sentences:
on_Tween_tween_completed not triggering I'm using this script to print out my text in a textbox one character at a time, and to do this I'm using a Tween. I have this set up so that when the Tween sends the tween_completed signal, then the variable finished becomes true. But for whatever reason, the tween_completed signal never gets sent. Does anyone see a reason that the signal wouldn't be sent? Thank you!
extends Control

var tempdialog = [
    'Super Animal Racing is shaping up to be a great game!',
    'Thomas is so good at programming omg!',
    'Isn\'t this so exciting?'
]

var dialog_index = 0
var finished = false
var totalcharacters = 0

func _ready():
    load_dialog()

func _process(delta):
    $AnimatedSprite.visible = finished
    print("visible", finished)
    if Input.is_action_just_pressed("jump"):
        load_dialog()

func load_dialog():
    if dialog_index < tempdialog.size():
        finished = false
        $RichTextLabel.bbcode_text = tempdialog[dialog_index]
        $RichTextLabel.percent_visible = 0
        $Tween.interpolate_property(
            $RichTextLabel, "percent_visible", 0, 1, 1,
            Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
        )
        $Tween.start()
    dialog_index += 1

func _on_Tween_tween_completed(object, key):
    print("tweentrigger")
    finished = true
```

sentences:
Circle to Circle Collision of moving Sprites i needed help attaching circle1 Sprite to circle2 Sprite on collision onto the same point where they are getting collided, and both circles are moving with Action.
Like this,

Attaching means, when circle1 and circle2 sprites get collided, i am removing circle1 Sprite from scene and creating new sprite at that same position of circle1.

I have implemented following code for collision
....
float dx = circle1.x - circle2.x;
float dy = circle1.y - circle2.y;
float distance = Math.sqrt(dx * dx + dy * dy);

if (distance < circle1.radius + circle2.radius) {
    // collision detected
   // removing older sprite
   // creating of new sprite
}

Its working perfectly when one circle sprite in motion and another is static.

But when both are in motion, at some points ( collision point like bottom-left/ up-right of circle2 ) its get attached little over circle2 sprite and it happens at random times so i couldn't able to detect the error.

I want to attach new Sprite at exact point where collision occurred like this,

Anybody have done it before..

sentences:
Detecting End of Animation So I am making a death animation for a game. enemy1 is a UIImageView, and what I'm doing is when an integer is less than or equal to zero, it calls this deathAnimation which only happens once. What I want to do is use a CGPointMake right when the animation is finished being called. Note that before the deathAnimation is called, there is another animation that is constantly being called 30 times a second. I'm not using anything like cocos2d.

if (enemy1health <= 0) {
    [self slime1DeathAnimation];
    //How can i detect the end of this animation
}

This is how the animation is done:

-(void)slime1DeathAnimation{
    enemy1.animationImages = [[NSArray alloc] initWithObjects:
                              [UIImage imageNamed:@"Slime Death 1.png"],
                              [UIImage imageNamed:@"Slime Death 2.png"],
                              [UIImage imageNamed:@"Slime Death 3.png"],
                              [UIImage imageNamed:@"Slime Death 4.png"],
                              [UIImage imageNamed:@"Slime Death 5.png"],
                              nil];
    enemy1.animationDuration = 0.5;
    enemy1.animationRepeatCount = 1;
    [enemy1 startAnimating];
}

If you need more code just ask

sentences:
How do I produce "enjoyably" random, as opposed to pseudo-random? I'm making a game which presents a number of different kinds of puzzles in sequence. I choose each puzzle with a pseudorandom number. For each puzzle, there are a number of variations. I choose the variation with another pseudorandom number. And so on.

The thing is, while this produces near-true randomness, this isn't what the player really wants. The player typically wants what they perceive to be and identify as random, but only if it doesn't tend to repeat puzzles. So, not really random. Just unpredictable.

Giving it some thought, I can imagine hacky ways of doing it. For example, temporarily eliminating the most recent N choices from the set of possibilities when selecting a new choice. Or assigning every choice an equal probability, reducing a choice's probability to zero on selection, and then increasing all probabilities slowly with each selection.

I assume there's an established way of doing this, but I just don't know the terminology so I can't find it. Anyone know? Or has anyone solved this in a pleasing way?

sentences:
Finding tileX and tileY based on x and y (and vice versa) in isometric 2D view I'm working on 2d Isometric game in ruby and gosu, although my problem is probably universal. My map is saved in 2d array:

@map_tiles[layer][y][x] = tile_id

Each tile is displayed on coordinates:

isoX = (x * @tile_width/2) - (y * @tile_height)
isoY = ((x * @tile_width/2) + (y * @tile_height)) / 2

So it's displayed in "diamond" like way. But I'm having a problem with calculating two things.
- Entity's tile_x and tile_y (on which tile is the entity positioned) when given x and y, and;
- Entity's x and y when I'm sending it's tile_x and tile_y.

One method is pretty much the other one reversed. I tried various methods I found over internet, but either I'm doing something wrong, or I don't understand the instructions correctly. The closest I got is:

@x = (tile_x * 32) - (tile_y*32)
@y = ((tile_x * 32) + (tile_y * 32) / 2)

for finding @x and @y based on tiles (player "teleportation" method), and

@tile_x = ((@x / 32) + (@y / 32)) / 2
@tile_y = ((@y / 16) - (@x / 32)) / 2

But they kinda don't work correctly.
- When I send player to tile position (4, 3), he is displayed at (5, 4), and after recalculating it's tile_x/y position, printing says it is at tiles (3,5)
- When I send player to tile position (3, 4), he is displayed at (4, 5), and after recalculating it's tile_x/y position, printing says it is at tiles (2,5)
- When I send player to tile position (4, 2), he is displayed at (5, 3), and after recalculating it's tile_x/y position, printing says it is at tiles (2,5)

So you can clearly see that something's not right here.

That's pretty much it, thanks in advance. I can post the code on github if it's neccessary, but I reckon the problem lies in what I posted.

sentences:
How do physics bones relate to animation bones? Skinned animations use a tree of bones where the child bone (say a finger) is the weighted sum of the rotations of all it's parent bones. Physics bones are defined as a rotation matrix of a primitive (a cube) that has its position constrained by each of its child bones.

Is there any correlation with how they map to each other?
Can a physics bone be used in-place of an animation bone?

Thanks in advance.

sentences:
Unity - Save/load in a sandbox game, how to instantiate saved objects I have a game where a player can place GameObjects.

I can  save/load this GameObjects data with using JSON, for example its position, but I cannot think of a good way to tell my save-file (and my load) what Prefab it needs to instantiate at position X.

How I could this be done in a clever way?

sentences:
How to reference UnityEditor in external DLL when using UnityVS, successfully? So I'm trying to put my scripts and custom inspector editor scripts in two external DLLs and I'm facing a problem on my Editor DLL.
First of, I'm using UnityVS with Visual Studio 2013 Ultimate.

I added a reference to C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.dll and it successfully shows me IntelliSense and I can access all classes and it's members, too. But when I try to compile the build, it will complain not finding the assembly UnityEditor. Even referencing the same DLL like the UnityProject (inside the Library folder) results in that problem, as it's just a copy of installed UnityEditor.dll.

I even tried to open this project in a separate Visual Studio and build it, got the same result.

I've heard, placing the resulting DLL in the Editor folder will make the custom inspectors available, so I really wish this would compile.

sentences:
CLR Profiler Allocated Bytes and XNA ContentManager I've been fighting with XNA ContentManager and memory allocations for some weeks because I'm trying to port my game from XNA (Windows) to ExEn / Monotouch (iphone).

The problem is that after playing a few levels, my game exits unexpectedly on a real iPhone device (not simulator).

Profiling memory usage on Windows with CLRProfile, I found some useful stuff but I also found something I dont understand. If I use 2 ContentManagers (1 for shared assets and 1 for level assets), when profiling, "Allocated Bytes" grows and grows after level through level but Memory consumption measured by Windows Task Manager stays constant (down when I unload the content manager and up again when I load content). Obviously, I contentManager.Unload() when level ends. After a few levels my game exits unexpectedly on an iPhone device.

If I use 1 content manager, "CRLProfiler Allocated Bytes" stays constant on Windows and on the iPhone; I can play the game normally and it doesnt exit unexpectedly. I use the same assets level through level.

It seems like in ios (iPhone) when loading and unloading the same assets, it allocates memory and consumes all device memory, so the ios kill it.

Can anybody explain me how this really works?
I've read quite a bit, but I still don't understand what's going on.

sentences:
What component should hold the character movements in ecs and fsm? In the below code, there's a FSM for CharacterState that will be handled also in CharacterSystem. The problem was, I don't know what component should hold movements data to process in CharacterState or CharacterSystem

public class CharacterState implements State<Entity> {
    STANDING,
    WALKING,
    RUNNING,
    IN_PAIN,
    DEAD
}

public enum Movements {
    STAND_STILL,
    MOVE_UP,
    MOVE_DOWN,
    MOVE_LEFT,
    MOVE_RIGHT,
    MOVE_UP_RIGHT,
    MOVE_UP_LEFT,
    MOVE_DOWN_RIGHT,
    MOVE_DOWN_LEFT;
}

CharacterComponent implements Component {
    Movements movement
}

MovementComponent implements Component {
    Movements movement
}

AnimationComponent implements Component {
    IntMap<Animation> map = new IntMap<Animation>();
}

animation.map.put(Movements.MOVE_UP.order, ASSET.CHAR_MOVE_UP);

sentences:
Unity UI Chat Message Expanding Bubble How do you set up Unity's UI Layout system so that the chat bubble changes in size automatically based on the length of the text? What's the right use of Layout and Content Size Fitter elements?
How do you turn
into

sentences:
How do I find a unit vector of another in Java? I'm writing a Java formula based on this tutorial: 2-D elastic collisions without Trigonometry. I am in the section "Elastic Collisions in 2 Dimensions". Part of step 1 says:

  Next, find the unit vector of n, which we will call un. This is done by dividing by the magnitude of n.

My below code represents the normal vector of 2 objects (I'm using a simple array to represent the normal vector).

int[] normal = new int[2];
normal[0] = ball2.x - ball1.x;
normal[1] = ball2.y - ball1.y;

I am unsure what the tutorial means by dividing the magnitude of n to get the un.

What is un? How can I calculate it with my Java array?

sentences:
Moving along the surface of a mesh? I'm trying to replicate the movement in this game: https://www.youtube.com/watch?v=OcvD8BXars8

The players ship along with all other game elements move along the surface of a mesh.

I've tried replicating this by ray-casting down on the mesh to have an idea of the up direction which is fairly straightforward, the problem is rotating the object on the axis of that normal such that the front is always facing the way the player intended (when the player is moving on the mesh the hit normal changes throwing everything off).

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:
Input handling between game loops This may be obvious and trivial for you but as I am a newbie in programming I come with a specific question.

I have three loops in my game engine which are input-loop, update-loop and render-loop. Update-loop is set to 10 ticks per second with a fixed timestep, render-loop is capped at around 60 fps and the input-loop runs as fast as possible. I am using one of the Javascript frameworks which provide such things but it doesn't really matter.

Let's say I am rendering a tile map and the view of which elements are rendered depends on camera-like movement variables which are modified during key pressing. This is only about camera/viewport and rendering, no game physics involved here.

And now, how can I handle input events among these loops to keep consistent engine reaction? Am I supposed to read the current variable modified with input and do some needed calculations in a update-loop and share the result so it could be interpolated in a render-loop? Or read the input effect directly inside the render-loop and put needed calculations inside?

I thought interpreting user input inside an update-loop with a low tick rate would be inaccurate and kind of unresponsive while rendering with interpolation in the final view. How it is done properly in games overall?

sentences: XML serialization error on XBOX 360 When try to save game on an xbox with xml serialization i get a code 4 error. I made sure t oadd all the xml referances and there is no errors until i run the game. Any suggestions?

sentences:
Display a variable in the UI I have been searching and searching for an answer to this question but nobody seems to be helping me. I have wasted the past two hours trying to figure out how to do this, so please help me out here.

I am making a FPS game in Unreal Engine 4, and I want to display ammo. I can do that fine, but changing the text of the UI displaying the ammo is turning into a nightmare. I need to access the text label variable

Inside of the blueprint that handles the actual gun firing

From there I should be able to adjust the text to match what my ammo is.

Unfortunately, no matter what I try, I cannot change the variable in my blueprint. I can't even make the variable public to begin with! What do I need to do to accomplish this?

sentences:
I can't find a way to make my projectile gameobject collide with my ofscreen collider so my code on my collider is as followed

public class Collide : MonoBehaviour
{

    private void OnCollisionEnter2D(Collision2D collision)
    {
        Debug.Log("Collision");
    }
}

the projectile has a rigidbody2D and a capsule Collider 2D.

collider has a box collider 2D.

the projectile spawns from my player and moves upwards in the direction of the collider (the collider is large enough that the projectile cant miss it).

the projectile however goes straight through the collider and no message appears and I have no idea why.

what I've tried and made sure of :

both are on the same layer and plane(z axis)
gave the collider a rigidbody but changed nothing
made the collider on trigger and not on trigger
made the projectile dynamic and kinematic
changed collider script to onCollisionEnter and onCollisionEnter2D

sentences:
Closest node in A* pathfinding For my 2D Unity game, I've implemented A* pathfinding based on waypoints. System already handles building graph from waypoints on scene (which are manually placed objects), as well as finding and caching closest routes.

So, general idea is to select closest waypoint to character, closest waypoint to target position, and use pathfinding algorithm to find closest route (which is pre-cached already).

Yet, I've stumbled into issue - I don't know how to actually get closest waypoint. Well, there are several ways I think of, in the worst case I can just brute-force closest non-blocked waypoint from the collection, but that would be bad performance-wise.

So, are there any proper ways to get start or end points?

sentences:
Unity "Convert To Entity" does not work (Render) with "Skinned Mesh Renderer" for Animations I'm trying to make a game with Unity's ECS and Job System.

I came across the issue where, Convert To Entity does not support Skinned Mesh Renderer. It does not render the mesh. I need it for animations.

On the bright side, Game Object Entity does render Skinned Mesh Renderer. The downside is that, it does not support Physics Shape and Physics Body. Convert To Entity does.

I am using Physics Shape and Physics Body for physics.

Would anyone mind telling me what options are open to me?

sentences:
Check legal movement on grid map i'm trying to develop a simple multiplayer turn base game, i'm start creating the grid map, i have already write the javascript script to display the range movement for the specific unit, but my problem is how to check if the grid position sent to server by the client is a valid position, i think this is a operation to do on server side (i use php) because javascript is easy editable by the user, my first throught is to save in a database each tile and its data (example: is a water tile, a forest tile...), so when the position is send to server i can read the db and check if the position is valid, but i think this method is very slow and require a lot of server resources, so there is a better way to do this?
(i don't know if this is the correct site or is a question for StackOverflow)

sentences:
How to rotate a local position offset based on a direction vector? I'm trying to fire three raycasts in the direction of movement, from offset starting points. I'm having trouble calculating the start positions of the rays based on the direction.

As you can see in the animation, the three parallel lines in the middle overlap when moving upwards using the code below, but I want them to remain evenly spaced.

I cannot use transform.right (up/etc) etc because the transform is always facing the same direction by design. Instead I am using the currentDirection which is the normalized last movement velocity.

I want the lines to always be evenly spaced based on the direction the object is moving without rotating the actual transform - the problem is I don't know the math behind it and have spent last several hours trying to figure it out.

Current code:

Debug.DrawRay(this.transform.position, currentDirection * (avoidObjectsScanDistance + 0.05f), Color.blue, 0.09f);
Debug.DrawRay(this.transform.position + new Vector3(0, 0.1f, 0), currentDirection * (avoidObjectsScanDistance + 0.05f), Color.magenta, 0.09f);
Debug.DrawRay(this.transform.position + new Vector3(0, -0.1f, 0), currentDirection * (avoidObjectsScanDistance + 0.05f), Color.blue, 0.09f);

I've tried to get the position based on direction by using

var drawRayTopPos = currentDirection * localpos + position;

sentences:
How can I change the anchor point of a Pyglet sprite? while trying to make my game, I noticed that you can't change the anchor point of Sprites in pyglet.
I use some convoluted way(see bottom of the post) to draw my minimap(WIP) so that the rooms are centered and lined-up correctly, however, I thought of the following occurence.

I'll be using the mouse-pointer to direct a 2D person from the top. However, if the anchor point of a sprite is the bottom-left corner of the orginal image, how can you make it feel as though the anchor point is in the middle of the sprite.

This may not be so important for the Player, but it would be hell to algorithmically controll the NPC's that fight.

Any help and input appreciated.

Code:

        pic_img = image.load(imgPath)
        picX, picY = window.width/2,window.height/2
        pic = pyglet.sprite.Sprite(pic_img, x=picX, y=picY)
        pic.rotation = roomType.ImageRotation

        if pic.rotation == 0:
            picX = picX - pic.width / 2
            picY = picY - pic.height / 2
        elif pic.rotation == 90:
            picX = picX - pic.width / 2
            picY = picY + pic.height / 2
        elif pic.rotation == 180:
            picX = picX + pic.width / 2
            picY = picY + pic.height / 2

        elif pic.rotation == 270 or pic.rotation == -90:
            picX = picX + pic.width / 2
            picY = picY - pic.height / 2
        pic.x,pic.y = picX, picY

sentences:
Why are examples of game textures often represented on a sphere model? I have recently started working with Unity and was looking for textures for the background (castle walls and such pieces) on a game that I am thinking about eventually building. I noticed that the textures are often represented as ball shaped, such as for example in this sample image here:

For example, why are the texture patterns not shown as simply flat squares? I guess there is a reason behind this that has to do with mapping to 3d surfaces but I was not sure so I wanted to check here.

Why are textures often represented in spherical shapes in examples and previews?

sentences:
How do I make an infinitely scrolling background? I am trying to make a game where a torpedos keep coming from random directions and the player has to maneuver a submarine to escape them.

I am currently offsetting the background to give it an illusion that the submarine is moving i.e. if the submarine moves forward, I move the background (quad) backwards. This is primarily being done as I want it to be an infinite space. The position of the submarine does not change, the player just controls the rotation of the submarine and the background moves in the opposite direction. The background is set to repeat to give it an infinite space illusion.

The torpedo gets spawned at a random distance and moves towards the submarine. Since, the position of the submarine does not change, the torpedo will always hit the submarine. How do I structure this game, specifically the background repeat so that I can actually move the submarine in absolute dimensions and still maintain the infinite space illusion?

sentences:
How can I "stick" objects to tables in Skyrim and still allow those objects to be player-interactable? I'm trying to place a non-static pot (RuinsPot01) on a table (RuinsAltar) with the Havok simulation.

I place the pot a little bit above the table and turn on Havok. The pot falls down but is left floating slightly above the table.

If I turn of Havok and press F it is aligned correctly to the table, but as soon I turn on Havok Simulation, it jumps up slightly and floats as before.

Does any one have a fix for this? Making the pot static isn't an option, it has to be movable.

sentences:
Pre-existing voxel tools/libraries for Java I want to do some development using voxel data as well as rendering it. My interest is more in the project its self, rather then things like working out rendering optimization techniques and working efficiently with large data sets, which I know have been done a billion times by other people.

However, all the existing libraries I can find seem to be for other languages. I have found PolyVox, which seems great, but I'd really much rather use Java for this.

Are there any fleshed out libraries? If not,I'm assuming I'm stuck using LWJGL and building something from scratch. Can anyone recommend some thorough tutorials on the subject?

Thanks so much.

sentences:
How do I implement pixel-exact collision server-side? Recently I made a 2D offline game with HTML5 Canvas and JavaScript.  I'm detecting collisions by first checking whether image bounding boxes overlap.  If they do, I check against the bounding boxes, to see if there are any pixels that exist in the same location for both images.

I learned the technique from this tutorial (YouTube).

Now I'm making a multi-player version of the game, in a client-server configuration.  I've decided to have the server handle all physics, including collision.

However, I'm not sure how to implement that. Since the images are drawn client-side, the server cannot access image's data to do the pixel collision tests.  I can make bounding boxes on the server side, but how do I detect pixel collisions?

Tech details: I intend to write the server in node.js, using either CouchDB or MongoDB as my database.

sentences:
XNA Strange Lighting, Shader Hey guys, i have strange lighting problem.
I've written my own "deferred lighting" shader and this happend:

Pic: Normal-Map
Pic: Light-Map

As long as i only use one big mesh everything seems okay, but this look pretty wrong.

Here is how i calculate the point light map (http://www.packtpub.com/article/advanced-lighting-3d-graphics-xna-game-studio-40):

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
  // Find the pixel coordinates of the input position in the depth
  // and normal textures
  float2 texCoord = postProjToScreen(input.LightPosition) + halfPixel();
  // Extract the depth for this pixel from the depth map
  float4 depth = tex2D(depthSampler, texCoord);

  // Recreate the position with the UV coordinates and depth value
  float4 position;
  position.x = texCoord.x * 2 - 1;
  position.y = (1 - texCoord.y) * 2 - 1;
  position.z = depth.r;
  position.w = 1.0f;

  // Transform position from screen space to world space
  position = mul(position, InvViewProjection);
  position.xyz /= position.w;
  position.w = 1;

  // Extract the normal from the normal map and move from
 // 0 to 1 range to -1 to 1 range
 float4 normal = (tex2D(normalSampler, texCoord) - .5) * 2;

 // Perform the lighting calculations for a point light
 float3 lightDirection = normalize(LightPosition - position);
 float lighting = clamp(dot(normal, lightDirection), 0, 1);

 // Attenuate the light to simulate a point light
 float d = distance(LightPosition, position);
 float att = 1 - pow(d / LightAttenuation, LightFalloff);

 // Calculate the specular Component
 float3 R = normalize(2 * max(0,dot(normal, lightDirection)) * normal - lightDirection);
 float4 specularComponent = pow(saturate(dot(R, normalize(CameraPosition - position.xyz))), LightShininess);

 return float4(LightColor * att * lighting  + LightColor * att * specularComponent, 1);
}

I don't really know why, but Blender is the root problem here; causing the exact same issue. I would appreciate any tip to solve that problem.

sentences:
What pattern is used to render tiles? I want to render a tile-based map and I am not sure which class structure to use to keep logic and rendering separeted.

My class structure so far on the logic side: One abstract parent class Tile with an attribute int tileType and one class extending Tile for every kind of tile. Every of the extending class defines the value, for example in the class Tree extends Tile I have tileType = 2 and in the class Wall extends Tile I have tileType = 3.

When I render a map, I go through the array of tiles and do something like this:

switch (tileType) {
...
case 2: texture = treeTexture; break;
case 3: texture = wallTexture; break;
...
}
draw(texture, x, y);

I wonder if the class structure makes sense and if this is a good solution to render tiles? Or what other solutions are there to render tiled maps while keeping logic and rendering separated?

sentences:
Player positions in a race game through arrays or...? First time posting on these forums so go easy on me!

I've been programming a race game which has been going quite well. I've just discovered now how hard it is to set up player positions!(As in 1st, 2nd, 3rd, etc). From research I've discovered that the easiest way of doing this is through checkpoints which I've successfully managed to set up. Each player races through the checkpoints in the game and this progress is stored as an int. There's 2 int, one for laps and one for checkpoints. When the checkpoint integer reaches a certain number it resets back to zero and the lap integer is incremented.

I was planning to compare these to work out player positions. Hopefully by putting them into arrays and then sorting them so it could tell me the player's positions in the race as the person with the high lap and checkpoint count would surely be the highest ranked.

Also to make the measuring of player positions more accurate I've measure the distance between checkpoints. At each checkpoint it works out how far the player is from the next point and using the distance from the previous to the next I'm able to generate a percentage which tells me how far the player is from the lap.

What I was hoping to do is create an integer worked out from the players race progress. So for example going through a checkpoint would increment the player's race progress integer by 100. If there were 12 checkpoint a complete lap would obviously be 1200. 2 laps would be 2400 and so on. By inverting the percentage I generated earlier it gives me the distance to the next checkpoint. so for example a player 75% towards the 4th checkpoint in their first lap would have an integer of 375, whereas a player 50% towards the first checkpoint in their second lap would have an integer of 1250.

I hope that logic made sense.

So what I'm essentially looking to create is a sort of table, using the player's object or even a unique player id as an index. And then to sort this table by the player position int.

I think this maybe possible through multidimensional arrays but I'm quite unsure. I've looked into associative arrays, dictionaries and hashtables but I'm still pretty unclear on what to do.

Would really appreciate being pointed in the right direction.
Thanks!

sentences:
How to implement scripted events? I'm building a game in C++ (using SDL) for a college project, I'm trying to figure out how to script events that happens when a player does something, or some time passes etc.

I have a and idea of how to do it but I don't want to go against how it's commonly done.

Right now I have a class called Obj from where enemies, items and the player are child classes, my idea is to add 3 public variables to it like this:

class Obj{
    int eventDeath,eventTouch,eventTalk,eventMeet;
}

Then I could create an Obj with eventDeath=1 and when it died it would fire event(1). event() would be something like this:

void event(int n){
   switch(n){
   case 1:
      dialog("I'm dying");
      break;
   }
}

I could also add invisible "Obj" in specific places for when a player walks over a certain place. I don't know if this is a good idea but I can't think of other means to do it. How is it commonly done? Also how do I keep track of events that already happened?

sentences:
Slots Machine Matching feature I'm designing a slot machine.

I need to find the number of combinations that two matching icons will appear side-by-side in a 3X5 window (3 rows, 5 reels (columns))

A match gives the user some payout.

Having the following assumptions: Icons: H1, H2, X (all the rest). Matching Icons: should meet on the same row (side by side) (wild doesn't count here)

Window is as follows:

|   |   |   |   |   |
---------------------
|   |   |   |   |   |
---------------------
|   |   |   |   |   |

I have listed all possible options, and now I would like to get the exact number of combinations per each option.

Example of what I need:

The number of possibilities for this kind of scenario (1 of 72 possible ones):

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | X | X |

Number of H1 icons on reels 1-5: R1_H1, R2_H1, R3_H1, R4_H1, R5_H1

Number of H2 icons on reels 1-5: R1_H2, R2_H2, R3_H2, R4_H2, R5_H2

Number of all icons on reels 1-5: RL1, RL2, RL3, RL4, RL5 (respectively)

Some more examples:

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | H1| H2|

| H1| H2| H2| H1| X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | X | X |

And so on.. the only limitation I put is that H1 and H2 icons on the same reel have distance between them so I won't have kind of the following scenario:

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | H1| H2| X | X |

sentences:
What's the difference between XNA Game Services and glorified global variables? The Microsoft.Xna.Framework.Game class has a Services property that allows the programmer to add a service to their game by providing the type of the class and an instance of the class to the Add method.

Now, instead of having to pass an AudioComponent to all classes and methods that require it, instead you just pass your Game instance and look up the service. (Service Locator)

Now, because games have many services (GraphicsDevice, SceneGraph, AudioComponent, EffectsManager, et cetera), you will now basically be passing Game to everything.

So why not just make these instances a Singleton? Well, because Singletons are bad because they have a global state, prevent testing, and make your design much more brittle. Service locators are equally considered to be an anti-pattern to many because instead of just passing the dependency to an object, you pass a service locator (the Game) which couples that class with the rest of the services.

So then why are Services recommended in XNA and game development? Is it because games are different from regular programs and are highly intertwined with their components and having to pass every component necessary for the functioning of a class would be highly cumbersome? Are Game Services just then a necessary evil in game design? Are there alternatives that don't involve lengthy parameter lists and coupling?

sentences:
Fill all unallocated space with texture I have a system of bunkers underground, and I need to fill all the free space where there are no buildings - with earth. Yes, I can manually add a ground texture to the plane, but I have procedural level generation.
I thought there might be some kind of filter on the camera that I don't know about. Or maybe there are some other solutions?

sentences:
How can I deactivate and activate a button? I have a code that keeps a gameObject between scenes, the theme is that this gameObjecte has as a child a button, which I can change the linerenderer color, besides changing the image of the button according to the selected color and thus keep the data between scenes. then when I change to the next scene I deactivate the button with the meteodo "dehabilitar()"  and in the others it is not necessary, then when I change to the next scene I deactivate the button and it is not shown, but when I go back to the next scene and call the function " habilitar() "the button is not displayed. If someone can help me in what I have bad in the code or what I lack?

PS: I did different methods to activate and deactivate the button but the same thing always happens and I leave it like that for a while.

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

namesp

ace DigitalRubyShared
    {
        public class CambioColor : MonoBehaviour
        {

            public Button mybutton;
            public LineRenderer p1;
            public LineRenderer p2;
            public Sprite colorRojo;
            Color Rojo = new Color(1, 0, 0, 1);
            public Sprite colorAzul;
            Color Azul = new Color(0, 0, 1, 1);
            public static int counter = 0;

            public static bool estado = false;

            public static CambioColor estadoCambioColor;

            void Awake()
            {
                if (estadoCambioColor == null)
                {
                    estadoCambioColor = this;
                    DontDestroyOnLoad(gameObject);
                }
                else if (estadoCambioColor != this)
                {
                    Destroy(gameObject);
                }

            }

            void Start()
            {
                mybutton = GetComponent<Button>();
                p1 = GetComponent<LineRenderer>();
                p2 = GetComponent<LineRenderer>();

                counter = 2;
            }

            public void changeColor()
            {

                counter++;

                if (counter == 1)
                {
                    mybutton.image.overrideSprite = colorAzul;
                    //mybutton.image.sprite = colorAzul;
                    p1.startColor = Azul;
                    p1.endColor = Azul;
                    p2.startColor = Azul;
                    p2.endColor = Azul;

                }
                if (counter == 2)
                {
                    mybutton.image.overrideSprite = colorRojo;
                    //mybutton.image.sprite = colorRojo;
                    p1.startColor = Rojo;
                    p1.endColor = Rojo;
                    p2.startColor = Rojo;
                    p2.endColor = Rojo;

                    counter = 0;
                }

            }

            public void dehabilitar()
            {
                if (estado == false)
                {
//mybutton.enabled = estado;
                    mybutton.gameObject.SetActive(estado);
estado = true;
                }
            }

            public void habilitar()
            {
                if(estado == true)
                {
//mybutton.enabled = estado;
                    mybutton.gameObject.SetActive(estado);
                    estado = false;
                }

            }

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

            }
        }

    }

sentences: Unity Applying Global Light Settings fog to a non-main camera Is it possible to apply fog to a non-main camera?

sentences:
What is the difference between these options when saving an image as a PNG in Photoshop for my game? I'm creating sprites and tilemaps for 2D games. I might just use Unity.

What is the impact of choosing different options when saving as a .png?

sentences:
How can I scroll/animate up lines reading from a string to ui text? This is the reading lines code :
if (primaryTarget != null)
            {
                var lines = primaryTarget.description.Split('\n');
                text.text = "Item found: " + primaryTarget.description;
            }
            else
            {
                text.text = "";
            }

And this is the script of the description :
The script is attached to each interactable target(item) :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class InteractableItem : MonoBehaviour
{
    public enum InteractableMode // your custom enumeration
    {
        Description,
        Action
    };

    public InteractableMode interactableMode = InteractableMode.Description;

    public float distance;

    private bool action = true;

    [TextArea(1, 10)]
    public string description = "";

    public void ActionOnItem()
    {
        if(interactableMode == InteractableMode.Action && distance <= 5f && action == true)
        {

            action = false;
        }
    }
}

Depending on the amount of text in the string I want to show it in the ui Text.
If there is one line then just show the text or even if there are two lines.
but if there is a lot of text then split the lines and scroll the lines smooth up so the first line will be disappear or pushed up and bottom lines will come up.
In the screenshot you can see on the left the text that show in the ui text on the right the text of the description. The ui text can't show all the text and I don't want the text to overlap other ui's or objects so the idea is to make the text slowly smooth scrolling up.

sentences:
How to rotate a sprite in 2D with LWJGL3 and GLSL I have all the basic rendering already set up, with translation, scaling etc. What matrix(s) and/or vector(s) do I need to multiply/add with my existing code to rotate an object.

Preferably around a point given by a vector2fa, also only in degrees because quaternions aren't implemented and its only 2D not 3D.

Snippet of the vertex shader:

gl_Position = transformation * vec4(position, 1.0) + translation

Where transformation is done in java as (Note not actual code as * is replaced with .mul()):

Matrix4f transformation = ortho * scale

And translation is given by a method:

Vector4f translation = new Vector4f(x , y , 0f, 0f).mul(gc.getOrtho());

All the code listed before works as expected. It is just lacking the rotation feature mentioned at the top.

How can I add rotation to my code?

sentences:
Chartboost Adds are not showing up in android I am testing chartboost example but no adds are being shown up. I have added app ID and signature. and Even test mode is enabled still its not showing up.

I am using chartboost SDK Provided by chartboost, also I am getting this warning

CHARTBOOST: You are using a Chartboost example App ID or App Signature! Go to the Chartboost dashboard and replace these with an App ID & App Signature from your account!

Though I have added correct ID and Singnature.

Note: Adds are showing up if I build for iOS. I have added app in dashboard for both iOS and android.

sentences:
How can I render a JBox2D ParticleGroup? I want to render a ParticleGroup from JBox2d using OpenGL.  I've managed to define a particle group area, but I'm unsure how to draw the individual particles.

Here's how I create the ParticleGroup:

m_world.setParticleRadius(0.15f);
m_world.setParticleDamping(0.2f);

PolygonShape shape = new PolygonShape();
shape.setAsBox(8, 10, new Vec2(-12, 10.1f), 0);
ParticleGroupDef pd = new ParticleGroupDef();
pd.shape = shape;
m_world.createParticleGroup(pd);

This is how I draw a normal Square (which I don't know how to apply to groups of particles):

public void draw(GLAutoDrawable gLDrawable, Vec3 position, float angle){

    gLDrawable.getGL().getGL2().glEnable(GL.GL_BLEND);
    gLDrawable.getGL().getGL2().glEnable(GL.GL_TEXTURE_2D);

    gLDrawable.getGL().getGL2().glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);

    gLDrawable.getGL().getGL2().glBindTexture(GL2.GL_TEXTURE_2D, TextureFactory.getTextureIndex(TextureCollection.valueOf(getTextureSelection())));
    gLDrawable.getGL().getGL2().glPushMatrix();

    gLDrawable.getGL().getGL2().glTranslatef(position.x * getP2M(), position.y * getP2M(), position.z);
    gLDrawable.getGL().getGL2().glRotated(Math.toDegrees(angle), 0, 0, 1);
    gLDrawable.getGL().getGL2().glBegin(GL2.GL_QUADS);
    gLDrawable.getGL().getGL2().glTexCoord2f(0.0f, 0.0f);
    gLDrawable.getGL().getGL2().glVertex3f(-getWidth() / 2 * getP2M(), -getHeight() / 2 * getP2M(), 0.0f);
    gLDrawable.getGL().getGL2().glTexCoord2f(0.0f, 1.0f);
    gLDrawable.getGL().getGL2().glVertex3f(-getWidth() / 2 * getP2M(), getHeight() / 2 * getP2M(), 0.0f);
    gLDrawable.getGL().getGL2().glTexCoord2f(1.0f, 1.0f);
    gLDrawable.getGL().getGL2().glVertex3f(getWidth() / 2 * getP2M(), getHeight() / 2 * getP2M(), 0.0f);
    gLDrawable.getGL().getGL2().glTexCoord2f(1.0f, 0.0f);
    gLDrawable.getGL().getGL2().glVertex3f(getWidth() / 2 * getP2M(), -getHeight() / 2 * getP2M(), 0.0f);
    gLDrawable.getGL().getGL2().glEnd();
    gLDrawable.getGL().getGL2().glFlush();
    gLDrawable.getGL().getGL2().glPopMatrix();

    gLDrawable.getGL().getGL2().glDisable(GL.GL_TEXTURE_2D);
    gLDrawable.getGL().getGL2().glDisable(GL.GL_BLEND);
}

How should I do this?  (Example code would be great.)

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: 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 are these physics formulas translated to this code? So how exactly does something like \$v_f = v_i +a*t\$
translate to something like self.vel += self.acc in code?
or \$d=v_i*t+\frac{a*t^2}{2}\$ translating to self.pos += self.vel + 0.5 * self.acc there seems to be variables missing, and summations happening that aren't part of the formulas.

sentences:
How do I use _com_ptr_t with RenderTargetView and DepthStencilView? I have successfully used _com_ptr_t with the ID3D11Device and IDXGISwapChain but when applying the same reasoning to the RenderTargetView and DepthStencilView, the function m_spD3DImmediateContext->OMSetRenderTargets(...) sets the m_spRenderTargetView smart COM pointer to null! Then, subsequent draw calls fail on ClearRenderTargetView and ClearDepthStencilView.

Is it because I am passing the smart pointer incorrectly?

HR(m_spD3DDevice->CreateRenderTargetView(pBackBuffer, 0, &m_spRenderTargetView));
...
HR(m_spD3DDevice->CreateTexture2D(&stDepthStencilDesc, 0, &m_spDepthStencilBuffer));
...
m_spD3DImmediateContext->OMSetRenderTargets(1, &m_spRenderTargetView, m_spDepthStencilView);
assert(m_spRenderTargetView); // <=== FAIL

I think the smart pointer overloads the operator& so that it returns an Interface** (see Extractors in _com_ptr_t class).

sentences:
How to synchronise the acceleration, velocity and position of the monsters on the server with the players? I'm building an MMO using Node.js, and there are monsters roaming around. I can make them move around on the server using vector variables acceleration, velocity and position.

acceleration = steeringForce / mass;

velocity += acceleration * dTime;

position += velocity * dTime;

Right now I just send the positions over, and tell the players these are the "target positions" of the monsters, and let the monsters move towards the target positions on the client with a speed dependant on the distance of the target position. It works but looks rather strange.

How do I synchronise these properly with the players without looking funny to them, taking into account the server lag?

The problem is that I don't know how to make use of the correct acceleration/velocity values here; right now they just move directly in a straight line to the target position instead of accelerating/braking there properly. How can I implement such behaviour?

sentences:
Can I achieve a torchlight effect (lighter area around a light source) in a 2D game? I am thinking of writing myself a simple 2D game. It will not shine with perfect graphics or gameplay at first, but I'd consider it my first step in PC game development. So, imagine such simple sprite-based 2D game (like Heroes IV or Startcraft BroodWar).

I want the gameplay to support day/night with the according lighting changes and at the same time it will be madness to have to create sprites for every lighting nuance. So, I decided adding a semi-transparent layer on top of other objects will be enough.

The issue with this solution is if I have a light source object in the game (like the hero wearing a torch, or a burning building), there must be a lighter area around it, right? Since I am putting my semi-transparent layer over everything, how would you suggest to achive the torchligt visual effect I want? Maybe redraw that layer adding 'gaps' or differently colored areas based on the lighting effect?

sentences:
Sorting sprites based on Z index I am working on a 2D game engine in C# using OpenGL. I am trying to find a collection to satisfy my needs for sprite ordering, and I can't seem to find the combination of performance and functionality.

The following is the criteria I am after:

The ability to be iterated over in order according to "Z" value, which may change for any sprite at any time
Possible for many sprites to be added/removed within a single frame, so sorting each time a value was added/removed will have large performance impact without the correct implementation
Insertion/removal speed is much lower priority than access speed during enumeration
Have no need for indexing
Only unique values, but with the correct collection, I can manage that manually if the base collection does not implement it, as I do in the example

Currently, this is the best I could come up with. (I removed all the interface implementations for clarity, leaving only the important stuff)

    public class SpriteBatch : ICollection<IRenderable>
{
    private readonly Dictionary<uint, IRenderable> _dict;
    private readonly List<uint> _keys;
    private bool _needSort;

    public SpriteBatch()
    {
        _dict = new Dictionary<uint, IRenderable>();
        _keys = new List<uint>();
        _needSort = false;
    }

    public void Add(IRenderable renderable)
    {
        if (renderable == null)
            throw new ArgumentNullException(nameof(renderable), "Item cannot be undefined.");
        if (_dict.ContainsKey(renderable.Id))
            return;
        _needSort = true;
        renderable.Disposed += (sender, args) => Remove(renderable);
        renderable.ZChanged += (sender, args) => _needSort = true;
        _keys.Add(renderable.Id);
        _dict.Add(renderable.Id, renderable);
    }

    public bool Remove(IRenderable renderable)
    {
        if (renderable == null)
            return false;
        _dict.Remove(renderable.Id);
        return _keys.Remove(renderable.Id);
    }

    public IEnumerator<IRenderable> GetEnumerator()
    {
        if (_needSort)
            _keys.Sort((a, b) => _dict[a].Z.CompareTo(_dict[b].Z));
        foreach (var key in _keys)
            yield return _dict[key];
    }
}

Was curious if anyone else had a better approach, or what the "standard" tried-and-true way of doing this is?

sentences:
How to determine the angular velocity needed move an object to a given position I am trying to move two lines joint to a fixed position sprite in a way similar to that of a pendulum. I would like the lines to swing from end to end each time. The image below shows what I want to achieve:

I'm moving the lines using angular velocity, but I'm not getting the pendulum/swinging effect (a cycle of the lines generally swinging faster as they move to the center and slowing down a bit when they change from one direction to another). I rather get some brisk movement then it slows down till the movement stops. Please see my SpriteKit code below:

extension Int {
  var degreesToRadians: Double { return Double(self) * .pi / 180 }
}
extension FloatingPoint {
  var degreesToRadians: Self { return self * .pi / 180 }
  var radiansToDegrees: Self { return self * 180 / .pi }
}

class GameScene: SKScene, SKPhysicsContactDelegate {

var anchorSprite = SKSpriteNode(imageNamed: "swingPin")
var armLeft = SKSpriteNode(imageNamed: "swingArm")
var armRight = SKSpriteNode(imageNamed: "swingArm")

override func didMove(to view: SKView) {

self.physicsWorld.gravity = CGVector(dx: 0, dy: -1.8)
self.physicsWorld.contactDelegate = self

var tealBg = SKSpriteNode(imageNamed: "tealBg")
tealBg.position = CGPoint(x: frame.midX, y: frame.midY)
tealBg.zPosition = 10
addChild(tealBg)

anchorSprite.position = CGPoint(x: frame.midX, y: frame.midY + frame.midY/2)
anchorSprite.zPosition = 20

anchorSprite.physicsBody = SKPhysicsBody(rectangleOf: anchorSprite.frame.size)
anchorSprite.physicsBody?.categoryBitMask = pinCategory
anchorSprite.physicsBody?.isDynamic = false
addChild(anchorSprite)

armRight.anchorPoint = CGPoint(x: 0.5, y: 1)
armRight.position = anchorSprite.position
armRight.zPosition = 20
armRight.physicsBody = SKPhysicsBody(rectangleOf: armRight.frame.size)
armRight.zRotation = CGFloat(Double(15).degreesToRadians)//CGFloat(Double.pi/6)
armRight.physicsBody!.isDynamic = true

addChild(armRight)

armLeft.anchorPoint = CGPoint(x: 0.5, y: 1)
armLeft.position = anchorSprite.position
armLeft.zPosition = 20
armLeft.physicsBody = SKPhysicsBody(rectangleOf: armRight.frame.size)
armLeft.zRotation = CGFloat(Double(-15).degreesToRadians)//CGFloat(-Double.pi/6)
armLeft.physicsBody!.isDynamic = true
addChild(armLeft)

// Create joint between two objects
//Pin joint
var pinAndRightArmJoint = SKPhysicsJointPin.joint(withBodyA: anchorSprite.physicsBody!, bodyB: armRight.physicsBody!, anchor: CGPoint(x: anchorSprite.position.x, y: self.armRight.frame.maxY))
self.physicsWorld.add(pinAndRightArmJoint)

var pinAndLeftArmJoint = SKPhysicsJointPin.joint(withBodyA: anchorSprite.physicsBody!, bodyB: armLeft.physicsBody!, anchor: CGPoint(x: anchorSprite.position.x, y: self.armLeft.frame.maxY))
self.physicsWorld.add(pinAndLeftArmJoint)

var fixArms = SKPhysicsJointFixed.joint(withBodyA: armLeft.physicsBody!, bodyB: armRight.physicsBody!, anchor: CGPoint.zero)
self.physicsWorld.add(fixArms)

pinAndRightArmJoint.shouldEnableLimits = true
pinAndRightArmJoint.lowerAngleLimit = CGFloat(Double(-60).degreesToRadians)
pinAndRightArmJoint.upperAngleLimit = CGFloat(Double(60).degreesToRadians)

}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
armRight.physicsBody?.angularVelocity = -100.0

}

Please note that though I believe this is the most appropriate approach to my problem, I'm open to another approach that would help me achieve the same result.

sentences:
Roguelike 2D Collision Detection I'm just a normal guy trying to do some basic collision detection but I suck at it. I either get stuck in a wall or I go in reverse in the wrong direction trying to update the player position to a non collision part. So here is how I check for collision and this function will return true or false. True if collision and false if not.

roguelike.player.collision = function() {
  var player = roguelike.player;
  for(var i = 0; i < roguelike.map.rooms.length; i++) {
    var room = roguelike.map.rooms[i];
    if(player.x > room.x && player.x < room.x + room.width && player.y > room.y && player.y < room.y + room.height){
      return false;
    }
  }
  return true;
};

This function works just fine just like expected. But it's when I try to stop the player when he hits a wall is where I get bugs. When the player goes down and hits a wall he gets stuck there. Here is the function that updates the player position.

roguelike.update = function() {
  var player = roguelike.player;

  //Left
  if(player.moving.left && !player.collision()) {
    player.x -= roguelike.game.speedPerSecond(player.speed);
  } else if(player.collision()){
    player.resetPosition();
  }
  //Up
  if(player.moving.up && !player.collision()) {
    player.y -= roguelike.game.speedPerSecond(player.speed);
  } else if(player.collision()){
    player.resetPosition();
  }
  //Right
  if(player.moving.right && !player.collision()) {
    player.x += roguelike.game.speedPerSecond(player.speed);
  } else if(player.collision()){
    player.resetPosition();
  }
  //down
  if(player.moving.down && !player.collision()) {

    player.y += roguelike.game.speedPerSecond(player.speed);
  } else if(player.collision()){
    player.resetPosition();
  }
  player.savePosition();

};

So what I do is check what direction the player is moving and if there is no collision detected then the player is free to move. Otherwise if there is a collision I put the player position as the last position he was when there was no collision so he will be free to move. This works going left, up, and right, but not going down. Going down the player gets stuck in the collision and the resetPosition function doesn't put the player back in the safe zone.

So I know there must be a better way. And I would appreciate your advice on what you think that way should be.

sentences: If I draw a rectangle, then extrude it, will it be identical to a box? If I draw a rectangle, then extrude it, will it be identical to a box? I mean, will bottom face be closed as in box?

sentences:
Switching bezierpath to follow SpriteKit swift I am trying to make it so that a SKShapeNode follows a UIBezierPath. Then when the screen is tapped it switches to another UIBezierPath to follow. I have this functionality working except that when the screen is tapped the shape node moves back to where it started. I want it so that when the screen is tapped the circle does not go back to where it starts. Here is my code.

override func didMoveToView(view: SKView) {
    //screenWidth and screenHeight
    screenWidth = view.bounds.width
    screenHeight = view.bounds.height

    // Set up the circle track
    let trackWidth = screenWidth/3

    let circleTrack = UIBezierPath(roundedRect: CGRectMake(screenWidth/2 - trackWidth/2, screenHeight/2  - trackWidth/2, trackWidth, trackWidth), cornerRadius: 100)
    let shapeTrack = SKShapeNode(path: circleTrack.CGPath, centered: true)
    shapeTrack.position = CGPointMake(screenWidth/2, screenHeight/2)
    shapeTrack.strokeColor = UIColor.whiteColor()
    self.addChild(shapeTrack)

    //Outside track
    outsideTrack = UIBezierPath(roundedRect: CGRectMake((screenWidth/2 - trackWidth/2) - trackWidth*0.08, (screenHeight/2  - trackWidth/2) - trackWidth*0.08, trackWidth + trackWidth*0.16, trackWidth + trackWidth*0.16), cornerRadius: 100)

    //Inside track
    insideTrack = UIBezierPath(roundedRect: CGRectMake((screenWidth/2 - trackWidth/2) + trackWidth*0.08, (screenHeight/2  - trackWidth/2) + trackWidth*0.08, trackWidth - trackWidth*0.16, trackWidth - trackWidth*0.16), cornerRadius: 100)

    //Set the default track
    track = outsideTrack

    // Create the ball
    circle = SKShapeNode(circleOfRadius: 15)
    //circle.position = CGPointMake(screenWidth/2, screenHeight/2)
    circle.fillColor = SKColor.whiteColor()
    self.addChild(circle)

    //Move the circle
    let followPath = SKAction.followPath(track.CGPath, asOffset: false, orientToPath: false, speed: 200.0)
    let repeatForever = SKAction.repeatActionForever(followPath)

    //Move the circle
    circle.runAction(repeatForever)
}

//Movement of circle
func movemementOfCircle(){
    if track == insideTrack{
        track = outsideTrack
    }else{
        track = insideTrack
    }

    //Actions
    circle.removeAllActions()
    //Move the circle
    let followPath = SKAction.followPath(track.CGPath, asOffset: false, orientToPath: false, speed: 200.0)
    let repeatForever = SKAction.repeatActionForever(followPath)

    //Move the circle
    circle.runAction(repeatForever)
}

sentences:
How can I animate 2d sprite rotation without interpolation? I would like to animate a weapon being swung in 2 frames - all I'm doing is changing the position and rotation of the weapon sprite. However, I don't want unity to interpolate the rotation (generate sub-frame rotations that smooth out the animation).

How can I do this? Using flat curves (constant tangents) does not work, and my options seem to be Euler interpolation and Quaternion interpolation (there is no "No interpolation" option).

I would like to not have to make spritesheets for every frame of every weapon.

Edit: Here is my current solution, which isn't ideal since I have to specify the number of frames and the speed I want per weapon

IEnumerator AnimateAttackManually () {
    float numFrames = attackFrames-1; // 1 frame per second, zero indexed
    for(int currentFrame = 0; currentFrame <= numFrames; currentFrame++){
        animator.Play("Attack", -1, (currentFrame/numFrames));
        animator.speed = 0;
        yield return new WaitForSeconds(1/attackSpeed);
    }
    animator.Play("Idle");
}

sentences:
How do you Draw a path and have a GameObject follow it? How would you go about creating a path that a gameobject would follow?

I'm looking to create similar functionality that you see in some RTS games.
most notability the Total War series does this well. here are a few screen shots for reference.

https://imgur.com/a/Zhi6pQu

Goal.

Click a Unit
Hold the mouse button down and drag to draw a line
Release the mouse button. unit follows path drawn

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:
1-bit game - How to change the palette for the entire game at runtime? So I'm making a 1-bit color game, and would like to have an option in the menu to change what those two colors are so the player can adjust it to their liking. What is the simplest and/or best method to go about this? This would apply to the entire screen, not individual sprites/meshes, as I want to preserve the 1-bit color look.

Most of my assets are sprites, with a few flat meshes that are rendered without anti-aliasing so that they blend in with the sprites. They're all exported with the two standard colors I'm using (a yellow-ish off-white and a dark grey-ish-blue), but I can go back and re-export them in black and white if that is necessary for the suggested method.

My eventual plan is to support the basic black and white, a few monochrome monitor color schemes, and some color combinations that you'd see on 8-bit computers (C64, Apple, etc.).

sentences:
Exporting distinct images from a sprite sheet using GIMP I have recently found that in Photoshop there is a script that enables you to export individual images on different layers into distinct png images on disk.

Is it GIMP capable of doing the same thing and how?

I have a sprite sheet (png image) and there are 36 perfectly aligned images in 4 rows (64x64 pixels each). I have to cut and export 36 times.

Can be GIMP of some help here? I don't have Photoshop.

sentences:
Variable-step update() in game loop is falling behind, how can I get around this? I'm working on a minimal game engine for my next game. I'm using the delta update method like shown:

void update(double delta) {
    // Update code that uses `delta` goes here
}

I have a deep hierarchy of updatable objects, with a root updatable that contains several updatables, each of which contains more updatables, etc. Normally I'd just iterate through each of the root's children and update each one, which would then do the same for its children, and so on. However, passing a fixed value of delta to the root means that by the time the leaf updatables are reached, it's been longer since delta seconds that have elapsed. This is causing noticable desyncing in my game, and time synchronization is very important in my case (I'm working on a rhythm game).

Any ideas on how I should tackle this? I've considered using StopWatches and a global readable timer, but any advice would be helpful. I'm also open to moving to fixed timesteps as opposed to variable.

sentences:
In Unity C#, how can I change weapon a few frames later? I have this Input code to change weapon:

if (d_left)
    {
        if (!p_d_left)
        {
            states.inventoryManager.ChangeWeaponToNextWeapon(true);
            p_d_left = true;
        }
    }
    if (d_right)
    {
        if (!p_d_right)
        {
            states.inventoryManager.ChangeWeaponToNextWeapon(false);
            p_d_right = true;
        }

And in the InventoryManager I have the weapon changed by this:

public void ChangeWeaponToNextWeapon(bool isLeft)
{
    if (isLeft)
    {
        if (l_index < r_l_weapons.Count - 1)
            l_index++;
        else
            l_index = 0;
        EquipWeapon(r_l_weapons[l_index], true);
    }
    else
    {
        if (r_index < r_r_weapons.Count - 1)
            r_index++;
        else
            r_index = 0;

        EquipWeapon(r_r_weapons[r_index]);
    }

    states.actionManager.UpdateActionsOneHanded();
}

Then equip the weapon along with animation and other stuff :

public void EquipWeapon(RuntimeWeapon w, bool isLeft = false)
{
    if (isLeft)
    {
        if (leftHandWeapon != null)
        {
            leftHandWeapon.weaponModel.SetActive(false);
        }

        leftHandWeapon = w;
    }
    else
    {
        if (rightHandWeapon != null)
        {
            rightHandWeapon.weaponModel.SetActive(false);
        }

        rightHandWeapon = w;
    }

    string targetIdle = w.instance.oh_idle;
    targetIdle += (isLeft) ? "_l" : "_r";
    states.anim.SetBool(StaticStrings.mirror, isLeft);
    states.anim.Play(StaticStrings.changeWeapon);
    states.anim.Play(targetIdle);

    UI.Slot uiSlot = UI.Slot.singleton;
    uiSlot.UpdateSlot(
        (isLeft) ?
        UI.QSlotType.lh : UI.QSlotType.rh, w.instance.icon);

    w.weaponModel.SetActive(true);
}

But the problem is the weapon changes immediately after pressing  the button. How can I switch my weapon a few frames later while playing the animation?

sentences:
Keeping raycast on the same level I want my raycast to end at certain height(red line). But as the game is 3D and the camera rotates I can't use a fixed magnitude. What I thought was a stroke of genius, I figured I'd project the height vector(a) to the ray direction to get vector(b). The result is in the right direction, but the magnitude of b is not big enough.

The wanted result is to get the vector b always reach the red line(Magnitude changes depending on the camera). My previous knowledge of vector projection says it should work, but obviously it doesn't. Where am I going wrong here?

---- EDIT: Question clarification ----

Step one: The ray is cast depending on used input. And it fails to hit any of the gameobjects.

Step two: Check the area around the midlevel(redline) to see if any gameobjects are close enough(green circle). For this to work, I need the magnitude of b-vector to use the Ray.GetPoint().

sentences:
Game input display is slow I'm trying to build a very small example to run input logic but i'm facing a small issue. The code below is runnable with MonoGame v3.7.0.1708.

My problem is that whenever you press a key (here the example is for the D key) i'm displaying a small text on the console.

But you will see if you run the code that the display happens with lag. When i press the "D" key on my keyboard, the message is displayed only ~200ms after the input.

You can for example do a fast press on the keyboard and the message will be displayed after the release of the key.

Does anyone have any idea why it's happening? Thanks!

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;

namespace TestProject
{
public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    GameInput gameInput;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        gameInput = new GameInput();
    }

    protected override void Initialize()
    {
        base.Initialize();
    }

    protected override void LoadContent() {}

    protected override void UnloadContent() {}

    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            Exit();
        base.Update(gameTime);
        gameInput.Update();
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
    }
}

public class GameInput
{
    public bool _dKeyPressed = false;

    public void Update()
    {
        KeyboardState keyState = Keyboard.GetState();
        if (keyState.IsKeyDown(Keys.D))
        {
            if (!_dKeyPressed)
            {
                Console.WriteLine("[GameInput] D key is pressed.");
            }
            _dKeyPressed = true;
        }
        else if (_dKeyPressed)
        {
            Console.WriteLine("[GameInput] D key is released.");
            _dKeyPressed = false;
        }
    }
}
}

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:
unity2D swipe control's bool for animator doesn't work i was trying to make a control where the animation plays upon swiping one direction. each time i've make a tap/swipe control, it just keeps popping messages like this. the tap animation works fine, but the animation for swipe controls just doesn't work well, the bool for them has assigned but did not make it 'true' when i swipe a direction, but the bool for the tap works, which is weird.(ignore the miss bool in the animator)

it says that i need to assign the anim variable of the Swipe script in the inspector. but there is nothing left for me to assign, which doesn't make much sense for me. (refer to Region: Animation)

i've tried to make some adjustment with the script, but the results is the same, and it has no problems when build. which is why i need help for the animation stuff.

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

public class Swipe : MonoBehaviour {

public Animator anim;
public bool tap, swipeUp, swipeDown, swipeLeft, swipeRight;
public bool isDragging = false;
public Vector2 startTouch, swipeDelta;

private void Update()
{
    tap = swipeUp = swipeDown = swipeLeft = swipeRight = false;

    #region Standalone Input
    if (Input.GetMouseButtonDown(0))
    {
        tap = true;
        isDragging = true;
        startTouch = Input.mousePosition;
        //Debug.Log("Tapped");
    }
    else if (Input.GetMouseButtonUp(0))
    {
        isDragging = false;
        Reset();
    }

    #endregion

    #region Mobile Inputs
    if (Input.touches.Length >= 1)
    {
        if (Input.touches[0].phase == TouchPhase.Began)
        {
            // tap = true;
            isDragging = true;
            startTouch = Input.touches[0].position;
        }
        else if (Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled)
        {
            isDragging = false;
            Reset();
        }
    }

    #endregion

    #region Animation
    if (Tap)
    {
        anim.SetBool("Tap", true);
    }

    if (SwipeDown)
    {
        anim.SetBool("Down", true);
    }

    if (SwipeUp)
    {
        anim.SetBool("Up", true);
    }

    if (SwipeLeft)
    {
        anim.SetBool("Left", true);
    }

    if (SwipeRight)
    {
        anim.SetBool("Right", true);
    }

    #endregion

    //calculating the distance
    swipeDelta = Vector2.zero;
    if(startTouch != Vector2.zero)
    {
        if (isDragging)
        {
            if (Input.touches.Length > 0)
                swipeDelta = Input.touches[0].position - startTouch;
            else if (Input.GetMouseButton(0))
                swipeDelta = (Vector2)Input.mousePosition - startTouch;
        }

    }

    //did we cross the deadzone?
    if (swipeDelta.magnitude > 125)
    {
        //which direction?
        float x = swipeDelta.x;
        float y = swipeDelta.y;
        if (Mathf.Abs(x) > Mathf.Abs(y))
        {
            //left or right
            if (x < 0)
                swipeLeft = true;
            else
                swipeRight = true;
        }
        else
        {
            // Up or down?
            if (y < 0)
                swipeDown = true;
            else
                swipeUp = true;
        }
    }

}

public void Reset()
{
    startTouch = swipeDelta = Vector2.zero;
    isDragging = false;
    anim.SetBool("Tap", false);
    anim.SetBool("Down", false);
    anim.SetBool("Up", false);
    anim.SetBool("Left", false);
    anim.SetBool("Right", false);
}

public Vector2 SwipeDelta { get { return swipeDelta; } }
public bool Tap { get { return tap; } }
public bool SwipeUp { get { return swipeUp; } }
public bool SwipeDown { get { return swipeDown; } }
public bool SwipeLeft { get { return swipeLeft; } }
public bool SwipeRight { get { return swipeRight; } }

}

sentences:
Server hosting and costs I'm developing a game that will require renting a server. The server will be used to host scores, clans, friends(on/off), match making, lobby, and chat. The game/match will be hosted by each player (to lower the cost). How much would a server like this cost? Any hosting recommendation? How much would it cost if the server hosts the games/matches too?

I want to know a base price (imagine a card game or turn based RPG, even though my game is real time).

sentences:
Preloading for level transitions in a tile-based game? I am developing a 2D Metroidvania which consists of a series of interconnected levels. When my player gets near a portal which can take him to a new map, I want to pre-load the next map so that there is a seamless transition when he actually enters the portal.

Here is some background about the structure of my code.

Each level is represented by a Tiled TMX file in which I have specified where various objects of different sprite classes spawn (for example, enemies, pickups, levers, etc.). When starting a new game, loading a saved game, or changing a level, my game loop runs through the appropriate TMX file and generates all the objects in that level.

For example, here is a simplified version of my new_game() method.

level = "level_1.tmx"

def new_game(self):
    Globals.scene = "game"

    # create groups
    self.all_sprites = pg.sprite.Group()
    self.walls = pg.sprite.Group()

    # load map and spawn objects
    self.map = TiledMap(path.join(self.map_folder, level))
    self.map_name = level
    self.map_img = self.map.make_map()
    self.map_rect = self.map_img.get_rect()

    # spawn objects
    for tile_object in self.map.objects:
        if tile_object.name == 'player':
           Player(self, tile_object.x, tile_object.y)
        if tile_object.name == 'wall':
            Obstacle(self, tile_object.x, tile_object.y, tile_object.width, tile_object.height)

I handle level changes like this: If the Player object intersects a Portal object, a change_map() method is called which loads a new map (the one associated with the intersected portal) and positions the player at the appropriate position on the new map. The change_map() method looks very similar to the new_game() method above, except that it empties all the sprite groups and hangs on to the player object for repositioning on the new map.

I want to restructure my code so that when the player gets near a portal object (say, within 640 pixels), the map associated with the portal begins to load. This way, when the player enters the portal, the map will load instantly.

I was thinking that I could check to see if the player is near a portal in my game's update() method. If he is, I could call a preload_map() method. But I am unsure how this function should look and how to transition to the new map when the player enters the portal. In order to avoid a stutter when the new map loads, do I need to learn about multiple threads? Maybe I should simply load all the new map images and sprites into their own variables (suffix them with "temp" or something) and then, when my player enters the portal, I can effectuate transition with lines like self.map_img = self.map_img_temp and self.all_sprites = self.all_sprites_temp.

So my question is: Given the structure of my code, how can I use pre-loading to achieve seamless map transitions?

Here is a similar question where the poster does not specify enough information about the structure of their code.

sentences:
OpenGL ES 2.0: Texture does not appear to be correct Here are my shaders...

 GLbyte vShaderStr[] = "attribute vec4 vPosition;   \n"
 "attribute vec2 texPosition; \n"
 "attribute vec4 inColor;   \n"
 "varying vec4 fragColor;   \n"
 "varying vec2 v_texCoord;     \n"
 "void main()                 \n"
 "{                           \n"
 "   gl_Position = vPosition; \n"
 "   fragColor = inColor; \n"
 "   v_texCoord = texPosition; \n"
 "}                           \n";

GLbyte fShaderStr[] =
  "precision mediump float;                            \n"
  "varying vec2 v_texCoord;                            \n"
  "uniform sampler2D s_texture;                        \n"
  "void main()                                         \n"
  "{                                                   \n"
  "  gl_FragColor = texture2D( s_texture, v_texCoord );\n"
  "}                                                   \n";

And here is my code...

GLfloat gObj[18] = {
  0.5f, 0.5f, 0.0f,
  -0.5f, -0.5f, 0.0f,
  0.5f, -0.5f, 0.0f,
  0.5f, 0.5f, 0.0f,
  -0.5f, 0.5f, 0.0f,
  -0.5f, -0.5f, 0.0f
}
...
GLuint textureId;

GLubyte bytePix[4 * 3] ={
        255, 0, 0,
        0, 255, 0,
        0,0, 255,
        255,255,0
};
GLfloat texC[] = {
            0.0f, 0.0f,
            0.0f, 1.0f,
            1.0f, 1.0f,
            1.0f, 0.0f
    };
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, bytePix);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, gObj);
glVertexAttribPointer(textCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, texC);

glUniform1i(sampler, 0 );
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(textCoordLoc);
glDrawArrays(GL_TRIANGLES, 0, 6);

But when I run the app I see the following...

This seems wrong, how can I make it so each quadrant of the square is the color in the texture. Of course I could always be misunderstanding textures in general.

sentences:
Developing a Bot for Fanorona game I am currently developing a bot for a game board called Fanorona. The game is not as popular as other board games such as chess or backgammon, but still it brings a lot of fun. Some of you may know it from Assassins Creed 3, specifically the game Connor and Achilles play together.

http://gasy-fanorona.sourceforge.net/docs/fanorona_rules.html

In this link I provided the basic rules.

I have studied what people usually use for bots for chess, algorithms like Alpha-Beta Minimax. These algorithms require a score system in order to make specific decisions, take into account the branching factor, which in this game is hard to estimate. Additionally, the bot could be trained to recognize patterns.

I have never worked with AI algorithms before, therefore I would like find out your opinion concerning this subject. What course of action would you employ in order to build a bot for this kind of game?

sentences:
GLM conversion from euler angles to quaternion and back does not hold I am trying to convert the orientation of an OpenVR controller that I have stored as a glm::vec3 of Euler angles into a glm::fquat and back, but I get wildly different results and the in-game behavior is just wrong (hard to explain, but the orientation of the object behaves normally for a small range of angles, then flips in weird axes).

This is my conversion code:

// get `orientation` from OpenVR controller sensor data

const glm::vec3 eulerAnglesInDegrees{orientation[PITCH], orientation[YAW], orientation[ROLL]};
debugPrint(eulerAnglesInDegrees);

const glm::fquat quaternion{glm::radians(eulerAnglesInDegrees)};
const glm::vec3 result{glm::degrees(glm::eulerAngles(quaternion))};
debugPrint(result);

// `result` should represent the same orientation as `eulerAnglesInDegrees`

I would expect eulerAnglesInDegrees and result to either be the same or equivalent representations of the same orientation, but that is apparently not the case. These are some example values I get printed out:

39.3851 5.17816 3.29104
39.3851 5.17816 3.29104

32.7636 144.849 44.3845
-147.236 35.1512 -135.616

39.3851 5.17816 3.29104
39.3851 5.17816 3.29104

32.0103 137.415 45.1592
-147.99 42.5846 -134.841

As you can see above, for some orientation ranges the conversion is correct, but for others it is completely different.

What am I doing wrong?

I've looked at existing questions and attempted a few things, including trying out every possible rotation order listed here, conjugating the quaternion, and other random things like flipping pitch/yaw/roll. Nothing gave me the expected result.

How can I convert euler angles to quaternions and back, representing the original orientation, using glm?

Some more examples of discrepancies:

original:      4; 175;   26;
computed:   -175;   4; -153;
difference:  179; 171;  179;

original:     -6; 173;   32;
computed:    173;   6; -147;
difference: -179; 167;  179;

original:      9; 268;  -46;
computed:   -170; -88;  133;
difference:  179; 356; -179;

original:    -27; -73;  266;
computed:    -27; -73;  -93;
difference:    0;   0;  359;

original:    -33; 111;  205;
computed:    146;  68;   25;
difference: -179;  43;  180;

I tried to find a pattern to fix the final computed results, but it doesn't seem like there's one easy to identify.

GIF + video of the behavior:

Full video on YouTube

Visual representation of my intuition/current understanding:

The above picture shows a sphere, and I'm in the center. When I aim the gun towards the green half of the sphere, the orientation is correct. When I aim the gun towards the red half of the sphere, it is incorrect - it seems like every axis is inverted, but I am not 100% sure that is the case.

sentences:
Can you have shader variables that vary per primitive? A shader normally has values that vary per-vertex and values that vary per-fragment.

Can you have values that vary only per primitive, such as per-triangle or per-quad?

sentences:
Can't load own .obj-files from Blender to DX11 I'm currently trying to import objects to my game. My problem is that I'm able to load objects from online-sites but it doesn't work for my own objects. It gives me an error:

  Debug assertion failes. Expression: vector subscript out of range.

So I watched the value of my vector and realized that the faces are empty. The difference between my obj and these from the internet are that in mine the faces are like:

  f 53//51 69//51 54//51

And in the files from online they look like:

  f 3551/5154/3181 3666/5155/3182 3543/5151/3178

What do I wrong at exporting my blender-object. I took a screenshot of my settings:

I hope you can help me.

sentences:
Force change prefab source I have a prefab A and i use it in scene A (as gameobject A). Then i to save that scene A as scene B and also renamed the gameobject A to gameobject B. Then inside unity (in project window ) , i duplicated the prefab asset A to prefab B.
Fyi, i'm using .blend (blender file) as the prefabs.
in scene B, i want the gameobject B which refers to prefab A , to switch its prefab's source to prefab B.
This way , i have 2 different scenes which has independent gameobjects  which refer to unique prefab. So i can modify prefab A and will affect scene A but not scene B.
Ussually, i can drag the gameobject to project window and choose/create 'new original prefab' option, but this method can't be used, since i want both prefab as .blend file (so i can modify them directly using blender).
What i did so far, is to drag prefab B to scene B, which then i have to manually redo all the setting which has been done in scene A . I want to avoid this tedious process.
Does anyone have any idea ?

sentences:
ECS - Components inside components? Reading up on ECS, I've tried to implement a simple 'game', if you can call it that.
Basic concepts :

You have planets(entity), they produce gold. (gold is a component inside planet)
Planets can build buildings on themselves(Buildings component)
A building(entity) has associated gold costs(Costs component)

But costs component has Gold in it(or it needs to anyway)

As to my question :
Am I close with my interpretation of ECS(Should components be inside other components?)
Are resources a valid Component? if not, where would it make sense to place them?

Edit for clarity :

ECS - Entity-Component-System.
My entities are empty hash tables of components.
My components are used inside systems for game logic, the Treasury entity has a Gold component and the IncomeSystem updates that component.

Other components (Buildable, Population, Moveable)

sentences:
What is the math behind rendering isometric with the aid of Depth Maps? I am currently in the process of designing an Isometric game, and one of the features we are trying to add, is using sprite depth maps to render geometry in the correct order.

The reason we are trying to do this, is a number of our game objects make use of overlapping sprites, and the animation is not always in sync with it's other parts.

I do have experience with working in 3D. But the issue comes to using something that is normally generated on the fly, pre baking it, and then retrofitting it to work with what ever distance.

So... something similar to what the sims has done with it's objects.

Linky

sentences:
CS0118 framerate is a field but a type was expected I'm making a mobile game in Unity and I'm trying to write a script that will set the game to either 30 or 60 frames per second based on a public bool, but I am getting error CS0118 on line 12 with

  fps.framerate is a 'field' but a 'type' was expected.

I am pretty new to Unity so I need help with this?

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

public class fps : MonoBehaviour
{
  public fps framerate;

    // Use this for initialization
    void Start ()
    {
    framerate = GameObject.Find("gameSettings").GetComponent<framerate>(); <= error CS0118
    {
      if (framerate == true)
        Application.targetFrameRate = 60;
      else
        {
            Application.targetFrameRate = 30;
            }
        }
    }
  }

sentences:
Spatial Jitter problem in large unity project I have a very large environment where i am getting very weird view of objects as picture given below:

As you can see there are black lines/spot, maybe the vertex lit problem. Currently I am using Standard specular shader. Remember this problem is only occuring at the end of the project (away from origin like position -17000, 0, 144)

As a workaround i tried to change my shader to Unlit and i found this shader

 Shader "Unlit/UnlitAlphaWithFade"
 {
     Properties
     {
         _Color ("Color Tint", Color) = (1,1,1,1)
         _MainTex ("Base (RGB) Alpha (A)", 2D) = "white"
     }

     Category
     {
         Lighting Off
         ZWrite Off
                 ZWrite On  // uncomment if you have problems like the sprite disappear in some rotations.
         Cull back
         Blend SrcAlpha OneMinusSrcAlpha
                 //AlphaTest Greater 0.001  // uncomment if you have problems like the sprites or 3d text have white quads instead of alpha pixels.
         Tags {Queue=Transparent}

         SubShader
         {

              Pass
              {
                         SetTexture [_MainTex]
                         {
                     ConstantColor [_Color]
                    Combine Texture * constant
                 }
             }
         }
     }
 }

This shader has almost solve the problem but i have to tweak and set colour of each object as be default it is not according to my expectation.

sentences:
BRDF Incorrect specular highlights I'm currently attempting to implement BRDF lighting, and am hitting a bit of a snag with my specular term - the specular highlights aren't rendering correctly.

To make things simple, I'm using a single directional light rendering down the Z axis only, and manually specify the gloss/specularity of each of the following spheres.

Glossyness increases left to right, and Specularity increases bottom to top. Notice how the highlights seem shifted nearly 90 degrees upwards:

Calculating the specular BRDF

I use the generic Fresnel Shlick eq:

For the NDF, I use the GGX Trowbridge-Reitz eq:

And for the Geometric Shadowing function, I use the Smith / Shlick-Beckmann eq:

vec3 BRDF_Specular(vec3 F0, vec3 1minusF0, vec3 WorldPos, vec3 Normal)
{
    vec3 LightDirection         = vec3(0, 0, -1);
    vec3 ViewDirection          = normalize(EyePos - WorldPos);
    vec3 HalfVec                = normalize(LightDirection + ViewDirection);
    float NdotL                 = clamp(dot(Normal, LightDirection), 0.0, 1.0);
    float NdotV                 = clamp(dot(Normal, ViewDirection), 0.0, 1.0);
    float NdotH                 = clamp(dot(Normal, HalfVec), 0.0, 1.0);
    float VdotH                 = clamp(dot(ViewDirection, HalfVec), 0.0, 1.0);

    float Roughness             = max(1.0f - Gloss, 0.0); // Turn into roughness
    float Roughness_2           = (Roughness * Roughness);
    float NdotH_2               = NdotH * NdotH;

    /*  Normal Distribution Function
        GGX (Trowbridge-Reitz) */
    float D0                    = (NdotH_2 * (a_2 - 1.0f) + 1.0f);
    float D                     = a_2 / (M_PI * (D0 * D0));

    /*  Fresnel
        Shlick  */
    vec3 Fs                     = F0 + 1minusF0 * pow(1.0 - VdotH, 5.0);

    /*  Geometric Shadowing
        Smith / Shlick-Beckmann */
    float k                     = a_2 / sqrt(2.0 / M_PI);
    float GV                    = NdotV / (NdotV * (1.0 - k) + k);
    float GL                    = NdotL / (NdotL * (1.0 - k) + k);
    float G                     = GV * GL;

    vec3 brdfspec               = vec3(max(( Fs * D * G ) / (4.0f * NdotL * NdotV), 0.0));
    return brdfspec;
}

I've been following so many different resources and mimicked many other implementations, and even reducing it down to this basic level I'm still having this issue. I don't know why I'm not getting proper results

I'm using a deferred renderer, I derive the World position of each fragment from the depth buffer, and store my normals in viewspace.
I don't use a "Metalness" map, but instead use a single rgb specular map, hense why my Fresnel calculation uses Vec3's instead of floats.

sentences:
c++ most used libraries I'm trying to find out whether or not I want to switch from Java to c++ for my OpenGL game programming. I now have setup a test project in VS 11 professional, with GLUT. I created my windows with GLUT, and I can render OpenGL primitives without any problems.

Now my question: What library(s) is/are used mostly in the indie/semi professional industry for using OpenGL in c++?

With 'using OpenGL' I mean:

Creating and managing an OpenGL window
Actually using the OpenGL API
Handling user-input (keyboard/mouse)

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

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

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

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

So a couple of questions about this:

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

sentences:
List of Anti-Cheat Packages for MMOs? i would like to start this topic for programs to counter-attack link text.

I am not aware of a big list but with everyone's help i hope to make this a fine topic.

Posting format:

NAME: nProtect GameGuard

GAME TYPE: any type of game

Website: http://global.nprotect.com/product/gg.php

FEATURES?

Protect the users' PC from fast
evolving hacking technologies and
viruses.
Real-time protection, diagnose
various patterns latest hacking tools
that can harm games, but also memory
debugging prevention technology will
be applied, completely blocking
hacking tools through real-time
hacking tool monitoring and blocking
function.
Blocks hacking attacks through memory
scan
Blocks online outflow of personal
information

sentences:
Speed of procedural geometries I'm evaluating solutions for creating a VR videogame that should run on cellphones. The assets will be streamed from our servers and that could be a problem on limited capabilities devices.

Since the geometries are not going to be too complex (mostly boxes and wardrobes) I was thinking about procedurally generating them.

Is generating geometries procedurally usually faster or slower than just streaming a bunch of vertex data?

sentences:
Box2d on authoritative server for Unity client I'm creating a multiplayer platform and shooting game in unity, using unity2d's own physics system (box2d).
But the truth is that I am quite lost in the creation of an authoritative server in c ++.
I have quite clear and experience in the use of socket for communication between client and server, I do not know how to approach the issue of simulating the physics of my game on the server so that it decides the positions/movements of the clients.
Can anyone guide me to use box2d on the server, as I simulate the game on the server? Is this a good option or would it be better to implement my own game physics than to use the non-deterministic engine?
Thank you very much and sorry for my level of English

sentences:
2D Tile based game Texture Atlas combining I am new to OpenGL and game dev, I have been to courses and trying to learing everything about this. My task is to implement a Texture Atlas in a 2D tile based game (very similar to Tibia) using OpenGL.

Now the game have the sprite sheet loaded into memory and on each tile the program generates an image, load to a texture, bind and make a draw call. You can imagine how ineficcient it is. So what I have to do is to load this sprite sheet as a Texture Atlas and get the advantage that it has.

The problem is that in the first step while generating an image, the program makes some combinations on the sprites. For example, the character has an outfit and player changes its colors (boots, pants, t-shirt, hair) to do this there is a sprite for the base outfit, and a sprite for each element of the outfit, so the program apply a mask on color for each element and combine this five sprites into an image, then make the process that I mentioned above. This is an example that happens with outfit, but it happens to other things too, so this is not a special case with outfit only.

My question is: is there any way to make this combinations using OpenGL elements? Combining this multiple textures in my Texture Atlas into one draft and do it in a single draw call?

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:
Multi texturing in XNA I am attempting to make a map editor for my game, just so I can visualize how the end result would be.

To my world I can add cubes (2 triangles) or corners (1 triangle), which are then added to a list of the vertices to draw, and the indices are added to a list of indices. Everything draws fine here, and I can set different colours for each vertex.

I would like to implement texturing, so that when you add a primitive to the scene it will let you choose a texture (that, I can handle), but then also blend with other primitive's of different textures if they are touching (everything is on a grid).

I would guess that I would have to store the texture name for each primitive, and somehow set that texture when drawing it. But I fail to see how you can set the effects texture when you are using one DrawUserIndexedPrimitives<> to draw the entire scene.

If anyone has a work around for this, or ideas on other ways of doing this, you help would be greatly appreciated.

Edit 1

I have incorporated the technique from this website here - http://toyfactorygame.com/wp.php/2010/05/06/simple-fast-gpu-driven-multi-textured-terrain/ (similar to Blau's answer below), and have the current working result...

Which maps to this...

Using each color channel as a texture..

Output = tex2D(TextureSampler0, input.TexCoords) * input.Color.r;
Output += tex2D(TextureSampler1, input.TexCoords) * input.Color.g;
Output += tex2D(TextureSampler2, input.TexCoords) * input.Color.b;
Output += tex2D(TextureSampler3, input.TexCoords) * input.Color.a;

But doing it this way means I can only be setting 4 textures to blend together each DrawPrimitives call.

Is there another way I can achieve multi texturing with more than 4 (preferably unlimited) textures? I know this is possible, as games like C&C generals allow you to set textures anywhere you want on the map.

Thanks.

Twitchy

sentences:
How to make one-axis tileable simplex noise? I made a program that uses perlin noise to generate a height map. It worked very good. Later I changed it to use simplex noise.

What I want to achieve now is that the left edge fits in the right edge, so I want to make it tileable.

I did some research and found this: https://gamedev.stackexchange.com/a/23639/116727.
This formula makes it tileable on every edge but I only want it to be tileable on the left and right edges. Then I found this website: http://www.jgallant.com/procedurally-generating-wrapping-world-maps-in-unity-csharp-part-2/#wrap1. It was just what I needed, with a formula that only tiles on one axis. I the tried to implement it, but I could not get it to work.

Here is my implementation:

//Noise range
double x1 = 0, x2 = 1;
double y1 = 0, y2 = 1;
double dx = x2 - x1;
double dy = y2 - y1;

//Sample noise at smaller intervals
double s = x / xsize;
double t = y / ysize;

// Calculate our 3D coordinates
double nx = x1 + Math.Cos(s * 2 * Math.PI) * dx / (2 * Math.PI);
double ny = y1 + Math.Sin(t * 2 * Math.PI) * dy / (2 * Math.PI);
double nz = t;

float PerlinValue = (float)SimpNoise.Evaluate(nx, ny, nz); //* 2 - 1;

map[x, y] = PerlinValue;

This is the result that I get:

What am I doing wrong? How can I fix this?

sentences:
load scene - some time (2 seconds) after object is destroyed in Unity How do I check if an object has been destroyed. And do something like change scenes 2 seconds later.

this is what I tried:

float delay = 2

void OnDestroy(){

 delay-= Time.deltaTime;
 if(delay<=0){
   Application.LoadLevel("scene2");
  }
}

sentences:
Unity3d generating a file in iOS and saving it on a linux machine I've done a little research and don't know if the following is possible.

At the moment I have created a small application in Unity that generates an XML file. This file will be used to help set up my game. It's done in Unity due to it being cross platform with no need to re-write a single line of code. Eventually this will run on an iPad.

However, my game will be running on a linux computer and I need to pass over the XML file to the computer that will be running the final game (please don't ask why I'm doing that, it's something I need to do). So what I want to know is the following:

Can I generate my XML file on an iPad and have that XML file be saved, and transmitted to a linux machine, without the need to manually copy the file over. If so, how is this possible?

sentences:
XNA: How to Flip/Mirror a position over a custom vector? I want to flip Horizontally my Sprite/Texture however the SpriteEffects.FlipHorizontally isn't cutting it for me as it just flips the texture in place.

I want to flip the texture over a specified Vector2/Vector3?

Thanks!

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:
LWJGL 3 - Random Sprites Don't Blend Some of my sprites don't "Blend" in with tiles behind them Z-wise.
glEnable(GL_DEPTH_TEST);

Depth testing is enabled and works.
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

The blend function is above.
Below is a picture of four different instances of the application. As you can see, blending works on random sprites.
Why aren't some of the sprites blending?
An observation that I made is that when I move the sprites (layers 0 and 1) below (Z-wise) the button, you can see the sprites from the gaps left by letters (layer 10), yet the button itself (layer 9) doesn't show in that area. This is what I find the strangest.

sentences:
Unity: Assign GameObject to Class that hasn't been yet instantiated I'm creating a game where I have an Entity class that contains basic entity info (pos, health,..) and some functions. Enemies and Player later on inherit from this class.

Public class Entity {

public Vector2 position;
public float health;
,...

Lets say that I have a function like this inside the Entity class:

public GameObject movingIntoEnemy(Vector2 movingToPoint)
{
    foreach (GameObject go in GameObject.Find("GameMap").GetComponent<GameMap>().enemyList)
    {
        if (go.GetComponent<EnemyScript>().enemy.position == movingToPoint)
        {
            return go;
        }
    }
    return null;
}

This function looks for a GameObject called "GameMap" and then cycles through enemies in it's list. If an enemy is found, it returns it's GameObject. Using GameObject.Find() is pretty ineffective, so what would be a better approach to this? I mean, I can't just easily use

public GameObject GameMap;

since the code is in a class, and this class needs to be instantiated first in my player/enemy scripts.

My question is - how do I attach gameObjects to this class before it is even created? What is the appropriate approach to this? I guess that I might pass these GameObjects to the class through it's constructor, but it would make things much more complicated.

Thanks in advance ;)

sentences:
what is order of implementation of matrix transforms? What is the meaning of Tr*Sh*Ro*Sc =M ?

How is matrix M written to form the graphic transformation :  1st Sc=Scale, 2nd: R=Rotate, 3rd : Sh=Shear 4th: T=Translate ?
Is the matrix  M above written properly in a "post multiplcative" format" T*Sh*R*Sc , but executed  Scale, Rotate, Shear , finaly Translate ?

sentences:
How do you use these kind of rpg ground tileset ? Searching about some tilesets for a little RPG game, I've often found these kind of tileset :

Their structure are special, there is two upper tile and 4 others for the same material. I understand that, like that, you have all what you need to create more various shapes than simple rectangles of different sizes. But I don't get how they are used in practice. I'm talking about the two little upper tiles that are used to make some corners. for me the 4 corners are stored inside only one tile ?  (hard to explain with my bad english but I'm sure you understand what I mean)

Also, do you know if that tilemapping technic has a name ? And do you kown if it is possible to use them directly in Tiled ?

sentences:
How to make it clear that a game is in Beta? I develop games on ROBLOX which is a site full of user-generated games that are typically free for other users to enjoy. Many users have studios in which they have a consistent set of playtesters, but I am the only developer in the case of my project. Nonetheless, I still have the need to test my game at times, so I recruit random people from the forums of the site (specifically the site's "Scripters forum"). While recruiting from the forums is a reliable and quick way to get players, it may be hard for them to get over the fact that the game is meant to be unfinished.

ROBLOX has a like and dislike system, and during testing I have already received three likes and one dislike. The dislike concerns me because I feel that someone probably evaluated my game on the notion of "This game should be working for me, but it's not." when those problems are the purpose of why I recruit people to go to the game in the first place. Many users even absurdly evaluated the game on its artistic value  which I believe to be an afterthought in the game development process versus functionality which should be at its core.

For the future, how do I make it clear that the current game should be evaluated for its functionality, and that in the beta phase, it may or may not work for all users?

Side note: I do some preliminary testing before I recruit testers to the game, so it works at the very least on my device, but their own experience varies based upon their quality of connection and device.

sentences:
Interesting and simple missions for text-based game Can you give me an idea for a simple and interesting mission for online text-based game that doesn't require much reading? Or maybe link to a website with a list with missions?

I love programming, but I hate when it comes to create things like this, because I am not creative at all.

Thank you.

sentences:
Unprojeting a line on the screen I have a line connecting two points of my model. I see a projection of this line on my screen and a want to map a point of that projection to the corresponding point in my model PoV.

Let A = (x_a, y_a, z_a, 1.) and B=(x_b, y_b, z_b, 1.) be the coordinates of two points of my line in the model PoV.

Let M,V and  P be the model, view and projection matrices.
Let A_s = NDC_to_screen(P*V*M*A) and B_s = NDC_to_screen(P*V*M*B) be the coordinates of A and B projections on my screen (assume that those two points are distinct).
Let vec_AB_s = B_s - A-s be the vector from A_sto B_s and let C_s = A_s + lambda_s * vec_AB_s be a point that lie on the line's projection on my screen.

How can I get the 3D coordinates of C so that C_s = NDC_to_screen(P*V*M*C) ? Something that would be usefull for me would be to have it in the form C = A + lambda * vec_AB

sentences:
What is the most efficient method to write a multiple choices story? I’d like to tell a story through a video game, and I’m starting to write it. But I got like 8 characters, some of them dies, some don’t, player has important choices changing the way characters talk to him or interact to eachother and I’m looking for an efficient way to get the story on paper before starting to code.

Do you guys know a clever way to write this ? I tried to make a file for each path, but its a bit messy

sentences:
2D Platformer AABB collision problems I have a problem with AABB collision resolution.

I resolve AABB intersection by resolving the X axis first, then the Y axis.
This is done to prevent this bug: http://i.stack.imgur.com/NLg4j.png

The current method works fine when an object moves into the player and the player has to be pushed horizontally. As you can see in the .gif, the horizontal spikes push the player correctly.

When the vertical spikes move into the player, however, the X axis is still resolved first. This makes "using the spikes as a lift" impossible.

When the player moves into the vertical spikes (affected by gravity, falls into them), he's pushed on the Y axis, because there was no overlap on the X axis to begin with.

Something I tried was the method described in the first answer of this link: 2D rectangular object collision detection

However the spikes and moving objects move by having their position changed, not velocity, and I don't calculate their next predicted position until their Update() method is called.
Needless to say this solution didn't work either. :(

I need to solve AABB collision in a way that both of the cases described above work as intended.

This is my current collision source code: http://pastebin.com/MiCi3nA1

I'd be really grateful if someone could look into this, since this bug has been present in the engine all the way back from the beginning, and I've been struggling to find a good solution, without any success. This is seriously making me spend nights looking at the collision code and preventing me from getting to the "fun part" and coding the game logic :(

I tried implementing the same collision system as in the XNA AppHub platformer demo (by copy-pasting most of the stuff). However the "jumping" bug occurs in my game, while it doesn't occur in the AppHub demo.
[ jumping bug: http://i.stack.imgur.com/NLg4j.png ]

To jump I check if the player is "onGround", then add -5 to Velocity.Y.

Since the player's Velocity.X is higher than Velocity.Y (refer to the fourth panel in the diagram), onGround is set to true when it shouldn't be, and thus lets the player jump in mid-air.

I believe this doesn't happen in the AppHub demo because the player's Velocity.X will never be higher than Velocity.Y, but I may be mistaken.

I solved this before by resolving on the X axis first, then on the Y axis. But that screws up the collision with the spikes as I stated above.

sentences:
Where does Unity save the editor window layouts? In every project there are the CurrentLayout.dwlt and CurrentMaximizeLayout.dwlt files, but those, as the name implies, are just the current layouts.

I've been unable to find the general files where it saves all your layouts, in order to copy it to another computer.

Where is it?

sentences:
How do I draw long tiled paths in 2D? (Eye of the Beholder style) I'm using artwork from the following page:
http://opengameart.org/content/first-person-dungeon-crawl-art-pack

As you can see with the first artwork, the grass field is long. The floor also goes into the distance. I'm most interested in the path.

However,
The floor is really small tile-wise, much like the grass. The floor 118x22 pixels.

I'm supposing that the artwork is layered on top of each other. But how?

Is the method similar to this?
set x to 0, y -= 22
draw path
set x+=20, y -= 22
draw path
...

But as you can see, the tile isn't square, so I don't think this is correct. I'm sure there's some industry standard to doing this. Any thoughts would be great. Thank you.

sentences:
How to adapt a webgl shader using mouse position to have symmetrical behaviour I'm trying to create a particular kind of effect for the background of my SpriteKit game, and I've found some shaders on shadertoy that are close to what I want, but I'm struggling to adapt them to do exactly what I want..

There are a few shaders that simulate the sun with atmospheric scattering based on its xy position.
here are some examples:
https://www.shadertoy.com/view/MsVSWt
https://www.shadertoy.com/view/MdtXD2

I want something similar to this effect but I want the glow to be symmetrical, so that when the 'sun' reaches close to bottom or top edge the glow effect is at a maximum, and when it is in the centre it is at a minimum. I've been playing with these shaders trying to get this effect but my understanding of webgl is clearly lacking as I'm struggling to achieve this.

What I've tried playing with is replacing variables such as sunPosition.y with abs(sunPosition.y) - my logic being that the y axis ranges from -1 to 1 so I should be able to get symmetry by making everything positive.. but this in fact has no effect.

If someone can nudge me in the right direction would be greatly appreciated as I'm now thoroughly confused by webgl!

sentences:
What makes a good tech tree? In strategy/simulation games there are often tech/research trees which allow players research new abilities/options, improve existing options and decease negative effects.

Some games seem to follow the abc approach of item 1 -> item 2 -> item 3 with minor stat changes while others make every unlocked option wildly change the way a game is played by throwing new units into the game which are able to change the balance of the game. Some make unlocking one branch block off another for the rest of the game while other will let you research everything. Some let you research multiple things while others will penalize you for switching research before it is complete. On that note tech trees can be progressive (with dedicated research over time unlocking an item) while some need you to collect enough money/points in order to unlock instantly.

What are some general guidelines for when to employ what strategy in a game? What games types of games would benefit more from one tech tree type over another and why? When should a linear tech tree be employed over a branching one?

Edit

For example a game where the main character has to build up an organisation and research technologies in secret while others are finding them and shut them down resulting in lost research laboratories, which reduce research output. The research output should increase somewhat exponentially as the game goes on as better technology is unlocked and research laboratories are upgraded. There would presumably be a very large tech tree to explore and the constant danger of losing facilities to other parties until you either unlock some endgame tech or lose everything.

Why this isn't a duplicate

Some people are marking this question as a duplicate because there is a related question about tech tree size. This question has to do more with the connections, cost and relationships between the technology options (of which size is a factor but not everything).

sentences:
Launch event at the end of an animation with phaser 3 I'm starting to develop in Phaser 3, and I'm really a begginer.
I'm trying to make an attack move of an archer sprite, but I cannot make it work right...
This is how I have defined the things related to combat:
class Jugador extends Phaser.Physics.Arcade.Sprite {

    constructor(escena, x, y) {
        super(escena, x, y, "jugador");
        this.escena = escena;
        this.escena.add.existing(this);
        this.escena.physics.add.existing(this);

        this.createVariables();
        this.createControls();
        this.createAnimations();
  }

  createAnimations(){
    this.defineAttackAnimation();
    /// Some others...
  }

  defineAttackAnimation(){
    this.attackAnimation = {};
    this.attackAnimation.key = "attack";
    this.attackAnimation.frames =
      this.escena.anims.generateFrameNames("attack",
      {
        prefix: "attack",
        start: 1,
        end: 6
      });
    this.attackAnimation.frameRate = this.attackFrameRate;
    this.attackAnimation.repeat = 1;
    var atkListener = () => {
      this.arrow();
    };
    this.escena.anims.create(this.attackAnimation);
    this.escena.anims.get("attack")
      .addListener("animationcomplete", atkListener);
  }

  arrow(){
    console.log("arrow");
  }

  attack(){
    if(this.body.onFloor() && this.attackButton.isDown){
      this.setVelocityX(0);
      this.setVelocityY(0);
      this.play("attack", true);
    }
  }

  update() {
    if ( this.body.onFloor() ){
      this.setVelocityY(0);
    }

    this.facing();
    this.idle();
    this.walk();
    this.jump();
    this.attack();

    if (this.body.velocity.y < 0){
      this.play("jump");
    } else if (this.body.velocity.y > 0 && !this.body.onFloor()){
      this.play("falling");
    }

  }
}

What I want to do is:

Player pushes the attack button.
Attack animation plays. I would like it to be played untill it ends, but now I have to keep pushing the attack button.
When attack animation ends, the function "arrow" is executes in order to make an arrow appear.

Thanks in advance.

sentences: Having unity game saved to SD card can't run on certain devices but after it's moved to phone memory it works.. why? A game I made ends up not being able to run (it shows the loading screen but after that it gets stuck), happens on nexus 5, sony experia z3 and I found this happening because the game was downloaded into the sd card memory. After moving it to the phone the game runs. I'm not sure why this is happening. Please help?

sentences:
Drawing sprites messes up my model in XNA4 I have a model which draws correctly in XNA4.

However if I try to add a background image (or any sprite), the rendering of my model is messed up. There are two problems with the rendering

model is partially transparent
hidden surfaces are visible.

 Above is the 'problem' rendering (the cyan coloured cockpit cover is visible through the bottom of the ship)

 This is how the rendering should look

sentences:
Why are parts of this Unity scrollrect not being bound to the mask? I'm setting up a system for people to load up extra levels.  Since I don't know how many levels are going to be loaded I have a UI prefab that gets added to the main Level Load UI. However, the Text components of the prefab are not being bound by the scrollrect mask.  The panel, images and button all are, and they are all children of the panel getting added to the panel that is the scrollrect's content.

Another related problem, each of the prefabs also has a button on it.  I've given it some alpha because I find that once it's in the scrollrect only the top half is clickable.  You can see below that it only highlights (as red) if your on the top half of the button.  The exception is that the final button will work if your mouse is anywhere on the button.  This isn't an issue for the buttons if they're just placed in the scene.  It only happens inside the scrollrect.

I have a smaller version of the project right here for download.  The 'main' gameobject starts a script that instantiates the main 'Load Level Screen' prefab and populates it with the 'LoadLevel - Single' prefabs.

I've been banging my head against the wall for over a week now, so any help would be appreciated!

sentences:
Why do games seemingly reload the entire level when restarting a level? Is the data really modified that much during play?

I'm assuming the longish pause between restarting a level is the entire level reloading. But it seems to me that a well implemented system should just be able to 'ping' back to the start of the level.

It's more noticeable on consoles, but its not unnoticeable on PC games.

sentences:
Get the object that triggered the event I am trying to make a simple tooltip for my game. I added event trigger to object that I want to trigger an event on mouse hover (PointerEnter).

And I want to get the game object that triggered the event in ShowTooltip(). I tried requiring BaseEventData in the void but it gave me error.

void ShowTooltip(BaseEventData baseEvent)
{
    Debug.Log(baseEvent.selectedObject.name);
}

The error: Failed to call function ShowTooltip of class UIManager

Calling function ShowTooltip with no parameters but the function requires 1.

sentences:
Render 2D texture on the cube texture at given location I would like to simulate a moving sun on the sky. What I have managed to do so far is calculating the exact location of the sun, that is the 3D direction vector from the camera's position in the world to the sun. The sky is the cube with 6 faces textured with some cube map texture. The skybox positon is constantly being set to the position of the camera, so that the camera is always in the cube's center.

Now, I have a simple 2D texture of the sun that I would like to render onto the cube map texture using the aforementioned direction vector. Could you please describe how I can achieve this? My reasoning is that I need to bind the framebuffer of the cube map and then render the sun mesh with the correct sun texture. But how do I specify the position of the sun here so that it matches the direction vector I have calculated earlier? Another question is if there might be problem when it happens that part of the sun is supposed to be rendered on one face of the cube texture and the other part on some other face of the cube texture?

Thank you in advance.

sentences:
Data-oriented design and Component Sytem cross-referencing Let's assume we're talking about a game (engine) which is written in C++. This is more like a design question but I can't find any suitable description.

Component System

The Component System says that an Entity in the world is defined by its components. This system is flexible, modular and really powerful. I've used Unity (a lot) and I like its concept. This also solves the traditional class-hierarchy problem.

Example components:

StaticTransform: Position, Rotation, Scale - a StaticTransform can be a child (and of course a parent) of another StaticTransform (this describes the Entity-hierarchy in the scene)
Rigidbody/Transform: Position, Rotation, Force, etc. - I could use the StaticTransform data, but I'd like to separate the concepts. That's why I have Position and Rotation (but not Scale) data. A Rigidbody can not be a child of another object but can be a parent of StaticTransform.
MeshRenderer: LocalBounds, WorldBounds, Mesh, Material - this component is used to generate draw calls to render the mesh with a specific material.
AudioSource: AudioData - A simple audio source which can be world-space (using one of the transforms) or global (in this case the transform component is irrelevant)
AudioListener: Only one AudioListener is allowed. Most of the time it's added to the player's Entity. It uses the transform's data.
Camera: FoV, Clipping planes, etc. - Of course a Camera can be used to render the meshes from that point of view. Multiple cameras are allowed.

Data-oriented design (DoD)

The key concept of the DoD is to focus on data and data-access instead of code. There are some additional "rules" like: "When there is one, there are many". Most of the time this means that the data itself is stored in a cache-friendly way: contiguous memory with linear access (aka. iterating the array one-by-one). In a "Component System world" the component itself does not exist but the corresponding system stores and manages the data.

In a system like this, raw or managed pointers are forgotten, instead ids and/or handles (special id with additional info) are used. Most of the time a special entityId -> componentId map is used to match the entity to the component. This way the component data can be packed (moved in the array) so the iretation is fast (cache-friendly).

In theory this work really well. Blog posts and other discussions show examples how to do it with a single "component". However I cannot find any good solution to the cross-referencing problem.

The cross-reference problem

Using the example components described above: The MeshRenderer depends on the (both static and dynamic) Transform component because the World matrix is requried to render/cull the mesh. The AudioSource, Camera and AudioListener also depend on the Transform component.

The entities can be arranged into a hierarchy using the Transform's parent-child relation. When the user updates the transform of a root object, every child Transform must be updated as well. This means we are jumping back-and-forth in the memory.

Rendering all meshes all the time seems to be a bad idea. That's why people implement spatial trees which can be used to cull meshes and other renderable objects efficiently. Again, this kills the cache-friendly part.

Question

Should I even use the DoD concept in a complex system like this? The hierarchy, the spatial trees and the cross-referencing kill the linear access (so the cache/prefetcher-friendlyness) advantage. It seems using a "stable vector" (adding/removing elements and resizing the container do not invalidate iterators) is not worse than packed vectors.

Is there any good solution to the problems described above? I like the key concept of the DoD but I'm failing to apply it.

sentences:
How to create a generic character entity in Entity System? In the below code is the way I create a character in Entity System. But I think this is the decouple, I'm having hard time decoupling this class.

1st approach

public enum CharacterType {

     PLAYER_CHARACTER,      // PC or a character controlled by a player
     NON_PLAYER_CHARACTER   // NPC or a character controlled by a computer it self (artificial intelligence), but notice that it is a friendly character

}

public class Character {
     // Player-Character can be controlled by the player it self
     // None-Player-Character is a autonomous and cannot be controlled
     // Player-Enemy target a player-character
     // Player-Allied target a player-enemy and friendly to a player-character
     // All character is moving
     CharacterType type
     CharacterMovement movement
}

// or

public class PlayerCharacter extends Character {

}

public class NonPlayerCharacter extends Character {

}

public class Merchant extends NonPlayerCharacter {

}

public class Enemy extends Character {

}

public class CharacterComponent implements Component {
     public Character character;
}

2nd approach

public class PlayerComponent implements Component {
     public static final int IDLE = 0;
     public static final int MOVE_UP = 1;
     ...
}

public class NonePlayerComponent implements Component {
     public static final int IDLE = 0;
     public static final int MOVE_UP = 1;
     ...
}

public class EnemyPlayerComponent implements Component {
     public static final int IDLE = 0;
     public static final int MOVE_UP = 1;
     ...
}

public class AlliedPlayerComponent implements Component {
     public static final int IDLE = 0;
     public static final int MOVE_UP = 1;
     ...
}

Noticed in the 2nd approach that it has a redundant data.

sentences:
Why do consoles have so little memory compared to classic computers? I remember the Playstation having 2MB ram and 1MB graphic memory.

The Playstation 3 now has only 256MB ram and 256MB graphic memory, and I'm sure that the day the console was released, even laptop's "standard" capacity was at least 1GB.

So why do they put so little memory in their machines, while developers would benefit a lot by having more ? Or is the memory that much faster than desktops and thus more expensive ? Or is it not that much worth it for developers ? What are the Sony/XBox/Nintendo engineers thinking that seems to be the same reason ?

sentences:
How can the fluid stream be stuck to the top of flask? I created a flask and added a fluid stream to the top of the flask. When I translate the flask, the fluid stream goes along with the top of the flask. How do I achieve this when rotation occurs.

   void Start () {
    aa.transform.position = new Vector3(bb.transform.position.x,
    bb.transform.position.y + 4, bb.transform.position.z);
    aa.SetActive(false);
    aa.SetActive(true);
   }

void Update () {
    aa.transform.position = new Vector3(bb.transform.position.x, bb.transform.position.y+4, bb.transform.position.z);
   //aa is the fluid stream and bb is the flask
    cc.transform.position = new Vector3(bb.transform.position.x, bb.transform.position.y + 4, bb.transform.position.z);
    }

The traslation works. But you can see the gap between top of flask and rotation here. How do I close that gap?

sentences:
Clipping a SpriteBatch Draw() in XNA Is there any way to enable a temporary clipping mask in XNA while using a SpriteBatch? I'm drawing a bunch of Texture2D objects and Sprites in a given rectangle, and I want to make sure that said objects aren't drawn outside of that rectangle. If it's of any help, I'm already drawing my content within a Viewport, I'm not sure if I can draw, for instance, in another Viewport within that Viewport.

Illustrative image of what I'm trying to accomplish:

sentences:
Changing text occurs error: move initialization code to the Awake or Start function I have GameManager class that has Log method:

using UnityEngine;
using UnityEngine.UI;

public class GameManager: MonoBehaviour {
    public static GameManager Instance;
    [SerializeField] private ScrollRect m_GUIConsoleContainer;
    [SerializeField] private UnityEngine.UI.Text m_GUIConsole;
    ...

    void Awake() {
        Instance = this;
    }

    ...

    public void Log(string message) {
        m_GUIConsole.text = m_GUIConsole.text + message + "\n";
    }
}

GameManager class has static instance, so I can invoke Log method in anywhere like this:

GameManager.Instance.Log("Helloworld");

However it works only first time. After invoke Log again, Unity gives me this error message:

  get_isActiveAndEnabled can only be called from the main thread.
  Constructors and field initializers will be executed from the loading thread when loading a scene.
  Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
  UnityEngine.UI.Text:set_text(String)

I assigned reference of m_GUIConsoleContainer and m_GUIConsole in inspector, but I don't get it what this means and why it happens. Just using Debug.Log() or print() works without any error.

How should I avoid this error message? Using Unity 2018.2.1f1.

p.s. Error coming from here, another class called NetworkManager:

void OnReceivedBytes(IAsyncResult result) {
    try {
        if(m_Socket == null) {
            return;
        }

        int resultLength = m_Socket.EndReceive(result);

        if(resultLength == 0) {
            Shutdown();
            return;
        }

        Log("Received: " + m_RecvBuffer[0]);  <<- Error coming from here
        ...
    }
    ...
}

And this is where it call OnReceivedBytes:

using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;
using System.Net;
using System.Net.Sockets;

public class NetworkManager: MonoBehaviour {
    private Socket m_Socket;

    void Start() {
        m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        m_Socket.Connect("localhost", 1337);

        if(m_Socket.Connected) {
            Log("Connected.");

            m_Socket.BeginReceive(
                m_RecvBuffer,
                0,
                m_RecvBuffer.Length,
                SocketFlags.None,
                new System.AsyncCallback(OnReceivedBytes),
                null
            );
        }
        else {
            Log("Failed to Connect.");
        }
    }

    ...
}

sentences:
Pause Tiled animation during game in LibGDX I’m using Tiled with LibGDX and I have some animated tiles. When the game is paused I would like their animation to be paused as well. Is this possible?

The map is drawn with mapRenderer.render() and if I'm not mistake, this is the class responsible for getting the corresponding animation. There doesn't seem to be a way to freeze time. Any help appreciated, I've been searching for a couple of hours and cannot find anything.

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:
WebGL half float equivelant? I'm trying to find a half float for the purposes of doing math in a fragment shader, not trying to have a half float texture.

Is there an equivalent of the half float data type in WebGL?
I know you can create a lowp float, but is that the same, or not necessarily?

sentences:
How to make my animation play once? In 3ds max, I've made a Cannon that sets itself up, but I only want this animation to play once, here's where I'm trying to make it loop only once:

When I click the toggle at the bottom, it stops the animation for constantly looping, but when I click 'Save', and run my game, it still continues to loop.
What am I doing wrong?

sentences:
If I know a given action will result in a collision, should I allow the action to occur anyway? I've finished programming my game engine, and now that I've been testing it, I've been noticing some graphics problems.

The big one is that when a player tries to push against a wall, their character will "jiggle" against it as it constantly tries to enter the wall's space and the collision detection constantly pushes it back outside.

What is the proper way to handle such a situation?

My first instinct was, if moving in a certain direction causes a collision, disable movement in that direction until the entity's position has changed. I.e., once an object falls onto a platform, disable gravity until the object is no longer above a platform.

Is there a better way to resolve repeated collision detections between the same two objects in the same overlapping space?

sentences:
Downsides of using a 8192 x 8192 texture? So I am using Unity to build a 2D game and one thing that I needed is to be able to render a lot (talking about 10s of thousands) of sprite to the screen so I have a custom solution that basically is a single game object with a script that uses Graphics.DrawMesh() with pretty good results right now. Now I know another way to reduce draw calls is to have a few materials as possible (as I believe a single mesh can only use 1 material) so I was think about using a 8192 x 8192 texture as basically my main (maybe only texture) as with 64 x 64 sprites, I can fit a bit over 16000 sprites which should be more than enough for all the sprites in the game world).
My question is whether or not there is any major downside of using a texture of this size? I am sure there are decides and video cards that would not support this but I am curious as to what those are. Would current gen / next gen consoles support this? At what point would video card not support this? For the game I am working on mobile / VR is not a concern.
If this texture size would restrict support too much, what about 4096 x 4096?

sentences:
Character on Character fighting animations sorry about the vague title, but these couple of videos/images might explain my situation a bit better:

https://www.youtube.com/watch?v=MG1mNyjNuXk (Wolfenstein the Old Blood)
https://www.youtube.com/watch?v=NVmsucYKlvo (Mad Max the Game)
https://www.youtube.com/watch?v=XYWQ-UzTpZ8 (at 0:49 seconds, Credits go to: Ranon Sarono AKA Hyper)

I am basically wondering how you would animate the 2 characters if 1 of them knifed the other one, do they both have their separate animations? or do they just take the animation file?

sentences:
Why game window automatically scale itself when I press play? When I am in the editor and I press play to test my game something weird happens,
the game window is like zooming in.. and I am not touching anything, the scale slider just goes from x0.41 to x1.
What may cause the problem? Bug in the editor?

Thank you in advance.

PS:
I noticed that the problem is only with my custom game windows, their initial scale is 0.41 and not 1, why is that?

sentences:
Unity - Smooth player input direction when changing camera Preface- I'm very new to Unity.
I'm working on an exercise using fixed cameras like how they work in the PSX final fantasy games. I have the camera scripts working fine but it's an aspect of the character control that I'm struggling with.
My character moves relative to the cameras facing position, but when the camera suddenly changes to another angle, my running direction instantly and abruptly changes too. In the final fantasy games it sort of keeps going roughly in the same direction you were briefly.
input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
input = Vector2.ClampMagnitude(input, 1);

// get camera direction
// need to add something here for in between camera switches!
camF = Camera.main.transform.forward;
camR = Camera.main.transform.right;
camF.y = 0;
camR.y = 0;
camF = camF.normalized;
camR = camR.normalized;

transform.position += (camF * input.y + camR * input.x) * Time.deltaTime * 8;

I saw someone with a similar game comment on an article with his solution, but I don't quite know how to put it into code. The quote;

"Player just gets a rotation based on where the camera is looking and multiplies the character’s motor force by that .forward and .right. I only update that rotation after a big delta in input so you can smoothly move between shots."

This is his small (online) game which he's talking about, I'm trying to mimic the movement basically;
https://ocias.com/games/foggy-shore/
Can anyone give me some pointers?

Updated:
It doesn't quite play how it does in the demo game, but it's getting there.
    input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
    input = Vector2.ClampMagnitude(input, 1);

    if (!cameraChanged) {
        _lastCameraInput = input;
        camF = Camera.main.transform.forward;
        camR = Camera.main.transform.right;
        camF.y = 0;
        camR.y = 0;
        camF = camF.normalized;
        camR = camR.normalized;

    } else if (Vector3.Dot(input, _lastCameraInput) <= -0f) {
        cameraChanged = false;
        }

    transform.position += (camF * input.y + camR * input.x) * Time.deltaTime * 8;

sentences:
Gap in parallaxing background loop The bug here is that my background kind of offset a bit itself from where it should draw and so I have this line. I have some troubles understanding why I get this bug when I set a speed that is different then 1,2,4,8,16,...

In main class I set the speed depending on the player speed

 bgSpeed = -(int)playerMoveSpeed.X / 10;

and here's my background class

class ParallaxingBackground
    {
        Texture2D texture;
        Vector2[] positions;
        public int Speed { get; set;}

        public void Initialize(ContentManager content, String texturePath, int screenWidth, int speed)
        {
            texture = content.Load<Texture2D>(texturePath);
            this.Speed = speed;
            positions = new Vector2[screenWidth / texture.Width + 2];
            for (int i = 0; i < positions.Length; i++)
            {
                positions[i] = new Vector2(i * texture.Width, 0);
            }
        }
        public void Update() {
            for (int i = 0; i < positions.Length; i++)
            {
                positions[i].X += Speed;
                if (Speed <= 0)
                {
                    if (positions[i].X <= -texture.Width)
                    {
                        positions[i].X = texture.Width * (positions.Length - 1);
                    }
                }
                else
                {
                    if (positions[i].X >= texture.Width*(positions.Length - 1))
                    {
                        positions[i].X = -texture.Width;
                    }
                }
            }
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < positions.Length; i++)
            {
                spriteBatch.Draw(texture, positions[i], Color.White);
            }
        }

    }

sentences:
Collision detection Libgdx I'm trying to implement Collision detection using Rectangles for my game but can't seem to get it to work.

Bullets are updated when pressing space every frame so they move across the screen. Apparently so I've been told on here, the collisionbox moves with it as well. I'm getting this by using sprite.getBoundingBox() which sets a datafield Rectangle to this value for each instance.

I have two Arraylists, one holding instances of Monsters and one holding instances of Bullets. They all have collisionRectangles associated with them.

I'm calling the checkCollisions() method from my main render loop every frame as long as there's something in the bullets or monsters arraylist.

/*this handles collisions between bullets and enemies*/
public static void checkCollisions(){
    for (int i = 0; i < Main.currentBullets.size(); i++){
        for (int k = 0; k < Main.currentMonsters.size(); k++){
            if (Intersector.overlaps(Main.currentBullets.get(i).collisionBoxBullet,
                  Main.currentMonsters.get(k).collisionBoxMonster)){
                     System.out.println("Boom headshot");
                }
        }
    }

Why does it keep writing Boomheadshot to standard out even when its not colliding with an enemy?

sentences:
Should I use GL_GENERATE_MIPMAP_SGIS or GL_GENERATE_MIPMAP? I'm using Windows 7 and most people in the group of this specific OpenGL project is too, there's only one member on Windows XP. We are all using Visual Studio 2010 though. I don't know if the OpenGL headers come with VS or with Windows but I would assume it's VS. And since we are all using the same VS version, albeit not the same SKU, I'm also assuming we all have the same OpenGL headers and version running on our systems.

That said, the version installed on my system (note that I haven't installed anything OpenGL related) is 2.1 and it does support GL_GENERATE_MIPMAP, I don't need to resort ot the SGIS extension.

However, the Windows headers only support version 1.1. To work around that, I'm using GLEW. I also noticed that both GL_GENERATE_MIPMAP_SGIS and GL_GENERATE_MIPMAP have the same exact values defined.

So my question is, should I do the following on my texture loading routine:

if(GLEW_SGIS_generate_mipmap) {
    glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
    glTexImage2D(GL_TEXTURE_2D, 0, glFormat, texWidth, texHeight, 0, glFormat,
        GL_UNSIGNED_BYTE, texPixels);
} else {
    gluBuild2DMipmaps(GL_TEXTURE_2D, glFormat, texWidth, texHeight, glFormat,
        GL_UNSIGNED_BYTE, texPixels);
}

...or can I just assume everything will work and just do this:

glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, glFormat, texWidth, texHeight, 0, glFormat,
    GL_UNSIGNED_BYTE, texPixels);

?

I would think that this code would fail (and the game wouldn't probably run) if the OpenGL version doesn't support mipmapping generation like that, but nowadays, most people probably have OpenGL 2.1 on their systems right, probably in Windows XP too (without any development tools installed)?

Also, another small question...

My laptop has 2 graphics card, one integrated (Intel) and the other dedicated (NVIDIA), with NVIDIA Optimus technology. Mipmapping using the dedicated GPU seems to have better quality. I mean, the integrated card mipmapping seems more pixelized in near planes (I'm talking about a plane terrain texture) than the dedicated one. And when I move the camera, the near pixels "blink" a little (with the integrated card) and it's distracting, while the far pixels look nicely linear. Yes, I'm using GL_LINEAR_MIPMAP_LINEAR for the minifying filter. Anyway to fix this?

sentences:
LibGDX Android Textures reload other textures, and transparent images get black backgrounds [Pictures] I have very strange problems with my LibGDX Game in Android - The problem is that sometimes the textures get black backgrounds when they should be transparent, and sometimes when I remove the texture, or press the back button, the textures get replaced with other textures that I have.

To clarify:
I'm using x texture to show the status of health. I'm using three x textures to show how many lives the player got, and when I lose health, and remove one texture, the x texture get replaced with y or z texture, or the remaining x textures get black backgrounds. Sometimes it works flawlessly, and the x texture gets removed, and the backgrounds are still transparent.

I'm loading my textures via an AssetManager, and just load them on create().

In my render I use this:

    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    batch.enableBlending();

                  batch.begin();
                   for (Entity life : LifeEntities) {

                        life.render(batch);
                    }
                  batch.end();

I'm also using this in my Launcher Class.

 AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
 cfg.r = cfg.g = cfg.b = cfg.a = 8;

 MainGame myGame = new MainGame(arrayName);
 initialize(myGame, cfg);

I do dispose the textures also. I have looked up on google and on gamedev about this problem, but all the questions are for problems when the transparent always have black background, not when it is something that happens like a bug.

Any suggestions on where the problem could be? Thanks a lot, if you need more code, please let me know.

Pictures of the problem:

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:
In Unity, how do I dynamically manipulate parts of a mesh? I'm trying to achieve mesh manipulation of any mesh based on user input (mostly sliders). Here's an example of what I want. I am not sure whether to call this "morphing", as I am trying to change one part of the mesh without modifying the other parts.

How does this work?

sentences:
How can I fix texture clipping in Unreal 4? I made a small project testing out mini-maps, it worked fine, I left it alone for a few months and reopened the project, and now I'm getting this:

I'm not even sure what to call this kind of issue other than clipping.

Also note, a sprite representing the player model is supposed to be at the center of the mini-map, but now it doesn't show. I hadn't made any changes to the project since I last worked on it, and when I check the camera I'm using for the mini-map, the pointer is definitely visible in the Blueprint. The project was made in 4.13.

Though as I took that screenshot, everything else that should be visible disappeared, so the mini-map no longer is showing the floors and walls. This feels like a graphics problem. Anyone know where I can start fixing this?

SOLVED: It was a rendering/shader problem. Project settings > platform > mac > rendering > Max Metal Shader Standard to Target = "Metal v1.1"

sentences:
Good way to handle offscreen AI? For example sake:

Let's say there are 10 rooms in the world.
And let's say the world is inhabited by 10 entities.
And each entity has it's own "daily routine" where it performs
certain actions in the room and also might navigate between the rooms
as well.

Given that the player can only be in one room at a time, what is a good way to keep track of the actions the other entities are performing in other rooms offscreen?

The most straightforward option is to check on each of the 10
entities on every frame, check their position/state and determine
whether or not the entity should be in the room where player is
located in at any given time.  ( This however feels really resource
heavy especially as the room/entity amount is increased. )
Another option is to keep track of the time that has passed since
the start of the game, then each of the entities checks whether its
pattern intersects with the room the player is on, and if it does it
checks against the time whether or not the entity is supposed to be
in the same room at this particular time, entities whose patterns do
not intersect with the current room the player is located in do
nothing until the player enters a room which their pattern
intersects and only at that point calculate whether or not they
should render. ( But if they interact with the room, then they will
have to always check the state of the rooms which intersect their
route in order to determine their location at that point in time,
which is not that great. )
The third option I came to would be to first of all only look at the
    routes which intersect the player location (as described
    previously), secondly upon entering a room, check if the player is
    in that room, if not then to only check the state of the room and
    how long will it take to proceed to the next room. For example a
    janitor NPC enters the room, checks the state of the room, sees that
    there is a spillage made by player, calculates how much time it will
    take to clean that up and how long the pathing will take etc. And
    until the mentioned time is due to enter the next room we only check
    if the player is in the room. The exact location of the NPC for
    rendering purposes would only be calculated when the player enters
    the room.

After brainstorming a while I came to the third option, but I was wondering if perhaps there is a known or better way to handle things like these?

sentences:
Trying to find a solution for instant knockback in multiplayer game I'm making a server-authoritative fast-paced multiplayer game. I'm trying to implement wack-hammers, they are a melee weapon that knocks close players, in other words, that sets their velocity to inverse of their mass *  to the direction aimed at * the force of the hit. Even if the enemy player is only seen getting knocked after the client input gets processed on the server and after the enemy's position and velocity get sent back, I want to make it seem like your action appeared instantly.
I've tried one thing: when you knock a player, that player gets predicted for a short amount of time instead of being interpolated. That way, players appears to have been knocked out instantly, but there's an issue with that. When should I stop predicting? And how? When you think about it, the prediction is done on your own client time. The positions and velocities of other players are a few millisec old, so when you try to interpolate between your local "futur" predicted player position to the "old" server player position, you essentially move the other players back in time, and it looks real bad.
I'm not quite sure what to try to hide this issue. I can't possibly predict the enemy player's position forward in time, its movement can get too chaotic.
I've already watched the GDC talk from Overwatch's and Rocket League's netcode a million time, I'm not sure if they can help me with my issue.
Edit: I still haven’t found the best solution yet but there’s some useful information over at https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1455487-responsive-knock-back-in-multiplayer-game

sentences:
How to use multiple custom vertex attributes in OpenGL My code currently uses glBindAttribLocation and glVertexAttribPointer to specify two custom vertex attributes in indices 6 and 7. This seems to work fine, but I wish to add another attribute and no index other than 6 or 7 will work - the shader instead acts like the attribute is always set to a value of 0.

I'm using gl_Vertex, gl_Normal, gl_Color and gl_MultiTexCoord0, and apparently some nVidia thing means indices 0, 2, 3 and 8 are off limits, but that should still leave other indices. I don't use gl_SecondaryColor or gl_FogCoord anywhere in my code or shaders for example, but indices 4 and 5 still don't work.

If I change graphics cards for an ATI one which supports more than 16 attributes, then indices 16+ work fine, but I want to support cards with only 16 attributes.

sentences:
What bones are involved in a walk cycle like Leon's in RE4? I would like to create a character that moves like Leon in RE4. This video demonstrates Leon's walk cycle, which I'd like to reproduce. I'm confused about which bones of my character's skeleton should be rotated to achieve the desired cool "sideways" look.

At first I thought that his feet and hip are not rotated at all and that only his abdomen was rotated. But after watching the above video (for example at 00:20) where a camera FOV hack was applied and one can finally see his lower body, I'm not sure anymore.

How has this walk cycle been created? Did they take a walk-straight-forward-animation and then rotated some bones? If yes, which ones?
I guess somebody who has a great eye for animations can see that.

Thank you.

sentences:
How to detect if I click on an object (2D) using Raycast? I need to know this for a little popup I made in my game, I want to avoid using OnMouseDown because I have multiple cameras so I was wondering how I'd be able to detect a mouse click event on an object using Raycasting, as I can't figure it out :/

Thank you!

sentences:
in Unity3d, how to automatically create fixed joints in a wall of cubes? I want to create a wall:
width  6 cubes
height 7 cubes

therefore I have 22 cubes on the margins and 20 cubes inside. For each of the margins cubes(except the corners) I have to set 3 fixed joints, and for the cubes inside the wall I have to set 4 fixed joints - all this to have good physics behavior.

Pretty much I have to create a fixed joint between a cube and all his neighbors => and that's a lot!
Is there a way to automatically create these fixed joints?

Is there another way to create a physics friendly wall? I want to simulate a wall of bricks hited by a projectile.

sentences:
Ground for 2D AndEngine game with physics I am using AndEngine to create a 2D Game for Android platform using Java and AndEngine.

I have learned how to use Tiled editor to create tiled maps. The only problem I am having is that I don't know how to place an object such as a character on the ground, and have it count as the ground.

How do I go about doing this or what is the best way to do this?

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:
Photon2 Unity2D How to send float with RPC I have big problem in my code .. I want to spawn obstacle exactly on the same position as on the server is spawned so I made rpc Method and tried to pass random variable of float , but when i run the game obstacles are spawned on the diffrent position. I am loosing a lot of time to get it done but I still can not find solution.

Here is the code

   [PunRPC]
    void RPC_SpawnColumn(Vector3 position)
    {
        // Instantiate(prefab, position, Quaternion.identity);
        Debug.Log("THIS IS SPAWNYPOSITION" + spawnYPosition);

        Instantiate(prefab, new Vector2(9, spawnYPosition), Quaternion.identity);

    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        //print("Are we here");
        if (collision.GetComponent<ColumnsMultiplayer>() != null)
        {

            print("Or are we here");
            if (SpawnOnce)
            {
                spawnYPosition = Random.Range(-3.36f, 2.98f);

                photonView.RPC("RPC_SpawnColumn", RpcTarget.Others,new Vector3(9, spawnYPosition));  // this is

            }
                //SpawnColumn();

            SpawnOnce = false;

        }
    }

Thank you so much for reading post.

Edit: I need to send spawnYPosition  from method two to method one and spawn it with same position of spawnYPosition  in the second method.

sentences:
How decoupled should game logic and rendering be? From a data perspective, how decoupled should game logic and rendering be? How much does it have to know about each other?

Take a look at the following example. I'm going to use javascript because that's what I'm most familiar with.

Block

Basically, when the Block.destroy is called, there is a delay before it loses a life

function Block(life, destructionDelay){
    this.life = life;
    this.destructionDelay = destructionDelay;

    this.destructionCountdown = 0;
}

Block.prototype = {
    destroy: function(){
        this.destructionCountdown = this.destructionDelay;
    },

    update: function(){
        if(this.destructionCountdown > 0){
            this.destructionCountdown--;

            if(this.destructionCountdown === 0){
                life--;
            }
        }
    }
}

What was supposed to happen here is when the Block is destroyed, it plays a "being destroyed" animation before it loses a life/destroyed.

As I have been informed, it is ideal for the game logic to know nothing/minimal about the renderer and vice-versa. How do I design these kinds of entities?

sentences:
2D Platform physics system with deltaTime I'm implementing my physics handler in my own 2D "Platform" game.
My main problem is that when the timestep ( deltaTime ) changes, maybe to some tiny lag spike or something like that, the running entity visibly changes its speed ( running at top speed, actually) and that is really annoying to see. Other than that, if my game run slower (for example at ~33 fps) the entity moves definitely slower, which is, of course, not good at all, and moves 'lagging', in a completely not smooth way.
I use a variable time step and I limit FPS only if I have to do some test (for example simulating lag).
The game, and so the timestep calculation, is made with C++ and SDL2 but I think this issue is not language-specific. By the way this is how I calculate the timestep:

double last=0, delay=0;
while (running) {
    Uint32 now = SDL_GetTicks();
    if (now > last) {
        delay=now-last;
        last=now;
    }
    view->update(delay); // This is where every game logic takes place
    //... Do other stuff (clear screen, clear inputs, swap buffers)
}

Generally, this code works just fine, if my fps are less, then the deltaTime (delay in the code) increases. And that's ok. On the other hand there is a huge problem which is, of course, affecting my physic system: if my game runs faster than a certain number of fps (i.e. fps >= 1000 ) then, not matter what is the specific value, delay is always 1.
This makes a game session running at 1000 fps fast 1/2 of a session running at 2000fps. I know those values are extremely high and that my game is running like that just because now it's empty, but I think I can't ignore this problem. What if a super high extreme gaming machine tries to run my game ?

Now let's talk about physics:
My physics engine is really simple. It is 2D and, for now, I implemented only the x-Axis algorithm. My entity has a 2D vector holding speed (speed.x and speed.y ), a top speed (maxSpeed) and, of course, a position).

My engine works like this:

//Code executed in every frame:
if (fabs(speed.x) > 0 ) {
    speed.x /=  delta; //Simulate a very high friction

    if (fabs(speed.x) > maxSpeed) { //check if exceed the top speed
        //if so, set the speed to the top speed with the same sign
        speed.x = (maxSpeed * delta) * sgn(speed.x);
    }

   //Finally change the position according to the speed
    x += speed.x*delta;
}

That is what I use to simulate a physic system, where sgn is custom function which returns 1 if the value is positive, -1 otherwise. I know the friction is very high, but at the moment I do not care too much.

The last piece of code I use, is the code to make the entity actually move. To do so I use this piece of code:

if (input->isKeyDown(KEY_D))
    speed.x += acceleration.x * delta;
else if (input->isKeyDown(KEY_A))
    speed.x -= acceleration.x*delta;

In this code acceleration is like a constant, it's simply a value.
Now the code works fine in very general terms but the problems are:

Even a little change to delta (delay, variable time step) makes the entity visibly change his own speed (I guess it's related to top speed).
If my game runs on average of 30 -- 45 fps, the entity moves, but at a different top speed and the transition is verry laggy.
At a certain point delta becomes constant and that breaks up every physic logic.

I think everything is related to how I use my delta (delay) in each frane

sentences:
What's the fastest collision detection (Game Maker) I want to build a simulator using Game Maker in which there are many (up to hundreds) of obj_Cell, each has a radius of 10, (they don't have sprites, they just draw a circle with radius 10).

Each step, I want the cells to check around itself for obj_A to see if any obj_A is "touching" it, (has a distance less than 10 from the cell). However, since I have so many obj_Cell and so many obj_A, the most straight forward code (below) will have to be executed tens of thousands of times (number of obj_A * number of obj_Cell)

//In obj_Cell:
(with obj_A)
{
   if distance_to_object(other)<=10
   {
      //do stuff
   }
}

Is there any possible way to make this faster?

sentences:
When I shoot from a gun while walking, the bullet is off the center, but when stand still it's fine. (Video Included) I am making a small project in Unity, and whenever I walk with the gun and shoot at the same time, the bullets seem to curve and shoot off 2-3 CMs from the center. When I stand still this doesn't happen.
This is my main Javascript code:
@script RequireComponent(AudioSource);

var projectile : Rigidbody;
var speed = 500;
var ammo = 30;
var fireRate = 0.1;
private var nextFire = 0.0;

function Update() {
    if(Input.GetButton ("Fire1") && Time.time > nextFire) {
        if(ammo != 0) {
            nextFire = Time.time + fireRate;
            var clone = Instantiate(projectile, transform.position, transform.root.rotation);
            clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));
            ammo = ammo - 1;
            audio.Play();
        } else {

        }
    }
}

I assume that these two lines need to be tweaked:
var clone = Instantiate(projectile, transform.position, transform.root.rotation);
clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));

I just started Unity, and I might have a difficult time understanding some things.
EDIT:
Here is a video - http://www.screenr.com/2pxH
(If there are any more mistakes in my code, feel free to edit it.)

sentences:
What is the difference between Character Modeling and Level Design? I'm  thinking of either focusing on character modeling or level design, but I'm not sure what the differences are. Do companies consider them as separate jobs because I don't know that either.

My background: Currently I'm in an associates program for Game Programming, but over the last semester due to my work schedule there was no programming class available for me to take so instead I decided to take 3D Modeling. But as I'm reaching the end of the class I noticed I'm enjoying the 3D Modeling a lot more than programming, so I decided to stick with the art side. However, due to unforeseen circumstances, I'm going to have to move soon and transfer to a new university. Now this new university that I'm going to be attending how the program is set up so that you're required to pick a particular area to focus on. But I'm not sure what to do.

sentences:
How to check for cube collisions? I want a method, which takes two "ObjectBox" objects (A "ObjectBox" has .getX() .getY() .getZ() .getSizeX() .getSizeY() .getSizeZ() methods) as a parameter and return true if the two Boxes are colliding and false if they aren't.

So it should be something like this:

public static boolean checkCollision(ObjectBox box1, ObjectBox box2){
return //TRUE IF COLLIDING - FALSE IF NOT COLLIDING
}

I tried figuring it out but it seemed pretty hard to me.

sentences:
How to Create a New Instance of a Game Object Alright, please don't scald me here haha. I'm very new to XNA, C#, and game development as a whole. I have done web-design, but that is my main experience with programming. It is a Space Invaders type-ish game.

In the code below I have a Meteor class. In this class I want to create a meteor in a random location (on the X-axis) and then have it fall. I don't care much about it doing damage - yet.

I can always get one meteor created, and falling, yet when I press 'M' to create another instance of the class it isn't creating another meteor. I could very possibly be going about this entirely wrong...please forgive me if I am.

  class Meteor
   {

    private Random randomNumber = new Random();
    private Rectangle position;
    private int fallSpeed;
    private double damage;
    private int x, y = 0;
    private int WIDTH, HEIGHT;

    // List to hold meteors created (holds instance of Meteor class)
    List<Meteor> meteors = new List<Meteor>();

    // Texture for the meteor

    private Texture2D meteor;

    /// <summary>
    /// Create the meteor and each meteor's properties
    /// </summary>
    public Meteor()
    {
        HEIGHT = randomNumber.Next(0, 60);
        WIDTH = HEIGHT;
        fallSpeed = randomNumber.Next(0, 10);
        damage = fallSpeed * 2;
        x = randomNumber.Next(0, 600); // Randomly generates where meteor will spawn on X axis
    }

    public void createMeteor()
    {
        meteors.Add(new Meteor());
    }

    /// <summary>
    /// Load content (graphics) relating to the meteor
    /// </summary>
    public void LoadContent(ContentManager Content)
    {
        // Load meteor texture
        meteor = Content.Load<Texture2D>("Sprites/meteor");
    }

    /// <summary>
    /// Update the meteors position
    /// </summary>
    public void Update()
    {
        //Update position of metoer (falling)
        y++;

        // Testing purposes mostly...I want meteors to be created when I press 'M'
        if (Keyboard.GetState().IsKeyDown(Keys.M))
        {
            createMeteor();
        }
    }

    /// <summary>
    /// Draw the metoer (and it's new position).
    /// </summary>
    public void Draw(SpriteBatch spriteBatch)
    {
        position = new Rectangle(x, y, HEIGHT, WIDTH);
        spriteBatch.Draw(meteor, position, Color.White);

    }

    // So I can get the damage
    public double getDamage() { return damage; }
}
}

sentences:
How can I avoid a delay with continues touch detection in swift? I want control a character on my screen with a continuous swipe gesture. As soon as I do a swipe +x or -x my character moves left or right. And as long as I hold my finger it continuous to move to the direction in that I swiped. When I swipe into the opposite direction of my last swipe without leaving my finger from the touch ground, my character should move into this direction. When I release my finger from the touch screen, my character should stops instantly.

My problem is that there is often a small delay within the change of direction. And this delay makes it less precise.

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    /* Called when a touch begins */
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        lastFingerPosition = location

    }
}

override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent){
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        if(location.x > lastFingerPosition?.x && lastMoveDirection != "right"){
            movePlayer("right")
        } else if(location.x < lastFingerPosition?.x && lastMoveDirection != "left"){
            movePlayer("left")
        }
    }
}

//@Todo: Wenn man touchMoved und nicht über dem Button hoch geht, wird die Action nicht aufgehoben
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        player?.removeAllActions()
        lastMoveDirection = ""
    }
}

func movePlayer(direction: String) {
    var player = self.childNodeWithName("man")

    if(lastMoveDirection != direction){
        player?.removeAllActions()
        lastMoveDirection = direction

        var duration:CGFloat? = 0
        var x = player?.position.x
        duration = x!

        if(direction == "left"){
            var xDestination:CGFloat = 10
            var run = SKAction.moveToX(10, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveLeft")
        } else if(direction == "right") {
            duration = self.frame.width - x!
            var xDestination = frame.size.width - 1
            var run = SKAction.moveToX(xDestination, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveRight")
        }
    }
}

sentences:
a shader type class in c Is it possible to setup something sort of like a class in C++ but in c in the simplest terms? I want to avoid using c++ but I would like to create a simple struct that has glsl shader program.

for example

struct shader_program
{
     GLuint shader;
     void (*create_shader)(const char* vss, const char* fss);
     void (*enableShader)(void);
     GLuint (*getUniformLoc(struct shader_program* sp, char* name);
     void (*disableShader)(void);

}

sample usage.

struct shader_program simple_shader = create_shader(.., ..);
struct shader_program advanced_shader = create_shader(.., ..);

draaw()
{
 simple_shader->enableShader();
 //...bind vai, draw, etc..
 simple_shader->disableShader();

 advanced_shader->enableShader();
 //draw
 advanced_shader->disableShader();

}

the main question is how would i set this up in a header and source file so that I can use a struct like this to do my rendering?

sentences:
How can I implement a "boost pad" with Farseer/Box2D physics? I'm trying to implement a boost pad in my XNA game using the Farseer Physics Engine. (This question applies to Box2D too, I would be happy to port working Box2D code to C#.)

By "boost pad", I mean an object that can apply a force to the player that makes him go faster than he usually can under normal circumstances. These are most often seen in non-realistic racing games (e.g., Mario Kart, F-Zero). (For the record, my particular game is a 2D side-scroller.)

I use a very simple Farseer physics Body for my player: it's just a square shape with basic linear velocity.

Normally, I move my player like this:

body.ApplyForce(ConvertUnits.ToSimUnits(force));

Then, in my Update loop method, I cap the player velocity like this (to make sure the player speed never goes above maxSpeed):

float speed = body.LinearVelocity.Length();
if (speed > maxSpeed)
    body.LinearVelocity = (maxSpeed / speed) * velocity;

I'm struggling to think of a good way to implement a boost pad. The issues:

What would be a good way to enforce two separate max speeds? There's one maximum speed for forces that are applied by normal player input, and another maximum speed for forces applied by boost pads.
If the character is going faster than the normal max speed (e.g., they just hit a boost pad), how can I still allow the player to influence his direction without increasing his overall speed?

sentences:
Good algorithm to generate pixels for thick line? I am not really making some drawing as of picture manipulation but I use line function to calculate "claimed" pixels in my line race game (demo here):

The actual rendering is apart from the game algorithm which uses map of integers to remember which line "claimed" which pixel. I intentionally do the game logic based on pixels, not line intersections, because in future I want to add all kinds of shapes and analytic geometry would make that pain to implement. Instead, I'll use raster map and eventually make it look smooth on the rendering side.

The problem I have right now is that under special occasions, one line can cross another - and this is not an algorithm error but concept error. The problem happens because sometimes, the lines look like this:

As you see, there's no pixel collision - and this is not as unlikely as it seems. Making the line thicker would fix this and probably also make the game look better, but it has a flaw too - the line will now "claim" pixels it has already claimed last iteration. The current "thin" algorithm is  basically just copied from wikipedia:

/**
 * Returns array of points that form line between x1,y1 and x2,y2. The array looks like this:
 *  [x,y,x,y,x,y...]
**/
Line.straightPoints = function(x1,y1,x2,y2) {
  var result = [];
  // Define differences and error check
  var dx = Math.abs(x2 - x1);
  var dy = Math.abs(y2 - y1);
  var sx = (x1 < x2) ? 1 : -1;
  var sy = (y1 < y2) ? 1 : -1;
  var err = dx - dy;
  // First coordinates are not being added - it's assumed they were added in the last
  // iteration
  // Main loop
  while (!((x1 == x2) && (y1 == y2))) {
    var e2 = err << 1;
    if (e2 > -dy) {
      err -= dy;
      x1 += sx;
    }
    if (e2 < dx) {
      err += dx;
      y1 += sy;
    }
    result.push(x1);
    result.push(y1);
  }
  // Return the result
  return result;
}

But anyway, I need a trick to get this algorithm generate thicker line and I have no idea what to change. Should I generate circle of points for every point?

sentences:
How to get UE4 to correctly put my bundle identifier for iOS projects? Each time I create a new project UE4 adds a generic bundle identifier to the iOS platform settings, that I always have to change to com.myname.[PROJECT_NAME] in order to be able to run the newly created project. So, I wonder how can I make UE4 to correctly auto detect this field from the picked provisioning profile.

I was thinking something like putting [BUNDLE_IDENTIFIER] (including the square brackets) but the editor crashes when I put that in the bundle identifier field.

sentences:
Combining Many Small Colliders into Larger Ones I am creating a game using a tile-map made of many thousands of grid squares. At the moment, each square has a square collider on it for checking collisions.

However, with many thousands of tiny blocks, checking them all for collisions is inefficient. If I had known the tilemap was going to look like this in advance, I could have just used 3 or 4 big colliders rather than thousands of tiny ones:

Is there some sort of standard algorithm for combining many small adjacent tiles into maximally large ones? If so, could someone describe it here, or point to literature on such algorithms?

Alternatively, maybe pre-processing the tile colliders in this way is completely the wrong approach. If so, what is the correct one to deal with the efficiency of an extremely large number of colliders?

sentences:
How can I make my program load music from files? I'm working with a XNA game and I want my program to load music files from libary/music so I can play that music in the game.
It would be great if the mediaplayer class could play a playlist of all the music in library/music.

sentences:
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:
Change Camera Contrast in VR Game Hello there Firends ,
I'm developing a Virtual Reality game in Unity. As in every VR game , i have 2 cameras for stereo rendering.
I want to show the same object in each camera having different color/contrast ratio> The effect is similar to the one shown in this image :

the grid in the center here is the same in each side but each camera is seeing it differently.i.e. its grey in the left and black in right (you will notice the black grid if you look closely)
here is another example :

(source: wired.co.uk)
How do i get this effect ? Any suggestions ?

sentences:
Box collisions between vehicles in traffic pattern I'm working on a traffic simulator. Right now, I have ways to manage 4-way stop intersections and a solution for efficiently determining which vehicles are colliding with one another. All vehicles operate independently of each other and will overlap/ignore any vehicles they pass.

I'm looking to build a way to resolve collisions between vehicles such that a Vehicle will follow the Vehicle in front of it. If a Vehicle stops at an intersection, any Vehicles that follow thereafter should stop and wait as well.

Below are the relevant components I already implemented:

TileGrid containing road segments.
TravelGraph graph of waypoints for Vehicles to travel along the TileGrid.
CollisionTracker for efficiently determining which vehicles are colliding, i.e. O(1) lookup for get_collisions(<vehicle_id>) -> List[<vehicle_ids>]
Intersection for determining which vehicles are waiting at an intersection and determining which Vehicles may pass through it.

The only seemingly-viable algorithm right now is:

Calculate velocities and position of all vehicles after tick
Determine which vehicles are in a collision
Determine which vehicles are in a "collision group" (e.g. if A collides with B, collides with C, then (A, B, C) are in a group)
Determine the order of the vehicles in each group based on their velocities (e.g. if A, B, and C are moving to the right and C is the rightmost, followed by B, followed by A, then the order is [C, B, A]).
Recalculate the positions of all vehicles, in order from front to back (e.g. C, B, A) such that they reside adjacent to, but not touching the Vehicle in front of them.

Problems with this solution:

This requires a lot of recalculations. If there's a line of n vehicles waiting on a light, I'd effectively compute 2*n positions per tick in addition to all other overhead for establishing groups, order, etc.
If the vehicles are following each other around a turn, the logic for finding the "vehicle order" becomes more complex, adding on to the computations per tick.

Ideally moving the vehicles would require n calculations per tick.

I'm open to any/all suggestions here. I've tried building my code as modular as possible, so I'll happily rewrite large parts of it if there's a better architecture to solve this problem.

Below is the visual representation of the TileGrid (black), TileGraph (purple), and Vehicles (circles).

sentences:
Unity - Sprite with collider2d hits a rigidbody - Searching for a way to make the rigidbody not to react When a sprite with a box collider 2d hits the game object (rigid body),

the collision detection is fired and I get the event.

However, the sprite moves the rigidbody and I have trouble restoring it back.

I tried to create a collision detection without ridigbody but without success.

Is there a way so that the ridigbody is never moved?

Hint: I can't make it static, since the rigidbody becomes immovable.

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:
How can I unify the collision handling of melee/spell attacks in a networked environment? I am trying to figure a good way to create the battle system of a game. The game is fast paced and the gameplay needs to be precise (think hack n slash)

What I would like to achieve is a simple and unified system that could manage any type of attacks, that could be tweaked.

My first idea is to use physics shape: For example an arrow will just be a little capsule moving forward, an explosion would be a growing sphere collider, and melee combat could be done by spawning a box in front of the player.

One problem I have with this is that I'd like to have an authoritative server for multiplayer, which means I shouldn't use too much actual physics.

So, is there any standard way people program these sort of systems, do you know any good starting point better than just using physics?

sentences:
What would be a good filter to create 'magnetic deformers' from a depth map? In my project, I am creating a system for deforming a highly detailed mesh (clothing) so that it 'fits' a convex mesh.
To do this I use depth maps of the item and the 'hull' to determine at what point in world space the deviation occurs and the extent.

Simply transforming all occluded vertices to the depths as defined by the 'hull' is fairly effective, and has good performance, but it suffers the problem of not preserving the features of the mesh and requires extensive culling to avoid false-positives.

I would like instead to generate from the depth deviation map a set of simple 'deformers' which will 'push'* all vertices of the deformed mesh outwards (in world space). This way, all features of the mesh are preserved and there is no need to have complex heuristics to cull inappropriate vertices.

I am not sure how to go about generating this deformer set however. I am imagining something like an algorithm that attempts to match a spherical surface to each patch of contiguous deviations within a certain range, but do not know where to start doing this.

Can anyone suggest a suitable filter or algorithm for generating deformers? Or to put it another way 'compressing' a depth map?

(*Push because its fitting to a convex 'bulgy' humanoid so transforms are likely to be 'spherical' from the POV of the surface.)

Edit: Here is an image/diagram rightly suggested that illustrates what I am trying to achieve.

Also, I should say since this question was posted I worked a lot more on this problem, and though I never solved how to the get the deformers I did eventually decide that depth maps for this were unsuitable as:

If the deformed mesh is not complete, it is possible to get texels in the map that are meant to be on the other side of the convex mesh (because they are not obscured by those closer to the camera on the correct side).
The efficiency was not as high as I had hoped due to the fact 6 maps were needed per deformation.

Not that these were unsolvable, but the other solution, which involved collision testing in kernels running on the GPU, resulted in higher quality results and was much simpler, even though it may not be as fast.

I still think this questions problem is interesting though and would be interested in any answers as I am sure there are situations where it would be preferred.

sentences:
string and int concatenation resulting in null for a Tetris clone? I'm writing a tetris clone, and I have sprites (of every possible piece and rotation) loaded through the XNA content pipeline. For example, I have assets "i", "i2", "i3", and "i4" for each rotation of the 4-block-long I-tetrimino. For the O-tetrimino, I only have asset "o", because the O-tetrimino doesn't require any rotations.

I want to load each of these assets into a 2D array of Texture2Ds. Here's my attempt:

1 Texture2D[,] tetriminoTextures = new Texture2D[7, 4];
2 char[] tetriminos = { 'o', 'i', 'l', 'j', 'z', 's', 't' };
3 string t;
4
5 for (int i = 0; i < 7; i++)
6 {
7     for (int j = 1; i <= 4; i++)
8     {
9         if (i == 0 || j == 1) // If char[i] == 'o', then don't consider rotations.
10                              // The square piece doesn't have rotations.
11                              // If j == 1, then leave the asset name as is.
12            t = letters[i].ToString();
13        else // (i != 0 && j <= 2 && j <= 4)
14            t = letters[i].ToString() + j;
15        tetriminoTextures[i, j-1] = Content.Load<Texture2D>(t);
16    }
17 }

However, when I attempt to

spriteBatch.Draw(tetriminoTextures[x, y], /* some position vector */, Color.White);

I get an ArgumentNullException. Apparently tetriminoTextures[x, y] is null when y >= 1 && y <= 3.

I have no idea what's going on. I think it may have something to do with my concatenating a string and an int together in line 14. But I'm getting an ArgumentNullException even when i == 0 && j >= 2 && j <= 4 (i.e. for each rotation of the O-tetrimino excluding the first one), though the if statement in line 9 should have caught these cases. Any help would be appreciated!

sentences: Texture packing algorithm What is a good texture packing algorithm?  Technically, bin packing is NP-hard, so a heuristic is what I'm really after.

sentences:
Optimal data size for a 3G client-server game? I'm currently working on an iOS turn-based client-server game and I am concerned over later performance issues.

How much data per message is too big? I am planning to use JSON to transfer data (and, if possible, gzip it for more compression) and try to send as little as possible to make it work, but is there a figure I should keep in mind so that I do not exceed and is there a best-practice way of compressing this data?

On a side note, will this prevent me or affect whether I will use secure connections like SSL?

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:
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:
Libgdx problem while converting TextureRegion to Pixmap I'm developping a Tile base game where I have to generate transition tiles. To do so, I have a method that generate those tiles from 2 existing one and 1 "filter tile". I use this method to make a pixMap from the region I retrieved from my TextureAtlas.

public Pixmap getPixMapFromRegion(TextureRegion region){

    Texture texture = region.getTexture();
    TextureData data = texture.getTextureData();
    if (!data.isPrepared()) {
        data.prepare();
    }
    Pixmap pixmap = data.consumePixmap();
    int width = region.getRegionWidth();
    int height = region.getRegionHeight();
    Pixmap px = new Pixmap(width, height, Format.RGBA4444);
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            int colorInt = pixmap.getPixel(region.getRegionX() + x, region.getRegionY() + y);

        }
    }
    return px;
}

Them I apply this method

public Pixmap generateMixedTile(TiledMapTileSet tileset, AssetManager assMan,String template, TextureRegion region1, TextureRegion region2) {
    TextureAtlas atlas = assMan.get("../core/assets/tuiles/MergeFilter.atlas")
    AtlasRegion region = atlas.findRegion(template);
    Pixmap templ = getPixMapFromRegion(region);
    Pixmap img1 = getPixMapFromRegion(region1);
    Pixmap img2 = getPixMapFromRegion(region2);
    Pixmap res = newPixmap(region.getRegionWidth(),region.getRegionHeight(),Format.RGBA4444);

    for (int y = 0; y < templ.getHeight(); y++) {
        for (int x = 0; x < templ.getWidth(); x++) {
            if(0xFF000000 == templ.getPixel(x, y))
                res.drawPixel(x, y, img1.getPixel(x, y));
            else
                res.drawPixel(x, y, img2.getPixel(x, y));
        }
    }
    return res;
}

It seems that after asking again and again for the same texture in the AssetManager, I get a Couldn't load file ../core/assets/tuiles/Water3.png  Exception. But this happen after the system success a lot of time to access that same file.

So I don't know how I could handle that because I thought that using assetManager and Atlas was the bests practices

Any Idea of how to fix that or to do it in another way?

sentences:
SDL2 in a VS2015/C++ panel I'm trying to use SDL2 in a panel (VS2015/C++) and cannot find solid examples of how to connect the two. Anyone know how this is done?

I've tried some code found in various places, but no luck yet.  The code below was my latest attempt. I'm using latest version of SDL2.

SDL_Window* sdlWnd = SDL_CreateWindowFrom((void*)mapPanel->Handle);
SDL_SetWindowTitle(sdlWnd, "SDL Window - Set by SDL");
SDL_Surface* s = SDL_GetWindowSurface(sdlWnd);
SDL_FillRect(s, &s->clip_rect, 0xffff00ff);
SDL_UpdateWindowSurface(sdlWnd);
SDL_ShowWindow(sdlWnd);

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:
Replacing all objects in scene with another object I have around 100 objects (prefab A) in my scene, all in different positions.

Is it possible to replace all of these objects with another object (prefab B), so that the prefab B objects are placed in the same position as the prefab A objects were?

I want this done in the editor, not in game.

sentences:
How to move 3D Object With Touch Dragging Finger By the screen In android Unity Game My Code is As Followed:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Sphere : MonoBehaviour

{
    [SerializeField]
    private Touch touch;
    private float speedModifier;
    // Start is called before the first frame update
    void Start()
    {
        speedModifier = 0.01f;
    }

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

    {
        if (Input.touchCount > 0)
        {
            touch = Input.GetTouch(0);

            if (touch.phase == TouchPhase.Moved)
            {
                transform.position = new Vector3(
                    transform.position.x + touch.deltaPosition.x * speedModifier,
                    transform.position.y,
                    transform.position.z + touch.deltaPosition.y * speedModifier);
            }
        }

    }
}

I tried with this code but object is not even responding

sentences:
How to expand the limit of screen mouse access for FPS side rotation I started coding in Godot and i have a working FPS controller but the problem is that when i move my mouse sideways , it cannot move my sight beyinid that side of my screen , in other words the movement of my charecter is limited by the size of my screen , how to prevent this
Rotation code
func _input(event):
if event is InputEventMouseMotion:
    head.rotate_y(deg2rad(event.relative.x * -mouseSensitivity))
    camera.rotate_x(deg2rad(event.relative.y * -mouseSensitivity))

sentences:
How does a custom physics engine connect to a tile graphics engine? I’ve been looking into adding physics to my tile based side scroller game, and it seems like the best option might be to write my own engine to handle things like collisions and gravity due to the simplicity of what it is I need.

I mostly understand the math that I need and some of the techniques to get the functionality I want (such as slopes), but the part I'm still missing is how the physics relates to the graphics, as well as how to actually implement that connection.

All that I've seen is that physics and graphics are separate, but are updated together (the textures/animations change according to the interactions from the physics engine). Aside from that, however, I have very little idea what I'm doing.

My question is: When it comes to a tile-based game, how do you handle physics bodies and their creation? And on top of that, what would be an efficient way to connect the two engines to one another?

sentences:
Working towards going 3D I am a beginner-intermediate C++/Java programmer and my long term goal is to be a game programmer.

I have decided to start off with 2D and work my way towards 3D.

I would like to use SDL to start off with, but I am wondering if it is maybe not such a great idea.

Given the fact that I am working towards 3D, would it be advisable to use SDL or jump into OpenGL without the Z axis?

sentences:
DDS load texture and cubemaps I'm trying to render a skybox with a cubemap on it and to do so I'm using DDS Texture Loader from DirectXTex library. I use texassemble to generate the cubemap (texture array of 6 textures) into a DDS file that I load at runtime. I generated a cube "dome" and sample the texture using the position vector of the vertex as the sample coordinates (so far so good), but I always get the same face of the cubemap mapped on the sky. As I look around I always get the same face (and it wobbles a bit if I move the camera). My code:

//Texture.cpp:

    Texture::Texture(const wchar_t *textureFilePath, const std::string &textureType) : mType(textureType)
    {
        //CreateDDSTextureFromFile(Game::GetInstance()->GetDevice(), Game::GetInstance()->GetDeviceContext(), textureFilePath, &mResource, &mShaderResourceView);
        CreateDDSTextureFromFileEx(Game::GetInstance()->GetDevice(), Game::GetInstance()->GetDeviceContext(), textureFilePath, 0, D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, D3D11_RESOURCE_MISC_TEXTURECUBE, false, &mResource, &mShaderResourceView);
    }

// SkyBox.cpp:

void SkyBox::Draw()
{
    // set cube map
    ID3D11ShaderResourceView *resource = mTexture.GetResource();
    Game::GetInstance()->GetDeviceContext()->PSSetShaderResources(0, 1, &resource);

    // set primitive topology
    Game::GetInstance()->GetDeviceContext()->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

    mMesh.Bind();
    mMesh.Draw();
}

// Vertex Shader:

cbuffer Transform : register(b0)
{
    float4x4 viewProjectionMatrix;
};

float4 main(inout float3 pos : POSITION) : SV_POSITION
{
    return mul(float4(pos, 1.0f), viewProjectionMatrix);
}

// Pixel Shader:

SamplerState cubeSampler;
TextureCube cubeMap;

float4 main(in float3 pos : POSITION) : SV_TARGET
{
    float4 color = cubeMap.Sample(cubeSampler, pos.xyz);
    return color;
}

I tried both functions grom DDS loader but I keep getting the same result. All results I found on the web are about the old SDK toolkits, but I'm using the new DirectXTex lib.

sentences:
Picking problem with rotated view matrix I have picking code that works, if my view matrix has no rotation (only translation). Now If I rotate my camera, picking goes to hell.

I cant find whats wrong

My code:

/*-----------------------------------------------------------
Function:   GetViewportSystem
Returns:
    viewportCoordSystem

Get viewport coordinate system (only for reading)
Forward ray goes through origin
d = distance |camera, projection plane|
cameraPos = position of camera in World Space
lookAt = camera target in World Space
-------------------------------------------------------------*/
ViewportCoordSystem Camera::GetViewportSystem() const
{
    ViewportCoordSystem viewportCoord;
    viewportCoord.w = this->cameraPos;
    viewportCoord.w = this->cameraPos - this->lookAt;
    viewportCoord.w.Normalize();

    viewportCoord.u = MyMath::Vector3::Cross(viewportCoord.w, MyMath::Vector3::UnitY());

    viewportCoord.v = MyMath::Vector3::Cross(viewportCoord.u, viewportCoord.w);

    float d = (this->viewport.Height * 0.5f) * (1.0f / tanf(this->viewport.fov * 0.5f));

    viewportCoord.origin = this->cameraPos;
    viewportCoord.origin -= d * viewportCoord.w;

    return viewportCoord;
}

/*-----------------------------------------------------------
Function:   MapViewport2Dto3D
Parametrs:
    [in] viewportSystem - cameras viewport coordinate system
    [in] point - 2D point on image
Returns:
    3D mapped point in space

Map 2D image point to 3D space
Info about mappind 2D to 3D: http://meatfighter.com/juggler/
-------------------------------------------------------------*/
MyMath::Vector3 Camera::MapViewport2Dto3D(const ViewportCoordSystem & viewportSystem, const MyMath::Vector2 & point) const
{
    MyMath::Vector3 res = viewportSystem.origin;
    res += (point.X - this->viewport.Width * 0.5f) * viewportSystem.u;
    res += (this->viewport.Height * 0.5f - point.Y) * viewportSystem.v;

    return res;
}

And calculating ray (x, y are mouse coordinates within screen, my world is scaled, so I amd trasnforming ray and origin to transformed world)

    ViewportCoordSystem vpSystem = this->camera->GetViewportSystem();
    MyMath::Vector3 pos = this->camera->MapViewport2Dto3D(vpSystem, MyMath::Vector2(x, y));

    float inverseScale = 1.0f / scale;
    MyMath::Matrix4x4 worldInv = MyMath::Matrix4x4::Scaling(inverseScale, inverseScale, inverseScale);

    this->ray.dir = pos - this->camera->GetPosition();
    this->ray.dir = MyMath::Vector3::TransformCoordinate(this->ray.dir, worldInv); //transform ray to object space
    this->ray.dir.Normalize();

    this->ray.origin = this->camera->GetPosition();
    this->ray.origin = MyMath::Vector3::TransformCoordinate(this->ray.origin, worldInv); //transform ray to object space

sentences:
Can I use copyrighted sprites for a demo? I just had a quick question and wanted everyone's opinions.

I'm making a 2D demo game for a resume which I want to post online. I'm applying as a programmer position so I don't really have my own art. I am planning on using sprite sheets and tile sets from other games in order to create just one or two levels on my demo. I will give credit at the bottom of the screen and state that these sprites are not my own.

Is this a good idea or could this be potentially "dangerous" in the illegal sense?

sentences:
Changing an Image's alpha through an animation in Unity I'm trying to change an Image's alpha through a legacy animation in Unity, so that it fades in and out in a loop. The animation works: I can see the color updated in realtime in the inspector. But the Image is not actually being updated. I know that it is possible this way, since changing the alpha manually in the inspector does change the opacity of the Image.

I could write a script for this, but would prefer to do it through an animation.

sentences:
Directional shadow mapping view/projection matrices I've got shadow mapping with directional lights working, but I believe I am constructing the view/projection matrices wrong.

Here's how I build them:

Mat4 viewMatrix = LookAt(lighting.mCameraPosition + (directionalLight.mLightDirection * Z_FAR / 2.0f), -directionalLight.mLightDirection, Vec3(0.0f, 1.0f, 0.0f));
Mat4 lightVP = CreateOrthographicMatrix(-Z_FAR, Z_FAR, -Z_FAR, Z_FAR, Z_NEAR, Z_FAR) * viewMatrix;

The problem is the shadows become skewed and change depending on the camera position, which is bad. What is the proper way of doing this?

EDIT:

1) No, that is what I'm not sure about; currently as you said it is the camera position and thus the shadows moves around when I move the camera, which is bad - what should be the actual position, since directional lights have no position?

2) Also using Z_FAR DOES make it pixelated which is my second problem - but must not the boundaries be Z_FAR in all directions, otherwise objects in the view range may not cast shadows?

sentences:
Executing Components in an Entity Component System Ok so I am just starting to grasp the whole ECS paradigm right now and I need clarification on a few things. For the record, I am trying to develop a game using C++ and OpenGL and I'm relatively new to game programming. First of all, lets say I have an Entity class which may have several components such as a MeshRenderer,Collider etc. From what I have read, I understand that each "system" carries out a specific task such as calculating physics and rendering and may use more that one component if needed. So for example, I would have a MeshRendererSystem act on all entities with a MeshRenderer component. Looking at Unity, I see that each Gameobject has, by default, got components such as a renderer, camera, collider and rigidbody etc. From what I understand, an entity should start out as an empty "container" and should be filled with components to create a certain type of game object. So what I dont understand is how the "system" works in an entity component system.

http://docs.unity3d.com/ScriptReference/GameObject.html

So I have a GameObject(The Entity) class like

class GameObject
{
public:
    GameObject(std::string objectName);
    ~GameObject(void);
    Component AddComponent(std::string name);
    Component AddComponent(Component componentType);
};

So if I had a GameObject to model a warship and I wanted to add a MeshRenderer component, I would do the following:

warship->AddComponent(new MeshRenderer());

In the MeshRenderers constructor, should I call on the MeshRendererSystem and "subscribe" the warship object to this system? In that case, the MeshRendererSystem should probably be a Singleton("shudder").  From looking at unity's GameObject, if each object potentially has a renderer or any of the components in the default GameObject class, then Unity would iterate over all objects available. To me, this seems kind of unnecessary since some objects might not need to be rendered for example. How, in practice, should these systems be implemented?

sentences:
LibGdx: How to check if VSync is enabled I am just about finished my options screen, the only thing I need is some way of detecting if Vsync is enabled or not.

I'm using LibGdx 1.5. I have tried to find an access to wglSwapIntervals, but haven't found one. Libgdxs API only allows a setVsync options that accepts a Boolean.

If anyone could shed some light on this, it would be greatly appreciated!

sentences:
Keeping the meshes "thickness" the same when scaling an object I've been bashing my head for the past couple of weeks trying to find a way to help me accomplish, on first look very easy task. So, I got this one object currently made out of 5 cuboids (2 sides, 1 top, 1 bottom, 1 back), this is just for an example, later on there will be whole range of different set ups. Now, the thing is when the user chooses to scale the whole object this is what should happen:

X scale: top and bottom cuboids should get scaled by a scale factor, sides should get moved so they are positioned just like they were before(in this case at both ends of top and bottom cuboids), back should get scaled so it fits like before(if I simply scale it by a scale factor it will leave gaps  on each side).

Y scale: sides should get scaled by a scale factor, top and bottom cuboid should get moved, and back should also get scaled.

Z scale: sides, top and bottom cuboids should get scaled, back should get moved.

Hope you can help,

EDIT
I am asking you, if any of you have any idea on how to accomplish this scaling.

I have tried whole bunch of things, from scaling all of the object by the same scale factor, to subtracting and adding sizes to get the right size. But nothing I tried worked, if one mesh got scaled correctly then others didn't.

Donwload the example object.

sentences:
Do game engines put all interpolation onto the GPU? Is it considered standard to push all the vertices and an interpolation of the next position onto the GPU?

Suppose a sector is moving up every game tick at 50 units per second. You could put on the shader something like (good old parametric equation-like formulas):

pos.x = a*x1 + (1 - a)*x0;

Where you'd calculate a as a uniform and only send this value to the GPU in an uncapped fashion, like so:

while (true) {
    a = percentage of the way between frames [in range from 0.0 to 1.0]
    updateGLUniform(..., a);
    render();

    // Rest of stuff

    delay();
}

The other way of doing it was to manually set each entity and sector every single time you loop, but then you might have to update the position of a lot of things every game cycle. Just setting one value seems way more efficient.

However, I don't know if there's any downsides to this. Are there any negatives to shoving interpolation off to the GPU to save computation time in the game? Or is there something that I'm missing? What do major games do?

sentences:
how can i make my game more intuitive without a tutorial? i am currntly working on a mobile game app. the game details a tree with several branches on which diffrent types of birds fly and land on. every bird has a diffrent weight and the purpose of the user is to balance the weight on each side of the tree before the branches break. i attached a screen shot of the game, and i hope someone will have a suggestion on how to make the concept of the game more understandable to users without having to let them do a tutorial. second, what would be your guess about the purpose of the game when you look at the screen shot? and third, i was hoping to add a bending feature to the tree that will enable the user to save the tree by actually moving his phone but it is problematic when the design is made with pixel art - any other thoughts?
thank you,

sentences:
Can't show an object in a tapped coordinate So hi, I have a problem. I want to show an object (Texture2D) in an area tapped by user. This is my fields :

List<Texture2D> list = new List<Texture2D>();
List<Vector2> list2 = new List<Vector2>();
List<int> list3 = new List<int>();

list, is used to store the object. list2, used to store tapped coordinate. and list3, is used to store object timeout (after 100ms, the shown object vanishes)

This is my update method

protected override void Update(GameTime gameTime)
{
    TouchCollection touchState = TouchPanel.GetState();

    foreach (TouchLocation t in touchState)
    {
        if (t.State == TouchLocationState.Pressed)
        {
            list.Add(Content.Load<Texture2D>("base_grass"));
            list2.Add(new Vector2 { X = t.Position.X, Y = t.Position.Y });
            list3.Add(100);

            System.Console.WriteLine("added : " + t.Position.Y + "," + t.Position.X);
        }
    }

    for (int i = 0; i < list3.Count; i++)
    {
        list3[i]--;

        if (list3[i] <= 0)
        {
            list.RemoveAt(i);
            list2.RemoveAt(i);
            list3.RemoveAt(i);
        }
    }
    base.Update(gameTime);
}

(base_grass is the name of my object. It is a plain rectangle image)

The "for" statement is to remove the object when the time expires.

And this is my draw method

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.White);

    _spriteBatch2.Begin();

    for (int i = 0; i < list.Count; i++)
    {
        _spriteBatch2.Draw(list[i], list2[i], new Rectangle(0, 0, 64, 64),
                Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1);
    }
    _spriteBatch2.End();

    base.Draw(gameTime);
}

Nothing shown when I clicked on the screen.

But if I change the _spriteBatch2.Draw into this

 _spriteBatch2.Draw(list[i], new Vector2((64 * 0),(64 * i)), new Rectangle(0, 0, 64,64), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1);

It worked, but shown vertically, not on the tapped / clicked coordinate.

Anyone know where my problem is? Thanks

sentences:
file:write restarts Corona app I am attempting to implement an auto-save feature into a mobile game.  I have the following code writing to the save file:

function saveFunc(input)
local saveData=input
local file = io.open( "saveFile.txt", "w" )

for i,val in ipairs(saveTable) do
    saveData=saveData.."\n"..val
end

file:write( saveData )
io.close( file )
end

This writes to the file correctly.  The problem is that after the function finishes, the whole app restarts.  Watching the output console, it re-prints the "Copyright (C)..." as if I had Relaunched the app.

I know it is this specific function because if I comment out the call for this function the game continues as normal.  I also tried commenting out the io.close(file) but the program still restarted.

How can I write to a file and not restart the app?

sentences:
Uniform arrays do not work on every GPU I am trying to implement instanced rendering for objects that repeat, so I came up with idea I could simply group objects that loaded same model files, create array with their Model matrices and so on, and finally pass this array as uniform array to shaders, which will be indexed by gl_instanceID to get correct model matrix for given objects.

C++ implementation looks pretty much like this:
    std::vector RelativePositions, Scales;
    std::vector Models;

int ctr = 0;
bool first = true;
int isz = 0; obj->getIndices(isz);

// pDrawData->refObjects holds all Object3D instances which share same model geometry

for (std::list<IObject3D*>::iterator pObj = pDrawData->refObjects.begin(); pObj != pDrawData->refObjects.end(); pObj++) {
    IObject3D *obj = *pObj;
    int render = prepareForRender(obj, flags, isShadow, offset);
    if (!render) continue;
    if (first) {    //this is gonna be same for all objects of this class
        setUniform(Type, (int)obj->getType());
        setUniform(Flags, (int)obj->getFlags());
        first = false;
    }
    Scales.push_back(obj->getScale());
    RelativePositions.push_back(obj->getPos());
    Models.push_back(obj->getModel());
    ctr++;
}
if (ctr) {
    int Rem = 0;
    const int Step = MAX_OBJ_PER_INST;  // = 64
    for (size_t i = 0, j = Scales.size(); i < j; i+=Step) {
        Rem = Scales.size() - i;
        if (Rem > Step) Rem = Step;
        //following functions set uniform array of specified length
        setUniform(Scale, Scales.data()+i, Rem);
        setUniform(RelativePosition, RelativePositions.data()+i, Rem);
        setUniform(Model, Models.data()+i, Rem);
        glDrawElementsInstanced(GL_TRIANGLES, (GLsizei)isz, GL_UNSIGNED_INT, 0, Rem);
    }
}

Rendering object is done via Vertex Shader > Tess Control Shader > Tess Eval Shader > Geom Shader > FragmentShader.
Instance ID is being passed using flat out/in int InstanceID; from shader to shader while being once set in Vertex shader as gl_InstanceID.

Tessellation Evaluation Shader logics look like this:

    #version 430
    layout(triangles) in;

    in vec3 tcPosition[];
    in vec3 tcTexCoord[];
    in vec3 tcNormal[];
    flat in int tcInstanceID[];

    out vec3 tePosition;
    out vec3 teDistance;
    out vec3 teTexCoord;
    out vec3 teNormal;
    flat out int teInstanceID;

    #define MAX_OBJ_PER_INST 64

    uniform mat4 Model[MAX_OBJ_PER_INST];
    uniform vec3 Scale[MAX_OBJ_PER_INST];
    uniform vec3 RelativePosition[MAX_OBJ_PER_INST];

    // ... other uniforms

    void main(void)
    {
        vec3 p0 = gl_TessCoord.x * tcPosition[0];
        vec3 p1 = gl_TessCoord.y * tcPosition[1];
        vec3 p2 = gl_TessCoord.z * tcPosition[2];

        // ... other stuff ...

        teDistance = gl_TessCoord;
        tePosition = (p0 + p1 + p2);
        teInstanceID = tcInstanceID[0];

        switch(Type){
            // ... other types ...
            default:
                tePosition = (vec4(tePosition,1)* Model[teInstanceID]).xyz * Scale[teInstanceID] + RelativePosition[teInstanceID];
                break;
        }
    }

This works fine when I run it on any nVidia GPU when on laptop, but when I try to run it on AMD GPU or Intel Integrated Graphics, it suddenly doesn't work and I only get blank screen.

But if I remove uniform arrays and pass only single variable for uniform, so all instances would suddenly have same model matrix, position and scale, it works even on other GPUs, so problem is definitely with arrays...

Is there any solution to this?

sentences:
OpenGL ES 2.0: Controlling Transparency in Fragment Shader The following is the OpenGL ES 2.0 simple GLSL Fragment Shader, I use to place textures on polygons, to render 2D sprites.

varying mediump vec2 TextureCoordOut;
uniform sampler2D Sampler;

void main()
{
gl_FragColor = texture2D(Sampler, TextureCoordOut);
//gl_FragColor = vec4(texture2D(Sampler, TextureCoordOut).xyz, TextureCoordOut.w * 0.5);

}

The fragment shader places voxels with alpha information taken from the source 2D texutre(.png image). Apart from alpha information, I need to control overall polygon/sprite transparency to achieve Fade In/Fade Out effects.

Could you show me, please, how to modify the above shader to control the overall transparency, besides the alpha information?

Note: The commented out line is used for my attempts to achieve the transparency. I wish to combine both the alpha information with the overall polygon/sprite transparency.

Thanks.

sentences:
Component-wise GLSL vector branching I'm aware that it usually is a BAD idea to operate separately on GLSL vec's components separately.
For example:

//use instrinsic functions, they do the calculation on 4 components at a time.
float dot = v1.x*v2.x + v1.y * v2.y + v1.z * v2.z; //WRONG
float dot = dot(v1, v2); //RIGHT

//Multiply one by one is bad too, since the ALU can do the 4 components at a time.
vec3 mul = vec3(v1.x * v2.x, v1.y * v2.y, v1.z * v2.z); //WRONG
vec3 mul = v1 * v2; //RIGHT

I've been struggling thinking, are there equivalent operations for branching?

For example:

vec4 Overlay(vec4 v1, vec4 v2, vec4 opacity)
{
    bvec4 less = lessThan(v1, vec4(0.5));
    vec4 blend;
    for(int i = 0; i < 4; ++i)
    {
        if(less[i]) {
            blend[i] = 2.0 * v1[i] * v2[i];
        } else {
            blend[i] = 1.0 - 2.0 * (1.0 - v1[i]) * (1.0 - v2[i]);
        }
    }
    return v1 + (blend - v1) * opacity;
}

This is a Overlay operator that works component wise. I'm not sure if this is the best way to do it, since I'm afraid these for and if can be a bottleneck later.

Tl;dr, Can I branch component wise? If yes, how can I optimize that Overlay function with it?

sentences:
XNA spritebatch drawing to the centre of screen I have bit of a silly problem.

Is is possible to use SpriteBatch.Draw() method to draw to the centre of screen using coords from the beginning of window (So resolution 800x600 would use 400;300) instead of coords from the beginning of the Game coordinates? Right now I'm doing calculations to keep the object in the centre of screen but I'm wondering if theres easier method how to solve this.

I tried googling, but either this hasn't been discussed anywhere or I'm using wrong keywords in search.

Thank you.

sentences:
map/world "decorator" algorithms/patterns I've spent a lot of time working with perlin/simplex noise for different styles of map gen, but I'm having a hard time finding advice/resources on how to populate the map with "world decor" that have some patterns to them... not just a random flower or tree.

I can control where on the map they spawn based on the height/temp values, but what are some good ways to control "patterns" the items spawn in?

For example, I want a specific plant to always spawn in clusters, but I want it to look natural and random - a bunch all together in a cluster and some individuals further out. I don't want all spawn instances to look the same.

A good reference is the Minecraft ore spawner - they're always in random configurations with some min/max size variations. Larger veins are even more rare.

sentences:
How to calculate the distance between a Vector3 and a (3D polygon triangle)? How to calculate the distance between a Vector3 and a (3D polygon triangle)?

for example : " float DistanceToTrianale( Vector3 pos, Vector3 Edges1, Vector3 Edges2, Vector3 Edges3)

thanks in advance

sentences:
How to make a dynamic frontline system for my game? My problem:
Basically the units, units meaning soldiers or vehicles, influence the frontline by moving into the opponents territory (See example image).
I'm trying to understand where to even start with this. I honestly have no idea what kind algorithm would be used to create this kind of system.
Example Image:

More info about the example:
https://www.eugensystems.com/steel-division-normandy-44-gameplay-dynamic-front-line/
This system is not node or tile based, but is fully dynamic (almost looks like a fluid simulation lol). I figured out I would render the line by using spline interpolation with points, but I don't understand the math behind the system itself (the part that controls how the line moves and creates points).
It's really cool and I would love to know where I would even start. Any free references would be highly appreciated.
Thank you!

sentences:
Render 2D textures on a 3D object's face I am not familiar with 3D graphics, and I'd like to know the right way to render some 2D figures on different points of a wider face of a 3D object. My 3D object is just a cube representing a poker table. I have a 2D png for players' placeholders, and I'd like to render these figures on the 3D object where needed. An alternative solution would be to render the whole face with a big picture containing all the placeholders figures. However, it would be a waste of memory and thus less efficient.

What do you suggest?

sentences:
Execute native ios code in unity I want to execute native iOS code in unity. For this I have added two files in /plugins/ios.

ViewController.h
ViewController.m

Code for each file represented as under.

ViewController.h

@interface ViewController

-(void)sampleMethod;
@end

ViewController.m

#import "ViewController.h"

@implementation ViewController

-(void)sampleMethod
{
     NSLog(@"Sample Method Execute");
}
@end

For C# file I have added following code

[DllImport("__Internal")]
private static extern void sampleMethod();

and call to above method

sampleMethod();

When I am export project for iOS, xCode give me following error that I can't able to understand.

I can't able to understand how to solve this problem? Please give some suggestion here.

EDIT :

I have added extern keyword in my .m file after reading some suggestion.

#import "ViewController.h"

@implementation ViewController

extern "C"
{
   -(void)sampleMethod
   {
        NSLog(@"Sample Method Execute");
   }
}
@end

But in xCode now I am getting Expected Identifier or '(' at the line of extern keyword line. So what to do next?

sentences:
Spawn system not working correctly I try to spawn one or two obstacle at the same time given the position rightpos, midpos, and leftpos but i keep getting the spawn position to only rightpos and midpos.

     void Start () {
     rightpos = new Vector2(2f,6f);
     midpos = new Vector2 (0f,6f);
     leftpos = new Vector2 (-2f, 6f);
 }

 // Update is called once per frame
 void Update () {
     if (spawn_activate == true) {
         number_of_spawn = Random.Range (1, 2);
         spawn_activate = false;
     }
     if (number_of_spawn > 0) {
         spawnposition = Random.Range (0, 2);
         if (spawnposition == 0) {
             Instantiate(obstacle,rightpos,Quaternion.identity);
         }
         if(spawnposition == 1) {
             Instantiate(obstacle,midpos,Quaternion.identity);
         }
         if(spawnposition == 2) {
             Instantiate(obstacle,leftpos,Quaternion.identity);
         }
         number_of_spawn -= 1;
     }
 }

sentences:
Three points to normal notation (interpret the math) From: Euclidian Space: Planes, I see the formula:

  Convert Three points to normal notation

  N = (p1-p0) × (p2 - p0)

  d = -N • p0^2

  where:

  N = normal to plane (not necessarily unit length) d = perpendicular
  distance of plane from origin. p0,p1 and p2 = vertex points x = cross
  product

When calculating the distance to the origin from the plane (d)...
A) how is the p0 squared?
B) how do I resolve the dot product of the vector (-N dot p0^2) to scalar distance?

sentences:
Network interpolation wont work for local player im currently developing a little duengon crawler. It should have lan multiplayer and it works great but i think im sending to much packets. Should i send packets over network, when a player moves in delta time? But thats not my question.... Sometimes it lags when more than 2 players are online. So i thought interpolation would be a great idea. But im not sure if i did that right, because it isnt much more fluently when the player moves :/ Heres what i did :

    positionFromInput.set(posX, posY);

    differenzX = positionFromInput.x-position.x;
    differenzY = positionFromInput.y-position.y;

    position.x += differenzX/10;
    position.y += differenzY/10;

I thought this would be right ... but it wont work what i did i missed ?

>>>UPDATE<<<

I think it only wont work for the local player because , if theres another player, his position is sended to the host, right after that the other player is drawn correctly with interpolation...

Heres how i move my local player :

public void update(){

            state = 0;

           if(Gdx.input.isKeyPressed(Keys.A) && moveDirections[0]){
               position.x -= Gdx.graphics.getDeltaTime() * 200f;

               state = 1;

           }
           if(Gdx.input.isKeyPressed(Keys.D) && moveDirections[1]){
               position.x += Gdx.graphics.getDeltaTime() * 200f;

               state = 2;
               //System.out.println(currentState);
           }
           if(Gdx.input.isKeyPressed(Keys.W) && moveDirections[2]){
               position.y += Gdx.graphics.getDeltaTime() * 200f;

               state = 3;
               //System.out.println(currentState);
           }
           if(Gdx.input.isKeyPressed(Keys.S) && moveDirections[3]){
               position.y -= Gdx.graphics.getDeltaTime() * 200f;

               state = 4;

           }

}

This is being called in an Launcher, which is called in the render method.

Class Launcher{

.
.
.

public void update(){

    gameScreen.player.update();

    // other stuff like updating packets
    .
    .
    .

}

.
.
.

}

And this is called in the render thread :

@Override
public void render(float delta) {

.
.
.

launcher.update();

.
.
.

}

Thats not all, i also need to draw my player :

public void draw( final float posX, final float posY,  OrthographicCamera camera){

    interpolate(posX, posY);

      camera.position.set(position.x/Box2dVars.UNIT,position.y/Box2dVars.UNIT,0);
    camera.update();

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    batch.draw(currentFrame, position.x/Box2dVars.UNIT, position.y/Box2dVars.UNIT, playerWidth/Box2dVars.UNIT, playerHeight/Box2dVars.UNIT);
    batch.end();

}

The interpolate() is just the interpolation....

private void interpolate(float posX, float posY){

    interpolatePosition.set(posX, posY);

    differenzX = interpolatePosition.x-position.x;
    differenzY = interpolatePosition.y-position.y;

    position.x += differenzX/10;
    position.y += differenzY/10;

}

To draw the player it is also gonna called in the render thread :

@Override
public void render(float delta) {

.
.
.

launcher.update();

.
.
.

player.draw(launcher.getPlayerX(),launcher.getPlayerY());

.
.
.

}

sentences:
Removing a pair from array of pairs Im making a Breakout clone game and im stuck with deleting objects after they are hit. There are 3 rows. Each contains 12 blocks.

I'm trying to delete a pair in the array of pairs. The array contains coordinates of an object (texture) displayed, and if that object is hit with a ball I want to delete it and then my ball changes direction.

for each(pair<int, int> par in koordinateBlokova) {

    if (provjeraKolizijeBloka(par.first, par.second, rectLoptica) == true) {
        lopticaTrenutniY = -lopticaTrenutniY;

    }
}

Array and SDL_Rects are defined like:

pair<int, int> koordinateBlokova[36];
SDL_Rect rectBlock01;
SDL_Rect rectBlock02;
SDL_Rect rectBlock03;

Their definition is:

for (int j = 0; j < brojBlokovaRed; j++) {

    rectBlock01 = initRectBlock(j*sirinaBloka + j*razmakRedova, gornjiOdstoj, sirinaBloka, visinaBloka);
    rectBlock02 = initRectBlock(j*sirinaBloka + j*razmakRedova, gornjiOdstoj + visinaBloka + razmakStupaca, sirinaBloka, visinaBloka);
    rectBlock03 = initRectBlock(j*sirinaBloka + j*razmakRedova, gornjiOdstoj + 2 * visinaBloka + 2 * razmakStupaca, sirinaBloka, visinaBloka);

    SDL_RenderCopy(renderer, block01, NULL, &rectBlock01);
    SDL_SetRenderTarget(renderer, block01);
    koordinateBlokova[j] = make_pair(rectBlock01.x, rectBlock01.y);

    if ((j + 1) % 3 == 0) { // if its 3rd block, make it a impenetrable (not implemented yet, just drawn)
        SDL_RenderCopy(renderer, blockNeprobojni, NULL, &rectBlock02);
        SDL_SetRenderTarget(renderer, blockNeprobojni);
        koordinateBlokova[j+12] = make_pair(rectBlock02.x, rectBlock02.y);
    }
    else {
        SDL_RenderCopy(renderer, block02, NULL, &rectBlock02);
        SDL_SetRenderTarget(renderer, block02);
        koordinateBlokova[j+12] = make_pair(rectBlock02.x, rectBlock02.y);
    }

    SDL_RenderCopy(renderer, block01, NULL, &rectBlock03);
    SDL_SetRenderTarget(renderer, block01);
    koordinateBlokova[j+24] = make_pair(rectBlock03.x, rectBlock03.y);
}
SDL_SetRenderTarget(renderer, NULL);
SDL_RenderPresent(renderer);

To make it easier to understand:

brojBlokovaRed = number of blocks in a row
sirinaBloka= block width
visinaBloka= block height
razmakRedova = space between rows
razmakStupaca = space between columns
gornjiOdstoj = space from top of the screen to first row of blocks

My question is how to delete that current pair from array?

sentences:
Lua GameDev iOS - Code on win and mac I am searching for a simple framework like http://getmoai.com where you can simply code a game in lua for iOS. I want to build it along with a friend. I am using a Mac, he prefers windows so the fw needs to be used in Windows 7. Preferably something like LOVE2D but then offcourse also for iOS!

Thanks in advance

sentences:
handling buffers in OpenGL I'm reading through the OpenGL documentation for version 3.3 core. I'm having issues understanding proper buffer deletion.

At the moment I have an object that loads itself into OpenGL memory in the constructor and only exposes a VAO with the attribute pointers and a bound element array ready for rendering. When it stops existing it deletes all the buffers and sets pointers to NULL.

How do I properly delete OpenGL data? I'm going to assume that the object doesn't stop existing while it's being rendered. Do I have to do something more than just delete the VAO and then delete the buffer objects? Does that leave anything out? Should I bind the VAO disable the attributes, unbind it and then delete it?

sentences:
Ball bouncing and throwing, how to? I was given a task to make a 3D game for Android, but since I never programmed games and opengl until now I'm totally lost on how and where to start.
Right now I'm using libgdx framework to ease my development or at least I thought it would.
I looked into invaders libgdx demo, but everything is so confusing and not consistent with latest version of framework, and it also looks that it's not very clean and scalable approach.

I have two 3D models, ball and basket. Now I need to animate ball throwing with all the math for hitting the basket, bouncing from basket and floor etc.
So my question is can somebody please help me out or direct me to some useful resources about those kind of games.

I somehow managed to get ball moving by rendering ball model and calling glTranslatef to move it, but that's it, all it do is just moves constantly in same direction. I would like to pick it and throw it in arc to hit the basket.

sentences: Unity development build not connecting to profiler my development build( with auto connect profiler checked ) is not working. The build runs correctly but no data is displayed in the profiler window. In the console, it says failed to connect.

sentences: Why does OpenGL require all coordinates in [-1,1] (NDC)? Why shouldn't the z coordinate be normalized to the [0,1] range instead of [-1,1]? As I understand it, that happens some time after anyways, so what's the catch with this?

sentences:
How to convert OpenGL 2.0 code to OpenGL-ES 2.0? I have a 3D game library that uses OpenGL 2.0 for PC and I need to convert it to OpenGL-ES 2.0 to compile it for Android.
Because the library is huge, I'd like to avoid converting it line-by-line by hand.
Is there some faster way I can convert desktop OpenGL to OpenGL-ES source code, like a wrapper, or maybe some layer running on Android that converts desktop OpenGL to ES at runtime?

sentences:
Why my calculated value is far different from actual value? I using CharacterController and not using a Rigidbody so I writing a script for downward velocity which is velocity=-9.81*(time) and I declare my initial velocity as 12. Supposing from this calculation, the max height it can reach from the equation is roughly 6.7891 unit on y axis. By using the formulae
distance travel=initial velocity*(time)-0.5g*(time)^2,differentiate this w.r.t time, getting time=u/g=12/9.81=1.223, then max distance travel=12*(1.223)-0.5*(-9.81)*(1.223)^2=7.339 but from the coordinate below, can clearly seen the max distance travel before falling down is 13.2803unit--0.5499unit=13.8302unit? This is far exceed calculated value, wonder what went wrong?
Initial coordinate of y on ground=-0.5499

approximate final coordinate of y=13.2803

using UnityEngine;

public class NewPlayerMovement : MonoBehaviour
{
    public CharacterController Controller;
    //speed of the character
    public float Speed = 12f;
    // earth gravitational value
    public float Gravity = -9.81f;
    Vector3 velocity;
    //hit point of character
    float hp = 90;

    bool Grounded = true;

    public void OnControllerColliderHit(ControllerColliderHit hit)
    {
        Grounded = true;
        hp -= velocity.magnitude;
        velocity.y = 0;
        Debug.Log(hp);
    }

    public void OnControllerColliderExit(ControllerColliderHit hit)
    {
        Grounded = false;
    }

    public void Checkstatus()
    {
        if(Grounded==false)
        {
            velocity.y += 0.5f * Gravity * Time.deltaTime;
        }
    }

    void Update()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        Vector3 move = transform.right * x + transform.forward * z;

        Controller.Move(move * Speed * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space) && velocity.y == 0)
        {
            velocity.y = 12;
            Grounded = false;
        }

       //check if it grounded
        Checkstatus();
        Controller.Move(velocity * Time.deltaTime);
    }
}

sentences:
How to change AddForce code to MovePosition or SetVelocity? Vector2 vec = new Vector2(horizontal, vertical);
    vec = Vector2.ClampMagnitude(vec, 1f);

    Vector3 camF = cam.transform.forward;
    Vector3 camR = cam.transform.right;

    camF.y = 0;
    camR.y = 0;
    camF = camF.normalized;
    camR = camR.normalized;

    targetPosition = (camF * vec.y + camR * vec.x) * MoveSpeed;

    Vector2 targetVelocity = (targetPosition - transform.position)/Time.deltaTime;

    rb.AddForce(targetPosition - rb.velocity, ForceMode.VelocityChange);

My problem is my character doesn't affects by the gravity when i changed my code from transform.position to rb.AddForce. I searched online and even asked here how to calculate gravity and add it to my character, nobody knew, so i think if i can change this code to rb.MovePosition or rb.SetVelocity maybe it does affects by the gravity?

sentences:
SDL_Mixer functions Mix_Quit versus Mix_CloseAudio Could someone please explain me the differences between the SDL_Mixer functions Mix_Quit and Mix_CloseAudio? I've read the documentation but couldn't really understand it clearly. When to use them and in which row (first Mix_Quit or Mix_CloseAudio?)?

Also, is it ok to use Mix_Quit after using Mix_CloseAudio? The documentation states that you should not call any SDL_Mixer function after Mix_CloseAudio, but it worked when I tested it.

sentences: Failed to initialise the LWJGL display I added the fix of adding this line "Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true" to vm arguments, updated my drivers but nothing is working......my error message still remain same has shown in the image

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:
My object just automatically "launch" or do stuff without me clicking on my mouse when it respawn? I've already set the ball (my object) initially at the start where I have to click for the ball to launch from the paddle (it's a ping pong game).
private void LockBallToPaddle() {
    Vector2 paddlePos = new Vector2(Paddle.transform.position.x,
        Paddle.transform.position.y);
    transform.position = paddlePos + paddleToBall; //For the ball to stick to the paddle
}

Launch the Ball:
private void LaunchBall() {
    if (Input.GetMouseButtonDown(0)) {
        hasStarted = true;
        rbBall.velocity = new Vector2(Random.Range(-2f, 2f),speedVelocity);
    }
}

Both of which I put under Update()
private void LaunchBall() {
    if (Input.GetMouseButtonDown(0)) {
        hasStarted = true;
        rbBall.velocity = new Vector2(Random.Range(-2f, 2f),speedVelocity);
    }
}

Now the problem is when my ball hits a certain collider, I want it to respawn the position back to the paddle. So instead of Destroy the game object, I just copy and paste those same methods under collision
if (collision.gameObject.tag == "bottom") {
    LockBallToPaddle();
    LaunchBalls();
}

But now it just launches straight away from the paddle when hit the collision without me clicking anything like what "Launchballs()" intended to. What should I do?

sentences:
Best way to determine surface normal for a group of pixels? One of my current endeavors is creating a 2D destructible terrain engine for iOS Cocos2D (See https://github.com/crebstar/PWNDestructibleTerrain ). It is in an infant stages no doubt, but I have made significant progress since starting a couple weeks ago. However, I have run into a bit of a performance road block with calculating surface normals.

Note: For my destructible terrain engine, an alpha of 0 is considered to not be solid ground.

The method posted below works just great given small rectangles, such as n < 30. Anything above 30 causes a dip in the frame rate. If you approach 100x100 then you might as well read a book while the sprite attempts to traverse the terrain. At the moment this is the best I can come up with for altering the angle on a sprite as it roams across terrain (to get the angle for a sprite's orientation just take dot product of 100 * normal * (1,0) vector).

-(CGPoint)getAverageSurfaceNormalAt:(CGPoint)pt withRect:(CGRect)area {

float avgX = 0;
float avgY = 0;
ccColor4B color = ccc4(0, 0, 0, 0);
CGPoint normal;
float len;

for (int w = area.size.width; w >= -area.size.width; w--) {
    for (int h = area.size.height; h >= -area.size.height; h--) {
        CGPoint pixPt = ccp(w + pt.x, h + pt.y);
        if ([self pixelAt:pixPt colorCache:&color]) {
            if (color.a != 0) {
                avgX -= w;
                avgY -= h;
            } // end inner if
        } // end outer if
    } // end inner for
} // end outer for

len = sqrtf(avgX * avgX + avgY * avgY);
if (len == 0) {
    normal = ccp(avgX, avgY);
} else {
    normal = ccp(avgX/len, avgY/len);
} // end if

return normal;
} // end get

My problem is I have sprites that require larger rectangles in order for their movement to look realistic. I considered doing a cache of all surface normals, but this lead to issues of knowing when to recalculate the surface normals and these calculations also being quite expensive (also how large should the blocks be?). Another smaller issue is I don't know how to properly treat the case when length is = 0.

So I am stuck... Any advice from the community would be greatly appreciated! Is my method the best possible one? Or should I rethink the algorithm? I am new to game development and always looking to learn new tips and tricks.

EDIT: This is a re-work of the getSurfaceNormal function to implement the 2nd algorithm as specified by Nathan. I am putting it here for purposes of feedback and to hopefully show in code what Nathan is talking about.

-(CGPoint)getSurfaceNormalAt:(CGPoint)pt withSquareWidth:(int)area {
// This method only looks at surface pixels

int avgX = 0;
int avgY = 0;
CGPoint normal;
float len;
ccColor4B color = ccc4(0, 0, 0, 0);

for (int w = area; w >= -area; w--) {
    int h = area;
    do {
        if ([self pixelAt:ccp(w + pt.x, h + pt.y) colorCache:&color]) {
            if (color.a != 0) {
                if (w < 0) {
                    avgX -= w;
                    avgY -= h;
                } else {
                    avgX += w;
                    avgY += h;
                }
                break;
            } // end inner if
        } // end outer if
        h--;
    } while (h >= -area);
} // end for
int perpX = -avgY;
int perpY = avgX;
len = sqrtf(perpX * perpX + perpY * perpY);
normal = ccp(perpX/len, perpY/len);

return normal;
}

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:
OpenGL: Interpole keyframes of animated 3d object inside vertex shader Lets say I have N vertex buffers that hold the N key frames of an animated 3d object, that was created by an application like blender. To smoothly interpolate these frames, I would like to bind two buffers to render the object with a vertex shader like this:

in vec4 inPos0;
in vec4 inPos1;

in vec3 inNormal0;
in vec3 inNormal1;

... other attributes...

uniform float time;

void main(){
    vec4 currentPos = mix(inPos0,inPos1,time);
    ... other calculations ...
}

To do this, the two buffers must be bound simultaneously, so I'd need to call glVertexAttribPointer every time, that a new keyframe should be used. This way buffer I can be bound to inPos0 and buffer I+1 to inPos1.

My question: Is this a good way to interpolate key frames? Or is there any builtin function to handle this scenario?

sentences:
Can I use memcpy() with XMMATRIX? I.e. can I do this:

XMMATRIX dxMat;
Matrix myMat;
std::memcpy(&myMat, &dxMat, sizeof(XMMATRIX));
std::memcpy(&dxMat, &myMat, sizeof(XMMATRIX));

Matrix is my own class which contains 16 contiguous float variables (only). Also can I do the same with my vector class (4 floats) and XMVECTOR?

In other words, is XMMATRIX a POD?

sentences:
How do I avoid an infinite loop when testing D3D9 occlusion queries in SlimDX? I'm creating a Managed DirectX 9 application using SlimDX. I'm trying to utilize occlusion queries in order to cull non-visible geometry found in the scene. The problem I'm having relates to SlimDX's implementation of IDirect3DQuery9::GetData().

SlimDX, in managed code, has a function to check the status of a query. This function(SlimDX.Direct3D9.Query.CheckStatus(bool flush)) returns true if the query results are available, and false if the data is not yet available. The problem is, the unmanaged counterpart of CheckStatus(), IDirect3DQuery9::GetData(), will not only return true or false but also an HRESULT that indicates that the device was lost while waiting for the query result to become available. Because the call to CheckStatus() lies within a 'while' loop, the application hangs in an infinite loop. Also, another problem occurs that causes the graphics device driver to crash. The computer must be restarted altogether in order to restore the system. Here is my implementation of an occlusion query:

using Device = SlimDX.Direct3D9.Device;
using Query = SlimDX.Direct3D9.Query;
using QueryType = SlimDX.Direct3D9.QueryType;
using Issue = SlimDX.Direct3D9.Issue;

// device and query
Device pd3dDevice = GetDevice();
Query occlusionQuery = new Query(pd3dDevice, QueryType.Occlusion);

...
// issue begin
occlusionQuery.Issue(Issue.Begin);

// draw scene item
...

// issue end
occlusionQuery.Issue(Issue.End);

// wait for query results to be ready
while (!occlusionQuery.CheckStatus(true)) { }

// get query data
uint ucPixelsRendered = occlusionQuery.GetData<uint>(false);

The implementation eventually hangs or the device will be lost during the CheckStatus loop and the graphics device driver will crash requiring a restart of the computer...

I have successfully implemented timing queries(disjoint, frequency, and timestamps) without any problems.

How do I correctly implement an occlusion query in SlimDX?

sentences: Number of Impressions on Admob for Revenue Just curious for a rough estimate; how many impressions would it take to make 300 dollars, a day, in ad revenue?

sentences: Turn based game - HTTP or WebSocket? My game will be a turn based game which will need a server gateway in order to send requests. What would be better for the server: using REST HTTP GET for making the requests? Or using WebSocket which enables you to have an active connection?

sentences: LibGDX How can I draw a line at a specific angle I'm working on a 2D platformer, shooter game and I'm attempting to draw a line to serve as a guide to indicate where the player is shooting. The line should be drawn from the player's sprite to the mouse's position. I need to draw a line between the player and the mouse, at the angle from the player to the mouse, how can I do something like this? Here is a concept picture to explain what I'm talking about:

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:
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:
what should the size of a flash game in Facebook be I'm developing a flash game and i want to put it in Facebook
,My question is the Proper maximum  size for it.
500 KB
1 MB ??

sentences:
Top down space game control problem As the title suggests I'm developing a top down space game.

I'm not looking to use newtonian physics with the player controlled ship. I'm trying to achieve a control scheme somewhat similar to that of FlatSpace 2 (awesome game). I can't figure out how to achieve this feeling with keyboard controls as opposed to mouse controls though. Any suggestions?

I'm using Unity3d and C# or javaScript (unityScript or whatever is the correct term) works fine if you want to drop some code examples.

Edit: Of course I should describe FlatSpace 2's control scheme, sorry. You hold the mouse button down and move the mouse in the direction you want the ship to move in. But it's not the controls I don't know how to do but rather the feeling of a mix of driving a car and flying an aircraft. It's really well made. Youtube link: FlatSpace2 on iPhone

I'm not developing an iPhone game but the video shows the principle of the movement style.
Edit 2
As there seems to be a slight interest, I'll post the version of the code I've used to continue. It works good enough. Sometimes good enough is sufficient!

using UnityEngine;
using System.Collections;

public class ShipMovement : MonoBehaviour
{
    public float directionModifier;
    float shipRotationAngle;
    public float shipRotationSpeed = 0;
    public double thrustModifier;
    public double accelerationModifier;
    public double shipBaseAcceleration = 0;
    public Vector2 directionVector;
    public Vector2 accelerationVector = new Vector2(0,0);
    public Vector2 frictionVector = new Vector2(0,0);
    public int shipFriction = 0;
    public Vector2 shipSpeedVector;
    public Vector2 shipPositionVector;
    public Vector2 speedCap = new Vector2(0,0);

    void Update()
    {

   directionModifier = -Input.GetAxis("Horizontal");

   shipRotationAngle += ( shipRotationSpeed * directionModifier ) * Time.deltaTime;

   thrustModifier = Input.GetAxis("Vertical");

   accelerationModifier = ( ( shipBaseAcceleration * thrustModifier ) ) * Time.deltaTime;

   directionVector = new Vector2( Mathf.Cos(shipRotationAngle ), Mathf.Sin(shipRotationAngle) );
   //accelerationVector = Vector2(directionVector.x * System.Convert.ToDouble(accelerationModifier), directionVector.y * System.Convert.ToDouble(accelerationModifier));
   accelerationVector.x = directionVector.x * (float)accelerationModifier;
    accelerationVector.y = directionVector.y * (float)accelerationModifier;
   // Set friction based on how "floaty" controls you want

    shipSpeedVector.x *= 0.9f; //Use a variable here
    shipSpeedVector.y *= 0.9f; //<-- as well
   shipSpeedVector += accelerationVector;

   shipPositionVector += shipSpeedVector;

   gameObject.transform.position = new Vector3(shipPositionVector.x, 0, shipPositionVector.y);
    }

}

sentences:
Triangle-Plane intersection in 3D space I would like to clip a triangle if its bounds lie partially out of a cube. I guess I would need some kind of Triangle Plane intersection code - I'm not well versed with math but I do have the points of the triangle in 3d space (P1, P2, P3).

How do I get the 2 points of intersection of the triangle with one of the planes of the cube?

sentences:
Unity - Stuttering character rotation Am working on the controls and camera movement for my character.  What I am trying to do is have the character head be able to rotate left and right and then when the head is rotated a certain amount, the whole character rotates around.  I have kinda of done it, the head can move smoothly, but it stutters when it starts rotating everything.

Hopefully it is visible in this GIF.

You may be able to see that the head does rotate smoothly, but when the body starts rotating, it stutters.

Here is the code that is in LateUpdate that handles all the rotations.

this.current_rotation = Quaternion.Lerp(this.current_rotation, Quaternion.Euler(new Vector3(this.pitch, this.yaw, 0)), this.mouse_sensitivity * Time.deltaTime);

this.cam.transform.rotation = this.current_rotation;
this.head.transform.rotation = this.current_rotation;

if(this.head.transform.localRotation.y > 0.3 || this.head.transform.localRotation.y < -0.3){
    Quaternion from = Quaternion.Euler(0, this.player.transform.eulerAngles.y, 0);
    Quaternion to = Quaternion.Euler(0, this.current_rotation.eulerAngles.y, 0);

    Quaternion q =  Quaternion.Lerp(from, to, this.mouse_sensitivity * Time.deltaTime);
    this.player.transform.rotation = q;
}

sentences:
How can I change the path a sprite is following in real time? Is there a common way to implement a character following path that is issued and replaced in real time?

For example: the character follows a path issued, and while it's on that path, if a new path is issued, the character abandons the existing one and follows the new path from where it is currently located.

Here's a more detailed explanation:

I am trying to make a real-time action game, like Diablo, but in 2D and tile-based. The player can issue new destinations on the map and the in-game character should walk towards that destination in real time.

I got the path finding part all worked out, but I am having issues with getting the character to smoothly abandon an existing path, and follow a new path (when a new destination is issued).

The character sometimes flickers when a new path is issued while it's following an existing path. If the character sprite is not at the centre of a tile, it will "teleport" to the centre of the tile it's on and follow the path from there on smoothly.

I tried to get around this problem by first checking if the player is on at the centre of a tile, and if not, I amend a node in the front of the new path to get the player to move to that tile. But this still doesn't get me the desired effect, because if the same destination is issued over and over, the character will just keep walking to the same tile instead of walking towards that destination.

sentences: Tiled map editor and objects Ive been searching for an easy way to group multiple sprites of a spritesheet into a single entity. Im using tiled editor as written at the title. Some objects might be larger than the tile size and i need a way to let my game know that in order to manipulate these objects. I dont want to create new tilesets with different sizes for all objects. Is this possible in this app and if not do you know another that can handle this?

sentences:
Optimising the modelview transformation in GLSL for 2D So, the standard way to transform vertices and then pass to the fragment shader in GLSL is something like this:

uniform mat4 u_modelview;
attribute vec4 a_position;

void main() {
    gl_Position = u_modelview * a_position;
}

However, I am working in 2D so there is redundancy in the 4x4 matrix. Would it be more efficient for me to do this?

uniform mat3 u_modelview;
attribute vec3 a_position;

void main() {
    gl_Position = vec4(u_modelview * a_position, 1.0);
}

gl_Position requires a 4 component vector so an extra operation is required at output. However the matrix multiplication is for 9 elements instead of 16. Can I do any better?

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:
Java simple dust cleaner game simulator I am working on a dust cleaner simulator on Java, in this case the shape of the cleaner is a circular ball.
The program is quite simple, the user puts in the width and length of the "room" and coordinates x and y.
What I want to do and cannot is create a series of commands, each represented by a character. There are three commands that I want to implement:

char 'A' = Move forward 1 meter

char 'L' = Turn left 90 degrees

char 'R' = Turn right 90 degrees

Example of user input AALA, in this case the expected output is that the machine moves 2 meters and then turns left 90 degrees and then moves 1 meter again. Hope I am clear.
As you can see in the code, I have tried to create an array of chars but I don't know what the next step should be...
The code:
public class Cleaner extends JPanel {
/* int lx = 1, ly = 1;
int x = 200, y = 250;

*/
int x, y;
int width = 52, height = 50; // width and height of the "dust sucker"
int lx , ly;

// an array of chars
char[] charArray ={ 'A', 'L', 'R'};

java.util.Timer move; // making the instance of Timer class from the util package
static JFrame frame;

Cleaner()
{

    frame = new JFrame ("Cleaner started!"); // passing attributes to our fame
    frame.setSize (400, 400); // setting size of the starting window
    frame.setVisible (true);

    setForeground(Color.black); // setting color

    move = new java.util.Timer();

    move.scheduleAtFixedRate(new TimerTask()
    {

        public void run()
        {
            if(x<0)
                lx = 1;
            if(x>=getWidth()-45)
                lx = -1; // -1 sets boundry for the dusk sucker
            if(y<0)
                ly = 1;
            if(y>=getHeight()-45)
                ly = -1; // -1 sets boundry for the dusk sucker

            x+=lx; // to make the machine move
            y+=ly;

            repaint();
        }

    }, 0, 5// speed of the machine
            );

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public void paint (Graphics g)
{
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.fillOval(x, y, width, height);
}

public static void main (String[] args)
{
    // lx value

    String lxValue =
             JOptionPane.showInputDialog( "Enter lx" );
    // ly value
    String lyValue =
              JOptionPane.showInputDialog( "Enter ly" );

    String xValue =
             JOptionPane.showInputDialog( "Enter x value" );
    // ly value
    String yValue =
              JOptionPane.showInputDialog( "Enter y value" );

     // convert String inputs to int values
      int firstInput = Integer.parseInt( lxValue );
      int secondInput = Integer.parseInt( lyValue );
      int thirdInput = Integer.parseInt( xValue );
      int forthInput = Integer.parseInt( yValue );

         Cleaner cleaner = new Cleaner();

            frame.add(cleaner);
      cleaner.lx = firstInput;
      cleaner.ly = secondInput;
      cleaner.x = thirdInput;
      cleaner.y = forthInput;

}

}

All help is appreciated!

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: Why do transformation matrices always have an extra dimension? In 3D math I always see matrices with one additional dimension. For example, in 3D graphics, matrices are always 4x4 and in 2d they are 3x3 matrices. Can anyone explain why?

sentences:
Is there any map maker for javaME game? For the past two weeks I was trying to make a map maker for my java ME 2D RPG game. I failed because i get errors using slick TWL and the forum for this is inactive.

So I just wondered is there anyone that knows slick TWL (Themable Widget Library)? Or maybe do you know a good MapMaker where i could upload my map elements build a map and get numbers to use them for building map with LayerManager class?

Already found one http://sourceforge.net/projects/tilemapeditor2d/. But the thing is my map elements are in different .png images. In one of those images there is 16 elements (trees water and etc) and those kind of images are 29. So it would be hard to build a map with LayerManager

Well I was thinking putting everything into one image and that way it would be simplier.

sentences:
How does the Path of Exile ItemRenderer determine the items' rarity? This question is really specific to Path of Exile and their forum.

Basically, they render the items from a json object.

require(["PoE/Item/DeferredItemRenderer"], function(R) { (new R(JSON)) })

And the json of an item is of the form:

      {
         "verified":true,
         "w":1,
         "h":1,
         "icon":"http:\/\/webcdn.pathofexile.com\/image\/Art\/2DItems\/Rings\/Ring5.png?v=d645f9adfc012c52674c94d16b4292b2",
         "support":true,
         "league":"Default",
         "sockets":[

         ],
         "name":"Honour Grip",
         "typeLine":"Topaz Ring",
         "identified":true,
         "requirements":[
            {
               "name":"Level",
               "values":[
                  [
                     "41",
                     0
                  ]
               ],
               "displayMode":0
            }
         ],
         "implicitMods":[
            "+22% to Lightning Resistance"
         ],
         "explicitMods":[
            "Adds 4-48 Lightning Damage",
            "+8 to Evasion Rating",
            "+70 to maximum Life",
            "+35% to Cold Resistance"
         ],
         "frameType":2,
         "socketedItems":[

         ]
      }

I don't see the rarity of the item anywhere... How do you think they determine it? They could count the mods, but what if the object is not identified?

sentences:
WebGL CORS error loading simple texture in Chrome Here's my code:

function loadTexture() {
    textureImage = new Image();

    textureImage.onload = function() {
        setupTexture();
    }

    textureImage.src = "jumper2.png";
}

function setupTexture() {
    texture = gl.createTexture();

    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

    // this next line has the error: Uncaught SecurityError: An attempt was made to break through the security policy of the user agent.
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, textureImage);
    gl.texParameteri(gl.TEXTURE_2D, gl.OES_TEXTURE_FLOAT_LINEAR, gl.NEAREST);

    if (!gl.isTexture(texture)) {
        alert("Error: Texture is invalid");
    }

    glProgram.samplerUniform = gl.getUniformLocation(glProgram, "uSampler");
    gl.uniform1i(glProgram.samplerUniform, 0);
}

I've researched it and it is a CORS error a "Cross-origin resource sharing" error, but it's a local file! I can't figure out what's wrong.

I did make the picture using gimp, and I'm not sure the coding was right on the export, but I eliminated a previous error using "gl.OES_TEXTURE_FLOAT_LINEAR".

sentences:
How does the Simple Stupid Funnel Algorithm work? Working with the funneling algorithm shown on Digesting Duck I'm not sure how the detection of the funnel works.

Can someone explain the method clearly to me or suggest an alternative way of detecting the funnel and if the funnels sides overlap?

sentences:
What is the best way to keep track of time in a game? I'm getting to the part in development where I'm noticing that timing is going to be an issue.

If I put my movement update in the same function where I draw the scene, then a low FPS means slower movement and a high FPS means very fast movement. But putting it in its own function that is called every 1/60th of a second still has problems.  I'm starting to realize that there is no way you can rely on a scheduled function to keep track of time. It is just way too unreliable.

But I still need to be able to move at the same speed regardless of the FPS that a computer can handle. So what is the best way to keep track of time and move around?

sentences:
Rotation in 3D space using Quaternion System Configuration

I have two simulation systems (which I am going to call Sim-A and Sim-B) where I am going to spawn an entity created in Sim-A inside Sim-B.

Expected outcome

The entity created in Sim-A appears in Sim-B in the right position with the correct orientation.

System Input

The position of the entity created in Sim-A received in Lat/Long/Alt format (it assumes WGS-84 spheroid) and the orientation in Euler angles.

The Euler angles would help me to transform an entity from its world coordinate system to entity coordinate system by applying the Euler angles in the order of heading, pitch and yaw. Below is how it is documented.

" The order of rotation is first, rotate about z by the angle psi (), then about the new y (y') by angle theta (T), then about the newest x (x'') by the angle phi (I). The positive direction of rotation about an axis is defined as clockwise when viewed toward the positive direction along the axis of rotation."

However, in Sim-B this rotation is defined in Quaternion and it assumes a perfect sphere for the world (not WGS-84). As a result, I have to convert Euler to Quaternion before sending the information to Sim-B.

I have achieved this by applying ZYX conversion (page A-11) given in [here][2].

Challenge

When I pass the position and orientation of an entity created in Sim-A to Sim-B ( Sim-B uses ECEF system, so I do another conversion to go from LLA to ECEF), it appears in the correct LLA position but its orientation is incorrect (shown in the figure.).

This can be fixed by adding some value to the pitch and roll but it is not mathematically sound. Also, these values might change (haven't tried) if you spawn the entity in a different location of the earth due to its shape.

So, I would like to know the right way of correcting this issue (i.e. how to make the entity to stand upright). Assume that I can get the Up, Front and Right vector of the entity when it is spawned in Sim-B.

sentences:
Event handling on own UI implementation in XNA I´m creating a game in XNA with my own UI and its controls/components.
Currently I have some problems with the event handling. Let me tell me the way I do it right now.
Every object is handles as a component (also the form itself). Each component can implement an interface with a container which can contain a list of components (and so on and so on).
An example:
I have a form. On this form there is a TabControl. In this TabControl there are different TabPages and in these pages there are buttons.

I now have to handle my events that when I click on the button, the overlaying controls should not fire an event (like OnClick etc.).

How can I easily do that? I have a current function which runs recursively but only on two levels depth or something.

Here is my current function which is not working as expected:

private Boolean HandleComponentList(IComponentList parent) {
foreach (var singleItem in parent.Components.OrderByDescending(i => i.ID).Where(singleItem => singleItem.Visible))
{
    // Cast item to IComponentList.
    var castedList = singleItem as IComponentList;
    // If list is not null (so it implements IComponentList), call HandleComponentList for Components in this control first.
    if (castedList != null)
    {
        // If an event has been raised, break function.
        var eventFound = HandleComponentList(castedList);

        if (eventFound)
            return true;
    }

    // Only fire events if control is enabled.
    if (singleItem.Enabled)
    {
        // look for events.
    }
}

return false;

}

Would be great if someone has some suggestions!
Thank you!

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:
Context is NULL with SDL_CreateWindowFrom Win32 There is a VC ++ Win32 project. It connected the library sdl, follows CreateWindowW I have written

 SDL_Window* w = SDL_CreateWindowFrom(hWnd);
 //  SDL_WindowFlags(SDL_WINDOW_OPENGL);
   SDL_GLContext glcontext = SDL_GL_CreateContext(w);
   if (glcontext == NULL)OutputDebugString("null");

But my glcontext == NULL and SDL_GetError returns  The specified window isn't an OpenGL window

But if I use SDL_CreateWindow, context turns out successfully

Even after the creation of the window using

static PIXELFORMATDESCRIPTOR pfd = {
       sizeof(PIXELFORMATDESCRIPTOR), // strcut size
       1,                              // Version number
       PFD_DRAW_TO_WINDOW |    // Flags, draw to a window,
       PFD_SUPPORT_OPENGL, // use OpenGL
       PFD_TYPE_RGBA,          // RGBA pixel values
       24,                     // 24-bit color
       0, 0, 0,                // RGB bits & shift sizes.
       0, 0, 0,                // Don't care about them
       0, 0,                   // No alpha buffer info
       0, 0, 0, 0, 0,          // No accumulation buffer
       32,                     // 32-bit depth buffer
       0,                      // No stencil buffer
       0,                      // No auxiliary buffers
       PFD_MAIN_PLANE,         // Layer type
       0,                      // Reserved (must be 0)
       0,                      // No layer mask
       0,                      // No visible mask
       0                       // No damage mask
   };

   // Did We Get A Device Context?
   hDC = GetDC(hWnd);

   PixelFormat = ChoosePixelFormat(hDC, &pfd);

   SetPixelFormat(hDC, PixelFormat, &pfd);

   // Are We Able To Get A Rendering Context?
   hRC = wglCreateContext(hDC);

   // Try To Activate The Rendering Context
   wglMakeCurrent(hDC, hRC);
   ReleaseDC(hWnd, hDC);
   ShowWindow(hWnd, nCmdShow);

   SDL_InitSubSystem(SDL_INIT_VIDEO);

   SDL_Window* w = SDL_CreateWindowFrom(hWnd);
   SDL_GLContext glcontext = SDL_GL_CreateContext(w);
   if (glcontext == NULL)OutputDebugString("null");

Can not get context. How correctly get the context?

sentences:
Is it a bad idea to store functions inside components in ECS? Say I have three entities: Player, Spikes, and Zombie. All of them are just rectangles  and they can collide with each other. All of them have the BoxCollision component.
So, the BoxCollison system would look something like this:
function detectCollisions () {
  // for each entity with box collision
    // check if they collide
      // then do something
}

The issue is, the sole purpose of the BoxCollision component is to detect collision, and that's it. Where should I put the game rules, such as "if the Player collided with Spikes, diminish its health" or "if the Zombie collided with Spikes, instantly kill the Zombie"?
I came up with the idea that each Entity should have its onCollision function.
Programming languages such as Javascript and F# have high-order functions, so I can easily pass functions around. So when assembling my Player entity, I could do something like:
function onPlayerCollision (player) {
  return function (entity) {
    if (entity.tag === 'Zombie') {
      player.getComponent('Health').hp -= 1
    } else if (entity.tag === 'Spikes') {
      player.getComponent('Health').hp -= 5
    }
  }
}

const player = new Entity()
player.addComponent('Health', { hp: 100 })
player.addComponent('BoxCollision', { onCollision: onPlayerCollision(player) }
// notice I store a reference to a function here, so now the BoxCollision component will execute this passing the entity the player has collided with

function detectCollisions () {
  // for each entity with box collision
    // check if they collide
      onCollision(entity)

onPlayerCollision is a curried/closure function that receives a player, and then returns a new function that wants another Entity.
Are there any flaws with this? Is it okay for components to store references to functions? What are other ways of avoiding game rules in components? Events?
Thanks!

sentences:
Replace a div (with a ball picture in it) with a 3D canvas ball I am trying to make a game where you have to keep the ball on a green platform. At this point the ball is a div with a ball image. You can move the ball over the field, all works great.

See it in action here (click the 1 first).

When you use your arrow keys you can move the ball (actually you move a div). This looks kinda fake, so I want to use a real 3D canvas ball for this. I saw a nice example here. (scroll down half way to the page. You will see a smiley with a ball in it just above the title: Smoothing it out)

So how can I use this ball into my game? I have the following code for the ball:

  // build the ball and draw its texture with a 2d canvas -------------------------------------------
  var buildBall = function() {
    // create a canvas to draw the ball's texture
    var ballCanvas = document.createElement('canvas');
    ballCanvas.width = 64;
    ballCanvas.height = 64;
    var ballContext = ballCanvas.getContext('2d');

    // draw 2 colored halves of the 2d canvas
    ballContext.fillStyle = "#f8ae44";
    ballContext.fillRect(0, 0, ballCanvas.width, ballCanvas.height/2);
    ballContext.fillStyle = "#ffda4e";
    ballContext.fillRect(0, ballCanvas.height/2, ballCanvas.width, ballCanvas.height/2);

    // create the THREE texture object with our canvas
    var ballTexture = new THREE.Texture( ballCanvas );
    ballTexture.needsUpdate = true;

    // create the physijs-enabled material with some decent friction & bounce properties
    var ballMaterial = Physijs.createMaterial(
      new THREE.MeshLambertMaterial({
        map: ballTexture,
        shininess: 10,
        color: 0xdddddd,
        emissive: 0x111111,
        side: THREE.FrontSide
      }),
      .6, // mid friction
      .5 // mid restitution
    );
    ballMaterial.map.wrapS = ballMaterial.map.wrapT = THREE.RepeatWrapping;
    ballMaterial.map.repeat.set( 1, 1 );

    //THIS PART IS FOR QUESTION 2
    // create the physics-enabled sphere mesh, and start it up in the air
    ball = new Physijs.SphereMesh(
      new THREE.SphereGeometry( 30, 32, 32 ),
      ballMaterial,
      100
    );
    ball.position.y = 500;
    ball.receiveShadow = true;
    ball.castShadow = true;
    scene.add( ball );
  };

I know I have to implement three.js to make this work, but how can I get the div replaced with this 3D canvas ball keeping everything else working as is (using arrows to move, move speed of the ball, reset when fallen of the platform etc)?

sentences: Stop detecting Input in Unity? How can I stop detecting input from the user in Unity? I want to achieve the following: "do not detect Input.GetMouseButtonDown" In C#?

sentences:
How to cache the main camera as a global variable? I want to create a utility class that will, among other things, return a cached reference to the main camera. Is the below code correct? My concern is that I'm doing it wrong and that FindGameObjectWithTag is being called each and every time the getter is referenced.

using UnityEngine;

public static class Utils
{
    public static Camera MainCamera { get; } = Camera.main;

}

sentences:
Instantiate prefab in editor script I'm working on a script to battle against nested prefabs. The script finds and replaces certain prefabs with a new version of that prefab. Now finding the prefabs is easy:

prefabList.AddRange(GameObject.FindObjectsOfType(typeof(GameObject)).Where(x => x.name == "PrefabName"));

But how can you instantiate a prefab in an editor script when the prefab is not in a resources folder? From what I read the PrefabUtility.InstantiatePrefab is used to do that, but I need a reference to the object which is instantiated.

sentences:
Is reobfuscating javascript every time the page is loaded a valid option for a multiplayer game? I am looking for ways to prevent cheating on a multiplayer browser game. I saw this answer where it was mentioned that obfuscation is not an effective technique.
My plan is not only to obfuscate the code differently every time the page is loaded but periodically change the protocol that the client uses to communicate with the server. This would mean that even if they were able to deobfuscate the client-side code, they would need to update the protocol every time I changed it or they wouldn't be able to communicate with the game servers. I know that this will be difficult to implement, but I believe that I can do it.
Would this work? I know that it's impossible to outright prevent cheating, but I believe that this would make it extremely difficult.

sentences:
How do professional games avoid showing pixel seams in adjacent mesh boundaries due to decimal imprecision? Graphics cards are mathematically imprecise.

So when some meshes are joined by their borders, the graphics card often makes mistakes and decides that some pixels at the seam represent neither object, and unwanted pixels appear.

It's a natural behaviour on all graphics cards. How are such worries avoided in Pro Games? Batching? Shaders? Different tangent vectors? Merging? Overlaping seams? Dark backgrounds? Extra vertices at borders? Z precision? Camera distance tweaks?

Screencap of a fix that ended up not working:

sentences: Directional, Triangular Collision Detection in Pygame I am trying to create a game in Pygame, with Python 3, and am trying to figure out an algorithm that will tell me which direction a rectangle is colliding with a rectangle, so that I can push it back the correct direction. I know I can detect rect-to-rect, and I could (possibly?) use pixel-to-pixel collision, but I was wondering if there was a better way. My collision algorithm currently loops through all of the "entity" objects in a Pygame sprite.Group(), and testing for collision using the colliderect() method, then I test which direction the rect is coming from by testing which sides overlap. Is there something similar that I could do with a collision between a triangle and a rectangle, too? Pseudocode would be nice.

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:
Unity - How To Customize Buttons Graphics inside my buttons I added some variables (as you can see in the code below).

public UnityEngine.UI.Text itemInfo;
void Update () {
    itemInfo.text = itemName + "\nCost: " + (costo_stringa = ConvertiroreProiettili.Instance.GetCurrencyInString(costo, false, false))
    + "\nBullets: " + tickValue + "/s" + "\nLiv: " + count;

but in this way are one below the other as a list, how do I order them as I will, and also add a picture?
like this

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 can I implement shader lookups for my material system? I have been working on a material system and for the most part everything works just fine, however, I hard code the shader that will be used. Obviously this causes a problem when I want to have the materials be saved through the material editor.

What I ended up doing was having the material save "attributes". These attributes would know if the material is using a texture or diffuse color (that's it for now). I then have a VS/PS to render objects with a texture or a diffuse color. Then for each of those, I have shaders for either no lighting, or my lighting system. Right there that will leave eight different shaders, so you can see where the complexity comes in with which ones to pick. Also, that is only if all the objects all have the same vertex type (position, tex coord, normal). However, that is not always the case, as some times the geometry may be built differently.

My question is, how can a propery shader lookup system be written for a material system? There comes into two things I can think of

Shaders based upon different lighting models
Shaders based upon different vertex formats

sentences:
How do you handle scripting in multithreaded environment In my experience, two approaches are preferred when people want to handle scripting in multithreaded environment.

Synchronize every accesses to scripting module with one coarse-grained lock.
No Synchronization - Scripting module should be used by just one logic thread.

Of course, both solutions are not scalable in multi-core perspective.

Question - Is there any other (multi-core) scalable solution?

sentences:
Securing a TCP connection on iOS for an MMO I am currently building an iOS MMO and I'm leaning towards using TCP as my networking protocol over the higher level HTTP (for the speed difference and the fact that it does not require the client to poll constantly for updates.)

Now, through my research I know that with MMO and any client-server multiplayer games, you should never trust what the client sends to the server. As an extension of that, you wouldn't want anybody to read your packets to see the contents so it's harder for them to send correctly formatted data to the server. (Maybe I'm paranoid.)

The only problem is, where in HTTP there is great support for a secure channel in HTTPS through SSL where the setup occurs mainly server-side, I am not aware of a way to achieve the same thing on TCP. Is there any resource I could be referred that could help me achieving similar security, or at least good enough, on both the iOS side and server-side?

On a side note, if the answer involves doing the encryption and decryption on the client-side, would that severely impact the performance of my application?

Thanks!

sentences:
How do I correctly unload an additive Scene in WebGL? I am creating an app in WebGL.  I have a loading scene that I am loading additively:

SceneManager.LoadScene("Loading Scene", LoadSceneMode.Additive);

It loads correctly.

Then after I finish loading everything, I remove the additive loading scene:

SceneManager.UnloadScene(SceneNames.Loading);

In the Editor, it unloads perfectly.  However, in browser, via WebGL, it gets called, but does not unload.  If I throw it in a coroutine and wait for 3 seconds, it does unload.

I have a two-part question:

Why does waiting for 3 seconds before unloading fix the problem?
What is the correct way to unload this scene so that there is not an arbitrary "Wait for seconds" in there?

sentences:
Shuffle tiles position in the beginning of the game XNA Csharp I'm trying to create a puzzle game where you move tiles to certain positions to make a whole image. I need  help with randomizing the tiles start position so that they don't create the whole image at the beginning. There is also something wrong with my offset, that's why it's set to (0,0). I know my code is not good, but I'm just starting to learn.

My start-up tile positioning code

        spriteBatch = new SpriteBatch(GraphicsDevice);
        PictureTexture = Content.Load<Texture2D>(@"Images/bildgraff");
        FrameTexture = Content.Load<Texture2D>(@"Images/framer");

        //Laddar in varje liten bild av den stora bilden i en array

        for (int x = 0; x < 4; x++)
        {
            for (int y = 0; y < 4; y++)
            {

                Vector2 position = new Vector2(x * pictureWidth, y * pictureHeight);

                position = position + Offset;

                Rectangle square = new Rectangle(x  * pictureWidth, y * pictureHeight, pictureWidth, pictureHeight);

                Square frame = new Square(position, PictureTexture, square, Offset, index);
                squareArray[x, y] = frame;

                index++;
            }
        }

For reference, here is the square class:

class Square
{

    public Vector2 position;
    public Texture2D grafTexture;
    public Rectangle square;
    public Vector2 offset;
    public int index;

    public Square(Vector2 position, Texture2D grafTexture, Rectangle square, Vector2 offset, int index)
    {
        this.position = position;
        this.grafTexture = grafTexture;
        this.square = square;
        this.offset = offset;
        this.index = index;
    }

    public void Draw(SpriteBatch spritebatch)
    {
        spritebatch.Draw(grafTexture, position, square, Color.White);
    }

    public void RandomPosition() {  }

    public void Swap(Vector2 Goal )
    {
        if (Goal.X > position.X)
        {
             position.X = position.X + 144;
        }
        else if (Goal.X < position.X)
        {
            position.X = position.X - 144;
        }
        else if (Goal.Y < position.Y)
        {
            position.Y = position.Y - 95;
        }
        else  if (Goal.Y > position.Y)
        {
            position.Y = position.Y + 95;
        }
    }
}

sentences:
Unity2D - Save everything in a scene before loading another and come back to it? So I have am into this endless runner thing where everything is generated randomly from prefabs. Okay cool! But I am currently working on a bonus collectible which takes the player to another scene. After certain time, the player must reach at exactly the same position it left from.

But that's not the problem. I have figured out a way to save and load player's and camera's position using temporary prefabs.

My problem is : When the player collects the bonus thing in main scene and goes to the bonus scene and comes back, there's a sort of gltichiness or distortion in the game view. As if, the bonus scene is frozen and other scene is overlapping and everything is being stretched.
But in inspector, everything including camera is in place.

In game view, on returning, the camera seems to be starting from beginning while in inspector its exactly where its supposed to be. Not only that, there's a lot of distortion, which I am 70% sure is because the level had to load all over again and there's no possible way of game knowing which prefabs were instantiated as they all are random.

Compiling up, my question is, how can I save everything in a scene before leaving and load it all again at once so it doesn't have to go through all of it again. Is there any less-complex way? I hope I have made my ques clear. Thank you.

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:
How can I synchronize state in my Asteroids game with many networked players? Wondering how state synchronization works in games with lots of players like MMOs. It seems like a hard problem to solve and I am not aware if there are standard solutions. Specifically, synchronizing game clients (users playing game) with an array of centralized servers, and then broadcasting and merging the state with all the same connected clients. How it is done (and how efficiencies are implemented) typically, and what the structure of the game state is like.

To simplify this question, I am thinking in terms of a simple asteroids game:

You have n number of players, and the asteroids, players, and bullets are synchronized across clients. I am not familiar with how the game state should be modeled (if it's some quadtree thing you are sending around, or just a vector of patch/updates, etc.). There could be players all over the world, so latency is a factor.

sentences:
How to disable script component while in game? I'm trying to make a C# script to disable the First person controller script component for my character. I'm doing this so that while I'm controlling something else such as a vehicle, the only control script enabled at the time is the vehicle, and vice versa for when I'm not in the vehicle.

I did find a tutorial on the Unity Web site for Enabling and Disabling components but it uses a light component as an example, and I have no idea of how to do the same thing with a script component. I really appreciate any help I can get to solve this problem.

Thank you

This is the code in C# provided by the tutorial:

public class EnableComponents : MonoBehaviour
{
    private Light myLight;

    void Start ()
    {
        myLight = GetComponent<Light>();
    }

    void Update ()
    {
        if(Input.GetKeyUp(KeyCode.Space))
        {
            myLight.enabled = !myLight.enabled;
        }
    }
}

sentences:
Biased, conservative random walk I have a sprite which has Velocity and Position, either stored as Vector2. At each Update cycle, velocity is added to the position.

I would like to give the sprite a third vector, Target. New targets may be given at any iteration. I would like the sprite to essentially move in a random walk pattern, however two parameters must be exposed:

A typical random walk is equally likely to increase or decrease the distance to any given Target (plus the small chance of tangential movement). I must be able to bias my random walk such that, while still random, the direction on which the sprite "decides" should be more likely to bring it closer to Target.
The random walk should be "smooth"- the sprite should not rapidly change direction, as this will look like it's "flickering" or "trembling" to the player. It should gradually veer this way or that, moving randomly, while slowly getting closer when averaged.

What is a good, simple way to do this? If possible, give the answer as a Vector2 RandomWalk(Vector2 target) method.

I already have a NextGaussian(mean, stdev) method available, if that is helpful.

sentences:
What are some common FOV for third person games? I am trying to decide on a field of view (FOV) for a third person game and I really don't know where to start. It would be very helpful to have some points of reference from recent TPS games and the FOV they use by default. The trouble is many third person games (or at least those I have tried) do not have any settings or information about what their default FOV is. I have had a look at Uncharted 4, Hitman (2016), The Division and GTA 5 but cannot find information about their FOV anywhere.

I understand that each game is different and the type of gameplay will determine the FOV choice here, but it would be very useful for me to have some existing examples as a starting point. Is there any good place to find this out?

sentences:
Select box-shape grid between two positions on tilemap I want to be able to click and hold on a certain point and mark it as startPosition.
Then, while the mouse is held down and moved, mark that second position as endPosition.
When the mouse is finally released, I want to get all the positions between those two points.
Here is my code so far:
for (float x = startPosition.x; x <= endPosition.x; x++)
        {
            for (float y = startPosition.y; y <= endPosition.y; y++)
            {
                Vector3Int newPosition = Utilities.GridPosFromWorldPos(new Vector2(x, y));
                if (!selectedPositions.Contains(newPosition)) { selectedPositions.Add(newPosition); }
            }
        }

This works only when dragging up and/or to the right.
As soon as I try to go to left or bottom, the endPosition coordinates become smaller than the startPosition coordinates, which breaks the for loop.
How can I solve this?

sentences:
Why does my material look blotchy on this mesh? This is a generative mesh - wireframe looks like this

Here's the material

But the shaded object looks like a tie dye tshirt

I've no idea what settings are causing it to look like this. These are the settings of the mesh renderer

sentences:
Vehicle physics with skid How would I go about creating vehicle physics for a car that can loose traction? I want it to seem like the driver has a flat foot, so when you press the gas, they cars driving (rear) wheels loose traction, and makes it somewhat hard to control. I would also like to be able to do doughnuts and "drift" around corners.

I would also need to know how much "skid" is happening, so I can add a proportional amount of smoke and tire marks.

Assume a 2d, top-down style car game.

Thanks

sentences:
Implementing Separating Axis Theorem (SAT) and Minimum Translation Vector (MTV) I was following codezealot's tutorial on SAT and MTV and trying to implement it myself but I've come a cropper when it comes to getting the correct MTV. Here is my example: (Cue pretty pictures...)

I'm well aware how to obtain the length of the MTV and the axis on which it lies. However I can't work out whether the length should be 'positive' or 'negative' to push the object in the correct direction.

In the example we are separating the objects by moving the 'red' of the 'blue', the top example is moving the object negatively and the bottom moving it positively.

Please help I'm really struggling with this.

Here is my actual implementation.

sentences:
Convert MathAtan2 angle to degrees I use an angle to set the velocity (or direction if you prefer) of my sprite, however, I want the sprite to be heading in the same angle as I'm moving, rotating according to that angle.

How I set angle and velocity:

angle = (float)Math.atan2(0 - pos.y, 220 - pos.x); //using bottom mid of screen as destination for testing

//in update
pos.x += 200 * Math.cos(angle) * delta;
pos.y += 200 * Math.sin(angle) * delta;
sprite.setPosition(pos.x, pos.y);

//in render
sprite.draw(batch);

is there any way to use this value in LibGdx's "sprite.rotate()" function? I can't do "sprite.rotate(angle)". Can I do this some other way? Can I convert my angle-value somehow to degrees? I'm stuck.

I tried

sprite.rotate((float)Math.toDegrees(angle));

but that gave rly weird results, the following image is moving down and to the right

sentences:
Is it possible to convert file from Blender 3d to svg? I want to build web game in html5 with canvas/svg.

Can I convert/export file from blender to canvas/svg?

Maybe via unity3d?

sentences:
Is it legal to develop a game using D&D rules? For a while now I've been thinking about trying my hand at creating a game similar in spirit and execution to Baldur's Gate, Icewind Dale and offshoots. I'd rather not face the full bulk of work in implementing my own RPG system - I'd like to use D&D rules.

Now, reading about the subject it seems there is something called "The License" which allows a company to brand a game as D&D. This license seems to be exclusive, and let's just say I don't have the money to buy it :p.

Is it still legal for me to implement and release such a game? Commercially or open-source? I'm not sure exactly which edition would fit the best, but since Baldur's Gate is based of 2nd edition, could I go ahead an implement that?

in short: what are the issues concerning licensing and publishing when it comes to D&D?

Also: Didn't see any similar question...

sentences:
Yield and loading textures I have a need to dynamically load textures from the player's filesystem. WWW provides the functionality I need, but I can't get the example code to compile.

"yield www" causes my code to not compile. Here, the code is short:

    private List<Texture> LoadTextures (String prefix, int numTextures)
    {
        List<Texture> textures = new List<Texture> ();
        for (var i = 0; i < numTextures; i++ )
        {
            var www = new WWW(prefix + i);
            yield www;
            textures.Add(www.texture);
        }
        return textures;
    }

Why doesn't yield work here, like the code sample on the Unity docs suggests?

EDIT:

In response to Lasse:

    private IEnumerable<Texture> LoadTextures (String prefix, int numTextures)
    {
        for (var i = 0; i < numTextures; i++ )
        {
            var www = new WWW(prefix + i + ".png");
            yield return www.texture;
        }
    }

The above compiles, but I now get this error:

  You are trying to load data from a www stream which has not completed
  the download yet. You need to yield the download or wait until isDone
  returns true.

It's as if it is not even yielding. What gives? The file does exist in this directory. I tried prepending "file:///" but that didn't do anything. Do I need to provide an absolute path, or is relative OK?

sentences:
Selecting the entities needed for rendering Currently I'm sorting and looping every entity on my level but I really don't need to. Only a small subset would be on screen.

If I could extract a list of entities from my main list that are on screen (or near the screen), that would be great, but I believe maintaining a different kind of list like a quad-tree or something might be in order, but I have no experience with such things.

How can I do this?

sentences:
Marching Cubes - Legalities? I know this isn't a "Is this legal" website, but because Marching Cubes is definitely a large subject in game development, and isn't really about a specific graphic/item, it would pass...

To the point!

Does anyone know whether Marching Cubes is allowed in a commercial game? If so is there anything i must do? Credit to someone/company etc?

Cheers.

sentences:
3D Menu Attached to an Object? So I'm gathering information for my project, and one of the things I want to achieve is to create a very sophisticated crafting system and weapon modification but I want the weapon customization to look in a specific manner.

A very good reference would be Crysis weapon attachments system, where if you open it, your character tilts the weapon and there are few menus popping up, all attached to the weapon, so you can see the menus moving around as your weapon is moving (due to you breathing for example, or walking).

Here is a quick image reference:

So 1st thing comes to my mind is, how in the name of god should I approach this? Pardon if this is quite easy thing to do, I'm just completely new to Unity. (I have solid C++ background so programming isn't the obstacle)

Edit 1: To be precise, I'm wondering how to work out the positioning of the menus in relation to the weapon. So the menu is moving with the weapon and eventually even turn slightly to give that 3D'ish effect.

sentences:
Server-side real time position calculation based on destination position - C# What I want to achieve is to calculate the real object position based on its speed and a destination position.
In my server, I have a MapInstance that have a list of MapLayer that have MapRegions.

To resume we have:

1 MapInstance

N MapLayers
X MapRegions

Each MapInstance will update in an asynchronous task all his map layers and the common object such as NPCs and the MapLayer will update his regions of entities (monsters/items).

On the client side, when I click somewhere on the map, it sends a packet to the server with the destination position.
Then, on the server-side I receive the position and set the entity.Movable.DestinationPosition property.

As I said earlier, each map instance are updated in an asynchronous task and updates the map layers and common entities.
My problem is, my realtime position calculation formula is wrong somewhere, and I can't find where.

To understand the problem, there is some inputs:

Entity speed: 0.08 (8%)
Position and DestinationPosition are Vector3 (class) instance, where X, Y and Z are properties.

This is my code:

public void StartUpdateTask(int delay)
{
    Task.Run(async () =>
    {
        const double FrameRatePerSeconds = 0.66666f;
        double previousTime = Environment.TickCount;

        while (true)
        {
            if (this._cancellationToken.IsCancellationRequested)
                break;

            double currentTime = Environment.TickCount;
            double deltaTime = currentTime - previousTime;
            previousTime = currentTime;

            this.GameTime = (deltaTime * FrameRatePerSeconds) / 1000f;

            lock (SyncRoot)
            {
                foreach (var entity in this.Entities)
                    Walk(entity);

                foreach (var mapLayer in this._layers)
                     mapLayer.Update();
            }

            await Task.Delay(delay, this._cancellationToken).ConfigureAwait(false);
        }
    }, this._cancellationToken);
}

mapLayer.Update() method:

public override void Update()
{
    this.GameTime = this.Parent.GameTime;

    foreach (var entity in this.Entities)
        Walk(entity);

    foreach (var region in this._regions)
    {
        if (region.IsActive && region is IMapRespawnRegion respawnRegion)
        {
            foreach (var entity in respawnRegion.Entities)
            {
                Walk(entity);
            }
        }
    }
}

And the calculation formula:

private void Walk(IMovableEntity entity)
{
    if (entity.MovableComponent.DestinationPosition.IsZero())
        return;

    if (entity.MovableComponent.DestinationPosition.IsInCircle(entity.Object.Position, 0.1f))
    {
        entity.MovableComponent.HasArrived = true;
        entity.MovableComponent.DestinationPosition.Reset();
    }
    else
    {
        entity.MovableComponent.HasArrived = false;
        double entitySpeed = entity.MovableComponent.Speed * entity.MovableComponent.SpeedFactor;
        double speed = ((entitySpeed * 100f) * entity.Context.GameTime);
        float distanceX = entity.MovableComponent.DestinationPosition.X - entity.Object.Position.X;
        float distanceZ = entity.MovableComponent.DestinationPosition.Z - entity.Object.Position.Z;
        double distance = Math.Sqrt(distanceX * distanceX + distanceZ * distanceZ);

        // Normalize
        double deltaX = distanceX / distance;
        double deltaZ = distanceZ / distance;
        double offsetX = deltaX * speed;
        double offsetZ = deltaZ * speed;

        if (Math.Abs(offsetX) > Math.Abs(distanceX))
            offsetX = distanceX;
        if (Math.Abs(offsetZ) > Math.Abs(distanceZ))
            offsetZ = distanceZ;

        entity.Object.Position.X += (float)offsetX;
        entity.Object.Position.Z += (float)offsetZ;
    }
}

With this current formula, my players and monsters arrive to destination between 1-2 seconds sooner on the server side compared to the client-side...
Do you have any idea what I'm doing wrong ? Appriciate if someone could guide me and explain me how to solve my problem. :-)

Thank you

sentences:
Can I set offset / size in scene window in Unity? When I add component like RigidBody2D or BoxCollider, Can I set offset / size in scene window in Unity?
Other than manually set value in inspector form, then look in scene window whether it is fit or not?

sentences:
Is it unprofessional to leave game resources to the open eye? I'm still having problems packing my resources, after going through complicated APIs and basically just zip files which are exhausting my brain, I thought I could also pack the game with the resources visible to the human eye, in a simple folder.

Would that be unprofessional? Personally, I've never even seen games do that, it would basically mean that the player could just edit whatever he wants in the game, like go in map1.txt and add an X somewhere to create a wall, or change the player sprite to a pony in MS PAINT.

sentences:
Backround turning, follow the character In my Unity2d-platformer, I need background to follow the character, so I just attach it. And when character turn left from right (or right-to-left), background turn too.

How can I make my background constant?

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:
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 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:
Should I be using Lua for game logic on mobile devices? As above really,

I'm writing an android based game in my spare time (android because it's free and I've no real aspirations to do anything commercial).

The game logic comes from a very typical component based model whereby entities exist and have components attached to them and messages are sent to and fro in order to make things happen.

Obviously the layer for actually performing that is thin, and if I were to write an iPhone version of this app, I'd have to re-write the renderer and core driver (of this component based system) in Objective C.

The entities are just flat files determining the names of the components to be added, and the components themselves are simple, single-purpose objects containing the logic for the entity.

Now, if I write all the logic for those components in Java, then I'd have to re-write them on Objective C if I decided to do an iPhone port. As the bulk of the application logic is contained within these components, they would, in an ideal world, be written in some platform-agnostic language/script/DSL which could then just be loaded into the app on whatever platform.

I've been led to believe however that this is not an ideal world though, and that Lua performance etc on mobile devices still isn't up to scratch, that the overhead is too much and that I'd run into troubles later if I went down that route?

Is this actually the case? Obviously this is just a hypothetical question, I'm happy writing them all in Java as it's simple and easy get things off the ground, but say I actually enjoy making this game (unlikely, given how much I'm currently disliking having to deal with all those different mobile devices) and I wanted to make a commercially viable game - would I use Lua or would I just take the hit when it came to porting and just re-write all the code?

sentences:
How can I evaluate varying conditions in a Scriptable Object? I'm new to using Scriptable Objects, so this might just be a bit of confusion.

Let's say we have a Scriptable Object that defines the abilities a character might have in the game, and a character class that triggers these abilities:

public class Ability : ScriptableObject
{
    public string Name = "New Ability";
    public int ManaCost = 10;
    public Sprite AbilitySprite;

    public void Execute(ref Character character)
    {
        if (character.Mana < ManaCost)
        {
            return;
        }

        // Do something, like instantiating and moving the sprite

        character.Mana -= ManaCost;
    }
}

public class Character : Monobehaviour
{
    public int Health = 100;
    public int Mana = 100;

    public List<Ability> AbilityList = new List<Ability>();

    private void Update()
    {
        // Crude implementation for example purposes
        if (Input.GetKeyDown(KeyCode.Alpha1)) Abilities[0].Execute(ref this);
        if (Input.GetKeyDown(KeyCode.Alpha2)) Abilities[1].Execute(ref this);
    }
}

Obviously we can make numerous abilities with different mana costs, and add them to each character in the scene as needed; some characters may have a "Bolt" ability, while others might have an ability that casts "Fire." The Execute() method will then evaluate whether or not the character can use these ability based on the character's current mana.

But what if some of these abilities, all of which have similar effects, needed to also check the character's health, or perhaps a collision state, like isGrounded? For instance, maybe a certain ability can only be executed when the character has the appropriate mana value, and is also airborne. Would it be necessary to make many different subclasses of the Ability class to accommodate these different conditions, each with its own logic?

At first I tried changing the Execute() method to take in a bool, like this:

public void Execute(ref Character character, bool canExecute)
{
    if (!canExecute || character.Mana < ManaCost)
    {
        return;
    }
}

The problem with this is that I have to hard code the conditions for canExecute and compare the current ability against its Name, and that sort of defeats the purpose of Scriptable Objects. My goal is to be able to create abilities that might need to check varying conditions while performing the same functionality, and assign them in the inspector to each character as needed.

sentences:
What tool should I use to make this game? A little background info: I'm just about to graduate university with a software engineering degree. I have a fair amount of experience with more "serious" programming languages (C++/Java/C#), plenty of theoretical background, and good learning ability. I have minimal experience in web development as a whole (some JSP/JavaScript), and only very little with game engines (used Slick2D once to make a simple platformer, and had a brief introduction to 2D XNA).

I was recently approached by some people who have a game idea, and are looking for implementors. The game is a 2D turn-based strategy web game with a persistent world (meaning a DB backend would likely be required to store world state, user info, etc), and several UI interfaces.

I know this is a rather vague description, but based on this, which free game engine/framework/toolkit should I be looking at? Or at least, which technology (Flash/HTML5/JavaScript) would make it the easiest for me to develop this game?

sentences:
unity destroy enemy when jumping on it I am creating a 2D platformer using Unity3D, I want to have the player destroy enemies when it jumps/falls over them (just from the top). But I have been having problems trying to implement this. I stripped everything and used two simple box colliders in order to make it easy. So, when onCollisionEnter2D is called I get the bounds of the objects colliding like this:

    Bounds playerBounds = new Bounds(transform.position, collider2D.bounds);
    Bounds collisionBounds = new Bounds(collision.transform.position, collision.collider.bounds);

Then I check if the object colliding is below by comparing it's bounds:

    //If the player's lowest point is greater than the
    //colliding object's highest, then it is above it
    bool isAbove = playerBounds.min.y >= collisionBounds.max.y;

Then I check if the object is actually an enemy, and if so, I destroy it:

    if(isAbove)
    {
        if(collision.gameObject.tag == "Enemy")
        {
            collsion.gameObject.getComponent<EnemyController>().die();
        }
    }

Now the thing is this never happens, isAbove is never true, so I tried checking the heights of each object so I use

    Debug.Log("player : "  + playerBounds.min.y + " enemy : " + collisionBounds.max.y)

It says the player bottom-most is below the enemy top-most. Since I use this same method to detect if the player is grounded in order to enable jumping I noticed it works beautifully with other things like platforms but not with enemies. Also y used Debug.break to stop the game and noticed that when colliding with platforms the player's collider was always above the platform's, but when it collided with enemies they overlap: so the player's bottom-most part is below the enemy's top-most part. I read somewhere that this is due to the minPenetrationPenalty property, I didn't like the results of messing with it so I just left it the same (If I lower it doesn't even work with platforms, and I increase it they don't even touch and the collision is detected). I tried to compensate for this penetration when checking the bounds so I said:

    bool isAbove = playerBounds.min.y >= collisionBounds.max.y - 0.01;

It sometimes fails and sometimes not depending on the angle and other stuff, I still don't get it because if this was the problem It shouldn't work with the platforms either but it does, it only fails with enemy. I even tried to check for the overlap and said:

    float overlap = playerBounds.min.y - collisionBounds.max.y;

    bool isAbove = overlap > -0.01;

this still works beautifully with platforms only reporting positive values (which means they are not overlapping), but with enemies it actually reports negative values (which confirms the previous: they do overlap), even more strange it actually reports overlaps greater than what should be allowed, the usually report a -0.09 which means a 0.09 overlap which is greater than the 0.01 that the physics engine is supposed to allow.

If I apply this code in OnCollisionStay2D instead it works, I guess by this time the overlap  is fixed, but this looks unnatural and I still don't understand why this works perfectly with platforms (they never even overlap!) and not my enemies.

sentences:
Behaviour Trees with irregular updates I'm interested in behaviour trees that aren't iterated every game tick, but every so often. (Edit: the tree could specify how many frames within the main game loop to wait before running its tick function again).

Every theoretical implementation I have seen of behaviour trees talks of the tree search being carried out every game update - which seems necessary, because a leaf node (eg a behaviour, like 'return to base') needs to be constantly checked to see if is still running, failed or completed.

Can anyone suggest how I might start implementing a tree that isnt run every tick, or point me in the direction of good material specific to this case (I am struggling to find anything)?

My thoughts so far:

action leaf nodes (when they start) must only push some kind of action object onto a list for an entity, rather than directly calling any code that makes the entity do something. The list of actions for the entity would be run every frame (update any that need to run, pop any that have completed from the list).
the return state from a given action must be fed back into the tree, so that when we run the tree iteration again (and reach the same action leaf node - so the tree has so far determined that we ought to still be trying this action) - that the action has completed, or is still running etc.
If my actual action code is running from an action list on an entity, then I possibly need to cancel previously running actions in the list - i am thinking that I can just delete the entire stack of queued up actions. I've seen the idea of ActionLists which block lower priority actions when a higher priority one is added, but this seems like very close logic to behaviour trees, and I dont want to be duplicating behaviour.

This leaves me with some questions

1) How would I feed the action return state back into the tree? Its obvious I need to store some information relating to 'currently executing actions' on the entity, and check that in the tree tick, but I can't imagine how.

2) Does having a seperate behaviour tree (for deciding behaviour) and action list (for carrying out actual queued up actions) sound like a reasonable approach?

3) Is the approach of updating a behaviour tree irregularly actually used by anyone? It seems like a nice idea for budgeting ai search time when you  have a lot of ai entities to process.

(Edit) - I am also thinking about storing a single instance of a given behaviour tree in memory, and providing it by reference to any entity that uses it. So any information about what action was last selected for execution on an entity must be stored in a data context relative to the entity (which the tree can check). (I am probably answering my own questions as i go!)

I hope I have expressed my questions adequately! Thanks in advance for any help :)

sentences:
Sprite rotating to look towards mouse I am trying to figure out how to calculate the angle to rotate a sprite in z axis to look towards the mouse.

I declared one index -and vertexbuffer and set following vertices in it:
        VertexBuffer vBuffer;
        IndexBuffer iBuffer;

    VertexPositionColor[] vertices = new VertexPositionColor[4];
    short[] indices;

       vertices[0] = new VertexPositionColor(new Vector3(0, 0, 0) + position, Color.Blue);
        vertices[1] = new VertexPositionColor(new Vector3(1, 0, 0) + position, Color.Blue);
        vertices[2] = new VertexPositionColor(new Vector3(0, 1, 0) + position, Color.Blue);
        vertices[3] = new VertexPositionColor(new Vector3(1, 1, 0) + position, Color.Blue);

        indices = new short[] { 0, 1, 3, 3, 2, 0 };

        vBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 4, BufferUsage.WriteOnly);
        iBuffer = new IndexBuffer(GraphicsDevice, IndexElementSize.SixteenBits, 6, BufferUsage.WriteOnly);

        vBuffer.SetData<VertexPositionColor>(vertices);
        iBuffer.SetData<short>(indices);

Rendering:

            GraphicsDevice.SetVertexBuffer(vBuffer);
        GraphicsDevice.Indices = iBuffer;

      effect.View = Matrix.CreateLookAt(new Vector3(0, 0, -5), new Vector3(0, 0, 1), new Vector3(0, 1, 0));
        effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000.0f);
        effect.VertexColorEnabled = true;

        effect.World = Matrix.CreateRotationZ(radians);
        effect.CurrentTechnique.Passes[0].Apply();

        GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 2);

The variable radians is set in the update-method :

            center = new Vector3(0, 0, 0) + position;
        mousePosition = new Vector3(Mouse.GetState().X, Mouse.GetState().Y, 0);

        mousePosition = GraphicsDevice.Viewport.Unproject(mousePosition, effect.Projection, effect.View, Matrix.Identity);

        Vector3 dir = center - mousePosition;

        radians = (float)Math.Atan2(dir.Y, dir.X);

Now I want to solve this problem by avoiding using the method atan2.

Given is the xy-plane.
How is it possible to calculate the angle of a vector with the direction (0,0,0) to (mouseX,mouseY,0)?
Trying to use a reference vector and calculating then the dot product, dividing it by length to put it in the acos function had given false results.

Can You suggest a solution to this?

Thank you.

EDIT: I just read http://www.euclideanspace.com/maths/algebra/vectors/angleBetween/ which states that many acos implementations give a result between zero and pi... makes sense.

sentences:
How can I improve rendering speeds of a Voxel/Minecraft type game? I'm writing my own clone of Minecraft (also written in Java). It works great right now. With a viewing distance of 40 meters I can easily hit 60 FPS on my MacBook Pro 8,1. (Intel i5 + Intel HD Graphics 3000). But if I put the viewing distance on 70 meters, I only reach 15-25 FPS. In the real Minecraft, I can put the viewing disntance on far (= 256m) without a problem. So my question is what should I do to make my game better?

The optimisations I implemented:

Only keep local chunks in memory (depending on the player's viewing distance)
Frustum culling (First on the chunks, then on the blocks)
Only drawing really visible faces of the blocks
Using lists per chunk that contain the visible blocks. Chunks that become visible will add itself to this list. If they become invisible, they are automatically removed from this list. Blocks become (in)visible by building or destroying a neighbour block.
Using lists per chunk that contain the updating blocks. Same mechanism as the visible block lists.
Use nearly no new statements inside the game loop. (My game runs about 20 seconds until the Garbage Collector is invoked)
I'm using OpenGL call lists at the moment. (glNewList(), glEndList(), glCallList()) for each side of a kind of block.

Currently I'm even not using any sort of lighting system. I heard already about VBO's. But I don't know exactly what it is. However, I'll do some research about them. Will they improve performance? Before implementing VBO's, I want to try to use glCallLists() and pass a list of call lists. Instead using thousand times glCallList(). (I want to try this, because I think that the real MineCraft doesn't use VBO's. Correct?)

Are there other tricks to improve performance?

VisualVM profiling showed me this (profiling for only 33 frames, with a viewing distance of 70 meters):

Profiling with 40 meters (246 frames):

Note: I'm synchronising a lot of methods and code blocks, because I'm generating chunks in another thread. I think that acquiring a lock for an object is a performance issue when doing this much in a game loop (of course, I'm talking about the time when there is only the game loop and no new chunks are generated). Is this right?

Edit: After removing some synchronised blocks and some other little improvements. The performance is already much better. Here are my new profiling results with 70 meters:

I think it is pretty clear that selectVisibleBlocks is the issue here.

Thanks in advance!
Martijn

Update: After some extra improvements (like using for loops in stead of for each, buffering variables outside loops, etc...), I now can run viewing distance 60 pretty good.

I think I'm going to implement VBO's as soon as possible.

PS: All source code is available on GitHub:
https://github.com/mcourteaux/CraftMania

sentences:
Collision detection recommendations I am currently developing a prototype game for mobile devices in which the user will see several objects on the screen and will have to touch them one by one in the correct order to win. I guess it that you can say that it is similiar to a Whack a Mole game, but instead of having moles popping up on the screen, I will have several objects moving around.

I am having some difficulties in implementing a collision detection algorithm for this game, thefore I would like your recommendation on what is the best method to use.

For example suppose an object is moving in a given direction, then I could use the SAT to check if it collides with other objects. If it does collides, then it will stop and move in another direction which is randomly chosen.

Another option would be to divide my screen into square or hexagonal tiles. This way I could just check if the tiles are free or occupied before moving the objects.

My game be 2D and will use a top-down ortographic projection and I am developing it using Cocos2d-X and Marmalade SDK. I am not using any physics engine, because my game does not require them (the objects just have to move around, they don't bounce or need any sort of physics behavior).

sentences:
Handling different screen sizes in multiplayer games sorry if this has been asked already. I did some checking around and couldn't find any helpful advice.

I'm developing my first multiplayer game, and it'll be fullscreen when run. My issue is, how do I balance for screen sizes? It seems to me that it might be considered unfair if some players can see more of the playing field than others, and it's not an issue I'd ever considered before since all my previous projects have been single player and usually fixed resolution.

Some options I'd thought of is a zoomable map, so players can handle how much of the screen they see to give them the choice between clarity and view distance. Another was a fixed internal resolution and black bars or sidebars if it's out of the aspect ratio.

Thanks in advance for any help.

sentences:
Level/Asset design for performance Unity I am a big fan of modular assets.
Currently I am designing a 3d game for mobile and I don't know how I should create my levels to get the most out of the device.

Should I...

create lots of "small" (1x1x1 meter) assets and build my level using them
or create one geometry for the entire level?

What about textures?
Should "all" objects share one highres texture and only display their part using the right UV settings (like say in minecraft)or should I create an individual texture for each object?

sentences:
How to order objects with the same depth in the spritebatch cycle? I have a tilemap in a isometric 2.5 view and i have also many objects moving and static.
The problem is many statics are standing in a "integer" place for obvious reasons and the depths of each object is calculated based on their position in the tilemap.

So what happens for some strage reasons is that 2 objects standing next to each other if big enough overlap and if they are in an adjacent diagonal tile they also have the same exact depth, but when drawing the order of same depth object seems random... I draw them in the same order every cycle ofc but the overlapped part of the texture sort of flicker being drawed on top or bottom apparently randomly...

Is there a way to use depth to order objects but make the same depth ones be in some kind of order and not random?

sentences:
How to resolve a sphere-mesh collision? I'm making a rolling-ball type game, and I can't seem to get my sphere-mesh collision code working properly.

Currently what I have for the main loop (in regards to collision) is the following:

Calculate player acceleration based on input
Clamp velocity to avoid clipping
Add velocity to position
Add acceleration to velocity
For each solid object:
    Check for collision for this object and resolve (how I do this is below)

If there were any collisions:
    Normalize accumulated normal vector (explained below)
    Slow down ball to account for friction

I tried two main methods for resolving collisions, each with their own problems.

The first method:

For each triangle:
    If there is a collision:
    Correct player velocity along normal based on distance
    Accumulate normal for friction calculations later
    If velocity perpendicular to surface is above threshold:
        Rebound ball off surface with damping factor
    Otherwise, if moving toward surface instead of away:
        Clear perpendicular velocity

The problem with this method is, when I hit a wall, the player will begin to bounce erratically. The collision I'm using to test this looks like this (player to scale):

The second method is similar to the first:

Set collision distance accumulator to arbitrarily high value
Set triangle index to -1 (to denote that there's no collisions)

For each triangle:
    If there is a collision:
        Calculate collision distance
        If this distance is smaller than the accumulator value:
            Set triangle index to current triangle
            Set collision distance accumulator to current distance value

If the index is not -1 (there was a collision):
    Correct player velocity along normal based on distance in accumulator
    Accumulate normal for friction calculations later
    If velocity perpendicular to surface is above threshold:
        Rebound ball off surface with damping factor
    Otherwise, if moving toward surface instead of away:
        Clear perpendicular velocity

This fixes the bounciness issue, but now I can go partially through surfaces which are supposed to be solid.

I have no idea where to turn at this point. Hopefully someone here can provide some insight as to what's going on.

[EDIT] I can add some video if that'd help anyone.

[EDIT 2] Here's a link of a video using the first method:
https://drive.google.com/open?id=1n1MxTYQkzKA2eixTkEOD3E7eOd0Ryl4f

[EDIT 3] I redid the code somewhat, here's some related code snippets:
https://pastebin.com/GQd9bwgB

It still bounces, like so:
https://drive.google.com/open?id=1JPJ4lkIB0wBhjnlT5mawxKwq0dC6DlNr

I think I know the cause, but I don't know how to best fix the issue.

sentences:
Unity pixel art distorted sprites I have a problem rendering my pixel art sprites properly in Unity.
So far I have one character in a sprite-sheet I made, with frames of size 64x64. The actual sprite is roughly 32x32 but I left room for movement in animations.
I import the sheet following pixel perfection procedures I found on the internet using these settings:

As for the orthographic camera I set its size using this formula:

orthoCameraSize = screenHeight / (2 * 32)

If I zoom on the sprite in scene it looks fine but when in game it gets rendered quite poorly (in game / in scene pics below):

What could be the source of the problem? I applied every good practice advice I could find on the web...
Thanks for your help!!!!

sentences:
What is "tools development?" I have been looking at different jobs in the games industry and a lot of the jobs that I have seen advertised are for a "Tool Developer" position. I do not know what this actually is.

Could someone explain what this is to me please? And if anyone has any links to material that would help me understand it more then that would be very much appreciated.

sentences:
Unity3D multiple objects user rectangle selection I wish to allow the user to select multiple units by click and drag as most RTS do. The issue I have is that the tutorials are either in 2D or only use the transform.position such as this one.
Using the transform.position will work for most cases but will not allow the user to select easily as selecting the head or feet of a unit will not work in this instance. It also means I have to do an other script using raycasts for single click selections as it is almost impossible to get the single point of the transform.position with one click.
How can I do a proper rectangle selection for a 3D game? By looking at 3D RTS games I own, I noticed that they use a simplified hitbox (usually a cube or capsule).

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:
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:
JavaFX AnimationTimer VS Swing Game Loop After looking at some code sources out there I noticed Java Swing Games usually create a class implementing Runnable, create a new Thread and set up the game loop in the run() call.

But JavaFX games seem to simply extend from Application and run the game loop in a  new AnimationTimer() { ... public void handle() ... }

What gives?

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:
Scripting language with class instance support I have come across the need to use a scripting engine for my C++ game, but after experimenting with many languages since the last few days, nothing has truly stood out as the obvious choice for a language and/or binding library.

I would like have the ability to

call methods of a specific Game instance from within the scripting language,
call arbitrary functions in the scripts from C++, and
test for function existence in the scripts using strings.

Lua looks nice, but I'm unsure of its ability to do 1 and 3. Python and Boost::Python are great, but the same applies. Regardless, here's an example of an ideal implementation.

C++

class Game
{
    ...
    void printNumber(int arg);
};

int main( )
{
    Game *game = new Game();

    // Make method available to script
    functionRegister("printNumber", game->printNumber);

    // Test and call function in script
    if ( functionExists("greet") )
        functionCall("greet", "Hello world");
}

Script pseudocode

function greet( greeting )
    print( greeting )
    game.printNumber( 42 )
end

The output may be

Hello world
42

Is there a language and library that will pull this off?

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:
How to rotate and move a model in the direction it is facing? I am not using Unity or XNA. Eventually, I will probably use OpenTK for graphics. But for the concept of a game I'm writing, I am using the console for keyboard input and visual logging of events, etc.

I am also using a WPF window to display world and player data.

Update: I am using 0 deg as North. I understand that this may not be 'standard'. I don't mind switching to the standard where 0 deg is East if necessary.

The standard keys are W, A, D, S and Left/Right arrows.
W: move forward
A: move left
D: move right
S: move backward

L Arrow: rotate left 2.5 (degrees)
R Arrow: rotate right 2.5 (degrees)

I am new to the physics of movement within a 2D space (as if I am looking down from overhead). What I have is a World and Player model; each Player encapsulates an IEntityVector object.

Edit: added the conversion to radians in the following method. Seems to work more correctly as long as the orientation is 0, 90, 180, or 270 degrees.

Move Model:

  public static void MoveEntity (Guid EntityId, Direction Direction) {
     var entityVector = default(IEntityVector);
     var gameWorld = default(World);

     if (entityRealms.TryGetValue(EntityId, out gameWorld)) {
        if (gameWorld.entityVectors.TryGetValue(EntityId, out entityVector)) {
           var heading = (Math.PI/180) * entityVector.Heading;

           switch (Direction) {
              case Direction.Forward:
                 entityVector.AddMovementX((float)Math.Sin(heading));
                 entityVector.AddMovementY((float)Math.Cos(heading));

                 break;
              case Direction.Left:
                 entityVector.AddMovementX(-(float)Math.Cos(heading));
                 entityVector.AddMovementY((float)Math.Sin(heading));

                 break;
              case Direction.Right:
                 entityVector.AddMovementX((float)Math.Cos(heading));
                 entityVector.AddMovementY((float)Math.Sin(heading));

                 break;
              case Direction.Backward:
                 entityVector.AddMovementX((float)Math.Sin(heading));
                 entityVector.AddMovementY(-(float)Math.Cos(heading));

                 break;
              default:
                 break;
           }
        }
     }
  }

Rotate Model:

  public static void RotateEntity (Guid EntityId, float Heading) {
     var entityVector = default(IEntityVector);
     var gameWorld = default(World);

     if (entityRealms.TryGetValue(EntityId, out gameWorld)) {
        if (gameWorld.entityVectors.TryGetValue(EntityId, out entityVector)) {
           entityVector.Heading += Heading;
        }
     }
  }

#1 I am trying to understand the rotation first of all. If Heading is increased or decreased by 2.5 per rt/lf arrow key press, how do I keep the resulting value as a true degree value?

#2 How can I use the Heading degrees as the facing to properly move the entity?

Btw, here are the AddMovement methods:

  public static void AddMovementX (this IEntityVector Vector, float X) {
     var newPosition = Vector.Location.X + (X * Vector.Thrust);
     Vector.Location = new Vector(newPosition, Vector.Location.Y);
  }

  public static void AddMovementY (this IEntityVector Vector, float Y) {
     var newPosition = Vector.Location.Y + (Y * Vector.Thrust);
     Vector.Location = new Vector(Vector.Location.X, newPosition);
  }

sentences:
Game Modeling good practice regarding quads and ngons I'm asking myself if using quads is really the better practice instead of using ngons (for flat surfaces!) when it comes to game modeling.

I often read this and saw models that look like this (96 tris!).

But I can't understand why this should be preferred instead of this model using ngons (60 tris!)

Are there reasons why the quad variant with more tris should be preferred also for a final game model (that also does not use displacement mapping for example) or is the n-gon actually preferred in such cases because of the lower triangle count?

Because it came up in the discussion: This should be of course only valid for static objects that do not deform, my question came up because I saw that models which are most likely not supposed to deform are modelled using the additional quads and I'm wondering if there's really any benefit of doing it (I just see the disadvantage of additional triangles so far).

sentences:
Why does the Debug.DrawRay return these weird lines I am working on a small feature of a 2D mobile game where a indicator points towards a object in 2D space. I am trying to make the indicator turn towards the object, however the vector I am trying to construct that points towards the object is off a bit.

When I decided to draw a debug ray from the indicator position to the objects position it was also off a bit. I then decided to draw the debug ray the other way around which gave me a different line. If my understanding is correct, if you switch the starting point and the end point of a ray the line should stay exactly the same right?

using UnityEngine;
using System.Collections.Generic;

public class Tracker : MonoBehaviour {

public GameObject goToTrack;
private List<Renderer> renderers = new List<Renderer>();

void Start(){
    foreach (Transform child in transform) {
        renderers.Add (child.gameObject.GetComponent<Renderer>());
    }
}

void Update () {

}

void OnGUI(){
    Vector3 v3Screen = Camera.main.WorldToViewportPoint(goToTrack.transform.position);

    // if the target is within the viewable screen the indicator shouldn't be rendered)
    if (v3Screen.x > -0.01f && v3Screen.x < 1.01f && v3Screen.y > -0.01f && v3Screen.y < 1.01f) {
        foreach (Renderer renderableObject in renderers) {
            //renderableObject.enabled = false;
        }
    }
    else
    {
        foreach (Renderer renderableObject in renderers) {
            //renderableObject.enabled = false;
        }

        v3Screen.x = Mathf.Clamp (v3Screen.x, 0.01f, 0.99f) -0.04f;
        v3Screen.y = Mathf.Clamp (v3Screen.y, 0.01f, 0.99f) -0.04f;
        transform.position = Camera.main.ViewportToWorldPoint (v3Screen);

        Debug.Log ("Target planet position: " + goToTrack.transform.position.ToString());
        Debug.DrawRay(Camera.main.ViewportToWorldPoint (v3Screen), goToTrack.transform.position, Color.red, 5.0f);
        Debug.DrawRay(goToTrack.transform.position, Camera.main.ViewportToWorldPoint (v3Screen), Color.green, 5.0f);

        //Debug.Log ("Tracker angle: " + angle);
        //transform.Rotate(0,0, angle, Space.Self);
    }

}
}

Output:

UPDATE:
I have noticed that when i substract the second vector with the first vector of the Debug.DrawRay it draws the ray like i want it to.

From this I am taking that the Debug.DrawRay function draws the second vector on top of the first vector. (kind of like the the first vector is Vector(0,0,0) and the second vector is the actual ray you want to draw)

sentences:
Converting between Spiral Honeycomb Mosaic and axial hex coordinates There seems to be quite a lot of logic in dealing with hexagonal grids using a system of axial coordinates like the one described here.

In doing some reading about hex grids, though, I ran across the notion of the Spiral Honeycomb Mosaic (the links on that mirror are broken; the content is copied from here, about halfway down the page). It seems to be used mostly in image processing, but it's interesting from the standpoint that it assigns each hex a unique, sequential base-7 number as its identifier.

I'm not sure that it's actually useful for anything, but I'm wondering: is it possible to convert back and forth between the SHM numbering system and axial coordinates?

Both systems have methods to convert from a hex to the Cartesian coordinates of its center, so presumably one could calculate that out of one system, and then into the other. But that's messy and inefficient, and I'm convinced it's possible to do better.

Because of the fractal nature of the SHM, the conversion routine in the sample code provided relies on a loop; it seems like the general solution might involve a series?

sentences:
android game: how to approach mutliplayer I'm making a single player game that is near completion, and I am already starting to think about giving the game multiplayer.  The multiplayer would basically be finding someone to play against, likely in a waiting room or just have a match-making function, and then having a pokemon style battle between the people in real time.  I think it would be relatively simple as I'm just sending information about each attack(move chosen and damage) and what it did back and forth, but I'm not sure what resources to consult for this.  I am very new to Android/Java development and really just learning as I go.

I have heard a bit about Skiller, but I'm still unfamiliar with using other SDK's and how easy it may be.  Does anyone have any suggestions as to what SDK's or methods for accomplishing this.  I currently have no money to spend on software development, but I'd like to get started on learning how to do this.

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:
Multithreading MMO Server. A thread per area OK? As a personal project, I'm setting up a MMO, and writing the server in C#/.NET Core.

As of now my architecture is as follows: The world exists of different areas ( you can go from area to area trough portals ). An area is called a 'room' on my server. Each room has it's own list of clients ( players, each with their TCP stream ).

Now I was wondering if it was ok that I run each room on it's own thread. Each room will manage it's own update cycle ( game loop / room ), as it's independant of other rooms.

My worry is that as the game grows, I will get lots of areas and that a thread per area isn't that great of an idea.

So my question is: Am I doing something wrong or non-benificial in the future ? Am I better off having 1 thread for the game logic for all the rooms ? Or is it ok to have a thread per room ?

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:
Not clearing FBO's Texture error in battery economy mode When rendering inside a FBO's texture, I'm not using glClear() but overwriting each fragment, GL_BLEND is set to true.
This works just fine, but  I just realised when my laptop switch to economy mode, and I guess switch to egpu (intel 630) , the texture is full of garbage data when drawn.
here you can see first the working render, and then the garbage one. It should be exactly the same the only difference is my laptop is not plugged in AC

sentences:
Could not load PNG in SDL2? I have three image files, one is Techs.png, one is Techs.gif and one is Techs.bmp. I have used SDL_image 2.0.5 and SDL 2. When I load the image of Techs.gif and Techs.bmp, there is no error, but when I load the image of Techs.png.
SDL_Surface*Surface=IMG_Load("Techs.png"), an error occurs, I cannot load this image and Surface always returns NULL, I am using Visual Studio 2019.
Can someone help me, thanks.

sentences:
How can I use different fonts for different objects in Unity? In Unity 3.5, I have a font that is strangely linked to four game objects. I want to put separate fonts on each object.

In the Inspector, when I click on the circle icon next to the "Text" attribute, I can select a font.  But, then it changes the font on the other three objects as well.

I was hoping Unity would have something like a material ID from 3DS Max. If I could put a new material ID on the other objects, hopefully I could assign a new font to the text mesh. Regardless, is there a way to assign a different font to each of my objects?

sentences:
Code reuse for a CRPG data model on the server-side I'm working on a turn-based game with CRPG (Computer RPG) elements in HTML5. It has to support 10K+ CCUs (Concurrently Connected Users).
The CRPG elements in the game are item and character systems:

The game has characters, characters have items.
Items may be worn or used as consumables.
Items may be crafted and upgraded.
Characters gain experience and get new levels.
Characters and items have characteristics (like health, attack strength etc.).
Characters may have buffs and debuffs placed on them that affects characteristics.
Characters have talents that acts like permanent buffs or debuffs.
Items worn and consumables used may affect character characteristics.
Characters may strike each other, and strike outcome is calculated based on the effective characteristics of the attacker and target.

All of the above has to be stored and handled on the server-side.
To avoid developing everything from scratch for the 100th time, I'd like to maximize my reuse of existing code: original, free, or commercial.
I can adapt the CRPG model requirements to the implementation limitations to a certain (considerable) extent. Technology stack does not matter much either — as long as it is reasonably scalable.
How can I author my server-side solution to maximize code reuse?

sentences:
Most efficient language for rewriting a tile-based board game as a video game? I've been working on a hex-based board game. Every time I make changes, especially changes that require redesigning the map, it takes a good chunk of time and money. It might be more efficient to write it as a video game, at least for designing it and showing off mock-ups. I've always wanted to learn a programming language anyways, so this gives me a good excuse.

Things that are important:

Hex grid movement, obviously
Hot-seat or online play - it's a multiplayer board game, thus a multiplayer video game
Keep track of what you might call "touchdowns" at a specific location, as well as HP and movement speed

AI would be unnecessary, so would sound effects or a matchmaking server. I just want to be able to show this to people.

Languages I've thought about learning before:

Flash, because it's ubiquitous
C seems to be an industry standard for video games
Javascript, because it seems to be the more powerful successor to flash
Python, because geeks always geek out about how awesome it is

If one of those languages would work well for my purposes, awesome! If there's a more efficient language to learn for this particular application though, I'm open to that.

sentences:
How to debug shaders running on Android 4.x devices? I have tried some of the existing inspectors such as RenderDoc and gapid, but none of them can be used with Android 4.x. Latest version of gapid requires Android 6.0 and RenderDoc requires Android 5.0.

But I need to debug shaders in my app running on a Galaxy Tab 3 8.0 (SM-T311, ARM Mali 400), which uses Android 4.2.2. I cannot upgrade its Android version.

The app was made with Unity 2018.4 and targets Android 4, ARMv7. How can I inspect & debug my shaders running on this kind of device?

sentences:
What is a vertex color? My question is what is written in title. This term "vertex color" appear a lot. I am having hard time to understand this.

For example:

Isn't a vertex simple point on 3D space? If so, how can a point have a color? Or does this "color" mean something else?

There is a "Vertex Color" node in unreal engine's material editor.

Can someone shed light on my question? I couldn't find anything usefull when I googled "what is a vertex color" but the documentations that are too technical for me.

sentences:
Disable autorotation if Android has it disabled I'm making a game for Android in Unity. I wanted the game to handle screen rotations, so I set "Default Orientation" to "Auto Rotation. This works well, except for one issue:

If you disable auto-rotation in the device's settings, the game ignores this and keeps autorotation.

How would I go about making it disable autorotate when the Android device is set to disable autorotate?

sentences:
Using sprites in pygame without classes and objects Relevant information

I'm in a grade 11 computer science class that uses Python & Pygame. We're aloud to use sprites and images though we're never taught it, just drawing graphics like squares and circles. We were taught arrays, lists, functions but not classes and objects. We also relatively do things without using functions like the init main one I see a lot on line, we also don't use self or super.

If it's anything relevant, I'm making a top down (bird's eye view) 2D shooter game similar to a 2D version of dead ops arcade in Call Of Duty: Black Ops.

What I'm trying to do

I've been programming with Java & LibGDX before hand. So I want to use sprites in images in Pygame the same way I've been using it in LibGDX. Getting images, obtaining image rectangles for collision, rotating/transforming images, changing the images of the sprite.

Though every tutorial I've seen for sprites and images in Pygame that I can search up uses objects, classes and function calls that I'm not familiar with.

What I've done

I've loaded a PNG into my program and drew it to the screen. Simple and straight forward. Though the Pygame documentation doesn't give me a lot of options in terms of manipulating these images other than moving their location.

What I'm asking for

A simple run down syntax of how I would use a sprite in Pygame, without objects/classes or any weird function terminology. In terms of functions I can make a function, pass information through parameters and return values. I'm not aware of global variables, self or super.

The simplest of simple where I can resize an image, change the image of a sprite, transform/rotate it, and get a rectangle that I can use to overlap with another one.

sentences:
How to implement A.I. for checkers/draughts? I saw this checkers game and I wondered how the A.I. was implemented.

How should I implement an A.I. for checkers (draughts, dama, dame)? Are there any known algorithms?

Very thnaks full to all. I m very wonder to see this Tic Tac Toe game tutorial blog post.

So, i want dama game algorithm open source code and blog post..  Is there any helpful link or any doc file..? please let me know..

sentences:
How to annotate a BinaryFormatter packet with a header describing its length? I am working on a project that is sending data from pc to tablet via usb, using android adb. To serialize the data, we are using BinaryFormatter. The problem I'm running into is that the client is sending packets of size 1161 bytes.
Now I could hard code in 1161 as the length of the byte array on the receiving in, and this would fix my problem. But what I would rather do is put the length in the header of the packet being sent, so the receiving end can check that and create the packet according to the size, just incase we get a different packet type of a different size.
However, BinaryFormatter also encodes the names of the fields, so as far as I can tell, you can't determine the length the object will be before serializing it, at which point, it's too late to set the length property in the header.
Does any one know a solution to this that will elegantly handle different packet sizes, and packets over the size of 1024 bytes? Thank you!

sentences:
Steamworks SDK achievement de-synchronization The development of my game is coming to an end and I'm now looking into getting a hold of a publisher and publishing my game to Steam. To do this I'm also preparing my game for the use of the Steamworks SDK that handles general Steam business like achievements among other things.

The thing is my game already has a built-in achievement system and I'm worried that my achievement system and the Steam achievement system might get de-synchronized for one reason or another - as in the achievement is unlocked locally in the built-in system but not unlocked in the Steam API. This seems to have happened to several users (Plants vs Zombies example) and Steam has made it clear that this is the developer's responsibility.

How should I be a responsible developer and prevent de-synchronization or deal with it if it occurs?

sentences:
Which DirectX Version to use for a low poly game? Which DirectX Version (10, 11 or 12) is recommended to use, if you want to have a low-poly game with shaders, shadow and aliasing. But not normal or height maps. Moreover my question is, because once we upgraded from directx 9 to 11 now, the GPU usage for the game was like duplicated. I can not even play it with CPU at all. It means directx 11 has higher usage even then 9.

If using Directx10, could it help to decrease the gpu usage? (Which was caused by directx upgrade)

sentences:
Screen effects and antialiasing I have been working on a game for a while using glut for basic window creation.
I was rendering to an offscreen buffer so that I could implement various effects like screen bulging, motion blur, refraction, etc. I also used the screen texture with antialiasing (fxaa).

Now I have changed from glut to sfml. I switched on the in-built antialiasing and it looked much better than my version, but now I don't have the screen in a texture so I can't use the screen effects.

So my question is, how to people normally deal with this issue? Can I take advantage of sfml's antialiasing functionality and retain my effects? I thought about using glReadPixels, but that seems way too slow. Does sfml do offscreen rendering behind the scenes and can I access that texture?

This is not specific to sfml. How do AAA games do it? Do they always implement their own antialiasing techniques?

sentences:
How to draw text on a 3d sphere? I am facing a problem in mapping 3d co-ordinate to screen co-ord . I require it because i want to draw text on the model . model is drawn at the 3d-cordinate, so if i know the position of that co-ord on the screen i can draw text at that position.

my view is on z axis
test position is on x axis

In the follwing code I did what i said above but the transformation is not happening the way it should i.e, text should appear on the model

float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
Vector2 screenOrigin = new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
Vector3 testPosition = new Vector(10,0,0);
Vector3 cameraPosition = new vector(0,0,50),

Matrix world = Matrix.Identity;
Matrix view = Matrix.CreateLookAt(cameraPosition,Vector3.Zero, Vector3.Up);
Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);

Matrix totalEffect = world * view * projection;

Vector2 spritePos = getXYPosition(vecAndMatMultiplication(testPosition, totalEffect))+screenOrigin;

Where vecAndMatMultiplication() multiplies vector with the matrix and getXYpostion() should be fairly obvious.

sentences:
Random numbers with a left or right biased skew Within Java I have a table of objects ranging from horrible (1%) to wonderful (100%) from which one is randomly selected. This is simple enough and appears on a bell curve with a normal distribution and the average at the 50% mark. But at various stages I wish for this distribution to shift left or right meaning that you are more likely to generate a less pleasant item or at other stages, generate a more pleasant one. The table ranges from 1 to 100.

How do I generate a random number that is biased to one end of the table and not the other, while still being able to, in this case in a bad situation, randomly come up with a 100%? I have looked at Random.nextGaussian(). But this doesn't seem to quite do it, if I am reading it correctly.

sentences:
Camera rotation - First Person Camera using GLM I've just switched from deprecated opengl functions to using shaders and GLM math library and i'm having a few problems setting up my camera rotations (first person camera). I'll show what i've got setup so far.

I'm setting up my ViewMatrix using the glm::lookAt function which takes an eye position, target and up vector

// arbitrary pos and target values
pos = glm::vec3(0.0f, 0.0f, 10.0f);
target = glm::vec3(0.0f, 0.0f, 0.0f);
up = glm::vec3(0.0f, 1.0f, 0.0f);

m_view = glm::lookAt(pos, target, up);

i'm using glm::perspective for my projection and the model matrix is just identity

m_projection = glm::perspective(m_fov, m_aspectRatio, m_near, m_far);

model = glm::mat4(1.0);

I send the MVP matrix to my shader to multiply the vertex position

glm::mat4 MVP = camera->getProjection() * camera->getView() * model;
// in shader
gl_Position = MVP * vec4(vertexPos, 1.0);

My camera class has standard rotate and translate functions which call glm::rotate and glm::translate respectively

void camera::rotate(float amount, glm::vec3 axis)
{
    m_view = glm::rotate(m_view, amount, axis);
}
void camera::translate(glm::vec3 dir)
{
    m_view = glm::translate(m_view, dir);
}

and i usually just use the mouse delta position as the amount for rotation

Now normally in my previous opengl applications i'd just setup the yaw and pitch angles and have a sin and cos to change the direction vector using (gluLookAt) but i'd like to be able to do this using GLM and matrices.

So at the moment i have my camera set 10 units away from the origin facing that direction. I can see my geometry fine, it renders perfectly. When i use my rotation function...

camera->rotate(mouseDeltaX, glm::vec3(0, 1, 0));

What i want is for me to look to the right and left (like i would with manipulating the lookAt vector with gluLookAt) but what's happening is
It just rotates the model i'm looking at around the origin, like im just doing a full circle around it. Because i've translated my view matrix, shouldn't i need to translate it to the centre, do the rotation then translate back away for it to be rotating around the origin? Also, i've tried using the rotate function around the x axis to get pitch working, but as soon as i rotate the model about 90 degrees, it starts to roll instead of pitch (gimbal lock?).

Thanks for your help guys,

and if i've not explained it well, basically i'm trying to get a first person camera working with matrix multiplication and rotating my view matrix is just rotating the model around the origin.

sentences:
How to avoid CollisionShape2D bouncing which prevents Area2D detection? Consider the player with a rectangular CollisionShape2D:

and a round enemy with a CollisionShape2D and a little bigger Area2D:

I observe frequent collisions with no body_entered signal sent by the enemy area.
I have tried to reduce the radius of the collision shape in the enemy. It works, but enemy behavior against walls is not satisfaying anymore.

Edit
My question was unclear... Bouncing is not appropriate to describe what is happening.
Player and Enemy are KineticBody2D.
After some reflection, I have an hypothesis:
Maybe it is because Enemy changes x direction each time _is_on_wall() which means that he changes direction when he hits the player too.
Anyway, if changing direction is the cause of the absence of detection of the player Body by the enemy Area, for the player and enemy to collide, the body of the player must be in the area of the enemy.
For @Theraot remark on adding on Area to the player, I have decided to leave to the enemy the responsability to detect and damage the player, because it is easier to make type of enemy this way I presume.

sentences:
Activate and Deactivate Collider with Click I'm having some trouble working with this, it's basically a sword that points toward your mouse position, and when you Left-Click, a Trigger Collider is activated and then deactivated, but I can't get it to work.

Here is my code :

void Attack()
{
    //Activates the Sword Collider
    polygonCollider2D.enabled = true;
    //Debug Line
    Debug.Log("Collider Active");
    StartCoroutine(Wait(0.1f));
    polygonCollider2D.enabled = false;
}

IEnumerator Wait(float seconds)
{
    yield return new WaitForSeconds(seconds);
}

I did it this way hoping that the Wait method would give the game enough time to react to an active collider, and using some Debug.Log(). I know that the collider actually activates, but it does not react to other colliders.

I keep wondering if this is the proper way of working with this. If it's not, do let me know.

sentences:
Unity3D: collider performances on mobile iOS devices I'm experimenting with Unity3D and colliders. Unfortunately I still don't have Unity Pro version and I can't use the profiler.

Consider the following situation:

mobile devices (ios, iphone 3GS).
an infinite runner game (consider something like agent dash or temple run). The player run along its path collecting bonuses and possibly hurting obstacles.
the number of objects along player's path is very high.

The first simple approach is to use a rigidbody with a collider attached to the player (let's say it could be even a shere collider) and use a collider for each object in the scene (coins, obstacles, bonuses,...) .

AFAIK, using hundreds of colliders could have a serious impact on performances,specially on mobile devices, am I right?

So here's some questions:

In the situation described above, is that feasible use collider to
detect objects collectable by a player running along a path?
Could be a better idea to store the location of the collectables
objects inside some kind of data structure and completely avoid to
use Unity collision detection?
What's a reasonable average number of RigidBody/Sphere Collider that can be used in a single scene on a mobile device?

Does anyone has implemented something similar? Could you suggest me the right way to go?

sentences:
Help with building a platformer engine on top of cocos2d I am a C# programmer making a transition to game programming and hence C++. I want to make a reusable platformer engine (for now I want to start small) on top of cocos2d/box2d to make prototyping of new ideas easier.

My idea is nothing new, I want to use a component model to be able to build game objects by various blueprints. My biggest problem is the implementation of my idea as my c++ skills aren't great.

The idea is that every game object is a composition of raw data and behavior/actions where raw data is expressed as set of components eg. "VisualComponent", "PhysicsComponent" etc.. and actions defines the "mind" of the object or what it can do: "Move","Jump","Roll","Hide" etc..

Below you can see I made simple actions/states diagram, the actions has a flow. some actions are blocking other actions while their in progress. This is the notion I want to have with this engine. A set of actions or behaviors that plays nicely together. actions should be stacked if possible so shooting while moving/jumping is allowed. But shooting while rolling isn't allowed hence rolling is a blocking action. (I'm not talking about reactions yet but it is too a concern).

Ok, so back to the GameObject here is what I want to achieve.

GameObject should have plug-able components mechanism to be built by it's blueprint (Some sort of data structure maybe JSON).
Needs to have set of defined actions/behaviors.
Most important: If the object isn't a dummy (has a brain) it needs a composer that actually makes sense of what to do next, and that's a huge subject on where the logic of all the stuff should happen.

Here I made another simple diagram of how I see the object interactions with the world (it can get the actions by the AI or user input)

here is a theoretical example of what I want to be able to do (pseudo):
it's me talking to the engine if it was a human.

create a new object
add a physical component: circle body and radius size of 5
add a visual component: idle sprite "idle.png", jump animation "jump.gif" (needs to follow the physics object at all times)
add userControlComponent:(needs to communicate to physics component of the relevant physics actions)

bindkey('d', moveAction(force))
bindkey('a',moveAction(force))
bindkey('space',jumpAction(force))
(the actions change/replace states and block other states)

Hardest part for me to think about is how to keep actions intact with the specific components they affect. And how to add more logic without making this model a monstrous thing. Let's say I have jump now I want to be able to give my character double jump it's hard for me to visualize how it can be done without serious changes each time that can mess with the flow" of actions/states. Furthermore it's really hard for me to think about reactions logic cause that's not even controlled by the object itself.

I will be happy to hear your thoughts and ideas of this model. If it's outdated or totally crap I'd like to here it too. Mostly I'd like to hear about how you would implement such system.

sentences: When or why would someone use a programming language (Swift, Java, C++, Rust etc...) over an engine like Unity? Everytime I've read about people asking whether they should write their game in C++ or Unity, Unity is usually the default answer, unless they want to go through the hassle of creating an engine by themselves when Unity already does everything for you.  If that's the case is there ever a case where writing a game in C++, Java, Rust etc... is better than using Unity? If so what are these cases?

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 deal with "level design creep?" Level Design Creep is what I've started to call what happens when you build a series of levels and notice that every level is a little bit better looking or designed than the last, or when working together with several people with different skill levels. Left alone, as the player goes through the game the level quality would go up and down according to the order the levels were built. It seems like we're spending more time on this than we should be.

Besides cutting out the really good and really bad levels, is there a way I can plan for or manage the production so that the detail doesn't "creep up," and we have to revisit the same work over and over?

sentences:
How can I improve the performance of handling many objects to draw in XNA? I have a 2D engine that uses XNA 4.0. I have an issue with handling many objects.
In my engine, I only draw visible sprites, and ignore sprites outside of the current viewport. It works, so far. I also use a RenderTarget to minimize the amount of sprite batch being called, to draw the base.

I also need to draw buildable objects, and the worst case is that there is a list with 10,000 - 20,000 objects. I need to iterate through them, to find the visible buildable objects, as well. This really affects my frame rate, especially when the viewport changes.

I could decrease the zoom level, to minimize the amount of base tiles, but the list of objects keeps the same. Using smaller texture sizes could help, but then I´m also losing detail.

How could I improve the performance?

sentences:
Why don't more games use vector art? It would seem to me that vector art is more efficient in terms of resources/scalability; however, in most cases I have seen artists using bitmap/rasterized art. Is this a limitation put on the artists by the game programmers/designers? As a programmer I think vector art would be more ideal, since it allows for scaling up resolution without having to recreate the art, creating really large graphics or causing graphics to become blurry.

The questions: why aren't more people using SVG/AI to create 2D game art? Would it actually be preferred (and who prefers it)? Are bitmap graphics a standard or a limitation (or maybe neither)?

Background: I am working on an engine, and I had some kinda cool ideas for vector based graphics; however, I don't want to piss off artists in the future.

I guess this is more a question centered around pragmatism and developing games.

sentences:
Mixing perspectives in an oblique-perspective game I've been creating an adventure game using 45 degree angled tiles to create a 3D illusion- aka oblique style.

Using 45-degree angles...

I can create pretty much any size or shape building I want:

I found I can easily get another perspective if I simply flip the tiles horizontally:

While doing this gains an oblique perspective from the other way, it does change the vanishing point to be in the center of the map, versus towards the top left.

Is this style of mixing perspectives common? Does it ruin the perspective or add to it? I thought that just maintaining the point of origin at the top left the whole time would be monotonous.

To be clear, I wouldn't keep the two styles together. It'd be either like the buildings on the river or the buildings in the northwest.

Thanks

Edit: More of a full shot:

sentences:
Cumulative transformation matrices for hierarchical object transformations I'm having a small issue with my design for hierarchical 3D objects. I'll try to sum things up concisely. Every object has a vector3 for its position, scale, and rotation, as well as a std::vector of children objects. An object's render function takes an optional parameter for a parent's transformation matrix, which defaults to the identity matrix. In this render function, the object's transformation matrix is computed with this form:

transformation = parentTransformation * translationMatrix * rotationMatrix * scaleMatrix;

After the matrix is computed, all of the childrens' render functions are called with the computed matrix being passed, then the actual render for THIS object happens.

My problem seems to be with the scaling bit. For this case, I have a wooden manikin built out of several spheres, all translated and scaled to give shape. For the legs and arms, I scaled the sphere pieces obviously not uniformly. To avoid the children objects of those body parts from also being scaled like that, I scale them by the inverse of that scale factor after scaling the particular body part. However, when I rotate a joint which is a child of one of these oddly scaled pieces, you can see how the scaling is really only in the childrens' "model space" and as a result, they get strangely contorted. Is there a misunderstanding on my part about how objects should inherit their parents' transformations?

Here are some images to demonstrate my results. The second image is after rotating the knee joint 80 degrees.

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:
Disconnecting Power Flow from Source I'm trying to design a wiring system that allows players to connect power sources to switches via wires. Think redstone in Minecraft. When a wire is placed, if it is not initially connected to the power source, it has no power (behaving as expected). The PROBLEM occurs when the wire is connected to power, detecting that it is powered, and then disconnects from power. After it has touched the power source, it then becomes it's own source if disconnected, which is not what it should be doing.

This is what SHOULD be happening

Here's what is ACTUALLY happening

And here is my code:

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

 public class Wire_Moveable : MonoBehaviour {

 public static Wire_Moveable control;

 public bool IsBlue;
 public bool IsRed;
 public bool powered;

 void Start () {
     IsBlue = false;
     IsRed = false;
 }

 void Update () {
 if (Input.GetMouseButtonUp (0)) {
         following = false;
         this.gameObject.GetComponent<Wire_Moveable>().SnapWire ();
     }
 }

 void OnTriggerStay2D (Collider2D trigger) {
     if (trigger.tag == "wire") {
         if (trigger.gameObject.GetComponent<Wire_Moveable>().powered) {
             powered = true;
         }

         if (trigger.gameObject.GetComponent<Wire_Moveable> ().IsBlue) {
             IsBlue = true;
             IsRed = false;
         } else if (trigger.gameObject.GetComponent<Wire_Moveable> ().IsRed){
             IsBlue = false;
             IsRed = true;
         }
     }
 }

 void OnTriggerExit2D (Collider2D trigger) {
     if (trigger.tag == "startnode_blue") {
         IsBlue = false;
         powered = false;
     }

     if (trigger.tag == "wire") {
         if (trigger.gameObject.GetComponent<wire_Moveable>().powered) {
             powered = false;
         }
     }
 }

 void SnapWire () {
     if (this.gameObject.name == "Wire_Basic" || this.gameObject.name == "Wire_Basic(Clone)") {
         StartCoroutine ("ActivatePower", 0);
     }
 }

 IEnumerator ActivatePower () {
     yield return new WaitForSeconds (0.1f);
     if (powered) {
         PowerBeam.SetActive (true);
     } else if (!powered) {
         PowerBeam.SetActive (false);
     }
 }

sentences:
Engine for 2D Top-Down Physics-Based Skeletal Animation I just watched at the Sui Generis video, and was completely amazed. Specifically, the part where the big troll thing is beating up the player with his flail.

This got me really excited, and I would like to try implementing something like this in a 2D Top-Down format. Something like this.

That atloria example seems simple enough, but it's not exactly what I'm looking to make. I think atloria is using predefined animations, where as I would like to make something more physics-based like the Sui Generis engine does.

So, I'm wondering what physics engines might work for something like this, and if I'd need to implement my own skeletal system, or if I could just use "joints" and such from the engine. The only experience I have in terms of physics engines is Box2D, which I've heard shouldn't be used for top-down settings, and I can think of a few reasons it wouldn't work out well. One of those reasons being gravity. In box 2D, gravity pulls towards a side of the screen (usually the bottom.) I wouldn't want my player's forearms constantly being pulled to one side. :)

Also should mention that the programming language doesn't matter all that much to me. I'm currently playing with HTML5 stuff, though. :)

Thanks in advance!

sentences:
Which is the best LOD method for planet rendering? I'm currently working on my thesis, it is an engine to render terrains of planetary size.

I'm still finishing my research and I have encountered a lot of stuff about this subject, the problem is that I can't decide on which Level of Detail (LOD) method I should use.

I know about geomipmapping, geometry clipmaps (GPU) and chunked LOD by Ulrich that work good on large terrains and can be used to render 6 faces of a cube and then "spherify" the cube by this method and I understand how to implement all of these methods on GPU using C++/OpenGL/GLSL (using methods like ROAM or any other method that doesn't use a cube is out of my reach because of texturing is a pain). Also I recently got into a tutorial of rendering terrains using tessellation shaders here

So, I don't have the time to implement ALL the methods and see which one is the best and more suitable for a planetary scale and I'm asking here to see if someone has made this kind of comparison and help me decide which method should I implement and use (my tutor is kind of crazy and wants me to do something with an icosahedron, but I can't understand that method unless using ROAM)

Anyways, if you can help me decide or have any other suggestion or method I really will appreciate. One condition is that the method should be able to implement GPU side (at least most of it) to prevent CPU bottleneck.

Another request is that I know there are numerical problems about precision with floats when getting a lot of detail in the terrain, I don't know how to solve it, I read a solution in a forum but can't get to understand how to implement, I lost track of that thread and I would like to know how to solve this precision problem.

I'm currently reading about some matrix transformations to solve the float precision, z-fighting issues, frustum culling with dynamic z-values, and data representation for chunks (using patch space with floats and its position in the world coordinates as double) so I think I can solve the precision problem easily. I still need a comparison between LOD methods with your opinions and suggestions to decide which is better for this project. Take in count difficulty of implementation vs visual quality vs performance, I want the best.

Something I forgot to mention is that the generation is hybrid, I mean, I should be able to render the planet entirely using GPU (heights calculated on the fly) and/or using a base height-map image and add details with GPU (vertex shader). Texturing will be a side part I will trouble latter, right now I'm happy using just colors depending on the height, or maybe using some kind of noise texture generated on the fragment shader.

sentences:
Carve river beds into existing 3d procedural generated terrain Ok, I've read many threads around about procedural terrain generation with rivers and roads but they suggest approaches from zero to result.

I'd like to know if exists an algorithm to apply to an existing vertex structure which models it by adding rivers beds like cuts through the slope of a mountain for instance.

This approach should:

not work on heightmaps, since my terrain is not generated with
heightmaps
modify the surface with randomness
according to the heights (river sources should be higher and the flow should descend)
be as realistic as possible (like not too many circular paths)

I have no needs for speedy algorithms. would be enought to have a separated algorithm to modify the surface so that I am not forced to do all the work during the creation of the terrain.

I tagged this question with c# because this project is written in c# using xna4.0 and in the case that someone knows any algorithms in different languages, c# is preferred (ye, this is optimism)

By the way, I'm looking forward to see if someone knows anything that could fit these needs

sentences:
Is this Possible to force gameobjects (coliders etc) to get stretched based on the aspect ratio of the screen? Well with unity3D, I am in big trouble whenever I use sprites. As for textures I compensate for a evener look by Stretching it (Screen.width & Screen.height- that's fine for low end 2D games). Now If I have an Image and based on content of Image (Let's say I want to add BoxCollider for the walls in image). It works, but for only one aspect ratio. As I am making game for Android. I am having bunch of different resolution & Aspect ratios. Is this possible to stretch my coliders or other game objects so that I can Work easily????
please help me. I am in a rush :(

sentences:
How to save a character to be used in all Game States? I am using C# and SFML.

I am having a problem understanding how to save a character in memory, so I can use the character in any game state.

Right now, the character is a class, and the player creates the character in the "Character Creation" GameState. However the actual variable is created in the GamePlayState class (see below).

class Character : IGameObject
{
    public Vector2f SpritePosition { get; set; }
    public Vector2f SpriteScale { get; set; }
    public string Name { get; set; }

However, I need all of the character data to be usable in any/all Game States.

I tried using a static game container (Dictionary, which held GameObjects- the player's character) but ran into some problems where I couldn't build. So I tried a different method to handle it.

I save all of my GameStates in a Dictionary which resides in the primary game loop.

stateSystem.AddState("Gameplay", new GameplayState(stateSystem));

I can call any specific GameState, but it acts as though the character (if created in Gameplay) cannot be access in other game states. The Game States can, however, access any other Game State.

For example, I tried to create the character in Gameplay - GameState

class GamePlayState : IGameObject
{

Character playerCharacter = new Character();

}

And in the class CharacterCreationState, I try to access that Character. It says "IGameObject does not contain a definition for playerCharacter".

Variable = stateSystem["Gameplay"].playerCharacter.variable;

I even created a function in my StateSYstem class which gets gameobjects.

        public IGameObject getGameObject(string stateID)
    {
        return _stateStore[stateID];
    }

This works to get the correct IGameObject, which would be the Gameplay State.

class GamePlayState : IGameObject
{

Character playerCharacter = new Character();

}

But once i have that IGameObject (the GamePlay Game State) I cannot grab the playerCharacter to manipulate it.

Perhaps I am just tired, but I am having a hard time figuring out how to do this without making the Character playerCharacter a global variable, creating in the main game loop.

sentences:
What is going on in this SAT/vector projection code? I'm looking at the example XNA SAT collision code presented here:

http://www.xnadevelopment.com/tutorials/rotatedrectanglecollisions/rotatedrectanglecollisions.shtml

See the following code:

private int GenerateScalar(Vector2 theRectangleCorner, Vector2 theAxis)
{
    //Using the formula for Vector projection. Take the corner being passed in
    //and project it onto the given Axis
    float aNumerator = (theRectangleCorner.X * theAxis.X) + (theRectangleCorner.Y * theAxis.Y);
    float aDenominator = (theAxis.X * theAxis.X) + (theAxis.Y * theAxis.Y);
    float aDivisionResult = aNumerator / aDenominator;
    Vector2 aCornerProjected = new Vector2(aDivisionResult * theAxis.X, aDivisionResult * theAxis.Y);

    //Now that we have our projected Vector, calculate a scalar of that projection
    //that can be used to more easily do comparisons
    float aScalar = (theAxis.X * aCornerProjected.X) + (theAxis.Y * aCornerProjected.Y);
    return (int)aScalar;
}

I think the problems I'm having with this come mostly from translating physics concepts into data structures. For example, earlier in the code there is a calculation of the axes to be used, and these are stored as Vector2, and they are found by subtracting one point from another, however these points are also stored as Vector2s. So are the axes being stored as slopes in a single Vector2?

Next, what exactly does the Vector2 produced by the vector projection code represent? That is, I know it represents the projected vector, but as it pertains to a Vector2, what does this represent? A point on a line?

Finally, what does the scalar at the end actually represent? It's fine to tell me that you're getting a scalar value of the projected vector, but none of the information I can find online seems to tell me about a scalar of a vector as it's used in this context. I don't see angles or magnitudes with these vectors so I'm a little disoriented when it comes to thinking in terms of physics. If this final scalar calculation is just a dot product, how is that directly applicable to SAT from here on? Is this what I use to calculate maximum/minimum values for overlap? I guess I'm just having trouble figuring out exactly what the dot product is representing in this particular context.

Clearly I'm not quite up to date on my elementary physics, but any explanations would be greatly appreciated.

sentences: How to rewind time on just the main character? I have a 2D sidescrolling game and I want the character to be able to rewind time on him if he messes up. I don't want anything else to change, just the main character's position. Any idea how I can do this?

sentences:
How to get faster iteration times in android development I'm creating a game on the android platform that uses the resources/raw folder for assets and scripts. The problem is that every time I change something I have to rebuild the application to test the new variant. Of course this is bad for iteration times.

Any ideas about what I can do to avoid rebuilding every time I change something? This *.apk format is getting on my nerves now that I have to recreate it every time I change a word in my scripts.

Or at least how to make eclipse auto-rebuild every time I change something in my resources folder so that I don't have to go to Project->Build every time?

sentences:
Stretched textures in Blender First of all: I'm relatively new to Blender.

I discovered a weird bug in Blender 2.78c. On my object some textures are stretched although they are UV mapped. Since I have no clue why this is happening I took some screenshots which hopefully explain the problem.

I tried various things, but found no way to solve this. Things I tried:

Unwrap again
Apply Rotation and scale
Manually adjusting verts in UV map
Looking for "dead" verts somewhere in the model

Does anyone know this strange behavior?

Edit: I uploaded my .blend file -> http://pasteall.org/blend/index.php?id=47124 | merged screenshots due to low reputation :P

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:
IsoMetric Map draw: sort with Z-Buffer and anchor point I'm writing an IsoMetric renderer for my html5 isometric game. The isometric renderer should be able to render objects with floating point coordinates.

SOURCE: https://github.com/ilmattodel93/EaselJs-Isometric-with-Heightmaps

As now, the renderer works pretty well, but I have some questions and a problem to fix.
Note that little square is the anchor point, and lines are AABB (not correctly drawn I think).

THE PROBLEM

If you have a look at the demo, you should note that when the dragon is behind the tree on a higher level, it will be rendered over the tree instead of behind, as expected.

As you can see in js/mmo/renderer/IsoEntity.js#L91 and js/mmo/renderer/IsoLayer.js#L65, i have a "rough" implementation, and maybe it is'nt good.
I've googoled around and find something called "topological sort", i've attempted to implement it, but it does'nt seems to solve.

For each tile I have information about minX, minY, minZ, maxX, maxY, maxZ. An AABB as you can notice.

THE QUESTION

My question is, how can I solve this problem? Is it better (and will be faster) to maybe implement a depth-buffer? And how can I implement it? Will it ensure high performance? Maybe will a correct anchor point (represented with little square) solve the problem?

Thanks for any help! :D

sentences:
Structure game database to store player info and items Recently I started developing my tiny html5 multiplayer game made in Node.js, Express.js, MongoDB(Mongoose), Socket.io and using Phaser.js.

I am quite new to these frameworks and especially new to database structuring/management.

My struggle comes when I think about how can I structure the database to store things as player username, password and general preferences (basic user info); and then things as player equipment such as items and currency.

I can figure out how to do the code part but what I do not know how to handle is the process I should follow.

I thought of the structure like so:

//Users Document
{
    "_id": "randId",
    "username": "ArthurConan",
    "password": "aquamarine12345",
    "credits": 20,
    "equipment": [
        {
            "name": "Sword of the Forsaken",
            "equiped": true,
            "slot": "weapon",
            "id": "itemId",
        },
        {
            "name": "Meteor Katana",
            "equiped": false,
            "id": "itemId"
        }
    ]
}

//Items Document
{
    "_id": "itemId",
    "name": "Sword of the Forsaken",
    "atk": 1400,
    "value": 500
},
{
    "_id": "itemId",
    "name": "Meteor Katana",
    "atk": 200,
    "value": 50
}

As I am using MongoDB the structure would be more or less similar to that.

With the code above then I would do the following:
 - Player Registers and his basic info(username, password, ...) is added to the database and he will also get one weapon to start with.
 - Player adventures into my world and gathers credits and equipment. Those items are stored in his inventory.
 - Player can equip/use/sell/destroy/upgrade some of those items. Upgraded items will have its stats upgraded based on preset stats.

As a side-note I would like you to know I am not the best at explaining myself, I hope you understand what I am trying to achieve. Also any suggestions are appreciated, have a good day :)

sentences:
How to tween animated sprites? So I have an animated sprite of 15 frames, needless to say, at 15 frames, it plays jumpy with a low frame rate.

I want to increase that, by somehow tweening or generating intermediates between the authored animation frames.

I found tools that do frame interpolation for video, and I'm wondering whether similar techniques could be applied to sprite sequences.

Do you know any methods I could use to tween my sprites?

sentences:
How do I make a game object appear on the other side when it leaves the screen? I'm doing an assignment for a course and what's required is to include a moving asteroid in the game that starts moving in a random direction and when the asteroid leaves the bottom of the game window it should re-appear at the top of the game window
,so I wrote the script for warping and I applied it to the asteroid and a ship in my game ,then built it to WebGl game. the warping worked fine in the editor for both the ship and the asteroid, while it only worked for the ship in the built game, and I can't figure out what's wrong

this is the script

(ScreenUtils gives the borders of the screen)

float Radius;

void Start () {
    Radius = GetComponent<CircleCollider2D>().radius;
}
void OnBecameInvisible()
{
    // Make the ship wrap
    Vector3 position = transform.position;
    if (position.x - Radius >= ScreenUtils.ScreenRight || position.x + Radius <= ScreenUtils.ScreenLeft)
    {
        position.x *= -1;

    }
    if (position.y -Radius >= ScreenUtils.ScreenTop || position.y + Radius <= ScreenUtils.ScreenBottom)
    {
        position.y *= -1;
    }
    transform.position = position;
}

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:
How to drag 2D objects and stop it if collides with other 2D object? This is the code I am using but it's not working. It drags other object on collision:

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

public class TileControllerHorizontal : MonoBehaviour
{

    private Vector3 screenPoint;
    private Vector3 offset;
    public bool check;

    // Use this for initialization
    void Start ()
    {

    }

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

    }

    void OnMouseDown ()
    {
        screenPoint = Camera.main.WorldToScreenPoint (gameObject.transform.position);

        offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
        transform.name = "draging";

    }

    void OnMouseDrag ()
    {
        if (!check) {
            Vector3 point = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            point.z = gameObject.transform.position.z;
            point.y = gameObject.transform.position.y;
            gameObject.transform.position = point;
        }
    }

    void OnMouseUp ()
    {
        check = false;
        transform.name = "Tile";

    }

    void OnCollisionEnter2D (Collision2D col)
    {
        Debug.Log (col.gameObject.tag);
        if (col.gameObject.tag == "Player" && transform.name == "draging") {
            check = true;
        }
    }
}

sentences:
How can I mod Crusader Kings 2 to prevent vassals from declaring Holy Wars? I would like to have a playthrough where my vassals cannot declare wars.

I have set "vassal_wars_law_2" to all my subordinate kingdoms, and yet, this regularly happens:

I think that to prevent this I have to modify something in the

# Regular Holy War CB
religious = {
    name = CB_NAME_RELIGIOUS
    war_name = WAR_NAME_RELIGIOUS

declaration in the 00_cb_types.txt file.

Unfortunately I am quickly out of my depth and I don't know exactly what to change to disable that Casus Belli type for everyone in my empire except me, the emperor.

Can someone please help me in understanding the necessary steps?

sentences:
Masking A Postprocess Unreal 4.10 I was able to make a full screen blur with the depth of field post process which I want to use for the background both my pause menus and my in game HUD. The issue is that when I want to use it for my in game UI it needs to only be rendered under the HUD and not the entire screen. Is there any way the I can mask the post process to a UMG widget for simplicity?

The other solution that I thought of was to create a material and mask it off in the material. The problem is that PostProcessInput0 already has the blur applied and I can't use the SceneColor any more, so I don't have a way to get the original texture without the blur. Is there any way to do this?

Cheers.

sentences:
Cocos2d-x how to draw in specific free form area Here https://github.com/mikeccy/cocos2dx-finger-paint/blob/master/Classes/HelloWorldScene.h and https://github.com/mikeccy/cocos2dx-finger-paint/blob/master/Classes/HelloWorldScene.cpp you can see how a Sprite is being rendering in RenderTexture. What I want to add to this to make visible only the specific part in RenderTexture (canvas). I.e. I should apply a free form mask on it to be able to draw in a specific free form area.

How to do this in cocos2d-x 3.2?

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:
Unity: Improvements to skinnedMeshRender.BakeMesh performance or alternatives? I'm running to a situation where I need to do some manual deformation to a skinnedMeshRenderer's mesh vertices after applying some blendskinning. I'm finding that the following code takes ~15ms to run. I've calculated the time both by running it 100 times and measuring time difference, and by using the Unity Profiler.

Mesh bakedMesh = new Mesh();
skinnedMeshRenderer.BakeMesh(bakedMesh);

The mesh has ~7000 vertices.

I just need loop through each vertex to get its current (blendskinned) position relative to its gameObject's local origin. The goal is to calculate the amount of deformation it experienced.

so something like (pseudocode):

for i in vertices
    deformation[i] = originalVerticies[i] - bakedCertices[i]

It's the call to BakeMesh that is slowing things down, which is required to get bakedVertices[i].

Is there another way to get backedVerticies[i] without actually baking the mesh? Maybe some kind of manual calculation to simulate baking but only on the vertices? or perhaps some way to speed up the baking process?

Additional info:

The reason i'm calculating the deformation is to undo unity's automatic linear blend skinning, since at runtime I want to move some bones without affecting the mesh. However, when I move the bones, unity's automatic linear blend skinning kicks in and deforms the mesh, so this is a way to calculate how much it was deformed so I can "Undo" this blend skinnning by adding the deformation back on to the vertices. Perhaps there is a more elegant solution, but I can't find any way to temporarily turn off the automatic linear blend skinning. Note that I need to do this every single frame.

I'm currently at 15ms for this script, which is really pushing the 16ms limit to maintain 60fps. When I add other scripts etc into the scene it will for sure be laggy. I would also like it to run at at least 90fps since i hope to use this script in VR in the future.

sentences:
XNA 4.0 How to combine triangles vertices 3D Preview for the problem:

I'm making a similar game to Minecraft (a game that it's world is made by cubes), but the fps of the game is getting low only by rendering a little amount of cubes in the world.

So I decided to use the Combine/Margin technique to improve it. I want to combine cubes that are from the same type and there positions are next to each other.

Lets say I have 4 faces of cubes that are next to each other in that order:

[+] [+]

[+] [+]

Right Now: I am rendering each face with 2 triangles so in total I render all of the faces with 8 triangles.

Improvment That I Want To Make: I want to render these faces with only 2 triangles but to keep the textures where they are at. Which means to use only 2 tringles for 4 faces and to use 4 textures in that area.

OUT OF THE TOPIC:

Currently I'm using:

Frustum culling.
Not rendering cube faces that are on each other.

Which fps improvment techniques do you recommend me to use?
Currently when I'm rendering only 1500 faces at the same time [3000 triangles] my game is getting to about 25~ fps.

sentences:
How can I draw a line of certain length and direction? I want to create a line of certain length and direction.

What I mean by this is drawing a line from Point A to Point B.
Normally in Unity C# to draw a line from Point A to Point B is simply:

Debug.DrawLine(point_A, point_B);

The diagram would be something like this

A----------------B

But I dont want something like this, I want it to draw from Point A to Point B but with a certain length. So I am guessing I need the direction for this to work. But I don't know how to code it.

Here is a basic diagram of how i want it.

A--------        B

sentences:
Drag and drop card game--NullReference Exception despite object existing? I am trying to build a Hearthstone-style online TCG. Right now I am just working on getting the cards to drag around on the screen. Since I'm new to Unity, I'm using this tutorial https://www.youtube.com/watch?v=AM7wBz9azyU&index=3&list=PLbghT7MmckI42Gkp2cILkO2nRxK2M4NLo

I've copied the code in the tutorial pretty much exactly. What I have looks like this:

public class dragable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler {

   public Transform parentToReturnTo = null;

   GameObject placeholder = null;

   public void OnBeginDrag(PointerEventData eventData)
   {
       Debug.Log("OnBeginDrag");

       placeholder = new GameObject();
       placeholder.transform.SetParent(this.transform.parent);

       LayoutElement le = placeholder.AddComponent<LayoutElement>();
       if (le) {
           Debug.Log("Found it!"); //Found le here...
       }
       else
       {
           Debug.Log("No dice.");
       }
       le.preferredWidth = this.GetComponent<LayoutElement>().preferredWidth; //can't find le--why?
       le.preferredHeight = this.GetComponent<LayoutElement>().preferredHeight;
       le.flexibleHeight = 0;
       le.flexibleWidth = 0;

       parentToReturnTo = this.transform.parent;
       this.transform.SetParent(this.transform.parent.parent);

       GetComponent<CanvasGroup>().blocksRaycasts = false;
   }

The rest of the class doesn't seem to effect the problem I'm having. That problem being: whenever I try to write to the LayoutElement le, the console returns a NullReferenceException error. But when I try to read le--for instance, testing if it exists in the if (le) loop (which exists only for debugging this particular issue), it works fine. Also, if you watch the tutorial video, you'll see that there is a "tabletop" on the upper half of the canvas that you can drop cards on to--this doesn't seem to work unless I comment out all code that tries to write to le's attributes. Anyone know how to fix this?

sentences:
Stop player following cameras cameras direction Okay I'm not going to go to much into it but this is what I need my script to do. The way I have my controller set up is that the camera looks to the side of the player a little bit. I use this for aiming attacks, bullets and what not. The problem is that it follow the camera when it looks up causing my character to slightly jump ever time I aim and look up. So i want the player to move with the camera while ignoring its y axis. and i need my character to jump so i cant just make the players y movement = 0.

Here's the code I've been using:

transform.position += Time.deltaTime * cameraMain.forward * Input.GetAxis("Vertical") * speedWilAim;

and I am trying to avoid separating the mouse look script into x and y pivots but if there is no alternative I will do that.

sentences: Multithreading for a mixed-genre game in Python? So here's the situation.  I'm making a game that mixes two genres; arcade shooter and puzzler.  They don't intertwine TOO much; all the interaction that really goes on is that every time an enemy is destroyed, a block is created.   The blocks aren't even a part of the main collision detection system; they have their own more suited to their needs.  What I want to ask is this; might it be a good idea to have the arcade shooter portion run on one thread, and the puzzle game portion run on another?

sentences:
What is a good alternative to Unified Shader for Shadows? Most shadow systems I have seen use a unified shader system for shadowing techniques, resulting in an uber shader for the projects.

What alternatives do you find work well or is the unified shader the best approach?

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 to move the camera behind a model with the same angle? in XNA I'm having difficulty moving my camera behind an object in a 3D world. I'd like to have two view modes:

for fps (first person).
external view behind the character (third person).

I've searched the net for examples but they don't work in my project.

Here is my code used to change the view when F2 is pressed:

 //Camera
        double X1 = this.camera.PositionX;
        double X2 = this.player.Position.X;
        double Z1 = this.camera.PositionZ;
        double Z2 = this.player.Position.Z;

        //Verify that the user must not let the press F2
        if (!this.camera.IsF2TurnedInBoucle)
        {
            // If the view mode is the second person
            if (this.camera.ViewCamera_type == CameraSimples.ChangeView.SecondPerson)
            {
                this.camera.ViewCamera_type = CameraSimples.ChangeView.firstPerson;

                //Calcul position - ?? Here my problem
                double direction = Math.Atan2(X2 - X1, Z2 - Z1) * 180.0 / 3.14159265;
                //Calcul angle - ?? Here my problem

                this.camera.position = ..
                this.camera.rotation = ..

                this.camera.MouseRadian_LeftrightRot = (float)direction;
            }
            //IF mode view is first person
            else
            {
                    //....

sentences:
Create a continuous flight path on a Bezier Curve in Unity3d I am working on a game in which a butterfly is flying along some path.

What I am trying to do currently is create a Bezier curve starting from the butterfly's position(previous curves end point) and the rest of the points random for it to fly on. Once it has finished on the curve it needs to continue its path along the next curve that is generated. The problem I have is that the next curve sometimes starts in a direction that makes the transition look rugged and unrealistic. This is the code I have so far.

void updateDirection()
{
    if (!LeanTween.isTweening(this.gameObject))
    {
        Vector3 curveA = { transform.position, new Vector3(Random.Range(-5f, 0), 0, Random.Range(-3f, 0)), new Vector3(Random.Range(-5f, 0), 0, Random.Range(-3f, 0)), new Vector3(Random.Range(-5f, 0), 0, Random.Range(-3f, 0)) };
        LeanTween.move(this.gameObject, curveA, 3f);
    }
}

I am using the LeanTween API to create the movement method easier.

So basically I need to find a way to make a continuous bezier I guess and I am no mathematician so if it could be explained in easy to understand terms that would be amazing!

sentences:
Instancing with the SharpDX toolkit I am starting on the graphical portion of my project and before I begin I need to get Instancing working.  I can do instancing with SharpDX, but not with the Toolkit Models. The main reason I want to use the Tookkit is for loading models, textures, fonts, etc...

The most helpful thing for me would be a link to an example that instances a SharpDX.Toolkit.Graphics.Model -- but anything the shows the Model working with a custom effect should be fine... I can make instancing work from there right?

I have searched and searched for that though so I am not too hopeful - so if this is not something easily done alternative solutions would be great. As I said, I can use SharpDX without the toolkit just fine - but I want the benefits that come with loading models and fonts mostly.

sentences: How does Navigation Mesh path-finding work? I want to understand how navmeshes work, how to implement them and why it is better than other types of pathing systems.

sentences:
problems getting a new position vector3 could someone explain to me why i can't get a new position that is outside the update method.

if i set what's inside the void callposic to a Start I can't get any position, only if it's inside the update

what can you do, because I don't want to use them in the update board.

https://www.youtube.com/watch?v=aNzJ5GUYAOA&feature=youtu.be

public int index;
public Vector3[] posic;
void Start()
{
    prev.onClick.AddListener(() => void1(-1));
    next.onClick.AddListener(() => void1(1));
    index = 0;

}

void Update()
{
    callposic();
}

void callposic()
{
    transform.localPosition = posic[index];
}

void void1(int value) { index = index + value; }

}

sentences:
Gesture Detector not firing So I'm trying to create a input class that implements a InputHandler & GestureListener in order to support both Android & Desktop. The problem is that not all the methods are being called properly.

Here is the input class definition & a couple of the methods:

public class InputHandler implements GestureListener, InputProcessor{
...
public InputHandler(OrthographicCamera camera, Map m, Player play, Vector2 maxPos) {
...
@Override
public boolean zoom(float originalDistance, float currentDistance) {
    //this.zoom = true;
    this.zoomRatio = originalDistance / currentDistance;
    cam.zoom = cam.zoom * zoomRatio;
    Gdx.app.log("GestureDetector", "Zoom - ratio: " + zoomRatio);
    return true;
}

@Override
public boolean touchDown(int x, int y, int pointerNum, int button) {
    booleanConditions[TOUCH_EVENT] = true;
    this.inputButton = button;
    this.inputFingerNum = pointerNum;
    this.lastTouchEventLoc.set(x,y);
    this.currentCursorPos.set(x,y);

    if(pointerNum == 1) {
        //this.fingerOne = true;
        this.fOnePosition.set(x, y);
    }
    else if(pointerNum == 2) {
        //this.fingerTwo = true;
        this.fTwoPosition.set(x,y);
    }

    Gdx.app.log("GestureDetector", "touch down at " + x + ", " + y + ", pointer: " + pointerNum);
    return true;
}

The touchDown event always occurs but I can never trigger Zoom (or pan among others...). The following is where I register and create the input handler in the "Game Screen".

public class GameScreen implements Screen {
...
   this.inputHandler = new InputHandler(this.cam, this.map, this.player, this.map.maxCamPos);
   Gdx.input.setInputProcessor(this.inputHandler);

Anyone have any ideas why zoom, pan, etc... are not triggering?

Thanks!

sentences:
Rendering multiline text with SDL_TTF Can you use any function to render more than a line of text in a surface?

If you can't do this, what whould be the way to go?
I am doing the following: Create a surface (not sure if should be a software or a hardware one) and then create as many surfaces as lines my text have, then blitting all the surfaces, and freeing all the surfaces. But this turns to be very slow. This is the code:

void Text::updateSurface() {
    if (surface != NULL) {
        SDL_FreeSurface(surface);
    }

    TTF_Font * font = TTF_OpenFont(fontPath.c_str(),size);
    if (font == NULL) {
        ERROR("Null font"<<TTF_GetError());
    }

    int maxWidth = 0;
    int totalHeight = 0;

    std::vector<SDL_Surface *> surfaces;
    for (size_t i=0; i<lines.size(); i++) {
        SDL_Surface * partialSurface = TTF_RenderText_Solid(font, lines[i].c_str(), color);
        if (partialSurface == NULL) {
            ERROR("surface == NULL: "<<TTF_GetError());
        }
        surfaces.push_back(partialSurface);
        totalHeight += partialSurface->h;
        maxWidth = std::max(maxWidth, partialSurface->w);
    }

    TTF_CloseFont(font);

    surface = SDL::allocateSurface(maxWidth,totalHeight);
    if (backgroundColor != NULL) {
        SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format,backgroundColor->r, backgroundColor->g, backgroundColor->b));
    }
    totalHeight = 0;
    for (size_t i = 0; i < surfaces.size(); i++) {
        SDL_Rect dst = {0, totalHeight, 0, 0};
        switch(aligment) {
        case ALIGMENT_RIGHT:
            dst.x = maxWidth - surfaces[i]->w;
            break;
        case ALIGMENT_CENTER:
            dst.x = (maxWidth - surfaces[i]->w) / 2;
            break;
        case ALIGMENT_LEFT:
        default:
            break;
        }
        totalHeight += surfaces[i]->h;
        SDL_BlitSurface(surfaces[i],NULL,surface,&dst);
        SDL_FreeSurface(surfaces[i]);
    }
}

This is the code for SDL::allocateSurface(...)

static SDL_Surface * allocateSurface(int width, int height, int bpp = -1, Uint32 flags = 0)

SDL_Surface * SDL::allocateSurface(int width, int height, int bpp, Uint32 flags) {
    if (bpp == -1) {
        bpp = SDL::bpp; //SDL_GetVideoInfo()->vfmt->BitsPerPixel;
    }

    if (flags == 0) {
        flags = SDL_HWSURFACE;
    }

    Uint32 rmask, gmask, bmask, amask;

    #if SDL_BYTEORDER == SDL_BIG_ENDIAN
        rmask = 0xff000000;
        gmask = 0x00ff0000;
        bmask = 0x0000ff00;
        amask = 0x000000ff;
    #else
        rmask = 0x000000ff;
        gmask = 0x0000ff00;
        bmask = 0x00ff0000;
        amask = 0xff000000;
    #endif

    return SDL_CreateRGBSurface(flags, width, height, bpp, rmask, gmask, bmask, amask);
}

sentences:
Pathfinding to find the route to nearest resource in 2D grid The setting is a game in a 2D gridlike labyrinth/maze. I'm looking at pathfinding algorithms such as A* and Dijkstra.
I can't figure out how to have my game characters find the nearest resources. All the info I found regarding pathfinding deal with reaching a goal node. However, there are many potential goals so how do I find the path to the nearest resource? At first I thought running pathfinding for each potential goal, but that seems too time consuming (for 4-5 characters with 50 resource nodes). The characters are all competing for the resources so getting there fast is priority.

I understand that Dijkstra solves the distances to all nodes in the grid- so I think the solution lies there, but still the examples I found still require a goal node. So I'm confused how to distill paths from the node calculation.

Can someone explain how to handle pathfinding where finding the nearest goalnode is part of the problem?

Edit:

The solution I ended up using is this:
As mentioned by ali ahmadi in the comments below, it proved quick enough to do a distance search on the potential goals and then do a A* pathfinding to that goal.

It does not answer the question exactly, but the AI players mimic the human player behaviour close enough which is fine for my game.
I might get back to this when I need the AI to be more brutal...

sentences:
How to move 2D objects based on mouse movement with pointer locking? I'm using pointer locking for a 2D game (where you perform calculations based on the delta in mouse positions from frame to frame). I'm having some basic math/logic issues with accomplishing what I want.

I'd like the player to be able to send the character in the direction they last moved their mouse (so if they stop moving the mouse, the character continues to travel in the direction they last moved in).

The issue I'm experiencing is the movementx and movementy values are integers. If the player moves the mouse quickly so that from one mousemove event to the next many pixels are traversed, the direction to move the character is reasonably precise. Every other scenario results in the last movement having movementx or movementy only being -1/0/+1. If the character only moves based on the last movement of the mouse, it very often only moves in one of 8 directions.

How can I be more precise than 8 directions even on slow/short mouse movements while ensuring the last bit of movement of the mouse is always what's being used?

My first thought was to average out the last n movement values, but that can easily result in the character not always moving in the direction the mouse moved last. I've not really had too many other thoughts though, so I came here for assistance.

sentences:
Making an RTS game- how to handle player-created units interacting with each other I'm making an RTS game in Unity with C#. However, the interaction I'm going to have with player-created units interacting with other player-created units is what has me stumped. The player and his opponent can purchase units when they have the resources, and it instantiates them in the game. The main thing is checking whether an opponent's unit is within range to attack. Obviously, you can't have every unit asking every other unit what its position is, or it would get exponentially more CPU-consuming the more units are built, right? I'm trying to figure out how I'm going to go about this.

I figured I could have every unit report its position to a sort of master 'tracker', and then every unit could ask the tracker if any opponents' units have a position within X of their own. How I would actually implement this in Unity, though, I'm not sure about.

Moreover, I'm trying to get my head around Instantiated objects. If every unit is telling its position to the master 'tracker', what does it call itself? And let's say a unit asks the tracker if an enemy is in range and one is, what does the tracker tell it so it can locate the right GameObject and attack it? Sorry if I'm talking about it all wrong, I'm sure there's a simple methodology that exists on how to do it, but I can't think of any. Thank you.

sentences:
Technique to have screen independent grid based puzzle with sprite animation let's say I have a fixed size grid puzzle game (8 x 10). I will be using sprites animation, when the "pieces" in the puzzle is moving from one grid to another grid.

I was wondering, what is the technique to have this game being implemented as screen resolution independent. Here is what I plan to do.

1) The data structure coordinate will be represented using double, with 1.0 as max value.

// Puzzle grid of 8 x 10
Environment {
    double width = 0.8;
    double height = 1.0;
}

// Location of Sprite at coordinate (1, 1)
Sprite {
    double posX = 0.1;
    double posY = 0.1;
    double width = 0.1;
    double height = 0.1;
}

// scale = PYSICAL_SCREEN_SIZE
drawBitmap (
    sprite_image,
    sprite_image_rect,
    new Rect(sprite.posX * Scale, sprite.posY * Scale, (sprite.posX + sprite.width) * Scale, (sprite.posY + sprite.Height) * Scale),
    paint
);

2) A large size sprite image will be used (128x128). As sprite image shall look fine if we scale from large size down to small size, but not vice versa.

Besides the above mentioned technique, is there any other consideration I had missed out?

sentences:
Unity movie texture behaviour when hidden I have a UI with a button and a panel. Clicking the button toggles the panel on and off :

GameObject.SetActive();

Now the panel element has a child which is a plane. This plane has the following components :

mesh renderer
videoPlay, a script I've written
an audio source

The videoPlay script basically applies the MovieTexture to the plane's material, sets the plane's audioSource to the movie's audio clip, and starts audio and video.

public MovieTexture movie;

void Start() {
    GetComponent<Renderer>().material.mainTexture = movie as MovieTexture;
    GetComponent<AudioSource>().clip = movie.audioClip;
    movie.Play();
    GetComponent<AudioSource>().Play();
}

Now when at runtime I click the button (which hides the panel which is the plane's parent element), the audio and video stop as the plane disappears - which is expected behaviour.

When I reopen the panel though, the sound restarts right away but as if it were catching up for the time it was hidden (so it starts really fast and then comes back to regular speed) ; and the video is just frozen for - empirically and approximately - the same time the panel was hidden.

I've tried in the script - in Update() - messing with

if (!transform.parent.gameObject.activeSelf && movie.isPlaying)
    {
        movie.Pause();
        GetComponent<AudioSource>().Pause();
    }

for example, (and the same with Play() when it shows back up) but it doesn't seem to change anything.

sentences:
Parent variable inheritance methods Unity3D/C# I'm creating a system where there is a base "Hero" class and each hero inherits from that with their own stats and abilities. What I'm wondering is, how could I call a variable from one of the child scripts in the parent script (something like maxMP = MP) or call a function in a parent class that is specified in each child class (in the parent update is alarms() in the child classes alarms() is specified to do something.)

Is this possible at all? Or not?

Thanks.

sentences:
How would I check the range against the entirety of an enemy object, and not just it's transform.position? I want to be able to do range checks against the entirety of an enemy object, and not just it's transform.position. The enemy object can have it's side or nose within range, but range detection will not determine if it's close enough to be targeted unless it's transform.position is within range.

Right now I run a quick check against all nearby units to determine their distance from a turret on the friendly unit.

I was thinking raycasts, but I imagine raycasts every frame for up to 10 detected enemies per unit (Each unit will at max hold onto references of 10 nearby enemies. I could have 100 friendly units within range of 100 enemies) would chew up a fair bit more CPU than just checking their cached transforms.

Suggestions, ideas, or comments?

Edit: More Detail

Currently a Unit has a trigger spherical collider that defines it's view range. Any enemy unit within this view range is added to a collection based on priority, with a maximum of 10 objects referenced per collection (each Unit can only be aware of 10 enemy objects). From there, each turret on ship checks the distance from itself to each of the enemies within that collection. When the distance is <= it's attack range, it will fire upon whichever enemy object gets within it's attack range first.

I used to use spherical colliders for each turret, which of course would detect the enemy as soon as any part of the enemy entered the trigger collider. The issue was the massive performance loss due to OnTriggerStay() begin called by hundreds of units, tens of thousands of times per frame when I have no need for the method. So I discarded the extra trigger colliders for a more performance friendly approach.

The issue is that the range check is that is checks the transform.position of the enemy. This does not take into account the collider that makes up the enemies shape, and will only trigger when the center of the object enters within range.

sentences:
LibGDX strange camera behaviour I'm currently doing my final assessment for my study Game Development. I'm currently facing a real weird (maybe explainable) result from my camera.

I just set up my scene with alot of tiles and a character. When I set up the camera's position and direction, I experience something strange. The camera is tilted somewhat, and I can't explain why that is happening.

This is looking pretty good. Except for when I move the camera, the tilting is becoming worse.

Is this behaviour I should expect from the camera?
I made sure the camera is never rotated, is there any possibility the models are slightly rotated?
I use LibGDX with exported FBX files from 3Ds Max, converted to LibGDX's format "G3DB", are there any known issues with that?

sentences:
game maker place_meeting multiple objects I am working on a simple game that contains two objects the player and the ground, and I used place_meeting to make the player walk on the ground object and it works fine but when I try to add another object to make the player walk on it, it didn't work and the game freeze, here is my code:

// vertical collision
if place_meeting(x,y+vsp,ground1) or place_meeting(x,y+vsp,ground2)
{
while ((!place_meeting(x,y+sign(vsp),ground1 )) or (!place_meeting(x,y+sign(vsp),oground1=2 )))

 y+=sign(vsp);

    if (sign(vsp) ==1)
    {
    grounded = 1;
    }

    vsp =0;

 }
else
{
grounded = 0;
}
y+= vsp;

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:
FindObjectsOfType returns null array I am making the game in this tutorial: https://www.youtube.com/watch?v=OR0e-1UBEOU

and at 2:53:23 he is coding a LevelController script. I noticed that mine wasn't working the way his was and so I went to try and debug the error. I found that the error was in the function FindObjectsOfType(); You can find my code below.

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

public class LevelController : MonoBehaviour
{
    private Enemy[] _enemies;

    private void onEnable()
    {
      _enemies = FindObjectsOfType<Enemy>();
    }

    // Update is called once per frame
    void Update()
    {
      Debug.Log(_enemies);
    }
}

When I run this my debug log returns null values which is confusing because I have 3 objects (Monster, Monster (1) and Monster (2)) which have the Enemy script assigned to them.

What could be going wrong?

sentences:
How can I represent collection of distant but visit-able stars while using minimal resources? I have recently started to plan a project in Unity that will be for Android. I have a database that consists of over 150,000 stars (may trim this down if I/O cripples the overhead). The game will hopefully consist of a free-to-explore universe creating the illusion that the user is flying in a realistic representation of the stars.

My biggest concern at the moment is how do I create a realistic environment with these starts, while keeping the resource impact on the phone to a minimum? Some people mentioned using octrees, would this be wise?

This is my first game that I am looking to create so any help would be much appreciated to this novice!

sentences:
Unity difference between accessing asset prefab from reference VS from Resources.Load? Question point

Does putting prefab asset in inspector's reference and access its content inside in runtime VS. Load the same prefab asset from Resources.Load API, will both cause entire prefab to load and use same memory footprint?

Backgroud

In UNET or it's replacement lib, Mirror, you will have to register list of prefab on NetworkManager to spawn on server and clients.

Under the hood, these prefab references will be sent to registration function ClientScene.RegisterPrefab which in turn access them as far as
prefab.GetComponentsInChildren<NetworkIdentity>();
(I suspect that this will make entire prefab loaded?)

VS

I put those prefab in Resource folder, then use API like Resources.Load / LoadAll to send them to ClientScene.RegisterPrefab (which proved to work too) But many fellow dev warned me about how evil Resources API is and using these will load all data into memory, etc.

Didn't this 2 way ultimately need to access inside of prefab and both need to load entire prefab in? Is there clear advantage for memory footprint for approach?

Some prior research

In official document about resource management, there is some explanation about how resource will load but it still does not clear up difference between these 2 appraoches.

  2.7. Resource lifecycle

  To reduce loading times and manage an application's memory footprint, it's important to understand the
  resource lifecycle of UnityEngine.Objects. Objects are loaded into/unloaded from memory at specific and defined times. An Object is loaded automatically when:

  The Instance ID mapped to that Object is dereferenced
  ...

Foot note/ Some clarification

Why do you need to use Resources.Load?

Take UNET example case here in my question, and notice that it needs to know every prefab that will be use in game, that's including monsters, items, bullet. Sure you can drag and drop these to inspector (like in screenshot) but will become tedious and unorganized very fast on magnitude of 50+ prefabs. So instead I organize them to Resources folder like

Assets/Resources/EnemyPrefab/Stage1/*.*
Assets/Resources/EnemyPrefab/Stage2/*.*
Assets/Resources/ItemPrefab/*.*

To get more organized load pattern. Resources.LoadAll<GameObject>("EnemyPrefab/Stage1") will do as it suggest. And skipping tedious inspector drag and drop work, let alone checking what did I missed to drag and drop.

Can't you just profile it yourself? why asking here?

I could, but if someone already done this work or has knowledge to confirm such behavior, this could be better, thus this question here. And hey, didn't this is how knowledge is shared and this site is for?

sentences:
Smooth input handling in Java I am writing a Java game.

My problem is to get a really smooth input. If I hit the key W the character has to go forwards, but if I hit A and release the W key, the character doesn't go left ways :( .

It isn't smooth. Which ways are given in common game developing for a smooth input?

My current source code
(Input.java): http://pastebin.com/9Z9qtXik
(MainLoop.handlingInputs): http://pastebin.com/Vx8BzSpL

sentences:
Why even use coroutines in Unity? I have been thinking about the use of Unity's coroutines recently, and while I've used them in the past, and am already aware of their bad reputation (although I've also seen posts on the unity forums of people who seem to absolutely swear by them), the more I think about it, I'm kind of struggling to see any compelling reasons to use them at all instead of simply creating a new component and simply performing the logic of the coroutine in said new component's Update method. By using a IEnumerator coroutine inside of another component, it seems to me like all it accomplishes is decreasing the cohesiveness of individual components and the re-usability of the component using them.

Is there any convincing argument to actually use coroutines in Unity and would I be missing out by simply not using them? Are there any scenarios I'm overlooking where their use would either be required or prove incredibly useful?

sentences:
Unit collision avoidance for RTS I'm developing an RTS, and having a little difficulty with collision detection.  From what I understand RTS generally don't bother with collision detection and just try to avoid collision, and that is what I am trying to accomplish.

My game uses a grid for static obstacles, but units are not bound to the grid for movement.  How do I allow for units to avoid collisions, both with static obstacles and with other units?  Right now my workaround is to redirect units around static obstacles every time they move from point to point (and every time a new obstruction is placed on map, units replan their routes).  This doesn't seem like an ideal solution, but it works.  I have no idea how to handle unit-unit collisions.

sentences:
Rotate object around a dynamic object I'm trying to rotate an object (shield) around another object (player) like this question.

My use-case is this: I have players moving around a field. Their respective shield is orbiting in a constant velocity around them. If a "ball"-object (red) touches a player, he's dead. A player can use his shield to deflect a "ball". When a shield collides with the "ball", I want the player and shield be affected by the collision; thus the player should bounce back, keeping the shield at the same distance. Alternatively, on colliding with the "ball" the shield could act like a static object, either way would be okay with me.

I tried connecting the player to the shield via a b2DistanceJoint and

applying a force to the shield (orthogonal to the line between center of player and center of shield i.e. if the shield is right of the player, the force acts downwards; if the shield is below the player, the force acts to the left). This made the shield rotate, but the player's position was affected by the rotation, which resulted in wobbling. Then, I tried changing the density of the shield to turn down the effect on the player, but then the collision with the "ball" was faulty as the ball had way more mass.
"teleporting" the shield to the right position, but the collision with the "ball" was faulty afterwards (the ball "stuck" to the shield)

I know my whole setup is not a realistic physics model, so is there a way to achieve this behaviour in Box2D?

b2Body* body;
{
    b2BodyDef bodyDef;
    bodyDef.type = b2_dynamicBody;
    bodyDef.position.Set(gameToWorld * x, gameToWorld * y);

    body = world.CreateBody(&bodyDef);

    // Define another box shape for our dynamic body.
    b2CircleShape circle;
    circle.m_p.Set(0, 0);
    circle.m_radius = gameToWorld * bodyRadius;

    // Define the dynamic body fixture.
    b2FixtureDef fixtureDef;
    fixtureDef.shape = &circle;

    // Set the box density to be non-zero, so it will be dynamic.
    fixtureDef.density = 1;

    // Override the default friction.
    fixtureDef.friction = 0.0f;

    fixtureDef.restitution = 1.0f;

    // Add the shape to the body.
    body->CreateFixture(&fixtureDef);
}

b2Body* shield;
{
    b2BodyDef bodyDef;
    bodyDef.type = b2_dynamicBody;
    bodyDef.position.Set(gameToWorld * x, gameToWorld * y);

    shield = world.CreateBody(&bodyDef);

    // Define another box shape for our dynamic body.
    b2PolygonShape rect;
    // HERE:
    rect.SetAsBox(1, 1, b2Vec2(0, 0), 45);

    // Define the dynamic body fixture.
    b2FixtureDef fixtureDef;
    fixtureDef.shape = &rect;

    // Set the box density to be non-zero, so it will be dynamic.
    fixtureDef.density = 1;

    // Override the default friction.
    fixtureDef.friction = 0.0f;

    fixtureDef.restitution = 1.0f;

    // Add the shape to the body.
    shield->CreateFixture(&fixtureDef);
}

{
    b2DistanceJointDef def;
    def.bodyA = body;
    def.bodyB = shield;
    def.length = 0;

    world.CreateJoint(&def);
}

sentences:
How to make a game from the ground up I've been using unity to make 2d indie type games for a while now. However, i've tried to branch into different genres and unity cant do some of the things that i want it to do(although it is still very good).

I really want to make a game from scratch were i have complete control over what happens, although i wouldn't have the slightest clue were to start.

tldr what resources do you need to build a game from the ground floor. or more or less. what resources/software/libraries did most well made indies such as super meat boy, braid or limbo use.

sentences:
Make the player run onto stairs smoothly I have a 2D Platform game, where the player Always runs to the right, but the terrain isn't Always horizontal. Example:

I implemented a bounding-box collision system that just checks for intersections with player box and the other blocks, to stop player from running if you encounter a big block, so that you have to jump, but when I put stairs, I want him to run smoothly just like he is on the horizontal ground. With the collision system you have to jump the stairs in order to pass them!

I thought about generating a line between the edges of the stairs, and imposing the player movement on that line... What do you think? Is there something more clever to do?

sentences:
Gradually reduce speed Basically I am working on following application of android version
Party Games: Drinking Wheel

For this I want to rotate wheel and want to stop wheel at specific point. But I want this with gradually decreasing speed. For example at start I have speed of 10 then at stop time it at 0. So wheel stop smoothly.

At presently I have working code but it stop suddenly.

registerEntityModifier(new RotationModifier(desireTime, 359f,
            desireRotation, new IEntityModifierListener() {

                @Override
                public void onModifierStarted(IModifier<IEntity> pModifier,
                        IEntity pItem) {
                }

                @Override
                public void onModifierFinished(
                        IModifier<IEntity> pModifier, IEntity pItem) {

                    mPointer.stopRotation();
                    showWindowAfterSomeTime(randomSegment);
                }
            }, EaseLinear.getInstance()));

I want some help in this. Thanks for your time.

sentences: 2D Scrollable View with Matrix of Numbers on Android I would like to implement a 2D, scrollable view which can be scrolled horizontally, vertically or even diagonally (similar to a zoomed image which can be scrolled in any direction, but has bounds). In that scroll view, I would like to have matrix of numbers. Which component(s) should I use for this purpose.

sentences:
How can I create a 2D sprite shadow like in "Alto's Odyssey"? I've seen that the game "Alto's Odyssey" has a very nice way of projecting shadows on the ground the player is sliding on:

How could i replicate that?
Would I use some shader magic, or by projecting a 3D mesh/image on the ground plane?

sentences:
2D Screen Coordinates to 2D World Coordinates in LWJGL I'm making a 2d top down game with lwjgl and am having trouble converting my 2d screen coordinates to 2d world coordinates.

Here's what I have so far

 private Vector2f toWorldCoords(Vector4f eyeCoords) {
    Matrix4f invertedView = Matrix4f.invert(MathUtil.createViewMatrix(camera), null);
    Vector4f rayWorld = Matrix4f.transform(invertedView, eyeCoords, null);
    Vector2f mouseRay = new Vector2f(rayWorld.x, rayWorld.y);
    mouseRay.normalise();
    return mouseRay;
}

public Vector2f screenToWorld(Vector2f mouseCoords) {
    Vector2f normalizedCoords = CursorHandler.getNormalisedDeviceCoordinates();
    Vector4f clipCoords = new Vector4f(normalizedCoords.x, normalizedCoords.y, -1.0f, 1.0f);
    Vector2f worldRay = toWorldCoords(clipCoords);

    return worldRay;
}

I understand it's been asked before, and I've tried following some 3d tutorials that deal with the same topic, but so far I haven't been able to use the code successfully.

Thanks

sentences:
Why do I need a local server for HTML5 game development? I'm new to HTML5 game development. I'm trying to make something using Pixi.js, but when I tried to view it in a browser, I saw a blank page. According to the tutorial I'm following, I need to set up a local server. I'm not sure why I'd need to do that, though.

Could you please tell me why I would need a local server to run HTML files on my browser?

sentences:
Unity - Small holes of light seems to go through my blender mesh So, I am currently working on a low-poly terrain in Blender which will be flat-shaded in Unity. It all works great, however I am working on a cave for the terrain, and I seem to be getting these small odd light artifacts:

I have tried to highlight them with the read circles. If you look carefully, you can see the small holes.

The odd thing is, the entire mesh should be completely solid. Here's a screenshot of the cave entrance in blender (which is the floor I'm looking at in Unity)

All normals of the faces seems to be facing correctly, and mesh has simply been modelled by extruding edges from existing parts of the mesh, so there shouldn't actually be any actual holes.

Does anyone have any experince with this kind of problem?

sentences:
What kind of culling does XNA do for me? Which kinds of culling and clipping does XNA do for me as default, and which kinds does it not?

Z-culling? Backface culling? etc.

sentences:
Movement-networking for a Worms-like game I want to implement a strategy/artillery game, similar to Worms/Arcanists.

As game-development (and game-networking especially) is new to me, I was wondering whether this would be a good/performant way to do the movement-networking:

Server has all client's positions.
Moving-client to server:

Message: [start-moving, moving-direction]
Server now starts a simulation of the moving-client moving.
Server to all clients, except originating one, every 100ms(?):

Message: [set-client-position: client-id, new-position]
^ new-position calculated by the server's simulation
Clients lerp the moving-client's position.
Moving-client to server:

Message: [stop-moving]
^ server's simulation ends
Server to all clients, including originating one:

Message: [set-client-position: client-id, final-position]
^ all clients have the same position for the moving-client in the end

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: How can I make units in my board game equal in stats yet unique? I am making a board game, but can't figure out how to make the units overall equal in their stats, with each one being individual?

sentences:
How to identify whether the boundingvolume intersects with walls or floor when it doesnt return normals? My game in jMonkey is the kind that use will have to place objects in a scene (which consist of walls and slabs and floor). All my models are centered at origin. When the user click a point I use ray casting to find the point on the floor where the object will be placed (setLocalTranslation() and shootables.attachChild()).

CollisionResults results = new CollisionResults();
allAttached.collideWith (ray, results);

Now the problem is that when I click too close to an object or wall, the objects run into each other. I will use physics bounding volume to prevent objects running into each other but how to distinguish between horizontal(floor and slabs) and vertical planes (walls) which are part of same scene model.

I'm using code like this to identify collision in objects

private void checkCollision(Spatial model) {
      CollisionResults results = new CollisionResults();
      //BoundingBox box = new BoundingBox();
      //model.setModelBound(new BoundingBox());
      //model.updateModelBound();

      BoundingBox box = (BoundingBox) model.getWorldBound();
      allAttached.collideWith(box, results);

      CollisionResult closest = results.getClosestCollision();
      System.out.println("\n SIMAR \n Geometry = ");
      System.out.println(closest.getGeometry().getName());
      System.out.println("\nContactPoint = " + closest.getContactPoint());
      System.out.println("\nContactNormal = " + closest.getContactNormal());

        }

  }

However the problem is that its not giving me any normals/ etc.
Secondly its give me my geom-mall model scene when I shoot floor/ walls and slabs. Using ray casting I can identify horzontal and vertical surface as it gives getContactNormal but in case of BoundingVolume instead of ray, getContactNormal is just null.

How should I identify whether there is a collision with the wall or not.

sentences:
Determining a sensible gear-like hierarchy for a series of connected objects I would like a series of objects to behave in similar manner to a series of connected gears.

This means that each black object in the diagram below will rotate at a speed based on the ratio of their radius compared to their parent's radius.

The problem is how can I determine a sensible parent child hierarchy algorithmically?

Is there a tried and tested mathematical procedure for such a task?

sentences:
How many polycount for smartphone hardware starting from 2015? I already know that the answer is "depends". Depend if the hardware is low-mid or high hend.
So, I try to re-formulate: is 100K concurrent polycount in a 3d game for smartphone too much ?
How many is it a good compromise ?

Thanks

sentences:
How do I determine the slope of a curve? I am making a 2D game where the character rides on the curve of a graph. I need to find out whether the player is going uphill or downhill and calculate speed accordingly.

The problem is that I am not sure how to determine the slope of the curve on the point that the character is at.

Here is an example of what some of the curves look like:

sentences:
Collision Filtering in Box2D I have four bodies in my Box2D World.  Each are polygon shape, with some physics parameters.

Now when the game start, I need one of the bodies from the World (BodyA) to not be allowed to collide with another (BodyB).  It should be allowed to collide with others.

To clarify, BodyA and BodyB cannot collide with each other, but can collide with rest of the bodies in the Box2D world.

How could make this kind of mechanism in Box2d ?

Please help me about this query.
Thanks & Regards,

sentences:
Another way of writing 2D arrays on Game Maker Studio? I'm making a map in an array, something like this :

mapa[23,26]=4;mapa[25,28]=3;mapa[21,28]=3;mapa[22,30]=3;mapa[24,30]=0;
mapa[22,27]=5;mapa[23,27]=0;mapa[24,27]=0;
mapa[22,28]=1;mapa[23,28]=0;mapa[24,28]=0;
mapa[22,29]=0;mapa[23,29]=0;mapa[24,29]=0;
mapa[23,33]=0; mapa[23,32]=0; mapa[23,31]=0;mapa[23,30]=0;

This is tedious. In other languages 2d arrays can be written like :

int[][] myArray = {  {0, 1, 2, 3},
                     {3, 2, 1, 0},
                     {3, 5, 6, 1},
                     {3, 8, 3, 4}  };

Can I write in Game Maker Studio 2Darrays like this?

sentences:
Combining and drawing 2D lights in OpenGL I have progressed to the lighting portion of my little framework and I managed to solve a few initial problems so now I'm left with the subtle weirdnesses.

At this stage I just have 2 lights - the ambient daylight and a hard-coded example light in my fragment shader (ultimately, I want to have multiple lights that I loop through adding together, and shadows would be nice too, but 1 step at a time!):

        uniform sampler2D u_image;

        varying vec2 v_texCoords;
        varying vec4 v_position;

        uniform vec3 ambient_light; // set as (0.3, 0.3, 0.3), night!

        vec2 point_light_pos = vec2(-0.4, 0.3);
        vec3 point_light_col = vec3(0.999, 0.999, 0.999);
        float point_light_intensity = 0.4;

        void main()
        {
            vec4 frag_color = texture2D(u_image, v_texCoords);
            if(frag_color.a < 1.0)
              discard;

            float distance = distance(point_light_pos, v_position.xy);
            float diffuse = 0.0;

            if (distance <= point_light_intensity)
                diffuse =  1.0 - abs(distance / point_light_intensity);

            gl_FragColor = vec4(min(frag_color.rgb * ((point_light_col * diffuse) + ambient_light), frag_color.rgb), 1.0);
        }

Which almost does what I want, but there are 2 problems:

The light has a bright ring in it and the light is squashed on the y-axis. I actually like how it looks squashed at this ratio, but I'd much rather do it deliberately.

I the y-axis squashing is down to the window aspect ratio - if the window is square, the light is circular, but I don't know how to fix this in the fragment shader.

I don't know where the bright ring is coming from.

sentences: RTS game engine for iOS/iPhone Anyone know any free or non-free RTS engine that can be used for iOS game development?

sentences:
Target Lower API Level than Package or Plug-In Requirements I am working on a project that I want to use local mobile notifications for Android using Unity as game engine. I want to reach as much as users I can, so I want to target API level 16 for the lowest Android API level. As expected, when targeting Android API level 16 for a build, build fails with that error:

  Execution failed for task ':processReleaseManifest'.   Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:androidnotifications-release:] C:\Users\Tumay Varel.gradle\caches\transforms-2\files-2.1\71d39d4badfde5815e850866bcf079c9\AndroidManifest.xml as the library might be using APIs not available in 16
       Suggestion: use a compatible library with a minSdk of at most 16,
           or increase this project's minSdk version to at least 19,
           or use tools:overrideLibrary="com.unity.androidnotifications" to force usage (may lead to runtime failures)

In documentation , it is explicitly saying that the package supports Android 4.4 (API 19) and higher API levels. I can handle this problem by targeting lowest API level 19, however I want to ask: Is there a way to use this package or any other package or any plug-in  for required and higher API levels while not using for lower API levels than requirement at the same project?

sentences:
Comparing angles and working out the difference I want to compare angles and get an idea of the distance between them. For this application, I'm working in degrees, but it would also work for radians and grads. The problem with angles is that they depend on modular arithmetic, i.e. 0-360 degrees.

Say one angle is at 15 degrees and one is at 45. The difference is 30 degrees, and the 45 degree angle is greater than the 15 degree one.

But, this breaks down when you have, say, 345 degrees and 30 degrees. Although they compare properly, the difference between them is 315 degrees instead of the correct 45 degrees.

How can I solve this? I could write algorithmic code:

if(angle1 > angle2) delta_theta = 360 - angle2 - angle1;
else delta_theta = angle2 - angle1;

But I'd prefer a solution that avoids compares/branches, and relies entirely on arithmetic.

sentences:
Mouse look rotation not rotating object axis in Unity So, I made a simple First Person Camera script for my game, and the way it's supposed to work is the camera is rotated by localEulerAngles to rotate the camera around, and then just the Y-axis rotation is also applied to the character, so that he moves in the direction of the camera.

This isn't how its working now.

I've narrowed down the two most likely problems in the scripts, and this first one is from the camera controller:

player.transform.localEulerAngles = new Vector3(0, rotationX, 0);
cam.transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);

Note: the camera works just fine, and rotates perfectly in all directions.

Secondly, the player movement controller, which might not be actually be moving locally? I can't tell.

transform.Translate (new Vector3(0, 0, Input.GetAxis("Vertical") * walkSpeed));
transform.Translate (new Vector3(Input.GetAxis("Horizontal") * strafeSpeed, 0, 0));

There you go. Right now, even though the camera moves just fine with the mouse, and, incidentally, the whole script used to work, the player moves forward on the global Z-axis with W and backwards with S, all the while acting like a shooter on rails.

Thank you!

sentences:
Actual use of sparse voxel octrees in a game engine Looking for different ways to speed up my simple voxel system reducing the number of voxels and generated triangles, I stumbled upon these sparse voxel octrees.
Now, I read a lot about it: how do they work, their implementation, pro and cons especially regarding level of detail (that was my research purpose).
I am not an experienced game developer at all, until now I managed to create a simple yet working procedural generation based on chunks, contoured with Marching Cubes. As many other voxel engines, every chunk is formed by a tridimensional array of voxels, where each one has a density value and a position.
Before I even start trying to implement a Voxel Octree, my questions are:

1) How can I "translate" my world generation in order to use the octrees?

2) Should I use an octree for every chunk, or just one octree with "big" bounds containing the whole generated data?

3) Regarding my project, the aim is to create simple spherical world (fairly big, definitely too much without a LOD), are Voxel Octrees even necessary for my purpose?

Forgive my ignorance, I probably don't have the basic knowledge on these topics, but I still wanted to try this cool stuff.
Thanks!

sentences:
Rectangle collision doesn't work on WP 8 Collision detection is not working correctly when my 64x64 pixel block touches a bigger block. The big(rect2big) block measures 128x128 pixel. The falling block should change it's color to black when it touches another block, but that's not working if it touches the big block. The falling block changes it's color far too late when it touches the big block. You can see that in this video: http://www.vidup.de/v/QFeTK/

What is wrong? Why is collision detection not working correctly when the falling block touches the big block?

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Texture2D rect, rectbig;
    Rectangle rect1, rect2, rect2big;
    bool rectcollision = false;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        TargetElapsedTime = TimeSpan.FromTicks(333333);
        InactiveSleepTime = TimeSpan.FromSeconds(1);
        this.graphics.PreferredBackBufferWidth = 480;
        this.graphics.PreferredBackBufferHeight = 800;
        graphics.IsFullScreen = true;
    }

    protected override void Initialize()
    {
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        rect = Content.Load<Texture2D>("block64");
        rectbig = Content.Load<Texture2D>("block128");
        rect1 = new Rectangle(200, 0, rect.Width, rect.Height);
        rect2 = new Rectangle(200, 200, rect.Width, rect.Height);
        rect2big = new Rectangle(200, 400, rectbig.Width, rectbig.Height);
    }

    protected override void Update(GameTime gameTime)
    {
        rect1 = new Rectangle(rect1.X, (int)(rect1.Y+1.0f), rect.Width, rect.Height);

        if (rect1.Intersects(rect2) || rect1.Intersects(rect2big))
        {
            rectcollision = true;
        }
        else
            rectcollision = false;

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        spriteBatch.Draw(rect, rect2, null, Color.White, 0, new Vector2(rect.Width / 2, rect.Height / 2), SpriteEffects.None, 1);
        spriteBatch.Draw(rectbig, rect2big, null, Color.White, 0, new Vector2(rectbig.Width / 2, rectbig.Height / 2), SpriteEffects.None, 1);
        if (rectcollision == true)
          spriteBatch.Draw(rect, rect1, null, Color.Black, 0, new Vector2(rect.Width / 2, rect.Height / 2), SpriteEffects.None, 1);
        else
            spriteBatch.Draw(rect, rect1, null, Color.White, 0, new Vector2(rect.Width / 2, rect.Height / 2), SpriteEffects.None, 1);
        spriteBatch.End();
        base.Draw(gameTime);
    }
}

sentences:
How can I draw a perspective-correct quad? I'm trying to draw a quad in 2D (in SharpDX, but that is basically XNA). But texture correction is not working, and I'm getting only an affine textured quad.

I'm using BasicEffect to render it.

BasicTextureEffect = new BasicEffect(Device)
{
    Alpha = 1.0f,

    TextureEnabled = true,
    LightingEnabled = false,
    VertexColorEnabled = true,

    Projection = Matrix.OrthoOffCenterLH(0.0f, ScreenWidth, ScreenHeight, 0.0f, 0.0f, 1.0f),
};

It is an 2D isometric game. I have pseudo-3D coordinates in isometric world (it's a shadow on the ground) converted to screen space, and then rendered using DrawQuad.

Do I need to set-up view (or projection?) somehow, to real 3D (emulate the isometric camera), and then draw this quad in 3D coordinates instead? How eventually? Or is there a way to correct this in 2D?

Update:

I've uploaded the actual partial screen-shot (Figure A), for you to see it's almost the same. (I cut it a bit, but it goes all to the corner)

            Figure A                                         Figure B

Update 2:

I can confirm now, that plain SharpDX (XNA) BasicEffect does this with just plain UW mapping (4 corners of a square), and plain DrawQuad. I've temporarily changed it to include center point, and I do draw 4 triangles instead of 2 (Figure B), this reduces effect to minimum, but it's still there. It still needs to be solved, because I won't be using it only on shadow.

sentences:
How to figure out a vector based on 2 points that add up to a certain value I am writing a game in which I am representing a velocity with a vector. I have a starting point and a point that I want the object to move towards at a certain speed. (I need the resulting vector's x and y values to add up to 800). I'm not sure what kind of formula I can use to accomplish this.

SO! I have a starting point. An "ending point". And need a vector whose x and y values add up to 800.

Here is the code I came up with:

dx = size.width / 2 - ball.position.x
dy = 800 - size.height / 2 - ball.position.y
ball.physicsBody?.velocity = CGVectorMake(dx, dy)

Although this appears to work, |dx| + |dy| != 800 and therefore the balls move at slightly different speeds. I'm sure I'm doing this wrong, but I'm not sure how to go about fixing it.

sentences:
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:
How to move an object along a circumference of another object? I am so out of math that it hurts, but for some of you this should be a piece of cake.
I want to move an object around another along its ages or circumference on a simple circular path. At the moment my game algorithm knows how to move and position a sprite just at the edge of an obstacle and now it waits for the next point to move depending on various conditions.

So the mathematical problem here is how to get (aX, aY) and (bX, bY) positions, when I know the Centre (cX, cY), the object position (oX, oY) and the distance required to move (d)

sentences:
Why does this raycast code give me a NullReferenceException? The Error in the code is NullReferenceException: Object reference not set to an instance of an object for if (hitxx.collider.tag == "soldier")
Please help! Thanks in advance

 void Update () {
            Physics.Raycast (eyeenemy.transform.position, (eyeenemyfront.transform.position - eyeenemy.transform.position) * 20,out hitxx);

            Debug.DrawRay (eyeenemy.transform.position, (eyeenemyfront.transform.position - eyeenemy.transform.position) * 20,Color.green);
            if (hitxx.collider.tag == "soldier") {
                gameObject.transform.LookAt (soldier.transform.position);
                Debug.Log ("chuchu");
            }

sentences:
How to avoid players getting lost in and/or bored by the meta game? Yesterday, I noticed something that I had never noticed consciously before, but which had "ruined" more or less all games that I have ever played:

The longer you play a game, the more you get lost in and bored by the meta game. What I mean is that the longer you play, the more you know the meta game. Once you know the meta game by heart, you basically stop playing the game and instead only play the meta game anymore.

Here are a few examples from different genres to show what I mean:

DotA: In the beginning, DotA is super fun, although you totally suck at it. You learn new heros, you are happy when you are able to buy an expensive item and so on. After being "pro" in DotA, you basically only play the meta game anymore: You pick exactly the hero that can counter the enemy and play exactly a perfect meta game for your hero (e.g., go to jungle until you are fat, time creep spawns to stack, and so on). You know basically exactly at which time you will be able to buy which item and you execute this. You no longer play the game, you just play the meta game. You execute a well-thought-out choreography, which you perfected by executing it 100 or more times. Eventually this gets boring!

Anno XXXX:
In the beginning, you build an island and have to master more and more challenges to keep you citizens happy. Cool! Once you know the meta game the whole game becomes a "Oh, I need these 10 resources in these proportions, then the people are happy. I build a fleet and capture the enemy or keep on playing until my island is full".

Cities: Skylines (or any Sim City):
In the beginning, it is fun to master what your people need. In the end, you know exactly what they need, so it becomes more or less a burden: E.g., for each new residential district, I need a police station, a fire station, garbage incineration plant, crematory, a hospital, I connect everything to the highway, add a subway station and add bus lines. Done. Lame. It starts feeling totally mechanic. I no longer feel like building a real city. I feel like building a mathematically simulation of a city and just responding to optimize all parameters for this simulation.

Civilizations:
A super nice game to explore in the beginning! So many technologies, just wow! In the end: I know exactly which technology to develop when. I have a more or less complete ordering among the technologies. I know where exactly to place the next city and which units to build. Heck, I think I could even write an AI that does more than 95% of the things I do, since everything has become so mechanic.

I could go on forever. Almost all games have this. For some players, this is where the game gets really cool. Some players want to play the meta game! But for others, including me, it gets boring. I want to feel like playing a game, like exploring. Not optimizing a numerical simulation.

So, when designing a game, how can you avoid that this will happen? Is it possible to hide the meta game to such an extent that the player no longer feels it, even when playing the game for long.

sentences:
minecraft mapping from tibia OTBM file I am new to minecraft modding but i program for a living and it looks quite simple to get around. I have this fantasy and a quick internet search shows im not the only one. For those of you who do not know tibia is an MMORPG first released in 1997. It is a 2d tile based game and i would like to see it in 3D. since it is a tile based game it fits nicely with the minecraft architecture. Tibia is a close sourced game but there is TibiaOT which is developed by the community and the map file format is OTBM (open tibia binary map). This is a set of 15 2D grids where each grid represents a floor or the height of the grid, the file comes with two more files with monster spawns and default item locations like chests.

There is a tibia texture pack for minecraft called "Tibian texture pack", so we got the materials covered.

all in all we have the following: a native tibia map and a minecraft texture pack

people have been building tibia maps manually for years now, it seems stupid because we have a binary file for the real map. what we need is a way to map the OTBM file to a minecraft map. i am looking for tools and any other tips a on how to digest the files into a minecraft map file. an explanation of minecraft map file format would also be very helpful.

sentences:
How to put basic scripting/variable changes into dialog xml files? I have a simple XML structure for my dialog between the player and NPCs.
What I'd like to do is put variable changes (and maybe other things) directly into the XML.  So, for instance, if you select a certain conversation option the character gives you gold.  Like this:

<story>
  <segment id ="1">
    <dialog>
      <speaker>Fred</speaker>
      <text>Do you like futurecrew?</text>
    </dialog>
    <choice>
      <prompt>Yes</prompt>
      <target>2</target>
      <command>$gold-10</command>
    </choice>
    <choice>
      <prompt>No</prompt>
      <target>3</target>
      <command>$relationship-20</command>
    </choice>
  </segment>
</story>

In exploring this issue I have written a really terrible brute force command parser, but it just feels wrong at so many levels:

public class Command
    {
        string commandText;
        Symbol symbol;
        Field field;

        public Command(string _commandText)
        {
            commandText = _commandText;
        }

        public void Execute()
        {

            //look for operators
            int test = -1;
            int location = -1;
            int amount = 0;

            test = commandText.IndexOf("-");
            if (test != -1)
            {
                symbol = Symbol.Minus;
                location = test;
            }
            test = commandText.IndexOf("+");
            if (test != -1)
            {
                symbol = Symbol.Plus;
                location = test;
            }
            test = commandText.IndexOf("*");
            if (test != -1)
            {
                symbol = Symbol.Multiply;
                location = test;
            }
            test = commandText.IndexOf("/");
            if (test != -1)
            {
                symbol = Symbol.Divide;
                location = test;
            }
            string variable = commandText.Substring(0, location);
            amount = Int32.Parse(commandText.Substring(location + 1));

            if (variable.ToUpper() == "$GOLD")
                field = Field.Gold;

            if (field == Field.Gold)
            {
                Logger.log("Gold before {0}", Game.Instance.Gold);

                if (symbol == Symbol.Minus)
                    Game.Instance.Gold -= amount;
                if (symbol == Symbol.Plus)
                    Game.Instance.Gold += amount;

                Logger.log("Gold after {0}", Game.Instance.Gold);
            }
        }
    }

If I have 30 different variables I want to "expose" to the XML "scripting" it looks like I'll be writing a lot of stupid achey breaky code.

I have searched around and found people asking/answering about conditions, which I see as  simpler than this.  I have also seen suggestions for CodeDom for realtime compiling but this is in unity C# so I don't anticipate that will work.  I looked into LUA for .NET and IronPython but that seems overkill when really I just want the ability to change variables on my Game singleton.

Any ideas or direction would be much appreciated!

EDIT: I found UniLua https://github.com/xebecnan/UniLua for a unity safe pure c# implementation of lua.  I haven't decided yet if I'll use it, but my presupposition that I couldn't use Lua turned out to be false.

sentences:
computationally Intensive routine, ThreadPool or new Thread? I had to write a computationally expensive routine that runs in 20-30ms. This routine cannot run in the main thread since it would kill the frame rate. The routine runs on demand, when some data change.

I wonder what would be better to use in this scenario. While I think ThreadPool will be all right, I wonder what would happen on an extreme scenario where just one core is available. Would it be better than to create a new thread every time and set the priority to below normal? I wonder though if, in this case, I would end up with the routine struggling to complete within a decent time (although waiting 1-2 seconds would be all right)

My guess is that the ThreadPool is always better in a multi-core scenario, however I wonder if in a single core scenario, creating a thread with lower priority could be a better solution (since I don't care if the computation last longer than excepted).

sentences:
differences betwen game resolution in a different display resolution my game is not supported on the other devices with a different resolutions. for example may character is 140w X 55h pixels which is ok on a 4 inch display but it goes wide when i tested my game on a device with 4.7 inch display. how can i make a correct character for 4.7 or more inch displays?
i am using cocos2d-x engine. i want to see if it has a automatic synchronize tool or no. i my self must do it manually ?

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 move around in a map and remember position? I am working on sound labyrinth game. My game is about a person getting trapped in the basement and the only way to navigate and get out is through sound. I have created a map over the basement and for each square there has to be a sound.

The player starts in b5 with an intro sound and then has to move forward using the arrow keys. I've created this bit of code that plays a sound when forward arrow (keycode === 38) is pressed:

var thriller=new Audio("thriller.mp3");

document.addEventListener('keydown',
function (background) {
    if (background.keyCode === 38){
        thriller.play();
    }
}, false);

My question is:

How does the code know in which square the player is situated? Is there some smart way in which I can systematize the squares and the sounds they represent?

sentences:
Who has the rights to the party game Mafia / Werewolf? Who has the rights to the party game Mafia / Werewolf?

Or is it public domain, meaning anyone can do an implementation of the game and release it as a commercial product?

Update 1:
According to this question:
Making a mobile app from a board game. Copyright infringement?

You can't copyright concepts or mechanics. This basically means this should be public domain, right?

sentences:
How do I separate model positions from view positions in MVC? Using MVC in games (as opposed to web apps) always confuses me when it comes to the view.  How am I supposed to keep the model agnostic of how the view is presenting things?

I always end up giving the Model a position that holds x and y but invariably, these values end up being in units of pixels and that feels wrong.  I can see the advantage* of avoiding that but how am I supposed to?

This idea was suggested:

  Don't think of it in units of pixels, think of them in arbitrary distance units that just happen map to pixels at a 1:1 ratio. Oh, the resolution is half of what it was? We are now taking the x/y coordinates at 50% value for screen display, and your spells casting range is still 300 units long, which now is 150 pixels.

But those numbers conveniently work out.  What do I do if the numbers divide in such a way that I get decimal places?  Floating points are unsafe.  I think allowing decimal places would eventually cause really weird bugs in my game.

*It'd let me write the model once and write different views depending on the device.

sentences:
Why is the Set new visibility doesn't resets the hair's skeletal mesh visibility to be visible? The helmet is loaded when pressed a defined key and helmet is removed automatically by setting the remove on 2s delay.
The Problem when the helmet is removed, the hairs visibility doesn't sets to be visible while blueprint is set to restore the visibility.
setvisibility and sethiddeningame both are tested, none of them works.
How to fix it? any help appreciated.

sentences: How to use WorldToScreenPoint function in a texture context? I am rendering a scene into a RenderTexture and I have a set of 3D points. I want to convert these points from 3D to texture coordinate frame. It worked, when I rendered into screen and used camera.WorldToScreen() function. Now I have to render into texture. Is there any way to do the same as WorldToScreen() function does for the render/2D texture?

sentences:
Compressing 2D level data So, I'm developing a 2D, tile based game and a map maker thingy - all in Java.

The problem is that recently I've been having some memory issues when about 4 maps are loaded. Each one of these maps are composed of 128x128 tiles and have 4 layers (for details and stuff).

I already spent a good amount of time searching for solutions and the best thing I found was run-length enconding (RLE). It seems easy enough to use with static data, but is there a way to use it with data that is constantly changing, without a big drop in performance?

In my maps, supposing I'm compressing the columns, I would have 128 rows, each with some amount of data (hopefully less than it would be without RLE). Whenever I change a tile, that whole row would have to be checked and I'm affraid that would slow down too much the production (and I'm in a somewhat tight schedule).

Well, worst case scenario I work on each map individually, and save them using RLE, but it would be really nice if I could avoind that.

EDIT:
What I'm currently using to store the data for the tiles is a 2D array of HashMaps that use the layer as key and store the id of the tile in that position - like this: private HashMap< Integer, Integer >[][]

sentences:
Identify an object currently selected in the game I am making a 2D isometric game that uses the mouse. When I left click on an object, this object should be selected, but how do I determine what object that's currently selected and show a halo around it?

My objects are stored in a list of game objects as std::vector<Game_Object *> Object_Game. I am using the SDL library with C++. I did some research on Google but only found articles about Unity. Can someone help me with this?

sentences:
How do I correctly use singletons in C++ engine programming? I know singletons are bad, my old game engine used a singleton 'Game' object that handles everything from holding all data to the actual game loop. Now I'm making a new one.

The problem is, to draw something in SFML you use window.draw(sprite) where window is an sf::RenderWindow. There are 2 options I see here:

Make a singleton Game object which every entity in the game retrieves (what I used before)
Make this the constructor for entities: Entity(x, y, window, view, ...etc) (this is just ridiculous and annoying)

What would be the proper way to do this while keeping an Entity's constructor to just x and y?

I could try and keep track of everything I make in the main game loop, and just manually draw their sprite in the game loop, but that too seems messy, and I also want absolute full control over an entire draw function for the entity.

sentences:
What caused rotation in exported blender model to jMonkey? (OGRE) First off, I am very new to jMonkeyEngine 3 and still learning. Not exactly sure what could be causing my snowman to have already been rotated before import. I created him in blender and it was facing forward. The up axis was Z and the forward axis was Y.

For some reason when it is imported into jMonkey I got it pre-rotated which is not what I wanted nor what I coded. I just imported like this tutorial says to do in the book.

Exported as ORGE > Converted to .j3o > Imported with code.

snowMan = assetManager.loadModel("Models/Snowman/snowman.j3o");
Material matVC = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
matVC.setBoolean("VertexColor", true);
snowMan.setMaterial(matVC);
rootNode.attachChild(snowMan);

What should I look at doing to try and remedy this? Not even sure where to start. Could it be messed up in blender? The way I exported? jMonkey?

Update #1: I think it has to do with either the exporter or something I did in blender... not sure what though. Pretty sure it is not the fault of jMonkey.

Now it looks like this.

sentences:
How to remove seams from a tile map in 3D? I am using my OpenGL custom engine to render a tilemap made with Tiled, using a well spread tileset from the web. There is nothing fancy going on. I load the TMX file from Tiled and generate vertex arrays and index arrays to render the tilemap. I am rendering this tilemap as a wall in my 3D world, meaning that I move around with a fly camera in my 3D world and at Z=0 there is a plane showing me my tiles. Everything is working correctly but I get ugly seems between the tiles.

I've tried orthographic and perspective cameras and with either I found particular sets of parameters for the projection and view matrices where the artifacts did not show, but otherwise they are there 99% of the time in multiple patterns, depending on the zoom and camera parameters like field of view.

Here's a screenshot of the artifact being shown: http://i.imgur.com/HNV1g4M.png
Here's the tileset I am using (which Tiled also uses and renders correctly): http://i.imgur.com/SjjHK4q.png

My tileset has no mipmaps and is set to GL_NEAREST and GL_CLAMP_TO_EDGE values. I've looked around many articles in the internet and nothing helped.

I tried uv correction so the uv fall at half of the texel, rather than the end of the texel to prevent interpolating with the neighbour value(which is transparency). I tried debugging with my geometry and I verified that with no texture and a random color in each tile, I don't seem to see any seams. All vertices have integer coordinates, i.e, the first tile is a quad from (0,0) to (1,1) and so on. Tried adding a little offset both to the UV and to the vertices to see if the gaps cease to exist. Disabled multisampling too. Nothing fixed it so far.

Thanks.

sentences: Can I use copyrighted images and music in my game? I am working on my first ever project , and I have used some copyrighted images(images taken from some other well recognized games). Is it even possible that I edit the images a little bit and then use them as royalty free images?

sentences:
Can't import shaders/textures to Godot from Blender 2.8 I'm using this shader for my models and then i import them like this
This is the original model in blender:

the result in godot:

I think i might have missed some step but not sure of which one, i followed the tutorial video on how to import and other similar guides but the results is the same. Any ideas of what i'm doing wrong?
Looks like my model not importing shader and textures cor

sentences:
How to get a specific button component I'd like Unity to get a specific button with:
GetComponent<Button>().interactable

But how do I get a specific button with a name?

sentences:
How to use Monogame Content Pipeline with XML I have an XML file that I'm trying to import into my MonoGame project using the content pipeline.  I'm having trouble getting the MonoGame Pipeline tool to convert the XML file into a .xnb file before I can even run the program.

The XML file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent>
  <Asset Type="GameObjects.ObjectInstruction">
    <FrameNames>
      <Item>Image_1</Item>
      <Item>Image_2</Item>
    </FrameNames>
    <FrameSpeed>10</FrameSpeed>
    <HorizontalOrigin>0.5</HorizontalOrigin>
    <VerticalOrigin>0.5</VerticalOrigin>
    <HorizontalScaling>1</HorizontalScaling>
    <VerticalScaling>1</VerticalScaling>
    <HorizontalOffset>0</HorizontalOffset>
    <VerticalOffset>0</VerticalOffset>
    <Subset Null="true" />
    <RotationRadians>0</RotationRadians>
    <Tint>
      255
      <G>255</G>
      <R>255</R>
      255
      <PackedValue>4294967295</PackedValue>
    </Tint>
  </Asset>
</XnaContent>

The GameObjects namespace is in a Visual Studio project that creates a .dll file, and I have another MonoGame project that references GameObjects and is the one in which I'm trying to do all the content stuff.

Inside the Pipeline tool I've got a reference set to the GameObjects.dll file.  This file shows up in several places, and if I pick the wrong one the Pipeline tool fails with the error "Assembly is either corrupt or built using a different target platform than this process. Reference another target architecture (x86, x64, AnyCPU, etc.) of this assembly."

If I change the reference to the .dll file in the GameObjects project folder, the Pipeline tool still fails when trying to process my XML file.  The error message looks like "System.Xml.XmlException: 'Element' is an invalid XmlNodeType. Line 19, position 8."  This part of the XML file would be the G field of the Tint part of the ObjectInstruction object (Tint is a Color).

I've been knocking my head against this problem and getting nowhere.  How do I use the Monogame Pipeline tool with XML files?  How do I get it to recognize the definition of ObjectInstruction and process the XML file into a .xnb file?  I'm pretty sure the rest of my program will run if I can solve this bit.  Thanks for any help.

sentences:
Loading levels in XNA from XML I'm trying to load levels in XNA from XML files.
I have currently got a system to do this working, but it looks like it might get horribly complex as I add more objects later on.
My world currently consists of Planet entities along with physics props, scenery, static props, etc. It will later include NPCs, interactive machines, and a lot more content (but I want to sort this out before going any further).

Based on a tutorial I read, my level loader loads a LevelData entity from XML. This contains arrays of PlanetLevelData, PropData, and StaticData. My test file is as shown:

<?xml version="1.0" encoding="utf-8" ?>

<XnaContent>

<!-- TODO: replace this Asset with your own XML asset data. -->

    <Asset Type="DataTypes.LevelData">`

        <PlanetData>
            <Item>
                <Position>5.2 5.2</Position>
                <BodyRadius>300</BodyRadius>
                <FieldRadius>450</FieldRadius>
                <Name>Jupiter</Name>
                <Rotation>0</Rotation>
                <ImageName>-</ImageName>
            </Item>
            <Item>
                <Position>-2 -2</Position>
                <BodyRadius>300</BodyRadius>
                <FieldRadius>450</FieldRadius>
                <Name>Jupiter2</Name>
                <Rotation>0</Rotation>
                <ImageName>-</ImageName>
            </Item>
        </PlanetData>

        <PropData>
            <Item>
            <Type>Crate</Type>
            <Position>2 3</Position>
            </Item>
        </PropData>

        <StaticData>
            <Item>
                <Type>FromImage</Type>
                <Position>-4.5 -4.5</Position>
                <ImagePath>Lamp</ImagePath>
                <Rotation>2</Rotation>
                <Radius>0</Radius>
                <Vertices></Vertices>
                <PlanetOwner>Jupiter2</PlanetOwner>
            </Item>
        </StaticData>

    </Asset>

</XnaContent>

In other words, I have to put all my content files into arrays. However, for me to have different types of StaticData from the XML file, I have to specify the type with a String (called Type).

I then load the XML using Content.Load<LevelData>("name here.xml"). I go through every PlanetData in the array and create a new Planet based on it's properties. I also use switch statements based on the Type field to specify which type to create...

Is this the only way to load level data into objects using XML (I hope not, it's hideous to use). I couldn't really find much on this topic...

sentences:
Using a programmable pipeline in a game engine As a learning experience, I'm developing my own 3D game engine using OpenGL. I'm a little confused as to how to implement my rendering engine such that it uses a programmable pipeline while still being responsible for projecting and displaying vertices correctly.

Let's say my engine has a simple vertex shader that uses projection and modelview matrices to project a vertex in 3D space. How do I use the engine's vertex shader while still allowing the programmer to provide his/her own vertex shader for other calculations in their game? What is the normal approach here?

sentences:
Y and X - Am I doing it wrong? I sometimes run into small issues when doing my JavaScript projects.
That is because most build in functions of JavaScript run  X,Y if positions are needed. (In that order).

But when I build a 2D Array I start out with Y, it seems more logical for me to to run the X axis horizontal. If I am bad at explaining it, let me show you:

So my loops look like this:

for(var y = 0; y < 10; y++){
    for(var x = 0; x < 10; x++){
        console.log("Doh!");
    }
}

Is this so insane?
I would like to convert to the normal practise so that I have an easier time while building my game and don't have to do constant switcherroos.

So why is it X before Y ?

Edit:
Here is another example, and probably the main reason for my confusion:
X is Horizontal, and Y is Vertical in my books..

[
[0,1,2,3,4],
[0,1,2,3,4],
[0,1,2,3,4],
[0,1,2,3,4],
]

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:
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:
Handling an item database with procedurally generated items? Let's say you have an item database which has every item in your game.
This works fine for regular items like a Health Potion, a normal Iron Sword etc, because these items have ItemID's so we can get an exact copy of this item.
But what if we have an Iron Sword with an enchantment: '+5 Fire Damage'? (or whatever)

If you were to save that item to a player's inventory, exit the game and load the game, the item will load as a regular Iron Sword, because it still has that ID.

Specifically, how would you save that item to a file? I'm using Unity, so to save the Player's inventory, I use:

PlayerPrefs.SetInt("Inventory " + i, inventory[i].ItemId );

Would you create a custom item ID for every item with enchantments or is there a better way around this?

sentences:
Associating game object with some class Disclaimer: Somewhat long-winded question & new to developing

In my game I have a class called Item which defines what an item is. It contains several fields like the name of the item, the sprite of the item, the item's ID number, etc. I also have little physical objects on the ground that "represent" items, but they aren't really tied to the Item class in the way I want. I'll get back to this point.

So, when an enemy dies in my game, SpawnItem(Item item) is called. Depending on a randomly generated number, SpawnItem(ItemData.sword) might be called or SpawnItem(ItemData.axe) and so forth. SpawnItem itself just instantiates a generic prefab (that little physical object on the ground), modifies some state like bool itemDropped and int numItemsDropped, makes some calculations to determine where to drop the item, and displays that item's name in a UI label above the item.

I'm currently in the process of making an inventory system, and I've realized something. Those physical objects on the ground that are supposed to be items don't really know that they're items (in the sense defined by the class). A sword doesn't know it's a sword, and an axe doesn't know it's an axe (the game object sword doesn't know that it's a sword Item defined by the class) So when I pick up an item, I can probably do some code gymnastics to get the appropriate sprite to appear in the inventory, but that doesn't seem like a smart solution.

So, my question is how do I get my sword game object (just a sphere on the ground representing a dropped item) to be linked to the sword Item? How do I get the sphere to know that it represents a sword with the ID number "1", the name "Sword", a weight of "1.5" etc. so that I don't have to do awkward code gymnastics? After all, when I'm adding an item to my inventory, I don't really think of it as JUST drawing that item's sprite in the first non-empty slot of the inventory. I would think it's much better to get each game object to know what Item it represents than to just try and get that sprite to show up in the inventory.

I might be overlooking something basic, but understand that I'm pretty new to Unity. Anyway, thanks for the time and help!

sentences:
libgdx - Scalable UI without Scene2D I currently have a fairly decent framework for a side-view strategy-ish game built around libgdx. While I may have reinvented the wheel a couple of times, I believe I've done the vast majority with tools already existing in libgdx parts properly: camera, viewport, sprites, etc.

One thing I've not used at all is Scene2D, as I've simply not had a need for it (yet). Drawing the sprites at their positions is more than enough. The terrain is procedurally generated pixel art that is drawn beforehand.

Now I've come to the point where I need to implement some fairly basic UI-systems. Nothing out of the ordinary: A few buttons to click, and an area with additional info.

I haven't decided entirely on which approach to use when implementing the UI, but in the meantime I'm going with a fairly simple approach:
When everything else is drawn, I reset the projectionmatrix so that everything drawn after that never moves with the world:

    Matrix4 uiMatrix = camera.combined.cpy();
    uiMatrix.setToOrtho2D(0,0,viewport.getWorldWidth(), viewport.getWorldHeight());
    batch.setProjectionMatrix(uiMatrix);
    // Then draw the UI

This works fine, except when the aspect ratio changes and/or when the window resizes. Therefore I would like to find a more scalable way.

Is Scene2D the way to go? It currently looks like the only reasonable way of getting an UI that works well with resizing the screen and panning around.

The info I find on how to implement it either assumes a complete rewrite to use actors instead of sprites, or doesn't scale well at all.

sentences:
XNA 4.0 - Strange Behavior when using RenderTarget2D My Problem is similar to XNA 4.0 - Why does using a RenderTarget2d cause transparency on models?.

I want to render my scene to a Texture2D and then draw the texture.
If I set no RenderTarget at all (render directly to the back buffer), everything looks fine.

I draw my models/textures with:

graphics.GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.Opaque, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise);

[...Drawing methods for models etc. are called here...]

spriteBatch.End();

If I change that code to:

RenderTarget2D target = new RenderTarget2D(this.GraphicsDevice,this.GraphicsDevice.PresentationParameters.BackBufferWidth,this.GraphicsDevice.PresentationParameters.BackBufferHeight);
this.GraphicsDevice.SetRenderTarget(target);

graphics.GraphicsDevice.Clear(Color.Black);

spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.Opaque, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise);

[...Drawing methods for models etc. are called here...]

spriteBatch.End();
this.GraphicsDevice.SetRenderTarget(null);

And render the texture / save it as an image-file, some objects get transparent and the drawing order changes sort of randomly.

sentences:
Is my collision-free location script working? I've recently been learning C# and I wanted to take one of my 2D tutorials to Unity.

I reached a step where I need to spawn my new sprite into a collision free location. I've followed direction - generated random location, calculating Vector2s using the location and collider, and then used a while loop to check Physics2D.OverlapArea using my 2 vectors.

But, because I'm still only just learning C#, I'm finding it difficult to know if I have actually written my code correctly. Is there any simple way of being able to figure this out? Using Debug or something?

Vector3 spawnLocation = new Vector3 (Random.Range (minSpawnX, maxSpawnX),
                                     Random.Range (minSpawnY, maxSpawnY),
                                     -Camera.main.transform.position.z);
Vector3 spawnPoint = Camera.main.ScreenToWorldPoint (spawnLocation);
Vector2 lowerLeftCorner = new Vector2 (spawnPoint.x - teddyBearColliderHalfWidth,
                                       spawnPoint.y - teddyBearColliderHalfHeight);
Vector2 upperRightCorner = new Vector2 (spawnPoint.x + teddyBearColliderHalfWidth,
                                        spawnPoint.y + teddyBearColliderHalfHeight);
while (Physics2D.OverlapArea (lowerLeftCorner, upperRightCorner) != null)
{
    spawnPoint.x = Random.Range(minSpawnX, maxSpawnX);
    spawnPoint.y = Random.Range(minSpawnY, maxSpawnY);

    lowerLeftCorner = new Vector2 (spawnPoint.x - teddyBearColliderHalfWidth,
                                   spawnPoint.y - teddyBearColliderHalfHeight);
    upperRightCorner = new Vector2 (spawnPoint.x + teddyBearColliderHalfWidth,
                                    spawnPoint.y + teddyBearColliderHalfHeight);
}
Debug.Log (Physics2D.OverlapArea(lowerLeftCorner, upperRightCorner));

I was trying to use a debug at the end there, but it doesn't seem to continue running every single time that there's a spawn, so I am still unsure if it is working.
I'm terribly sorry for my nooby code. Feel free to direct to me some place else if you feel I need to do so.

sentences:
Player going out of boundaries So, I been following up the Space shooter tutorial on Unity, I had an issue where the project was acting up with an alpha version, so I was able to get a version that worked on a old release and applied all the new things I developed

But suddenly, my ship is acting up when getting closer to the boundary of its movement

This is the player movement code

public class playerMovement : MonoBehaviour
{
public float speed = 0.0f;
public float tilt;
public Boundary boundary;

void FixedUpdate ()
{
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");

    var movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
    var rigidBody = GetComponent<Rigidbody>();
    rigidBody.velocity = movement * speed;

    rigidBody.position = new Vector3
        (
            Mathf.Clamp(rigidBody.position.x, boundary.xMin, boundary.xMax),
            0.0f,
            Mathf.Clamp(rigidBody.position.z, boundary.zMin, boundary.zMax)
        );

    rigidBody.rotation = Quaternion.Euler(0.0f, 0.0f, rigidBody.velocity.x * -tilt);
}

}

[System.Serializable]
public class Boundary
{
    public float xMin, xMax, zMin, zMax;
}

And this is the player boundary properties

It used to work previously moving forward to the alpha, now I'm working on 2019.2.0f1, but since working on the alpha this is the behaviour I'm having

As you can see, getting closer to the player boundary, takes the player out of the play area, and I can't determine why this might be happening.

I already tried removing the Math.Clamp, as I though there migth be bug with the function in this version, but even without it, the problem is present.

sentences:
Include Box2D libraries to a cocos2d project (iOS) I have a problem including box2D to my cocos2d project. I've tried different ways to do it with no success. This is what I've done:

I downloaded Box2D (Box2D_v2.2.1) to my project directory.
Dragged the Box2D directory (which includes -> /Box2D.h, /Collision, /Common, /Dynamics, /Rope) to my Xcode project (from Finder to Xcode)
Then I added #include "Box2D.h" to my .h file and got many errors... Here is where I started my research :P
I went to Project Settings and edited the attribute Header Search Paths (contained in the Search Paths section) specifying the path of Box2D. At this point, I builded the project and I got less errors.
After that, I renamed my .m file to .mm (I think this is because Box2D is written in C++ and with this, the compiler can treat it as it is). Still got errors.
Then I tried changing the attribute Always Search User Paths
(contained in Project Settings -> Search Paths) from YES to
NO. Still got errors.
As my last option I tried changing the attribute Compile Sources
As (contained in Project Settings -> LLVM GCC 4.2 - Language) from
According to File Type to Objective-C++.

By now I'm frustrated xD. I have 203 errors and most of them are in the .h files contained in the Box2d engine.

b2Timer.h - Expected '=', ',', ';', 'asm' or 'attribute' before 'b2Timer'

b2Distance.h - Expected specifier-qualifier-list before 'b2DistanceProxy'

b2Math.h - Cfloat: No such file or directory

And so on...

Thanks!!!

sentences:
How to set speed based on screen size I am making a breakout clone for mobile and was wanting to make the ball speed to be related to the screen size.  Larger screen would mean faster speed.

Right now I have it set like so:

dirx=math.random(-5,5)*(maxx/320)
diry=math.random(3,7)*(maxy/480)

My reasoning for this is that 320x480 is iPhone resolution so I figured it would be a good base to start at.  For the record, it actually runs pretty well on iPhone setting.

Then for the actual movement I just add dir to the appropriate direction.

ball.x=ball.x+dirx
ball.y=ball.y+diry

The problem is if I change to a device with a larger screen resolution, the ball is crazy fast and is very jumpy.

Is some kind of formula that I can use to multiply to the random that will make the speed appear uniform across devices?

sentences:
HDR bloom techniques using post processing in Unity3D I've seen many posts on how to accomplish HDR bloom effects in Unity3D using its (now legacy) Bloom component as part of the standard assets package.

I'm trying to replicate it using the new post processing package, but I can't seem to get it to work.

I have an an emissive material that's emitting at a value far >1 sitting at 10:

Bloom is set in a Post Processing Profile, and the threshold is >1:

Finally, HDR is enabled on my camera, along with a deferred rendering path.

Yet this doesn't work. I only see the bloom effect if I set my bloom threshold <1, after which all my materials bloom. It's as if HDR is not actually enabled. Anyone know why?

sentences:
LibGDX - Rotating sprites and still keep the positioning between them I've been struggling with a problem regarding rotations and relative positions between sprites (in this case, the sprites are just lines) - a bit off-topic, but should i be using the ShapeRenderer class to do this, though?

Anyway, it might be quite simple but i can't seem to figure it out properly. Heres a picture of the situation: https://gyazo.com/78988e07991fedc778eaeb70f8a04d8e

Now, after trying a bunch of different approaches, this piece of code is the one i'm testing right now:

`   public class TestState extends AbstractGameState {

private static final String LINE = "lineEffect.png";

private Sprite[] sprites;

public TestState(GameStateManager gsm) {
    super(gsm);

    sprites = new Sprite[2];
    for (int i = 0; i < 2; i++) {
        sprites[i] = new Sprite(new Texture(LINE));
        // both lines starting at the same X and Y
        sprites[i].setPosition(20, 50);
        // both lines have the same size
        sprites[i].setSize(100, 2);
        // guess i might be messing up here
        sprites[i].setOrigin(sprites[i].getX(), sprites[i].getY());
    }

    // for testing purposes
    sprites[0].setRotation(-20);
    sprites[1].setRotation(45);
}

@Override
public void render(SpriteBatch batch) {
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    for (Sprite sprite : sprites)
        sprite.draw(batch);
    batch.end();
}`

Any help on this would be appreciated, thanks in advance.

sentences:
Coroutine wrong Behavior when scene is loaded. Ok so I have this coroutine :

 IEnumerator ShowCharTraits()
    {

        while(!hasPlayerChosen)
        {
            yield return null;
            traitPanel.SetActive(true);
        }
        hasPlayerChosen = false;
        traitPanel.SetActive(false);
    //    Debug.Log("Got called! job done");

    }

It's being called like this from the awake method in my GameManager:

players = GameObject.FindGameObjectsWithTag("Player");
                foreach (GameObject g in players)
                {
                    ui_Controller.StartShowCharTraits();
                    g.GetComponent<PlayerToken>().isTurn = false;
                }

StartShowCharTraits() is a simple method that does this :

  public void StartShowCharTraits()
    {
        StartCoroutine("ShowCharTraits");
    }

Now, I have checked the tags, no null reference exception, actually no errors or warnings are being thrown. If i load the scene in the editor and then play it everything works fine. traitPanel.SetActive(true); get called and my panel shows up. However when I load my scene from another scene using   SceneManager.LoadScene(1); the above mentioned line is never reached. Any ideas why this is happening ?

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:
Resuming swapped out RenderTarget2D in XNA Hopefully this will be a simple answer, but as RenderTarget2Ds are Texture2Ds under the hood I was wondering how it handles swapping in and out.

Lets say you create a default one and assign it as the render target at the start of your Game.Render(). Then at a few points during your render process a new RenderTarget is swapped in, rendered to and then kept as a texture for later and the original one is then put back in. Some more rendering occurs and another entity swaps in its own RenderTarget, puts it in another texture and then swaps back to the default RenderTarget, and finally everything is rendered and done.

Now as the RenderTarget2D is a Texture2D without setting preserve mode on the RenderTarget will you be able to swap it out and swap it back in without losing your current contents of the RenderTarget?

I know there are some issues with the Preserve settings for RenderTargets on the Xbox, but if the render targets are being stored as a class member somewhere, are they subject to different rules?

I am sure the answer is, they obey the RenderTargetUsage behaviour, and will be subject to the same rules regardless of how they are stored in the game, but I just wanted to be sure.

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:
How to get xy coordinates along a given path Say i have two points (x,y), (0,0) and (10,10). Now i wan´t to get coordinates along the line by stepping through values of x and y. I thought i solved it with the following functions:

 fy = startY + (x - startX) * ((destY-startY)/(destX-startX));
 fx = (y + startY) / ((destY-startY)/(destX-startX)) + startX;

taken from http://en.wikipedia.org/wiki/Linear_interpolation

However, it seems that im getting a problem when destX and startX is the same value, so you get division by zero.

Is there a better way of getting coordinates along a line when knowing the start and endpoint of the line?

sentences:
3D Physics Engine Collision Response: Solving Simultaneous Collisions via equation I have been implementing a basic physics engine for a small game project I'm working on. It has very specific requirements, so I decided to try and write my own physics engine to meet them. I found this paper, which seemed to be reasonably simple, and provide answers for everything I needed.

https://drive.google.com/file/d/0Bze6mKYvrpOKYjdkODVhMTAtM2Q4Zi00NzgyLWE2YzMtN2MwZmQ4NjA3OWMw/view?ddrp=1&hl=en#

So far I have successfully implemented collision detection (using my own custom algorithm designed to suit my particular requirements), as well as the collision response (See section 2.6.2.1 on page 41 of the paper).

I have, however, become stuck on solving simultaneous collisions. The paper provides equations (see section 2.6.7.1 on page 51), but I am unable to understand or implement them.

Can someone explain how these are supposed to be implemented?

Here is my current understanding of what is presented, and why is must be wrong:

In terms of implementation, I'm not sure what they mean by "combined contact impulse," as they do not mention to term elsewhere and fail to explain what they are "combining" (Possibly the angular and linear impulse, but I'm not sure how those aught to be combined).

I am also not sure how these formulas are supposed to work. It appears in the first equation just sum the the combined impulse (whatever that is), and use that to increase the velocity, but they only add it in 1/k (where k is the number of iteration) size chunks k times. This basically just seems to result in summing the velocities. This is not physically accurate since multiple collision against the same object will be summed resulting in unrealistically strong velocities.

I'm even more confused by the next equation. It appears to add r cross n to the rotational velocity, with complete disregard for impulse magnitude. Doesn't make sense ether.

The third equation has the same problem as the first.

I feel like some kind of integration or transform needs to happen on each iteration that is not shown, but I am not sure what it should be.

Please feel free to leave comments asking for clarification. I'm utterly confused, and I would not be surprised if my questions lack a little coherence.

sentences:
How to get the loudness of the real world environment using the device's microphone in Unity? I am trying to create a game where the character's movement is dependent on the loudness of the real world environment. So if the person playing the game screams or do something loud the character will move accordingly.

What I need is a function returning the loudness of the real world environment and use it in the Update() to control the character.

Is there such a function or if not how can I make one?

sentences:
Which algorithm used in Advance Wars type turn based games Has anyone tried to develop, or know of an algorithm such as used in a typical turn based game like Advance Wars, where the number of objects and the number of moves per object may be too large to search through up to a reasonable depth like one would do in a game with a smaller search base like chess?

There is some path-finding needed to to engage into combat, harvest, or move to an object, so that in the next move such actions are possible.

With this you can build a search tree for each item, resulting in a large tree for all items. With a cost function one can determine the best moves.

Then the board flips over to the player role (min/max) and the computer searches the best player move, and flips back etc. upto a number of cycles deep.

Finally it has found the best move and now it's the players turn. But he may be asleep by now...

So how is this done in practice?

I have found several good sources on A*, DFS, BFS, evaluation / cost functions etc. But as of yet I do not see how I can put it all together.

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:
Can I accept unicoins for micro-payments in my game? I'm developing a free-to-play game on Android and iOS and Facebook. I see that Unicoins can be purchased in many ways, a lot more that I'll ever be able to implement myself (Paypal, Bitcoins, Gold, Reddit karma! I mean: wow!).

Is there a way I can accept them as micro-payments and then turn them back into real money?

sentences:
Libgdx : point that scrolls on the edge of a circle I'm not very familiar with libgdx vectors. I want to create my own joystick-controller and I want to know how can I find the coordinates of B by using Vectors. I can calculate the radius and I have the center.

Thank you.

sentences:
resizing directx control so that more of my object's environment is visible I'm very new in 3D. I have a DirectX control which I want to be able to resize. A 3D object is shown in the control. On resize, I would like that object to stay the same size, only more of its environments should be visible. As I understand, I only need to change the FOV for this, and I tried to deduce how from the second image here http://msdn.microsoft.com/en-us/library/windows/desktop/bb206341(v=vs.85).aspx.

My "solution" is:

    float newFov = (float)(2 * Math.Atan((height / prevHeight) * Math.Tan(fov / 2)));
    projection = Matrix.PerspectiveFovLH(fov, width / height, zNear, zFar);

(fov is the vertical fov here before the resize, height is the control's NEW height, width is its NEW width)

Problem is, this is not working, if I change the control's width only it looks OK (but then FOV really doesn't change, only aspect ratio), but if I change the height too my object is scaled. I'm starting to think that something in my thinking is fundamentally wrong. I would appreciate any help from you 3D gurus out there.

sentences:
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:
Drawing a pixel to RenderTexture I would like to know how you would go about drawing a single pixel to a RenderTexture in Unity.

In XNA, it was just a matter of setting the graphic device's active renderTarget, and drawing to it.

In Unity, I am unable to figure out how to do this properly.  I attempted to use Graphics.DrawTexture, but that seems to be horribly slow.

I imagine there is something that can be done with GL, but I haven't been able to make it draw in side the RenderTexture properly.

Here was my attempt with DrawTexture:

    RenderTexture.active = rt;
    GL.PushMatrix();
    GL.LoadPixelMatrix(0, 128, 128, 0);

    for (int x = 0; x < 128; x++)
    {
        for (int y = 0; y < 128; y++)
        {
            Graphics.DrawTexture(new Rect(x, y, 1, 1), texture, mat);
        }
    }

    GL.PopMatrix();
    RenderTexture.active = null;

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:
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:
Why is my jump arc preview inaccurate? I'm trying to draw an arc out of dots that previews a KinematicBody2D's trajectory after a jump but said preview always falls short of the body's actual jump and I cannot figure out why. Below is an example gif of what I'm talking about.

And this is the code I used in the example.
extends Node2D

var arcPoints = 40
var pointsPerSec = 12
var startYvelocity = -500
var velocity = Vector2(200, startYvelocity)
var gravity = 300

var startPosition = Vector2(96, 544)

func _draw():

    var totalY = startPosition.y
    var velY = startYvelocity
    var calcGravity = gravity/pointsPerSec

    for p in range(arcPoints):
        velY += calcGravity
        totalY += velY/pointsPerSec

        var point = Vector2(startPosition.x+(velocity.x/pointsPerSec)*(p+1), totalY)
        draw_circle(point, 2, 'fafafa')

func _ready():
    pass

func _physics_process(delta):
    velocity.y += gravity*delta
    get_child(0).move_and_slide_with_snap(velocity, Vector2(0.0, 1.0), Vector2(0.0, -1.0))

sentences:
Why doesn't anything run after the yield return new line I am trying to make a fade to another scene in unity when I came across a problem. For some reason when the coroutine begins the Ienumerator it only runs half of the Ienumerator Method which is only the anim.SetForBlue line. Heres my code.

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

public class Loseforcube1 : MonoBehaviour
{

    public GameObject blueWinPanel;
    public Animator animForBlue;
    // Use this for initialization
    void Start()
    {
        blueWinPanel = GameObject.Find("Blue win panel");
        animForBlue = blueWinPanel.GetComponent<Animator>();
    }

    public IEnumerator WaitTillNextScene()
    {
        animForBlue.SetTrigger("FadeBlueWin");

        yield return new WaitForSeconds(3.9f);
        SceneManager.LoadScene(2);
    }

    void OnTriggerExit()
    {
        if (GameObject.Find("Cube Player 2"))
        {
            StartCoroutine(WaitTillNextScene());

        }
    }
}

sentences:
Problem finding correct value for Yaw I use an Arduino and a 9dof sensor ( gyroscope, accelerometer and magnetometer ) and i'm trying to use the pitch, roll and yaw that the sensor gives me to rotate an object in unity.

I managed to correctly compute pitch and roll ( the z and x axis in unity ) from the accelerometer but it seems that I can't get the Yaw right. By that I mean that when I rotate my sensor pitch or roll it rotates my Yaw too in a weird way.

Code in the arduino to get the heading

void getHeading(void)
{
  heading=180*atan2(Mxyz[0],Mxyz[1])/PI;
  if(heading <0) heading +=360;
}

void getTiltHeading(void)
{
  //float pitch = asin(-Axyz[0]);
  //float roll = asin(Axyz[1]/cos(pitch));
  float pitch = atan( Axyz[0] / sqrt( Axyz[1] * Axyz[1] + Axyz[2] * Axyz[2] ) );
  float roll = atan( Axyz[1] / sqrt(Axyz[0] * Axyz[0] + Axyz[2] * Axyz[2]));

  float xh = Mxyz[0] * cos(pitch) + Mxyz[2] * sin(pitch);
  float yh = Mxyz[0] * sin(roll) * sin(pitch) + Mxyz[1] * cos(roll) - Mxyz[2] * sin(roll) * cos(pitch);
  float zh = -Mxyz[0] * cos(roll) * sin(pitch) + Mxyz[1] * sin(roll) + Mxyz[2] * cos(roll) * cos(pitch);
  tiltheading = 180 * atan2(yh, xh)/PI;
  if(yh<0)    tiltheading +=360;
}

Pitch and roll

    float _Pitch  = (float)(180 / Math.PI * Math.Atan( m_ResultX / Math.Sqrt( m_ResultY * m_ResultY + m_ResultZ * m_ResultZ ) ) );
    float _Roll = (float)(180 / Math.PI * Math.Atan(m_ResultY / Math.Sqrt(m_ResultX * m_ResultX + m_ResultZ * m_ResultZ)));
    float _Yaw = (float)(m_TiltHeadingResult);

Don't hesitate to ask for details.

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:
Making an object orbit using c# script for Unity+Vuforia I have written a simple c# script for Unity+Vuforia. I want to create a simple sample project where an object like a sphere is revolving (orbiting) origin (0,0,0) above image target.

The code I have written is here

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

public class Orbit : MonoBehaviour
{
    float angles;
    float radiuss;
    float angleSpeed;

    // Start is called before the first frame update
    void Start()
    {
        angles = 0;
        radiuss = 0.2f;
        angleSpeed = 1;

    }

    // Update is called once per frame
    void Update()
    {
        angles += Time.deltaTime * angleSpeed;

        float x = radiuss * Mathf.Cos(Mathf.Deg2Rad * angles);
        float z = radiuss * Mathf.Sin(Mathf.Deg2Rad * angles);
        float y = 0;

        transform.position = new Vector3(x, y, z);
    }
}

It works perfectly fine if I am not using it with Vuforia, but when I attach this script as component to an object in Vuforia, it does not work and acts weird.
These are the configurations and hierarchy

Please help me out, I tried a lot of things.

sentences:
Does SDL2 completely encapsulates Direct3D and OpenGL? I'm starting to study game development but the concepts of how the SDL2 lib works are still a bit blurry to me.
I get that both Direct3D and OpenGL are two sides of the same coin. They both are used to draw vectors in the screen and are used as a graphics hardware abstraction layer.
From what I read about the SDL2 lib it seems to be a multi-purpose library that encapsulates some functionalities as user input, threading, networking, window creation, and so on [and also "graphics hardware via OpenGL and Direct3D"].
Now the questions:

The SDL2 webpage states that it provides access to "graphics hardware via OpenGL and Direct3D". What exactly that means?
If I'm making a 3D game do I need to decide beforehand which graphics API I want to use (Direct3D or OpenGL) and use it alongside with the SDL2? If not, does SDL2 completely encapsulates the graphics API so I could easily deploy my game targeting Direct3D or OpenGL without adapting too much code for each one?
In the case SDL2 does not completely abstract the graphics API, what texts and terms should I search to learn how to implement such an abstraction layer using SDL2? I want to be able to easily build for Direct3D and OpenGL.

Thanks very much!

sentences:
How to flip 2d skinned quadruped character? just would like to know is flipping 2d skinned character with one of scale axis good way for left or right movement(flipping direction and animation)?
Normal direction would change.(UPDATED)
for example i have a 2d skinned dog, and i wanna dog move left when i press left with same animation as right direction.
or is there any better way?
Thanks.

sentences:
Component / Entity-based design => no inheritance at all? [I understand that this this could be seen as a rather theoretical question, but I think it has real-application impact].

"Academic" base
With a component-based design one wants to get rid of the long inheritance chains known in larger games ("deadly diamond of death"). So we create a BaseComponent class that handles all the administrative chores (ID and type handling, possibly a generic list of properties, ...).

Now each actual Componentshould inherit from that base [start of academic/dogmatic flair] and only that base [end].

Concrete situation/example:
Assume I have three components with different attributes:

Person: age, name, gender, isTired, isSick, ...
Guest: satisfaction, desires, ...
Employee: current duty, shift end, ...

Now in traditional OOP design, Person would act as the base class for the other two. As I currently "forbid" that type of inheritance for the components in my project, everytime I am e.g. processing my employees and checking/updating their state attributes I have to either use some helper function to access the sibling component Person (if it exists) or send a message out that hopefully Person will be registered for and will process. Or I can simply assume that each Guest and Employee always will have the component Person. But then I might as well let those two components inherit from Person, so they for example both have the member functions to manipulate some specific properties.

Note: There will never be an Entity that has the component Employee, but not component Person (same applies to Guest). They are a fix requirement, which is why I am considering inheritance here at all.

Question:
My question is now whether anyone can see any real-life problems that would be introduced by (re-)incorporating a bit of inheritance into my components other than to a degree violating the original base/dogmatic concept and the risk that (if used excessively) I would end up with the exact same problem the component-based design tried to solve in the first place?

References:
Thread that ultimately led my to asking that question, showing such inheritance.

sentences:
What takes up more processing power between whole character models or models that are pieced together in Unity? In terms of performance when it comes to animation what takes up more processing power: Whole character models or models that are pieced together? (1 object vs multiple objects).

I also wonder if animating multiple objects allows us to get a better overall animation quality instead of working with one object (especially if we deal with action packed scenes).

sentences:
What techniques are useful for modelling Character Actions via OOP? I'm trying to rewrite a legacy php Browser-Based-Game so that it uses object oriented programming.  I find it relatively easy to model concrete nouns, like: new Npc(), new Character(), new Account(), new Clan().

I'm finding it more difficult to model a character's actions.

For example:

usable skills.
a test for whether two characters are multiplayers
attacking another character
test for whether a character is allowed to attack another character
etc.

Have you done something like this, and if so, what overall approach did you use to model the in-between-the-nouns behavior?

sentences:
Anti-cheat Javascript for browser/HTML5 game I'm planning on venturing on making a single player action rpg in js/html5, and I'd like to prevent cheating. I don't need 100% protection, since it's not going to be a multiplayer game, but I want some level of protection.

So what strategies you suggest beyond minify and obfuscation?

I wouldn't bother to make some server side simple checking, but I don't want to go the Diablo 3 path keeping all my game state changes on the server side.

Since it's going to be a rpg of sorts I came up with the idea of making a stats inspector that checks abrupt changes in their values, but I'm not sure how it consistent and trusty it can be.

What about variables and functions escopes? Working on smaller escopes whenever possible is safer, but it's worth the effort?

Is there anyway for the javascript to self inspect it's text, like in a checksum?

There are browser specific solutions? I wouldn't bother to restrain it for Chrome only in the early builds.

sentences:
UE 4.25.3 - can't make layered animations to work I want to make my character's upper body animations not connected to the lower body. For example, I have this set of animations:
Running
Jumping
Crouching
Kick
Sliding
Idle with sword
Sword attack
I need the idle with sword and sword attack animations override upperbody for every other animation, but the slide and kick. So, I want my character to hold his hand with the sword in front and do sword attack even while running and jumping.
I tried using layered animation like in every tutorial on Youtube. I created the upperbody slot, created a montage for my desired upperbody animation, added the Layered blend per bone node in the animBP and set the bone there, but it doesn't work. I don't know if I've missed something.

sentences: How to make collisionshape2D work from other scene in Godot? I have created a scene which contains Area2D, CollisionShape2D & AnimatedSprite. Then I imported that scene into a level. At this moment the player should collide with the object taking it as a obstacle. But it doesn't collide with the coin. How can I make collision work from other scene?

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:
How to alter the angle of texture projection I'm currently working on a 3Dish game; it's on a grid, with 3D props and the camera looking down on the grid at about 45º, but I want to use 2D sprites for the player and NPCs.

Currently, I'm using a quad as a canvas, but I've run into some problems. If the quad is coming up vertically from the floor, foreshortening squashes the player. If I tilt the quad to the same angle as the camera (manual billboarding), the player looks fine but will clip through 3D objects to the "north" from the camera on the grid. I've looked into point sprites but it seems like these would have the same problem.

So, tilting the canvas is out. I need the player to be able to go in front and behind things.

My latest and most promising attempt was to turn the vertical-oriented square canvas into a trapezoid, to compensate for the perspective change. (The canvas is 32x32; at a 45º angle it ended up having a top length of 28.14 and a height of 39.68.) This gets me a square canvas again, but the texture isn't right. It ends up slightly squashed; on nearest-neighbour sampling it loses a row of pixels in the middle (on the character where it's noticeable) and gains one somewhere at the top (above the character's head...)

My maths on the trapezoid might not be exact, but this doesn't really seem like the right answer for keeping things pixel-perfect. Is there a way to use that canvas quad as, I don't know, like a window onto another rendering context which would be pixel-perfect?

Context: This is in Python, PyOpenGL and Pygame; the maximum GLSL version my computer can handle is 120 so it's openGL 3-ish but not quite.

sentences:
Is it legal to use other game's title word in my game's name? Is it legal to use e.g. the word "Fortress" in my game’s title?

There is a game called Team Fortress and I think it’s trademarked. I’m thinking of replacing the word "Team" with another word and using that name in my game (with an intent to make money).

Would I get in trouble?

sentences:
What is causing my default libraries to conflict with OpenGL extensions? So I'm currently following the tutorial for creating OpenGL programs on learnopengl.com,so I'm using GLFW, GLEW and the base library for OpenGL. However, when I go to build my code, I get a warning about how some of my default libraries "conflict with use of other libs; use /NODEFAULTLIB:library". So I went and disabled the appropriate defaults, and I get even more errors.

I'm trying to figure out, what other reason would there be that this error might be caused? From what I can tell, GLFW and GLEW should not experience this warning in the first place. I wouldn't have been too upset, since it compiles properly, however, when I add a third library in (one called soil, for adding images as textures), I get errors straight off the bat.

The libraries I used were from the official websites:

www.glfw.org/download.html (windows 32 bit binaries)

sourceforge.net/projects/glew/files/glew/1.13.0/ (the win32 .zip file)

I've seen people asking about this particular warning before, but the methods given to fixing it don't seem to apply to me :L

Edit: Here's the list of errors

sentences:
Developing interesting game mechanics when not an avid gamer I've realized that though I like playing videogames, I find it much more entertaining to actually make them. This makes me wonder, if I'm planning to develop an [X]* game, do I need to be an avid [X] gamer? How can I develop interesting mechanics if I play that genre sparingly?

In order to get empirical answers, I'm more interested in listening to the opinion of those who have worked/are working in the game industry.  Are you and your co-workers avid gameplayers or "casual" gamers?  What about the Schafers, Carmacks, McGees and Gilberts of the industry (should anyone know any of them :) )?

*being [X] any game genre: Platformer, RPG, RTS, FPS, etc.

PS: I'm trying to make this question as subjective-less as possible, so feel free to point any improvements.

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:
Tips on thinking of a good game mechanic? I am trying to make a turned based rpg and I really want to know how can i make original game mechanics like Undertale with it's sparing system.I am not really that creative to think of a good game mechanic,I just need tips on how to improve my creativity for game dev because it is really hard for me to think of something original.
Thanks!

sentences:
Completely Pixelated Font in JavaScript Canvas? I'm making a game with a canvas scaled up such that each pixel is pretty big. I want to display some pixelated text without anti-aliasing but I have idea how I would accomplish this.

Is there I way can do such a thing?

sentences:
LibGDX input y-axis flipped I'm writing a game in Java for Android using LibGDX, and I connected my phone so I can test it on it.

I know that LibGDX's render system works different than regular Java systems since the 0,0 coordinate is in the lower-left corner, while in java it usually is in the upper-left corner.

But now I use the touchDown method out of the GestureListener class, it's like the regular Java rendering system: when I obviously tap in the left down corner of my screen, I debug-messaged the coordinates and it says it's Y-coordinate is 475, while I render the object at 0,0.

Is there a way to fix this easily?

sentences:
Update TTF Texture for Score I have a little problem with Updating my Score with TTF.
Im a neewbie so dont blame me :P

I Try to Update my Score But the Buffer Get too small after a while and my Game Crashes.

    void CText::Init(const string &_text, int xPos, int yPos, int Width, int Height)
{
    m_Text = _text;
    Font = TTF_OpenFont("arial.ttf", 30);

    SDL_Surface *pTempt = TTF_RenderText_Solid(Font, m_Text.c_str(), color);
    Texture = SDL_CreateTextureFromSurface(m_Renderer, pTempt);

    m_xPos = xPos;
    m_yPos = yPos;

    m_Rect.x = xPos;
    m_Rect.y = yPos;
    m_Rect.w = Width;
    m_Rect.h = Height;
    SDL_FreeSurface(pTempt);
}

void CText::RenderScore(int Score)
{
    sprintf_s(Buffer, "Score: %i", Score);
    SDL_Surface *pTempt = TTF_RenderText_Solid(Font, Buffer, color);
    Texture = SDL_CreateTextureFromSurface(m_Renderer, pTempt);
    SDL_RenderCopy(m_Renderer, Texture, NULL, &m_Rect);
    SDL_FreeSurface(pTempt);
}

//Game Loop
if (lastscore != currentscore)
        {
            m_Text->Destroy(); //<-- This is SDL_DestroyTexture(Texture);
            lastscore = currentscore;
        }else{
        m_Text->RenderScore(currentscore);}

It shows my score and Updetes it too but I have my char Buffer[50] and after a while it runs out of memory. And i free my font and texture in the destructor.

I thank everybody who helps me out there

sentences:
How do I sign up and download CryENGINE? I cannot sign up for Cryteks CryENGINE, at this site. When I click on the "sign up and download" button, nothing happens. I would ask this on their forums, but for that, you need an account.

How do I sign up and download CryENGINE?

sentences:
Underwater Shader Animation Help I found an underwater (distort) effect and I got it to work but somehow I cannot make it animate given the offset here:

Fragment Shader code:

uniform sampler2D fbo_texture;
uniform float offset;
varying vec2 f_texcoord;

void main(void) {
  vec2 texcoord = f_texcoord;
  texcoord.x += sin(texcoord.y * 4*2*3.14159 + offset) / 100;
  gl_FragColor = texture2D(fbo_texture, texcoord);
}

Original Source here

sentences:
Testing spheres without extracting planes I am currently a bit stuck. On OpenGL I am attempting to do view frustum culling,
so far I managed to do it by using a PCM.
Where center is the world position of the mesh.

bool shouldRenderMesh(mat4 VP, vec3 center, float radius)
{
    vec4 transformedCentre = VP * vec4(center, 1);
    vec3 PCN = vec3(
        transformedCentre.x / transformedCentre.z,
        transformedCentre.y / transformedCentre.z,
        transformedCentre.z / transformedCentre.z
        );
    if( abs(PCN.x) > 1 || abs(PCN.y) > 1 || abs(PCN.y) > 1 )
    {
        return false;
    }
    return true;

The problem is, while the approach works, items will disappear too soon, as the testing is based on the centre point of the mesh, rather than the bounding box.

Is it possible to test a sphere or box without extracting planes?

Thanks

sentences: How do I draw a full screen quad in DirectX 11? How do I draw a full screen quad that shows red on the screen?

sentences:
How much logic should be in an individual behaviour tree node? Let's say I have a condition node which has to spend a lot of time calculating something to finally return a bool to the behavior tree.
But in the following action, we need this information again.
I now have a few options:

I could just calculate the information again. That could unnecessarily take a lot of time and may result in redundant code.
I could save the information into some kind of state data dictionary but now the action depends on calling the condition first.
I could make it a single action that would just fail if the resulting calculation would end up being False. I would possibly end up with a bunch of very similar, very complex actions. Again possibly a lot of unnecessary redundancy.

How do I tackle something like that?
Is there a pattern that I could apply to the action/condition design (or whatever) or inside the behavior tree implementation that solves this?
Or am I using behavior trees wrong entirely?

sentences:
MonoGame creates a copy of song files in XNBs location I'm having a problem. I've been adding .wma files to the Content Pipeline app to be used as my game's background music. But today when I opened the solution/project/content/bin/music folder I spotted the following:

So am I forced to ship the .wma files with the actual XNBs when I distribute my game? No other asset gets copied like this so how do I prevent songs from being copied as well?

If I delete the .wma files manually then the next time I build the project they get automatically added again :/

sentences:
How to make the AI Chase in Multiplayer Im Currently develop a little Dungeon Crawler. The Singeplayer works fine, but it also should have multiplayer so i implemented it. But there's one problem. I have no idea how to make the AI chase the player and the other players. In singleplayer it works like this :

if(distanceToPlayer <= 400f){

   entity.chase(playerEntity);

}

Heres my full chasing code :

// in enemy update method i put all multiplayers into a map with their login number..

 // Pick a random Multiplayer and chase him

        boolean isAvaible = false;

 //Convert Map to Object array
        Object[] values = ((EnemyEntity)arg0).mpSortedPos.values().toArray();

        int rdm = 0;

        float randomValue = 0;

        // wenn map isnt empty
        if(((EnemyEntity)arg0).mpSortedPos.size() > 0){

            rdm = generator.nextInt(values.length);

            randomValue = (float)values[rdm];

            isAvaible = true;

        }

        //selecting the key
        // +2 because the first joined player is the second Player in the game so it begins with connection 2, the second with 3 and so on.
        int key = rdm + 2;

        // Only printing stuff
        System.out.println("Found a Map : "+((EnemyEntity)arg0).mpSortedPos + "Size of da HashMap : "+ ((EnemyEntity)arg0).mpSortedPos.size());
        System.out.println("Found a Random Value : "+rdm + " "+randomValue );
        System.out.println("Found a Key: "+key + " "+((EnemyEntity)arg0).mpSortedPos.get(key) );

        // When the multiplayer is near the enemy than
        if (/*((EnemyEntity)arg0).distanceToNextPlayer < 400 && arg0.isAlive() == true */ isAvaible && ((EnemyEntity)arg0).mpSortedPos.get(rdm) != null && ((EnemyEntity)arg0).mpSortedPos.get(rdm) < 400) {

            ((EnemyEntity)arg0).activated = true;

            arg0.stateMachine.changeState(CHASE_ENTITY);

        }

This is my code for multiplayer chasing but it doesnt work ... any ideas ? What could i improve ?

But how should i do that with multiple players ? Any ideas ? :)

sentences:
Godot Particles Randomly Turn Off I have a particle emitter on a rocket just to simulate some smoke. The rockets can be free-fired or lock onto a target and gradually steer towards the target. There is an issue that I can't seem to fix. When the rockets steer too sharply from their original trajectory the particle emitter turns off. Printing trail_particles.emitting shows true. GIF illustrating this issue:

I can share code, though I'm not sure which part would be relevant since I don't access the particle emitter in code.

sentences:
Duplicating Images in SFML I was wondering how one would go about duplicating the same sprite in SFML, instead of having to create new sprites every time I would want have another sprite of the same image. Just some basic thought process or pseudo-code is what I'm looking for.

Thanks.

sentences: Is it legal to use the name of an existing game? I'm planning on creating an iPhone game titled "Guess Who!". I know there is already a board game with the same title (linked here) so I'm wondering it is legal for me to use this title for my game. Will the game get pulled off of the App Store if I use it? Thanks in advance.

sentences:
How can I remove the view and projection matrix from ray position to get only the ray model? I've got a little problem with my picking module and I need your help.

I have a method to project a ray from the camera to a fixed point when I click somewhere. The computed ray looks good, it go to the asked direction and passes through the pointed box, so I'm thinking everything is OK here.

When I'm trying to pick an object a little further from the origin, there is no intersection found.

I'm sure that the ray is correctly projected and computed to the screen (I draw it) but coordinates are bad during intersection test.

Currently, I compute the ray with this code :

const glm::vec3 position    = glm::vec3( mouse.x, mouse.y, 0.f );
const glm::mat4& view       = camera.getViewMatrix();
const glm::mat4& projection = camera.getProjectionMatrix();
const glm::vec4& viewPort   = camera.getViewport();

ray.origin =  glm::unProject( glm::vec3(mouse.x, mouse.y, 0.f ),
                                        modelView,
                                        projection,
                                        viewPort );

ray.direction =  glm::unProject( glm::vec3( mouse.x, mouse.y, 0.f ),
                                            modelView,
                                            projection,
                                            viewPort );

So, I think the ray origin and direction are computed to world position (with camera matrix: projection and view).

When I test intersection, I use object model (without camera transformation), so I'm thinking error is here.

The question:
How can I remove view and projection matrix from ray position to get the ray model only ?

Thanks a lot!

PS: To test intersection, I create a bounding box from my object's model matrix and I test intersection with the ray computed previously.

EDIT:

Code to compute ray positions in world space :

////////////////////////////////////////////////////////////
bool computeRayPositions( Ray* ray )
{
    glm::vec3 start = ray->getOrigin();
    glm::vec3 end   = ray->getDirection();

    glm::mat4 startMatrix   = glm::translate( glm::mat4(1.f), start);
    glm::mat4 endMatrix = glm::translate( glm::mat4(1.f), end);

    const glm::mat4& viewMatrix       = camera->getViewMatrix();
    const glm::mat4& projectionMatrix = camera->getProjectionMatrix();

    glm::mat4 startWorldMatrix  = startMatrix * glm::inverse(viewMatrix * projectionMatrix) ;
    glm::mat4 endWorldMatrix    = endMatrix * glm::inverse(viewMatrix * projectionMatrix);

    ray->setOrigin( glm::vec3 (startMatrixFinal[3][0], startMatrixFinal[3][1], startMatrixFinal[3][2] ) );
    ray->setDirection( glm::vec3 (endMatrixFinal[3][0], endMatrixFinal[3][1], endMatrixFinal[3][2] ) );

}

sentences:
GML: check ds_queue or ds_stack for equality (identical contents) Is there a nondestructive way to check whether two queues or stacks contain identical values? For example:

foo=ds_queue_create();
ds_queue_enqueue(foo, 1);
ds_queue_enqueue(foo, 2);

bar=ds_queue_create();
ds_queue_enqueue(bar, 3);
ds_queue_enqueue(bar, 1);
ds_queue_enqueue(bar, 2);
ds_queue_dequeue(bar);

return(equality_test(foo, bar));

should return true

Options I know of:

foo == bar returns false, presumably because it's checking whether they point to the same queue as opposed to having the same values.
ds_queue_write(foo) == ds_queue_write(bar) seems to be sensitive to the queues' histories. If I just enqueue [1,2] on each queue, it gives true. But because I added and then dequeued an irrelevant value on bar, the serialized strings differ even though the current values are identical.
Iterating through the items one at a time and checking equality works for arrays, but doing this using ds_queue_dequeue destroys the queues. Is there a nondestructive way to read elements of a queue, other than the head and tail?
Per liggiorgio's comment below, I could duplicate the queues with ds_queue_copy and destructively iterate over the duplicates -- is this the best way?

As far as I know the same issues apply to stacks.

sentences: Does `SetResourceArray` copy the data into the GPU? I am trying to create multiple textures, and only several of them change every few frames. I don't want to have to copy in the whole array via SetResourceArray for just a few textures that change, which brings me to my quesiton: Does SetResourceArray copy the data into the GPU?

sentences:
Blender For Game Development, Pros And Cons Blender is one of those applications that you either love or hate. I know it is great for 3D modeling and and animations and there is a lot said about the UI and its steep learning curve.

I am more interested in how Blender stands out as far as Game Development goes. So my question is, what would be the Pros and Cons of choosing to use Blender to develop a high performance 3D game?

sentences:
Unity - RageTools Performance Has anyone used RageTools for Unity? What do you know about the performance? Is it more performant than using raster, for example with "puppet 2d" or the other way?
I'm developing mobile games, so performance is very important for me.
Thank you!

sentences:
Water shader in Unity3D not working on some Linux distributions/some Mac OS? I've got reports from some Linux users that the game's water isn't rendered on his machine.
3 example operating systems:

Ubuntu 20.04 (with kernel 5.4.0-54-generic x86_64

Linux 4.15 Linux Mint 19.2 64bit

Mac OS X 10.13.6

I use this shader: https://roystan.net/articles/toon-water.html
I've made a small change so I can use it in orthographic projection as well:
            float existingDepthLinear = 0;

            if (unity_OrthoParams.w > 0)
            {
                // orthographic camera
            #if defined(UNITY_REVERSED_Z)
                existingDepthLinear = 1.0f - existingDepth01;
            #endif
                existingDepthLinear = (existingDepthLinear * _ProjectionParams.z) + _ProjectionParams.y;
            }
            else
            {
                // perspective camera
                existingDepthLinear = LinearEyeDepth(existingDepth01);
            }

            // Difference, in Unity units, between the water's surface and the object behind it.
            float depthDifference = existingDepthLinear - i.screenPosition.z;

I've got a feeling that
            #if defined(UNITY_REVERSED_Z)
                existingDepthLinear = 1.0f - existingDepth01;
            #endif

is what causing the issue.
When I remove it, on my PC, which was working well until now, the whole surface will be just foam. So plain white. Just like on their computers.
So maybe UNITY_REVERSED_Z is not defined?
What could cause this issue? Feel free to ask for more info, maybe I can provide.

sentences:
How to set rotation of a projectile in a parabolic arc in Box2D? I have trouble making my projectile - in this case an arrow - rotate as it should when it's travelling in a parabolic arc. It doesn't rotate at all while travelling, only until it collides with something.

Below is the relevant code I'm using.

public class Arrow extends BodyDef{

private Body body;

public Arrow(float x, float y, float halfWidth, float halfHeight, float rotation, float velocity) {
    type = BodyDef.BodyType.DynamicBody;
    position.set(x, y);
    angle = rotation;

    body = Box2DTest.world.createBody(this);
    PolygonShape shapeShaft = new PolygonShape();
    shapeShaft.setAsBox(halfWidth, halfHeight);

    /* Creation of the shaft of the arrow */
    FixtureDef fixtureShaft = new FixtureDef();
    fixtureShaft.shape = shapeShaft;
    fixtureShaft.density = 6.5f;
    fixtureShaft.restitution = 0.4f;
    body.createFixture(fixtureShaft);

    /* Creation of the tip of the arrow, note the higher density */
    PolygonShape shapePoint = new PolygonShape();
    float[] shapePointV = {
            halfWidth, halfHeight * 2,
            halfWidth * 1.5f, 0,
            halfWidth, - halfHeight * 2};
    shapePoint.set(shapePointV);

    FixtureDef fixturePoint = new FixtureDef();
    fixturePoint.shape = shapePoint;
    fixturePoint.density = 26.0f;
    fixturePoint.restitution = 0.05f;
    fixturePoint.friction = 0.5f;
    body.createFixture(fixturePoint);

    body.applyLinearImpulse(MathUtils.cos(rotation) * velocity, MathUtils.sin(rotation) * velocity,
            body.getWorldCenter().x, body.getWorldCenter().y, true);

    //body.applyTorque(-90.0f, true); <-- My attempts to fix this but still doesn't work well
    //body.applyAngularImpulse(-0.5f, true);
    shapeShaft.dispose();
    }

}

The Box2DWorld is initialized as such:

  world = new World(new Vector2(0, -9.8f), true);

Here's a picture explaining how it looks and what I want to achieve (Courtesy of vilbeyli in github):

I have also attempted to apply the initial impulse in the bottom-left corner of the arrow but the resulting spin is very imprecise and random.

Why doesn't the heavier tip make the arrow rotate by itself?
How can this be fixed?

sentences:
Detecting collision between a sprite and many tiles I have been looking at the following question:- Tile coordinates and am thinking of using this for collision detection in my tile game.

The set up in my game is similar to this, in that there is a grid of tiles, and the sprite will move to (x,y) coordinates. However, if I were to have an object such as a box in my world that is made from multiple tiles, how would I get the collision detection to work?

Any ideas welcome.

sentences:
Canvas tile grid, hover effects, single tilesheet, etc I'm currently in the process of building both the client and server side of an HTML5, canvas, and WebSocket game.

This is what I have thus far for the client: http://jsfiddle.net/dDmTf/20/

Current obstacles

The hover effect has no idea what to put back after the mouse leaves. Currently it's just drawing a "void" tile, but I can't figure out how to redraw a single tile without redrawing the whole map.
How would I go about storing multiple layers within the map variable? I was considering just using a multi-dimensional array for each layer (similar to what you see as the current array), and just iterating through it, but is that really an efficient way of doing it?
Currently the "borders" encroach on one another. I'm not sure what I'm doing wrong? If you hover over and off of the bordering "tree" tiles, you'll notice how it removes part of the neighboring tiles border. This shouldn't need to happen.
Outside of the map, what would be an elegant way of adding Players to the render scene? I've seen a few places that recommend you use multiple canvas's, would you recommend that since they'll probably be moving much more? In addition to that, how can I confine player movement to the grid, similar to how in the pokemon gameboy games, when you tap the left arrow, you always move one "space" that direction. It's not a halfway type deal.
Camera. What would be a good way about adding a "camera" to the equation, so the viewport can pan around a larger map area?
Obstacles. In the newer version of the map, you'll notice an empty obstacles array. Assuming players get added well, what do you think would be good for adding movement obstacles?

Side note

The tile sheet being used for the jsfiddle display is only for development. I'll be replacing it as things progress in the engine.

If you guys have any pointers for my JavaScript, feel free. As I'm more or less learning advanced usage as I go, I'm sure I'm doing plenty of things wrong.

Note: I will continue to update this post as the engine improves, but updating the jsfiddle link and updating the obstacles list by striking things that have been solved, or adding additions.

Edit

Updated link from http://jsfiddle.net/dDmTf/7/ to http://jsfiddle.net/dDmTf/17/ - this handles the "hover" problem, and it's been striked out.

Edit

Updated link from http://jsfiddle.net/dDmTf/17/ to http://jsfiddle.net/dDmTf/19/ - fixes the out of bounds issue with the tiles

Edit

Updated link from http://jsfiddle.net/dDmTf/19/ to http://jsfiddle.net/dDmTf/20/ - adds multiple layers to the equation

sentences:
JavaScript rendering: Canvas or DIV? I am planning on developing a multiplayer RPG (kinda like RuneScape, but don't worry, with a different gameplay) and i want to do this in the browser. Now before saying things like "A MMORPG is hard to make" or "Others tryied that too" please keep in mind that i am not dreaming at a huge game, it's just an idea that i want to see "breathing".

The reason i choose JavaScript and HTML5 over other technologies is that i have some experience in web development (which of course includes a deep understanding of JS).

I've looked over some libraries (or so called engines) on the web and i've found some that  might have what i need.

My question is: What is the best way to render this kind of game in the browser, also could you suggest me the library that you think is the most suitable for this kind of job?

sentences:
Gamemaker - Change the fired bullets' direction using objects as guide So I am trying to create a shooting-ship-puzzle game at sea on gamemaker. There is a playership that must shoot the enemy ships using only the available "whirlpools". There are many whirlpools in the sea, but there is only one path consisting of whirlpools that will lead the bullets to the enemy ships and destroy them. There are different types of whirlpools, one that can direct the bullets using 90 degrees angle, U-turn whirlpool, etc. But my problem is how to change the direction of the fired bullets using those whirlpools. So can you guys maybe help me out with this problem...?

Thanks,

sentences:
Visualize quaternion euler angles without gimbal lock I fusion ACC and GYRO data with Mahony algorithm, and then I want to show a line chart representing roll pitch and yaw to the user, so they can understand the degrees. As you can imagine, gimbal lock comes in at 90 degrees.

I also have an activity where the user can see a cube rotating correctly, having quaternions as input.

Is there a way to visualize the angles in degrees without gimbal lock? I can only manage to show an OpenGL shape rotating correctly, but my goal is to show the degrees.

sentences:
Load texture from different thread I am trying to load textures from a different thread but it fails everytime on this following method:

D3DX10CreateShaderResourceViewFromFile

Turning off my multithreaded routines make the textures load correctly.

How do I allow the device to load from a texture from a different thread?

sentences:
How can I represent prerequisites of different type of game objects? In a strategy game, I want to declare prerequisites for various types of game objects to limit when they can be acquired/executed: technologies, buildables, resources, actions, etc. Any of these types could have prerequisites from any other type.

Examples:

Training unit U requires technology X to be known, a building Y present in the city, and a surplus of resource Z available.
Starting research on technology T requires technologies A and B to be known, and a source of resource C available.
Construction wonder W requires 5 instances of building D in that player's cities and no other instance of W in existence.

The difficulty here is that each type of object meets the prerequisite in a somewhat different way. Technologies are known to a player or not, while buildings may exist in a given city, and resources could be present but not exploited or already claimed.

Is there a way I can generically describe such a prerequisite feature that can include any combination of semantically different game objects? This structure would have to determine, given a context, whether all prerequisites are met, and if not what is missing.

sentences:
How to stop reinitialization in Gamemaker Studio Situation: This is a problem that I don't know if it is actually a problem yet: I've got initialization of variables like food, stamina and so forth, in an object called obj_Global_Variables, on its Create Event.

Question: How do I stop it from reinitializing said global variable each time the room is opened? (which, I assume, creates the objects in the room again).

sentences:
Massive CPU Usage by WaitForTargetFPS in the Profiler So I was checking the Standard Assets Example Projects of Unity, and they all have high FPS numbers in the Profiler.

I started a little project myself, just a simple sprite with movement via rigidbody and a plane as a floor, and suddenly this:

I searched for what exactly does WaitForTargetFPS represents, but apparently there is not a general consensus about what can cause such high CPU usage. So why exactly such a little and simple project have this performance (in contrast with the more complex Unity Example Projects)?

sentences:
How to add a volume bar like YouTube for iOS? I am almost done with my game in Unity 5. However when the player presses Volume Up/Down, the iOS (version) shows the standard UI to show volume. Android has it's own (looks better on Stock).

I want to make my game consistent on either platform and different variations of Android. So I want to recreate how YouTube (for iOS) handles the change in volume.

I can't figure this out. Any help would be awesome!!!

sentences:
Javascript 2D game tile textures I am using a texture atlas for my tiles. Of course I need to get the sub-images to draw them on the canvas as separate tiles. Right now I can think of two ways to implement this.

Divide the texture atlas into separate Image instances. Then draw them onto the canvas accordingly.
Use a single image, and just draw part of it by adding extra parameters to CanvasRenderingContext2D's method `drawImage.

I'm not sure which is better. My thoughts were that the first option would be more manageable and flexible, since each tile is separated. What would be better? What are the ups and downs of each?

sentences:
Put objects on a 2D maps using a matrix of distances Is that possible to put objects in a 2D map using only a matrix of their relative distance ?

An example would be putting cities on a map using the distances between them. There would be a minimum of 4 cities.

Thanks a lot.

sentences:
Using index arrays with OpenGL VBOs I've recently started reading about VBOs.

If, for example, I want to draw a cube using VBOs, can I use one VBO to hold the coordinates for the 8 vertices, and another one as an index array, to specify the order in which the vertices are drawn?

If it's possible I'd appreciate some help on the matter, or a link to good tutorial you may know on the subject.

Thanks.

sentences:
Pathfinding, 2+ tiles wide I recently started learning python and I'm working on a dungeon generator, using images for the rooms, hallways and junctions. Example of desired result.

So far I managed to generate a X * Y map and avoid the rooms from escaping the background image or colliding with each other (collision test); I was going to work on pathfinding to generate the corridors but ran into a problem. As you can see in the first image, some corridors and junctions are 1-tile wide while others are 2, and potentially wider.

Ideally I would use the generated grid to see where the corridors would go and "paste" whichever corridor or junction image would fit in that space.

Any tips on how to incorporate that into the pathfinding algorithm?, or if you have a better idea to generate the corridors, I'm all ears. Perhaps generating a single room, growing a corridor from there and adding a room at the end of that corridor, rinse and repeat?

sentences:
What is an acceptable receive rate for a client? I've noticed that syncing a transform( in Unity, so a Vector3, and a Quaternion ) ends up being close to 1000 byes per second received on a client( send rate of 20hz ). Multiply this by a generous 20 entities a single match might have and that's about 15k-20k bytes per second.

Is this too much? What should I be aiming for? What data rates do games typically have?

sentences:
Unity3D - Button Slicing Problem I'm having trouble getting my button to appear correctly, as you can see in the image below, the right and top sides are stretched out and not displaying properly. I cannot figure out if this is a problem with the image itself or something wrong in the way I'm setting up the button.

Here are the settings in the inspector window:

Here is the original image:

UPDATE: So everything looked fine when I just opened up Unity, so I tried to figure out what I did last time for it to make this switch. It happens when I build and export the scene to my Android device.

sentences:
How to draw the simplest grid map OpenGL 1.0 I want to draw a simple black & white grid map, like that:

I have been searching for a way to generate tile, a tile map and tho and I want to draw this map and thats all. I mean that I want to draw it only once so it should be easy.
I use OpenGL 1.0. How can I draw that and how should I draw - should I draw an Image and place it  like a map, should I draw a tile and multiple it ?

sentences:
Inconsistent jump height I am doing some physics for a platformer game in MonoGame. The jump height changes based on FPS even though I'm using delta time. When the FPS decreases and gravity is added before movement, the jump height is shorter than usual. How do I keep a consistent jump height at all frame rates?

Here's the pseudo-code executed each frame:

velocity.Y += gravity * dt;
Move(velocity * dt);

sentences:
Map logical coordinates to graphical for walking I'm having a problem with mapping logical coordinates to graphical ones when my character is walking. I've been able to map them without the graphical walking in between, i.e it just "jumps" from one tile to the other.

The logical coordinates are represented such as [0,0], [0,1] etc. and a character can only
be in one of these tiles at a time. I want my character to graphically move from one tile to the next at a given speed/pixels per rendering update until it hits the logical tile's graphical position.

If I didn't phrase myself good, please don't be afraid to tell me.

sentences:
How to read BC4 texture in GLSL? I'm supposed to receive a texture in BC4 format.
In OpenGL, i guess this format is called GL_COMPRESSED_RED_RGTC1.

The texture is not really a "texture", more like a data to handle at fragment shader.

Usually, to get colors from a texture within a fragment shader, i do :

uniform sampler2D TextureUnit;
void main()
{
   vec4 TexColor = texture2D(TextureUnit, vec2(gl_TexCoord[0]));
(...)

the result of which is obviously a v4, for RGBA.

But now, i'm supposed to receive a single float from the read.
I'm struggling to understand how this is achieved.

Should i still use a texture sampler, and expect the value to be in a specific position (for example, within TexColor.r ?), or should i use something else ?

sentences:
How to animate a character from a sprite sheet? I'm making an online game, and I had been using a blank square as the character until recently. Now I want to add a real, animated character.

I downloaded a free sprite sheet which has 12 (3x4) character sprites.

What is the general method to animate the character?

I see why having all the character animations in one file can be useful, but I don't understand how it would be done. I don't want code or anything, I just want to know how you normally use the sprite sheet to animate a character so I code it afterwards.

sentences:
What are the practical limitations of using XNA? Since development on XNA has long since stopped, it is unlikely that it will ever be updated to be in line with modern graphics technology, however aside from the obvious fact that it's Windows-only - what are the practical limitations of using XNA?

The obvious ones are:

It uses DirectX 9.0 - which means no compute or geometry shaders.
It's Windows-only (Excluding Monogame/FNA)
It requires the installation of .NET and XNA on a client's computer.

#2 and #3 are obvious limitations, but can be considered acceptable. #1 on the other hand, is a bit more complicated. In practical terms what does being limited to DirectX 9.0 mean in terms of game development and graphical capability? No geometry or compute shaders means having to do more heavy lifting on the CPU, but is there any other limitations that an end user would notice? Ideally beyond a generic term such as "graphical fidelity".

sentences: How to programmatically disable sprite renderer and mesh renderer in Unity3D? In my game, I have an empty GameObject that has a sprite and a TextMesh as child. I want to access the child (sprite and the text mesh) and turn off the sprite renderer and mesh renderer of the sprite and the text mesh programmatically and be able to then turn it back on, but I don't know how. Some help and/or sample code would be much appreciated. Thanks.

sentences:
Point rotation around point, accuracy question I study OpenGL ES 2.0. But I think it's more a C++ question rather then an OpenGL one.

I am stuck with the following rotation question: It is known, that rotation transformation can be applied using these equations (for simplicity suppose we rotating around (0, 0)):

x'=x*cos(theta)-y*sin(theta)
y'=x*sin(theta)+y*cos(theta)

But it seems that when I perform this rotation operation several times, the accuracy problem occures. I guess that the core of this problem is in uncertain results of cos() function and floating point limitations. As a result I see that my rotating object is getting smaller and smaller and smaller. By the way I am using C++.

1.) What do you think: Is this issue really connected to the accuracy problem?

2.) If so, how can I handle this?

Thanks.

sentences:
Ball Speed is not increasing as per code I am working on small project , but now I have a problem . The problem is The Player speed (Ball speed) is not increasing as per the code .

In the beginning ball speed increases , but as the time goes the speed becomes constant .

I made Gravity as -50 in Y - Axis .

So here is the C# Script attached to the ball :-

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

public class Ball_Script : MonoBehaviour
{

// Ball Physics Variables
private Rigidbody Ball_Rigid;
public float Ball_Speed = 10f;
private float Speed_Change_Time = 1.0f ;

// UI Text
public Text My_Ball_Speed_Text ;
public Text My_Key ;

// Use this for initialization
void Start ()
{
    Ball_Rigid = GetComponent<Rigidbody>();
    My_Ball_Speed_Text.text = Ball_Speed.ToString () + " km/h";
    My_Key.text = "No Key Pressed";
}

// Update is called once per frame
void Update ()
{
    // Restart game
    if(transform.position.y < -7.0f)
    {
        Application.LoadLevel(0);
    }

    // Ball Automatic Movement script Starts here
    Speed_Change_Time_Interval ();
    Ball_Rigid.AddForce (new Vector3 (Ball_Speed * -1 * Time.deltaTime, 0, 0));
    // Ball Automatic Movement script Ends here

    if(Input.GetKeyDown(KeyCode.LeftArrow))
    {
        Ball_Rigid.MovePosition(new Vector3(transform.position.x , transform.position.y , transform.position.z - 1.0f));
        My_Key.text = "Left Arrow Pressed";
    }

    if(Input.GetKeyDown(KeyCode.RightArrow))
    {
        Ball_Rigid.MovePosition(new Vector3(transform.position.x , transform.position.y , transform.position.z + 1.0f));
        My_Key.text = "Right Arrow Pressed";
    }
}

// This Fixed update stops the ball from bouncing
void FixedUpdate()
{

    Vector3 currentVelocity = Ball_Rigid.velocity;

    if (currentVelocity.y <= 0f)
        return;

    currentVelocity.y = 0f;

    Ball_Rigid.velocity = currentVelocity;
}

// This function increases the ball speed in every 1 second
void Speed_Change_Time_Interval ()
{
    Speed_Change_Time = Speed_Change_Time - Time.deltaTime;

    if(Speed_Change_Time <= 0)
    {
        Ball_Speed = Ball_Speed + 10;
        Speed_Change_Time = 1.0f;
        print(Ball_Speed);
        My_Ball_Speed_Text.text = Ball_Speed.ToString ()+ " km/h";
    }
}
}

Here FixedUpdate () stops the ball from bouncing and  Speed_Change_Time_Interval () function  increases the ball speed in every second . But it works some extent . Then there is no change in speed of the ball . Here is the video of the game ( Recorded with Jing , so file is in .swf format . Sorry for that :( ) Link :- http://www.mediafire.com/download/ibk4ffjm3y6i96y/Ball_Vid.swf

File size = 9.28 MB

So what is the problem of this script . If my method is wrong / not good please suggest me a good one :).

Hope you will help me to figure it out .

Thanks ,
Regards

NB :)

sentences:
Techniques for managing vertex buffer memory I'm learning OpenGL and I haven't seen any advice on managing vertex buffers in all of the tutorials I've read.

The basic problem is that I have some memory allocated as a buffer B in which I'm going to store vertex data to send to the graphics card.

Then I have the data that represents my domain D. This is the data that the game's simulation is run against. Let's say in a simple case it's just a list of 100,000 circles that will be moving around. Let's also assume that all of the data can, but might not, change every frame. Nothing is necessarily static.

I'm looking for the techniques people use to efficiently fill B with D.

I could create a new B each frame, but I imagine that would be very expensive.

I could give every object in D a pointer to a location in B and have it update that pointer directly, but that strikes me as error prone as then I have to manage all of these pointers.

I could also traverse D and fill a reused B every frame. This is what I'm currently leaning towards. The only problem here is that I'm forced to update every vertex in B every frame (because the location of the vertex data for a particular D could change within B) unless I come up with a more sophisticated scheme that guarantees that that an object in D always gets the same spot in B.

So I can think of several options, but I'm wondering what people typically do. I imagine almost everyone has to solve this problem at some point.

sentences:
Unable to use Maya animation with scripts when imported to Unity I am testing to import Maya animation over to Unity. I set up a simple cylinder with 2 bones and an IK handle. Made a simple animation where the cylinder bends and goes back to straight position over 24 frames.

Following that, I selected everything and baked, all bones,ik,(animation by selecting all at the graph editor) and even the cylinder. I saved the scene and then select all and export as FBX with animation and bake checked.

In unity imported it and at the preview able to see the animation. When I load the model into scene and play (after assigning the controller), able to see animation too.

But now when I try to script it and control the animation, nothing happens. Even to test, I tried the following under the Update method.

if(animation.isPlaying)
    Debug.Log("Animation Works");
else
   Debug.Log("Animation not working");

The bool doesn't even return true nor false. My animation is called "bend", thus just for try I did the following and nothing happens.

animation.Play("bend");

Can please advice based on my steps, am I missing something. Do I need to add the controller or is that an unnecessary step? Did I screw up on the Maya part or the Unity part. Thanks for help.

sentences:
Character doesn't move. I think I've tried everything, so I'm asking [Unity3D] The animations are playing fine, however I can't manage to move my character.
My script:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

    public float turnSmoothing = 20f;
    public float speedDampTime = 0.1f;
    public float jumpHeight = 8.0f;

    private Animator anim;
    private Rigidbody rb;
    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator>();
        rb = GetComponent<Rigidbody>();

    }

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

    }

    void FixedUpdate()
    {
        float h =- Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");
        MovementManagement(h,v);

    }

    void MovementManagement (float horizontal, float vertical)
    {
        if (horizontal != 0.0f || vertical != 0.0f)
        {
            anim.SetBool("Move", true);
            anim.SetFloat("Speed", 6.0f, speedDampTime, Time.deltaTime);
            Rotating(horizontal, vertical);

        }
        else
        {
            anim.SetFloat("Speed", 0.0f);
            anim.SetBool("Move", false);
        }

    }

    void Rotating (float horizontal, float vertical)
    {
        Vector3 targetDirection = new Vector3(horizontal, 0.0f, 0,0f); //2.5D I just want to move on the x-axis atm
        Quaternion targetRotation = Quaternion.LookRotation(targetDirection, Vector3.up);
        Quaternion newRotation = Quaternion.Lerp(rb.rotation, targetRotation, turnSmoothing * Time.deltaTime);
        rb.MoveRotation(newRotation);
    }

}

My character's inspector:

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:
Optimizing UV Map Sheet Based On Surface Area? I am trying to get my UV Map Sheets Optimized Based On Surface Area , I need Them optimized cause my scene area is huge and i want to use them in UDK so i am trying to get maximum possible optimization and i am running out of time

Here is What i Try TO Achieve :

Default 3DS Max :

Optimized By HAND THIS IS WHAT I WANT  Or Even Better If There Is Automated Intelligence Tool

Also I know this Tools Flatiron , UVPacker But They Are No Use

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 can I disable the green frames after a cinematic in UDK? These green frames appear in my scene after the display of a cinematic (which I just added recently):

How can I remove them, ideally without resorting to transitioning the game mode?

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:
The tolareable lag range in a multiplayer game I am programming a multiplayer game. I calculate the ping in ms as :

ping = the_time_i_recieved_pong - the_time_i_sent_ping

I implemented client-side prediction and interpolation algorithms. When I test the game with my friends, it works quite fine for those who have a ping under 100ms, but after 120ms it becomes unplayable as they have told me. So my question is wheter I should try to improve the client's game experience under a latency more than 120 ms or not ( is a lag >120ms considered tolerable ? )

Thank you all !

NOTE : My game is a fast-paced game so the lag compensation matters.

sentences:
How can I fix my sprite being rotated 90 degrees more than toward the mouse? I am trying to get a Sprite in LibGDX to look at the player's mouse. Here's the code I have (mind you, I am using JRuby):

target = mouse_position.sub(spatial.position)
rotation = MathUtils.atan2(target.y, target.x)
spatial.rotation = rotation * MathUtils.radiansToDegrees

This is definitely doing something, but it's not completely correct. Here's a GIF of what it looks like in action:

Where am I going wrong?

sentences:
What models am I allowed use when selling my game? I have purchased models through Daz3D, and I have downloaded a lot, for free. The 3D models were downloaded as .MMD or .FBX.

How do I tell if I can edit or use any of these models, in my game? When I sell my game, will I need a license to include these models?

sentences: Doubts on player movement strategy What I want to achieve is the player moving to the touched position on a 2D grid-based game, stopping at the last reachable spot if the target position is unreachable. What is the strategy usually adopted in these cases? Should I implement a specific path finding algorithm for the player?

sentences: Knockback when shooting I am currently working on a shooter and I could use some help with this. I want to make my character knock back when he shoots, but also the knock back should be different when the player uses a different weapon. How can I do this?

sentences:
Batching Homogeneous Render Objects in XNA, 2D Component-Entity Engine? I've been working on my component-entity engine for about 3 months now, and have managed to get nearly every constituent system working with little effort or compromise. My system has the following attributes:

Components are mostly comprised of data.
Services (physics, networking, rendering, etc) operate on these components' data in a type-agnostic manner.
Components register themselves with their respective service provider on start-up.

One of the services I've been struggling to implement is rendering. I want a rendering service that keeps a list of my drawn components in an ordered list depending on what kind of drawing operations they require from the graphics device (i.e. different shaders, textures, draw order, etc) and then every frame iterates over the the list, grabs the indexed vertex arrays from the component and renders them using the settings specified in the "DrawContext."

In my research, I've stumbled upon the Nuclex.Graphics package which seems to solve a great deal of my concerns. It has an excellent implementation of vertex buffer object batching, queuing and such but it is not necessarily tailored towards a component-entity system. With Nuclex's design, all that is required is for my components to "queue" vertex buffer objects with the service which then batches them according to their "DrawContext."

My question is, how I can hide all of these vertex objects from the user? How can I enable my rendering service to draw both simple textured quads and complex stencil shadows while remaining type-agnostic? If you've worked on a component-entity system, how did you tackle complex rendering schemes?

sentences:
Animating sprites at different speed than what the game runs at I am building a Javascript/canvas platformer game, and it's coming along nicely. The only problem I've really run into where I can think of any solution at all is the animation of my player sprite.

The game loop is running every 16ms, which equates to 60fps. On every game loop, I'm using a method of my player class (called draw) to draw the player sprite. The sprite looks like this: http://i.imgur.com/uM3Un.png

On every call of the draw method, I am advancing the "frame" of the player sprite, to give the illusion that the player is moving. As far as I know, this is common practice. However, due to my draw method being run every 16ms with the game loop, my player sprite is animating extremely quickly, and it doesn't look realistic at all.

Is there a way to slow this down to a pre-defined speed, or will I have to resort to adding loads of duplicate frames to my player sprite? Obviously that's not a great solution, as to make it look realistic at a game speed of 60fps I'd need to have a LOT of frames.

Here's my relevant code:

// Sets off the main game loop
setInterval("gameLoop()", gameSpeed);

function gameLoop() {
    // Updates
    player.update();

    // Draw
    c.clearRect(0, 0, canvas.width, canvas.height);
    player.draw();
}

// Then in my player class...

this.draw = function() {
        if(this.state == "idle") {
            c.drawImage(this.idleSprite, this.idleSprite.frameWidth * this.idleSprite.frameCount, 0, this.idleSprite.frameWidth, this.idleSprite.frameHeight, this.xpos, this.ypos, this.idleSprite.frameWidth, this.idleSprite.frameHeight);
            if(this.idleSprite.frameCount < this.idleSprite.frames - 1) { this.idleSprite.frameCount++; } else { this.idleSprite.frameCount = 0; }
        } else if(this.state == "running") {
            var height = 0;
            if(this.facing == "left") { height = 37; }
            c.drawImage(this.runningSprite, this.runningSprite.frameWidth * this.runningSprite.frameCount, height, this.runningSprite.frameWidth, this.runningSprite.frameHeight, this.xpos, this.ypos, this.runningSprite.frameWidth, this.runningSprite.frameHeight);
            if(this.runningSprite.frameCount < this.runningSprite.frames - 1) { this.runningSprite.frameCount++; } else { this.runningSprite.frameCount = 0; }
        }
    }

sentences:
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: Lighting, shader and GI is messing up the materials in Unity3D Hello Guys I am not very sound with Unity3D Lightmapping. Currently I have a set of low poly items in my scene. Textures on my models are getting washed out. They totally look absurd. here is a picture of expected (Right) vs current result (left)

sentences:
How to place objects/entities randomly in JS? I'm making a game and I have a script (running it with Node) on the server that currently just randomly places things on the map... I'd like to change that. I saw something about Perlin noise but I'm not sure if that's the thing I want and I'm even less sure how to implement it...

I want something like this, green dots represent trees, red ones represent enemies and grey ones represent rocks. Where can I get a simple JS algorithm to achieve this?

sentences: How do I use the Minecraft Coder Pack on Linux I downloaded the Minecraft coder pack to mod the game and decompile it, but how do I use it on Linux. Some sources seem to give specific directions, but they are not clear and they involve executing the .bat files. My Ubuntu does not recognize .bat file. How do I decompile a class file from changing a Minecraft version jar file to a zip and unzipping it? How do I decompile one of those class files using Minecraft coder pack? I have been wondering what at least some of the Minecraft source code looks like.

sentences:
Rendering after interpolating, renders inside/outside other objects So, we're working out our interpolated render-coordinates during our render call and it's doing a fantastic job of smoothing everything out.  All is great and collision detection is working to a perfectly acceptable level (for simple CD - ie, player hits other object, looses a life, starts over...).

However, how do we deal with situations that require 'collision and resolution'?  The classic example, of course, being our player character colliding with a solid object (usually a platform or the ground) and then being 'resolved' to bring the 2 entities out of collision.... here is what I mean:

Even if we say something simple like 'just don't interpolate vertically when touching a platform' - that wouldn't seem a very clean solution because we need to think about slopes where the player is moving both left/right as well as up/down.

What is the easiest and cleanest way to protect ourselves from this happening?

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:
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:
How to put a reference to my player (already instanced) into a prefab that will be instantiated later I'm making an enemy in my game. He stands at the side of road with a rocket launcher and fires when you get close. It nearly all works fine, except I just need a reference to the players position so that I can make his rocket explode when it reaches the same height on the map as the player car.

The enemy is a prefab which is NOT instanced at build-time, there a several spawn-points all with n% chance of spawning a guy there using the prefab. The player IS instanced at build-time. And here is my problem..

Although I have put a "public GameObject player" into my variables in the script on the prefab, it doesnt let me drag the already instanced player into it. I've read about a bit, and I see that Unity will not allow this (or at least thats what I gathered!)

So after much searching I came up with

player = GameObject.FindGameObjectWithTag("Player");

But i havent even tested yet because the source where i got that advice in the very next comment the guy says I shouldnt do this because it takes too much system resources up.

EDIT: I have tested it with that line, it does work. But is there a better way

But he doesnt say the way that it should be done! And the thread is about 6 years old. So I thought I'd write here again and ask you fine folks for more help.

I hope I explained the problem clearly enough, I think i got the terminology right. Basically, the RocketerEnemy prefab is going to be instantiated in runtime, but the PlayerCar is already instantiated by my dragging it into the heirarchy at the beginning of the project. This is stopping me from dragging the PlayerCar object into the box in the Inspector (for the Enemy prefab) .
All I really need is the PlayerCar.transform.position.Y value for each frame.

THANKS IN ADVANCE !

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 transform stretching? I've read a lot about transformations: model to world space, world to camera space and projection transformationsl but when programming it, I can't get things right. I think I'm missing something, so here is my example code:

package com.test.rendering;

import...

public class Test extends ApplicationAdapter {
Texture texture;
Matrix4 projection;
Matrix4 transform;
SpriteBatch batch;
float angle = 0f;

@Override
public void create () {
    float width = Gdx.graphics.getWidth();
    float height = Gdx.graphics.getHeight();

    projection = new Matrix4();
    projection.setToProjection(
            -width / 2,
            width / 2,
            -height / 2,
            height / 2,
            1,
            100);

    batch = new SpriteBatch();
    batch.setTransformMatrix(transform);
    batch.setProjectionMatrix(projection);

    texture = new Texture("badlogic.jpg");
    Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}

@Override
public void render () {
    Gdx.gl.glClear(Gdx.gl.GL_COLOR_BUFFER_BIT);

    angle = (angle + 0.5f * Gdx.graphics.getDeltaTime()) % 360;

    transform = new Matrix4();
    //translate the world so we can see the texture at z = 0
    transform.translate(0.0f, 0.0f, -5.0f);
    transform.rotate(Vector3.X, angle);

    batch.setTransformMatrix(transform);

    batch.begin();
    batch.draw(texture, -texture.getWidth() / 2, -texture.getHeight() / 2);
    batch.end();
}

@Override
public void dispose () {
}
}

If you run this code you will see a very weird transformation: the texture starts rotating, but then stretches until some part of the screen, and then slowly disappears. I was expecting to see the texture just rotating around the x axi, with no stretching. Why is this happening? What is wrong with my code?

sentences:
Effective SpriteBatching in XNA? What is an example of efficient sprite batching in XNA?

I don't know when (if ever) I would do something like this:

spriteBatch.Begin()
DrawSprite1();
spriteBatch.End();

spriteBatch.Begin();
DrawSprite2();
spriteBatch.End();

Is there any time within a draw method that I would separate drawing calls like this?

Thanks!

sentences:
Unity LineRender texture distorts in Game view I have a LineRenderer with a tiled texture of repeating arrows. I have a script that scrolls the texture.

However the texture distorts as it moves. The distortion goes back and forth repeating. Without the script the arrows are still distorted in game view so I dont think it is an issue particularly with the scroll.

public class LineArrow : MonoBehaviour
{
    public float scrollSpeed = 1f;
    public Renderer _renderer;
    // Start is called before the first frame update
    void Start()
    {
        _renderer = GetComponent<LineRenderer>();
    }

    // Update is called once per frame
    void Update()
    {
        float vOffset = Time.time * scrollSpeed;
        _renderer.material.SetTextureOffset("_MainTex", new Vector2(vOffset, 0));
    }
}

The first image is the scene view and the second is the game view

sentences:
how can I split the screen into two screens and make Gdx.input.setInputProcessor () accept two processors? I want to draw in the first screen portion, and manipulate the buttons in the second part.

This is what I tried:

if (mouse.x <600) {
    Gdx.input.setInputProcessor (new InputProcessor () {

Override
public boolean touchup (int arg0, int arg1, int arg2, int arg3) {
return false;
}
.
.
.
.
.
}
if (mouse.x> = 600) {
Gdx.input.setInputProcessor (stage);
}

the problem is that I have the ability to go from the first part to the second but I'm not allowed to go from the second to the first, it blocks the mouse coordinates in x = 600 This is what I tried

sentences:
Change object's location at instantiated moment I'm trying to instantiate object(scene) and set it's spawn position at the spawn time. Here's the code I wrote:

func spawn_asteroid():
    var spawn_position: Vector3 = get_spawn_position()

    var asteroid_instance = asteroid_scene.instance()
    asteroid_instance.transform.origin = spawn_position
    spawned_asteroids.append(asteroid_instance)

    add_child(asteroid_instance)

asteroid_scene is PackedScene, so get instance first, and then update it's position, and finally use add_child to append current scene's tree.

It seems fine to me, however when I run the game, the object was spawned at (0,0,0) and then move spawn_position.

I changed it's position before it appended to scene, but why it still (0,0,0) and right after move to the specified position?

In Unity, change object's location right after instancing works. In Godot Engine, is this approach invalid?

sentences:
How does an AAA graphical workflow look like? So this is how I understand it:

An artist models the thing in Zbrush or Mudbox. It now has 10+ million polygon. He exports it in Zbrush as a normal map + low poly model. (this works?)
The model now has ~20-30k polygons?

Now the artist imports the low poly model into 3dsmax or Maya, applies the normal map somehow as well, so it will look in the modelling program just like it would ingame. Then he starts adding bones and then skins the model.
Then animation, then export. As I understand it, somehow all the textures of a model get "baked" into a single texture which the engine will understand?

Do people still make textures in Photoshop and then UV unwrap the model by hand, then apply the textures? I never understood how someone can make the laid out texture of a face in Photoshop, and somehow he knows that it will look good on the model. Do they paint the textures in Zbrush? But Zbrush doesn't have all the photoshop tools.

What if I want to make a terrain, or an indoor level? Do I just model the whole thing in 3dsmax? What if the textures don't show up in the engine the way they do in 3dsmax?

sentences:
How can I draw a line rotated some number of degrees away from an original line? I have a line ahead of my moving object to serve as a raycast and its aligned with the object's movement direction. But I want also some extra lines according to an angle related to the 'head' of the moving object.

This position is always changing; I also have a velocity vector to see the direction of the object as well, I use that to trace the front line ray of my object but not sure how to use to calculate this new line.

In this picture, my object is moving to the right and up. I want to trace a new line but 30 degrees from this one. How do I do that?

sentences:
SerializeField UntiyEvent not properly saving modifications in EditorWindow I'm making a node editor in Unity using an EditorWindow, I'm currently trying to make it so designers can add their own methods to a node using serialized UnityEvents; but I haven't been able to get it to function properly.

SerializedObject serializedObject = new SerializedObject(selectedNode.NodeState);

SerializedProperty property = serializedObject.GetIterator();
property.Next(true);

while (property.NextVisible(false))
{
    EditorGUILayout.PropertyField(property);

}
serializedObject.ApplyModifiedProperties();

serializedObject.Update();

The above code runs through all necessary fields of the class so the user can modify them.

Everything functions perfectly with the exception of UnityEvents. They almost do as I intend them to do, except they don't preserve the variable inputs of inserted object's method. If I keep working within the editor window they stay, but if I close the window and re-open the inputted variable resets.

I thought this may be caused by an issue somewhere else in my code, but all other fields work fine.

sentences:
Integer linear program solver based AI Is Integer Linear Programming a viable solution for a turn based game AI?

My current AI solution uses an ILP solver. If you are unfamiliar with ILP, it uses a collection of Booleans to find most optimal solution to a linear problem.

I'm concerned about fluctuations in performance and I"m also thinking of portability. I am using C++ to prototype. I have access to an ILP solver that works well with it. I don't know if I"ll find one that I can use on portable devices. I'm unsure if can rely on the computation time being reasonable with an N large enough to get the results I"m planning for.

I am wondering if anyone used this technique (ILP based AI) and would advice against it or in favor of it. Also are there any other (portable and effective) optimization tools that could be used for a similar result? I read about NegaScout but I did not find a book or tutorial that could provide me with a deep understanding of it.

I also read this question which did not help: Implement Negascout Algorithm with stack

sentences:
How to achieve this kind of look of a cube in a most efficient way? It might be a trivial question, but I couldn't come up with a simple solution.
I need to create a cube like on the image below in Unity.

As always, I target mobile so it would be nice if it was made on a mobile/diffuse shader.

I was playing with lights a little bit, but in order to achieve this kind of look, I'd need to stack multiple lights because one shadow is not enough. Also, I tried adjusting the angles of the lighting - with no luck.

Do you have any tips, how could I make one in a most efficient way?

sentences:
Unity2D - Horizontal Scaling to Support Various Aspect Ratios? I am trying to work out how to support various resolutions for my Android game. I have come up with a solution, but do not know how to implement it.

Automatically, I am told that Unity vertically scales the screen to match the screen, leaving more room at the sides. How can I change this behaviour? I am hoping to shrunk the game down till it fits horizontally, and filling it the background above and below with more decorative features. How can I achieve this?

I'm sorry if there is an obvious answer, I'm quite new working with the Unity UI system.

If it makes it any easier, my game is heavily based on UI, and is locked in landscape.

BIG EDIT: I completely rephrased this question because it was so broad and messy.

sentences:
How can I manipulate a layer with click and drag functionality? This works well on clicking layers but not click and dragging layers.
public class FishClicker : MonoBehaviour {

public LayerMask whatIsFish;

public float clickRadius = 0.1f;

void Update() {

    if (Input.GetMouseButtonDown(0)) {
        var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        var hit = Physics2D.OverlapCircle(mousePos, clickRadius, whatIsFish);

        if (hit != null) {
            var fish = hit.GetComponentInParent<Fish>();

            if (fish != null) { fish.DoClickThing(); }
        }
    }
}

}
for DoClickThing(); this works
public void ControlFishClick()
{
    screenPos = myCam.WorldToScreenPoint(transform.position);
    Vector3 v3 = Input.mousePosition - screenPos;
    angleOffset = (Mathf.Atan2(transform.right.y, transform.right.x) - Mathf.Atan2(v3.y, v3.x)) * Mathf.Rad2Deg;

}

for DoDragThing() i want this to work
public void ControlFishDrag()
{
    stopMovement = true;
    rigid2D.velocity = new Vector2(0, 0);
    Vector3 v3 = Input.mousePosition - screenPos;
    float angle = Mathf.Atan2(v3.y, v3.x) * Mathf.Rad2Deg;
    transform.eulerAngles = new Vector3(0, 0, angle + angleOffset);
    //print(stopMovement);
}

for DoReleaseClick() i want this
public void ControlFishUp()
{
    stopMovement = false;
    SnapToPosition();
}

sentences:
Is there any harm in having the main game loop run uncontrolled? I was wondering if there is any possible harm when my game loop runs as fast as the system allows?

I currently have a loop, that, by measuring passed time in nanoseconds, runs the game logic and rendering logic at predefined speeds without a problem. In fact any logic I do in the loop is clocked to a certain amount of calls each second.

The loop itself though just runs about as fast as it likes to which comes up to around 11.7 million loops a second on my machine.

Loop (simple pseudocode):

while(!isGameOver){

 if(canPollInputs){
    pollInputs()
 }

 while(canStepLogic){
    stepLogic()
 }

 if(canRender){
    render()
 }
}

My question is basically if that simple loop, if its not running at a controlled speed, can do any harm to a system?

Edit:
That means my logic is running 30 times a second (30 tps), my renderer is running at 60 fps, I'm polling inputs a 100 times a second and there's also some logic to cope with logic or rendering taking longer than expected. But the loop itself is not throttled.

Edit:
Using Thread.sleep() to e.g. Throttle the main loop down to 250 loops per second leads to a reduction but the loops runs at around 570 loops per second instead of the desired 250 (will add code when I'm at my desktop machine..)

Edit:
Here we go, a working java gameloop in order to clarify things. Also feel free to use it but don't claim it yours ;)

private void gameLoop() {

    // Time that must elapse before a new run
    double timePerPoll = 1000000000l / targetPPS;
    double timePerTick = 1000000000l / targetTPS;
    double timePerFrame = 1000000000l / targetFPS;
    int maxFrameSkip = (int) ( (1000000000l / MINIMUM_FPS) / timePerTick);

    int achievedPPS = 0;
    int achievedFPS = 0;
    int achievedTPS = 0;

    long timer = TimeUtils.getMillis();

    int loops = 0;

    int achievedLoops = 0;

    long currTime = 0l;
    long loopTime = 0l;

    long accumulatorPPS = 0l;
    long accumulatorTPS = 0l;
    long accumulatorFPS = 0l;

    long lastTime = TimeUtils.getNano();

    while(!isRequestedToStop) {
        currTime = TimeUtils.getNano();
        loopTime = currTime - lastTime;
        lastTime = currTime;

        loops = 0;

        accumulatorPPS += loopTime;
        accumulatorTPS += loopTime;
        accumulatorFPS += loopTime;

        if(accumulatorPPS >= timePerPoll) {
            pollInputs();
            playerLogic();
            achievedPPS++;
            accumulatorPPS -= timePerPoll;
        }

        while(accumulatorTPS >= timePerTick && loops < maxFrameSkip) {
            tick();
            achievedTPS++;
            accumulatorTPS -= timePerTick;
            loops++;
        }

        // Max 1 render per loop so player movement stays fluent
        if(accumulatorFPS >= timePerFrame) {
            render();
            achievedFPS++;
            accumulatorFPS -= timePerFrame;
        }

        if(TimeUtils.getDeltaMillis(timer) > 1000) {
            timer += 1000;
            logger.debug(achievedTPS + " TPS, " + achievedFPS + " FPS, "
                    + achievedPPS + " Polls, " + achievedLoops + " Loops");
            achievedTPS = 0;
            achievedFPS = 0;
            achievedLoops = 0;
        }

        achievedLoops++;
    }
}

As you can see there is almost no code run on each loop but always a certain selection based on how much real time has passed. The question is referring to that 'worker loop' and how it does influence the system.

sentences: What is the reason that people avoid PlayerPrefs to store character data and coins etc? PlayerPrefs are easy to implement and i think it can be used to store important game data like selected character and coins and completed quests for small games, but i have read too much to make me ask this question that why not use it, and what is the other options for storing important game data in

sentences:
Translate velocity to mouse curos position I have particles, with a velocity (x and y) per tick. I would like to to make my cursor a gravity force, so particles fly to the cursor's position.

How can I apply gravity (that is towards my cursor position) on my velocity (x and y)?

sentences:
Does PBR mean only one, right technique to view 3D scenes? For example if I call Unity 5's render pipeline "PBR" (Physically-Based Rendering) and also call Unreal Engine 4's render pipeline "PBR," does it mean that the same model with the same PB textures will be viewed identically in very similar or equal scene setups on both engines?

I just wondering if someone says "PBR," does it mean only one, single, right way to do "PBR," or do implementations vary from one to the other?

sentences:
How can I get fastest region server in Photon C++ Client API? I am facing problem with my online multiplayer board game. It takes long time to create and join room. Also sometimes other player doesn't get the data. After searching all over the Photon C++ code I found this function :

void NetworkLogic::onAvailableRegions(const ExitGames::Common::JVector<ExitGames::Common::JString>& availableRegions, const ExitGames::Common::JVector<ExitGames::Common::JString>& availableRegionServers)
{
    EGLOG(ExitGames::Common::DebugLevel::INFO, L"%ls / %ls", availableRegions.toString().cstr(), availableRegionServers.toString().cstr());
    mpOutputListener->writeLine(L"onAvailableRegions: " + availableRegions.toString() + L" / " + availableRegionServers.toString());
    // select first region from list
    mpOutputListener->writeLine(L"selecting region: " + availableRegions[0]);
    mLoadBalancingClient.selectRegion(availableRegions[0]);
}

In the last line its just passing 0th region of the available regions. I think that region could be the slower one. Anyways, I am still facing the problem and I need help. Thanks.

sentences:
How (update,set, apply) dynamically color on a model of a XNA project? I encounter a problem for set a background color on my model instantiated. I can change the texture but not change color.
Is there a parameter for change the color ? Or change the opacity ? I am looking for a way to highlight a model.

thank you so much

Here is my code used:
Everything works except the two last line. I searched but can not find name parameter for color and opacity

//Does not work

effect.Parameters["Color"].SetValue(new Vector3(0,1,0));
effect.Parameters["Opacity"].SetValue(0.5f);

        void DrawModelHardwareInstancing(Model model, Matrix[] modelBones,
                                             Matrix[] instances, Matrix view, Matrix projection)
            {
                 .......

                foreach (ModelMesh mesh in model.Meshes)
                {
                    foreach (ModelMeshPart meshPart in mesh.MeshParts)
                    {
                        // Tell the GPU to read from both the model vertex buffer plus our instanceVertexBuffer.
                        Game.GraphicsDevice.SetVertexBuffers(
                            new VertexBufferBinding(meshPart.VertexBuffer, meshPart.VertexOffset, 0),
                            new VertexBufferBinding(instanceVertexBuffer, 0, 1)
                        );

                        Game.GraphicsDevice.Indices = meshPart.IndexBuffer;

                        // Set up the instance rendering effect.
                        Effect effect = meshPart.Effect;
                        //effect.CurrentTechnique = effect.Techniques["HardwareInstancing"];
                        effect.Parameters["World"].SetValue(modelBones[mesh.ParentBone.Index]);

                        //Work perfect
                        effect.Parameters["View"].SetValue(view);
                        effect.Parameters["Projection"].SetValue(projection);
                        effect.Parameters["Texture"].SetValue(textureInstancedModel);
                        /* ***************************** */
                        //Does not work
                        effect.Parameters["Color"].SetValue(new Vector3(0,1,0));
                        effect.Parameters["Opacity"].SetValue(0.5f);
                        /* ***************************** */

                        // Draw all the instance copies in a single call.
                        foreach (EffectPass pass in effect.CurrentTechnique.Passes)
                        {
                            pass.Apply();

                            Game.GraphicsDevice.DrawInstancedPrimitives(PrimitiveType.TriangleList, 0, 0,
                                                                   meshPart.NumVertices, meshPart.StartIndex,
                                                                   meshPart.PrimitiveCount, instances.Length);
                        }
                    }
               ........
}

sentences:
How do I combine matrix transformation with non-uniform screen scaling in Flash? I'm using a Flash transformation matrix for affine transformation.

I have a rectangular image being rotated and scaled (in 2D). There are two sets of scaling variables, ScreenScaleX and ScreenScaleY, and ScaleX and ScaleY, as well as a counter-clockwise rotation angle, theta. ScreenScaleX and ScreenScaleY are the scaling factors of the window; they should be applied in directions of the original X and Y axes after rotating the image. ScaleX and ScaleY should be applied in the new X and Y directions after rotating the image.

For example: if theta is 90 degrees, ScreenScaleX and ScreenScaleY will still stretch in the direction of the original X/Y axes, but now ScaleY will stretch in the screen's X direction, and ScaleX will stretch in the screen's Y direction.

I think I can accomplish this with some combination of scaling, rotation, and skewing, but I'm struggling to figure out what the matrix would look like. How would I construct a matrix from these variables in order to perform this transformation?

sentences:
Determining if something is on the right or left side of an object? I have a character in a 3D world which is facing an arbitrary direction on a flat plane, the player can click on the left or right side of the character and based on which side is clicked on a different action happens.

How can I determine which side the click occured on? Obviously for straight on ahead (0,0,1) I can simply use the x coordinate of the click point to determine if it's the left or right hand side, but what about other cases?

sentences:
Outline Shader Effect for Orthogonal Geometry in XNA I just recently started learning the art of shading, but I can't give an outline width to 2D, concave geometry when restrained to a single vertex/pixel shader technique (thanks to XNA).

the shape I need to give an outline to has smooth, per-vertex coloring, as well as opacity. The outline, which has smooth, per-vertex coloring, variable width, and opacity cannot interfere with the original shape's colors.

A pixel depth border detection algorithm won't work because pixel depth isn't a 3.0 semantic.
expanding geometry / redrawing won't work because it interferes with the original shape's colors.

I'm wondering if I can do something with the stencil/depth buffer outside of the shader functions since I have access to that through the graphics device. But I don't believe I'm able to manipulate actual values.

How might I do this?

sentences:
How to code a lot of cards in a trading card game java I want to make a trading card game like Yu-Gi-Oh or Magic. I have a lot of cards in my game and even the user can make new cards. Cards are objects and they have attributes like HP and Mana ,etc but they also has special power which is another object and has different types some of them activate when a card is played into the field, some of them activate at death and etc. One way is simply hardcoding all the different cards in different classes but This way, I cannot implement a user-built card. I am going to use enums for the essential cards but I don't know what to do for user defined cards.

Is there any standard way to implement things like this?

I am very new to Java and OOP. I think maybe Databases could help but I don't know what should I use or search to find the appropriate choice for this matter.

sentences:
Why is my application getting more CPU usage while it's halting the operation I have a question about the way OS gives CPU time to the applications. Usually when I render my scene with a single object in it I get ~8% CPU usage, but when I stop the framework for further process while my window has lost focus I see that my application has a ~50% CPU usage. Now, I'm a little bit confused about this behavior because supposedly I should get no CPU time at all.

The pseudo code is something like this:

while(open)
{
  // Window
  window->update();

  // Freeze when we have no focus
  if (freeze) continue;

  // Physics, Input, Render ...
  do_the_stuff();
}

The situation that I'm talking about is when I set freeze to true and just process the window messages. It means there is only one job to do per frame.

sentences:
Problem in player Rotation in Unity I am trying to rotate game camera using my android device orientation.Like this  Using accelerometer input of device this may be done. But I don't know how to do this. I tried lot of methods, but failed. Anybody please help.

I am using unity 5.3 with C#.

sentences:
UDK: Toggle Material on Brushes? I'm attempting to change / toggle the material that's applied to a BSP brush. I've seen where it's possible on static meshes, but I can't seem to get it to work on brushes. Below is an example scenario.

The ground (BSP Brush) is covered in a stone material
The player hits a trigger.
A new "moss" material is applied to the brush, removing the old stone material.

Any assistance you could offer would be greatly appreciated.

sentences:
Combining assets with different licenses Is it OK to mix assets that are Creative Commons 3.0 BY-SA with other assets that are in the Public Domain in the same project? Thanks.

For instance here.

sentences:
How can I load textures in Unity and keep them between scenes? I have some textures that are used in multiple scenes and I want to keep them in memory to speed up load times between scenes.  I know about Resources.Load, but does that always keep it loaded?  If a texture is loaded with Resources.Load, will instantiating a prefab with that texture recognize that it's already loaded or will it load its own instance of the texture?

It would be better if it's a method that I can use in code so that I can make a loading screen and not freeze everyhing up.  I'm limited to an earlier version of Unity so I don't have access to LoadLevelAsyc.

sentences:
Smooth Lighting Falloff So, I'm having some issues with lighting in my Unity game.  I had implemented torches, which seem to be working fine, but I have a creature (gelatinous cube) that I've put spot lights facing to give it a "glow".  The reflected and refracted light ends up having two issues:

the light abruptly ends at the edge of floor tiles, and
depending on the position, the light sometimes goes from it's blue color to a reddish color.

I have a short (11 second) video here:  http://www.labyrintheer.com/wp-content/uploads/2016/11/Nov-17-2016-21-07-57.mp4 so that you can see what I'm talking about.  I've tried changing global lighting settings and playing with the settings on the spot lights, but nothing seems to resolve the issue.

Still images for anyone hesitant to click the video link:

Hard falloff:

Reddish color:

Using a single point light inside the cube, instead:

You can see it on the wall in the upper right and the floor at the top a bit.  The upload seems to have lowered the quality a bit, but you can still see it.  The single light makes it a little bit better, but there's still complete falloff.

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:
Drawing simulator - Tracking mouse movement I was wondering what would be the logic behind coding a drawing simulator like the one on this website: https://www.mdbg.net/chindict/chindict.php?page=chardict&cdcanoce=0&cdqchi=
The paintbrush tool when you click it, once you start drawing strokes that a similar to what a character is, it will automatically bring out a list of characters that leads toward what you are drawing. Once you are finished, the correct character will show up.
To my idea, I think that a set of coordinates are set already and once the mouse coordinates passes through these points, then from there it will detect and provide all the possibilities and narrows it even further. I think this is very complex but what would be the right path/correct way to go about programming this concept?

sentences:
Adding local wireles multiplayer mode to my Android game I've created a little game on Android. Now, I want to add a multiplayer mode which works with bluetooth or WiFi, so you can play together with other "smartphones" in your neighborhood . Which is the best way to offer a fast, good working mulitplayer mode that supports so many devices as possible? I heard about Alljoyn, but Im not quite sure if it fits my needs. Which way do you recommend?

regards Lisa

sentences:
How can I clearify users my controlls? In my game I use a really simple control mechanic to control a character on screen. But my problem is that users do not understand this control.

Beside a little delay problem they work this way:

  As soon as I do a swipe +x or -x my character moves left or right.
  And as long as I hold my finger it continuous to move to the direction
  in that I swiped. When I swipe into the opposite direction of my last
  swipe without leaving my finger from the touch ground, my character
  should move into this direction. When I release my finger from the
  touch screen, my character should stops instantly.

a) Do you think this mechanic could work, if my users learn to use it?

If yes: what would be the best way to show them how it works? A short video? Or some graphics? Maybe a tutorial level?

My concern is that it might be not a good mechanic, because people do not understand it when playing my prototype the first time. That could be because they only know swipe and tap, but not swipe-hold-swipe.

I do not know if there is a right answer or if it is just a question of opinions.

sentences:
How do I use Bezier Curves in unity? I have to rotate few objects on an ellepsoidal(Capsule shaped) track and at the run time speeds are assigned to the objects from the server as this is a betting game which I am developing in Unity 5 using C#.

So can I use Bezier Curves for that if yes then how do I use that?

sentences:
XNA Stop movement when arrived I'm trying to stop movement when sprite arrive target position. But i couldn't handle it. Sprite  still move and pass target position.

Here's the code that runs every update to move it.

    public override void Update(GameTime gameTime)
    {
        if (!IsNasted)
        {
            //Find the delta time
            float delta = (float)gameTime.ElapsedGameTime.TotalSeconds * 300;
            //Find the direction
            Vector2 direction = ConvertUnits.ToDisplayUnits(targetPos) -
                 ConvertUnits.ToDisplayUnits(body.Position);
            if (direction.Length() < delta)
            {
                body.Position = targetPos;
                if (minx == movements.Count - 1) minx = 0;
                else minx++;
                targetPos = ConvertUnits.ToSimUnits(movements[minx]);
            }
            else
            {
                direction.Normalize();
                //Move towards it
                currentPos = direction * delta;
                body.Position += ConvertUnits.ToSimUnits(currentPos);
            }
        }
        base.Update(gameTime);
    }

sentences:
Unity - OnRenderImage hides UI I have a component which renders a few different cameras and the images. However, this obscures my UI when in Screen Space - Overlay mode.

I can put the canvas in WorldSpace mode, which works, but then the UI is affected by the image effect I've built and is, of course, not locked to the camera.

Suggestions?

Update - additional details

At design time, the OVR camera rig contains a single camera centered between the "eyes." This component is attached to the camera rig's centerEyeAnchor.

At run time, the rig creates two additional cameras - one for each eye. These aren't supposed to be modified by user code. (Among other things, their projection matrices are pretty weird.)

I need to modify the image per eye.

I created a new component which create two additional cameras per eye. One renders a low-res version of the entire scene, the other renders a high-res image of a portion of the screen, each to a dedicated RenderTexture.

Pseudocode:

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

/// called twice per frame - once per eye
void OnPreRender()
{
}

/// called twice per frame - once per eye
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
  /// low-res render of entire scene
  var camOuter = m_cameras[...];
  /// hi-res render of part of the scene - 10-20% of original image area
  var camInner = m_cameras[...];

  /// update cameras to match current eye camera
  camOuter.copyFrom(Camera.current);
  camOuter.targetTexture = m_outerTexture;

  /// render scene to low-res texture
  camOuter.Render();

  camInner.copyFrom(Camera.current);
  camInner.targetTexture = m_innerTexture;

  /// target texture that the Oculus wants to render to
  var ovrTexture = Camera.current.targetTexture;

  /// save projection matrix
  var originalProjectionMatrix = camInner.projectionMatrix;

  var scale = new Vector3(m_innerTexture.width * 1.0f / ovrTexture.width, m_innerTexture.height * 1.0f / ovrTexture.height);

  /// zoom/pan matrix to clip to part of the scene
  var gazeMatrix = Matrix4x4.Scale(scale);

  /// offset projection
  gazeMatrix.m03 += (1 - 2 * gaze.x) * scale.x;
  gazeMatrix.m13 += (1 - 2 * gaze.y) * scale.y;

  camOuter.projectionMatrix = gazeMatrix & originalPRojectionMatrix;

  /// render hi-res portion of the scene centered at gaze pixel
  camOuter.Render();

  /// restore projection matrix
  cam.projectionMatrix = originalProjectionMatrix;

  /// composite images
  m_material.SetTexture("InnerTexture", m_innerTexture);
  m_material.SetTexture("OuterTexture", m_outerTexture);
  Graphics.Blit(null, destination, m_material);

}

(I'm also worried that there may be additional scene renders happening in the background.)

The problem is that the UI does not render if set to Screenspace - Overlay or Screenspace - Camera. I can get it to render in Worldspace, which may be the only way to do this, but then it seems I'd need to create yet another hi-res texture matching the viewport dimensions and render the UI layer to that, and keep it locked to the current eye's camera position. Alternatively, I could re-use one of the current cameras, I guess, and just tweak its settings.

Is there a better way to do this?

Ideally, I'd like to have the engine just render the UI as it does in other applications without having to jump through hoops. However, at this point, I'll take anything I can get that works and looks good.

Update the 2nd

Okay, it looks like the UI is rendered perfectly if I use a regular camera instead of the OVR rig. :( Having the rig in the scene, though, prevents it from drawing at all.

sentences:
When scaling the camera with the player, how can I make it more noticeable? I am making a game where you play as fish. When you eat food you become larger. I am counting the camera scale as follows:

camera.scale = (player.originalWidth / player.width)

Then I apply it as a transform to the whole world. Now when the fish grows up you don't see any change on your sprite, only on the surrounding world. I want to achieve that you will see the growing a little bit. How should I modify this equation?

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 can I effectively manage a hobby game project? How can I successfully finish a hobby game project in my free time?

How do I motivate myself to keep it up and drive right through to the finish without losing interest or motivation along the way?

sentences:
Vector normalization gives very imprecise results When I normalize vectors I receive very strange results. The lengths of the normalized vectors range from 1.0 to almost 1.5. The functions are all written by me, but I just can't find a mistake in my algorithm. When I normalize I just divide all components of the vector by the vector's length.

public double length(){
    return Math.sqrt(x*x + y*y);
}

public void normalize(){
    if(length() > 0){
        x /= length();
        y /= length();
    }
}

Is this supposed to happen? I mean I can see the length ranging from 0.9 to 1.1 at worst, but this is just overwhelming.

Cheers

sentences:
Opengl lighting not working I have rendered a spinning model in LWJGL. I have calculated normals and enabled lighting. Now I make a light:

float lightpos[] = {0, 0, 0, 0};
FloatBuffer lightposb = BufferUtils.createFloatBuffer(8);
lightposb.put(lightpos);
glLight(GL_LIGHT0, GL_POSITION, lightposb);
float light[] = {10, 10, 10, 1};
FloatBuffer lightb = BufferUtils.createFloatBuffer(8);
lightb.put(light);
glLight(GL_LIGHT0, GL_SPECULAR, lightb);
glLight(GL_LIGHT0, GL_DIFFUSE, lightb);
glLight(GL_LIGHT0, GL_AMBIENT, lightb);

The model, instead of being lit up, is a dark gray. Also, no color appears on the model, even though I set its color to cyan:

    float color[] = {0,1,1,1};
    FloatBuffer colorb = BufferUtils.createFloatBuffer(8);
    colorb.put(color);
    glMaterial(GL_FRONT, GL_AMBIENT, colorb);

UPDATE: Even though I have calculated normals and set them with glNormal3f, the model still appears to be shaded flat.

UPDATE: I HAVE done glEnable(GL_LIGHTING) and glEnable(GL_LIGHT0); that is NOT the problem.

UPDATE: I reversed the order of the light code and the model code and now the model flashes white, then goes dark grey and stays there.

sentences:
Bullet physics with OpenGL I have got some problem implementing bullet physics into my opengl game. The thing is that it doesn't want to update my translatef value continously but only at the end.
The code for bullet looks like this:

void CGL::initPhysics( void ) {
broadphase = new btDbvtBroadphase();
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
solver = new btSequentialImpulseConstraintSolver;
dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);

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

ballShape = new btSphereShape(1);
pinShape = new btCylinderShape(btVector3(1,1,1));
pinShape->setMargin(0.04);

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

btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),1);

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);
btRigidBody* fallRigidBody = new btRigidBody(fallRigidBodyCI);
dynamicsWorld->addRigidBody(fallRigidBody);

for (int i=0 ; i<300 ; i++) {
    dynamicsWorld->stepSimulation(1/60.f,10);

    btTransform trans;
    fallRigidBody->getMotionState()->getWorldTransform(trans);

    fallY = trans.getOrigin().getY();
}
state_list.remove( STATE_FALL_BALL );
printf("stoped\n");

}

And the drawing function which is called at the beginning looks like this:

void CGL::fallingBall( void ) {
glPushMatrix();

float colBall2[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
glMaterialfv( GL_FRONT, GL_AMBIENT, colBall2);

glTranslatef(0.0f,fallY,0.0f);

printf("fallY: %f\n",fallY);

glutSolidSphere(1.0f,20,20);

glPopMatrix();

}

The thing is that it shows correct value in this function's printf but translation is called only at the beginning I mean I can only see the last state.

Can anyone help me, please?

sentences: How to manage collision between balls in Game Maker 2 (Drag and Drop) Hey there I'm using Game Maker 2 Drag and Drop for a project, I made a game like Break Out and when the ball collides with the wall it doesn't bounce, in Game Maker Studio we had Bounce Action but in GMS2 is deleted, can anyone help me about this issue?

sentences:
Collision detection enhancement I am developping a spaceinvader-like game. There comes the problem of how to handle collision detection.

At first I was doing like that :

forEach(fireBall : fireBalls) {
    forEach(stormTrooper : stormTroopers) {
        if (collides(fireBall, stormTrooper)) {
             // Explode

But then when playing I had the feeling the game was slowing down at some point, and I tought it had something to do with the multiple elements and the double loop.

So I tried to break the loops whenever I had the chance, changing the forEach loops to for loops at the same time :

for (var i = 0; i < fireBalls.length; i++) {
     if (stormTroopers.length > 0 && fireBalls[i].y > stormTroopers[0].y) {
          break;
     }
     for (var j = 0; j < stormTroopers.length; j++) {
         if (fireBalls[i].y > (stormTroopers[j].y + 31)) {
             break;
         }

If the fireball isn't on the same "y" as any stormtrooper, the fireballs following are not going to be either, so no need to check. Same for the stormtroopers loop.
This works only if the list is ordered, meaning the first stormTrooper of the list has the highest "y" value.

The problem in my game is that all stormTroopers don't have the same speed, so I need to sort the list each time.

This leads to my question : in order to enhance the performance, I tried to break the loops, but for that I had to add a new operation : sort the list of the stormTrooper. Is it worth it?

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:
Godot Engine: Why is baking light making my scene darker? I have an interior scene with some windows.  The light is from an OmniLight near the ceiling, default environmental light from outside, and a desk lamp with emission.  Without baking light, the scene looks like this:

Consistent with the documentation for emission, the desk lamp is not affecting the surrounding objects.  I want to bake the light to see the lamp's effect and to support low end hardware.
I followed the baked lightmaps tutorial and set the BakedLightmap's extents to encompass the entire room.  After baking, the scene looks like this:

I can see the lamp's light, as expected, but now everything is too dark.  It is unclear to me from Godot's documentation if scenes include indirect light without baking.  I have tried this with the OmniLight set to bake "all" and only indirect light.
What am I missing here?

UPDATE 10 April 2021:
The problem seems to be that baking environmental light isn't working as expected.  I was using Godot 3.2.3; now I'm using 3.3rc8.  That gives the BakedLightmap options for environmental light, but the problem remains.
I began troubleshooting by shuttering all the light sources as follows:

Hid the OmniLight, and set its "Bake Model" property to "disabled"
Unchecked "use in baked light" for the desk lamp
Set the default environment's background and ambient energy to 0
Set the BakedLightmap's "environment mode" to "Disabled", verified "Min Light" is set to pure black, and cleared the "Light Data"

When I run the game, I get exactly what I expect--a black screen.  If I bake light under these conditions, I continue to get a black screen, as expected.
Here's where things get screwy.  When I set the BakedLightmap's "environment mode" to "Scene"--with the environment still without any light--I get dim illumination.

sentences:
Cube world rendering optimizations I'm making a Minecraft like game and I would like to apply some optimizations. Firstly I didn't and I rendered the world using a vbo in which I stored a cube model and I drow all blocks of the worlds and off course it caused lag if there were too many blocks.
Then I decided to draw the world face-by-face and check if a face is hidden from another one.

This concept is simple if I have the world made only by cubes of the same size, like this:

Blue and black block are two blocks of the same size and the red face is the face to ignore since is hidden (overlapped) by another opaque face.

As I said if I want to make blocks of different sizes (scale)/position/rotation but by always drawing them from faces, the matter is different since I can't know if a face is completely visible or not. Here's an image of a normal block with a "custom" block on it:

Blue block is the custom block, the black a "normal" block and the red is the face overlapped by the biggest one (then it should be ignored during rendering).

Here the rotation is null but if there's no way to check rotated faces I can simply ignore it and draws all rotated blocks by default (I don't rotate all the world lol)... that's not what I'd like to do but if there's no way or the way is too difficult...

Anyway, finally, how can I check (using GL functions or doing it in my code) if a face is hidden and to ignore it on rendering?

I forgot to say that another optimization I did is if a block is hidden (has a block relative to each face) by other blocks I don't draw it.

sentences:
How do I let players control which key does what? New to coding so this is probably super simple, but I can't find the answer. I'm using Unity 5.4.0 and coding in C#.

Is there a variable for input keys?

I have a game I'm making and it is working good, but I want the players to be able to choose which key does what, but I don't know how to make the key presses changeable. I am using both Input.GetKeyDown(Keycode."KEY") and Input.GetKey(Keycode."KEY").

My question is: is there a variable I can use in place of the keys that I can make changeable by the players?  Like a float, but instead of numbers, it uses key codes.

sentences:
irrlicht for android I was  just wondering after noticing that moblox was.built with irrlicht if there is an android port of it?  Or did the dev make his own port from scratch?

From my research I noticed a port project on github but it seems far from ready.-

sentences:
Play an effect where a sprite touches a trigger I have a sprite-based GameObject in Unity to which is attached a RigidBody and a Collider2D. When this GameObject comes into contact with a particular Collider2D Trigger, I want a particle effect to play at the point of contact. This sounds extremely simple to set up and yet I can't seem to find any solution that works, since OnTriggerEnter2D doesn't bother to provide hit coordinates.

Please note that the trigger represents a non-solid space, so adding a solid (non-trigger) collider for hit detection is not a solution.

The sprite is large, so I can't just play the particle effect at its transform position. Raycast is not an appropriate solution for this problem; it doesn't handle nearly enough cases.

sentences:
Compute billboard rotation I'm trying to compute a matrix to have object always facing the camera. For the moment, my result look pretty good, the problem is that my original billboard scale isn't preserved (Every billboard have a size of 1/1).

Here is what I've done using this post:

glm::vec3 look = glm::normalize(camera->getPosition() - objectPosition);
glm::vec3 right = glm::cross(up, look);
glm::vec3 up2 = glm::cross(look, right);
glm::mat4 transform;
transform[0] = glm::vec4(right, 0);
transform[1] = glm::vec4(up2, 0);
transform[2] = glm::vec4(look, 0);
transform[3] = glm::vec4(objectPosition, 1);

glm::quat q = glm::quat_cast(transform);
objectTransformable->setOrientationFromQuat(q);

I've tried to add something like that but the result is a bigger object with bad proportion:

transform = glm::scale( transform, objectScale );

To resume, I would like to extract orientation from result matrix to apply it on my transform object, something like Unity:

MyTransform.LookAt(Cam.transform.position, upVector);

sentences:
HLSL SampleCmp compile error When trying to compile the following HLSL:

Texture2DArray gShadowmap : register(TEXTURE_REGISTER_DEPTH);
SamplerState gShadowmapSampler : register(SAMPLER_REGISTER_DEPTH);

// ...

float3 projCoords = (float3)mul(gSplitVPMatrices[index], worldPos);
float viewDepth = projCoords.z - DEPTH_BIAS;
projCoords.z = float(index);
float visibilty = gShadowmap.SampleCmp(gShadowmapSampler, projCoords, viewDepth).r;

visual studio gives me:

error X3013: 'SampleCmp': no matching 3 parameter intrinsic method
error X3013: Possible intrinsic methods are:
error X3013: Texture2DArray<float4>.SampleCmp(SamplerComparisonState, float3|half3|min10float3|min16float3, float1|half1|min10float1|min16float1)
error X3013: Texture2DArray<float4>.SampleCmp(SamplerComparisonState, float3|half3|min10float3|min16float3, float1|half1|min10float1|min16float1, int2)
error X3013: Texture2DArray<float4>.SampleCmp(SamplerComparisonState, float3|half3|min10float3|min16float3, float1|half1|min10float1|min16float1, int2, float1|half1|min10float1|min16float1)
error X3013: Texture2DArray<float4>.SampleCmp(SamplerComparisonState, float3|half3|min10float3|min16float3, float1|half1|min10float1|min16float1, int2, float1|half1|min10float1|min16float1, out uint status)

I believe I match the first method, so why is this?

sentences:
Character controller going down slopes When I go down slopes with character controller, if the speed is too high, the character just flies off the slope and lands at the bottom. I want my character to "stick" to the slope rather then just jump of it. I came up with code to do so, but it didn't turn out as I planned. Now the character just slides on the slope when I stop pressing the arrows (not staying at its place on the slope).

Physics.Raycast (transform.position, Vector3.down, out hit);
transform.position = transform.position
                     + new Vector3(0f, distance - hit.distance, 0f);

Thanks for the help, i couldn't figure this out all day.

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:
Rotation Continuity help First the issue im having: Basically its the fact that the angles of a circle aren't continuous, they rise from 0 to 2pi then immediately fall back to 0.

I want to make a game where the player controls a tank and ive got a tank drive working but i want to implement a "Directional Drive" where the player can push a joy stick(XBOX360) in a certain direction and the tank will move forward and turn towards this direction.
heres the code i have to do that:

if (Math.Abs(controllerCOORD.Y) > Deadzone || Math.Abs(controllerCOORD.X) > Deadzone)
        {
            decimal intended_angle = (decimal)Math.Atan2(controllerCOORD.X, controllerCOORD.Y);

            double correction = (double)Decimal.Round((intended_angle - (decimal)this.BaseAngle_Rad), 1, MidpointRounding.AwayFromZero);

            this.BaseAngle_Rad += (correction / demultiplier_rot);

            this._x_pos += ((float)Math.Sin(this.BaseAngle_Rad) * multiplier_pos); //x component vector of movement
            this._y_pos -= ((float)Math.Cos(this.BaseAngle_Rad) * multiplier_pos); //y component vector of movement
        }

Unfortunately with this code, when the player pushed the joystick downwards(0,1), the angle it calculates approches pi from the right side and negative pi from the left side causing it to make a full turn in the wrong direction instead of like a few degrees in the correct direction.

How do i make the rotation continuous all the way around?
Ive already found these two questions on here but neither is helping me:

360+ degree rotation skips back to 0 degrees when using Math.Atan2(y, x)

Turning a sprite such that it rotates in the direction that's most efficient

Thanks

sentences:
How can I implement temporary effects in Objective-C? How could I use this IBAction

-(IBAction)shield:(id)sender{
    appDelegate.healthInt = 150;
}

and simply make it work for a limited time. I want to set appDelegate.healthint = 150 for about 20 seconds. I'd assume this works with some sort of NSTimer. Not really sure. I'm not using any frameworks.

sentences:
Drawing graphics in Java game I am quite new to game development, so here is a question (maybe a stupid one):

In my sidescroller i have a bunch of different graphics objects that i need to draw (player, background tiles, creatures, projectiles etc). Most tutorials i've read so far show that each object has its own draw method, which is then called from some other method.

What if I had one method that does all the drawing? Lets say i keep all my objects in an array or queue (or multiple arrays) and then go through each of them, get an image and draw it.

So basically would it be better (and why) to have each object have its own draw method or one method that does all the drawing? Or does it matter at all? I feel like the second option is more comfortable, because then all the stuff to do with drawing would be in one place...

sentences:
Creating A TickRate Class I need to implement tickrate into my engine to handle timed events such as pushing out entity updates and I don't know where to start.

I have access to a timer which allows me get the time in milliseconds since the device has been initialized.

When I try to brainstorm on the correct approach to take one of the main things that I get stopped up on is that on the client side I should allow the framerate to run as fast as it can, however if I want the tickrate to run at 60 and the client FPS is less than 60 how can 60 ticks execute if the main loop wont run at least 60 times a second due to it being slowed down by the fps?

Can anyone explain how to properly implement tickrate? Thank you for your time.

sentences: GraphicsAdapter lacks a definition for CheckDeviceMultiSampleType The MSDN is really confusing about this, with all their different versions of XNA jumbled together for my google results. All I want to do is find out, in XNA 4.0, what antialiasing modes are supported by the display adapter. Supposedly, this involves calling GraphicsAdapter.CheckDeviceMultiSampleType(), but that function isn't defined. What should I be using in its place?

sentences:
How to zoom and scroll in libGdx? I am trying to both A.) Pinch zoom my game scene and B.) Move (scroll) my game scene but I have not found many examples. I learn more by examples than by reading API documentation (although I am willing to resort to that if there is no other way) and the lack of examples has put a damper on my game.

How do I do these things?

A little background:

I am developing a RPG for Android and one of the features in my game is the ability to purchase a game map for money that let's users see the location of enemies in the level and all of the obstacles. Since most Android devices are quite small 3.5" to 5" I thought it would be a good idea to let the user zoom into the map and then scroll around. I have omitted most of my game code.

Relevant code

I have

 //Irrelevant code omitted for clarity and in accordance with the help center
    public class MyGdxGame implements ApplicationListener
    {
Texture mapTexture;
SpriteBatch batch;

@Override
public void create(){
    mapTexture = new Texture(Gdx.files.internal("map.png"));
    batch = new SpriteBatch();
}

@Override
public void render(){
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.glClear(GL20_GL_COLOR_BUFFER_BIT);
    batch.begin();
    batch.draw(0 , 0, Gdx.graphics.getWidth, Gdx.graphics.getHeight());
    batch.end();
}

@Override
public void dispose(){
}

//I want to zoom in to the map here
@Override
public void resize(int width, int height){
}

@Override
public void pause(){
}

@Override
public void resume(){
    }
}

sentences:
Smooth matrix rotation I have a coded a simple example for a matrix rotation. The example rotates a sphere around its center. The problem is that the rotation is not running perfectly smooth and I'm wondering why.

Here is a minimal code sample:

float totalMs = 0.0f;
int animationDuration = 5000;

void update(float deltaMs) {
    totalMs += deltaMs;
    float degrees = (totalMs % animationDuration) / animationDuration * 360.0f;
    glm::mat4 rotation = glm::rotate(glm::mat4(), radians(degrees), rotationAxis);

    //multiply modelViewMatrix by rotation matrix
    //and use the resulting matrix in shader to transform points
}

I'm programming in C++, using GLM Library for Maths, SDL2 for rendering context and OpenGL for the rendering.

Any hints what could cause the rendering to not look totally smooth?

Edit:
Ok I found out that the time needed for SDL_GL_SwapWindow() at the end of my gameLoop varies between <1ms and >30ms. What could be causing this?

sentences:
In general, are programmers or artists paid better? I'm in a private game programming school where there also are 3D art classes; sadly, there seems to be a lot more students in those latter classes, something like 50% or 100% more.

So I was wondering: in the real video game industry, which of the artist/modeler or the programmer is more likely to be wanted in a company, so who will be paid more ?

I'm sure there are artists which are obviously paid better than other programmers and I'm sure there are other sorts of jobs in the game industry (sound, management, testers), but I wanted to know if there is a general tendency for one or the other. And sometime I wonder even if an artist can happen to write scripts...

sentences: Algorithm for generating a 2d maze What algorithm have you used in the past to generate a simple 2d maze?

sentences:
HLSL: how to get/set effectvariable to an array of structs with Direct3D10 HLSL Code:

//Lights
struct Light
{
    float3 pos;
    float3 dir;
    int type;
} m_aLights[3];

How can I get/set an effectvariable to m_aLights with Direct3D10?

Thanks

sentences:
How can I add array of components to a new gameobject? I use Getcomponents to get all components from existing gameobject:

Component[] components = go.GetComponents(typeof(MonoBehaviour));

And I want to add them now to another gameobject:

for (int i = 0; i < components.Length; i++)
                {
                    var comp = components[i];
                    newObject.AddComponent<comp>();
                }

components is type Component[]

But when I try to type components inside the AddComponent<> the variable components not exist. Tried then to make the comp variable but can't type it inside the <> either.

sentences:
Same scroll speed across devices with different DPI I am creating a simple game in JS, something like the flappy bird :)
For pipe scroll, I am using a linear tween.

I noticed that the speed of the pipes are different across different smartphone screens, so
the game has different difficulty.

I observed that this has to do with different screen sizes and different pixels densities.

What I did is I defined a duration per pixel, which is multiplied by the number of pixels the screen has.
The duration per pixel, pixel_duration is constant.

So basically:

tween_duration = number_of_horizontal_pixels * pixel_duration

But this gives same speed in different sized browser windows on the (same) computer screen.
If I use this approach on some device that has higher pixel density, the pipes will move slower,
because there are more pixels, so this tween_duration value gets larger, so tween gets slower.

Then I learned of the devicePixel ratio value which can be used. So I try to factor this in the equation:

tween_duration = number_of_horizontal_pixels * pixel_duration / devicePixelRatio

This devicePixelRatio is higher as screen DPI's goes higher and should solve my problem according to the docs, right?
https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio

However, this only helps a bit. There is still a noticable speed difference.

Why is this not working, and how can I get the same scroll speed across devices in JS (in browser window) - perhaps some other approach would do?

sentences:
smoothly object transition through lerp and coroutine IEnumerator SmoothlyShiftPosition(Vector3 destination, float OverTime) {

    float startTime = 0;
    while (startTime < OverTime)
    {
        Debug.Log(startTime/OverTime + "changing: " + navigationCanvas.transform.position);
        Debug.Log("startTime : " + startTime);
        navigationCanvas.transform.position = Vector3.Lerp(navigationCanvas.transform.position, destination, startTime/OverTime);
        startTime += Time.deltaTime * 2f;
        yield return null;
    }
    navigationCanvas.transform.position = destination;
}

I have this simple code snippet which i am using to lerp my object to specfied position smoothly it work sometime correctly but  not always. I logged different data and found that my startTime variable sometime becomes zero continuously. I am unable to figure why this occuring? what i am doing wrong?

Edit:

I am calling coroutine function like this

 if (SmoothlyShiftPositionIEum != null) {
                            StopCoroutine(SmoothlyShiftPositionIEum);
                        }
                       SmoothlyShiftPositionIEum = StartCoroutine(SmoothlyShiftPosition(navCanvas, smoothPositionTime));

sentences:
Light Attenuation Formula Derivation I understand that when sampling the brightness of a given point on the surface, a certain cutoff needs to be taken into consideration.

Other words, when the light is further away, the intensity decreases.

I came across the following formula that is used to compute the aforementioned:

attenuation = 1.0 / (1.0 + a * dist + b * dist * dist)

However, I have not been able to find out why and how this formula is derived.

From the formula what I can understand is that as the distance get larger, the result will become smaller; but how it is derived is beyond me.

If distance takes an important role in the above formula, which helps determine the intensity, could we simply ignore a and b from the formula and simply use:

attenuation = 1.0 / (1.0 + dist)

?

Does anyone know how the formula is derived and the importance the values a and b play within the formula?

Thanks.

sentences:
How to tell which segment user is interacting with in dynamic road building system? Im prototyping dynamic road building system as seen in most city builder games. I gather the points from user input (red dots) and programmatically generate mesh.

It's currently one big mesh, seems like a good default rendering performance wise.

Starting a new road/creating intersection from already existing road is a very important feature. Everything is pretty straight forward except how to know which segment user is hovering, clicking.

Options:

split segments into separate gameobjects and attach collider to each
use single big mesh and create empty gameobjects for colliders only

Is there a better way besides these two? That would be a lot of colliders if you consider the scale of city builders. I suspect there's a smarter way..

Note: on the other hand, if user adds new intersections, updating a huge mesh could be a problem. If I split meshes into reasonable chuncks, I could localize updates to only affected meshes.

Simplified data structure:

public class Road {
    public List<Segment> segments;
}

public class Segment {
    public Vector3 start;
    public Vector3 end;
}

sentences:
XNA Line to Rectangle Collision return first pixel I have the following code:

    public static bool LineIntersectsRect(Point p1, Point p2, Rectangle r)
    {
        return LineIntersectsLine(p1, p2, new Point(r.X, r.Y), new Point(r.X + r.Width, r.Y)) ||
               LineIntersectsLine(p1, p2, new Point(r.X + r.Width, r.Y), new Point(r.X + r.Width, r.Y + r.Height)) ||
               LineIntersectsLine(p1, p2, new Point(r.X + r.Width, r.Y + r.Height), new Point(r.X, r.Y + r.Height)) ||
               LineIntersectsLine(p1, p2, new Point(r.X, r.Y + r.Height), new Point(r.X, r.Y)) ||
               (r.Contains(p1) && r.Contains(p2));
    }

    private static bool LineIntersectsLine(Point l1p1, Point l1p2, Point l2p1, Point l2p2)
    {
        float q = (l1p1.Y - l2p1.Y) * (l2p2.X - l2p1.X) - (l1p1.X - l2p1.X) * (l2p2.Y - l2p1.Y);
        float d = (l1p2.X - l1p1.X) * (l2p2.Y - l2p1.Y) - (l1p2.Y - l1p1.Y) * (l2p2.X - l2p1.X);

        if (d == 0)
        {
            return false;
        }

        float r = q / d;

        q = (l1p1.Y - l2p1.Y) * (l1p2.X - l1p1.X) - (l1p1.X - l2p1.X) * (l1p2.Y - l1p1.Y);
        float s = q / d;

        if (r < 0 || r > 1 || s < 0 || s > 1)
        {
            return false;
        }

        return true;
    }

This code checks to see if a line intersects a given rectangle. But I need to find a way to get the position of the first pixel colliding between Point 'p1' and Point 'p2'.

Any help is appreciated.

sentences:
How to avoid many import iterations while generating sub assets? I have a ScriptedImporter that generates other assets in the same directory.

Whenever it happens, import progress bar pops in again, this time like Importing (iteration N).

I've tried to use AssetDatabase.DisallowAutoRefresh to circumvent this behavior but that failed.

Question:

How to prevent subsequent import iterations and rather group them to happen all at once ?

sentences:
How can I de-rig & delete the skeleton while keeping the mesh? There is this 3D model one can download here and  then import to 3DS Max with XNALara importer. (Side note: XNALara is also known as XnaPosingStudio)

Now this model already comes with a skeleton which is rigged. But if I want to rig the mesh to a different skeleton I need to delete the current skeleton correct?

When I have tried to delete the skeleton before the mesh got deleted with it.

So what I need to do is de-rig the skeleton from the mesh and then delete the skeleton, but how do I de-rig? Does anyone here know how? It's not a CAT rig.

sentences:
Adding an object viewer to a Unity Editor Window I'm wondering if its possible to add an object viewer (For example when you import an .fbx file into unity you can see a small preview of it in the inspector) to a Unity Editor Window? I've looked through the docs and didn't seem to be able to find anything for this

Thanks,

Lewis

sentences:
Unity Android Immersive mode leaving a black bar in the soft key area? The black bar is not hiding anything. Everything is drawn above it. But the black bar is there in place of the soft keys even when they are hidden.
I don't know how to hide it and render using whole screen.
The bar is only visible with device having soft keys not for device with physical keys.
 I have set the Screen.fullScreen = true.

Unity 2018.3.4f1

sentences:
How can I launch Visual Studio via a double-click on a C# script in Unity? This is my first time using Unity and I am following the tutorial for the 2D RogueLike Game. Everythings seems to be working properly, apart that I cant get Visual Studio to launch, if I'm double click my c# scripts.

What I have tried so far:

Checked my preferences, that External Script Editor says "Visual Studio 2017"
Reinstalled Unity and Visual Studio.

Unity Version: 2019.3.0a2 Personal

Hope somebody can help me.

Additional information:

After double click, nothing seems to be happening, even my mouse doesnt show a load icon
When I create a new project, the bug (dont know if bug, or my fault) is still there.
I can open the .sln file from my project in Visual Studio. Visual Studio can even autocomplete unity based code then, before it was a "miscellaneous file" and didnt autocomplete code like for example "Transform" or "Rigidbody2D".

sentences:
Game planning and software design? I feel that UML is not convenient In my university, they always emphasize and hype about UML design and stuff, in which I feel it is not going to work well with game structure design. Now, I just want a professional advice on how should I begin my game designing? The story is I have some skill in programming and have done many minor game such as getting some 2D platformer working to some extend. The problems that I find about my program is the poor quality design. After coding for a while, things start to break down due to poor planning (When I add new feature, it tends to make me have to recode the whole program). However, to plan everything out without a single design flaw is a bit too ideal. Therefore, any advice to how should I plan my game? How should I put it into visible pictures, so that me and my friends are able to overview the designs?

I planned to start coding a game with my friend. This is going to be my first teamwork, so any professional advices would be a pleasure. Is there any other alternatives than UML?

Another question is how does "prototyping" normally looks like?

sentences: Connect Micromax A100 with Eclipse I want to know that I can connect micromax a100 with the eclipse for android development or not. From other community I found that for development purpose micromax device can not be used. Also I doesn't found any usb driver for that. So please help to come out that.

sentences:
game server - fault tolerant If you have for example an MMO with 2000 players, and players are constantly removing / creating / swapping items (and doing some other important things that can't be lost).

If the updates are saved instantly in the database, since they are too many, the database dies. If you save them every "x" minute, there's a window where if your server app dies, players may lose items, and sometimes they may be expensive, let's say 100$, so that can't happen.

Is there a design or a guide I could read that handles this issue? The games I play today do not have that problem.

sentences:
Error in the order of the target points to be followed. How to set the order of elements in an array? I have a project where it has 1 NPC and 3 target points:

In the project I set the NPC to go to target point 1, then to 2, then to 3.

Expected path:

Path that is occurring:

This problem did not happen out of nowhere, but first I will explain the creation of the target points.

I created the first target point, added the components it needed, and then replicated it. Selecting the first target point and pressing CONTROL + W. I positioned the second target point, and then, again selecting the first target point, I again replicated it.

The order of the path was as expected. I modified some code (none of the codes I modified related to the NPC or target points). After that I created a new target point (replicating it from the first target point) and then my problem started.

The NPC was initially going to target point 3, to the 4, 1 and then 2.

Even excluding target point 4, the order did not return to the expected (1, 2 and 3).

I inserted a print after the loop that causes the NPC to move toward the target points, so I could figure out the order of the target points, and it is making sense with the order of the path that is taking place.

Blueprint + Print:

3 to 1 to 2.

I created 2 more target points, and see how the order changes without any sense:

4 to 5 to 1 to 2 to 3.

I added another 1 target point to see if it meets a pattern:

No sense at all.

I'd like to know how to set the order of target points in the array.

EDIT 1 (Root of the problem)

From what I researched, I came to the conclusion that the problem is due to the function Get All Actors Of Class (that I use to make the NPC follow the target point):

It was also researching that I discovered that I can search for a specific actor using tags.

Link where I made the discovery:

https://docs.unrealengine.com/en-us/Gameplay/HowTo/FindingActors/Blueprints

But this feature does not serve me, because I do not want to establish an exact number of target points, I would like the order of the path to be given by the name of the target points or at least by the creation order.

EDIT 2 (today opening the project again, the order is correct)

Correct order:

I suspected that if I added new target points, the problem would come back, but that was not what happened.

Again the order is correct:

Even so, I'd like you to tell me if there is any way to know all the elements of an array, and thus be able to treat, set, and order them. For this problem may occur again at some crucial moment.

sentences:
Unity3D, how much code do you write? I'm curious to know the workflow when creating a game in Unity3D?

Does it generate a lot of code for you?

My understanding is that you describe the game in Unity and do scripting on the back end to do the logic. Kind of like you use Unity to describe the puppets and you use a scripting language as the puppet master.

sentences:
Generating geometry when using VBO Currently I am working on a project in which I generate geometry based on the players movement. A glorified very long trail, composed of quads.

I am doing this by storing a STD::Vector, and removing the oldest verticies once enough exist, and then calling glDrawArrays.

I am interested in switching to a shader based model, usually examples I see the VBO is generated at start and then that's basically it. What is the best route to go about creating geometry in real time, using shader / VBO approach

sentences:
The A,I can't seems to move/strafe on the left continously? void Update()
{
    ChasingPlayer();
}

void ChasingPlayer()
{
    if (chasing == true)
    {
        transform.LookAt(player.transform);  //facing player
        transform.position += transform.forward * approaching * Time.deltaTime;  //going towards player
    }

        float distance = Vector3.Distance(transform.position, player.position);
    Debug.Log(distance); //calculating the distance between player and enemy
    if(distance < 10)
    {
        chasing = false;
        transform.position += Vector3.left * 2f * Time.deltaTime;
        Debug.Log("STOP!");
    }
}

I want my A.I to approach to the player but when it reaches within 10 feet(?), I want it to stop moving towards the player and strafe/move to the left or right from there but instead it just moving in a curve movement that leads towards the player. How should i stop the AI within 10 feet(?) and move to the left/right?

sentences:
Rotating 2D-Projectile towards mouse, hides the projectile (Maybe changes the layer) I want to shoot towards my mouse, which is working fine now. After this was solved, I wanted to rotate the projectile, so that it's looking to the mouse. This is my code:

projectile.transform.LookAt (target);

I think this should work, but suddenly my projectile is gone, I can still see the particles behind it but the projectile for itself isn't visible. So I think, that it switched to another layer. Target looks like this:

Vector2 target = Camera.main.ScreenToWorldPoint (new Vector2 (Input.mousePosition.x, Input.mousePosition.y));

So it shouldn't be possible that the z value is wrong am I right?

sentences:
How do we keep ourselves from being sued for unknown patent infringements? There's breaking news about Zynga being sued over some very obvious implementations. This is making me think that the game industry is full of landmines to be stepped on at every turn. What input does everyone have to minimize the damage?

Latest:
http://www.gamasutra.com/view/news/36657/Zynga_Sued_Over_Prize_Redemption_Patents.php

Another example:
https://w2.eff.org/patent/wanted/patent.php?p=sheldon

sentences:
Move a point to another, along an elipse according to this picture, I want to move my yellow object, smoothly to the red one. And I want to have an eliptic trajectory in relation to my center point.

So for now I'm having this code:

yellowPoint.position = Vector3.SmoothDamp(yellowPoint.position, redPoint.position, ref currentVelocity, dampingMove);

How can I change it to add the elipse, depending on a third center point ?
the itinial code can change of course.

Thanks you !

sentences: Does Steam provide persistent data storage to developers? Does Steam provide persistent data storage (for custom data) to developers? For example, would an online shooter be able to store player statistics (kills, matches, player deaths, etc.) on Steam servers?

sentences:
Collision detection in ruby I'm making a simple pong game in ruby.

I did the collision detection this way:

def collides_with(player)
      ((@x + @image.width >= player.x) && (@x <= player.x + player.image.width)) && ((@y + @image.height >= player.y) && (@y <= player.y + player.image.height))
end

If this is true I multiply the ball's y coordinate by -1 (to change its direction):

@ball.vy *= -1

This is working as expected, except in one case when the ball reaches the left (or right) side of the paddle while it's moving. this will cause the ball to move into the inside of the paddle,which seems strange.

What should I do to fix this?

sentences:
Does GLSL copy function arguments by value? My question is about passing variables to GLSL shader. I'm not sure how that works and what are the performance implications.

Say I got a function that accepts a "vec4" variable. The question is - is that variable copied at the entrance? I guess it makes impact on performance if so. And if it happens to be that way is there a way to pass only references like in C/C++?

sentences:
How can I create light shafts like Journey's in Unity? I'd like to create cartoon looking sun / light shafts that look very close (or identical) to the ones in very well known and loved games like Journey:

and Ori:

How can I accomplish this?

sentences:
How to motion capture animations? I'm not an animation artist and so I want to create some animations for testing.
I want to use a camcorder to record me while I'm running and so
I want to know if exists a software that grab the video and translate it
in animation frames.

sentences:
Fading alpha color with overall time. It's working but I need some help with some things to fix/change/add This is more or less what I wanted, It's working in general but there are things to fix/add/change :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FadeInOutSaveGameText : MonoBehaviour
{
    public Animator animator;
    public Canvas canvas;
    public float fadingSpeed;

    private bool stopFading = false;

    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(OverAllTime(5f));
    }

    IEnumerator CanvasAlphaChangeOverTime(Canvas canvas, float duration)
    {
        var alphaColor = canvas.GetComponent<CanvasGroup>().alpha;

        while (true)
        {
            alphaColor = (Mathf.Sin(Time.time * duration) + 1.0f) / 2.0f;
            canvas.GetComponent<CanvasGroup>().alpha = alphaColor;

            if(stopFading == true)
            {
                break;
            }

            yield return null;
        }
    }

    IEnumerator OverAllTime(float time)
    {
        StartCoroutine(CanvasAlphaChangeOverTime(canvas, fadingSpeed));

        yield return new WaitForSeconds(time);

        stopFading = true;
        StopCoroutine("CanvasAlphaChangeOverTime");
    }
}

Things to fix/change :

Does the line StopCoroutine really work ? If I'm not using the helper flag and make break; inside the loop then the fading weill never stop.

Should I use a helper flag and break; only or also StopCoroutine ?

When the CanvasAlphaChangeOverTime Coroutine stop then the fading also stop at the same point it is. but I want it to finish fading first depending on the fading direction. If it was changing to the 0 then first finish fading to 0 then stop the Coroutine and same if it was more then 0.5 changing to the 1 then first finish changing to 1 then stop the Coroutine.

Things to add :

An option to change the fadingSpeed in real time while the fading is working ? How to do it ?

sentences:
LWJGL—How to Animate and Render Characters Using a Sprite Sheet I'm making an RPG similar to Super Nintendo RPGs in the early '90s. I'm handling movement much like Squaresoft's Final Fantasy IV.

Notice that the player never actually changes his x and y positions on screen. What I'm asking, to be precise, is how could I, in LWJGL through user input (say, the arrow keys), take the sprite sheet I have of my character's movement animations and render them in a [partially] fluid animation like above?

I've been perusing the internet for hours, and I've not found a surefire way to do this. I don't have any code as of yet; I'm more or less looking for a guideline or some pointers in the right direction concerning how I might tackle this.

And, to note, this'll be a rather large game, so I want to focus partially on speed and efficiency—that meaning that I don't want to dive into Slick2D and libGDX unless absolutely necessary.

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:
How can I make an actor fire a bullet on touch? I created a Jet and a Bullet, and when Jet is touched, the Bullet is fired.

Now I want to know how can I make the Jet fire again when touched after it has fired the first shot?

public class MyGdxGame implements ApplicationListener{

    private Texture bulletTexture;
    private Texture jetTexture;
    private Stage stage;
    private JetActor jetActor;
    private BulletActor bulletActor;

    int counter=0;
    float jetX = 700,jetY = 150;
    float bulletX = jetX-10, bulletY = jetY +43;
    boolean started;

    public class JetActor extends Actor{

        public JetActor() {
            setBounds(jetX, jetY, jetTexture.getWidth(), jetTexture.getHeight());
            this.addListener(new InputListener(){
                public boolean touchDown(InputEvent event, float x, float y, int pointer, int buttons){
                    stage.addActor(bulletActor);
                    System.out.println(counter);
                    counter++;
                    started = true;
                    return true;
                }
            });

        }

        @Override
        public void draw(Batch batch, float parentAlpha) {
            batch.draw(jetTexture, jetX, jetY, jetTexture.getWidth(), jetTexture.getHeight());
        }
    }

    public class BulletActor extends Actor{
        @Override
        public void act(float delta) {
        }

        @Override
        public void draw(Batch batch, float parentAlpha) {
            batch.draw(bulletTexture,bulletX,bulletY,bulletTexture.getWidth(), bulletTexture.getHeight());
        }
    }

    @Override
    public void create() {
        bulletTexture = new Texture("C:\\Users\\User\\Documents\\LibGdxMainProjects\\SampleGame1\\android\\assets\\bullet.png");
        jetTexture = new Texture("C:\\Users\\User\\Documents\\LibGdxMainProjects\\SampleGame1\\android\\assets\\jet.png");
        stage = new Stage();
        jetActor = new JetActor();
        bulletActor = new BulletActor();
        stage.addActor(jetActor);
        Gdx.input.setInputProcessor(stage);
    }

    @Override
    public void dispose() {
    }

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

        if(started){
            bulletX -=5;
        }
        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

    @Override
    public void resize ( int width, int height){
    }

    @Override
    public void pause () {
    }

    @Override
    public void resume () {

    }
}

sentences:
Empty Synchronized method in game loop I am studying the gameloop used in Replica Island to understand a bit about Android game development. The main loop has the below logic...

GameThread.java (note the variable names in sample code dont match exact source code)

 while (!finished) {

        if (objectManager != null) {

            renderer.waitDrawingComplete();
            //Do more gameloop stuff after drawing is complete...
      }
 }

I was curious to see what waitDrawingComplete actually does, but found its just an empty syncrhonized method! I guess it does nothing, am I missing something here?

GameRenderer.java line 328

 public synchronized void waitDrawingComplete() {
 }

Source code can be checked out here with SVN if you feel like having a look: https://code.google.com/p/replicaisland/source/checkout

sentences:
Rotations and Origins I was hoping someone could explain to me, or help me understand, the math behind rotations and origins.
I'm working on a little top down space sim and I can rotate my ship just how I want it.

Now, when I get my blasters going it'd be nice if they shared the same rotation.

Here's a picture.

and here's some code!

blast.X = ship.X+5;
blast.Y = ship.Y;
blast.RotationAngle = ship.RotationAngle;
blast.Origin = new Vector2(ship.Origin.X,ship.Origin.Y);

I add five so the sprite adds up when facing right.
I tried adding five to the blast origin but no go.

Any help is much appreciated

sentences:
What is the differencen between ccTouchesEnded and ccTouchEnded I'm learning cocos2d-x. Following the tutorial I found that ccTouchesEnded works perfectly in linux (and windows) but when I replace by ccTouchEnded the event isn't detected anymore.

What are differences between this two functions? And why one is detected and the other isn't.

Taking the HelloWorld project sample as a base, I add the following lines in init()

this->setTouchEnabled(true);
this->schedule(schedule_selector(HelloWorld::updateGame));

Also, add this method to my code:

void HelloWorld::registerWithTouchDispatcher()
{
    // TouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,0,true);
    Director::getInstance()->getTouchDispatcher()->addStandardDelegate(this,0);
}

Then if I add ccTouchesEnded like this:

void HelloWorld::ccTouchesEnded(Set* touches, Event* event)
{
    // Choose one of the touches to work with
    Touch* touch = static_cast<Touch*>( touches->anyObject() );
    Point location = touch->getLocation();

    log("++++++++after  x:%f, y:%f", location.x, location.y);
}

it works perfectly but if I use ccTouchEnded as:

void HelloWorld::ccTouchEnded(Touch* touch, Event* event)
{
    Point location = touch->getLocation();

    log("++++++++after  x:%f, y:%f", location.x, location.y);
}

The events aren't fired.

Any help is welcome
Thanks!!

sentences:
tile based 2d level editor Possible Duplicate:
  Tools for creating 2d tile based maps

I am Indie Game developer and  I am looking for a tile based 2d level editor. I also would like to know the free ones as well as paid ones, which you feel as the best.

sentences:
How to set shader global variable in sharpdx without using Effect class I am working with SharpDX, i thinking to try using (uniform) global variables for HLSL constants instead of constant buffers.

But, in my code SharpDX's Effect class is not used: i use PixelShader and VertexShader classes instead - constructed directly from bytecode blobs (i just don't use techniques/passes, i compile shaders separately).

With Effect class, i can assign new value to any constant in HLSL program by its name, as DirectX allows that, in any time. Example (i haven't tested this; yes, its ugly here):

SharpDX.Direct3D11.Effect fx = //
fx.GetVariableByName("someOption").AsVector().Set<Vector3>(newVectorValue);//nice

But i don't use Effect class.
How can i set global HLSL variable using Vertex/PixelShader class instance?
If it is not possible, shame on SharpDX dev then, in native DirectX it is much easier.

sentences:
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:
Causing Update loop with Coroutine Unity Total Noob Alert! < 7 days with C# and Unity

My Win Game screen becomes SetActive and my Player is SetActive false when you are standing in a trigger and crouch. That all works fine except you cant see the crouch animation because he is IMMEDIATELY SetActive false.

I tried to delay this by creating a coroutine. The problem with that is this is all happening in the Update function (or whatever it's called) because of the getkeydown for crouch. That gets called once per frame so my coroutine is trying to go off once per frame.

I tried creating a bool called isCoroutineStarted and set it to false and then set it to true in the Coroutine to break the loop but that didn't work either.

Don't know what to do so I reverted it back to before where it doesn't show my crouch animation.

Here's my script (It's attached to a Game Object with the trigger):

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

public class xxxxxx : MonoBehaviour {

    public bool xxx = false;

    [SerializeField]
    private GameObject youWinUI;

    [SerializeField]
    private GameObject player;

    // Determines whether or not the player is standing on the xxxxx
    void OnTriggerEnter2D (Collider2D other)
    {
        xxx = true;
    }

    void OnTriggerExit2D (Collider2D other)
    {
        xxx = false;
    }

    //Turns on Win screen and makes player disappear when crouch on xxx
    void Update ()
    {
        if (Input.GetKeyDown (KeyCode.S) && xxx == true) {
            youWinUI.SetActive (true);
            player.SetActive (false);
        }
    }
}

P.S. ignore the x's no stealsies lol. Also this piece of script works as intended I just want a delay so you can see the crouch animation.

sentences:
Is std::deque the best option for storing my graphics objects? I am currently implementing an object buffer, which stores all the objects used in the game at one place. All other components of the game, like the user interface, the level loader, etc, add objects to this buffer and then the objects are accessed by the rendering engine to render them all at once.

I need to store the graphics object in the object buffer contiguously in memory, so that  i can take advantage of cpu caching while rendering. I also need to have stable pointers to the objects stored in the buffer as they have to be editable by their pointers by the components that created them, like the user interface must be able to access the graphics it put into the buffer in response to mouse movement with a pointer to that graphic.

These are the reasons i could not use either std::lists, which are not contiguous, or std::vectors, which invalidate all pointers when they reallocate. One data container i found useful was the std::deque, which though doesn't have complete contiguity, does allow some and keeps pointers valid, but what i wanted to ask was is

is there any other data structure out there which is better at what i want?

As far as i understand deques, they are implemented as vectors of arrays of all definite sizes. Is there a data structure that is able to allocate arrays with increasing size, like vector does?

sentences:
2D bone animation - point gun at mouse How is this handled?

https://www.youtube.com/watch?v=egk3yD1w4Wo

It's some form of kinematics which I kinda understand and I have a very solid grip of trig, but I don't know how to start with having both hands attached to a single weapon with each arm moving independently and the torso also moving to accommodate extreme angles. How would one keep the gun completely static (It appears to have an origin/rotation point at the shoulder) while having the arms bend with the hands static on the gun?

Is the gun rotated to point at the mouse and that motion propagates back through the arms? Or does it figure out where the gun needs to be pointed and then rotate the arms to match?

How is the movement handled for the torso? Is the torso only rotated when the arms reach a limit?

etc.

As you can see I have a lot of questions. I'd just like a starting point to begin with, or someone to suggest a way to approach it all. An example or tutorial would be great if you could point me to one.

What I'd like to avoid is using a third party program like DragonBones, Spriter or Spine. I'd like to start at the beginning of the problem to get a fuller understanding of it all.

Thanks!

sentences:
Which type of Xbox console should I get to begin developing games on it? If I want to start developing small indie-like games with XNA on Xbox (I don't think any game I'd make would need more than 100, maybe 200 megabytes), will the 4gb Slim (I want to get a slim version because of the wi-fi) version of the console be enough, or should I get the 250 gb version? I don't really plan to play actively on the console as I'm more interested in developing on it. Also, will a console and a verified student XBLIG account be enough to set up everything I need to run and debug my game on the console?
Thank you.

sentences:
Practice openGL or learn a specific engine? Possible Duplicate:
  Should I use Game Engines to learn to make 3D games?

I am a university student.
I want to work in the game industry.
Now I am thinking about either practicing my openGL skills or learn a complete new game engine during my time in school.
I will do this by developing a smartphone game.
I am debating over using just openGL or using a game engine.
If I learn a game engine, then if the company I want to work for does not use that game engine, then wouldn't it be a waste of time to learn that game engine now instead of solidifying my openGL skills?
So, openGL or game engine?
Thanks.

sentences:
Libgdx - overlapping stages - textbutton unclickable I've created a few TextButtons for a menu that render on top of another stage area, however the textbuttons that i've created for menu aren't clickable or don't provide any events. The MenuComponent class I created is being instantiated/rendered in another class.
The buttons show up, just unable to click anything or get any events from the buttons. Can someone take a look at the code I provided and maybe show me mistakes or something I forgot to implement to make them work?
MenuComponent Class:
   @Override
    public void create() {
        batch = new SpriteBatch();
        this.stage = new Stage();
        setRenderer(new ShapeRenderer());
        Gdx.input.setInputProcessor(stage);
        menuUp = new Texture("assets/ui/disengage.png");
        menuDown = new Texture("assets/ui/disengagePressed.png");

        Table menuWindow = new Table();
        this.menuWindow = menuWindow;
        menuWindow.setPosition(675,160);
        //Button View
        SpriteDrawable upFormat=new SpriteDrawable(new Sprite(createRoundPixMap(Color.BLACK,100, 30,10)));
        SpriteDrawable downFormat=new SpriteDrawable(new Sprite(createRoundPixMap(Color.RED,100, 30,10)));
        SpriteDrawable checkedFormat=new SpriteDrawable(new Sprite(createRoundPixMap(Color.BLACK,100, 30,10)));
        TextButtonStyle buttonStyle=new TextButtonStyle(upFormat, downFormat, checkedFormat, new BitmapFont());
        //Individual Buttons
        lobbyButton = new TextButton("Back to Lobby",buttonStyle);
        mapsButton = new TextButton("List Maps",buttonStyle);
        menuWindow.add(lobbyButton).pad(3,0,3,0).row();
        menuWindow.add(mapsButton).pad(3,0,3,0).row();
        menuWindow.setVisible(false);
        stage.addActor(menuWindow);
        stage.getRoot().setPosition(65,150);
    }

    @Override
    public void update() {
    }

    @Override
    public void render() {
        batch.begin();
        batch.draw((menuButtonIsDown)?menuDown:menuUp, MENU_buttonX, MENU_buttonY);

        batch.end();
        stage.act();
        stage.draw();
    }

Part of the class its being rendered/created in:
    @Override
    public void create() {
        generator = new FreeTypeFontGenerator(Gdx.files.internal("assets/font/Roboto-Regular.ttf"));
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.size = 10;
        parameter.spaceX = 0;
        parameter.shadowColor = new Color(0, 0, 0, 0.5f);
        parameter.borderColor = Color.BLACK;
        parameter.borderWidth = 1;
        parameter.borderStraight = true;
        parameter.shadowOffsetY = 1;
        parameter.shadowOffsetX = 1;
        font = generator.generateFont(parameter);

        renderer = new ShapeRenderer();
        this.batch = new SpriteBatch();
        sea = context.getManager().get(context.getAssetObject().sea,Texture.class);
        sea.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
        camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 200);
        this.mainmenu = new MenuComponent(context, this);
        mainmenu.create();
    }

    @Override
    public void render() {
        batch.setProjectionMatrix(camera.combined);
        batch.begin();

        Gdx.gl.glViewport(0,200, Gdx.graphics.getWidth(), Gdx.graphics.getHeight() - 200);

        mainmenu.render();
    }

sentences:
How do i set Lua variables? You can pretty easily read variables, but what about writing them to the lua file?

Ive given it a little go, but it doesnt seem to work...

void Lua::setBool(string path, string var, bool val) { //"Lua" is a class with my Lua functions (such as get bool, get float...)
    lua_State *L = luaL_newstate();
    luaL_openlibs(L);
    if (luaL_dofile(L, path.c_str())) { // For some reason, "!luaL_dofile" triggers if i input the path Correctly
        string msg = "Unable to open file " + path;
        MessageBox(NULL, msg.c_str(), "Lua IO", MB_ICONERROR);
    }

    lua_pushboolean(L, val);
    lua_setglobal(L, var.c_str());

    lua_close(L);
}

And yes, ive inputted "var" and "path" correctly.

sentences:
Unity & CSharp - Placing Instantiated Object in the Direction of Player So, I am making a Minecraft ripoff.
I have a raycast that hits a block. It then places a block inside of that block. I am trying to make it place next to the block in the direction the user is facing.
I got some of that figured out. I use:
Math.Round();
to round up the floats. My problem is figuring out what axis to round on. I need it to depend on the direction the player is facing to figure it out.
I tried doing a complicated algorithm to figure out which face of the collider the player is facing, but that didn't work out that well....

How do I solve this? I can't figure it out.

sentences:
2D Websocket WebGL game Inspired by BrowserQuest, I want to try my hand at making my own kind of game like this but I don't really know anything about game development other than the basics, like how the game loop works. Although, I feel more than confident with server-side/client-side JS so it's mostly just about learning concepts for me.

Some questions I've had so far when thinking about how I'll go about implementing it:

I understand there'll be unsynced client-side code and synced server-side code. If a player presses an arrow key on their keyboard, should it send that information to the server, then the server says it's ok, then the client does it? Or should the client just do it anyway then the server validate it after-the-fact and correct the client if they perform an invalid action?
The data going between server and client will initially be very simple. Currently I just have x and y positions for players. But how often is it ok for clients to send this data back to the server and the server to broadcast the data to all clients? I could do these things every 1ms which would make everything as smooth as possible, but wouldn't this kill the client/server or at least use a truck-load of bandwidth? I only have a very small VPS and wouldn't want to overload it by sending 1000 JSON objects to a bunch of clients every second when I don't have to. What's the sweet-spot here?
I want to include some PvP style combat in my game but am not sure if the websocket protocol is suitable for this. With UDP, data is sent back and forth super fast partly in thanks to its unreliable nature, right? With websockets, will the communication between clients/server be fast enough to process something like a player attacking another player?

Any other advice about this sort of thing would be great, even if it's just links to existing documentation/examples. Cheers.

sentences:
Finding the closest face normal from a given point in space efficiently I have a large model (roughly 400k faces) and a large number of points on this model (roughly 2000) and I need to calculate a normal per point based on the closest face on the model. Is there a faster way that isn't O(n*m) where n is the number of points and m is the number of faces (e.g., raycasting or iterating through every face)?

I'm using THREE.js and the target hardware is a Toshiba tablet with Intel integrated graphics so I don't have a lot of power to work with. Currently if I compute this on load it takes about 10+ minutes.

I've been given the requirement that there shouldn't be any model specific information precomputed for each point so that we can use the points on a different model without recomputing everything and then have multiple datasets of point => normal mappings. This is currently what we are doing and it works but doesn't scale well to our needs.

sentences:
What do you call the logic gates visual programming of PS4 Dreams? The PlayStation 4's Dreams app has a visual programming framework made up of sensors (detect touch, a person etc.), logic gates (AND, NOT, splitters etc.), wires, and action outputs (move somewhere, execute keyframe, teleport etc.). Through these flows energy which is usually a value between (presumably) 0.0 to 1.0. This in turn is used to create full games logic, movies and more.

Is there a name for this type of programming UI? I can think of a general "logic gates" programming or so, but maybe there's something more specific. Thanks!

sentences:
Reduce emission of sphere object with HDRP material I have a material which I have assigned to be used on a sphere game object which acts as stars.

This is what the settings are set to:

And this is what the Game View looks like:

I have also tried setting emission intensity to 0 nits and exposure weight to the minimum (0), but some stars still are far too bright, below is a screenshot of what it looks like with the altered emission intensity and exposure weight:

The bigger stars are far too emissive. I am trying to give each star a little glow. How do I reduce the emission?

sentences:
How to make a sprite jump up and then return to original position android java I am just starting out in game development and I am trying to make a simple android game using GDXLib. I want to make my sprite "ball" jump straight up in the air and then return to where it originally was. How would I do this? I have looked at multiple other answers from similar questions but none seem to work with my code. This is my code so far:

@Override
public void create () {
    batch = new SpriteBatch();
    background = new Texture("gamebackground.png");

    ball = new Texture("ball2.png");
    ball.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);

    spike1 = new Texture("spike1.png");
    spike1.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
    spike2 = new Texture("spike2.png");

}

@Override
public void render () {

    batch.begin();
    float scaleFactor = 2.0f;
    batch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    batch.draw(ball, 80, 145, ball.getWidth() * scaleFactor, ball.getHeight() * scaleFactor);
    batch.end();

Gdx.input.setInputProcessor(new InputAdapter () {
        @Override
           public boolean keyDown (int keycode) {
            if(keycode==Keys.UP)
            {
               ball.setHeight(ball.getHeight()+50);
            }
            return true;

    }

@Override
public void dispose () {

}

}

sentences:
How can I add a delay to my enemy spawning in Greenfoot? How can I add a delay between spawning my enemies in Greenfoot? I'm doing it from a class that is neither a world nor an actor, its made totally by me. I need to it spawn 3 enemies, 3 times, with a 1-second delay between each time. Here's what I've got now.

void attack()
{
    long beginTime = System.nanoTime();
    int i = 0;
    while(i < 3)
    {
        if ((System.nanoTime()-beginTime)/1000000000>1f)
        {
            for (int j = 0; j < 3; j++)
            {
                world.spawnEnemy();
            }
            i++;
        beginTime = System.nanoTime();
        }
    }
}

It's based off of this answer to this question. However, it does not at all give me the desired results. Instead, it entirely pauses everything else in the game (all of the actors, probably the world too, but I'm not sure) until the makeshift timer ends 1 second into it, and then spawns all 3 waves (all 9 enemies) at once.

sentences:
Mega Man screen scrolling in JavaScript I'm trying to create screen transitions similar to those found in Mega Man or Legend of Zelda (i.e. the active elements of the first screen are stopped as the screen scrolls in the direction of the new screen then the active elements of the new screen become active again).  I'm making this for a 2D browser game written in JavaScript.
Right now, I can only make the screen scroll as long as the player remains on the edge of the screen; the player can still move when the transition is taking place, which stops the scrolling midway through transition. Below is the code I'm using to make this happen.  If anyone can help me with this, I would really appreciate it.

//checks if player has touched right side of screen
//*used to change screen color
if(this.rightX == gameWidth){
    screenShift = true;
    if(bgDrawX2 > 600){
        bgDrawX-=5;
        bgDrawX2-=5;
        drawBg();
    }
    screenShift = false;
}

if(this.leftX == 0){
    screenShift = true;
    if(bgDrawX2 < 1200){
        bgDrawX+=5;
        bgDrawX2+=5;
        drawBg();
    }
    screenShift = false;
}

sentences:
Blurry text in Unity UI at default scale I'm working on a VR (GoogleVR Cardboard) game, and need to include UI elements within it.

Ever since I first learned how to use Unity's UI elements, I've been limping around what seems to be a major problem: at the default (1,1,1) scale, literally everything involving fonts that I add to a world-space Canvas ends up looking like scaled, blurry bitmaps.

I can kludge around the problem by manually changing the scale of everything UI-related to (0.1, 0.1, 0.1) and multiplying the dimensions of everything by 10... but I can't believe this is how Unity's UI editing is intended to work by design.

Somewhere along the line, I must have overlooked something major. The question is... what? Is there an option somewhere to either make Unity render fonts at a higher resolution, or to at least change the default scale for new items from (1,1,1) to (0.1, 0.1, 0.1) & multiply all the default dimensions for new UI items by 10?

sentences:
3D visual effects on videos I'm trying to get some hands-on experience with 3D visual effects on videos. Similar to those AR apps, I want to add a 3D model with effects, say a dragon, to a video. Something like this famous demo:
https://youtu.be/u5hQpRbHERg
But I don't really want to make it this fancy with camera tracking. I like to start with the simplest approach- probably just placing a dragon on the field (like its last scenes) with fixed camera.
What's the best way to do it? Some tutorials would be very helpful.

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: Unity Extension method with coroutine Is it possible to have extension methods that starts coroutines? Id like to have an extension method for the GameObject that checks if itself has a renderer and a material and then lerps the color to a target color.

sentences:
Light on every model and not in the whole scene I am using a custom shader and try to pass the effect on my Models like that:

foreach (ModelMesh mesh in Model.Meshes)
{
       foreach (ModelMeshPart part in mesh.MeshParts)
       {
           part.Effect = effect;
       }
       mesh.Draw();
}

My only issue is that every Model now has its own light source in it. Why is this happening and is this a problem of my shader?

Edit:

These are the parameters passed to the shader:

      private void Get_lambertEffect()
            {
                if (_lambertEffect == null) _lambertEffect = Engine.LambertEffect;

                //Lambert technique (LambertWithShadows, LambertWithShadows2x2PCF, LambertWithShadows3x3PCF)
                _lambertEffect.CurrentTechnique = _lambertEffect.Techniques["LambertWithShadows3x3PCF"];
                _lambertEffect.Parameters["texelSize"].SetValue(Engine.ShadowMap.TexelSize);

                //ShadowMap parameters
                _lambertEffect.Parameters["lightViewProjection"].SetValue(Engine.ShadowMap.LightViewProjectionMatrix);
                _lambertEffect.Parameters["textureScaleBias"].SetValue(Engine.ShadowMap.TextureScaleBiasMatrix);
                _lambertEffect.Parameters["depthBias"].SetValue(Engine.ShadowMap.DepthBias);
                _lambertEffect.Parameters["shadowMap"].SetValue(Engine.ShadowMap.ShadowMapTexture);

                //Camera view and projection parameters
                _lambertEffect.Parameters["view"].SetValue(Engine._camera.ViewMatrix);
                _lambertEffect.Parameters["projection"].SetValue(Engine._camera.ProjectionMatrix);
                _lambertEffect.Parameters["world"].SetValue(
                Matrix.CreateScale(Size) *
                world
            );
                //Light and color
                _lambertEffect.Parameters["lightDir"].SetValue(Engine._sourceLight.Direction);
                _lambertEffect.Parameters["lightColor"].SetValue(Engine._sourceLight.Color);
                _lambertEffect.Parameters["materialAmbient"].SetValue(Engine.Material.Ambient);
                _lambertEffect.Parameters["materialDiffuse"].SetValue(Engine.Material.Diffuse);
                _lambertEffect.Parameters["colorMap"].SetValue(ColorTexture.Create(Engine.GraphicsDevice, Color.Red));

            }

Image:

sentences:
What makes a computer opponent feel alive? Are there any recommended blogs or whitepapers that talk about making the AI in an RPG game feel more real? (Specifically in turn based combat.)

I know something must be out there, but I am only finding papers that talk about algorithms  behind the AI. I am looking more along the lines of "this is what makes a computer opponent feel alive". Taking risks, going easy, retreating, etc....

So many awesome answers, and I wish I could accept several of them. Thanks everyone!

sentences:
How do I respond to keyboard events which occur between polling? In my games update loop, which happens on a fixed timestep of 30 times per second, I am checking the current state of several keys to determine how to move the player.
For example:

if(Keyboard.down(KEY_LEFT) { /* move character left */ }

This works fine in situations where I expect the player to hold the key down for extended periods (such as movement), but for things like shooting, where the player just taps the key quickly, it doesn't always pick up the key being down.

This is due to the key being both pressed and released in the gap between polling.

Now obviously I don't want to trigger my shooting code 30 times a second like I do my moving code, so the solution needs to incorporate some kind of buffering/delay mechanism to make sure each shot is still x milliseconds apart, but I need the first one to register immediately and with certainty.

I am using Javascript, so I can easily use event driven functions linked to keypresses (in fact I am doing this already in order to keep track of which keys are down), but I didn't want to have game logic outside of the fixed timestep update.

Can anyone suggest a solution? I'm not looking for code, more an idea of how to design/structure the code around the problem.

sentences:
Limiting interaction between certain RigidBodies I'm developing a 2D game in Unity and have been tasked with building a particular feature I'm not sure how to accomplish with Unity's physics engine. To simplify, a bunch of objects of type X and O are filled into a pit:

XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXoXXXoXXXoX

Both objects have Rigidbody2Ds and colliders. Objects of type X have normal gravity and should settle into place. Objects of type O have inverse gravity and should float.

However, O should not be able to push X, and X should not be able to push O. Another way of looking at it is that O should only be able to move upward, and X should only be able to move downward. If we remove some of the Xs directly above an O, the O should float upwards as the Xs fall downwards until the Xs settle on top of the O and everything stops moving:

XXXXXXXXXXXX        XX XXXXXXXXX
XX XXXXXXXXX   -->  XXXXXXXXXXXX
XX XXXXXXXXX   -->  XXoXXXXXXXXX
XXoXXXoXXXoX        XX XXXoXXXoX

(In the actual game Xs and Os can be different sizes; their movement is continuous and they are not constrained into rows or columns).

The Os should be able to support the weight of any arbitrary number of Xs without sinking.

XXXXXXXXXXXX
XXXXXXXXXXXX
XooooooooooX
X          X

Lastly, the Os should be able to float diagonally if there is a space available:

XXXX XXXXXXX      XXX       XX
XXXXX     XX  --> XXXXX   XXXX
XXXX    XXXX  --> XXXXoXXXXXXX
XXXo XXXXXXX      XXXX XXXXXXX

I can't solve this problem simply by adjusting the mass of the Xs or Os since the number of Xs on top of an O may vary. I can't use the built-in RigidBody constraints since they don't allow you to disable only one direction along an axis (e.g. saying an object can move upward but not downward).

What's the proper way to handle this? I could do something like this:

void FixedUpdate() {
    if (movementDirection == Direction.UP) {
        if (transform.position.y < lastYCoordinate) {
            Vector3 position = transform.position;
            position.y = lastYCoordinate;
            transform.position = position;
        }
    }
    lastYCoordinate = transform.position.y;
}

but that feels hacky to me and I suspect it will keep the objects from sleeping. Are there better solutions here?

sentences:
Handling Background & other objects in a Flash platformer I asked a similar question in 'SO' not knowing about this place,anyways here goes:

I wanted to know what the best approaches are while creating a platformer based game for handling background & objects.

Tiled method - Using small objects & loading on-the-fly :
I understand this is good for employing a level editor for the game later but wouldn't it become too processor intensive to manage so many tiles(using arrays, i assume). Especially if have many objects which also might be mutually exclusive (eg different sets of bg objects which react differently to user). Please throw some light on what usually the tile sizes often considered. I have a doubt that I used too small tiles which reduced my frame rate drastically.

Create, store & scale:
Creating the whole level & storing them in separate movie clips, scaling them while the level loads. I found this method could solve the frame rate problem, but I then had to handle the issue of not  being able to place objects (like enemy, power ups, etc) during runtime, as I no longer tracked the exact locations of the player (hero) in the game.

sentences:
Buttons implementation with regards to a basic Game Loop As the title states I am creating a game with SFML being the only library used.

I am entirely unsure how to go about this.

I want the buttons to be activated by simple mouse clicks (when the mouse is within the defined area of the button).

My question however is how do I do this with regards to a standard Game Loop, with the following methods HandleInput(), Update() and Draw().

Should I implement it so that HandleInput() calls a function (on left
mouse click) which stores the mouse coordinates and in Update() every
button checks if it has been clicked on?
Or should I (attempt to) implement Observer pattern?
Or is there a method I haven't even covered?

I hope this question is relevant to GameDev I believe it is.

sentences:
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:
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:
In cocos2d's plist output, what are 'offset,' 'colorSourceRect,' and these other fields? <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>frames</key>
            <dict>
                <key>frame1.png</key>
                <dict>
                    <key>frame</key>
                    <string>{{0,0},{96,288}}</string>
                    <key>offset</key>
                    <string>{3,-6}</string>
                    <key>rotated</key>
                    <false/>
                    <key>sourceColorRect</key>
                    <string>{{80,12},{96,288}}</string>
                    <key>sourceSize</key>
                    <string>{250,300}</string>
                </dict>
                <key>frame2.png</key>
                <dict>
                    <key>frame</key>
                    <string>{{96,0},{96,288}}</string>
                    <key>offset</key>
                    <string>{3,-6}</string>
                    <key>rotated</key>
                    <false/>
                    <key>sourceColorRect</key>
                    <string>{{80,12},{96,288}}</string>
                    <key>sourceSize</key>
                    <string>{250,300}</string>
                </dict>

Above there is a part of a plist output in cocos2d format. each frame has own node, I do not know what is offset, sourceColorRect is. the first string node is the Rectangle of the current frame on sprite, but what are the "offset", "sourceColorRect" and "sourceSize"

sentences:
OpenGl indices array I have a class terrain which create a grid of Quads. I do it like this

for(int z=0; z<_length;z++){
            for(int x=0; x<_width;x++){
                vertices.push_back(vec3((float)x*250, 0.f, (float)z*250));
    }
}
for(int z=0; z<(_length-1);++z){
    for(int x=0; x<(_width-1);++x){
        int index = z*_width+x;
        Vertex _vertices[] = {
            Vertex(vertices.at(index),vec3(0, 0, 0)),
            Vertex(vertices.at(index+1),vec3(0, 0, 0)),
            Vertex(vertices.at(index+_width),vec3(0, 0, 0)),
            Vertex(vertices.at(index+1+_width),vec3(0,0,0))
        };

        unsigned short indices[]= {index,index + 1,index +
            _width,index + 1,index +  _width,index +  _width + 1};
        Quad quad(_vertices, 4, indices, 6);
        squares.push_back(quad);
        i++;
    }
}

The vertices and the logic are correct, but the indices aren't, for some reason. here is the output for this code :

But when I change this indices to this :

            unsigned short indices[]= {0,1,2,1,2,3};

It works great :

The problem is I don't understand why this line

        unsigned short indices[]= {index,index + 1,index +
            _width,index + 1,index +  _width,index +  _width + 1};

doesn't work. And if it worked, my grid would consume a lot less ressources. If someone could explain me why it doesn't work, It would be great, thanks you.
In case you need to know how I draw a Quad, here is the code :

class Quad{
public:
    Quad(Vertex *_vertices, int _n, unsigned short * _indices, unsigned short _numIndices){
        for(int i=0; i < _numIndices; i++){
            indices.push_back(_indices[i]);
        }

        for(int i=0; i<_n; i++){
            vec3 v = vec3(_vertices[i].position, _lengthPower);
            position.push_back(v);
        }
        glGenVertexArrays(1, &mVertexArray);
        glBindVertexArray(mVertexArray);

        glGenBuffers(1, &mPositionBuffer);
        glBindBuffer(GL_ARRAY_BUFFER, mPositionBuffer);
        glBufferData(GL_ARRAY_BUFFER, sizeof(vec3)*position.size(), position.data(), GL_STATIC_DRAW);

        glGenBuffers(1, &mIndicesBuffer);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndicesBuffer);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned short)*indices.size(), indices.data(), GL_STATIC_DRAW);

    }

    void draw(){
        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, mPositionBuffer);
        glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndicesBuffer);
        glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_SHORT, 0);
        glDisableVertexAttribArray(0);

    }
    ~Quad(){

    }
private:

    std::vector<unsigned short> indices;
    std::vector<vec3> position;
    GLuint mVertexArray;
    GLuint mPositionBuffer;
    GLuint mIndicesBuffer;
};

I'm using, OpenGL, glm, glfw etc.

sentences:
Most efficient way to get the closest point to a 3d rectangle I have a 3D rectangle, with 4 points (x,y,z)
And I have a player, who can be anywere (inside the rectangle, outside, not even in the plane, in the corner...).

I would like to get the closest point in that rectangle, to my player. The most efficient way

I have already a struct who can say the closest point to a line:

public struct ExtLine
{
    public readonly Vector3 A;
    public readonly Vector3 B;
    public readonly Vector3 Delta;
    public bool noGravityBorders;//if I want to return true only if player is in the boundary

    public ExtLine(Vector3 a, Vector3 b, bool _noGravityBorders)
    {
        A = a;
        B = b;
        Delta = b - a;
        noGravityBorders = _noGravityBorders;
    }

    public Vector3 PointAt(double t) => A + (float)t * Delta;
    public double LengthSquared => Delta.sqrMagnitude;
    public double LengthLine => Delta.magnitude;

    public Vector3 ClosestPointTo(Vector3 p)
    {
        //The normalized "distance" from a to your closest point
        double distance = Project(p);

        if (distance < 0)     //Check if P projection is over vectorAB
        {
            if (noGravityBorders)
                return (ExtUtilityFunction.GetNullVector()); //an extention who give me an "null vector", not useful here
            return A;
        }
        else if (distance > 1)
        {
            if (noGravityBorders)
                return (ExtUtilityFunction.GetNullVector());
            return B;
        }
        else
        {
            return A + Delta * (float)distance;
        }
    }

    public double GetLenght()
    {
        return (LengthLine);
    }

    public double Project(Vector3 p) => Vector3.DotProduct(Delta, p - A) / LengthSquared;
}

And a struct who can say the closest point to a plane:

public struct ExtPlane
{
    public Vector3 Point;
    public Vector3 Direction;

    public ExtPlane(Vector3 point, Vector3 direction)
    {
        Point = point;
        Direction = direction;
    }

    public bool IsAbove(Vector3 q) => Vector3.DotProduct(q - Point, Direction) > 0;

    public Vector3 Project(Vector3 randomPointInPlane, Vector3 normalPlane, Vector3 pointToProject)
    {
        Vector3 v = pointToProject - randomPointInPlane;
        Vector3 d = Vector3.Project(v, normalPlane.normalized);
        Vector3 projectedPoint = pointToProject - d;
        return (projectedPoint);
    }
}

How can I manage to find my point ?
Thanks for help !

sentences:
how to add an onclick event to a button? If I will draw a button with canvas with any programming language (java,javascript....) I want to know how to add the events to what I've drawn for example If I will draw a button piture then what I have to do to be able to make an onclick event to that button in my case I'm trying to make a javascript application but In canvas it's a drawing so how could we add a button ? Please comment with any idea you have ?

  Example : When I run my game the player will find a welcome page with
  a start button drawn with Photoshop or something like that and it has
  been drawn by a canvas so how could I add a MouseListener to that
  button ?

sentences:
How To Have My Character Turn When The Camera View Moves So I have recently finished animating my character, having it move with key presses and have applied a camera to it. But I am stumped on how to have the player turn when the camera view moves, and have them both in sink. I want to have this instead of using keys to turn because that can be very awkward and hard to control. I would really appreciate any help I can get on this, as it will allow me to finally finish my character.

Thanks, Nova

sentences:
How can I import a model from a Source Engine game into Unreal Engine 4? I am currently developing a game in Unreal Engine 4. This project is for personal use, and will not be exhibited or sold.

Because I have no talent, I need to snatch some models from some Source Engine games.

Does anyone happen to know how I would port these models into UE4?

I have Blender and Crowbar already installed.

sentences:
Sync a file across multiple devices How can a file be synced across multiple devices? I am able to store the data locally using binary serialization, but the user should have the ability to access it on any device at any time.

Is this done automatically by the operating system? If the user logs into an Android phone using a Google account, would local data created by the application appear on every device that Google account is logged into or would I need to implement this functionality myself?

I have considered using a remote database, but I am not so sure that is the best option. My target platforms are Windows Universal, Android, and iOS.

The closest topic I found when I researched this is "Remote Settings" and "binary serialization", but neither help in my case.

sentences:
Unity animation won't play on trigger. What do I do to fix it? Ok so I added a play animation line to my trigger script. I made an animation, added it to the trigger object, attached the animation to the trigger, and tested. The target goes to the trigger as it should, deletes the trigger, but the animation never plays. So I check the console, and it's telling me "The AnimationClip 'MazeDoorClose' used by the Animation component 'SuckInTarget' must be marked as Legacy." so I do that, but now the trigger activates before the target gets there, and there is still no animation playing!

I know this sounds confusing so in an attempt to make it easier to understand I made a short video . Sorry for the crappy quality, but hey it's free.
Here is the code:

using UnityEngine;
using System.Collections;

public class SuckIn : MonoBehaviour
{

    public Transform target;
    public float speed;
    public string ObjectWithTagToBeDestroyed;
    public string ThingToAnimate;

    void Update()
    {
        float step = speed * Time.deltaTime;
        target.position = Vector3.MoveTowards(target.position, transform.position, step);
    }

    void OnTriggerEnter(Collider coll)
    {
        if (coll.gameObject.tag == "Ball")
        {
            Destroy(GameObject.FindWithTag(ObjectWithTagToBeDestroyed));
            GetComponent<Animation>().Play(ThingToAnimate);
        }
    }

}

Before you ask yes the animation is on the object as it should be, and as Unity told me to do I marked it as a legacy animation. Any ideas what  am doing wrong?

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:
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:
Open world game state saving Android As a hobby project I'm building a 2D game with a custom game engine in Android. Currently I can render a json map, and let the user interact with objects on the map. The game should be an open world map, with multiple maps. One of my current maps has a 150 x 150 tile pattern, with on every tile one or more objects. Thus, the map has 22.500, multiple layers, and more attributes. The player can edit objects (like fish in water object, plant seeds in soil, etc.), so every object needs to be stored separately. Some objects, like growing plants, need to be updated over time, even when the player is not playing the game.

My question is about efficiently saving and loading the game state. I think I need to store all the attributes of the maps, together with the objects, player progress, npc progress, and so on. Since this is a lot of data for a mobile device, I can't think of a good way to store this on the phone (or in the cloud).

I've tried the following:
- Store the entire game state in a serialized file. The parsing of this file took way to long while loading, and when one object's state changed, the whole game had to be loaded.
- Store every object in a sqlite database, with for every attribute a column. This was even slower than the first option, so not an option either.
- Store every object serialized as a blob in the database. This option wasn't much faster than the previous one.

I've been looking at ObjectBox, but in order to create the entity values for this database, I need to change a lot of reference values to ToOne<> or ToMany<> objects, which will take a lot of time and since I am using the map attributes to render the maps, the wrapping and unwrapping of the objects would cause (unnecessary) delay. (This is an assumption)

How do I save the game state without causing a 20-minute loading delay?

sentences:
Setting Camera's Viewing parameters manually I am working on Context-aware camera in Unity. in this project i have to set parameters of the camera each frame manually depending on what camera sees on the screen. New View (v) direction is given and Up (u) and Right (r) vectors should be such that they minimize torsion with previous frame's u and r. I have deployed the following code to accomplish the given task:

 Vector3 viewNew = -m_Normal;
 Vector3upNew=Vector3.Cross(viewNew,m_CameraPrevTransform.right).normalized;
 Vector3 rightNew = Vector3.Cross(viewNew, upNew).normalized;
         ...
 transform.forward = viewNew;
 transform.up = upNew;
 transform.right = rightNew;

The problem is: it seems like Unity tries to automatically adjust parameters when one of the directions (up, forward, right ) are set. Is there a workaround ? is it possible to get more control of the camera?

sentences:
How can I prevent the following animation frames from affecting the state of the previous animation frames in Unity? How can I prevent the following animation frames from affecting the state of the previous animation frames in Unity?
E.g. I create a frame at 0:20 by moving a character leg. And that is it - that is what I would like my character to look like at the 0:20 and I would like to change nothing more about the current positioning of my character parts and never.
But, here I proceed to the 0:40 and move another part of my character - foot this time. And now instead of starting to move after the 0:20 the foot starts to move from the 0:00.
That drives me crazy, because now I have to go through all of the frames before the 0:40 and modify the foot position. Of course in the presented case there is only one frame to update - that is the 0:20. But when I work with complex and long animations I easily stumble across having to update 10 or even more of the previous frames each time I decide to move a part which I did not move in the previous frames.
I noticed the Add keyframe button in the Animation window. I would expect it to preserve all the character parts in frame and solve my issue. But it does not prevent the case explained above from happening.
Another thing I was thinking about is to develop animations backwards - starting from the last frame and proceed to the first frame. But that feels like a lame user experience from a Unity user point of view.
Any help here would be appreciated.

sentences:
Get quaternion between two objects on sphere In a planetary gravity environment objects are represented in the following way:

struct object {
    struct quaternion quat; // quaternion to represent the rotation between the object and the center of the planet
    float dist; // distance from the center of the planet
};

Here are the steps at which I position my player:

// start at center of the planet
applyQuaternion(&object.quat);
glTranslatef(0.0f, object.dist, 0.0f);
drawObject(&object);

Step 1, translate to center of planet:

Step 2, apply quaternion:

Step 3, translate outwards by distance value:

I am also able to get the current position of the player or enemy by using this code:

struct matrix initialMatrix, resultantMatrix;
glPushMatrix();
getPositionMatrix(&initialMatrix);
applyQuaternion(&player.quat);
glTranslatef32(0, player.dist, 0);
getPositionMatrix(&resultantMatrix);
playerPosition = matrixTranslationToVector(initialMatrix, resultantMatrix);
glPopMatrix();

Given two objects:

struct object player;
struct object enemy;

How can I get the enemy to face in the direction of the player, whilst always standing upright on the planet, using quaternions?

I want the enemy to go from this:

To this:

His feet always on the planet, and head always away from planet.

I'm able to rotate on the axis which doesn't affect the position (from first enemy diagram to second enemy diagram like so):

// Rotate right
Quaternion_multiply(&player.quat, Quaternion_fromAxisAngle(vect(0.0f, 0.0f, 1.0f), degreesToAngle(2)));

// Rotate left
Quaternion_multiply(&player.quat, Quaternion_fromAxisAngle(vect(0.0f, 0.0f, 1.0f), degreesToAngle(-2)));

So I'm unsure as to why I'd need a local orientation in addition to the quaternion I already have.

sentences: How to calculate fps in GLFW? Just letting you guys know before anything I'm a beginner at programming. I am just wondering how I should go about calculating the fps using GLFW?

sentences:
Could a Peer-To-Peer network architecture be good for my fighting game I am looking forward to developing a 2D spaceship-fighting, brawler game and I have so many ideas about it. I am going to make a single-player component anyway, but the core of this game would certainly be its multiplayer.
For this game, I was inspired by Brawlhalla and its dynamic play-style. In my game, there has to be real-time action features such as attack, dodge, getting hit, killed, so a reliable networking needs to exist. I have thought initially about a client/server architecture, but a peer-to-peer connection would be in my opinion more easily for me to implement.
I have read this article and it proves encouraging for me to go on with this simulation solution.

Let me describe my concept:

A client initializes a room and using sockets, IP, port and the other players would after connect to him. Therefore, there is always a Master Client that handles the new connections and gives signal to other clients about a new existing player. Then, as the game is running, the byte data-packets would stream each player's input, his position, his ship rotation, his ship status and so on, so that each of the other clients could run a perfect simulation of the initial client. In other words, this data packets would trigger all the actions on each client. As network protocol, I am thinking about TCP/IP and should someone be willing explain to me in more practical terms the difference between this and UDP, I would be thankful.

I have even computed how much data it would take to transmit over a second: assuming a byte[256] array that holds all the data at one time multiplied by the number of calls per second (about 32 times) multiplied by the number of clients the data should be broadcasted to (3-4)
results in about 32 kb/s. It might be a dummy result, i might have left a lot of things out, but again, I am ready to learn.

As a note, I do not intend to make at this moment a professional multiplayer system, but rather, I would like to learn more about this programming part of applications and I think this is a very good project idea to enhance my skills.
Of course, I am opened to any advanced tips, solutions, materials and should I add anything else about my concept, please let me know.

How is my theoretical model so far?

sentences:
How do I move an object in a square pattern? I have some bots that can move via setting the x and y. I have already been able to make them move in a circle pattern, but how do I make them rotate around the player in a square pattern? I'm not very good at math, so I'd appreciate some help.

Here is what it looks like now:

here is how I did circle pattern.

var PI2 = 2 * Math.PI, FOLLOWADD = PI2 / 18/*PI2 / 360 * 20*/, BOTSLICE = PI2 / BOTS;

bots.follow = function(id) {
    if (!ppl()[id])
        id = protocol.id; //player is default

    var pos = getPos(id), a, i = BOTS;
    while (i--)
        if (this[i] && !this.busy) {
            a = BOTSLICE * i + f;
          this[i].pos.x = pos.x + (Math.cos(2 * Math.PI / BOTS * i + f) * 3);
            this[i].pos.y = pos.y + (Math.sin(2 * Math.PI / BOTS * i + f) * 3);
        }
    f = (f + FOLLOWADD) % PI2;
}.bind(bots);

sentences: Free ebooks about game development Are there good free ebooks on game development? I don't care if they are theoretical or technology specific, I want to start reading one free book that worth it.

sentences:
glColor3f Setting colour This draws a white vertical line from 640 to 768 at x512:

glDisable(GL_TEXTURE_2D);
glBegin(GL_LINES);
      glColor3f((double)R/255,(double)G/255,(double)B/255);
      glVertex3f(SX, -SPosY, 0); // origin of the line
      glVertex3f(SX, -EPosY, 0); // ending point of the line
glEnd();
glEnable(GL_TEXTURE_2D);

This works, but after having a problem where it wouldn't draw it white (Or to any colour passed) I discovered that disabling GL_TEXTURE_2D Before drawing the line, and the re-enabling it afterwards for other things, fixed it. I want to know, is this a normal step a programmer might take? Or is it highly inefficient? I don't want to be causing any slow downs due to a mistake =)

Thanks

sentences:
How can I tell if a set of tiles form an enclosure? I have this tile-based game I've been messing around with and I want to have a way to check if a set of wall tiles make an enclosed space.

Here's some more details:
I have a tile map. Each tile has an ID. If you have a set of IDs like so:

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

0 is grass, 1 is wall, and 2 is floor. Assuming these have a spot in a 2d array, how can I find and confirm if whether or not the floor tile is surrounded by walls. This method has to be scalable as well. So if the floor area is 2x2 it would still work.

I've already tried implementing a way to check it, but I failed on my first couple of tries. Any recommendations?

sentences:
How to create a random array of Transforms and Instantiate the random item? I'm trying to make a rock that after you break it, it will spawn a random item from the minerals array. How can I pick a random item from the minerals array and then instantiate it?

    var rockHealth : int = 50;
    var rock : GameObject;
    var speed : int = 8;
    var rb : Rigidbody;

    var copper : Transform;
    var gold : Transform;

    var minerals : Transform[];
    minerals.push(copper);
    minerals.push(gold);

    function DeductPoints(hitpoints : int) {
     rockHealth -= hitpoints;
    }

    function Update() {
     if(rockHealth <= 0) {
         DestroyRock();
     }
    }

    function DestroyRock() {
     Destroy(rock);
     var position : Vector3 = Vector3(Random.Range(-1.0, 1.0), 0, Random.Range(-1.0,1.0));
     Instantiate("random mineral would go here", rock.transform.position + Vector3(0,0,0) + position, Quaternion.identity);
    }

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: What do I need to develop for the Playstation 3? I made a game, and I want to port it to the Playstation 3. What do I need in terms of hardware, money, licenses and such?

sentences:
How to build a math module and simulate a system? For example, in the classical game SimCity:

an economic model to simulate the supply and demand of the city, then calculate how many people live in each building, how many people work there.
a traffic model to simulate the commute time of the citizens,
in another game, there'd be a whole stock market, where the player and sim-citizens can buy and sell.

Obviously, we cannot simulate every single citizen, every single car, every single trader in the market, we need some math modules and formulas.

I'm making a fake SimCity and almost finished the graphics parts. Now I'd like to know how to do the math parts, or how to build such math modules.

sentences:
Is it possible to import UV-maps in Unity3D without manually importing the associated texture? When i import an object from Maya with a defined UV-map i have to manually import the texture (image) and assign it to the material.

Is there a way to keep the materials texture reference from Maya when importing into Unity?

sentences:
NodeJS setTimeOut - How to run callback before delay time exceeded I'm developing a card game server.
I want to do this :
While server process a turn for players, players have 20 seconds to do something. If players send a request to server within 20 secs, timer will stop and the callback will fire.

I'm doing like this :

self.tables[table.id].currentTimer = setTimeout(function () {
    callback();
}, 20*1000);

How should I run the callback before delay time exceeded ?

sentences:
Import JXInput by StrikerX3 Into Eclipse I'll be honest, I'm stumped, I've been trying all night, googling away, made multiple attempts and failed every time. The library in question that I'm trying to add to my project is:
https://github.com/StrikerX3/JXInput
The instructions say:

Usage:
1. Install the project into your Maven repository (since it is not available in the Central Maven repository).

2. Include the Maven dependency into your project:

<dependency>
    <groupId>com.ivan</groupId>
    <artifactId>xinput-device</artifactId>
    <version>0.5</version>
</dependency>

3. There is no need to extract or copy the native libraries from the VS project. The natives are included in the jar file and are extracted and loaded at runtime automatically under the lib folder of the working directory.

4. In your Java code, import the com.ivan.xinput.XInputDevice class for XInput 1.3 functionality or com.ivan.xinput.XInputDevice14 for XInput 1.4. The latter class extends the former so you can use 1.3 methods with the 1.4 class.

5. To check if the desired version is available:

// check if XInput 1.3 is available
if (XInputDevice.isAvailable()) {
    System.out.println("XInput 1.3 is available on this platform.");
}

// check if XInput 1.4 is available
if (XInputDevice14.isAvailable()) {
    System.out.println("XInput 1.4 is available on this platform.");

I'm using the current latest version of Eclipse and have the latest version of Java installed. I have a simple project I'm working on, just a JOGL based 3D application.
The first step says, "1. Install the project into your Maven repository". This is where I'm most confused.. I've never used Maven before, I don't know how to use it. After some googling, I unzipped the project into my Eclipse workspace and tried going to File > Import > Maven > Existing Maven Projects and imported the project.
Next the instructions refer to Maven dependency. I tried setting the dependency on the maven project, but I'm not sure if I was even in the right place for that.
The 3rd instruction refers to natives included in a Jar file, but after much searching I can't find a Jar file inside of any of the files provided by the library.
After that I tried to follow the rest of the instructions but obviously nothing has worked. I've fiddled with many settings and tried what I can all night to make this work but I can't see what it is I'm meant to do.
Can anyone give me any hints? Has anyone done this before who can give me a quick howto on this? I just don't know what I'm meant to do, any help would be greatly appreciated.

sentences: Setting up a custom cursor image in LWJGL 3 How can I load a custom cursor image with LWJGL3? It took me a while to figure this out. Here is how it is done for version 3.0.1. Hope this helps.

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:
Creating a fragment shader to darken a white texture over time - OpenGL GLSL So as a part of learning OpenGL, I've now decided to try and be a bit more creative with shaders, as part of a practice game I'm making using C/OpenGL.

I'm completely new when it comes to working with shaders, so I'm still trying to get used to the thought process behind creating something with it. To this extend, here's what I want to attempt.

As a part of the gameplay, the entire background of the game consists of a white, plain, 2D texture. The white texture should slowly animate black circles into it over time, until finally the entire texture is completely black.

I've considered some different approaches to the problem, and would like to know which one will be the most practical when it comes to shaders.

Using framebuffers: As I've understood from looking around the internet, you can't really, say, apply certain colors to a specific area of fragments in your fragment shader (like creating a black circle), and then save the state of those fragments for the next frame. Instead, I would have to apply the effect, and render the texture to a framebuffer and then re-use it again the next frame. I could then continuously do this slowly add black circles to the texture. The problem is, is this really too much work to do for something simple as this? Or would it be fast enough? As far as I've seen, framebuffers are usually used to post-process effects for entire scene frames. This would not be for the entire scene, only for the background. The advantage of this approach would be that it's relatively simply to work with as you're only working on one texture.

Creating individual circle objects with own fragment shaders: This was another approach I thought about doing. Basically, instead of having one shader work on the entire background texture, I would simply spawn textured quads that each individually run a fragment shader that just turns their texture black over time using a simple percentage value input as a uniform. The disadvantage of this solution is that you make it a bit more complex by having to handle more objects at runtime, instead of simply working with one texture. More vertices would also have to be handled when rendering.

Of these two approaches, I don't know really what would be a good solution to run with. I would like to use the framebuffers approach but I don't know if I would "abuse" the technique with this kind of problem or not.

Or perhaps there's another way of doing this that I've completely missed because I'm new to shaders, in that case other suggestions would be welcome!

Thank you all for your help :)

sentences:
How can I cut a doorway through my wall at runtime? I am working on a Unity project where I have 3 models: a stacked, rounded wall (think logs), a flat wall (think bricks), and a door.

The door has an animation to open / close itself, and when it's attached to a wall, there's one major problem -- when the door swings in, it reveals not the empty space one would expect, but the segment of wall it's layered on top of!

Since all 3 models are part of dynamic mesh structures, I can't "pre-calculate" what the model should look like to account for the empty space of the door -- what if the player puts the door on the next segment of wall instead?

I considered expanding the "door" model to a "door + wall segment" model (replacing that wall segment entirely), but because I already have two separate shapes of wall, it quickly becomes a combinatorics problem -- 2 models for each door, per door shape (not to mention windows, or a 3rd [or fourth!] wall shape!). In short, this doesn't seem like a tenable solution.

What would work most cleanly is if I could remove a "Door-shaped" segment of my Wall segment mesh, leaving a clear hole that the Door model could snugly fit.

In an equation: Final Mesh A = Mesh A Volume - (Mesh A Volume ∪ Mesh B Volume)

Is an operation like that feasible? My gut tells me that polyhedron intersection is hard, and there might be a better way to do this. I'm also equally interested if someone has a better suggestion on how to solve the initial problem of doors intersecting with wall segments.

sentences:
Optimum Screen Resolutions Most PC games nowadays obviously come with the standard option to change the game's resolution from between 640x480 to 1920x1080 on average, depending on your monitor and whether or not you are playing in windowed mode. However, when developing a retro pixel art game, allowing the resolution change to be between 640x480 and 1920x1080 is rather absurd.

So in a pixel art game where, at default resolution, one frame of the main character's sprite is 16x32 pixels, what would you like to see the game's default resolution to be, and by how much would it scale with each resolution option? Would a square screen be better than a widescreen? How many map tiles (at 32x32) would be best to display across and down?

So, in general, what would be the optimum game screen size and at what resolution for a pixel art game now? Your opinions are appreciated.

sentences:
Is there any way to embed browser component into game for facebook Authentication? Say I have desktop game and I like to make it social, for that I need browser component
embedded into my game  ( c++ openGL) for the Authentication part. Is there any framework
for that?

sentences: what is the best way to code an online multiplayer game? so i want to create a simple game that runs over a network but I am having trouble deciding what needs to be done in terms of what the server needs to do and what the clients need to do. I understand I should use UDP sockets but I am unsure how to implement it within a game and have all the clients be in sync. Should the server side have like a master copy of the game where i basically runs the game and accepts moves, plays them in itself, and then sends the current state of the object to the other clients?

sentences:
Programmatically drawing a "pencil" line or curve If you look closely (scan it on a computer and zoon in) at a carbon pencil line you can see that there are differing shades of gray.  I tried looking on the Internet for any kind of algorithm or statistical model for how that gray would be drawn programatically.  Does anyone have information on this?  Thanks a lot!!

I want to make drawings on a computer that look they were drawn with a pencil.

sentences:
How to increase the difficulty setting as close as possible to maximum difficulty automatically? I have a simple 2D version of Mini-golf. The goal is to manage to clear each level in the least amount of shots, the ball is bouncing at most 3 times (stops on the 4th hit) from a wall but not reducing in speed, there is no out of bounds and no obstacles that would remove the ball. Now I would like to add some water/ instant death obstacle at the most annoying places.

How do I find those places?

The player can aim in a 360 radius, if I set the goal of managing a given level in 2 shots, there are 129,600 ways of how the player could shoot the ball. While it should be possible to simulate all of those shots fairly easy, I don't want to add randomly water and check if the level is still possible to clear, rather simulate the level, record all places the ball went over and place on the spots with the most hits water.

What is the best strategy/ a good algorithm to blockade the most ways but to guaranty that at least one way stays clear?

Does the strategy change significantly if moving obstacles (on a fixed path, same rule for bouncing as normal wall) are included?

sentences:
How to "relax" robotic arm? I have downloaded robotic demo from here. It contains robotic arm, which I can move by keyboard

While moving, parts of arm oscillating naturally, which proves that physics is applied to them.
How can I "relax" joints? I.e. turn off them from maintaining fixed positions and allow them fall down physically correct?

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:
culling lines on the back of a globe I am drawing a simple outline of the world using GL_LINE_STRIPs (in WebGL).
I want to not draw those lines that are on the other side of the spinning globe.
Using Nicol Bolas approach below I am trying to determine if a point is going away from the camera or not:
scene.map = {
    vbo: gl.createBuffer(),
    draw: function(pMatrix,mvMatrix,camera,t) {
        gl.useProgram(this.program);
        gl.uniformMatrix4fv(this.program.pMatrix,false,pMatrix);
        var spin = mat4_rotation(t,[0,1,0]);
        mvMatrix = mat4_multiply(mvMatrix,spin);
        gl.uniformMatrix4fv(this.program.mvMatrix,false,mvMatrix);
        var nMatrix = mat4_inverse(mat4_transpose(mvMatrix));
        gl.uniformMatrix4fv(this.program.nMatrix,false,nMatrix);
        gl.uniform3fv(this.program.camera,camera);
        gl.uniform4fv(this.program.colour,[0,1,0,1]);
        gl.enableVertexAttribArray(this.program.vertex);
        gl.bindBuffer(gl.ARRAY_BUFFER,this.vbo);
        gl.vertexAttribPointer(this.program.vertex,3,gl.FLOAT,false,3*4,0);
        var ofs = 0, parts = this.data.ofs;
        for(var part=0; part<parts.length; part++) {
            var start = ofs;
            ofs += parts[part];
            gl.drawArrays(gl.LINE_STRIP,start,ofs-start);
        }
        gl.disableVertexAttribArray(this.program.vertex);
        gl.bindBuffer(gl.ARRAY_BUFFER,null);
        gl.useProgram(null);
    },
    program: createProgram("precision mediump float;\n"+
            "attribute vec3 vertex;\n"+
            "uniform mat4 pMatrix, mvMatrix, nMatrix;\n"+
            "varying vec3 n;\n"+
            "void main() {\n"+
            "   gl_Position = pMatrix * mvMatrix * vec4(vertex,1.0);\n"+
            "   n = (nMatrix * vec4(vertex,1.0)).xyz;\n"+
            "}\n",
            "precision mediump float;\n"+
            "uniform vec4 colour;\n"+
            "uniform vec3 camera;\n"+
            "varying vec3 n;\n"+
            "void main() {\n"+
            "   if(dot(camera,n) < 0.0) discard;\n"+
            "   gl_FragColor = colour;\n"+
            "}\n",
            ["pMatrix","mvMatrix","colour","camera","nMatrix"],
            ["vertex"]),
    data: getFile("json","data/world.json"),
};
var pts = [], deg2rad = Math.PI/180;
for(var i=0; i<scene.map.data.pts.length; i+=2) {
    var lng = scene.map.data.pts[i] * deg2rad,
        lat = scene.map.data.pts[i+1] * deg2rad;
    pts.push(-Math.cos(lat)*Math.cos(lng),Math.sin(lat),Math.cos(lat)*Math.sin(lng));
}
pts.push(0,0,0); // centre of sphere, for sprite z-culling trick
gl.bindBuffer(gl.ARRAY_BUFFER,scene.map.vbo);
gl.bufferData(gl.ARRAY_BUFFER,new Float32Array(pts),gl.STATIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER,null);

and to draw it:
var pMatrix = createPerspective(60,canvas.width/canvas.height,0.1,4),
    eye = [-2,0,0],
    mvMatrix = createLookAt(eye,[0,0,0],[0,1,0]);
scene.map.draw(pMatrix,mvMatrix,eye,t);

However, this is only drawing the left hemisphere rather than the front:

How can I correctly compute the normal of a point, and the position of the camera?

sentences:
Best C# technique to pass variable from Instantiated object to GameObject There are lots of instantiated prefabs.  Info from it is transmitted while it crosses a trigger zone.  Some of these are calculated custom variables.

I can print the custom variables from the instantiated prefabs.

I can get the trigger zone to report standard things like "...transform.position" or "...transform.localEulerAngles", but not stuff I make up. Intellisense seems to see everything I am trying to get, and everything compiles.

What's the best manner to perform this?  Here's what I've tried:

Prefabs' Script:

public float infoToSend;
 void Update(){
 float infoToSend = 10f //...actually, there's some math here, but it's a float.
}
print("Sender: " + infoToSend); //Works.

Receiver Script on Trigger Zone:

void OnTriggerStay2D(Collider2D other){

print("Receiver: " + other.transform.position);  //Works Fine.
print("Receiver: " + other.transform.localRotation);  //Works Fine.

float infoReceived = other.GetComponent<PrefabsScript>().infoToSend;
print("Receiver: " + infoReceived);  //Does not work!
}

Any help, either fixing this arrangement or directing me to a different method, would be appreciated.  Thanks.

Edit to display the solution:

Corrected Prefabs' Script (changed third line down):

public float infoToSend;
 void Update(){
 this.infoToSend = 10f //...actually, there's some math here, but it's a float.
}
print("Sender: " + infoToSend); //Works.

Correct Receiver Script on Trigger Zone:

void OnTriggerStay2D(Collider2D other){

print("Receiver: " + other.transform.position);  //Works Fine.
print("Receiver: " + other.transform.localRotation);  //Works Fine.

float infoReceived = other.GetComponent<PrefabsScript>().infoToSend;
print("Receiver: " + infoReceived);  //Does not work!
}

Many thanks, again!  There's so many places to begin with, it's tough to find a "Beginner course" to cover everything.

sentences:
How to design rating (leaderboard) I have a quiz online game. For each game there is a prize (number of scores). Now I have three ratings: top for the last day, top for the last week, total top (based on the sum of scores). Sum is not bad, but there is an issue: the more you play (even with bad results), the higher you are because more games leads to more points. I want to build a new rating, that takes in account not only sum of scores, but performance in games to. Just an average prize is not a good idea for me, because it means that winner of a single game will be higher, than a person who won 9 games and got not-maximum score in the last one.

Do you have any ideas/experience, what formulas could be used?

Thanks.

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:
How to smooth a voxel mesh? Currently I have refined voxels, I want to smooth it to achieve accurate projection. After some web search, I came across smoothing algorithms such as Catmull-Clark, Doo-Sabin etc. Along with this, I read one should need the connectivity information to use smoothing algorithm on the outer face of voxel and the connectivity information can be established using the Half edge data structure.
I understand that I need to feed voxel data to Half edge data structure so that I can proceed with a further step but the thing is I didn't get proper idea to use CGAL's Half edge data structure. Moreover, the documentation didn't help me much. Can someone help me to figure this out?.

For example, I have taken sphere as input geometry (First Image). After voxelization, I used intersection algorithm to identify boundary cells which represent actual input geometry as you can see in the above image. Either we can take voxels outside boundary or inside the boundary for projection. Since projecting inside voxels on the surface mesh is quite easy. So directly by using ray shooting on refned voxels, I identified those voxels which are inside boundary voxels. Inside voxels also represents geometry which also looks like in middle image.
From middle Image, we can see that the size of the cells varies from one to another. I want to identify outermost faces from it so that I can use a smoothing algorithm to eliminate Cartesian front to achieve accurate projection.

sentences:
GLM: Camera attached to model moves in opposite direction from the model I have been working on a component based engine with nested game objects each with there own transformation's. Each game object calculates its position in the world based on its parents world transformation multipled by there own local one (ModelsWorldTransform = ParentsWorldTransform * LocalTransform).

This all works great until I attach the camera component to a model and in this scenario, as the model the camera is attached to moves away from the origin, the camera moves in the opposite direction to the movement whitest still seeming like it is in the correct position according to its mat4.

All local transformations are stored in a mat4 rather then three vec3's for position, rotation and scale to save on calculations each update having to generate new mat4's.

Transformation Component Update Code

m_world_transformation = m_local_transformation;
// If we have a parent object
if (m_parent_transform_component)
    m_world_transformation = m_parent_transform_component->GetWorldTransformation() * m_world_transformation;

Camers position buffer being updated

BufferData.view = m_transformation_component->GetWorldTransformation();
m_camera_buffer->SetData();

I'm not sure what i'm missing, if anyone has any sugestions that would be apreatiated.

sentences:
Does CADisplayLink automatically control the app's timestep? I'm writing an iOS game that uses OpenGL ES 2.0. I have my 'OpenGLView' which contains a

- (void)setupDisplayLink {
    CADisplayLink* displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(render:)];
    [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}

And then my

- (void)render:(CADisplayLink*)displayLink {

function which at the end of the processing calls

[_context presentRenderbuffer:GL_RENDERBUFFER];

Like most people I've found the http://gafferongames.com/game-physics/fix-your-timestep/ tutorial but I've been thinking.

With a CADisplayLink, has the framerate limiting been done for me already by iOS, meaning I don't need to calculate the timing of each frame?

Also, as a sanity check, the 'render' function is where all my game logic goes? I'm currently treating it as the equivalent of a

while (!quit) {
  do_stuff();
  render();
}

loop you see in traditional game loop designs, or is this only for rendering?

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:
How can I develop my Android game for different phone resolutions? For instance, the Motorola Droid is as wide as the G1, but has more height.

Should I try to spread the UI out across the extra height found on the Motorola Droid?  How do others handle this problem?

I'm not using OpenGL, but a SurfaceView for a 2D game.

sentences:
Rotate arrow without using Unity3d physics engine I have this code that simulates the movement of a projectile without using the unity physics engine

IEnumerator LaunchProjectile(int angle, float speed)
{

    // Move projectile to the position of throwing object + add some offset if needed.
    Projectile.position = transform.position + new Vector3(0, 0f, 0);
    Projectile.rotation = transform.root.rotation;
    Debug.Log(transform.root.eulerAngles);

    // Calculate distance to target
    float target_Distance = speed * (Mathf.Sin(2 * firingAngle * Mathf.Deg2Rad) / gravity);

    // Extract the X  Y componenent of the velocity
    float Vx = Mathf.Sqrt(speed) * Mathf.Cos(firingAngle * Mathf.Deg2Rad);
    float Vy = Mathf.Sqrt(speed) * Mathf.Sin(firingAngle * Mathf.Deg2Rad);

    // Calculate flight time.
    float flightDuration = target_Distance / Vx;

    this.arrowSimulationScript = Projectile.gameObject.GetComponentInChildren<ArrowSimulation>();

    float elapse_time = 0;

    while (!arrowSimulationScript.Collided())
    {
        Projectile.Translate(0, (Vy - (gravity * elapse_time)) * Time.deltaTime, Vx * Time.deltaTime);

        Projectile.LookAt(Projectile.position - new Vector3(0,  (Vy - (gravity * elapse_time)) * Time.deltaTime, Vx * Time.deltaTime));

        arrowSimulationScript.Velocity = new Vector3(0, (Vy - (gravity * elapse_time)) * Time.deltaTime, Vx * Time.deltaTime).magnitude;

        elapse_time += Time.deltaTime;

        yield return null;
    }
}

The arrow is fired in the direction of the object which has this script attached. To make the arrow rotate I use this line of code:

Projectile.LookAt(Projectile.position - new Vector3(0,  (Vy - (gravity * elapse_time)) * Time.deltaTime, Vx * Time.deltaTime));

The arrow moves towards the right direction but with the tip facing the z axis direction, instead of the direction of the bow.
Here is a video of the problem:
https://www.youtube.com/watch?v=cyK6DXxTw_E

If I comment out that line of code the arrow fly with the tip facing the direction of the bow, but it doesn't rotate.

sentences:
Developing a platform - why are age verifications even a thing? I'm building an online gaming platform and have bumped into the question of age verification. Checkboxes such as "I verify that I am 13 years old or older" or a slider where you put in your age are common online when registering for accounts.

Why? I've been checking that box since I was a kid, it doesn't stop anyone. If you put it in your Terms of Service, is that enough?

Does any of this actually matter?

sentences:
How do you stop OgreBullet Capsule from falling over? I've just started implementing bullet into my Ogre project. I followed the install instructions here: http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1

And the rest if the tutorial here:
http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2

I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around.

I need a way to fix the capsule to always stay upright, but I have no idea how

Below is the code I'm using.

(part of) Header File

OgreBulletDynamics::DynamicsWorld *mWorld;   // OgreBullet World
OgreBulletCollisions::DebugDrawer *debugDrawer;
std::deque<OgreBulletDynamics::RigidBody *>         mBodies;
std::deque<OgreBulletCollisions::CollisionShape *>  mShapes;

OgreBulletCollisions::CollisionShape *character;
OgreBulletDynamics::RigidBody *characterBody;
Ogre::SceneNode *charNode;

Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;

main file

bool MinimalOgre::go(void)
{
    ...

     mCamera = mSceneMgr->createCamera("PlayerCam");
     mCamera->setPosition(Vector3(0,0,0));
     mCamera->lookAt(Vector3(0,0,300));
     mCamera->setNearClipDistance(5);
     mCameraMan = new OgreBites::SdkCameraMan(mCamera);

    OgreBulletCollisions::CollisionShape *Shape;
    Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance)
    OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody(
            "BasePlane",
            mWorld);
    defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction)
    // push the created objects to the deques
    mShapes.push_back(Shape);
    mBodies.push_back(defaultPlaneBody);

    character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0));

    charNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    charNode->attachObject(mCamera);
    charNode->setPosition(mCamera->getPosition());

    characterBody = new OgreBulletDynamics::RigidBody("character", mWorld);
    characterBody->setShape(   charNode,
                    character,
                    0.0f,         // dynamic body restitution
                    10.0f,         // dynamic body friction
                    10.0f,          // dynamic bodymass
                    Vector3(0,0,0),
                    Quaternion(0, 0, 1, 0));

    mShapes.push_back(character);
    mBodies.push_back(characterBody);

    ...
}

sentences:
How can I find the valid words in a grid of characters? I am creating a game similar to Tetris, with two main differences: the screen already begins filled with tiles (like in Puzzle Quest for Nintendo DS and PC) and each individual tile has a letter in it. The player's objective is to eliminate tiles by forming valid words with them. Words are formed by placing letters next to each other, in any direction, except diagonally.

The player can move an entire row of tiles to the left or to the right or an entire column of tiles up or down, for as many spaces as he desires (if the movement of a row/column surpasses the limits of the board, the letter that crosses the limit will "cycle", appearing at the other end of the row/column). After the player's action, the game should check the entire board to look for valid words and remove the letters that form those words from the board. The letters above those that were removed will fall down in the place of those letters that were removed and new letters will drop from the top of the screen until the board is filled up again.

I have already written a linear algorithm that, given a sequence of characters, determines if it is a valid english word. The problem I am having is: how can I check for valid words on the board? Is brute force the only way? Testing all possible combinations from the board to see if they are valid is very slow, even for a small (5x5) board. Any help will be very appreciated, thanks!

sentences:
Creating a set of islands by subtracting gradient values from a Perlin noise The answers to this question explains fairly well how to create a big island in the center of the screen by setting up a gradient and then subtracting its value from a Perlin Noise.

Anyway they explain how to create only
one gradient at the center of the screen to create a big, sort of circular island.

But what if I want to create an island which has more than one gradient to create a less regular shape, or if I want to create multiple separated islands by setting multiple gradients in different positions? What value should I subtract from the Perlin Noise function for each point? The sum of the distance from each gradient to that point? The average?

Edit: Jon's method of multiplying and normalizing worked, got this result with 4 gradient points:

sentences:
Do shader program compilers optimise divide-by-PoT-constants to bitshift operations? So just to restate that, let's say we have this:

float f = g / 2;

Given the divisor is a constant, will the shader compiler auto-optimise this to a bitshift operation, as some language compilers are known to do? Where would I find more info on shader program compiler implementation details?

(I'm guessing there will be different answers for OpenGL & DirectX.)

sentences:
Unity3D object fill shader I've been researching this for a while, and had no luck yet. I figured I'd ask here to see if anyone had any good ideas.

Essentially what I want is a shader that can make only part of an object transparent based on a slider. Similar to fill effects on 2D sprites, the object would fill from the bottom up, when the slider was set to 0 the whole object would be transparent, when it was set to 50 just the bottom half would be visible, and when it was set to 100 the whole object would be visible.

I've tried various masking effects, but it would be best if I could build this in to existing shaders or have a separate mask. Is there perhaps a way to adjust the alpha on individual pixels used for the diffuse texture without incurring great performance loss?

sentences:
Custom Camera View Fustrum in Unity Is it possible in Unity to make some sort of bounding box (with a running application) within the current viewpoint of the actual screen?

Let me explain:

I'm working on a project which uses a projection for visual output, the screen I am projecting on is smaller than the actual projectors resolution. This means that the unused spaces around the actual working application, are black and visually hidden.

Made an image for exra explanation:

As i'm new to Unity and still learning, I'm not sure if this is even possible because of the use of camera's and environment. I happen to know that it's possible in three.js. But if anyone could point me in the right direction or explain that it's impossible would be much appreciated because I'm not sure where to look anymore!

sentences:
How can I make the text flash? I want to have text that flashes from green to white and back to green over and over until the window is closed? Below is what I have tried but i cant seem to get it to work, please help me.

int main()
{
    sf::RenderWindow window(sf::VideoMode(LAYOUT_WINDOW_WIDTH, LAYOUT_WINDOW_HEIGHT),
        "Tetris 2019 - A New Beginning");

    sf::Font myFont;
    if (!myFont.loadFromFile("cartoon relief.ttf")) {

    }

    window.setFramerateLimit(30);

    sf::Text gameOver;
    gameOver.setFont(myFont);
    gameOver.setFillColor(sf::Color::Green);
    gameOver.setStyle(sf::Text::Regular);
    gameOver.setString("GAME OVER!");
    gameOver.setCharacterSize(65);
    gameOver.setPosition(30, 60);

    //everything below gets copied into the "processSplash" function
    while (window.isOpen())
    {
        sf::Time elapsed_time;
        sf::Clock r;

        sf::Time delta_time = sf::seconds(1);

        sf::Text playAgian;
        playAgian.setFont(myFont);
        playAgian.setFillColor(sf::Color::Green);
        while (window.isOpen && elapsed_time >= delta_time)
        {
            if (elapsed_time == delta_time)
            {
                playAgian.setFillColor(sf::Color::Green);
                elapsed_time == r.restart();
            }
            else
                playAgian.setFillColor(sf::Color::White);
                elapsed_time += r.restart();
        }
        playAgian.setStyle(sf::Text::Regular);
        playAgian.setString("Press ENTER to play agian!");
        playAgian.setCharacterSize(25);
        playAgian.setPosition(80, 235);

        sf::Event event;

        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            if (event.type == sf::Event::KeyPressed
                && event.key.code == sf::Keyboard::Space)

                //close splash screen and start game
            {
                /*processSplash();*/
            }
        }

        window.draw(gameOver);
        window.draw(playAgian);

        window.display();
    }

    return 0;
}

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:
MMO Server with C# asynchronous sockets performance I have developed a 2D RPG MMO client / server. The server is developed in C# with asynchronous sockets. It is a pretty simplet implementation. The server gets the client's input / coordinates and broadcasts it to the other players. It is a very alpha stadium so that I only want to test performance to know if this way to go is good.

Now I am living in Germany, I have a static public IP (accessible via the internet) and deployed my game server on a Raspberry Pi 3 (it runs in the command line with C# / Mono). The only database access (write / read) is currently made, when a client connects or disconnects (store / load coordinates).

I made a speed test right now and have the following result:
Download Speed: 100840 kbit/s
Upload Speed: 8973 kbit/s
The Raspberry Pi is connected on a router (Fritz Box) via LAN and the port is set to  bridge mode (because of the public static IP).

Everything runs fine, but I tested it with ony two clients and when one client begins to move, the second client "sees" it maybe 1 second later. The movement is "lag free". But of course, it takes a lot of time until the signal arrives to the other clients.

My question now is, will I have the same issues later, when I rent a server? I really hope that this is what I should expect, when I run my server in my home network. Maybe this question is pretty difficult to answer, because I give you no source code of the server here, but as I said, when the clients get the signal, it is "lag free". The only thing I have is kind of a "delay".

Thanks in advice.

sentences:
Issues using NetworkServer.Spawn with Unity and Mirror-Networking I am using Mirror to handle the networking aspect

When I spawn an object on the network, I Instantiate it on the server and then use NetworkServer.Spawn to notify all clients to spawn the object.

However, when this object is eventually spawned on the client side, it seems to be spawned at the wrong position for a few seconds and then corrected itself and move to the correct position as is reflected by the server. Is there something I am not doing? Is this normal?

Also I noticed if I changed the Network Sync Mode to 0, then it will only spawn in the wrong spot for a split second.

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

public class EnemySpawner : NetworkBehaviour
{
    public uint theId;
    public int maxNumEnemies;
    public int spawnDelay;
    public GameObject enemyToSpawn;
    float curSpawnTime;
    BoxCollider2D boxColl;
    // Start is called before the first frame update
    public override void OnStartServer()
    {
        curSpawnTime = spawnDelay;
        boxColl = GetComponent<BoxCollider2D>();
    }

    void Start()
    {
        if (!isServer) return;
        theId = netId;
    }

    // Update is called once per frame
    void Update()
    {
        if (!isServer) return;
        if (transform.childCount < maxNumEnemies && curSpawnTime <= 0.0f)
        {
            Vector2 spawnPoint = new Vector2(Random.Range(boxColl.bounds.min.x, boxColl.bounds.max.x),Random.Range(boxColl.bounds.min.y, boxColl.bounds.max.y));
            curSpawnTime = spawnDelay;
            SpawnEnemies(spawnPoint,netId);
        } else
        {
            curSpawnTime -= Time.deltaTime;
        }
    }

    [Server]
    void SpawnEnemies(Vector2 spawnPoint, uint theId)
    {
        GameObject gobj = Instantiate(enemyToSpawn, new Vector2(60.7f,1.3f), Quaternion.identity);
        gobj.GetComponent<EnemyController>().parentNetId = netId;
        NetworkServer.Spawn(gobj);
    }
}

The way I've organized things, in the hierarchy I have:

Enemies
   Area1
      Spider(Clone)
      Spider(Clone)

Area1 has the EnemySpawner script.  The spider is registered a spawnable prefab.
Both Area1 and the Spider have a NetworkIdentity with no boxes checked.
Additionally, the Spider has a NetworkTransform and NetworkAnimator.

sentences:
OpenGL Camera causes spatial distortion I'm trying to implement a 3D camera of the "Orbit around the origin" variety in a game engine I'm developing in order to learn about 3D graphics and game programming. I have a basic handle on the required math, and have implemented my own crude 3D math library and matrix stack (functionally similar to the one in OpenGL's compatibility profile). My first attempts at a camera failed miserably, until I decided that I should use quaternions to represent rotation. Once I'd done that, I had a camera that moved in the direction I expected it to at about the right speed and fairly smoothly, but there is an odd spatial distortion effect that I can't seem to get rid of. I have posted a brief video on YouTube showing exactly what is happening.

I honestly don't know what could be causing this issue, the magnitude of the distortion appears to reach a maximum at certain angles, but beyond that I'm not sure what I should be looking at. Right now my chief suspect is my quaternion math code, because the matrix stack appears to be behaving itself and if something was wrong with my matrix math code I would be having more serious issues than this.

I'm not sure what information or code I can provide that would be of any use, so I'll start with the code that handles quaternion math.

public class Quaternion {
private float w;
private float x;
private float y;
private float z;

public Quaternion(){
    this(1.0f,0.0f,0.0f,0.0f);
}

public Quaternion(float W, float X, float Y, float Z){
    w = W;
    x = X;
    y = Y;
    z = Z;
}

public void loadIdentity(){
    w = 1.0f;
    x = 0.0f;
    y = 0.0f;
    z = 0.0f;
}

public float magnitude(){
    //AKA the "norm"
    return (float) Math.sqrt(w*w + x*x + y*y + z*z);
}

public void qNormalize(){
    float mag = this.magnitude();
    w /= mag;
    x /= mag;
    y /= mag;
    z /= mag;
}

public void qMultiply(Quaternion q){
    this.qMultiply(q.w, q.x, q.y, q.z);
}

private void qMultiply(float w2, float x2, float y2, float z2){
    //Performs A*B, where this Quaternion is A
    this.w = w*w2 - x*x2 - y*y2 - z*z2;
    this.x = w*x2 + x*w2 + y*z2 - z*y2;
    this.y = w*y2 + y*w2 + z*x2 - x*z2;
    this.z = w*z2 + z*w2 + x*y2 - y*x2;
}

public float[] qMatrix(){
    //Return a 4x4 matrix representation of this Quaternion, column-major like OpenGL prefers
    float w2 = w*w;
    float x2 = x*x;
    float y2 = y*y;
    float z2 = z*z;

    if(Math.abs(w2+x2+y2+z2 - 1.0) >= 0.000001){
        this.qNormalize();
        return this.qMatrix();
    }

    return new float[]{
        1.0f - 2.0f*y2 -2.0f*z2, 2.0f*x*y + 2.0f*w*z, 2.0f*x*z - 2.0f*w*y, 0.0f,
        2.0f*x*y - 2.0f*w*z, 1.0f - 2.0f*x2 - 2.0f*z2, 2.0f*y*z + 2.0f*w*x,0.0f,
        2.0f*x*z - 2.0f*w*y, 2.0f*y*z + 2.0f*w*x, 1.0f - 2.0f*x2 - 2.0f*y2,0.0f,
        0.0f,0.0f,0.0f,1.0f
    };
}

public void qFromAA(float angle, float[] axis){
    //create a Quaternion from an axis-angle representation

    if(Vector.magnitude(axis) == 0.0f){
        this.loadIdentity();
        return;
    }

    float theta = angle/2.0f;
    axis = Vector.scale((float)Math.sin(theta), Vector.normalize(axis));

    w = (float)Math.cos(theta);
    x = axis[0];
    y = axis[1];
    z = axis[2];
}

public String toString(){
    return "w: "+w+"\tx: "+x+"\ty: "+y+"\tz: "+z+"\tmag: "+(x*x+y*y+z*z+w*w);
}

}

Any ideas about where I should start?

sentences:
Friction using delta time returns inconsistent result Slowing down a character using the following formula returns different results depending on the frame rate:

this.y += this.yVel * delta;
this.yVel *= Math.pow(0.99, delta);

Is there a better way to decelerate a player using delta time to allow for consistent movement across several framerates?

sentences:
Can I "unmerge" merged meshes UE4? I set up my character to be modular, by following the UE4 docs.
I used the code at the bottom of the page to implement mesh merging functionality.
It does work well, I can merge meshes runtime.
I use this to add clothes to my characters.
Just wondering, if there is a way to take off clothes, by unmerging stuff:
Something like:

store added clothes in a TArray or something
then call a function to remove the desired cloth from the array

Of course, I would like to do it at runtime...

sentences:
Rotating kinematic object around a moving point Box2D I'm new at Box2D and I am making a simple game where you control the rotation of the maze and the gravity leads the ball to the exit.

The game looks like:

The problem: I want to rotate the maze, and I'm doing it well. It is a kinematic object, so it will only move when I want. But it always rotate on a static pivot, I think that's it's center of mass. Rotating the maze, the ball hits the walls and when too further to the center, it becomes hard to control the movement of the ball by rotating the maze as the centrifugue force is too high for the ball.

What I want: I want to change the maze's rotation pivot to the ball's position, every game loop/frame, so it will rotate around the ball always and I will be able to use only gravity, not centrifuge forces, to lead the ball to the exit.

What I tried: I already tried to find a function to change the pivot center, or the center of mass, but I only found to change the mass proprieties. It changes the center of mass only if it was a dynamic body. Even the kinematic body having the same localCenter.x and localCenter.y proprieties as the dynamic body, it remains on (0.0 ,0.0) when trying to change it. And when changing the localCenter on the dynamic body, it doesn't rotate at this point anyway, so I'm not sure what to do.

Is there any possibility to change the center of the kinematic body all the time? I'm using Box2D Vestion 2.3.2, as you can see on the picture, and Visual Studio 2013 with OpenGL.

Thanks!

sentences:
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: Is it still possible to develop for gamecube? I know the Nintendo gamecube is outdated, but it still one of my favorite systems. Is there any way to still develop games for it? What software would I need? What are the programming languages involved? Thanks guys!

sentences:
Collision detection problems using AABB's I implemented a simple collision detection routine using AABB's between my main game sprite and various platforms (Please see code below).  It works great, but I'm now introducing gravity to make my character fall and it's shown up some problems with my CD routine.

I think the crux of the matter is that my CD routine moves the sprite back along the axis in which it has penetrated the least amount into the other sprite. So, if it's more in the Y axis than the X, then it will move it back along the X Axis.

However, now my (hero) sprite is now falling at a rate of 30 pixels per frame (It's a 1504 high screen - I need it to fall this fast as I want to try to simulate 'normal' gravity, any slower just look weird) I'm getting these issues.  I will try to show what is happening (and what I think is causing it - although I'm not sure) with a few pictures: (Code below pictures).

I would appreciate some suggestions on how to get around this issue.

For clarification, in the above right picture, when I say the position is corrected 'incorrectly' that's maybe a bit misleading.  The code itself is working correctly for how it is written, or put another way, the algorithm itself if behaving how I would expect it to, but I need to change it's behaviour to stop this problem happening, hope that clarifies my comments in the picture.

My Code

public boolean heroWithPlatforms(){

    //Set Hero center for this frame
    heroCenterX  = hero.xScreen+(hero.quadWidth/2);
    heroCenterY  = hero.yScreen+(hero.quadHeight/2);

    //Iterate through all platforms to check for collisions
    for(x=0;x<platformCoords.length;x+=2){

    //Set platform Center for this iteration
    platformCenterX = platformCoords[x]+(platforms.quadWidth/2);
    platformCenterY = platformCoords[x+1]+(platforms.quadHeight/2);

    // the Dif variables are the difference (absolute value)
    // of the center of the two sprites being compared (one for X axis difference
    //and on for the Y axis difference)
    difX = Math.abs(heroCenterX-platformCenterX);
    difY = Math.abs(heroCenterY-platformCenterY);

    //If 1
    //Check the difference between the 2 centers and compare it to the vector (the sum of
    //the two sprite's widths/2.  If it is smaller, then the sprites are pverlapping along
    //the X axis and we can now proceed to check the Y axis
    if (difX<vecXPlatform){

    //If 2
    //Same as above but for the Y axis, if this is also true, then we have a collision
    if(difY<vecYPlatform){
        //we now know sprites are colliding, so we now need to know exactly by how much
        //penX will hold the value equal to the amount one sprite (hero, in this case)
        //has overlapped with the other sprite (the platform)
        penX = vecXPlatform-difX;
        penY = vecYPlatform-difY;
        //One sprite has penetrated into the other, mostly in the Y axis, so move sprite
        //back on the X Axis
        if (penX < penY){hero.xScreen-=penX*(heroCenterX-platformCenterX>=0 ? -1 : 1);}
        //Sprite has penetrated into the other, mostly in the X asis, so move sprite
        //back on the Y Axis
        else if (penY < penX) {hero.yScreen-=penY*(heroCenterY-platformCenterY>=0 ? -1 : 1);}
        return true;
        }//Close 'If' 2
        } //Close 'If' 1
    }
    //Otherwise, no collision

    return false;
    }

sentences:
How to find the angle of an arc for reflection I am using the following code to calculate points for a circle arc drawn with a Line Renderer.

for (int i = 0; i <= pts; i++)
    {

        float x = radius * Mathf.Cos(ang * Mathf.Deg2Rad);
        float y = radius * Mathf.Sin(ang * Mathf.Deg2Rad);
        arcLine.positionCount = i + 1;
        arcLine.SetPosition(i, new Vector2(x, y));
        ang += (float)totalAngle / pts;

    }

How can I change the angle ang to create a reflected arc along the line P1P2 as in the image below?

Please note that totalAngle represents the portion of the circle that is to be drawn between 0 and 360.

sentences:
How to limit velocity of object on touchDragged event? I am using the current code to handle the movement of the player ship in my libGDX game:

if (playerShipTouched)
{
  position.x = screenX - touchOffset;

  // limit movement to screen bounds
  if (position.x < 0)
  {
    position.x = 0;
  }
  else if (position.x > (globals.VIRTUAL_WIDTH - playerShipSprite.getWidth()))
  {
    position.x = globals.VIRTUAL_WIDTH - playerShipSprite.getWidth();
  }
}

This gives me 1:1 screen to touch movement of the ship. However, I would prefer to limit the movement velocity so the ship can't just skip to the other end of the screen if the user moves their finger fast enough. I tried something like this:

position.x = position.x + Math.signum(screenX - position.x) * 800 * Gdx.graphics.getDeltaTime();

The movement is correctly restricted, but is jerky. Any ideas?

edit

Additional overridden touch methods:

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button)
{
    touchPos.x = screenX;
    touchPos.y = screenY;
    touchPos.z = 0;

    camera.unproject(touchPos, globals.resizeViewport.x, globals.resizeViewport.y,
            globals.resizeViewport.width, globals.resizeViewport.height);

    // Did the player touch the ship?
    touchRect.x = position.x;
    touchRect.y = position.y;

    if (touchRect.contains(screenX, screenY))
    {
        playerShipTouched = true;
        touchOffset = screenX - position.x;
    }
    return false;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button)
{
    playerShipTouched = false;
    return false;
}

sentences:
Is there a term for placeholder graphics for dialog systems? I'm working on a game that has a lot of dialog. It has a dialog system similair to Phoenix Wright, where the characters appear onscreen when they talk, either in sprite form or as a 3d model. Usually there's mouth and eye animations as well, and their facial expressions change depending on the context of the scene.

Here's my problem: I suck at drawing. Like, massively. I enjoy writing dialog and I already have lots of dialog written down. I even made a little program for myself, which mimics how the dialog would play out in my game. Something that I don't enjoy doing, however, especially when I implement the dialog into my game, is have tags everywhere that describe the characters mood/expression instead of showing it visually. Example:

John: mostly neutral, slightly worried How was your day?
Jane: sad Not so great...

Even in the prototype stage, I would like something more... visual, to convey the scene better to everyone else and really get the right mood and expression of the character across. That way, it would be easier for the future artist to draw the necessary poses, expressions, animations, etc. for each character.

What I would like to do is have placeholders of blank (mostly featureless) characters that have lots of different expressions to convey what I want the character to look like in that situation. I'm not asking where to find something like that, I simply want to know if there is some sort of game developer jargon/term for this kind of thing (animated or still), so I can narrow down my search a little.

sentences:
How to create a tube 2D in unity I want to create a 2D tube in unity which I can cut, suture and drag it,  My idea is to use a small image in form of fragments but how i can do it like the picture bellow

EDIT :
What I did until now:

Firstly I tried to use Linerenderer but it didn't work for me because i couldn't cut it so tried to create a tube of cubes I used an empty object as parent whit childs of cubes as you can see on the picture bellow

with this way it was easy to apply the cut script so I just remove the fixed joint between the cubes where i click
and for the appearance of the tube I started by creating it as a direct line and I turned on the game then by dragging the tube i get the form bellow and i copy the position of each cube and set it on the instantiation of the childs

   GameObject intestines_top = GameObject.Find("intestine_top");

    setPositions();//on this method I instantiate an array of vector3 contains all the position i get
    fragments = new GameObject[fragmentNum];

    Vector3 position = Vector3.zero;

    for (int i = 0; i < fragmentNum; i++)
    {
        fragments[i] = Instantiate(fragmentPrefab, positionArray[i], Quaternion.Euler(new Vector3(0.413f, -259.96f, -536.531f)));
        fragments[i].transform.SetParent(transform);

        var joint = fragments[i].GetComponent<FixedJoint>();

        joint.connectedBody = parent.GetComponent<Rigidbody>();
        parent = fragments[i];

    }

the result of what i did :

NOTE :  other problem of my solution is sometimes all the gameobjects disperss due to collision I think
That's happen after a while of dragging the tube
I didn't find what exactly the problem but when I change the direction of the collider to the X-axis its solve the problem by 85% and for the drag script i use AddForce and velocity

rigid.AddForce((dest - rigid.position) * 200f); rigid.velocity *= 0.8f;

sentences:
What is a good book to start programming a 2D C++ game? I have a degree in Computer Science and while I was in college, I created a simple 2D game in Game Maker.  I would like to recreate this game in C++ as a start to learning how to create games in C++.  What would be a good book to start out on programming games in C++ for someone who has a bit of C++ experience (My CS Major classes were taught using Java and I had a class in C++ to learn syntax) and knowing the concepts behind objects, methods, inheritance, etc?

This would be a hobby of mine while I build up experience until I one day could work in the Vide Game Industry.

sentences:
Alternative to pyGame? i'm learning something about game programming from a book about "pyGame". pyGame is simple, but... python is a little complex and different from my previous knoweledge about programming.

I know "classical" language: C# (also C/C++), Java ... I know a lot of people love Python but for me is a little harder to learn!

So I'm looking something like "pyGame" but for java or for c# ... A library with which I can do almost the same thing i can do with pygame (so .. do more with less code ... and headache).

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:
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:
Why when rotating object 360 degrees on the x, it rotates once then stops? using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class MeshGenerator : MonoBehaviour
{
    public GameObject meshPrefab;
    public Vector3[] newVertices;
    public Vector2[] newUV;
    public int[] newTriangles;

    private List<Vector3> verticesList = new List<Vector3>();
    private List<Vector2> uvsList = new List<Vector2>();
    private List<int> trianglesList = new List<int>();
    private GameObject go;

    private void Start()
    {
        Mesh meshprefab = meshPrefab.GetComponent<MeshFilter>().sharedMesh;
        newVertices = meshprefab.vertices;
        newTriangles = meshprefab.triangles;

        for (int i = 0; i < newVertices.Length - 2; i++)
        {
            DrawLine(newVertices[i], newVertices[i + 1], Color.red);
            DrawLine(newVertices[i + 1], newVertices[i + 2], Color.red);
            DrawLine(newVertices[i + 2], newVertices[i], Color.red);
        }
    }

    void DrawLine(Vector3 start, Vector3 end, Color color, float duration = 0.2f)
    {
        go = GameObject.Find("Lines");
        GameObject myLine = new GameObject();
        myLine.transform.parent = go.transform;
        myLine.transform.position = start;
        myLine.AddComponent<LineRenderer>();
        LineRenderer lr = myLine.GetComponent<LineRenderer>();
        lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
        lr.startColor = color;
        lr.endColor = color;
        lr.startWidth = 0.05f;
        lr.endWidth = 0.05f;
        lr.useWorldSpace = false;
        lr.SetPosition(0, start);
        lr.SetPosition(1, end);
    }

    private void Update()
    {
        var p = go.transform.eulerAngles;
        p.x += 1;
        go.transform.eulerAngles = p;
    }
}

This is the rotation part:

private void Update()
    {
        var p = go.transform.eulerAngles;
        p.x += 1;
        go.transform.eulerAngles = p;
    }

It's rotating 360 degrees once, then it stops rotating but keeps shaking like it's trying to keep rotating but something keeps it from continue.

sentences:
How 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 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: Minecraft Forge modding 1.8 instance changing tool/armor material + color I am developing a minecraft mod in forge, and I need to find a way to create tools and armor where individual instances of items would have different tool material properties, armor material properties, and hues in how they are displayed. If you can offer help for any of those things, or for how to achieve these dynamic properties in general, I would be very appreciative.

sentences:
What implications does JIT (javascript/canvas) vs. AOT (Flash) have in terms of browser based game performance? In my experience, even till this day, I still see more of a visual lag in entity movement / animation in JavaScript (Canvas) based games than I do in Flash based games.

Why is this - what exactly is the descrepancy at the most basic level between an JIT vs AOT compiler in the specific scenario of JavaScript vs. Flash.

sentences:
Best Game Engine/Framework and Language for 2D actor/sprite intensive game I'm new to the game dev world.

I have a rather large project in mind (I learn by setting myself challenges :P ) and I'm wondering what the best engine/framework/language is for a 2D game with thousands of sprites/actors on screen at a time. Bare metal type stuff. I need to still be able to zoom in and out with that many actors at once.

This game will have no 3D elements.

Any thoughts?

Suggestions?

sentences:
Making a game preloader (Flash) Possible Duplicate:
  How do you create a single/internal pre-loader for a Flash game written using Flex?

Hi guys, Im trying to make a preloader in a Flash game.

Thing is, I need some advices on this since I never made one, I have the game almost complete, but when, i.e, I upload the game to a website I get a white screen for a few seconds, and then I see the game.

Is there a simple way, maybe using an a API or something like that, to make a preloader screen?

Im using Flash Builder fyi.

Thx!

sentences:
Fragment shader coordinates: Displacing pixels and texCoord problems I'm trying to create a shader that creates a displacement on an object, slicing horizontally the sprite.

These is an example of the atlas I'm using and the effect I'm trying to achieve:

I tried to achieve this creating a fragment shader, that would read the Y coordinate of the texcoord, and depending on the height, displace it horizontally.

But I found two main problems:

1) If my atlas had more rows of sprites, I can't really tell at what height I'm drawing the sprite in the fragment shader. Since values of texcoord go from 0 to 1 relative to the atlas being use, the more rows I have, the smaller values should I choose to create the horizontal cut. Is there any way to know the position inside the drawn?

2) The problem is similar to the previous point. When displacing the pixels horizontally, if the displacement is too big, I end up sampling the sprite next to the one being rendered. The idea is for it to loop back the the begining of the sprite. If I had the width of the sprite, I could tell how to do so, but using texcoord alone is just not posible. How can I do this?

sentences:
How is Unity's [Command] supposed to behave? Here's a very simple class/call hierarchy:

public class NetworkPlayer : NetworkBehaviour {
    public static NetworkPlayer localPlayer {
        get;
        private set;
    }

    [Command]
    public void CmdTurnDone() {
        Debug.Log("Turn done! isServer "+isServer+" isClient "+isClient+" isLocalPlr "+isLocalPlayer);
    }
}

public class SomeMonoBehaviour : MonoBehaviour {
    void Update() {
        NetworkPlayer.localPlayer.CmdTurnDone();
    }
}

When Update() gets executed on the host, it outputs as expected:

  Turn done! isServer True isClient True isLocalPlr True

Now, when Update() is executed on the remote client it outputs the following at the remote client's log only. However, the message does not appear at the server's logs:

  Turn done! isServer False isClient True isLocalPlr True

What puzzles me is why the message appears at the remote client's log only.

If I'm not mistaken, calling CmdTurnDone() at the remote client should execute it on the server. But why does the log message appear at the remote client's log instead of on the server's logs - where it is executed? Is it valid to call CmdTurnDone() from a MonoBehaviour?
Do you have any ideas why it's behaving like this? Is this the intended behavior? Thank you.

sentences:
How do I linearly interpolate between two vectors? I have a velocity vector where my client is at and where its going, and I have the same vector that comes from the server telling where the client should be. Sometimes its a bit different, so I want to interpolate between my current position to the server correct position.

The black arrow is the client velocity vector, the red arrow is the client velocity  vector on the server and the blue arrow is the one that I want to calculate and interpolate to.

How do I calculate the blue vector? Then, how can I linear interpolate between them?

sentences:
My texture is doing weird, either not loaded correctly or not rendered correctly. DirectX11 I'm loading a texture from a file called owl.png. But it renders really weird.

Original picture(512 X 512):

But it renders like this:

It's rendered on a square, that is initialized like this:

 { XMFLOAT4(-0.5f, -0.5f, 0, 0), XMFLOAT2(0,1) },
 { XMFLOAT4(-0.5f,  0.5f, 0, 0),XMFLOAT2(0,0) },
 { XMFLOAT4(0.5f,  0.5f, 0, 0), XMFLOAT2(1,0) },
 { XMFLOAT4(0.5f,  -0.5f, 0, 0), XMFLOAT2(1, 1) }

Where the XMFLOAT2 are the tex coords.
It's loaded like this:

ID3D11ShaderResourceView* m_texture;
DirectX::CreateWICTextureFromFile(device, fileName, 0, &m_texture);

My samplerDesc looks like this:

samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.MaxAnisotropy = 4;

And I use the normal sample method in my PS.

What did I do wrong?

sentences:
How can I instantiate my variables in Boo? I have a Player Attributes class:

import UnityEngine

class Stat ():
    public current as int
    public max     as int

class PlayerAttributes ( MonoBehaviour ):
    public Name          as string
    public level         as int
    public hp            as Stat = Stat()
    public ep            as Stat = Stat()

public strength      as int   // How accurate and how much damage with melee attacks
public dexterity     as int   // How accurate and how much damage with ranged attacks
public vitality      as int   // How many hit points he has
public power         as int   // How much damage his energy attacks deal
public resistance    as int   // How much defense he has against energy attacks
public agility       as int
public speed         as int   // How fast character attacks

public meleeAtk      as int
public rangedAtk     as int
public defense       as int
public powerAtk      as int
public powerDef      as int
public initiative    as single

public exp         as Stat = Stat()

def SetInitialStats (
            name       as string,
            strength   as int,
            dexterity  as int,
            vitality   as int,
            power      as int,
            resistance as int,
            agility    as int,
            speed      as int,
            exp        as int
          ):
   self.level      = 1
   self.Name       = name
   self.strength   = strength
   self.dexterity  = dexterity
   self.vitality   = vitality
   self.power      = power
   self.resistance = resistance
   self.agility    = agility
   self.speed      = speed
   self.exp.max    = self.level * (self.level + 1) * 500
   AddExp(exp)

def AddExp ( experience as int ):
   exp.current += experience

   while exp.current >= exp.max and level < 99:
     exp.current -= exp.max
     exp.max      = level * (level + 1) * 500
     level       += 1
     IncreaseStats()

def IncreaseStats ():
   strength   += 1
   dexterity  += 1
   vitality   += 1
   power      += 1
   resistance += 1
   agility    += 1
   speed      += 1

   meleeAtk   = (level * 7) + strength
   rangedAtk  = (level * 7) + dexterity
   defense    = (level * 2) + agility
   powerAtk   = (level * 7) + power
   powerDef   = (level * 2) + resistance
   initiative = 20 + ((speed * level)/1500)

   hp.max     = ((level * 5) + vitality) * 10
   hp.current = hp.max

   ep.max       = ((level * 5) + power)
   ep.current = ep.max

Jut anything simple really. Well I read in the docs to not use constructors with MonoBehaviour, but I try instantiating my variables with the Start() function which is SetInitialStats (...)

So In another script in the Start() function I call it up like this

    Player = PlayerAttributes.SetInitialStats('Robo', 20, 21, 19, 20, 18, 22, 22, 57000)

I get the warning: ' An instance of type 'PlayerAttributes' is required to access non static member'

Not sure what else I can do to setup my beginning stats.

I got this to work I Unityscript which worked with a constructor without MonoBehaviour so I don't know where else to go from here. I would like to stay using Boo.

sentences:
When and how should I update my collision grid? When and how should I update my collision grid?

Current implementation:

buildGrid(): add all entities with collision to the grid
handleCollision(timePerFrame, entities): handle all collisions
grid.clear(): clear grid

If I have for example 4000 stationary entities and only 20 moving entities, I remove and add 4000 entities to the grid every update for no reason.

What would be the good way to update only cells that require updating?

Only idea that I have currently is that after collision check I remove moving entities from the grid and during buildGrid() I add only moving entities to the grid.

All help is welcome.

Grid implementation

// CollisionGrid Cell
class Cell
{
    public:
        typedef std::set<Entity*> Container;

    public:
        void        setNeighbours(Cell* left, Cell* right, Cell* up, Cell* down);
        void        addEntity(Entity* entity);
        Container   getNearbyEntities() const;
        void        clear();

    private:
        void        appendEntitiesTo(Container& entities) const;

    private:
        Container   mEntities;

    protected:
        Cell*       mLeft;
        Cell*       mRight;
        Cell*       mUp;
        Cell*       mDown;
};

// CollisionGrid
class CollisionGrid
{
    public:
                            CollisionGrid(float sceneWidth, float sceneHeight, float cellSize);

        void                clear();
        void                addEntity(Entity* entity);
        Cell::Container     getNearbyEntities(Entity* entity);

    private:
        int                 getIdForPosition(const sf::Vector2f position);

    public:
        int                 mCols;
        int                 mRows;
        std::vector<Cell>   mCells;

    private:
        float               mSceneWidth;
        float               mSceneHeight;
        float               mCellSize;
};

// CollisionGrid Cell
void Cell::setNeighbours(Cell* left, Cell* right, Cell* up, Cell* down)
{
    mLeft = left;
    mRight = right;
    mUp = up;
    mDown = down;
}

void Cell::addEntity(Entity* entity)
{
    mEntities.insert(entity);
}

Cell::Container Cell::getNearbyEntities() const
{
    Container entities = mEntities;

    if (mLeft != nullptr)
        mLeft->appendEntitiesTo(entities);
    if (mRight != nullptr)
        mRight->appendEntitiesTo(entities);
    if (mUp != nullptr)
        mUp->appendEntitiesTo(entities);
    if (mDown != nullptr)
        mDown->appendEntitiesTo(entities);

    return entities;
}

void Cell::clear()
{
    mEntities.clear();
}

void Cell::appendEntitiesTo(Container& entities) const
{
    entities.insert(mEntities.begin(), mEntities.end());
}

// CollisionGrid
CollisionGrid::CollisionGrid(float sceneWidth, float sceneHeight, float cellSize)
: mSceneWidth(sceneWidth)
, mSceneHeight(sceneHeight)
, mCellSize(cellSize)
, mCols((int)floor(sceneWidth / cellSize))
, mRows((int)floor(sceneHeight / cellSize))
{
    mCells = std::vector<Cell>(mCols*mRows);

    for (int id = 0; id < mCols*mRows; ++id)
    {
        Cell* left = nullptr;
        Cell* right = nullptr;
        Cell* up = nullptr;
        Cell* down = nullptr;

        if (id % mCols > 0)
            left = &mCells[id - 1];
        if (id % mCols < mCols - 1)
            right = &mCells[id + 1];
        if (id > mCols - 1)
            up = &mCells[id - mCols];
        if (id < mCols * (mRows - 1))
            down = &mCells[id + mCols];

        mCells[id].setNeighbours(left, right, up, down);
    }
}

void CollisionGrid::clear()
{
    for (Cell& cell : mCells)
        cell.clear();
}

void CollisionGrid::addEntity(Entity* entity)
{
    mCells[getIdForPosition(entity->position)].addEntity(entity);
}

Cell::Container CollisionGrid::getNearbyEntities(Entity* entity)
{
    return mCells[getIdForPosition(entity->position)].getNearbyEntities();
}

int CollisionGrid::getIdForPosition(const sf::Vector2f position)
{
    return int(floor(position.x / mCellSize) + floor(position.y / mCellSize) * mCols);
}

sentences:
Check key state or listen for event? Possible Duplicate:
  Polling vs event driven input

I'm trying to teach myself a bit of game development using Pygame, and I'm unsure what's the best way to approach some of the fundamental parts of a game. For example, I've made a tiny 2D game where a sprite can move around the screen, seen from the top like a classic RPG. I'm using an event loop, and whenever I detect the right arrow key being pressed, I start the character walking right, and whenever I detect the key being released, it stops walking right, etc.

My question is if this is the best way to do it, or if it is better to check the state of the key at each step, and move right if the key is down, etc. I originally thought that it would be best to listen for events, as the player might conceivably press and release a key between two timesteps, thus making the game miss the event if it only checks the state of the key at each timestep.

I imagine for things like attack, which would start at or soon after the press of a key, and then last for a certain amount of time regardless of the state of the key, it would be best to listen for events. For things like movement, however, which typically lasts for as long as the key is pressed, it might be better to check the state of the key.

Any thoughts? Also, any links to a tutorial or textbook on game design which discusses these kinds of low level decisions would be great.

sentences: what is best iap unitypackage (Asset) for support google play+ amazon in unity 2019.1.9? I need a unitypackage easy and easy for In app purchasing in googleplay and amazon (for Android) Which unitypackage is best in unity 2019.1.9?

sentences:
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:
How to add multiple floors to a map in a text-based game? I decided to learn how to make games during this quarantine. I am reading Mission Python, a book that teaches how to make games using python and pygame. I'm halfway through it, but the game only has one map.

I'm trying to challenge myself by adding a basement and an upstairs room, but the book doesn't have anything on making multiple floors.

Current code for my map:

###############
##    MAP    ##
###############

MAP_WIDTH = 5
MAP_HEIGHT = 10
MAP_SIZE = MAP_WIDTH * MAP_HEIGHT

GAME_MAP = [ ["Room 0 - where unused objects are kept", 0, 0, False, False] ]

outdoor_rooms = range(1, 26)
for planetsectors in range(1, 26): #rooms 1 to 25 are generated here
    GAME_MAP.append( ["The dusty planet surface", 13, 13, True, True] )

GAME_MAP  += [
        #["Room name", height, width, Top exit?, Right exit?]
        ["The airlock", 13, 5, True, False], # room 26
        ["The engineering lab", 13, 13, False, False], # room 27
        ["Poodle Mission Control", 9, 13, False, True], # room 28
        ["The viewing gallery", 9, 15, False, False], # room 29
        ["The crew's bathroom", 5, 5, False, False], # room 30
        ["The airlock entry bay", 7, 11, True, True], # room 31
        ["Left elbow room", 9, 7, True, False], # room 32
        ["Right elbow room", 7, 13, True, True], # room 33
        ["The science lab", 13, 13, False, True], # room 34
        ["The greenhouse", 13, 13, True, False], # room 35
        [PLAYER_NAME + "'s sleeping quarters", 9, 11, False, False], # room 36
        ["West corridor", 15, 5, True, True], # room 37
        ["The briefing room", 7, 13, False, True], # room 38
        ["The crew's community room", 11, 13, True, False], # room 39
        ["Main Mission Control", 14, 14, False, False], # room 40
        ["The sick bay", 12, 7, True, False], # room 41
        ["West corridor", 9, 7, True, False], # room 42
        ["Utilities control room", 9, 9, False, True], # room 43
        ["Systems engineering bay", 9, 11, False, False], # room 44
        ["Security portal to Mission Control", 7, 7, True, False], # room 45
        [FRIEND1_NAME + "'s sleeping quarters", 9, 11, True, True], # room 46
        [FRIEND2_NAME + "'s sleeping quarters", 9, 11, True, True], # room 47
        ["The pipeworks", 13, 11, True, False], # room 48
        ["The chief scientist's office", 9, 7, True, True], # room 49
        ["The robot workshop", 9, 11, True, False] # room 50
        ]

#simple sanity check on map above to check data entry
assert len(GAME_MAP)-1 == MAP_SIZE, "Map size and GAME_MAP don't match"

sentences:
How to find the closest point on multiple colliders within a box? I need to find the position of the closest point from the bounds of multiple colliders. Right now I'm using OnTriggerStay and collider.ClosestPointOnBounds().

This works great for one collider, but as when I add a new collider, it doesn't update.

I've drawn a quick picture to illustrate what I'm trying to say. The black box is the area I want to check in, the red boxes are the colliders with numbers representing the order they entered the black box. The green star is what the code currently says the closest point is, and the blue star is the expected result. The purple star is the position I'm checking for, the blue star should be the closest point to the purple star.

I found this answer to a similar question on answers.unity3d.com. However, I feel like that could be very inefficient because there will be many, probably up to 50 of these box checking scripts running at the same time.

I've also tried using Physics.BoxCast but that gave very wild results. The area it was checking was very different to what I wanted, and also what I was visualizing with gizmos. Also, the whole idea of boxcasts are very very confusing so I would rather something else.

What is the best way to find the closest point on the bounds of multiple colliders within a certain area?

sentences:
Why Inverse Transform the Ray when doing Transformation? I am adding 3D affine transformations to my ray tracer, and it seems all the literature on the web recommend inverse transforming the ray instead of transforming the 3D objects.

Why is that? There are a lot more rays than objects in a typical ray tracing scene, so wouldn't it be more efficient to transform the objects themselves?

sentences:
How to "place" object in a 3d world without overlapping them ? I would like to place object  in a 3d world "like minecraft player can do".

What I'm trying to do is to allow the user to place objects, without overlapping them (like in minecraft you can do).

So if the player try to place an object partially over another, my  game automatically "move and place" the object in the allowed position.

What can be the right approach ?

sentences:
Roguelike Class Structure Makes Everything Effectively Global A brief rundown of the hierarchy of the game data objects:

Configuration - loaded from XML files, has Descriptors, among other things

Atlas - has a Configuration, has a CreatureInstance(represents the player's creature instance), is an associative array of AtlasColumns

AtlasColumn - has an Atlas(parent), is an associative array of AtlasCells

AtlasCell - has an AtlasColumn(parent), is an associative array of Layers

Layer - has an AtlasCell(parent), is an associative array of LayerColumns

LayerColumn - has a Layer(parent), is an associative array of LayerCells

LayerCell - has a LayerColumn(parent), has a CreatureInstance, a array of ItemInstances, and a TerrainInstance

CreatureInstance/ItemInstance/TerrainInstance - has a LayerCell(parent), has a Descriptor

Descriptor - has an associative array of properties needed by an instance to do its particular function

The most important thing in the Configuration are the Descriptors.  A Descriptor has all of the properties that are needed by the various types of instances. It has properties that drive behavior, what it looks like on screen, and so on.

So here's the part that bothers me:

Everything... EVERYTHING, from Atlas to TerrainInstance can talk up and down the entire chain, the reason being that if, for example, the TerrainInstance is a square upon which a player steps and suddenly a number of monsters are conjured around him, the TerrainInstance needs to have access to the neighboring LayerCells.  Or for another example if a CreatureInstance when attacking the player's CreatureInstance is able to take items from the player's inventory, and relocate them somewhere else in the dungeon, it needs access to a different Layer or AtlasCell in order to put the item where it needs to go.

An alternative that would appear to be "better encapsulated" might be a messaging system that sends little message objects up and down the chain and handles things at the appropriate level, but is that really any BETTER than just having the objects be aware of one another?

The game I'm writing started out with mostly hardcoded item and creature types, and gradually morphed its way into something similar to the more flexible roguelike framework that I've detailed above. I'm finally switching from C# to Java for it(the language is immaterial, however), and I'd like to not have missed something glaringly obvious that will cause great pains later when I need to refactor it.

So, the question: is the apparent lack of encapsulation within the data/business objects of the game demonstrate a fatal flaw in the architecture?  And if so, what is that flaw and how can I correct it before I get too far along?

sentences:
XNA 4.0 - Normal mapping shader - strange texture artifacts I recently started using custom shader. Shader can do diffuse and specular lighting and normal mapping. But normal mapping is causing really ugly artifacts (some sort of pixeling noise) for textures in greater distance.

It looks like this:

This is HLSL code:

// Matrix
float4x4 World : World;
float4x4 View : View;
float4x4 Projection : Projection;

//Textury
texture2D ColorMap;
sampler2D ColorMapSampler = sampler_state
{
    Texture = <ColorMap>;
    MinFilter = Anisotropic;
    MagFilter = Linear;
    MipFilter = Linear;
    MaxAnisotropy = 16;
};

texture2D NormalMap;
sampler2D NormalMapSampler = sampler_state
{
    Texture = <NormalMap>;
    MinFilter = Anisotropic;
    MagFilter = Linear;
    MipFilter = Linear;
    MaxAnisotropy = 16;
};

// Light
float4 AmbientColor : Color;
float AmbientIntensity;

float3 DiffuseDirection : LightPosition;
float4 DiffuseColor : Color;
float DiffuseIntensity;

float4 SpecularColor : Color;
float3 CameraPosition : CameraPosition;
float Shininess;

// The input for the VertexShader
struct VertexShaderInput
{
    float4 Position : POSITION0;
    float2 TexCoord : TEXCOORD0;
    float3 Normal : NORMAL0;
    float3 Binormal : BINORMAL0;
    float3 Tangent : TANGENT0;
};

// The output from the vertex shader, used for later processing
struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 TexCoord : TEXCOORD0;
    float3 View : TEXCOORD1;
    float3x3 WorldToTangentSpace : TEXCOORD2;
};

// The VertexShader.
VertexShaderOutput VertexShaderFunction(VertexShaderInput input, float3 Normal : NORMAL)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    output.TexCoord = input.TexCoord;

    output.WorldToTangentSpace[0] = mul(normalize(input.Tangent), World);
    output.WorldToTangentSpace[1] = mul(normalize(input.Binormal), World);
    output.WorldToTangentSpace[2] = mul(normalize(input.Normal), World);

    output.View = normalize(float4(CameraPosition,1.0) - worldPosition);
    return output;
}
// The Pixel Shader
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float4 color = tex2D(ColorMapSampler, input.TexCoord);

    float3 normalMap = 2.0 *(tex2D(NormalMapSampler, input.TexCoord)) - 1.0;
    normalMap = normalize(mul(normalMap, input.WorldToTangentSpace));
    float4 normal = float4(normalMap,1.0);

    float4 diffuse = saturate(dot(-DiffuseDirection,normal));
    float4 reflect = normalize(2*diffuse*normal-float4(DiffuseDirection,1.0));
    float4 specular = pow(saturate(dot(reflect,input.View)), Shininess);

    return  color * AmbientColor * AmbientIntensity +
            color * DiffuseIntensity * DiffuseColor * diffuse +
            color * SpecularColor * specular;
}

// Techniques
technique Lighting
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

Any advice? Thanks!

sentences:
Xcode workspace with Unity3D as a sub-project? Let's say we're developing a 2D game with Cocos2d-iPhone and UIKit and CoreAnimation. But we're also considering leveraging the 3D capabilities of Unity 3D.

Is it possible that we add the Unity3D-generated Xcode project as a sub-project into the workspace and expose the 3D UI element as some kind of UIView subclass so that the native UIKit and CoreAnimation code could use them without the need to mess up with their underlying Unity3D implementation?

sentences:
How to update model transform of components when using physics? I implemented a high level components system for my renderer and am curious about the right way to update the transforms components of models that have a physics rigidbody attached. I am using bulletsharp. To clarify. Transformcomponents holds the model matrix that is used for rendering. Rigidbody holds the worldmatrix that is getting modified by step simulation of bulletsharp. I want my rigidbody and transformcomponents matrices to stay synced.

My idea is to do it like this per render loop:

Always use transformcomponent for rendering
Execute physics step simulation
Update all transformcomponents with new matrices from  rigidbody
Whenever transformcomponent gets a matrix update from user input and not physics... Update the matrices recursive for the attached rigidbody and all children
Render with matrices of transformcomponents

Is there a better way to implement rigidbody physics in a components system for rendering? I use the physics mainly for raycast picking and OBB collision detection.

And when I use the term "better", I mean more efficient in terms of least updates on scene components. Syncing two components matrices seems tedious and I want to know if there is a solution without syncing.

sentences:
2D Terrain Modification/Expansion? I have a problem which I don't really know what to call, and I would like to apologize in advance for perhaps the misleading title. Let's say I break a few objects in the 2D game and they scatter along the floor, I want the objects to now become apart of the floor.

The solution doesn't have to account for movement, it can wait till the object has come to a stop before updating the terrain. It is intended the terrain doesn't produce any concave shapes as I assume that would just add a whole new layer of complexity.

I thought of a few solutions but I am completely new to this all and if all you can do is point me in the right direction I would greatly appreciate it.
What am I actually asking? I am honestly just looking either for the general Maths involved, or what this type of process is even called if it has a proper term or a few suggestions for a solution.

(In the images, the blue rectangles are rigid bodies, the black lines are the edges of the environment, and the red line is the floor/terrain that changes in relation to the blue rectangles)

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:
Generating island terrains with Simplex Noise (C#/XNA) I've got one little question: Is there any code or sample which shows how the simplex noise works? I cannot find anything about it... How should I implement it, without the knowledge how the algorithm works?...

The other question is: Is the simplex noise a good algorithm for island generation? I need huge islands (really huge), with different layers (sand, gras, stone) and clearly visible height-differences, which have soft-edges, so you can go out/into water without jumping over uneven surfaces.

sentences:
How to control the list of items on the screen? I am an experienced app developer (c#) however I am just looking at starting 2d game development.

I have read some articles and understand the concept of the gaming loop controlling the application flow. However there seems few articles explaining general concepts for an existing developer. From these I assuming that each on screen item becomes it's own object and handles it's own location, drawing, collision detection etc. (though correct me if I am wrong)

My question is how to control the list of items on the screen? Are these stored in a simple collection and then removed as they fall out of play and is this collection held by the game engine or individual components? An example would be bullets from a gun?

sentences:
View matrix in opengl Sorry for my clumsy question.
But I don't know where I am wrong at creating view matrix.

I have the following code:

 createMatrix(vec4f(xAxis.x, xAxis.y, xAxis.z, dot(xAxis,eye)),
 vec4f(  yAxis.x_, yAxis.y_, yAxis.z_, dot(yAxis,eye)),
 vec4f(-zAxis.x_, -zAxis.y_, -zAxis.z_, -dot(zAxis,eye)),
 vec4f(0, 0, 0, 1)); //column1, column2,...

I have tried to transpose it, but with no success.
I have also tried to use gluLookAt(...) with success.
At the reference page, I watched the remarks about the to-be-created matrix, and it seems the same as mine. Where I am wrong?

sentences:
How does the use of marching square and wave function collapse differ in a auto tiling? I am discovering the techniques of procedural generation.
I struggle understanding on the usage of those two techniques:

Wave Function Collapse
Marching Squares

As I understand, both can be used to populate neighbourhood of a tile based on rules.

In the case of a game map editor where a user can "paint" a dungeon. When would you use one versus the other?

sentences:
How can I get the Launch dynamic link in Unity? I have integrated firebase dynamic link sdk in my app and it is working perfectly fine,

I can generate dynamic links, and when clicked on them if the app is not installed it redirects me to the playstore and if installed open up the link in app.

My question is how can I get that generated link when I open the app through it, I just could not able to find anything in docs

the code I am using to listen for link clicks is as follows

void Start()
{
    DynamicLinks.DynamicLinkReceived += OnDynamicLink;
}

// Display the dynamic link received by the application.
private void OnDynamicLink(object sender, EventArgs args)
{
    var dynamicLinkEventArgs = args as ReceivedDynamicLinkEventArgs;
    Debug.LogFormat("Received dynamic link {0}", dynamicLinkEventArgs.ReceivedDynamicLink.Url.OriginalString);
    // Above line gets me the original base link,
    // But I want the link which I clicked
}

sentences:
How to find position of the edge of an object? I have two planes and I want to put both planes one after another so that I can form a road. I set them from the editor and that was very easy but I wanted to do this from code. So in the code:

void Start() {
  secondRoad.position = firstRoad.position;
}

But this just set the second plane in the center of the first plane, kind of overlapping. But I want the second plane to be placed next to the first plane where it ends right the edge of the first plane. How will I do this?

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

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

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

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

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

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

    gl_Position = gl_ModelViewProjectionMatrix * vec4(Position,1);

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

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

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

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

sentences: Can I sell Windows Phone 7 games on the marketplace from India? I am a developer from India working on a game in WP7. I need to know, can I sell my game in Windows phone apps marketplace or is it like Android market where only free/ad-based is allowed?

sentences:
Don't know what to do with XML file and Spritesheet (Swift 3) I'm new to spritesheets and game development in general. I have two files:
1) a .png spritesheet with tons of sprites and
2) a companion XML file with coordinates, anchor points, image names, and animation info.

The spritesheet appears to have no order, and I cannot make sense of the organization of the XML file (which does not appear to contain the dimensions of the seemingly different-sized sprite images)

My question is: How do I use these to make sprite animations? It appears the work has been done for me, but I have no idea how to use it.

In particular, I would like to use this with Swift 3 SpriteKit.

I would be satisfied with exporting all the sprites into separate images with the appropriate names. Is that possible? Thank you for your help!!

sentences:
How can I support many point light sources in a dynamically-generated level in Unity? I'm currently working with a dungeon game which is similar to Dungeon Keeper by Mythic Entertainment. I'm using Unity and developing this game for Ipad 2 and above. Player can modify his dungeon, and I'd written a dungeon generator which creates it. In this case, I can't use lightmaps, because the dungeon has been created dynamically and player can tweak it. I also devised a way to combine separate game objects in a single mesh, so imagine that the entire dungeon (except special objects such as pillars, statues and mobs) is the single mesh. There's many point light sources (10-15 and above) on the stage, but Unity don't allow to use more than 8 light sources per object.

So, if all dungeon cells are separated objects, I can use the diffuse or even vertex-lit lighting, but if the entire dungeon is a single mesh, there's the hardware limit appears.

Ways to solve this problem I'd divised:

Use separated geometry (tried) - bad, because it harms berformance because there's many-many-many drawcalls (16-17 fps on Ipad 4).
Use deffered shading (tried) - bad, because it harms performance even more than separated geometry.
Use a custom shader (haven't tried) - I don't know how.
Don't unite all cells in the single mesh but unite groups of cells to reduce the number of separated objects (haven't tried)
Use the light manager (haven't tried) - I don't know how.
???

How can I deal with it?

sentences:
OpenGL threaded loading I'd like to introduce seamless level loading which means I need multiple threads. The main thread is for rendering the current scene (or for non-seamless level loading a progress bar) while the other thread is loading the resource files and sending data to the graphics card.

Now I have the following single threaded architecture: when the graphics device is initialized, a dummy window and a "shared context" is created. This is the only rendering context (HGLRC in Windows terms) I'm creating. Every time a new window is created and the graphics device is asked to create a "renderable surface" into that window, the same "shared rendering context" is used. I can do this because I set the same pixel format for each window, so there is no point to make multiple rendering contexts (that would just make my life harder than it should). Here is a small image representing the current design:

I've read some topics about this but now I'm confused since I read really different point of views, so I have some questions:

As far as I know an OpenGL context can be active in a single thread only (at a time). This means that I need another "loading rc" which shares resources (through context creation or *glShareList) with the "shared rc". Every time I create a new thread to load something, I have to set the "loading rc" active in that thread. Am I right?
Can I use the same dummy device context (HDC) in the loading thread?
Because I have a single GPU the commands sent to the graphics card are queued up. Right? Will this behaviour introduce switches between shared and loading contexts?
Is there anything else I should take care of?

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:
Reducing adjacency bookkeeping work in constrained Delaunay triangulation I'm using the Sloan algorithm for constraining a generated Delaunay triangulation. This primarily consists of edge flipping for the edges that overlap the constrained edges.
In order to flip an edge, I have to know what two triangles contain that edge, and so for every edge I currently maintain an index (into the triangle array) of the current and opposite triangles for that edge. This gets built from the triangle array, where each triangle maintains indices for all adjacent triangles.
While this works, I've found that the vast bulk of my code is dealing with the maintenance of these triangle adjacencies. Every time an edge gets flipped, I not only have to update the two triangles that share the edge, but also update all of the other neighboring triangles that may have adjacency to one of those triangles, as well as go through and update any adjacency indexes within my list of edges to be flipped.
And then again, after the edges are flipped and you get a list of final "good" edges to use, you have to go through them and make sure they still satisfy Delaunay circumcenter rules, and if not, flip them again. Which means repeating all of the same work to maintain adjacency indexes.
Is there an algorithm for efficiently maintaining triangle/edge adjacency without all of this work? Or, better, is there an efficient method of determining neighboring triangles that share a common edge without the need to maintain these links?
I feel like I'm doing more adjacency maintenance than actual triangulation...

sentences:
How do I load textures with SFML for OpenGL? I'm looking at NeHe's texture mapping tutorial. It looks overly complicated for just loading a texture.

Is there a way to load a texture in SFML and then use it in Open GL? I use SFML for my windowing.

sentences:
How do I write a game server with single-threaded networking? I want to write a game server with one thread for clients message handling and use something like epoll to accept network messages. All I/O and database access will be processed in a thread pool and they are asynchronous and non-blocking.

Given such a scheme, how should I handle other events/messages (physics, game logic, etc)? Can I implement methods to handle these messages as a blocking interface in the main thread?

What simple, popular servers exist (using Cocos*d/Unity as client) that I could look at for an example of this?

sentences:
Deleting faces or triangles from an object by material on load scene I have objects that have multiple materials imported from blender as a .FBX.

I'd like to find the objects where materials are used, and destroy faces when a certain material name is used ("!null", in my case).

I know this is not the correct way to work. Normally I should delete the faces in Blender, but as I am building quite complex geometry using faces that I need in Blender but don't want the Unity engine to render, it seems the only way to go.

I tried "cutout", but although they are invisible, it does not make any difference in rendering times.

Is this at all possible? If it is, how do I do it?

sentences:
How can I center an arbitrary string over a sprite? Eyesore:

The problem is, the text should be exactly centered over the player, I want something like this:

My code to draw username above the player is:

g.drawString(username,(int) playerX,(int) playerY);

I can just do playerX-(some number of pixels), but this won't work all the time, because if the player makes his name something that has fewer characters, it will not be centered any more.

How can I make the user-provided String 'username' always be centered above the player sprite?

sentences:
Unable to rotate a 2D object, wanting to move it like a ball/wheel I'm using Unity2D.

I have a very basic 2D space with a platform, a ball and 2D physics.

Physics is being applied and ball sits on top of the platform.

However, it will not spin.

Below is the script attached to the ball:

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

public class Circle : MonoBehaviour
{
    private Vector3 screenPoint;
    private Vector3 offset;
    private float speed = 10f;
    public 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.maxAngularVelocity = 999;
        rb.AddTorque(movement * speed);
    }

    void OnMouseDown()
    {
        offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
    }

    void OnMouseDrag()
    {
        Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
        transform.position = curPosition;
    }
}

The script is attached to the ball, I know this because I'm able to drag it (see OnMouseDown).

I have also tried with other objects such as a rounded-corner square, but I just can't get any spin or torque to be applied.

Below is a screenshot of the inspector on the element.  Circle.cs (the script) is the above pasted script.

Any help appreciated.

sentences:
lemniscate of Bernoulli I am trying to learn and teach myself openGL and I wanted to draw a figure 8 in a 3D setting but I'm having a problem. Please forgive me, I am very new at this but I'll attempt to explain what I have done so far

I understand that I can use the Lemniscate of Bernoulli to draw a nice figure 8, so I've have adopted that idea into my code. I just want to draw it along the x and z plane.
 My code looks like this

#define PI 3.1415926535f
#define MAX_STEPS 100.0f
//...
Vector3 PointOnCurve1(Vector3 p1, float t)
{
    Vector3 tempPoint = {0.0f, 0.0f, 0.0f};
    float scaler = 2/ (3- cos(2*t));

    varX = scaler * cos(t);
    varZ = scaler * sin(2*t) / 2

    tempPoint.x = varX+p1.x;
    tempPoint.y += p1.y;
    tempPoint.z =varX+p1.z;

    return tempPoint;
}

Vector3 g_Point    = {-4,  0,  0};
glBegin(GL_LINE_STRIP);
    for(float t = -PI; t <= PI; t += PI / MAX_STEPS)
    {
        vPoint = PointOnCurve1(g_Point, t);
        glVertex3f(vPoint.x, vPoint.y, vPoint.z);
    }

glEnd();

All I'm getting is one straight green line instead of a figure 8. any ideas? Am I missing something here? I'm basing this equation from this gamedev article

How can I move an object in an "infinity" or "figure 8" trajectory?

sentences:
best way to destroy an gameobject in unity 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.
  grid.objGridSize () (at Assets/scripts/grid.cs:119) grid.hit
  (System.String hitObjString) (at Assets/scripts/grid.cs:109)
  grid.Update () (at Assets/scripts/grid.cs:80)

I'm getting this error and strange results after finding a gameobject, storing it in a new GameObject variable and then destroying it:

void Update () {
    if(Input.GetButtonDown("Fire1")){ // detect left mouse click

        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        Debug.Log("clicked");

        if(Physics.Raycast(ray, out hitObj)){
            if(hitObj.collider != null){

                // send a message to the object that got hit
                hit(hitObj.collider.gameObject.name);
            }
        }
    }
}
public void hit(String hitObjString){

    Debug.Log("I got hit: "+name);

    GameObject hitTile = GameObject.Find(hitObjString);

    if( hitTile.tag == "tile"){

        Destroy(hitTile);
    }
}

sentences:
Unity, NavMeshAgent SetDestination acts funny I had a scene set as the following picture.

And a NavMesh baked as the following picture.

But my "player" (The left-bottom corner sphere) don't go where I want it want to go!

Test vedio

Source Codes:

public Camera cam;
public NavMeshAgent agent;
public GameObject particle;
// Update is called once per frame
private void Start()
{
    particle.GetComponent<Renderer>().material.color = Color.red;
}
void Update ()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if(Physics.Raycast(ray,out hit))
        {
            Vector3 v = hit.point;
            agent.SetDestination(v);
            Instantiate(particle,v,transform.rotation);
        }
    }
}

Could somebody please help me out!?

Much appreciated!!!

PS.

I found out through my "particle" that after first few hits, the "hit position" starts to "float"!

That's why my "particle" became bigger!

It doesn't "hit" the plane no more!

It always hit at somewhere above the plane!

That's why my "player" can NOT go to the destination!

Could somebody teach me how to fix it please!

Much appreciated!

sentences:
Best way to create neon glow line effect in AS3? What's the best way to create a neon glow line effect in Flash AS3? Say similar to what's going on in the game gravitron360 on the xbox 360?

Would it be a good idea to create movieclips with plain lines drawn in them and then apply a glow filter to them? or perhaps just apply the glow filter to the entire movieclip layer the movieclips are on? or just draw them manually and create a glow effect by converting the lines to fills and then softening edges? (wouldn't blend as well but would be the fastest CPU wise?)

Thanks for any help

sentences:
How would one program potions that can change virtually every aspect of the character? In Witcher 3, there are various potions that the character can consume. There seems to be potions that have various effects during their effect time:

Restores a certain number of health points per time
Instantly restores a certain number of health points
Increases the defense points
If one delivers a critical blow, the damage will be amplified
If one is attached by a vampire and it draws blood, the vampire will become poisoned
Increases the maximum weight capacity by 20 pounds.
Lets you see at night
Improves sight under water and extends the time that the character can hold his breath

Then there are various properties of the equipment that also have various effects (extra 5% experience points, extra attack points, ...) and runes one can put into the equipment.

I can imagine how one could program each of them separately, I do not see how one could program this in a non-intrusive and extensible fashion. It seems the potions must have access to virtually every aspect of the game.

Or is it the other way around? In the attack code, there are hooks for certain potions. In the diving code, there is hook for the one relevant potion.

How does one implement this kind of thing?

sentences:
Is it possible to index different vertex attributes with different index buffers? Let's say I've got a vertex which is part of many triangles. I can just reference those with an index buffer.  But is it possible to share it's position but have different texture coords for each triangle?  e.g.

+--+--+
|\ |\ |
| \| \|
+--X--+
|\ |\ |
| \| \|
+--+--+

The center vertex, X, is shared. If I want each square to have a different texture then I would need to store four distinct UV coordinates for the centre vertex.  Is this only possible by creating it four times?

sentences:
How do I know what to do with incoming network messages? I am programming a 2D game in a server/client architecture with C# and lidgren. When a client sends a message to the server, how does the server know what to do with that message data?

The client could send different kinds of things, for example the coordinates of player 1 and 2 or the health. So how does the server know its the coordinates and stuff?

sentences:
Grid-Based 2D Lighting Problems I am aware this question has been asked before, but unfortunately I am new to the language, so the complicated explanations I've found do not help me in the least.

I need a lighting engine for my game, and I've tried some procedural lighting systems. This method works the best:

if (light[xx - 1, yy] > light[xx, yy]) light[xx, yy] = light[xx - 1, yy] - lightPass;
if (light[xx, yy - 1] > light[xx, yy]) light[xx, yy] = light[xx, yy - 1] - lightPass;
if (light[xx + 1, yy] > light[xx, yy]) light[xx, yy] = light[xx + 1, yy] - lightPass;
if (light[xx, yy + 1] > light[xx, yy]) light[xx, yy] = light[xx, yy + 1] - lightPass;

(Subtracts adjacent values by 'lightPass' variable if they are more bright) (It's in a for() loop)

This is all fine and dandy except for:

The system favors whatever comes first in the for() loop

This is what the above code looks like applied to my game:

On the left side you can see some weirdness going on:

The loop goes top to down then to the right column:

This is how the for() loop goes:

Light provided from my mouse, should be a full light, but is only half:

If I could get some help on creating a new procedural or otherwise lighting system I would really appreciate it!

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:
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:
How can a system similar to Dwarf Fortress' legends mode be implemented? In Dwarf Fortress, nearly everything that happens during world generation is logged and viewable in legends mode. An XML file containing that information can be exported and loaded into a utility such as Legends Viewer which can show specific events, relationships between two recorded people, what kingdoms people belonged to, etc.

My naive approach would be to add each event associated with a person to a database with a unique ID then filtering using the ID in order to view the correct events. However, this approach seems to be inflexible and adds more dependencies and complexity to my project.

My second approach would be to store these events in a JSON file in order to be able to treat each individual as an object, although this approach will probably be either be too memory intensive and not scale well since I would have to load a large file into memory or be too slow since I would have to open and modify many files at a time.

Assume the game has a simple system where each individual is tracked by a name and a UUID, belongs to a kingdom, and has some type of relationship to other individuals. Events are tracked by recording the location, date, and individuals involved. What type of file, data structure, library, etc. is generally used for something like this that is efficient enough to store up to a million or so of these simple entries?

sentences:
How do I write to z-buffer in a transparent Unity 5 shader without a shadow caster? I've seen plenty of examples of "priming the depth" buffer with this pass:

Pass
{
    Tags{ "LightMode" = "Always" }
    ColorMask 0
}

But it does nothing in Unity 5. How do I write to the depth buffer (_CameraDepthTexture) in Unity 5 without using a shadowcasting pass?

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:
Change the shape of body dynamically I have a problem where i have a ballon which i need to continuously inflate and defalte in update method, I have tried to used setScaleCenter but it is not giving desired result.
Below is a code i am trying to make work

    scale += (float) ((dist-lastDist)/lastDist);
    Log.d("pinch","scale is "+scale);
    Log.d("pinch","change in scale is "+(float) ((lastDist-dist)/lastDist));
    player.setScaleCenter(scale, scale);
    player.setScale(scale);

sentences:
Updating aiScene in ASSIMP with skeleton data I am working on a project where I take an unrigged closed mesh, import it using ASSIMP, auto-rig it using the algorithm provided by Ilya Baran and Jovan Popovic and again export it using ASSIMP. I have the following code that updates the aiScene structure created by assimp inserting the new skeleton data into it. I does not seem to be working, it throws weird exceptions. Can anyone check whether I am updating the data correctly...

Update Code:

void setSkeleton()
    //Number of bones is 20
    const int num_bones = 20;
    string names[num_bones] = { "hip_center", "spine", "shoulder_center", "head"
        , "shoulder_left", "elbow_left", "wrist_left", "hand_left"
        , "shoulder_right", "elbow_right", "wrist_right", "hand_right"
        , "hip_left", "knee_left", "ankle_left", "foot_left"
        , "hip_right", "knee_right", "ankle_right", "foot_right" };

    //define nodes
    aiNode* nodes[num_bones];
    for (int i = 0; i < num_bones; i++) {
        nodes[i] = new aiNode(names[i]);
    }

    //define parents
    nodes[0]->mParent = NULL;
    nodes[1]->mParent = nodes[0];
    nodes[2]->mParent = nodes[1];
    nodes[3]->mParent = nodes[2];
    nodes[4]->mParent = nodes[2];
    nodes[5]->mParent = nodes[4];
    nodes[6]->mParent = nodes[5];
    nodes[7]->mParent = nodes[6];
    nodes[8]->mParent = nodes[2];
    nodes[9]->mParent = nodes[8];
    nodes[10]->mParent = nodes[9];
    nodes[11]->mParent = nodes[10];
    nodes[12]->mParent = nodes[0];
    nodes[13]->mParent = nodes[12];
    nodes[14]->mParent = nodes[13];
    nodes[15]->mParent = nodes[14];
    nodes[16]->mParent = nodes[0];
    nodes[17]->mParent = nodes[16];
    nodes[18]->mParent = nodes[17];
    nodes[19]->mParent = nodes[18];

    //set root node reference in the aiScene object
    aiscene->mRootNode = nodes[0];

    //create bones for the 0th mesh in the scene(assuming there is only one mesh)
    aiMesh* aimesh = aiscene->mMeshes[0];
    aimesh->mNumBones = 20;
    aiBone* bones[20];
    aimesh->mBones = bones;

    vector<aiVertexWeight> weightsOfBone[20];
    //This loop creates vertexWeight objects for all the vertices affected by each bone in the above array
    int numVertices = rigOut.attachment->getNumVertices();
    for (int i = 0; i < numVertices; i++) {
        vector<pair<int, double>> weights = rigOut.attachment->getNZWeights(i);
        int s = weights.size();
        for (int j = 0; j < s; j++){
            aiVertexWeight wght(i, weights[j].second);
            weightsOfBone[weights[j].first].push_back(wght);
        }
    }

    //define bones
    for (int i = 0; i < num_bones; i++)
    {
        bones[i] = new aiBone();
        bones[i]->mName = names[i];
        const int numWeights = weightsOfBone[i].size();
        bones[i]->mNumWeights = numWeights;
        if (numWeights == 0) return;
        aiVertexWeight* weights = (aiVertexWeight *)malloc(numWeights * sizeof(aiVertexWeight));
        for (int j = 0; j < numWeights; j++) {
            weights[i] = weightsOfBone[i][j];
        }
        bones[i]->mWeights = weights;
    }
}

sentences:
Logarithmic spacing of FFT subbands I'm trying to do the examples within the GameDev.net Beat Detection article ( http://archive.gamedev.net/archive/reference/programming/features/beatdetection/index.html ) I have no issue with performing a FFT and getting the frequency data and doing most of the article. I'm running into trouble though in the section 2.B, Enhancements and beat decision factors.

in this section the author gives 3 equations numbered R10-R12 to be used to determine how many bins go into each subband:

R10 - Linear increase of the width of the subband with its index

R11 - We can choose for example the width of the first subband

R12 - The sum of all the widths must not exceed 1024

He says the following in the article: "Once you have equations (R11) and (R12) it is fairly easy to extract 'a' and 'b', and thus to find the law of the 'wi'. This calculus of 'a' and 'b' must be made manually and 'a' and 'b' defined as constants in the source; indeed they do not vary during the song."

However, I cannot seem to understand how these values are calculated...I'm probably missing something simple, but learning fourier analysis in a couple of weeks has left me Decimated-in-Mind and I cannot seem to see it.

sentences:
Interpolate camera rotation over many keyframes smoothly I have a defined set of rotation/position keyframes that I want a camera to animate between smoothly.  Handling the position is easy enough using cubic bezier curves (and just auto-generating the control points between each keyframe).  But after a day of research I'm still having a lot of trouble figuring out how to handle rotation similarly.

My first thought was that there must be a similar way to do it using bezier curves, except applied to quaternions instead of 3d vectors.  I found a bunch of research papers on the subject, but as is so often the case with research papers, actually implementing them is another story entirely (and frustratingly, source code is never provided).  So if anyone with experience in this stuff could give me some direction as to the best approach here I'd really appreciate it

sentences: Memory managing fully removing an item from a dictionary of GameObjects - Unity When you have a dictionary that looks like Dictionary<string,GameObject> dictionaryOfGameObjects, for removing an item from the dictionary, do you have to Destroy(gameObject) and dictionaryOfGameObject.Remove(stringid) as well?

sentences:
Xna 4 Model Rotation with inertia not working as expected with variable updates I am trying to rotate a model with inertia damping with the keyboard.
The code works great with a fixed time step but it doesn't behave the same with a variable update frequency.

Update method:

protected override void Update(GameTime gameTime)
{
    base.Update(gameTime);

    float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
    const float rotationPerSecond = 0.25f;
    const float decayPerSecond = 0.5f;

    KeyboardState kb = Keyboard.GetState();

    if (kb.IsKeyDown(Keys.Left))
    {
        m_velocity += rotationPerSecond * elapsed;
    }
    else if (kb.IsKeyDown(Keys.Right))
    {
        m_velocity -= rotationPerSecond * elapsed;
    }
    else
    {
        if (Math.Abs(m_velocity) < 0.01f)
        {
            m_velocity = 0;
        }
        else if (m_velocity > 0)
        {
            m_velocity -= decayPerSecond * elapsed;
        }
        else if (m_velocity < 0)
        {
            m_velocity += decayPerSecond * elapsed;
        }
    }

    m_rotationAngle += m_velocity;
}

Draw method:

Matrix rot = Matrix.CreateWorld(new Vector3(0, 0, 0), Vector3.Forward, Vector3.Up) *
                         Matrix.CreateRotationY(MathHelper.ToRadians(m_rotationAngle));

I am changing the time step with

IsFixedTimeStep = true;
graphics.SynchronizeWithVerticalRetrace = true;

and

IsFixedTimeStep = false;
graphics.SynchronizeWithVerticalRetrace = false;

Rotation speed and damping is completely different with different update frequencies.
Any ideas what i am doing wrong?
i have timed the code with a stopwatch, and it does work ok if you fake the keyboard input to be always on (remove the keyboard if()) and just do:

m_velocity += rotationPerSecond * elapsed;

Full Solution can be found here testproject

sentences:
Shortest rotation value I have a top down game. The player moves the avatar with WASD where W rotates the avator to 180, S rotates to 0, A rotates to 90 and D rotates to 270. I also do diagonal movement so if they hold SA it rotates to 45, WA it rotates to 135, WD it rotates to 225, and SD it rotates to 315.

I smoothly rotate from the current rotation to the hardcoded desired rotation based on those key combo's. Of course what happens is if I'm rotating from anything > 180 to 0 it goes the long way back to 0. So if I'm at 270 rotation and I press S key it sends it back to 0 but that goes from 270 to 0 vs going from 270 to 360 which would result in the same end result but how it got there would be shorter.

I was looking at this (https://answers.unity.com/questions/556480/rotate-the-shortest-way.html) and trying to translate it but it's not working. Below is my translation.

function Script:CalcShortestRot(current, target)
    --if current == target then return from end

    local dist = target - current + 180
    dist = dist - math.floor(dist / 2 / 180) * 2 * 180 - 180

    System:Print("Dist = "..dist)

    if dist < 0 then
        System:Print("Value 1 = "..target - current)
        return current - dist
    else
        System:Print("Value 2 = "..current + target)
        return current + dist
    end
end

The usage is:

-- determine the model rotation based on direction we are going
    if move > 0 then
        if strafe > 0 then
            self.targetRot = self:CalcShortestRot(self.targetRot, 225)
            --self.targetRot = 225
        elseif strafe < 0 then
            --self.targetRot = 135
            self.targetRot = self:CalcShortestRot(self.targetRot, 135)
        else
            --self.targetRot = 180
            self.targetRot = self:CalcShortestRot(self.targetRot, 180)
        end
    elseif move < 0 then
        if strafe > 0 then
            --self.targetRot = 315
            self.targetRot = self:CalcShortestRot(self.targetRot, 315)
        elseif strafe < 0 then
            --self.targetRot = 45
            self.targetRot = self:CalcShortestRot(self.targetRot, 45)
        else
            --self.targetRot = 0
            self.targetRot = self:CalcShortestRot(self.targetRot, 0)
        end
    elseif strafe > 0 then
        --self.targetRot = 270
        self.targetRot = self:CalcShortestRot(self.targetRot, 270)
    elseif strafe < 0 then
        --self.targetRot = 90
        self.targetRot = self:CalcShortestRot(self.targetRot, 90)
    end

    self.rot = Math:Curve(self.targetRot, self.rot, self.damping)

EDIT: updated my CalcShortestRot() function per comments below but still not working. It spins all around

sentences:
Locomotion-system with irregular IK Im having some trouble with locomtions (Unity3D asset) IK feet placement. I wouldn't call it "very bad", but it definitely isn't as smooth as the Locomotion System Examples.

The strangest behavior (that is probably linked to the problem) are the rendered foot markers that "guess" where the characters next step will be. In the demo, they are smooth and stable. However, in my project, they keep flickering, as if Locomotion changed its "guess" every frame, and sometimes, the automatic defined step is too close to the previous step, or sometimes, too distant, creating a very irregular pattern.

The configuration is (apparently)Identical to the human example in the demo, so I guessing the problem is my model and/or animation. Problem is, I can't figure out was it is =S

Has anyone experienced the same problem? I uploaded a video of the bug to help interpreting the issue (excuse the HORRIBLE quality, I was in a hurry).

sentences:
Three.js camera turning leftside right In Three.js I am trying to implement an orbiting camera can be rotated around the x and the y axis. I am using these two functions:

    function rotateX(rot) {
        var x = camera.position.x,
            y = camera.position.y,
            z = camera.position.z;

        camera.position.x = x * Math.cos(rot) + z * Math.sin(rot);
        camera.position.z = z * Math.cos(rot) - x * Math.sin(rot);

        camera.lookAt(scene.position);
    }

    function rotateY(rot) {
        var x = camera.position.x,
            y = camera.position.y,
            z = camera.position.z;

        camera.position.z = z * Math.cos(rot) + y * Math.sin(rot);
        camera.position.y = y * Math.cos(rot) - z * Math.sin(rot);

        camera.lookAt(scene.position);
    }

Now the x rotation works fine but the y rotation does not. Once I go over the top of the model as in that the camera's z position becomes negative then suddenly the lookAt method rotates the camera by PI amount on the Z axis and suddenly the left side of the model is on the right and vice versa. Now I can fix this by checking for a negative Z and then just fixing the camera's rotation but this then causes a malfunction when using x ad y rotation at the same time, the x then suddenly gets this inverting behavior.

How should I go about fixing this?

sentences:
When I add in Java transformationMatrix I can't see images? When I add in Java transformationMatrix I can't see images moving but when I remove it I can see why and how to fix it? Any ideas how to fix it?

My Renderer class:

public class Renderer {

    private static final float FOV = 70;
    private static final float NEAR_PLANE = 0.1f;
    private static final float FAR_PLANE = 1000;

    private Matrix4f projectionMatrix;

    public Renderer(StaticShader shader){
        createProjectionMatrix();
        shader.start();
        shader.loadProjectionMatrix(projectionMatrix);
        shader.stop();
    }

    public void prepare(){
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        GL11.glClearColor(1, 0, 0, 1);
    }

    public void render(Entity entity,StaticShader shader){
        TexturedModel model = entity.getModel();
        RawModel rawModel = model.getRawModel();
        GL30.glBindVertexArray(rawModel.getVaoID());
        GL20.glEnableVertexAttribArray(0);
        GL20.glEnableVertexAttribArray(1);
        Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), entity.getRotX(), entity.getRotY(), entity.getRotZ(), entity.getScale());
        shader.loadTransformationMatrix(transformationMatrix);
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getID());
        GL11.glDrawElements(GL11.GL_TRIANGLES, rawModel.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
        GL20.glDisableVertexAttribArray(0);
        GL20.glDisableVertexAttribArray(1);
        GL30.glBindVertexArray(0);
    }

    private void createProjectionMatrix(){
        float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
        float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
        float x_scale = y_scale / aspectRatio;
        float frustum_length = FAR_PLANE - NEAR_PLANE;

        projectionMatrix = new Matrix4f();
        projectionMatrix.m00 = x_scale;
        projectionMatrix.m11 = y_scale;
        projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
        projectionMatrix.m23 = -1;
        projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
        projectionMatrix.m33 = 0;
    }
}

Edit added StaticShader class:

package shader;

import org.lwjgl.util.vector.Matrix4f;

public class StaticShader extends ShaderProgram{

private static final String VERTEX_FILE = "src/shader/vertexShader.txt";
private static final String FRAGMENT_FILE = "src/shader/fragmentShader.txt";

private int location_transformationMatrix;
private int location_projectionMatrix;

public StaticShader() {
    super(VERTEX_FILE, FRAGMENT_FILE);
}

@Override
protected void bindAttributes() {
    super.bindAttribute(0, "position");
    super.bindAttribute(1, "textureCoords");
}

@Override
protected void getAllUniformLocations() {
    location_transformationMatrix = super.getUniformLocation("transformationMatrix");
    location_projectionMatrix = super.getUniformLocation("projectionMatrix");
}

public void loadTransformationMatrix(Matrix4f matrix){
    super.loadMatrix(location_transformationMatrix, matrix);
}

public void loadProjectionMatrix(Matrix4f projection){
    super.loadMatrix(location_projectionMatrix, projection);
}
}

Edit vertexShader.txt

#version 400 core

in vec3 position;
in vec2 textureCoords;

out vec3 colour;
out vec2 pass_textureCoords;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;

void main(void){

gl_Position = projectionMatrix * transformationMatrix * vec4(position,1.0);
pass_textureCoords = textureCoords;
colour = vec3(position.x+0.5,0.0,position.y+0.5);

}

sentences:
Getting the point of intersection from this fast ray box intersection algorithm I have seen lots of such algorithms that return a Boolean value, but I also need to get back the intersection point and ray length.
I am looking into this example, but I'm not sure how I can extract the point of intersection from it.
I did a small experiment in JS https://jsfiddle.net/j7htk96n/ . I assumed tmin is the needed distance (or intersection point parts), but doesn't seem so.

function intersection(b, r) {
    var t1 = (b.min[0] - r.origin[0])*r.dir_inv[0];
    var t2 = (b.max[0] - r.origin[0])*r.dir_inv[0];

    var tmin = Math.min(t1, t2);
    var tmax = Math.max(t1, t2);

    console.log(tmin);

    for (var i = 1; i < 3; ++i) {
        t1 = (b.min[i] - r.origin[i])*r.dir_inv[i];
        t2 = (b.max[i] - r.origin[i])*r.dir_inv[i];

        tmin = Math.max(tmin, Math.min(t1, t2));
        tmax = Math.min(tmax, Math.max(t1, t2));
        console.log(tmin);
    }

    return tmax > Math.max(tmin, 0.0);
}

var box = {
 min: [0,0,0],
 max: [5,5,5]
};

var ray = {
 origin: [-2,-2,0],
 dir_inv: [0.66667,0.33333,0.66667]
};

console.log(intersection(box, ray));

sentences:
Run a few seconds of simulation just after loading a scene I'm looking for a way to execute 3 to 15 seconds of simulation once a scene is loaded.

The problem is: some objects can be left suspended in motion while the player exits the scene. their state is saved. And the player can come back later to see the simulation resume. I have solved this type of problems in the past by running the physics engine in parallel for multiple scenes, but I could not find a way to do this in Unity.

I understand Time.timeScale could be used here, but how should I proceed to hide/not display the scene while the simulation runs or run all the time ticks in one pass before display?

sentences:
(Why) Should I choose Unity 3 or Cocos2d (or something third) for my app? My colleague and me made an HTML 5 iPad game ( http://braille.gandzo.com/ ) and we would like to upgrade it, and our framweork is not enoguh, for what we want. Some of the things we would change are: graphics update, animations/"effects", multi-player, achievements and so on. The game would stay 2d. Now, as far as I understand, both Unity and Cocos would be good for this task, with Unity having the advantage of being multi-platform.

What I want to know is are there unknown qualites/"flaws" to these two programs which would influence my decision (maybe even by choosing something else). Examples that come to mind are "Unity is too complicated/has too much unneeded options/hoops because it's made with 3d in mind" or "Cocos is significantly more suited for 2d games".

sentences:
How to handle input in Monogame I've just switched over to MonoGame from XNA. Since MonoGame is supposed to have the same API (implying that any copied code should work as usual), I've run into a strange issue- input doesn't seem to be handled through MonoGame.

When I tried to fix any missing "using" directives in that class, it automatically added using Microsoft.Xna.Framework.Input which implies that there's no MonoGame equivalent.

Googling the issue had no success- all the tutorials I found for MonoGame said to use XNA's input.

Is there a MonoGame equivalent for handling input, or do I just need to use XNA for that?

sentences:
Direction vector in raycasting When I read about how to get the direction vector in raycasting, for example on this site: http://www.daimi.au.dk/~trier/?page_id=98

They first render the mesh with front face culling and then with back face culling. And then subtract the backface from the front to get at a direction vector for each pixel.

But is this not to much work to get the direction vector, is it not more simpler and faster to just take the vertex position(in world coordinates) and subtract the camera position in the fragment shader to get the direction vector? This should give the exact same answer but we skip the backface and frontface rendering.

sentences: Entity Component Systems with Model View Controller Can the Model View Controller design pattern be used with non-OOP coding style, specifically with Entity Component System?

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:
How can I facilitate communication between "attack" and "movement" components? I'm currently programming in Unreal, but this is more of a component oriented design question.

I'm trying to follow a component driven aproach, and I have currently achieved creating a movement component which gets connected to the character object, it can do the following (apart from the usual walk, jump behaviour)

WallSlide/WallClimb (like parkour) on Walls that the character cannot climb.
Ledge Grab when reaching the apex of a wall, the character will start grab the ledge and climb to the end so he can be on top of the ledge.
Hook Movement Implementation: you set a target point and the movement component will make the character travel to that point, triggering an event when it reaches the destination or it's interrupted by something in it's journey

The problem is that I'm right now trying to figure where and how to put the "attack" actions of the character. Say I make an Attack component, how do I deal with the weapon or attack wanting to move the character while the movement component is wanting to do the same thing (think of a shoryuken or a stinger)?

The thing that confuses me is that the movement is the domain of the movement component, and adding the movement logic of the combo breaks the decoupling of the modules, if I have to program the movement component thinking of the attack component.

I know this is an abstract question and i have asked it aroud everywhere, but I just cannot find some good material on how to approach this, every place I check, they use some "patch like" programing where they program directly to the character and don't worry decoupling the behavior.

sentences:
Keep game name after complete rebuild, engine migration and change from 2D to 3D? I have published an Alpha version of a game with XNA in 2D, but I am now learning Unreal with full intention of porting the game to 3D there. I expect that in 3 months time, or less with a little luck, I will have a comparable version of the game in 3D, but I am already really close to the point where I can release some early footage.

With this in mind, I am also beginning to think about the game's promotion, its IndieDB page has it listed as a 2D XNA game, but there's two considerations:

a) Should I change the engine, given that earlier images and uploads are still there and I haven't got a release to replace them with?

b) Should I keep the name, considering that, 1) it is associated with the 2D game, and 2) search results bring up Fallout content, and the abbreviation SW is already fully associated with Star Wars?

I am, in the meantime, going to try to contact IndieDB and see if I am even allowed to change the game's listing (in terms of game engine and type) and will edit the post when I have an answer.

sentences:
How to know when the cameras change? I'm working on a script that uses raycasting from the camera's perspective to see what the player is looking at.  Pretty standard stuff.  The only question is, how to reliably find the camera?

Everything I've seen says you don't want to use Camera.main in Update() because performance, so instead you should call it once in Start() and cache it in a field.  And that's great, as long as you can guarantee that the main camera will never change.  But what if it does?

What I'd like is to have some sort of OnCameraUpdated event I can subscribe to that will let me know when the main camera has changed, but I don't see anything like that on the Camera class.  Is there any good way to find this out without polling for it?

sentences:
JiglibX addition to existing project questions Got a very simple existing project, that basically contains a lot of cubes. Now I am wanting to add a physics system to it and JiglibX seemed like the simplest one with some tutorials out there.

My main problem is that the physics don't seem to be working how I imagined, I expected my tower of cubes to come crashing down, but they dont seem to do anything.

I think my problem is that my cubes do not inherit DrawableGameComponent, they are managed by a world object that will update and render them. So they are at no point put into the games component list. I am not sure if this means that JiglibX will not be able to interact with them as in all the tutorials there are no explicit calls to add the Body objects to the physics system, so I can only presume that they are using a static/singleton under the hood which automatically hooks in all things, or they use the game objects component list somehow.

I also noticed that in alot of the tutorials they use the following when setting up the physics system:

float timeStep = (float)gameTime.ElapsedGameTime.Ticks / TimeSpan.TicksPerSecond;
PhysicsSystem.CurrentPhysicsSystem.Integrate(timeStep);

Would it not be better to keep a local instance of the created PhysicsSystem object and just call myPhysicsSystem.Integrate(timeStep)?

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:
Checkerboard using Shadergraph In Unity Shadergraph, how can I create a checkerboard pattern that works independently of the size of the quad that it is applied to?
Here's what I got so far. Since I have set the Frequency to 10x6, this will work for a quad that has a scale of 20x12. However, if I increase the scale of the quad, the checkerboard will get stretched to fit. But instead, I would like it to "add more squares" to fit the new size.
Is there a way to get it to somehow use the size of the quad instead of manually specifying the frequency?

sentences:
Calculate corner rotation to fit between 2 waypoints I'm currently working on a system where I create a linear path by spawning waypoints, but i'm struggling to figure out how to compute the rotation needed to render the corner waypoints correctly.

if I rotate it towards (nextSegment.Coordinate - myCoordinate) it almost seems correct, most corners are behaving how I want.

but you can see the first 2 corners, and one near the end are incorrect.

if I rotate it towards (prevSegment.Coordinate - myCoordinate) it solves the rotation for the incorrect segments in the previous solution.

I know the coordinate of the next cell, and the previous cell and the cell i'm trying to rotate.

But then the other segments are incorrect. I cannot figure out the pattern on how to decide which segment to rotate towards. Any ideas?

sentences:
Why does flipping 1 texture region cause an identical texture region to also be flipped? (libGDX) Sorry for the bad title. I didn't know how else to explain it.

The following is a portion of my code:

public class AssetLoader {

    public static TextureAtlas spriteSheet;

    public static TextureRegion hill, hillTop, hillBottom, rabbitJumped, background1, background2, water, spikes, playButtonDown, playButtonUp, dust;

    public static void load() {
        spriteSheet = new TextureAtlas(Gdx.files.internal("data/SpriteSheet.txt"));

        background1 = spriteSheet.findRegion("background");
        background2 = spriteSheet.findRegion("background");

        TextureRegion[] runFrames = {spriteSheet.findRegion("Frame01"), spriteSheet.findRegion("Frame02"), spriteSheet.findRegion("Frame03"),
                spriteSheet.findRegion("Frame04"), spriteSheet.findRegion("Frame05"), spriteSheet.findRegion("Frame06"),
                spriteSheet.findRegion("Frame07"), spriteSheet.findRegion("Frame08"), spriteSheet.findRegion("Frame09"),  };

        runningAnimation = new Animation(.03f, runFrames);
        runningAnimation.setPlayMode(Animation.PlayMode.LOOP);

        background2.flip(true, false);

    }
}

For some reason, the texture Region background1 is also flipped. Any help would be appreciated.

Some irrelevant code was ommitted.

sentences:
Portal View/Projection Matrix near plane For RenderToTexture/Camera based portal rendering, the basics seems simple enough.

However, with a free camera, most of the time it is going to be looking at such portals at an angle:

Now a regular near clipping plane will not always work here, it will either intersect with the wall the portal is sitting on, or possibly with objects in front of the wall.

The desired near clipping plane would be aligned like the portal, producing a view volume more like this:

or this in 3D:

So here is my question:

How does one construct or "truncate" a view/projection matrix to achieve such an off-camera-normal (near) clipping plane?

sentences: Is there a testing framework for bounding volume classes? This may be a long shot, but is there a small framework out there anywhere for testing custom bounding classes and other collision objects? (for example between rays, spheres and AABB's)

sentences:
How to handle enemies outside camera view in 2d platform i am making a 2d platformer in unity like mario or adventure island, and i am placing enemies manually(not doing any spawning) in the world, and those enemies have animations and movement scripts with update function.
And now my question is, how can i handle the enemies outside camera view.
I just want that the enemies should update/animate/move only when they come inside the camera view, otherwise they should be fixed where they were manually placed in the world.
Maybe not only enemies but other things like coins, stars, etc(having different animations and scripts)
Should i need to use some collision trigger, like attaching trigger to camera and detecting each enemies entered inside it and enabling animations and scripts on them.
Please tell me if that is an efficient way or if not please tell me if there is any simple and efficient way to do this.
Please correct me if there's anything wrong. Thank you.

sentences: Unity3d: keep working on the project in the editor while building for Android in command line Is it possible to keep working on the project in the editor while it's being built for Android in command line?

sentences:
Prevent keyframe interpolation in imported model animation in Unity I made first person model in blender. It also has animations in it.

Most of animation works fine, but in some cases, Unity's keyframe interpolation makes wrong result.

Note that animation was made by 60 frames per second in Blender.

To explain my problem, you have to see my model:

As you can see there are two magazines. Each named Mag1 and Mag2 and Mag1 is the magazine that attached to the gun.

Mag2 is always located very bottom of the screen so that it is impossible to see, except reloading animation.

While reloading, first pull out the mag1 from the gun and put in the mag2 to the gun. And here is the trick, after mag2 is attached to a gun, hand put the mag1 somewhere, maybe magazine pouch.

Anyway as soon as mag1 disappeared from the screen, it switches mag1 and mag2 immediately at only single frame. So mag1 is now move back to the gun and mag2 is also reloated to bottom.

In Blender, it seems nothing wrong but in Unity is quite different. As soon as mag1 disappeared, it doesn't switched immediately and it moves smoothly animated so I can see that magazines were moved. I'm pretty sure that this happens maybe Unity interpolates keyframes.

I already turned off Animation Compression option and resample curves, but still won't worked.

This is the video that I made to explain my situation:
https://www.youtube.com/watch?v=7aew959ejL4&feature=youtu.be

Is there a way to "turn off" that interpolation? I want to disable it only that frame. Unity doesn't allow me to edit animation clip, so I just duplicate animation clip and change the option(I don't know what it called) to "Flat" and use that clip instead, but still have same problem. (Note that it wasn't easy because Unity doesn't show me the animation if I duplicate and modify it)

I struggled this issue almost a year and still figuring out how to fix it, and I think it's time to solve it. Any advice will very appreciate it.

sentences:
DirectX11 without window attached? I just wonder, if it's possible to initialize and use DX11 or DX9 for offscreen rendering only - meaning with no attached window.
My intention is to do some GPU benchmarking before opening actual window. In this benchmarking some test scene is rendered, but should not be visible. (Actually depending on the benchmark score different windows are opened)

sentences:
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:
Mobile Game Development: Supporting Multiple Screen Resolution for iOS Questions

When designing the graphics of the game (e.g. for iPhone): What is the resolution I should base it upon? Is it the smaller resolution (iPhone4 screen resolution) so that I could scale it bigger to bigger resolution devices later on or the bigger resolution (iPhone6+) so that I could scale it smaller for smaller resolution devices later on? Which solution would be the best to implement that will not distort the graphics?
I am creating a game now (endless runner type game) and I am using parallax backgrounds. What will be the best option in supporting multiple resolutions? Scale it so that it will look the same on every device but it might distort the image or reduces the viewing area of the game when scaled. Alternatively let the other parts of the background be seen on larger resolution devices making the graphics stay as it is but let users using larger resolution devices see objects that might not be seen on smaller devices. I am talking about the next part of the parallax background.

My question pertains to iPhone devices (iPhone 4/4s, iPhone 5, iPhone 5s, iPhone 5c, iPhone 6, iPhone 6 Plus) for now.

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:
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:
Is there a way to use the RGB channels of a texture as the alpha channel when applying multitexturing using OpenGL ES 1.1? I have been trying to get texture compression using ETC1 (specifically PKM files) working for some time now. I am trying to do this without having to upgrade to OpenGL ES 2 so I have been using multi-texturing.

I have the multi-texturing working now (finally) but the problem is that it is not behaving as one would expect and I think that I have figured out why. When creating the PKMs you end up with PKM with the color components only and one with the alpha component only. Problem is that the alpha PKM seems to be storing the alpha value in the RGB channels. Black seems to represent full transparency and white seems to represent full opaqueness.

My question is: Is there a way to combine and convert these RGB values into an alpha value when using multi-texturing? If not, then I don't see any options for using ETC1 and supporting alphas under OpenGL ES 1.1 (please correct me if I am wrong).

sentences: What things should an indie game developer never do? What are some of the biggest - and better yet: insidious and unexpected - mistakes that indie game developers make? Especially when making the transition from hobbyist to full-time indie?

sentences:
How do i find the circumsphere of a tetrahedron? I'm looking for the most minimized equation to find the center coordinates and the radius of a tetrahedron circumsphere given four 3D points.

What I found on the internet mainly deal with the circum sphere of a flat 3D triangle, or some rough mathematical definitions, or some very single case such as regular tetrahedrons. Anyway I managed to find the equation below but I missed something :

    ->  ->      ->
let d1, d2, and d3 three vectors of any face of the triangle :

    | d1x  d1y  d1z |   | x |   | d1^2 |
2 * | d2x  d2y  d2z | * | y | = | d2^2 |
    | d3x  d3y  d3z |   | z |   | d3^2 |

My knowledge in this field has its limits but I think I can handle matrices and vector operations. But is the right part of the equation the square of the norm of each vectors ? (which are into a vector). Is the equation valid ? Is it just the writer who lazely forgot to write |d1|^2 ? Or Is it a common way to define some mathematical property.

PS : It's for a Delaunay Triangulation implementation. The equation (number 9) is in the following link : https://www2.mps.mpg.de/homes/daly/CSDS/t4h/tetra.htm

sentences:
Efficient way of detecting a touched object in a game? Imagine a Sims-like 2D game for a touch based mobile phone where one can interact with virtually any object in the scene.

How can I efficiently detect which object is being touched by the player?

In my short experience, looping through all the visible objects in the scene and checking if they're touched has so far done the job, but when there may be many many moving objects in the screen that sounds kind of inefficient isn't it? Keeping the visible moving objects list can consume time in itself as one may have to loop through all of them each frame.

Other solutions I've thought are:

Spatial hashing. Divide the screen as a grid and place the visible objects in the corresponding bucket. Detection of the clicked object is fast but there's additional overhead for placing the objects in the correct bucket each frame.

Maintaining a quad-tree. Moving objects have to be rearranged all the time, the previous solution looks better.

What is usually done in this case?

sentences:
Convert box to matrix I have a box (non-rectangular cuboid?) and would like to convert it to a matrix such that when a point inside the box is multiplied by the matrix, a vector is returned that describes the relative position inside the box (very similar in regard to a camera's view and projection matrix)

The difference between this box and a camera frustum, is that the box vertices are defined by the points intersecting 4 rays from the center of two concentric spheres.

What's the formula for creating such a matrix?

sentences:
Get back or delete an existing OpenGL object, then change it and draw at new. How? With OpenGL i'm drawing for example a circle.

Can i take this drawn circle back out of the window and change something and then draw it back on the window?

Or can i /have to delete it and then draw it new with other properties?

Do someone have me a link etc how to do something like this?

edit
it is just about 2D objects

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:
How to move my cube left or right using touch Inputs (C#) in unity I am trying to create a 3d game in unity. I have a cube in unity and I want it to move left or right on swipe . It should move to a distance till where user swipe or take their finger off of a screen. I want it to move fast or the cube should move fast on swipe and cube should flow smooth. Like in the gif there is a circle and the user use their finger to move the circle till wherever the user swipe it and it should be instant and I want my cube to move like that at a distance till where user swipe their finger and it should be instant and fast.
 I don't know how to do it. Any help is appreciated!

sentences:
Unity - Extending native components I was wondering if it was possible to use the existing native components inside Unity to extend them, and create my own.

For instance, if I wanted to create a component called Hurtbox, could I maybe do something like this?

class Hurtbox : BoxCollider2D { ... }

That would allow me to use the existing logic of the component and enhance it for my purposes.

Currently I have a separated BoxCollider2D and a Hurtbox components. The latter uses the former, but I thought if I managed to combine them both in a single one, it would be more elegant.

Is it doable? How?

sentences:
XNA 4.0 - Why does using a RenderTarget2d cause transparency on models? I have been working through Riemers ShadowMap tutorial and everything was going well until the section on drawing to a separate rendertarget. I am using a different model and quads but I assumed the process would still work.

If I draw the scene directly to the back buffer I get:

When I draw it first to a RenderTarget2D and THEN to the screen, I get this weird transparent effect only on the model, the textured primitives below are still rendered fine:

The RenderTarget is defined:

PresentationParameters pp = device.PresentationParameters;
renderTarget = new RenderTarget2D(device, pp.BackBufferWidth,
           pp.BackBufferHeight, true, device.DisplayMode.Format, DepthFormat.Depth24);

And it is used in this way:

protected override void Draw(GameTime gameTime)
{
    device.SetRenderTarget(renderTarget);

    device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1.0f, 0);

    DrawScene("Simplest");

    device.SetRenderTarget(null);
    shadowMap = (Texture2D)renderTarget;

    device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
    using (SpriteBatch sb = new SpriteBatch(device))
    {
        sb.Begin();
        sb.Draw(shadowMap, new Vector2(0, 0), null, Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 1);
        sb.End();

    }
    base.Draw(gameTime);
}

What gives?

Edit 1:
I resolved the transparency effect by resetting:

device.DepthStencilState = DepthStencilState.Default;
device.BlendState = BlendState.Opaque;

But now the model has a purple tint on the side away from the light. Something to do with my Shader code I presume.

Edit 2:
Turns out the purple (blue) colour was a result of the window being cleared to .DarkSlateBlue and the RenderTarget having alpha transparency.
Fixed with:

sb.Begin(SpriteSortMode.Immediate, BlendState.Opaque);

sentences:
Initial setting of camera and ppu to match playing table My goal is to implement another board game as close as possible as I would play it on a table - to not much think about how to arrange elements. The used space on table is in the dimensions of around 1x2m and most of my assets are scans of game cards with a touch of Photoshop (for personal use only). My question is regarding the camera, pixel on import of asset and converting to units. There are no physics in the game involved and it is 2D. For now it will be tailored to my own mobile but I would like to know if one way is preferred if I wanted to later change resolution or is just better best practice. From my understanding it would result both in the same outcomes but there might be some hidden trouble or side effects.

Should I (convert for myself to get a feel for dimensions) take 1 unit as 10cm -> scene of 10x20 units would represent my table or rather have a 1x2 unit scene (since most take one unit as one meter)
Assuming my scanned card has something like 2000x1000 pixel (and is 10x5cm big on a real table), does it make more sense to have it imported as 2000/20000 under pixel per unit or downscale the image first before importing it with a lesser value? I don't really care currently about build/ asset size.

sentences:
Cocos2d v2.0 and OpenGL 2.0/1.0: where to start I started developing my very first game 3 months ago using Cocos2d 2.0 for iPhone. I am now in the stage where I'd like to add some cool effects to the bullets and some special weapons (see my waveforms question here). I got a good answer in the cocos2d-iphone forum (see this one).

Unfortunately I am a bit paralized now. I don't know if I will be overdoing by learning OpengGL 2.0 or if I should just stick ot the old 1.0. There is a good intro on various tutorial's written in Steffen Itterheims blog (see this post).

I would like to add to my game:

a blur effect to the bullets (here is a tutorial for OpenGL 1.0)
a waveform (see above)
some realistic water ripples (here is a nice sample code)

So now, given that I don't want to overdo things but at the same time I want to achieve those effects, from where should I start? Should I discard the OpenGL 1.0 tutorials? OR should I use only OpenGL 1.0 code?

How can I avoid confusion? I mean, it seems that the compiler recognizes both, but that there are some conflictual calls in some circumnstances, I am fairly sure this has some explanation, is there some reference to this somewhere?

sentences:
How to clip cut-off using different frustrum than that of original camera? How to cut plane by pyramid shape? SOURCE : http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Mitchell_LightShafts.pdf

This process is part of creating light draft effect. And I am suggested to do the described process in order to enhance performance and I really want to do it.

However I am clueless on how I can apply "frustrum perspective matrix" from other camera to my camera perspective to chop off that square plane into shapes that fit into the "frustrum perspective matrix".

I am guessing I need to do this on CPU side first? But that's as far as my wild guess goes

sentences:
UK Indie studio registration I'm from the UK and I've just about completed making an indie game and had some interest from several online retailers that sell games. This requires me filling in a basic contract.

I'm just one guy who works from home as a hobby, I go by a studio name for my game solely because that's the norm.

Do I need to register my 'company' name before I can go any further?

EDIT: I'm already registered as self employed from prior work in a different field

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:
Creating a Custom Map Editor using XNA and Windows Forms I'm looking to create my own level editor for a game I'm making, and I came across the following post:

Tutorial or Example of creating custom sprite tool/map editor for XNA?

In the example posted by Blau, I am unsure what needs to be replaced in this line, and with what:

XnaControlGame.CreateAndShow<MainDialog, VoxelEditorGame>( );

If anyone could help at all, that would be great!

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:
Add impulse and torque to a cube I would like to spawn a cube if I press space and apply a short impulse of force and torque to make the cube rotate. I have some calculations for the impulse but I think they are wrong since the cube only gets faster over time and not fast on the impulse.
The formular for the impulse is p = m · v. In my case I decided to give the cube a mass of 1.

At the moment I calculate the whole impulse thing this way in c++:

                f = 8.f / dt; //force = impulse / dt
                a = f / 1; //acceleration = force / mass
                v += dt * a; //velocity = velocity + a * dt
                p = m_pObject1->getPosition()[0];
                p += v * (float)event.dt; //position= position + v * dt
                m_pObject1->setPosition(glm::vec3(p,m_pObject1->getPosition()[1], m_pObject1->getPosition()[2]));

I am sure I am doing something wrong here also I am a little bit lost in implementing the torque here.
I hope my code and question is clear and I would be happy to see some suggestions. :)

Kind regards

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:
Are display lists faster than VBOs? I'm making a voxel rendering engine. My "chunks" are 32 * 32 * 256 blocks and I can render a 16 * 16 square of them (which corresponds to Minecraft's maximal render distance). I'm using VBOs holding XYZ float positions and UV float coordinates. I use one VBO per chunk.

VBOs are alloacted with:

GL44.glBufferStorage(GL15.GL_ARRAY_BUFFER,
            BufferUtils.createFloatBuffer(32 * 32 * 256 * 6 * 6 * 5),
            GL30.GL_MAP_WRITE_BIT | GL44.GL_MAP_PERSISTENT_BIT);

I map them once at creation:

GL30.glMapBufferRange(GL15.GL_ARRAY_BUFFER,
            0,
            32 * 32 * 256 * 6 * 6 * 5 * 4,
            GL30.GL_MAP_WRITE_BIT | GL30.GL_MAP_UNSYNCHRONIZED_BIT | GL44.GL_MAP_PERSISTENT_BIT, null);

Then I can write directly into the buffer and make changes visible to the GPU with:

GL42.glMemoryBarrier(GL44.GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT);

This works, except I get about 20 FPS, while Minecraft gets 300 without frustum culling. The CPU is clearly not the bottleneck, as I have 1M FPS when the window is minimized.

Am I doing something wrong or are VBOs slower than Minecraft's Display Lists? How can I speed this up?

System specs: i7 4770 & GTX 770 OC

sentences:
Map with media texture not packaging I have a simple map with a Big-sphere and a pawn inside it. I use media texture and media player to play 360 video on it. But when I try to package it for windows-64 it fails while it tries to cook the map.

Yes all the videos are copied to Content/Movies first and then imported to UEProject as asset later.

This is very crucial to our project. One of our developer have already started to build the solution in Unity just in case if packaging issue does not resolve with media player in unreal.

Please help!

sentences:
Unity: Change scene by drag How do I change the scene like you do on common android home screens?

I know i could detect if the player swipes to the right and then change the scene but this would not look as smooth as android home screens.

sentences:
When to destroy Google AdMob InterstitialAd object? There are a few answers on this question but they don't give a satisfactory answer.

I am using a singleton AdManager class that persists throughout the game. I am not sure if I should destroy the instance of InsterstitalAd each time after displaying an ad. This answer says that an InterstitalAd object can only be used once, however in my current implementation I use the same instance multiple times without any ill effect.

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

public class AdManager : MonoBehaviour
{
    public InterstitialAd interstitialAd;
    private string InterstitialAdId = "test-code";
    public static AdManager Instance = null;

    void Awake()
    {
        MobileAds.Initialize(initStatus => {});
        RequestInterstitialAd();
        SceneManager.sceneLoaded += OnSceneLoaded;

        // Singleton class
        if (Instance == null) {
            Instance = this;
        } else if (Instance != this) {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }

    void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
        DisplayInterstitialAd();
    }

    public void RequestInterstitialAd() {
        interstitialAd = new InterstitialAd(InterstitialAdId);
        interstitialAd.OnAdClosed += HandleOnInterstitialAdClosed;
        interstitialAd.LoadAd(new AdRequest.Builder().Build());
   }

    public void HandleOnInterstitialAdClosed(object sender, EventArgs args) {
        interstitialAd.LoadAd(new AdRequest.Builder().Build());
    }

    public void DisplayInterstitialAd() {
        if (interstitialAd.IsLoaded()) {
            interstitialAd.Show();
        }
    }

    public void DestroyInterstitialAd() {
        interstitialAd.Destroy();
    }
}

As I understand the InterstitalAd object refers to a UI element, while the actual content of the ad comes from AdRequest, so I can reload the ad content without affecting the InterstitalAd object. Do I need to call DestroyInterstitalAd() after each time after an ad is displayed? I want to prevent any memory leaks from happening during long plays.

sentences:
Unity - Hide GameObject that is behind UI I have the following example:

How can I prevent the part of the sprite that is highlighted in red and is behind the UI from being displayed on the camera, but having the background image still showing?

sentences:
Understanding Torque in Unity This is (hopefully) a simple question that should avoid me asking a more complex question. This is in Unity (2D) but hopefully this is a general physics principle I am not getting.

I am applying a torque to a 2D object. The object has a scale of 1, a RigidBody2D with a mass of 1 and no angular drag or undergoing gravity. It is a CircleCollider2D with a radius of 1. There is nothing else attached to the object.

In the following code I apply a torque of Pi for one second. In linear motion (and from my understanding of torque) I would expect the angular velocity, after one second, to be Pi (or 180deg/s). However, running this code and printing out the speed at t=1.0, the speed is 90deg/s.

void FixedUpdate()
{
    if (time < 1.0f)
    {
        rigidbody2D.AddTorque(Mathf.PI);
    }
}

This is consistent, applying a torque of 2Pi gives me a velocity of 1Pi after the time. Where is this factor of 2 coming from?

sentences:
Ambiguation between multitouch geistures tap and free drag in Windows Phone 8 Emulator (Monogame) I am making a 2d tile based tactic game. I want the map to be slided around (because it's bigger than the screen) with FreeDrag (It's perfectly done, the map can moved around, that's not the problem).

And then, I want to display the character's actions, everytime it's tapped.

The problem then appeared. Everytime I want to FreeDrag the map, the Tap trigger always fired first before the FreeDrag one. Is there any way to differ the map sliding than the character tapping? Below is my code.

while (TouchPanel.IsGestureAvailable)
{
    GestureSample gesture = TouchPanel.ReadGesture();
    switch (gesture.GestureType)
    {
        case GestureType.FreeDrag:
            {
                //a
            } break;
        case GestureType.Tap:
            {
                //b
            } break;
    }
}

Every time I first want to free drag (at the first touch), it always goes to "b" first (see commented line above), and then to "a" rather than immediately goes to "a".

I've tried flick, but it seems the movement produced by flick is too fast, so freedrag fits the most.

Is there any way or workaround to perform FreeDrag (or similar) without firing the Tap trigger?

Thanks in advance.

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:
How to get the GameObject's LayerMask? I am currently following Unity's 2D Roguelike tutorial.

In that tutorial, I have Player, Enemy, and Wall Prefabs, which all belong to a Layer called BlockingLayer.

The Player and Enemy Prefabs both have a script inheriting from a script called MovingObject.

While writing the MovingObject class, I was meant to write the following line of code:

public LayerMask blockingLayer;

Later on, after creating the Player and Enemy scripts and attaching them to their respective Prefabs, I was supposed to set the blockingLayer to BlockingLayer from within the editor.

I thought this was stupid, because the Prefabs already belonged to the correct Layer, otherwise they couldn't interact with one another, so I changed the variable to private and instead added the following line to the Start() method:

blockingLayer = gameObject.layer;

However, suddenly collisions no longer worked. The Player and Enemy could now walk through each other as well as through Walls. Using the Visual Studio debugger, I noticed the following:

Setting the blockingLayer via the editor yielded following value: 256.
gameObject.layer has a value of 8.

Obviously, the two layers are completely different, which explains why my modification didn't work. Still, I believe that setting the Layer twice — once on the GameObject, and once on the script — is dumb.

How do I get the correct Layer programmatically?

sentences:
How to get quality sprite sheet generation with rotations I'm working on a game that uses sprite sheets with rotation for animations.  While the effect is pretty good, the quality of the rotations is somewhat lacking.  I exported a flash animation to png sequence and then used a C# app to do matrix based rotations (System.Drawing.Drawing2D.Matrix).

Unfortunately, there are several places where the image gets clipped.

What would you suggest for a way to get high quality rotations from either flash or the exported PNGs?  A circle should fit within the same image boundaries.  I don't mind a new program that I must write or an existing program I must download/buy.

sentences:
Unity stats framerate vs Time.deltaTime Googling around, a way for calculating framerate and displaying it as text ingame is using 1/Time.deltaTime. However, comparing this against unity stats FPS shows 2 different FPS. Which of it is incorrect? If 1/Time.deltaTime is incorrect, how does one go about calculating FPS?

Below is a screenshot of the FPS difference, as seen in the profiler, fps is well below 100 FPS whereas calculated FPS stays around 60.

sentences:
SDL2 GUI (same window) I have a problem: I working on a simple game and want to use some GUI (think of simple input for player name, etc). I've googled a lot of GUIs that can be used with SDL, but:

Most of them are using OpenGL while I'm using SDL2 render system. Docs say I can't mix these two, so I need to render GUI in a separate window. I know I can make it borderless and always-on-top, but I still need to manage this as a separate window (e.g. if main window moves, I need to move the gui window, etc, basically, I need to implement the childing myself). That makes me sad.
Those few which are using SDL as render (without OpenGL) either abandoned / unfinished / can't be compiled / etc or I can't figure out how to mix them with my rendering.

What I want to achieve: to render GUI in some place on the screen (think of a sidebar) and game stuff on the rest of the screen. Like:

SDL_Window* w = ...;
SDL_Renderer * r = ...;

while(running)
{
    renderGui(r, 0, 0, 100, 100); // Minimap located at 0,0 of size 100
    renderGameScreen(r, 100, 100, 100, 100); // Rest of the game located at 100, 100
}

Is there a way to do that? How GUI supposed to be used in alongside the SDL? May be my design is broken.

Sorry, I'm completely novice and may mix the things. Thanks.

Update:

Thanks for your answers. Quick update: I've tried so far:

nanogui-sdl - it uses opengl context, I was not able to mix it with SDL 2d render: it either flickers (because opengl and sdl fight for the screen and over-drawing the contents) or just draws the either thing: ui or game screen. Moreover, it crashes on some controls (like color-picker) and significantly affects rendering time (it drops 2-3 times when I add nanogui rendering with a couple of basic widgets)
nuklear - the same thing as with nanogui
I was not able to compile ToT KiWi - there are some syntax error (like #elsif instead of #else if or #elif so I'm not ever sure it can be compiled at all).

I'm going to try: imgui, kiss and gwen (gwork).

In the end, I can switch my drawing to opengl (fortunately I need some basic primitives, like circles, rectangles, triangles, etc, nothing complex) if I can't find a UI to work with SDL 2d render.

Update 2:

Sorry for not selecting the answer - was very busy during the week. I marked answer as accepted. I also tried to upvote both answers, since they are both useful, but I don't have enough reputation to do that. Thanks.

For those who wondering is I solve the problem: yes, kind of. I've switched over to SFML. I really like SDL and know it's very stable and mature, but I really need basic graphics for my pet project, so I'm OK with SFML too. It makes working with OpenGL a bit easier, so I can adopt the GUI library.

sentences:
Best practice/way for client to speak with server I'm making a multiplayer game in HTML5 Canvas and Node using Express and Socket.io. It's a platformer style game and so far the players are able to see each other and move around on the screen. It works pretty well, but most of my game logic is client side which I believe might become a problem. The movement of other players at the moment isn't very smooth at all. So far, the only thing the server does is recieve the position and velocity of the players, and then broadcast it out to all the other players so they can see each other. I was wondering if there was a smarter way to go about this? Everything like collision detection, movement, key inputs etc is all used client side. Should this be server side instead? I could imagine that if I calculated things like collision detection and movement server sided, then there would be no way for the player to do things like edit their position via the browser console and change their size etc.

I hope it's not too complicated. I haven't written much code yet since I would like to make sure I do it the correct way from the start without having to change and rewrite a lot of code. Let me know if you'd like to see my code.

sentences: Alternative to entity system in a game engine? I have been developing a game engine. I was wondering what I should use for a component system. I've read up on entity component systems, but what other alternatives are there? The idea of searching through a "master list" of all entities in the entire game world seems inefficient and slow. I need the most efficient one possible (3D and 2D, if that matters). Using object oriented programming (C++)

sentences:
How to get the correct Input direction based on the camera angle to use in a rootmotion based third person controller I move my character based on the rootmotion of their animation using a blend tree that uses 2D Freeform Cartesian input (Vertical, Horizontal)
if Vertical = 1, the character moves forward based on the direction he is facing
if Horizontal = 1, the character turns right based on the direction he is facing
and the rest of the system follows, here is the current Blend Tree:

Currently, if i press forward, the character move forward no matter where the camera is facing:

But in this example, what i want is for the character to slightly make a turn left to face the camera direction and then start walking forward:

When working on a game that moves the character by code (without rootmotion), something like this would solve the issue:
_inputAxis = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);
_inputCam = Quaternion.Euler(0, _cam.transform.eulerAngles.y, 0) * _inputAxis;

And then use _inputCam to move the character, but for some reason this isn't working, and these two variables are always equal to each other, what am i doing wrong ? also if there is a "standard" solution for this problem (am sure it is) please link it (doesn't matter if its Unity or not as long as the code is readable)
Thanks!

sentences:
Can a block-chain with embedded shared content stop cheating? I want to make a game where users create their content and embed it in a block-chain. For example, they have a small x,y grid. In the grid they place objects... After the grid is made they share it via block-chain with others. The other players then experience this content and try to pass it unfairly. I feel like there is a way in the block chain to stop them via agreement or algorithm?
Is this possible?

sentences: Asking the user to place the joystick in the center while calibrating I would like to know why exactly calibration programs (usually?) ask the user to place the joystick in middle, that is: Why isn't moving the handle in a complete circle (usually?) enough to calibrate a joystick?

sentences:
Adding an angle variance to a 3d vector I am converting a particle emitter from 2d to 3d.

In the 2d system the original coder used a random angle variance and added it to the angle.  So it would be something like:

thisAngle = emitterAngle + angleVariance * RANDOM_MINUS_1_TO_1();

I want to do the same thing in 3d using an emission vector (vec3) and again an angleVariance.  My specific variance for this particle will still be angleVariance * RANDOM_MINUS_1_TO_1().  But how do I apply that angle a 3d vector so that the new vector could be any value X degrees off of center.  So if the original vector is straight up (0,1,0) the new vector could be off in the X or the Z and still normalized to 1.

Any hints?  I have all the matrix and vector functions at my disposal.

=====

Thanks to nathan I was able to write this code. Not sure if I've over complicated it somewhere. Once I test it I'll checkmark his answer:

    // first pick a random Z from [cos(angleVariance), 1]
    GLfloat varianceZ = [self randomFloatBetween:myCosf(angleVariance) andLargerFloat:1.0];
    // and a random angle for the azimuth
    GLfloat rndA = [self randomFloatBetween:0.0 andLargerFloat:360.0];

    // then calculate the X & Y to make this a vector off of the +Z axis with a max width of angleVariance
    GLfloat varianceX = sqrt(1 - varianceZ*varianceZ) * myCosf(rndA); // my functions input degrees not radians
    GLfloat varianceY = sqrt(1 - varianceZ*varianceZ) * mySinf(rndA);

Up to here the above code works.  It makes a variance angle off center but it is aligned to the +z axis.  The next part is supposed to rotate/transform the angle to my emissionVector angle so it's a variance off of that.  But so far this part isn't working.

    // next find an axis to rotate the point around to put it in line with the emmissionVector
    vec3 rotationAxis = normalizeVec3(crossProduct(vec3Make(0.0, 0.0, 1.0), emissionVector));
    GLfloat rotationAngle = acos(degreesToRadians(emissionVector.z));

    // make a quaternion out of the rotation axis and angle
    vec4 q = quaternionVector(rotationAxis, rotationAngle);
    // turn the quaternion into a matrix
    mat4 rotMat4;
    mat3 rotMat3;
    matrixQuaternion(q, rotMat4);
    getMat3FromMat4(rotMat4, rotMat3);
    // multiply the variance vector by the matrix to get a resulting vector with the variance added
    vector = matrixTransformVec3(rotMat3, vec3Make(varianceX, varianceY, varianceZ));

=====

The above code doesn't appear to be correct. I'm still working on the solution and will fix the above code when I get it working.

sentences:
Gamma Space and Linear Space with Shader I am using Unity and I can choose between two color space mode in the settings: Gamma or Linear Space.

I am trying to build a Custom Lighting Surface shader but I am facing some problems with those Color Space. Because the render is not the same depending of the Color Space.

If I render the lightDir, Normal or viewDir I can see that they are different depending of the Color Space I use.

I made some test and the result I have in Linear Space is great but how can I obtain the same result in Gamma Space ?
Are there some transformations ? On what component should I apply those transformations ?

Thank you very much !

sentences:
How to make an object move outside the map and appear on the other side with a tilemap? I have a tilemap where a character moves from tile to tile. I'm trying to make it possible for the character to move outside the screen and reappear on the other side, just like the tunnel in Pacman.

The movement works like following:

Look for which arrow key is being pressed.
Check if the tile where the user wants to go to is walkable. If not, go back to 1.
If walkable, set it as target and start moving towards the tile.
When arrived to the target, go back to 1.

The problem I have is that there're no tiles outside the screen. I've tried to set the target to the tile on the other side of the map if the target doesn't exist, but then the character would move across the whole screen.

I've tried a couple other solutions that either don't work or require lots of additional code in many different files.

Does anyone know a good solution or recommend another approach?

I'm programming in Python with Pygame but know other languages in general. Here's MVCE code for my class:

import pygame
import math

TILE_SIZE = (16, 16)

class Player(pygame.sprite.Sprite):

    def __init__(self, pos, size):
        super().__init__()
        self.rect = pygame.Rect(pos, size)  # Rectangle representing the character's pos.
        self.image = pygame.Surface(size)
        self.position = pos  # In order to have the position in float precision, (x, y).
        self.speed = 80  # Pixels per second
        self.tile_index = (pos[1] // TILE_SIZE[1], pos[0] // TILE_SIZE[0])  # (Row, column).
        self.moving = False
        self.target = self.rect

    def handle_events(self, level):
        key = pygame.key.get_pressed()
        if key[pygame.K_w] or key[pygame.K_UP]:
            self.set_target(level, y_offset=-1)
        elif key[pygame.K_s] or key[pygame.K_DOWN]:
            self.set_target(level, y_offset=1)
        elif key[pygame.K_a] or key[pygame.K_LEFT]:
            self.set_target(level, x_offset=-1)
        elif key[pygame.K_d] or key[pygame.K_RIGHT]:
            self.set_target(level, x_offset=1)

    def set_target(self, level, x_offset=0, y_offset=0):
        tile = level.get_tile(self.tile_index, x_offset, y_offset)
        if tile.is_walkable:
            self.target = tile.rect
            self.moving = True

    def move(self, dt):
        distance_x = self.target.x - self.rect.x
        distance_y = self.target.y - self.rect.y
        # Make sure the player move at 'speed * dt' or distance, depending on the smallest.
        x = math.copysign(min(abs(distance_x), self.speed * dt), distance_x)
        y = math.copysign(min(abs(distance_y), self.speed * dt), distance_y)
        self.position = (self.position[0] + x, self.position[1] + y)
        self.rect.topleft = self.position

    def stop_if_arrived(self):
        if self.rect.contains(self.target):
            self.moving = False
            self.tile_index = self.target.y // TILE_SIZE[1], self.target.x // TILE_SIZE[0]

    def update(self, level, dt, *ignore):
        if not self.moving:
            self.handle_events(level)
        else:
            self.move(dt)
            self.stop_if_arrived()

sentences:
Do I need a Point and a Vector object? Or just using a Vector object to represent a Point is ok? Structuring the components of an engine that I am developing along with a friend (learning purposes), I came to this doubt.

Initially we had a Point constructor, like the following:

var Point = function( x, y ) {
    this.x = x;
    this.y = y;
};

But them we started to add some Vector math to it, and them decided to rename it to Vector2d.

But now, some methods are a bit confusing (at least in my opinion), such as the following, which is used to make a line:

//before the renaming of Point to Vector2, the parameters were startingPoint and endingPoint
Geometry.Line = function( startingVector, endingVector ) {
    //...
};

I should make a specific constructor for the Point object, or there are no problems in defining a point as a vector?

I know a vector have magnitude and direction, but I see so many people using a vector to just represent the position of an object.

sentences:
Solution for GIT commits in Visual Studio while Unity is open? Specifications

-VS 2013 Pro (Linked with Unity)

-Unity 4.6.1

-Git Version Control (Linked with Visual Studio 2013)

Summary

After much research, I haven't found any solutions to this fix.
*While visual studio 2013 and Unity 4.6.1 is open, I am unable to commit in Visual Studio in Team Explorer. I am able to SYNC and commit when VS is closed.

ERROR: An error occurred. Detailed message: Could not open 'PROJECT/Temp/UnityLockfile': The process cannot access the file because it is being used by another process.

I understand that it is being used, but is there any work around to this? I need to write custom commit messages to close open ISSUES in git, but would be efficient if done while Unity is open.

This just slows me down in terms of product management/ workflow, so if anyone has any workarounds to commit while unity is open, it would be much appreciated.

Let me  know if you have any questions, I know there are some Unity/VS/Git masters out there

FIXED SOLUTION:
Only include ProjectSettings and Assets when committing->
http://forum.unity3d.com/threads/solution-for-git-commits-in-vs-while-unity-is-open.328380/

sentences:
MonoGame - Scale Texture2D from 16x16 to 64x64 I need to scale a Texture2D (let's say it's 16x16) to 64x64.

I tried scaling it in the SpriteBatch#Draw method, but it doesn't look like pixel art as soon as it's drawn, more like a lot of anti-aliasing happened.

I chose 64x64 because 16x16 is pretty small, and I thought I could just scale every pixel by 4 (1x1 pixel in 16x16 could be 4x4 pixels in 64x64), basically I don't want MonoGame to anti-alias when I draw the scaled Texture.

Thank you!

sentences:
Issue translating objects by one unit in the y direction I'm currently making space invaders (in OpenGL/SDL) and I'm running into an issue with the movement of the aliens. I have a 2-d vector of aliens (5 rows of 11) and I'm translating each in the x direction by a constant factor times elapsed time. If the right or leftmost alien in the vector hits either side of the screen, I decrement the y position of every alien. For some reason, when it collides the side of the screen, it infinitely translates downward in the y direction.

I thought that this would not happen since I wasn't multiplying the y position by elapsed time, but I think that its probably happening due to the fact that the update() method is being called once per frame. Here is the code for the update function (inside of the enemies class which holds the 2-d array):

void update(float elapsed) {
        //Update positions

        float minX = -5.2;
        float maxX = 5.2;

        bool hitRight = false;
        bool hitLeft = false;

        //if the enemies haven't hit the right side
        if (((enemyVect[0][rightmost]->x) + ((enemyVect[0][rightmost]->width) / 2.0) <= maxX)) {
            for (int i = 0; i < enemyVect.size(); i++) {
                for (int j = 0; j < enemyVect[i].size(); j++) {
                    enemyVect[i][j]->x += elapsed * 0.4 * xDirect;

                }
            }

        }
        //if they've hit the right side
        else if(((enemyVect[0][rightmost]->x) + ((enemyVect[0][rightmost]->width) / 2.0) >= maxX)){
            xDirect = -1;
            hitRight = true;
            for (int i = 0; i < enemyVect.size(); i++) {
                for (int j = 0; j < enemyVect[i].size(); j++) {
                    if(hitRight)enemyVect[i][j]->y -= 0.6; //move each row of enemyVect down to the next level
                }
            }
            hitRight = false;
        }
//if the enemies haven't hit the left side
        if (((enemyVect[0][leftmost]->x) -((enemyVect[0][leftmost]->width) / 2.0) >= minX)) {
            for (int i = 0; i < enemyVect.size(); i++) {
                for (int j = 0; j < enemyVect[i].size(); j++) {
                    enemyVect[i][j]->x += elapsed * 0.4 * xDirect;
                }
            }

        }
//if they've hit the left side
            else if (((enemyVect[0][leftmost]->x) - (enemyVect[0][leftmost]->width / 2.0) <= minX)) {
                xDirect = 1;
                for (int i = 0; i < enemyVect.size(); i++) {
                    for (int j = 0; j < enemyVect[i].size(); j++) {
                        enemyVect[i][j]->y -= 0.6; //move each row of enemyVect down to the next level
                    }
                }
            }
        }

    };

How should I go about making it so that the y position of each alien only gets decremented once right after the collision with either side of the screen?

sentences:
Do you know any 3D engines written in Objective-C for iOS? In the next few weeks I will start a game for iOS, most of the action will happen in 2D but a 2D engine is not enough for our idea, therefore I'm doing a small research on available 3D engines for iOS written in Objective-C (we already looked on some engines written in C++).

Do you know 3D engines written in Objective-C?

I found this one http://nineveh.gl/ but is not yet ready :(.

later edit (1).......
I did a research on the engines written in C++, they are nice and probably I will go with one of them, but if there is any good engine written in Objective-C, than I will go with it, because its a matter of taste and I like very much the obj-c language.

later edit (2).......
nice presentation/teaser about what I'm looking for http://www.slideshare.net/rsebbe/designing-an-objectivec-framework-about-3d

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:
What physics engine support force fields and bodies represented as points? I need a game engine that supports force fields in 2d or 3d, but suitable for 2d calculations, like bullet.

Each body I want to simulate is represented as a set of points. Each point has positive mass and can accept force. Force field is updated every tick.
Engine should accept force applied to every point and return point speed values and coordinates.
Each body made of particles should move as a whole thing in result, relative position of particles must persist, hence this is a rigid body.
If engine does not support setting body as a set of points it should allow setting density function, or some other means to let have non-uniform density.

Is there any that can do that, preferably cross-platform.

sentences: Texture2D ignored by GC I loaded my textures with FromStream method and I noticed a problem that those textures are being ignored by garbage collector. I even nulled them, called dispose on them and tried to force garbage collector - they're still in the memory. Any ideas why this might be happening?

sentences:
Make my Tower continously fire at enemy while inside collider? So I've made a Tower script in c# that spawns a projectile that then fires at the enemy gameobject. However, because I'm using the OnTriggerEnter() function it will only fire as many times as gameObjects enters the collider.

How do I make sure that the tower will keep firing untill there is no more enemies within its collider?

public class Tower : MonoBehaviour {

// Public variables
public GameObject ammoPrefab;
public float reloadTime = 1f;

// Private variables
private Transform projectileTarget;
private GameObject projectile;
private float nextFireTime;
private float nextAnimTime;

void Update() {
    if (projectileTarget) {
        Debug.Log("We have target");
        if(Time.time >= nextFireTime){
            Debug.Log("nextFireTime has passed");
            FireProjectile();
        }
    }

}

void OnTriggerEnter(Collider co) {
    // Was it a Monster? Then Shoot it
    if (co.gameObject.tag == "Enemy") {
        Debug.Log("Enemy tag detected");
        nextFireTime = (float)(Time.time+(reloadTime*0.5));
        projectileTarget = FindClosestEnemy().gameObject.transform;
    }
}
void OnTriggerExit(Collider co) {
}
void FireProjectile()  {
    Debug.Log ("Shoot");
    nextFireTime = Time.time + reloadTime;
    projectile = (GameObject)Instantiate (ammoPrefab, transform.position, ammoPrefab.transform.rotation);
    projectile.GetComponent<Projectile> ().target = projectileTarget;
}
GameObject FindClosestEnemy() {
    GameObject[] gos;
    gos = GameObject.FindGameObjectsWithTag("Enemy");
    GameObject closest = null;
    float distance = Mathf.Infinity;
    Vector3 position = transform.position;
    foreach (GameObject go in gos) {
        Vector3 diff = go.transform.position - position;
        float curDistance = diff.sqrMagnitude;
        if (curDistance < distance) {
            closest = go;
            distance = curDistance;
        }
    }
    return closest;
}

}

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 compensate for moving objects with client side prediction? I'm implementing a game server that supports Star Control-like melee. So you have ships flying and shooting, with super simple velocity/acceleration/dampening physics to drive movement.

I've read Valve, Gafferon and Gambetta and implemented Gambetta's algorithm for client prediction:

Client prediction works on the player ship by updating its position from the server as it comes and then reapplying the yet-unprocessed-by-the-server input to the player ship.

Unfortunately, it doesn't work well for my game. I believe it has to do with the fact that Gambetta's example doesn't take into account objects that are already moving, or commands that are updated on a step by step basis. (by "step" I mean frame). So in my game the player presses up to accelerate the (already moving) ship, which continues moving on the client, sends the command to the server and usually receives the world snapshot from the server on the next step. I get something more like:

The player command runs at client step 3, but on the server its only run at server step 5. By the time the world snapshot is received by the client at client step 6, the prediction is way off, especially in faster velocities.

The crux of the problem is that the client runs the command at step 5, but the server runs it at step 6. I thought about maybe sending the client step with the command, and have the server roll back and re-run the command with the client time step. That might lead to a slew of other problems though - like what happens to commands received since the rollback, or how cheating clients can exploit by changing the sent step.

Reading and watching videos like this one from Google mentions a different approach, where you gradually change player position to match that of of the snapshot over a few steps.

My questions:

Can you make Gambetta's algorithm work with constant step movement? Or is it conceptually incompatible with my game?
Is gradual interpolation over steps the correct way to go then? If so, how do you interpolate an already moving object from the client position to match that which was just received from the server?
Can these methods, gradual interpolation and Gambetta's algorithm work in tandem, or are they mutually exclusive?

sentences:
Rotation of a matrix with unequal rows and columns I have this simple matrix class which has a char** array for storing the data. The data array gets initialized like this:

data = new char*[cols];
  for (int x = 0; x < cols; x++)
    data[x] = new char[rows];

Is it possible to rotate this kind of matrix when its let's say 3x2?
So that the rotation will result in this (or counter clockwise works as well)

a b
c d    ->    e c a
e f          f d b

Got some kind of atable here which shows where certain elements move when the matrix is rotated, but cannot get it working in code (those numbers around a&b are the x and y indexes):

  0                               0
0 a              0 1            0 b
1 b     ->     0 b a     ->     1 a
   (0,0)->(1,0)     (0,0)->(0,0)
   (1,0)->(0,0)     (1,0)->(0,1)

I'm currently rotating with these methods (they rotate clockwise):

void Matrix::reverseCols() {
  for (int x = 0; x < cols; x++)
    for (int y = 0, i = cols - 1; y < i; y++, i--)
      std::swap(data[y][x], data[i][x]);
}

void Matrix::transpose() {
  for (int y = 0; y < rows; y++)
    for (int x = y; x < cols; x++)
      std::swap(data[y][x], data[x][y]);
}

Should I keep it like this or should I go with a one-dimensional array and calculate the index when accessing the data by a method? And should I initialize the data array by columns (like I'm doing right now) or rows?

Wouldn't really bother doing this, but while learning C++ I want to build an console window engine and test it with a Tetris clone.

Thanks!

sentences:
Why is the rectangle not moving? public class Main {

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        Character c = new Character();
        frame.add(c);

        frame.setSize(600, 600);
        frame.setTitle("Keyboard control");
        frame.setResizable(false);
        frame.setVisible(true);
    }
}

character class

public class Character extends JPanel implements KeyListener{

   int posx = 0, posy = 0;

   public void movementX(int i) {
        posx+=i;
    }
   public void movementY(int i) {
       posy+=i;
   }

       public void paint() {
           repaint();
       }

     public void paintComponent(Graphics g) {
        super.paintComponent(g);

        this.setBackground(new Color(0, 0, 0));

        g.setColor(new Color(0, 0, 255));
        g.fillRoundRect(posx, posy, 50, 50, 4, 4);

    }

    public void keyPressed(KeyEvent e) {
        movementX(10);
        paint();
    }

    @Override
    public void keyReleased(KeyEvent e) {

    }

    @Override
    public void keyTyped(KeyEvent e) {

    }
}

sentences:
No-duplicate collection without iterator allocation Problem

I need a collection with non-duplicate values minimising memory allocation during access operations. I am prepared to compromise with a slight decrease of performance to make up for the improved "garbage generation".

Solutions Considered (including discarded ones for reference)

Extend ArrayList to include a check on add(E e) for duplicates and do nothing if value exists. (this may include other methods too)
Use HashSet (discarded) - iteration of elements causes instantiation of a new Iterator which defeats the requirement of minimal memory allocation during access.
Convert HashSet to ArrayList (discarded) - creates more memory allocaiton than HashSet iteration.

Question

Is the extention of ArrayList to reject duplicate values a sensible way to achieve non-duplicate collection with minimal memory allocation? Are there alternative methods I should consider?

Notes

Most advised solutions to eliminate duplicates in ArrayList I have seen refer to using HashSet or other object instantiation which defeat my minimal memory allocation requirement. The only implementation I can think of is a basic "for iteration" of the ArrayList checking equality of the added value against each existing element.

Class NonDuplicateList extends ArrayList{
    @Override
    boolean add(E e){
        for(int i = 0; i < this.size(); i++){
            if(this.get(i).equals(e)
                return false;
        }
        return super.add(e);
    }
}

For completion this question is being posted on gamedev stackexchange as the game dev community is more sensitive to the subjects of memory allocation and garbage collection impact, so hopefully I won't get comments along the lines of iterator allocation memory allocation is insignificant :-)

sentences:
Giving the illusion of speed I'm making a racing game that feels a lot like xtreme g 64 or fzero.

Making the player feel like they are moving extremely fast is important for this game. Actually moving them fast enough to give them that feeling is out of the question. Collision detection and a few other aspects of the physics engine prohibit it.

My current solution is the following:

Map the speed to the field of view for the projection matrix so that the FOV is 30 at speed x and 100 at speed y with a linear increase for the FOV inbetween x and y. This will probably be some polynomial once I test it out some.
Trail render any light sources on the vehicle. I am just adding a trail rendered blurred object of the same color as any light source: tail lights, jet flames, etc.
slight camera shake when you are above 3y/2 speed
your max speed without a boost is y/2, when you have a boost the max speed is y and these effects all become pretty noticeable

My Question:
I can't do any post processing effects on the iphone. I'm limited to poor mans solutions like the one I did. Is there another approach that is more common or better? My solution seems like what they would have done back in the N64 days so I'm wondering if there's a better way. The problem with this solution is that it makes it seems cheap to stretch the FOV like I am. It's a cool effect, but still feels cheap when you play it.

Here's a link to a very limited version of my effect

The speed they are simulating is supposed to be 400kph, I'm simulating about 2000 meters per second, about 18 times their speed. so my effects are very exaggerated.

Note:
I'de give you a screenshot but setting up a test scene that doesn't display the art assets would be hard. Setting up one with the art assets would get me sued.
My object is on the ground so I'm avoiding effects that are used more for aircraft.
There is no wind or dust so that is a little more limiting in using those elements.

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:
Move camera around player while facing player My player has the following hierarchy:

Hero (GameObject)
      Model (child of "Hero", centered at 0-0-0)
      Camera (child of "Hero")

The camera should be allowed to

- change its position around the Model in a circle ("rotate around the
  center")
- rotate so that it always faces the Model
- move up and down
- move nearer and further from / to the Model

I know how to do that using Quaternions, but as I'm doing this in a coroutine and using Lerp, I found myself in situations where the camera would get right through the model as this was the shortest path between the destination and the target vector.

I would now like to use pure angles (Sin and Cos), preferrably without LookAt.
Can somebody share how I would position and rotate the camera according to the angle, perhaps even taking a camera height variable into account as the camera should also be able to move up and down, still facing the player?

That would be the bomb!

sentences:
How can I make a character walk on uneven walls in a 2D platformer? I want to have a playable character who can "walk" on an organic surface at any angle, including sideways and upside-down. By "organic" levels with slanted and curved features instead of straight lines at 90-degree angles.

I'm currently working in AS3 (moderate amateur experience) and using Nape (pretty much a newbie) for basic gravity-based physics, to which this walking mechanic will be an obvious exception.

Is there a procedural way to do this kind of walk mechanic, perhaps using Nape constraints? Or would it be best to create explicit walking "paths" following the contours of the level surfaces and use them to constrain the walking movement?

sentences:
Nintendo 3DS copy protection I bought an old second-hand Nintendo DS game from a used game shop and my 3DS wouldn't play it. I exchanged it and the shop said it was probably a forged cartridge.

I did a bit of research and apparently the 3DS has better forgery detection than the older models - so the fake cartridge probably worked in an old DS but not in my newer model.

Here's what I already understand about 3DS copy protection:

Modern cartridges have a cryptographic signature to prove they're genuine.
Older cartridges have no signature, but the 3DS has a whitelist of checksums for every legitimate old cartridge.
Cartridges that don't have a signature OR appear on the whitelist are blocked.

I can see how this would stop me releasing my own unlicensed game. But I don't understand why it blocks a copy of an existing, legitimate game.

My question is: why can't the game pirates make a perfect copy of an existing game, including the signature (or with a matching checksum), so the 3DS can't distinguish it from the real thing?

(Aside - I've got no interest in playing pirated games (I write software for a living myself), I'm just curious about the technology).

sentences: Aquire disassembly of shader code Is there a way to get the disassembly that your driver generates when compiling a shader? I noticed that you can get an accidental disassembly dump if you go over the maximum thread group size supported by the hardware in compute shaders, so naturally I figured there must be some way to do this for all shader types. Is there a reliable way to get the disassembly (perhaps specific to NVIDIA/AMD/Intel hardware), using tools or even just "hacks" like causing errors during compilation / linking?

sentences:
Struggling to implement A* pathfinding execution So I've implemented pathfinding to my game which works well with a tile based map. All tiles have an x & y integer coordinate for example the tile on the top left would be 0,0 the adjecent tiles would we 0,1; 1,0 and 1,1. My pathfinding returns a path based on these coordinates.

My game however is using float coordinates. So that an entity is basically able to stand on or between two tiles at the same time. For that  the tile coordinates are multiplied by 32 (the size of one tile). That means the first tile would be 32,32  and the adjecent tiles 64,32; 32,64; 64,64

My approach was to get a target X and Y from my pathfinding to calculate the next step and multiply it by 32. So if the entity is supposed to move to the top left for example the targetX and Y would be 1*32, 1*32.

After the targetX & targetY is set i'll increase or decrease the coordination of moving entity by its movementspeed, when it's reached its targetX & targetY i'll get the next step and to the same until no steps are left.

However I'm encountering various problems because it's not really possible to set an entity to a certain field because its possible to stand on two tiles at the same time and entities only have float coordinates. Especially when an entity is supposed to move around a narrow corner its getting stuck because of the offset between the pathfinding and the float coordinates of the entity.

I hope my problem became more or less clear, how could I deal with that or how is dealt with that problematic in general? I'm glad about any advices.

Edit: No diagonal movement is intended.

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: How to develop XBox 360 games? I understand that I can learn XNA as a hobbyist, but for top games like Fifa for example how are they witten?

sentences:
What is the best approach to informing individual GUI objects about the screen size? I have a problem with designing classes for my game which I create.

In my app, there is:

the class CGame, which contains all the information about game, itself.
For example, screen width, screen height, etc. In the main() function, I
create a pointer to the CGame instance.
the class CGUIObject, which includes fields specifying its position and
draw() method, which should be able to draw an object according to the
screen size.
the class CGUIManager, which is a singleton, and includes a list of
CGUIObjects. For each object, in a list, it calls the draw()
method.

Now the problem is, each CGUIObject needs to know the screen size, which is held by CGame. However, I find it inefficient to include pointer to CGame instance in every object.

For clarity's sake, I'll provide some simple code:

class CGame
{
   int screenWidth;
   int screenHeight;
};

class CGUIObject
{
   CPoint position;
   void draw();     // this one needs to know what is a screen's width and height
};

class CGUIManager   // it's a singleton
{
   vector<CGUIObject*> guiObjects;
   void drawObjects();
};

And the main.cpp:

CGame* g;

int main()
{
   g = new CGame();

   while(1)
   {
      CGUIManager::Instance().drawObjects();
   }

   return 0;
}

What would be the best approach to provide the screen size to each CGUIObject?

sentences: GLSL mesh discard command? Is there a GLSL command similar to the discard, but it discards the whole mesh and not just a fragment?

sentences:
What is the best way to implement the story functionality (dialogue and cutscene management, etc.) in an RPG? I would like to know what the best way to implement the story functionality of an RPG would be. I am writing the game in C++ using the SFML library for graphics, and I have implemented drawing tiles, level loading and player movement, but I am not sure on how exactly to go about implementing the story. How would I implement when to do cutscenes, what to do in cutscenes, changes in dialogue, and have dialogue options affect the game? I am planning to have the dialogue in JSON files in a format similar to this

"dialogue" :[
        {"type" : "dialogue", "character" : "player", "text" : "dialogue here", "result" : "next"},
        {"type" : "dialogue", "character" : "character", "text" : "more dialogue", "result" : "next"},
        {"type" : "option", "options" : [{"text" : "option 1", "result" : "goto 4"}, {"text" : "option2", "result" : "goto 5"}]},
        {"type" : "dialogue", "character" : "character", "text" : "from option 1", "result" : "next"},
        {"type" : "dialogue", "character" : "character", "text" : "from option 2", "result" : "next"}
]

Is this a good way to go about this?
Should I also consider embedding a scripting language like Lua for cutscenes and other high-level tasks?

sentences:
ARBShaderObjects.glDeleteObjectARB vs GL20.glDeleteShader to remove shader? I've created a shader object using ARBShaderObjects.glCreateShaderObjectARBand I'm wondering exactly how I'm suppose to remove said shader.

It seems both ARBShaderObjects.glDeleteObjectARB and GL20.glDeleteShader can do this.

I'm leaning towards ARBShaderObjects.glDeleteObjectARB since I created the shader using the ARBShaderObjects set of classes.

Do both of these work?

In this case is one prefered or different from the other?

Sorry for general LWJGL / OpenGL noobiness.

sentences:
Multiplayer VR art gallery using different headsets I'm creating a VR art gallery using Unity3D (like a VR Museum Views with more freedom) and would like to have an environment where 1 or more users can gather together, communicate and move around (similar concept to SecondLife except in this case would be first-person view (by default) with only one room/location and users would be in VR).

From a user perspctive, the initial screen would be a door and the user would have a mini-map and a menu, turned to him/herself, with specific actions.

Once inside of the gallery, the users would be able to see others, "walk" or "teleport" to different locations

and see the canvas

The overall environment is rather simple so I've decided to get feedback from potencial users. Turns out the majority doesn't want to be alone in such environment. So, I've considered adding multiplayer (one of the users could even be guiding the others, which is interesting).

Now, multiplayer makes more sense when we can more inclusive. That's where the problem starts. In this specific case, inclusive is being defined as the possibility of users to be able to be present in the environment using at least one of the following devices

Android Phone (Cardboard)
Oculus GO
Samsung Gear VR
Google Daydream
Oculus Rift
HTC Vive

I've done some research and couldn't find someone doing it or a way to do it (considering all of the requirements). If that's possible to do, how can i do it?

One thing I found was that if I didn't want the users to move around and just be watching the gallery like watching a webinar / presentation in different devices, I could use VR Sync (they basically synchronize video playback on multiple VR devices).

So, at the moment I can either have the environment with just one user at a time and develop the environment for all the different headsets or use VR Sync.

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:
Method for Modifying Numbers based on Attributes in a Game A game that I'm working on in Unity has a diverse set of spells. The player character and NPCs all use an attributes which modify these spells in different ways. Our design is very fluid and the functions that modify these spells are continuously changing. As of now I've been hard coding the modifying function into the spell class itself while leaving different variables open for designers to modify it. Example for amount of missiles fired:

BaseQty + Strength * MissilesPerStrength

Leaving the BaseQty and MissilesPerStrength attribute open in the inspector for designers.

As our game balancing is changing so much I feel as if only leaving certain variables open isn't enough, as I'll have to go back and change the formula itself if required. I've thought about allowing designers to script the function itself, and for the spell class to get the number for (Example) missiles fired by interpreting the script, but I'm not sure how to go about doing this and in my mind it feels a little bit needlessly complicated for the small team that we are. It's not too much of a hassle to go into the class and change the formula, it just feels wrong not to have it separate.

I'm looking for critique and suggestions on my ideas if possible. Thanks for reading.

sentences:
How to efficiently handle registration/anchor points for graphics? I am currently working on an iPhone project, but most of my work has been in Flash. Flash has a feature where you can place a bitmap into a MovieClip, set its registration point with the mouse and it's automatically adopted. It's one of the lovelier Flash features.

Now I'm doing iPhone stuff, using TexturePacker for importing the graphics, and I'm having to write code like this:

if(graphic == "spikes1") setAnchorPoint(ccp(1, 0));
if(graphic == "spikes2") setAnchorPoint(ccp(.5f, 0));
if(graphic == "spikes3") setAnchorPoint(ccp(.5f, 0));
if(graphic == "spikes4") setAnchorPoint(ccp(.5f, 0));

if(graphic == "bush-a") setAnchorPoint(ccp(.5f, .25f));
if(graphic == "bush-b") setAnchorPoint(ccp(.5f, .25f));

if(graphic == "tree1") setAnchorPoint(ccp((float)134/209, (float)34/202));
if(graphic == "tree2") setAnchorPoint(ccp((float)96/236, (float)31/184));

I can obviously use macros or functions to shorten this a little, but is there a more intelligent way to go about this?

How do professional platformer games (on consoles and PC) handle this?

sentences:
Fixing T-Junction artifacts in a BSP Editor I'm starting a little BSP engine, and have begun implementing Brush CSG.  Currently I represent my brushes as the enclosed volume of surface planes (like old idTech 3 maps), with a cache for each face that is generated on rendering the brush for the first time.

Now, I subtract a cube from another cube to cut a hole into it, yielding 5 brushes. Instantly, t-junctions! As you can see below, visible cracks appear:

This isn't particularly surprising, and obviously moving onto the BSP compilation process I will have to fix up all the t-junctions in the scene. However, I notice that in e.g. GtkRadiant, if I perform the same operation, these artifacts don't show up (or at least, I don't notice them), despite the fact the new brushes ARE separate and can even be moved apart and back together in the scene.

How do I remove this rendering issue at map design time?

sentences:
Determining whether to trigger random events Say I want to trigger some event with a certain likelihood throughout gameplay. For example, say I want there to be a 5% chance of engine failure in a spaceship simulator that runs for an indeterminate length of time.

When and how do I determine if that event will occur? If I determine it will occur, how do I determine when it will occur?

The problem I see is that if you calculate the chance of a failure every tick, then there's a 5% chance of failure per tick, which means over two ticks there's more than a 5% chance - something like 8% I believe. Once the game ticks 1,000 or 1,000,000 times, it's almost certain the engine will have failed (~100% chance) when there's only supposed to be "a 5% chance."

Say we somehow knew the game would last for ten minutes - then we could get a random number 1-100 and if it's 5 or less, say the engine will fail within those ten minutes. But then at minute 5, say the player upgrades his or her engine to a 2% failure rate. We could again roll the die and if we get 2 or less, the engine will fail within the next five minutes. But again, we've calculated the chances of failure twice, which means it's more likely to fail than if we calculated those chances only once.

When we look at in-game items, they never say "5% chance of failure per frame, per minute, per game, etc." What does "x% chance" really mean and how do we get a computer to tell us if and when the event will occur?

sentences:
Approximately circular range of motion on a square tile grid I've been working on a grid based tactics style game to learn the ropes of Unity. I have an issue with movement range for a player unit. Let's say the units move range is 3 spaces..
If I set up each grid tile with 4 neighbours (up down left right), I get this movement range:

If I give each tile diagonal neighbours too- 8 in total, I get this;

What I'm actually looking for is what you'd see in these type of games traditionally, like this;

Here is the code that finds the unit move range list, starting at tile (5, 5). It adds the initial tile/node and its neighbours to the movelist, then works outward looping through all their neighbours. It's based off a youtube tutorial.
public HashSet<Node> getUnitMovementOptions() {

    float[,] cost = new float[mapSizeX, mapSizeY];
    HashSet<Node> moveList = new HashSet<Node>();
    HashSet<Node> tempMoveList = new HashSet<Node>();
    HashSet<Node> finalMoveList = new HashSet<Node>();

    int moveSpeed = 3;
    Node unitStartNode = graph[5, 5];
    finalMoveList.Add(unitStartNode);

    /// Initial costs for the neighbouring nodes
    foreach (Node n in unitStartNode.neighbours) {
        cost[n.x, n.y] = costToEnterTile(n.x, n.y, unitStartNode.x, unitStartNode.y);
        if (moveSpeed - cost[n.x, n.y] >= 0) {
            moveList.Add(n);
            }
        }

    finalMoveList.UnionWith(moveList);

    while (moveList.Count != 0) {
        foreach (Node n in moveList) {
            foreach (Node neighbour in n.neighbours) {
                if (!finalMoveList.Contains(neighbour)) {
                    cost[neighbour.x, neighbour.y] = costToEnterTile(neighbour.x, neighbour.y, n.x, n.y) + cost[n.x, n.y];

                    if (moveSpeed - cost[neighbour.x, neighbour.y] >= 0) { tempMoveList.Add(neighbour); }
                    }
                }
            }

        moveList = tempMoveList;
        finalMoveList.UnionWith(moveList);
        tempMoveList = new HashSet<Node>();
        }

    Debug.Log("Total move spaces for this unit is: " + finalMoveList.Count);
    return finalMoveList;
    }

Here is the costToEnterTile function:
public float costToEnterTile(int targetX, int targetY, int sourceX, int sourceY) {

    Tile t = tileTypes[tiles[targetX, targetY]]; // get current tile type
    float cost = t.movementCost;

    // diagonal
    if (sourceX != targetX && sourceY != targetY) {
        cost += 0.3f;
    }

    return cost;
}

If I tamper with the cost value in here, I can get different results in the movement range overall shape, but it's a bit hit and miss depending on the movement range.
Can anyone offer insights in to what path I need to head down to solve this?

sentences:
How to use the SDL viewport properly? I'm very confused about the SDL2 viewport, I did some googling to find out how to implement it but people keep mentioning things like "world coordinates" which I don't have in my game.

Question : Do I even need world coordinates for the SDL2 viewport to work? If yes, how do I implement it?

I've currently got a problem where if my viewport goes too much to the right or down, the entire window will become green, kinda like if it stopped rendering all my sprites.

Here's a GIF to show you what I mean :

As you can see, whenever I go too much to the right or down the entire screen goes green.

I thought this maybe was beause of me not using world coordinates, but I have no idea I'm just guessing stuff at this point...

My current codes for moving the viewport, drawing it, and such looks like this :

Creating the viewport / camera :

Camera::Camera(Uint16 x, Uint16 y, Uint16 w, Uint16 h)
{

    // Sets up the viewport positions and sizes
    viewport.x = x;
    viewport.y = y;
    viewport.w = w;
    viewport.h = h;

    // Sets the viewport so that SDL uses it
    SDL_RenderSetViewport(Window::GetRenderer(), &viewport);

}

Drawing the viewport : (gets called every frame)

void Camera::DrawCameraViewport()
{
    SDL_RenderSetViewport(Window::GetRenderer(), &viewport);
}

I set the cameras position during runtime like this :

void Camera::SetCameraPosition(int _x, int _y)
{
    viewport.x = _x;
    viewport.y = _y;
}

And here's how I set the cameras position using the above function :

Note : Sorry, the line became giantic...

camera->SetCameraPosition(
    -SpriteManager::GetPlayerSprite()->GetPosition().x
    + Window::GetWindowMiddlePoint().x
    - SpriteManager::GetPlayerSprite()->GetMiddlePoint().x

    , -SpriteManager::GetPlayerSprite()->GetPosition().y
    + Window::GetWindowMiddlePoint().y
    - SpriteManager::GetPlayerSprite()->GetMiddlePoint().y);

Question : Am I implementing the viewport correctly?

sentences:
Reducing the level of detail of a mesh I am importing an extremely detailed mesh (provided by a client) and it consists of something like 16 million triangles. For rendering performance I've been using the ID3DXMesh interface's Optimize and OptimizeInPlace methods. I'm using GenerateAdjacency with an epsilon of around 0.0025, and there doesn't seem to be much optimizing going on. Even with an epsilon of around 50.0 there's no significant increase in performance.

Am I misunderstanding Optimize? Isn't it supposed to get rid of unused faces based on the adjacency buffer? If that isn't the case, what other methods/algorithms/libraries could I use that would reduce level of detail?

Here's my code:

this->m_pMesh->GenerateAdjacency( 0.0025f, l_ulpAdjacencyBuffer );
this->m_pMesh->OptimizeInplace( D3DXMESHOPT_COMPACT | D3DXMESHOPT_ATTRSORT |D3DXMESHOPT_VERTEXCACHE, l_ulpAdjacencyBuffer, 0, 0, 0);

sentences:
How to manipulate browser pixels on different mobile devices I'm creating a board game using HTML5, CSS3 and JavaScript. It's working fine on Desktop browsers properly. But when i load it on Windows phone it's not behaving properly. The resolutions and the game board are not matching. I'm targeting Windows and Android platform.

Game Board is 1050x650 px which is implemented using HTML and css3.
now what i want to know is most browsers don't support certain CSS3 features like rotations and key-frames animations so will it be better if i use photoshop to make the board for different resolutions or is it possible to do the same as i did using HTML5 and CSS3.

And in the above image, let's say distance between B and a red dot is 200px and i use JS to manipulate the movement of B from one point(red dot) to another point(red dot), now will the distance 200px be the same in all the devices? If not how to write a proper code to manipulate the movement in all mobile devices?

sentences:
How to dynamically create an UI text Object in Unity 5? I have been searching for something that should be simple, but Unity 5's documentation on that is fairly outdated. What I want to achieve is to be able to create UI Text totally from script, i.e. fully dynamically - in my real case application, I will do that in a loop of not pre defined number of iterations.

A search using Google will find quite many examples on how to do that, but all I saw either use methods that are already deprecated (are from before Unity version 5) or are simply wrong (no surprise here...). I already know that I should first add a Canvas to my project, then I should include using UnityEngine.UI in my C# code, and also that I could declare a UI Text like Text _guitext.

However, the code below does not work. I mean, it's not that it crashes, but rather that nothing is shown:

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

public class MyClass: MonoBehaviour {

Text _guitext;

// Use this for initialization
void Start () {
    _guitext.text = "testing";
}

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

Worse than that, it seems that while game is played, no new object appears in the object hierarchy list.

Could you please point me out in the right direction here? Thanks.

sentences: NLua - How to implement Roblox like function security? Roblox uses Normal Identities, basicly they assign a lua block/object to a certain number. They use 2 for Scripts and LocalScripts, which can only use non-secured functions, while the command bar can access everything that is LocalUserSecurity and RobloxPlaceSecurity. How can I implement this type of Lua Security into NLua?

sentences:
XNA - multiple VertexBuffers? I'm trying to learn how to use VertexBuffers in XNA 4.0. I can render wireframe shapes and I can render textured shapes. However, I'm having some trouble rendering them both at once.
 I'm initializing the buffers like this:

vertexBuffer1 = new VertexBuffer(graphics.GraphicsDevice, vertexDeclarationWireframe, numPointsWireframe, BufferUsage.None);
vertexBuffer1.SetData<VertexPositionColor>(pointList1);

vertexBuffer3 = new VertexBuffer(graphics.GraphicsDevice, vertexDeclarationTexture, numPointsTexture, BufferUsage.None);
vertexBuffer3.SetData<VertexPositionTexture>(pointList3);

The above code fails during Draw() because the vertex buffers are using two different types of vertexDeclarations, one for wireframe (VertexPositionColor) and one for textures (VertexPositionTexture). I tried moving the call to VertexBuffer.SetData() to just before the relevant geometry is drawn but that didn't work.

I've also tried setting my Effect object TextureEnabled = false when wireframe is being rendered and resetting it when the textured geometry is rendering, but that didn't work either. The effect seems to be expecting a TextureCoordinate regardless.

What's the proper way to do this?

sentences: Issue in using Set Integer (by ref) in Unreal Engine 4.16 blueprint I am trying to set the value of an integer by reference in a macro created in my blueprint script. The macro does a simple conditional check of an integer and increments it if it is less than a max value. I was using one of the maze generating tutorials and the function throws a failed to resolve term Value passed into Target error. I am not sure why it cannot deduce the type of Value. The original tutorial was made in UE 4.6, so could it be due to updates made in UE 4.16? I have attached a screenshot of my blueprint.

sentences:
WriteObject in XNA with existing ContentWriters I have quite a lot of custom content pipeline components, and I was just wondering if under the hood XNA knows about these things when doing its magic...

Here is my scenario.

I have animation objects which basically contain 2d animation frames and timings etc, which can be loaded as self contained objects or can be embedded within other object. Now I was expecting that my CustomObjectAWriter could contain an instance to AnimationObjectAWriter and internally just call through to that to write out each animation object, i.e:

<SomeCustomObjectA>
    <SomeCustomElementA>
        ...
    </SomeCustomElementA>
    <SomeCustomElementB>
        ...
        <AnimationObjectA>
            ...
        </AnimationObjectA>
    </SomeCustomElementB>
</SomeCustomObjectA>

However as AnimationObjectAWriter has its Write method protected I am unable to access it, however I was wondering if WriteObject will know of the AnimationObjectAWriter so if I did WriteObject<AnimationObjectA>(animationObjectAInstance) would this work?

sentences:
Map file format for Real-time strategy game I am planing to create a 2D RTS game on iPhone using cocos2d, besides the tile map, any other suggestion for storing the map details for the game?

Would be nice if a GUI editor is also provided.

sentences:
Combine n Gaussian Probability Sets in a limited float range I've got a fixed solution space defined by a minimum and maximum float which has no divisible slice.

You then have 0..N Gaussian distribution probability sets which I need to combine.

In the end I neeed

Method to define probability set with a numeric range (not sliceable) and 0..N Gaussian functions
A function which can generate a random number in the range as defined by the calculated probabilities.

Also I know it is possible that some combinations will generate a zero solution space.

Now I'm thinking the way to do it is take the normalised probability density functions and multiply them to get a new space then normalising the result. I just can't seem to break it down into algorithmic form.

Any ideas?

sentences:
Integration error in high velocity I've implemented a simple simulation of two planets (simple 2D disks really) in which the only force is gravity and there is also collision detection/response (collisions are completely elastic). I can launch one planet into orbit of the other just fine.

The collision detection code though does not work so well. I noticed that when one planet hits the other in a free fall it speeds backward and goes much higher than its original position. Some poking around convinced me that the simplistic Euler integration is causing the error.

Consider this case. One object has a mass of 1kg and the other has a mass equal to earth. Say the object is 10 meters above ground. Assume that our dt (delta t) is 1 second. The object goes to the height of 9 meters at the end of the first iteration, 7 at the end of the second, 4 at the end of the third and 0 at the end of the fourth iteration.

At this points it hits the ground and bounces back with the speed of 10 meters per second. The problem is with dt=1, on the first iteration it bounces back to a height of 10. It takes several more steps to make the object change its course.

So my question is, what integration method can I use which fixes this problem. Should I split dt to smaller pieces when velocity is high? Or should I use another method altogether? What method do you suggest?

EDIT: You can see the source code here at github:https://github.com/elektito/diskworld/

sentences:
What exactly are sprites and entities and what are the differences between the two? Well I was looking at a few game based tutorials, as well as articles. I found out about two terms:
Entities and Sprites. Now they seem related but different, what is each and how are they the same and/or different?
I have some basic ideas already:

An entity is an item/thing/object/person any object that can be interacted with in the world.

A sprite is like an entity, but usually for NPCs/players/monsters.

Or a sprite can be the name of a picture assigned to a specific entity.

Do I have the right idea or are sprites and entities something completely different?

sentences:
In Inform 6, what is LibSerial and how does it factor into action-based dispatching? By no small amount of pain, I have discovered that the following  Inform 6 source doesn't work as expected: instead of calling the right branch of Bar.after based on the current action, it always prints Called from Foo:

Global action;

[ R_Process a;
    action = a;
    indirect(#actions_table-->a);
];

Verb 'foo' * -> Foo;
Verb 'baz' * -> Baz;

Object Bar "bar"
  with after [;
    Foo: "Called from Foo";
    Baz: "Called from Baz";
    ];

[ BazSub;
    print "[Baz]^";
    Bar.after();
];

[ FooSub;
    print "[Foo]^";
    Bar.after();
];

[ Main;
  <foo>;
  <baz>;
];

Running it produces the following output:

[Foo]
Called from Foo
[Baz]
Called from Foo

However, if I prepend the following three lines to the Inform script above, then it works as expected:

Constant LibSerial "foo";
Global reason_code;
Property additive life;

Now the output becomes:

[Foo]
Called from Foo
[Baz]
Called from Baz

The three lines are all important:

Omitting the definition of the LibSerial constant (i.e. keeping the other two lines only) causes Called from Foo to be printed from both callbacks.
Omitting the declaration of the (as far as I can see, unused) variable reason_code gives the following compile-time error:

"<constructing output>", line -65535:
Error:  No such constant as "reason_code"

Omitting the declaration of the life property causes a similar compile-time error:

"<constructing output>", line -65535:
Error:  No such constant as "life"

So basically my question is, what is going on here? What is the effect of defining LibSerial and why does it need the life property and the reason_code global variable to be declared?

sentences:
error in post a screen shot of game scores with Android Intent in LIbgdx game I want to post a screen shot of my game on social apps. I have developed this game using Libgdx framework. I have created an interface in Core class.
Here is its Intent share specific code.

public interface ActionResolver {
   public void shareit();

   }

then on my Androidlauncher class I implement it

public class AndroidLauncher extends AndroidApplication implements
        ActionResolver{ .......

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

gameView = initializeForView(new MainGame(this),
                new AndroidApplicationConfiguration());// View
}

 @Override public void shareScreen() {

      String message = "Text I want to share."; Intent share = new
     Intent(Intent.ACTION_SEND); share.setType("text/plain");
      share.putExtra(Intent.EXTRA_TEXT, message);

      startActivity(Intent.createChooser(share,
      "Title of the dialog the system will open"));

      }

     public void createIntent(View v){

      { // View view =gameView.getRootView(); Bitmap icon =
      getBitmapFromView(v.getRootView()); Intent share = new
      Intent(Intent.ACTION_SEND); share.setType("image/jpeg");

      ContentValues values = new ContentValues();
      values.put(MediaStore.Images.Media.TITLE, "title");
      values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); Uri uri =
      getContentResolver().insert(
      MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

      OutputStream outstream;

      try { outstream = getContentResolver().openOutputStream(uri);
      icon.compress(Bitmap.CompressFormat.JPEG, 100, outstream);
      outstream.close(); } catch (Exception e) {
      System.err.println(e.toString()); }

      share.putExtra(Intent.EXTRA_STREAM, uri);
      startActivity(Intent.createChooser(share, "Share Image")); } }

public void createIntent(View v){

      Bitmap icon = getBitmapFromView(v.getRootView()); Intent share = new
      Intent(Intent.ACTION_SEND); share.setType("image/jpeg");

      ContentValues values = new ContentValues();
      values.put(MediaStore.Images.Media.TITLE, "title");
      values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); Uri uri =
      getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
      values);

}
public static Bitmap getBitmapFromView(View view) {

        Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(),
                view.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(returnedBitmap);
        Drawable bgDrawable = view.getBackground();
        if (bgDrawable != null)
            bgDrawable.draw(canvas);
        else
            canvas.drawColor(Color.WHITE);
        view.draw(canvas);
        return returnedBitmap;
    }

I also Initialize my Interface in MainGame class

public MainGame(ActionResolver actionResolver) {
        super();
        this.actionResolver = actionResolver;

One thing I am confuse Which view I should pass to start this intent? becuase its libgdx framework.
Secondly on Android side obviously Canvas, Bitmap all would be from Android.

with this whole code I am able to start my intent but when i share screen the screen is just a black screen. but That screen has an ad appears on its bottom that I am already using through admob.

I have searched it here a lot, found related thread of sharing a black screen instead of actual screen shot of game. but I dont Understand all that because some asking to use some different library. I dont wana use any external library nor facebook sdk for facebook. I just want simple android Intent to share Screen . Kindly help me out.

sentences:
How to calculate new direction after sprite collision The scenario as you can see in the picture. A ball will be hitting a surface and I want to fairly correctly get the new angle after the collision..

I expect to know the X,Y coordinates of the lines breaking points (The picture below would has 6 lines)

Secondly, if the ball would have a rotation - Is there a standard way of compensate for a "screewed" ball?

sentences:
How to batch coroutines (IEnumerators) in parallel We are working in a context where multithreading is not an option, so we're using coroutines to handle our loads. Often there are multiple things that need to be downloaded, leading to a pattern like this:

// set up multiple downloads
dataToDownload = 3;
StartCoroutine(ReadDataCoroutine1(OnDataRead));
StartCoroutine(ReadDataCoroutine2(OnDataRead));
StartCoroutine(ReadDataCoroutine3(OnDataRead));

// handle each of the loads completed
private void OnDataRead()
{
    // nasty and error prone way to check completion of all data
    dataToDownload--;
    if (dataToDownload > 0) return;

    DoStuffNowThatDataIsAllLoaded();
}

So I thought I would build a helper class to batch the downloads:

public BatchDownloader(
    IEnumerable<Func<IEnumerator>> downloadFuncs,
    Action<int, int> onDownloadComplete = null,
    Action<int> onAllDownloadsComplete = null)
{
    this.downloadFuncs = downloadFuncs;
    this.onDownloadComplete = onDownloadComplete;
    this.onAllDownloadsComplete = onAllDownloadsComplete;
    totalDownloads = downloadFuncs.Count();
}
public IEnumerator DownloadBatch()
{
    completedDownloads = 0;
    foreach (var downloadFuncs in downloadFuncs)
        yield return ProcessDownload(downloadFuncs);
    onAllDownloadsComplete?.Invoke(totalDownloads);
}
private IEnumerator ProcessDownload(Func<IEnumerator> downloadFunc)
{
    yield return downloadFunc();
    onDownloadComplete?.Invoke(totalDownloads, ++completedDownloads);
}

Used something like this:

public IEnumerator LoadAllTheThings()
{
    Func<IEnumerator>[] downloadFuncs = new Func<IEnumerator>[]
    {
        ReadDataCoroutine1,
        ReadDataCoroutine2,
        ReadDataCoroutine3
    };

    BatchDownloader batchDownloader = new BatchDownloader(downloadFuncs);

    yield return batchDownloader.DownloadBatch();

    DoStuffNowThatDataIsAllLoaded();
}

Now that is much cleaner, more flexible, and it all works a treat, except that no load starts until the previous finishes. This obviously has a huge effect on load time. So in an attempt to have the coroutines run simultaneously, I'm trying the following:

public IEnumerator DownloadBatch()
{
    completedDownloadsCount = 0;

    var activeDownloads = new List<IEnumerator>();
    foreach (var downloadFunc in downloadFuncs)
    {
        activeDownloads.Add(downloadFunc());
    }

    while (activeDownloads.Count > 0)
    {
        yield return null;
        for (int i = activeDownloads.Count - 1; i >= 0; --i)
        {
            var download = activeDownloads[i];
            if (!download.MoveNext())
            {
                onDownloadComplete?.Invoke(totalDownloadsCount, ++completedDownloadsCount);
                activeDownloads.RemoveAt(i);
            }
        }
    }

    onAllDownloadsComplete?.Invoke(totalDownloadsCount);
}

Now while this correctly kicks off the coroutines, and runs them "in parallel", any code after the last yield in a coroutine is not executed. So in a method like the following:

private IEnumerator ReadDataCoroutine1()
{
   yield return WaitForStuffToDownload();

   DoPostDownloadStuff();
}

DoPostDownloadStuff() is never called.

What am I misunderstanding here about stepping through these IEnumerators? Is there a way to do what I'm trying to, without introducing StartCoroutine into the batch downloader? (that is my solution for now, but idealy I'd like to not have to)

sentences:
CCParticleSystemQuad works as intended every second time I'm using CCParticleSystemQuad for particles, loading it from plist:

flourEmitter = [CCParticleSystemQuad particleWithFile:@"FlourParticles.plist"];

But it works not every time. Every second or third time I start a game, particles look different from what I've set them up and there are errors saying it couldn't load image.

cocos2d: CCTexture2D. Can't create Texture. cgImage is nil
cocos2d: Couldn't create texture for file: in CCTextureCache

Of course the image is there and the next time i launch game it works as intended.

I cannot think of any ways how to debug this error.

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:
Using single Triggers on multiple controllers in Unity After trying out a lot of stuff I finally need to surrender. Im having a project where I want to use the triggers of the Xbox Controllers seperately. To do so I added them as axis 9 and 10 in the input manager (see image). Now, when i have multiple controllers connected on project startup the triggers wont get recognized. I have to press the trigger on two controllers to get a value from it...prettty strange. If i reconnect the controllers after project launch everything works fine...

Test script looks like this.

Thanks!

sentences:
Why do mesh classes still contain vertex arrays if VBO's exist? I find I'm a bit confused about the practical use of resource management in combination with memory not tied to the CPU. Correct resource management is often recommended in game tutorials, books and on websites to ensure the same heavy data is not loaded in memory more than once, but cached and passed out whenever needed. This seems to be a valid idea and I've built a couple of resource management classes more than once.

Resource caches work perfectly for, say, level data or audio files, but my understanding always comes crashing down as soon as we're talking about memory residing on the GPU (vbo's, textures). It would seem to me that a mesh resource class should have to store nothing more than a vbo index, yet every mesh class I look at (e.g. Ogre3D) manually stores vertex lists in mesh classes. I can't seem to grasp why that is done. What's the use of vbo's if you're storing the mesh data in your usual memory anyway?

This question is not about how vbo's work (I understand them conceptually), but more about how they're practically applied in game development.

Could someone please elaborate?

sentences:
Higher Performance With Spritesheets Than With Rotating Using C# and XNA 4.0? I would like to know what the performance difference is between

using multiple sprites in one file (sprite sheets) to draw a game-character being able to face in 4 directions and
using one sprite per file but rotating that character to my needs.

I am aware that the sprite sheet method restricts the character to only be able to look into predefined directions, whereas the rotation method would give the character the freedom of "looking everywhere".

Here's an example of what I am doing:

Single Sprite Method

Assuming I have a 64x64 texture that points north.

So I do the following if I wanted it to point east:

spriteBatch.Draw(
    _sampleTexture,
    new Rectangle(200, 100, 64, 64),
    null,
    Color.White,
    (float)(Math.PI / 2),
    Vector2.Zero,
    SpriteEffects.None,
    0);

Multiple Sprite Method

Now I got a sprite sheet (128x128) where the top-left 64x64 section contains a sprite pointing north, top-right 64x64 section points east, and so forth.

And to make it point east, i do the following:

spriteBatch.Draw(
    _sampleSpritesheet,
    new Rectangle(400, 100, 64, 64),
    new Rectangle(64, 0, 64, 64),
    Color.White);

So which of these methods is using less CPU-time and what are the pro's and con's?

Is .NET/XNA optimizing this in any way (e.g. it notices that the same call was done last frame and then just uses an already rendered/rotated image thats still in memory)?

sentences:
How would I go about programming atmosphere for a game? I've recently started making a 2D game, and I want to implement an atmosphere.

My plan is to include many in-game compartments, such as tubes and ventilation. If I open an airlock from a room with zero pressure to a room with high pressure, I should feel a heavy knock back. If I mix gases in a room, and players both human and alike would not be able to breath, they would die.

I have idea of how to do it, but it won't be that sufficient and real. I don't need an real atmosphere; it just needs to feel real.

This is the small list of what I want to implement:

Gas pressure that effects the environment, such as moving objects and causing damage to objects.
Simple gas mixing, where I would like to implement 4-5 different gasses.
Some sort of in-game device to affect atmosphere and check its state.

How would I go about programming atmosphere for a game?

sentences:
How to find a material through a raycast in Unity 5? I have an empty object with a script on it and I want to be able to move the empty over other objects and then have it print out the name of the material for the triangle that it's hovering above. (Its for something else, but I only need help getting to that stage, I can do the rest from that point). I found this on the topic but the answer is very vauge. I finished steps 1 and 2 but I can't figure out number 3. Here is my code so far...

void Update (){
        Ray ray = new Ray(transform.position, new Vector3(0, -100, 0));
        RaycastHit hit;

        if(Physics.Raycast(ray, out hit)){
            print ("Triangle Index: " + hit.triangleIndex);

            Mesh mesh = hit.collider.gameObject.GetComponent<MeshFilter>().mesh;

            print ("Submesh Count: " + mesh.subMeshCount);
        }
    }

Could someone show me how to finish it off so that when I move the empty over different objects, it would print out the name of the material per triangle?

Thanks, Matthew

sentences:
What are these odd distortions on far away textures? I'm currently writing a simple voxel engine just to get some practice in, and I'm coming across some odd issues. In order to generate terrain, I create a mesh and then assign UV coordinates on a texture atlas to each vertex. Whenever I run the game, I get strange distortions, like these:

I've tried doing a few things so far:

Generating mip maps for the texture atlas.
Play around with the max size of the texture atlas.
Play around with the format of the texture atlas.

Unfortunately, none of these have worked so far. As of right now, the import settings on the texture atlas itself look like this:

Is there any way I can get rid of these obnoxious distortions?

sentences:
Solution for lightweight LAN peer discovering? I built a library for purely cross-platform programming. My games made with it run fine in Android , Pc, Linux, Mac etc.

The networking capabilities are provided by ENET library, therefore all communication between my apps is not TCP or UDP compatible, but only in the custom protocol, even tough its based on the UDP ultimately.

I don't think its possible to do what i want with ENET, thats why I ask here for help!

Lets say I have the same game running in my Android phone, my laptop and my pc. They are all in the same wifi network, and therefore in a LAN, whether its Wifi hotspot(?) or the household router.

I need each of those 3 peers to discover the other two in the network. This is meant only to find the IP of alive apps in the LAN network, to be able to host multiplayer games between them.

I can only think of one effective way to do this, UDP broadcast, wait responses, but if that is the solution, i need something small, since its the only purpose of the implementation.

Other way could be to try to connect to all IPs in the LAN address subrange, but I don't think the OS would be with me on this one :p

sentences:
How should I manage meshes for the streets of a 3D city map in Unity? I was recreating a small city in Unity3D and was going to place streets and pathways according to a sketch. I'm building for Android and the city is quite small; I'm planning to have the entire road mesh(es) loaded during play, without a load/unload algorithm. I made a few road meshes in Sketchup and imported them into Unity, but was unsure on how to manage them. I thought of two strategies but was unable to identify the pros and cons of either:

Place all the separate road meshes in Unity and position them, recreating the sketch and make them children of an empty GameObject to order them in the Editor window.
Create the entire city roadmap in Sketchup, making it a single and complete mesh. Then, import it into Unity and that's it.

The city is quite small and I'm planning to have the entire road mesh(es) loaded during play, without a load/unload algorithm. I'm building for Android.

Which strategy should I prefer in this situation? Or are both basically the same?

sentences:
Techniques for lighting a texture (no shadows) I'm trying to learn about dynamic shadows for 2D graphics. While I understand the basic ideas behind determining what areas should be lit and which should be in shadow, I don't know how I would "lighten" a texture in the first place.

Could you go over various popular techniques for lighting a texture and what (dis)advantages each one has? Also, how is lighting a texture with colored light different from using white light?

sentences:
How can I optimise my game and its game objects? I have a 3D game in Unity and I use blender to design models for it. My game has a feature where if you click a button, an object is cloned. An example from my game is a tree that is cloned around 100 times with different sizes and positions to form a forest.

The issue is that after a few presses of the button, the game starts to really lag. Is there a way to optimise the game in Unity or optimise the models in Blender to reduce this lag? I use the instantiate function in Unity to do my cloning.

Some useful information for a generic gameobject (all of them are similar in complexity):

faces: 12,226
triangles: 26,116
memory: 13.24 mb
gameobjects in scene not static
CPU usage mostly spent on rendering

Here is a screenshot showing my game running, where the blue part on the graph in the middle is when I click the button:

Here is a detailed look into the spikes you can see:

sentences:
Some questions about lists I've been looking for articles or tutorials on this and I can't seem to find any, so I thought I'd ask here. I've created a bullet class in my game that is added and removed through a list. If I'm going to make these bullets work the way I want them to I need to be able to do two things:

One, I need to check if the bullets are colliding with each other and then remove the two bullets that are colliding. I've tried doing it by updating the bullet list with a for statement and then checking for collision with another for statement, but that occasionally crashes the game.

Two, I need to be able to check how far away every other bullet in the list is from the current one.

So how can I go about doing this?

sentences:
Problem using glm::lookat I am trying to rotate a sprite so it is always facing a 3D camera.

Object

GLfloat vertexData[] = {
    //  X     Y     Z       U     V
    0.0f, 0.8f, 0.0f,   0.5f, 1.0f,
    -0.8f,-0.8f, 0.0f,   0.0f, 0.0f,
     0.8f,-0.8f, 0.0f,   1.0f, 0.0f,
};

Per frame transform

glm::mat4 newTransform = glm::lookAt(glm::vec3(0), gCamera.position(), gCamera.up());
shaders->setUniform("camera", gCamera.matrix());
shaders->setUniform("model", newTransform);

In the vertex shader:

gl_Position = camera * model * vec4(vert, 1);

The object will track the camera if I move the camera up or down, but if I move the camera left/right (spin the camera around the object's y axis), it will rotate in the other direction so I end up seeing its front twice and its back twice as I rotate around it 360.

If I use -gCamera.up() instead, it would track the camera side to side, but spin the opposite direction when I move the camera up/down.

What am I doing wrong?

sentences:
rotate sprite and shooting bullets from the end of a cannon Possible Duplicate:
  How to Align Gun with Bullets

Hi all i have a problem in my Andengine code,

I need , when I touch the screen, shoot a bullet from the cannon (in the same direction of the cannon)
The cannon rotates perfectly but when I touch the screen the bullet is not created at the end of the turret

This is my code:

private void shootProjectile(final float pX, final float pY){
    int offX = (int) (pX-canon.getSceneCenterCoordinates()[0]);
    int offY = (int) (pY-canon.getSceneCenterCoordinates()[1]);
    if (offX <= 0)
            return ;
    if(offY>=0)
                    return;

    double X=canon.getX()+canon.getWidth()*0,5;
    double Y=canon.getY()+canon.getHeight()*0,5 ;
    final Sprite projectile;
    projectile = new Sprite( (float) X, (float) Y,
                    mProjectileTextureRegion,this.getVertexBufferObjectManager() );

    mMainScene.attachChild(projectile);

    int realX = (int) (mCamera.getWidth()+ projectile.getWidth()/2.0f);
    float ratio = (float) offY / (float) offX;
    int realY = (int) ((realX*ratio) + projectile.getY());

    int offRealX = (int) (realX- projectile.getX());
    int offRealY = (int) (realY- projectile.getY());
    float length = (float) Math.sqrt((offRealX*offRealX)+(offRealY*offRealY));
    float velocity = (float) 480.0f/1.0f;
    float realMoveDuration = length/velocity;

    MoveModifier modifier = new MoveModifier(realMoveDuration,projectile.getX(), realX, projectile.getY(), realY);
    projectile.registerEntityModifier(modifier);
}

@Override
public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {

    if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_MOVE){

        double  dx = pSceneTouchEvent.getX() -  canon.getSceneCenterCoordinates()[0];
        double  dy = pSceneTouchEvent.getY() -  canon.getSceneCenterCoordinates()[1];

        double  Radius = Math.atan2(dy,dx);
        double Angle = Radius * 180 / Math.PI;
        canon.setRotation((float)Angle);

        return  true;

    }
    else if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN){

        final float touchX = pSceneTouchEvent.getX();
        final float touchY = pSceneTouchEvent.getY();

        double  dx = pSceneTouchEvent.getX() -  canon.getSceneCenterCoordinates()[0];
        double  dy = pSceneTouchEvent.getY() -  canon.getSceneCenterCoordinates()[1];

        double  Radius = Math.atan2(dy,dx);
        double Angle = Radius * 180 / Math.PI;

        canon.setRotation((float)Angle);
        shootProjectile(touchX, touchY);
    }

    return false;
}

Anyone know how to calculate the coordinates (X,Y) of the end of the barrel to draw the bullet?

sentences:
two-part dice pool mechanic I'm working on a dice mechanic/resolution system based on the Ghost/Echo (hereafter shortened to G/E) tabletop RPG. Specifically, since G/E can be a little harsh dealing with consequences and failure, I was hoping to soften the system and add a little more player control, as well as offer the chance to evolve player characters into something unique, right from creation. So, here's the mechanic: Players roll 2 separate d12 against each of the two statistics for their character (each is a number from 2-11, and may be rolled above or below depending on the nature of the action attempted, rolling your stat exactly always fails). Depending on the success for that roll, they add dice to the pool rolled for a modified G/E style action.

The acting player gets two dice anyhow, and I am debating offering a bonus die for each success, or a single bonus die for succeeding on both of the statistic-compared rolls.

Once the size of the dice pool is set, the entire pool is rolled, and the players are allowed to assign the rolled dice to a goal and a danger, one to each. Assigned results are judged as follows:

1-4 means the attempted goal fails, or the danger comes true.

5-8 is a partial success at the goal, or partially avoiding the danger.

9-12 means the goal is achieved, or the danger avoided.

My concerns are twofold:

Firstly, is the two-stage action too complicated, with two rolls to judge separately before anything can happen?

Secondly, are the statistics involved going too far in softening the game? I've run some basic simulations, and the approximate statistics follow:

                 2 dice     (up to) 3 dice      (up to) 4 dice
failure          ~33%            ~25%               ~20%

partial          ~33%            ~35%               ~35%

success          ~33%            ~40%               ~45%

I'd appreciate any advice that addresses my concerns or offers to refine my simulation (right now the first roll is statistically modeled as sign(1d12-1d12), where >0 is a success).

sentences:
Checkers AI Algorithm I am making an AI for my checkers game and I'm trying to make it as hard as possible. Here is the current criteria for a move on the hardest difficulty:

1: Look For A Block: This is when a piece is being threatened and another piece can be moved in behind it to protect it. Here is an example:

Black Moves

|W| |W| |W| |W| |
| |W| |W| |W| |W|
|W| | | |W| |W| |
| | | |W| | | | |
| | | | |B| | | |
| |B| | | |B| |B|
|B| |B| |B| |B| |
| |B| |B| |B| |B|

White Blocks

|W| |W| |W| |W| |
| |W| | | |W| |W|
|W| |W| |W| |W| |
| | | |W| | | | |
| | | | |B| | | |
| |B| | | |B| |B|
|B| |B| |B| |B| |
| |B| |B| |B| |B|

2: Move pieces out of danger: if any piece is being threatened, and a piece cannot block for that piece, then it will attempt to move out of the way. If the piece cannot move out of the way without still being in danger, the computer ignores the piece.

3: If the computer player owns any kings, it will attempt to 'hunt down' enemy pieces on the board, if no moves can be made that won't in danger the king or any other pieces, the computer ignores this rule.

4: Any piece that is owned by the computer that is in column 1 or 6 will attempt to go to a side. When a piece is in column 0 or 7, it is in a very strategic position because it cannot get captured while it is in either of these columns

5: It makes an educated random move, the move will not indanger the piece that is moving or any piece that is on the board.

6: If none of the above are possible it makes a random move.

This question is not really specific to any language but if all examples could be in Java that would be great, considering this app is written in android. Does anyone see any room for improvement in this algorithm? Anything that would make it better at playing checkers?

sentences:
How do I get and install the Android SDK on my Ubuntu OS? I heard that it would be a lot easier to do java type games and then move on to Android gaming?
I AM a total beginning but with motive and I have been reading about it from several sources, including similar questions on this site alone.
But I need to know specific things from experienced users.

As for getting the SDK and Eclipse on the computer, I'm having trouble with it, I am running Ubuntu btw so exe files are useless. But I have tired terminal use but I kind of failed because I don't think the SDK and Eclipse are installed, just downloaded.
Ubuntu users especially, I can use help from you seeing how complicated Ubuntu can be compared to windows "click install" setups.

Also if you guys really suggest me learning Java first (which is still a big question cause I don't want to waste time with something I don't want to really use, but getting the feel of gaming is pretty important I know) I am looking at this tutorial:

http://zetcode.com/tutorials/javaswingtutorial/

And it talks about using swing toolkit, but idk how to get that exactly, I tried searching. Sorry for the noobness, but gotta start somewhere and I'm new to this site so I'm really hoping you guys can really help me. I want to make simple games to put on the android market, and then advance.

So going to the tutorial above, it just kind of starts with giving me coding and whatnot which is fine, just copy it but idk where exactly to do all this on (Swing toolkit?) so I can't even start with that.

But really I want help getting this SDK and Eclipse/plugins on my computer and then I can continue with this guide:

www.rbgrn.net/content/54-getting-started-android-game-development

Which is the main guide that I probably should follow, and would be great if some expert skims it a little at least to see if I should start with that guide and skip the java.
But again, I'm stuck on the SDK stuff.

Sorry for the long questions, I am new and I really want to get out of this beginner stage, it's the worst part. Tank you to all and if you want my facebook or AIM to help me through with IM to at least get this SDK and stuff installed fine with Ubuntu OS, ask please (:

sentences:
Is it normal for the baking timer in Unity to increase? I'm having an unusual reaction from trying to bake my scene for Occlusion Culling (the scene was starting to lag and I thought this would optimize it) and I wanted to ask for advice.

What's happening:
This scene and the previous scene are very similar in structure and appearance, only one scene has 2 large models in it. I selected every model/object in the scene that wasn't a character, or had any animation, set it to static, then clicked 'bake' (according to the tutorial I was following and the previous being very successful) and this is where it starts going wrong.

In the previous scene, beside Auto Generate Lighting On is a loading bar, which had 126 Jobs Remaining and took about an hour and a half to do (I was watching a show and each was 30 minutes long, I saw 3 before it completed) but this time, it showed:

Baking... [ETA: 10:26:20]

And when it first started, it had 9 hours instead, then spiked up to 11 after 30 minutes. I'm not sure why there's such a dramatic difference between the two and with my very limited experience on this, I wanted to ask for advice from more experienced Devs.

edit: This is a screenshots of everything that appears in the static dropdown menu:

sentences:
Level up increases to stats in rpg games? I have decided on the stats being vitality, strength, intelligence, speed and endurance.

While HP and MP are decided by vitality, both physical attack and defence are derived from strength.

Intelligence decides both magic attack and magic deffense while speed changes how fast the character is and endurance increases things like equip load burden.

In rpgs I have played different characters depending on how the designer wanted them to feel (i.e. a muscular brute may have a higher strength but lower intelligence) the character may have higher stats in a certain area.

While I can understand that I do not understand how I should structure stat increases that happen when leveling up. For a test character I set all of their stats equal to 10 (I decided to start all characters with a base 50 stat total for now) the characters stats should move up anywhere from 0 to lets say 9 at most when leveling up.

So what is a way to decide which stats go up and by how much when the character levels?

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:
How can I make my image to be blur like the one in my message content? Should I use post processing v2 depth of field or something else ? I want to do it for my main menu.
I have my own image and I want to make it blur like this one.
I changed my images texture type to Sprite (2D and UI) and assigned it to a ui image component.
Now the question how to make it blur ?

sentences:
How to add time delay in Unity C# So I'm trying to make a camera zoom in, but Thread.Sleep doesn't work.
Here is the code:
    void Start() {
    for (int a = 0; a > 1000; a = a + 1)
    {
        Debug.Log("Done!");
        Thread.Sleep(100);
    }
}

The error code is this:
Assets\StartScene\CamScript.cs(12,13): error CS0103: The name 'Thread' does not exist in the current context

sentences:
Dynamically applied texture to GameObject using GUI button In a scene I have multiple different GameObjects (almost 30 kinds) with parent child relationships. At run time (by using a GUI button) I want to change the texture of each clicked GameObject. As the user clicks specific GameObjects, a GUI with a multiple texture button will appear. By clicking on the button, that specific texture will be applied.

Is there a smarter way to do this?

Do I need to apply a script to every object?

I have tried to apply a script with some specific code; it's working but not regularly and correctly.  Additionally, I want different texture options for each kind of GameObject.

sentences:
Follow camera for car object I have a car object in my game that has a car location like any other object. It is able to steer with bicycle KInematics and even rotates while it drives from a car heading vector.
Now I need the camera to follow the car. I put the camera position 10 up and 10 behind the car. But I'm confused on where to make the camera look. I tried this:
pseudo code
lookatcamera = carLocation.x + 5 * cos(carHeading), carLocation.y, carLocation.z + 5 * sin(carHeading);

sentences:
How do I let game maker know that recieved json data is an array? In python I created an array called lobbyList = ["Awesome","Funny","Epic"]

I sent this array to Game maker studio 1.4 using JSON, I made a variable called RecievedData and made the following script

var name = argument0;
var data = argument1;

RecievedData = json_decode(data);
show_message(RecievedData); //Let's me know data has been recieved

I can recieve data fine, but when I show_message(RecievedData) it returns 4, when I do show_message(data) it gives me a string of ["Awesome","Funny","Epic"]

So how do I tell game maker that this is an array and not just a number or string? I want to draw this array coming from the server into a lobby list but for the life of me, I can't figure out how say this is an array.

sentences:
Unity: How to manage a large amount of prefab variations? The project that I'm working on demands the ability for game designers to be very flexible when balancing, customizing items, etc. The most difficult requirement to meet at the moment is that they want to drag-drop, say, a weapon prefab onto a weapon field in some game entity component and from there be able to tweak the prefab's parameters. If I provide some tools that create derived prefabs at such moments, then we'll end up with possibly hundreds of pretty much same prefab variations and also loose the ability to edit the initial prefab and transfer the changes to derivatives.

What I'm starting to consider is introducing a "Data Map" structure in every entity that requires high level of parameter customization. Every parameter would be set through methods like Set/GetFloat("key", "value"), Set/GetFloatArray, Set/GetInt, etc. So basically a dictionary that maps a string to a predefined set of data types. When a prefab of such entity would be drag-dropped into a field of another component, an editor tool would separate the "Data Map" from the prefab, allow the game designer to tweak the values of the keys and eventually serialize it to json. During runtime uppon instantiation of a prefab with a "Data Map" a manager would check the deserialized overrides and override the "Data Map" with the tweaked values if needed.

Though to me this sounds overly complicated and maybe some of you had a similar situation and came up with a simple solution? Maybe it's worth trying the ECS approach? Thanks.

An example: Let's say there are prefabs: Axe, Sword, Bow with a bunch of parameters configured, say Damage, Durability, etc. There are many other components that can accept a weapon prefab and once it's dropped, the designers want to have "on the spot editing" say, okay, for this situation here the Axe prefab needs to be a little different and have Damage+3. Creating a new prefab means that the link to the initial Axe prefab is lost and there are now two Axe prefabs that need to be managed - this is the problem we're trying to address.

sentences:
Transform translation relative to world space What is common algorithm for translating a transform matrix relative to world space axis?
E.g. Matrix M is representing some local space.
When I want to translate M relative to it's own local axis, I just do it like
        M.Translate(translationVector);

But what should I do when I want to translate same matrix but relatively to world space axis?

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:
How to get all keys and values of the PlayerPrefs in Unity? I'm storing player name and scores in the Unity PlayerPrefs. I'd like to list all the names and scores stored in PlayerPrefs and display a high score page:

Is it possible to display all the keys values previously stored in the PlayerPrefs? Or can someone provide me by a JavaScript to do this?

sentences:
Location of project.json in Cocos2d-JS I am learning Cocos2d-JS to develop web-based games with Javascript. In Cocos2d-JS there is project.json file which defines game configuration.

Is it possible to place this file in another location than the directory containing index.html or main.js and if so, where and how should I define the new path?

sentences:
What is the simplest method to generate smooth terrain for a 2d game? What is the simplest method to generate smooth terrain for a 2d game like "Moon Buggy" or "Route 960"?

I got an answer at stackoverflow.com about generate an array of random heights and blur them later. Yes, it's quite okay. But it would be better to give some points, and get a smooth curve.

sentences:
In VR Games, i frequently notice that skyboxes look too close. Would this be a method for making them appear more distant, especially for space games? I was playing Star Trek Bridge Crew, and noticed that the starfield looks oddly close. The same goes for the sky in other games. I realized that this is because when rendering the skybox in a game, VR games render the skybox once for each eye. But because games use a large dome or sphere for the skybox, instead of the appearance of the skybox being located extremely far away (Which happens convincingly in non-vr games), the parallax is quite detectable to our eyes and we see the skybox for what it is, a relatively close wall of stars.

To fix this, I propose that when rendering for the right eye, the right eye camera be temporarily moved to the position of the left eye camera to render the skybox, then moved to the correct position before continuing to render the scene's foreground. Alternately, you could move the skybox model's position by a few pixels (as many as the distance between the cameras) to achieve the same effect.

This should make the appearance of the skybox appear at "infinite" distance since that's how we see stars ourselves, with both eyes seeing the photons arriving at almost parallel vectors.

The effect, in VR, should be convincing. Put simply, stars don't move their apparent position when you close one eye. That should be true in vr games too.

My question is whether, to the game devs of stack exchange, this would be possible using this method. I think the main challenge would be in changing the position of an object in the middle of a render pass.

sentences:
How do I follow this glsl1.2 + lights + shadows tutorial? I am following this great tutorial but I have many questions.

Let's see if I understand the basic idea.

1. I must create the same number of FBOs that lights (maximum 8).
2. I must create the same number of depth textures (shadow maps) that FBOs.
3. For every FBO I must perform offscreen render (render to texture, drawing the scene from the point of view of each of the lights, maximum 8 times).

Is this correct or can I use just a texture with multiple FBOs, or fbo with various textures or how?

Assuming you use the idea above, how should the final render of the scene?

glUseProgram(programa);
  glUniformli(shadowM0,4);
  glActivateTexture(GL_TEXTURE4);
  glBindTexture(GL_TEXTURE_2D,depthT0);
  //Draw Escene?

  glUniformli(shadowM1,5);
  glActivateTexture(GL_TEXTURE5);
  glBindTexture(GL_TEXTURE_2D,depthT1);
  //Draw Escene?

  glUniformli(shadowM2,6);
  glActivateTexture(GL_TEXTURE6);
  glBindTexture(GL_TEXTURE_2D,depthT2);
  //Draw Escene?

  ...
glUseProgram(0);

Is this okay? I think not, because it uses a lot of resources and the scene would have to be drawn up to 7 times. (One per light source and shadow mapping).

Well but then how should the render scene with multiple light sources and shadows?

sentences:
Setting up OpenGL camera with off-center perspective I'm using OpenGL ES (in iOS) and am struggling with setting up a viewport with an off-center distance point.

Consider a game where you have a character in the left hand side of the screen, and some controls alpha'd over the left-hand side.  The "main" part of the screen is on the right, but you still want to show whats in the view on the left.  However when the character moves "forward" you want the character to appear to be going "straight", or "up" on the device, and not heading on an angle to the point that is geographically at the mid-x position in the screen.

Here's the jist of how i set my viewport up where it is centered in the middle:

// setup the camera
    //

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    const GLfloat zNear = 0.1;
    const GLfloat zFar = 1000.0;
    const GLfloat fieldOfView = 90.0; // can definitely adjust this to see more/less of the scene

    GLfloat size = zNear * tanf(DEGREES_TO_RADIANS(fieldOfView) / 2.0);
    CGRect rect;
    rect.origin = CGPointMake(0.0, 0.0);
    rect.size = CGSizeMake(backingWidth, backingHeight);
    glFrustumf(-size, size, -size / (rect.size.width / rect.size.height), size / (rect.size.width / rect.size.height), zNear, zFar);

    glMatrixMode(GL_MODELVIEW);

    // rotate the whole scene by the tilt to face down on the dude
    const float tilt = 0.3f;
    const float yscale = 0.8f;
    const float zscale = -4.0f;
    glTranslatef(0.0, yscale, zscale);
    const int rotationMinDegree = 0;
    const int rotationMaxDegree = 180;

        glRotatef(tilt * (rotationMaxDegree - rotationMinDegree) / 2, 1.0f, 0.0f, 0.0f);

    glTranslatef(0, -yscale, -zscale);

    static float b = -25; //0;
    static float c = 0;

    // rotate by to face in the direction of the dude
    float a = RADIANS_TO_DEGREES(-atan2f(-gCamera.orientation.x, -gCamera.orientation.z));
    glRotatef(a, 0.0, 1.0, 0.0);

    // and move to where it is
    glTranslatef(-gCamera.pos.x, -gCamera.pos.y, -gCamera.pos.z);

    // draw the rest of the scene
    ...

I've tried a variety of things to make it appear as though "the dude" is off to the right:
- do a translate after the frustum to the x direction
- do a rotation after the frustum about the up/y-axis
- move the camera with a biased lean to the left of the dude

Nothing i do seems to produce good results, the dude will either look like he's stuck on an angle, or the whole scene will appear tilted.  I'm no OpenGL expert, so i'm hoping someone can suggest some ideas or tricks on how to "off-center" these model views in OpenGL.  Thanks!

sentences: Is there a way to apply euphoria physics (ragdoll) to rigged Sprites in Unity2D? With euphoria physics I mean the realistic object interaction and freefall as seen in most games like recent GTAs. But I want to do that in 2D. (I am a beginner :P).

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:
Setting Window Icon SDL2 I've been playing around with SDL2 and have made a very nifty little program!
Now, I'm trying to set my window icon - for the SDL Window. I have the following code in the main function of my program, right after SDL initialization stuff.

            SDL_Surface* icon = IMG_Load("assets/system/interface/icon.png");
        SDL_SetWindowIcon(window, icon);

However, the topbar icon and the toolbar icon remain the same, default application icon! What could I be doing wrong???

Thanks!

sentences:
Is it possible to use plugins like Admob when creating a UDK game for Android or iOS? Is it possible to use plugins like Admob or Chartboost for iOS and Android when using UDK?

I am interested in an official or unofficial source where it's mentioned that the plugins are possible or not with UDK or if anyone have ever made plugins without using the original Unreal Engine Source?

sentences:
Update single entry in GLSL array I have an array in my vertex shader like this:

uniform mat4 MeshTransforms[20];

At the moment I'm just updating the entire array of matrices like so:

int meshTransforms = ARBShaderObjects.glGetUniformLocationARB(shader, "MeshTransforms");
ARBShaderObjects.glUniformMatrix4ARB(meshTransforms, false, UnitTransformMatrices);

Where UnitTransformMatrices is a float buffer containing the transform matrices of some units.

I'd like to just update a single matrix in the array (just update one unit transform matrix). So how can I overwrite a single matrix in the middle of the matrix array?

This is using the LWJGL, so I'm limited to the functionality it provides.

sentences:
Texturing 2D vectorial terrain (or simply masking texture) I have a procedurally generated terrain, as follows:

It is generated and then built using Farseer Physics, however I haven't found a way to create and apply a mask to texture it properly, I have already played with stencil buffers and pixel shaders but I still have no solution at the moment. How would I do that? Am I going the right direction with stencil and pixel shader? Thank You.

sentences:
2D Tile Collision free movement I'm coding a 3D game for a project using OpenGL and I'm trying to do tile collision on a surface.

The surface plane is split into a grid of 64x64 pixels and I can simply check if the (x,y) tile is empty or not.

Besides having a grid for collision, there's still free movement inside a tile.

For each entity, in the end of the update function I simply increase the position by the velocity:

pos.x += v.x;
pos.y += v.y;

I already have a collision grid created but my collide function is not great, i'm not sure how to handle it. I can check if the collision occurs but the way I handle is terrible.

int leftTile = repelBox.x / grid->cellSize;
int topTile = repelBox.y / grid->cellSize;
int rightTile = (repelBox.x + repelBox.w) / grid->cellSize;
int bottomTile = (repelBox.y + repelBox.h) / grid->cellSize;

for (int y = topTile; y <= bottomTile; ++y)
{
    for (int x = leftTile; x <= rightTile; ++x)
    {

        if (grid->getCell(x, y) == BLOCKED){
            Rect colBox = grid->getCellRectXY(x, y);
            Rect xAxis = Rect(pos.x - 20 / 2.0f, pos.y - 20 / 4.0f, 20, 10);
            Rect yAxis = Rect(pos.x - 20 / 4.0f, pos.y - 20 / 2.0f, 10, 20);

            if (colBox.Intersects(xAxis))
                v.x *= -1;

            if (colBox.Intersects(yAxis))
                v.y *= -1;

        }
    }
}

If instead of reversing the direction I set it to false then when the entity tries to get away from the wall it's still intersecting the tile and gets stuck on that position.

EDIT: I've worked with Flashpunk and it has a great function for movement and collision called moveBy. Are there any simplified implementations out there so I can check them out?

EDIT2: I've figured out a solution, you can check the answer below

sentences:
Generate road mesh from a graph I want to generate a mesh for the entire road network(later I'll probably want to split it into chunks but for now this will do).

My road network is stored as a TArray of pointers to a struct that contains the node location and pointers to each connected road(it's up to 4 nodes, each one has a direction).

struct FRoadNode
{
    int radius;
    float angle;
    TWeakPtr<FRoadNode> topNode;
    TWeakPtr<FRoadNode> bottomNode;
    TWeakPtr<FRoadNode> rightNode;
    TWeakPtr<FRoadNode> leftNode;
}

The road is following a polar grid. (see Frostpunk for example, it's almost exactly like that)

Each arc will be divided by its length to have as little vers as possible while keeping a nice curve.
If 2 line segments get too close the will be merged at the intersection point. (3rd example below, still not sure about this one...)
If 2 intersections are too close together they will be merged.

Here's the general idea of how I was thinking of generating the mesh:

I'm pretty new to generating mesh programmatically and to UE C++... so..
1. Is there a nice algorithm out there that will make my life a little bit easier?
2. How should I approach it?
3. Should I connect the road segment verts with the intersections verts?
4. Are there some advanced techniques that I need to know about?

BTW I saw somewhere a way to generate the road mesh by connecting all the nodes then extrude the edges, but I can't find it and I have no idea how this method called, If you know what I'm talking about, please tell what it's called\provide links.

sentences:
Destroy physics triggered GameObject in Unity ExecuteInEditMode To destroy GameObjects I'm using this code :

try
        {
            DestroyImmediate(g);
        }
        catch (Exception e)
        {
            Destroy(g);
        }

It is giving me error, something like this :

Full code :

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

[ExecuteInEditMode]
public class Road : MonoBehaviour
{
    public List<Vector3> points = new List<Vector3>();
    public List<GameObject> gameObjects = new List<GameObject>();
    void Start()
    {

    }
    void OnValidate()
    {
        foreach(GameObject g in gameObjects)
        {
            try
            {
                DestroyImmediate(g);
            }
            catch (Exception e)
            {
                Destroy(g);
            }
        }
        gameObjects.Clear();
        foreach (Vector3 point in points)
        {
            GameObject tem = GameObject.CreatePrimitive(PrimitiveType.Cube);
            tem.transform.position = point;
            tem.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
            tem.transform.parent = gameObject.transform;
            gameObjects.Add(tem);
        }
    }
}

sentences:
GetData() error creating framebuffer I'm currently porting a game written in C# with XNA library to Android with Monogame.
I have a Texture2D and i'm trying to get an array of uint in this way:

Texture2d textureDeform = game.Content.Load<Texture2D>("Texture/terrain");
uint[] pixelDeformData = new uint[textureDeform.Width * textureDeform.Height];
textureDeform.GetData(pixelDeformData, 0, textureDeform.Width * textureDeform.Height);

I get the following exception:

  System.Exception: Error creating framebuffer: Zero at
  Microsoft.Xna.Framework.Graphics.Texture2D.GetTextureData (Int32
  ThreadPriorityLevel) [0x00000] in :0

I found that the problem is in private byte[] GetTextureData(int ThreadPriorityLevel) creating the framebuffer:

private byte[] GetTextureData(int ThreadPriorityLevel)
{
            int framebufferId = -1;
            int renderBufferID = -1;

            GL.GenFramebuffers(1, ref framebufferId);  // framebufferId is still -1 , why can't be created?
            GraphicsExtensions.CheckGLError();
            GL.BindFramebuffer(All.Framebuffer, framebufferId);
            GraphicsExtensions.CheckGLError();
            //renderBufferIDs = new int[currentRenderTargets];
            GL.GenRenderbuffers(1, ref renderBufferID);
            GraphicsExtensions.CheckGLError();

            // attach the texture to FBO color attachment point
            GL.FramebufferTexture2D(All.Framebuffer, All.ColorAttachment0,
                                    All.Texture2D, this.glTexture, 0);
            GraphicsExtensions.CheckGLError();

            // create a renderbuffer object to store depth info
            GL.BindRenderbuffer(All.Renderbuffer, renderBufferID);
            GraphicsExtensions.CheckGLError();
            GL.RenderbufferStorage(All.Renderbuffer, All.DepthComponent24Oes,
                                   Width, Height);
            GraphicsExtensions.CheckGLError();

            // attach the renderbuffer to depth attachment point
            GL.FramebufferRenderbuffer(All.Framebuffer, All.DepthAttachment,
                                       All.Renderbuffer, renderBufferID);
            GraphicsExtensions.CheckGLError();

            All status = GL.CheckFramebufferStatus(All.Framebuffer);

            if (status != All.FramebufferComplete)
                throw new Exception("Error creating framebuffer: " + status);

...
}

The frameBufferId is still -1, seems that framebuffer could not be generated and I don't know why.
Any help would be appreciated, thank you in advance.

sentences:
How should I calculate the score in Minesweeper: 3BV or 3BV/s? I'm designing a minesweeper game, and I'm a bit confused as to how to calculate the score.

The objective of my game is to reveal all the non-flagged boxes. Marking the flag must not count toward the score. Just showing the number of seconds required to complete a board seems obsolete as I have a variable board size which is decided by the user. I studied the Wikipedia page on Minesweeper regarding the two scoring techniques.

But I don't understand how to calculate the 3BV. Is it just the number of left clicks done by user done during the game, or is the 3BV the minimum number of clicks required to complete the board? Also how can 3BV/s be judged: does a higher or lower score give a higher ranking?

Regarding my implementation

I used an integer array with all zeros and 9 designating a mine position. When a user click in the grid I calculate the nearby cells and then display the appropriate number and if he clicks on cell with value 9 then game is over.

sentences: Source control for storing everything of game project? Is it usual to manage not only source code, but all assets, textures, art, documentation files, etc under git repository for version controlling? For example I wanna to get back old version of texture. If it is very bad practice what tools do you use for version control of assets and other stuff?

sentences:
How to move an object using X and Y coordinates in JavaScript I am making a 2d baseball game with JavaScript and HTML5 and am trying to move an image that I have drawn with JavaScript like so:

    //canvas
    var c = document.getElementById("gameCanvas");
    var ctx = c.getContext("2d");
    //baseball
    var baseball = new Image();
    baseball.onload = function() {
        ctx.drawImage(baseball, 400, 425);
    };
    baseball.src = "baseball2.png";

I'm not sure how I would move it though, I have seen many people seem to just type something like ballX and ballY but I don't understand where the actual x and y definition comes from. Here is my code so far:

http://jsfiddle.net/xRfua/

I have a different image source but it is a local source so I didn't include it. Thanks in advance for any help at all!

sentences:
Rotating with a preferred direction I do a RayCast to the terrain and then use the RaycastHit.normal to plant flags.

I would like to have the flags to point up with the normal, but have them all face the same direction. As seen in the image flag 1 points to left of the screen and flag 5 to the right. I understand why, but do not know how to rotate it.
I saw LookRotation (Unity) has an override that takes a forward direction too. I thought it would work with say Vector3.Forward, but if a flag is placed on a wall it points into the wall.
The direction or angle they face can be set by the player.
I have a hard time understanding quaternions, every time I think I do, I get stuck.
Any tips ?

sentences:
How to properly rotate towards a local point in Unity C#? (a local LookAt) I am having a nightmare trying to make a child object rotate towards a given point of its parent object, similar to what is possible at the world level when using LookAt.

The problem is that most functions related to rotating in Unity C# do not work for local level. In the description of function transform.Rotate one can have the impression that it allows that, trough passing the Space.Self parameter. However, to use that function one has to know the 3 angles between the 2 points of interest. And there is no function that allows such calculation.

Anyone could please help implementing a local LookAt?

sentences: LWJGL Collision Detection I cannot find LWJGL collision detection with a camera and walls. Like making it to where you can not walk through walls and other different shaped rectangular prisms and cubes. How do I set up LWJGL collision?

sentences:
How to determine mouse position outside stage, and center the cursor? I was wondering if it is possible to have my flash game determine the position of the mouse, even when the cursor is not inside the stage.

My movie clip should move horizontally between x = 100 and 500, using mouseX for movement:

private var previousX : int;
private var mc : MovieClip;
//...
private function update(e:Event = null):void
{
    var deltaX : int = (mouseX - previousX) / 2;
    mc.x = Math.min(Math.max(mc.x + deltaX, 100), 500);
    previousX = mouseX;
}

The above code works fine, as long as the cursor is above my flash game. When the cursor is outside the stage, mouseX stops updating. I realise that mouseX is probably not what I'm looking for, so I was wondering if there was any other way of finding the cursors position.

I hoped there was a way to set the mouse position directly, so I could center it after every update, so it would almost never be able to leave the frame in the first place. Is that possible?

sentences:
Can I use JBox2D on server with Box2D on libGDX on client? I want to use Box2D for my turn-based game, made with libGDX. The client is supposed to do some prediction of physics after his input and I want to correct these calculations with server-side calculations afterwards.
As I do not want to run an entire libGDX project on my server (because there will be parallel games and a single game per GameRoom is not necessary), I thought about running JBox2D on the server and send the final calculations for correction purposes to my two clients.

Can I e.g. step 10 seconds ahead at once with my server-side physics and send the results to my client right away? I don't need small steps, because the server won't render them anyways
Will these results mostly match with the client results of the built-in libgdx box2d version? I will here use smaller steps, so the client can render the changes easily.

Thanks in advance!

sentences:
Should I render all of my HUD views to a single SurfaceView? I'm using a SurfaceView and canvas to implement a game HUD, title screens etc., by overlaying standard Android view widgets over my SurfaceView. This works reasonably well and maintains an acceptable frame-rate, but it is a simple game with little happening on or off screen.

I have handlers flinging messages around and runOnUiThreads everywhere. Quite cumbersome. Can I draw all my views to the one SurfaceView, controlled by the main game thread? Is there an advantage to this?

sentences:
Drawing multiple objects from one Vertex Buffer Object in OpenGL/OpenTK I am trying to experimenting drawing method using VBO in OpenGL. Many people normally use 1 vbo to store one object data array. I was trying to do something quite opposite which is storing multiple object data into 1 vbo then drawing it. There is story behind why i want to do this. I want to group many of objects as a single object sometime. However my code doesn't do the justice. Following is my pseudo code:

//Data
int[] _vBO = new int[1]; //vertex buffer objects

_triangleVertices = new float[]
                  { 0.0f, 1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, //first triangle lineloop, positions in the middle of the screen.
                    3.0f, 1.0f, 0.0f, 2.0f, -1.0f, 0.0f, 4.0f, -1.0f, 0.0f, //second triangle lineloop, positions on the left side of the first triangle.
                    -3.0f, 1.0f, 0.0f, -4.0f, -1.0f, 0.0f, -2.0f, -1.0f, 0.0f  }; //third triangle lineloop, positions on the right side of the first triangle.

//Setting Up
void init()
{
   GL.GenBuffers(1, _vBO);
   GL.BindBuffer(BufferTarget.ArrayBuffer, _vBO[0]);
   GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(sizeof(float) * _triangleVertices.Length), _triangleVertices, BufferUsageHint.StaticDraw);
   GL.VertexPointer(3, VertexPointerType.Float, 0, 0);
   GL.EnableClientState(Array.VertexArray);
}

//Drawing
void display()
{
    GL.Clear(ClearBufferMask.ColorBufferBit);
    GL.Clear(ClearBufferMask.DepthBufferBit);

    //setting up camera and projection.
    float[] eyes = { 0.0f, 0.0f, -10.0f };
    float[] target = { 0.0f, 0.0f, 0.0f };
    Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView(0.785398163f, 4.0f / 3.0f, 0.1f, 100f);  //45 degree = 0.785398163 rads
    Matrix4 view = Matrix4.LookAt(eyes[0], eyes[1], eyes[2], target[0], target[1], target[2], 0, 1, 0);
    Matrix4 model = Matrix4.Identity;
    Matrix4 MV = view * model;

    GL.MatrixMode(MatrixMode.Projection);
    GL.LoadIdentity();
    GL.LoadMatrix(ref projection);

    GL.MatrixMode(MatrixMode.Modelview);
    GL.LoadIdentity();
    GL.LoadMatrix(ref MV);

    GL.Viewport(0, 0, glControlWindow.Width, glControlWindow.Height);
    GL.Enable(EnableCap.DepthTest); //Enable correct Z Drawings
    GL.DepthFunc(DepthFunction.Less); //Enable correct Z Drawings
    GL.MatrixMode(MatrixMode.Modelview);

    //Draw
    drawTriangleLineLoops();

    //Finally...
    GraphicsContext.CurrentContext.VSync = true; //Caps frame rate as to not over run GPU
    glControlWindow.SwapBuffers(); //Takes from the 'GL' and puts into control
}

void drawTriangleLineLoops()
{
   GL.BindBuffer(BufferTarget.ArrayBuffer, _vBO[0]);
   GL.VertexPointer(3, VertexPointerType.Float, 0, 0);
   GL.EnableClientState(ArrayCap.VertexArray);
   GL.DrawArrays(BeginMode.LineLoop, 0, 3); //drawing first triangle lineloop, first vertex starts at index 0.
   GL.DrawArrays(BeginMode.LineLoop, 9, 3); //drawing second triangle lineloop, first vertex starts at index 9.
   GL.DrawArrays(BeginMode.LineLoop, 18, 3); //drawing third triangle lineloop, first vertex starts at index 18.
   GL.DisableClientState(ArrayCap.VertexArray);
}

I expect 3 different triangles to be drawn, but only one was drawn. I don't know what went wrong.

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:
Failed to get socket connection from UnityShaderCompiler.exe shader compiler! C:/Program Files/Unity/Editor/Data/Tools/UnityShaderCompiler.exe When running a jenkins build using the Unity 3D plugin I get the following error repeatedly:

Failed to get socket connection from UnityShaderCompiler.exe shader compiler! C:/Program Files/Unity/Editor/Data/Tools/UnityShaderCompiler.exe

Not sure what's going on there, I tried giving a pass to the exe in windows firewall but it didn't help.

I have Unity 2017.1 installed...

sentences:
Use IPointerEnterHandler with bool function? Im trying to use mouse pointer to detect any UI element on my canvas. when pointer enter any UI element, UI_active set true, else UI_active set false. Here is my script:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.EventSystems;// Required when using Event data.

public class UI_AVATAR : MonoBehaviour, IPointerEnterHandler {

public bool  UI_active;

public void OnPointerEnter(PointerEventData eventData)
{
    Debug.Log("The cursor entered the selectable UI element.");
    print(eventData.currentInputModule.name);
    print(eventData.pointerCurrentRaycast.gameObject.name);

}

}

sentences:
ParticleSystem, performance behind the technique on batching with different materials I found that guide:
https://thinhhb.wordpress.com/2016/03/27/unity3d-optimization-make-atlas-textures-for-particlesystem-reduce-drawcall-why-not/ which is quite clever.

As far as I know, we can't batch ParticleSystems with different materials, for example:

A star (Particles/Additive)
A smoke (Particles/Additive)

give 2 draw calls.

The guide points, that we can use a TextureSheet trick to achieve batching of different graphics on multiple ParticleSystems like that:

We create a spritesheet manually and cut it in Unity's SpriteEditor into a grid, and create a material:

Then, we create our ParticleSystems and attach generated sprites into Texture Sheet Animation Module:

And here the magic happens. They batch.

My question is, what is the overhead behind this? Is the TextureSheetModule expensive?

If I have 15 different sprites, their ParticleSystems create 15 batches, which is quite expensive on mobile.

Is it wise, to move to TextureSheet and save these 14 batches?

sentences:
FFMPEG Opengl video rendering I'm searching any way to render with ffmpeg, an opengl texture that contains the video frame.

Actually, I am not good with ffmpeg... Is there any library/documentation or something?
How can I render a video with ffmpeg to opengl?

Thanks

sentences:
How should I cycle my game to be more scalable? I'm trying to improve my game emulator so it can handle more users. I currently have one separate thread and execute all processing there.

The cycles processes players and rooms, rooms are individual maps that users can belong to, with other users where they can walk, talk and interact with each other

Currently my game server starts having issues where there are more than 2,000 users online, or when a single room has more than 60 users inside it.

Here is the main game cycle

private Task _gameCycle;
private int _cycleSleepTime = 25;

public Game()
{
    _cycleActive = true;

    _gameCycle = new Task(GameCycle);
    _gameCycle.Start();
}

private void GameCycle()
{
    while (_cycleActive)
    {
        Root.GetGame().GetRoomManager().OnCycle();
        Root.GetGame().GetPlayerManager().OnCycle();

        Thread.Sleep(_cycleSleepTime);
    }
}

RoomManager's OnCycle:

var sinceLastTime = DateTime.Now - _cycleLastExecution;

if (sinceLastTime.TotalMilliseconds >= 500)
{
    _cycleLastExecution = DateTime.Now;

    foreach (var room in _rooms.Values.ToList())
    {
        if (room.isCrashed)
        {
            continue;
        }

        if (room.ProcessTask == null || room.ProcessTask.IsCompleted)
        {
            room.ProcessTask = new Task(room.ProcessRoom);
            room.ProcessTask.Start();
            room.IsLagging = 0;
        }
        else
        {
            room.IsLagging++;

            if (room.IsLagging >= 30)
            {
                room.isCrashed = true;
                UnloadRoom(room.Id);
            }
        }
    }
}

PlayerManager's OnCycle:

if (_clientPingStopwatch.ElapsedMilliseconds >= 30000)
{
    _clientPingStopwatch.Restart();

    var toPing = new List<IGameClient>();

    foreach (var client in _clients.Values.ToList())
    {
        if (client.GetConnection().PingCount < 6)
        {
            client.GetConnection().PingCount++;

            toPing.Add(client);
        }
        else
        {
            lock (_timedOutConnections.SyncRoot)
            {
                _timedOutConnections.Enqueue(client);
            }
        }
    }

    var start = DateTime.Now;

    foreach (var client in toPing.ToList())
    {
        try
        {
            client.SendPacket(new PongComposer());
        }
        catch
        {
            lock (_timedOutConnections.SyncRoot)
            {
                _timedOutConnections.Enqueue(client);
            }
        }
    }
}

if (_timedOutConnections.Count < 1)
{
    return;
}

lock (_timedOutConnections.SyncRoot)
{
    while (_timedOutConnections.Count > 0)
    {
        IGameClient client = null;

        client = (IGameClient)_timedOutConnections.Dequeue();

        if (client != null)
        {
            client.Disconnect();
        }
    }
}

Each room has its own task (thread). It processes a lot, user movement, chat messages, items, status updates. I figured rather than waiting for each room to process in RoomManager's OnCycle, use a new thread and try to process multiple at the same time, after all the server is multi-core.

Room's ProcessRoom

public void ProcessRoom()
{
    if (isCrashed || mDisposed)
    {
        return;
    }

    try
    {
        if (GetRoomUserManager().GetRoomUsers().Count == 0)
        {
            IdleTime++;
        }
        else if (IdleTime > 0)
        {
            IdleTime = 0;
        }

        if (Promotion != null && Promotion.HasExpired)
        {
            EndPromotion();
        }

        if (IdleTime >= 60 && Promotion == null)
        {
            Root.GetGame().GetRoomManager().UnloadRoom(Id);
            return;
        }

        GetRoomItemHandler().OnCycle();
        GetRoomUserManager().OnCycle();
        GetRoomUserManager().SerializeStatusUpdates();
        GetWired().OnCycle();
    }
    catch (Exception e)
    {
        _logger.Exception(e);
        OnRoomCrash(e);
    }
}

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:
Time based events separate from the game loop How can set up time elapsed based events separate from the game loop?

I want the character to heal over real time rather than per cycle of the game loop.  How might i do that?

sentences:
Closest point on an ellipsoid I need to know how to get the closest point on the surface of an ellipsoid to another point.

I had an idea, but apparently i was wrong, and oversimplfying.

What i did was squash the ellipsoid and point into local space, so the ellispoid is a unit circle

vector3 pointLocalCoord = ( pointOriginal - ellipsoid.origin ) / ellipsoid.radii

Then from there, the closest point should be 1, in the  direction of the transformed point from the origin

vector3 closestPointOnEllipsoidLocal = norm ( pointLocalCoord )

Then get back into standard space

vector3 closestPointOnEllipsoidWorld = closestPointOnEllipsoidLocal * ellipsoid.radius + ellipsoid.origin

But of course, all of this seems not to work, i was curious if any body could point me in the direction of some pre-existing code or such; as some of the articles i've tried reading kinda go a bit out of my scope of knowledge.

Also, if that seems right to you, please do tell. I'm pretty sure its wrong though.

Edit: Sorry for the unresponsiveness with this and my other question. They're different, i was axperimenting with something else

sentences:
Animated Energy/Combo Bar (Unity 4.6) How could I achieve the animated Combo bar effect used in Ski Safari / Ski Safari: Adventure time? Preferably with Unity 4.6 UI. General explanations also welcome!

Links to videos showing the wanted effect:
https://www.youtube.com/watch?v=CnfCkqiM890#t=4m46s
and
https://www.youtube.com/watch?v=aqj61liRJ74#t=7m00s

sentences:
Hierarchical "Select GameObject" Dialog or names with prefixes? I am attempting to connect a series of teleporters with entrances inside a single scene. Once the player touches a teleporter he is moved to another place. I am doing this by simply connecting two game objects as shown in the following screenshot. The particle system in the center of the upper side is used as teleporter, the red line indicates the game object where the player will be transported to.

Sadly, this results in an utter mess when attempting to select a new entrance the teleporter should link to. There is no way to guess which entrance corresponds to which side and dice:

So the tl;dr of my problem would be this: The name of the object that should be selected is meaningless when isolated. It's the path to the object (or in other terms: the name of some parent) that is relevant.

I would see three possibilities to solve this, but sadly I haven't gotten around to find out how to do any of them.

Switch the "Select GameObject" Dialog to use the same hierarchical view as used in the scene viewer. Is there a hidden option somewhere in Unity that I overlooked?
Somehow prefix the names of my entrances programatically. Is there a way to include the path to a certain game object in its name?
My whole approach is backwards and I am doing something in a not Unity friendly way. But what would be the "correct" way to do this?

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:
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:
Grid Based Lighting in XNA/Monogame I know that questions like this have been asked many times, but I have not found one exactly like this yes. I have implemented a top-down grid based world in Monogame, and am starting on the lighting system soon. How I want to do lighting is to have a grid that is 4 times wider and higher, basically splitting each world tile into a 4x4 system of "subtiles". I would like to use a flow like system to spread light across the tiles by reducing the light by a small amount each time. This is kind of the effect I was going for:

http://i.imgur.com/rv8LCxZ.png

The black grid lines are the light grid, and the red lines are the actual tile grid, and the light drop-off is very exaggerated. I plan to render the world by drawing the unlit grid to a separate RenderTarget2D, then rendering the lighting grid to a separate target and overlaying the two.

Basically, my questions are:

What would be the algorithm for a flow style lighting system like this?
Would there be a more efficient way of rendering this?
How would I handle the darkening of the light with colors, reducing the RGB values in each grid, or reducing the alpha in each grid, assuming that I render the light map over the grid using blending?
Even assuming the former are possible, what BlendState would I use for that?

sentences:
Multiple keypresses causing wierd results in SDL I have been building a pong clone. I've been using a mixture of peoples different code to understand the way they structure their games as well as reading on game patterns. Currently I've gotten to draw a paddle on the screen and the player can move it with the keyboard no problem.

The issue comes when a player presses a button that is not 'Up' or 'Down'. For instance when the player holds the 'Up' key the paddle travels upwards, but if they simultaneously hold the 'Right' key it causes the paddle to fly downwards at a much greater speed.

My keyboard checking code is:

void GameLoop::Input(SDL_Event &ev)
{
    if (ev.type == SDL_KEYDOWN)
    {
        if (ev.key.keysym.scancode == SDL_SCANCODE_DOWN)
        {
            player1->IsMoving(true);
            player1->velocity = 10;
        }
        if (ev.key.keysym.scancode == SDL_SCANCODE_UP)
        {
            player1->IsMoving(true);
            player1->velocity = -10;
        }

    }

    else if (ev.type == SDL_KEYUP)
    {
        if (ev.key.keysym.scancode == SDL_SCANCODE_DOWN)
        {
            player1->IsMoving(false);
            player1->velocity = 0;
        }
        if (ev.key.keysym.scancode == SDL_SCANCODE_UP)
        {
            player1->IsMoving(false);
            player1->velocity = 0;
        }
    }
}

The GameLoop is ran within loop that is configured to run at 60FPS. You can see this in this code block here:

int main(int argc, char **argv){

    //Initialise the app and SDL
    App app(SDL_INIT_VIDEO);
    GameLoop game;

    double lastTime = 0.0, currentTime;

    SDL_Event e;

    while (app.isRunning())
    {
        if (SDL_PollEvent(&e))
        {
            if (e.type == SDL_QUIT)
            {
                app.exit();
            }
        }

        currentTime = SDL_GetTicks() / 1000.0;
        if (currentTime >= lastTime + 0.01666667)
        {
            game.Input(e);
            game.Update();
            game.Render();

            lastTime = currentTime;
        }

    }

    return 0;
}

This is the paddles update code:

void Paddle::Update()
{
    if(moving == true)
    {
        rect.y += velocity;
        velocity = 50;
    }

    X = rect.x;
    Y = rect.y;
}

I'm unsure of what is causing the paddle to behave so strangely. Any insight given into this problem or even just the way I've approached this problem would be appreciated.

sentences:
My 3D Shader wont render light direction correctly opengl/c++/glsl This is what I'm doing:

vertex shader:

#version 400
layout ( location = 0 ) in vec3 vertex_position;
layout ( location = 1 ) in vec3 vertex_normal;

uniform mat4 ModelViewMatrix; //model
uniform mat3 NormalMatrix; //transpose(inverse(model)))
uniform mat4 priv_mat; //projection*view*model

out vec3 normal;
out vec3 position;

void main()
{
  normal=normalize(NormalMatrix*vertex_normal);
  position=vec3(ModelViewMatrix*vec4(vertex_position,1.0));
  gl_Position=priv_mat*vec4(vertex_position,1.0);
}

fragment shader:

#version 400
in vec3 normal;
in vec3 position;

uniform vec4 LightPosition; // light position: vec4(0,0,0,1);
uniform vec3 LightIntensity;

uniform vec3 Kd;            // Diffuse reflectivity
uniform vec3 Ka;            // Ambient reflectivity
uniform vec3 Ks;            // Specular reflectivity
uniform float Shininess;    // Shininess

vec3 ads( ){
    vec3 n = normal;
    vec3 s = normalize( vec3(LightPosition) - position );
    vec3 v = normalize( vec3(-position));
    vec3 r = reflect( -s, n );
return
    LightIntensity *
    ( Ka +
    Kd * max( dot(s, n), 0.0 ) +
    Ks * pow( max( dot(r,v), 0.0 ), Shininess ) );
}

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

But when I run it, I get this:

Where the light doesnt just come from the wrong spot, but it also doesnt change when I move the planet around, like so

The diffuse value somehow gets the wrong direction? According to the example given (page 90), the diffuse is calculated by getting the dot(s,n), where s is lightposition-position, and position is (viewmodelvertex_position). But like you can see, the result doesnt shade the direction correctly.

Solution: The answer was matrix confusion all along. The problem was the ModelViewMatrix, and that It didnt have to be multiplied with view before being sent to the shader. The rest is just correct. Basically I was putting the "position" in the wrong space. Not multiplying with view before sending to the shader fixes it.

sentences:
Where can i get the openal sdk for c++? The OpenAL site I'm looking at is a crappy outdated and broken sharepoint portal and the SDK in the downloads section give me a 500 html code when i request it.

http://connect.creativelabs.com/openal/Downloads/OpenAL11CoreSDK.zip

I found an OpenAL SDK on a softpedia and it has headers but not alu.h or alut.h which the tutorials I'm looking at apparently require for loading wavs etc.

What am I missing? Is OpenAL dead or something?

sentences:
How to manage state in a component-based game engine? I'm working on a small, data-driven game engine with some friends.

We use GameObjects (a.k.a. Entities, Actors, or whatever it is called in your favorite engine) to represent every entity in the game. These GameObjects owns Components, who communicates via message passing. This is a very well-known pattern, and although implementations differ greatly, it seems to be what every commercial, modern game engine is doing.

Now we have one problem: managing state. Let's say we are creating some kind of platform game. The hero of this game should be able to stand still, jump, attack...

We created some Finite State Machines to hold the player's state. Now the state should, in turn, be consumed by the other components. Running should trigger an animation and modify the player's velocity, attacking should stop the player and spawn a bullet...

But this creates a lot of dependencies. The Sprite component now has to be aware of the State component, and listen to state changes. The Movable component should listen to state changes too, to be able to change the player's speed. Nearly every component depends on the State component. This sounds like a dependency hell.

I think it's a very common problem, but I can't find a good solution for it. Are there some design patterns for situations like this?

sentences:
Runtime Access to Unity 2d Tiles I'm trying to use Unity's 2017 tilemap features. What I would like to do is push a tile's sprite up (change its offset), so that the sprite moves up pixel by pixel and the top of the sprite loops (wraps) back around to the bottom. Basically, I want to animate my "Water" sprite without having to build 20 different versions of the sprite to achieve the same effect.  I was able to do this in Rotorz tiles by accessing its Atlas' MainTexture Offset or something like that but this product is discontinued.  This animation is similar to the water in classic RPG games like Ultima 4.

More than that, I would just love to have runtime access to the tiles to do other things: change out the entire sprite on a single tile, change the color, etc.

I have made a custom Tile class using this example:
https://docs.unity3d.com/Manual/Tilemap-ScriptableTiles-Example.html

But this only seems to affect tiles at the time of placement.

Is this possible and does anyone have a good example?  Docs on this feature are scarce.

sentences:
Animations in Unity are not working properly I've done a few animations in Blender for my 3D character but the problem is, that they look different in Unity. It seems like the eyes are moving too much. I tried to change many things in import like rig etc. but nothing helped at all. Here are screenshots:

Wrong animation

Good animation

sentences: Farseer: Shooting a ball in a certain angle? How can I shoot a ball in a certain angle? When I press the Space key, the ball should be shot in a 45 degree angle. How can I do that?

sentences:
Update variable before building the unity build Before building the standalone build I want to update one of the variables in the script using this.

class MyCustomBuildProcessor : IPreprocessBuild
 {
      public int callbackOrder { get { return 0; } }
      public void OnPreprocessBuild(BuildTarget target, string path) {
        // Do the preprocessing here
        CopyRightCls.buildDateTime = System.DateTime.Now;
        Debug.Log("+++++++++++++++++++++++++++++++++++BuildDateTime" + CopyRightCls.buildDateTime);
      }
 }

But the problem is my date variable is not updating its showing 1 january 0001.

sentences:
Can you help me find resources for developing a top-down 2D game in Java? I just started reading about games, and I'm going to develop a game where a person is moving around on a 2D map. My preferred language is Java. Is that suitable to develop games?

I'm going to develop a desktop app and need some help to get started. Can someone please give me some good resources for newbies?

sentences:
How can I handle rendering on multiple monitors with differing refresh rates? What's the best way to deal with a situation that may arise, where a user has two or more monitors with different resolutions and vertical sync intervals?

This would apply when a game has a fixed timestep, and is running in windowed mode: if one monitor has a frame rate of 60.056, and the other has a frame rate of 59.94, vertical sync will ultimately fail to do its job, if the game window is moved from the primary screen to another.

Temporal aliasing will also occur, as the timestep is not properly attuned to the other sync rate. How do games typically deal with this issue, if at all?

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

sentences:
Drawing multiple Textures as tilemap I am trying to draw a 2d game map and the objects on the map in a single pass.
Here is my OpenGL initialization code

// Turn off unnecessary operations
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glDisable(GL_STENCIL_TEST);
glDisable(GL_DITHER);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);

// activate pointer to vertex & texture array
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

My drawing code is being called by a NSTimer every 1/60 s.
Here is the drawing code of my world object:

- (void) draw:(NSRect)rect withTimedDelta:(double)d {
  GLint *t;
  glActiveTexture(GL_TEXTURE0);
  glBindTexture(GL_TEXTURE_2D, [_textureManager textureByName:@"blocks"]);
  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

  for (int x=0; x<[_map getWidth] ; x++) {
    for (int y=0; y<[_map getHeight] ; y++) {
      GLint v[] = {
        16*x ,16*y,
        16*x+16,16*y,
        16*x+16,16*y+16,
        16*x ,16*y+16
      };

      t=[_textureManager getBlockWithNumber:[_map getBlockAtX:x andY:y]];

      glVertexPointer(2, GL_INT, 0, v);
      glTexCoordPointer(2, GL_INT, 0, t);
      glDrawArrays(GL_QUADS, 0, 4);

    }
  }
}

(_textureManager is a Singelton only loading a texture once!)
The object drawing codes is identical (except the nested loops) in terms of OpenGL calls:

- (void) drawWithTimedDelta:(double)d {
  GLint *t;
  GLint v[] = {
    16*xpos ,16*ypos,
    16*xpos+16,16*ypos,
    16*xpos+16,16*ypos+16,
    16*xpos ,16*ypos+16
  };
  glBindTexture(GL_TEXTURE_2D, [_textureManager textureByName:_textureName]);

  t=[_textureManager getBlockWithNumber:12];

  glVertexPointer(2, GL_INT, 0, v);
  glTexCoordPointer(2, GL_INT, 0, t);
  glDrawArrays(GL_QUADS, 0, 4);
}

As soon as my central drawing routine calls the two drawing methods the second call overlays the first one. i would expect the call to world.draw to draw the map and "stamp" the objects upon it. Debugging shows me, that the first call is performed correctly (world is being drawn), but the following call to all objects ONLY draws the objects, the rest of the scene is getting black.

I think i need to blend the drawn textures, but i cant seem to figure out how.

Any help is appreciated.
Thanks

PS: Here is the github link to the project. It may not be in sync of my post here, but for some more in-depth analysis it may help.

sentences:
How to create a game save file format in c++ using STL Hey so i just learned about the i/o part of the STL, more specifically fstream. Although I can now save binary info and classes i've made to the hard drive, i am not sure how to define how the info should be read.

I saw the answer for making a file format from [this][1] post:

  Typically you would define a lot of records/structures, such as
  BITMAPINFOHEADER, and specify in what order they should come, how they
  should be nestled, and you might need to write a lot of indicies and
  look-up tables. Such files consists of a number of records (maybe
  nestled), look-up tables, magic words (indicating structure begin,
  structures end, etc.) and strings in a custom-defined format.

What i want to know specifcally is how to do this with the STL and C++...
Since the format is meant simply for the use of a game i would think it would be much easier though. The format should:

Be traversable (i can look through it and find the start of structure and maybe check it's name
Be able to hold multiple classes and data in a single file
have identifiable starts and ends to sections: such as the space in text files
Maybe have it's own icon to represent it??

How do i do this in c++ ?

sentences:
OOP design, keeping track of entities First, I would like to say that I have no experience with this and am still getting my head around OOP, so if something is really obvious, just point it out :)

I am designing a game and I am not sure of the best OOP design patten to use or if I am going on the right track. I have entities, but I don't know the best way of storing them. I am going to put them in a vector based on what I have seen on GDSE, but am not sure where to put that in my games code. I thought of putting them in a singleton manager class, but have read up on singletons and don't think that it would be wise to use them.

Or could I store entities in a world object? Like here ?

Is a singleton entity manager class fine in this case, or can you point me in the right direction for a different way of managing them.

EDIT: Oops.Even though I did multiple searches only now have I seen this (http://tinyurl.com/kv963nu) Although this seems to tell me to use global variables or singletons..

sentences:
Experiencing strange behavior in Unity when rotating a 2D GameObject according to the slope it is standing on I am trying to rotate a square GameObject, so it appears to be standing perpendicular to the slope underneath it. However, when above a slope, the square constantly "spins"; it seems like the rotation is set and then immediately set back to 0, causing it to jitter.
I am currently using a RayCast based character controller instead of rigidbody. To change the rotation, I added the follow line of code following the vertical RayCast:
if (_raycastHit)
    {
       transform.rotation = Quaternion.FromToRotation(transform.up, _raycastHit.normal) * transform.rotation;

    ...
    }

It calculates and rotates the square correctly, but I am not sure why it resets back to 0 every other frame. To avoid taking up too much space, the character controller I am using is hosted on GitHub here. Specifically, this is in the moveVertically() method.

sentences:
Trying to make pitch black night - some meshes still dimly lit I have a directional light as a "sun". At night, I need a pitch black scene, but a mesh I'm using as terrain somehow stays faintly lit when the light intensity is 0.

At night:

The direction light "sun" is rotated so it's beneath my world.
The sun light is set to black, intensity to 0
I tried setting fog and ambient light color in RenderSettings to black
I tried setting ambient intensity to 0

Notice how the background is lighter than the character. Something is causing that light to remain.

However, if I enter playmode with the light object inactive, the coloring works fine.

sentences:
What is the design rationale behind hard content that's limited to only a couple attempts per week? There is currently a lot of discussion in the World of Warcraft playerbase about a recently added feature: Horrific Visions. Visions are personal areas you can enter alone or with a handful of players and have 5 objectives with increasing difficulty plus additional difficulty options. The details aren't that important, but the core is that these Visions require careful planning of resources and time if you want to progress the harder difficulties, both during the visions themselves and in how you earn the right to complete a Vision. In return for completing these Visions, you can earn increasingly better gear based on difficulty (though repeated gear rewards decline in quality) as well as upgrades for an item you need against the final bosses of the raid that came in the same patch.

Now, usually in games that have really hard content you're supposed to defeat, there is no limit in how many attempts you can do, or the limit is sufficiently high that it makes no real difference. However, this isn't the case in Visions. Visions require you to buy an item to make an attempt, and this item is so costly that even if you log in every day and do all the content that rewards the items you need to buy this item, you can at most earn 4 copies of the item per week. There is also incentive to save these tokens for later weeks because later upgrades require you to complete increasingly more runs, which you can speed up by not using additional tokens in weeks where you don't need them.

This is what many people see as the biggest problem with these Visions. They're hard content, but you have only a couple attempts per week and you need to make them count. So there isn't really a safe way to practise them so you can learn how they work and what the best way to do them is. If you mess up and you don't do enough to earn the upgrade token mentioned above, it's a huge potential loss and you fall behind other players who did manage to complete them.

I'm trying to understand possible design rationale behind this. I don't usually come across this design element in games, and I can't even remember another game with similar design, especially for such a core feature of the content update. in other hard game content, Soulsborne games don't really restrict you in attempts, and Roguelikes actually are built around immediately starting anew when you fail, again without real limitations. AFAIK neither genre really limits you in how often you can try them. And it has been years since Blizzard last put a hard limit on how many attempts you were allowed for the hardest content, especially such a low amount.

What can be potential design rationale behind putting hard content behind a restrictive attempt limit?

sentences:
Add tiles to both sides of TileMap List in MonoGame This is what my tile map looks like (red highlighting added for clarity):

My code:
private List<List<int>> _layoutLayer = new List<List<int>>(50); // Layout Layer
private List<List<int>> _trLayer = new List<List<int>>(50); // Transitional Layer
private List<List<int>> _entityLayer = new List<List<int>>(50); // Object Layer
private List<List<int>> _logicLayer = new List<List<int>>(50); // Logic Layer

// To add a tile
if (inputManager.IsMouseHeld(true))
{
    try
    {
        switch (_currentLayer)
        {
            case LayerRepresentation.LayoutLayer:
                _layoutLayer[_gridMouseY][_gridMouseX] = _currentTile;
                break;
            case LayerRepresentation.TransitionalLayer:
                _trLayer[_gridMouseY][_gridMouseX] = _currentTile;
                break;
            case LayerRepresentation.EntityLayer:
                _entityLayer[_gridMouseY][_gridMouseX] = _currentTile;
                break;
            case LayerRepresentation.LogicLayer:
                _logicLayer[_gridMouseY][_gridMouseX] = _currentTile;
                break;
        }
    }
    catch
    {
         // Player clicked outside of map bounds, add specified amount of tiles to map
    }
}

What I need:
When the player clicks outside of map bounds for example on the point A, add the amount of tiles between point A and the map to the map's height. Do the same with point B, but add to the map width instead.
What I've tried:
    // Inside the above catch block
    if (_mapHeight - _gridMouseY == 0 && _gridMouseX < _mapWidth && _gridMouseX > -1)
    {
        List<int> tempDefaultLayout = new List<int>();
        List<int> tempDefaultOther = new List<int>();

        for (int i = 0; i < _layoutLayer[0].Count; i++)
        {
            tempDefaultLayout.Add(0);
            tempDefaultOther.Add(-1);
        }
        _layoutLayer.Insert(_gridMouseY, tempDefaultLayout);
        _trLayer.Insert(_gridMouseY, tempDefaultOther);
        _entityLayer.Insert(_gridMouseY, tempDefaultOther);
        _logicLayer.Insert(_gridMouseY, tempDefaultOther);
        _mapHeight++;
    }
    else if (_mapWidth - _gridMouseX == 0 && _gridMouseY < _mapHeight && _gridMouseY > -1)
    {
        for (int y = 0; y < _layoutLayer.Count; y++)
        {
            for (int x = 0; x < _layoutLayer[y].Count; x++)
            {
                if (_layoutLayer[y].Count <= _mapWidth)
                {
                    _layoutLayer[y].Add(0);
                    _trLayer[y].Add(-1);
                    _entityLayer[y].Add(-1);
                    _logicLayer[y].Add(-1);
                }
            }
        }
        _mapWidth++;
    }
    return;

The problems:

The first part is about adding tiles to the height (only one row at a time) Adding the temp Lists to the layer Lists with List.Add() doesn't work, I don't know why. I used List.Insert instead.
The second part is used to add a single column to the map one at a time.

Any help would be appreciated.

sentences:
How can an Entity trigger changes to the world in C++? I'm writing a simple physics based game in C++ using SFML. I want to trigger a scene change when my playerCharacter collides with a door. Since C++ does not have any native Event Sender/Listener system, I'm not sure how I should organize my architecture such that entities can trigger events within the world, or within other entities they are not colliding with directly. These are the only ways I can think of;

Entities all have a reference back to the scene/world. This is what I'm doing currently but I keep hearing it's horrible design.

Have the scene/world call methods on the entities to check if they are making changes. This seems like a terrible solution, I would have to check for any possible change.

I integrate a premade C++ Event system. I'm happy to do this, I just want to first make sure there isn't a more simple approach I'm missing.

Interfaces between classes. I keep hearing this a solution, but I don't know how ti really solves anything. If my Entity and Scene objects both have references to the interface, and have to base functionality around that- isn't that just as bad?

Messaging system. This actually seems like a good approach, but I'm not sure if it's intended to be a comprehensive solution. Here it is in detail:
How to implement the interaction between engine parts?

Please let me know if you have any solutions for this specific issue, or perhaps some sort of class diagram that circumvents this issue completely. I've been looking a while and haven't found a solution for this issue. How do the major engines do it?

sentences:
Trying to increase the size of a sprite when it touches a pellet in Unity with C# This is my first game, and I'm trying to keep it simple, so just a simple platformer that works around the size of the player's character, and the character increases in size whenever they consume a pellet. I have the character's basic movement down, but I'm coming across some errors that I'm not so sure how to fix.

The way I have it set up is that I have a script attached to an empty object called 'LevelManager' that will execute actions once it's called upon (Like 'Respawn Player' and 'Grow Player'), there is a 'Pellet' script attached to the pellet that basically calls upon the 'Grow Player' function when the player touches the pellet's collision box.

LevelManager.cs

public class LevelManager : MonoBehaviour {
    public GameObject currentCheckpoint;
    private PlayerController player;

    // Use this for initialization
    void Start () {
        player = FindObjectOfType<PlayerController> ();
    }

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

    }
    public void RespawnPlayer()
    {
        Debug.Log ("Player Has Respawned");
    }
    public void GrowPlayer()
    {
        Debug.Log ("Player Has Grown");
        player.transform.localScale += new Vector2(0.5, 0.5);
    }
}

Pellet.cs

public class Pellet : MonoBehaviour {
    public LevelManager levelManager;

    // Use this for initialization
    void Start () {
        levelManager = FindObjectOfType<LevelManager>();
    }

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

    }
    void OnTiggerEnter2D(Collider2D other)
    {
        if (other.name == "Player")
        {
            levelManager.GrowPlayer();
        }
    }
}

Also, I'm sorry I don't have the exact errors with me, something funky happened with the editor and I'm unable to locate the window for the compile errors anymore, and when the bug report I sent get's responded to, I'll add that in to make this an easier problem to tackle.

sentences:
Is it possible to not pack asset files into archives when building a Unity game? When I build a game in Unity, it packs the assets into strange data files with strange extensions like .split2 or .split1.

But what if I want to give the player the ability to replace textures and modify the game without reverse engineering these files?

I want the Assets folder as I see it in the editor to be accessible with the same files in the build.

sentences:
cocos2d Merging box2d bodies i'm using cocos2d to build an iphone game.

my game currently has two sprites: one for the main character and another for an item i should carry once he gets on him.

the main character and the item are both box2d bodies. i can detect the collision between the two. what is want is to make the item body stick to the main character body when they meet, that way any movement of the main character would also affect the item.

any suggestions on how to implement this?

thanks!

sentences: VR Camera and Hands height Using the Oculus Rift S, I just added OVRCameraRig and LocalAvatar or OVRPlayerController and when I press play I feel like I'm not as high as I want in my vision and hands, I change the position of Y of objets to make it more higher, but it affects to everything, my guardian setup floor goes more high too and it does not match with my floor. What can I do to solve this? What should I change or modify?

sentences:
Left-handed version of the reversed depth projection with infinite far plane Let's say that I have standard left-handed WorldToView and ViewToScreen row-major matrices in the same vein as the DirectX D3DXMatrixPerspectiveLH functions, like so:

EXVector vView = NormalizeVector(LookAt() - m_Position);

float fDotProduct = DotProduct(m_WorldUp, vView);

EXVector vUp = NormalizeVector(m_WorldUp - fDotProduct * vView);

// Generate x basis vector (crossproduct of y&z basis vectors)
EXVector vRight = CrossProduct(vUp, vView);

// Generate the matrix
row0.Set(vRight.x, vUp.x, vView.x, 0);
row1.Set(vRight.y, vUp.y, vView.y, 0);
row2.Set(vRight.z, vUp.z, vView.z, 0);
row3.Set(-DotProduct(m_Position, vRight),
         -DotProduct(m_Position, vUp),
         -DotProduct(m_Position, vView), 1);

EXMatrix mWorldToView(row0, row1, row2, row3);

Here's the left-handed mViewToScreen / projection matrix:

float zNear  =    0.001f;
float zFar   = 1000.000f;
float Aspect = DisplayHeight() / DisplayWidth();

float sinfov, cosfov; qsincosf(VFOV() / 2, sinfov, cosfov);
float cotfov = cosfov / sinfov; // cos(n) / sin(n) = 1/tan(n)

float w = Aspect  * (cotfov);
float h =   1.0f  * (cotfov);
float Q = zFar / (zFar - zNear);
float R = -Q * zNear;

row0.Set(w, 0, 0, 0);
row1.Set(0, h, 0, 0);
row2.Set(0, 0, Q, 1);
row3.Set(0, 0, R, 0);

EXMatrix mViewToScreen(row0, row1, row2, row3);

Many things like map/object culling depend on this fact:

// View to cull matrix
Q = (       zFar + zNear) / (zFar - zNear);
R = (2.0f * zFar * zNear) / (zFar - zNear);

row0.Set(w, 0, 0, 0);
row1.Set(0, h, 0, 0);
row2.Set(0, 0, Q, 1);
row3.Set(0, 0, R, 0);

EXMatrix mViewToCull(row0, row1, row2, row3);

Does anyone know how to derive the infamous "reverse depth with infinite far plane" from the original blog post for mViewToScreen and mViewToCull? Every single reference I have found (nlguillemot and nVidia, for example) is in the right-handed space.

Normally I am able to figure things out visually, but 4D matrices are a headache.

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: Do Google/Apple provide the multiplayer servers for an app themselves? I have an app that I have been working on and I was wondering does Google/Apple host the server requirements for the multiplayer aspects of an app?

sentences:
How to make a scrollbar? I am making my own UI for my game, no libraries used, basic UI with simple controls and I am almost done. Now, let's say I need to display lots of information, controls or items which obviously won't fit in the screen space. I must use a scroll bar to achieve this task. But how does one make a scroll bar?

I just don't understand how to do it. The concept for vertical and horizontal scrollbars is the same. Virtually there is a huge plain with data, but we can only display cut of it all in a such by such screen space. We use scrollbars to move that viewable rectangle across our giant plain. The scrollbar itself is a displayed line/texture/sprite on the side of the screen which has a button inside that we can interact with by moving it across the scrollbar. The button is dynamic, its size is relative to total item count and possible item count that can be shown in given space. Our button shrinks when there are more items added, expands when items are getting removed and the whole scrollbar disappears when all the items can be successfully displayed at once.

I can't seem to find online tutorials on this matter. Perhaps it's so basic for everyone except me? Still can't wrap my head around it...

sentences:
trying to get an int grid of values from unity tilemap I'm trying to get a 2 dimensional grid of values from a tilemap and found this which seems to do the trick:

_tileMap = gameObject.GetComponent<Tilemap>();

foreach (var position in _tileMap.cellBounds.allPositionsWithin)
{
    Debug.Log(gameObject.name + ": " + position);
    // TileBase tile = _tileMap.GetTile(position);
    // if(tile.name != null) Debug.Log(tile.name);
}

However, something strange happens as it produces two values, when I only have one tile on the tilemap and when I uncomment my .name log above it only works for the second value and errors for the first.

Any help of the best way of finding values from tilemaps would be great.

sentences:
How to read neighbor pixels in GLSL? I'm using SFML 2.1, it's much more straightforward for me so I can jump directly to learning the shading language.

I'm trying to do something similar to conway's game of life. I already learned that I will need to use 2 textures since I need to read and write at the same time.

My questions:

How do I read neighbor pixels ? Do I need to pass a vec2 from the vertex shader to the fragment shader like this ? :

vertex shader:

out vec2 pixelpos;
void main(){
    pixelpos = gl_Position;
}

fragment shader:

in sampler2d mytexture;
in vec2 pixelpos;
void main(){
    if(mytexture[pixelpos.x][pixelpos.y].r > 0.5)
    {}
}

How do I write to a texture ?

sentences:
Connecting 3d corridors created by procedural generation? The 2d case is simple. You generate the segments. You find the intersections. Then you can easily outline the shape of the connecting joint in the 2d embedded graph.

However, in 3d or n-d with a whole new variety of directions (corridors from above and bellow), it is more complicated and I'd like to hear some advice.
The corridors themselves are simple. The challenge is the "connecting room" between them (you can imagine that room as convex hull of the red in blue dots). This is the goal here.

One way to overcome this, is using voxels and then leaving only the exterior of the connected corridors. This is not optimal however. Is there any simply way to generate the room in the center without complex binary operations?

sentences: frustum culling and exporting a big scene model Let's assume that I created in Blender a race track with landscape. I can export it to single wavefront obj file and then load in my graphics engine using assimp but it doesn't allow to use frustum culling. Should I split such big scene too seperate objects or some model formats allow to split object within single file. How graphics engines load such big scenes ? Do you know some useful techniques/articles ?

sentences:
Basic Moving/Anim Script [Unity CSharp] So, I got this to do the anims for my sprite in Unity 2d...

using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour {
public float Speed = 2;
Animator anim;
// Use this for initialization
void Start () {
    anim = GetComponent<Animator>();
}

void FixedUpdate () {
    rigidbody2D.velocity = new Vector2(Input.GetAxis("Horizontal") * Speed, 0);
    anim.SetFloat("HorizontalSpeed", Mathf.Abs(rigidbody2D.velocity.x));

if(transform.localScale.x > 0 && rigidbody2D.velocity.x  < 0)
    transform.localScale = new Vector3(-1, 1, 1);

if(transform.localScale.x < 0 && rigidbody2D.velocity.x > 0)
    transform.localScale = new Vector3(1, 1, 1);

}
}

That works fine... then I add the script so he can move up and down. (the previous was moving left+right)

using UnityEngine;
using System.Collections;

public class UpMove : MonoBehaviour {
public float VerticalSpeed = 2;
Animator anim;
// Use this for initialization
void Start () {
    anim = GetComponent<Animator>();
}

void FixedUpdate () {
    rigidbody2D.velocity = new Vector2(Input.GetAxis("Vertical") * VerticalSpeed, 0);
    anim.SetFloat("VerticalSpeed", Mathf.Abs(rigidbody2D.velocity.y));
}
}

Welll.. The second script doesn't do anything.
I've been working at this (rookie noobness) for around an hour now.. so pls pls pls.

sentences:
How do I get an NPC to follow the player(and stop when it gets within range) I'm making a game where you have a friend follow you. I have a script that partly works, but when the friend exits the trigger, it won't follow the player.

How do I get the friend to follow the player once indefinitely, or until it hits the trigger again?

Here is the script:

public Transform friend;
private int movespeed;

public int speed;
public Rigidbody rb;

// Use this for initialization
void Start()
{
    speedup();
}

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

    transform.LookAt(freind);
    Vector3 eulerAngles = transform.rotation.eulerAngles;
    eulerAngles.x = 0;
    eulerAngles.z = 0;
    transform.rotation = Quaternion.Euler(eulerAngles);

    rb.AddRelativeForce(0, 0, movespeed);

}

public void OnTriggerStay(Collider other)
{

    if (other.tag == "Player")
    {
        movespeed = 0;
    }
    else
    {
        speedup();
    }
}

public void speedup()
{
    movespeed = speed;
}

sentences:
Procedural generation of stars in the background with given random seed I want to generate stars (actually a 2d vector) in the background. The player is moving left and right endlessly. When the player moves the stars, which aren't in sight anymore, should be deleted from the ArrayList to keep things small. But when the player turns back in the other direction again, the same star(coordinate) should be there again. But the random generator gets a different number, which is normal. How can I do something like lastInt() like I do with nextInt() ? Or what is the proper way to do something like this?
Thank you very much.

sentences:
How to make character gain acceleration? I want to create more realistic physics for my 2D games.

Currently, the character and the other game objects in my games start moving instantly (achieve maximum speed instantly) and stop instantly (achieve 0 speed instantly).

There is no transition between speed levels - resting and moving, moving and resting.

I heard about 'steering behaviors', but am pretty sure they're mostly for designing AI agents' movements.

Should I learn steering behaviors to make more realistic character movements in general? (In the physics-aspect). Is this the way to go?

If the answer is 'yes', could you recommend a good source to learn them?

sentences:
How should I structure an extensible asset loading system? For a hobby game engine in Java, I want to code a simple but flexible asset/resource manager. Assets are sounds, images, animation, models, textures, et cetera. After a few hours of browsing and some code experiments I'm still not sure how to design this thing.

Specifically, I'm looking for how I can design the manager in a way so that it abstracts away how specific asset types are loaded and where assets are being loaded from. I would like to be able to support both file system and RDBMS storage without the rest of the program needing to know about it. Similarly, I would like to add an animation description asset (FPS, frames to render, reference to the sprite image, et cetera) that's XML. I should be able to write a class for this with the functionality to find and read an XML file and create and return an AnimationAsset class with that information. I'm looking for a data-driven design.

I can find a lot of information on what an asset manager should do, but not on how to do it. The generics involved seem to result in some form of cascading of classes, or some form of helper classes. However I haven't seen a clear example that didn't look like a personal hack, or a point of consensus.

sentences:
How do I get the player to collide with another object to use as a boundary? I'm trying to make a simple game where you move a sphere from left/right and try to avoid falling cubes. If a cube touches the player (sphere), the player dies. I'm trying to set up boundaries using a cylinder with a collider, but every time I hit the collider boundary, the player disappears like they would if they hit a cube. Here is my player script:

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

public class Move : MonoBehaviour
{
public float moveSpeed = 1;

// Start is called before the first frame update
void Start()
{

}

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

    transform.position += new Vector3(Input.GetAxis("Horizontal") * moveSpeed, 0, 0);
}

void OnCollisionEnter(Collision collision)
{
    if (collision.gameObject.tag == "Cube")
    {
        Destroy(collision.gameObject);
        Destroy(gameObject);
    }
}

}

sentences: How to give node sillouhette when behind wall in Godot I am working on a boss-rush fps game. I want it to be like the eye of cthulu fight from terraria, with the enemy flying towards you and then turning around to try again if it misses. However, in order for that to work, the enemy must be visible when they are under the ground. How could I accomplish this?

sentences:
Best Practices for Locating Clicks I am building a 2D board game in Unity with a static camera pointed down at the game board. During the active phase of each player's turn, I want to detect where they click on the board. Fortunately, the board is laid out in an easy rectangular grid. (Essentially a trio of 5x5 grids).
Which of the following would be best practice to implement this?

Create invisible colliders for every square on the board and create a translation function that translates those back to board positions (5,3) with Raytracing?

Get the translated coordinates of the click and use a function to figure out which square (if any) the click is in using the mouseclick event handler (by calculating which square the grid coordinates fall in)?

Make each square a button with its grid identity encoded and use that in its OnPressed function?

Edit: 4) Some other idea I haven't thought of yet?
Experience level: I'm just learning Unity, but have written a lot of C# (and tons of other code).

sentences:
Mouse input position is being printed as Unity coordinates, but the actual coordinates used seem incorrect This will be hard to explain, but I'll try to keep it short and simple:

I'm trying to set the position of a UI rectangle to the position of the mouse when clicked. When initialized, the position of the rectangle works fine (if, during Awake(), I initially set it so that x = 100 and y = 100 and then check the Rect Transform component during run time, Pos X and Pos Y are both set to 100 as intended). However, if I use the X and Y coordinates of Input.mousePosition, Pos X and Pos Y are given strange numbers that I have no clue where they're coming from.

I don't think they're pixel coordinates because the value for Pos X of the rectangle when my mouse clicks at the farthest left possible during run time is a value over 300 when it should be 0, and that value goes up as I progressively click rightwards.

Now here's the strange bit. When I try to use print() to print the mouse position x and y values that I use to set the rectangle's position, they're printed as intended (clicking the bottom left of the game area yields x = 0 and y = 0) yet the rectangle's position is far from close the values printed (rectangle's position is x = 337.5 and y = 192.5).

Can someone please explain why this happens, and how I can fix it? I suppose I can manually fix it by subtracting the new position values by 337.5 for x and 162.5, but it feels too brute-force-ish and there's bound to be consequences down the line.

Here is a screenshot to help clarify my issue: http://i.imgur.com/ivSmhKe.png

sentences:
Find angle to a point I'm trying to find the angle between a point and the left side of my camera's fov.

In the picture below the camera (Red dot) is looking towards a polygon (Green) with the fov of the camera represented as the blue lines.

I've tried to butcher some code together from my limited understanding of linear so I havent gotten far. I've tried atan2 as well, but it seems to give incorrect answers for what im looking for.

the info i have is:

the point(x,y) I'm evaluating
the camera(x,y)
line segment and angle representing the left side of the cameras fov
same for the right

How would i find the angle between the left angle and the point?
I'm going to use the calculation to find the angle to each of the points making up the polygon.

Below is a rough mock up ive been using to try to figure this out
the blue angle with the question mark is what im looking for

sentences:
How to apply a shader to only one side of an object in Unity3D So I have this rather simple surface shader that essentially cuts a hole in the object based on another texture.

Shader "Custom/NewSurfaceShader" {
    Properties {
        _MainTex("Texture (RGB)", 2D) = "white" {}
    _SliceGuide("Slice Guide (RGB)", 2D) = "white" {}
    _SliceAmount("Slice Amount", Range(0.0, 1.0)) = 0.5
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        Cull OFF
        CGPROGRAM

#pragma surface surf Lambert addshadow
        struct Input {
        float2 uv_MainTex;
        float2 uv_SliceGuide;
        float _SliceAmount;
    };
    sampler2D _MainTex;
    sampler2D _SliceGuide;
    float _SliceAmount;

    void surf(Input IN, inout SurfaceOutput o) {

        clip(tex2D(_SliceGuide, IN.uv_SliceGuide).rgb - _SliceAmount);
        o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb;
    }
    ENDCG
    }
        Fallback "Diffuse"
}

This produces the following effect.

Now as cool as this looks I want to only apply it to, let's say, one side of the cube and its opposite side. Any suggestions on how do I go about doing this will be appreciated.

sentences:
glDrawElements draws nothing As the title says…. :( nothing is drawn on screen… is there something I'm missing?

Mesh *Mesh_Create(GLfloat vertices[], GLuint indices[], GLfloat uvs[], GLfloat colors[])
{

Mesh *mesh = (Mesh*)malloc(sizeof(Mesh));

mesh->vertices = (GLfloat*)malloc(sizeof(vertices));
memcpy(mesh->vertices, vertices, sizeof(vertices));

mesh->indices = (GLuint*)malloc(sizeof(indices));
memcpy(mesh->indices, indices, sizeof(indices));

mesh->elementCount = sizeof(indices) / sizeof(GLuint);

glGenVertexArrays(1, &mesh->vao);
glBindVertexArray(mesh->vao);

glGenBuffers(1, &mesh->vbo[VERTEXBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[VERTEXBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(mesh->vertices), &mesh->vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(0);

/*glGenBuffers(1, &mesh->vbo[TEXTUREBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[TEXTUREBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(uvs), uvs, GL_STATIC_DRAW);
glVertexAttribPointer(1, 2, GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(1);
*/
glGenBuffers(1, &mesh->vbo[INDICESBUFFER]);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->vbo[INDICESBUFFER]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(mesh->indices), &mesh->indices, GL_STATIC_DRAW);

/*glGenBuffers(1, &mesh->vbo[COLORBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[COLORBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(colors), colors, GL_STATIC_DRAW);
glVertexAttribPointer(3, 4, GL_FLOAT, false, 4 * sizeof(GLfloat), NULL);
glEnableVertexAttribArray(3);*/

/*glBindVertexArray(0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);*/

return mesh;
}

Mesh *Mesh_CreateQuad()
{

GLfloat vertices[] = { -0.5,  -0.5,
                        0.5,  -0.5,
                        0.5,   0.5,
                       -0.5,   0.5 };

GLuint indices[] = { 0,1,2,
                      0,2,3 };

GLfloat uvs[] = {   0 , 1,
                    1,  1,
                    1,  0,
                    0,  0 };

GLfloat colors[] = {    1, 1, 1, 1,
                        1, 1, 1, 1,
                        1, 1, 1, 1,
                        1, 1, 1, 1 };

return Mesh_Create(vertices, indices, uvs, colors);
}

void Mesh_Render(Mesh *mesh)
{
    glBindVertexArray(mesh->vao);
    glDrawElements(GL_TRIANGLES, mesh->elementCount, GL_UNSIGNED_INT, &mesh->indices);
}

sentences:
Unity Editor: Get Mouse coordinates on left click on Scene Editor I need a simple script which does the following:

When I left-click somewhere in the Editor-Scene:

(doesnt matter if there is an object under the cursor- or not)

Do NOT deselect the current selection in the Inspector.
Do not select the object under the cursor.
and

Just print the mouse X and Z interception with the Y-Plane in the Debug.Log();

i stumbled on many solutions but somehow i couldnt get this to work.

i tried:

HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));

and

Tools.current = Tool.None;

both seem to do nothing ..... X.x

EDIT:

Happens that
"HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));"
needs to be inside:
public void OnSceneGUI()
and called every frame - to "block" the mouse clicks on the editor.
i thought it toggles it off.

still the problem of the mouse coordinates persists.

sentences:
What can make a peaceful game successful? Today, the most successful games are action games like FPS, RPG, MMORPG...

I'd like to make a peaceful game, but I don't know how to attract people. I can make good graphics, but that's not the main thing that makes people like a game for more than a couple of minutes. The content is important. In the game styles mentioned earlier, their main content is fighting, killing others, and generally making yourself the most powerful player in the game.

But what content can attract people in a peaceful game?

sentences:
In unity, how do I rotate a vector in relation to the player? I am making a radar script in a unity FPS game project I am making for class. I already have a working example of a radar script that works in relation to the player's position. However the rotation is in relation within the world map, not the player's view.

In code I have it kinda like this (not actually my code, as I don't have it with me right now, but basically the same algorithm)

if (isPlayerInViewRange(otherPlayer[i]){
    //these are both normalized Vector
    dir = getDirectionFromPosition(player, otherPlayer);
    dir = rotateDirectionInRelationshipToPlayer(player, dir); //problem here
    dir = new Vector3(dir.x, dir.z, 0);

    dir.Scale(MapToRadarPosition, 0, MapToRadarPosition);
    radarDot[i] = dir;
    radarDot[i].setActive(true);
} else {
    radarDot[i].setActive(false);
}

Any ideas what I am missing, I feel like I am missing some obvious function to do it.

sentences:
Difference between _process(delta) and _physics_process(delta)? The documentation is pointing one main difference, this is the concept of being synced or not with the physics engine, so the delta parameter has more chance to be constant in _physics_process(delta) than in _process(delta).
But I am pretty sure that no one counts on that. And that everybody checks the value of delta in _physics_process(delta).
So what are the different use cases of those two functions?

sentences:
Choppy enemy movement I had a question about How to calculate the enemy to arrive in the middle of cell.

How to calculate the enemy to arrive in the middle of cell?

The posters pointed out that the direction of the enemy isn't needed because the velocity already has a direction. I modified the code -

if(position.x < start.position.x) {
            velocity.x = ENEMY_VELOCITY;
        }
        else if(position.x > start.position.x){
            velocity.x = -ENEMY_VELOCITY;
        }
        else {
            velocity.x = 0;
        }

        if(position.y < start.position.y) {
            velocity.y = ENEMY_VELOCITY;
        }
        else if(position.y > start.position.y){
            velocity.y = -ENEMY_VELOCITY;
        }
        else {
            velocity.y = 0;
        }
        position.add(velocity.x * deltaTime, velocity.y * deltaTime);

The enemy's movements were choppy after it go around the tower I added the range of the middle of a cell but it looks like it'll stop in certain places.

public void plotPath(Cell start, float deltaTime) {

        if(position.x < start.position.x && Math.abs((start.position.x - position.x)) > 0.01f) {
            velocity.x = ENEMY_VELOCITY;
        }
        else if(position.x > start.position.x && Math.abs((position.x - start.position.x)) > 0.01f){
            velocity.x = -ENEMY_VELOCITY;
        }
        else {
            velocity.x = 0;
        }

        if(position.y < start.position.y && Math.abs((start.position.x - position.x)) > 0.01f) {
            velocity.y = ENEMY_VELOCITY;
        }
        else if(position.y > start.position.y && Math.abs((position.y - start.position.y)) > 0.01f){
            velocity.y = -ENEMY_VELOCITY;
        }
        else {
            velocity.y = 0;
        }
        position.add(velocity.x * deltaTime, velocity.y * deltaTime);
    }

I think Math.abs((position.y - start.position.y)) is a wrong way to calculate. I tried to fix 0.1f to different value, but it'll stop somewhere after passing the tower or having choppy movements, it's much less than before.

sentences:
Is Quadtree Terrain Decimation applicable today? It all started from that page.
https://www.gamasutra.com/view/feature/131841/continuous_lod_terrain_meshing_.php?print=1

I didn't quite got what it was all about, so I've looked at this.
https://www.researchgate.net/publication/3410916_Terrain_decimation_through_Quadtree_Morphing

Then I've got some understanding. It was about decimating the more distant patches of the terrain.
And then I've just wondered about one thing. At every frame, the mesh is re-generated and re-uploaded. Wouldn't it be kinda of slow?

Ran the demo provided in the first link and got just 3 fps. What's the big idea of this "optimization"?

My current code has 1048576 vertices for 1024x1024 heightmap, undecimated, and it runs way faster. His code makes my laptop hot.

Another link.
Quadtree vs multiple resolution grids for terrain rendering

That is more useful. It turns out that there might be some mipmapped meshes on the GPU, and the quadtree decides which of them are turned on.

The first question. Is my last guess correct?
Second - am I right the first link isn't useful anymore?
Third - how this applies to modern Android development (I mean at least GLESv2).

sentences:
Entity position: In map or in script? I'd like to know how others have handled the issue of storing the entity's position. (Or maybe it's not an issue and I just make it too complicated.)

I'm undecided on whether to store the position of each entity in the world map file or in the entity's script file. From what I figured, both approaches have their own good and bad points:

If you store the entity's position in the map:

Good: Easier to edit the map; you can see where the entity will be. Maybe this isn't a problem for integrated map editors, but I'm using an external, general-purpose map editor (GLEED2D).
Bad: Inside the game it's easier to handle data if the position is inside the entity object, not the map object. So when you load the game, you have to gather data from a lot of places to build your entity object.

On the other hand, if you store the position inside the entity script, the advantages and disadvantages are exactly the opposite of the above.

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 methods can be used to rotate a tiled structure? I'm trying to rotate some structures that are locked on a grid-like structure. This means I'm looking for lossless ways to rotate the tiles. Maintaining proper distances are not important, I'm aware that diagonals will be longer if we maintain the same number of filled tiles.

Here's a few examples of what I want to do (done by hand, so might be slightly off), where the red block is the front:

On the left are the four cardinal directions, which are East(0°/0.0π rad), North(90°/0.5π rad), West(180°/1.0π rad) and South(270°/1.5π rad).

On the right there's ~22.5° in the top and 315° in the bottom.

Right now I'm looking mostly to do rotations in ~22.5° increments, so a full circle in 16 steps, but a general solution for the problem would be great.

sentences:
Discovering path through unknown territory Let's say all the AI knows about it's surroundings is a pixel-map that it has which clearly shows walkable terrain and obstacles. I want the AI to be able to traverse this terrain until it finds an exit point.

There are some restrictions:

There is always a way to the exit in the entire map that the AI walks around in, but there may be dead ends. The path to the exit is always pretty random, meaning that if you stand at crossroads, nothing indicates which direction would be the right one to go.
It doesn't matter if the AI reaches a dead end, but it has to be able walk back out of it to a previously not inspected location and continue its search there.
Initially, the AI starts out knowing only the starting area of the whole map. As it walks around, new points will be added to the pixel-map as the AI corresponding to the AIs range of sight (think of it like the AI is clearing the fog of war)
The problem is in 2D space. All I have is the pixel map.
There are no paths in the pixel map which are "too narrow". The AI fits through everything.
The AI does not know where the endpoint is (it is hidden in the map)
The AI traverses the terrain in real time
It shouldn't be a brute force solution. E.g. it would be possible to simply find a path to each pixel in the pixel map that is yet undiscovered (with A*, for example), which will lead to the AI discovering new pixels. This could be repeated until the end is reached.
The path doesn't have to be the shortest path (this is impossible without knowing the entire map beforehand), but when movements within the visible area are calculated, the shortest and from a human standpoint most logical path should be taken (e.g. if you can see a way out of your room into a hallway, you would obviously go there instead of exploring the corner of your current room).

What kind of approaches to solve this problem are there?

sentences:
Incorrect Model Position (XNA) I am new at XNA, i have started it about a week earlier but i have 3d experience in WPF.

Scenario:
I have a room in which i have a object(for now it is a cube). The objects are generated in Max 2011 in the designers computer which i import into mine using fbx importer.

Problem:
1. The model are not positioned as per the max files, and also there are losses in the models.

In Max: http://i.imgur.com/iNJGTh.png
In XNA: http://i.imgur.com/ZXoU8.png

Could anyone suggest me how to resolve this problem?

Is there a dynamic way to get the camera position information from the "FBX" file that i exported from 3Ds Max?

sentences:
Check if point is inside convex hull I first tried with a simple axis aligned bounding box to test my algorithm (later shape will be different but always convex 6 faces), but even this case did not work, it always tells me that the point is not inside:

                BoundingBox bb = new BoundingBox(-new Vector3(.5f), new Vector3(.5f));

                var corners = bb.GetCorners();

                bool liesInside = true;
                for (int cornerIndex = 0; cornerIndex < 6; cornerIndex++)
                {
                    Plane plane = new Plane(corners[cornerIndex], corners[cornerIndex + 1], corners[cornerIndex + 2]);
                    if (plane.DotCoordinate(rayPos) > 0)
                    {
                        liesInside = false;
                        break;
                    }
                }

sentences:
Changing alignment within a vertical layout group I have a vertical layout group that has text bubbles instantiated into it.
Instantiating them always aligns them to "lower middle".
However, I'd like to have them on opposite sides for a message app effect.

Right now, I'm changing the anchoredPositions of each instantiated UI object in Update. Is there any better way of doing this?

sentences:
Pathfinding in Isometric Phaser with Tunnels I want to create a 2D isometric game. Currently I'm looking and testing Phaser game engine with isometric plugin. Almost everything at the moment looks possible except few things. I will create a bridge/tunnel in my map so entities could go through tunnel and on the bridge. The simplest implementation of this simulation will be enough.

What kind of trickery I have to use to implement pathfinding algorithm in this situation? And is this event possible in 2D isometric games? What are your suggestions about this type of game overall and my problem?

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 should I replan A*? I've got a pathfinding boss enemy that seeks the player using the A* algorithm.  It's a pretty complex environment, and I'm doing it in Flash, so the search can get a bit slow when it's searching over long distances.  If the player was stationary, I could just search once, but at the moment I'm searching every frame.  This takes long enough that my framerate is suffering.

What's the usual solution to this?  Is there a way to "replan" A* without redoing the entire search?  Should I just search a little less often (every half-second or second) and accept that there will be a little inaccuracy in the path?

sentences:
Getting the bounding box of a sphere I have a sphere with values center,radius and I need to convert the sphere to a bounding box with values min,max.

How do I convert a sphere into a bounding box?

sentences:
Negamax for turn based game I am working on a fast paced turn based game, each turn the player can move left, right or stay put and choose whether or not to fire. Each turn the shots move one block in the direction they are pointing.

I would like to implement NegaMax on this game for curiosity's sake.

Could anyone recommend a brilliant tutorial they tried and found satisfactory?

Thanks

sentences:
change direction navmesh agent on collision encounter I have one player and many enemies. The enemies are following my player through the navigation mesh. Sometimes enemies get stuck because there is another enemy in-front of them. You can say both are in line.

Is it possible that when one enemy collides with other enemy in-front of it to change direction so that it avoids colliding with one another?

sentences:
glOrtho setting view I am duplicating this thread from stackoverflow, please remove it if that is not allowed.

I'm completely new in OpenGL. I have this problem: I have quite a complicated scene, and I am looking at it from the front (default camera position). The way I have seen to move the camera is using the gluLookAt() function to set the point you want to look at, and glTranslate3f() to move the camera position. I need to move the camera with different data - my data is not the point I want to look at - rather, I have the data of the projection plane - determined with a viewing vector and a point in the plane. Is there a way to set the camera using this data rather than a "look at" point?

I am using an ortographic projection (glOrtho()), so everything is projected onto the projection plane.

UPDATE: To be more precise: the point I have is a point in the plane, to which I want to project to. I have in fact not only the plane, but the square to which I need to project, defined. So I have a scene somewhere a space, and a square somewhere away from that scene. I want to project the scene to that square and show that projection on screen. I hope that made it a bit clearer what I need to achieve ... While gluLookAt defines a point in the scene at which to look at, and the position of the eye. While eye is one point in space and projection offers perspective, with ortographic projection, you do not have one point, you have a whole square on which to project to, so how can I define that?

For easier understanding what I am trying to achieve. Here is the image of what glOrtho normally does:

Here is an image of what I am trying to achieve:

sentences:
Unity multyplayer change player prefab on scene change How do you change player prefab with mirror network? I have tried this but its not working, atleast not on switching scenes.
My current code is:
 public void switchScene()
    {
        ServerChangeScene(gameScene);
    }

    public override void OnServerSceneChanged(string sceneName)
    {
        foreach (NetworkConnectionToClient conn in NetworkServer.connections.Values)
        {
            GameObject obj = conn.identity.gameObject;

            NetworkServer.ReplacePlayerForConnection(conn, Instantiate(shipPrefab));

            NetworkServer.Destroy(obj);
        }
    }

I have also tried OnClientSceneChanges but i always keep getting the same error:
MissingReferenceException: The object of type 'NetworkIdentity' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
LobbyManager.OnServerSceneChanged (System.String sceneName) (at Assets/LobbyManager.cs:56)
Mirror.NetworkManager.FinishLoadSceneHost () (at Assets/Mirror/Runtime/NetworkManager.cs:1011)
Mirror.NetworkManager.FinishLoadScene () (at Assets/Mirror/Runtime/NetworkManager.cs:953)
Mirror.NetworkManager.UpdateScene () (at Assets/Mirror/Runtime/NetworkManager.cs:936)
Mirror.NetworkManager.LateUpdate () (at Assets/Mirror/Runtime/NetworkManager.cs:274)

Running around in the source code of mirror shows, that at somepoint the existing prefab is destroyed and then recreated once new scene has loaded. But i want the new scene to have a new player prefab. How or when can i change the player prefab for connection?
And trying to switch character without scene change also gives error.
public void ChangeCharacter()
    {
            GameObject obj = NetworkClient.connection.identity.gameObject;

            NetworkServer.ReplacePlayerForConnection(NetworkClient.connection, Instantiate(shipPrefab));

            NetworkServer.Destroy(obj);

    }

Error
InvalidCastException: Specified cast is not valid.
Mirror.NetworkIdentity.SetClientOwner (Mirror.NetworkConnection conn) (at Assets/Mirror/Runtime/NetworkIdentity.cs:362)
Mirror.NetworkServer.InternalReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:837)
Mirror.NetworkServer.ReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:697)
LobbyManager.ChangeCharacter () (at Assets/LobbyManager.cs:56)
UnityEngine.Events.InvokableCall.Invoke () (at <e8645a79b0794e0e9a2b5bbff081b88a>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <e8645a79b0794e0e9a2b5bbff081b88a>:0)
UnityEngine.UI.Button.Press () (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376)

sentences:
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:
How should I handle animation states in Mecanim? I did a tutorial which associated an integer to each state and manually set transitions from one state to another based on that integer, but that seems really sloppy.

Is there a more elegant way? I want to be able to change animations from code.

sentences:
What is the best type of c# timer to use with a Unity game that uses many timers simultaneously? I am developing a stand-alone 3d game in Unity that will have anywhere from 1 to 200 timers running simultaneously. There will be a GameObject containing 1 timer. For this game timer durations will range from 5 minutes to 4 days. There will not be any countdown displays or any UI for the timers.

Each object is a prefab, with all the necessary materials included. An attached script will handle the timer and all the necessary code to change the materials and make any sound effects. Once the timer is expired, the user will then click on the object again, and the object will be destroyed, and the user's inventory will be adjusted.

If the user wants to save or end the game before all the timers are done, the start value of the still running timers is to be saved to an XML file such that when the game is started again, any still running timers will be checked to see if they have expired, where the object's materials will be changed appropriately.

I am still trying to figure out what type of timer to use, and see also if there are any suggestions for saving and calculating times over several days.

What class(es) of timers should I use?
Are there any special issues I should look out for in terms of performance?

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:
Frustum culling with a single large object I am helping to optimize performance in a mobile game. The artists who built a particular scene added a wall around the scene. The wall is a single mesh with 100k triangles. Because it goes around the entire scene, at least some of the wall is visible from all angles and is always being rendered.

While running the game in the Editor with the Statistics panel enabled, I can see that hiding the GameObject containing the wall always reduces the current number of tris by 100k regardless of how much of the wall is actually visible. Does this mean that the entire wall is always getting rendered, rather than only the triangles that are actually in front of the camera?

Obviously the artists need to reduce the overall polygon count of the wall, but I'm wondering if they should also break it into several separate pieces so that the entire wall doesn't need to be rendered at once.

sentences:
How to find optimal perpendicular axis of rotation vector to draw arrows? I am drawing lines on the screen. Each line has a point (x,y,z) and a direction (u,v,w). I want to draw arrow heads on these lines, like two lines that start from (x,y,z) and leave at a 15 degree angle.

I know how to draw these arrow head lines. I do this by rotating (u,v,w) by 15 degrees on some axis of rotation which is perpendicular to (u,v,w). The problem is the axis of rotation I am using is not making all my graphs look good.

Basically I'm given a unit vector (u,v,w). If |w|=1, then u and v are 0 and I just use (1,0,0) which is a unit vector and perpendicular to (u,v,w).

If that is not the case, then I use (v, -u, 0) which is not a unit vector but is perpendicular. Then I normalize it. The norm won't be 0, since |w| < 1 which means u^2 + v^2 != 0.

This gives ok results. But some tests, the arrow head lines look a bit messed up, or not even looking like a 15 degree angle from the main line.

Does anyone know a good way to find a good perpendicular unit vector to (u,v,w) so the results will always look good?

Thanks

sentences:
Store values or calculate values We're talking about fairly anal levels of optimisation here that I wouldn't really worry about in anything other than mobile games. Let's say for example you were drawing a texture to the screen in a fairly constant position and the position of that texture could easily be calculated or stored.

I'd be interested to know what professional game developers default to in the first instance when writing code. Which of the two options below would to achieve higher performance in a majority of situations. My main development language is Java.

So option 1 is something like:

constructor {
  x = container.left + offset.x;
  y = container.bottom + offset.y;
}

paint {
  draw(texture, x, y);
}

And option 2 is something like

paint {
  draw(texture, container.left + offset.x, container.bottom + offset.y);
}

With option one the advantage is obviously that the values are pre-calculated. The disadvantages being you're using more RAM and as such there's an increased risk that the data you need wont be in the CPU cache. You also need to make sure the position is recalculated every time there's any movement.

With option two less RAM is used and therefore it's more likely data will be in the CPU cache, but there's the overhead of the calculation. We also don't need to worry about recalculation when there's movement.

sentences:
passing a class type as a parameter I have a setup in my game engine where I can add behavours to game objects. All behaviours are based on the class AbstractBehaviour. To easily get access to behaviours from a game object, I am trying to mimic unity's getComponentOfType<type>().

Now for the question:
how can I pass a class type as a parameter to my GetBehaviourOfType() function?

What I am trying to achieve in code:

AbstractBehaviour* GameObject::GetBehaviourOfType(typeid type)
{
    for (int i = 0; i < _behaviours->size(); i++)
    {
        if (dynamic_cast<type>(_behaviours[i]) != NULL)
        {
            return _behaviours[i];
        }
    }
}

Where _behaviours is a vector of abstract behaviours.

sentences:
Help Needed with Shaders Ok, bear with me, I am a beginner with Google Cardboard programming.
What I have been doing is looking at the TreasureHunter sample app from Google's page and (with the help of documentation and other sources) have been trying to create a simple cube floating in space.
 I have also been trying to avoid making everything as bare bones as the sample, so I have been trying to object orient things such as lights and the meshes.

I am pretty sure that my matrices and methods are correct, but I think there could be something wrong with my shaders.

When I compile the app and install it, no errors are thrown, but I am given just my white screen (set with glClearColor) with the Cardboard binocular UI/view; no cube is rendered, tilting/looking around has no effect.

I am using the colors, verticies, and normals from the Treasure Hunter sample, so those should be correct.

Full source code (Java) is here.

uniform mat4 u_Model; // model position in world space
uniform mat4 u_MVP;  // model in projection space
uniform mat4 u_MVMatrix; // model in view space
uniform vec3 u_LightPos; // Light position in eye/camera space (projection space)

attribute vec4 a_Position; // vertex in local space
attribute vec4 a_Color; //Vertex colors
attribute vec3 a_Normal; //vertex normal

varying vec4 v_Color; // color
varying vec3 v_Grid;
varying vec3 v_Normal;
varying vec3 v_Position;

void main() {
   v_Grid = vec3(u_Model * a_Position);
   v_Normal = vec3(u_MVMatrix * vec4(a_Normal, 0.0));
   v_Position = vec3(u_MVMatrix * a_Position);
   vec3 modelViewVertex = vec3(u_MVMatrix * a_Position); //Vertex position in view space
   vec3 modelViewNormal = vec3(u_MVMatrix * vec4(a_Normal, 0.0)); //Normal in view space

   float distance = distance(u_LightPos, modelViewVertex);
   vec3 lightVector = normalize(u_LightPos - modelViewVertex);
   float diffuse = max(dot(modelViewNormal, lightVector), 0.5);

   diffuse = diffuse * 1.0/(distance * distance);
   v_Color = a_Color * diffuse;
   gl_Position = u_MVP * a_Position;
}

My vertex shader:

My fragment shader:

precision mediump float;

varying vec4 v_Color;

void main()
{
    gl_FragColor = v_Color;
}

sentences:
Ray tracing - draw polygon (square/bounded plane) I'm going on with my own ray tracer as an iPad app for a school project. This is the result with soft shadow, antialiasing, pure reflective and pure transparent object:

Now i want to change the skybox, implemented with the method contained here http://www.ics.uci.edu/~gopi/CS211B/RayTracing%20tutorial.pdf with a real cube that wrap all the scene. In this way I can display the soft shadow projected on the floor.
I read a lot of documentation about ray tracing polygon and I understood how to check if the ray intersect the polygon plane. Now my question is: if I want to draw a square, one for each side of my cube that will wrap the scene, how do I check if the point of intersecton is inside the square/polygon (so that i can shade it)? All the documentation seems so vague and incomplete. I can't find a complete explanation with some example, and maybe with some pseudo code, that really explain how to draw a square (bounded plane) in a ray tracer.

Thanks for helping me.

sentences:
Component based architecture - Rendering approach? I'm planning to use a component based architecture for a new 3D game engine I plan to work on, however I don't know how to approach the rendering side of things.

I can see two options here:

Every renderable game object has a RenderComponent, which stores a mesh and OpenGL-specific stuff like VBOs and VAOs. When the time comes to have update() called, it will use OpenGL to render itself.
Every renderable game object has a MeshComponent. When it's time to render, the Renderer would go through a list of all MeshComponents, extract vertex and material information, and render it.

Which option would be most flexible if I want to implement things like post-processing (bloom, motion blur), skyboxes, LOD, blending/transparency or implementing a deferred renderer?

sentences:
Why does changing texture change it for both objects? I have two identical objects in my Unity scene. When I change the texture of one, the texture is changed on the other, almost as though the first one is a prefab. Why is this happening and how can I treat them independently?

Steps taken:

Import .obj file and two .png files
Drag object into scene
Look at the object in the hierarchy (where the list of all objects in the scene is)
It has a child called pSphere1
pSphere1 has a mesh renderer with 2 materials on it - RedGold and pSphere1Mat
It also has two components controlling each of these materials
In those control components, I can select a shader from the dropdown and I can also select a texture.
For either one of them, if I change the texture say to PolkaDots, both objects have their materials changed, instead of only the one I am working on.

sentences:
counting coins after a certain time I am beginner in unity .
and now i am trying to write my first game.
the game is includes appear random coins in random place on the screen , after passing a certain amount of time.(one coin will be appear and then after for example 2 seconds it will be destroyed and the other coins will be appear in another place ).
there is a  counter  which calculate the  number of click on coins which appear in scene and counting number  of clicks on screen The coin is a prefab .Now i need to count the number of coins that will be disappear after certain amount of time.
can someone help me how i can write the code.

sentences:
Render time only equal half of fps I'm working on a project that remakes mario 3 (NES). In my game loop, i face a strange thing. Here is my code:

 while (true)
{
    if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (msg.message == WM_QUIT)
        {
            break;
        }
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    else
    {
        //Game logic
        c1++;
        _Mario.Update(1.0 / FPS);

        //Render
        _Timer.SetBeginTick();
        _LpD3dDevice9->Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(102, 255, 255), 1.0f, 0);
        if (_LpD3dDevice9->BeginScene())
        {
            c2++;
            _Mario.Render();
            _LpD3dDevice9->EndScene();
        }
        _Keyboard->GetState();
        _Mario.Move(_Keyboard);
        _LpD3dDevice9->Present(0, 0, 0, 0);
        _Timer.SetCurrTick();
        _Timer.UpdateGameTIme();
        if (_Timer.ElapsedTime < (1.0 / FPS))
        {
            Sleep(1000.0 / FPS - _Timer.ElapsedTime * 1000);
        }
    }
}

Update function :

void ImageMove::Update(float t)
{
    _Image_X += _Image_Vx * t;
    _Image_Y -= _Image_Vy * t;
    _SpriteTimer.SetCurrTick();
    _SpriteTimer.UpdateGameTIme();
    if (_SpriteTimer.ElapsedTime >= 1.0 / ANIMATE_RATE)
    {
        if (_Image_Vx > 0) _Image_Right.Next(); //change to next sprite
        if (_Image_Vx < 0) _Image_Left.Next(); // change to next sprite
        _SpriteTimer.SetBeginTick();
    }
}

Render Function :

void ImageMove::Render()
{
    int vpx = _Image_X - 400;
    int VIEW_PORT_Y = _Image_Y + 500;
    _SpriteHandler->Begin(D3DXSPRITE_ALPHABLEND);
    if (_Image_Vy > 0 && _Image_Vx_Last > 0) _Image_Jump_Right.Render(_Image_X, _Image_Y);
    else if (_Image_Vy > 0 && _Image_Vx_Last < 0) _Image_Jump_Left.Render(_Image_X, _Image_Y);
    else
    if (_Image_Vx > 0)_Image_Right.Render(_Image_X, _Image_Y);
    else if (_Image_Vx < 0)_Image_Left.Render(_Image_X, _Image_Y);
    else if (_Image_Vx_Last < 0)_Image_Left.Render(_Image_X, _Image_Y);
    else _Image_Right.Render(_Image_X, _Image_Y);
    _SpriteHandler->End();
}

I put c1 and c2 in my game loop to measure how many times Update and Render are called. I set fps = 60, while debuging, I let my game loop run for 5s, then set a breakpoint to view c1 and c2. The value of c1 = 320, and c2 = 160 ( = 1/2 c1 for sure, i have run it many times, so the times render is called only ~1/2 fps, i think with fps = 60, it should be ~300 for 5s, shoudn't It?).

If i debug with F10 (on Visual studio) , I can see a loop will execute with _LpD3dDevice9->BeginScene() success, and _LpD3dDevice9->BeginScene() in next loop always failed.

Is it error? Because i have tested on another small project, and c2 = 1/2 c1 too.
This problem cause an issue in my game. In Update() function, I change my sprite here, and draw it in Render() , so I always miss some sprite. Because It only render = 1/2 time game update.

If it is an error How can I fix my game loop? And if It is not an error, what can I do to prevent missing sprites?

P/S : sorry for bad English.

sentences:
Are there any pitfalls with this approach to isometric map generation? First of all, I don't have much experience on game development but I do have experience on development. I do know how to make a map, but I don't know if my solution is a normal or a hacky solution. I don't want to waste my time coding things, and realise they're utterly crap and lose my motivation.

Let's imagine the following map. (2D - top view - A square)

X: 0 to 500
Y: 0 to 500

My character currently stands at X:250,Y:400, somewhere near center of 100px above bottom and I can control him with my keyboard buttons. LEFT button does X--, UP button does Y-- etc.

This one is kid's play.

I'm asking this because I know there are some engines that automate this task. For example, games like Diablo 3 uses an engine. You can pretty much drag drop a rock to map, and it is automatically being placed here - making player unable to pass through/detect the collision. But what the engine exactly does in the background? Generates a map like mine, places a rock at the center, and checks it like:

unmovableObjects = array('50,50'); //we placed a rock at 50,50 location

if(Map.hasUnmovableObject(CurrentPlayerX, CurrentPlayerY))
{
     //unable to move
}
else
{
     //able to move
}

My question is: Is this how 2D/Isometric maps are being generated or there is a different and more complex logic behind them?

sentences:
Unit Testing a C#/XNA Game Project I have been dabling in game development since I started programming, but never very seriously. I work as a business app developer, but I'm working on some games in my spare time.

In the business world (on the Microsft web-dev stack) ASP.NET MVC is becoming really popular, because of its ease of unit-testing the way the interface works.

I'm wondering what design patterns (MVC, MVP, MVVM, etc) one could use to write a game in which all of the game logic is easily unit-testable. Is this possible or feasible? Am I wasting my time, is it better to do full builds and then run "integration" type tests instead of unit-tests?

Sample code would be great, but a writeup is also useful.

(I tried to add a unit-testing tag, but don't have the rep required...)

sentences:
How to make a snake game where each snake tile follows it's connected tile I want to make a basic snake game. It has a head and a series of tails that occupy a tile in a grid. The first tail in the series is adjacent to the head. and each tail that comes after is adjacent to the previous tail. Head can move in four directions and the first tail moves to head's previous position, and each other tail moves to the previous position of the previous tail, as they follow each other.
How can I model this as data, and update it for movement.
I've tried this but that's a little doesn't work.
p = {
  x=0,
  y=0,
  tails={}
}

function init_tail(dx,dy)
   return {
      x=0,
      y=0,
      dx=dx,
      dy=dy
   }
end
-- Initialization
add(p.tails, init_tail(0,1))
add(p.tails, init_tail(0,1))
add(p.tails, init_tail(0,1))

local last = p
for tail in all(p.tails) do
   local tx = last.x + tail.dx
   local ty = last.y + tail.dy
   tail.x = tx
   tail.y = ty
   last = tail
end
-- Movement
local last = p
for tail in all(p.tails) do
   tail.dx = -last.dx
   tail.dy = -last.dy
   local tx = last.x + last.dx + tail.dx
   local ty = last.y + last.dy + tail.dy
   tail.x = tx
   tail.y = ty
   last = tail
end

This is what I have so far:

sentences:
Do games depend on the OS to scale resolution? I'm having issues with my computer related with scaling when using different resolutions other than the native. So I started to wonder, in PCs, is scaling handled by the card driver or the game engine? Does it depend of what engine we are talking about? Do engines somehow bypass the scaling algorithm from the driver?

PS: I'm talking about the regular PC games that uses DirectX or OpenGL.

sentences:
Is creating a blend state like this possible? I'm wanting to create a custom blend state that is similar to XNA's BlendState.Additive, but slightly different. I'm wanting something like the 'custom' output below:

Is something like this possible? I'd even appreciate an answer that could help point me in the right direction. Blend states are a little bit baffling to me at the moment.

For an explanation of why I need this: I'm trying to add emissive maps to our game's rendering. I think most shading that uses emissive maps handle that in the lighting shader. Unfortunately, the emissive maps aren't available to our lighting shader, so I'm just trying to draw them over the top of what's already been rendered. Using BlendState.Additive almost works, but doesn't handle situations where emissive textures are overlapping.

Thanks in advance.

sentences:
Designing the main classes in a solar system simulation game in C++ If this is not the right place for this question, could you please direct me to a more suitable site/forum?

I'm a beginner in game development (and in the use of this site). I've worked with C++ only for rather small scientific simulations, so I can "code" but I've never done a full-blown design of an OO program, much less of a game. You can tell from what I'll write next :P

I've decided to write an open source educational game that simulates accurately the motion of the Sun, the planets and of one or more spacecraft controlled by the player. By "simulates accurately" I mean that I want to use a scientifically valid and precise algorithm to obtain the forces and thus the motions of the bodies.

The game will be in 3D and will use the Ogre3D engine for the graphics. Graphically it will look similar to Celestia.

The first difficulty is that I've never designed the structure and the classes of any game. By reading a few references and guides I think I have a vague idea of how the dynamics could work, but it's vague: each entity (planet or spacecraft) could store its own state information and then have an "update" function that updates the state based on some input (like user commands). There are probably many other ways to do this, I guess.

The main problem, however, comes from the particular needs of this project:

my objects must not only respond to user input, but also obey accurate physical laws, and the algorithm that computes them must be centralized. This is because it needs to know the positions of all the bodies at the same time to perform its computations;
I plan to add different kinds of spacecraft with different types of propulsion, and some of them would react to the other bodies in special ways (think antigravity).

The Question

Is there a design pattern or architecture suitable for this problem?

The best I can think of is to have a singleton Universe class containing the central algorithm for the dynamics. The various objects of the solar system then communicate with Universe. They would contain basic parameters like mass and size, and they would listen to Universe telling them where to stand.

However this doesn't sound right. Where do I put the ever-changing trajectory data of all the bodies, in Universe? What's the point of having all those objects then? Only for the graphical part of the game?

And what about the special dynamical properties of some spacecraft? I can't possibly include them all in the central algorithm from the beginning.

Ok, I think you can tell how confused I am about the matter much better than me. I would be grateful for any kind of input.

sentences:
Unity 2D Player Shoots at my joystick position Hi I am new to unity and have only a little coding knowledge.
Right now I have made my character shoot at my touch position on mobile but when ever I touch the joystick, whick I use to move my character, he shoots there, what should I do to make him not shoot at the joystick when i hold the joystick, any suggestion... heres my code.
Shooting code
public class Shooting : MonoBehaviour
{
    public GameObject shot;
    private Transform playerPos;

    void Start()
    {
        playerPos = GetComponent<Transform>();
    }
    void Update()
    {

            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
             Instantiate(shot, playerPos.position, Quaternion.identity);
            }
            else if (Input.GetTouch(1).phase == TouchPhase.Began)
            {
                Instantiate(shot, playerPos.position, Quaternion.identity);
            }
        else if (Input.GetTouch(2).phase == TouchPhase.Began)
        {
            Instantiate(shot, playerPos.position, Quaternion.identity);
        }

    }
}

Projectile Code
public class Projectile : MonoBehaviour
{
    private Vector2 target;
    public float speed;
    private Shake shake;
    void Start()
    {
        shake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent<Shake>();
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(1).position);
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(2).position);
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = Vector2.MoveTowards(transform.position, target, speed * Time.deltaTime);

        if(Vector2.Distance(transform.position, target) < 0.2f)
        {
            Destroy(gameObject);
        }

    }
    void OnTriggerEnter2D(Collider2D other)
    {
        shake.CamShake();
    }
}

Thanks in advance

sentences:
How can shader code duplication be reduced in Unity? In our current Unity project we have a few shaders that are basically just supersets of another shader. For example, we have a shader that performs lighting calculates with diffuse, normal, specular, and gloss maps, and a shader that performs lighting calculations with a diffuse, normal, specular, gloss, and glow map. The first is a subset of the second, but for performance reasons we've decided to separate them. This leaves us with heaps of duplicated code.

On top of this, I need to add stencil buffer operations to some of these materials, which is about 3 lines, but from what I can see, requires the entire shader file to be copied again.

How can we reduce this code duplication? In an object orientated language we'd used inheritence and polymorphism. What can we do here?

sentences:
Choosing random array indexes in Unity C# I want to change a string by randomly choosing an index in an array, using the random.range command in unity. Bare in mind that I'm using strings here, not floats or integers. Here is a code example(not the real thing. I'm just coming up with this by example, but it still has the same meaning. I may make a few typo errors as a result):

public string ChangingString = ("");
public string[]ExampleArray = new string [2];

void Start () {
    ExampleArray[0] = ("String1");
    ExampleArray[1] = ("String2");
}
void OnGUI () {
    if(GUI.Button(new Rect(10,10,100,24), "Randomize text")){
        ChangingString = (code to choose random string using the ExampleArray);
    }
    GUI.Label(new Rect(10,30,100,20), ChangingString);
}

EXTRA NOTE: I'M NEW TO USING ARRAYS.

sentences:
Specular intensity of non-metals(plastics) in metalness pbs workflow The specular color in metalness/roughness workflow is usually defined as following:

float3 specColor = lerp(0.03f, albedoColor, metallic);

The Cook-Torrance BRDF is given with the following formula:

The final color will be:

Ci = (diffColor*(n.l)+Ks*specColor*cook);

My question is - won't specular be too dim for non-metals? Cook-Torrance term will be multiplied by 0.03 in case of dielectrics - this will make the specular component virtually non-existent. This doesn't seem realistic to me, because smooth plastic reflects a lot of light, almost as much as metals:

What am I missing?

sentences: Books that discuss practical rendering techniques? I'm looking for some books that discuss practical rendering topics like say rendering a bsp level or md2/3 mode, making a little quake like game as the goal or something to that effect. Any recommendations would be much appreciated.

sentences:
Do i lose performance doing this public class TileObject : MonoBehaviour {

////some code was here
public PlayerAnimator playerAnimator;

////some code was here

public void SetTileObject(int xPos, int yPos, TileData tileData)
{
   ////some code was here

    if (tileData.player)
        playerAnimator = new PlayerAnimator();
}

And my question do i lose any performances(or memory) doing this instead of inheritance or something else.(tileObject can be other than player)

sentences:
How to get the Exact Collision Point and ignore the collision (from 2 "ghost bodies") I have a very basic problem with Box2D.

For a arenatype game where you can throw scriptable "missiles" at other players I decided to use Box2D for the collision detection between the players and the missiles. Players and missiles have their own circular shape with a specific size (varying). But I don´t want to use dynamic bodies because the missiles need to move themselve in any way they want to (defined in the script) and shouldnt be resolved unless the script wants it.
The behavior I look for is as following (for each time step):

velocity of missiles is set by the specific missile script
each missile is moved according to that velocity
if a collision accurs now, I want to get the exact position of impact, and now I need a mechanism to decide if the missile should just ignore the collision (for example collision between two fireballs which shouldnt interact) or take it (so they are resolved and dont overlap anymore)

So is there a way in Box2D to create Ghost bodies and listen to collisions from them, then deciding if they should ignore the collision or should take them and resolve their position? I hope I was clear enough and would be happy about any help!

sentences: How do I open Gdevelop with Termux? Is it even possible? I use a samsung chromebook 3 and I am trying to get the FULL version of Gdevelop. I installed it for linux, and I dragged it to be one of my termux files. I am trying to run a command in termux that opens the full version of gdevelop. But it keeps saying: "NO SUCH FILE OR DIRECTORY" Is there a command I can run in termux to open the full version of Gdevelop?

sentences:
Steamworks Networking with LibGDX / Java I have recently found out about Steamworks SDK and after reading through some of the documentation and information from other sources I was left with a few questions.

I found Steamworks because I was interested in how Steam handles multiplayer in games, like co-op games with the lobby creation and all.

This is because of a game I'm developing which is planned to be a 2-player co-op puzzle game.
When it comes to networking, how would I program the game to use Steamworks lobby creation? Would I just program it normally with a client server? Because normally that would require atleast one of the users to forward their ports but would the Steamworks work around that? Or do I implement the Steamworks right away?

This would be cruicial to know since adding networking late in to the development is very difficult.
Thank you in advance, any links or help is much appreciated!
Also, I'm progamming in Java(LibGDX).

sentences: How do i move a 2D object with angle and speed variables in unity? I want to move an object with a certain angle and speed, is there a was to set this as an initial velocity so that it is still possible for the object to collide and bounce of other objects using its rigid body?

sentences:
How to change pixel color of Texture with Fragment Shader I want to change the pixel color of a texture. I don't know where to start and what to add. Really need help, I only find useless snippets in the internet.

My current Code:

public void onSurfaceCreated(GL10 gl, EGLConfig config) {
...
GLES20.glAttachShader(riGraphicTools.sp_SolidColor, vertexShader);
GLES20.glAttachShader(riGraphicTools.sp_SolidColor, fragmentShader);
GLES20.glLinkProgram(riGraphicTools.sp_SolidColor);

vertexShader = riGraphicTools.loadShader(GLES20.GL_VERTEX_SHADER, riGraphicTools.vs_Image);
fragmentShader = riGraphicTools.loadShader(GLES20.GL_FRAGMENT_SHADER, riGraphicTools.test_Image);

riGraphicTools.sp_Image = GLES20.glCreateProgram();
GLES20.glAttachShader(riGraphicTools.sp_Image, fragmentShader);
...
}

The riGraphicTools Class:

public class riGraphicTools {

public static final String test_Image =
        "precision mediump float;" +
        "varying vec2 v_texCoord;" +
        "uniform sampler2D s_texture;" +
        "void main() {" +
        "  gl_FragColor = texture2D( s_texture, v_texCoord );" +
        "}";

public static final String vs_Image =
    "uniform mat4 uMVPMatrix;" +
    "attribute vec4 vPosition;" +
    "attribute vec2 a_texCoord;" +
    "varying vec2 v_texCoord;" +
    "void main() {" +
    "  gl_Position = uMVPMatrix * vPosition;" +
    "  v_texCoord = a_texCoord;" +
    "}";
}

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:
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:
Simulating a sine wave/oscillating pattern for enemies I'm creating a simple top down shooter, right now I have an enemy which simply follows the player. I'd like to change things up and have the enemies move towards the player but in a wave like motion. I have looked at some similar questions like this but they don't take into account for the Y changing. How can I simulate a wave like pattern for my enemies whilst they are homing into their target.

Edit:

Sample code

In my update method I have the following:

            Vector2 trackingPos = position - target;
            trackingPos.Normalize();
            position -= trackingPos * elaspedTime  * speed;

sentences:
What is wrong with my Chest script? I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script! But it doesn't work. I just want some help fixing this script.

#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
    Text.SetActive(true);
    if (Input.GetKeyDown("e"))
    {
        CurrentChest.SetActive(false);
        OpenedChest.SetActive(true);
    }
}

function OnTriggerExit()
{
    Text.SetActive(false);
}

I get no compiler errors. When I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. What is wrong with my script?

sentences:
VBO and shaders confusion, what's their connection? Considering OpenGL 2.1 VBOs and 1.20 GLSL shaders:

When creating an entity like "Zombie", is it good to initialize just the VBO buffer with the data once and do N glDrawArrays() calls per each N zombies? Is there a more efficient way? (With a single call we cannot pass different uniforms to the shader to calculate an offset, see point 3)
When dealing with logical object (player, tree, cube etc), should I always use the same shader or should I customize (or be able to customize) the shaders per each object?
Considering an entity class, should I create and define the shader at object initialization?
When having a movable object such as a human, is there any more powerful way to deal with its coordinates than to initialize its VBO object at 0,0 and define an uniform offset to pass to the shader to calculate its real position?

sentences:
How to avoid overwriting a value in Unity? I'm working on a Tower Defence style game, and wondering how best to handle the "resources" part. I have multiple enemies on screen at a time, and when an enemy dies, it updates a resource that allows the player to build more towers
var tower = Instantiate(buildables[0], center, Quaternion.identity);
var controller = tower.GetComponent<TowerController>();
controller.OnKilledEnemy += (sender, args) =>
{
    int.TryParse(goldAmount.text.Replace(",", ""), out var curr);
    curr += args.gold;
    goldAmount.text = $"{curr:n0}";
};

But if 2 enemies die in the same frame, wouldn't the value there miss an update?
What ways are there in Unity/C# to mitigate this problem?

sentences:
View Frustum Alternative I am working on a simulation project that requires me to have entities walking around in a 3D world. I have all that working, matrix transformations, etc. I'm at the point where I need what is essentially a view frustum, so I can give each entity a visible area. However, when looking over the calculations required to do it, it seems like a perspective frustum is only required to be able to project it onto a 2D screen. Is there another, easier to code solution, that would function better, such as an orthogonal perspective? Could I just define a shape mathematically and test wether the coordinates of the objects are inside or out? I am not really a 3D coder (and I am doing this all from scratch, not using an engine or anything), so I would like the simplest solution possible for my needs.

Thank you!

sentences:
How are "2.5D" art assets created? By "2.5D" I mean the art style in games such as Roller Coaster Tycoon, Age of Empires 2 or Fallout 1 and 2:

Everything in the games appears to be created with a "pixel art"-like tool. Am I correct?

How are the moving characters are created though? Take AoE2: For much of my childhood I was convinced that the soldiers, villagers and other characters were 3D!

Could someone explain:

What dimensionality are the characters?
What sort of software package could I use to create them?

sentences:
ID3D10Device::RSSetState to be called every frame? I am trying to create a ID3D10RasterizerState with direct3D10, and then call

ID3D10Device::RSSetState()
with the proper information. However, whenever the window get rescaled, or when the app goes fullscreen, the rasterizerstate seems to reset to the default state. I have tried to set the state with WM_SIZE messages, but awkwardly, nothing seems to happen...

It works properly when I call RSSetState() every frame, but that seems highly inefficient.

Does anyone know a solution to this? It seems to be poorly documented on msdn.

Code:

bool TestGameApp::InitGame()
{
    D3D10_RASTERIZER_DESC desc;
    desc.AntialiasedLineEnable = TRUE;
    desc.CullMode = D3D10_CULL_NONE;
    desc.DepthBias = 0;
    desc.DepthBiasClamp = 0.0f;
    desc.FillMode = D3D10_FILL_SOLID;
    desc.FrontCounterClockwise = false;
    desc.MultisampleEnable = true;
    desc.ScissorEnable = FALSE;
    desc.SlopeScaledDepthBias = 0.0f;

    m_pD3DDevice->CreateRasterizerState(&desc,m_pRSState);
    m_pD3DDevice->RSSetState(m_pRSState);

    //...more code
}

WndProc:

switch( message )
{
    case WM_SIZE:
    {
        m_pD3DDevice->RSSetState(m_pRSState);
        break;
    }
}

sentences:
How to instantiate GameObject on client without network? When I NetworkServer.Spawn(ob) a gameobject and make it a child of a transform.parent after it spawns on both the server and client it usually lags, meaning it takes some secs to align with the transform.parent which is the player

Example : Instantiating a GameObject containing a ParticleSystem which gives the parent somewhat an effect, smoke or something in that direction, in the host client every object usually has a smooth movement where as in the connected client it goes very rough and slow, like every gameobject having a low fps except the main client player prefab

So i was thinking spawning the same effect on both clients so it wouldn't have to sync from the server to the client which uses it instead it only would have to sync inside the clients game, it might not have the same particle movements but it wouldn't make a difference

Here's the child's prefab network identity and transform :

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

I'm working in XNA if that helps.

sentences:
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: Why is Euler integration sometimes preferred over RK4 even if RK4 is more accurate? Some high quality engines such as Box2d uses the Simplistic Euler integrator instead for RK4 when Eumplectic Euler commits a global error of the order of Δt whereas, RK4 has Δtˆ4 error? RK4 is not that hard to do, right? Why would a physics engine use Euler over RK4 hence sacrificing accuracy ?

sentences: What are typical pitfalls when writing games with a managed Language like C#? What pitfalls did you encounter when writing games for the PC with a managed Language like C# and how did you solve them?

sentences:
How does having the Debugger change the game execution on an XBOX 360? So I thought my issue was relating to the difference between a Debug and a Release build as per this question: What's the difference between a "Release" Xbox 360 build and a "Debug" one? but I've since found that if I go ahead and build a Creators Club version of the game using a Debug build and deploy to the XBOX, I get the same experience I had with the Release version of my game.

However if I run the game from Visual Studio using F5 and having set the XBOX as the default platform, then the game runs as expected. If I change from Debug to Release and run with CTRL+F5 then the game also works as expected.

How would running the game with the debugger attached change the results I am getting in game? Is there any way that I can use the same approach or change the default compilation of the game so that I can use this approach to release my game?

sentences:
Unity3d - How to use controller joystick to look around? I try to use my xbox controller as input device for a game targeted to run on windows. However the documentation fails to explain how to set it up.
E.g. how can I use the right stick from my xbox controller to look around, like in any 3D game? Even such a common task is not documented.

I found a very old wiki entry where the xbox controller is briefly described, I was able to find out that the Y-Axis of the right analog is called 5th axis (Joysticks) and the X-Axis is called 4th axis (Joysticks). I post the images below, in case the link get's dead.

Linux

Note: wired controllers only support axises for the d-pad, while the wireless controller only supports buttons for the d-pad, refer to the table above for the wireless controller configuration.

I figured out that the name of a control is responsible for the action which the button, stick, key, pedal etc. does. But it is not documented how the control has to be named for looking around vertically or horizontaly like you can do in an 3D game to look around with the camera by using the right joystick (e.g. witcher 3)

How can I control the camera by using the right joystick?

sentences:
When rendering on two different computers, the texture is glitchy I am using Ogre3D, and have been using it for a while. Also lately, I have been using the Opengl Rendering system that is included in Ogre, only because Directx will not compile correctly(Will post errors on request through comment).

But as of now the main problem is when i render my model(it is a plane with simple, unblended pixelated texture), it looks like this on my Laptop(Left Image), but when I render on the desktop(Right Image), it looks the way its supposed to be.

Im pretty sure this problem might not be relevant to this site, but im not sure on where else to post this(if it needs to be moved then so be it), but i felt it would fit here just a bit, since its a game-dev type question.

Anyways, My compiler is MinGW that uses the IDE Code::Blocks.
also the operating system that im using on both computers are windows Vista 32 bit.

Now if anyone would know why this would happen then please do tell(but my guess is that maybe the graphics card is not compatible)

Here are the images:

Left:Laptop

Right:Desktop

there both about the same image, and if you notice on the desktop screenshot: it looks more clearer and you can see the "mountains" better, where on the laptop picture, you cant see any pattern at all...Also, you can notice an odd stopping of light(or maybe called something else), but that has me confused also.

sentences:
Deferred Rendering: Orthographic directional light that has position Basically I need to code a light for deferred rendering that is a cross between a spotlight and a directional (positionless) light.  It's to be used for sunlight, but because my terrain has overhangs and multiple layers, I can't use a directional light for the sun, as those affect everything in the scene, and do not cast shadows.

I would also prefer that the light uses a full screen pass like directional lights use, rather than rending the light using a cone geometry like spot lights do.

Does anyone have an example of something like this?  I've found a few resources but nothing that clearly shows how to code it up.  Language is irrelevant, but I would prefer C#.  Anything would be great though.

sentences:
Learning OpenGL: Red and Blue book still relevant? I've recently purchased the Orange book( GLSL ) and am wondering if it is important at all to read through the red and blue books as well?

Any thoughts?

sentences:
Unity3D: Touch and Objects have different coordinate systems I would like to associate the same script to different empty objects I just use as placeholders in the game. The aim is to exploit their positions so that when the user touch a point in the screen, close to one of these objects, a dedicate GUI appears. The problem is that though the two objects are different their scripts seem to influence each other so that when the game is running and I touch one of these two objects both the gui appears. What am I doing wrong?

Some hours later...
This happens because the object and the touch are in two different coordinate systems. For instance though I touch the object I get (-0.77, 0.46) for the object and (12.1,95.2) for the touch which, I guess, is measured in pixel. How to transform one into the other?

....
private var check: boolean;
var topCamera : Camera;
var customSkin : GUISkin;

function Update () {
   if (Input.GetMouseButtonDown(0)){
      if(Input.mousePosition.x > this.transform.position.x - Screen.width*0.20 && Input.mousePosition.x < this.transform.position.x + Screen.width*20){
        if(Input.mousePosition.y > this.transform.position.y - Screen.height*0.2 && Input.mousePosition.y < this.transform.position.y + Screen.height*0.2){
                check = true;
        }
    }
}

if(check){
   //the camera zooms forward
}else{
   //the camera zooms backward
}
}

function OnGUI () {
if (this.check){
var w = Screen.width;
var h = Screen.height;
var bw = 0.083;
var bws = 0.001 *w;
GUI.skin = customSkin;
GUI.Box(new Rect(w*0.6,h*0.3,w*0.38,h*0.45), "Stuff");
customSkin.box.fontSize = 0.04*h;
customSkin.textField.fontSize = 0.08*h;
customSkin.button.fontSize = 0.04*h;
textFieldString = GUI.TextField (Rect (w*0.62, h*0.39, w*0.34, h*0.1), textFieldString);
if (GUI.Button (Rect (w*0.62,h*0.50, w*bw, h*0.1), "+")) {
    if (this.check){
        this.check=false;

    }else{
        this.check = true;
    }
//...
}
 //...
    }

sentences:
XNA `tex2Dlod` always returns transparent black I want to sample a texture in a vertex shader, so at first I just tried using

float2 texcoords = ...;
color = tex2D(texture, texcoords);

But apparently I cannot use tex2D in a vertex shader, and must use tex2Dlod. So then I changed the above code to

color = tex2Dlod(texture, float4(texcoords, 0, 0));

But now color is always float4(0, 0, 0, 0) (i.e. transparent black).

Why is this, and how can I fix it?

EDIT: I know for a fact that the texture does not contain just transparent black pixels.

sentences:
Camera with zoom that follows the player in javascript I'm passing the time programming a little game in javascript, I've done what I'm trying this in several in game engine. And what I'm trying to do is generate the world while the player walks around the map. Using engines like unity and godot, I have always had the facilities to deal with the camera and the scene. Now with pure javascript I'm kind of not knowing where to go.

Come on, what I have so far:

A world generated by 2D noise and my character in it can move with the keys of the keyboard. What I want to do now is that when walking he generate the world and also the camera accompany him. And that with the scroll of the mouse I can take the camera to a bigger zoom so that I can better visualize the generated world.

So there are 3 questions I have:

1 - How to create a camera that will follow the player, already thinking about the best way to make the world be generated when walking the player.

2 - How to generate the world while he walks (This I believe I can do.)

3 - How to zoom in with the mouse scroll?

sentences:
With LibGDX how is it okay to use Fonts statically? I am working on a engine/framework/game in LibGDX as a baseline for future Java games (really lightweight and stuff, just gamestates, entity framwork, physics, font, etc), but I am unsure of how I should handle font.

Should I create a Font Factory to generate fonts, manage them, and allow static access to fonts? Or should I just create fonts when I need them, like in my HUD/GUI/Player/Level/etc.

sentences:
Whats the best way to light up a scene in unity? What I want is a darkish scene with like neon style lights
Currently is use the bloom post processing effect but sometimes it doesn't render well on my main camera and looks not as good as it does in the scene

My game view with main camera -

My aim is to get the lighting similar to look like Brackeys party killer game
How may I achieve this

sentences:
In a grid based system, where users can build their own walls to create buildings, how do you determine which parts are indoors? I've looked around for an algorithm to solve this problem, but I can't seem to find anything.

In a game I am working on, data is held in a grid. Certain squares within that grid can be set as walls, so that the user can create buildings.  What I am wondering is how could I write an algorithm to determine which parts of the grid were indoors, that is to say, within a building, and which parts are outdoors. Thank you in advance for any advice.

sentences:
Two UBO's end up containing the same data I have two separate UBO's for different types of lights (for a light stage in a deferred rendering system).

These are defined as follows:

//Pointlight UBO
m_pointLightBlockIndex = glGetUniformBlockIndex(shader.getShaderHandle(), "PointLights");
glGetActiveUniformBlockiv(shader.getShaderHandle(), m_pointLightBlockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &m_PointLightBlockSize);
glUniformBlockBinding(shader.getShaderHandle(), m_pointLightBlockIndex, 0);

//Spotlight UBO
m_splBlockIndex = glGetUniformBlockIndex(shader.getShaderHandle(), "SpotLights");
glGetActiveUniformBlockiv(shader.getShaderHandle(), m_splBlockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &m_SpotLightBlockSize);
glUniformBlockBinding(shader.getShaderHandle(), m_splBlockIndex, 0);

//create the buffers
glGenBuffers(1, &m_SLBuffer);
glGenBuffers(1, &m_PLBuffer);

glBindBuffer(GL_UNIFORM_BUFFER, m_SLBuffer);
glBufferData(GL_UNIFORM_BUFFER, sizeof(SpotLightData)*m_MaxSpots, nullptr, GL_DYNAMIC_DRAW);

glBindBuffer(GL_UNIFORM_BUFFER, m_PLBuffer);
glBufferData(GL_UNIFORM_BUFFER, sizeof(LightData)*m_MaxPoints, nullptr, GL_DYNAMIC_DRAW);

glBindBuffer(GL_UNIFORM_BUFFER, 0);

To populate the UBO's I use the following:

void LightUniformBuffer::updatePointLights(int numLights, const LightData * data)
{
    glBindBuffer(GL_UNIFORM_BUFFER, m_PLBuffer);
    glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(LightData)*numLights, data);
    glBindBuffer(GL_UNIFORM_BUFFER, 0);
}

void LightUniformBuffer::updateSpotLights(int numLights, const SpotLightData * data)
{
    glBindBuffer(GL_UNIFORM_BUFFER, m_SLBuffer);
    glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(SpotLightData)*numLights, data);
    glBindBuffer(GL_UNIFORM_BUFFER, 0);
}

And finally to bind them:

void LightUniformBuffer::bindPointLights()
{
    glBindBufferBase(GL_UNIFORM_BUFFER, m_pointLightBlockIndex, m_PLBuffer);
}

void LightUniformBuffer::bindSpotLights()
{
    glBindBufferBase(GL_UNIFORM_BUFFER, m_splBlockIndex, m_SLBuffer);
}

These buffers are represented as arrays of lights in GLSL, like so:

layout (std140) uniform PointLights
{
    LightData points[MAX_NUM_POINT_LIGHTS];
};

layout (std140) uniform SpotLights
{
    SpotLightData spots[MAX_NUM_POINT_LIGHTS];
};

Now, when I populate the buffers and use the shader, I found, through using Nsight, that both buffers are using the same set of data, i.e. the spotlight buffer is filled with point light data, and so is useless.

Why is this happening, and how can I fix it?

sentences:
How to make Unity Layout switch while in Play mode I'm looking for a way to auto switch the Unity layout when I go to play mode.

I want to Unity Editor layout automatically changes to my preset layout when I click on Play button and When I stop the game, It goes back to the default layout.

sentences:
Unity: Z-position issue on gameobject with subcomponents I'm following this tutorial from Ryan Miller on how to create a rig of sorts from a sprite atlas sheet.

My intention was to put the panda behind a bamboo, but this is what happened:

The bamboo's Z-position has been set to 2, whilst the Panda's has been set to 6.

Here's a 3D look at the problem:

How do I fix this?

sentences:
RPG Damage Calculation Logartihm in Java I'm trying to make a damage calculation formula for my RPG game, there are 12 levels for both the Player and the Enemy, I've come as far as making a Reverse Exponential formula, but I want the damage to go down from slow to faster as the Players level gets closer to the level of the Enemy.

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

public class DamageCalc {

    private static double defense;
    private static double dmg;
    private static String teststring;

    public static void main(String args[]) throws FileNotFoundException, UnsupportedEncodingException{
        for(int i = 1; i <= 12; ++i){
            for(int j = 1; j <= 12; ++j){
                defense = ((j * 3) * 2 + 11) * 2;
                dmg = i * 12;
                double totaldmg = getDamage(i,dmg,defense,j);
                teststring += "Player Level " + i + "\nMonster Level " + j + "\nTotal Damage " + totaldmg + "\n----------------------------------\n";
            }
        }
        PrintWriter test = new PrintWriter("testvalues.txt","UTF-8");
        test.println(teststring);
        test.close();
    }

    public static double getDamage(double level, double dmg, double defense, double enemy){
        double intdamage = (((2*level+10) / 128) * (dmg/defense) * 11 + 1) * 10;
        double damage = Math.ceil(Math.pow(intdamage,level/12) * 10);
        System.out.println(intdamage);
        return damage;
    }

}

The code just loops through the players level (int i) and the enemies level (int j), then returns the damage done. The difference in damage between level 1 and 2 is significantly higher than between 11 and 12, eventhough that should be the other way around.

EDIT: I'll explain it even further. The player starts with 12 for each stat, every level 12 get's added (dmg = level * 12). Every stat for the player has 128 points and monsters 128 points, so that's why the begin defense of a monster is 11. If the damage stat from the player is lower than the defense of the enemy, the damage will get a penalty, otherwise it will get a boost (double * (dmg/defense)).

I hope this explains it.

sentences:
What formula is commonly used in rpg based games to calculate gained currency? Assuming I have an RPG game with monsters, a game you can fight any amount of monsters at any time - What are my options for a gained currency from a battle formula? I've been trying to use Google for any ideas, but couldn't find something solid.

Currently I have the enemy level * user level * 0.1

Pretty sure I need something more realistic and randomized, Hope someone can share any idea about it.

Thanks in advance!

sentences:
Get world position of touch on objects In my Unity3d game, I want to get the world position that was touched, when I touch a specific object, regardless of all objects that are in front of it.

How would I do that, I only know Camera.ScreenPointToRay(...), but for some reason that does not work properly?

OK - one cannot answer the question with the information I provided.

In order to determin the point, where the Ray hit the object, I used RaycastHit.transform.position (which refers to the Transform object that was hit) as opposed to RaycastHit.point (which refers to the Vector3 in world space, where the RaycastHit happened).

sentences:
In Pygame, I can only display text once I stop updating and drawing, why? At this moment, I can only display text once I stop updating and drawing sprites. In the code below (which is actually the game loop), you can see how if GAMEOVER == True (gameloop stops drawing), the text "Game Over!" is displayed. But if I try to display any text while drawing and updating, it doesn't appears until I stop drawing the sprites. In fact, the frist block to display text ("My Game!") isn't shown, as I said, until the gameloop stops drawing. I need to display some info like, name of char, instructions, etc while the game is running, so, how can I render text in every loops and frames?

The game loop:

while True:

    myfont = pygame.font.SysFont("monospace", 30)
    label = myfont.render("My Game!", 1, (255, 255, 0))
    SCREEN.blit(label, (500, 400))

    if PLAYER.healthBase <= 0:
        GAMEOVER = True #True para que se acabe la partida

    if not GAMEOVER:
        charsGroup.update(time_passed)
        npcsGroup.update(time_passed)
        mapTilesGroup.draw(SCREEN)
        charsGroup.draw(SCREEN)
        npcsGroup.draw(SCREEN)
        drawBullets()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    time_passed = freq.tick(0) /1000.

    if GAMEOVER:
        myfont = pygame.font.SysFont("monospace", 30)
        label = myfont.render("GAME OVER!", 1, (255, 255, 0))
        SCREEN.blit(label, (400, 300))

    pygame.display.flip()

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:
Horizontal scrollview only I am using unity's scrollview.
I want to disable the vertical scrollbar and i want the viewport to resize vertically depending on the content.
Too confusing to explain with word so i have created the example picture below :

How do i achieve this properly ?

sentences:
Read actor instance's text variable for widget when triggered on different objects What I'm trying to do:
(a 'long story version' is linked in comment below)
(and another user example is hyperlinked in comment below - i couldn't post over 8 images and/or links in this first comment*)
(there are other similar user questions elsewhere I know)
Short story: I'm trying to make a widget that is triggered by an actor blueprint, and I want the widget to display different text that reflects the public-variable-text edits I make in the editor.
My latest progress includes actors that are titled somewhat according to the hyperlinked user case above so, I have a "door_trigger" and a "doorWidget". I have altered the pin connections so much that I am just going to copy and paste all my screen shots below.
I got to change text asset DoorName by making a public variable called "name," as you'll see. I can make the trigger show this text on screen and have it disappear when the user leaves the trigger actor, BUT EVERY INSTANCE ALSO SHOWS THIS TEXT VALUE, EVEN THOUGH I CHANGE IT
In the screenshots (some in comment following too) you'll see the text "3" appear on screen, and it does this for all three of the dummy boxes I made; notice how the second box is supposed to show "dd" (I was just typing random filler content).
ALL HELP SO APPRECIATED!!!!! Thank you!!!

sentences:
What is the simplest way to export a bezier curve created in Blender to a text file? I have created a bezier curve in Blender.

I'd like to export this curve to a text file. What I need is :

Control point + handles, three points in total.

Example :

{{ 2.3333,4.3942, 55.333 }, { 0.3234, 2.4234, 4.0332 }, { 2.534, 6.S234, 12.0332 }}

I have tried to export the scene in Collada format but it doesn't seems to include curves information.

What is the easiest / simplest way to export this curve to some readable text file format ?

sentences: How to find points that lie on a circle From the image below I know the vectors P1, P2 and P3. How can I find the point A which lies on the circle and line P2A which is a bisector (angle q and r are equal) of the lines P2P1 and P2B? Also how can I find the point B which is in the same direction as P2P3 and lies on the circle?

sentences:
Territory patrol planning I am developing a game/simulation where agents are fighting for land. I have the situation shown in the picture below:

These creatures are walking around and occupying pieces of land they step on if they are free. To make this more interesting, I want to introduce "patrolling" behaviour, such that agents are actually walking around their land to patrol from any intruders who may want to take it.

On the technical side, each square is represented as a x,y position as well as a dimension representing its side length. It also contains information on who occupies the square. All squares are stored in an ArrayList.

How can I introduce  patrolling behaviour? What I want is for each agent to patrol a certain portion of the area (they divide amongst themselves which areas they will patrol). The main issue I've found are as follows:

The area of land is very random, as seen in the picture. It is rather difficult to understand where the bounds are in each direction.
How they should agents split the regions to patrol?
Areas of land may be disjoint, since the opposing team may take territory from the middle.

I had an idea of taking the furthermost square in each direction, treating those as the boundaries of the area, and divide regions based on those boundaries, but this might include lots of irrelevant land.

How should I approach this problem?

sentences:
Why do objects interpenetrate in this simple collision solver? The code below is from a Microsoft XNA sample here.
This is quite a simple rigid body simulation that ignores many physical effects (such as angular momentum), but it does try to push objects (spheres) apart so that they are not penetrating one-another.

However, the simulation allows spheres not only to penetrate, but when many spheres are stacked on top of each other, small spheres can be almost completely inside of larger spheres. If I make all spheres have the same radius and mass, then the simulation performs reasonably well (with minimal interpenetration).

Can someone explain why there is any interpenetration at all? Since it moves the positions of the spheres, it seems like interpenetration should be impossible.

For each sphere in the simulation, this method is called on every other sphere.

/// <summary>
// Given 2 spheres with velocity, mass and size, evaluate whether
// a collision occured, and if so, excatly where, and move sphere 2
// at the contact point with sphere 1, and generate new velocities.
/// </summary>
private void SphereCollisionImplicit(Sphere sphere1, Sphere sphere2)
{
    const float K_ELASTIC = 0.75f;

    Vector3 relativepos = sphere2.Position - sphere1.Position;
    float distance = relativepos.Length();
    float radii = sphere1.Radius + sphere2.Radius;
    if (distance >= radii)
    {
        return; // No collision
    }

    // Add epsilon to avoid NaN.
    distance += 0.000001f;

    Vector3 relativeUnit = relativepos * (1.0f / distance);
    Vector3 penetration = relativeUnit * (radii - distance);

    // Adjust the spheres' relative positions
    float mass1 = sphere1.Mass;
    float mass2 = sphere2.Mass;

    float m_inv = 1.0f / (mass1 + mass2);
    float weight1 = mass1 * m_inv; // relative weight of sphere 1
    float weight2 = mass2 * m_inv; // relative weight of sphere 2. w1+w2==1.0

    sphere1.Position -= weight2 * penetration;
    sphere2.Position += weight1 * penetration;

    // Adjust the objects’ relative velocities, if they are
    // moving toward each other.
    //
    // Note that we're assuming no friction, or equivalently, no angular momentum.
    //
    // velocityTotal = velocity of v2 in v1 stationary ref. frame
    // get reference frame of common center of mass
    Vector3 velocity1 = sphere1.Velocity;
    Vector3 velocity2 = sphere2.Velocity;

    Vector3 velocityTotal = velocity1 * weight1 + velocity2 * weight2;
    Vector3 i2 = (velocity2 - velocityTotal) * mass2;
    if (Vector3.Dot(i2, relativeUnit) < 0)
    {
        // i1+i2 == 0, approx
        Vector3 di = Vector3.Dot(i2, relativeUnit) * relativeUnit;
        i2 -= di * (K_ELASTIC + 1);
        sphere1.Velocity = (-i2) / mass1 + velocityTotal;
        sphere2.Velocity = i2 / mass2 + velocityTotal;
    }
}

In particular, I though that this:

sphere1.Position -= weight2 * penetration;
sphere2.Position += weight1 * penetration;

Should completely disallow any interpenetration, why doesn't it?

sentences:
Why do my animations need to be marked as "legacy?" I'm in the beginning of a project and I'm not really using 3D models but rather a hierarchy of primitive shapes. I made a couple of animations that suddenly don't work anymore. I get an error about that I need to mark them 'legacy'.

I came across this suggestion to mark them as legacy in the rig tab via the model, but I'm not using a model so that doesn't help.

I don't understand how the animations that I made in Unity yesterday don't work today? What is this legacy problem?

sentences: Jump Point Search on an infinite grid I recently found Jump Point Search and it seems like a really interesting algorithm. But I wonder about what its performance is like when your grid is of infinite size. When searching diagonally, is it not possible that the orthogonal rays being sent out can go on for an arbitrarily long amount of time on an infinite grid even if the place you want to pathfind to is just a few steps away? Is JPS feasible in general for such grids?

sentences: Do I lose/gain performance for discarding pixels even if I don't use depth testing? When I first searched for discard instruction, I've found experts saying using discard will result in performance drain. They said discarding pixels will break GPU's ability to use zBuffer properly because GPU have to first run Fragment shader for both objects to check if the one nearer to camera is discarded or not. For a 2D game I'm currently working on, I've disabled both depth-test and depth-write. I'm drawing all objects sorted by their depth and that's all, no need for GPU to do fancy things. now I'm wondering is it still bad if I discard pixels in my fragment shader?

sentences:
Get Particular Object's collision status via C# script My current scripts creates and modifys the location of various prefab objects as they go along the screen. One of the things I want to find out about the active object is whether it has collided with another object, and if so, to destroy itself. The problem is that every example I've found to date has no way to access the object itself to get this information.

        if (Random.value > 0.9)
    {
        var bomberInstance = GameObject.Find("bomber");

        var newBombObject = Instantiate(Resources.Load("_prefabs/bomb"), new Vector3(bomberInstance.transform.position.x, bomberInstance.transform.position.y, bomberInstance.transform.position.z), Quaternion.identity) as GameObject;

        bombArray.Add(newBombObject);
    }

    foreach (GameObject bomb in bombArray)
    {

        //get bomb objects collision status here.

        var newBombYAxisPosition = bomb.transform.position.y - .1f;

        bomb.transform.position = new Vector3(bomb.transform.position.x, newBombYAxisPosition, bomb.transform.position.z);

    }

As you can see, the examples you find online don't exactly fit very well for what I need. Do objects in unity store this information, and if so how can it be accessed? And if not, is there another way to access this information?

sentences:
How do I make a hitbox for a sword in a top-down game? Context: I'm using Box2D through LibGDX in Java. The sword and the player are in separate classes. Both extend LibGDX's Sprite class.

I've got a sword attached to my character that swings when I press 'X' on the keyboard, but I'm having trouble defining its hitbox. I want the hitbox to cover the area that the sword currently is, acting as an extension of my character so it doesn't push him around or slow down his movement. However, when the hero slashes his sword on a wall, I want it to push him back.

The animation:

I want the hitbox to appear only for the duration of the animation (there are only two frames in the animation), then disappear until the sword is swung again.

Would I have to set the hitbox's position to certain coordinates for each frame of the animation in a long switch-case? How could I easily find these coordinates, or is it just trial and error?

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:
Libgdx change velocity of moveTo action I am trying to create physics for a ball in Libgdx. The ball starts moving after a pan and everytime the ball collides with a wall, a moveTo action is added to it. But my ball moves with a constant velocity (action time = distance/velocity). I want my ball movement to get slower smoothly.

Here is my method for calculating velocity

private float velocity(float panDistance) {
        float coefficent = 0.3f;
        return panDistance / coefficent;
    }

in act method of the Ball I decrement velocity

  @Override
    public void act(float delta) {
        super.act(delta);
        if (velocity < 100 && velocity > 0) {
            ballImage.clearActions();
        }
     velocity -= 3f*delta;
 }

When gesture detector detects a pan the method below is called.

public void moveTheBall(float tanX, float tanY) {
        if (ballImage.getActions().size == 0) {
            motionVector = (int) (tanX / Math.abs(tanX));
            motionAngleTan = tanY / tanX;
            panDistance = (float) Math.sqrt((tanX * tanX) + (tanY * tanY));
            velocity = velocity(panDistance);
            recursivelyAddActions(motionVector);
        }
    }

in recursivelyAddActions() method

private void recursivelyAddActions(int vectorDirection) {
    // AFTER SOME CALCULATIONS
    distance = (float) Math.sqrt(((predictionX - ballStartingPosX) * (predictionX - ballStartingPosX)) + ((predictionY - ballStartingPosY) * (predictionY - ballStartingPosY)));
        moveToAction = Actions.moveTo(predictionX, predictionY, distance / velocity);
        ballImage.addAction(moveToAction);
    }

this is not smooth and this does not work good. I need an advice to make this work better. Thank you.

sentences:
Handling Back Button in Android without implementing InputProcessor Please advice/clarifyon below issue in libgdx while handling back button in Screens.

I have already gone through these 2 threads,

https://stackoverflow.com/questions/7223723/in-libgdx-how-do-i-get-input-from-the-back-button

Is there a way to capture back button twice in same activity libgdx game

As per suggestion in above two threads, I have done something like this in 2 Screen of my Game,

public class MainMenuScreen implements Screen{
    //omitted unnecessary code
    @Override
    public void render(float delta) {
    if (Gdx.input.justTouched()) {
        game.setScreen(game.STS);   //Setting 2nd Screen
    } else if (Gdx.input.isKeyPressed(Keys.BACK)) {
        System.out.println("mms back");
        //if(Gdx.input.isKeyJustPressed(Keys.BACK))
        Gdx.app.exit();            // Exiting
    }
}

public class StageScreen implements Screen{
    //omitted unnecessary code
    @Override
    public void render(float delta) {
        if (Gdx.input.isKeyPressed(Keys.BACK)) {
        System.out.println("backed to mms in android");
        //if(Gdx.input.isKeyJustPressed(Keys.BACK))
        game.setScreen(game.MMS);  //going back to Main screen
    }
}

Above code works fine, when I press BACK in Stage Screen to call Main Screen, it exits the app immediately, without stopping in my Main screen, which is as per my expectations because I am using Gdx.input.isKeyPressed(Keys.BACK) instead of Gdx.input.isKeyJustPressed(Keys.BACK).

But my problem is, when I use Gdx.input.isKeyJustPressed(Keys.BACK) method in my Screens, it does not (return true) catch BACK key.

I have already set Gdx.input.setCatchBackKey(true) for my Game.

Any idea, why does isKeyJustPressed not responds while isKeyPressed does?

Thanks in Advance.

sentences:
How to apply code of certain script to another? I have a code in my "OnCollider" script to respawn whenever the player dies and has taken an object containing tag 'Respawn'.
1st script: OnCollider ;

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

    public class OnColllider : MonoBehaviour {
        public GameObject Doorfinder;
        public GameObject Door2;
        public Transform Camera;
        public Transform target;
        public GameObject Coin;
        public bool collided;
        public GameObject Playee;
        public GameObject currentRespawn;
        void Start(){
            Door2 = GameObject.Find ("Door0.2");
            Playee = GameObject.Find ("Player");
        }
        public void OnCollisionEnter2D(Collision2D collision){

            if (collision.gameObject.name ==

"scroll") {
            Destroy (collision.gameObject);
            Destroy (Doorfinder);
        }
        if (collision.gameObject.tag == "Fire" ) {
            Playee.SetActive (false);
        }

        if (collision.gameObject.name == "PathFinder") {
            Destroy (collision.gameObject);
            Destroy (Door2);
        }

        if (collision.gameObject.tag == "Coin") {
            Destroy (collision.gameObject);
        }

        if (collision.gameObject.tag == "subVillains") {
            Playee.SetActive (false);
        }
        if (collision.gameObject.tag == "Bramble") {

            Playee.SetActive (false);
        }

        Respawnable (collision);
    }
    public void Respawnable (Collision2D collision){
        if (collision.gameObject.tag == "Respawn") {
            collided = true;
            collision.gameObject.SetActive (false);

        }
        if (collided = true && Playee.activeInHierarchy == false) {
            transform.position = currentRespawn.transform.position;
            Playee.SetActive (true);
            collided = false;
        }
        if (currentRespawn.activeInHierarchy == false && collision.gameObject.tag == "Respawn") {
            currentRespawn = collision.gameObject;

        }

    }

}

2nd Script: Enemy;

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

public class MaxyMory: MonoBehaviour {
    public Vector2 origin;
    public float distance;
    public int layerMask;
    public float sider;
    public Vector2 secondorigin;
    public float bringer;
    public float lesngther;
    public GameObject destroy;
    public Vector2 origination;
    public float middle;
    public float lengther;
    // Use this for initialization
    void Start () {
        origin = new Vector2 (transform.position.x + bringer, transform.position.y + sider);
        origination = new Vector2 (transform.position.x + bringer, transform.position.y + middle);
        secondorigin = new Vector2 (transform.position.x + bringer, transform.position.y + lengther);
    }

    // Update is called once per frame
    public void Update(GameObject Playee){
        Debug.DrawRay (origin, Vector2.right*distance,  Color.red);
        Debug.DrawRay (secondorigin, Vector2.right * distance, Color.cyan);
        Debug.DrawRay (origination, Vector2.right * (distance + 30f), Color.gray);
        RaycastHit2D hit = Physics2D.Raycast (origin, Vector2.right, distance);
        RaycastHit2D anotherhit = Physics2D.Raycast (secondorigin, Vector2.right, distance);
        RaycastHit2D checker = Physics2D.Raycast (origination, Vector2.right, distance + 2f);
        if (hit.collider.tag == "Player" || anotherhit.collider.tag == "Player") {
            Playee.SetActive (false);
        }

    }

}

OnCollider is attached to the player while the enemy script is attached to the enemy itself.

sentences:
Virtual screen size with libgdx and GLES 2 I've been trying to use a virtual screen size for my libgdx desktop-android game. I'd like to always use a 16:9 aspect ratio but with a virtual screen size so everything would adapt automatically depending on the device size.

This post illustrates the process pretty well but my game crashes when camera.apply(Gdx.Gl10) is called. This is because I'm using GLES 2.0 (for not having to use multiple of 2 texture sizes). As stated in the OrthographicCamera doc, the apply method only works with GLES 1 and GLES 1.1.

Is there another way of applying my GL transformation to the camera so I can use a virtual screen resolution? Having to resize everything manually it's a total pain.

Thanks a lot.

sentences:
Rotating a Quad around it center How can you rotate a quad around its center?

This is what I am trying to do but it is not working:

    GL11.glTranslatef(x-getWidth()/2, y-getHeight()/2, 0);
    GL11.glRotatef(30, 0.0f, 0.0f, 1.0f);
    GL11.glTranslatef(x+getWidth()/2, y+getHeight()/2, 0);
        DRAW

my main problem is that it renders it off the screen..

draw code:

    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2f(0, 0);
        GL11.glTexCoord2f(0, getTexture().getHeight());
        GL11.glVertex2f(0, height);
        GL11.glTexCoord2f(getTexture().getWidth(), getTexture().getHeight());
        GL11.glVertex2f(width,height);
        GL11.glTexCoord2f(getTexture().getWidth(), 0);
        GL11.glVertex2f(width,0);
    }
    GL11.glEnd();

sentences:
How do you fully publish a game under your name, under 18? This has been a week of stress in trying to get things done correctly. It's all tied with keeping things legal and making sure I don't lose out on benefits of any kid. I have just recently finished up a game and now adding the final touches into it so I can make some sort of income.

I am incredibly sorry if I asked this on the wrong site. I felt that this is still relative to game development because it is the final step of developing your game: preparing yourself for distribution. If there is a better site to ask, or if some one has experience in this field please notify me.

Problems I am having:

I do not own a company, but just about every service I am trying to make use of is asking for a company name:

I do not know where I can find straight facts about owning, buying, or even keeping up with a name.
I am using my full name to publish my works because I read that in similar words, every one was born with a trade-mark known as their name.
I can not afford a company in the first place, I read some where that this can cost from 150 and higher. I have no income like said before and the only way I can think about making money as of this time is through my games which apparently requires me to already have at least a couple hundred dollars or more.

I don't know the most efficient and cheapest way to acquire a Tax ID

I don't know where I can read up on this subject, and apparently I am finding that I need an actual company name again - and I'm not entirely sure I can just use my name.
I'm not sure if there is an age limit on this, and as I currently stand I don't even have a documented signature.
This also costs a couple hundred dollars as I have read and I have no money.

I have no a clue what steps I should be taking for any of this.

I just want to publish games I make without feeling like I'm losing my hard worked time.
I want to be able to publish games without feeling I did something illegal.
I'd like to be able to have advertisers host on my game so I can make little revenue from people who can't afford buying full games.

Edit - In Detail:

I am currently trying to publish games to the google play store for android entertainment applications.
I am trying to use the advertisement service known as "mopub" : http://www.mopub.com/.
This is more like a linker than a direct advertiser that way you can get more benefits of multiple advertisers through your game.
I am living in the U.S

I don't want to quit making games because of issues like so. I can't publish my games right now if I don't have a legal representative name or a way to make money and not have others steal my rights of owner ship to the games I create.

sentences:
Not getting desired results with SSAO implementation After having implemented deferred rendering, I tried my luck with a SSAO implementation using this Tutorial. Unfortunately, I'm not getting anything that looks like SSAO, you can see my result below.

You can see there is some weird pattern forming and there is no occlusion shading where there needs to be (i.e. in between the objects and on the ground).  The shaders I implemented follow:

#VS
#version 330 core

uniform mat4 invProjMatrix;

layout(location = 0) in vec3 in_Position;
layout(location = 2) in vec2 in_TexCoord;

noperspective out vec2 pass_TexCoord;
smooth out vec3 viewRay;

void main(void){
    pass_TexCoord = in_TexCoord;
    viewRay = (invProjMatrix * vec4(in_Position, 1.0)).xyz;
    gl_Position = vec4(in_Position, 1.0);
}

#FS
#version 330 core

uniform sampler2D DepthMap;
uniform sampler2D NormalMap;
uniform sampler2D noise;

uniform vec2 projAB;
uniform ivec3 noiseScale_kernelSize;
uniform vec3 kernel[16];
uniform float RADIUS;
uniform mat4 projectionMatrix;

noperspective in vec2 pass_TexCoord;
smooth in vec3 viewRay;

layout(location = 0) out float out_AO;

vec3 CalcPosition(void){
    float depth = texture(DepthMap, pass_TexCoord).r;
    float linearDepth = projAB.y / (depth - projAB.x);
    vec3 ray = normalize(viewRay);
    ray = ray / ray.z;
    return linearDepth * ray;
}

mat3 CalcRMatrix(vec3 normal, vec2 texcoord){
    ivec2 noiseScale = noiseScale_kernelSize.xy;
    vec3 rvec = texture(noise, texcoord * noiseScale).xyz;
    vec3 tangent = normalize(rvec - normal * dot(rvec, normal));
    vec3 bitangent = cross(normal, tangent);

    return mat3(tangent, bitangent, normal);
}

void main(void){

    vec2 TexCoord = pass_TexCoord;
    vec3 Position = CalcPosition();
    vec3 Normal = normalize(texture(NormalMap, TexCoord).xyz);

    mat3 RotationMatrix = CalcRMatrix(Normal, TexCoord);

    int kernelSize = noiseScale_kernelSize.z;

    float occlusion = 0.0;

    for(int i = 0; i &lt kernelSize; i++){
        // Get sample position
        vec3 sample = RotationMatrix * kernel[i];
        sample = sample * RADIUS + Position;
        // Project and bias sample position to get its texture coordinates
        vec4 offset = projectionMatrix * vec4(sample, 1.0);
        offset.xy /= offset.w;
        offset.xy = offset.xy * 0.5 + 0.5;
        // Get sample depth
        float sample_depth = texture(DepthMap, offset.xy).r;
        float linearDepth = projAB.y / (sample_depth - projAB.x);
        if(abs(Position.z - linearDepth ) &lt RADIUS){
            occlusion += (linearDepth &lt= sample.z) ? 1.0 : 0.0;
        }
    }
    out_AO = 1.0 - (occlusion / kernelSize);
}

I draw a full screen quad and pass Depth and Normal textures. Normals are in RGBA16F with the alpha channel reserved for the AO factor in the blur pass. I store depth in a non linear Depth buffer (32F) and recover the linear depth using:

float linearDepth = projAB.y / (depth - projAB.x);

where projAB.y is calculated as:

and projAB.x as:

These are derived from the glm::perspective(gluperspective) matrix. z_n and z_f are the near and far clip distance.

As described in the link I posted on the top, the method creates samples in a hemisphere with higher distribution close to the center. It then uses random vectors from a texture to rotate the hemisphere randomly around the Z direction and finally orients it along the normal at the given pixel. Since the result is noisy, a blur pass follows the SSAO pass.

Anyway, my position reconstruction doesn't seem to be wrong since I also tried doing the same but with the position passed from a texture instead of being reconstructed.

I also tried playing with the Radius, noise texture size and number of samples and with different kinds of texture formats, with no luck. For some reason when changing the Radius, nothing changes.

Does anyone have any suggestions? What could be going wrong?

sentences:
How do you handle entity life-time and entities without all components in an ECS? I'm just starting to implement my own ECS and am drawing everything down on paper to make sure I understand it all before tackling the implementation in code. However I'm getting stuck on entity-lifetime and nothing I've read really answers my question.

Just to be sure I'm not missing something, my understanding so far is:

Components of the same type all sit next to each other in memory
Entities are just an ID, which Components refer to (i.e. Components have an "owner")
Components all have a unique Id

Great! So for example, say I have a PositionComponent, VelocityComponent, and VisibleComponent.

struct PositionComponent {
    vector2f position;
};

struct VelocityComponent {
    vector2f velocity;
};

struct VisibleComponent {
    Image imageToRender;
};

Great. Now let's say I have two types of Entity:

EntityA has a position, velocity, and visible components
EntityB has a position and velocity component, but is not visible

(let's hypothetically say that the Image in the visible component is the actual image data because every entity is super unique or something)

Say I have an PhysicsSystem which wants to iterate over all the Position and Velocity components and update the Position. This works, because every entity I've created has both of these components.

And so we're using EntityID as an index into the component arrays, we can easily know we're accessing the correct ones.

But then if there was a RenderSystem that wants to iterate over all the Position and Visible Components, the problem is that the EntityId can no longer be an index into the arrays, because not every Entity has every component.

So; the way I've thought to address this is by having an "Entity to Index Map" for each component. Basically, this EntityID has a PositionComponent in index 232 of the array.

But because of this, now any system that needs two or more Components to act, will lose out on all the benefits of an ECS, right?

I dismissed giving all components arrays empty space to keep them all "in sync", but that means I could have a lot of wasted data, which only gets worse the more different components I create.

There's then the problem of lifetime. If EntityID 232 is killed, I ideally would shift all the components in these arrays down to fill the gap, which again means I can't use EntityId as an index into the arrays.

A solution I thought of here was to re-use EntityIDs when they're no longer needed, maybe by using a 16bits of a 32-bit ID as the actual array index, and the other 16-bits as some sort of random guid to keep it clear that it's a new entity (and not the old one who's EntityID is being reused). This means I don't need to shift the data around, and wouldn't need to keep a map from ID to Index; but it doesn't solve the problem where not all entities have all components, so none of the arrays can ever be assumed to be "in sync".

So in summary my questions are:
1. How does a System in an ECS handle iterating over two separate components, when it's not guaranteed both component arrays will have the same entities components in the same indices?
2. Is it more beneficial to keep the data compact, or keep the arrays in sync?

sentences:
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:
Displaying whole screen image on multiple devices without stretching In my(Android) game, all of my sprites are scaled against to a particular ratio (this 'guide' ratio stays the same regardless of the actual ratio of the screen on which they are to be displayed) - these sprites are then displayed on screens of different ratios.

This way, the game can run full screen on any device, it simply means that more/less of the game is visible on some devices than it is on others.

However, I can't work out how to diaplay a large (full-screen) image on different devices.

The only thing I can think of is to simply create the original image for the larger display and the crop it down to fit other ratios.  Something like this:

So here, the image on the right is how the picture will show on the original device (full-screen with no cropping), the device on the left has a smaller width.  But what if this runs on a device with a larger screen?

In this case is it simply a case of (uniformly) stretching the image until it fills the screen?

Would be grateful for some guidance.

sentences:
Simple framerate counter? I'm making a first person shooter, and I've seen questions like this before, but the answer is either overly complicated or they're using SDL, GLFW, GLUT, or something else. I'm not using any of that. OpenGL, C++, and GLEW for me.

I am just a little confused on how to do a framerate counter, so if I could get pseudo-code or some code-snippets that would point me in the right direction, that would help.

sentences:
Would someone please explain Octree Collisions to me? I've been reading everything I can find on the subject and I feel like the pieces are just about to fall into place, but I just can't quite get it.

I'm making a space game, where collisions will occur between planets, ships, asteroids, and the sun. Each of these objects can be subdivided into 'chunks', which I have implemented to speed up rendering (the vertices can and will change often at runtime, so I've separated the buffers). These subdivisions also have bounding primitives to test for collision. All of these objects are made of blocks (yeah, it's that kind of game). Blocks can also be tested for rough collisions, though they do not have individual bounding primitives for memory reasons. I think the rough testing seems to be sufficient, though.

So, collision needs to be fairly precise; at block resolution. Some functions rely on two blocks colliding. And, of course, attacking specific blocks is important.

Now what I am struggling with is filtering my collision pairs. As I said, I've read a lot about Octrees, but I'm having trouble applying it to my situation as many tutorials are vague with very little code.

My main issues are:

Are Octrees recalculated each frame, or are they stored in memory and objects are shuffled into different divisions as they move? Despite all my reading I still am not clear on this... the vagueness of it all has been frustrating.
How far do Octrees subdivide? Planets in my game are quite large, while asteroids are smaller. Do I subdivide to the size of the planet, or asteroid (where planet is in multiple divisions)? Or is the limit something else entirely, like number of elements in the division?
Should I load objects into the octrees as 'chunks' or in the whole, then break into chunks later? This could be specific to my implementation, I suppose.

I was going to ask about how big my root needed to be, but I did manage to find this question, and the second answer seems sufficient for me. I'm afraid I don't really get what he means by adding new nodes and doing subdivisions upon adding new objects, probably because I'm confused about whether the tree is maintained in memory or recalculated per-frame.

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: How to make a Unity3d program/plugin and publish it on Asset Store? I want to make a plugin for Unity3d, like TornadoTwins's FPS Control. How can I do that? I already have Visual Studio 2010 installed.

sentences: Does Overlap2d have frustum culling? Does Overlap2d have its own frustum culling or do I have to implement my own?

sentences:
Variable not set before reading it error in GameMaker Studio 2 I am following along with a guide. I'm trying to reference code from an instance in my room, but whenever I try to run the script I get this error:

ERROR in action number 1 of Create Event for object objSmileyFace:
Variable objHealth.(100004, -2147483648) not set before reading it.
at gml_Object_objSmileyFace_Create_0 (line 4) - objHealth.playerHealth = objHealth.playerHealth + 10;
gml_Object_objSmileyFace_Create_0 (line 4)

It says objHealth is not set, which is not true. What am I doing wrong?

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:
Why are some of my normals facing away from the camera? I'm trying to use WebGL to render some simple models, and I'm running into issues where pixels near the edge of my model are passing normals to my fragment shader that point away from the camera. This is of course messing with my attempts to use physically-based shading, because BRDFs are only defined in the hemisphere around the normal vector. These normals aren't just slightly pointing away from the screen; if that was the case, I would chalk it up to floating-point error and clamp to acceptable values. But some of my pixels have v-dot-n values of -0.5 or less.
This happens on pretty much any mesh I try to render. I have verified that my vertex normals point away from the mesh. I have backface culling turned on. This happens with both perspective and orthographic projections. I have tested in both Firefox and Chrome. Everything else about my render looks fine.
My vertex shader looks like this:
precision mediump float;

uniform mat4 M;
uniform mat4 V;
uniform mat4 P;

attribute vec3 vertexPos_model;
attribute vec3 vertexNormal_model;

varying vec3 pos_world;
varying vec3 normal_world;

void main() {
    gl_Position = P * V * M * vec4(vertexPos_model, 1.0);
    pos_world = (M * vec4(vertexPos_model, 1.0)).xyz;
    // We can use M here instead of its inverse transpose because it does not scale the model.
    normal_world = mat3(M) * vertexNormal_model;
}

And my fragment shader looks like this:
precision mediump float;

uniform vec3 cameraPos_world;

varying vec3 pos_world;
varying vec3 normal_world;

void main() {
    vec3 n = normalize(normal_world);
    vec3 v = normalize(cameraPos_world - pos_world);
    float vAngleCos = dot(n, v);
    // This will highlight pixels whose view vectors are outside of the hemisphere around n.
    gl_FragColor = vec4(vec3(clamp(-vAngleCos, 0.0, 1.0)), 1.0);
}

Rendering with the fragment shader above gives me results like this:

Apologies if I'm missing something obvious!

sentences:
Unity3d iOS build restarts when regaining focus from browser I have an app made in Unity3d for android and iOS. In it, the user has the ability to link their accounts with Facebook and Twitter. For Facebook I use their Unity plugin, for Twitter, I open an external browser page that lets them accept or decline Twitter integration that then redirects to a php page the calls the app URI to return focus to Unity.

On Android this all works perfectly using an Intent in the Manifest. In IOS I'm running into issues though and I don't really know my way around XCode.

I'm using the newest version, XCode 7 Beta 2. The App runs as expected but for both the Facebook and Twitter authentications, upon returning focus to the App from the Browser, it completely restarts the App as if just launched rather then returning from a suspended state.

In the Unity build I have "Run in Background" selected. I setup the URL Scheme in XCode. Its a pretty basic app so I don't think its being closed due to Memory usage.

Any ideas or any settings I can change in XCode that might be preventing it from resuming?

*Note, if I just hit Home and send the App to the background it will properly resume, its only when called by the URI from the browser that it seems to completely restart.

sentences:
Number of iterations to real time I have an animation of traffic. I have 20 cars in road network, each car have a starting node and end node. Each car know how much distance does it need to travel in order to reach the end node. I move cars each 20 ms for 10 px. To move all cars from their start node to end node I need 60 iterations. That is 60*20ms = 1200ms.

Now I want to convert this time, or use data that I have, to a real time where car move 50km/h. How can I do that? Any idea?

sentences:
Creating an mouse-friendly GUI in a "sort of" Python console mode I'm developing a real-time rogue-like game during my spare time, using Python and libtcod, to learn programming (and have some fun). I would like to create some sort of mouse-friendly GUI, just like in Goblin Camp.

This game is 90% mouse-driven, with menus, scrollbars, buttons etc.
As a total noob with graphical interfaces, I just can't figure out how to do this. Example: How to display the name of a monster when the cursor is over it? I tried some ways, which more or less worked, but were always awful, impossible to maintain, hard to scale, and resource-consuming.

Is there a "simple" way to have something more like an object.OnClick() ?

sentences:
Documentation/Spec for Flash's XFL layout? Has anyone found an official spec or documentation on the XFL file layout?

Are there any design tools in existence or planned that can create XFL files? (Besides the official Adobe Flash Professional program)

sentences:
Networking library compatible C++ and Java There is any networking library like eNet compatible with Java and C++?

'm trying to find a way to communicate an Android game in Java with a C + + server, but I prefer to use a network library instead raw sockets.

I've found a java-enet, but I don't know if it's a mature project or compatible with eNet C version.

sentences:
Unity AudioSource.PlayClipAtPoint - controlling attenuation New developer here, looking to do some raycasting and controlling audio positioning in 3D space based on the raycasts interactions with other objects.
I've got the raycast 'casting' and able to report back where it collides other objects and managed to get audio to play back at that raycast point using AudioSource.PlayClipAtPoint()

However, PlayClipAtPoint doesn't allow me to change the audio 3d attenuation settings as a one shot audio object is generated and then removed immediately and I can't find any parameters to control this new object apart from a volume 0-1 float value.

I came across this post by Aldonaletto:

function PlayClipAt(clip: AudioClip, pos: Vector3): AudioSource; {
   var tempGO = GameObject("TempAudio"); // create the temp object
   tempGO.transform.position = pos; // set its position
   var aSource = tempGO.AddComponent(AudioSource); // add an audio source
   aSource.clip = clip; // define the clip
   // set other aSource properties here, if desired
   aSource.Play(); // start the sound
   Destroy(tempGO, clip.length); // destroy object after clip duration
   return aSource; // return the AudioSource reference
 }

But can't seem to get the local function to work in Unity as it complains about not using C# version 7 or above. If I upgrade the C# version in visual studio I get compiler errors on Unity's side.

Little bit stuck, would appreciate some advice! Some code below, just not sure what to put into the result of the if statement to get this to work.

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

public class raycasting : MonoBehaviour
{
    public float raycastlength = 3;
    public AudioClip playthis;
    public float ER_Volume = 1F;

    // Use this for initialization
    void Start()
    {
        //Debug.Log("I'm a sphere, yo!");
    }

    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;
        Ray forwardray = new Ray(transform.position, Vector3.forward);

        //draw the raycast in scene view
        Debug.DrawRay(transform.position, Vector3.forward * raycastlength, Color.white);

        if (Input.GetMouseButtonDown(0))
        {
            //Debug.Log("We pressed the fire button!");
            if (Physics.Raycast(forwardray, out hit, raycastlength))
            {
                if (hit.collider.tag == "evil")
                {
                    Debug.Log("Raycast Hit!");
                    Debug.Log("Distance to object:" + hit.distance);
                    //Debug.Log("Object hit point:" + hit.point);

                    //play a sound using playclipatpoint, but this doesn't allow us to change attenuation settings
                    AudioSource.PlayClipAtPoint(playthis, hit.point, ER_Volume);
                }
            }
        }
    }
}

sentences:
Simulate dirt spread (Normal distribution?) -This question is technically more math related, but it has to do with a simulation so I am here first. I can post this in the math SE instead if needed.

I am in the process of trying out some mesh deformation simulating the effect of sand/dirt being poured in a pile (Think hourglass sand) and I am trying to determine the best way to calculate the spread instead of becoming increasingly taller. I don't intend on actually matching sand/dirt physics, I just want to get my mesh to be somewhat close to the shape that pile would make as it grows.

I'm pretty sure that Normal Distribution is what I want, so in my desmos graph below, think of f(x) -green line- as the current dirt/sand piling up (where I am at in my code) and f1(x) -purple line- as the spread version (what I want to happen instead).

f1(x) is not correct but I think it is pretty close. Essentially i need the area of f1(x) to always equal the area of f(x) but as f(x) gets taller, f1(x) gets wider and taller, but not as tall as f(x).

https://www.desmos.com/calculator/ir8if2u8qq

I hope this makes sense to you gurus. If not, I can try to clarify more.

Edit: Also, if you open that graph, the slider for variable 'h' is the one im essentially trying to work with.

sentences:
Calculating normal vector on a 2d pixelated map I want to know an efficient way to get the normal of the surface of a 2d map. suppose an object hit the map, i want the object to bounce accordingly. The problem is, the "bounding box" of said object is several pixels in size and the map has many curves.

I thought about getting the pixels that collides with the object (don't ask me how) and calculating it's mean, and having the normal to be the line between said pixel and the center of the object

for those familiar with worms, I want to do the same when a grenade hits the map and bounces back

EDIT: I'm not looking for a 100% accurate formula, I want it to be efficient and believable enough

sentences:
How can I make Matrix Rain? I want to make 3d Matrix rain like this shader that you can rotate camera.I tried to convert this shader but It have many calculations that it's expensive inside game engine.then I tried to make this effect by trail Renderer but I couldn't make random letters inside trail renderer.finally I tried by Instantiating quads but It hadn't fade like trail.

so my question is how can I make this effect In efficient way?

sentences:
Stuttering Character When Colliding With Wall XNA 4.0 Help! I'm trying to make a platformer game without tiles. I've made a collision handler to handle collision between Player and Stage(platform)and a collision checker, here's the code:

public void handleCollision(GameObject OtherObject)
    {
        if(this.CollidesWith(OtherObject))
        {

            if(OtherObject is Stage)
            {

                float rightEdgeDistance = OtherObject.BoundRect.X - (Position.X + this.BoundRect.Width);
                float leftEdgeDistance = OtherObject.BoundRect.X + OtherObject.BoundRect.Width - Position.X;

                float TopEdgeDistance = OtherObject.BoundRect.Y - (Position.Y + this.BoundRect.Height);
                float BottomEdgeDistance = OtherObject.BoundRect.Y + OtherObject.BoundRect.Height - Position.Y;

                float Left_Right_SmallerDistance = Math.Min(Math.Abs(rightEdgeDistance), Math.Abs(leftEdgeDistance));
                float Top_Bottom_SmallerDistance = Math.Min(Math.Abs(TopEdgeDistance), Math.Abs(BottomEdgeDistance));

                float smallerDistance = Math.Min(Math.Abs(Left_Right_SmallerDistance), Math.Abs(Top_Bottom_SmallerDistance));

                if (smallerDistance == Math.Abs(leftEdgeDistance))
                {
                    Position.X = OtherObject.BoundRect.X + OtherObject.BoundRect.Width;
                    Velocity.X = 0;
                }
                else if (smallerDistance == Math.Abs(rightEdgeDistance))
                {
                    Position.X = OtherObject.BoundRect.X - this.BoundRect.Width;
                    Velocity.X = 0;
                }
                else if (smallerDistance == Math.Abs(BottomEdgeDistance))
                {
                    Position.Y = OtherObject.BoundRect.Y + OtherObject.BoundRect.Height;
                    Velocity.Y = 0;
                }
                else if (smallerDistance == Math.Abs(TopEdgeDistance))
                {
                    Position.Y = OtherObject.BoundRect.Y - this.BoundRect.Height;
                    Velocity.Y = 0;
                }
            }
        }
}

My collision checker:

public bool CollidesWith(GameObject OtherObject)
    {
            return BoundRect.Intersects(OtherObject.BoundRect);
    }

Here's my inputHandler method for the Player class:

public void inputHandler(GameTime gameTime)
    {
        Velocity = Vector2.Zero;

        if (Keyboard.GetState().IsKeyDown(Keys.W) )
        {
            Velocity.Y -= moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        }
        else if (Keyboard.GetState().IsKeyDown(Keys.S) )
        {
            Velocity.Y += moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        }
        else
            Velocity.Y = 0;

        if (Keyboard.GetState().IsKeyDown(Keys.A) )
        {
            Velocity.X -= moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        }
        else if (Keyboard.GetState().IsKeyDown(Keys.D) )
        {
            Velocity.X += moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        }
        else
            Velocity.X = 0;

    }

And here's my code for the Update method in Player:

public void Update(GameTime gameTime,List<Stage> lstOtherObject)
    {
        inputHandler(gameTime);
        foreach (GameObject OtherObject in lstOtherObject) { handleCollision(OtherObject); }

        Position += Velocity;
    }

This works, if I don't continue to press the keys in the bounded direction. If I do, it will stutter in and out of the platform bounds.
Like this:
It goes a bit into the grey platform
and then it goes out of the grey platform to the intended place.
Can someone help? I want to learn, but I cant seems to figure out whats wrong with this.I tried many things, but still I can't achieve what I want, that is for the player to stop when it reaches the bounds of the platform and never going into it.Appreciate if someone can bring a clear solution and explanation to this. Thanks.

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: 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:
How do I know if my game's average game session time is too small? My game has only one life, and the aim is to stay alive as long as possible to get as many points as possible (it's an endless runner).

Using Google Analytics I found that players are staying alive for an average of 17 seconds. I could easily increase or decrease this by manipulating acceleration or starting speed. The question is, should I change it at all? Is there any research or general ideas on the best playing time for a game like this? I would also like to know about any research about how long an ideal mobile game session should last.

sentences:
Away3D vs Papervision3D I have served Google and I found that there are many 3D game engine also I have another question here

Do Playfish and Zynga use Flash game engines?

and I know that away3D is used for social media games on Facebook

but I'm confused now which one is the best and will be good and easy to start with as I'm very new in game development

so if anyone can advice me I will be thankful

also if anyone can support me with tutorial or book that may help me this is will be great

Thanks in Advance

sentences:
Unity 5 Camera Functions Usage Error How to use functions like ScreenToRayPoint() in Camera class?

I have used this code:

Ray ray = camera.ScreenPointToRay(Input.mousePosition);

and it says

  Component.camera is obsolete, instead using GetComponent()

Then I tried these:

Camera cam = GetComponent<Camera>();

Ray ray = cam.ScreenToRayPoint(Input.mousePosition);

and it says

  Camera doesn't contain a definition of ScreenPointToRay and no extension method 'ScreenPointToRay' accepting a first argument of type 'Camera' could be found.

sentences:
How do I run my XBOX XNA game without a network connection? I need to demo my XBOX XNA game in college. The college doesn't allow this type of device to connect to the network. I deployed my game to the Xbox and it is sitting in the games list along with my other games. It runs fine with a network connection but when its offline it comes up with an error message saying its needs a connection to run the game.

This makes no sense, the game is deployed on the Xbox memory, it must be some security policy or something!

Is there any way around this? The demo is on monday!

sentences:
sound stops after scene reloads in unity3d I'm recently facing problem regarding the inclusion of sounds in my game. Although i have used the technique of DontDestroyOnLoad() for background sounds and that work perfectly fine. But for the casual sound, it is creating problem that it stops during scene reloads. I have my script below that contains AudioClips and AudioSources and that script is attached to an empty game object, and calling that script in different scripts for the playback of the sounds.

AudioScript.cs

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

public class AudioScript : MonoBehaviour {

    public AudioClip pinshit;

    public AudioClip rowlingball;

    public AudioSource rowling;

    public AudioSource hit;

    public AudioClip cheer;

    public AudioClip strike;

    public Text counttext;

    public AudioClip spare;

    public AudioClip sorrow;

    public AudioClip winaudio;

    GameObject[] music;

    // Use this for initialization
    void Start () {

        rowling = GetComponent<AudioSource>();

        music = GameObject.FindGameObjectsWithTag("class");

        if (music.Length == 1)
        {

        }
        else
        {
            for (int i = 1; i < music.Length; i++)
            {
                Destroy(music[i]);
            }
        }

    }

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

    }

    private void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
    }
}

To play sound on different actions routines

sorrow.clip = GameObject.FindWithTag("class").GetComponent<AudioScript>().sorrow;

                sorrow.Play();

                sorrow.volume = 1;

sentences:
Why is my sine based scale animation not changing? I followed the code at this YouTube channel: https://www.youtube.com/watch?v=OR0e-1UBEOU&t=4178s, and did some modification on the code so that the scale of the bird will change during projectile using the absolute sine function under the if statement.
I'm using the scale (16/20)*|sin(distance)| for my x and y component. However, when I launch the game, the scale stays as 0 along the path. Why is my scale staying as a constant zero?
using UnityEngine;
using UnityEngine.Assertions.Must;
using UnityEngine.SceneManagement;

public class Bird : MonoBehaviour
{
    Vector3 OldPosition;
    Vector3 DistanceDifference;
    float TotalDistance = 0;
    Vector3 _initialPosition;
    private bool _birdWasLaunched;
    [SerializeField] private float _launchPower = 500;

    void start()
    {
        OldPosition = transform.position;
    }

    private void Awake()
    {
        _initialPosition = transform.position;

    }

    void Update()
    {
        if (_birdWasLaunched && GetComponent<Rigidbody2D>().velocity.magnitude > 0.1)
        {
            DistanceDifference = transform.position - OldPosition;
            TotalDistance += DistanceDifference.magnitude;
            OldPosition = transform.position;
            transform.localScale = new Vector3((16/20)*Mathf.Abs(Mathf.Sin(TotalDistance/5)), (16/20)*Math.Abs(Mathf.Sin(TotalDistance /5)) , Mathf.Sin(TotalDistance /5));
        }

        if (transform.position.y > 15.00 || transform.position.y < -15.00 || transform.position.x > 18 || transform.position.x < -18)
        {
            string currentSceneName = SceneManager.GetActiveScene().name;
            SceneManager.LoadScene(currentSceneName);
        }
    }

    void OnMouseDown()
    {
        GetComponent<SpriteRenderer>().color = Color.red;
    }

    private void OnMouseUp()
    {
        GetComponent<SpriteRenderer>().color = Color.white;
        Vector2 directionToInitialPosition = _initialPosition - transform.position;
        GetComponent<Rigidbody2D>().AddForce(directionToInitialPosition * _launchPower);
        GetComponent<Rigidbody2D>().gravityScale = 1;
        _birdWasLaunched = true;
    }

    private void OnMouseDrag()
    {
        Vector3 newPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        transform.position = new Vector3(newPosition.x, newPosition.y);
    }
}

sentences:
GLSL shader without a vertex array Ok so I have a idea for a neat GPU driven curve renderer, and I realised that the vertex shader can be hardwired to generate points of the curve segment (to be rendered as a line strip) without sending any vertex positions - gl_Position could be set completely procedurally.

That said I'd still need to specify a "t" value per point via vertex attributes.

Is it possible to specify attributes (ie via glVertexAttribPointer) without specifying vertices? Or does the GL need "space" in the buffers for vertices - even if they aren't initialized.

sentences:
Is there an in memory data store that is feasible for real time, non-networked games? I would like to know if anyone has recommendations or experience with using an in memory data store for a real time, non-networked game. This is not necessarily for loading levels or saving data, but to be accessed within the game loop as the game is running. Pretty much everything I look at w.r.t. data stores in games refers to networked games like MMOs.

As I am working on my game I find myself building a lot of ad hoc structures to hold various bits of game data and I was thinking it would make more sense to leverage work in this area that would provide a more consistent (and hopefully efficient) retrieval/storage method.

Does anyone have any experience or recommendations on in memory databases or key value stores or document stores that would be reasonable?

For my own purposes, my game is being written in Scala but the answers don't need to be Scala/Java specific.

EDIT

To be more specific I am primarily talking about entity data and lists of entities not necessarily things like 3D meshes.

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:
MMO techniques, algorithms and resources for keeping bandwidth low? Are there any resources and documentation on how current MMOs handle the action and movement data from the compression to the handling on the client?
Any resources for movement prediction algorithms?

I'm especially interested in those that have wsad movement and focus on keeping latency low
Also what is the packet rate and size for different types of MMOs(network wise)?

Is there a way to scale the packet rate or outright disable some packets if the player can't reach or in the later case see them?

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:
Attach simple, portable 2D graphics for a c++ game I have a game written in C++ (using STL and c++11 extensively).

I would like to do the following things:

Attach graphics to this game -> Think chessboard of some kind. I just need some pictures and simple status bars, no movement necessary, even though it would be nice I guess. It's a turn based game.
Port the game across Windows / Android / iOS

So, all in all, I need a tool that would provide a portable, simple, 2D graphical interface. A tool that would allow me to "bind" my c++ code to portable graphical representation.

How would I go about making this idea come true?

sentences: Is using a half-edge mesh structure feasible? Is it feasible to use half-edge mesh, in games, instead of vertex-face structure? What comes to my mind is that it could be useful in mesh simplification (dynamic level of detail). However, I'm worried it could take too much memory, or even have a negative impact on a games rendering performance.

sentences:
How do i easily clamp my cameras rotation when using transform.rotate() I'm making a fps controller, and I'm trying to clamp my cameras x rotation.  Here's my code so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    // Start is called before the first frame update

    [SerializeField] Camera cam;
    [SerializeField] float camSpeed;
    [SerializeField] float walkSpeed;
    [SerializeField] float jumpSpeed;

    float yaw;
    float camPitch;
    Vector3 direction;
    Vector3 worldDirection;

    Rigidbody myrigbody;
    void Start()
    {
        myrigbody = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        camPitch = -Input.GetAxis("Mouse Y") * camSpeed;
        cam.transform.Rotate(new Vector3(camPitch, 0, 0));
        yaw = (yaw + Input.GetAxis("Mouse X") * camSpeed) % 360f;

        direction = new Vector3(Input.GetAxis("Horizontal") * walkSpeed, myrigbody.velocity.y, Input.GetAxis("Vertical") * walkSpeed);
        worldDirection = transform.TransformVector(direction);

        if(Input.GetKeyDown(KeyCode.Space))
        {
            myrigbody.AddForce(new Vector3(0, jumpSpeed, 0), ForceMode.Impulse);
        }
    }
    private void FixedUpdate()
    {
        myrigbody.MoveRotation(Quaternion.Euler(0, yaw, 0));
        myrigbody.velocity = worldDirection;
    }
}

I know that I want to clamp my cameras X rotation within a range of -89 to 89, but no matter what I try I can't figure out how to clamp the rotation while using cam.transform.Rotate(). I don't think I can clamp camPitch, because it is reset every frame, and I can't figure out a way to directly clamp the cameras rotation.  The cameras rotation is not resetting, so if I could somehow clamp it it would work.  Is this possible, or do I need to try a different method?  How do i get this to clamp correctly?

sentences:
Project vertex on a line V,A and B are 3 points in 3D space and We have d0 (distance of V from (AB)line).

I want to calculate question mark point in the image above!

sentences:
Select specific tile in Tilemap I am following this video tutorial on how to implement drag-to-select behavior like in an RTS. The only difference is, I'm using a tilemap.
The selection area is a square which I can drag to make it as big as I want, like in any top down RTS.
CodeMonkey in his video uses Physics2D.OverlapAreaAll to get a list of all colliders in the selected area. I want to use this to specifically see which "vegetation" tiles I've selected. However, no matter which vegetation tile I select, or how many, I always get one result - the vegetation tilemap itself.
You can clearly see from this picture that every grass tile and every tree tile have a collider around them, which is why this works, but how can I get exactly those that I selected?

Other than vegetation from the tilemap, I also want this to work with GameObjects that have Box2DColliders on them, and that works out of the box. I also made those MonoBehaviors inherit an interface called ISelectable, so I can only add to the selected list entities that have that inherit that interface. I tried to do the same with vegetation like so public class Vegetation : Tile, ISelectable but it doesn't work.
What am I missing? Can this even work on a specific tile basis?

sentences:
Why the state of the duration is all the time 7 even if updating the state inside the while in the ienumerator? I want to get the current coroutine state.

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

public class DepthOfField : MonoBehaviour
{
    public UnityEngine.GameObject player;
    public PostProcessingProfile postProcessingProfile;
    public bool dephOfFieldFinished = false;
    public LockSystem playerLockMode;

    private Animator playerAnimator;
    private float clipLength;
    private Coroutine depthOfFieldRoutineRef;
    private DepthOfFieldModel.Settings depthOfField;
    private DepthField state;

    void Start()
    {
        if (depthOfFieldRoutineRef != null)
        {
            StopCoroutine(depthOfFieldRoutineRef);
        }

        playerAnimator = player.GetComponent<Animator>();

        AnimationClip[] clips = playerAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        DepthOfFieldInit(clipLength);

        state = new DepthField();
    }

    public void DepthOfFieldInit(float duration)
    {
        depthOfField = postProcessingProfile.depthOfField.settings;
        depthOfField.focalLength = 300;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, duration));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }

    public IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)
    {
        playerLockMode.PlayerLockState(true, true);

        float counter = 0f;

        while (counter < duration)
        {
            var dof = postProcessingProfile.depthOfField.settings;

            counter += Time.deltaTime;

            float val = Mathf.Lerp(fromVal, toVal, counter / duration);

            dof.focalLength = val;
            postProcessingProfile.depthOfField.settings = dof;

            state.duration = duration;
            state.focalLength = val;

            yield return null;
        }

        playerAnimator.enabled = false;
        dephOfFieldFinished = true;
        depthOfFieldRoutineRef = null;
    }

    public struct DepthField
    {
        public float focalLength;
        public float duration;
    }

    public void Save()
    {
        SaveGame.Save("depthoffieldstate", state);
    }

    public void Load()
    {
        Time.timeScale = 1f;
        depthOfField = postProcessingProfile.depthOfField.settings;
        DepthField state = SaveGame.Load<DepthField>("depthoffieldstate");
        depthOfField.focalLength = state.focalLength;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, state.duration));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }
}

Inside the while loop I'm doing :

state.duration = duration;
state.focalLength = val;

The focalLength value does change if for example I save onethe game start the focalLength value will be 299 and if I will save after the coroutine has finished the focalLength value is 1.

But the coroutine duration value is not changing it keep staying on 7 when saving even if the coroutine has finished and should be 0 it still 7.

The value 7 of the duration is coming from the clipLength.

I can't get the current duration time of the coroutine.
In the Load function I'm starting the coroutine over again but since I'm using the loaded focalLength value and duration value it should look like the coroutine is continue from the last saved point. But I can't get the correct duration value when saving.

sentences: How can I create beautiful, random, abstract images? To generate random, beautiful, abstract images – which algorithms are not too complex and give good results?

sentences:
How can I improve my touch slide mechanic to be more smooth and fluid? I have the following C# code, but it leaves me with two problems:

void FixedUpdate()
{
    if (Input.touchCount == 1)
    {
        this.transform.Translate(Input.touches[0].deltaPosition.x * 0.009f, 0, 0);
    }
}

Firstly, the gameobject (which is a sphere in my case), has a tendency to leave the ground and fly into the air. Additionally, it is not as smooth and snappy but fluid as I would like it to be.

If you look at some of the following gameplay videos, you will see the kind of movement I am looking for.

"Splashy!" Gameplay
"Sky Ball" Gameplay
"Balls Race" Gameplay

More specifically, from actually playing each of the above games, there is a certain "ratio" that seems to be operating in regards to each swipe gesture and the actual movement of the ball. That is, the ball does not go exactly where the finger goes, for it is slightly ahead, if that makes sense. What I mean is, the device is only so wide, yet for that width, the ball can always reach it's required destination on either end of the horizontal axis. This must mean that for every pixel the finger moves, the ball moves a little bit more to fit that pixel density of the screen. In other words, in the case of "Splashy!", it's clear that even if the finger moves the entire distance across the screen, the ball moves more than double that distance.

By "smooth", "fluid", and "snappy", I mean that the swiping gesture is very responsive. It moves where you want it to and does not over or undershoot. Additionally, the "snappy" effect is present when you stop swiping. The ball seems to "snap" into it's end position.

My question, then, is what is the best way to improve my script as to achieve the polished mechanic I am looking for, as is depicted in the above videos? Also, how can I keep the sphere on the ground without constraining any axes on the rigidbody? I am using Unity3D with C#.

I would appreciate any help you could provide. Thank you.

sentences:
Loss in quality on downsized sprites in Game Maker I'm having an issue with sprites quality in Game Maker.

I have some sprites used for UI with an original size of 2048*512. I need to resize them in game to 512*128. But when I do, I got a loss in quality.

This is the original picture, resized to 512*128 with a third-party software:

This is the sprite, as it appears in Game Maker room editor (and in game) once resized to 512*128:

Are there general guidelines for this kind of situation?

By the way, it's on Windows. Though I tried launching the game on an Android device and the result was the same.

sentences:
How do we coordinate which order the systems get processed within an ECS? If I knew all of the systems at compile time, I could order them myself. However, I intend on having user-defined mods. This adds a level of complexity, in that I (as the framework developer) don't know which mods will be developed, or installed on a particular user's machine.

I've thought about adding some sort of execution ordering

// within core code
systemRegistrar.register(PhysicsSystem.class).before(RenderingSystem.class);

// within third-party mod
systemRegistrar.register(ModSystem.class).before(PhysicsSystem.class);

I've thought about an incidental ordering using some sort of message or event bus

// within core code
// - PhysicsSystem
public void update() {
    // do physics-y stuff
    eventBus.send(new PhysicsSystemUpdatedEvent());
}

// - RenderingSystem
public void handle(PhysicsSystemUpdatedEvent event) {
    // do rendering stuff
    eventBus.send(new RenderingSystemUpdatedEvent());
}

But this blurs the line between what will happen, and what could happen.

Another thought that came into my mind is that we can be a little bit dirty and not care too terribly much about what order the systems get executed in, because even if we render before the physics are applied, the next frame will then render the physics update that was made in the previous frame. It's consistent, but it blurs the line between what happens within a frame.

sentences:
How to create class for storing different types of vertex? I am writing graphics engine for educational pursoses and have some problems.

I need to have ability to use different vertex formats (for example position+normal+uv or position+normal+uv+bones+weights).
I have different structs for these formats and have a class HardwareBuffer that stores OpenGL vertex and index buffers.
The problem is to give this class the ability to work with different types of vertices.
There are a way to make this class template and use like this:

HardwareBuffer<VertexPosNormUV> buffer;
buffer.addVertex(VertexPosNormUV(vector3(1, 1, 1), vector3(1, 0, 0), vector2(1, 0)));

But in my engine there is an interface IRenderer that have virtual method drawDataFromHardwaveBuffer. Also there is a class OpenGLRenderer that is inherited from it. And now I can't pass my hardware buffer object to this method because there isn't a way to use template virtual methods.

Renderer renderer = createRenderer(GraphicsDriver::OpenGL3);
renderer->drawDataFromHardwaveBuffer(buffer); // can't make this method template

I can write functions for every type of vertex but this is not a solution.

How can I solve the problem?

sentences:
Getting Components to their respective System in Entity-Component Engine I asked this question in stackoverflow, but I didn't get any responses. I think it's better suited in this exchange.

I'm building a game engine of sorts (purely educational) and am not sure the best way to keep a large system decoupled when using objects the are shared by systems.

My engine is making use of an entity-component design where components contain only state. Systems are the driving force of making these components run so I need to be able to register components with their respective system. I am just unsure on how to pass the components through the hierarchy which looks like this:

I can think of a few ways of dealing with this.

Option 1: Singleton.
If I make my Engine object a singleton I can use static methods directly in my input component to bind to the input system.

class InputComponent: public Component
{
    InputComponent()
    {
        Engine::getEngine()->getInputSystem()->bindInputComponent( this );
    }

    virtual ~InputComponent()
    {
        Engine::getEngine()->getInputSystem()->unbindInputComponent( this );
    }
}

This has the benefit of components automatically binding and unbinding themselves to their system which is convenient. It has the downfall of being a singleton (not necessarily bad, but it can possibly make my engine inflexible in the future) and my InputComponent "knows" about the InputSystem which might be bad design.

Option 2: Work down from scene system. I can make my scene system responsible for binding and unbinding components.

class SceneSystem: public System
{
    void setActiveScene( Scene* scene )
    {
        // Deactivate (and unset components) for the current scene.
        unsetActiveScene();

        for( auto i : scene->getEntities() )
        {
            for( auto j : i->getAllComponents<InputComponent>() )
            {
                // Send message through mediator to bind the component
                DataMessage<InputComponent*> bindMessage( MESSAGE_BIND_INPUT_COMPONENT, j );
                Message response;
                sendMessage( &bindMessage, &response, SYSTEM_INPUT );
            }
        }
    }
}

In this way the input component isn't worried about looking up the hierarchy. But now my scene system has to "know" about input components (and all other components that need to be registered). This is coupling my system.

Also if I need to add/delete components I'll need to do it through the scene system.

Option 3: Working up from input component. The last thing I can imagine is to instead work my way up the hierarchy from the input component. I think in this scenario I would also add a general bindComponent to the scene system so not too much complexity about the mediator messaging creeps into my components.

class SceneSystem: public System
{
    template <typename T>
    void bindComponent( T* component, int system )
    {
        DataMessage<T*> bindMessage( MESSAGE_BIND_COMPONENT, component );
        Message response;
        sendMessage( &bindMessage, &response, system);
    }
}

class InputComponent: public Component
{
public:
    InputComponent( Entity* parentEntity ) : m_parentEntity( parentEntity )
    {
        m_parentEntity->getParentScene()->getSceneSystem()->bindComponent<InputComponent>( this, SYSTEM_INPUT );
    }

    virtual ~InputComponent()
    {
        m_parentEntity->getParentScene()->getSceneSystem()->unbindComponent<InputComponent>( this, SYSTEM_INPUT );
    }

private:
    Entity* m_parentEntity;
}

This has the effect of my hierarchy being bidirectional (not sure if this is a bad thing)

Of these options, which is better for keeping such a system flexible and reasonably decoupled. Also point out other options especially if there are flaws with my current design and/or understanding of the problem.

sentences:
Would it be good idea to use blender to create sprite and animating rather than using a 2d software to create sprites and animating them in 2d I'm making this 2d side scroller game. I had been working on 3d games(modelling and animation) for 2 years, thus my experience with 2d sprites is none to zero.

So I've been struggling with asset creation in 2d especially thinking about animation is kind of stressing me out. There will be a lot of fighting animation in the game and may be that I'm new to 2d it just feels impossible to create a character and animating it do lots of combos.

An idea poped into my mind, using blender to create animation and rendering the animation as png to create spritesheet. I'm not sure if that's already a thing, I've did some research and there are people who do recommend and there are those who don't. It just felt a bit vague.

So my question is, would using blender to create 2d sprites and their animations be easier, since I'm exprienced with it. Or should I try to handle  sprites in completely 2d?
side note: every character is gonna be plain black(like shadow)

sentences:
Which pathfinding algorithm should I use for multiple enemies and tower placement? I am new to game development and I am developing my first "Tower Defense"-type game.

I need a pathfinding algorithm to place my towers and to move enemies.

For tower placement case: I want the algorithm to run from entry to exit so that if it passes, the user can place tower and if fails user can't.
For the enemy case: it should help multiple enemies to find their shortest path by running it for each enemy's current position to exit.

Searching about path finding I have found some algorithms like Floyd–Warshall, A*, Breadth First, Dijkstra's and some others. Some answers give priority to Floyd's over it for path finding with multiple enemies. So what do you suggest that I use for my case?

My grid size is 17x23 and my game would have multiple entry and exit points in future.
I am using the Unity game engine and scripting in C#.

sentences:
How to use TextureArray's Pre-OpenGL 4.2? I've been using TextureArray's in my current Project; However, I have come to the problem of OpenGL 4.2 functions not being on the present Mac software when ported over. Due to only version 4.1 of OpenGL being supported.

All my problems stem from the single function. glTexStorage3D which is the only function not supported.

This is how it currently works on my OpenGL 4.2 capable machine. (and works wonderfully I might add.)

1.) I allocate the memory beforehand with glTexStorage3D.

glGenTextures(1, &_texture);
glBindTexture(GL_TEXTURE_2D_ARRAY, _texture);
glTexStorage3D(GL_TEXTURE_2D_ARRAY, 255, GL_RGBA8, 16, 16, _maxLayerCount);

2.) Then per image I would load it into the before allocated memory block with the following.

glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, _layerCount, 16, 16, 1, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());

3.) Success.

How would I go about mimicking this functionality pre OpenGL 4.2 without using Immutable Storage? Aka (glTexStorage3D).

I've tried stuffing all my images into a horizontal single image and then loading that into just glTexImage3D with no success. Am I missing something?

Additional Note: I prefer to use TextureArray's for my project in order to avoid rendering artifacts I had using a TextureAtlas. It's simplicity during shaders is also a big plus.

sentences:
Application to record sound effects for games I'm having kids record sounds using their PCs (a few have Macs as well) for use in the games they create.  The built-in windows 7 sound recorder is surprisingly poor, didn't older versions of windows include a sound recorder that could at least play back the sound you recorded or tell you how long it was?

I tried Audacity, but that is pretty confusing for kids.  They record a sound, don't like it, then want to record again and it merges those 2 sounds instead...  It's also a little confusing trying to simply specify when the sound starts and ends.

Is there some tool game developers use to easily create sound effects from a mic?

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:
How to prevent rendered wound from sliding on moving character? I am trying to display a rendered wound on the character, but I still can't figure out how to display it properly without sliding on character's body.

I'm following this link on rendering the wounds on characters but I still can't figure out why it isn't working.

This is what I have so far on rendering the wound based on hit location

What have I done wrong? Any ideas is appreciated. Thanks!

p.s This is how I draw the wound based on hit location.

UPDATE:
So I replace WorldPosition into Preskinned Position based on the comment suggested and the sphere mask won't render at all. I thought my HitLocation must be the problem, so I get back to the linked post to understands better on how to approach this, and included some C++ as well, but all those still resulting in the same results. The sphere mask keep on sliding on the body.

This is the code I have been using for both callable functions above

//Recursive function to have results relative to world origin
FTransform UGestureMathLibrary::GetWorldSpaceTransform(FReferenceSkeleton RefSkel, int32 BoneIdx)
{
 FTransform BoneTransform;

 if (BoneIdx > 0)
 {
  BoneTransform = RefSkel.GetRefBonePose()[BoneIdx];

  FMeshBoneInfo BoneInfo = RefSkel.GetRefBoneInfo()[BoneIdx];
  if (BoneInfo.ParentIndex != 0)
  {
   BoneTransform *= GetWorldSpaceTransform(RefSkel, BoneInfo.ParentIndex);
   UE_LOG(LogTemp, Warning, TEXT("if parent index is not equal to zero"));
  }
 }

 return BoneTransform;
}

//Reference pose bone transform
FTransform UGestureMathLibrary::GetRefPoseBoneTransform(USkeletalMeshComponent* SkelMesh, FName BoneName)
{
 FTransform BoneTransform;

 if (SkelMesh && !BoneName.IsNone())
 {
  SkelMesh->ClearRefPoseOverride();
  FReferenceSkeleton RefSkel;
  RefSkel = SkelMesh->SkeletalMesh->RefSkeleton;
  BoneTransform = GetWorldSpaceTransform(RefSkel, RefSkel.FindBoneIndex(BoneName));
  //BoneTransform = RefSkel.GetRefBonePose()[RefSkel.FindBoneIndex(BoneName)];
 }

 return BoneTransform;
}

//Bone transform
FTransform UGestureMathLibrary::GetBoneTransform(USkeletalMeshComponent* SkelMesh, FName BoneName)
{
 FTransform BoneTransform;

 if (SkelMesh && !BoneName.IsNone())
 {
  FReferenceSkeleton RefSkel;
  RefSkel = SkelMesh->SkeletalMesh->RefSkeleton;
  BoneTransform = SkelMesh->GetBoneTransform(RefSkel.FindBoneIndex(BoneName));
 }

 return BoneTransform;
}

Am I missing something?? Thanks again!

sentences:
What is a good starting platform for a teenage game programmer? My son (15) has decided that he wants to pursue a career as a games programmer. I've said that he should get started now with a simple game. He has no programming experience yet, but I am a programmer (business apps, not games) so I can teach him programming, but what would be a good platform for him to start on? Initially I'm looking for something that can provide quick results, to keep his enthusiasm up.

What would you suggest?

sentences: How do I calculate the angle of the slope at a point on a 2D bitmap terrain? I have an arbitrary destructible bitmap terrain like the one in "Worms". It's easy to work out if a character or missile intersects the terrain, but how do I work out the angle of the slope at the contact point, so I can make grenades roll down hills, bounce off at the right angle, etc. I know it can be down by somehow taking a sample of points around the impact point and seeing which ones intersect, but I'm not sure exactly how to go about it, and in an efficient way.

sentences:
How do I slowly decrease a float from 0.5 to 0? I have a 2D racing game with a track, and the track is repeated with vector2. When I die, I want to slowly stop moving the track, but I do not know how.

Here is my code:.

using UnityEngine;
using System.Collections;

public class trackMove : MonoBehaviour
{
    public static trackMove Instance { get; private set; }

    public float speed;
    Vector2 offset;

    // Use this for initialization
    void Start ()
    {
        Instance = this;
    }

    // Update is called once per frame
    void Update ()
    {
        offset = new Vector2(0, Time.time * speed);
        GetComponent<Renderer> ().material.mainTextureOffset = offset;
    }
}

Here is my current Inspector view:

sentences:
How can I disable mipmapping on textures loaded from .X files? I'm trying to render a plane mesh textured with a simple grid pattern. The problem is that XNA keeps mip-mapping the texture in horrible, horrible ways.

What I'm trying to achieve is to get this grid to look as close to vector graphics as possible (so anisotropic filtering is out of the question, I must use point filtering):

SamplerState ss = new SamplerState();
ss.Filter = TextureFilter.Point;
ss.MaxMipLevel = 0;
ss.AddressU = TextureAddressMode.Wrap;
ss.AddressV = TextureAddressMode.Wrap;
GraphicsDevice.SamplerStates[0] = ss;

I'm loading the mesh, and it's textures, from an .x file so I don't have control over the specifics of the texture loads. Can I disable mip-mapping for the whole rendering process?

sentences: How to continue Lego microgame tutorial? I was passing Lego microgame tutorial. I closed it and quit Unity. Now, how can I continue it from the same place? If I opening it's project, I am getting just silent Unity project, without any guidance.

sentences:
How can I set my non-convex object's collision to a more detailed one to allow other objects to go underneath? My problem is simple. I imported a 3D object (it's not convex) and I want the character to go under your legs.

But this does not happen:

There seems to be a way to do this, I just do not know which one.

Vision of what would be a complex collision:

I've already changed all these options, but it did not work out:

The closest I got was when I saw something about adding a physical material. But when I try only a circle appears, I still can not add one exactly equal to the Character:

Links where I've already looked for help:

https://docs.unrealengine.com/en-us/Engine/Content/FBX/StaticMeshes#collision
https://docs.unrealengine.com/en-us/Engine/Physics/PhysicalMaterials/PhysMatUserGuide
https://forums.unrealengine.com/development-discussion/content-creation/18509-how-can-i-make-this-have-a-more-precise-collision-box

sentences: Are there official button images for the xbox controller that I can get for free? If you want to support xbox controllers, it is always wise to use the native images that the controller uses. Can one obtain those from Microsoft without being a registered, aka paying developer?

sentences:
UE4 Code Project is not showing sub folders created within C++ Classes Folder even though they exist These were my steps.
Created an empty code project in UDK4.
The editor starts up.
On the left bottom you have:

If you try to right click on C++ Classes,
Or select [Add New] while having C++ Classes highlighted
The option to add a new folder is greyed out.

This seems odd, since you can add a new C++ Class and set your sub folder in there. When the class gets created and our IDE in my case (Visual Studios) opens up the folder gets created in there no problem. I also tried setting the public or private option when making a new c++ class that just added a sub folder of /private /public where my new class gets nested in code but still not seeing the folder format display on the Unreal Editor.

So what's going on with UDK4? It seems highly unlikely that the issue is actually a bug.
Is it something I'm doing wrong? Or some second step I need to do?

Different Attempts:
1) Tried making the sub folder in the class create pop up, that created the folder in Visual Studios but still did not show up in the Unreal Editor
2) Restarted Unreal Editor to see if it would refresh the folder hierarchy, no luck.
3) Shutdown both UDK4 and VS and restarted UDK4 then VS also tried VS then UDK4 just in case as a second test.
4) Attempted to drag and drop a folder into the hierarchy from Visual Studios you just get a red O with a slash next to the mouse icon stating it wont allow it.

sentences:
XNA Rendering Blocks I am currently building a little game in XNA and found something strange. I want to draw many blocks next to another (1x1x1 with a texture on the side)

So what happens when I do it this lines appear:

When I move the camera the lines change the position or disappear completely. I know this is because the side of the blocks are drawn but i do not know why. Does anybody of you know a solution for my problem? (removing the sides of the cube does not count)

sentences:
NavMeshAgent - Do something once destination is reached I have items on the ground which I can pick up. If I'm within the radius of a trigger collider around the item, I just pick it up. If i'm not, I want to set my NavMeshAgent's destination to the item and then pick it up once I've arrived. I have done this exact thing before but have since completely forgotten how to do it.

The way picking up an item occurs is by clicking on its UI nameplate, not the physical item gameObject. Therefore, I'm using the OnPointerClick function. If possible I'd like to not have to check every frame whether I have arrived at my destination or not, but I'm open to doing it that way for now.

I'm not really familiar with how the NavMeshAgent API works. I would think that if (!agent.pathPending && agent.remainingDistance <= agent.stoppingDistance) or something similar would work. I'm kind of lost though, any help is appreciated.

void Update()
{
    if (!navMeshagent.pathPending && navMeshagent.remainingDistance <= navMeshagent.stoppingDistance)
    {
        PickUpItem();
    }
}

public void OnPointerClick(PointerEventData eventData)
{
    if (itemPickupRange.playerIsInRange)
    {
        PickUpItem();
    }
    else
    {
        navMeshAgent.SetDestination(item.transform.position);
    }
}

This doesn't work. I've tried breaking up the conditions in Update and making it a nested loop, and it still doesn't work. One other thing: there's some weird behaviour with remainingDistance. Sometimes It's a number between 0 and 1 when I'm positive that the actual distance must be much larger.

sentences:
Lagging problem with chunk creation in Godot We are developing a 2D game in Godot and we are stuck while trying to divide the map in chunks. Namely, the scene is a forest, where trees spawn positions were generated by noise: since the trees are too many to be loaded altogether, we created a Chunk node, which only instances trees contained in it, and gets instanced and deinstanced according to player's position. Though, this does not seem to be enough: each time a new chunk is to be instanced, we get a lag spike. How can we improve this?
This is the script attached to Chunk:

extends Node2D

var noise

func _ready():
    randomize()
    self.name=str(global_position)
    noise=get_node("/root/global").noise
    LoadTrees()

func LoadTrees():
    var x=-38
    while x<39:
        var y=-14
        while y<15:
            if noise.get_noise_2d(global_position.x+float(10*x),global_position.y+float(12*y))>0.07:
                InstanceTree(Vector2(10*x+rng.randi_range(-3,3),12*y+rng.randi_range(-3,3)),self)
            y+=1
        x+=1

func _on_Exit_body_exited(body):
    if body.name=="Player":
        call_deferred("free")

func _on_AreaLeft_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position-2*Vector2(380,0)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaRight_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position+2*Vector2(380,0)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaDown_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position+2*Vector2(0,170)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaUp_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position-2*Vector2(0,170)
        get_parent().InstanceChunk(NewChunkPos)

The functions the script calls from its parent's script go as follows:

func InstanceTree(pos,Parent):
    var tree=Tree.instance()
    tree.position=pos
    tree.name=str(global_position)+"_tree_"+str(pos)
    Parent.call_deferred("add_child",tree)

func InstanceChunk(NewChunkPos):
    if not self.has_node(str(NewChunkPos)):
        var NewChunk=Chunk.instance()
        NewChunk.global_position=NewChunkPos
        NewChunk.name=str(NewChunkPos)
        call_deferred("add_child",NewChunk)

sentences:
Create a car sound with frequencies Im trying to create a car game in c sharp! Im now trying to figure out a way to get some sounds into the game! For example, the acceleration sound of the car.

I recently tried to add a 5 second-sound of a real car accelerating, but I don't think its the right way to do it. Because then i have to start from the beginning all the time of the clip when i accelerate.

Is there maybe some way to work with frequencies? To send a frequency to the speakers and then just increase it when I accelerate (And to make it sound like a car)

I've heard about PWM, could that be something?

Thanks!

sentences:
How to Check and Destroy "linked" gems quickly efficiently Engine: Gamemaker Studio

(simplified) Situation: I have a 6x6 board (at this moment) stored in a 2D matrix, a mechanism for linking adjacent squares, similar to Puzzlecraft, and a button that confirms the link - adding the resources, and destroying the instances of the squares, then moving existing squares and generating new ones.

Question: Is there a way to instantly go through the linked squares, and not just check for any instances marked as linked = true.

Efficiency is in all likelihood not a true concern, especially on this tiny scale, but I'd like to know for the sake of self-improvement more than anything.

Idea for Solving it: I've thought of a way that may be fairly lightweight and quick, I don't know if it is though:

Once a square is added to the link, put the square's position in the matrix in a separate array (one which has 36 slots, in case the entire board is linked). Then once the button to confirm is pressed, it goes up from the bottom of the array, until it reaches a null or -1 value - destroying and setting the value of this array at the appropriate position to null or -1.

Question on the idea: Would this work? How would I store the square's position in the matrix in this array? Would I need to make the array 2D so that it can hold both the x and y position of the square [ie. 0 to 5]?

sentences:
Resource/Asset Manager I'm creating a ResourceManager.
At the beginning i'm creating a groups of resources which contain a map of resources. The role of groups is to quick load/unload resources, to find some constant, never unloading resources which placing to group, for example named Static and newer trying to unload, or find resources common for 2 scenes, or batches etc, this is work of pipeline. Also resource names are hashes of string, they are all unique and its checked off-line.

After i'm adding archives, where assets is stored and load table of contents and put it into group. After i'm calling InitializeGroup where i'm creating a raw resources with out creating or loading some data, only passing to them the Location, where their data is stored.

struct Location
{
    Archive* pArchive;

    size_t m_Offset;
    size_t m_Size;
};

class ResourceManager
{
public:
    struct RacingEngineExport ResourceGroup
    {
        LocationMap m_Locations;
        ResorceMap m_ResorceMap;
        String m_Name;
    };

    void CreateGroup(const String& name);
    void AddLocation(const String& path, const Archive::Type lType, const ResourceGroupName& group, bool recursive = true);

    void InitialiseGroup(const String& name);

    void RegisterResourceHandler(ResourceHandler* pResourceHandler);;

protected:

    ResourceGroupMap            m_ResourceGroups;
};

For each Resource type like Mesh, Texture etc. i'm creating specific ResourceHandler. ResourceHandler responsible to retrieve data from archive(not load, just ask some background queue to load it) and prepare resource for future using, also it's creating and unloading them.

class ResourceHandler
{
public:
    inline ResourcePtr Get(const ResourceID& id);
    ResourcePtr Create(const ResourceName& name, const PropertyMap& properties = PropertyMap(), const bool isManual = false);
    inline void Load(ResourcePtr pResource);
    inline void Unload(ResourcePtr pResource);
    inline void Destroy(ResourcePtr pResource);
}

In Load it's retrieving Archive from Resource::Location::pArchive, loading data from disk and creating some other stuff specific for Resource type.

So when the resource needed by some one, it's calling ResourceManager, retrieving ResourcePtr and asking ResourceHandler to load it if it's not loaded, ResourceHandler somehow (async or sync) loading it and returning ready to use resource.
So now the resources ready to load.

This model not friendly to real-time adding new resources, but it's possible, but i don't need it, just it's can't be loaded again after unload automatically.

So, the question is where i have to store resources, in the main ResourceManager, in all ResourceHandler, in Groups or everywhere? Also i want to hear some recommendations how to improve my impl. or defects in it, or some better way to manage resources. May be my question is stupid but i can't get rid of thoughts that that it's not OK at all.

sentences:
Marching cubes leaving holes in the mesh Hi I'm trying to reproduce GPU Gems 3 chapter 1 (Generating Complex Procedural Terrains Using the GPU) and so far I managed the basics... Now I'm betting some strange output.

I started with the suggested -ws.y to generate a plane. Then when I moved to the noise I noticed some holes in the mesh. But unlike this previous question.

The noise mesh:

So I decided to try something more simple, 3 tubes:
x^2+y^2-2

x^2+z^2-2

y^2+z^2-2

I would assume there is some problem with the z axis. But I can seem to figure out what.
My function to get the triangles vertex positions also seems ok...

Vector3 vertexAlongEdge(int edge, Voxel v){
    Vector3 result=new Vector3(0,0,0);

    Vector3 p1=v.vertexes[edges [edge, 0]];
    Vector3 p2=v.vertexes[edges [edge, 1]];
    float v1 = density (p1);
    float v2 = density (p2);
    if (Mathf.Abs (isoLevel - v1) < 0.00001)
        return p1;
    if (Mathf.Abs (isoLevel - v2) < 0.00001)
        return p2;
    if (Mathf.Abs (v1 - v2) < 0.00001)
        return p1;

    float m = Mathf.Abs((isoLevel - v1) / (v1 - v2));
    result.x = p1.x + m * (p2.x - p1.x);
    result.y = p1.y + m * (p2.y - p1.y);
    result.z = p1.z + m * (p2.z - p1.z);

    return result;
}

The only thing I can think of right now is an error in my table with the edges for each case.
Please help.

sentences:
Help deciding data structure for spatial partitioning, using only value-types in c# I simply want to implement some sort of grid where I can sort units in an RTS into cells, and then for each unit check to avoid other units and attack other units, in 2d.

My map grid is currently 10 000 x 10 000 cells, with 20+ thousand units. To be specific, my grid is sparse but the units move together in very dense groups of about 300 each (like an ancient army type of formation). So cells will either be extremely dense, or completely empty, no in-between really.

My issue in deciding is that I am using Unity job's system and burst compiler. If you do not know, jobs is a multithreading system, and burst is an LLVM based compiler outputting very fast assembly. The limitations of these systems is you can only use value types. So no classes.

I have looked at using a MultiHashmap, but from what I read this can be very slow because I need to run a hash function for every unit. Then when I want to iterate al units in a cell, this is much slower than iterating an array. Especially, because I will also be checking the 8 neighbour cells for each unit as well. That's a lot of hashing being done. Finally, I have to clear the map every frame. The advantage here is Unity provides a container NativeMultiHashMap which is thread-safe, so I can build and query it in parallel.

I have looked into quad-trees. But quad-tree does not seem suited to multithreading, especially without using references. So if I did this, it would most likely be single threaded.

My question is, are my above statements correct in thought? Is there a faster way to organize my data? If I go with a hashmap, how can I query it most efficiently?

sentences:
Disabling impact damage by Kinematic actor on non-dynamic destructibles (using NVidia APEX) I have a destructible non-dynamic object at Apex scene and am hitting the object with a kinematic actor. I do not want it to be fractured by these impacts. Is it possible?

PS: the impact damage is off when the destructible is dynamic. I have tried below settings:

physx::apex::NxDestructibleParameters destructibleParameters =
                                          destructibleActor->getDestructibleParameters();
destructibleParameters.forceToDamage = 0;
destructibleParameters.damageCap = 0;
destructibleParameters.impactVelocityThreshold = PX_MAX_F32;
destructibleParameters.impactDamageDefaultDepth = -10;
destructibleActor->setDestructibleParameters(destructibleParameters);

sentences:
How can I get separate caches for different coroutines? (Unity) I want to fade out an image, so I have a coroutine FadeOut(). However, I want to have a separate image each time I call FadeOut.

If I try to do something like this:

IEnumerator FadeOut(GameObject image) {
    SpriteRenderer render = image.GetComponent<SpriteRenderer>();
    yield return null;
}

Ignoring all the color changing code which I took out, how do I make it so that I can save a separate cache for each image I add? I don't want to run GetComponent() each frame, because I'm running on mobile and because I want to think of a clever way to stash the renderer.

For example, if I declare the renderer at the top like this:

private SpriteRenderer render;

and want to cache it on the first frame of the coroutine, there's the chance that calling FadeOut() on another object will change the renderer to a new object and the first FadeOut() will cancel.

Can I make the method static? Will that cache a private version of renderer?

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:
Has anyone ever made a shader that produces something similar to pixel art? I find that pixel art is really pleasing to look at; it has this kind of crisp, satisfying perfection to it.

I've been following some beginner pixel art tutorials, when I got an idea: what if someone made a shader (in GLSL for example) that took 3D scenes and did the best possible job at making it look like it was drawn by a pixel artist? The concepts of anti-aliasing and shading should be relatively easy to perform. Constraining your colour palette would be very simple as well.

Of course, no computer program could outdo the manual work of a great pixel artist, but has anyone ever tried this before?

Is this idea at all possible?
Are there any games that use it?
Have there been (documented) failed attempts?

sentences:
Is there a way to setup a notification from Unreal Engine when it finishes packaging / building my game? In Unity I was able to use a post build script to send myself an email when Unity finishes building a game. Is there a way to make a script run when Unreal Engine is done packaging a game?

Or any other way to set up a notification sound or visual prompt in my Windows PC to alert me when it finishes packaging?

sentences: XNA seams between 3d primitives in tiled terrain Every time I draw two primitives side by side, in this case two quads, I always get this seam-like tearing effect right along the sides of them. I'd like to think there is just an easy fix, but the only way I can think of would be reworking my indices, which I think would compromise my ability to draw textures. If anyone reading this can think of any fix, that would be great. Thanks in advance.

sentences:
libGDX map transition via try & catch exeption I have a simple question.  Some explination first, however:

I am using libGDX and making a Legend of Zelda-type top-down game and I'm having an issue with map transitions.  When I made the tilemap and added the (currently crappy) collision detection to it, I noticed that the IDE threw an error when the character walks off the map (where there are no tiles to test the collision possibility against).  I thought, cool, I can use that.

Knowing that the program would throw an exception when the player left the screen, I caught that exception and used it to decide to which map the player was trying to transition and switch accordingly.  I played a little transition from the scene2d actions and to the next map we went.

BUT, I got to thinking that while catching that exception is a great thing, I probably shouldn't rely on it for map transitions.  I'm betting you all will agree: handle the exception just in case, but don't rely on it.

SO, this means that I need to handle a transition before the user gets off the map.  I tried using transition tiles from within the collision detection:

If the tile had the transition property, figure out where the user is attempting to transfer and then play the transition effect and on to the next map.  The only problem with this system is that it doesn't look right.  The user transitions just as collision is made while there is still room left in the tile to transverse.

My question to you all, then, is this:  Is there a middle ground between the two?  Is there a way to tell end of map or last tile, allow the user to transverse the tile just prior to transitioning?  Or are my two ways the only ones?

sentences:
How do I pause/play animation in Unity without the animation getting cut off I'm trying to achieve a common game behavior that when you hit an enemy, then whatever the enemy's action (animation) is, when the hit happens, the enemy pauses a bit, then continues with the animation. So everytime you hit the enemy, the enemy pauses for a bit.

I currently have this code:

IEnumerator StopStartMotion()
{
    _animator.speed = 0;
    yield return new WaitForSeconds(.2f);
    _animator.speed = 1;
}

Problem is, sometimes, when I hit too early in the enemy's animation (like at the beginning of a punch), the enemy pauses, and then doesn't continue the animation where he paused for a bit. Is there a better way of doing this?

I tried animator.enabled as well, but the animation also jumps.

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:
up vector for quaternion First, I know there's a question exactly like mine, and some ohter really close, but my implementation of the solutions didn't work at all. Ok, now to the question.

I created some forms of camera based on quaternions, however, for my orbit/chase camera every quaternion I create will roll the camera in an uncontrollable manner. What I want is a function like Unity's Quaternion.LookRotation where you can pass an up vector.
This is a simplification current attempt of implementation:

Vector3 target = -Position; //Because we're looking at the origin
target.Normalize();

float cosine = Vector3.Dot(Vector3.Forward, target);
Vector3 axis = Vector3.Cross(Vector3.Forward, target);
Rotation = Quaternion.CreateFromAxisAngle(axis, (float)Math.Acos(cosine));

//Trying to unroll up vector to Vector3.Up
//based on the other answer but results were unchanged
Vector3 rolledUp = Vector3.Transform(Vector3.Up, Rotation);
Vector3 right = Vector3.Cross(target, Vector3.Up);
Vector3 newUp = Vector3.Cross(right, target);

Vector3 axis2 = Vector3.Cross(rolledUp, newUp);
float angle2 = (float) Math.Acos(Vector3.Dot(rolledUp,newUp));

Rotation = Quaternion.CreateFromAxisAngle(axis2, angle2) * Rotation;

return Matrix.CreateLookAt(
    cameraPosition: Position,
    cameraTarget: Vector3.Transform(Vector3.Forward, Rotation),
    cameraUpVector: Vector3.Transform(Vector3.Up, Rotation));

If my sleepiness got in the way of my clarity, here's what I have:

and here's what I want:

sentences: In GameCenter realtime multiplayer how to identify who is host? In GameCenter real-time multiplayer how to identify who is a host?

sentences:
How does one get sprites to hide/unhide using OnMouseDown() in Unity? I'm right now using Unity for a school project and I need to be able to hide and
unhide sprites for "expansions".

I've looked all over the internet for this and I can't seem to find an answer.

Here is the script so far:

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

[DisallowMultipleComponent]
public class addBlock : MonoBehaviour{

  void OnMouseDown()
  {
     Debug.log(gameObject.name);
  }
}

sentences:
Unity crashes when opening a project Why does this happen?

I'm new to Unity development. I have installed Unity yesterday (2015-09-06). This is the error that I get:

sentences:
How to determine if a 3D voxel-based room is sealed, efficiently I've been having some issues with efficiently determining if large rooms are sealed in a voxel-based 3D rooms. I'm at a point where I have tried my hardest to solve the problem without asking for help, but not tried enough to give up, so I'm asking for help.

To clarify, sealed being that there are no holes in the room. There are oxygen sealers, which check if the room is sealed, and seal depending on the oxygen input level.

Right now, this is how I'm doing it:

Starting at the block above the sealer tile (the vent is on the sealer's top face), recursively loop through in all 6 adjacent directions
If the adjacent tile is a full, non-vacuum tile, continue through the loop
If the adjacent tile is not full, or is a vacuum tile, check if it's adjacent blocks are, recursively.
Each time a tile is checked, decrement a counter
If the count hits zero, if the last block is adjacent to a vacuum tile, return that the area is unsealed
If the count hits zero and the last block is not a vacuum tile, or the recursive loop ends (no vacuum tiles left) before the counter is zero, the area is sealed

If the area is not sealed, run the loop again with some changes:

Checking adjacent blocks for "breathable air" tile instead of a vacuum tile
Instead of using a decrementing counter, continue until no adjacent "breathable air" tiles are found.
Once loop is finished, set each checked block to a vacuum tile.

Here's the code I'm using:
http://pastebin.com/NimyKncC

The problem:

I'm running this check every 3 seconds, sometimes a sealer will have to loop through hundreds of blocks, and a large world with many oxygen sealers, these multiple recursive loops every few seconds can be very hard on the CPU.

I was wondering if anyone with more experience with optimization can give me a hand, or at least point me in the right direction.
    Thanks a bunch.

sentences:
How do I generate a random curve for landscape (like Worms)? Possible Duplicate:
  How do I generate terrain like that of Scorched Earth?
  How can I generate Worms-style terrain?

I must build random curve line for the 2D Game on the BitMap (like in Worms, from the side).

Teacher said that I should do it using Terrain Generation through recourcy
(I work in Delphi 7).
I understand the main principle, but I don't know how to introduce it as code.

All measurements according to the screen resolution.

sentences:
Where is linked_portal_door in the Source SDK? I just made a new mod in the Source SDK. I saw online that there is an entity that allows portals to be created (linked_portal_door). However, I cannot find or create this entity.

Is it included in the base SDK or do you have to have an add-on. If it is not included, is there an alternative?

I am using Source Engine 2007.

sentences:
How to trigger poison effects efficiently I'm trying to trigger poison effects at the end of each turn in a turn based game. Each Actor in battle has a list of active effects, each of which could be a poison. I simply want to Execute() all of those Poisons.

See my code below; is there a way I can combine my two queries or make them more efficient so that the moment a Poison is found, that Poison executes?

var poisonedActors =
            from Actor actor in ins.BattleParticipants
            where actor.ActiveEffects.Any(activeEffect => activeEffect is Poison)
            select actor;
var poisons =
            from ActiveEffect activeEffect in poisonedActors
            where activeEffect is Poison
            select activeEffect;
foreach (Poison poison in poisons)
            poison.Execute();

EDIT: Is this more efficient? Is there a better way to do things?

    foreach (Actor actor in ins.BattleParticipants)
        foreach (ActiveEffect activeEffect in actor.ActiveEffects)
            if (activeEffect is Poison)
                activeEffect.Execute();

sentences:
How can I pool objects with differing properties? My game requires a 2D GameObject to be spawned every second until they fill the whole screen and the game ends (around 60 objects total). On Android I see some performance spikes whenever a GameObject is spawned, so I'd like to use object pooling to help alleviate this. However, some of my objects have random properties like a second sprite, different tag, particle effect, and so on, so I don't think it's possible to save them for object pooling.

Is there any way for me to pool objects that have variable properties?

sentences:
How to switch between sprites in Unity So I made an empty game object in inspector, called it "squareTest", and I clicked and dragged 3 sprites in. One is the square being black, one is the square being red, and one is the square being green. What I want to do is this:

In the code, it starts by default as the black sprite. Whenever 'x' happens, the sprite changes to the red square. And whenever 'y' happens, it changes to the green square. BTW, x and y could mean anything. I just want some logic to it, as in

if (password == "Open sesame") {
    //Change square color
}

My game programming experience is from Pygame, and this problem could have been solved like this (using a sprite sheet that goes from left to right)

if Condition:
    square_spritesheet.current_frame = 5

screen.blit(square_spritesheet.texture, (x, y),
(self.current_frame*self.frame_width, 0, self.frame_width, self.frame_height))
#screen.blit goes (image, (x, y),
#(start chopping_X, start chopping_Y, end chopping_X, end chopping_Y)

Unfortunately, I do not have a clue how this could be accomplished in Unity.
I do not know if this is possible with an animator controller. I just want to know if this is possible, and how it could be achieved, with or without an animator. Thank you very much!

The different colored squares are different textures, and I do not need transitions between states.

sentences:
Solving the riddle on distributing a python built game? So, I've done the research, and i've done the try/catch process of almost getting things to work. . . almost.

I've read this chart: https://spreadsheets.google.com/pub?key=tZ42hjaRunvkObFq0bKxVdg&output=html
and i've read this post: How can I distribute a native executable for a Python program?

I'm at that point where I'm looking for either just using an installer that can run a python installer, then run the installers for all the dependencies (modules) or just copy paste the modules into the proper python directories.

So my question is: Do you have any experience with this? If so, what are your success/fail stories? Would you want to build everything into an Exe with something like pyinstaller, or just use a custom installer that would require more time to learn (like: http://www.actualinstaller.com/)?

sentences:
How can I use keybord keys like W, A, S and D in GLUT and C++? I want to use W, A, S and D keys like GLUT_KEY_LEFT.

My Code:

if (key == GLUT_KEY_RIGHT)
    rotate_y += 5;
else if (key == GLUT_KEY_LEFT)
    rotate_y -= 5;
else if (key == GLUT_KEY_UP)
    rotate_x += 5;
else if (key == GLUT_KEY_DOWN)
    rotate_x -= 5;

else if (key == GLUT_KEY_HOME)
    X1 += 0.5;
else if (key == GLUT_KEY_END)
    Y1 += 0.5;
else if (key == GLUT_KEY_INSERT)
    Z1 += 0.5;

sentences:
Unity Event Pause/Unpause & jump frame Hello, I would like to get in a script the event whenever we click on the pause button, or the Jump frame button.

I have already manage the Pause button:

private void OnEnable()
{
    EditorApplication.playmodeStateChanged += HandleOnPlayModeChanged;
}

private void OnDisable()
{
    EditorApplication.playmodeStateChanged -= HandleOnPlayModeChanged;
}

private void HandleOnPlayModeChanged()
{
    if (EditorApplication.isPaused)
    {
        // do stuff when the editor is paused.
    }
    else
    {
        // do stuff when the editor is unpaused
    }
}

But How to get the "jump frame" button ?
Thanks !

sentences:
Tiled perlin/value noise texture with (2^n)+1 size Actually what I have in mind is value noise I think, but what I am going to ask applies to both of them.

It is known that if you want to produce tiled texture by using the perlin/value noise, the size of the texture should be specified as the power of 2 (2^n). Without any modifications to the algorithm when you use the size of (2^n)+1 the texture cannot be tiled anymore, so I am wondering whether it is possible (by modifying the algorithm somehow) to generate such tiling texture with the size of (2^n)+1. The article (from which I have my implementation) is here: http://devmag.org.za/2009/04/25/perlin-noise/

I am aware that I can produce texture with 2^n size and just copy twice the last column/row from the ends to make it (2^n)+1, but I don't want to, because such repetitions are visible too much.

sentences:
How to find a non active gameobject in unity? I am trying to find a gameobject, which is not active in the current scene.It throws Null Reference error.

GameObject gameObject;
void start(){
//a non active gameobject tagged with InactiveTag
gameObject = GameObject.FindGameObjectWithTag("InactiveTag");
}
void update(){
if(someCondition){
gameObject.setActive(true); //this line throws Null Reference error
}
}

sentences:
How is entering cover animation done for cover system? I am trying to create a cover system for my 3rd person shooter game in Unity.

My implementation is a basic one :

On Player enter Trigger
  Player move to preset cover position
  Player play Enter Cover animation (eg: dash to cover)

This is fine without root motion enabled, when it is enabled (so the movements look natural), instead of dash &
stop behind the cover, the Player will dash and stuck himself inside the cover (due to root motion). So I am curious, what is a good way to do the animation for cover system?

sentences:
What functions should be called in C++ gameloop from Lua Script I am using sol2 lua wrapper for my 2D game-engine to implement some lua scripting,but I have some questions about what should functions should i call from Lua scripts in c++, and i cannot find any good resources about this topic.

For example. lets say that i am trying to render a sprite on the screen, which sprite is created inside a lua script. As usually the sprite should call render() function every frame, my question is that, should i call every frame functions from Lua in my game-engine loop ? or its bad habit? i mean can i have a structure in lua like below :

function init()
   --called only once
end

function render()
  --called every frame in C++ gameloop
end

or should I implemented in other way?
Can someone suggest me any books about this matter or any good resources ?

sentences:
Unity: How to fix shadows with several meshes in different objects? I'm creating many GameObjects and each one has a single mesh, created in a script. The problem is that I would like to draw them so that they behave like a single mesh. Is it possible? Or I must combine all the meshes togheter?

Thanks for your help!

Edit:
Added the code where I create the mesh and an image to clarify what I did

public void createMesh() {
        List<Vector3> vertices = new List<Vector3>();
        List<int> triangles = new List<int>();

        Vector3 _right = rightBase * radiusBase;

        //BASE
        //POC = Point on circumference
        Vector3 axis = Vector3.Cross(_right, fwdBase); //Axis of rotation of the vector _right for the base
        for(int POC = 0; POC < numberOfSections; POC++) {
            vertices.Add(_right);

            _right = Quaternion.AngleAxis(360 / numberOfSections, axis) * _right;
        }

        //TOP
        _right = rightTop * radiusTop;

        axis = Vector3.Cross(_right, fwdTop);
        for(int POC = 0; POC < numberOfSections; POC++) {
            vertices.Add(direction + _right);

            _right = Quaternion.AngleAxis(360 / numberOfSections, axis) * _right;
        }

        //The 2 points at the center of the base and the top
        vertices.Add(Vector3.zero);
        vertices.Add(direction);

        //Triangles
        for(int face = 0; face < numberOfSections - 1; face++) {
            triangles.Add(face);
            triangles.Add(face + numberOfSections);
            triangles.Add(face + 1);

            triangles.Add(face + 1);
            triangles.Add(face + numberOfSections);
            triangles.Add(face + numberOfSections + 1);
        }
        triangles.Add(numberOfSections - 1);
        triangles.Add(2 * numberOfSections - 1);
        triangles.Add(0);

        triangles.Add(0);
        triangles.Add(2 * numberOfSections - 1);
        triangles.Add(numberOfSections);

        //COVER BASE
        for(int POC = 0; POC < numberOfSections - 1; POC++) {
            triangles.Add(2 * numberOfSections);
            triangles.Add(POC);
            triangles.Add(POC + 1);
        }
        triangles.Add(2 * numberOfSections);
        triangles.Add(numberOfSections - 1);
        triangles.Add(0);

        //COVER TOP
        for(int POC = 0; POC < numberOfSections - 1; POC++) {
            triangles.Add(2 * numberOfSections + 1);
            triangles.Add(numberOfSections + POC + 1);
            triangles.Add(numberOfSections + POC);
        }
        triangles.Add(2 * numberOfSections + 1);
        triangles.Add(numberOfSections);
        triangles.Add(2 * numberOfSections - 1);

        getMesh().Clear();
        getMesh().vertices = vertices.ToArray();
        getMesh().triangles = triangles.ToArray();
        getMesh().RecalculateNormals();
        getMesh().RecalculateBounds();
        obj.GetComponent<MeshCollider>().sharedMesh = getMesh();
    }

sentences:
Rotation of a 3D ball on a plane This used to be on the physics stack exchange but I was told to put it here:

I'm making a game (with physics) and I have a 3D ball rolling down a flat plane. It moves perfectly fine, but the rotation is messed up. It seems way too fast, and the axis seems to be all wrong. Here's the code that runs every tick (20 times per second). (normal is the normal to the plane, acceleration is gravity vector projected onto the plane, in m/tick2, and velocity is the velocity in m/tick.)

vec3 rotationAxis = normalize(cross(normal, acceleration));
quat newRotation = rotate(oldRotation, length(velocity) / sphereRadius, rotationAxis); // rotate by v/r radians about the rotationAxis

I'm not sure why this doesn't work, since according to angular mechanics, v=rω and ∆θ=v∆t/r (and ∆t=1 since velocity is in meters/tick). Am I doing something wrong? Why is the rotation so much faster than it should be? And is my axis of rotation correct?

Rephrased in a more physics way, is this correct in 3D:

$$\hat{x} = \frac{\hat{N} \times \vec{a}}{|\hat{N} \times \vec{a}|}$$

$$\Delta \theta \textrm{ about } \hat{x} = \frac{v}{r} \Delta t$$

And if it is correct, then what’s wrong with my code?

sentences:
Isometric Tile Selection with rectangular bounding boxes I am having problems trying to determine which tile I have selected with the mouse.

Currently it selects two tiles, rather than one. Producing the following results:

My tiles height, is half their width, and all tiles have the same dimensions.

The tiles are rectangles and their Cartesian position has been translated to a relative isometric position.

Because I am checking the mouse position with the sprites bounds, it will select two tiles, as demonstrated in the image below:

I suppose my question is, how to I determine that my mouse x/y is within the 'diamond' of the rectangle?

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:
In Phaser, how should I be managing state? I'm quite new to Phaser and JavaScript really confused about state management.

Phaser has lots of documentation and info on the net, but everyone seems to be doing it a different way.

An example:

var game = new Phaser.Game(800,600, Phaser.AUTO, 'phaser-demo',
        {preload: preload, create: create, update: update, render: render});

function preload(){ ... }
function create() { ... }
function update() { ... }
function render() { ... }

Another:

window.game = new Phaser.Game(800, 600, Phaser.AUTO);
// all other states are in different files

module.exports = {
    preload: function(){ ... },
    create:  function(){ ... },
    update:  function(){ ... }
};

I would be grateful for a simple overview of properly handling states.

sentences:
Unity custom camera projection only working in scene editor I've found this article on Gamasutra on a custom camera projection to make 3D look more 2D and decided to implement it to make some gameplay tests.
I had to make some changes to make it work on URP(on unity 2019.3.6f1) but it "worked" with the following code:
using UnityEngine;
using System.Collections;
using UnityEngine.Rendering;

// This script is meant to be attached to your main camera.
// If you want to use it on more than one camera at a time, it will require
// modifcations due to the Camera.on* delegates in OnEnable()/OnDisable().

[ExecuteInEditMode]
public class CustomProjectionTest : MonoBehaviour {
    private void OnEnable(){
        RenderPipelineManager.beginFrameRendering += ScenePreCull;
        RenderPipelineManager.endFrameRendering += ScenePostRender;
        //Camera.onPreCull += ScenePreCull;
    }

    private void OnDisable(){
        RenderPipelineManager.beginFrameRendering -= ScenePreCull;
        RenderPipelineManager.endFrameRendering -= ScenePostRender;

        GetComponent<Camera>().ResetWorldToCameraMatrix();
    }

    private void ScenePreCull(ScriptableRenderContext context, Camera[] cam){
        // If the camera is the scene view camera, call our OnPreCull() event method for it.
        OnPreCull();
    }

    private void ScenePostRender(ScriptableRenderContext context, Camera[] cam){
        // Unity's gizmos don't like it when you change the worldToCameraMatrix.
        // The workaround is to reset it after rendering.

        foreach(var camm in cam)
            camm.ResetWorldToCameraMatrix();
    }

    private Camera _cam;
    private void Start(){
        _cam = GetComponent<Camera>();

        // Set the camera this script is attached to to use orthographic sorting order.
        // Instead of using the euclidean distance from the camera, objects will be sorted based on their depth into the scene.
        _cam.transparencySortMode = TransparencySortMode.Orthographic;
    }

    public Vector4 up = new Vector4(0, 1, 0, 0);

    // This is a Unity callback and is the ideal place to set the worldToCameraMatrix.
    private void OnPreCull(){
        var cam = !Application.isPlaying? Camera.current : _cam;

        // First calculate the regular worldToCameraMatrix.
        // Start with transform.worldToLocalMatrix.
        var m = cam.transform.worldToLocalMatrix;

        // Then, since Unity uses OpenGL's view matrix conventions we have to flip the output z-value.
        m.SetRow(2, -m.GetRow(2));

        // Now for the custom projection.
        // Set the world's up vector to always align with the camera's up vector.
        // Add a small amount of the original up vector to ensure the matrix will be invertible.
        m.SetColumn(2, 1e-3f*m.GetColumn(2) - up);

        cam.worldToCameraMatrix = m;
    }

    public static Matrix4x4 ScreenToWorldMatrix(Camera cam){
        // Make a matrix that converts from screen coordinates to clip coordinates.
        var rect = cam.pixelRect;
        var viewportMatrix = Matrix4x4.Ortho(rect.xMin, rect.xMax, rect.yMin, rect.yMax, -1, 1);

        // The camera's view-projection matrix converts from world coordinates to clip coordinates.
        var vpMatrix = cam.projectionMatrix*cam.worldToCameraMatrix;

        // Setting column 2 (z-axis) to identity makes the matrix ignore the z-axis.
        // Instead you get the value on the xy plane.
        vpMatrix.SetColumn(2, new Vector4(0, 0, 1, 0));

        // Going from right to left:
        // convert screen coords to clip coords, then clip coords to world coords.
        return vpMatrix.inverse*viewportMatrix;
    }

    public Vector2 ScreenToWorldPoint(Vector2 point){
        return ScreenToWorldMatrix(_cam).MultiplyPoint(point);
    }

    private void Update(){
        if(Input.GetMouseButtonUp(0)){
            Debug.Log(ScreenToWorldPoint(Input.mousePosition));
        }
    }
}

Well, kinda. For some reason, it only works in the scene editor, but not in the game. I just have no clue why
With Scene Editor:

In Game

sentences: HTML5 tags on my website? I'm not here to ask about the merits of HTML 5, CSS 3, Javascript, etc. as game development tools.  Lord knows how many people have asked about that already.  No, what I'm curious about is what kind of browsers different types of gamers tend to have.  I'm starting a game development studio, and I want to use some HTML 5 and CSS 3 features on my website.  I know where to look for browser compatibility, but I'd like to know how old a browser I should cater to.  My target audience is primarily teenagers through young adults.  Is there any risk of alienating potential players with fancy HTML 5 features, or is it safe to assume their browsers are reasonably up to date?

sentences: How can I detect a Gameobject touching another gameObject without using collider2D's? I have fish gameObjects that have colliders2D so that I can click and move them. I added fish food with Collider2D's but it was hard for me to click on the fish. After I disabled the fish food collider2D it was easier to click on the fish. Is there an alternative when detecting two gameObjeccts without colliders?

sentences:
Libgdx Android app: Avoid fullscreen and show titlebar I am developing an app using Libgdx and I don't want the app to go fullscreen and want to show the title bar but the app goes to fullscreen and hides title bar despite all efforts.

Here is my style.xml file

<style name="MyStyle" parent="android:Theme.Light"></style>

Here is AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyStyle" >
    <activity
        android:name="com.mygdx.game.android.AndroidLauncher1"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Here is AndroidLauncher class

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.hideStatusBar=false;
    initialize(new MyGdxGame(), config);
    setContentView(R.layout.main_activity);
    tv=(TextView)findViewById(R.id.tv);
    tv1=(TextView)findViewById(R.id.tv1);
    button = (Button)findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Build.VERSION.SDK_INT < 19) {
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
            }
            else{
                Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
                intent.addCategory(Intent.CATEGORY_OPENABLE);
                intent.setType("image/*");
                startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
            }
        }
    });

}

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == SELECT_PICTURE) {
            Uri selectedImageUri = data.getData();
            selectedImagePath = getPath(selectedImageUri);
            Intent act2 = new Intent(this ,AndriodLauncher2.class);
            act2.setData(selectedImageUri);
            startActivity(act2);
        }
    }
}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}

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:
How to form a sphere from Voxels I want to form a Sphere given radius from blocks given size. And can't figure out the code / algorithm. Any help appreciated.

Edit: I dont wan't the Sphere to be filled, just the outer shell

Edit: I tried this

function ds(r)
    for tx=-r, r do
        for ty=-r, r do
            for tz=-r, r do
                if math.sqrt(math.pow(tx, 2)  +  math.pow(ty, 2)  +  math.pow(tz, 2)) <= r-2 then
                    Terrain:FillBlock(Vector3.new(tx, ty, tz), Vector3.new(1,1,1), material)
                end
            end
        end
    end
end

But it's very much iterations and so slow and odes the filling that is extra calls.

sentences:
3ds Max error dialog: "Instancing not supported for this action" "Instancing not supported for this action” is the dialog I get. My favorite part is that, according to google and yahoo, apparently i am the only person in the history of mankind to experience these words together in this order, let along get this message from Max. Thanks, autodesk, for putting this dialog in special for me!

So I’ve created my model (nws) and was setting up a Skin Wrap. Selected "Face Deformation", added the base-skin for weight, checked “weight all points”. . . clicked “convert to skin” and got that dialog.

My model doesn’t have a whole lot of elements to it, I had a left and right appendage that came from a base model (skyrim). so, i did a clone>copy of all 3 of my elements, just to be sure nothing was instanced… and VOILA! Same error message. the only other elements are an imported NIF mesh and skeleton.

Any idea where this is coming from or how I can make it go away so that I can export my mesh?

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 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:
LibGdx sprite rotation vs Box2D physics rotation problem LibGdx sprite rotation vs Box2D physics rotation problem

Tearing my hair out on this one. I am an experienced software developer, but very new to LibGdx and Box2D development.

I am writing a game where the game board is the size of the screen. The game board does not pan - it just fills the screen. For the descriptions below presume that the device is being held vertically, so that vertical is the longest length. Also, for the description below, presume that on a device with a 'normal' aspect ratio, circles will be rendered perfectly circular, but a device that is narrower than expected, the circles will be squashed so that they are taller than wide.

I have a number of circle shapes that are rendered to the screen.

Because different devices will have different width / height aspect ratios, I am happy for the circle shapes to be squashed on a device that is narrower on the horizontal than expected (I am trying to avoid maintaining identical aspect ratios and forcing black borders at the edges of the game board).

My problem is this: when Box2D debug renders the screen, showing the physics objects, the circle shapes maintain their width and height, even when rotated. To describe further, if a sphere is displayed with 0 degree rotation on a narrow device, it takes an oval shape that is taller than it is wide, as would be expected on a narrower than expected device. If you rotate the circle shape by 90 degrees, the Box2d debug renderer shows the rotation (there is a line that sticks out of the centre of the object at an angle that shows the angle of rotation) but the object maintains its taller than wide oval shape. This is correct, as a sphere on a horizontally narrower aspect-ratioed device will always be displayed taller than wide.

When I attempt to overlay a LibGDX sprite on top of the Box2D physics simulation (the sprite, in its unaltered form, is circular, and is then scaled to the devices aspect ratio), with a zero degree angle, it appears nicely mapped to the Box2D representation - taller than it is wide. However, when I rotate the LibGDX sprite by 90 degrees, it appears rotated the way a billboard image would be rotated, so it is now wider than it is tall (imagine drawing a taller-than-wide oval on a piece of paper and turning the piece of paper by 90 degrees).

It appears to me that Box2D applies rotation before it applies the camera scaling - so the circular object is rotated first (maintaining its circular shape under the hood), and then sqaushed to form an ellipse that is taller than wide on the screen. Whereas, the LibGDX engine applies the transforms in reverse. The object is squashed to taller-than-wide, then rotated, so it becomes wider-than-tall on the screen.

I have pasted the relevant code below:

//screen size in box2D metres
private static float screenHeight = 100.0f;
private static float screenWidth = 70.0f;

//set up the camera in the show() method
    cam = new OrthographicCamera(screenWidth, screenHeight);
    cam.position.set(screenWidth / 2, screenHeight / 2, 0);

//render method
batch.begin();
for (int i = 0; i < ballList.length; i++)
{
    ballList[i].render(batch);
}
batch.end();

//ball class render method
public void render(SpriteBatch batch)
{
    ballHappyImage.setOrigin(64.0f, 64.0f);
    ballHappyImage.setPosition(body.getPosition().x - 64.0f, body.getPosition().y - 64.0f);
    float scaleWidth = Gdx.graphics.getWidth() / 1400.0f; //hardcoded to make things fit correctly
    float scaleHeight = Gdx.graphics.getHeight() / 2000.0f; //hardcoded to make things fit correctly
    ballHappyImage.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
    ballHappyImage.setScale(scaleWidth, scaleHeight);
    ballHappyImage.draw(batch);
}

The images below show the Box2D debug rendered line drawings overlayed on the libgdx sprites.

sentences:
Base64 Decoding In Unity I am trying to decode a map file for Unity which I believe was compressed using Base64 encoding.

The actual data looks like this:

  H4sIAHah5VgA/z2PvQ7CMAyEXyXyjASsXStGeAHEkBRTivJTOQlKW/XdSYKc7dOd7+Tb4CrnmzQIHQzRB2eExi9qOAiQMbwdZeOFdiyCUx/o7mKD6ZnVc5EIfca+JnPTRaNBG459VFjslM1TgYVhZfCJO/zSaG29LUktSi1LfDYyKAbJEDCFSGVXbR5omkP51UZd19n/6PrpLh77D92WFGkKAQAAAA=

And I am expecting an output that looks like:

  custom,cuboid,default,1,1,1,0,1,1,1,1.0,1.0,0,0,0,0,0,0,0;

While Base64 decoding should be an easy feat, this particular case is giving me trouble. I've tried decoding it into several different formats, but all my attempts resulted in garbled messes. I am fairly certain that the file is in a Base64 format, but it shouldn't be this difficult to decode.

Does anyone have an idea of how the file was encoded and how I might go about decoding it?

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:
SMFL C++: IntRect intersection not working? I'm trying to find free space to place rectangles, but even though I check for a collision using .intersects() it still places them through each other and somehow doesn't see the intersection happening while it's blatantly there.

This is my code at the moment:

#include "dungeonGenerator.h"

std::map<int, dungeonGenerator::dungeon_room> dungeonGenerator::newDungeon(int x, int y, int n)
{
    srand(time(NULL));
    std::map<int, dungeon_room> rooms;
    bool canPlace;

    for (auto i = 0; i < n; ++i)
    {
        canPlace = false;
        dungeon_room dungeon_room;
        while (!canPlace)
        {
            int height = rand() % x;
            int width = rand() % y;

            int pos_x = rand() % 512;
            int pos_y = rand() % 512;

            sf::RectangleShape room;
            room.setSize(sf::Vector2<float>(height, width));
            room.setFillColor(sf::Color(rand() % 255, rand() % 255, rand() % 255));
            room.setPosition(sf::Vector2<float>(pos_x, pos_y));
            dungeon_room.image = room;
            dungeon_room.collider = sf::IntRect(pos_x, pos_y, width, height);

            if (!rooms.empty())
            {
                auto i = 0;
                for (auto& room : rooms)
                {
                    std::cout << ++i;
                    canPlace = canPlaceRoom(&dungeon_room, &room.second);

                    if (canPlace == false)
                    {
                        break;
                    }
                }
            } else
            {
                canPlace = true;
            }
        }
        rooms[i] = dungeon_room;
    }
    return rooms;
}

bool dungeonGenerator::canPlaceRoom(dungeon_room* room, dungeon_room* target)
{
    if (room->collider.intersects(target->collider))
    {
        return false;
    }
    return true;
}

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:
How do you allow networking code to be written in the later stages of the development? I'm currently in the early progress of writing a game which I eventually will want to improve in most aspects.
How can I skip out on writing network code yet leaving it fairly easily implemented, that is, not having to rewrite the entire game just to add it.
What do I have to keep in mind?

I have a component pattern where I separate physics/collision-detection, game logic, data types and animating/rendering from each other.
How do I write a client and server that doesn't have any network code implemented yet can be tested locally?
What should I do in the client and what should I do in the server?
Should I sort of just pretend I have network code finished and send messages between server and client and account for delays etc. even though there will be none?

Edit: It's planned to be a top down RPG. Simple multiplayer where you host a server for your friends is what I'm thinking, so cheating isn't that much of an issue (who would like to play with cheating friends?). Still I'd like to go with a "The server is always right"-approach.

Edit 2: I guess I'm looking for some pointers on what my mind set should be like. How should I handle keyboard input, animating, etc, instead of just applying every effect/change instantly.
Hmmm, I may need to read up properly on networking before going anywhere after all, which was what I had hoped to get away from by making a network skeleton of some sort that could work locally.

sentences:
Failed to load QCARWrapper.dll I am using unity 5.1.0f(64 bit) and  Vuforia SDK Version: vuforia-unity-5-0-5

The web cam is operating normally in windows but in unity in Play Mode not.

I am getting an error message
"failed to load QCARWrapper.dll: expected 64bit architecture..."

Can anybody help out solving this issue?

sentences:
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:
VS2012 C++: Unable to ID3D11Device::CreateVertexShader when loading compiled CSO file I have been trying to get a tutorial Direct X 11 application running for some time now. I'm being stymied when I try to create the vertex shader. Setting the Direct X Debug setting reveals that I am getting this error.

D3D11 ERROR: ID3D11Device::CreateVertexShader: Encoded Vertex Shader size doesn't match specified size. [ STATE_CREATION ERROR #166: CREATEVERTEXSHADER_INVALIDSHADERBYTECODE]

I have compiled the hlsl shader code using Visual Studio 2012 Express into "shaders.cso" and that appears to load okay. According to the HRESULT return from D3DReadFileToBlob. However, the CreateVertexShader call returns "E_INVALIDARG One or more arguments are invalid."

After this the program fails on a Draw attempt.

I have checked the size of the blob buffer and it is the same size as the shaders.cso file.

I have included the code which sets this up below.

void InitPipeline()
{
    HRESULT hr;

    // load and compile the two shaders
    ID3DBlob *VS = nullptr, *PS = nullptr;
    ID3DBlob *errorBlob = nullptr;

    const D3D_SHADER_MACRO defines[] = {"EXAMPLE_DEFINE", "1", NULL, NULL};
    UINT flags = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
    flags |= D3DCOMPILE_DEBUG;
#endif
    hr = D3DReadFileToBlob(L"shaders.cso", &VS);

    // encapsulate both shaders into shader objects
    auto vbs = VS->GetBufferSize();
    auto vbp = VS->GetBufferPointer();

    hr = dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), nullptr, &pVS); // This function returns "E_INVALIDARG One or more arguments are invalid." and pVS is returned as NULL

    // set the shader objects
    devcon->VSSetShader(pVS, 0, 0);

    // create the input layout object
    D3D11_INPUT_ELEMENT_DESC ied[] =
    {
        {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
        {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
    };

    dev->CreateInputLayout(ied, 2, VS->GetBufferPointer(), VS->GetBufferSize(), &pLayout);
    devcon->IASetInputLayout(pLayout);
}

For reference this is the shader code.

cbuffer ConstantBuffer
{
    float4x4 matFinal;
}

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut main(float4 position : POSITION, float4 color : COLOR)
{
    VOut output;

    output.position = mul(matFinal, position);
    output.color = color;

    return output;
}

I'll admit to not knowing much about shader code. Honestly, I'd prefer to do without it at this stage of re-learning D3D, but it appears to be required to use DX11.

Can anyone shed any light on this?

sentences:
How to import character package in Unity I recently made a game in Unity 3D and I tried to import the FPS Controller package as the tutorial I was following said, but when I clicked Assets/Import Package the only thing I saw was a button saying 'Custom Package'

How do I get the character option when I click 'Import Package'?

sentences:
difference between an engine and a library I'd like to know the difference between a library and an engine. I've searched some information and if I'm not wrong, an engine gives you more options and makes work easier than a library.

An engine can help you for example handling user input or handling collisions but I don't know how. I mean I've been using SFML and it has a function that detects collision between two rectangles. You can handle user input too.

How does an engine work? In what ways handling collisions for example is easier with an engine than with a library?

sentences:
Is there an easy and automatic way of converting a Windows XNA project into a Monotouch Monogame project? I have just started with XNA development on Windows. But as I'm a fan of iOS I had to try porting my test code over to Monotouch on the Mac.
I used these instructions: http://www.facepuncher.com/blogs/10parameters/?p=42
But this is so much (manual) work!
And it really doesn't answer open topics like: why would I copy all the XNB files and in addition all the resources, like PNGs?

Is there maybe a tool that automatically converts a Windows XNA project into a Monotouch iOS project or at least creates the correct folder structure?

sentences:
Problem when texturing triangles using glVertexPointer() I'm having a problem for displaying a single quad, here is how i do :

//note: this code is only for 2 triangles, while on picture there is 4 triangles
float tex_coord[] =
{
   0.0, 0.0, //3
   0.0, 1.0, //2
   1.0, 1.0, //0
   1.0, 1.0, //0
   1.0, 0.0, //1
   0.0, 0.0  //3
};

int indexes[] =
{
    3, 2, 0, 0, 1, 3
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

sentences:
How to add & copy ParticleSystem attached to an existing GameObject using C# script in Unity? I have a GameObject "FireBall" with a ParticleSystem attached to it. I want to add the same ParticleSystem to other GameObject "Avatar". Initially there is no ParticleSystem attached to "Avatar".

When I do this -

ParticleSystem fireparticlesyst = gameObject.AddComponent<ParticleSystem>();

It adds a ParticleSystem to "Avatar" but I want to set all the properties of this ParticleSystem to the ParticleSystem attached to "FireBall".

If I add all the properties by individually I can't set some of the properties as they are read only.

How to do this ?

sentences:
How to draw efficiently large number of objects with alpha blending? In a 3D game i have large no. of trees with alpha value.
What is the efficient way to draw all?
What i tried is Taking every tree as a object and draw according to its z value and using billboarding. But large draw calls, hiting performance.

sentences:
How to prevent the player from calling the Jump function if no collision is detected? I am back once again. This time with a basic 2D platformer game. I would like to allow my player to jump but only if the ground bool checks as true. I would like to fix my script so that upon collision with the ground the player is able to jump, but while the player is in the air the player is not able to jump. My platform has a box collider and my player has a collider as well as a rigidbody. How do I go about fixing my script to allow this system to go into effect? Please and Thank you!

public class MovePlayer : MonoBehaviour {

    public float speed = 0f;
    public float height = 0f;
    public GameObject player;

    private bool grounded = false;

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "ground")
            grounded = true;
            return;
    }
    // Use this for initialization
    void Movement ()
    {
        if (Input.GetKey (KeyCode.RightArrow))
        {
            transform.Translate(Vector3.right * speed * Time.deltaTime);
        }

        if (Input.GetKey (KeyCode.LeftArrow))
        {
            transform.Translate (Vector3.left * speed * Time.deltaTime);
        }

        while (grounded = true)
        {
             Jump();
        }
    }

    void Jump()
    {
        if (Input.GetKeyDown (KeyCode.UpArrow) || Input.GetKey (KeyCode.Space)) {
            transform.Translate (Vector3.up * height * Time.deltaTime);
            return;
        }
    }

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

        Movement ();
    }
}

sentences:
Libgdx - notification popup (something like Toast) - on both Desktop and Android I'm trying to implement a notification system with LibGDX. As we know, Android has it's Toast which is great, but I can't use it in Desktop mode.

I tried extending Dialog etc, adding as an actor and it all worked, but there's one problem - it still needs to be within the 'stage' object range, cause I have to add the 'notification actor' to the stage.

Do you have any ideas how to implement it in a static way, that the notification dialog/label/window would be 'callable' from the whole app?

Here's my code:

public class Notification extends Dialog {

public enum NotificationType{
    SUCCESS, FAIL, INFO;
}

static Skin skin = new Skin(Gdx.files.internal("data/notificationskin.json"));
Label label;
public Notification(String text, NotificationType type) {
    super("", skin);
    setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/10);
    setPosition(0, Gdx.graphics.getHeight() + getHeight());
    label = new Label(text, skin);
    add(label).center();

    label.setColor(Color.BLUE);
    setKeepWithinStage(false);
    show();
}

public void show(){

    MoveToAction moveTo = new MoveToAction();
    moveTo.setPosition(getX(), Gdx.graphics.getHeight() - getHeight());
    moveTo.setDuration(2f);

    MoveToAction moveBack = new MoveToAction();
    moveBack.setPosition(getX(), Gdx.graphics.getHeight() + getHeight());
    moveBack.setDuration(2f);

    SequenceAction action = new SequenceAction(moveTo, Actions.delay(1.0f), moveBack, Actions.removeActor());
    addAction(action);

}
}

To show the toast I need to call:

Notification not = new Notification("You're now connected", SUCCESS);
stage.addActor(not);

which is bad - it should be static.

sentences:
Is it possible to customize the Scriptableobject inspector for Simple level data, without the use of PropertyDrawers? I've invented an innovative, new game mechanic for Bricker Breaker Quest and want to create a quick prototype to recruit a game development team. After wasting a week researching the best way to easily represent the simple level data, I reluctantly started using Scriptableobjects. Each level is defined as a List<Block>, where :

public class Block : MonoBehaviour, IComparer<Block>
{
    public int x;
    public int y;

    public int lives = 0;
    private int pastLife = 0;

    private SpriteRenderer spriteRenderer;
    private TextMeshPro text;

    private void OnCollisionEnter2D(Collision2D collision)
    {
        lives--;

        if (lives > 0)
            UpdateVisualState();
        else
        {
            gameObject.SetActive(false);
        }
    }

    private void Awake()...

    public void AddLives(int life)...
}

How do I properly serialize the Block object so that I can enter the X, Y, and Lives integers directly in the Inspector? As a quick hack, I created a List<Vector3Int> instead of the Block List and use the Z input field to enter the lives. Seems like overkill to create a PropertyDrawer just to relabel one field.

Any other advice is appreciated.

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: Real world terrain import into UE4 I am trying to create a basic game in Unreal Engine 4.8.1 and I wish to have it set in the Dubai, UAE but i cannot find a way that will successfully use terrain data i have obtained (NASA Shuttle RADAR 90m) to create a 1:1 scale map in unreal without creating huge world spikes. Does anyone know a method that can import the data without creating terrain spikes?

sentences:
How to spawn collectibles at random positions in Java Please i need assistance,
I made a game in Android Studio with Java.
I am almost done with the game just that i'm having an issue where my collectible keeps re-spawning in the same position after the player has collected it.
I would like for it to re-spawn at random positions on the screen, how can i do this?.
The collectible is a fuel can.

Here is the fuel can collectible class

Fuel.java

public class Fuel extends GameObject {

 public Fuel(Bitmap res, int w, int h, int numFrames) {
        x = GamePanel.WIDTH + 5000;
        y = GamePanel.HEIGHT / 2;
        dy =(random.nextInt()*(GamePanel.HEIGHT - (maxBorderHeight* 2)+maxBorderHeight));
        dx = +GamePanel.MOVESPEED;
        height = h;
        width = w;

        Bitmap[] image = new Bitmap[numFrames];
        spritesheet = res;

        for (int i = 0; i < image.length; i++)
        {
            image[i] = Bitmap.createBitmap(spritesheet, 0, i*height, width, height);
        }
        animation.setFrames(image);
        animation.setDelay(100-dx);
        animation.update();
    }

    public void update()
    {
        if (x < 0) {
            reset();
        }
        x += dx;
        dx = dx- 1;

        if (dx <= -15) {
            dx = -15;
        }

    animation.update();
    }

    public void draw(Canvas canvas)
    {
        try {
            canvas.drawBitmap(animation.getImage(),x,y,null);
        }catch (Exception e){}
    }

    public void reset(){
        x = GamePanel.WIDTH + 5000;
        y = GamePanel.HEIGHT/2 ;
        dy = (random.nextInt()*(GamePanel.HEIGHT - (maxBorderHeight* 2)+maxBorderHeight));
        dx = +GamePanel.MOVESPEED;

    }

    public void fuelCollected(){
    reset();
    }

}

Here is my GamePanel.java class

public class GamePanel extends SurfaceView implements SurfaceHolder.Callback
{
  private Fuel fuel;

  @Override
  public void surfaceCreated(SurfaceHolder holder){
   fuel = new Fuel(BitmapFactory.decodeResource(getResources(), R.drawable.fuel),40,40,1);
  }

 public void update()
{
fuel.update();
        if(collectFuel(player,fuel)){
            distance +=100;
        }

public boolean collectFuel(GameObject player, GameObject fuel){
    if(Rect.intersects(player.getRectangle(),fuel.getRectangle()))
    {
        fuelCollected();
        return true;
    }
    return false;
}

public void fuelCollected(){fuel.fuelCollected();}
}
 @Override
public void draw(Canvas canvas){

// draw fuel can

        fuel.draw(canvas);
 }
}

sentences:
Is it illegal to decompile Unreal Engine maps from games? I am currently in the process of learning to use Unreal Engine 4, and want to learn how certain games design their components. I know about the issues with decompiling Unreal Engine 3 to Unreal Engine 4, and are aware of the limitations. Is it legal to decompile maps for my own use, just as a learning opportunity, and not to profit from it in any way?

I searched online for advice, but the answers are wide and varying. Some claim that there is illegality, depending on where you live. Others claim nothing is illegal, as long as no attempt is made to profit from it, or claim it as your own.

sentences:
Separate objects for hitbox and sprite? I am making a technically top down game with a shifted perspective. It shows more of the characters side, not just above their head. I think most "top down" games have a similar art style.

Due to this, only the bottom of the character sprite should collide and interact with game objects. Should I use two separate objects for the hitbox and the sprite? It seems inefficient to do this. Is there some other solution?

For reference, I am using python3 and the pygame library. I am using the sprite class from pygame. My player class inherits from the sprite class and is comprised of a surface object for the sprite image, and a rectangle object for the coordinates and length/width. Using a separate object for the hitbox and sprite would require to classes for this.

sentences:
Loading images in XNA 4.0; "Cannot Open File" Problems Okay, I'm writing a game in C#/XNA 4.0 and am utterly stumped at my current juncture: Sprite animation.  I understand how it works and have all the code in place, but my ContentLoader won't open my file...

Basically, my directory looks like this:

    //WindowsGame1
      - "Game1.cs"
      - //Classes
          - "NPC.cs"
      - Content Reference
          - //Images
              - "Monster.png"

Inside my NPC class, I have all the essential drawing functions, i.e. LoadContent, Draw, Update.  And I can get the game to find the correct file and attempt to open it, but when it tries, it throws an exception and tells me it can't open the file.  This is how my code in my NPC class looks:

    Texture2D NPCImage;
    Vector2 NPCPosition;
    Animation NPCAnimation = new Animation();

    public void Initialize()
    {
        NPCAnimation.Initialize(NPCPosition, new Vector2(4, 4));
    }

    public void LoadContent(ContentManager Content)
    {
        NPCImage = Content.Load<Texture2D>("_InsertImageFilePathHere_");
        NPCAnimation.AnimationImage = NPCImage;
    }

The rest of the code is irrelevant at this point because I can't even get the image to load.  I think it might have to do with a directory problem, but I also know little to nothing about spriting or working with images or animations in my code.  Any help is appreciated.  Not sure if I provided enough information here, so let me know if more is needed!  Also, what would be the correct way to direct that Content.Load to Monster.png given the current directory situation?  Right now I just have it using the full path from the C:// drive.  Thanks in advance!

sentences:
Changing long float to number + short scale I am looking to use a piece of code to take an extremely long number and convert it to decimal equivalent + short scale. (i.e. 120100000000 would be 120.1 Billion)

I am doing this with two separate scripts but this can be condensed into a single one. I am trying to look for a recurring process instead of the massive amount of if statements currently running in the script.
This is being done with an external array in Unity that holds the strings for short scale. (billion,trillion, etc)

Trying to find a recurring model that will look for the length, and attach it to the appropriate array object.

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

public class amountText : MonoBehaviour {
    public Text text;
    public Text numberPref;
    public string[] values;
    public static float number = 1000f;

    private float numberLength;
    private float remainder;
    private float increaseAmount = 5000f;

void Start () {
    text = GetComponent <Text>();
}
void Update () {
    text.text = Mathf.RoundToInt(number).ToString();
    numberLength =  Mathf.RoundToInt(number).ToString().Length;
    if(numberLength <9) {
        text.text = Mathf.RountToInt(number).ToString();
        numberPref.text = (" ");
    }
    if(numberLength > 9 && numberLength =< 12) {
        text.text = number/1E-9;
        numberPref.text = (values[0]);
    }
    if(numberLength > 12 && numberLength =< 15) {
        text.text = number/1E-12;
        numberPref.text = (values[1]);
    }
    if(numberLength > 15 && numberLength =< 18) {
        text.text = number/1E-15;
        numberPref.text = (values[2]);
    }

}
}

sentences:
Libgdx Back button exit the app when I press back button on android, it exits the game although I ask it to go to other screen instead. It goes to the other screen for one or two seconds then it exits.:

if((Gdx.input.isKeyPressed(Input.Keys.BACK)))
    game.setScreen(new GameOverScreen(game,4));

sentences:
Procedural mesh comes out black in any shader I wrote a script that Creates a mesh procedurally
        mr = gameObject.AddComponent<MeshRenderer>();
        mf = gameObject.AddComponent<MeshFilter>();
        //
        mf.mesh = new Mesh
            {
                vertices = GetVertices(),
                triangles = GetTriangles()
                uvs = UpdateUVMap();
            };

        //assign material + shader.
        mr.sharedMaterial = new Material( Shader.Find("Shader Graphs/surface") );

(the mesh is a sphere for this example)
I created my Shader in shader-graph (any shader seems to have the same result)
When played, all seems good except that the object is black. What's happening?
//basic uv map example from docs
    public Vector2[] UpdateUVMap()
    {
        Vector2[] uv = new Vector2[this.vertices.Count];

        for (int i = 0; i < uv.Length; i++)
        {
            uv[i] = new Vector2(vertices[i].x, vertices[i].z);
        }

        return uvs.ToArray();

        //uvs.Clear();
        //uvs.AddRange(uv);
    }

sentences:
Unity Transport Layer API - How to manage client-server connections I am currently working on a "Master server" system for our Unity Game using Unity's Low Level "Transport layer API" for networking.

My problem is that I would like to prevent clients from connecting to eachother. I have tried not giving them a port on the Addhost() call, but it doesn't seem to change anything. They also do not seem to detect the connections, so basically I find myself with NetworkTransport.Connect(..) calls that work (the error byte is 0, meaning no error) but no actual connections. I don't understand what's going on.

I can't really show my code because it's quite long, but here's how it works, in summary :

The Clients objects initialise a Socket as normal with only one Reliable channel, no port, and one connection allowed by default. Then they have the ability to connect to another socket, as you'd expect. My problem COULD be coming from there : for testing purposes the IP I use for testing is 127.0.0.1. What I do not understand is, how can it "find itself" when it is not bound to any port ? And more importantly how can it NOT find the Master Server object whose socket IS bound to a port ?

Speaking about Master Server, it's an object that also initialises its socket, but with a port and many allowed connections.

When a client connects and the connection did not yield any errors, it considers the connection to the Master server to be successful and proceeds sending a message containing some information for the server about this client : the username chosen by the player for example.

When the master server receives a connection event, it registers the received ConnectionID and waits for more information from that same connection, for example the aforementioned username.

Both the client and the server handle receiving messages with the NetworkListener class (Static). On each frame it executes the Listen() method which executes a "normal" NetworkTransport.Receive() body. I can give you that part of the code as it is fairly common in design :

public static void Listen()
{
    int recHostID;
    int recConnectionID;
    int recChannelID;
    byte[] buffer = new byte[1024];
    int recDataSize;
    byte error;
    NetworkEventType e = NetworkTransport.Receive(out recHostID, out recConnectionID, out recChannelID, buffer, 1024, out recDataSize, out error);
    Debug.Log("Listening");
    switch(e)
    {
        case (NetworkEventType.Nothing):
            break;
        case (NetworkEventType.ConnectEvent):
            Debug.Log("Connection established. ConnectionID = " + recConnectionID);
            if (OnConnectionReceived != null)
            OnConnectionReceived(recHostID, recConnectionID, recChannelID);
            break;
        case (NetworkEventType.DataEvent):
            Debug.Log("Received data !");
            BinaryFormatter f = new BinaryFormatter();
            MemoryStream stream = new MemoryStream(buffer);
            Message = f.Deserialize(stream) as NetworkMessage;
            break;
        case (NetworkEventType.DisconnectEvent):
            Debug.Log("Connection terminated. ConnectionID = " + recConnectionID);
            break;
    }
}

Network message is a simple data structure which contains a ConnectionID (the one it's from), a message title and content. The title is used to determine the general purpose of the message. The content is the rest of the information.

What happens in my current build of the client :

The user is prompted to enter a username, then he clicks "Search for match". The search for match button is supposed to trigger the connection to the Master Server. The logs say that the connection was successful (as no errors are detected) but no Connection event is received on either side. This of course prevents everything else from working.

If you need further description of the problem just ask and I'll answer ASAP.

Thanks a lot in advance !

sentences:
How to run a method after a scene2d being rendered in libGDX I want to make a screenshot with

ScreenUtils.getFrameBufferPixmap(x, y, w, h);

I call this function in Actions.run(new Runnable{...}) in scene2d.ui, and the problem is that actions are called at very beginning of a new frame, so nothing is rendered yet.

How to call this method properly, e.g.

Scene.inTheEnd(run(ScreenUtils.getFrameBufferPixmap(x, y, w, h);));

?

sentences: Do I need to implement IPv6 support for my game? I'm going to implement network features for the game I'm currently working on, now I'm wondering if I need to implement IPv6 support or just having support for IPv4 is enough?

sentences:
How to initialize OpenGL context with PyGame instead of GLUT I'm trying to start with OpenGL, using Python and PyGame.

I'm going to use PyGame instead of GLUT to do all the initializing, windows opening, input handling, etc.

However, my shaders are failing to compile, unless I specify exactly the version of OpenGL and profile.

They do compile with GLUT initialization from the book:

glutInit()
glutInitDisplayMode(GLUT_RGBA)
glutInitWindowSize(400, 400)

# this is what I need
glutInitContextVersion(3, 3)
glutInitContextProfile(GLUT_CORE_PROFILE)

glutCreateWindow("main")

But, with simple PyGame initialization like this:

pygame.init()
display = (400, 400)
pygame.display.set_mode(display, pygame.DOUBLEBUF|pygame.OPENGL)

which doesn't specify exact OpenGL version 3.3 and CORE_PROFILE,
the same program would fail when trying to compile shaders:

  RuntimeError: ('Shader compile failure (0): 0:2(10): error: GLSL 3.30
  is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES,
  and 3.00 ES\n', ['\n    #version 330 core\n    layout(location = 0) in
  vec4 position;\n    void main()\n    {\n        gl_Position =
  position;\n    }\n    '], GL_VERTEX_SHADER)

My question is: how do I do this initialization with PyGame?

sentences:
How to achieve a sheet of paper unfolding from the center in XNA 2D? I need to create an effect like a folded sheet of paper unfolding.

I was thinking about transforming an image so it "scales" from the center to the borders by cutting the image in half and scaling both parts to create this effect.

Is there a better way?

sentences:
Why does lightmapping take so long compared to real time shadows? I am using Unity 5. As a test, I set the realtime shadow resolution to max and the distance to cover my entire scene with no cascades. As expected, it lagged severely, but I could still move the camera and the shadows updated in real time.

As a second test, I lightmapped the scene using the absolute lowest settings. This took about a minute to complete.

Basically, I can use lightmapping, and it takes much longer to work than real time shadows even though it looks worse. Why does lightmapping take so long to bake in comparison to real time shadows?

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: How do I play a video file in OpenGL? Is there a library that will let me load a movie file and play it in an OpenGL application?  Or maybe just a code sample that someone has lying around?  I'm also using GLUT, if that makes a difference.  I guess file format doesn't matter, although currently my movie is in AVI format.

sentences:
Shadertoy getting help moving to glsl I spent some time writing a shader on shadertoy but now, when I try to translate my code to opengl I don't know how to calculate the uv that they describe as like this:

vec2 uv = fragCoord.xy / iResolution.xy;

How can I do that in a typical opengl 330 core fragment shader?

sentences:
Hidden operations of the Direct3D pipeline I'm curious- what operations are there in Direct3D that aren't controlled directly through shader, or directly to do with shader manipulation- i.e., that occur behind the scenes.

So far, I've got just pixel interpolation.

sentences:
Consistent normals at any angle in bezier curve Could not work out or find any solution for this.

I have a spline which consists of bezier curves (in 3d space) — in fact, any straight line will also have such problem.

I take a point on the curve and need to get a normal to this point at any given angle 0 - 360 (say, to build a mesh around it or to calculate an offset for the movement).

I understand that in 3d space we have to define a plane to build normal, normally — by using Vector3.Cross(A, B); In general, one uses curve's tangent as A and, e.x., Vector3.up or right as B.

But, if curve becomes vertical (it can go in any direction, imagine any track that is ground-independent, like in space), it gets aligned with Vector3.up, and the direction of normals goes crazy, swaps direction and so on, which is quite logical. More, it does so not only in straight vertical position, but start to change gradually around it.

So, the question is: how can I get consistent (all in equally correct direction) normals, using any given curve point position and angle for normal rotation?

Update:

The initial approach looked like this:

public Vector3 GetTangent(...) {

    Vector3 q2 = CalculateTangent (...);

    Quaternion lookAt = Quaternion.LookRotation (q2);
    Vector3 normal = lookAt * Vector3.up;
    normal = Quaternion.AngleAxis (angle, q2) * normal;
    return point + normal * size;
}

Which generated the following normals (blue is up):

Now, if I try to use the previous normal for the direction:

Quaternion lookAt = Quaternion.LookRotation (q2, previousNormal);

first of all, I don't understand what to place here:

Vector3 normal = lookAt * ?

And any combination of tangent, normal and rotation gives me something like this:

Where it can be clearly seen that normals on the vertical are improved (though not correct), but on the horizontal all went wrong, as if I just changed Vector.up to Vector3.right.

In addition, the code for generating the tube in its main part looks like this:

float vStep = (angleTo - angleFrom) / pipeSegmentCount;
if (b == 0 && _tP == 0f) _tP = 0.01f;
if (b == 0 && _t == 0f) _t = 0.01f;
if (b == spline.Nodes.Count - 2 && _tP == 1f) _tP = 0.9f;
if (b == spline.Nodes.Count - 2 && _t == 1f) _t = 0.9f;
Vector3 vertexA = spline.GetTangent (_pP, _tP, _bP, Vector3.up, pipeAngle, pipeRadius);
Vector3 vertexB = spline.GetTangent (_pointsTotal[b] [s], _t, b, Vector3.up, pipeAngle, pipeRadius);
for (int v = 1; v <= pipeSegmentCount; v++, i += 4) {
    vertices [i] = vertexA;
    vertices [i + 1] = vertexA = spline.GetTangent (_pP, _tP, _bP, Vector3.up, v * vStep + pipeAngle, pipeRadius);
    vertices [i + 2] = vertexB;
    vertices [i + 3] = vertexB = spline.GetTangent (_pointsTotal[b] [s], _t, b, Vector3.up, v * vStep + pipeAngle, pipeRadius);
}

Where 0.01f and 0.99f are because ends of spline do not have control points and LookRotation produces an error about zero rotation. b and _bP are node indexes, and _P suffix is for "previous".

This particular code is used to generate a round rail and move an object beneath it. Thus, it is important that the bottom normal is consistent and always at the bottom (when it is vertical, this bottom is not the world bottom of course, but it protrudes at the side of the tube, object will turn itself accordingly, looking forward the curve).

sentences:
Question about references I have an enemy game object and an item game object.

Enemies have an ItemDrops script attached.
Items have a DisplayItemLabel script attached.

Attached to each enemy:

public class ItemDrops : MonoBehaviour
{
    public Transform itemPrefab;
    private EnemyHealth enemyHealth;

    private float originToGroundDistance;
    private Vector3 offset;

    private bool itemDropped;
    private bool numberGenerated;
    private float randomNumber;

    private ItemData itemData;
    public string nameOfDroppedItem;

    void Start()
    {
        enemyHealth = GetComponent<EnemyHealth>();

        itemData = GameObject.Find("Item Manager").GetComponent<ItemData>();
    }

    void Update()
    {
        //Initialized in Update instead of Start because enemy floats to 1.083333 on the Y-axis after some time after Start
        originToGroundDistance = transform.position.y - 0.25f;
        offset = new Vector3(0f, originToGroundDistance, 0f);

        if (enemyHealth.isDead && !itemDropped)
        {
            if (!numberGenerated)
            {
                RandomNumberGenerator();

                //Debug.Log(randomNumber);

                if (randomNumber < 1)
                {
                    SpawnItem(itemData.coin);
                }
            }
        }
    }

    private void RandomNumberGenerator()
    {
        numberGenerated = true;

        randomNumber = Random.value;
    }

    private void SpawnItem(Item item)
    {
        itemDropped = true;
        nameOfDroppedItem = item.itemName;

        Instantiate(itemPrefab, transform.position - offset, Quaternion.identity);
    }
}

Attached to each item:

public class DisplayItemLabel : MonoBehaviour
{
    private GameObject itemLabel;
    private Text itemNameText;

    void Start()
    {

        itemLabel = transform.Find("Canvas/Item Label").gameObject;
        itemNameText = itemLabel.GetComponentInChildren<Text>();

        itemNameText.text = "Item Name";

        itemLabel.SetActive(false);
    }

    void Update()
    {
        ClampLabelToItem();
    }

    private void ClampLabelToItem()
    {
        Vector3 offset = new Vector3(0f, 16f, 0f);

        Vector3 desiredPosition = Camera.main.WorldToScreenPoint(transform.position) + offset;
        itemLabel.transform.position = desiredPosition;

        itemLabel.SetActive(true);
    }
}

Item is not a child of enemy for multiple reasons I can think of. One is that enemies are destroyed when they are killed. With that said, how do I get the item to know who dropped it or get the enemy to know which item it dropped?
MY GOAL is to get itemNameText.text = "Item Name"; to say something like itemNameText.text = itemDrops.NameOfDroppedItem; but I can't use GameObject.FindGameObjectWithTag("Enemy").GetComponent<ItemDrops>(); because it won't always grab the correct enemy and thus the correct ItemDrops script.
I also can't set DisplayItemLabel.itemNameText.text = nameOfDroppedItem in the SpawnItem function because it wouldn't know which item's DisplayItemLabel script to get.

So clearly, I'm having issues with references. What should I do?

sentences:
First Steps. Windows Phone game development I'm pretty new in game development. Have a couple ideas wich could be cool. First that comes to mind is to develop a 2D game (kinda puzzles) for Windows Phone Mango. You may ask: "Why Windows Phone?". I answer - I've got solid experience in Silverlight and C#. For me, this is a major advantage compared to other platforms.

Please, give advice and suggestions about:

What should I read?
Best practices.
Third party libraries.
Silverlight(Only) vs XNA.
Whatever I should pay attention to.

sentences:
How can I change the speed flag for random or not random at run time? This method is being called by Update()
private void SpeedUpdater()
    {
        if (changeSpeedOnce == false)
        {
            foreach (WaypointsFollower follower in waypointsFollowers)
            {
                if (randomSpeed)
                {
                    follower.speed = Random.Range(minRandomSpeed, maxRandomSpeed);
                }
                else
                {
                    follower.speed = speed;
                }
            }

            changeSpeedOnce = true;
        }
    }

I'm using the changeSpeedOnce flag helper to assign the speed to the followers once either random or the constant speed.  but then when the game is running changeSpeedOnce is true and if I want to change the randomSpeed flag again I need somehow somewhere to set the changeSpeedOnce to be false again.
I don't want to use a button or an input key for that but using the randomSpeed flag.

sentences: Serialize classes in unity c# Is there some best practices to serialize objects to file on mobile devices in Unity using C#. I've tried to search it myself, but found only this link. However, it looks like here they are trying to cache AssetBundles. I'm new to Unity, but I have some experience in iOS (swift) development. Here we have opportunity to cache some objects(variables) in local storage, to avoid overusing network. So I wanted to create some static class (for example Storage), which caches variables to file permanently and return them by some key.

sentences:
How to obtain "annealing" effect via particle system In this video demonstration, there is the annealing effect, where particles seems to loose their hue and converge into pure white, and then gradually disappear via alpha channel. And in parallel to all of this: particles are gradually becoming thicker.

I tried with my particle system and it is giving different results. How to obtain the "annealing"?

sentences:
Efficient way of loading wavefront models in openGL game In my game, a RTS game, the units are all wavefront obj. all their animation frames are each seperate wavefront obj file. ie. without any skeletal animation; fully rigid models. So when many units are loaded before a game starts, it takes too much time. for example, if 20 types of units are loaded, they take approximately 700/800MB in memory, take atleast 3 minutes to load.

Can it be done in an efficient way somehow?

Solutions I have already used:

As obj parsing take too much time. I have stored each obj as memory dump and load that dump. This helped a lot atleast reduced to 3min from 10min, for above example.

Further Possible solution I tried:

I tried loading the anination frames on runtime, when they are accesessed. But this is making the game slow at some crucial time. Like when fighting, all units' fighting frames are loaded together. thus making the game slow.
loading the units in different threads. Makes no improvement

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: How to stop and start sprite sheet flipbook materials in a widget blueprint? I have a flipbook material I created from a sprite sheet to add some fireworks to a game I'm working on. I have the material set up and it is showing the animation of the firework like it should. However the animation in the material always repeats forever in a loop. I added an image to a widget to display the flipbook animation in a widget blueprint. The animation is shown in the blueprint as expected. The problem I have is getting the animation to start only when I show the animation. Being that the animation in the flipbook material is always looping, every time I show the image to show the firework, it seems to always start in a random frame, rarely is that frame actually the first frame. I read that I can control the speed of the animation in the flipbook. How can I stop the flipbook animation from looping indefinitely and only start the animation once I show the widget containing the image used to show the flipbook animation?

sentences:
Keyframe animation workflow Been digging through the animation tools in Unreal, trying to find a direct way to set keyframes and edit animation curves on a skeletal mesh. It seems far more complicated than I expected, generally requiring imported poses and animation that is then edited, mixed, etc... in blueprints.

What I am wondering, is there an efficient way to

take a skeleton,
position and keyframe its bones in one place not with multiple bone transform nodes wired together
then edit the resulting animation curves

so as to set poses and create animation directly in the editor, or is the only reasonable way to keyframe and edit curves when using Unreal is in an external program?

If it is practical, what editor panes, blueprint nodes, and game objects would I use?

sentences: How do i get the X,Y and Z of the way my unit is facing? I have the yaw and pitch of my unit at my disposal, I know if I use polar to cartesian conversion I'll get the X and Y of each one of those two, but I need them combined to give me the x,y and z of the direction I'm facing.

sentences:
How to include fur in the exported obj file in Maya? In Maya I use fur to create plants. In my game I want to render these plants with cel shading. I use Wavefront .obj as a file format in my game for the models, but it doesn't seem to include the fur.

Is there a way to export the fur (as vertices) with the model into the obj file? Generating the fur at runtime is a bit CPU expensive for the platform.

sentences:
Get world object transform relative to another object (potential parent) I'm attempting to parent a bullethole decal to a dynamic object. I've figured out how to set the correct position for the bullethole object so that it shows at the correct position of the dynamic object, but once that dynamic object is rotated, parenting new bulletholes are skewed because I'm not compensating for the rotation of the dynamic object (the child object, bullethole decal in this case, is translated relative to the parent, which is why I'm attempting to remove the initial rotation of the parent object to get the actual rotation for the child). I've probably done a terrible job of explaining this...so here is a video of what I'm working on (note that the bulletholes that are added to the barrel before it is moved stay where they should be, and it's only after the barrel is rotated that new bulletholes become skewed)
So I believe I know what needs to happen, I'm just not sure how to go about implementing it. I need to compensate for the rotation of the barrel at the time the bullethole is parented to it, setting the rotation of the bullethole to this value. Possibly an easy question to answer for someone with experience working with quaternions.
if (raycast.hasHit())
{
    auto hitPoint = vel::helpers::functions::bulletToGlmVec3(raycast.m_hitPointWorld);

    bulletObject->currentPositionFromScreen = hitPoint;
    bulletObject->disposeOnNextTick = true;

    auto normal = vel::helpers::functions::bulletToGlmVec3(raycast.m_hitNormalWorld);
    float nrmDot = glm::dot(normal, glm::vec3(0.0f, 1.0f, 0.0f));

    auto bulletHoleAdjustmentValue = this->currentBulletHoleIndex == 0 ? 0.00001f : 0.00001f + (0.00001f * this->currentBulletHoleIndex);
    auto bulletHolePosition = hitPoint + (normal * glm::vec3(bulletHoleAdjustmentValue, bulletHoleAdjustmentValue, bulletHoleAdjustmentValue));

    auto bulletHoleActor = this->bulletHoleQueue.at(this->currentBulletHoleIndex);

    if (this->currentBulletHoleIndex < (this->bulletHoleQueueSize - 1))
        this->currentBulletHoleIndex++;
    else
        this->currentBulletHoleIndex = 0;

    bulletHoleActor->getTransform().setTranslation(bulletHolePosition);

    if (nrmDot < 1.0f && nrmDot > -1.0f)
        bulletHoleActor->getTransform().setRotation(glm::toQuat(glm::transpose(glm::lookAt(hitPoint, bulletHolePosition, glm::vec3(0.0f, 1.0f, 0.0f)))));
    else
        bulletHoleActor->getTransform().setRotation(90.0f, glm::vec3(1.0f, 0.0f, 0.0f));

    bulletHoleActor->setVisible(true);

    // if physics object has a user pointer, parent bullethole actor to the actor which that value represents
    if (raycast.m_collisionObject->getUserPointer() != nullptr)
    {
        auto dynamicActor = (vel::scene::stage::Actor*)raycast.m_collisionObject->getUserPointer();

        bulletHolePosition =  bulletHolePosition - dynamicActor->getTransform().getTranslation();
        bulletHoleActor->getTransform().setTranslation(bulletHolePosition);

        // Was thinking below would work, but it does not for some reason?
        //auto newRotation = bulletHoleActor->getTransform().getRotation() * glm::inverse(dynamicActor->getTransform().getRotation());
        //bulletHoleActor->getTransform().setRotation(newRotation);

        bulletHoleActor->setParentActor(dynamicActor);
    }

}

sentences:
2d ParticleSystem batching problem I have multiple ParticleSystems with TextureSheetAnimation pointing to the same texture, using different offsets/rows to choose different textures.

They seem to batch with each other, but they're also being split by Unity into multiple batches in a strange manner.

Here's a Frame Debugger view:

These 4 Draw Dynamic are on the same atlas, using Mobile/ParticlesAdditive shader.

The reason of breaking batching is:

  Objects have different batching keys. This is usually caused by using
  different vertex streams on ParticleSystems or by mixing Lines and
  Trails, or by mixing lit and unlit geometry.

All of the ParticleSystems have a simple setup, some Color Over Lifetime, some Velocity Over Lifetime etc.

The strange thing is that Unity breaks batching like it makes one batch, puts half of the stars and half of the smokes into that, and then, makes another batch from these two.

So they do batch, and the don't o.O

I couldn't find and help on the web about this issue.
I'd be glad for help.

sentences:
Java or Flash for MMO Game? I hope this question hasn't been asked before.

I'm thinking of creating an MMO game, perhaps for Facebook. I've investigated the options of using Java or Flash/Flex. But I'm still not sure which to go with. Does anyone have any advice on which language to use?

Which language has more open source or free tools/libraries? Which one has better performance for a database transaction-heavy game?

A few notes:
I'm intending it to be a 2D, isometric game with cartoony graphics. Nothing necessarily intense on the graphics front. I've heard of JMonkeyEngine, but that's 3D. The only other thing I've found that's good for 2D is LWJGL. One thing I don't like about Flash/Flex is that it can't create a direct connection to the database. Is that also true for a Java-based game?

Essentially, I would like to know how to approach the development of an MMO. What tools/libraries should I use? I'm hoping that there are open source/free options.

Thank you for your time.

sentences:
Scaling Skeletal values to be able to reach objects on the screen I have created a game using Kinect + XNA and the game runs on full screen mode.. However when i try to touch or reach a certain area on the screen using hand.. I cant reach it.. I will already be outside the range of the sensor trying to touch the object on the game screen..

Is there anyway I can scale the skeletal values so that the users can easily touch objects on the screen without having to stretch or bend too much?

sentences: How is scripting done in games such as Zelda? How do games implement their triggers and events that make up the plot of the story. For example, to be concrete how would one implement the story of a game such as The Legend of Zelda: A Link to the Past. I'm assuming there is some kind of scripting that somehow hooks into the game world state? I know absolutely nothing about scripting and game development. And have no clue how the underlying code would be architected in terms of classes, data structures, design patterns, etc.

sentences:
How to slow down this rotation My goal here is simple. I am making a top down shooter kind of game, and I want the player to simply rotate in one axis, towards where the mouse is on the screen. I got it working, but it rotates so fast that everything is out of control. The following method is called in Update() on my player's game object

void RotatePlayer()
{

    var targetPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 100);

    targetPosition = Camera.main.ScreenToWorldPoint(targetPosition);

    targetPosition.y = transform.position.y * Time.deltaTime;

    transform.LookAt(targetPosition);

}

That rotates in the direction of the mouse, but like I said it rotates so fast that you cannot control it.

As you can see I tried to multiply by delta time, but that did not seem to do anything. Also, changing that last parameter of "100" to a lower number also does not do anything.

Any help is greatly appreciated.

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:
Unity UI Buttons Not Functioning I have been working on a UI Inventory System for my Unity game and for some reason, none of my buttons work in my game. All the buttons have the ‘interact-able’ box ticked and an EventSystem which is in the scene. In my scene, I have an image, which is holding two buttons, in a canvas. The buttons are supposed initiate a function called UseItem when clicked, but they don't respond to anything. I have tested them using Debug.Log, but I don't get any messages back in the Console. I also don't get any errors or warnings. I am using Unity 2019.4.17f1 LTS.
The pictures below show my UI.
Here's a picture of my game scene:

Here's the complete hierarchy:

These are the EventSystem's configurations:

These are my canvas settings:

And these are use and drop button settings:

sentences:
LibGDX - Wait for action to complete With Scene2D, in the act() method of a Group, under certain circumstances I add actions to some children (eg a moveTo, or a fadeOut), which last a few tenths of seconds. Now I need ALL these action to complete before I start running the code in act() again. Right now I'm using a kludge with a timer, I set a variable actionRunTime before attaching the actions to children, set to the value of how long all actions should take to complete, then in act() I do

public void act(float delta){

  super.act(delta);  // to have the actions run on children

  actionRunTime -= delta;

  if (actionRunTime >= 0) return;

  // ... code to run when no action is running

This looks terrible to me. Is there some cleaner way?

sentences:
Why would a borderless full-screen window stutter occasionally? I want to be able to allow players to switch between full-screen, windowed, and full-screen-with-a-borderless-window rendering modes. The last mode, borderless is an important one lots of players, myself included.

I have noticed that my game will stutter a little bit in borderless windowed mode. It's not terrible, but choppy gameplay can get slightly annoying and I want to it to be as smooth as it is in full-screen. I know other games have always had some issue with being borderless. I just figured since my game isn't that intensive I shouldn't see much of problem.

I am using David Amador's "XNA 2D Independent Resolution Rendering" code. The trouble comes when I create my gameplay screen and use the following code to create a borderless window:

Form gameForm = (Form)Form.FromHandle(curGame.control.Handle);
gameForm.FormBorderStyle = FormBorderStyle.None;

If I have it set to fullscreen through Amador's Resolution class then this borderless code doesn't seem to do anything at all. If I have it set to windowed it does work as expected and creates a borderless window. The only problem is that strange choppy behavior.

In full screen it doesn't lag one bit so I'm wondering if there's some issue with how the borderless code works. Is how I'm doing a borderless window correct? Am I just going to have to deal with a little bit of stuttering in that mode?

sentences:
Playing Multiple Sound effects isssue in cocos2d-x Please help if someone faced this issue. I have a sound effect 3sec long which need to be played repeatedly for some time of 10 to 15 secs. Implemented like below:
SimpleAudioEngine::sharedEngine()->playEffect(powerUpSound, true);

But when I play an another sound effect, previous sound (powerUpSound) effect stops.
SimpleAudioEngine::sharedEngine()->playEffect(starsSouns, false);

Any help will be appreciated. Cocos2d-x v2.2.3

sentences:
Taking Physics into account for AI Planning What I've seen in most Game Engines and game engine design is that the Physics Engine is the be all end all system.

Basically, AI for example may want to travel to some position, but it simply sends that request (velocity, direction) to the Physics Engine.  If the AI really gets to that position is up to the will of the Physics Engine.

Is there some Design or Physics Engine which will let you plan out how Physics will react? Before it will actually occur?

Take for example that you can do Motion Planning by the AI to nearly eliminate foot sliding.

images from aigamedev.com - Motion Planning for Fun and Profit!

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:
In-Game Tutorial Decisions I'm working on a game with confusing mechanics such as energy storage and the coolant temperature. What is the best way to get a new player learned quickly? What are the pros and cons of different in-game tutorial methods? I was thinking of a tutorial with annotated screenshots, but that makes it sound like a science textbook ("Active towers are towers that consume energy and may generate heat.").
Other ways include:

in-game tutorials, which is somewhat difficult to program
tips that will show in-game and after game over
a reduced difficulty without the energy and coolant things

sentences:
Why is the texture all wrong on my model? Why is this happening? If possible I'd like to know what this particular problem is called. The model is a simple cube made in blender and exported with normals and MTL. Texture is the cube unwrapped with crate image on each side.

Are the UV coordinates wrong?

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:
Moving a character to a point without any floating point operations So I'm writing an adventure game for MSDOS, just a fun challenge for me. I'm trying to get the character to walk along a straight line to his destination (either the next navMesh node or where you clicked). Normally I would simply store the characters x,y as floats and add the direction vector to it for each move, the problem is that cpus before the 486 didn't have FPUs at all so floats are out of the question. So naturally I thought about Bressenham's line algorithm which can be done using all ints. Taking inspiration I came up with this function here which runs every frame:

void character::doWalk()
{
    int x_diff = destination.x - x;
    int y_diff = destination.y - y;

    int x_dist = abs(x_diff);
    int y_dist = abs(y_diff);

    int walk_x_dir = x_diff > 0 ? 1 : (x_diff < 0 ? -1 : 0);
    int walk_y_dir = y_diff > 0 ? 1 : (y_diff < 0 ? -1 : 0);

    if(y_dist >= x_dist || yerror > 0)
    {
        y += walk_y_dir;

        yerror -= path_dist_x;
    }
    else
    {
        yerror += path_dist_y;
    }

    if(x_dist >= y_dist || xerror > 0)
    {
        x += walk_x_dir;

        xerror -= path_dist_y;
    }
    else
    {
        xerror += path_dist_x;
    }
}

path_dist_y is the vertical distance calculated when the character begins walking path_dist_x is the horizontal distance.

This algorithm almost works, it seems that he begins walking at an angle just too shallow to get to the point correctly and he has to change direction near the end of his walk to make it to the point. Any idea what else I could try?

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:
Keep track of VoxelData/NPC in parallel Level Background

I'm tring to make a First-Person-Shooter Game in a Voxel-World (Finit Size) with Unity3d.

The Player has some kind of a Base that he has to protect against Enemy units. There are also one or more enemy Bases that the Player has to destroy, but in a different Level/Map.

The Game has multiple Levels that are connected through predefined Ports. So the Player and other Units can travel from Level to Level. There are a couple of Levels to explore. (Maybe there could be infinit Levels in the future.)

At game start I create a LevelManager and all Levels as Children of them. They can spawn an manage the Units and Voxel-Blocks independently. One ChunkManager renders always the current Level where the Player is in. He creates multiple Chunks which itself generate the Mesh from the current Voxel-Data of the Level. This works all very well and I'm also able to travel between the Levels. (This runs all in one Scene.)

At the moment I try to implement some kind of a Worm unit. They spawn from time to time anywhere in each level and can move randomly around and modify the Voxel-World by eating the Blocks away... type of random enviroment event.

Problem

The problem I can't solve is how to simulate all the Worms in parallel Levels? And the Blocks they have eaten? Same problem would occur for the enemy bases if they grow and build new defences and so on.
Because when the Player enter a Level there should be some differences since his last visit.

My attempt

All my Units and Buildings have already separated logic and rendering components. So they can work properly even when not rendered by the ChunkManager. Its working for maybe 3 Levels and a handfull of worms but if I increase the amount of Levels it gets starting to go laggy (4-10FPS). So this would not be the right way to go or is it and my code is crap?

Has someone any suggestions for me how I can solve this?

Edit

I disable now all none active Levels and reactivate always the current Level where the Player is in. So I can better manage the objects that realy need computation time.

The problem I get now is how can I simulate the progress in a Level since start? Example for the worm unit. He would have moved across the Level and left a path of removed voxels. Should I made a seperate method to calculate the path that would be made or the last X minutes or should I just call the Update method multipletimes to match the missed calls since last X minutes? This should then be made by all Objects that can modify the Level or produce something.

sentences:
How to normalize angles from points in java Previous thread on projectile slopes

What is the velocity of a translating projectile in 2D?

What I'm trying to do

Get the slope at a constant speed for both X & Y Coordinates though I don't have an understanding on how to use Vectors in programming so I'm going off this guys equations but with both X & Y since I don't understand vectors. I can't tell at this point if there a direction or coordinate.

What I've done so far

Got everything ready

What I need help with

What do I have to put in as Syntax to normalize these 2 points even though their coordinates (Based off the answer on the given thread)

sentences:
UVW: better explanation, and how to implement with GLES texture2D() UVW texture coordinates, as opposed to UV texture coordinates, do not get very adequate explanation on the web. Many people offer the simple exlanation, "UV is for 2-dimensional textures and UVW are for 3-dimensional textures." I don't buy this.

I have found a small handful of explanations that I find inadequate. This and this seem to be the best I've come across.

The first link talks about an analogy of shining a laser on a wall. At a perpendicular to the wall, the beam will project as a circle. As the angle increases, however, the beam projects increasingly as an elongated ellipse (it skews).

This sounds to me strikingly like the math involved in lighting equations in that the outcome is related to a vector pointing perpendicular to the surface. How can this relationship be adequately described with a single scalar, the W coordinate (assuming my basic understanding is appropriate)? Can you explain the relationship between the UVW coordinates and the current model-view matrix?

More importantly, I have some models that describe texture coords with a non-zero W coordinate (about 1/3 of the tex coords, or so, and most non-zero values are nowhere near zero.) I'm using OpenGL ES 2.0, where my shading language only provides calls to texture2D(). First off, how significant is the effect of the W coordinate for typical models (think something shaped like an airplane)? (I suspect this question is unfair since it should depend equally on the texture itself.) Is the call to texture3D() required for this, and if so, how can I achieve the desired effect with texture2D()?

sentences:
Implementing The Command Pattern - Undo And Entity References I am trying to implement a replay/undo system for a turn based strategy game I am currently working on. A sample move could go as follows:

1. A players select a pawn and gives it an attack command.
2. The attacked unit dies.
3. The dead unit is removed from the map and the controlling player.
4. The controlling player takes some damage.
5. The attacking unit gains a survivor strength power up for the remainder of the game.

The rest of the game plays similarly to a Fire Emblem type game, but the point is a single command like attacking yields multiple effects to various game entities.

Eventually I want to make the game networked, but for now everything is local play.

After doing some research, I came across several resources discussing the command pattern and feel it is the solution to my replay and undo system. I ended up using an interface similar to https://gamedev.stackexchange.com/a/37684/41499 but I am confused on some of the implementation details.

Do I make commands to update each component of my game separately (i.e. AtkUnitCmd, RmvUnitFromMapCmd, RmvUnitFromPlayerCmd, InflictPlayerDmgCmd, etc.) or should my AtkUnitCmd handle all updates of entity state internally?
How do I handle dead units? I can store a reference to the dead unit, but this would likely need to change when networking is implemented as the object itself would not be transmitted over the network correct?
Each command has some animation involved for example when a unit moves an animation needs to play. I may choose to skip the animations while other times leave them on. Do I bake the animations into the commands themselves or should I separate the animation code and call it somehow when the command is played?

Any thoughts?

sentences:
How can I efficiently make a solid Texture2D? I am trying to programmatically make an Image to cover the entire screen.  I create the Texture2D, then create a Sprite from the Texture2D, then apply the Sprite to my Image. This works, but it is slow.

I suspect the issue is that I am setting each pixel individually for my Texture2D:

private static Texture2D CreateSolidTexture2D(Color color)
{
    var texture = new Texture2D(Screen.width, Screen.height);
    for (int y = 0; y < texture.height; y++)
    {
        for (int x = 0; x < texture.width; x++)
        {
            texture.SetPixel(x, y, color);
        }
    }
    texture.Apply();
    return texture;
}

I have tried creating the Texture2D by resizing a Texture2D of a single pixel, but the color comes out as a translucent white, instead of the color passed:

private static Texture2D CreateSolidTexture2D(Color color)
{
    var texture = new Texture2D(1, 1);
    texture.SetPixel(0, 0, color);
    texture.Resize(Screen.width, Screen.height);
    texture.Apply();
    return texture;
}

Why doesn't my second approach work?  How can I efficiently create a screen-sized Texture2D of a solid color?

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

sentences:
"Squeezing" a game object based on distance to another game object I am trying to "squeeze" a gameObject. When distance starts to be 6.98, execute this code: "The smaller the distance between gameObject1 and gameObject2, the thinner and longer this gameObject is". Somehow, this code has no effect. Why?

public Transform gameObject1;
public Transform gameObject2;

void Update ()
{
    float distance_squeeze = Vector3.Distance(gameObject1.position,
                                              gameObject2.position);
    if(distance_squeeze < 6.98F)
    {
        transform.localScale = new Vector3(-distance_squeeze, distance_squeeze, 1);
    }
}

sentences:
Space nebula cloud generation? I found a cool kickstarter project called "Skywanders".
It's an minecraft like space game with a lego like building system and pretty cool graphics.

One thing I noticed are the "nebula clouds". They are procedurally generated 3D Objects and they look amazing.

How do I generate such nebulas? I bet there's a way to do that. And is it possible to convert a 2D nebula into a 3D one? I didn't found any algorithm yet or other sources.

sentences:
UDK : Problem with Touching Actors In my game I am trying to see all touching actors of a particular DynamicSMActor and it does return only two Actors as touching Actors - Water Volume and Player Pawn. It is ignoring all the other DynamicSMActors that are touching. I actually tried different values for collision type, Blocking type, etc,. No success.

Any help is really appreciated.

sentences:
How to create an Editor class for a generic class For all my MonoBehaviour scripts, instead of them inheriting from MonoBehaviour they inherit from a generic class like so:

public abstract class MonoBase<T> : MonoBehaviour where T : MonoBase<T> { }

public class Example : MonoBase<Example> { }

Now, I would like to make an editor script for all those MonoBase classes, and the closest I have gotten to a solution that will compile is :

[CustomEditor(typeof(MonoBase<>))]
public class MonoBaseEditor<T> : Editor where T : MonoBase<T>
{
    public override void OnInspectorGUI() {
        this.DrawDefaultInspector();

        MonoBase<T> myScript = (MonoBase<T>)this.target;
        if (GUILayout.Button("Build Object")) {
        }
    }
}

But of course it doesn't really work.

Am I missing something or is there really no way to make a generic editor class like it's mentioned in an answer here.

sentences:
Saving instances of classes, then recreating the instances I have many types of entities, each type has a lot of if instanceof Spider (for example ) then do this in the game code... Now I got to the part where I want to save each type.

They all are based on the same class, Entity but implement some of their own methods.
When I save them, lets say for now I just want their position and their health.

So I do write position the write health, to a file with all the entities.

Now here is the problem, When I want to load it, How will I know it's a spider and then create a Spider instance?

An easy fix is to create toString method then writing it before the position and health. But the problem with this is that when I load I will have to have this big switch statement for each type and I will have to manually add the case for a new type that I create. This is not very mod friendly.

What would be a way to read a name of a class and then create an instance of that class without having a big switch case?

sentences:
Why should i set glClearColor and setProjectionMatrix in render method many time in LibGDX? import com.badlogic.gdx.Game;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class MyGame extends Game {
    public OrthographicCamera camera;
    public SpriteBatch        batch;
    //..

    @Override
    public void create() {
        //..
        batch = new SpriteBatch();

        Gdx.gl.glClearColor(0, 0, 0, 1);
        batch.setProjectionMatrix(camera.combined);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        //..
    }

In LibGDX Doc
Gdx.gl.glClearColor(0, 0, 0, 1); and batch.setProjectionMatrix(camera.combined);
is setting in render() method at a time.
I use this definitions in create() method at once, and it is running perfect.

So why should i use this definitions in render() method? is't it a performance loss?

sentences:
lightmap equivalent with realtime shadow i'm using in Unity free edition.

I try to bake a lightmap which equivalent feeling with Unity's real time light map and shadowing, like left figure.

But the result is the right figure.

How can i set a paremters of lighting window to get result like left figure?

--added--

here's all of screenshots.

sentences:
Triangulating a partially triangulated mesh (2D) Referring to the above exhibits, this is the scenario I am working with:

starting with a planar graph (in my case, a 2D mesh) with a given triangulation, based on a certain criterion, the graph nodes are labeled as RED and BLACK. (A)
a subgraph containing all the RED nodes (with edges between only the directly connected neighbours) is formed (note: although this figure shows a tree forming, it may well happen that the subgraph contain loops) (B)

Problem: I need to quickly build a triangulation around the subgraph (e.g. as shown in figure C), but under the constraint that I have to keep the already present edges in the final result.

Question: Is there a fast way of achieving this given a partially triangulated mesh? Ideally, the complexity should be in the O(n) class.

Some side-remarks:

it would be nice for the triangulation algorithm to take into account a certain vertex priority when adding edges (e.g. it should always try to build a "1-ring" structure around the most important nodes first - I can implement iteratively such a routine, but it's O(n^2) ).
it would also be nice to reflect somehow the "hop distance" when adding edges: add edges first between the nodes that were "closer" to each other given the start topology.

Nevertheless, disregarding the remarks, is there an already known scenario similar to this one where a triangulation is built upon a partially given set of triangles/edges?

sentences:
Handheld video playback pauses when going to the home screen Put an MP4 movie in your StreamingAssets folder and play it with

Handheld.PlayFullScreenMovie("MyMovie.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput);

Then, in the middle of the movie, go to the home screen and then go back to the game. The video is paused.

You can't resume it because upon tapping the screen the video will disappear because of the CancelOnInput parameter (which I want to keep).

So - how can I make it so when the player returns to the game, the video resumes? I don't want to show video controls.

I am using Unity Pro 5.4.2, running on an iPhone 7 with iOS 10.1.

sentences:
Setting a uniform float in a fragment shader results in strange values, is this a type conversion? How can it be fixed? First, some details:

I'm learning OpenGL from the tutorials on https://open.gl
My computer is running Linux Mint 18.1 Xfce 64-bit
My graphics card is a GeForce GTX 960M
OpenGL Version: 4.5.0 NVIDIA 375.66
GLSL Version: 4.50 NVIDIA
Graphics Card Driver: nvidia-375 Version: 375.66-0ubuntu0.16.04.1
CPU: Intel Core i7 6700HQ
The code I'm working on can be found here: https://github.com/Faison/sdl2-learning/blob/8a61032d20edf91cfa60f665e1bb4d72e58f634b/phase-01-initial-setup/main.c (Makefile is located in the same directory)

In a fragment shader, I'm trying to make an image do a sort of "flipping mirroring" animation (lines 44-57):

#version 450 core
in vec3 Color
in vec2 Texcoord;
out vec4 outColor;
uniform sampler2D tex;
uniform float factor;
void main() {
 if (Texcoord.y < factor) {
    outColor = texture(tex, Texcoord) * vec4(Color, 1.0);
  } else {
    outColor = texture(tex, vec2(Texcoord.x, 1.0 - Texcoord.y));
  }
}

When factor is 1, the image should be right-side up and has some color on it.
When factor is 0, the image should be upside down and has no color added to it.
When factor is 0.5, the top half should be right-side up and the bottom half should be upside down.

Currently, that is only the case if I replace factor with the number.

When I set the uniform factor with glUniform1f(), I'm getting very strange results. To illistrate, I added some debug code to lines 188-197 that sets the uniform with one number, retrieves the number from the uniform, and outputs both values to try and see what's going on.

Here's the code:

GLfloat factorToSet = 1.0f;
GLfloat setFactor = 0.0f;
GLint uniFactor = glGetUniformLocation(shader_program, "factor");

while (factorToSet > -0.1f) {
  glUniform1f(uniFactor, factorToSet);
  glGetUniformfv(shader_program, uniFactor, &setFactor);
  printf("Factor of %.1f becomes %f\n", factorToSet, setFactor);
  factorToSet -= 0.1;
}

And here are the results:

Factor of 1.0 becomes 0.000000
Factor of 0.9 becomes -2.000000
Factor of 0.8 becomes -0.000000
Factor of 0.7 becomes 2.000000
Factor of 0.6 becomes 0.000000
Factor of 0.5 becomes -0.000000
Factor of 0.4 becomes 2.000000
Factor of 0.3 becomes -36893488147419103232.000000
Factor of 0.2 becomes 0.000000
Factor of 0.1 becomes 36893488147419103232.000000
Factor of -0.0 becomes -0.000000

So with what little I understand about OpenGL and the way scalar types are stored in binary, I'm thinking that this issue is caused my GLfloat getting converted into something else on the way to the shader's uniform float. But I'm grasping at straws.

What could be causing this strange conversion between the number I send to the uniform float and the value that the uniform float becomes? What could I do to fix it if it's possible to fix?

Thanks in advanced for any help and leads, I really appreciate it :)

An additional note after receiving a working answer

George Hanna provided a link to a post where someone had a similar issue. I read over the comments and someone said to use -DGL_GLEXT_PROTOTYPES as a CFLAG. So I rolled back my local code to use glUniform1f() again, added -DGL_GLEXT_PROTOTYPES to the Makefile, and everything worked! Even crazier, all the compiler warnings I had for implicit declarations of OpenGL functions were gone!

So in addition to the answer below, if you have this issue, try adding -DGL_GLEXT_PROTOTYPES to your CFLAGS.

(You can also get this affect by adding #define GL_GLEXT_PROTOTYPES before any OpenGL #includes)

sentences:
Jerky motion when standing on hovering object In a level of a 3D FPS I'm making, I have several floating pillars that move up and down (the x and z positions are always the same). When the player stands on one of the pillars, the motion is incredibly jerky going up, but smooth going down. I think the player is sinking into the pillar slightly and then catching up.

I've tried different colliders, all sorts of combinations with rigidbodys and character controllers. I've tried setting the pillar as a parent of the character and then having the player hover slightly. I've just hit a brick wall and would appreciate an outside perspective. Here's my code just in case the issue is in there.

Player movement

 public float walkSpeed = 6.0F;
 public float runSpeed = 10.0F;
 public float jumpSpeed = 8.0F;
 public float gravity = 20.0F;
 private Vector3 moveDirection = Vector3.zero;

 void FixedUpdate(){
     CharacterController controller = GetComponent<CharacterController>();

         moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
         moveDirection = transform.TransformDirection(moveDirection);
         moveDirection *= walkSpeed;
         if (Input.GetButtonDown("Jump")){
             moveDirection.y = jumpSpeed;
         }

         if (Input.GetButton("Sprint")){
             walkSpeed = runSpeed;
         }
         else{
             walkSpeed = 6.0F;
         }

     moveDirection.y -= gravity * Time.deltaTime;
     controller.Move(moveDirection * Time.deltaTime);
 }

 void OnCollisionStay(Collision hit) {
     if (hit.gameObject.tag == "Column") {
         transform.parent = hit.transform;
     } else {
         transform.parent = null;
     }
 }

Pillar movement

 float height;
 float speed;
 Vector3 start;
 Vector3 end;
 Vector3 startOrEnd;
 void Start(){
     speed = 0.01F;
     start = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
 }

 void Update () {
     motionControl(speed);
 }

 float randomNumber(float min, float max){
     float number = Random.Range(min, max);
     return number;
 }

 void motionControl(float speed){
     if (gameObject.transform.position == start) {
         end = new Vector3(gameObject.transform.position.x, randomNumber(0, 10), gameObject.transform.position.z);
         startOrEnd = end;
     }else if (gameObject.transform.position == end) {
         startOrEnd = start;
     }
     gameObject.transform.position = Vector3.MoveTowards(gameObject.transform.position, startOrEnd, speed);
 }

sentences:
Translating a terrains position using input in Unity 3D C# I am trying to make a terrain in Unity move, but im having trouble. Here's the code i have.

using UnityEngine;
using System.Collections;

public class NewScript : MonoBehaviour {

Camera camera;

Transform Terrain;
// Use this for initialization
void Start () {

}
// Update is called once per frame
void Update () {
    Terrain.Translate(new Vector3(500, 500 ,500));
}
}

now i would suspect that the terrain would just keep translating its position but it doesnt budge. How do i make a terrain move, or if you cant, how can i make the camera move and preferably with input. I am familiar with the XNA framework, is there a way to implement the input from XNA into unity?

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:
What are perimeter and aspect ratio, in the context of 3D mesh approximate convex decomposition? I'm trying to understand the logic behind Mamou and Ghorbel's algorithm in their paper A Simple And Efficient Approach For 3D Mesh Approximate Convex Decomposition.

I cannot understand what is the aspect ratio of a surface as defined by the author. It includes the perimeter of two vertices v and w. These two vertices represent two triangles in the original mesh as they come from the dual graph as the authors define it. So I'm guessing they are talking about the perimeter of the two triangles these vertices correspond to. What is the perimeter of two triangles? Do they mean the sum?

The algorithm proceeds like this:

Create a dual graph of the mesh, where each vertex corresponds to a triangle of the original mesh, and two vertices are connected by an edge iff their corresponding triangles share an edge.
Iteratively choose and collapse an edge, so that two vertices are merged into one. We keep track of the "ancestors" of each vertex, A(v) that have been merged into it in this way.

Here's where I get confused:

  The decimation process described in the previous section is
  guided by a cost function describing the concavity and the
  aspect ratio [5] of the surface \$S(v, w)\$ resulting from the unification
  of the vertices \$v\$ and \$w\$ and their ancestors:

  $$S(v, w) = A(v) ∪ A(w) ∪ {w, v}. (2)$$

  As in [5], we define the aspect ratio \$E_{shape}(v, w)\$ of the
  surface S(v, w) as follows:

  $$E_{shape}(v, w) = \frac{ρ2(S(v, w))}{4π × σ(S(v, w))}, (3)$$

  where \$ρ(S(v, w))\$ and \$σ(S(v, w))\$ are respectively the perimeter
  and the area of \$S(v, w)\$.

sentences:
Smoothness & performance issues of new game I've written the basics of a new game which just includes a game loop that can update and render basic game objects so far.

I want to ensure that what I've written so far is as good as it can be and provides me with the best & most flexible foundation to build a game on top of. Really don't want to discover something fundamental later which causes a massive re-write.

Even though the game is running at a very decent frame rate the game objects are not moving entirely smoothly. I'm seeing stuttering and what looks like skipped frames, especially when the game objects bounce off the walls.

I'm not sure if this is a problem with my game loop or how I'm updating the game objects, or something else?!

If I increase the number of game objects from 5 to 100 the performance does not seem to change so I don't think it's a processing issue.

The project is only small at the moment - https://github.com/arrwhidev/java2d

sentences:
How is the value of transform.position updated and accessed between different private methods? I followed this YouTube video but I'm still confused about how the code actually retrieves the value of transform.position.
I can understand the Camera.main.ScreenToWorldPoint code is to transform the screen position to a position in the world based on the camera's view, and it then uses this to update the transform.position as in the private void OnMouseDrag method.
However, I also learnt that since the method is declared as private, the "transform.position" cannot retrieve the value of "transform.position" in each {}bracket.
So how does the value of "transform.position" in private void OnMouseUp, private void Awake get updated, unless I misunderstood the concept?
using UnityEngine;

using UnityEngine.Assertions.Must;

using UnityEngine.SceneManagement;

public class GreenBird : MonoBehaviour

{
    Vector3 _initialPosition;
    private bool _birdWasLaunched;
    [SerializeField]private float _launchPower = 500;

    private void Awake()
    {

        _initialPosition = transform.position;
    }

    void Update()
    {
        if (_birdWasLaunched &&
                 GetComponent<Rigidbody2D>().velocity.magnitude <= 0.1)
        {
            timeSittingAround += Time.deltaTime;
        }

        if (transform.position.y > 10.00 ||
            transform.position.y < -10.00 || transform.position.x > 10 || transform.position.x <-10)
        {
            string currentSceneName = SceneManager.GetActiveScene().name;
            SceneManager.LoadScene(currentSceneName);
        }

    }

     void OnMouseDown()
    {
        GetComponent<SpriteRenderer>().color = Color.red;

    }

    private void OnMouseUp()
    {
        GetComponent<SpriteRenderer>().color = Color.white;
        Vector2 directionToInitialPosition = _initialPosition - transform.position;
        GetComponent<Rigidbody2D>().AddForce(directionToInitialPosition * _launchPower);
        GetComponent<Rigidbody2D>().gravityScale = 1;
        _birdWasLaunched = true;

    }

    private void OnMouseDrag()
    {
        Vector3 newPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        transform.position = new Vector3(newPosition.x, newPosition.y);

    }
}

sentences:
How can I get sensor data on iPhone onto a Windows PC? For use as a steering wheel I am making a Unity game. I want to be able to allow the phone to be used as a steering wheel, as input into the PC game.

Technically, How can I achieve this? Can this be done through bluetooth?

Thanks

sentences:
Unity 4 mecanim; 'Quaternion to Matrix conversion failed, input quaternion is invalid' I'm trying to animate a stick figure in Unity, with placeholder animations. Character is built/animated in Blender, exported to FBX. When imported to Unity, everything appears correct in the editor. All animations are imported, and i can preview them normally.

I set up the "rig" section of the model import to use generic rigging. This creates the avatar which is used in mecanim.

I set up a simple "walkForward" animation, and setup mecanim parameters to get it called when the player moved forward; all that works. The animation is called at the right times.

However, during play, as soon as any animation is started on the avatar, the model disappears, and a flood of error messages appear in the console, stating

Quaternion to Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, -1.#IND00} |=-1#IND00

I'm not altering the animation with any scripts of my own, it's all mecanim. Is there a setting i'm missing?

I'm using Unity 4.3.0.0f4, building/exporting my mesh with Blender (latest).

sentences:
LineRenderer doesn't apply material in 2D Unity5 I'm making something that draw lines with mouse on top of everything (in 2D), but the color of the line is always purple even though I assign a material to the line renderer. I could change the color by using shader, but after that the line doesn't appear on the screen anymore.

DrawLine.cs

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

public class DrawLine : MonoBehaviour
{
    private bool isMousePressed;
    private List<Vector3> pointsList;
    private Vector3 mousePos;
    private GameObject lineDrawPrefab;
    private LineRenderer lineRenderer;
    public GameObject lineDrawPrefabs;

    struct myLine
    {
        public Vector3 StartPoint;
        public Vector3 EndPoint;
    };

    void Awake()
    {
        isMousePressed = false;
        pointsList = new List<Vector3>();
    }

    void Update ()
    {
        if(Input.GetMouseButtonDown(0))
        {
            isMousePressed = true;
            lineDrawPrefab = GameObject.Instantiate(lineDrawPrefabs) as GameObject;
            lineRenderer = lineDrawPrefab.GetComponent<LineRenderer>();
        }
        else if(Input.GetMouseButtonUp(0))
        {
            isMousePressed = false;
            pointsList.Clear();
        }
        if(isMousePressed)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z=-5;
            if (!pointsList.Contains (mousePos))
            {
                pointsList.Add (mousePos);
                lineRenderer.SetVertexCount (pointsList.Count);
                lineRenderer.SetPosition (pointsList.Count - 1, (Vector3)pointsList [pointsList.Count - 1]);
            }
        }
    }

    private bool checkPoints (Vector3 pointA, Vector3 pointB)
    {
        return (pointA.x == pointB.x && pointA.y == pointB.y);
    }
}

LineMaterial.cs

using UnityEngine;
using System.Collections;

public class LineMaterial : MonoBehaviour {

    private LineRenderer line;

    void Awake()
    {
        line = gameObject.GetComponent<LineRenderer>();
        //line.material =  new Material(Shader.Find("Particles/Additive"));
        //line.SetColors(Color.green, Color.green);
        line.SetWidth(0.15f,0.15f);
        line.useWorldSpace = true;
    }
}

sentences:
How to wrap a components position using angles (i.e horizontal compass) I'm trying to make a horizontal compass.  The compass is made up of UI components: panel (with mask), with a child UI Image (the compass image).

Here is the compass from Fallout:

As you turn around, so does the compass.  I want to move the child based on the rotation of the player.  I want to move the child by using transform.position so that any child components will also move (i.e way points).

I found some code on the Unity forum.  I got it to kinda work, however when it wraps around, it doesn't wrap to the correct position.  See GIF.  When I approach the South rotation, it wraps but not to the correct position.  The compass image and code can be found here.

I've made sure that the image is native size, and also tried various values in the "numberOfPixelsNorthToNorth" property.

using UnityEngine;
using UnityEngine.UI;

using System.Collections;

public class CompassHandler : MonoBehaviour {
    public float numberOfPixelsNorthToNorth;
    public GameObject target;
    Vector3 startPosition;
    float rationAngleToPixel;

    void Start(){
        startPosition = transform.position;
        rationAngleToPixel = numberOfPixelsNorthToNorth / 360f;
    }

    void Update (){
        Vector3 perp = Vector3.Cross(Vector3.forward, target.transform.forward);
        float dir = Vector3.Dot(perp, Vector3.up);
        transform.position = startPosition + (new Vector3(Vector3.Angle(target.transform.forward, Vector3.forward) * Mathf.Sign(dir) * rationAngleToPixel, 0, 0));
    }
}

I don't really understand how the code works in the Update method, as my Math knowledge is pretty poor.  I looked up the methods used, but still was clueless.  So I can't work out how to solve it.

I would like to understand what is going on in the Update, but if that is too much, can anyone help fix the issue that is seen in the GIF?

Edit:  Here is a GIF using the accepted solution.

sentences:
Simplify navmesh path I'm trying to implement pathfinding in my game, I'm using navmesh with triangles.

I'm able to find a path but I want to simplify the path. This is what I have right now :

Green quad is start position and blue quad is the destination, the path taken by my character is in white.

Wireframe :

Node 1 and Node 2 are in differents triangles, I want to delete Node2 and go from Node1 to final destination.

How can I simplify this path ?

sentences:
How can I spawn multiple monsters in my game? I made a little iPhone game in which I want to make multiple monsters spawn.

I have one UIImageView called enemy that spawns at beginning of the game. But I want it to spawn many more monsters until I say it needs to stop spawning them.

I know how to get random locations. This question is a follow up to this one.

sentences:
What common interface would be appropriate for these game object classes? Question

A component based system's goal is to solve the problems that derives from inheritance: for example the fact that some parts of the code (that are called components) are reused by very different classes that, hypothetically, would lie in a very different branch of the inheritance tree.

That's a very nice concept, but I've found out that CBS is often hard to accomplish without using ugly hacks. Implementations of this system are often far from clean. But I don't want to discuss this any further.

My question is: how can I solve the same problems a CBS try to solve with a very clean interface? (possibly with examples, there are a lot of abstract talks about the "perfect" design already).

Context

Here's an example I was going for before realizing I was just reinventing inheritance again:

class Human {
public:
    Position position;
    Movement movement;
    Sprite   sprite;
    // other human specific components
};

class Zombie {
    Position position;
    Movement movement;
    Sprite   sprite;
    // other zombie specific components
};

After writing that I realized I needed an interface, otherwise I would have needed N containers for N different types of objects (or to use boost::variant to gather them all together). So I've thought of polymorphism (move what systems do in a CBS design into class specific functions):

class Entity {
public:
    virtual void on_event(Event) {} // not pure virtual on purpose
    virtual void on_update(World) {}
    virtual void on_draw(Window) {}
};

class Human : public Entity {
private:
    Position position;
    Movement movement;
    Sprite   sprite;
public:
    virtual void on_event(Event) { ... }
    virtual void on_update(World) { ... }
    virtual void on_draw(Window) { ... }
};

class Zombie : public Entity {
private:
    Position position;
    Movement movement;
    Sprite   sprite;
public:
    virtual void on_event(Event) { ... }
    virtual void on_update(World) { ... }
    virtual void on_draw(Window) { ... }
};

Which was nice, except for the fact that now the outside world would not even be able to know where a Human is positioned (it does not have access to its position member). That would be useful to track the player position for collision detection or if on_update the Zombie would want to track down its nearest human to move towards him.

So I added const Position& get_position() const; to both the Zombie and Human classes. And then I realized that both functionality were shared, so it should have gone to the common base class: Entity. Do you notice anything? Yes, with that methodology I would have a god Entity class full of common functionality (which is the thing I was trying to avoid in the first place).

Meaning of "hacks" in the implementation I'm referring to

I'm talking about the implementations that defines Entities as simple IDs to which components are dynamically attached. Their implementation can vary from C-stylish:

int last_id;
Position* positions[MAX_ENTITIES];
Movement* movements[MAX_ENTITIES];

Where positions[i], movements[i], component[i], ... make up the entity. Or to more C++-style:

int last_id;
std::map<int, Position> positions;
std::map<int, Movement> movements;

From which systems can detect if an entity/id can have attached components.

sentences:
OpenGL ES indices optimization I am using OpenGL ES 1.x/2.x

I have 2 attributes to be passed to the GPU(one is colors, one is vertices, one color per vertex).

I use indices. Both attributes will use the same indices array

This is not a big issue but I was wondering if there is a way to tell the GPU that both attributes use the same indices array so that it is not transfered to the gpu twice, or maybe it does not matter because the GPU uses the RAM?

sentences:
How to use Facebook Web Hosting for my Unity Game for both WebGL and GameRoom As can be seen from the
Facebook's official Docs

It says that

  To have both a Gameroom and a Facebook Web Game, you should leave your Facebook Web Games URL (https) unchanged. For example, https://friendsmashsample.herokuapp.com/

and also

  Otherwise, if you only have a Gameroom title, you should enter https://localhost/ as shown here:

I wanted to know if there is a way to get both of them working instead of hosting WebGL game on my server and putting it's URL?

I have even tried to enable the Simple Web Hosting but the toggle just reverts Back to off upon saving.

sentences: Is there any performance benefit to sharing shaders between programs? OpenGL allows you to share the same shader between multiple programs. Aside from saving small amounts of memory and a shader handle, are there any GPU-side performance benefits to doing this?

sentences:
Is XNA for iOS overkill? I'm working on iPAD game using MonoTouch which is similar to an IQ testing game. At the moment, I can write some simple games using basic UIImages and animations.

I'm wondering if I should learn XNA to create a game where people can throw a ball against a wall and see it bounce.

Has anyone seen any good examples of tutorials using XNA for simple 2d games?

sentences:
Custom Physics: Preventing objects from losing velocity in certain situation Illustration:
http://s22.postimg.org/7agd30vap/Untitled.png

So the little box is my character. The red arrow shows the current velocity(Some force to right + gravity).
Below it are 2 blocks which has the same height. The problem is that my algorithm would false solve the collision normals.(You can see them in green).
These would mean that my character would not slide, but will stop in one place.

I'm following this tutorial: http://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-the-basics-and-impulse-resolution--gamedev-6331

Is there something I miss and how can I fix this problem?

sentences:
Double sides face with two normals I think this isn't possible, but I just want to check this:

Is it possible to create a face in opengl that has two normals?

So: I want the inside and outside of some cilinder to be drawn, but I want the lights to do as expected and not calculate it for the normal given. I was trying to do this with backface culling off, so I would have both faces, but the light was wrongly calculated of course. Is this possible, or do I have to draw an inside and an outside? So draw twice?

sentences:
Problem with SAT collision detection overlap checking code I'm trying to implement a script that detects whether two rotated rectangles collide for my game, using SAT (Separating Axis Theorem). I used the method explained in the following article for my implementation in Google Dart.

2D Rotated Rectangle Collision

I tried to implement this code into my game. Basically from what I understood was that I have two rectangles, these two rectangles can produce four axis (two per rectangle) by subtracting adjacent corner coordinates.

Then all the corners from both rectangles need to be projected onto each axis, then multiplying the coordinates of the projection by the axis coordinates (point.x*axis.x+point.y*axis.y) to make a scalar value and checking whether the range of both the rectangle's projections overlap. When all the axis have overlapping projections, there's a collision.

First of all, I'm wondering whether my comprehension about this algorithm is correct. If so I'd like to get some pointers in where my implementation (written in Dart, which is very readable for people comfortable with C-syntax) goes wrong.

Thanks!

EDIT:
The question has been solved. For those interested in the working implementation: Click here

sentences:
More natural camera movement I have a camera that currently smoothly (ease in and out) linearly interpolates between two positions. The camera also moves in response to user input.
While this movement is nice and smooth it does not feel natural. My goal is to add some sort of feeling of inertia or natural movement or hand-heldedness to it.
Therefore I have been trying to generate a formula that simulates more natural camera movement on top of the interpolation and user control. Thus far I have not had success.
In one try I pretended that the camera had a stick going out of it and that at the end a ball was attached to a spring attached so said stick. This ball was then focused on adding some direction animation to the system... however I could never get this right. The camera would be shaky/oscillating and user movements looked really awful.
I also tried having the direction point towards a slower animated pole.
No such luck.
Why do these methods of generating a more natural 3D camera movements not work? What is usually used to make this work.

sentences: Socket.io emit textfield Hello everyone I learned how to emit from socket.io website guides but I was wondering how does the chat example receive its input? For example in my cocos2dx app how do I pass a text field over to the socket.io chat?

sentences:
Creating fake 3D character for 2D isometric game. Characters in my 2D isometric game are composed of several sprites corresponding to particular body parts (head, torso, upper arm, lower arm, etc.) which let me extensively customize my characters in-game and do skeletal animations.

I would like to avoid creating animations in all eight directions and since I cannot use 3D models - there are many reasons for that and please do not suggest using 3D - I'm looking for a way to fake 3D so the character could be freely rotated in all directions, but use only one animation.

I imagine that this fake 3D could be achieved by an algorithm which would change body parts locations (x, y), their scale (xscale, yscale) and drawing order. How would I go about it?

Should I add to every sprite a fake z variable? What then? Are there any known examples of something similar?

Throw me some ideas

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:
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:
How can I communicate between libGDXand the Android Studio Java files? The reason I'm asking is because I wanted to create a game and I know I could use Scene2D to create the UI but as far as menus go I wanted to use the tools in android studio to at least create a menu that would lead to the game screen.

They say you should try to do everything in libgdx but how would I go on about trying to accomplish this task?

sentences:
Limit position rigidbody How can I limit the position of a rigidbody, between two values if I use this code:

public Vector3 dir;

Rigidbody rb;

void Awake()
{
    rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
    rb.velocity = new Vector3(0f, 0f, 6f);

    rb.AddForce(dir * 1f, ForceMode.VelocityChange);
}

If I use Vector3.Clamp then the object will shake

sentences:
MySql Database design for Facebook game I'm at the planning stages for a facebook game, it will be similar to farmville, but will feature parks. I've been a Flash game dev for many years but all this database stuff is new to me so I'm having trouble getting my head around what's the best way to handle the data.

I know I need a table for the players, so that's straightforward.

Each player can grow crops/flowers and/or harvest trees etc that are already in the parks. The way I'm setting it up is that the parks are made up of 2 layers, or 2 2D arrays, the bottom array or ground tile array is just big tiles, and in a 8x8 grid, so that seems pretty straightforward as well, just store 16 entries for each part in a "parks ground tile table", but first question about that. Those 16 entries would correspond to each park, so would I still use the auto increment on the ID, or some other kind of ID to represent them as a group somehow? I'm just thinking of what's the fastest way to grab those 16 from the database.

Next onto the trickier stuff which is the 2nd layer of the park or the items/objects/crops 2d array. Each player has to have their own version of this 2D array, so first qusetion is how do I set that up in the database? I was thinking maybe having a "park items array" and then each feature (tree, crop) etc for each player would just be stored in that array, but I can see that getting huge really quick, so not sure how to do that? or if the size of that would be an issue?

Then on top of that, each player can maintain multiple parks :p...again what would be the best database design to maintain all of those?

Thanks for any help!

sentences:
What are some known 2D/3D physics engines for XNA? I'm looking for a physics engine to use in an XNA project (2D or 3D). Because it's for XNA, it needs to fulfill some requirements:

Not necessarily free, but close to it is obviously preferred
Managed code only (or it won't run on the 360)

For 3D I know of
- BulletX (It works, and I'm using it now, but it's not active and could use more work)

For 2D I know of
- Farseer

sentences:
How to texture procedurally generated custom terrain mesh I am making an infinite procedural terrain for my game and currently trying to apply textures to it.
The generated terrain has different biomes, so I want to texturize the terrain based on biome and have different textures applied based on the steepness and height of the terrain. I also have different areas generated, such as settlements and also roads so I want to apply specific textures to specific places like those as well.
Unity terrain only supports I think 8 layers, but generally, it should be around 4 for 4 channels? In my case I generate a custom mesh, so I don't really need to worry about this, however, I am trying to figure out how to generate some sort of texture map (splatmap), and have lots of textures in it. I want to use (albedo, normal, height) for each 'layer'. Considering that the biomes are generated based on the noise map and each chunk can have many different biomes in it, I need to have more than 4 layers available. For example, steep areas like cliffs will need to have a rocky texture applied and each biome will have a different rocky texture. So if a chunk has two biomes in it, there are lots of different textures that need to be used, including various misc textures for paths and settlement grounds, etc.
Something like this, where a single chunk mesh has for example two biomes. Also, the terrain has a settlement that has a dirt texture applied to the terrain, which extends to both biomes. So essentially, lots of textures in just one mesh.

The other chunk(s) can have similar biomes or even completely other types of biomes. Also, would like to perhaps add the ability to apply different textures to a specific position on terrain chunk at runtime, for example, if the player would want to create a path or if a specific object is placed that would spread some specific texture around the object on the terrain. Something like this for example, where a placed tree has spread some leaf ground texture around:

So, I am looking for a flexible way in applying various different textures to generated terrain mesh. I would like to do that in the script when I am generating a chunk, so I would know which biomes is it at the position and as well as things like steepness and etc.
I am using Shader Graph to create the terrain shader. I'm not really experienced with shaders, so would like to ask for some help on what would be the correct way to achieve something like this?

sentences:
Why doesn't it seem to be any development in the field of 3D VR gear, especially with regard to gaming? I remember that way back around 1995, there was this big craze with VR in the media, a whole bunch of (mostly mediocre) games labeled as "virtual-reality-interactive-movie (...)" were published. If I recall correctly, the first 3D VR helmet was called VFX-1 and was sold bundled with Descent and some dedicated joystick. I never owned one, and I read just one review which was mostly enthusiastic, but pointed to some weak points, like the eyes getting tired after an hour or so of playing. Then the whole thing basically flickered down and died.

I suppose the main reason it wasn't successful was that the hardware of the day was not powerful enough, the VR gear's design wasn't perfected to make it comfortable and natural to use, and the companies that made it failed to market it successfully. What I can't understand is why isn't there any development in the field today. There is some vr-ish hardware mostly targeted at the consoles (Kinect, Wii remote, TrackIR), but all projects of creating some 3d head-mounted display system seem to be in early infancy, appear once in a trade show somewhere and aren't heard of again.

I think it could work great with head tracking and some of today's shooters, flight sims (trackIR is nice but the movement scale translation is awkward) and other games with an FPP POV. Is there any technological reason why decent vr headgear can't be made today, or is it just that nobody really cares/everyone is scared to repeat the '90s failure?

sentences:
XNA - Static classes from game libraries executing after content pipeline extensions, how to avoid the problem? Alright, formulated this way I'm sure it sounds obscure, but I'll do my best to describe my problem.

First, let me explain what's wrong with my real source code.

I'm making a platformer, and here are the current components of my game: a Level, which is holding its own grid of tiles and also the tile sheets and a Tile, which just keeps the name of its tile sheet and index within the tile sheet. All these are within a separate XNA game project, named GameLib.

Here is how my levels are formatted in a text file:

x x . . . . .

. . . b g r .

. . . . . . .

X X X X X X X

Where . represents an empty tile, b represents a blue platform, X represents a block with a random color, etc.

Instead of doing all the work of loading a level within the Level class, I decided to take advantage of the content pipeline extension and create a LevelContentPipelineExtension.

As soon as I started, I quickly realized that I didn't want to hard-code 20+ lines of the kind:

if (symbol == 'b')
    return new Tile(/*...*/);

So, in the hope of at least centralizing all the content creation into one class, I made a static class, called LevelContentCreation, which holds the information about which symbol creates what and all this kind of stuff. It also holds a list of all the asset paths of the tile sheets, to load them later on. This class is within my GameLib game library project.

The problem is, I'm using this LevelContentCreation static class in both my Level class (to load the actual tile sheets) and my content pipeline extension (to know which symbol represents what tile)...

And here's how my LevelContentCreation class looks like:

public static class LevelContentCreation
{
    private static Dictionary<char, TileCreationInfo> AvailableTiles =
        CreateAvailableTiles();

    private static List<string> AvailableTileSheets { get; set; }

    /* ... rest of the class */
}

Now, since the LevelContentCreation class is part of the game library, the content pipeline extension tries to use it but the call to CreateAvailableTiles() never happens and I'm unable to load a Level object from the content pipeline.

I know this is because the content pipeline executes before the actual compilation or something like that, but how can I fix the problem?

I can't really move the LevelContentCreation class to the pipeline extension, because then the Level class wouldn't be able to use it... I'm pretty lost and I don't know what to do... I know these are pretty bad design decisions, and I'd like it if somebody could point me in the right direction.

Thank you for your precious time.

If anything is not clear enough or if I should provide more information/code, please leave a comment below.

A little more information about my projects:

Game - XNA Windows game project. Contains references to: Engine, GameLib and GameContent
GameLib - XNA game library project. Contains references to: Engine
GameContent - XNA content project. Contains references to: LevelContentPipelineExtension
Engine - XNA game library project. No references.
LevelContentPipelineExtension - XNA content pipeline extension. Contains references to: Engine and GameLib

I know close to nothing about XNA 4.0 and I'm a little bit lost about how content works now. If you need more information, tell me.

sentences:
Doing powerups in a component-based system I'm just starting really getting my head around component based design.  I don't know what the "right" way to do this is.
Here's the scenario.  The player can equip a shield.  The the shield is drawn as bubble around the player, it has a separate collision shape, and reduces the damage the player receives from area effects.
How is such a shield architected in a component based game?
Where I get confused is that the shield obviously has three components associated with it.

Damage reduction / filtering
A sprite
A collider.

To make it worse different shield variations could have even more behaviors, all of which could be components:

boost player maximum health
health regen
projectile deflection
etc

Am I overthinking this?  Should the shield just be a super component?
I really think this is wrong answer.  So if you think this is the way to go please explain.

Should the shield be its own entity that tracks the location of the player?
That might make it hard to implement the damage filtering.  It also kinda blurs the lines between attached components and entities.

Should the shield be a component that houses other components?
I've never seen or heard of anything like this, but maybe it's common and I'm just not deep enough yet.

Should the shield just be a set of components that get added to the player?
Possibly with an extra component to manage the others, e.g. so they can all be removed as a group.  (accidentally leave behind the damage reduction component, now that would be fun).

Something else that's obvious to someone with more component experience?

sentences: JigLibX collision detection only once I'm trying to implement collision detection using the latest JiglibX. I am working off of this example. I chose creating a callback. I'm trying to detect a collision only once. When the object falls through, the callback is invoked multiple times, not only once. Is there any way how to ignore other calls? Thanks for advice.

sentences:
What common spritesheet formats for 2D Top-Downish Games are there? For 2D top-down style sprites, what commonly used spritesheet formats are available?

By a sprite sheet format, I mean this: for any RPG Maker sprite sheet, you can count on all the walk animations being in the same place on the image between characters. For Final Fantasy 6's characters, you could open all their sprite sheets and compare them and in each one, the walk animations, crouching sprites, surprised sprites, etc would all be in the same places. They all adhere to a standard.

I'm using RPG Maker XP right now and it defines character tilesets as having four states -- facing up, down, left, and right, each with animation. This is really restrictive, and I'd rather have more options like Final Fantasy 6.

So are there any more common sprite sheet formats out there that I can use?

sentences: How can I generate a terrain heightmap from the perlin algorithm? How can I generate a terrain heightmap from the perlin algorithm? I am trying to make a terrain generator (like World Machine). This is the source code I have for the perlin. The only thing that I can't figure out is how to use the perlin algorithm to generate a heightmap image.

sentences:
Pathfinding Search for Path of Specific Length I am creating a roguelike.  This question applies to random map generation.

First, I generate areas using a BSP algorithm, where I randomly divide the map into areas.
Then, I generate a graph of the areas so that I can use search algorithms to generate paths through the map.
It is easy to find the shortest path between two areas, but I would like to find a path with a specific number of steps(or path cost).

So, my question is:  What is an algorithm that I can use to find a path that has a specific cost or cost range?

An Example of why I think this is useful:
Say that I randomly choose two areas(start and end for example).  These area might be next to each other, they might be on the opposite sides of the map.  I want to force the player to travel through a minimum number of areas before reaching the end, let's say 5.  I should be able to be like:

path = startArea.findPathMinimumCost(endArea,5);

And it will return a path of cost 5, or the shortest path, whichever has the greater cost.

Thank you.

sentences: Need help implementing shadows on platform with limited feature set I am writing a game that very much relies on real-time shadowing and would like to implement shadow volumes. I was thinking of doing shadow mapping, but the platform I am using is Molehill/Stage3D and it's limited to 8 bits per channel, BGRA textures, and shaders can only read from textures, not depth buffers. I have never done stencil shadows before, but would it be possible to generate a shadow volume entirely on the GPU without the use of Geometry shaders, and only vertex shaders?

sentences:
Algorithm for waypoint path following? I have a worldmap, with different cities on it. The player can choose a city from a menu, or click on an available cities on the world map, and the toon should walk over there.

I want him to follow a predefined path.

Lets say our hero is on the city 1. He clicks on city 4. I want him to follow the path to city 2 and from there to city 4.

I was handling this easily with arrow movement (left right top bottom) since its a single check.

Now I'm not sure how I should do this. Should I loop threw each possible path and check which one leads me to D the fastest ... and if I do how do I avoid running in circle forever with cities 1-5-2  ?

sentences:
Love2D: Calling two files Okay so i have two files one named Player.lua and one named Main.lua

Main:

function love.load()
end

function love.update()
end

function love.draw()
end

Player:

function player.load()
end

function player.update()
end

function player.draw()
    love.graphics.setColor(255, 0, 0)
    love.graphics.rectangle("fill", 50, 50, 50, 50)
end

Output is just a black screen!

sentences:
Performance of many canvas drawImage calls is very slow I'm developing a top-down 2D tile-based canvas game. I have a single sprite sheet of all my tiles, and then a JSON tile map array of where they're placed.
Previously I would render all the layers of tiles out to a single canvas element once, and then re-render that every frame. This would give me 300+ FPS because it would just be a single draw call each frame to redraw this canvas.
However, the issue with this is that the map is not just a "flat" image. Sometimes tiles need to be destroyed, or sometimes the player needs to stand behind certain tiles (such as when the player is above them), which doesn't seem possible if the map is just a static image.
As a result, I believe I instead need to re-render all the tiles every frame. However, even if I only re-render the tiles that the user can see, the FPS drops tremendously. With just two tile layers and a 100x100 map, the FPS drops to 20.
I would have assumed that, despite there being 100 * 100 * 2 canvas.context.drawImage calls per frame, that it would still be fine, because it was leveraging the GPU, and I'm using a single sprite sheet, so there should be no texture swapping. Apparently this is not the case.
I was looking for a way to possibly speed this up, but the recommendations seem to be extremely heavy-handed and opinionated libraries like three.js and pixi.js. These libraries would be great, except they do too much. In PIXI and Three.js you need to add objects to a scene and they're automatically redrawn each frame. This is not what I need, as my current ECS architecture demands an immediate-mode renderer, and I have my own scene graph already, so I can't (and don't want to) use theirs.
Is there a solution here? The only thing I really need to do is draw images clipped from a spritesheet quickly. Can this be done using immediate-mode rendering? Or is it doomed to be 20 FPS?

sentences:
Large Sprite Performance I've got a large Sprite generated using a set of vertices(x,y coordinates) and a bitmap pattern (using moveTo, lineTo, beginBitmapFill, endFill ...etc). It's about 15000 pixels wide and between 1500 - 2000 pixels high depending on the level -it's the terrain for a 2D game.

My question is: what is the best way to display/move it on the stage - performance wise?

Currently I'm just adding it to the stage as is...I get decent frame rate/ memory/ cpu usage but I want to optimize it for slower PCs.
Any ideas? I've been reading a little about blitting but I'm not sure how to implement it in my case.

Thanks.

sentences:
When prototyping, how can I more easily explore game behaviour? I build indie games myself, but I'm usually out of energy once I've taken a newly developed game to a level where it's possible to play with behavior, so I settle for refinement instead of exploration. With awful results.

(picture from the Intercom blog)

For example, I find that the iteration cycles for tweaking behavior (i.e. linking and restarting a C++ application) are so long that they kill all creativity. I'm building a tool to deal with this.

What other ways exist to quickly explore game behavior? I'm interested in the methodologies used by indie developers as well as larger companies.

sentences:
Overlaying grid for pathfinding My game is not grid-based, so units can be at any arbitrary coordinate and move at different speeds. My obstacles are all rectangular and axis-aligned, so naturally it makes sense for me to overlay a grid over the map for pathfinding. Each unit will take up a grid cell (floor(unit.x / CELL_SIZE), floor(unit.y / CELL_SIZE)). I will then run standard A* grid-based pathfinding on the grid.
The problem is that although the path is grid-aligned, the unit movement is not. Thus, in the midst of moving, the unit might end up colliding with a cell that is blocked, and get stucked. Here's a picture to illustrate:

I'm trying to get from point A to point B. B is the center of the grid cell, since it is a waypoint from the found path. A is the point the unit is currently at. The pathfinder thinks A to B is valid movement, since it takes the grid cell of A as the start point and the diagonal neighbour B is not blocked. But moving from A to B might result in position C, which is blocked.
I thought of using a soft collision radius for pathfinding, but it has its problems. The pathfinder will not return any paths where there's a soft collision. So if the current location of the unit already has a soft collision, the unit cannot move! It seems that it is necessary to keep the pathfinding collision and physics collision identical...
How do I resolve this problem, and what is the standard way to overlay a grid for pathfinding?

sentences:
Shader authoring/editing tools for GLSL ES Since Render Monkey has been discontinued (perhaps due to the complexity of today's shading languages), there are few successors that can match its functionality. Is there any useful tool for material editing aimed at developers and artists alike, but concentrated (or with substantial support for) on embedded GLSL shaders?

Render Monkey itself wasn't that flexible (I'm not aware if it allowed the usage of several textures, each with its own set of texture coordinates - plus, it didn't seem to be that intuitive either).  Apart from complete engines, is there such a stand-alone tool that can be used together with a stand-alone engine (able to interface with a custom application)?

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:
Portrait and Landscape Design I have a turn-based game that is built with HTML 5 gaming framework and runs completely fine in Landscape mode. What I am trying to figure out is how to make the game run fine in both portrait and landscape mode such that even when the game is running and player rotates the screen to landscape the game runs perfectly or the game transition between landscape and portrait mode smoothly.

I can capture the orientation change event which is fired, my question is how should I design the game for both orientations.

Currently, I am trying to create a common file which then calls my separate orientation layouts created for the game but is this the right way?
Thanks

sentences:
Avoiding impossible states in an adventure game I'm looking at creating a fairly complex choose-your-own adventure style of game, but I'm looking for a technique or method to help with the game design.

It will be a multi-branching story, and at times the branches will fold back in on themselves, and your major actions will be remembered and items will be collected.  For example, if the player goes to the swamp and the forest before going to the castle he has picked up a dinosaur bone, killed a unicorn and grown an extra arm.  If a player gets to the castle via the caves and the crypt he has picked up a bicycle and a strange smell.
Now when developing puzzles for the castle I don't want to create a situation where two impossibilities are requires, for example - an extra arm and the smell are needed to kill an ogre.

Other than documenting the events and items very very carefully is there a process, a technique I can use in a spreadsheet or a piece of software that can help me?

sentences:
how to check mouse is not over any object in unity Im working on a way to check mouse is not over any object on scene to put my object in there. i know i can use OnMouseOver function but i have to add it on all objects script. Is there any other way to check my mouse position is not on any object collider?
Its a 2d project.
thank you for helping

sentences:
Can't seem to get Sprite to face left in sfml c++ I am having some small issues getting my sprite character to flip around. Basically I have a character that can walk to the right.. I am looking to flip it so that it looks like it is walking left.  I haven't found a working solution at the moment so any help would be amazaing!

I am using:

SFML 2.1
C++

I have tried:

  guy.setTextureRect(sf::IntRect(guy.getGlobalBounds().width, 0, guy.getGlobalBounds.width * -1, guy.getGlobalBounds.height));

sentences:
Multi-platform multi-threading: What are the real challenges? While a library like SDL provides a cross-platform wrapper API for threading, I think it would be naive to assume that this leads directly to easy development of games across vastly different platforms (desktop / mobile).

What is the best way to tackle developing in this way (given any cross-platform threading API) considering the following:

different numbers of cores
vastly different processing capabilities per core
A generally different systems architecture with eg. different latencies for cache, RAM , and I/O access

I get the feeling that the only way to do this is evaluate how many threads may be run per each device you intend to support, and find out what the lowest common denominator is. However, this still leaves me in the dark as to the total amount of processing throughput available. Am I right in assuming the only way to do this effectively is to actively develop for the lowest spec mobile device I intend to support, throughout development? -- i.e. the lowest common denominator? Should this roughly be sufficient? Or is there more to it than this?

EDIT: Please could others offer further experience on this as I don't feel my question has been answered fully yet.

sentences:
Collisions on complex map 2D I'm currently thinking about collision and map system that I want to use in my next game and I'm kind of puzzled. Maps are going to be somewhat complex with lots of irregularities and thus tiling is out of question.

I thought about an editor where you'd draw rectangles on the map that would represent areas that are collidable with and then saving such "collision map" with only black/white gfx. Or maybe should I save exact rectangles data with their x/y/width/height into some text file and go from there?

What would you recommend? Thanks.

sentences:
Optimize DOM game performance I am working on a game developed on DOM using Crafty JS framework, and Greensock GSAP JS (http://www.greensock.com/gsap-js/) for animations. It is my first time working with these technologies.

I have a problem with FPS going down to 15 and less while animations are performed on bigger DOM elements. After investigating the issue with Chrome Developer Tools Timeline I discovered that 80% of bottleneck events time are:

Image Resize(non-cached)

I assume it is caused by the fact that I am using

CSS Transform scale()

for the game to adjust to browser size. Performance is acceptable once the scaling is disabled.

Is there any way to cache the resized images in browser to improve performance? The game will only be used on a local computer.

Any help and advice will be greatly appreciated.

sentences:
Trigger scene loading in one device from another device using Unity WWW class I have a master device and client device. I want to load a scene in the client device by pressing a button in the master. My method is, when the button is pressed in the master device, a data is stored in a server using the WWW class and in the client device it is checked whether the data is there, through a coroutine.

But, in the client device, the coroutine is not waiting for the trigger from the master. Instead it continues the execution. Because in the yield return statement, it says downloading is complete. Can I make it to wait for a trigger from the server?

sentences:
How do I click on specific text in an array of text? I am trying to click on a specific word in an array but I can't think of how.
This is what I have:
  for x in range(0, len(names)):
    templine = font.render(names[x], True, WHITE)
    tempRect = templine.get_rect()
    tempRect.midleft = (50, (170+30*x))
    if mouse012[0] == True and tempRect.collidepoint(mouseXY):
      state = AppState.STATS

      detailsName = names[x]
    screen.blit(templine, tempRect)

sentences:
How can I find a good fixed ratio between buying and selling prices for the player in an in-game market? I'm developing a single player game containing gathering and crafting where I'm still struggling to find base values for the prices of gathered resources and crafted items. (But this is part of Constructing a game stock market)
Since it's a single player game and just one in-game market that offers items, I do not want to use dynamic pricing, I'm looking for a reasonable ratio between the buying and selling price. I was not able to find any hints on how to determine a good starting point.
Is for example 2:1 a reasonable ratio between the buying and the selling price for the player?
Things to consider:

Of course the buying price has to be higher than the selling price or otherwise players could just make fortune by buying and selling the same item.
Only some randomly chosen items will be available to buy in a certain time period and rarer items will be seen less often in the shop to buy.
The offer should be reasonable enough to tempt the player to buy the item instead of farming the ingredients and craft the item for themselves.

Updated the question to fit the constraints.

sentences:
Connecting players in an Online TCG I've been developing single player games for a while now and I have decided to start working on a online PC(and maybe mobile) TCG. The design is almost complete and I can cover most of the code as far as single player goes.

My question is:

Do I have to implement some sort of server-client model in order to make it possible for two player to get in a match together?

sentences:
Matrix rotation of a rectangle to "face" a given point in 2d Suppose you have a rectangle centered at point (0, 0) and now I want to rotate it such that it is facing the point (100, 100), how would I do this purely with matrix math?

To give some more specifics I am using javascript and canvas and I may have something like this:

var position = {x : 0, y: 0 };
var destination = { x : 100, y: 100 };
var transform = Matrix.identity();

this.update = function(state) {

  // update transform to rotate to face destination

};

this.draw = function(ctx) {
  ctx.save();
  ctx.transform(transform); // a helper that just calls setTransform()
  ctx.beginPath();
  ctx.rect(-5, -5, 10, 10);
  ctx.fillStyle = 'Blue';
  ctx.fill();
  ctx.lineWidth = 2;
  ctx.stroke();
  ctx.restore();
}

Feel free to assume any matrix function you need is available.

sentences:
How to add a collision function to a game Ive tried a few things but i cant get a working function  if player collides with object set speed to 0( stop moving)

ive tried to use the function under  "game over " and change the things to make speedx=0 and speedy=0 but i couldnt format it correctly.

https://www.w3schools.com/graphics/game_obstacles.asp

my  code:

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

use the arrow keys on you keyboard to move the red square.

https://jsfiddle.net/tmanrocks999/e6w9br2s/178/

I expect when the player hits the obstacle for them to stop moving. but at the moment they go through it/ i have 1 && that prevents it from going past the x location of obstacle but that doesn't work right

sentences:
Unity shader set to GameObject position I have a shader with acts like a magnifying glass that I downloaded and I have to attach to the camera scene.

My issue with this I want it in the same fixed position as the sprite but being attached to the camera when I changed the screen size for different devices it wonders to the upper right of the screen.

I am completely new to shaders so I and their scripts so I am not sure if this can be done.

private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
    if (mtrl == null || mtrl.shader == null || !mtrl.shader.isSupported)
    {
        enabled = false;
        return;
    }

    if(Input.GetMouseButton(0) || !detectMouseButtonDown)
    {
        mtrl.SetFloat("_Radius", radius);
        mtrl.SetVector("_Mouse", new Vector4(740, 480, 0));
        mtrl.SetFloat("_Distortion", distortion);
        mtrl.SetFloat("_ScaleArea", scaleArea);
        if(isMagnifyingGlass)
        {
            mtrl.EnableKeyword("IS_MAGNIFYING_GLASS");
        }
        else
        {
            mtrl.DisableKeyword("IS_MAGNIFYING_GLASS");
        }
        if(warpType == WarpType.POW)
        {
            mtrl.EnableKeyword("WARP_TYPE_POW");
            mtrl.DisableKeyword("WARP_TYPE_EXP2");
        }
        else
        {
            mtrl.DisableKeyword("WARP_TYPE_POW");
            mtrl.EnableKeyword("WARP_TYPE_EXP2");
        }
        Graphics.Blit(src, dest, mtrl, 0);
    }
    else
    {
        Graphics.Blit(src, dest);
    }
}

Shader:

Shader "Hidden/MagnifyingGlassFisheyeWarpImageEffect"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma target 3.0
            #pragma multi_compile WARP_TYPE_POW WARP_TYPE_EXP2
            #pragma multi_compile _ IS_MAGNIFYING_GLASS

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float4 pos : SV_POSITION;
                float4 scrPos : TEXCOORD0;
                float2 uv : TEXCOORD1;
            };

            sampler2D _MainTex;
            float4 _MainTex_TexelSize;

            float2 _Mouse;
            float _Radius;
            float _Distortion;
            float _ScaleArea;

            v2f vert (appdata v)
            {
                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                o.scrPos = ComputeScreenPos(o.pos);
                o.uv = v.uv;
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                float4 c = 0;
                float2 uv = i.scrPos.xy/i.scrPos.w;
                float2 mousePos = _Mouse.xy / _ScreenParams.xy;
                float wh = _ScreenParams.y / _ScreenParams.x;
                uv.y *= wh;
                mousePos.y *= wh;
                if(length(uv - mousePos) <= _Radius)
                {
                    uv -= mousePos;
#if defined(IS_MAGNIFYING_GLASS)
                    float newLength = _ScaleArea * _Distortion;//_ScaleArea * pow(length(uv) / _Radius,  _Distortion);
#else
#if defined(WARP_TYPE_POW)
                    float newLength = _ScaleArea * pow(length(uv) / _Radius,  _Distortion);
#endif
#if defined(WARP_TYPE_EXP2)
                    float newLength = _ScaleArea * exp2(length(uv) / _Radius * _Distortion);
#endif
#endif
                    uv *= newLength;
                    uv += mousePos;
                }
                uv.y /= wh;

                c = tex2D(_MainTex, uv);
                return c;
            }

            ENDCG
        }
    }
}

Here is what it looks like over the gold selector. It is in the correct position.

Now if I change the screen size for a different device the magnifying effect has shifted to the right

sentences:
How do I simulate color blindness for accessibility testing? Is there an application I can download (or some configuration of Windows, or something) that will let me see how my game will appear to users with different color-blindnesses?

There are already good questions about how to avoid badly-designing your game for colour blindness. There's also a Photoshop filter from VisCheck is a nice idea, except their image-processing upload service is down.

Is there, therefore, a tool I can use to simulate colour blindness and see how things look? Ideally, I would like to try different types (red/green, blue/yellow, mild/severe).

If not, how do other game developers test/avoid this problem, other than ignoring it, or having access to a color-blind person (which I don't)?

sentences:
How to achieve an aesthetic which looks like hand-made pencil and paper drawings? I am a programmer in the process of making a stick figure game and I draw the figures myself. The thing is that they look like they are made of black pixels, but I want them to look photorealistic as if they were drawn on paper. They are also animated with short 4 frame loops, each frame drawn individually.

I want my game art style to look somewhat like the following drawings,

but imagine this is actually a game where everything is animated. Is this possible with proper art style alone or shading techniques should be involded in the process? If so, can you point me in the right direction?

sentences:
UDK license (DLLBind) I dont understand part of UDK's license about DLLBind:

does it allow to use DLLBind in UDK projects? Could I use DLLBind for commercial games without buying c++/native license?

sentences:
Unity2D: Using UI buttons to move Player I've created a script that allows my player to move using UI button, however my player's movement isn't very smooth or flowing, instead it's very clunky and somewhat looks like my player is teleporting. I tried following tutorials on YouTube, however I was having problem with accessing the 'Unity Standard Assets' as for some reason it wasn't there. I read up for information about people re-importing it into their projects only to have it mess up parts of their games. Overall I was wondering if there any one can help me fix my problem! Thank you :)

My script:

public float moveSpeed;

void Update () {
    if (moveRight == true) { // Here I have tried methods like Addforce and velocity, but for some reason it wasn't working!!
        GetComponent<Rigidbody2D>().AddForce (transform.right * maxSpeed);
    } else if (moveRight == false) {
        GetComponent<Rigidbody2D>().AddForce (transform.right * maxSpeed);
    }
}

public void MoveLeft() {
   transform.position -= transform.forward * Time.deltaTime * moveSpeed;

  // moveRight = false;
}

public void MoveRight() {
   transform.position += transform.forward * Time.deltaTime * moveSpeed;

 // moveRight = true;

}

sentences: Simple Alternate Art Style I'm looking for suggestions on easy or simple art styles that can be created by anyone. It would be for a 2D game, but pixel art isn't really my thing. An example from a game would help. Thank you very  much.

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:
Compile cocos2d-x Windows games without Visual Studio I want to use cocos2d-x to make a Windows game. I used the cocos console:

cocos compile -p WIN32

And apparently it needs Visual Studio.

Is there an alternative to build the Windows game without Visual Studio? Anything more lightweight? I am hesitant to use Visual Studio because I actually work on many different machines and they all have somewhat limited memory.

Any other smaller IDE would do. Or even better, some sort of command line tool.

sentences:
Does Specular Power affect the Brightness? I read the book Real-Time Rendering, 2nd Edition. Somewhere in there it say:

But I did the experiment and concluded that the mshi doesn't seem to affect to the brightness (it causes the area just to be narrower):

The experiment is base on http://www.rastertek.com/dx11tut10.html.
Am I missing something? I didn't find an errata for the book on its corrections Website, and my first-languages isn't English, so maybe my vocabulary understanding is wrong?

Does the Shininess means the Brightness? Or what else?

sentences: How can I make a gameObject jump quick at first then start slowing down after a while? How can I make a gameObject jump quick at first then start slowing down after a while? It definitely has something to do with deltaTime.

sentences:
Gameserver Request handling EDIT: I forgot to mention that in this implementation E stands for Entity which is just an ID, C => Component as data-only types and S for Systems which should implement logic

Currently i'm working on a small hobby project which is a multiplayer card game with a client/server architecture. I'm using a framework for the network part which triggers message events to services objects like this:

class AuthRequestMessage : public fqpnet::IMessage
{
public:
  //methods for serialization

  inline const std::string& getLoginId() const
  { return loginId_; }

  inline const std::string& getPassword() const
  { return loginId_; }

private:
  std::string loginId_;
  std::string password_;
};

//Handles authentication
class GatewayService : public fqpnet::Service
{
public:
  //registers handlers
  GatewayService()

private:
  void onAuthRequestMessage(const AuthRequestMessage* msg, ClientSession* session);
};

and now i'm at the point where i have to create the player entity. My first thought was to create the player entity directly in the message handler. But it feels like this code should be in a system so i created a system and added a method:

class PlayerSystem : public entityx::System<PlayerSystem>
{
public:
//Entity createPlayer(/*info needed...*/);

//update etc
};

But this feels rather bad too as the method is only used once in the handler.
My third attempt was to use the builtin messaging system of the ECS:

struct PlayerAuthRequest
{
//id etc
};

class PlayerSystem : public entityx::System<PlayerSystem>
{
public:
void receive(const PlayerAuthRequest& request);

};

//and now just emit the event in the message handler
void GatewayService::onAuthRequestMessage(const AuthRequestMessage* msg,
ClientSession* session)
{
  //verify, load from db etc.
  eventMgr->emit<PlayerAuthRequest>(/*data*/);
}

Which of these approaches would be the best? Or are there alternative ones? Basicly i just want to do it in the right way to learn. Performance does not really matter to me.

sentences:
Rotate Points with Object in world space I posted this in the original stack overflow then realized that a game-dev specific one exists.

I am working on personal project that requires me to have 4 points surrounding an object (1 at each of its furthest points) that will rotate/move when the object does.

These points are represented as simple coordinates (x,y,z) and rotational values (ry,rx,rz). Some other stuff exists in the class but it shouldn't be to relevant.

My object has coordinates in world space and can freely move around on the X and Z axis. The y value of the object and points are calculated elsewhere, separately using the X and Z values obtained by the points.

So Basically What I am asking is How do I attach my points to the Object and have them rotate when it does, move when it does etc. Keeping in mind I need the points coordinates in world space.

My knowledge of DirectX is a bit sketchy and basic concepts (change of coordinate systems, vector/matrix transformations etc) confuse me sometimes.

Any help is greatly appreciated.

This is the Constructor for the object, it initializes the points to areas around the object.

    Object::Object(ID3D10Device *renderingDevice, float mlength, float mwidth)
{
    pd3dDevice = renderingDevice;
    length = mlength;
    width = mwidth;
    A = new CollisionPoint(width,-length); //Front Left
    B = new CollisionPoint(-width,-length); //Front Right
    C = new CollisionPoint(width,length); //Back left
    D = new CollisionPoint(-width,length); //Back Right

}

This is the code that is meant to move and rotate the points.

 void Object::doBehaviour()
{
    //origin required for rotating of collisionbox
    D3DXVECTOR3 origin = D3DXVECTOR3(x,0,z);
    setUpWorldMatrix();
    moveForward();
    speed *= 0.99;

    //update collisionbox
    A->x = width;
    A->z = -length;
    A->rotateTo(0,ry,0);
    A->doBehaviour1(origin,world);

    B->x = -width;
    B->z = -length;
    B->ry = ry;
    B->doBehaviour1(origin,world);

    C->x = width;
    C->z = length;
    C->ry = ry;
    C->doBehaviour1(origin,world);

    D->x = -width;
    D->z = length;
    D->ry = ry;
    D->doBehaviour1(origin,world);

}

This is the code the collisionPoints use to move and rotate the points, ignore the int wheel bit.

    void CollisionPoint::moveAndRotate(D3DXVECTOR3 origin, int wheel)
{
    //1 = frontleft //2 = frontright //3 = backleft //4 = backright
    float xR = origin.x + cos(ry) * x - sin(ry) * z;
    float zR = origin.z - sin(ry) * x + cos(ry) * z;

    x = xR;
    z = zR;

}

void CollisionPoint::doBehaviour1(D3DXVECTOR3 origin, int wheel)
{
    moveAndRotate(origin, wheel);
    speed *= 0.99;
}

TLDR;

How do I:

Convert coordinates to Object space.
Rotate these coordinates along with an object based on its RY (rotation on the Y axis) value
Obtain their coordinates in world space.

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:
How to know if an actor is touched in libgdx? I am using "Gdx.input.isTouched()" in the render method of my Screen method, to know where is touched, but when the touch is dragged in the screen, it also activates the events i want only when an actor is touched.

Is there any listener to know when an Actor is touched, but the event is not the dragged one, im doing it with sprites.

sentences:
How to set C++ language standard for VS2019 in an Unreal project? I am trying to a simple thing, just like that, in a header file;
#include <filesystem>
#include <iostream>

namespace fs = std::filesystem;

And IntelliSense goes:
namespace std has no member filesystem.
Okay no worries, it's an easy fix.
Just set the C++ language standard in the propery pages...
Well, it turns out it isn't, it's not an option in Unreal VS project. Tried typing in search bar, View -> Property pages, but no luck.
Okay let's try doing the whole thing in a console project first.
Same message from IntelliSense as before.
Ok, no worries, I found this.
I found my settings under: Project > projectname Properties
And voila, the console app works.
Let's try it in the Unreal project.
Well, well... My options are limited here.

I had a look around in the project settings as well:

How do I get this filesystem header work with my project?

sentences:
Mesh to world vector translation Suppose I have a world defined in typical OpenGL coords.. then the up vector defined for this space is (0,1,0).

Now, if I load a model that is defined with (0,0,1) as its up vector, what are the matrix operation(s) that I need to carry out here to arrive at the 4x4 transformation matrix for the model?

Many thanks.

sentences:
Potion effect never wears out I am writing a mod for Minecraft (in Java, duh) and want to apply a random potion effect like this:
    private static Effect[] poss_effects = new Effect[]{
        Effects.SPEED,
        Effects.SLOWNESS,
        Effects.HASTE,
        Effects.MINING_FATIGUE,
        Effects.STRENGTH,
        Effects.INSTANT_HEALTH,
        Effects.INSTANT_DAMAGE,
        Effects.JUMP_BOOST,
        Effects.NAUSEA,
        Effects.REGENERATION,
        Effects.RESISTANCE,
        Effects.FIRE_RESISTANCE,
        Effects.WATER_BREATHING,
        Effects.INVISIBILITY,
        Effects.BLINDNESS,
        Effects.NIGHT_VISION,
        Effects.HUNGER,
        Effects.WEAKNESS,
        Effects.POISON,
        Effects.WITHER,
        Effects.HEALTH_BOOST,
        Effects.ABSORPTION,
        Effects.SATURATION,
        Effects.GLOWING,
        Effects.LEVITATION,
        Effects.LUCK,
        Effects.UNLUCK,
        Effects.SLOW_FALLING,
        Effects.CONDUIT_POWER,
        Effects.DOLPHINS_GRACE,
        Effects.BAD_OMEN,
        Effects.HERO_OF_THE_VILLAGE
    };

    private long prev_milli = System.currentTimeMillis();

    @Override
    public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
        if (System.currentTimeMillis() - this.prev_milli >= 60000) {
            Effect to_apply = poss_effects[(int) (Math.random() * poss_effects.length)];
            int duration = (int) (Math.random() * 15 * 20);
            int amplifier = (int) (Math.random() * 2);
            playerIn.addPotionEffect(new EffectInstance(to_apply, duration, amplifier));
            this.prev_milli = System.currentTimeMillis();
        }
        return super.onItemRightClick(worldIn, playerIn, handIn);
    }

However, when the timer ticks down to zero on the potion effect, the effect stays there with the timer at 0:00. The first time I right-click it, I get two potion effects: one that works properly and only lasts for the given amount of time and one that has the problem described previously. All subsequent right-clicks produce the latter.
When I do this:
    @Override
    public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) {
        target.addPotionEffect(new EffectInstance(Effects.WITHER, 60, 2));
        target.setHeadRotation((float) (Math.random() * 360), (int) (Math.random() * 180 - 90));

        return super.hitEntity(stack, target, attacker);
    }

the effect applies normally and runs out normally every time I hit an entity.
What's wrong?

sentences: How to create multiple balloon bodies in Box2D? In Box2D, how would I go about making a body that's being lifted by multiple "balloons"?  These balloons would have to be able to be destroyed (for example, by a bow and arrow).

sentences:
How do you "branch" a Unity project How do you branch a unity project?
Suppose you have Game Project A, and say there is variant A' that requires a large convoluted plugin. But the idea is also that you want to keep developing this without the plugin getting in the way, for the other variants - say A and A'' - that don't require it.

sentences:
Unity Timeline character transform initial values I'm trying to make a runtime cutscene in Unity using the Timeline editor. I have a humanoid character with an animation controller, track and a cinemachine track set-up in the playable. The timeline starts playing onTriggerEnter() through script. Initially I applied the track offsets and the timeline plays perfectly in the editor but in play mode the player swaps to random positions in the world and it looks really ugly. So I changed the track offsets to scene offsets and it's almost works perfectly except that the position and rotation of the character are relative to the input just before the character enters the trigger (all input is disabled on trigger entered).

What I intend to do is set a default position and rotation to the character at the beginning of the timeline. Is there any way to achieve that within the timeline editor, if not how else could I do it?

sentences:
How do I add a PIXI container into a Phaser Game? How do I add a PIXI container into a Phaser Game?

I have a game made ONLY with PIXI. but now i would like to port it to a Phaser.

All my game content happens inside a pixi container "screenContainer".  I tried to add a pixi container like this.

var created = function() {
       screenContainer = new PIXI.DisplayObjectContainer();
       var sprite = m.game.add.existing(screenContainer);
}

var.game = new Phaser.Game(gameWidth, gameHeight, Phaser.AUTO, "divId", { create: created });

but it stops here

"phaser.js" line 33067
/**
* The core update - as called by World.
* @method Phaser.Group#update
* @protected
*/
Phaser.Group.prototype.update = function () {
var i = this.children.length;

while (i--)
{
    this.children[i].update(); // UPDATE IS UNDEFINED
}

};

because Pixi.Container, does not have "update" method.

Is there any other way to add a pixi container inside a phaser game?

sentences:
How do I spawn enemies with a delay using threads? Right now I have this:

Thread enemySpawner = new Thread(new Runnable() {
    public void run() {
        if(world.getCurrentState() == gameState.GAME) {
            world.spawnEnemy(x, y);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
});
enemySpawner.start();

It is called in the constructor of my game. For some reason, only one enemy spawns. How do I fix this?

sentences:
Wierd behaviour upon limiting rotation on Y-axis Okay, this is the code that works for a FPS camera, except it allows the player to flip it over by going under/over -/+90° rotation on Y-axis:

transformation->rotateObjectFromRight(glm::radians(angleX), glm::tvec3<GLfloat>(0.0f, 1.0f, 0.0f));
transformation->rotateObjectFromLeft(glm::radians(angleY), glm::tvec3<GLfloat>(1.0f, 0.0f, 0.0f));

transformation object holds the data required to construct the view matrix, among others, a quaternion representing the rotation.

The functions called will construct the quaternion with the given data and then multiply it with the rotation quaternion either from the left (relative to global axes) or the right (relative to local axes) side.

angleX and angleY are mouse X and Y offsets representing the angles to rotate around.

The first line yaws the camera around local Y-axis, while the second then pitches it around global X-axis, creating the characteristic FPS camera movement.

Okay. So far so good. This is the code that should limit the pitch to never exceed the +/-90 boundaries:

transformation->rotateObjectFromRight(glm::radians(angleX), glm::tvec3<GLfloat>(0.0f, 1.0f, 0.0f));

glm::tvec3<GLfloat> forwardVector = glm::rotate(glm::inverse(transformation->getRotation()), glm::tvec3<GLfloat>(0.0f, 0.0f, 1.0f));
GLfloat pitchAngle = forwardVector.y * 90.0f;
angleY = glm::clamp(angleY, -(pitchAngle + 90.0f), -(pitchAngle - 90.0f));

transformation->rotateObjectFromLeft(glm::radians(angleY), glm::tvec3<GLfloat>(1.0f, 0.0f, 0.0f));

First and the last line are the same. What happens here?

First I get the unit vector that lies on the Z-axis and rotate it so that it represents the forward vector of the camera. I then take the Y component of that vector (ranging from -1 to 1) and multiply it with 90 to get the degrees. Then I clamp the angleY so that current rotation combined with the new one never exceeds the +/-90° boundary.

If the rotation was about to flip the camera overhead, it would change the new rotation angle so the camera looks straight up. Similar thing for underfoot flipping.

However, the camera acts weird. It's fastest at pitch angles close to 0°, but gets progressively slower as the pitch nears +/-90°. If I move my mouse slower, the camera is faster, if I move it faster, it's slower.

It's as though it's discarding the too large/small angleY values instead of clamping them to the appropriate values (but it's not, and I can confirm via the debugger - all the calculated values look alright and are correct).

What could be amiss here to cause such weird movement?

sentences: How do I find out which functions are deprecated for specific OpenGL profiles? I would like to get the list of functions that are part of a certain OpenGL profile and the list of the ones that are deprecated so that I can avoid those.

sentences:
How can I generate biome borders? I'm looking for ways to generate random biome borders (like what Minecraft has).

One technique involves choosing specific biomes based on (eg) a rainfall map and a temperature map. But that just determines which biome to place, not where the borders between biomes are.

I don't want to use quantized Perlin noise directly; that would generate certain quantized values strictly within other zones, whereas I'd like finer control over which biomes can abut others. For example, in Minecraft one can see mountainous terrain, forests, plains, or deserts right next to the ocean.

Many of the solutions to "the biome problem" propose computing the whole universe in a heuristic manner. I want to generate infinite terrain, and to me that suggests the algorithm be strictly functional: given an X,Y value (and a world seed) the algorithm can easily spit out a biome value.

So, my question: what are some techniques for identifying random, non-trivial-sized, contiguous chunks of terrain to be of a given biome?

sentences:
How can I increase text using scale and keep the text smooth in libgdx? I found that I can use DistanceFieldShader from here and found an example
but I couldn't make it work. First my whole screen becomes white, all the other actors that I have on screen disappears. second, the text that supposed to be smooth becomes to be black squares. whats wrong with my code? Or maybe someone can give me an example that suits my needs.

This class represents score in the game. (Maybe this should be actor and needs to be Label)

public class Score extends Actor {
    private int scoreInt;
    private BitmapFont scoreBitmapFont;
    private int x, y;
    private DistanceFieldShader distanceFieldShader;

    private Texture distanceFieldTexture;
    private BitmapFont distanceFieldFont;

    float scale = 1.5f;
    float smoothing;

    public Score(int x, int y) {
        this.x = x;
        this.y = y;
        scoreInt = 0;
        scoreBitmapFont = new BitmapFont();
        scoreBitmapFont.setColor(Color.BLACK);
        scoreBitmapFont.scale(scale);

        distanceFieldTexture = new Texture(Gdx.files.internal("default.png"), true);
        distanceFieldFont = new BitmapFont(Gdx.files.internal("default.fnt"), new TextureRegion(
                distanceFieldTexture), true);
        distanceFieldFont.setColor(Color.BLACK);

        distanceFieldShader = new DistanceFieldShader();

        // set filters for each page
        Texture.TextureFilter minFilter = Texture.TextureFilter.MipMapLinearNearest;
        Texture.TextureFilter magFilter = Texture.TextureFilter.Linear;

       scoreBitmapFont.getRegion().getTexture().setFilter(Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.Linear);
    }

    public void inc(int inc) {
        scoreInt = scoreInt + inc;
        if (scoreInt < 0) scoreInt = 0;
    }

    @Override
    public void draw(Batch batch, float alpha) {
        String scoreStr = String.format("Score: %d", scoreInt);
        smoothing = scoreBitmapFont.getBounds(scoreStr).width;
        batch.setShader(distanceFieldShader);
        scoreBitmapFont.draw(batch, scoreStr, x, y/* + scale * getBaselineShift(scoreBitmapFont)*/);
        distanceFieldShader.setSmoothing(smoothing / scale);

//        y += scoreBitmapFont.getLineHeight();
    }

    public int getScoreValue() {
        return scoreInt;
    }

    private float getBaselineShift(BitmapFont font) {
        if (font == distanceFieldFont) {
            // We set -8 paddingAdvanceY in Hiero to compensate for 4 padding on each side.
            // Unfortunately the padding affects the baseline inside the font description.
            return -8;
        } else {
            return 0;
        }
    }
}

sentences:
Camera rotation in 4D What practical choices do I have in order to rotate a camera in 4D space? I would like to make it as intuitive as possible.

A camera in 3D space can be represented by

a point where it is located
the forward vector (movement using the [w] and [s] buttons)
the left (movement using the [a] and [d] buttons)
the up vector (eg. [space] and [ctrl])

In 4D space, the an additional axis is added:

the fourth axis vector (eg. [q] and [e])

All of the vectors remain orthogonal to eachother. So the movement is trivial.

sentences:
GUI.DrawTexture problem in Unity I'm having a problem with GUI.DrawTexture() and I'm looking an alternative function to draw 2D Texture Images. The problem I have is that my textures draw above all other objects and when my camera moves, the images move with the camera, keeping their relative position inline with the cameras position.

using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using UnityEngine;

public class AnimatedGifDrawer : MonoBehaviour
{
public string loadingGifPath;
public float speed = 1;
public Vector2 drawPosition;

List<Texture2D> gifFrames = new List<Texture2D>();
void Awake()
{
    var gifImage = Image.FromFile(loadingGifPath);
    var dimension = new FrameDimension(gifImage.FrameDimensionsList[0]);
    int frameCount = gifImage.GetFrameCount(dimension);
    for (int i = 0; i < frameCount; i++)
    {
        gifImage.SelectActiveFrame(dimension, i);
        var frame = new Bitmap(gifImage.Width, gifImage.Height);
        System.Drawing.Graphics.FromImage(frame).DrawImage(gifImage, Point.Empty);
        var frameTexture = new Texture2D(frame.Width, frame.Height);
        for (int x = 0; x < frame.Width; x++)
            for (int y = 0; y < frame.Height; y++)
        {
            System.Drawing.Color sourceColor = frame.GetPixel(x, y);
            frameTexture.SetPixel(frame.Width - 1 - x, y, new Color32(sourceColor.R, sourceColor.G, sourceColor.B, sourceColor.A)); // for some reason, x is flipped
        }
        frameTexture.Apply();
        //frameTexture.LoadImage.
        gifFrames.Add(frameTexture);
    }
}

void OnGUI()
{
    GUI.DrawTexture(new Rect(drawPosition.x, drawPosition.y, gifFrames[0].width, -gifFrames[0].height), gifFrames[(int)(Time.frameCount * speed) % gifFrames.Count]);
}

}

The code above is designed to draw animated GIFs using System.Drawing.dll in Unity

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:
When would a GPU need to write data to a vertex (or other) buffer? I'm trying to understand why, when and how a GPU would need to write data to some buffer inside its own Video Ram.

In Direct3D 11, there are two flags that concern this, which are D3D11_USAGE_DEFAULT and D3D11_USAGE_IMMUTABLE. The former gives the ability to read and write, the latter only the ability to read.

So, apart from the resources that imply actual rendering to, like back buffers or textures set to use in a render-to-texture scenario, is there any other case where one would prefer to use DEFAULT over IMMUTABLE? How would you get the GPU to change this data? (I guess from a shader?) Why is it not the default one the one that gives you read only access?

sentences:
Modular building technique with angles? (A roof) Ive been spending a bit of time lately studying the modular buildings of many games and reading/viewing several tutorials about it as well, but almost every example I see uses a plain square building that does not have any angled roof or similar.

In all my applications (CS6, Blender/Max, UDK) I adhere to the same grid spacing and I get pretty good results, but trying to make modular angled pieces is confusing me as I'm not sure the best way to approach it.

Below is some shots of my template sheet and workflow I have been doing. Should I do the roof separately or is it possible for me to keep it in the same texture sheet?

The main issue is below. I have made a couple modular roof pieces but when i try to use them, i end up needing to model multiple other parts to fill gaps based on what roof shape i want. I then model those 'filler' pieces and now i have that much less space left in my texture sheet and those pieces are usually not that reusable for anything else. This is where im not sure how to proceed.

If anyone has any links to documents or papers talking about this or advice, I would greatly appreciate it! =-)

My main roof pieces with the gaps

My power of 2 texture sheet, with 16x16 grid squares.

The texture sheet loaded into blender on a 16x16 plane and starting to separate and extrude.

sentences:
Move player in a circular manner i'm creating a pong game for learning purpose and decided to have the Paddle moving freely but with a slight change in its control.

When pressing LEFT OR RIGHT it should move in polar coordinates facing the ball. And UP OR DOWN moves the paddle towards or backwards the ball.

I've spent the whole day trying out a few solutions but didn't make it.

             var ball = Vector3.zero; // target
             var d = ball - translation.Value.ToVector3();
             var radius = d.magnitude;

             var dir = d.normalized * data.speed * deltaTime;
             var angle = Vector3.Angle(ball, translation.Value);

             var nextPos = translation.Value;

             if (data.input.x > 0)
             {
                 nextPos.x += dir.x + 15 * math.sin(angle) * data.speed * deltaTime;
                 nextPos.z += dir.z + 15 * math.cos(angle) * data.speed * deltaTime;
             }

             if (data.input.x < 0)
             {
                 nextPos.x -= dir.x + 15 * math.sin(angle) * data.speed * deltaTime;
                 nextPos.z -= dir.z + 15 * math.cos(angle) * data.speed * deltaTime;
             }

             translation.Value = nextPos;

sentences:
Swept AABB vs Line Segment 2D I've really exhausted as much as Google has to give, I've spent a solid week googling every combination of words for an "AABBvsLine sweep", downloaded countless collision demos, dissected SAT intersection examples and an AABBvsAABB sweep trying to figure out how to approach this. I've not found a single thing covering this specific pairing.

Can anyone shed any light on how to get the hit time of a swept AABB vs a Line segment in 2D? I'm still getting familiar with the SAT but I do know how to implement it to a degree, I'm just not sure how to extract the hit time from the velocity in the non axis aligned separating axes for the sweep.

I really would appreciate anything at the moment, some code or even some helpful links, I'm at my wits end!

sentences: Does game development have its own types of modeling? In general computer science there are modeling "languages" (read: standardized diagramming techniques) such as UML 1,2, in databases there are things like ERD3, in business there are other types such as BPMN4,5. Is there anything like these that are Game Design specific?

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:
Audio not playing until after button release when it should be playing while it's pressed I am trying to play the sound of a car accelerating while a user has a certain button pressed, however, the audio clip isn't playing until after that button is released.  Can anyone explain to me where I'm going wrong?

C#

using UnityEngine;
using System.Collections;

public class MoveCar:MonoBehaviour{
    //Car's idle speed
    private float idleSpeed = 0.0f;
    //Car's current speed
    private float speed = 0.0f;
    //Car's top speed
    public float topSpeed = 165.0f;
    //Car's acceleration rate
    public float acceleration = 10.0f;
    //Car's braking power
    public float deceleration = 15.0f;
    private Rigidbody playerCar;

    void Start(){
        playerCar = GetComponent<Rigidbody>();

    }

    void Update(){
        if(Input.GetKey(KeyCode.W)){
            AudioSource accelerate = playerCar.GetComponent<AudioSource>();
            float horizontal = Input.GetAxis("Horizontal");
            float vertical = Input.GetAxis("Vertical");
            if(speed <= topSpeed){
                accelerate.Play();
                speed = speed + (acceleration * Time.deltaTime);
                Vector3 movement = new Vector3(vertical, 0.0f, horizontal);
                playerCar.AddForce(movement * Mathf.Clamp(speed, idleSpeed, topSpeed));
                Debug.Log(Mathf.Clamp(speed, idleSpeed, topSpeed));
            }
            else{
                speed = topSpeed;
                Debug.Log(Mathf.Clamp(speed, idleSpeed, topSpeed));
            }
        }
    }
}

Here's my editor windows

sentences:
mesh gets twisted wildly when trying to use Unreal's mannequin's skeleton I have modelled a simple mannequine and made a skeleton for it in Blender. As far as I can judge, this skeleton copies the Unreal's standard mannequine's skeleton perfectly...
All the hierarchy and bone names are the same, and Unreal also does not complain when I import this mesh and use Unreal's skeleton asset for it.
However, when I try to play a preview animation on my mesh, it gets twisted wildly.
This is a normal state:

... and this happens when I play an animation on this asset:

I thought it was due to different joint initial transforms, so I tried exporting from Blender with varying bone axes (x-axis along the bone, z-axis along the bone etc.) but it did not help. There is neither imporevement nor mere difference when I change that. Can you tell me possible reasons?
Please find the .fbx here:
https://drive.google.com/file/d/1v1X8t7l-6lwQragO8E0mtC1chdT2p1m4/view?usp=sharing

sentences:
Android cocos2d removing a sprite after animation I have an object going across the screen with an animation using the following code:

CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFrames("ninjastar.plist");
CCSpriteSheet projectileSheet = CCSpriteSheet.spriteSheet("ninjastar.png");
addChild(projectileSheet);
ArrayList<CCSpriteFrame> projectileSprites = new ArrayList<CCSpriteFrame>();

for (int i = 1; i <= 4; i++) {
    projectileSprites.add(CCSpriteFrameCache.spriteFrameByName("ninjastar" + i + ".png"));
}

CCAnimation projectileAnimation = CCAnimation.animation("throw", 0.1f, projectileSprites);
CCSprite projectile = CCSprite.sprite(projectileSprites.get(0));
CCAction projectileAction = CCRepeatForever.action(CCAnimate.action(projectileAnimation, false));
projectile.setPosition(CGPoint.ccp(winSize.width + (projectile.getContentSize().width / 2.0f), actualY));
    actionMove = CCMoveTo.action(actualDuration, CGPoint.ccp(-projectile.getContentSize().width / 2.0f + 320, actualY));
projectileSheet.addChild(projectile);
projectile.setTag(1);
_projectiles.add(projectile);
CCCallFuncN actionMoveDone = CCCallFuncN.action(this, "spriteMoveFinished");
CCSequence actions = CCSequence.actions(actionMove, actionMoveDone);
projectile.runAction(actions);
projectile.runAction(projectileAction);

I'm using "spriteMoveFinished" to remove the sprite once it is done going across the screen:

public void spriteMoveFinished(Object sender) {
CCSprite sprite = (CCSprite)sender;
_projectiles.remove(sprite);
sprite.stopAllActions();
removeChild(sprite, true);
}

However, when the sprite gets to the end of the screen it just stays stuck there on the last frame. How do I remove it completely?

sentences:
How to optimize Floor Meshes with different material in unity I have several meshes (floor tiles) that consist of unique materials as they have different textures. I see that it is taking too many batches and it has around 100m vertexes.
Is there any way to improve it through programming? The long way, it should be ported to 3d modeling and combine.
I also see the mesh combine but it requires the same material.
Edit:

Around 17k Floor tiles (LoD 9) with details
around 5 or 6 large tiles (Floor LoD 7) with fewer details that are placed beneath the LoD 9 tiles
lod9 tiles are display-based camera culling otherwise LoD7 floor shows all the time.

Here are some of the screenshots:
Lod 7 Tile example (there total 16 tiles)

sentences:
Creating outline from a collection of points following the concavity I am trying to create an outline from a collection of points. I found this solution for Convex Hull. I specifically picked this implementation: https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain
Edit: I can't find an algorithm that will find the concavity of the region specified in green. The yellow line is the Hull from the algorithm amove

I have the point is defined as:
[Serializable]
public struct Point : IComparable<Point>, IEquatable<Point>
{
    public int X;
    public int Y;

    public static int Cross(Point o, Point a, Point b)
    {
         return (a.X - o.X) * (b.Y - o.Y) - (a.Y - o.Y) * (b.X - o.X);
    }
}

Here is the implementation of the algorithm:
        public static List<Point> ConvexHull(List<Point> points)
        {
            if (points == null || points.Count <= 3) {
                return points;
            }

            var size = points.Count;
            var k = 0;
            var hull = new Point[2 * size];

            points.Sort();

            //build lower hull
            for (int i = 0; i < size; ++i) {
                while (k >= 2 && Point.Cross(hull[k - 2], hull[k - 1], points[i]) <= 0) {
                    k--;
                }

                hull[k++] = points[i];
            }

            //build upper hull
            for (int i = size - 1, t = k + 1; i > 0; --i) {
                while (k >= t && Point.Cross(hull[k - 2], hull[k - 1], points[i - 1]) <= 0) {
                    k--;
                }

                hull[k++] = points[i - 1];
            }

            var result = new List<Point>(hull);

            if (k > 1) {
                result.Resize(k - 1);// remove non-hull vertices after k; remove k - 1 which is a duplicate
            }

            return result;
        }

sentences:
Turn Based Game Match Data in iOS Hi I’m working on turn based game development using turn based API from Apple’s GameKit framework. My game is 2 player strategy game.  Currently I’m facing the issue match data update on game play screen when the player complete their turn. I have more animation on game play, so the turn  data make impact both side.

and also we need reference or guidance for following questions:

1.when i get invite from the opponent player, the app will launch and authenticate on home screen but didn’t navigate to game play screen.

2.How the match data manage easily?

3.I have  3 primary leaderboard to play the game, Is this possible to update scoreboard for every turn?

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:
Geometry System of Populous: The Beginning I want to to develop a game like Populous: The Beginning with my friend. But we could not find out what type of geometry they have used for the world.

We know that
- all tiles have the same size
- all tiles are squares

So.. It cannot be a Icosahedron, because there are triangles, nor cant it be a standard sphere geometry, because not all tiles have the same size.

Can someone help me?

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:
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:
Increasing height increases width I have a game, where the user presses a button to spend money and increase the height of a Movie Clip. I use the following: height ++.

The problem:  When I test this out, it seems the width increases, too.  The actual thickness, you could say.  How can I solve this?

sentences:
Combining lots of small polygons to one (some) big poly(s) I am looking for algorithm to merge lots of relatively small 2d polygons to one or some big polygons. In case two small polygons are touching or overlapping, they should be merged to one polygon.

My big goal is to sufficiently decrease amount of points/lines required to describe collider. Resulting collider can include some polygons, btw.

Could you propose an algorithm or library to do this? (Finally I will implement solution in C# for Unity3d).

P.S. Here is one picture of task I need to solve. Look this http://epsiloncool.ru/i/E20160624-224050.png Green lines is a colliders. I need to merge them all to get one collider (or some)

sentences:
Shadow map depth error makes all light be covered and hidden I've been following the tutorials listed below:

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series3/Shadow_map.php

http://xbox.create.msdn.com/en-US/education/catalog/sample/shadow_mapping_1

And I made my shadow map creator effect:

float4x4 WorldViewProjection;

float4x4 LightingWorld;
float4x4 LightingViewProjection;

struct VertexToPixel {
    float4 Position : POSITION;
    float Depth : TEXCOORD0;
};

VertexToPixel ShadowMapVertexShader(float4 position : POSITION) {
    VertexToPixel output = (VertexToPixel)0;

    output.Position = mul(position, mul(LightingWorld, LightingViewProjection));
    output.Depth = output.Position.z / output.Position.w;

    return output;
}

float4 ShadowMapPixelShader(VertexToPixel input) : COLOR0 {
    float4 color = input.Depth;
    color.a = 1;

    return color;
}

I use the following flashlight (which has a cone angle: coneAngleHalfRad * 2) View and Projection matrices for the shadow map (and for checking the depths later):

        lightProjection = Matrix.CreatePerspectiveFieldOfView(
            coneAngleHalfRad * 2,
            1,
            1, //0.25f,
            range);

        //Helper.Message(this, "draw shadow maps: " + needsShadows);
        //Helper.Message(this, "rotation up: " + rotation.Up);
        lightView = Matrix.CreateLookAt(position, position + (direction * range), rotation.Up);
        lightViewProjection = lightView * lightProjection;
        DepthMapMakerEffect.Parameters["LightingWorld"].SetValue(Matrix.Identity);
        DepthMapMakerEffect.Parameters["LightingViewProjection"].SetValue(lightViewProjection);
        DepthMapMakerEffect.Techniques[0].Passes[0].Apply();

        device.SetRenderTarget(RenderDirectional);
        device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1.0f, 0);

        drawAction(this, DepthMapMakerEffect);

        device.SetRenderTarget(null);
        ShadowMapDirectional = (Texture2D)RenderDirectional;

I set my shadow map to the effect:

TextureManager.DynamicTexturingEffect.Parameters["Flashlight" + numFlashlightsPP + "Map"].SetValue(((Flashlight)lights[lightIndex]).ShadowMapDirectional);

And when I am drawing the light with additive blend state, I use the following code to get the depths from the shadow map and from the camera (is it from the camera? I didn't understand yet):

shared float DepthBias = 0.001f;

//  [...]

shared Texture Flashlight0Map;
shared sampler Flashlight0MapSampler = sampler_state {
    texture = <Flashlight0Map>;
    magfilter = LINEAR;
    minfilter = LINEAR;
    mipfilter = LINEAR;
    AddressU = clamp;
    AddressV = clamp;
};

//  [...]

//  Find the position of this pixel in light space.
float4 lightingPosition = mul(worldPosition, flashlight.LightingViewProjection);

//  Find the position in the shadow map for this pixel.
float2 shadowTexCoord = 0.5 * lightingPosition.xy /
                        lightingPosition.w + float2(0.5, 0.5);
shadowTexCoord.y = 1.0f - shadowTexCoord.y;

//  Get the current depth stored in the shadow map.
float shadowDepth = tex2D(Flashlight0MapSampler, shadowTexCoord).r;

//  Calculate the current pixel depth.
// The bias is used to prevent folating point errors that occur when
// the pixel of the occluder is being drawn.
float ourDepth = (lightingPosition.z / lightingPosition.w) - DepthBias;

//  [...]

float intensity = 0;
if (ourDepth <= shadowDepth) {
    if (atten > 0) {
        intensity = saturate((flashlight.Range - dist) / flashlight.Range) * (dot(vertexNormal, perVertexNormal) * fog) * atten;
    }
}

But what happens is that the result is ALWAYS "ourDepth > shadowDepth", which makes the entire light always hidden so it's always shadowed no matter if there's an object in front of it or not.

What could I possible be doing wrong? I think I used wrong values in the flashlight's View and Projection. But I can't find the error. What might be the problem?

Any suggestion may help!

EDIT: I'm not using the same aspect ratio of the screen and of the camera for the shadow map. Do I need to?

sentences:
How do I change the name of map shown in Warcraft 3 list of available maps? I used an MPQ editor to change some things in one of my maps.  Among those changes was the map name defined as a text string in the war3map.wts inside the map.
Now, however, I see that the name of the map, as shown in the list of maps, was unchanged and — of course — differs from the name of the map shown everywhere else:  above the preview, e.g.

How do I change the list name?
Do I actually need to resave it in a map editor, e.g. Blizzard's “World Editor”?

sentences:
How can I attach a libGDX actor to a box2D body? I'm creating game like hill climb racing.

I created my car with the help of shapes and joints but I don't know how to attach graphics to it. I used actors and sprites before for the sake of learning, but I don't know how to use those with box2d bodies.

How can I?

sentences:
DXUT getters are always null using DLL I'm struggling with a problem for a while and I hope some of you can help me out. The title for this question is vague, so I will try to explain my problem as best as I can!
I'm am creating a project (in C++ using Visual studio 2012) with a DLL that has the DirectX toolkit and DXUT as references. I initialize DXUT (the device and all that kind of stuff) in the DLL and create a GameScene (GameScene is in the executable) after DXUT is initialized. The GameScene derives from its base class BaseScene (BaseScene is in the DLL project).
When I call DXUTGetD3D11Device() to get the DirectX device in the GameScene (in the executable) it is all fine, but when I call DXUTGetD3D11Device() in the BaseScene it returns null.
Note: This counts for all the DXUT functions!
Note: The executable has the same references as the dll + the dll!
If you need more information to answer my question, ask me! I find it really hard to explain my problem and I will try my best to make it more clear!

sentences:
Updating OpenGL ES 1.1 based iPhone game to use Open GL ES 2.0 I'm fairly new to anything OpenGL in general.  I've made an OpenGL ES 1.1 based 2D iPhone game by working from sample code.  I'm under the impression that OpenGL ES 2.0 is substantially different from 1.1.  So what does updating 1.1 code to 2.0 entail?

I'm accustomed to the kinda basic drawing pattern of "push matrix, translate, rotate, draw 2D texture, pop matrix".  What's the "equivalent" in 2.0?

sentences:
Managing Unity Scenes during refactoring? Most of my Unity project code is in a visual studio project, and I use Unity for UI/Rendering/wiring things together.

I renamed some fields in an object and suddenly the game, when run in unity, became unrunnably buggy. It turned out that a field I had set in the unity frontend had been unset when I renamed it.

What's a good way to avoid these sorts of problems when working with unity? I was using version control and could have reverted to an old build in the worst case, but I couldn't find any human-readable Unity Scene files that could have just shown me what I changed.

sentences:
Scene2d cyrillic font I'm trying to use cyrillic(Russian) letters in libgdx Scene2d. I drop default.fnt and default_0.png (generated with BMfont) into folder assets of my Android project (other files such as uiskin.atlas,uiskin.json,uiskin.png are taken from libgdx examples).

main code:

    skin = new Skin(Gdx.files.internal("uiskin.json"));
    Label label1 = new Label("QWERTYqwertyЙЦУКЕНйцукен",skin);

uiskin.json:

    {
com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } },
com.badlogic.gdx.graphics.Color: {
    green: { a: 1, b: 0, g: 1, r: 0 },
    white: { a: 1, b: 1, g: 1, r: 1 },
    red: { a: 1, b: 0, g: 0, r: 1 },
    black: { a: 1, b: 0, g: 0, r: 0 },
},
com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
    dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } },
},
com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: {
    default: { down: default-round-down, up: default-round },
    toggle: { down: default-round-down, checked: default-round-down, up: default-round }
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
    default: { down: default-round-down, up: default-round, font: default-font, fontColor: white },
    toggle: { down: default-round-down, up: default-round, checked: default-round-down, font: default-font, fontColor: white, downFontColor: red }
},
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: {
    default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-rect, hScroll: default-scroll, vScrollKnob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: {
    default: {
        font: default-font, fontColor: white, background: default-select,
        scrollStyle: default,
        listStyle: { font: default-font, selection: default-select-selection }
    }
},
com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle: {
    default-vertical: { handle: default-splitpane-vertical },
    default-horizontal: { handle: default-splitpane }
},
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
    default: { titleFont: default-font, background: default-window, titleFontColor: white },
    dialog: { titleFont: default-font, background: default-window, titleFontColor: white, stageBackground: dialogDim }
},
com.badlogic.gdx.scenes.scene2d.ui.ProgressBar$ProgressBarStyle: {
    default-horizontal: { background: default-slider, knob: default-slider-knob },
    default-vertical: { background: default-slider, knob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
    default-horizontal: { background: default-slider, knob: default-slider-knob },
    default-vertical: { background: default-slider, knob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
    default: { font: default-font, fontColor: white }
},
com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle: {
    default: { selection: selection, background: textfield, font: default-font, fontColor: white, cursor: cursor }
},
com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
    default: { checkboxOn: check-on, checkboxOff: check-off, font: default-font, fontColor: white }
},
com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle: {
    default: { fontColorUnselected: white, selection: selection, fontColorSelected: white, font: default-font }
},
com.badlogic.gdx.scenes.scene2d.ui.Touchpad$TouchpadStyle: {
    default: { background: default-pane, knob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Tree$TreeStyle: {
    default: { minus: tree-minus, plus: tree-plus, selection: default-select-selection }
},
com.badlogic.gdx.scenes.scene2d.ui.TextTooltip$TextTooltipStyle: {
    default: {
        label: { font: default-font, fontColor: white },
        background: default-pane
    }
},
}

and get such result:

Where can be the problem?

sentences:
Get enum value "string", and get int value of that Sorry if the title is confusing, but I literally don't even know how to summarise this into a title. So here's the problem:

I have a list of combat moves for a character. I have an animation for each of those possible moves. When the "combat manager" (instantiated to manage each individual fight) works out what move the enemy and your person will make, it should tell the Animator to play the animation specific to the selected move. I'm really not sure how to go about this so:

The player's Animator has a state for each possible move, containing that move's animation. The script controlling the Animator has a public enum "CombatMove" containing every possible move (ie. CombatMove.WhicheverMove). So the Combat Manager will get the name of the move (eg. "Right Middle Jab"), remove the spaces and search for an enum value whose name is that string (eg. CombatMove.RightMiddleJab). Now it has the corresponding enum value, it retrieves the int value of that (eg. 0). It then sends that int value to the Animator, where each move's transition will occur if the int value equals the move's int value on the enum. So summed up:

move's string name, turned into an enum value name, turned into its int value, used to specify which move animation should be played.

The questions:

1) How do you find an enum value whose name equals a given string?

2) How do you get the int value of that enum value?

If this is confusing, please comment what makes no sense and I will try to explain, I'm honestly so lost that I don't even know how to ask what I need to ask.

EDIT:

IF anyone is wondering what I mean by 'int value', Fafase's answer at http://answers.unity3d.com/questions/764091/using-c-enums-to-control-an-animator.html says that each enum value has an int value by default, which can be used in animation conditions; however I have no idea how to access them, which part 2 of my problem.

sentences:
Detect mouse over a line in Phaser We're developing a game in Phaser as a university project and have come across an obstacle. We need to detect when the mouse is over a line between two points. There are not a lot of lines, definitely fewer then 500. We were thinking of just checking it with line equations on every update call, but that might slow the game down. We haven't found anything useful on google. Should we just stick with the equations or is there a more elegant way?

Cheers

sentences:
Wall avoidance steering I making a small steering simulator using the Reynolds boid algorithm.
Now I want to add a wall avoidance feature. My walls are in 3D and defined using two points like that:

   ---------. P2
   |        |
P1 .---------

My agents have a velocity, a position, etc...

Could you tell me how to make avoidance with my agents?

Vector2D ReynoldsSteeringModel::repulsionFromWalls()
{
    Vector2D force;
    vector<Wall *> wallsList = walls();
    Point2D pos = self()->position();
    Vector2D velocity = self()->velocity();

    for (unsigned i=0; i<wallsList.size(); i++)
    {
        //TODO
    }

    return force;
}

Then I use all the forces returned by my boid functions and I apply it to my agent.

I just need to know how to do that with my walls.

Thanks for your help.

sentences:
AABB Sweeping, algorithm to solve "stacking box" problem I'm currently working on a simple AABB collision system and after some fiddling the sweeping of a single box vs. another and the calculation of the response velocity needed to push them apart works flawlessly.

Now on to the new problem, imagine I'm having a stack of boxes which are falling towards a ground box which isn't moving:

Each of these boxes has a vertical velocity for the "gravity" value, let's say this velocity is 5.

Now, the result is that they all fall into each other:

The reason is obvious, since all the boxes have a downward velocity of 5, this results in no collisions when calculating the relative velocity between the boxes during sweeping.

  Note: The red ground box here is static (always 0 velocity, can utilize spatial partitioning ), and all dynamic > static collisions are resolved first, thus the fact that the boxes stop correctly at this ground box.

So, this seems to be simply an issue with the order the boxes are sweept against each other.

I imagine that sorting the boxes based on their x and y velocities and then sweeping these groups correctly against each other may resolve this issues.

So, I'm looking for algorithms / examples on how to implement such a system.

The code can be found here: https://github.com/BonsaiDen/aabb

The two files which are of interest are box/Dynamic.lua and box/Manager.lua.

The project is using Love2D in case you want to run it.

sentences:
How to bundle a HTML5 JavaScript game as native Windows application? As the web browsers evolve, HTML5 game development with JavaScript, Canvas, webgl is increasingly becoming popular. The advantage of web-based games compared to native apps is that they run on multiple platforms, and you don't have to fiddle with OS-specific libraries or programming environments.

You can already sell your web games via the chrome web store, but I think it's too unpopular yet for being profitable for indie game developers.

I think you may reach a larger crowd by selling your games at the Mac App Store or Steam, but therefore you have to bundle it as standalone application.

For mac, you can easily bundle your HTML5 games as native app by using the Apple's WebView component. Here is an example on how to do that.

Now I wonder: is there an equivalent way for Windows platform?

sentences:
Designing a unit combat system (java) I am looking to make a program that will allow me to test units for balance when in combat. The idea is that there will be two teams of so many units of different types. I would loop through a battle system that would pick units, have them attack, etc, and then see which team won and do this many many times for an average.

The thing I am having issues with is how to design or make the classes for the units. I tried making a class for a generic unit and then classes that pulled from it for each different unit. The issue was when I called a unit from a team, tried to add one etc. I need to know what the unit type was, that was I couldn't write one function that understood all the unit classes.

I am looking to make a system for the units that allows me to have each unit have the same basic stats, health, speed, etc. But that each unit will also have their own functions for abilities that would be different then other units. It would also allow me to make a method where I can say get a unit from an arraylist and call its get speed method and it wouldn't demand I know the unit class. For instance, grunt g = new grunt() instead something where I can get the unit and just call, unit.getspeed();

Any help or ideas for how I can do this, please ask for more information if needed.

sentences:
How to reduce a rectangle without problems? I'm developing an asteroids' game and I'm needing to reduce the rectangle of the spacecraft because when I use the method intersect() of Rect class to detect a collision with an asteroid they are far.

Here is a part my game:

As you can see, if the red rectangle of the spacecraft intersects with the red rectangle of the asteroid the game will detect a collision.

My problem it's that there is a big space in the bottom and the top part of the spacecraft which can confuse the player.

To solve it, I'm trying to modify the rect values of top and bottom but when i do this the image dissapear of the canvas.

sentences:
Intented name for my game already exists as a book title I have found that the name I have planned for my game have been already used for the title of a book.

After checking the trademark database, this is the description they have used:

"Paper Goods and Printed Matter"

Would I be infringing the trademark if I use the same exact title for my game ?

(Looks like the owner wanted to trademark the same name as a videogame in 2006, but they didn't complete the proccess: Abandoned-failure to respond or late response)

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:
Do I need to "use" the shader program when buffering and defining VBO data? I'm trying to wrap my head around the relation between a GL "program", and the VAOs, buffers, textures, etc. I don't quite understand when I need to "use" my shader program, and when (if ever) I need to "un-use" it?

So when do I need to use the shader program (i.e. invoke glUseProgram), exactly? Does my shader program need to be in "use" when:

Creating and binding VAOs?
Creating and binding VBOs?
Buffering data to VBOs?
Defining vertex attributes (i.e. invoking glVertexAttribPointer)?

sentences:
How to I create a resource manager? Currently I'm using XNA's ContentManager to load my content. For the unfamiliar the ContentManager deserializes classes from disk and keeps a reference for future requests.

I'm currently facing a problem with management, where for some resources I don't want to deserialize them repeatedly (e.g. a texture) but for others I do (e.g. destructible level geometry). As it is now when I replay a level I get back the original class with the player's changes.

For this reason I decided to inherit from ContentManager to provide some way of re-deserializing a resource to get a new copy (probably using the protected ReadAsset<T> method).

Now I'm thinking about how I should manage this. Ideally I want some way of saying you can re-use Textures, but not Levels (i.e. when a Level is requested it always deserializes a new instance).

While I think about that I'd also like to create my custom ContentManager with a view to get other niceties such as automatic unloading, on-demand or in advance loading of assets, pre-loaded place-holder assets etc.

How is this sort of class typically designed and how can I overcome my immediate problem (reloading particular types and re-using instances of others)?

sentences:
Where can I find True Type fonts that are free for commercial use? Possible Duplicate:
  Where can I find fonts for my game?

Does anyone know of fonts that are true type and unicode that can be used in a commercial game for free?

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:
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:
Synchronizing mob states in online multiplayer game I'm developing an exploration-based platform game in which from the start there were plans about including local multiplayer support, but recently I've been considering an online multiplayer mode, mainly because in local multiplayer, because I think it'd make players loose too much visibility to be worth it, I don't want to split the screen between players. It'd be akin to Spelunky.

But I really want for players to be able to explore rooms independently just as much as cooperatively (in the style of Kirby & the Amazing Mirror, for GBA), and online multiplayer would solve this problem of local multiplayer, but I've been wondering what exactly I could do about synchronizing the states of mob between the clients whenever the players are in different rooms. For example, what do I do when a player enters a room in which players were already meddling with the monsters and the evironment, how do I update him with everyone's states?

This question and its answers suggest that I keep a host which is constantly updating the various rooms with players and from them I can provide each client with only the significant data, but what significant data do I need to send my players? Before multiple rooms all that I needed to send was input and random numbers (not much, my game has fixed timesteps), but now I need to send the whole data of entities? After all, each creature has plenty of variables that influence in its AI and physics, as I'm dealing with a platformer.

What are the alternatives?

sentences:
How to avoid game objects accidentally deleting themselves in C++ Let's say my game has a monster that can kamikaze explode on the player. Let's pick a name for this monster at random: a Creeper. So, the Creeper class has a method that looks something like this:

void Creeper::kamikaze() {
    EventSystem::postEvent(ENTITY_DEATH, this);

    Explosion* e = new Explosion;
    e->setLocation(this->location());
    this->world->addEntity(e);
}

The events are not queued, they get dispatched immediately. This causes the Creeper object to get deleted somewhere inside the call to postEvent. Something like this:

void World::handleEvent(int type, void* context) {
    if(type == ENTITY_DEATH){
        Entity* ent = dynamic_cast<Entity*>(context);
        removeEntity(ent);
        delete ent;
    }
}

Because the Creeper object gets deleted while the kamikaze method is still running, it will crash when it tries to access this->location().

One solution is to queue the events into a buffer and dispatch them later. Is that the common solution in C++ games? It feels like a bit of a hack, but that might just be because of my experience with other languages with different memory management practices.

In C++, is there a better general solution to this problem where an object accidentally deletes itself from inside one of its methods?

sentences:
LWJGL - How to draw text on screen After some months on libGDX, I chose to make a little java game library based on LWJGL.
I have already tried to do it, but got stuck on this same problem: how render text on screen.
The first time, I used Sick, but it was deprecated... how do I should do?
This time I tried this code, of couse it doesn't work (I read it on StackOverflow):
public class Starter {

private String GAME_NAME;
public String VERSION;
private int WIDTH, HEIGHT;
private static long window;

public Starter(@NotNull JJGLInfo info){
    Objects.requireNonNull(info);
    GAME_NAME = info.getGAME_NAME();
    VERSION = info.getGAME_VERSION();
    WIDTH = info.getWidth();
    HEIGHT = info.getHeight();
}

public void run(){

   System.out.println("Hello player by JJGL\nJJGL Version: " + VERSION + "\nLWJGL Version: " + Version.getVersion());

   this.init();
   this.loop();

   this.terminate();
}

private void terminate() {
    glfwFreeCallbacks(this.window);
    glfwDestroyWindow(this.window);

    glfwTerminate();
    glfwSetErrorCallback(null).free();
}

ByteBuffer pixels = this.getByteBufferFromString();
private void loop() {

    GL.createCapabilities();
    glClearColor(1f, 1f, 0f, 0f);

    while (!glfwWindowShouldClose(this.window)){
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glfwSwapBuffers(this.window);

        ByteBuffer pixels = this.getByteBufferFromString();
        glEnable(GL_TEXTURE_2D);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, 1000, 200, 5, GL_BLUE, GL_UNSIGNED_BYTE, pixels);
        glEnd();

        if(Input.isKeyPressed(GLFW_KEY_A))
            System.out.println(1);

        glfwPollEvents();
    }
}

private ByteBuffer getByteBufferFromString(){

    String text = "ABCD";
    int s = 256; //Take whatever size suits you.
    BufferedImage b = new BufferedImage(s, s, BufferedImage.TYPE_4BYTE_ABGR);
    Graphics2D g = b.createGraphics();
    g.drawString(text, 0, 0);

    int co = b.getColorModel().getNumComponents();

    byte[] data = new byte[co * s * s];
    b.getRaster().getDataElements(0, 0, s, s, data);

    ByteBuffer pixels = BufferUtils.createByteBuffer(data.length);
    pixels.put(data);
    pixels.rewind();
    return pixels;
}

/**
 * Initialize window
 */
private void init() {
    //Set Callback, when library get an error, it will be print
    GLFWErrorCallback.createPrint(System.err).set();

    //Let's initialize GLFW. Without this call, most of functions won't work
    if(!glfwInit()){
        throw new JJGLInitException("Could not initialize GLFW");
    }

    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);   //Make window hidden
    glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);  //Make window resizeable

    window = this.createWindow();

    glfwMakeContextCurrent(this.window);

    glfwShowWindow(this.window);
}

/**
 * Creating window. If you have passed -1 at one side,
 * it will be maximize (-1, 30 only width will be maximized)
 * @return
 */
private long createWindow() {
    //Getting info about screen
    GLFWVidMode glfwVidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());

    if(this.WIDTH <= -1)
        this.WIDTH = glfwVidMode.width();

    if(this.HEIGHT <= -1)
        this.HEIGHT = glfwVidMode.width();

    //Creating window
    return  glfwCreateWindow(this.WIDTH, this.HEIGHT, this.GAME_NAME, MemoryUtil.NULL, MemoryUtil.NULL);
}

public static long getWindow() { return window; }
}

sentences:
Datastructure for infinite 2D map I started a 2D Tilegame programmed with libgdx which needs potentially infinite tiles. That means when the player arrives the border of the map it should be possible to generate even more tiles. So a simple 2D Array is not the best datastructure for that purpose.
A better solution I found here in the comments from dlras2:
A way to store potentially infinite 2D map data?

it seems like he put 2D arrays in 2D arrays and that again and again, that reduces a lot of memory compared to one array for all tiles:

The problem is that I dont know before how many times the arrays will be encapsulated so it should be easily possible to wrap a new Array around if it is needed.

dlras2 also posted his code in C#, but I dont understand anything from it. Do you have an idea how to implement such a datastructure of recursive Arrays in Java? Or how to translate the whole C# code into Java? I hope the other stuff like putting tiles in the right array I'll solve by my selve.

sentences: How to integrate images into text lines in Unity? Here are two screenshots from Stellaris, where images are seamlessly integrated into the text. How can I achieve this in Unity?

sentences:
GLSL, all in one or many shader programs? I am doing some 3D demos using OpenGL and I noticed that GLSL is somewhat "limited" (or is it just me?). Anyway I have many different types of materials. Some materials have ambient and diffuse color, some materials have ambient occlusion map, some have specular map and bump map etc.

Is it better to support everything in one vertex/fragment shader pair or is it better to create many vertex/fragment shaders and select them based on currently selected material? What is the usual shader strategy in OpenGL or D3D?

sentences:
How can I move an object towards another along a straight line How can I move an object (like a cube) towards another object?

Let's say that we have a red cube in the center of a floor, and a blue cube in another location, there aren't objects between this two, so the movement is along a line.

How can I move the blue cube towards the red one?

sentences:
Do I need to delete a texture after calling SDL_DestroyTexture()? Let's suppose I have this texture:

SDL_Texture* txt = IMG_LoadTexture(renderer, "path");
/* various code */
SDL_DestroyTexture(txt);
delete txt; // <- Is this part really necessary? Doesn't SDL_DestroyTexture() does it already?

Since there's not a lot of documentation about SDL, I haven't found an answer to my question on my own.

sentences:
How can I modify how my scene is drawn to make it look like it's taking place at different times of day? My game has a day-time association with the scene, that the morning light will be different from the afternoon and the night. But I don't know how to make this difference.

Here is an example in Pokemon game:

I have an idea that put a layer on the top of the game with the transparency about 10 - 20%, and change its color depends on the time, but I don't know which color is good.

Are there any other mechanisms to do some kind of day/night cycle in a game of this style?

sentences:
Client interpolation for 100% serverside game I'm developing an online browser MMO 2d war game.

And I'm having some issues with the interpolation. The server sends updated positions to the clients every 90 ms.

I've managed to make it smooth, and it works very well on low latency, but if the latency is high, everything skates around like its on ice (OVERLY SMOOTH).

I would like to achieve normal movement (visually), and I don't care about input-lag, as 3-400 ms input lag doesn't matter for this game.

This is how I'm doing it now (simplified for readability):

The "Server" object is the one processing the updates send by the server, and "animate()" is the gameloop.

    var Server = {
        msAhead: 0,
        Time: Date.now(),
        SetData: function (data) {

            //Set date.now() to calculate ms since last update
            var now = Date.now();

            //calculates ms since last update
            var ms = now - this.Time

            //sets new time (for calculating ms next update)
            this.Time = now;

            //Keeps track of how many milliseconds the server is ahead (position vice)
            this.msAhead += ms;

            //Attatch a reference with the players new position to each player
            $.each(data["players"], function (id, data) {
                Players[id].target = data;
            });
        }
    }

    var Time;
    function animate() {
        //Sets time if first call
        if (!Time) Time = Date.now();

        //Sets new time and calculate ms between frames, sets deltatime
        var now = Date.now();
        var ms = now - Time;
        var delta = ms * 0.001;

        //reset info for next frame
        Time = now;

        //Calculate and normalize lerp
        var lerp = ms / Server.msAhead;

        //update the "msAhead" so we know that we are closer to our target position
        Server.msAhead -= ms;

        //normalize lerp (it can be off on the first frames since time isn't set yet, or is heavy spikes occur)
        if (lerp > 1) lerp = 1;
        if (lerp < 0) lerp = 0;

        //Update player positions lerping towards the target position set by the server object
        $.each(Players, function (id, player) {
           player.position = Lerp(player.position, player.target.position, lerp)
        });

        //Request next animationframe
        requestAnimationFrame(animate);
    }

EDIT:
I can simulate my goal on high latency by doing:
var now = Date.now() + 300;
in the animation loop.

But that will crash (stop updating) low latency players, since the client will think its ahead of the server, and lerp will become negative (zero).

sentences:
Do I need to learn any physics if I use a physics engine? Complete novice out here. Of course I know basic physics like mass and inertia. I don't want to make an engine I just want to make a game and use a physics engine made by someone else.

Do I need to learn any physics if I plan to use a physics engine?

sentences:
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:
Would adding delay to inbound traffic give you an advantage in online games? Wouldn't adding a latency delay to inbound traffic and limiting your download speeds to a low but playable standard give you an advantage in online games, especially shooters?

Because wouldn't your shots be registering as normal (using upload/outbound) while anything that attempts to hit you (download/inbound) would be delayed and/or slow?

sentences:
Material tiling and offset in unity Ambiguity:
What exactly is the difference between Tiling the material and Offset of material?

Need to do:

I need the material to be repeated n times on the object where I need to set the value of n via script.How do I do it?

It seems to happen through Tiling(tried via inspector) but again what is difference between mainTextureOffset and setTextureOffset?

Tried:

Following is the line of code that I tried to repeat the texture n number of times on an object(repeat across the width of object), but it does nothing significant that I can see.

sentences:
Kickstarter "last minute cold feet" today I scheduled the publication of a video on Kickstarter requesting approximately $5,000 in order to complete the iPhone shooter game I started 1 year ago after quitting my job.

I invested more than $20,000 in the game so far (for artwork, music, legal and accountant expenses) and I am now getting cold feet about my decision of publishing the video.

The game is "nearly finished", in other words: the game mechanics are working but I still have some bugs to fix. Once I will have finished this (I hope will take me 1 or 2 weeks) I plan to start working on the actual level balancing (e.g. deciding the order of appearance of enemies for each level and balancing the number of hitpoints and strength of bullets that the enemies have).

Reasons for not publishing the video are:

fear that the concept can be copied easily: the game is a shooter game set in a different environment (its a
pretty cool one, believe me :)) and I am worried that someone might
copy* the idea (I know, its the usual "I am worried story.."). A shooter game is one of the easiest game to implement and hence there will be hundreds game developer able to copy it by just adapting their existing code and changing graphics (not as straightforward).

It took me one year to develop this because I was inexperienced plus there are approximately 6/7 months of work from the illustrator and there are 8 unique music tracks composed.
The soundtrack of the video is the soundtrack of the game which is not
yet published and has not been deposited to a music society. I did
create legally valid time-stamps for the tracks and I am considering
uploading the album on iTunes before publishing the video so I can
have a certain publication date. But overall I am a bit scared and worried because I have never done this before and even the simple act of publishing an album requires me to read a long contract from the "aggregator company") which, even if I do have contracts with the musicians do worry me as I am not a U.S. resident and I am not familiar with the U.S. law system

Reasons for publishing the video are:

I almost run out of money (but this is not a real reason as I should have enough for one more
month of development time)
...I kind of need extra money as, even if I do have money for 1 month of development I do not have money for marketing and for other expenses (e.g. accountant)
It will create a fan base
I could get some useful feedback from a wider range of beta testers
It might create some pre-release buzz in case some blogger or game
magazine likes the concept

Anyone has had similar experiences? Is there a real risk that someone will copy the concept and implement it in a couple of months? Will the Kickstarter campaign be a good pre-release exposure for the game? Any references of similar projects/situations? Is it realistic that someone like ROVIO will copy the idea straight away?

sentences:
Is there a proxy for the Steam Web API? I'm making a small spreadsheet that tracks the amount of kills my wrench's eaten over time in TF2.  So far I've been manually copy pasting fields from the TF2 window, but hey, Steam does have some API I could consume, and Google Spreadsheets can consume XML too. This number I'm tracking should also be exposed by the GetPlayerItems route, so I should be golden!

Except the Steam Web API requires a domain-bound authorization key (!). I don't own docs.google.com, so I can't get one. Thus, I cannot make the API call.

Is there some kind of API proxy service for the Steam Web API so that I can query the API without having to buy a whole damn domain for such a simple use case? ...or do I have to resort to scraping middle men such as tf2b.com?

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:
How to know the adresses an editor modifies while saving a file I hope this question belongs here.

Suppose an editor for a specific file extension. It usually has a user friendly interface so you don't see raw data. Once you edit anything and save the editor modifies some data. Is there any way to keep track of these changes and see which specific data is modified?
This is motivated by the fact that an editor is a program that has its limitations and sometimes it does not allow some changes. This protects the original file from fatal damage. As an example suppose a .nes file that can be edited through the HEX editor or a "level" editor. I might not know the ROM address where some level information is stored but (i guess) the "level" editor knows. So I can edit, save and search the region of the ROM, with the HEX editor, that was modified. That would give me information on where this level data is stored and be able to understand it.

My system is Windows so I wonder if there is any "save register" that keeps track of this save operations. Or is it an editor specific thing and each one has its own way of saving data, meaning i should look into the editor's code more than a general Windows place?

Thanks,

PD: I'm sorry if I misunderstood something essential but I'm not experienced with how this precesses work.

sentences:
Understanding how to create/use textures for games when limited by power of two sizes I have some questions about the creating graphics for a game.

As an example. I want to create a motorbike. (1pixel = 1centimeter)
So my motorbike will have 200 width and 150 height. (200x150)
But the libgdx only allows to load sizes with the power of 2?! (2,4,8,16,...)

First I thought about that way.
I will create my bike with the size (200x150) and save it as png. Than I will open it again (e.g. with gimp) resize the image to a size which uses values with power of 2 (128x128). I will load that as texture in the programm and set width as 200 and height as 150.

But wouldn't it be a problem? Because I will lose some pixel information when I make the first conversation.?! Isn't it?

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:
Do all included assets become part of built outcome or only the ones in use? When building a unity game, does it include all assets inside the project folders etc or only the ones used?
Can Unity really tell if a prefab is used anywhere or a sprite or any downloaded package for that matter?

sentences:
Traversing an acyclic binary tree to construct paths from a given starting node, but the paths come out wrong The tree is an acyclic binary tree. It's composed of node objects that have a list of connections to link objects (at most 3), and link objects that have a list of connections to node objects (always 2). I am trying to construct a list of possible paths to other nodes that can be reached given a fuel budget and a fuel cost on each link. What it is supposed to do is go through each non-backtracking connection of a node, and spawn a new route and thread to investigate that, leaving the current one to end at that node and thus create a list of routes to every node in the reachable area. When executed, the list of end destinations are valid but many of the paths that are constructed to get to them are wrong, going down other branches in the tree that are extraneous or entirely outside of the reachable area bounded by the fuel budget as well as jumping between nodes that aren't directly connected. There seems to be some pattern in the errors, when going down from the root of some branches of the tree the path goes down every offshoot in order first instead of going in a straight line, and when going up the tree the path tends to go further out and make triangle shapes, often landing somewhere other than the listed destination. I have already checked the link and node connections themselves to see if they are assigned properly, and they are. What am I getting wrong?
Route class definition
var origin:Node
var destination:Node
var totaldV:float
var totalt:float
var dVBudget:float
var tBudget:float
var tdVRatio:float
var links:Array
var nodes:Array

func duplicate_values(originator:Route):
    origin = originator.origin
    destination = originator.destination
    totaldV = originator.totaldV
    totalt = originator.totalt
    dVBudget = originator.dVBudget
    tBudget = originator.tBudget
    tdVRatio = originator.tdVRatio
    nodes = originator.nodes
    links = originator.links

func _init(originator_route):
    if originator_route != null:
        duplicate_values(originator_route)

Tree traversal algorithm
var routes:Array
onready var root = get_node("..")

func traverse(current_node:Node, previous_route:Route):
    if previous_route == null:                             # Starts off the recursion by providing an initial node
        previous_route = Route.new(null)
        previous_route.origin = current_node
        previous_route.nodes.append(previous_route.origin)
        previous_route.dVBudget = 2000
        previous_route.totaldV = 0
    for link in current_node.connections:
        if (previous_route.totaldV + link.dV < previous_route.dVBudget &&
        !IsBacktracking(previous_route, LinkDestination(link, current_node))):   # If there is enough fuel and the link isn't backtracking, go through it.
            var working_route:Route = Route.new(previous_route)    # Copy the previous route to make the new route
            routes.append(working_route)
            working_route.destination = LinkDestination(link, current_node)
            working_route.totaldV += link.dV
            working_route.totalt += link.t
            working_route.links.append(link)
            working_route.nodes.append(working_route.destination)
            traverse(working_route.destination, working_route)
    DisplayRoutes()
    root.get_parent().pathSelectionFlag = true   # UI control boolean

func IsBacktracking(route:Route, destinationNode:Node) -> bool:
    for nodeI in route.nodes:
        if (destinationNode == nodeI):
            return true
    return false

func LinkDestination(link:Node, originNode:Node) -> Node:    # Finds the node on the other side of a link
    for nodeI in link.connections:
        if (nodeI != originNode):
            return nodeI
    return originNode

sentences:
How do I generate a 2d grid-based map without screwing it up? I'm relatively new to the mechanics of game development - catching up fast, but there are still some things that escape me. For example: generating a fully-accessible map on a 2d grid.

See the example at http://crawl.s-z.org. Each floor map starts with dozens of winding labyrinthine passages and randomly drops in points of interest - temples, boss lairs, bazaars, etc. I know there's a lot of factors that go into this: generating passages that always have at least one exit (no isolated tunnels in the walls), making sure passages have at least a one-cell-width wall between them and adjacent parallel passages, and dropping points of interest in such a way that they connect to the dungeon.

I've taken a shot at it, and it's very easy to ranomly place lines in a 2d matrix that represent passages - but they're never guaranteed to connect, and it's not nearly as elegant as the maps at the above example.

I suppose my question is, what do I need to know to reproduce the example at crawl.s-z.org? I know this is a large question - I'd be fine with someone handing me a link to a reference site and telling me to learn it there. I'm just new enough at this that I don't even know what terms to google - maybe there are names for different generation processes? Available techologies are JS (jQuery) and PHP, so a solution tailored to one of those would be ideal. Thanks!

sentences:
How do I create a 2.5d parallax effect? I have a decent background in 3D graphics and programming, but I'm new to game development. I'm currently exploring different possibilities and I really want to make an RPG game. I was thinking about classic 2D isometric view, but I really love how Diablo 2 looks and feels to play.

My question is - how can I achieve Diablo 2's parallax effect? Everything looks hand drawn with baked lights and shadows and looks awesome, but when you move around you notice some perspective.

For example, let's say that I drew a big hall with columns in Photoshop with an orthographic perspective (classic pixel art style, just parallel lines). How would I give parallax effect to this scene when the character moves around? If I use camera-facing sprites for everything it would probably look OK in the distance, but it would be really fake when a character comes close to a column (cylinder) for example.

Any suggestions? How did Blizzard make the parallax effect in Diablo 2?

See this screenshot: http://guidesmedia.ign.com/guides/10629/images/act2tombs.jpg

sentences:
storing map data as file in 3d roguelike games I'm currently designing 3d roguelike game. I need to come up with a map storing system but I'm quite new to game programming so I don't really know how to design.
The map will be relatively small, it's not open world. I think it would be just like 3d version of The Binding of Isaac with first-person perspective.

I want to store map data as a file(e.g txt) but I don't know how to order them and what is necessary to store.

Answers with some examples would be very appreciated.

sentences:
Question on parallelizing ECS Systems Learning & Implementing an ECS system for my game, I'm wondering how I am supposed to parallelize the systems on multiple threads. Different systems can't run at the same time (unless they operate on completely different set of components), so I guess the most common option is to run each system sequentially and parallelize the iteration they do on components, in a parallel_for fashion. The problem with this is that parallel_for assumes each iteration is self contained, which is not always true. In case an entity needs to access the component of another entity, and maybe modify it (very common in gameplay programming), we cannot really run a parallel_for as often we don't know what entities will want to access (through the system) what other entities.
How is this handled in ECS?

sentences:
Calculating the geometry of a thick 3-way miter joint Following a very helpful post on another forum I've found a simple algorithm that takes an array of 2D vectors and creates a triangle strip.
I've modified the source code for my purposes. I haven't tested it yet, but it should do the trick.

public static void PolyLineToTriangleStrip(Vector2[] pts, bool closed, float thickness, List<Vector2> vertices, List<int> indices)
    {
        var numPts = pts.Length;
        vertices.Clear();
        indices.Clear();
        for (int i = 0; i < numPts; ++i) {
            int a = ((i - 1) < 0) ? 0 : (i - 1);
            int b = i;
            int c = ((i + 1) >= numPts) ? numPts - 1 : (i + 1);
            int d = ((i + 2) >= numPts) ? numPts - 1 : (i + 2);
            var p0 = pts[a];
            var p1 = pts[b];
            var p2 = pts[c];
            var p3 = pts[d];

            if (p1 == p2)
                continue;

            // 1) define the line between the two points
            var line = (p2 - p1).normalized;

            // 2) find the normal vector of this line
            var normal = new Vector2(-line.y, line.x).normalized;

            // 3) find the tangent vector at both the end points:
            //      -if there are no segments before or after this one, use the line itself
            //      -otherwise, add the two normalized lines and average them by normalizing again
            var tangent1 = (p0 == p1) ? line : ((p1 - p0).normalized + line).normalized;
            var tangent2 = (p2 == p3) ? line : ((p3 - p2).normalized + line).normalized;

            // 4) find the miter line, which is the normal of the tangent
            var miter1 = new Vector2(-tangent1.y, tangent1.x);
            var miter2 = new Vector2(-tangent2.y, tangent2.x);

            // find length of miter by projecting the miter onto the normal,
            // take the length of the projection, invert it and multiply it by the thickness:
            //      length = thickness * ( 1 / |normal|.|miter| )
            float length1 = thickness / Vector2.Dot(normal, miter1);
            float length2 = thickness / Vector2.Dot(normal, miter2);

            if (i == 0 && !closed) {
                vertices.Add(p1 - length1 * miter1);
                vertices.Add(p1 + length1 * miter1);
            }

            vertices.Add(p2 - length2 * miter2);
            vertices.Add(p2 + length2 * miter2);

            if (closed && i == numPts-1) {
                indices.Add(i * 2);
                indices.Add(i * 2 + 1);
                indices.Add(0);
                indices.Add(i * 2);
                indices.Add(0);
                indices.Add(1);
            } else {
                indices.Add(i * 2);
                indices.Add(i * 2 + 1);
                indices.Add(i * 2 + 2);
                indices.Add(i * 2);
                indices.Add(i * 2 + 2);
                indices.Add(i * 2 + 3);
            }
        }
    }

Feeding it a sequence of vectors would produce something a bit like this:

However, I want to complicate matters by introducing another problem - 3 way joints (or rather n-way).

It must be possible to do this by building on the algorithm, but I'm not sure how I would modify the above algorithm to draw an n-way miter joint with perfect angle distribution like so:

The highlighted lines represent the source lines that would be fattened up by the algorithm.

I calculated and drew these in blender, unfortunately I'm at a bit of a loss to do it programmatically.

Obviously this cannot be achieved with simple line sequences, but that's beside the problem. All that' needed is a central point and n-ammount of points that represent the ends of outcropping lines, and then an algorithm to calculate the outer edges of the required shape.

sentences:
How to write on a Tilemap using a C# script? I loaded my tileset asset TileSheet.png using the Tile Palette (Window -> 2D -> Tile Palette).

This created the folder "grass_tiles" with multiple asset files, one named "TileSheet_168.asset".

My goal is to write a script that randomly generates grass tiles within my 128 x 128 tile map.

I envision the code looking something like this:

tilemap.SetTile(new Vector3Int(x, y, 0), "TileSheet_" + TileNum + ".asset);

...where TileNum is a randomly generated integer between 1 and 750 (assuming that's what SetTile even does).

Current code:

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

public class drawMap : MonoBehaviour {
    public Tile grassTile;
    public Tilemap ChessMap;

    // Start is called before the first frame update
    void Start()
    {
        RenderMap(GenerateArray(128, 128), ChessMap, grassTile);
    }

    public static int[,] GenerateArray(int width, int height)
    {
        int colorControl = 0;
        int cellFig = 0;
        int[,] map = new int[width, height];

        for (int x = 1; x <= map.GetUpperBound(0); x++)
        {
            cellFig = x / 16;

            if (Mathf.Floor(cellFig) == cellFig) {
                if (colorControl == 0) { colorControl = 1; } else { colorControl = 0; }
            }
            for (int y = 1; y <= map.GetUpperBound(1); y++)
            {
                if (colorControl == 0)
                {
                    map[x, y] = 0;
                }
                else
                {
                    map[x, y] = 1;
                }
                Debug.Log("Map Coordinates x: " + x);
                Debug.Log("Map Coordinates y: " + y);
                Debug.Log("color: " + colorControl);
            }
            if (colorControl == 0) { colorControl = 1; } else { colorControl = 0; }
        }
        return map;
    }

    public static void RenderMap(int[,] map, Tilemap tilemap, TileBase tile)
    {
        //Clear the map (ensures we dont overlap)
        tilemap.ClearAllTiles();
        //Loop through the width of the map
        for (int x = 0; x < map.GetUpperBound(0); x++)
        {
            //Loop through the height of the map
            for (int y = 0; y < map.GetUpperBound(1); y++)
            {
                // 1 = tile, 0 = no tile
                if (map[x, y] == 1)
                {
                    tilemap.SetTile(new Vector3Int(x, y, 0), "TileSheet_" + TileNum + ".asset);
                }
            }
        }
    }
}

Where I need help is the loading of the asset, referencing the asset, and setting of the asset.

I only need this script once, because after it's done, hopefully the GameObject can remember (as if I used the Tile Palette tool).

sentences:
UI Dropdown - Is it possible to have a custom value type instead of an index? I'm using the UI Dropdown component which lets you set the text of an option (OptionData) only.  The value of an option is the index position in the options list, so there is no way to set this.

My problem is that I have a dictionary<string, tile> that I use to populate the dropdown options, but I would like the value of the option to be the id of the tile class, not the index position.

Edit:

I know I can access elements from the list by using the value (index).

list[dropdown.value].id

But I wanted to see about extending the dropdown with this small change, as I have some other changes I would like to make, but wanted to start with something simple first just to get an idea of what is possile.

I do not want someone to post a full code solution.  Am mostly after some pointers.  Looking at the dropdown class, I don't see how I can extend it to modify some things (value in this case), it looks like I would have to implement by own version?

Some code will make this a little clearer I think:

// All tiles into list.
List<Tile> list = new List<Tile>(mydictionary.Values);

// Sort all tiles based on the tile name.
list.Sort((x,y) => x.name.CompareTo(y.name));

// Current way to add list to dropdown.
for(int i=0; i<list.Count; i++){
    dropdown.options.Add(new Dropdown.OptionData(){
        text = list[i].name // Tile name (string).
    });
});

// What I want to do.
for(int i=0; i<list.Count; i++){
    dropdown.options.Add(new Dropdown.OptionData(){
        text = list[i].name, // Tile name (string).
        value = list[i].id // Unqiue tile id (string).
    });
});

// Getting changed value
dropdown.onValueChanged.AddListener(delegate {
    Debug.Log(dropdown.value); // Instead of the index selected, I want the tile id
});

Or if the value is needed internally for some reason, then maybe an extra property that can be set and retrieved.

for(int i=0; i<list.Count; i++){
    dropdown.options.Add(new Dropdown.OptionData(){
        text = list[i].name, // Tile name (string).
        tile_id = list[i].id // Unqiue tile id (string).
    });
});

dropdown.onValueChanged.AddListener(delegate {
    Debug.Log(dropdown.tile_id);
});

I took a look at the DropDown class to see if I could extend it and add the "tile_id" option in, but I got completely lost on what to do, as I am still quite new to C#.

https://bitbucket.org/Unity-Technologies/ui/src/a3f89d5f7d145e4b6fa11cf9f2de768fea2c500f/UnityEngine.UI/UI/Core/Dropdown.cs

https://docs.unity3d.com/ScriptReference/UI.Dropdown.html

sentences:
Transform 3D vectors between coordinate systems I've got 6 points in 3D space: A,B,C,D,E,F, that represent 4 vectors. AB is perpendicular to AC and DE is perpendicular to DF.

I need to find a transformation matrix M, that transforms AB to DE and AC to DF. In other words: M⋅AB=DE, M⋅AC=DF

If no scaling was involved, this could be solved with a simple rotation matrix. But since the ratios |AB|/|DE|, |AC|/|DF| might be different, I'm not sure how to proceed.

sentences:
SNES Bung Game Doctor, add RAM retention modification (battery backup) Firstly I'd like to say that this doesn't seem like the right "forum" for this question as it actually doesn't relate directly to the development of games.

As this is my first post on 'game development', I cannot include more links - sorry.

I recently obtained a Game Doctor SF7 ("Professor SF2" in the US I believe) backup unit for the Super Nintendo, and I'd like to add battery backup to it.

Quick background

This first model (SF1) unit was designed by Bung Enterprises  starting in 1994. It was placed on top of the SNES (interfacing with it via the standard cartridge slot) and allowed backup of SNES cartridges to floppy disk and PC(via a straight-through DB-25 M/M cable).

The unit can store the cartridge ROM, SRAM ("Save" RAM - used by many cartridges to store save games) as well as complete SNES RAM onto its own (expandable) RAM so that one can later dump this to floppy/PC, or to simply keep the games retained in memory for quick recall during development/gaming.

More interestingly, it can download ROM and SRAM data from a PC on most modern platforms thanks to the ucon64 project; this is of course of great interest if you want to actually do some SNES development on real hardware (which I do)!

Dilemma

The main kink is that the unit does not have any battery backup - if you cut power to the unit, RAM is lost. This wouldn't have been much of a bother in '94 when floppy disks were the bees knees, but nowadays it's very frustrating!

Idea

The idea is to add battery backup functionality to the unit. I've tried to find people who have made similar (or any!) modifications to the unit,  Unfortunately as the machine is very old (and has more modern, "non-programming" everyday alternatives) it's very hard to find any information at all - most of the websites I've found which do have some information have been on archive.org!

Finding information

There are a number of reasons for it being exceptionally frustrating to find information about the unit. Firstly, Nintendo(and others) basically forced Bung out of business about ten years ago, so none of the original sites exist. Secondly, the unit series has different names in the US as compared to Japan - it's called the game doctor sf7 in Japan, and professor SF2 in the US. Thirdly, the majority of the userbase used the unit for the sole purpose of "game backups" and not development/hardware mods.

So,
Has anyone performed such a feat before, got information about it, or simply the hardware know-how to get me on the right track? Am I perhaps thinking this might be easy when it might actually be quite hard (difficulty in retaining power to the RAM versus the entire unit, unforeseen issues, etc)?

Thanks for taking the time!

sentences:
Calculate winner of battle when auto is chosen There are two slightly different scenarios I am interested in and I'l give you examples of each.

The first is like the tournament system in Super Smash Brothers Melee, when there can be dozens of cpu vs cpu battles and it has to choose a winner. This could be done with a random number generator but I feel there is something more there.

The second is in some games, mostly strategy games, you can choose to play a battle or have the computer calculate the battle for you. The game Medieval: Total War comes to mind, where it calculates how many troops you and the computer lose. In these scenarios, it never goes as well as if I had done it myself but I usually win if it is plausible.

What I want to know is, how are these battles are calculated? Does anyone know how it is done, or have an idea of how to implement it?

I had an idea of just doing the battle normally but disabling all graphic display so it would conclude very fast, but I'm not sure this would work too well.

sentences:
Global keyboard states I have following idea about processing keyboard input. We capture input in "main" Game class like this:

protected override void Update(GameTime gameTime)
{
    this.CurrentKeyboardState = Keyboard.GetState();

    // main :Game class logic here

    base.Update(gameTime);

    this.PreviousKeyboardState = this.CurrentKeyboardState;
}

then, reuse keyboard states (which have internal scope) in all other game components. The reasons behind this are 1) minimize keyboard processing load, and 2) reduce "pollution" of all other classes with similar keyboard state variables.

Since I'm quite a noob in both game and XNA development, I would like to know if all of this sounds reasonable.

UPDATE: If someone is interested, actual utility class, as suggested by David Gouveia, I've created can be found here.

sentences:
MonoGame Linux Mouse.SetPosition doesn't work! Having a really weird issue, it seems that no matter what I do I cannot get the Mouse to lock to the center of the screen in MonoGame. I triple checked all the possible noob mistakes, and Mouse.SetPosition does get called. Weirder still, setting Game.IsMouseVisible to false does nothing as well.

        public override void Update(GameTime gt)
        {
            _lastmousestate = _mousestate;
            _mousestate = Mouse.GetState();
            if(LockMouse)
                Mouse.SetPosition(100,100);
            Point distance = new Point(_mousestate.X - _lastmousestate.X, _mousestate.Y - _lastmousestate.Y);
            MouseEntity.Position = new Point(MouseEntity.Position.X - distance.X, MouseEntity.Position.Y - distance.Y);
        }

I'm using Linux Mint 64-bit with Cinnamon.

sentences:
Help developing grid maps I have been working with Tiled and Cocos2d lately but am having problems understanding how Im suppose to be doing the maps.
Tiled is not an image editor, so I create my tileset in Gimp.  However it seems impossible for me to get grid lines that are the same as Tiled and so I dont know prior to importing the image (into Tiled) where the grid lines will be.

See the image below.  Both Tiled and Gimp's grid lines are set to 32px however the grid lines are nothing alike between the two programs

How can I get the grid lines to match so that I can draw stuff knowing how many tiles it will take.  Is there a better program for creating tileset or another way to do it?

sentences:
Where should shaders and lights be in a component-based entity system? Where should I put the shader and the light / shadow calculation? Should that be a component too?

And should the rendering system know how to handle them or should there be a separate light system?

I'm specifically talking about about a 2D system, but it should be the same in for 3D I think.

sentences:
Can i use Soccer/football team names in my web, iphone and android apps? If i don't use logos, player names, sponsors or any images can i use team names in a for profit app? The reason i mention these is that i have seen countless references to images and badges but not the name in text format only.

Eg print the league table or show a fixtures list or show some user stats in relation to a team name in the app.

I read that a court has ruled in 2012 that fixture lists are not copyright-able as they involve pure scheduling logic and no artistic or innovative value. Also i know that logos, shield, images, player names and images etc are copyright-able.

Do team names fall under fair use if it is purely the team name in a fixture list or in a list or teams?

sentences: How To generate spiky terrain in 2D? I am learning game design, and wanted to know how one can automatically generate spiky terrain (something like this: Cavernaut, notice, the terrain at the sides?). I have heard about midpoint displacement algorithm. But How can I apply that to my problem, given that I would also like to increase/decrease the randomness of the terrain. Also, Is there any helpful library for this in libgdx?

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:
Rotate an object to face a point with glm::lookAt I want to rotate an object to face a point, such as the monster look at the player.

For that I've decided to use the glm::lookAt function. However the following does not yield good results:

const glm::mat4 transformation = glm::lookAt(ghostPosition, cameraPosition, glm::vec3(0, 1, 0));
ghost.transformation = transformation;

The ghost is correctly oriented to the player but is located to the world origin.
However the following works correctly (position and orientation):

const glm::mat4 transformation = glm::inverse(glm::lookAt(ghostPosition, cameraPosition, glm::vec3(0, 1, 0)))

But I don't get why I need to inverse the matrix ?

sentences:
How do you add turbulence to a particle system using noise? I have implemented a basic particle system using transform feedback in openGL, hoping to replicate a dust cloud.

I have looked at methods of adding turbulence, such as vortices found here.

But they do not give the desired effect. The guide discusses the idea of using perlin or simplex noise to add turbulence.

But I don't understand how this is done?

Would you use a pre-generated noise texture and take sample data from it?

Or calculate data at run time in the shader?

What is the basic idea behind implementing noise turbulence?

Edit:
My main question would be, how do you get a turbulent velocity from noise values?

sentences:
How minecraft manages interactable blocks (Chest)? I am wondering, how does minecraft handle blocks like chest?

I guess normal blocks are ids in simple array, but how does it store and references blocks with special behaviour?

sentences:
How do I use get_action_strength in Godot? I get the error:

  Invalid call. Nonexistent function 'get_action_strength' in base 'InputDefault'.

extends KinematicBody2D

export (int) var speed = 400
export (float) var rotation_speed = 10

var velocity = Vector2()
var rotation_dir = 0
var stance = 0

func ready():
    Input.action_set_deadzone("left", 0.25)
    Input.action_set_deadzone("right", 0.25)
    Input.action_set_deadzone("up", 0.25)
    Input.action_set_deadzone("down", 0.25)

static func angle_to_angle(from, to):
    return fposmod(to-from + PI, PI*2) - PI

func get_input():
    var left_joy_axis_h = Input.get_action_strength("right") - Input.get_action_strength("left")
    var left_joy_axis_v = Input.get_action_strength("up") - Input.get_action_strength("down")

    rotation_dir = 0
    velocity = Vector2()

    if(Input.is_action_just_pressed("stance")):
        if(stance == 0):
            stance = 1
        else:
            stance = 0
    if(stance == 0):
        velocity = Vector2()
        velocity += Vector2(speed, 0) * left_joy_axis_h
        velocity += Vector2(0, speed) * left_joy_axis_v
        if(angle_to_angle(rotation, velocity.angle()) > 0):
            rotation_dir = 1;
        elif(angle_to_angle(rotation, velocity.angle()) < 0):
            rotation_dir = -1;
        else:
            rotation_dir = 0
    elif(stance == 1):
        rotation_dir = (Input.get_joy_axis(0,7) - Input.get_joy_axis(0,6))

        velocity = Vector2()
        velocity += Vector2(speed, 0).rotated(rotation + PI/2) * Input.get_joy_axis(0,0)
        velocity -= Vector2(speed, 0).rotated(rotation) * Input.get_joy_axis(0,1)

func _physics_process(delta):
    get_input()
    rotation += rotation_dir * rotation_speed * delta
    move_and_slide(velocity)

sentences:
ConstantBuffer in HLSL file While programming and not being able to compile because of a missing Template struct or class in a hlsl file, i tried to search for ConstantBuffer but had no luck.
Is there any light to be shed about it. Ive dug for a while and cannot find anything.
Im in Directx 12 C++
example snippet...
    #define HLSL
#include "RaytracingHlslCompat.h"
#include "RaytracingShaderHelper.hlsli"
#include "RTAO/Shaders/RTAO.hlsli"

Texture2D<float> g_inValue : register(t0);
RWTexture2D<float2> g_outMeanVariance : register(u0);

RWTexture2D<float4> g_outDebug1 : register(u3);
RWTexture2D<float4> g_outDebug2 : register(u4);

ConstantBuffer<CalculateMeanVarianceConstantBuffer> cb: register(b0);

sentences:
How can I read an image from a binary file? I'm trying to put all the assets inside a binary file and then trying to read them from the file itself, without scattering all them around in separate folders to let them exposed. What I'm trying to achieve is something like the way that RPG Maker and Wolf Editor use to join all the images / sounds of the game into a single customized format file (e.g. Data.wolf).

It's a very simple security's method but is enough for what I'm planning.

For now, I have the following code for reading a PNG file inside the binary, that always prints an error's message when it trys to create a new surface from IMG_LoadPNG_RW, saying "Error reading the PNG file."

tString sResult{};
cFile_Manager::tRead_File oRead(sDir, std::ios::binary);

if(oRead.is_open()) {
    tString sLine{};
    while(getline(oRead, sLine)) sResult += sLine + "\n";
    oRead.close();
}else {
    throw cLog("\n\n[ERROR] Wrong dir passed.\n\nDIR: %s\n\n", sDir);
}

SDL_RWops* aRW{};
aRW = SDL_RWFromConstMem(&sResult, sizeof(sResult));

if(!aRW) // Error message

SDL_Surface* aSurface{};
aSurface = IMG_LoadPNG_RW(aRW);

if(!aSurface) // This is where SDL shows "Error reading the PNG file."

EDIT: Omg I made some mistakes, now this is the correctly code. Now it gives a different error: "PNG file corrupted by ASCII conversion"

    char* sBuffer{};
    if(oRead.is_open()) {
        oRead >> std::noskipws;
        oRead.seekg(0, oRead.end);
        int iLength = oRead.tellg();
        sBuffer = new char[iLength];
        oRead.seekg(0, oRead.beg);
        oRead.read(sBuffer, iLength);
        oRead.close();
    }else {
        throw cLog("\n\n[ERROR] Wrong dir passed.\n\nDIR: %s\n\n", sDir);
    }

    SDL_RWops* aRW{};
    aRW = SDL_RWFromConstMem(sBuffer, sizeof(sBuffer));

sentences:
Character jittering with this tile based collision code I have been trying to get my collision code working for hours now but with every resource I have tried my character still jitters. First I tried using the platformer sample but my character still jittered up and down really quickly, even when standing still. Then I took to these forums and found this post and I used his code and eventually found out that in order for his to work you have to:

Move the character's position along the x-axis only.
Check if the character collided with something along the x-axis

Then do the same thing for the y axis. In other words, the character could only move one direction at a time and with my game there are a lot of different forces, velocities, accelerations, et cetera. all pulling on the target at once and this kind of solution didn't really work.

I heavily simplified the code in the sample and ended up with this:

Rectangle playerBounds = GetPlayerBounds(motion.Position.X, motion.Position.Y, characterWidth, characterHeight);

// Get the player's bounding rectangle and find neighboring tiles.
Rectangle bounds = playerBounds;
int leftTile = (int)Math.Floor((float)bounds.Left / TileSize);
int rightTile = (int)Math.Ceiling(((float)bounds.Right / TileSize)) - 1;
int topTile = (int)Math.Floor((float)bounds.Top / TileSize);
int bottomTile = (int)Math.Ceiling(((float)bounds.Bottom / TileSize)) - 1;

for (int y = topTile; y <= bottomTile; ++y) // For each potentially colliding tile,
{
    for (int x = leftTile; x <= rightTile; ++x)
    {
        Tile collision = stage.CustomLayer.GetTile(x, y);

        if (collision.Value == Tile.CollisionTile)
        {
            Vector2 depth = Extensions.GetIntersectionDepth(bounds, collision.Bounds); // Determine collision depth (with direction) and magnitude.

            if (depth != Vector2.Zero)
            {
                if (Math.Abs(depth.Y) < Math.Abs(depth.X)) // Resolve the collision along the shallow axis.
                {
                    motion.Position = new Vector2(motion.Position.X, motion.Position.Y + depth.Y); // Resolve the collision along the Y axis.
                }
                else // Ignore platforms.
                {
                    motion.Position = new Vector2(motion.Position.X + depth.X, motion.Position.Y); // Resolve the collision along the X axis.
                }

                bounds = playerBounds; // Perform further collisions with the new bounds.
            }
        }
    }
}

The code produces the jittering effect as well. I have debugged it for hours and I think I found the cause but I do not know how to fix it.

For example, if the character's Y position is 500 and is found to be colliding with a tile with a depth of 5 pixels, he will be pushed to Y position 495. At this time, though, the loop will continue based off of old topTile and bottomTile values and he may still be found to be colliding with those tiles, and will be pushed up to Y position of 490. Next time this function is called though when the character has moved back down to Y position of 495 due to gravity, he won't be colliding because of different initial topTile and bottomTile values and will continue moving downwards.

I believe this is what causes the jittering effect but I do not understand why it is happening to me. As far as I know, I am using the same algorithm as everyone else and their code doesn't produce any jittering. All my tiles are of equal size (32x32) and I am using the same GetIntersectionDepth method found in the platformer sample.

Thanks to anyone who can help me solve this problem.

sentences:
Find References In Scene of scriptable object unity asset shows incorrect results I'm trying to work out why my game is loading a large sprite atlas that I don't think it should be. The snapshot view of the profiler shows that the atlas is loaded. The references pane shows that it's loaded through a scriptable asset object. That object does indeed reference the sprites in the atlas - but I don't think the object is referenced in the scene at the moment. The game boots to this scene, so the atlas should not be loaded.

I've replicated this profiling on both the editor and on android, so it's not an editor-only thing.

When I right-click on the scriptable object in the project view, while the game is running, and Find References In Scene, it shows a few game objects. None of these objects seem to reference the scriptable object. None even have monobehaviours with fields for this type of scriptable object. Some are new-UI button objects, that have Canvas Renderer, Image and Button scripts only. None of which could be referencing this scriptable object.

Has anyone seen this behaviour before? What's going on?

sentences:
Unity won't slice images properly Okay, so I am very new to Game Development and I imported a .png file(made in Paint) to the assets and that file contains just a circle and an oval, not touching and far apart from each other, both of them coloured blue. When I open the sprite editor and click on splice, then select Automatic and Delete existing options and then click slice, I do not get different sprites, one containing the circle and the other containing the oval. The image isn't sliced at all. I have also set the sprite mode to Multiple, but to no avail.

Can someone help me and tell me what I am doing wrong? The engine I am using is Unity.

This is the image.

sentences:
Formula throwing a ball to destination I am throwing a ball using this:

        double v, vx, vy, alpha, t2 = 0;
   if (Keyboard.GetState().IsKeyDown(Keys.Up))
        {
            alpha = MathHelper.ToRadians(60f);
            v = -1230d;
            vy = v * Math.Sin(alpha);
            vx = v * Math.Cos(alpha);

            ball2pos.Y = (float)((vy * t2) + (g * t2 * t2 / 2)) +  graphics.GraphicsDevice.Viewport.Height - ball2.Height;
            ball2pos.X = (float)(-vx * t2);
            t2 = t2 + gameTime.ElapsedGameTime.TotalSeconds; }

It works without a problem. It calculates the throw including the gravitation (g). vx is how much it moves per second on the X,vY the Y accelerration (running against gravity), v the strength of the throw and t2 the current time.

But I want to change the formula to throw the ball to a given destination. Say I want to throw my ball from 60 degrees to a target. How much "strength" do I need for it?

What would be the formula? I'm not really good at figuring out that and google doesn't give me what I want.
To simplify let's assume that the Y of source and target are the same:

Given: Angle, SourceLocation, TargetLocation, Gravitation

Looking for: Strength

sentences:
Why does Unity's MeshCollider only use SharedMesh? For components like MeshRenderer, Unity uses two references to mesh through script--mesh, and sharedMesh. My understanding as of yet that setting a "sharedMesh" will affect every GameObject that uses that component, whereas "mesh" alone will only affect a particular instance of that component. Same goes for "material" and "sharedMaterial".

However, for MeshCollider, the only thing available is "sharedMesh". The field "mesh" does not exist. I can work with this, but from a policy standpoint it seems very strange to me. Is there a reason that MeshCollider is treated differently?

I may be overlooking something obvious, but a Google search didn't help me.

sentences:
Android and iPhone Global Market Share I made the mistake of making my game Android only (via libGDX). A lot of people are asking me for an iPhone/iPad version. Sigh. (Next time, I'll use Unity or Corona SDK.)

I've searched high and low, and cannot find much (relevant or recent -- beyond 2010) about market share of these two phones, globally.

Where can I find the relative market shares of these phones, globally, to some degree of accuracy? It doesn't have to be 100% accurate, as long as it remains recent (i.e. updated every few months). Ideally, this is something like Android's Platform Versions, albeit it tells me about different OSes.

I really want to know, because when I choose a development platform, it might matter (if I make the mistake of not using a cross-platform development tool).

sentences:
How could I implement destruction of bases in Space Invaders type game? What approaches could you use to implement the the gradual destructions of bases/shields in a top down shooter type game similar to Space Invaders?

The simplest approach could be to use a series of sprites that are replaced to show increasing deterioration after each missile hit.

A more advanced approach might be to randomize the deterioration pixel by pixel after each hit, but I'm not sure how to implement an approach like this. Does anyone have any suggestions for how to approach something like this?

sentences:
Tiny Wings - Placing items I'm currently developing a Flash game like 'Tiny Wings'. I have a lot of work done, but i'm currently working on placing the items ( coins and obstacles ) on the terrain.

My player it is moving on a auto-generated terrain (based on Emanuele Feronato's tutorials) so every time the player's x position is greater than (screenWidth + x) another hill is generated and so on.

I'm currently having problems placing the items in a correct angle and put 5 or more items together on a hill.

Could you please help me with this?

Thanks,
Regards.

PS: This is the URL to the Emanuele Feronato post and the code to make the hills
http://www.emanueleferonato.com/2011/10/04/create-a-terrain-like-the-one-in-tiny-wings-with-flash-and-box2d-%E2%80%93-adding-more-bumps/

sentences:
How to move a line of sprites in a sine wave? So, I'm spawning a horizontal line of enemies that I would like to have move in a nice wave.  Currently I tried:

 Enemy.position.X += Enemy.velocity.X;
 Enemy.position.Y += -(float)Math.Cos(Enemy.position.X / 200) * 5;

This...kind of works.  But the wave is not a true wave.  The top and bottom of one pass are not the same (e.g. 5 for the top, and -5 for the bottom (I don't mean literal points, I just meant that it's not symmetrical)).

Is there a better way to do this?  I would like the whole line to move in a wave, so it looks fluid.  By that, I mean that it should look like each enemy is "following" the one in front of it.  The code I posted does have this fluidity to it, but like I said, it's not a perfect wave.

Any ideas?

Thanks in advance.

sentences: Why do games usually don't allow arbitrary window resize? Why do games usually only allow some specific resolutions, instead of allowing arbitrary window resizing? Are there any technical difficulties for arbitrary window resizing?

sentences:
CocoonJS draws shadow around tiles I am using CocoonJS launcher on iOS for a simple tiled game. Calling canvas drawImage for tiles adds a shadow or ghost border around tiles. See this screenshot:
http://martindrapeau.github.io/cocoon-mario/img/screenshot.png

The canvas is 960 pixels wide. Using viewport meta tag:

Using CocoonJS Launcher 2.1.1.2 on iOS 8 (iPad mini and iPhone 6).
Same behavior with anti-aliasing turned off.
Same behavior with Scale Aspect Fit and No Scale.

If someone could help me eliminate this problem, would be great.

Extra notes:
See here for the zip to try it out in the CocoonJS launcher:
http://martindrapeau.github.io/cocoon-mario/cocoon-mario.zip

And the HTML5 game to play in your browser. Notice it looks find in any browser.
http://martindrapeau.github.io/cocoon-mario/

sentences:
Translating ChainShape to world coordinates according to touch drag input I'm trying to draw a ChainShape according to touch screen coordinates, however the coordinates are slightly off from my touch coordinates. I translate the chain drawn on the screen to world coordinates but don't think I've done it correctly.

I tried setting the shape's position to the first vertex but it positions it even further from the original touch coordinates. Can someone please help me understand where I'm going wrong?

public class Play implements Screen {
    private static final float TIMESTEP = 1 / 60f;
    private static final int VELOCITYITERATIONS = 8, POSITIONITERATIONS = 3;

    private Box2DDebugRenderer debugRenderer;
    private OrthographicCamera camera;
    private PolygonSpriteBatch batch;
    private World world;

    private List<Float> chain_verts = new ArrayList<Float>();
    private float[] chain;

    @Override
    public void show() {
        world = new World(new Vector2(0f, -9.81f), true);
        debugRenderer = new Box2DDebugRenderer();
        camera = new OrthographicCamera();
        batch  = new PolygonSpriteBatch();

        InputProcessor input_0 = new GestureDetector(new Gesture() {
        }) {
            @Override
            public boolean touchUp(float x, float y, int pointer, int button) {
                if (chain_verts.size() != 0) {
                    chain = new float[chain_verts.size()];
                }

                for (int i = 0; i < chain_verts.size(); i++) {
                    chain[i] = chain_verts.get(i);
                    System.out.print(chain[i] + " ");
                }

                ChainShape chainShape = new ChainShape();
                chainShape.createChain(chain);

                Vector3 mouse = new Vector3();
                camera.unproject(mouse.set(Gdx.input.getX(), Gdx.input.getY(), 0));

                BodyDef bodyDef = new BodyDef();
                bodyDef.type = BodyType.StaticBody;
                bodyDef.position.set(mouse.x , mouse.y);

                FixtureDef fixtureDef = new FixtureDef();
                fixtureDef.shape = chainShape;

                world.createBody(bodyDef).createFixture(fixtureDef);

                chain_verts.clear();
                chainShape.dispose();

                return super.touchUp(x, y, pointer, button);
            }

            @Override
            public boolean touchDragged(float x, float y, int pointer) {
                chain_verts.add(x);
                chain_verts.add(Gdx.graphics.getHeight()-y);
                return super.touchDragged(x, y, pointer);
            }
        };

        Gdx.input.setInputProcessor(input_0);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        world.step(TIMESTEP, VELOCITYITERATIONS, POSITIONITERATIONS);

        camera.position.set(0, 20, 0);
        camera.update();

        batch.setProjectionMatrix(camera.combined);

        debugRenderer.render(world, camera.combined);
    }

    @Override
    public void resize(int width, int height) {
        camera.viewportWidth = 1200;
        camera.viewportHeight = 800;
    }

    @Override
    public void pause() {}

    @Override
    public void resume() {}

    @Override
    public void hide() {
        dispose();
    }

    @Override
    public void dispose() {
        batch.dispose();
        world.dispose();
        debugRenderer.dispose();
    }
}

sentences:
Keeping the CCSprite on the screen In my cocos2d app I have a CCSprite moving on the screen but it moves off the screen. How can I prevent the CCSprite from moving off the screen?

Thanks

sentences:
Unity point light baking into lightmap I'm developing a puzzle with a ball with cracks on it. Inside the ball there's a point light. Its light rays come out of the cracks and hit some platforms (walls/ceiling/floor).

To solve the puzzle the player must rotate the ball to match the light coming out of the cracks with some pre-lit pattern on the platforms.

I don't know how to do the pre-lit pattern. I don't want it to be manually done using a texture editing tool like Photoshop or GIMP. I remembered this could probably be done using light baking. I think what I need is to bake the light from only that point light into a lightmap and use it only on those platforms, but don't know how to do that.

Can someone help me with a solution?

sentences:
Realistic slow-falling snow algorithm? Is there a good algorithm that simulates falling snow? I'm particularly interested in snow that falls slowly, so it doesn't quite fall in a straight line but deviates a bit. Maybe even including simulation of flurries (drafts of wind), variable size, etc. Are there any papers or articles on an algorithm that mimics real-life snow movements or simulates it in the context of a game?

I'm particularly interested in a 2D algorithm, but I imagine any algorithm can be taken to 3D easily.

sentences:
TypeError: unsupported operand type(s) for /: 'tuple' and 'int' Error I wanna make a sprite appear on my cursor. However, I get this error:
Traceback (most recent call last):
  File "C:\Users\Lenovo\Desktop\Tap Simulator\main.py", line 60, in <module>
    screen.blit(hitmarker, (pygame.mouse.get_pos() - hitmarker.get_size() / 2))
TypeError: unsupported operand type(s) for /: 'tuple' and 'int'

screen.blit(hitmarker, (pygame.mouse.get_pos())) makes it appear right bottom of your cursor, so don't try it.
Source code:
import pygame, sys, time
from pygame.locals import *
from millify import millify,prettify

pygame.mixer.init()
pygame.init()
music = open("music.txt", "r+")
pygame.mixer.music.load("soundtrack.wav")
x = int(music.read())
WHITE = 255,255,255
font = pygame.font.SysFont(None, 44)
cpsecond = open("clickpersecond.txt", "r+")
cps = int(cpsecond.read())
baltotal = open("totalbal.txt", "r+")
totalbal = int(baltotal.read())
totalbalM = prettify(totalbal, '.')
clock = pygame.time.Clock()
w = 800
h = 600
screen = pygame.display.set_mode((w,h))
pygame.display.set_caption('Tap Simulator')
Loop = True
background = pygame.image.load("Background.jpg")
egg = pygame.image.load("egg.png")
resized_egg = pygame.transform.scale(egg, (282, 352))
text = font.render(f'Your total clicks are {totalbalM}', True, WHITE)
pygame.mixer.music.play(-1,0.0)
volume = pygame.image.load("volume.png")
mute = pygame.image.load("mute.png")
resized_volume = pygame.transform.scale(volume, (100, 100))
resized_mute = pygame.transform.scale(mute, (100,100))
icon = pygame.image.load("ico.ico")
hitmarker = pygame.image.load("hitmarker.png")
resized_hitmarker = pygame.transform.scale(hitmarker, (50, 50))

pygame.display.set_icon(icon)

while Loop:
    for event in pygame.event.get():
        if event.type == QUIT:
            Loop = False
        if event.type == MOUSEBUTTONDOWN:
            if event.button == 1: # 1 == left click
                egg_rect = resized_egg.get_rect(topleft = (260,150))
                vol_rect = volume.get_rect(topleft = (700,500))
                if vol_rect.collidepoint(event.pos):
                    x += 1
                    if x > 2:
                        x = 1
                if egg_rect.collidepoint(event.pos):
                    totalbal += cps
                    totalbalM = prettify(totalbal, '.')
                    screen.blit(background, (0,0))
                    if x == 1:
                        screen.blit(resized_volume, (700,500))
                    if x == 2:
                        screen.blit(resized_mute,(700,500))
                    screen.blit(text, (235,557))
                    screen.blit(resized_egg, (260,150))
                    screen.blit(hitmarker, (pygame.mouse.get_pos() - hitmarker.get_size() / 2))
                    pygame.display.flip()
                    text = font.render(f'Your total clicks are {totalbalM}', True, WHITE)
                    print("Your total clicks are", totalbalM, end="\r")
                    time.sleep(0.07)

    #print(pygame.mouse.get_pos()) #to get mouse pos
    screen.blit(background, (0,0))
    screen.blit(resized_volume, (700,500))
    if x == 0:
        screen.blit(background, (0,0))# [...] draw something different
    elif x == 1:
        pygame.mixer.music.unpause()
        screen.blit(resized_volume, (700,500))
    elif x == 2:
        pygame.mixer.music.pause()
        screen.blit(background, (0,0))
        screen.blit(resized_mute,(700,500))
    screen.blit(text, (235,557))
    screen.blit(resized_egg, (260,150))
    pygame.display.flip()
    pygame.display.update()
    clock.tick(30)

with open("totalbal.txt", "w") as baltotal:
    baltotal.write(str(totalbal))
baltotal.close

with open("music.txt", "w") as music:
    music.write(str(x))
music.close
pygame.quit()
sys.exit()

sentences:
How do I correctly implement Java animations? Here's what I have so far.

//Inside the Animations class
public void update() {
    timer +=System.currentTimeMillis() - lastTime;
    lastTime = System.currentTimeMillis();

    if(timer>speed) {
        Playing=true;
        index++;

        timer=0;
        if(index>=frames.length) {
            index = 0;
            Playing=false;
        }
    }

}//Getters and setters down

In the main state

    @Override
public void update() {
    Ability.update();
        if(AttackP.isPlaying()) {
            AttackP.update();

        }

    //gets
    HealthCheck();
    getMousePosition();
}

...

    if(turn==true) {//Only run when it's the players turn
        if(MousePressed&&!AttackP.isPlaying()&&!AttackingP) {
//if left clicked when animations are not playing and when AttackingP is false
            buttonCheck(g);//next
        }else if(!MousePressed) {//set Attacking to false when mouse not pressed
            AttackingP=false;
        }

...

private void buttonCheck(Graphics g) {
    if(MouseX<501&&MouseX>420&&MouseY<531&&MouseY>500){//if the mouse is in this button

        AttackingP=true;
        StartAnimation(g);

        }

...

    private void StartAnimation(Graphics g) {

    g.drawImage(getCurrentAnimationFrame(),175,0,512/2,512/2, null);//play animation
    BossHealth-=5;
    turn=false;

}

public BufferedImage getCurrentAnimationFrame(){
    return AttackP.getCurrentFrame();
    }

The problem is, when I press the button, the animation only renders 1 frame, not the others in the BufferedImage array.

Help appreciated, I've been stuck on this part for 2 days now.

sentences:
Why is concept art not signed by the author? I am a starting concept artist who would like to enter the gaming industry. I noticed that some AAA titles show their concept art with no artists signature (only a reference to game the game, such as for Star Wars The Old Republic: 2013 ALL RIGHTS RESERVED BioWare, LucasArts).

I  asked myself a question, what possible harm could my autograph cause on the public concept art if I am not a well known concept artist such as Adam Adamowicz (who did concepts for Skyrim). Why would a prospective boss tells me not to leave my "finger print" on the picture despite, the fact that I am a very talented artist?

sentences:
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:
MonoGame not all letters being drawn with DrawString I'm currently making a dynamic user interface for my game and are setting up having text on my buttons. I'm having an odd issue where, when i use a specific piece of code to determine the text position, it will not render all of the text passed to DrawString. Even weirder, is if i insert another DrawString after this, drawing more text at a different place, different parts of the text will be drawn.

The code for drawing my button with the text attached is:

public override void Draw(SpriteBatch sb, GameTime gt)
{
    sb.Draw(currentImage, GetRelativeRectangle(), Color.White);
    sb.DrawString(font, text,
        new Vector2(this.GetRelativeDrawOffset().X + this.Width / 2 - font.MeasureString(text).X / 2,
            this.GetRelativeDrawOffset().Y + this.Height / 2 - font.MeasureString(text).Y / 2), textColor);
}

The methods in the creation of the Vector2 simply get the draw position of the button. I'm then doing some calculation to center the text.

This produces this when the text is set to 'Test':

And when i enter this piece of code below the first DrawString:

sb.DrawString(font, "test", new Vector2(500, 50), Color.Pink);

I should mention that that grey square is being drawn in the same spritebatch, before the button and the text.

Any ideas as to what could be causing this? I have a feeling it may be due to draw order, but i have no idea how to control that.

sentences:
What 3D level development tools are available to indie developers? People who build in Unity or UDK have immediate access to a 3D level editor. People who build their games in XNA or from scratch have no such thing. I'm looking for 3D level development tools available to these people.

It must be free, or affordable to an indie developer. I leave the term "affordable" open to interpretation.
It must not be restricted to a specific game engine. I should be able to build my game from scratch and use this level editor to construct my levels.
It should have a file format that comes with an interpreter, or sufficient documentation for me to be able to build my own interpreter.
Open source and/or modifiable/customisable is a plus, but not a requirement.

I know beggars can't always be choosers, but I'm hoping there's something high quality out there.

If there isn't, maybe someone would like to jump on that opportunity and fill the void.

sentences:
How to code a multi level isometric map? I have already worked with isometric grids in the past, but in my current project I found an issue I am not sure on how to solve. I am trying to produce something similar to what's in the below screen:

What I am having trouble with is how to represent the tiles. With a flat 2d isometric grid all you need is an 2d array (even if you have elevation you can just have a z variable in there to track it and then render based on the z variable plus the z variable of nearby tiles). I am not sure how to proceed with this, however.

My plan was to have the map composed of 4-sided polygons that can be placed anywhere, and have a (x, y, z) position. Rendering is easy enough (start with lowest z tiles, go up to the next level, add any stairs that end on that level, keep repeating until all tiles are rendered).

However, how can I do collision checking? Checking if a point (a player) is inside the polygon is not too difficult, but how can I know whether he can move to another tile?

What would be best:

Have tiles holding a pointer to neighbouring tiles? (Seems like a lot of trouble to code for the editor).
Sort the array by Z-level, then search through the array for tiles that are close enough? (Seems slow)
Something else entirely?

sentences:
How can I change the dimensions of collision volumes showed in UE4's physics asset tool? How can I change the dimensions of the capsule for one bone in the physics assets tool?

The problem is that bones not connected by joints have overlapping collision volumes in the mannequin that comes with the starter content, which causes those body parts to apear dislocated or out of place when the simulation is running.

For instance in this image the pelvis and the middle bone in the spine (Spine 2) are overlapping.

So, when the simulation runs Pelvis and Spine 2 get pushed apart reducing the overlapping to a contact point.

sentences:
Delay in connecting to server in Unity I have a button, when I press the connect button, it gets connected to the server. When I press the connect button again, it's getting delay in connecting to the server. Below is the code to connect to the server:

public void setupSocket() {
    try {
        socket = new Client(Host, Port);
        theStream = socket.GetStream();
        theWriter = new StreamWriter(theStream);
        theReader = new StreamReader(theStream);
        socketConnect = true;
    }
    catch (Exception e) {
        Debug.Log("Socket error:" + e);
    }
}

And I have one more issue. When I take the desktop build of the app and opened the app, clicked button, it's getting connected to the server, but when I click the button again it's not getting connected. But when I close the app, it displays the connection message and also close message on the server. Is there anything to be set when taking the desktop build?

Can anybody help out what will be the problem?

sentences:
How do I best solve multiple component modifications via a single event? I'm trying to solve multiple component modifications via a single event. Is there a better way of handling this?

I have an a label entity that cares about when a shield entity's hitpoints component is modified (damage, regeneration, etc).

The label will need to change

its text to display the current % of shield remaining.
its text color to display the severity of shield remaining.

When my ShieldSystem resolves the hitPoints component, the below code runs. For eah type of modification I plan to listen for, I need to add a new if-statement to the for-loop. This means I have a bunch of duplicated code between systems if more than one wants to modify any listening text component, sprite component, etc.

for(int i =0; i < listeners.size(); i++)
{
    if(listeners.count(MessageType::CHANGE_TEXT) == 1)
    {
        std::vector<Entity*> entities =  listeners[MessageType::CHANGE_TEXT];
        for(int j; j < entities.size(); j++)
        {
            Entity* e = entities[j];
            MessageInfo* messageInfo = new MessageInfo(MessageType::CHANGE_TEXT, e, "Some Text");
            MessageCenter::Dispatch(messageInfo);
        }
    }

    // Add an If(listeners.count(MessageType::CHANGE_TEXT_COLOR)...

    // Add an If(listeners.count(MessageType::CHANGE_SPRITE_RECT)...

    // etc

}

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:
Box2D No Gravity when moving against wall I use Box2D in my current project and I have a problem with the gravity..

You can see my problem here: https://www.youtube.com/watch?v=2_kv9LkKwN4&feature=youtu.be

when i jump normal everything is fine, but when I press against a wall while I jump the body doesn't fall down after I release the move key in the direction of the wall the body falls down.

This is my move code:

public void moveByLinear(float x, float y) {
    linearMovement.set(x, y);

    body.setLinearVelocity(linearMovement);
}

and

moveByLinear(movespeed, getBody().getLinearVelocity().y);

movespeed is 8

sentences:
Sprite collision with color? Is this possible?

To elaborate, I am making a PacMan offshoot. Essentially it is a "zoomed in" version of the game, but the board is randomly generated. I have 11 .png files each to be used as a background for different hallway shapes. You have your straightaways, corners T junctions and cross intersection. They are very simple, each has a black background and the walls are blue. What I am looking for is a way to stop the player from walking on the blue parts of each image. Is that possible?

My current set-up is that I have a Piece class that holds the image, Entry points as bools (up down left right) for when I randomly select the image to be used so that a path can be created, size, etc. I then have a Board class that holds a list of Pieces (size 11 (One for each image))) and then 2D an array "board" (currently 9x9) that randomly but intelligently generates the map. When it comes to player pathing, I was manually going to add to the Piece class code that adds invisible rectangles over the blue walls and then have the Player class, or some other class, check for collision. This would take a ton of extra code because each image is different so each would need to be manually done.

I was just thinking there must be an easier way to do this, and the whole color idea occurred to me. If i could just check if it intersects the blue and then change its position back that would be much easier.

I am at work currently, but if there is any code you would need to see, or any other helpful information let me know and I will add it as soon as I get home!

TL;DR Is there a way to check collision via color, or add rectangle automatically over a specific color.

sentences:
Map editor undo function - Not actually setting values to tiles I'm currently attempting to implement an undo/redo function for my map editor for a tile-based 2D platformer game made with XNA. I've found a lot of resources online about this and decided to try to write my own code for it to gain a better understanding of how it works.

My issue is when I pass the my tile's information into a stored "Action" and change the data within the newly created Action, it does not actually change the data in my tiles.

Below is the Action struct and the UndoBuffer class where I modify the tile's data based on the stored actions that I created elsewhere:

public struct Action
{
    public object[] StoredItem { get; set; }
    public object[] ModifiedItem { get; set; }
}

public class UndoBuffer
{
    private readonly List<Action> _undoBuffer;
    private readonly List<Action> _redoBuffer;

    public UndoBuffer()
    {
        _undoBuffer = new List<Action>();
        _redoBuffer = new List<Action>();
    }

    public void StoreAction(object[] storedItem, object[] modifiedItem)
    {
        var action = new Action {StoredItem = storedItem, ModifiedItem = modifiedItem};

        _undoBuffer.Insert(0, action);
    }

    public void Undo()
    {
        if (_undoBuffer.Count == 0) return;

        _redoBuffer.Insert(0, new Action {ModifiedItem = _undoBuffer[0].ModifiedItem, StoredItem = _undoBuffer[0].StoredItem});

        for (int i = 0; i < _undoBuffer[0].StoredItem.Count(); i++)
        {
            Action tempAction = _undoBuffer[0];
            tempAction.ModifiedItem[i] = tempAction.StoredItem[i];
            _undoBuffer[0] = tempAction;
        }

        _undoBuffer.RemoveAt(0);
    }
}

Here's how I'm passing the data in to the class above:

private void ReplaceTile(Tile oldTile, TileInfo tileInfo, bool storeAction = true)
{
    int tileX = (int)oldTile.Position.X / Tile.Width, tileY = (int)oldTile.Position.Y / Tile.Height;
    if (tileX < 0 || tileY < 0 || tileY >= _tileData.Tiles.Count || tileX >= _tileData.Tiles[tileY].Count) return;

    var storedTiles = new ArrayList();
    var modifiedTiles = new ArrayList();

    if (storeAction)
        storedTiles.Add(_tileData.Tiles[tileY][tileX].TileInfo);

    _tileData.Tiles[tileY][tileX].TileInfo = tileInfo;

    if (storeAction)
    {
        modifiedTiles.Add(_tileData.Tiles[tileY][tileX].TileInfo);
        _undoBuffer.StoreAction(storedTiles.ToArray(), modifiedTiles.ToArray());
    }

    _saved = false;
}

And here is the actual Tile class and its TileInfo struct:

public struct TileInfo
{
    public string ViewName;
    public int Frame;
    public TileCollision Collision;
    public CollisionType CollisionType;
    public TileProperty TileProperty;
    public SpriteEffects Effects;
    public Color TileColor;
    public float Rotation;
    public float Layer;
}

[Serializable]
public class Tile
{
    public TileInfo TileInfo;
    public Vector2 Position;

    public const int Width = 8;
    public const int Height = 8;

    public static readonly Vector2 Size = new Vector2(Width, Height);

    public Tile CreateTile(TileInfo tileInfo, Vector2 position)
    {
        var tile = new Tile
        {
            TileInfo = tileInfo,
            Position = position
        };

        return tile;
    }
}

So essentially, I just need the UndoBuffer class to actually change the data within the TileInfo structs that are passed into it, and not change a boxed copy of them.

sentences:
Seeking to streamline message system in my engine (C++) So been building up my own custom engine, and one core bit of it is a message system to keep all the systems disconnected.

As it currently stands I have it take in a pointer to every other system, and then during their creation they register with the message system for what they want to receive.

The problem is the message system right now knows exactly what each system is, and I would like to simplify that.

My goal is to have any system sign up for messages, without the message system needing to care about the type of system. I thought about adding a "message class" parent class wrapper to put around every system, but that feels more like a jury rig then a fix, and I would like to avoid having layers of class wrappers.

Anyone have any thoughts how to simply this?

sentences:
2d engine/library for android in C# I'm looking for a good 2d engine or library (that supports physics) for Android. I have a restriction - language should be C#.
It's not a requirement to use Mono Droid, but it seems that it is an only way.

What can you suggest?

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:
What is a good free "game development organisation" site? I'm searching for a site that will help me to design a game. I don't have a development team in the same location. They are all located somewhere over the world. I am searching for a kind of site that allows people to post ideas and suggestions, but moreover to have control over who has the control over what. For example, one makes the graphics and has several people "under" him that can get a certain task to make a certrain graphic. This has to be easily found on this site.

Does anyone know a good site like this? I prefer it to be free.

sentences:
How to project textures onto an animated model? I'm trying to figure out exactly how to project textures onto an animated  model. I've taken a look at L4D2's wound's white paper. But their method doesn't exactly explain how they went about this.

I've tried using the old school method to create a mesh and attach it to the object... But that would require the GPU to store that data for a long period of time, and recall it correctly for the animated model. On top of that there's the Z-fighting problem with it.

I've tried the Deferred shading method. But I can't get that to work correctly either. My set up requires some form of filter in order to prevent the decal from projecting onto other models. And then should a moving body part cross over the volume, it gets rendered onto that as well, which is not as desired.

sentences:
Unity2D: Sprite Mesh Lighting Issue I am trying to make my 2D mesh render sprites with the same brightness as the original file.

On the below picture, the mesh on the left is darker than the UI Image on the right, which is an exact likeness of the original file. How can I make the mesh as bright as the Image?

So far, I've been looking into the following potential culprits:

Shader attached to the Mesh
Global lighting settings
Mesh renderer lighting settings

The above image is with Environment Lighting > Ambient Color at #FFFFFF.

Environment Lighting > Ambient Color > Intensity doesn't help.
Increasing the shader's emissions can offset the darkness but it's not an ideal solution.

All other lighting settings both globally and on the Mesh Renderer are default.

At this point, I'm lost :/
Any help would be much appreciated!

sentences:
Strategies for dealing with crowds at choke-points I've recently switched my game engine over from steering behaviours to impulse based movement with proper time based collision resolution. This has solved so many problems (no more tunnelling, yay) and made the simulation a great deal more stable. However, with the stability has come a new problem.

The three balls started their journey near the bottom of the image, their target was where the pink ball has stopped. On the way the red and green balls have become stuck at the choke-point in the wall.

Before, I could rely on floating point errors and the general instability of steering behaviours to make the green and red balls jostle each other until they managed to get through the choke point. Now with proper collision resolution, the forces acting upon the balls cancel each other out which results in the balls remaining perfectly still.

What methods are commonly used to resolve such situations? Perhaps some sort of priority queueing system would work, though I can see it becoming complex once I need to decide priority between more than 2 objects.

sentences:
How to make player move into next level in pygame When my player reaches at the end of the map, I want it to enter to the next level. I've created the first level and it all works fine. All I want to do is that when player finishes 1st level I want to load another map on which it can move forward. But I'm not able to understand how to do it.
Here is piece of my code:
def runGame(theGame):

    theGame.clock.tick(FPS)

    # This function consists code for Events
    theGame.events()
    # This function consists code from enemy hit events
    theGame.hit_or_not()
    # This function consists code for player movements
    theGame.movements()
    # This function consists code for drawing the sprites over the screen
    theGame.redrawGameWindow()

def readyGame(run, gameOver):
    game = Game()

    while run:
        runGame(game)

        keys = pygame.key.get_pressed()

        if keys[pygame.K_x]:
            game = Game()
        elif keys[pygame.K_ESCAPE]:
            run = False
        pygame.event.pump()

        if gameOver:
            runGame(game)

readyGame(True, False)

Here is my whole code which is responsible for my 1st level please kindly check it - https://pastebin.com/zMFetAd6 (Game Class)
Do I have to create another class for 2nd level like I did for the 1st level?
Can anyone please help me out in this issue? Thanks in advance!

sentences:
What is the best practice for creating a system of platforms that does not use Unity's tag system? Right now I'm finalizing my character raycast controller, but have come to the realization that Unity's tag system, which I'm using as a way for my raycasts to detect different types of platforms, is limited and may cause issues further into development when I start adding more platform types, or use the controller for AI (do I want my AI to be affected the same way the player is affected by platforms?).

So far I've got a bunch of different platforms, like passable platforms, icy blocks and jump boosts. These all work great, and change the character's default movement parameters, but I rely on things like this in order for changes to be made:

if (hit.collider.tag == "platformPassable")

Is there a better way to do this? I am not the most experienced programmer, but my initial solution was to create a Platform class with a TypeOfPlatform enum that will allow me to make sub classes that implement changes based on this type, but I'm worried that having to access a component for each raycast on a platform on which the character or AI is standing will lead to horrible performance issues. Would I have to reference the base class in the character controller, or would I access the character controller in the base class?

I'm just not very comfortable with inheritances like this and would appreciate some guidance.

Update: here's a segment of my code (there are many other likes this) that hopefully helps illustrate what I believe will become problematic as I continue development:

private void MoveVertically(ref Vector3 deltaMovement)
{
    float directionY = Mathf.Sign(deltaMovement.y);
    float rayLength = Mathf.Abs(deltaMovement.y) + skinWidth;

    for (int i = 0; i < verticalRayCount; i++)
    {
        Vector2 rayOrigin = (directionY == -1) ? raycastOrigins.bottomLeft : raycastOrigins.topLeft;
        rayOrigin += Vector2.right * (verticalRaySpacing * i + deltaMovement.x);

        RaycastHit2D hit = Physics2D.Raycast(rayOrigin, Vector2.up * directionY, rayLength, collisionMask);

        Debug.DrawRay(rayOrigin, Vector2.up * directionY * rayLength, Color.red);

        if (hit)
        {
            if (hit.collider.tag == "platformPassable" || hit.collider.tag == "icePassable")
            {
                State.IsCollidingWithPassablePlatform = true;

                if (directionY == 1)
                {
                    State.IsCollidingAbove = false;
                    continue;
                }

                if (CanJumpDown)
                {
                    State.IsCollidingBelow = false;
                    continue;
                }
            }

            if (hit.collider.tag == "iceNormal" || hit.collider.tag == "icePassable")
            {
                Parameters.accelerationTimeGrounded = 1.0f;
                Parameters.accelerationTimeAirborne = 3.0f;
            }

            else if (overrideParameters == null)
            {
                Parameters.accelerationTimeGrounded = defaultParameters.accelerationTimeGrounded;
                Parameters.accelerationTimeAirborne = defaultParameters.accelerationTimeAirborne;
            }

            deltaMovement.y = (hit.distance - skinWidth) * directionY;
            rayLength = hit.distance;

            if (State.IsClimbingSlope)
            {
                deltaMovement.x = deltaMovement.y / Mathf.Tan(State.SlopeAngle * Mathf.Deg2Rad) * Mathf.Sign(deltaMovement.x);
            }

            State.IsCollidingBelow = directionY == -1;
            State.IsCollidingAbove = directionY == 1;
            CanJumpDown = false;
        }
    }

As you can see there are a lot of platform types that are somewhat similar. Plus, since this script will be placed on any character, such as the player or the enemy, both of these entities will be bound to the same movement parameters. What if I didn't want an enemy to slide around on an ice block? I'm not sure there's a way to prevent this in my code in its current structure.

sentences:
Changing properties for multiple objects in unity 3d free? So my team and I need to assign values to specific values in the inspector to large numbers of objects.

For example, we have a script that's assigned to all the walls, and all the floors.

We want to select all the walls in the Scene view and assign the value "1" to a variable in the inspector and then go and select all the floors and assign the value "2" to the same variable, for those objects.

Right now, when we select multiple objects and assign a value to the variable in the inspector, it just changes it for the last selected object.

We've got (potentially) hundreds of object that we need to do this to and it would suck to have to go in and change the values one at a time.

The equivalent I'm thinking of is the Attribute Spreadsheet in Maya, where you can see a list of objects, and assign the same value to a bunch of their attributes.

Hope somebody out there has an answer for this! Haven't been able to find one yet!

sentences:
Where do assets for Minecraft mods go? I found this link:
Where do I store (or how do I refer to) textures for custom blocks?

Unfortunately, the answer did not explain where that assets folder actually is. As such, I can't figure out where the textures themselves go.

I'm trying to replicate the tutorial on minecraftforge.net, so the mod's ID is "generic". For some reason, though, the assets folders all contain folders called "genericmod".

Basically: Can someone give me the exact path I should go to, starting from forge_1710_src, to put my graphics in?

sentences:
How do I copy box2d data from one body to another? I want to copy all Box2D-related data (position, velocity, rotation, impulse, ...) from one body to another.

This is what I've got working (with box2djsweb):

var t = body.GetTransform();
other_body.SetTransform(t);

var vel = body.GetLinearVelocity();
other_body.SetLinearVelocity(vel);

I think that covers most things, but judging by the behaviour, I've missed something. It's as if it's a frame or tick behind. Also, this isn't placing the other_body in the exact location as the the original body.

Is there a better way to do this?

sentences:
What's the proper way to set up a texture atlas in Unity 3D? I am using Unity3d (free) to make a game with user-defined content (i.e., load in a map, it'll build the level for you).

Everything is working as expected, except for the rendering.

Note the artifact / seam along the edge of the two cubes.

I am not entirely sure what is causing this, other than, perhaps a rounding error?

At any rate, every mesh in my scene shares the same texture, with specific UV offsets generated at 1/8 intervals for each corresponding texture:

Playing around with the assigned UVs moves the artifacts around. For instance, the red brick texture has the issue between the top faces:

So clearly, I'm doing this in a suboptimal way. Is there something specific I'm doing wrong? Or is there a better way to build meshes with texture atlases?

sentences:
How to Create a Grid for a 2D Game? So I'm currently writing the engine for my videogame. I've almost integrated Tiled (I think) so I should have a map-creator here soon.

My question is, how do I actually make the grid? I'm really confused here. If I create a large map with, say, 20x20 grids the size of 32x32 (screen size 640x640), then what do I do with it?

Let's say I have the code for creating a window, and then place a player sprite that I can move with input, that's fine. If I use one map that's as big as the screen, then every pixel on the map is also a pixel on the game screen. The mapping is exact.

Now what happens if I have a 2000x2000 map, for example? My character would have to keep moving and move the map around (or rather the camera focused on the player moves). Then I can no longer say that the screen maps exactly to the pixel position of the map.

I tried making a Grid class that maps out the screen area to 32x32 tiles, but I'm not sure if that makes any sense. Once the map moves each tile would have to update its information, or something. I'm just really confused here.

How do I actually make the tiles and a grid and map them to the data I get from tiled, or that I make myself? Are there any good examples of source code that I could look at?

sentences:
Developing an interactive book for Windows-Runtime My three year old loves playing with the interactive books on our iPad, and I love playing with code and I love my Surface RT...

So I thought I'd try and make a basic animated book using WinRT, I've spent some time reading about animations
(granted the book isn't WinRT based), and thought I'd try and use the Storyboard approach rather than rolling any kind
of bespoke animation framework.

That was until I saw the Faresee Physics Engine, and the Physics XAML Helper.

I've played around with some of the more basic examples, and it seems pretty good - very easy in-fact.

My issue is when I start thinking about stringing together animations that can react to input,
the Farsee and Physics XAML Helper blows my mind a little.

As a proof of concept I was thinking about getting a character to walk from a path (in the top right),
and while moving closer (getting larger) walk to the front at the center.

Then, based on some kind of decision, via an input, walk either back to the right, or up to the left.
Both are back into the distance (getting smaller) as if walking away.

The character should have basic humoid movement, athough slightly cartoon-like - swinging arms, moving head and legs.
Also, it would be nice to have the ability for the character model to swap images when it walks back up the path.

My question (finally!), is do you think that it's better to use the built in Storyboarding features of WinRT, with it's
animations - primarily using easing and descrete key frames to create each animation 'scene'. Or, use something like
Farsee and the Physics XAML Helper to create the scene using real word objects and physics?

Are there any examples, samples, tutorials etc of creating anything similar?

Thanks,
Kieron

sentences: Make my Character face the same way as my Camera as I rotate the camera Before posting, I've already tried parenting the camera to the Character mesh head and setting controller yaw, that didn't work, in fact it invalidated my blueprint to set my Mouse X and Y for the pitch and yaw that allowed me to move my camera in the first place. So I need a different method to make my character follow the way my camera is facing whenever I rotate, otherwise when I turn around I just face my Character.

sentences:
How to use the Vulkan graphics backend in the Stride game engine? What do I have to do in order to run my Stride game on the Vulkan graphics platform?

The documentation section seems to be outdated, the drop-down doesn't exist anymore:
https://doc.stride3d.net/latest/en/manual/platforms/index.html#set-the-graphics-platform

sentences:
GameMaker Studio: fullscreen vs. dialogs When setting my game to fullscreen, I get problems with dialogs:

"get_save_filename" opens in the background, and when I close it, the game doesn't react anymore.
Asking the user a yes/no question exits fullscreen mode and does not enter it again afterwards.
"window_set_fullscreen" doesn't seem to do anything either...

Can anyone help?

sentences:
How do I use virtual joysticks in Unity2d ()top view? I want to use virtual joysticks for character movement, in a top-down 2D game, that includes rotating the character.

I tried an Easy Joystick Unity Package, but it doesn't work properly, so what do I do?
Does anyone have a script (preferably in C#) that would use virtual joysticks to move a character?

sentences:
How do I create weapon attachments? My question is; I am developing a game for XNA and I am trying to create a weapon attachment for my player model. My player model loads the .md3 format and reads tags for attachment points. I am able to get the tag of my model's hand. And I am also able to get the tag of my weapon's handle. Each tag I am able to get the rotation and position of and this is how I am calculating it:

Model.worldMatrix = Matrix.CreateScale(Model.scale) *
                    Matrix.CreateRotationX(-MathHelper.PiOver2) *
                    Matrix.CreateRotationY(MathHelper.PiOver2);

Pretty simple, the player model has a scale and its orientation(it loads on its side so I just use a 90 degree X axis rotation, and a Y axis rotation to face away from the camera). I then calculate the torso tag on the lower body, which gives me a local coordinate at the waist. Then I take that matrix and calculate the tag_weapon in the upper body. This gives me the hand position in local space. I also get the rotation matrix from that tag that I store for later use. All this seems to work fine.

Now I move onto my weapon:

Matrix weaponWorld = Matrix.CreateScale(CurrentWeapon.scale) *
                            Matrix.CreateRotationX(-MathHelper.PiOver2) *
                            TagRotationMatrix *
                            Matrix.CreateTranslation(HandTag.Position) *
                            Matrix.CreateRotationY(PlayerRotation) *
                            Matrix.CreateTranslation(CollisionBody.Position) *

You may notice the weapon matrix gets rotated by 90 degress on the X axis as well. This is because they load in on their sides. Once again this seems pretty simple and follows the SRT order I keep reading about.

My TagRotation matrix is the hand's rotation. HandTag.Position is its position in local space. CreateRotationY(PlayerRotation) is the player's rotation in world space, and the CollisionBody.Position is the player's world location. Everything seems to be in order, and almost works in game. However when the gun spawns and follows the player's hand it seems to be flipped on an axis every couple frames. Almost like the X or Y axis is being inversed then put right back. Its hard to explain and I am totally stumped. Even removing all my X axis fixes does nothing to solve the problem. Hopefully I explained everything enough as I am a bit new to this! Thanks!

sentences:
LibGDX Swipe Detection Left and Right I have displayed an image at the center of the screen with libgdx. If I swipe left, the image should move to the left; and, if I swipe right, image should move to the right.

Subsequent swipes to the left should move the image left. The same should happen for right. I used GestureListener.

It works to some extent in the sense if I swipe left first image moves left. But after that if I try to swipe right the image still moves left.

So how do I implement the expected behavior?

class MyGestureListener implements GestureListener {
    @Override
    public boolean fling(float velocityX, float velocityY, int button) {
          if (velocityX>0)
              iX += 20;
          else
              iX -= 20;
          System.out.println("iX: "+iX);
          return true;
    }
}

// ...
Gdx.input.setInputProcessor(new GestureDetector(0.0f, 0.0f, 0.0f, 5f, new MyGestureListener()));

// ...
batch.draw(splashTexture, iX, iY);

sentences:
Dealing with string memory pollution Consider following example. I have a title screen for a game which displays top scores list, and some other text. The Update method looks like (simplified):

// remove all text
textList.Clear();

// add scores
foreach(var sc in scores)
{
    textList.Add(new GameText(string.Format("{0}: {1}", sc.Name, sc.Score));
}

If I understand all correctly, then each frame 10 new strings are created, polluting memory at high rate. Currently I fight it with creating a cache:

// this is a class level variable, outside of Update method of course
List<GameText> scoreCache = new List<GameText>();

// remove all text
textList.Clear();

// add scores to cache if needed
if(scoreCache.Count == 0)
{
    foreach(var sc in scores)
    {
        scoreCache.Add(new GameText(string.Format("{0}: {1}", sc.Name, sc.Score));
    }
}

// get fast copy from cache
// no new strings created until score cache is invalidated
textList.AddRange(scoreCache);

I wonder, if there are some other reliable solutions and patterns to this common, as I see it, problem?

Update. As @JasonH correctly mentioned, there is no need to update list each time at all, so now scoreCache is initialized once in a LoadContent-like method which is called once before main Game loop starts.

Update 2. Another similar problem was with a debug text layer output which displays FPS, Total game time, etc. on top of all screens. Despite using StringBuilder, intermediate strings were required for creation of final debug text for each frame. I've decided to solve it this way, since I don't actually need per frame response, I update this only each second:

private void PrepareDebugText(GameTime gameTime)
{
    this.refreshAccumulator += gameTime.ElapsedGameTime.TotalMilliseconds;

    // if required time is not elapsed yet
    if (this.refreshAccumulator < RefreshIntervalMs)
    {
        // do nothing
        return;
    }

    // reset accumulator
    this.refreshAccumulator = 0;

    // create debug text below
    // ...
}

Applying this two approaches gives following:

reduced garbage collection frequency by 2 (from 60-70 seconds to 130-140 seconds)
reduced peak heap allocation from 3,4 Mb to 1,5 Mb
reduced short life objects to less than 1% from more than 50%.

Now I'm satisfied.

Update 3. @GeorgeDuckett found an interesting approach example how we can further reduce string pollution then output is integer number.

I also would like to clarify why strings are so specific in XNA (.NET). Despite being a reference type, on each assign (i.e. =) operation new string is created instead of assigning reference. This can produce not very obvious amounts of garbage strings.

sentences:
What is a currently a good game stack for simple Javascript 2D multiplatform game? I'm looking for advice from someone can help me avoid common pitfalls in developing light weight, quick-to-market games. Yeah, I've heard of Google ;-), but a trip down Google lane does not beat solid experience from someone who has been down this path. I'm looking for advice from someone who works alone, or in a small team, and has developed some 2D games for mobile.

My game ideas don't require intensive graphics, just simple arcade style glyphs and collision detection. My experience is mostly with Scala, Java and web technologies (Javascript, CSS, SVG, HTML, etc).

My question is: Is there a nice stack that someone can suggest that will be a good fit for my skillset?

I'm considering Javascript for simple 2D shooter games with simple multiplayer games being supported with a Scala server-side written on Spray. Is this silly? Should I rather look into things such as Unity 3D, and use it in 2D mode?

For the actual game engine, something like the Sparrow Framework would be great, but it needs to be multiplatform.

sentences:
Hold button down by mouse? When I hold down a button by mouse for 5 seconds, print a message. How to do this ? I wrote this script but is not working. I don't know if there other methods.

Public float clock;
Public Button out;

public void quit_out_mouse() {
    clock = Time.time;
    if(Time.time - clock > 3.0f )       {
        Debug.Log (" gone !! ");
    }

   }

sentences:
Manipulating Perlin Noise I've been learning about Procedurally Generated Content lately (in particular, Perlin noise). Perlin noise works great for making things like landscapes, height maps, and stuff like that. But now I am trying to generate structures more like mountain ranges (in 2D, as 3D would be way over my head right now) or underground veins of ores.

I can't manage to manipulate Perlin Noise to do this. Making a cut off point (i.e. using only the tops of the 'mountains' of a heightmap) wouldn't work, because I would get lumps of mountains/veins. Any suggestions?

Thanks,
Numeri

sentences:
LibGdx table with label children at fixed positions I'm trying to make a table containing three labels in each row.

Something like this:

Label1 Label2 Label3

Text1 Text2 LongerText

LongTextLoremIpsum LongTextLoremIpsum LongTextLoremIpsum

Is there a way to fix the position of the labels so that they will be at the same position horizontally regardless of the length of the text in the label?

So far I'm using a table as the root container, and then HorizontalGroup for each row.

sentences:
Xna - How do you use large animations for a menu In the main menu of my game I have several animations that pause in specific frames.

I made the sprite sheets for the different layers, but then I found out that the sprite sheet has to be smaller than 2048 pixels. My sprite sheet is 14400 pixels with 18 frames...

How can I play these large animations? I tried video playback but I couldn't find a way to do this...

sentences:
How to generate caves that resemble those of Minecraft? I've been working on a 3D procedural world for a while now and am wanting to start adding cave systems. I'm currently using 2D/3D Perlin Noise for the terrain generation in combination with Marching Cubes for smoother terrain. I'm just getting stumped when it comes to long interconnecting caves.

I'm hoping to get something more like Minecraft's cave systems. They seem to be very connected, branch off randomly in nearly any direction, and nearly any point in the cave would have a fairly circular look with a fairly equal radius throughout (not the best wording, but not quite sure how else to put it).

The biggest challenge for generating caves like I'm wanting is that I want to generate the world on the fly. The world is generated chunk by chunk currently, starting where the player is and it generates outwards from there. I would NOT want to generate any of the world and then dig the caves out using a wandering pattern, cellular automata, etc.

Are there any well known algorithms that can be used for this? If so, does anyone want to share how they do something similar? I'd greatly appreciate any help.

A good example:

sentences:
Why do RPGs let you know how much XP you need to level up? I was reading this article called Behavioral Game Design, and it says:

  ...how do we make players maintain a high, consistent rate of activity? ... the answer is a variable ratio schedule, one where each response has a chance of producing a reward.

RPGs (I'm thinking of traditional JRPGs like Final Fantasy 1-6) don't do this when it comes to leveling up characters.  You can always pause the game and look at how much XP you need to level up again.  I haven't played WoW before, but I suspect it lets you know how much XP you need to level up, too.  In WoW, there's plenty of examples of "variable ratio schedule" elsewhere in the game, so why not when it comes to XP you need to level up?

I suspect most professional game designers know the lessons in this article.  So why is it typical for the XP you need for the next level to be known?  They could design the game so that it's random, where you never know how many enemies you need to kill for that next level.  So why don't they use this as an opportunity to have a "variable ratio schedule"?

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: Best Practices for Random Enemy Animations? For various animations for NPCs (getting hit with projectiles, shooting, dying) I've been creating 2-4 animations each in blender before exporting. Should I be doing this inside Unity with Animation Controllers instead? Either way what would be the best practices to actually randomizing the animations?

sentences:
Error in projecting coordinates from FitViewport to screen in LibGDX i'm using a FitViewport to render my "game world". Viewport virtual dimensions are fixed 400x240.
I use viewport.unproject method to scale input touches from screen coordinates to world coordinates, and the values are good.

The problem begins when i use the opposite (viewport.project method).
I have to use it for drawing a sprite that is scaled for screen dimensions but i have X and Y positions in "game" coordinates.

Vector2 screenCoords = new Vector2();
screenCoords = (viewport.project(new Vector2(gameX, gameY)));

When i use viewport.project i only have the result i expect if the screen aspect ratio matches my game aspect ratio (so the viewport fits the whole screen).

I noticed that if screen height is higher (so my viewport is fitted horizontally and black bars appear below and above it) the X coordinate is fine, but Y coordinate varies slightly depending if the "game" Y coordinate is near upper or lower side.

Based on my knowledge and on javadoc comments i've red, the method must automatically recognize if the viewport is not full-screen or if it is not, and add an offset based on how tall the black bars are.

Am i doing something wrong???

sentences:
Unity TextMeshPro bounds.size is wrong when hovering first time over gameobject I have this weird issue, which I am not able to fix. This is my third attempt and I need some help. Basically I have a hover element which spawns when I hover over a gameobject. The height of the element is determined by the amount of text (TextMeshProUGUI).
The issue happens only when I hover first time, also not always (I have no clue how to reliably to reproduce it).
Here is what happens (sec 10~):
https://vimeo.com/449387131
I have tried to add these everywhere and different combinations:
LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);
hoverElementRect.ForceUpdateRectTransforms();
Canvas.ForceUpdateCanvases();
txtMeshPro.ForceMeshUpdate();

They dont seem to help. I assume the problem is here:
float bgHeight = txtMeshPro.bounds.size.y + 25;

The bounds.size.y is wrong the first time I hover, but I have no clue why.
Here is the whole code for spawning the GUI element:
public static void SpawnGeneralHoverElement(string descText, RectTransform hoverOverRect, float guiWidth) {
    Canvas hoverCanvas = instance.hoverElementGeneral.GetComponent<Canvas>();
    EnableCanvas(hoverCanvas);

    TextMeshProUGUI txtMeshPro = hoverCanvas.GetComponentInChildren<TextMeshProUGUI>();
    RectTransform hoverElementRect = hoverCanvas.GetComponentsInChildren<RectTransform>()[1];

    float scale = hoverCanvas.GetComponent<RectTransform>().localScale.x;

    txtMeshPro.text = descText;

    // Need this to be dynamic, if I change hover element size, it will still work
    float hoverElementWidth = guiWidth;

    // Forces canvas update because of: stackoverflow.com/questions/55417905/why-is-textmeshpro-not-updating-textbounds-after-setting-text
    Canvas.ForceUpdateCanvases();
    LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);
    hoverElementRect.ForceUpdateRectTransforms();
    txtMeshPro.ForceMeshUpdate();

    // Need this because otherwise the element spawns too far away on smaller resultions
    float spawnOffset = (txtMeshPro.bounds.size.y * hoverCanvas.GetComponent<RectTransform>().localScale.x) + (Screen.height * 0.022f);

    float bgHeight = txtMeshPro.bounds.size.y + 25;

    hoverElementRect.position = new Vector3(hoverOverRect.position.x, hoverOverRect.position.y + spawnOffset,
        hoverOverRect.position.z);

    hoverElementRect.sizeDelta = new Vector2(guiWidth, bgHeight);
    Debug.Log(hoverElementRect.sizeDelta);

    LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);
    hoverElementRect.ForceUpdateRectTransforms();
    Canvas.ForceUpdateCanvases();
    txtMeshPro.ForceMeshUpdate();

    // Slide in form left to right if off bounds, need for traps for example
    float leftOffset = hoverElementRect.position.x - ((hoverElementRect.sizeDelta.x * scale) / 2);
    if (leftOffset < 0) {
        hoverElementRect.position = new Vector2(hoverElementRect.position.x + (leftOffset * -1) + 15, hoverElementRect.position.y);
    }

    // Slide in form right to left if off bounds, need for traps for example
    float rightOffset = Screen.width - (hoverElementRect.position.x + ((hoverElementRect.sizeDelta.x * scale) / 2));
    //Debug.Log("Screen width: " + Screen.width + "\nrightOffset: " + rightOffset);
    if (rightOffset < 0) {
        hoverElementRect.position = new Vector2(hoverElementRect.position.x - (rightOffset * -1) - 15, hoverElementRect.position.y);
    }

    LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);
    hoverElementRect.ForceUpdateRectTransforms();
    Canvas.ForceUpdateCanvases();
    txtMeshPro.ForceMeshUpdate();

}

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:
Blender 2.6: Changing the Resolution (Rings/Segments) of a UVSphere's I know that it's possible to change the resolution (I mean the rings and the segments) of a UVSphere by pressing [F6] and changing some arguments.

But what if I add a UVSphere to my canvas at first, then I do something else in the meantime and not till then I want to change the resultion of the UVSphere which I added before. Is that possible? Thanks.

sentences:
Unity: how to implement a sound detection ? I want to trigger an event if an enemy (or player) can hear a sound generated from other enemy/player.

How to implement a sound detection system ?

Thanks

sentences:
Writing a basic shader for large input files I started writing a shader for my iOS app and instead of starting from scratch i used this tutorial here:
http://www.raywenderlich.com/3664/opengl-es-2-0-for-iphone-tutorial

I wrote an import function, first to import wavefront .obj models. My problem is that with I can't handle larger inputs (with a simple cube it was working). I realized that the indices array is an array of GLubyte values, which is unsigned char, so as a result i cant have more than 256 indexes. I modified it to GLuint, but then only get a blank screen.

What else needs to me modified?

p.s.: the source can be downloaded from here: http://d1xzuxjlafny7l.cloudfront.net/downloads/HelloOpenGL.zip

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:
Queueing with Unity's NavMeshAgent I have created a strategy game where the units use Unity's NavAgent pathfinding and flocking algorithms.  This works well.  However, I need to add queueing so that units will queue sensibly.  This works most of the time, but it isn't perfect and I want to know if there's a better way of doing it.

My first draft was to simply check which unit is closest to the destination, but this caused issues because a group might be navigating around an obstacle and the unit closest is at the back of the queue... so the whole group stops.

Second draft checked the distance to destination based upon the length of the path each unit had to take.  This works far more often, but sometimes still has issues.  Sometimes the same problem happens, but much less often.  The one who is supposed to be moving stops, and so the entire group stops.

There's also a problem I've noticed, where the waiting units could sometimes benefit from rotating, even if they shouldn't be moving.  Unfortunately they sometimes get stuck and will wait before they can move, to rotate.  If they could rotate when forbidden from moving it'd help considerably too.

What I need to know...

How can I make Unity NavAgent's queue, so that they will wait for the other agents closest to the destination to move first?
How can I ensure that this does not stop agents from rotating while in a queue (rotating may move them into a better position in the queue).

Code:

Unit Movement Function

private void Movement()
{
    // Unit is moving.
    if (moveVectors.Count > 0)
    {
        navAgent.isStopped = false;

        // Check for whether to wait in queue.
        Vector3 nextVector = transform.position;
                nextVector += transform.forward * speed * Time.deltaTime;

        foreach (Unit unit in list)
        {
            if (unit != this &&
                unit.moveVectors.Count > 0 &&
                Vector3.Distance(unit.transform.position, nextVector) <= (unit.footprint + footprint) &&
                PathDistance(unit) < PathDistance(this))
            {
                navAgent.isStopped = true;
                return;
            }
        }
    }
}

There's a bit more to Movement, but it's not relevant so we'll ignore it for now.

PathDistance Function

private float PathDistance(Unit unit)
{
    Vector3 startPosition = unit.transform.position;
    Vector3 endPosition = unit.moveVector;
    Vector3 lastPosition = startPosition;
    Vector3[] path = unit.navAgent.path.corners;
    float distance = 0;

    for (int i = 0; i < path.Length; i++)
    {
        distance += Vector3.Distance(lastPosition, path[i]);
        lastPosition = path[i];
    }

    distance += Vector3.Distance(lastPosition, endPosition);
    return distance;
}

Is there a better way of achieving the result I want?

sentences: Virtual World Plaforms and Unity3d I'm moving in the direction metaverse developing. A few years back I wandered around in Second Life and found it entertaining for a New York minute. Now, I'm set to plunge into the Virtual World/MMO enviroment. ReactionGrid's Jibe seems to be wonderfully paired with Unity3d. I've been a Unity developer for 5-6 years now. Is there a open source Virtual World Platform that integrates with Unity like Jibe? I've read an article on platforms like OGRE, Open Colbalt, OpenSimulator, Project Wonderland and Sirikata but none seem to mention working with Unity3d.

sentences:
Teleport Not Working in Unity 2D So I'm basically trying to get my character to "use" a set of stairs by teleporting from one stairway door to another. Each stairway door will be paired with one other stairway door.

Here's the code, I feel like it should be working...my Debug.Logs are even outputting the correct information. Also FYI, I have the Transform doorPairedWith as public so that I can just drag and drop the stairway door that each one is supposed to be paired with.

 using UnityEngine;

 public class Stairs : MonoBehaviour {

 Player player;

 public Transform doorPairedWith;

 Vector3 doorPairedWithPosition;
 Vector3 playerPosition;

 BoxCollider2D playerCollider;
 BoxCollider2D stairsTriggerCollider;

 bool playerIsNearStairs = false;

 void Start()
 {
     player = Player.instance;

     playerPosition = player.transform.position;
     doorPairedWithPosition = doorPairedWith.position;

     playerCollider = player.GetComponent<BoxCollider2D>();
     stairsTriggerCollider = GetComponent<BoxCollider2D>();
 }

 void Update()
 {
     UseStairs();
 }

 void UseStairs()
 {
     if (playerIsNearStairs == true)
     {
         if (Input.GetKeyDown(KeyCode.E))
         {
             Debug.Log("Attempting to use stairway door named: " + doorPairedWith);
             playerPosition = doorPairedWithPosition;
         }
     }
 }

 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         playerIsNearStairs = true;
         Debug.Log("Player is near stairs: " + playerIsNearStairs);
     }
 }

 void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         playerIsNearStairs = false;
         Debug.Log("Player is near stairs: " + playerIsNearStairs);
     }
 }
 }

sentences:
how to prevent stretched vertical shadow in blob shadow which projected by Projector of Unity I feel it's a ridiculous because projector's rotation of X is 90.

the projector is a orthographic.

how can i prevent that long stretch shadow in vertical side of a platform?

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: How to move the ball in straight line in gamesalad? I have an actor named ball  and I want to move it in a straight line which is created by actor ball's X and Y coordinate and cursor's X and Y coordinate. I have Move To behavior in gamesalad but I don't have exact idea how to move the ball with two Cartesian coordinates ball and cursor.

sentences:
How to save Unity assests to another drive? My C:\ volume has almost no space left.
Therefore I want to transfer all my assets to the volume E:/. And save my new assets automatically on the E:/ volume. I have searched very long in unity for save options of unity assets but nowhere found a setting option for this.

sentences:
Particles not rendering over projectors I am using projectors for shadows...When I use particles for bike speed up i.e., nitro speed the particles get cutout by those shadows....

Here is screenshot of it,

Here is my shader code of projectors ,

Shader "Projector/Projector Multiply Black"
{
    Properties
    {
        _ShadowTex("Cookie", 2D) = "gray" { TexGen ObjectLinear }
    _ShadowStrength("Strength",float) = 1
    }

        Subshader
    {
        Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+100" }
        Pass
    {
        ZWrite Off

        //Fog { Mode Off }

        Blend DstColor Zero

        CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_fog_exp2
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"

        struct v2f
    {
        float4 pos : SV_POSITION;
        float2 uv_Main     : TEXCOORD0;
    };

    sampler2D _ShadowTex;
    float4x4 unity_Projector;
    float _ShadowStrength;

    v2f vert(appdata_tan v)
    {
        v2f o;

        o.pos = mul(UNITY_MATRIX_MVP, v.vertex);

        o.uv_Main = mul(unity_Projector, v.vertex).xy;

        return o;
    }

    half4 frag(v2f i) : COLOR
    {
        half4 tex = tex2D(_ShadowTex, i.uv_Main);
        half strength = (1 - tex.a*_ShadowStrength);
        tex = (strength,strength,strength,strength);
        return tex;
    }
        ENDCG

    }
    }
}

Here is my particle code,

// Simple additive particle shader.

Shader "Custom/Particle additive"
{
Properties
{
    _MainTexture ("Particle Texture (Alpha8)", 2D) = "white" {}
}

Category
{
    Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
    Blend SrcAlpha One
    Cull Off Lighting Off ZWrite Off Fog {Color (0,0,0,0)}

    BindChannels
    {
        Bind "Color", color
        Bind "Vertex", vertex
        Bind "TexCoord", texcoord
    }

    SubShader
    {
        Pass
        {
            SetTexture [_MainTexture]
            {
                combine primary, texture * primary
            }
        }
    }
}
}

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: How to create biomes I am creating an 2D XNA Tile Based Platformer. I have a tile engine and a world/terrain generator. However, I am trying to create biomes or areas, For example, Desert in one part of the world, ocean on the ends, City in the middle, forests scattered around etc. I can easily make it generate them, but My problem is defining the actual areas to be generated in.

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:
Scripting: to block or not to block Context: I'm making a little "program your robot army" sort of game in Java in which the player writes Lua scripts (which are then run by LuaJ) to program their robots to do stuff. So far there are two objectives:

Keep It Simple, Stupid, and
React to the environment.

To take a simple example of what I currently have, the player should be able to tell their robot to go to a particular location with something like

robot:goTo(5, 8)

Like Colobot, the scripting engine effectively halts (blocks) at that instruction until the robot has reached its destination.

I like this -- it's meets the first requirement nicely, in that you can't do anything until goTo decides to return. It's also simple on the Java side -- I can basically do while (/* condition */) yield() and just resume the coroutine every tick (then maintaining state in local variables is trivial). But: what if that resource at (5,8) disappears, or an enemy comes near, or energy runs low? There's no opportunity to bail -- the robot has to reach (5,8) before it can do anything else.

The main other idea I can think of is to produce some sort of loop:

while not robot:near(5,8) do
    if robot:enemyNearby() then
        break -- and do some other stuff, presumably
    else
        robot:moveTo(5,8)
    end
end

where moveTo this time sets the velocity/acceleration and then immediately returns, without blocking until arrival.

I could have robot:goTo return the actual coroutine (either wrapped, so you just call it, or directly, which requires calling coroutine.resume and passing the coroutine), which might look something like this:

moveTask = robot:moveTo(5,8)
while not robot:near(5,8) do
    if robot:enemyNearby() then
        break
    else
        moveTask()
        -- or perhaps coroutine.resume(moveTask)
        -- or some other syntactic sugar
    end
end

These last two approaches look pretty similar, but reusing a coroutine as in the second example makes managing state (e.g. a path) trivial, at the cost of exposing coroutines to the player.

To reiterate, the goal is to allow for writing simple scripts, in which a set of actions are executed in series (sorta like queued actions in The Sims), while simultaneously allowing more complex scripts with actions that may be interrupted by arbitrary events (nearby enemy, target moved, stats dropping).

Any tips or ideas would be much appreciated!

sentences:
(Abstract) Game engine design I am writing a simple 2D game (for mobile platforms) for the first time. From an abstract point of view, i have the main player controlled by the human, the enemies, elments that will interact with the main player, other living elements that will be controlled by a simple AI (both enemies and non-enemies). The human player will be totally controlled by the player, the other actors will be controlled by AI. So i have a class CActor and a class CActorLogic to start with.

I would define a CActor subclass CHero (the main player controlled with some input device). This class will probably implement some type of listener, in order to capture input events. The other players controlled by the AI will be probably a specific subclass of CActor (a subclass per-type, obviously). This seems to be reasonable. The CActor class should have a reference to a method of CActorLogic, that we will call something like CActorLogic::Advance() or similar.

Actors should have a visual representation. I would introduce a CActorRepresentation class, with a method like Render() that will draw the actor (that is, the right frame of the right animation). Where to change the animation? Well, the actor logic method Advance() should take care of checking collisions and other things.

I would like to discuss the design of a game engine (actors, entities, objects, messages, input handling, visualization of object states (that is, rendering, sound output and so on)) but not from a low level point of view, but from an high level point of view, like i have described above.

My question is: is there any book/on line resource that will help me organize things (using an object oriented approach)?

Thanks

sentences:
Unity game crashing when dialogue with NPC initiated I have 3 NPCs in my "Game". When the player walks up to any of them, they're supposed to have their own dialogue; I've tested this, and they do.

I tried to create a display that shows this dialogue text using a TextMeshProUGUI attached to a blank GameObject called dialogDisplay (tagged DialogDisplay). There is one DialogDisplay object in the scene that I'm trying to get each of my NPC's to use. I tried to make the display object inactive in the NPC Start() function, and enable it when it's time to display the NPC's next sentence.

When I run my game, I get an error on line 21, where SetActive() is called: "Object Reference Not Set to an Instance of an Object".

Here's the NPC script (DisplayNextSentence() is at the bottom, where dialogDisplay is used):

public class NPC : Character {
private bool charInRange;
public Dialogue dialogue;
public bool talkedTo = false;
private Queue<string> sentences;
public TextMeshProUGUI textPro;
public GameObject dialogDisplay;
private bool isTalking;

// Use this for initialization
void Start () {
    charInRange = false;
    textPro = FindObjectOfType<TextMeshProUGUI>();
    dialogDisplay = GameObject.FindGameObjectWithTag("DialogDisplay");
    dialogDisplay.SetActive(false);
}

// Update is called once per frame
void Update () {
    //if player is in range and presses space, triggers NPC dialogue
    if (charInRange && Input.GetKeyDown(KeyCode.Space))
    {
        TriggerDialogue();
    }
}

//if Player gameObject is in NPC collider, player is in range
void OnTriggerEnter2D(Collider2D other)
{
    if(other.gameObject.tag == "Player")
    {
        charInRange = true;
    }
}

//if player exits NPC collider, player is not in range
void OnTriggerExit2D(Collider2D other)
{
    if (other.gameObject.tag == "Player")
    {
        charInRange = false;
    }
}

//if NPC has been talked to before, displays next sentence; if not, loads dialogue and displays first sentence
private void TriggerDialogue()
{
    if (!talkedTo)
    {
        talkedTo = true;
        StartDialogue(dialogue);
    }
    else
    {
        DisplayNextSentence();
    }
}

//loads a queue with lines from Dialogue and displays first sentence
public void StartDialogue(Dialogue dialogue)
{
    sentences = new Queue<string>();

    foreach (string sentence in dialogue.sentences)
    {
        sentences.Enqueue(sentence);
    }

    DisplayNextSentence();
}

//displays next sentence in the queue
public void DisplayNextSentence()
{
    string sentence;
    bool done = false;

    //if last sentence in the queue, display it again
    if (sentences.Count == 1)
    {
        sentence = sentences.Peek();
        textPro.text = sentence;
        Debug.Log(sentence);
        return;
    }

    sentence = sentences.Dequeue();
    textPro.text = sentence;
    dialogDisplay.SetActive(true);
    while (!done) {
        Debug.Log("In WHile Looop");
        if (Input.GetKeyDown(KeyCode.A))
        {
            done = true;
        }
    }
    dialogDisplay.SetActive(false);
}
}

Grateful for any insight or tips you can provide. Happy to provide further information if it helps. Thank you!

sentences:
Custom Music in Skyrim's Creation Kit? Can you bring in external music such as mp3s?  If so, how?  I didn't see anything about this in the wiki Bethesda released.

Also how does this work with regards to the Steam Workshop?  Don't imagine they would appreciate uploading copyrighted content.  I don't particularly care about making a public mod, I just want to screw around privately and create dungeons/towns using music from some of my favorite games.

Thanks.

sentences: How do I generate platforms in a specific position in godot? I am making a rogue-like game in Godot. Currently, I am stuck with the world generation. I know how to add children, but I am wondering if there is a way to add those children in a specific position. I also need to know how to add nodes to an array, and then choose one from the array to spawn.

sentences:
UDP vs TCP in multiplayer mobile game I'm working on a networked multiplayer game, initially for iOS.

Even with TCP_NODELAY there are large fluctuations in latency. I can't be sure of the reason, but I would not be surprised if it was resends on packet loss due to flaky connections.

Having done no real life server work with UDP as opposed to TCP (which I have lots of experience with), I wonder if there are any significant gains to trying a UDP-based architecture.

Client packets are typically only a few bytes, sent rarely, except when moving, when the player might issue 2-8 commands/s. Server packets are slightly larger and mostly sent as response to a client command.

Connections need to be reliable and ordered.

ADDITIONAL INFO

Very early on I did some exploratory tests with TCP versus UDP. I would run connections Phone -> 3G -> External static IP of router -> Wifi -> Development computer and Phone -> Wifi -> Router -> Wifi -> Development computer.

What I wanted to improve was mainly the very uneven lag one would experience moving around on the map with a non-local connection.

Obviously starting animations can help, but there are (rare but valid) reasons why a move command might be rejected that the client have no way to predict. In addition, much data is hidden from the client, which again gives very little room for predictive responses.

Anyway, my results was the UDP and TCP gave pretty much the same average latency when sending data.

What I didn't look at was the actual spread - for example the maximum TCP latency in face of packet loss. I would have have needed to do some packet recovery mechanism in UDP to figure out if UDP could do better.

So again the results I see today with TCP is that usually it works fine, then suddenly a slowdown and a burst of movement as all the other buffered packets are more or less executed at the same time.

sentences:
Game Design. Question about balance progression Playing in the main mode, the player receives Glory for victory, and for defeat, loses it. When the player reaches the required number of Glory, he moves to the next League. There are N Leagues in the game.
Each League has a recommended Promotion (level) of the Hero. When a player has a Hero's Promotion below the recommended one, he loses more often. The Hero has K Promotions.
And Quastion
Player must complete N Leagues for 360 days. How can i reach this?

sentences:
Turn-based JRPG battle system architecture resources The past months I've been busy programming a 2D JRPG (Japanese-style RPG) in C++ using the SDL library. The exploration mode is more or less done. Now I'm tackling the battle mode.

I have been unable to find any resources about how a classic turn-based JRPG battle system is structured. All I find are discussions about damage formula. I've tried googling, searching gamedev.net's message board, and crawling through C++-related questions here on Stack Exchange. I've also tried reading source code of existing open source RPGs, but without a guide of some sort it's like trying to find a needle in a haystack.

I'm not looking for a set of rules like D&D or anything similar. I'm talking purely about code and object structure design. A battle system asks the player for input using menus. Next the battle turn is executed as the heroes and the enemies execute their actions.

Can anyone point me in the right direction? Thanks in advance.

sentences:
Apply external effects to player movement In a 2D downhill game with the following, custom movement code, how do I apply external effects to the player's movement?
For example, when the player hits an obstacle, I want them to get bounced off the obstacle and briefly stop before they are able to continue moving. How do I best integrate those types of external effects into my movement code in a way that is scalable?
private void UpdatePlayerVelocity()
{
    // Calculate the player's vertical movement speed
    float speedY = maxSpeed.y * Time.fixedDeltaTime;

    // Calculate the player's horizontal movement speed
    float speedX = inputDirectionX * maxSpeed.x * Time.fixedDeltaTime;

    // Set the player's new velocity
    rb.velocity = new Vector2(speedX, speedY);
}

My player-obstacle collision is handled in the obstacle class, and I am using an action to notify the player about the collision. So I have the ability to have a corresponding method in the player class that get's called when the collision occurs:
public void OnPlayerCollidedWithObstacle(Vector2 collisionNormal)
{
    // TODO:
    // Integrate the following into the above movement code ???
    // 1. Bounce the player off the obstacle
    // 2. Briefly stop the player from moving
    // 3. Continue moving when the player has tapped the screen
}

As a first step, I am thinking to wrap my default movement code in a bool check, so that it doesn't get run when the collision movement code is run.
However, I was hoping for a better, more scalable way?
PS: I would like to keep my movement code custom, so no Unity physics / AddForce / etc.

Update - Here is my attempt:
The following works. However, I am wondering if there is a cleaner / more systematic / more scalable way to handle this?
private void UpdatePlayerVelocity()
{
    // If no player-obstacle collision
    // and player has tapped to start/continue moving
    if (obstacleCollisionTimer <= 0 && playerHasTapped)
    {
        // Calculate the player's vertical movement speed
        float speedY = maxSpeed.y * Time.fixedDeltaTime;

        // Calculate the player's horizontal movement speed
        float speedX = inputDirectionX * maxSpeed.x * Time.fixedDeltaTime;

        // Set the player's velocity
        rb.velocity = new Vector2(speedX, speedY);
    }
    // If player-obstacle collision resolved,
    // but player has not yet tapped to continue moving
    else if (obstacleCollisionTimer <= 0 && !playerHasTapped)
    {
        // Don't move
        rb.velocity = Vector2.zero;
    }
    // If currenty resolving player-obstacle collsion by bouncing player off
    else
    {
        rb.velocity = new Vector2(-collisionNormal.x, -collisionNormal.y);

        obstacleCollisionTimer -= Time.fixedDeltaTime;
    }
}

public void OnPlayerCollidedWithObstacle(Vector2 collisionNormal)
{
    // Collision normal will be used to bounce the player off the obstacle
    this.collisionNormal = collisionNormal;

    // Duration of the "bounce off" movement
    obstacleCollisionTimer = 0.2f;

    // The player needs to tap for movement to start again
    playerHasTapped = false;
}
```

sentences:
line to point collision without doing three square roots Is it possible to test a point to line collision without doing three square roots? Here's how I'm currently doing it:

I have point P that I want to check is on the line, and point A and B for the two ends of the line. I use the Pythagorean equation to get length PA, PB, and AB. Now I check to see if PA + PB = AB. if PA + PB is larger than AB, the point cannot be on the line.

private boolean PTLCollisionCheck(float px, float py, float ax, float ay, float bx, float by) {
    float PA = (float) Math.sqrt(((px - ax) * (px - ax)) + ((py - ay) * (py - ay)));
    float PB = (float) Math.sqrt(((px - bx) * (px - bx)) + ((py - by) * (py - by)));
    float lineLength = (float) Math.sqrt(((ax - bx) * (ax - bx)) + ((ay - by) * (ay - by)));
    return (PA + PB) <= (lineLength + 1);
}

sentences:
What broad-phase collision algorithms are suited to a static tiled world with dynamic objects of different sizes? Sorry for this routine question, but I can't think of what broad-phase collision algorithms really work in the following, reasonably standard, setup:

2D tile based world, consisting of objects that do not move but might be altered/changed in some ways (not too often).
Significant amount of dynamic objects, interacting with eachother and with the static tiles. These objects can be of variable size, possibly much larger than the tile size.

I started thinking about using just a grid to store the static tiles, but that has its issues. One example would be a level which is a long corridor following the edges of a square; I'm anxious about creating a whole nxn grid when there is a huge amount of irrelevant space in the middle. Also I'm not sure a grid is going to be helpful when figuring out what needs to be considered for collision, or needs to be drawn on screen; a quadtree seems more appropriate.

So far, I'm thinking of:

using a quadtree to store the static tiles (to account for the possibility of large empty spaces in the middle of the grid for instance); hopefully that won't be prohibitively expensive when I need to modify some tiles (this shouldn't happen excessively often);
using some other data structure (I'm undecided which is most suited) to store the dynamic objects, which might have very different sizes;
once that's done, from the tile map I determine which tile edges are empty, solid or need further investigation for collisions; then I would use axis aligned bounding boxes for the dynamic objects to see if there is a possible collision with the static world, and some other algorithm (depending on the data structure for the dynamic objects) to model collisions between dynamic objects.

Maybe something slightly different would be more suited for the tiles, I'm thinking some sort of grid but with "off limits" regions that can be dismissed.
I'm also somewhat anxious about fast-moving dynamic objects; so maybe those could belong to yet another data structure. I wouldn't expect them to be of large size (so they should fit inside tiles nicely), but I'd like to keep my options open in case I make some design changes.

(One thing I am completely neglecting is what generally happens with off-screen dynamic objects; I'm ignoring that problem for now and assuming everything is to be simulated together, but that might be a blunder.)

sentences:
Is It Possible To Reset UI To Initial State At Runtime Without Any Direct Assignments? Is it possible to reset UI to it's initial state (the state when game started) without directly reseting elements one by one?

Thanks in advance.

Edit: I'm asking for runtime. (ResetToPrefabState doesn't work at runtime.)

sentences: Detect if two objects are going to collide I am working on a car game where I am to create an AI. In the game there are other cars and a few objects moving around that I do not want to crash with, I have the speed, position and direction of all objects including my own car, but how would I go about calculating if my car is on a collision course with another object given my current speed and the other objects current speed? I tried coming up with an algorithm myself but I'm not very good at algebra.

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:
How many testers should I get for my game? I made a game for my bachelor final project. How many testers should I get to play-test my game? Is there any theory about that?

Would be really helpful if you can give any citation or source, since most likely my examiner will ask about that.

Thanks!

sentences:
Player animating the wrong direction once he is rotated I have used the scripting root motion move the player when using an 'inplace' animation.

All works correctly until the players rotation is off 0,0,0.
This is expected as the movement is along the transform.z axis but how can I account for the rotation in the script and apply it so the movement is correct in game?

The gorillacontroller script is the script we are trying to fix On playerGorilla. animator is on the playergorilla. The gorilla1 is the gameobject holding the mesh and the bones for the character.

I will also add the transforms are moving this was my silly mistake because I had tool handles in global instead of local.

This makes it even more confusing however because all tranform.z (blue axis) are facing the correct way for the animation to work but the animation is only ever playing in the original direction where the rotation is 0,0,0,0.

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Animator))]

public class RootMotionScript : MonoBehaviour {

    void OnAnimatorMove()
    {
          Animator animator = GetComponent<Animator>();

          if (animator)
          {
               Vector3 newPosition = transform.position;
               newPosition.z += animator.GetFloat("Runspeed") * Time.deltaTime;
               transform.position = newPosition;
          }
    }
}

sentences:
Cocos 2D putting things on the cocos thread or not? We are using Cocos 2D for Android and are unsure if it's a good thing to execute our non-ui tasks on the Cocos thread as a way to get the animations in our game to pause.

What is the recommended practice?

sentences:
Find third point in right triangle I need to get position marked as green X.
I have the helicopter's world position and the player's world position. I want X to always have an angle of 90 degrees.
Player heading is ignored.
How can I obtain the position X.

sentences:
How do I maintain game balance while promoting interaction between dead and alive players? How do you motivate players to be content with randomly selected roles that are often complex to play and differ drastically in playstyle (AND to stick around till the end of game)?

Some background: Town of Salem is a more diversified and polished version of the popular "party games" such as Mafia and Werewolf. There are about 30 roles with offensive/defensive/supportive/investigative specializations, assigned to players at random. Most of all, many roles have unconventional abilities that provide incentives for any player to stay engaged during each stage of a game session (i.e. early-game/initiative, mid-game, and end-game)

For example: Medium can chat with dead players. The catch is that the names of such dead players ("out of play") are anonymous to Medium. In this sense, it provides a greater flexibility in player contribution overall with a strong emphasis on mid and late-game . Players are motivated to keep deducing and cooperating until the game is declared over (as opposed to sitting back once they are out of play) knowing that their intel can affect the outcome via Medium regardless of how early they were killed off.

I am also interested to see examples from multiplayer games in the same genre.

sentences:
Gravity and Jumping in Clickteam Fusion 2.5 So I'm currently building a bare-bones functioning game that involves simple platforming. Quite literally a box moving left and right and jumping.
I'm using Clickteam Fusion 2.5, and I know there's an option to assign platforming movement to an active object, but I honestly do not enjoy implementing that feature one bit.

So instead I'm opting for simply adding or subtracting from the X and Y coordinates of the player object while the left and right arrow keys are held down for side-scrolling movement.

However, I have yet to figure out how to use this same method for jumping and gravity. I know being able to jump would be running an event that occurs after hitting a certain key, which takes in the current Y-coordinate of the player and runs it through a parabolic formula. And then gravity would simply be constantly subtracting from (or I guess in Fusion's case, adding to) the current Y-value of the player object while the frame is running.
So the question simply is where and how do I implement these things in order to create jumping and gravity. I figure there's a correct syntax for a parabolic formula when creating an event after "jump" is pressed, but for the life of me I can't figure it out. As for gravity, I'm completely lost. I have managed to get down stopping movement when colliding when another object so that is not an issue.

Thanks and appreciation in advance.

sentences:
Unity 2D detect if swipe goes through an object I am developing a game in unity with flying arrows that the user tries to deflect by swiping through them (changing their direction). I can get the arrows to move with the swipes, but they move no matter where the swipes occur. I want them to only move (be affected) iff the swipe goes through the arrow. Here's what I have so far:

public class swipe : MonoBehaviour
{

private Vector2 leftFingerPos = Vector2.zero;
private Vector2 leftFingerLastPos = Vector2.zero;
private Vector2 leftFingerMovedBy = Vector2.zero;

public float slideMagnitudeX = 0.0f;
public float slideMagnitudeY = 0.0f;

bool touched = false;

void Update()
{
    if (Input.touchCount == 1)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            leftFingerPos = Vector2.zero;
            leftFingerLastPos = Vector2.zero;
            leftFingerMovedBy = Vector2.zero;

            slideMagnitudeX = 0;
            slideMagnitudeY = 0;

            // record start position
            leftFingerPos = touch.position;

        }

        else if (touch.phase == TouchPhase.Moved)
        {
            leftFingerMovedBy = touch.position - leftFingerPos; // or Touch.deltaPosition : Vector2
            // The position delta since last change.
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            // slide horz
            slideMagnitudeX = leftFingerMovedBy.x / Screen.width;

            // slide vert
            slideMagnitudeY = leftFingerMovedBy.y / Screen.height;

            if(touched)
            {
                //rigidbody2D.velocity = new Vector2(slideMagnitudeX, slideMagnitudeY)*20;
                rigidbody2D.AddForce(new Vector2(slideMagnitudeX, slideMagnitudeY)*5000);
                touched = false;
            }
        }

        else if (touch.phase == TouchPhase.Stationary)
        {
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }

        else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
        {
            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }
    }

}

void OnMouseEnter()
{
    touched = true;
}
}

The only way I have been able to find so far is using "onMouseEnter" which only works for very slow swipes.

How do I detect whether a swipe goes through an object?

sentences: 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:
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:
How to get error line when debugging APK from Logcat I made android game by Unity and built APK. When I got error from this game, I can see the error message:

07-06 00:35:38.905: I/Unity(31609): (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
07-06 00:35:38.906: E/Unity(31609): NullReferenceException: Object reference not set to an instance of an object
07-06 00:35:38.906: E/Unity(31609):   at GameManager.OnRealTimeMessageReceived (Boolean isReliable, System.String senderId, System.Byte[] data) [0x00000] in <filename unknown>:0
07-06 00:35:38.906: E/Unity(31609):   at GooglePlayGames.Native.NativeRealtimeMultiplayerClient+OnGameThreadForwardingListener+<RealTimeMessageReceived>c__AnonStorey4.<>m__0 () [0x00000] in <filename unknown>:0
07-06 00:35:38.906: E/Unity(31609):   at GooglePlayGames.OurUtils.PlayGamesHelperObject.Update () [0x00000] in <filename unknown>:0
07-06 00:35:38.906: E/Unity(31609):
07-06 00:35:38.906: E/Unity(31609): (Filename:  Line: -1)

However file name and error line is wrong, so I can't check where exactly error came from.

I checked my logic almost 2 hours also the object references too, but there is no logic to access undefined object code.

It could be, but I can't see where it is. I must run this app because it uses Google Play Games Service, so it requires completed built APK without developlemt option checked.

Using Application.RegisterLogCallback not much help, it has exactly same result.

How do I get exact error line in this case?

sentences:
Fog Of War - Is looping over every tile inefficient? I'm trying to optimize my static FOW code for my 2D tile-based game and the bottleneck seems to be in the rendering of the fog (rather than the circle drawing algorithm or other aspect of the code).

It's a fairly simple implementation - there are two steps.

First, the game renders everything normally as if there is no fog. Then after the fact, the FOW code loops over every row and every column of tiles and if the tile is "hidden" behind fog, it draws black over the tile.

Everywhere on the web I see that this is the method most used - but to me it seems like it'd be much more efficient to set all of the tiles black, and only show through the tiles which are visible.

Although this sounds logical, in my case it turned out to be not very efficient either.

The Fog grid's tile size is different than the actual game's tile size, which provides some special challenges.

Are there any better methods for generating the Fog of War?

(The game's implementation is in Java, I can provide pseudocode if you'd like.)

Any help is appreciated.

EDIT: I've tried 2 circle-drawing algorithms, and there was little difference in performance (the original proved a little faster).

When I moved the fog code into the level drawing loop, I saw a notable performance increase, but it isn't a lasting solution because my fog grid size is larger than my map grid size.

EDIT 2: Here's the pseudocode - I don't feel comfortable posting the real code, as it isn't mine to post.

Level.render

for all x
    for all y
        if {x,y} is in view of camera
            render tile

for all visible entities
    if entity is in view of camera
        render entity

call FOW.render()

FOW.render

for all x
    for all y
        if {x,y} is in view of camera
            if tile is hidden by fog
                 render fog

sentences:
how to store game state for a multiplayer board game eg. poker First Approach: Store the state in database and play with database queries. Could a database handle the load, as poker is quite fast paced, and I have to query/update database for each player move.

Second Approach: Store the state in memory. What kind of architecture/implementation is needed to achieve this?

What are the pros/cons of each approach, what other options do I have?

What is the best fit for poker, and/or chess?

sentences:
Thick Ray interaction with AABB I would like to intersect a thick ray (actually a cylinder) with an AABB.
The current code to perform intersection with the ray is the following.

template <class RealT>
bool CAABB<RealT>::Pick(const CPoint3T & base, const CVector3T & dir) const
{
    // SLAB based optimized ray/AABB intersection routine
    // Idea taken from http://ompf.org/ray/

    RealT l1 = (_minPnt.x - base.x) / dir.x;
    RealT l2 = (_maxPnt.x - base.x) / dir.x;
    RealT lmin = minT( l1, l2 );
    RealT lmax = maxT( l1, l2 );

    l1 = (_minPnt.y - base.y) / dir.y;
    l2 = (_maxPnt.y - base.y) / dir.y;
    lmin = maxT( minT( l1, l2 ), lmin );
    lmax = minT( maxT( l1, l2 ), lmax );

    l1 = (_minPnt.z - base.z) / dir.z;
    l2 = (_maxPnt.z - base.z) / dir.z;
    lmin = maxT( minT( l1, l2 ), lmin );
    lmax = minT( maxT( l1, l2 ), lmax );

    if( (lmax >= 0.0f) & (lmax >= lmin) )
    {
        // Consider length
        const CVector3T rayDest = base + dir;
        CPoint3T rayMins( minT( rayDest.x, base.x), minT( rayDest.y, base.y ), minT( rayDest.z, base.z ) );
        CPoint3T rayMaxs( maxT( rayDest.x, base.x), maxT( rayDest.y, base.y ), maxT( rayDest.z, base.z ) );
        return
            (rayMins.x < _maxPnt.x) && (rayMaxs.x > _minPnt.x) &&
            (rayMins.y < _maxPnt.y) && (rayMaxs.y > _minPnt.y) &&
            (rayMins.z < _maxPnt.z) && (rayMaxs.z > _minPnt.z);
    }
    else
        return false;
}

I would like to write a routine that takes an additional parameter for ray_thickness (diameter of the cylinder) and compute the intersection.

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:
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:
Doubts with results of per-vertex lighting shader I'm researching simple shaders to add to my DirectX 11 project such as a per-vertex diffuse shader plus specular reflection component.

I'll begin with the results:

Seems specular reflection is working, but do you see the border and upper objects? They don't seem to be lit well, as a shader based on this lighting equation is not supposed to gray-scale the diffuse component (excepting when dot product < 0 in backfaces,etc).

My HLSL vertex shader rationale is as follows, I dont  know at this point of the day, if i'm missing something.

Vertex shader input / Output structs are defined as:

// Output and Input Structs
// ------------------------

struct VS_OUTPUT {
    float4 pos       : SV_POSITION;
    float4 color     : COLOR;
};

struct VS_INPUT {
    float4 pos : POSITION;
    float4 norm: NORMAL;
};

1) Transform the input position to world coordinates:

vo.pos = mul(vi.pos, worldMatrix);

2) Transform normal to world and normalize:

float4 N = normalize(mul(vi.norm, worldMatrix));

3) Calculate the vector from the light position to the current vertex position.
   Lighting is already in world coordinates. w=1.0, so:

 float4 L = float4(normalize(float4(light[0].pos.xyz,1.0f) - vo.pos));

I have camera position in world coordinates passed through Cbuffer, so camera minus vertex position yields V vector.

float4 V = normalize(cameraPos - vo.pos);

4) Use reflect intrinsic to calculate R, negating L since it's pointing towards   light.

float4 R = reflect(-L, N);

5) Finally I calculate the color to pass to the pixel shader, and transform the vertex position with the view/projection matrices.

 vo.color = ka + ke + kd * saturate(dot(N, L)) + (ks * pow(saturate(dot(V, R)), specp));
    vo.pos = mul(mul(vo.pos, viewMatrix), projMatrix);
    return vo;

Just for completion, here are the constant buffers:

#define MAX_LIGHTS 16

cbuffer bufWorldMatrix : register (b0) {
    float4x4 worldMatrix;
}

cbuffer bufViewProjMatrix : register (b1) {
    float4x4 viewMatrix;
    float4x4 projMatrix;
    float4   cameraPos;
}

cbuffer materialProperties : register (b2) {
    float4 kd;
    float4 ka;
    float4 ks;
    float4 ke;
    float  specp; // Specular-power (shininess)
}

struct LightBase {
    float3 pos;
    float3 color;
    float  intensity;
    float  isOn;
};

THanks, any help is appreciated. I'm sure normals are OK, but I can recheck in case. I can post additional debugging/ code if it's required.

sentences:
Why do separate loops run faster than one loop that does multiple things? My game had some lag, so I tried to improve the performance.

I found that if I write my loops separately like this:

for (...){
    for (...){
        // Do operation A
        // (Fill int[][] with 1s)
    }
}

for (...){
    for (...){
        // Do operation B
        // (Work with Sprite Renderers & Spritebatch)
    }
}

for (...){
    for (...){
        // Do operation C
        // (Work with Shape Renderers with alpha)
    }
}

then the result runs a whole lot faster than if I try to do all the operations in one loop:

for (...){
    for (...){
        // Do operation A
        // Do operation B
        // Do operation C
    }
}

Can anyone explain this?

I'm running this game on Android OS!

sentences:
Recording equipment for game sounds I was wondering if anybody knows about any good pieces of equipment fit for recording sound effects for games.
If you can, also tell please me the price range for professional equipment.

sentences:
2DRaycast is shooting slightly in wrong directions I wanted just a simple 2DRaycast, which points from my character to my mousePointer. So I found the following code in the Internet, most people seem to use it like that. So I tried it, but it isn't working for me like it is supposed to do, check the screenshot below. The direction is kinda weird, so I tried some variants of the variables and tried with Normalize, which didn't solve the problem.

    Vector2 test = new Vector2 (Camera.main.ScreenToWorldPoint (Input.mousePosition).x, Camera.main.ScreenToWorldPoint (Input.mousePosition).y);
    Vector3 test1 = (Camera.main.ScreenToWorldPoint (Input.mousePosition));
    //test.Normalize ();
    RaycastHit2D hit = Physics2D.Raycast (transform.position, test);
    Debug.DrawRay (transform.position, test, Color.red);

I tested both variables, test and test1, same things happen, even with Normalize and without it. The following Screenshot shows, what happens (The red thing is the mouse pointer).

Edit:

Solution:

    Vector2 test = new Vector2 (Camera.main.ScreenToWorldPoint (Input.mousePosition).x, Camera.main.ScreenToWorldPoint (Input.mousePosition).y);
    Vector3 test1 = (Camera.main.ScreenToWorldPoint (Input.mousePosition));
    //test.Normalize ();
    RaycastHit2D hit = Physics2D.Raycast (transform.position, test1 - transform.position);
    Debug.DrawRay (transform.position, test1 - transform.position, Color.red);

I use now the second variable, because we need the Vector3 here, because we substract with Transform.position which is a Vector3.

sentences:
OpenGL - Texture disappears I'm making a simple program with C++, SDL and GLEW. So far it is going great but I ran into a weird problem. One of my four textures would not show up on screen even though it used the same code as the other three. EXAMPLE: https://www.dropbox.com/s/4038p0yv041mhdy/Sk%C3%A4rmdump%202014-09-10%2021.37.48.png?dl=0
HOW IT SHOULD BE:
https://www.dropbox.com/s/huhln17zjip1pjb/Sk%C3%A4rmdump%202014-09-10%2021.39.04.png?dl=0

But the weird thing is how I fixed it.
NOT WORKING:

  _sprite[0].init(0.0f, 0.0f, 1.0f, 1.0f, "kitten.png");
  _sprite[1].init(-1.0f, -1.0f, 1.0f, 1.0f, "kitten1.png");
  _sprite[2].init(0.0f, -1.0f, 1.0f, 1.0f, "kitten1.png");
  _sprite[3].init(-1.0f, 0.0f, 1.0f, 1.0f, "kitten.png");

WORKING:

  _sprite[1].init(0.0f, 0.0f, 1.0f, 1.0f, "kitten.png");//Switched around the 0 and the 1
  _sprite[0].init(-1.0f, -1.0f, 1.0f, 1.0f, "kitten1.png");
  _sprite[2].init(0.0f, -1.0f, 1.0f, 1.0f, "kitten1.png");
  _sprite[3].init(-1.0f, 0.0f, 1.0f, 1.0f, "kitten.png");

I only changed the index when the init function was called and all of a sudden it started to work again. So my question is: Why does the texture not display when I'm using index 1 but working when I'm using index 0.

Nothing happened when I only changed the draw function.

INIT FUNCTION:

void Sprite::init(float x, float y, float w, float h, std::string image) {
//Loads image, initilaze the varibles and generate the Vertex Buffer Object(VBO)
_texture = ResourceManager::getTexture(image);

_x = x;
_y = y;
_w = w;
_h = h;

if(_vboid == 0) {
   glGenBuffers(1, &_vboid);
}
if(_eboid == 0) {
   glGenBuffers(1, &_eboid);
}
//The vertex data
Vertex vertexData[4];
//Specify which vertices to reuse
GLuint elementdata[6] = {
   0, 1, 2,
   2, 3, 0
};

//Top right corner position
vertexData[0].setPosition(_x + _w, _y + _h);
vertexData[0].setTexCoord(1, 0);

//Top left corner position
vertexData[1].setPosition(_x, _y + _h);
vertexData[1].setTexCoord(0, 0);

//Bottom left corner position
vertexData[2].setPosition(_x, _y);
vertexData[2].setTexCoord(0, 1);

//Bottom right corner position
vertexData[3].setPosition(_x + _w, _y);
vertexData[3].setTexCoord(1, 1);

for(int i = 0; i < 4; i++) {
   vertexData[i].setColor(255, 255, 255, 255);
}

//Let's set some special color

//Binds the buffer, then upload data to the GPU and the last thing it does is unbind the     buffer
glBindBuffer(GL_ARRAY_BUFFER, _vboid);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _eboid);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elementdata), elementdata, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

sentences:
The farther I move my character, the more its projectiles fire in the wrong direction I'm making a top down shooter, and the movement is working fine.
However, I'm having trouble getting my Fire function to work correctly. When I run the game, it kind of fires in the right direction, but the more I move, the more off the shooting becomes. Anyone have any idea why?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    private float _horizontalInput = 0;
    private float _verticalInput = 0;

    public int movementSpeed = 2;
    public int rotationSpeed = 2;

    Rigidbody2D rb2d;

    float coolDown = 0;

    public Rigidbody2D bulletPrefab;
    public float attackSpeed = 0.5f;
    public float bulletSpeed = 500;
    public float yValue = 1f; // Used to make it look like it's shot from the gun itself (offset)
    public float xValue = 1f; // Same as above

    // Start is called before the first frame update
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
    }

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

        MovePlayer();
        RotatePlayer();
    }

    void Update()
    {
        GetPlayerInput();

        // Determines if the player can fire
        if (Time.time >= coolDown)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                Fire();
            }
        }
    }

    private void GetPlayerInput()
    {
        _horizontalInput = Input.GetAxisRaw("Horizontal");
        _verticalInput = Input.GetAxisRaw("Vertical");

    }

    public void MovePlayer()
    {
        rb2d.velocity = transform.right * Mathf.Clamp01(_verticalInput) * movementSpeed;
    }

    private void RotatePlayer()
    {
        float rotation = -_horizontalInput * rotationSpeed;
        transform.Rotate(Vector3.forward * rotation);
    }

    private void Fire()
    {
        Rigidbody2D bPrefab = Instantiate(bulletPrefab, new Vector3(transform.position.x + xValue, transform.position.y + yValue, transform.position.z), transform.rotation) as Rigidbody2D;

        bPrefab.GetComponent<Rigidbody2D>().AddForce(transform.position * bulletSpeed);
        coolDown = Time.time + attackSpeed;
    }
}

sentences:
I am looking to create realistic car movement using vectors I have goggled how to do this and found this http://www.helixsoft.nl/articles/circle/sincos.htm I have had a go at it but most of the functions that were showed didn't work I just got errors because they didn't exist. I have looked at the cos and sin functions but don't understand how to use them or how to get the car movement working correctly using vectors. I have no code because I am not sure what to do sorry.

Any help is appreciated.

EDIT:

I have restrictions that I must use the TL engine for my game, I am not allowed to add any sort of physics engine. It must be programmed in c++. Here is a sample of what i got from trying to follow what was done in the link I provided.

if(myEngine->KeyHeld(Key_W))
    {
        length += carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_S))
    {
        length -= carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_A))
    {
        angle -= carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_D))
    {
        angle += carSpeedIncrement;
    }

    carVolocityX = cos(angle);
    carVolocityZ = cos(angle);

    car->MoveX(carVolocityX * frameTime);
    car->MoveZ(carVolocityZ * frameTime);

sentences:
MonoGame does not generate xnb from png I am coming straight from XNA and I installed the latest version of MonoGame today (2015-12-22) for Visual Studio 2015 Community. I created a project from the windows Project template.

I right click the content folder and add a png-file. I compile without error but it stops during runtime because it can't find the content file. My solution look like this

Game1.cs look like this:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace homer
{
    public class Game1 : Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        private Texture2D simpson;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {
            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            simpson = Content.Load<Texture2D>(@"Images/Homer");
        }

        protected override void UnloadContent(){ }

        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
            spriteBatch.Draw(simpson, new Vector2(200, 100), Color.White);
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}

The problem I encounter is that MonoGame do not make xnb-files from the png and put it in my output folder. I tried to copy the file manually from a compiled XNA project to my MonoGame debug folder and it worked. I have done nothing but create a project from the template and trying to load an image. What do I need to do to make MonoGame compile xnb-files for me. It also runs if I change "Do not copy" to "Copy always" but that is not optimal for runtime as I understand it. Also, I don't want it to be too easy for the users to doodle in the graphics.

Content.mgcb look like this

#----------------------------- Global Properties ----------------------------#

/outputDir:bin/Windows
/intermediateDir:obj/Windows
/platform:Windows
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#

#---------------------------------- Content ---------------------------------#

sentences:
Currently developing a game with Android SDK, should I switch to a game engine in future projects? I am an android developer, and I've made several apps on the Google Play Store. I'm currently working on my first game, which is just a simple RPG for android, that I'm coding in Java with the android SDK. I went to an indie game conference recently, and one of the veterans, asked why I didn't use Unity or another game engine to build my game, so it could be easily ported later on. Which got me to wonder if I should use a game engine, since I do want to port this game to other platforms.

So, my question is, should I try to adapt to a game engine to make my future projects, if so, which game engines should I look into?

Thanks!

sentences:
iPhone 3d Model format: .h file, .obj, or some other? I'm beginning to write an iPhone game using OpenGL-ES and I've come across a problem with deciding what format my 3D models should be in.  I've read (link escapes me at the moment) that some developers prefer the models compiled in Objective-C .h files.  Still, others prefer having .obj as these are more portable (i.e., for deployment on non-iPhone platforms).

Various 3D game engines seem to support many(?) formats, but I'm not going to use any of these engines as I would like to actually learn OpenGL-ES.  Am I putting myself at a disadvantage here by not using a packaged engine?

Thanks!

sentences: Hinting at Steganography I'm working on an ARG which will be implemented mostly through a standard website. I'd like to give some of the images on the site steganographic content (hidden content stored in an image, e.g. an 8 color image of the same dimensions stored as even and odd color values in the pixels). Technologically, this is fairly easy to do. However, I'm having trouble figuring out a subtle way to hint at the presence of this content. The effect itself is invisible to the naked eye, and nobody just randomly checks for this kind of thing. What can I do to draw players' forensic attention to these images, while still maintaining an amount of subtlety (i.e. something that doesn't make it glaringly obvious)?

sentences:
outline object effect How can I achieve an outline effect similar to the ones found in League of Legends or Diablo III?

Is it done using a shader? How?
I would prefer answers that are not tied up to any particular engine but one that I can adapt to whatever engine I'm working on.

sentences:
Get video chipset manufacturer in Direct3D I'd need to know if the video chipset Direct3D runs on is from Nvidia, AMD or Intel.

Is there a way to do that?

sentences:
Unity NavMesh pathfinding using Job System I'm trying to write a system where I can run each enemy's NavMesh pathfinding in parallel, using Job System.

The problem I'm having is that I can't pass the NavMesh agent argument as it's a reference type.

  InvalidOperationException: PathfindJob.agent is not a value type. Job structs may not contain any reference types.

I'm probably approaching this problem in a completely wrong way, but this is all I've come up with.

Here's the current Enemy code

using System.ComponentModel;
using Managers;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Jobs;

namespace Characters
{
    [RequireComponent(typeof(Rigidbody))]
    public class Enemy : MonoBehaviour
    {
        [Header("Stats"), SerializeField] private int _health = 100;
        [SerializeField] private int _damage = 20;
        [SerializeField] private float _aggroRadius = 10f;

        private Rigidbody _body;
        private NavMeshAgent _agent;
        private Transform _target;

        private void Awake()
        {
            _body = GetComponent<Rigidbody>();
            _agent = GetComponent<NavMeshAgent>();
            _target = PlayerManager.GetInstance().GetPlayer();
        }

        private void OnDrawGizmosSelected()
        {
            Gizmos.color = Color.blue;
            Gizmos.DrawWireSphere(transform.position, _aggroRadius);
        }
    }

    public struct PathfindJob : IJobParallelForTransform
    {
        public Vector3 TargetPosition;
        public NavMeshAgent Agent;
        public float AggroRadius;

        public void Execute(int index, TransformAccess transform)
        {
            var distance = Vector3.Distance(TargetPosition, transform.position);

            if (distance < AggroRadius)
                Agent.SetDestination(TargetPosition);
        }
    }
}

I'm scheduling the job from the GameManager class.

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 control which path a unit will take? This might be a really easy solution that I probably just do not know due to lack of experience so thanks for any and all the help. TLDR at bottom of post.

I'm still learning Unity / C# and I am following Brackey's Tower Defense tutorial series while adding my own twist.
The tutorials use levels with only 1 available path for units to walk along. However, the game I am currently developing has 3 separate paths that units can walk along.

Essentially, the game is similar to the mobile game Clash Royale with 3 lanes except it is also a tower defense.

Here is the current layout:

The different lanes are empty gameObject labeled as Path1 (red), Path2 (blue), and Path3 (green).
The nodes laid out in each path are all children objects of their respective path.

Each of the parent path objects contain the following script:

public class Waypoints : MonoBehaviour
{
    public static Transform[] points;

    private void Awake()
    {
        points = new Transform[transform.childCount];
        for (int i = 0; i < points.Length; i++)
        {
            points[i] = transform.GetChild(i);
        }
    }
}

Now, following the tutorial, I have also successfully added an enemy that contains this EnemyMovement script:

public class EnemyMovement : MonoBehaviour
{
    public float speed = 10f;

    private Transform target;
    private int waypointIndex = 7;

    void Start()
    {
        target = Waypoints.points[7];
    }

    void Update()
    {
        Vector3 dir = target.position - transform.position;
        transform.Translate(dir.normalized * speed * Time.deltaTime);

        if(Vector3.Distance(transform.position, target.position) <= 0.2f)
        {
            GetNextWaypoint();
        }
    }

    void GetNextWaypoint()
    {
        if(waypointIndex <= 0)
        {
            Destroy(gameObject);
            return;
        }

        waypointIndex--;
        target = Waypoints.points[waypointIndex];
    }
}

Now, as it currently stands, whenever I have an enemy present on the field, it will successfully run down path2 (blue nodes). However, it will ONLY run down path2. I would like to be able to decide which path the enemy will take. Eventually, the enemy's actions will be decided by an Enemy AI.

The player will also be able to spawn units and will be able to decide which path the unit will travel.

So to reiterate:

TL;DR: Following Brackey's Tower Defense tutorial. Currently, enemy will always default to path2. I need to figure out how to have control over which path, out of 3 options, an enemy or friendly unit will take.

sentences:
How are the layers used in MagicaVoxel? I can't figure out how they are used, how to actually use them, or what they are meant for. I would have thought I could assign blocks or colour palettes to a layer...turn it off and temporarily hide/delete it while I work with specific sections etc. I'm clicking around and highlighting and trying to get it to work but all I can do is assign the entire box of voxels to 1 layer and turn that on/off.

I've been unable to find any documentation explaining how to use the layers.

sentences:
MonoGame Gamepad Y axis flipped? I'm following a book I bought on Google Play that is teaching me the ropes of MonoGame, and in Chapter 2 it introduces creating an input wrapper that takes care of all the input methods for a game pad or keyboard. What's supposed to happen is that the WASD keys is mapped to the same inputs that the right thumb-stick would be on the game pad, but what happens for me is that the WASD keys move up and down correctly, but on the game pad it is flipped for some reason. I've looked over every line that I think would cause the problem, even replacing my code with the source code in the book, and the project they provide as an example works perfectly, but my project using THEIR code does not. If anyone can look over my project and see what the problem could be, that would be awesome!

Project: Here

MonoGame Book (Would Recommend So Far): Here

sentences:
Why does my PBR material appear grey in game? I am playing around with PBR materials and I cant get them to work correctly. When I create a material using PBR the model appears gray in game. Any ideas on why I’m not getting the same result?
val floorMaterial = Material(assetManager, "Common/MatDefs/Light/PBRLighting.j3md")
floorMaterial.setTexture("BaseColorMap", assetManager.loadTexture("Textures/Floor_Diffuse.png"))
floorMaterial.setTexture("NormalMap", assetManager.loadTexture("Textures/Floor_Normal.png"))
floorMaterial.setTexture("SpecularMap", assetManager.loadTexture("Textures/Floor_Specular.png"))
val sun = DirectionalLight()
sun.color = ColorRGBA.White.mult(1.3f)
sun.direction = Vector3f(-.5f, -.5f, -.5f).normalizeLocal()
main.rootNode.addLight(sun)
val lightProbe = LightProbe()
lightProbe.position = Vector3f(0f, 10f, 0f)
addLight(lightProbe)

For comparison when I use regular lighting this is the result
val floorMaterial = Material(assetManager, "Common/MatDefs/Light/Lighting.j3md")
floorMaterial.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Floor_Diffuse.png"))
floorMaterial.setTexture("NormalMap", assetManager.loadTexture("Textures/Floor_Normal.png"))
val sun = DirectionalLight()
sun.color = ColorRGBA.White.mult(1.3f)
sun.direction = Vector3f(-.5f, -.5f, -.5f).normalizeLocal()
main.rootNode.addLight(sun)
val lightProbe = LightProbe()
lightProbe.position = Vector3f(0f, 10f, 0f)
addLight(lightProbe)

sentences:
How do I modify the health of an entity after it has been created? Is there any way to add or remove health after an entity has been created?

For example, I'd like to have a mob regenerate "hearts" when some event happens.

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: Does Animator.SetBool take precedence over Animator.SetTrigger in Unity's Animator? I've got an Animator with transitions from Idle to Walk or Dash. Walk requires isGrounded to be true and a float MoveX to be greater than .2. The Dash animation requires Dash trigger is returned. In my code, when the shift key is pressed I call anim.SetTrigger("Dash"), if a Walk key is pressed, I set anim.SetBool("Idle") to false and begin increasing MoveX. The problem I'm noticing is that when I play, and hit the dash button, it first starts walking and then after playing that animation it will then perform the dash animation. Looking in the animator as this is happening, it's clear that the walk animation plays in full before moving to the dash animation. What can I do to give priority to the Dash animation when that button is pressed?

sentences:
How can I refactor "attack cooldown" into "attack speed"? I'm building a game where the player's character can attack bad guys and vice versa. I built this with the concept of an "attack cooldown" because I don't want units to be able to attack each other every single frame.  I want there to be some delay between attacks.  Here's roughly how it works:

if unit.ticksUntilAttack <= 0
  unit.attack(target)
  unit.ticksUntilAttack = unit.attackCooldown
unit.ticksUntilAttack = unit.ticksUntilAttack - 1

I also have a page where I show the character's stats and list this as "Attack Cooldown".  I was showing my friend and he said, "Why don't you rename that to 'Attack Speed'"?  I explained that it's not really the speed at which you attack because "smaller is better".  We both agreed that "attack speed" is a more standard way to show this concept and that I should change things the way he suggests.

The problem for me is that "attack cooldown" is a much more intuitive way for me to program the solution.  I'm wondering if there's some "trick" to refactoring the current code I've got.  I'm thinking something like this:

if unit.attackSpeedAccumulator >= SUM_NEEDED_TO_ATTACK //a constant that's the same for every unit
  unit.attack(target)
  unit.attackSpeedAccumulator = 0
unit.attackSpeedAccumulator = unit.attackSpeedAccumulator + unit.attackSpeed

Is there a smarter way to do this?

sentences:
2.5D game vector choice I'm developing 2.5D game (3D assets, 2D gameplay). Since gameplay takes place on horizontal plane, majority of game objects have y component equal to 0. Most of my algorithms work on Vector2s, since these calculations obviously make more sense (and are a little bit faster, I guess). This makes field for hard to catch bugs, since Unity allows transparent conversion from Vector3 to Vector2 via cutting off z component.

Since I'm still in a stage in which I can change calculations quite easily, my question is: which approach will cause me the least trouble?

Current: Gameplay on XZ plane, custom conversion from Vector3.XZ to Vector2.XY
Gameplay on XZ plane, calculations on Vector3.XZ (and making sure, that y is always 0 - otherwise some of calculations may be erroneous)
Gameplay on XY plane (that may cause some problems in editor I guess) and automated conversion from Vector3.XZ to Vector3.XY
Gameplay on XY plane, calculations on Vector3.XY (though I see no benefit over solution 2)

Or is there some other approach I may take?

sentences:
Unity scene preview keyboard controls I am learning to use Unity, and found I disliked the way moving around the scene editor is implemented. The left and right arrow keys move the scene "camera" left and right as expected, but the up and down editor moves forwards and backwards. Is there a way to change the controls to make it more like a "traditional" WASD movement, similar to how Minecraft on touch devices does it (up, down, left, and right moves exactly as it sounds, and rotation is by clicking and dragging the mouse)?
Thank you for your time.

sentences:
Mobile Unity Shader - how to work with on/off boolean How do you set a boolean for a shader?
How do you write a conditional or assign a boolean in a shader?

So, it seems that shaders do not take booleans... so I tried assigning the float to 0 or 1 ren.material.SetFloat("_ZWriteVal", 1f);, but it doesn't seem to work...

 Shader "ZTestLess"
{

 Properties {
_Color ("Color", Color) = (0,0,0)
[Toggle(Z_WRITE_VAL)]
_ZWriteVal("Z Write Val", Float) = 0
}

SubShader
 {
    Tags { "Queue" = "Background" }

    Pass
    {
        CGPROGRAM
        #pragma shader_feature Z_WRITE_VAL

         #ifdef Z_WRITE_VAL
            ZWrite On
         #else
            ZWrite Off

           ZTest Less
            Color [_Color]
            Lighting Off

         ENDCG
    }
}
}

sentences:
Using Unity and MonoBehavior for UI only? I've made a turn-based game (think xcom) in Unity, and because I don't need real-time, asynchronous elements, or physics calculations I decided to make a pure c# Model (in the sense of Model, View, Controller) which everything is based on. I use Unity and a MonoBehavior based game loop to handle rendering, camera, UI and input, but stuff like a character attacking another and then calculating a counterattack, or player equipment and spells, are all pure c#.

Am I missing some capabilities of Unity that I should be looking at or is this a basically reasonable approach?

sentences:
Unity - Raycast not hitting to BoxCollider2D objects I'm working on 2D and I have a Quad as background.

And some wall sprites over this quad :

I'm instantiating wall prefab sprites over quad when user click to somewhere. But I don't want to instantiate a wall over another wall, so I'm sending a ray from camera to click point and if hit object is a wall object I won't instantiate.

Here my code :

RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        Physics.Raycast(ray, out hit,Mathf.Infinity);
        // If it hits ground, not another objects (like walls)
        if(hit.transform.name == "GroundQuad")
             Instantiate (wall, Input.mousePosition, Quaternion.identity)

But it's still creating wall objects. Tried Debug.Log() to print hitted object's name to console and moved pointer all over game screen, it's always GroundQuad. So ray not hitting to wall objects.

Can you tell me what is I'm missing? Is it a problem with Layer Collision Matrix ?

sentences:
Is it possible to use animated .gif images in lbgdx? Is it possible to use animated .gif  images in lbgdx? If not how whats the alternative? We need to include animated buttons.

When I use an animated gif, the animation won't play. This question (and many others) states that Libgdx doesn't support it, I'm wondering if something has changed over the years

sentences:
How to draw geometric shapes to a texture? How can I create a texture containing a geometric figure using SDL2?

I saw there is a way to convert Surface to Texture, and I also saw that there is a way to draw directly to the screen using DrawRect() / FillRect() functions... I'm not sure if the geometry has something similar. Ultimately I want to have a texture to render.

The way I'm making my engine draw is to read game objects' texture and copy it to the render using render.Copy(texture, rect1, rect2).

This makes me wonder if there's a way for my game object to hold a texture containing a rect, circle, or triangle texture. I couldn't find in the SDL wiki or tutorials online.

sentences:
About to release a free game on Google Play Store, any legal considerations I should take into account? I will release in the next few weeks a small free game on the Google Play Store. I was wondering if there was any important legal aspects I should consider before release.

Here's a few infos:

I'm doing this alone.
There's no code/graphic assets/gameplay concepts I would like to protect in particular. I don't have any issues with people copying something from my game.
I'm not sure right now, but maybe I'll add the possibility to make a small donation (so there will be IAP in a sense).
I'm using a music track from http://opengameart.org/. The author has specified that it wasn't necessary to credit him, though I would like to.

sentences:
Animation imported from Blender into Unity via FBX doesn't play? I started building this model in Blender and gave it a simple animation that rotates the board about the axel.

...I exported it as FBX and imported it into Unity. I can see the animation is stored in the file when I import, but I can't find an animation file after I drop it in the scene, and there is no controller for the Animator controller it generated, either. I can watch the animation play in the FBX preview thumbnail but nowhere else.

How can I get my animation working?

sentences:
How to organize a fallback system for older GPUs in OpenGL? I don't want to make this question too broad or opinion based, but I really need some help about good practices.

The scenario:

I created a particle engine with functions which require at least OpenGL 4.3. But some GPUs don't support this version, so I want to try to implement a fallback system for it.

But it's not only the particle system. There are many features in 3D engines that can't be simply replaced by a different function name. Some features need different logic behind them and it can go quite complex.

What are the best practices to manage fallback rendering in OpenGL?

sentences:
How to combine VAO and shader language? I'm new and trying to draw a very simple quad with VAO and GLSL.

My definitions:

typedef struct SPos
{
    float x;
    float y;
} SPos;
SPos mVertices[6];
SPos mIndicies[6];
GLuint mVao;
GLuint mVertexVbo;
GLuint mIbo;

These are my steps:

Load Vertex, Fragment code (I'm sure that no mistake in this step) and get programID
Create VBO

glGenBuffers(1, &mVertexVbo);
glBindBuffer(GL_ARRAY_BUFFER, mVertexVbo);
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(SPos), mVertices, GL_STATIC_DRAW);

Create IBO.

mIndices[0] = 0;
mIndices[1] = 1;
mIndices[2] = 2;
mIndices[3] = 3;
glGenBuffers(1, &mIbo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIbo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 4 * sizeof(GLuint), (GLuint*) mIndices,\
    GL_STATIC_DRAW);

Create VAO

glGenVertexArrays(1, &mVao);
glBindVertexArray(mVao);
glUseProgram(mProgram);

GLint posLoc = glGetAttribLocation(mShader.program, "a_posL");
glEnableVertexAttribArray(posLoc);
glBindBuffer( GL_ARRAY_BUFFER, mVertexVbo );
glVertexAttribPointer( posLoc, 2, GL_FLOAT, GL_FALSE, 0, 0 );

glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, mIbo );
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

Render loop.

mVertices[0].x = -50.0f;
mVertices[0].y = -50.0f;

mVertices[1].x = 50.0f;
mVertices[1].y = -50.0f;

mVertices[2].x = 50.0f;
mVertices[2].y = 50.0f;

mVertices[3].x = -50.0f;
mVertices[3].y = 50.0f;

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindVertexArray(mVao);
glDrawElements( GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, 0 );
// GLES2 swap function.
eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );

These are my shaders

fragment:

#version 300 es
precision mediump float;

out vec4 oColor;
uniform vec4 unifColor;

void main()
{
    oColor = vec4(1);
}

vertex:

#version 300 es

in vec2 a_posL;

void main()
{
    gl_Position = vec4(a_posL, 1.0, 1.0);
}

Nothing is draw in the screen. What's wrong?

All above is follows a VAO tutorial on the internet.

I spend 1 day to debug and scan it very carefully but not work.

EDIT:

Thanks GOD. The problem is that I setted the data of mVertices in render step, have to set it before create VBO.

I'm still confuse that glBufferData need a pointer for data but Why I cannot pass the address of data then assign its value in later? Why I have to assign its value before bind it to VBO?

sentences:
Unity3D Build Configuration for Deployment/ Publish Is there the option within Unity3D to specify build configurations?

My goal is relatively simple - when building for mobile stores (Play Store/ App Store) I want to make sure my app is pointing to the production services, rather than the test one I use in the editor/ testing on devices.

It's controlled by a field on a MonoBehaviour currently, but we I need to remember to flip it from Test to Production before doing a build and publish.

sentences:
Validating victory report to PHP leaderboards I have decided to begin working on some sort of leaderboard server for my PC game.

For starters, I decided to write some PHP scripts to handle it. The script doesn't actually receive a score - it just receives a player ID. Then the server increases their score. When submitting a "victory", the game performs a connection to the server of this form:

http://www.example.com/doVictory.php?ID=Joe

As you can see, the server just receives the player ID and then it does its own scoring stuff (the score value of a victory changes overtime).

My concern is pretty simple: what if some guy figures this out? They would be able to spam the above address several times and keep increasing their score.

One option:

Don't accept victories from the same player within a short amount of time.

Due to the nature of the game, players can have a victory as fast as within 1 minute. If somebody is having a victory every minute, I would not be able to tell whether they are cheating or just very good.

I have found an answer here: https://gamedev.stackexchange.com/a/4185/4779

  Send a JSON message over plain HTTP (not HTTPS). Include a MD5-hash of all fields plus a magic string.
  On the server, check the integrity of the message with the same operation.

But as far as I'm concerned, this doesn't quite work with my scenario because I am not really sending a score - just reporting a victory.

sentences:
Why aren't my isometric objects where I think they are? Background
I am creating an isometric RPG using Tiled and Monogame. My goal is to have relatively elaborate terrain and movement, with my vision for the overworld being much like the now-venerable Megaman Battle Network franchise. As such, by world must be 3D and simply drawn on top of an isometric map assembled from tiles.
Quirks
The Monogame.Extended system for drawing Tiled maps does so mostly on its own, though I have elected to draw a layer at a time and render any sprites I need to between the layer draw calls. The layers do not use the SpriteBatch I have configured to draw movable sprites, and just take a translation. I've managed to become decently adept at navigating it to convenient locations.
The Issue
Wikipedia says that for a good isometric scene, you want to rotate 45 degrees around Z and something like 32 degrees around what in my system is X. In my case, the resulting transformation does not seem to match the map image, so I am using an angle of approximately 52 degrees around X, which matches up fairly well. However, while the map itself can be perfectly aligned to the collision system, and I'm able to walk around the edges perfectly, objects within the map seem oddly placed. Some of this may be due to my incorrect handling of the Z (world upward) index, but it seems more than that. When I align the image so that it lines up with them instead of the edges of the map, their sizes seem subtly incorrect - I have found, for instance, that if my X rotation is negative, the objects (which are distant) seem slightly smaller than how they are drawn. I could be misreading that, however.
EDIT: The only distortion, if there is indeed any, seems to be in the viewport's Y direction. I collide where I expect to horizontally.
My Assumption
I believe this may simply be a camera issue - perhaps the default camera is not orthographic or something?  I don't really know the way to fix that if so, and if not, I'm mystified by what is going on.

sentences: How to open a .RKV file from Wii ISO So, a few days ago, I got the itch to try my hand at creating a modded version of one of my favorite Wii games: Star Wars: The Force Unleashed. However, when I unpacked the ISO, I noticed some of the files had the extension .RKV. I have scoured the internet in search of any information, but all I could find was that this file extension is typically associated with RKive archives. After going through all the trouble of getting that software to run on a Win95 VM, it too could not open the file. In fact, it said it wasn't even an RKive archive. I have spent all whole day researching with no progress, so if anyone could tell me what this file extension is and how to open it, I would greatly appreciate it.

sentences:
Hashing 3D position into 2D position I am doing volumetric raycasting and curently working on depth jitter. I have 3D position on ray and want to sample 2D noise texture to jitter the depth.

Function for converting (or hashing) 3D position to 2D have to produce absolutely different numbers for a little changes (especialy because i am sampling in texture space so sample values differs very very little) and have to be "shader-wise" - so forget about branches, cycles etc.

I'm looking forward for yours nice and fast solutions.

sentences:
How to assign an instance of an object to an array? Game Engine: Gamemaker Studio

I am making a game similar to bejeweled. I decided to use an array to control everything. Placing instances of objects themselves in to the array seems to be the best way to accomplish this because then I won't have to check where the square is in the room, and then compare it to where in the array that lines up, and so on and so forth.

However, I can't figure out how to do that. How do I do it?

sentences:
What are some techniques for designing fun, challenging Mario-style platformer levels? I have everything I need to make a Mario type game. I just have no idea how to design the levels to make it challenging or fun. Any tips?

The only way to kill enemies is by jumping on them, so I thought it would be too hard to make a boss. I was just going to make the last level long. Is this a bad idea?

sentences:
MySQL for MMO-Development... What do i have to consider ? Im currently developing an little mmo.
Its pretty basic, players can walk around... gather some resources... build some simple buildings and craft things.

Before i began to develop i read a lot about benefits using MySQL... Now im not sure if MySQL was the right choice for such a project.

Currently i store player specific data in real time, that means... once a player crafted, builded or gathered something, a server request is send which triggers a MySQL - Query to insert a new Row into the specific table.
This happens everytime a player moves, crafts, gathers or builds something.

I dont only store player-specific data in those tables... also world specific data, for example if one player visits a zone which was last updated 6 hours ago, i refresh this zone with resources and mobs. The server is generating them and after that, it inserts them as a bulk into the database.

With only one active player this works fine... but i have no idea if this will still work with dozens or hundreds active players at the same time. The serverside itself is able to handle them... but i have no idea if the database is able to.

I also heard bad stuff regarding table locks... That this is somekind of major iusse using MySQL, how does this effect dozends of database actions per seconds ? And could possible "share" be a solution for this ?

What else do i need to consider while using MySQL for a mmo ?

sentences:
MMORPG Server architecture: How to handle player input (messages/packets) while the server has to update many other things at the same time? This is more or less like what I'm thinking up to now:

while(true)
{
    if (hasMessage)
    {
        handleTheMessage();
    }
}

But while I'm receiving the player's input, I also have objects that need to be updated or, of course, monsters walking (which need to have their locations updated on the game client everytime), among other things.

What should I do? Make a thread to handle things that can't be stopped no matter what? Code an "else" in the infinity loop where I update the other things when I don't have player's input to handle?
Or even: should I only update the things that at least one player can see?
These are just suggestions... I'm really confused about it.
If there's a book that covers these things, I'd like to know.

It's not that important, but I'm using the Lidgren lib, C# and XNA to code both server and client.

sentences:
Unreal Engine 4 -- Casting I am currently developing my first classes in Unreal Engine 4. Coming from using UScript extensively, I'm getting a little bit confused by how typecasting works in pure C++. More specifically, class/object casting.

I am currently putting together a switch statement in MyCustomGameMode which calls upon MyCustomPlayerController for MyCustomPlayerControllerVariable.

The function in question that I am overriding is this one: virtual UClass* GetDefaultPawnClassForController(AController* InController);

Currently I'm trying to call the variable with the following line of code, which I know is incorrect, but I'm not sure why:

Cast<MyCustomPlayerController>(InController).MyCustomPlayerControllerVariable

I am interested in casting the "InController" to MyCustomPlayerController but Cast<MyCustomPlayerController>(InController) doesn't seem to work, what am I doing wrong here?

sentences:
'Edit Collider' exits after every adjustment When I click the Edit Collider button I can see the collider's region and the handles to adjust it.

After every adjustment (with the mouse) the collider outline disappears as Edit Collider finishes.  It's frustrating to use, having to reclick Edit Collider after every drag/click.

How do I stop Edit Collider mode from exiting after every change and only exit if I click the button, or press some commit key?

sentences:
Calculate the best route for racing games I'm trying to structure a system for rating player's performance in my arcade-style racing game. So I'm thinking about calculating the best route possible, and trying to guide the player towards the best way of driving.
Is there any work into such problem? Links to papers/implementations would be awesome.

sentences:
Are there alternatives to Vertex Tweening? Now that I'm getting into animating 3D entities in my game, I was wondering what the best approach for this would be. I did some research and came across something called "Vertex Tweening". However, most of these articles (like this one: http://archive.gamedev.net/archive/reference/articles/article2017.html) are from 2003, if not older!

In a DirectX 9 game which makes proper use of HLSL to do its rendering magic, is Vertex Tweening still the way to go these days (anno 2013), or are there other techniques I'm not aware of yet?

sentences:
How do I make my character jump on a platform? This is the code I've written so far:

Html:

Land

    <button id="howtobutton">Instructions</button>
    <button id="hsbutton">High Score</button>
    <button id="optionsbutton">Options</button>
    <button id="playbutton">Play Game</button>

How to Play

      <button class="backtomenu">Back to Menu</button>

High Scores

    (Username), your high score is:
    <button class="backtomenu">Back to Menu</button>

Options

    <button class="backtomenu">Back to Menu</button>

 Score:

      <button id="btn-quit" class="backtomenu">Back</button>

CSS:

div {
  border: 1px solid black;
} h2 {
  text-align: center;
} button {
  display: block;
  width: 100px;
  margin: 10px auto;
} #stage {
  width: 400px;
  height: 400px;
  overflow: hidden;
  position: relative;
  background-image: url(http://www.hlgjyl888.com/data/wallpapers/151/WDF_1917288.gif);
  background-size: cover;
} #splash {
  display: block;
} .screen {
  position: relative;
  display: none;
  width: 100%;
  height: 100%;
  color: white;
} #player {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  position: absolute;
  background-color: blue;
  bottom: 50px;
  top: 269px;
  left: 100px;
}
} #score {
  position: relative;
  top: 0px;
  right: 5px;
  width: 100px;
} #btn-quit {
  position: absolute;
  margin: 0;
  bottom: 0px;
  left: 0px;
} .platform {
  position: absolute;
  background-color: white;
} .onPlatform {
  background-color: blue;
}
#ground {
  top: 300px;
  width: 400px;
  height: 3px;
}

JavaScript:

var gravity = 1;
var maxheight;
var timer;
var jump = 32;
var velocity = 0;
var jumppressed = false;
// var username = prompt("What is your name?")

$(document).ready(function() {

  $('#howtobutton').click(function() {
    showScreen('#instructions');
  });
  $('#hsbutton').click(function() {
    showScreen('#highscores')
  });
  $('#playbutton').click(function() {
    showScreen('#game')
  });
  $('#optionsbutton').click(function() {
    showScreen('#options')
  });
  $('.backtomenu').click(function() {
    showScreen('#splash')
  });

maxheight = Math.round($("#stage").height() - $("#player").height());

timer = setInterval(update, 1000/60);

   $(document).keypress(function(e) {
    console.log(e.which);
    if (e.which === 32) {
      console.log("it works");
      jump();
    }});
});

function showScreen(screen) {
$('.screen').hide();
$(screen).show();
};

function jump() {
  if ($("#player").position().top >= maxheight) {
    console.log("Jump is working")
    velocity = -15;
  }
};

function update() {
  if (velocity === 0 && $("#player").position().top === maxheight) {
  } else if (velocity > 0 && $("#player").position().top >= maxheight) {
    console.log(maxheight + " through ground" + $("#player").position().top);
    $("#player").css("top", maxheight + "px");
    velocity = 0;
  } else {
    velocity += gravity;
    var newPos = $("#player").position().top + velocity + "px";
    $("#player").css("top", newPos);
  }
};

However I'm very new to game development, I've been stumped for a while now, I can't figure out a way to control my character movement. Can anyone tell me what's wrong with my code? My character should be jumping on the platform whenever the space key is pressed (that's it).

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:
How to abstract mouse movement event streams for networked multiplayer? I'm building a mouse driven 3rd person shooter with client-server network architecture.

My input system is event based. Keyboard input is captured by keys.S.onUp() keys.S.onDown() events. When these events are triggered I immediately pass them across the network to be replicated on the server and other clients.

Mouse input is captured by a mouse.onmove() event that receives data from screen coordinates x,y. This method is fired constantly as the mouse is moved producing a flood of data. This may be premature optimization, but I feel like its a bad idea to immediately pass this flood over the network.

I currently have an abstraction that wraps the mouse.onmove() event and creates essentially a mouse.moveStart() and mouse.moveStop(). This significantly reduces the flood of mouse input to send on the network.

Unfortunately, this abstraction produces a less responsive feel on the local client experience. I am setting a lookVelocity. When mouse.moveStart() is triggered the camera position and player rotation is updated per-frame by the lookVelocity value. This produces a stiff fixed rate movement. If you rapidly move the mouse the camera movement is not reflected.

Additionally, this is an isomorphic/universal code base. Meaning I am using the same code between client and server. Ideally, I would like to reuse the same mouse event abstraction between both client and server.

sentences:
How to manage game-object script component and values in new updated model in unity I have several objects/Models/FBX that contain different childrens and it attached several mono-behavior scripts with different values assigned publicly in the inspector (settings). SO of the assignments are manually drag-and-drop in the inspector.

Now the problem is each time we update the model in the project (FBX in the project) we have to drag and drop the model/FBX again in the hirarchy. It means that we have to attach all the scripts again with the values/Data (that we assigned in the inspector) again.

I am currently looking for the right way to do this job. Currently, I place both new and old Models in the scene and then one by one I copy-paste the old object's script component into the new objects by viewing every child of an object. Then, I delete the old one model from the hirarchy. It is a very time consuming process. I want to automate it. Just like Unity I should save all the information (Components and assignment) of a game-object in a separate file (meta file custom) and bring them again on button click. But its challenging as i dont know how to save assignments (refrence objects).

Note: I have to bring the fbx again in hierarchy because sometimes the object not properly update in the scene. Like mesh gets rotate or scaled in weird manner. Or sometime FBX childs are removed or add.

sentences:
Creating a 3rd Person Flying Camera for 3D asteroids game In order to learn PyOpenGL and test out an engine I am developing, I am trying to write a 3D asteroids flying space shooter game. Currently, I am implementing the camera using a "look at" function positioned right behind the player's ship. The player is able to control the yaw and pitch with the left+right and up+down arrow keys respectively. The results look like this (forgive the placeholder art):

And here is the code snippet in my Player class that implements that:

from pyorama.entity import Entity
from pyorama.math3d.vec3 import Vec3
from pyorama.math3d.mat4 import Mat4
import math

class Player(Entity):

    def __init__(self, model, camera):
        self.model = model
        self.center = self.model.mesh.compute_bounding_sphere().center
        self.model.transform = self.model.transform.translate(-self.center)
        self.camera = camera
        self.key_down_status = {"Left": False, "Right": False, "Up": False, "Down": False}
        super(Player, self).__init__()

    def update(self):
        messages = super(Player, self).update()
        for message in messages:
            if message.event_type == "key_down":
                key = message.data["key_name"]
                if key in self.key_down_status.keys():
                    self.key_down_status[key] = True
            if message.event_type == "key_up":
                key = message.data["key_name"]
                if key in self.key_down_status.keys():
                    self.key_down_status[key] = False

        self.model.transform = self.model.transform.translate(self.center)
        if self.key_down_status["Up"]:
            self.model.transform = self.model.transform.rotate_x(-0.01)
        if self.key_down_status["Down"]:
            self.model.transform = self.model.transform.rotate_x(0.01)
        if self.key_down_status["Left"]:
            self.model.transform = self.model.transform.rotate_y(0.01)
        if self.key_down_status["Right"]:
            self.model.transform = self.model.transform.rotate_y(-0.01)
        self.model.transform = self.model.transform.translate(-self.center)
        self.model.transform = self.model.transform.translate(Vec3(0, 0, 0.1))

        right = self.model.transform.data[0:3]
        up = Vec3(*self.model.transform.data[4:7])
        forward = Vec3(*self.model.transform.data[8:11])
        position = Vec3(*self.model.transform.data[12:15])

        temp = self.model.transform
        self.model.transform = self.model.transform.translate(+self.center)
        right = self.model.transform.data[0:3]
        up = Vec3(*self.model.transform.data[4:7])
        forward = Vec3(*self.model.transform.data[8:11])
        position = Vec3(*self.model.transform.data[12:15])

        self.camera.view = Mat4.look_at(position - 20 * forward, position, up)
        self.model.transform = temp

As you can see, the ship stays perfectly still behind and the world rotates around. As a result, it looks very unnatural, as if a 2D ship sprite was simply glued onto the screen!

So my question is, how are third-person cameras in flying games typically implemented? What would a keyboard+mouse control scheme look like that controls yaw, pitch, roll, banking, acceleration/deceleration, etc? Would the camera controls for the camera be separated from moving the ship? Any help would be greatly appreciated.

sentences:
How is time/duration handled in strategic games? I'm considering developing a space opera game, having already done some game design. Technically, though, I'm coming from a business applications background. Hence I don't really know how I should handle time and duration.

Let's state the matter clearly: what if something is bound to happen in 5 hours and on which other events depend.

For example the arrival of some space ship in some system where some defense systems are present, hence a fight would start.

The aim is to do some web application, so with multiple nodes for better scalability and the like. Hence a single loop on one node wouldn't do it. Should there be a master node or are they some better known solution?

Furthermore, the loop in itself doesn't resolve this duration issue: between firing of the event on its ends, many loops happen. Does it mean every loop should check such "waiting" actions?

Should I use some kind of scheduler (like Quartz in my java land) to trigger the corresponding event when due (I plan to use events for communication)? Something else?

sentences: The best option to multi-platform 2d mobile development we are in the process of porting a game from iphone(made with cocos2s) to android(using the andEngine), and it has been a pain to do. So for our next project (a 2d game) we are thinking about using some multiplatform engine/framework. For now we are thinking about testing both unity, marmaled(former airplay sdk) and cocos2d-x. Do you have any opinion about this? Does someon have experience developing 2d games using Unity?

sentences:
How can I mod Minecraft 1.7.9? I've looked up a lot of tutorials on YouTube and all of them only work for versions of Minecraft prior to 1.7.9.

I first got a Minecraft Coder Pack (MCP) off of this website, but then realized that only decompiles Minecraft 1.6.4. Then I found a more recent MCP (that's not on the website for some reason) and it is version 9.03, downloaded here. This decompiles Minecraft version 1.7.2 (when I followed this video's instructions, I run the decompile.bat file and it says Json file not found in C:\Users\mike\AppData\Roaming\.minecraft\versions\1.7.2\1.7.2.json).

Basically I can't decompile Minecraft 1.7.9, but I can decompile older versions. However, I don't have any older versions downloaded onto my computer. I have only 1.7.9.

Then I tried using Forge, but realized that most videos were using versions of Minecraft prior to 1.6.4, meaning they use the bin folder that does not exist anymore. Even after trying to figure that out as well, the decompiling would never work. I tried to do what this video did, but couldn't replicate it. Then I finally looked at this video about using Forge and I could replicate it, but this didn't decompile Minecraft. It just set up a workspace in Eclipse that I'm not sure how to use.

TL;DR

I can decompile Minecraft 1.6.4 and 1.7.2 but I can't decompile version 1.7.9. Should I download an older version of Minecraft, wait for an MCP for 1.7.9, or something else? Is there something I'm missing, where I actually can decompile and mod Minecraft 1.7.9?

sentences: Libgdx Particle Editor: Blank UI elements How can I get Libgdx Particle Editor to run properly on my 32-bit Windows 7 machine? When I run it, the UI elements are blank like this:

sentences:
Advices fo starting a video game design career I'm 24 and have a passion for video games and game-design. I've decided I want to design video games as my career.

I have no experience with designing video games or coding but I'm interested and willing to learn. I want a job at any level but what would I need to land a job?

I have no college experience and I have no money. What is a cheap school, or do I really need to go to school for this, or can I learn on my own? Is it possible to do this with no money? I'm literally broke but I want this so bad I feel like its the only career I'll enjoy.

I want to call up company's and ask them what they are looking for in someone they want to hire, is that a good idea?

Also I don't know the history of video game design and I don't want to sound like a dummy when someone says something about this field or talks about a famous designer and I have no idea who they're talking about. So what is key info when it comes to this field and where should I find it?

Hopefully some of you guys and girls can help me out: I know in the future I will create something everyone will enjoy and you guys will remember when you gave me advice and I will always remember you guys for helping me. I'm gifted I know I am and I want to share my gift with the rest of the world by making games that change the Industry. Help me out please.

sentences:
How Best to Implement Fixed Time Step for Gsync/Freesync Monitors? I currently implement my game loop using a variable fixed timestep, i.e. dt = 1 / monitor_refresh_rate with vsync (or pseudo vysnc with delays where vsync is disabled). I want to maintain using a fixed timestep to keep the replay system I have implemented. For variable refresh rate monitors like gsync and freesync, I'm unsure as to how best accomodate them using this pattern. I'm aware that I could easily cap the loop at say an assumed 60fps and that would work fine. However, I feel that this would not be taking full advantage of what these monitors  have to offer as I'd be effectively restricting their frame limit.

Any advice?
Thanks.

sentences:
Would A* or Dijkstra be more proper for a grid-based tactics game? In a grid-based tactical game (think Fire Emblem), would A* or Dijkstra be more proper for finding a path to use for enemy AI to determine the best place to move?

A* has a better performance that Dijkstra, however Dijkstra may offer me better/smarter looking results for an AI.

If possible, I'd like to have the answer for both a hexagon based grid, and a rectangle based grid, if it'll make a difference.

sentences:
Rendering performance for Flash games I was reading on SO about native flash rendering vs building a custom BitmapData frame buffer and some of the answers were a bit conflicting, so I was wondering:

Is it generally best practice to go the custom Bitmap buffer route or is it best to leave rendering to the flash engine?
If you're using vector animations (MovieClips) as opposed to sprites, does that change the answer to the above?
If so is it best practice to use sprite based animations?

(I'm targeting Flash 10 if that makes any difference)

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:
LWJGL: Camera distance from image plane? Let me paste some code before I ask the question...

public static void createWindow(int[] args) {

    try {

        Display.setFullscreen(false);
        DisplayMode d[] = Display.getAvailableDisplayModes();
        for (int i = 0; i < d.length; i++) {
            if (d[i].getWidth() == args[0] && d[i].getHeight() == args[1]
                    && d[i].getBitsPerPixel() == 32) {
                displayMode = d[i];
                break;
            }
        }

        Display.setDisplayMode(displayMode);
        Display.create();

    } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
    }

}

public static void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1.0);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GLU.gluPerspective(45.0f, (float) displayMode.getWidth()
            / (float) displayMode.getHeight(), 0.1f, 100.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

So, with the camera and screen setup out of the way, I can now ask the actual question: How do I know what the camera distance is from the image plane? I also would like to know what the angle between the image plane's center normal and a line drawn from the middle of one of the edges to the camera position is.

This will be used to consequently draw a vector from the camera's position through the player's click-coordinates to determine the world coordinates they clicked (or could've clicked).

Also, when I set the camera coordinates, do I set the coordinates of the camera or do I set the coordinates of the image plane?

Thank you for your help.

EDIT: So, I managed to solve how to calculate the distance of the camera... Here's the relevant code...

private static float getScreenFOV(int dim) {
    if (dim == 0) {
        float dist = (float) Math.tan((Math.PI / 2 - Math.toRadians(FOV_Y))/2) * 0.5f;
        float FOV_X = 2 * (float) Math.atan(getScreenRatio() * 0.5f / dist);
        return FOV_X;
    } else if (dim == 1) {
        return FOV_Y;
    }
    return 0;
}

FOV_Y is the Field of View that one defines in gluPerspective (float fovy in javadoc). This seems to be (and would logically be) for the height of the screen. Now I just need to figure out how to calculate that vector.

sentences:
Built-in Terrain analogs search: is it worth to use imported 3d-model? I think 3d-model is better than the built-in terrain-component in Unity when it comes to optimization. But when it comes to texturing terrain made in 3rd party 3d-modeller, how to apply resulting texture in Unity? If the terrain is too big you can't bake it in UV map. Otherway you should split it in many UV's and each one is separate material, which kills performance in the game. Other decision that i see is to use generated type of material and just tile it across the terrain-mesh, but you can't draw the details like roads on it...

So i'm confused is it really worth it to use Unity's terrain analogs or there is no way to do so efficiently?

sentences:
How to reduce the time taken to path-find to an unreachable location? I have a 2048x2048 map and if I path-find to an unreachable location, it makes the pathfinder go through every node on the map which freezes the thread for 4 seconds.

How can I reduce that time?

I'm using JPS
It's a dynamic map (it changes at runtime)

sentences:
Is state change command less reliable than sending the entire state? I'm asking for a game that I develop right now.
The game is using TCP communication, there's server and multiple clients.
While players in a room are playing the game, I send state update commands in a custom binary protocol every 33 ms. (30 FPS)
Problem is those states are huge - there are players moving, objects spawning and also destructible blocks.

If I were to send all this data a single state update to every player will be huge, resulting in huge bandwidth.

So I'm thinking different approach:

Initially send the huge state with all moving and stationary objects, when the room starts
Do the state update commands every 33 ms, but include just the moving objects, and not include the state and location of the stationary objects.
For stationary objects, issue separate commands to tell they are destroyed or spawned and expect clients to update their copy of the state.

My concern is that it may somehow happen that due to not including the stationary objects in every state update, clients may somehow miss the separate commands that update on those and not reflect that change in their copy of the state.

Here is a visual representation of what I imagine:

Less bandwidth (is it less reliable?):

game started -> obj1 {id,location}, obj2{id,location}, obj3{id,location}
state update 1 -> obj1 {id,location}, obj2{id,location} #assumes obj3 is there
state update 2 -> obj1 {id,location}, obj2{id,location} #assumes obj3 is there
state update 3 -> obj1 {id,location}, obj2{id,location} #assumes obj3 is there
object removed -> obj3 #removing the object locally
state update 4 -> obj1 {id,location}, obj2{id,location} #obj3 not present at this point

More bandwidth - include all objects in every state update and assume if something is not present, it has been removed (is it more reliable?):

game started -> obj1 {id,location}, obj2{id,location}, obj3{id,location}
state update 1 -> obj1 {id,location}, obj2{id,location}, obj3{id,location}
state update 2 -> obj1 {id,location}, obj2{id,location}, obj3{id,location}
state update 3 -> obj1 {id,location}, obj2{id,location} #obj3 is not here, so removing it locally
state update 4 -> obj1 {id,location}, obj2{id,location} #obj3 not present at this point

sentences:
How to implement expiring and self-refreshing buffs in an RPG? I have a turn based RPG with buff system where buffs are always on, and the player has an option to cancel them at any time.

An exception to this system is buffs like "Effect lasts until the end of this turn" or "Absorbs first x points of damage". And I'm thinking of a good way to implement them.

Currently I have these types of effects in game:

enum {
    kBuffOnTurnStart,
    kBuffOnAttack,
    kBuffOnEffect,
    kBuffAlwaysOn
};

I think that I can implement the recharging or expiring buffs as two part buffs - one is the "always on" portion and another a worker portion that will do it's action on turn start. For example, a shield buff has 8 points of damage it can absorb. After it does so, it can no longer absorb damage. At the start of next round the "worker" buff/action would find the linked shield buff and recharge it.

Alternatively, an "always on" buff has some action or behavior associated with it, which is executed on turn start.

What is a simple and clean way to implement auto refreshing or expiring buffs?

sentences:
Separate game engine from game I'm building a simple game engine (or mostly rendering engine) and I would like to separate the "engine" part from the "game" part. So, I've come up with an idea to build "engine" part as a library (static or dynamic) and the "game" part will link to this library. Simple.

However, there is one problem - "engine" part needs to reference some assets i.e. files with source code of builtin shaders (defualt shaders of the rendering engine).

Is there a way to include these shader files into an "engine" library? Or is there any other solution to this problem?

sentences:
Farseer: ApplyForce problem I just tried Farseer and everything is working great. My problem is, that on touch the player should get an force up. Although the touch event works well, the player did not get an force!

Here my code:

 public void Update()
    {

        if (acceleration.Y < 0)
        {
            body.Rotation += ConvertUnits.ToSimUnits(0.05f);
        }

        if (acceleration.Y > 0)
        {
            body.Rotation -= ConvertUnits.ToSimUnits(0.05f);
        }

        while (TouchPanel.IsGestureAvailable)
        {
            var gesture = TouchPanel.ReadGesture();
            if (gesture.GestureType == GestureType.Tap || gesture.GestureType == GestureType.Flick)
            {
                Debug.WriteLine("Okey");
                body.ApplyForce(new Vector2(0, -20));
            }
        }
    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(playertexture, ConvertUnits.ToDisplayUnits(body.Position),null,Color.White, ConvertUnits.ToDisplayUnits(body.Rotation), new Vector2(playertexture.Width / 2, playertexture.Height / 2), 1f,SpriteEffects.None, 0f);
    }

sentences:
Fastest way to get all adjacent tiles? What is the fastest way to get all adjacent tiles in a two-dimensional array of tiles, converted into a single-dimensional array?

If you don't know the answer, then the fastest way to do it in a two-dimensional array would be fine as well.

I tried the following, but it does 9 calculations, which is 1 too much when it comes to optimization.

for(int x = -1; x <= 1; x++) {
  for(int y = -1; y <= 1; y++) {
    if(x != 0 || y != 0) {
      Tile adjacent = Tiles[current.x + x, current.y + y];
    }
  }
}

sentences:
Generating skeleton bind pose from vertex weights Assuming that you know how many bones should be in the skeleton, and you have the bone hierarchy, is it possible to calculate the bind pose of the bones just based on the vertex weights?

To elaborate it a bit, let's say you have a skinned mesh, and each vertex of this mesh has 4 weights (at most). So you have 4 weight values and 4 bone ids for each vertex. Also let's say you have a skeleton with 10 bones, and all you have is the bone hierarchy. You need to position the bones to match the mesh (bind pose).

I am wondering if this can be done just using the weights/bone ids?

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

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

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

sentences:
Help on TileMapRenderer In my project, I'm trying to render a map using TileMapRenderer. But it doesn't show anything when I render it. But when I use some other files from a tutorial they are rendered correctly.

When debugging my TileAtlas instance shows the size as 0.

I have used Texture Packer UI for packing the images. Comparing with the tutorial's files, I can see that the index starts from 1 in my file and 0 in the tutorial. But changing it to 0 wouldn't work also.

map.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
Map
  rotate: false
  xy: 0, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 1
Map
  rotate: false
  xy: 32, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 2
Map
  rotate: false
  xy: 64, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 3
Map
  rotate: false
  xy: 96, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 4
Map
  rotate: false
  xy: 128, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 5

Here is the begining of the tmx file.

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="20" tilewidth="32" tileheight="32">
 <tileset firstgid="1" name="a" tilewidth="32" tileheight="32">
  <image source="map.png" width="256" height="32"/>
 </tileset>
 <layer name="Tile Layer 1" width="20" height="20">
  <data>
   <tile gid="2"/>
   <tile gid="2"/>

Apart from that the tutorial files and my files seems to be similar.

Can anyone help me here.

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:
Writing a minimalistic server for vanilla WoW This is about a personal project I've been longing to do for some time now. Since a while now I have stopped playing WoW, but as I'm quite experienced in C++ I thought I'd try the following:

Write a minimalistic server for
vanilla WoW for experimental,
personal purposes

All it would feature is being able to login with a fixed character, and being able to travel around in the standard maps (non-instance; Kalimdor, eastern kingdoms, etc.) I also don't want to use / modify existing projects such as Mangos in this case, as this would be all about the development process and trying it on my own

My questions to you:

Is the above a realistic objective?
How much work would such a project
require? (Boilerplate code excluded,
just the basic stuff to make the
client "happy")
Do you have any other recommendations
for me regarding this?

sentences:
Are frequent game updates a solution for preventing multiplayer cheating? I'm creating a game on Android where the enforcement of rules can only take place on client side (I can't shift it to server side...think aimbotting but in my case I wouldn't even be able to use heuristics to detect it!).

As I've read many times, the client side is impossible to 100% protect from modification/hacking.

I am going to include protections such as ProGuard obfuscation. But also I'm going to use a formula in the code which encrypts data from the client.

Hackers/cheaters can decompile the code and locate this formula eventually.

But how long will it take for them to uncover the encryption formula? A day, a week? Actually, how long in general does it take for a game to be modded for cheating?

Can I release updates to my game so that by the time hackers release modded versions of my app to public, they become obsolete? If I did release updates, I wouldn't require updates for single player mode, but only when they tried to do multiplayer would a message display telling them they must update.

I just really want to make multiplayer fair and not scare off players because they face opponents with uber-awesome hax.

sentences:
How to determine where on a path my object will be at a given point in time? I have map and an obj that is meant to move from start to end in X amount of time.

The movements are all straight lines, as curves are beyond my ability at the moment. So I am trying to get the object to move from these points, but along the way there are way points which keep it on a given path.

The speed of the object is determined by how long it will take to get from start to end (based on X).

This is what i have so far:

//get_now() returns seconds since epoch
var timepassed = get_now() - myObj[id].start; //seconds since epoch for departure
var timeleft = myObj[id].end - get_now(); //seconds since epoch for arrival
var journey_time = 60; //this means 60 minutes total journey time
var array = [[650,250]]; //way points along the straight paths

if(step == 0 || step =< array.length){
  var destinationx = array[step][0];
  var destinationy = array[step][1];
}else if( step == array.length){
  var destinationx = 250;
  var destinationy = 100;
} else {
  var destinationx = myObj[id].startx;
  var destinationy = myObj[id].starty;
}
step++;

When the user logs in at any given time, the object needs to be drawn in the correct place of the path, almost as if its been travelling along the path whilst the user has not been at the PC with the available information i have above.

How do I do this?

Note: The camera angle in the game is a birds eye view so its a straight forward X:Y rather than isometric angles.

sentences:
Texturing different block types on an optimized voxel mesh I have a cubic world (like Minecraft) where I'm generating chunks. In those chunks, only visible vertices and faces are generated.
Currently, it means that if I have a 2x2x1 chunk, it will generate 8 triangles for the top part (2 for each block). I'm trying to generate only two following this greedy meshing method:

If I combine adjacent faces together, I'd still like to be able to draw transitions in materials between adjacent blocks, something like this:

As you can see it has 3 different tiles: grass, dirt-grass transition, and dirt.
Currently, my shader looks like this:
Shader "MultiTexture_Diffuse_Worldspace"
{

    Properties
    {
        _Color ("Main Color", Color) = (1,1,1,1)
        _TexAbove ("Above texture", 2D) = "surface" {}
        _TexSide ("Side texture", 2D) = "surface" {}
        _TexBelow ("Below texture", 2D) = "surface" {}
        _TexTopSide ("Top side texture", 2D) = "surface" {}
        _Scale ("Texture Scale", Float) = 1.0
    }

    SubShader
    {

        Tags
        {
            "RenderType"="Opaque"
        }

        CGPROGRAM
        #pragma surface surf Lambert

        struct Input
        {
            float3 worldNormal;
            float3 worldPos;
        };

        sampler2D _TexAbove;
        sampler2D _TexSide;
        sampler2D _TexBelow;
        sampler2D _TexTopSide;
        float4 _Color;
        float _Scale;

        void surf (Input IN, inout SurfaceOutput o)
        {
            float2 UV;
            fixed4 c;

            if(abs(IN.worldNormal.y > 0.5))
            {
                UV = IN.worldPos.xz;
                c = tex2D(_TexAbove, UV* _Scale);
            }
            else if(abs(IN.worldNormal.x) > 0.5)
            {
                UV = IN.worldPos.yz;
                c = tex2D(_TexSide, UV* _Scale);
            }
            else if(abs(IN.worldNormal.z) > 0.5)
            {
                UV = IN.worldPos.xy;
                c = tex2D(_TexSide, UV* _Scale);
            }
            else
            {
                UV = IN.worldPos.xz;
                c = tex2D(_TexBelow, UV* _Scale);
            }

            o.Albedo = c.rgb * _Color;
        }
        ENDCG
    }
}

How would I modify this shader to work with faces that have been merged together? Or would I have to keep separate faces per block and handle them individually?

sentences:
Handling polygons in multiple nodes of an Octree I'm building a 3d software renderer for grins to learn the math and rendering concepts. I've implemented the basic drawing of polygons with some basic optimizations like back face culling and frustum culling. Its going pretty well for it being java and all (15k polygons at 30fps at 1900x1080) but I want to implement an Octree to reduce the amount of overdraw happening and correctly sort the polygons for drawing without using a z-buffer for the entire screen.

I get the basic ideas of how to partition the world and how to traverse the tree from front to back to order the polygons correctly, but I'm a bit confused on how to handle polygons that are in more than one node of the Octree.

Some example cases I'm concerned about are:
A floor of 2 big polygons that intersect all of the nodes at the bottom of the Octree
A polygon that extends across a node boundary
I figure I should split the polygon at the node boundaries, but then do I need to check on each frame for objects that have moved in the world that need recalculation in the Octree.

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:
Unity - Main manifest has  but library uses minSdkVersion='17' I got this error message when trying to build and run for Android.

  Error: [Temp/StagingArea/AndroidManifest-main.xml:22,
  /Users/MNurdin/Documents/unity/TangoMotion/Temp/StagingArea/android-libraries/google-unity-wrapper/AndroidManifest.xml:3]
  Main manifest has  but library
  uses minSdkVersion='17'
  UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

Where I can set android:minSdkVersion inside Unity? I'm using Unity5 right now. Please advice.

sentences:
Java collision detection with rectangles I'm trying to get the collision between two squares. I've made a Rectangle object that overlays each one and updates the position every tick.

Then I made a collision method that checks whether they are intersecting or not. It just uses rectangle1.intersects(rectangle2);

That works fine, and it detects the collision, however I can't move when it detects it.

This is my move and collision method at the moment.

public void move(int xa, int ya, Player opponent) {
    if (collision(opponent)) {
        return;
    }

    this.x += xa;
    this.y += ya;

}

public boolean collision(Player opponent) {
    if (rectangle.instersects(opponent.rectangle) return true;
    return false;
}

The detection and stuff works fine, but I can't move. I see why I can't, because the method is returning before it moves anything, but I'm just completely lost for whatever reason on where to go with it. I'm sure it's an easy fix and I'm just not seeing something.

sentences:
Impulse resolution for purely rotational collisions (relative linear velocity = 0) I've been writing a basic physics engine, (loosely) following Randy Gaul's online tutorial. I have been using this equation that he derives:

$$j=\frac{-(1+e)((V^A-V^B)*t)}{\frac{1}{{mass}^A}+\frac{1}{{mass}^B}+\frac{(r^A\times t)^2}{I^A}+\frac{(r^B\times t)^2}{I^B}}$$

(https://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-oriented-rigid-bodies--gamedev-8032)

This equation works well for the majority of all collisions. However, if two objects collide through rotation and rotation alone (that is, their relative linear velocity is 0), an impulse of 0 will be applied since VA - VB is 0. This results in one object clipping into another, passing through as if it were never there. While less noticeable, this can also be a problem for collisions where relative linear velocity is non-zero, but angular velocity is much greater than relative velocity.

This is clearly not how objects would interact with real-world physics. That being said, how would I determine the "effective" relative velocity used in the equation for rotating bodies? I have already tried adding the linear velocity of the collision contact point to the center of mass velocity for both objects, but have gotten unsatisfactory results.

sentences:
How can I prevent seams from showing up on objects using lower mipmap levels? Disclaimer: kindly right click on the images and open them separately so that they're at full size, as there are fine details which don't show up otherwise. Thank you.

I made a simple Blender model, it's a cylinder with the top cap removed:

I've exported the UVs:

Then imported them into Photoshop, and painted the inner area in yellow and the outer area in red. I made sure I cover well the UV lines:

I then save the image and load it as texture on the model in Blender. Actually, I just reload it as the image where the UVs are exported, and change the viewport view mode to textured. When I look at the mesh up-close, there's yellow everywhere, everything seems fine:

However, if I start zooming out, I start seeing red (literally and metaphorically) where the texture edges are:

And the more I zoom, the more I see it:

Same thing happends in Unity, though the effect seems less pronounced. Up close is fine and yellow:

Zoom out and you see red at the seams:

Now, obviously, for this simple example a workaround is to spread the yellow well outside the UV margins, and its fine from all distances. However this is an issue when you try making a complex texture that should tile seamlessly at the edges. In this situation I either make a few lines of pixels overlap (in which case it looks bad from upclose and ok from far away), or I leave them seamless and then I have those seams when seeing it from far away.

So my question is, is there something I'm missing, or some extra thing I must do to have my texture look seamless from all distances?

sentences:
How to set "useGravity" for Rigidbody to entities in Unity For the position you can use this:
[Inject] private ComponentDataFromEntity<Position> _position;

But cant use it for Rigidbody. How to access the parameters for Rigidbody for entities?

sentences:
Keep the prefab connection with FBX The steps I have gone through:

Added an FBX in UnityProject.
FBX added to scene hierarchy.
Made Prefab by dragging the FBX into my assets.

Note that now the model became a prefab in my hierarchy.
Then I added a script to the prefab and assigned some objects and methods to such script.
My problem is that when I import the new FBX in the project my scene object doesn't update as it's linked to the prefab which doesn't see the updated FBX.
Is it possible to update my prefab with the latest FBX so I don't have to rebuild the prefab and reassign all scripts every time?

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:
Control convention for circular movement? I'm currently doing a kind of training project in Unity (still a beginner). It's supposed to be somewhat like Breakout, but instead of just going left and right I want the paddle to circle around the center point. This is all fine and dandy, but the problem I have is: how do you control this with a keyboard or gamepad? For touch and mouse control I could work around the problem by letting the paddle follow the cursor/finger, but with the other control methods I'm a bit stumped.

With a keyboard for example, I could either make it so that the Left arrow always moves the paddle clockwise (it starts at the bottom of the circle), or I could link it to the actual direction - meaning that if the paddle is at the bottom, it goes left and up along the circle or, if it's in the upper hemisphere, it moves left and down, both times toward the outer left point of the circle.

Both feel kind of weird. With the first one, it can be counter intuitive to press Left to move the paddle right when it's in the upper area, while in the second method you'd need to constantly switch buttons to keep moving.

So, long story short: is there any kind of existing standard, convention or accepted example for this type of movement and the corresponding controls? I didn't really know what to google for (control conventions for circular movement was one of the searches I tried, but it didn't give me much), and I also didn't really find anything about this on here. If there is a Question that I simply didn't see, please excuse the duplicate.

sentences:
Smooth Scene transitions with SceneManager and additive scene in Unity I'm trying to work with the new SceneManager class with Unity, I'd like to have smooth transitions between scenes.
Currently I suppose that the only way to do those transitions is to manually implement them on the scene objects leveraging on the fact that scenes can be loaded additively.

In pseudo code I image something like:

for gameObject in previousSceneGameObjects
    gameObject.animateSceneExit()
endFor

for gameObject in nextSceneGameObjects
    gameObject.animateSceneEnter()
endFor

I feel that there is something I'm missing :P which is the best approach that you'd suggest? Is it my approach valid?

sentences:
Difference between 'max distance' and 'radius' in Physics.SphereCastAll I needed a way to check for all gameobjects within a set sphere of my player object.

I found Physics.SphereCastAll which will return a RaycastHit[], exactly what I wanted. But, I am having trouble understanding the method signature/docs.

Basically, it's the two things in the title I am confused on right now:

From Unity docs:

radius    - The radius of the sphere.
maxDistance - The max length of the sweep.

Is 'max length of the sweep' a measurement of time (or degrees?)? I would have thought the length would be the same as the radius (or at least you could calculate it from the radius) but it obviously isn't what I think length means.

sentences:
Is there a better way than to use render targets for a "glowing" effect? I am making glyphs on a wall "glow", by changing how much of the overlay textures light intensity is blended into the diffuse map. The basic approach is to capture the diffuse map into a render target, and then spritebatch.draw(additive) the light intensity texture on top of it.

This worked great for smaller textures. Now I want to do the same for a larger scene that has massive texture maps. It doesn't make sense to capture all of that just to make some portions "glow".

Is there a better way than to use render targets for a "glowing" effect?

sentences:
Projectile movement around spheres of varying gravity I found a game on the Internet called Sagittarius. This game is very fun, and I have a question: how can I make the arrow move like it does in this game? I know each sphere has a different gravity, but when I try to use this formula, it's not working as I expect=. Can any one help me resolve this problem? Thanks.

  public List<PlanetABC> p = new List<PlanetABC>() {
    new PlanetABC(){
        x = 0.91f,
        y = -1.28f,
        gravity = 5,
        r = 5
    },
    new PlanetABC(){
        x = 8.12f,
        y = -1.3f,
        gravity = 3,
        r = 10
    }
};
void Start () {

}
void Update () {
    float gravityOnX = 0;
    float gravityOnY = 0;
    foreach (var planet in p)
    {
        if (Vector2.Distance(g.transform.position, new Vector2(planet.x, planet.y)) > planet.r)
            continue;
        if (planet.x > g.transform.position.x)
            gravityOnX += planet.gravity;
        else gravityOnX -= planet.gravity;

        if (planet.y > g.transform.position.y)
            gravityOnY += planet.gravity;
        else gravityOnY -= planet.gravity;
    }

    if (currentGravityX > gravityOnX)
        currentGravityX -= Time.deltaTime;
    else currentGravityX += Time.deltaTime;

    if (currentGravityY > gravityOnY)
        currentGravityY -= Time.deltaTime;
    else currentGravityY += Time.deltaTime;

    Debug.Log(currentGravityX + "/" + currentGravityY);
    var DEG2RAD = Mathf.PI/180;
    float vx1 = Mathf.Cos(angle * DEG2RAD) * power ;
    float vy1 = Mathf.Sin(angle * DEG2RAD) * power;
    float y = (0.5f * currentGravityY * time + vy1) * time;
    float x = (0.5f * currentGravityX * time + vx1) * time;
    Vector3 pos = g.transform.position;
    pos.x = x;
    pos.y = y;
    g.transform.position = Vector3.Lerp(g.transform.position, pos, Time.deltaTime);
    time += Time.deltaTime;
}

Here is the game: https://gprosser.itch.io/sagittarius

sentences:
Is it safe to cast my 2D points to 3D points for a library which only takes Vector3s? I need to cast a ray in 2D space for bullet collision detection, but the Ray.Intersects method requires a BoundingBox which uses vector3's not vector2's. My question is should I just ignore the Z value and pretend it's a vector2? Raycasting is already slow enough so I think having calculations done in an unnecessary 3rd deminsion should be eliminated even if the value is just 0, but I don't know.

So should I implement my own raycasting system maybe using Bresenham's line algorithm which is for 2 dimensions or should I go the cheap way and make a bounding box a bounding plane?

sentences: Why should I not use MySQL for a browser based game? I keep reading on here that I shouldn't use MySQL for game development/play on the Internet, a browser game.  I understand MySQL wasn't made necessarily for that and for big relational needs.  Ok.  But what do I use then?  I am on a shared hosting, Unix/Linux platform.  What do I use to store my "stats" or other game necessities, level information, player information, etc.

sentences:
how to replace vertex buffer in webGL I want to replace a vertex buffer with another completely different vertex buffer, different size and values, it will not get replaced every frame.

gl.deleteBuffer(vertexBuffer);
vertexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
gl.bufferData(gl.ARRAY_BUFFER, vArray, gl.STATIC_DRAW);

I am using that code to replace it, I don't think it is the correct way because I am getting:

GL ERROR :GL_INVALID_OPERATION : glDrawArrays: attempt to render with no buffer attached to enabled attribute 1

I don't know if this is related to the error but I am rendering using the vertex buffer when I replace it.

sentences:
Passing an UAV to a Pixel Shader in DirectX11 I have a compute shader which task is to take an input image and then blur it using a Gaussian filter approach. The input and output for the compute shader looks like this:

//Input and output resources
Texture2D<float4> InputMap : register(t0);
RWTexture2D<float4> OutputMap : register(u0);

The necessary steps for the compute shader setup is shown below:

//Load SRV with the image first
DX::ThrowIfFailed(CreateWICTextureFromFileEx(D3DHelper::GetDevice(), L"Images/floor.jpg", 0, D3D11_USAGE_DEFAULT, D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE,
        0, 0, 0, m_resource.GetAddressOf(), m_blurTexture.GetAddressOf()));

//Create UAV
D3D11_UNORDERED_ACCESS_VIEW_DESC descView;
memset(&descView, 0, sizeof(descView));
descView.Format = DXGI_FORMAT_UNKNOWN;
descView.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D;
descView.Texture2D.MipSlice = 0;

DX::ThrowIfFailed(D3DHelper::GetDevice()->CreateUnorderedAccessView(m_resource.Get(), &descView, m_UAV.GetAddressOf()));

//Blur image with compute shader
Shader::SetComputeShader("Blur", m_blurTexture, m_UAV, 16, 16, 1);
Shader::UnbindComputeShader();

Now if we imagine that the work of the compute shader is done correctly, the last step would then be to bind the SRV/UAV containing the blurred image to the pixel shader stage for the object which will use the texture. However, this texture seems to end up completely black after the compute shader pass if I do the following binding:

D3DHelper::GetDeviceContext()->PSSetShaderResources(0, 1, m_blurTexture.GetAddressOf());

I believe there are a few more steps missing since I need to get the data from the UAV and not the SRV since the UAV contains the output image. What would be the correct approach?

sentences:
Texture will not rotate with gluSphere I have a gluSphere generated in my display that is rotating, but having a problem with the texture rotating with the sphere as well. So in a nutshell, no matter how the sphere rotates, the texture around the sphere remains in the same position regardless.

How am able to update the texture along with the sphere so that it rotates?

private static Texture testTex;
...

// This method is called in init()
public void sphereTexture(GL2 gl)
{
    InputStream iStream = null;

    try
    {
        iStream = getClass().getResourceAsStream("cratepng.png");
        TextureData data = TextureIO.newTextureData(iStream, false, null);
        testTex = TextureIO.newTexture(data);
        testTex.getImageTexCoords();
        testTex.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
        testTex.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
        iStream.close();
    }
    catch(IOException e)
    {
        e.printStackTrace();
        System.exit(1);
    }
    // Set material properties
    gl.glEnable(GL2.GL_TEXTURE_GEN_S);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT);
    gl.glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP);

    gl.glEnable(GL2.GL_TEXTURE_GEN_T);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT);
    gl.glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP);

    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);

    testTex.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S);
    testTex.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T);
}

// Draw Sphere (FILL, LINE, POINT) method called in display()
public void draw(GL2 gl, GLU glu)
{

    gl.glTranslatef(1f, 0.0f, -20.0f);
    gl.glRotatef(angleSphere, 1f, 0.0f, 0.0f); //90

    GLUquadric sphere = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(sphere, GLU.GLU_LINE);
    glu.gluQuadricTexture(sphere, true);
    glu.gluQuadricNormals(sphere, GLU.GLU_SMOOTH);
    glu.gluQuadricOrientation(sphere, GLU.GLU_OUTSIDE);

    testTex.enable(); // enable texture
    testTex.bind(); // bind texture

    glu.gluSphere(sphere, radius, slices, stacks);

    testTex.disable();
    glu.gluDeleteQuadric(sphere);
    angleSphere += speed;
    //System.out.println(angleSphere);

}

sentences:
Animation, Interpolation, & Structure I have been working on animation in my small game engine recently and I am implementing some interpolation to be used with skeletal animations. I know how to do interpolation but I am not sure where to put the equation that I get out of it.

Do I save an equation for each channel of every bone in the data structure? Maybe something along the lines of:

struct Channel
{
    std::string boneName;
    std::vector<KeyFrame> keyframes;

    // These equations will be used to find the position/rotation/scale of
    // the bone at t time.
    std::vector<float> rotEqX, rotEqY, rotEqZ;
    std::vector<float> translateEqX, translateEqY, translateEqZ;
    std::vector<float> scaleEqX, scaleEqY, scaleEqZ;
};

Do I just calculate the equation every time I want to update the animation? (Seems a little inefficient?)

sentences:
FollowPath steering behavior I'm having a problem with AI movement in my top-down game. AI builds path and than moves using libgdx FollowPath (this problem is still actual) steering behavior. I have some solutions, but can't guess whitch is better(or I even need other solution). FollowPath params:

followp = new FollowPath<Vector2, LinePathParam>(this,
            new LinePath<Vector2>(path));
    followp.setPredictionTime(0.08f);
    followp.setArriveEnabled(true);
    followp.setArrivalTolerance(0.001f);
    followp.setDecelerationRadius(40f);
    followp.setTimeToTarget(0.1f);

Problem. Character doesn't move straightly according to the path - cuts corners through obstacles.
Solution 1. Find right proportion between character speed/acceleration, character size, obstacles size. Curent parameters: maxLinearSpeed = 100; maxLinearAcceleration = 150; maxAngularSpeed = 15; maxAngularAcceleration = 30; characterRadius=40; obstacleSize=120 (width and height). But if acceleration and speed are too big, character will move like "on rails" and even sticks on corners. Too small - character will be skidding.

Solution 2. Write own FollowPath steering behavior, whitch requires character to get close enough to every point of the path (without using predictionTime,that prevents sticking, but allows cutting corners) and using Arrive on every point of the path, that won't allow skidding.

Solution 3. Use RaycastObstacleAvoidance with FollowPath together(Priority steering). Here comes another problem: cause of raycasting character shakes (especially when it needs to turn around near wall or just target is near wall). Probably, it is solved by usage of lower angular acceleration (causes skidding).

sentences:
How do I fairly distribute resources among factories when resources are near exhausted? The main resource in my game is mass, stored as a floating point number that changes over time. Resource nodes increase mass and factories drain it. For example, if I have a resource node yielding 5 mass per second, I'll gain 5 * deltaT mass each game step. Mass is displayed rounded to the nearest integer, and gain/loss indicators are displayed by tenths.

How should I handle mass hitting zero? This creates a race condition if multiple factories are trying to build at once: Factories first in the queue or which drain less resource get priority once some more resource comes in and so build faster than the others.

How can I deal with this? Should I skip the step entirely?

sentences:
How to hide assets from user? ( e.g.: a png file ) I think the title is quite self-explaining, still this is a big area I think, so let me drop a few words:

I've got a simple experiment game project going, and I want to make sure, that the user isn't messing with the game assets like player skin etc.

In my opinion the best way would be that on production I would merge all the assets into one file and the application would check the hash of that file, so it could detect the corrupted data.

Is this an acceptable practice? There must be sum libraries / applications which are targeting this problem, could you guide me on this?

Project details: unix/linux, c++, sdl

sentences:
List cells in a 2D grid that belong in a sector / portion of a circle Are there any algorithms to find out which cells in a 2D grid lie inside/is part of a slice of a circle - a pie slice shaped region?

Essentially, as per image below, I need to list out all the green cell coordinates.

At the moment, I am ray casting (using DDA based line interpolation) from the starting red cell, and sweeping across the area in with (arbitrarily chosen) small fixed angle increments, casting multiple rays; but this does not guarantee all cells will be covered.

Are there any approaches to this problem?

sentences:
Rotate canvas along its center based on user touch - Android I want to rotate the canvas circularly on its center axis based on user touch.

i want to rotate based on center but its rotating based on top left corner .

so i am able to see only 1/4 for rotation of image.

any idea..

Like a old phone dialer .

I have tried like as follows

onDraw(Canvas canvas){
  canvas.save();
  // do my rotation
  canvas.rotate(rotation,0,0);
  canvas.drawBitmap( ((BitmapDrawable)d).getBitmap(),0,0,p );
  canvas.restore();
}

@Override
        public boolean onTouchEvent(MotionEvent e) {
                  float x = e.getX();
              float y = e.getY();
              updateRotation(x,y);
              mPreviousX = x;
              mPreviousY = y;
            invalidate();
        }

  private void updateRotation(float x, float y) {

          double r = Math.atan2(x - centerX, centerY - y);
            rotation = (int) Math.toDegrees(r);
        }

sentences:
Render text and still have it interractive with minimum effort with hit-testing? The background of the situation:

I need to render text. Text will be moving aroud the screen and
user will have ability to interact with it by erasing with a finger,
shifting the order of the words, deleting letters and so on.
Text will be in many different languages.
Kering and other typing tricks should be implemented when
rendering.

So the problem for me:

I don't know the most efficient way to render all the text AND at the same time to have information about the location of each and every letter on the screen, plus each letter should know the word it belongs.

Now, if I make a big class of strings, where each letter is a child of each word, and words are the children of sentences, then interaction part seems trivial to implement, but rendering becomes a problem since

either I render each letter to the pipeline individually and store it's location in screen coordinates.
or I prepare one big string  by gathering letters from all the above mentioned classes and render it in one run, but I loose the ability to store the coordinates of each letter in the screen coodrinates.

Is there a way to have both :) Fast rendering in one string and coodinates of each letter stored?

sentences:
What are the steps to instantiate a button in Unity? Given a Canvas test_canvas containing a Button test_button and an empty GameObject that manages instantiation and scripts and the like called test_manager, what are the steps to instantiate this button through code as opposed to having it already there?

I've tried making the button a prefab and instantiating it as I would any other object but that didn't work. I tried making the canvas a prefab and then trying the button but nothing. I've searched around for quite some time and there's mention of RectTransform and SetParent but steps or specific details would clear up my confusion

sentences:
How do I get the width of a string as it would be displayed on screen? What is the best and easiest way to get the width of a String using Slick2D?

I'm working on the achievement interface menu in my game that displays some images. On each image I need to draw a string such as "Reach Level 5.". Only problem is that I don't know how to get the string width to properly center the string on the image.

sentences:
How can I easily create textured physics objects of different shapes and sizes? I want to make a 2D game with this art system:

Whats the best way to achieve this in Unity?
Can I use sprite renderers or do I need quads or something different?
Rectangles seem possible and easy with Sprite Renderer, but Circles, Triangles and other shapes... how would those be done?

sentences:
2D Physics: What happens with torque when center of mass changes? Novice programmer and explorer of simple 2D physics, here.

I have a simple 2D object made up of two rigid bodies connected at a fixed joint.

The two rigid objects can rotate freely about that fixed joint, causing the center of mass and moment of inertia of the whole object to change(but not adding extra energy to the system).

If my 2d object is rotating about it's center of mass, and then the center of mass changes (because one of its components rotates), what happens with the torque?

Since my torque was applied at the initial center of mass, and now the center of mass has changed, it would seem that I could not just preserve the torque for the new object orientation?

One possibility in my head is that some of that initial torque will be converted to linear velocity, but I can't visualize this in any consistent way.

So does the torque value remain the same when center of mass changes or does it need to be recalculated?

What key information am I missing here?

If there's a simple enough answer that could be expressed in some python or pseudo code (in terms of what to do with the torque), that would be appreciated.

EDIT:

I'll try to be more clear.  There's no friction there's no gravity, and no ability for either of these objects to collide with anything (they are in vacuum too).  The two components themselves are connected at a joint but they are effectively rigid (in the sense that torque force does not cause them to change their orientation to joint).  Linear velocity starts at nothing and we apply a  one time (impulse?) torque through the center of mass.  The whole object  rotates in the expected way when all of the sudden one of the components of the object changes its orientation(without adding any additional forces to whole object).  This changes the objects center of mass and moment of inertia. Since the only force applied to this object was torque, what happens in such a hypothetical situation? I'm mostly interested in how to apply the existing energy to the new orientation.  Does the object gain linear velocity and lose torque? If so how do i calculate that.

(I suppose if I were spinning in outer space and stuck out my arm, that might be along the same line?)

sentences:
GLSL - Stencil buffer - instanced geometry I have geometry that have attached some "ID" data. I have generated stencil  buffer, that holds these IDs.
Now, in second pass, I render different geometry, but this time I need to mask it with already existing stencil. Each part of geometry can have different "ID". Is there a way, how to control stencil buffer test value from shader?

I give an example:

  render geometry with ID = 1, writes 1 to stencil
  render geometry with ID = 2 if ID in stencil != 1, writes 2 to stencil
  do some other rendering with stencil turn off
  render bunch of particles at one go, but some of them have ID 1, some of them ID 2 -> I want to mask them, so 1 is rendered only if 1
  is in stencil and 2 only if 2 is in stencil

I need this for OpenGL ES 2.0

sentences:
Should I use retained mode or immediate mode I'm trying to make a opengl wrapper for winforms(.net). Basically you code in gdi+ syntax but it gets rendered for opengl(using glcontrol of opentk).

Which mode should I use for rendering ui? It has to be fast enough to support lagless animations and image-drawing. Direct mode (glBegin, glEnd) is easy but I've read there are performance issues. On the other hand, retained mode will be relatively much complex to implement.

My preference is first make for immediate mode then move to retained as I progress. Are there any issues with immediate mode(like missing functionality

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:
Which approach is better: Frequent small updates, or occasional large ones? I recently released the first publicly available free Alpha for my top-down shooter: Dread

I'm trying to decide whether a weekly / bi-weekly small update release schedule is better than the more traditional monthly (or longer) large updates.

The more frequent schedule would mean that players would have a new build to play more often, but the new builds would likely only have a few bug-fixes / feature additions at a time. Would players grow tired of the constant updating, or would they feel more attachment as they are more involved in the development process?

I'm thinking that, due to the somewhat experimental nature of my game, it might be a good thing for people to have the opportunity to suggest tweaks to the new features during their infant stages. But I don't want my desire for feedback to bias my decision.

What are your thoughts / experiences on the matter?

sentences:
Unity is reimporting everything! How do I stop that? I have a relatively large project (about 8GB) and it is constantly reimporting itself over and over, to the point that I spend 80% of my time waiting for Unity to:

Reimport everything
Stop hanging.

Even for the smallest of changes (ie. removal of a comment on one line in a script), or changing import settings on an asset can cause these long hangs and reimports.
To make matters worse, this project is also synced over UnityCollabBETA, which throws manual/selective import (auto-refresh is forced on) out the window.
I've also read up that other programs locking asset files (to read them) can also cause Unity to reimport everything as opposed to simply doing a selective import (only reimporting things that has been changed).
I've tried creating blacklists for my auto-backup programs, anti-viruses and anything that would snoop around and/or mess with the Unity Project folders. However, despite those programs not accessing anything, Unity still reimports the whole project every time I alt-tab out.
The only workaround I've found so far is to just kill Unity every time it does it and relaunch it as for some reason it processes the actual changed files first, then hangs itself by going through everything else.
It is also worth noting that I/O is maxed up by Unity (due to the sheer size of the project) and CPU/GPU usage are relatively low (does not exceed 20-30%, assuming nothing else is running in the background).
Note: This has persisted through installs and computers.

Question
How do I stop Unity from reimporting everything without constantly killing Unity?

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:
What should audio programmers know? I'm a music composition student also getting a minor-plus-some in computer science. I love writing music and making sound effects and want to write music for games. But, I also realize everyone and their mother wants to do that. With that in mind, and since I'm already equally in love with programming, I'm interested in looking at focusing some aspects of the computer science portion of my education towards audio implementation for games.

What I've done/am doing:

Wrote "MusicManager" classes that are aware of musical timings and a small amount of automated mixing based on game events
Reading Who is Fourier? as I work my way toward understanding Fourier analysis and implementing the FFT
Learning FMOD Designer and using the designer API in a game (of course not taking a class specifically on this, I'm good for learning APIs on my own)

With that background, I've got a two-part question.

So aside from the things I list above, and the good ole fundamentals of computer science (data structures and algorithms, discrete math, OO/structured design), what are studios looking for in audio programmers?

Also, G.A.N.G. and Audio Engineering Society lecturers speak as though audio programmers are the next hot thing in games, but do many studios even have or think to hire dedicated audio programmers?

sentences:
Disjointed bones in 3ds Max - Are they a problem? The title sums up my question fairly well. I'm working with a biped, and I'm not sure whether to put the extra effort into connecting all the bones, or just to leave spaces between each of them. What do you think?

Screenshot:

http://i.imgur.com/pfbLSDt.png

sentences:
2d raycast collision problem I am currently making a 2d top down game in unity and have stumbled upon a problem with my raycast collision. I want my green player to stop moving when colliding with a wall, therefore i made my player object cast a ray in the direction it is moving. Its velocity is nullified when the distance to the collision point is equal to zero, or below. What seems to be the case is that the player object stops moving way to late and ends up overlapping the wall object. I tried to make an offset such that the player stopped a bit earlier, but it seems that the offset needs to differ depending on the side of the wall block. It even feels like the point at where the player stops is arbitrary and differs from time to time.

I would really like to know why this happens and what i can do to fix it. BTW, I would also really like to be able to change the players speed and still have it work.

Here are some pictures of my problem:

The code i use for the player:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

    [SerializeField]
    private float speed;

    Rigidbody2D body;
    bool justChangedDir;
    Vector2 moveDir;

    void Start()
    {
        body = GetComponent<Rigidbody2D>();
    }

    void MoveDirection()
    {
        Vector2 input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if ((input.x != 0 && input.y == 0) || (input.x == 0 && input.y != 0))
            justChangedDir = false;

        if (moveDir.x != 0)
        {
            moveDir = new Vector2(input.x, 0);

            if (input.y != 0 && !justChangedDir)
            {
                moveDir = new Vector2(0, input.y);
                justChangedDir = true;
            }
        }

        else if (moveDir.y != 0)
        {
            moveDir = new Vector2(0, input.y);

            if (input.x != 0 && !justChangedDir)
            {
                moveDir = new Vector2(input.x, 0);
                justChangedDir = true;
            }
        }

        else
            moveDir = input;
    }

    void CheckCollision()
    {
        RaycastHit2D hit = new RaycastHit2D();

        if (moveDir.x != 0)
        {
            hit = Physics2D.Raycast(body.position, Vector2.right * moveDir.x, 1);

            Debug.DrawRay(body.position, Vector2.right * moveDir.x, Color.yellow);

        }

        else if (moveDir.y != 0)
        {
            hit = Physics2D.Raycast(body.position, Vector2.up * moveDir.y, 1);

            Debug.DrawRay(body.position, Vector2.up * moveDir.y, Color.yellow);
        }

        if (hit.collider != null && hit.distance <= 0.5 )
        {
            body.velocity = Vector2.zero;
        }
        else
        {
            body.velocity = moveDir * speed;
        }

    }

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

        if (moveDir != Vector2.zero)
        {
            CheckCollision();
        }
        else
            body.velocity = Vector2.zero;
    }

}

Any help will be really appreciated :) Many thanks in advance!

Gusgus

sentences:
Aligning bullet's position in Asteroid Game I'm writing an asteroid game and I would like to align the bullets on the ship's tip. I also want when the ship fires, the bullet gets the same orientation(angle, direction) of the ship and also be fired at a different velocity.

I'm drawing the ship by the following code:

gl::drawLine(Vec2f(-43,-52),Vec2f(59,1));
gl::drawLine(Vec2f(-14,-31),Vec2f(-14,38));
gl::drawLine(Vec2f(59,1),Vec2f(-43,54));

sentences:
Why the skyline continues to stay on the same place and how to change this? I started my first Unity3D project and in this game main hero should be able to fly up passing clouds and then reaching open space but i faced with the problem. No matter how long and fast i am flying after takeoff the skyline continues to stay on the same place. Currently i'm going to rotate the main hero so that skyline would go down. But maybe someone can suggest me more common and better way to achieve the effect of leaving the Earth?

I think it would be bad idea to post all my code here because there is a lot of code that does not relate to the topic. But i will try to explain what i'm doing now and i will show you short piece of code. I have global parent object and a main hero is added as a child to it. Then when as main hero moving up relative to the global object i start to rotate this global object around z-axis so that gradually the main hero is looking to the sky.

And for skyline i'm using procedural skybox.

I hope this piece of code will explain better of what i'm doing now:

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

public class PlayerController : MonoBehaviour
{
    float gravity;

    GameObject global;//main hero’s parent

    Vector3 startHeroLocalPos;//start hero position relative to the global object

    public float degreesPerUnit = 1.0f;//global object will rotate by this amount of degrees after the player has moved up by one unit

void Start ()
{
    global = GameObject.FindGameObjectWithTag ("GlobalObject");
    startHeroLocalPos = transform.localPosition;
}

void Update ()
{

    float curAngle = (transform.localPosition.y - startHeroLocalPos.y)*degreesPerUnit;
    global.transform.rotation = Quaternion.AngleAxis(curAngle, Vector3.back);

}
}

sentences:
Unity Nav Mesh instantiation Issue I've been working on a wave-based zombie game for the past few months and all of the systems have been working perfectly - until I upgraded to the latest version of Unity. Since then, spawning a zombie onto a nav mesh and then calling SetDesination is throwing the exception:

"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:SetDestination(Vector3)

The zombies are spawned a random spawn point and their destination set as so:

 GameObject go;
        for (int i = 0; i < SpawnAmount; i++)
        {
            Vector3 location = new Vector3(transform.position.x + i + UnityEngine.Random.Range(-1, 1), transform.position.y, transform.position.z + i + UnityEngine.Random.Range(-1, 1));
            go = Instantiate(enemyPrefab, location, spawnRotation) as GameObject;
            go.GetComponent<NavMeshAgent>().SetDestination(players[0].transform.position);
        }

It is the setdestination line that is causing me issues.

I have a static baked nav area. The player characters (who also use nav agent to move) can move across the nav area perfectly - it is only the zombies which seem to have trouble.

I have spent a long while tweaking settings here and there. Adjusting the location of the zombie and even having a zombie in the game before starting the game. However I can't seem to correct this exception - all while the player characters are moving perfectly.

Any ideas on what I could be missing or areas I should be looking?

EDIT The updated and working code:

GameObject go;
for (int i = 0; i < SpawnAmount; i++)
{
    Vector3 location = new Vector3(transform.position.x + i + UnityEngine.Random.Range(-1, 1), transform.position.y, transform.position.z + i + UnityEngine.Random.Range(-1, 1));
    go = Instantiate(enemyPrefab, location, spawnRotation) as GameObject;
    go.GetComponent<NavMeshAgent>().Warp(location);
    go.GetComponent<NavMeshAgent>().SetDestination(players[0].transform.position);
}

sentences:
How to save and update modifications done by the player in my procedurally generated JavaScript game? I am making a game and I need the world to be generated and saved. I used Perlin noise to generate the terrain (and other stuff like trees), but cannot figure out the best way to save and recall actions done by the player, e.i. if a tree is cut down or a mineshaft is used I want that entity to either be updated or deleted.

How could I accomplish this?

More info: I am making this in JavaScript and eventually want to implement Node.js to implement multiplayer features in the future. The player also has a very limited view and this is a 2D top down kind of game. I am also making this basically from scratch.

Any and all help is appreciated!

sentences:
Trail Effect for fast moving object I am currently working on some FX trail effect. Here's the situation, you have a fast moving object that puts trail on another object.

Here's how it works for the moment. I have some kind of stamp texture (the object) that is printed onto another texture of the receiver object. When the object is moving not to fast, you can see the trail effect.
But the problem appears when the object is moving to fast, then you don't see the trail but only the stamp texture printed at some points.

The issue is quite logical and linked to the time when the update function is called (I am using Unity). The function is not called enough so it's missing some positions and thus the trail effect

sentences:
Why do not Easy Mobile Pro scripts know about each other? I am getting this error when I try to build the project:

Assets\EasyMobile\Scripts\Modules\NativeAPIs\NativeUI\Nati
veUI_AlertPopup.cs(68,17): error CS0103: The name 'AndroidNativeAlert' does not exist in the current context

I tried adding this to my NativeUI_AlertPopup.cs:

    #if UNITY_ANDROID
        using EasyMobile.Internal.StoreReview.Android;
    #endif

Hint says unnecessary using.
Googling, searching Unity EMP forum and thread did not bring any results.
Unity version 2019.2 .net 4.x EMP 2.5
If I try adding a breakpoint it says:

The breakpoint will not currently be hit. Unable to find a corresponding location.

AndroidNativeAlert is a static class, have have no clue why it can't been seen from the other one.

sentences:
How can I design loot to be enjoyable to acquire and neither a chore nor frustrating? I am currently working on an ARPG and I am trying to figure out which elements of the game influence each other and one example is that endgame activities inherently influence loot drops/handling and the other way round. The more classical loot systems we usually get in touch with are following:

Classic MMORPG loot where enemy bodies have to be clicked which open up a window which displays the loot that can be clicked one item at a time. Sometimes it is possible to enable auto-loot in order to skip the clicking of each item.
ARPG loot where slain enemies die in a explosion of loot which can occasionally get extreme up to a point where loot filters are necessary otherwise the screen will be cluttered. In this case players usually pick up uncapped currency like gold automatically while everything else from gear to crafting parts has to be looted manually if the player so desires. Diablo, Path of Exile and the likes to handle it with cliackable labels on-screen while Borderlands for example spreads the loot all around the place and has visual light beams indicating rarities that allows players to filter quickly and go grab the items they might be interested in.
"Loot chests" is what I call the system of Destiny. During a strike or adventure players do participate in combat and are not distracted by random loot on the ground which would require consideration as to whether picking it up is a good choice. After the event has ended, typically after defeating the final boss a chest appears that contains loot.
"Vacuum loot" which was used for Guild Wars 2 and Wildstar where the loot physically drops on the ground and players can loot everything from currencies to gear with one click of a button. In an ARPG this would never work out since inventory space is even more restricted than anything else.

My naive first thoughts are based on how the endgame of Diablo 3 is designed. In classic endgame rifts players can slay enemies and are usually busy picking up materials and some "useless" items that may be used to disassemble them for even more materials. Furthermore they are looking for chests and hoping for some random drops. In contrast to that game mode there are greater rifts which, similiar to Destiny, drop no loot at all except when you kill the final boss that appears after progressing far enough.

In greater rifts there are no distractions just the challenge to finish those at higher difficulties and farming them with specific speed builds while on the other hand the classic rift slow down gameplay when you have to stop every few meters just to click and pick up those items.

I have reached an impasse since I understand players might want to blaze through content and I don't want to make them slow down constantly (with a system like classic rifts in Diablo or Path of Exile in general) but when I stick to "loot chests" at the end of an activity it might happen that less loot drops in general and that there is less gratification when collecting things since the is nothing on the way. Take a long dungeon for example, a "loot chest" system might incentivize just skipping all enemies and do the bare minimum to tackle the final boss. In such a scenario I basically invalidated almost the entire content I am presenting!

Comparing this to (current) legendary items in WoW: if one legendary drops I might be relieved to finally get one (and be angry about it since it's a shitty one...) but I missed the reward stimulus up to the drop itself. Applied to my scenario, the player sees a dungeon as an annoying chore to finally get the chance of acquiring something. If the drops are not satisfying it could possibly be more demotivating thinking that that only chance to get something after such a chore was a waste of time.

So my question is the following: Even though loot explosions may be enojoyable at first they can degenerate into an annoyance (e.g. clicking a bazillion items on the floor). When thinking about making them less boring I end up with something that can be as frustrating in the end. How can I balance this?

sentences:
Adding newly created objects into a vector inside the object? Would some thing like this work?

RawModel::RawModel(GLuint vao, GLsizei count)
    : m_VAO(vao), m_Count(count)
{
    m_RawModels.push_back(this);
}

RawModel::~RawModel()
{
    for (GLuint i = 0; i < m_RawModels.size(); i++)
        delete m_RawModels[i];
}

I am fairly new to the language and I don't know if it would work.

sentences:
Cocos Code IDE unable to find python I am trying to create a new JavaScript project on Cocos Code IDE but every time it immediately give me the error message:

  Unable to find python. Please, click the setting button to set the python path, then python 3.0 or later is not supported.

I click the button and I set the path to C:\Python27 which is the folder of my python installation, and I try again but I get exactly the same error. The version of my python installation is 2.7.8. I am using Windows8.1.

EDIT: It occurred to me that there is also another error message:

the python's version must be greater than or equal to 2.7.5 and less than 3.0

But I cannot understand why it does not accept my version(2.7.8).

sentences:
Playing a Song causing WP7 to crash on phone, but not on emulator I am trying to implement a song into a game that begins playing and continually loops on Windows Phone 7 via XNA 4.0. On the emulator, this works fine, however when deployed to a phone, it simply gives a black screen before going back to the home screen. Here is the rogue code in question, and commenting this code out makes the app run fine on the phone:

// in the constructor fields
private Song song;

// in the LoadContent() method
song = Content.Load<Song>("song");

// in the Update() method
if (MediaPlayer.GameHasControl && MediaPlayer.State != MediaState.Playing)
{
    MediaPlayer.Play(song);
}

The song file itself is a 2:53 long, 2.28mb .wma file at 106kbps bitrate.

Again this works perfectly on emulator but does not run at all on phone. Thanks for any help you can provide!

sentences:
What exactly IS a model? I'm trying to actually learn OpenGL after having experimented with it for a while, and so I'm trying to build a rudimentary rendering engine (not a game engine) to lead me through it. I've come to a conceptual obstacle however: I don't know exactly what a model really is. I mean obviously, it is composed of one of more meshes and textures, and other important data. But how much data? Should shaders be associated with models directly, with each one holding some sort of reference to the shader they require? Or should that be handled in another layer?

I think it makes sense to incorporate the shader program and the necessary parameters along with the meshes and textures as part of a model, but I wanted a more experienced opinion.

sentences:
Camera type for puzzle game like tetris I can't find what is the name of the camera type.

Sided camera view seems logical but not correct thought

sentences: AI engine for iOS game development? I'm looking for an AI engine for iOS game development (machine learning, path finding).

sentences:
Why does my mesh move when i add an avatar? I've imported a wall model into my scene, it snaps to the other walls fine until I add an avatar to the model to animate it, then it moves.
here's some picture to explain:
The first picture in the scene:

This picture is in the game:

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:
Arrays for a heightmap tile-based map I'm making a game using in C# and Javascript that uses a map which has tiles, corners and borders. Here's a graphical representation:

I've managed to store tiles and corners in memory but I'm having trouble getting the borders structured.

For the tiles, I have a Map Width * Map Height sized array. For corners I have (Map Width + 1) * (Map Height + 1) sized array.

I've already made up the math needed to access corners from a tile, but I can't figure out how to store and access the borders from a single array.

Tiles store their type (and other game logic variables) and via the array index I can get the X and Y coordinates. From this tile position it is possible to get the array index of the corners (which store the Z index).
The borders will store a game object and accessing corners from only border info would be also required.

If someone even has a better way to store these for better memory and performance I would gladly accept that.

sentences:
Trouble GamePad input on iOS but works perfect on Android I am having trouble getting input from on iOS devices (iPhone 6 Plus and iPad). Here is my code,

    if (Input.GetKey (KeyCode.JoystickButton14))// A
    {
        chr_show = "A";
    }
    if (Input.GetKey (KeyCode.JoystickButton13))// B
    {
        chr_show = "B";
    }
         ...........................................

    if (Input.GetKey (KeyCode.JoystickButton11))// Select
    {
        chr_show = "SELECT";
    }

And in OnGUI()

    GUI.Label (new Rect(0,0,100,100), "Pressed Button : "+chr_show, guiStyle);

Code works perfect on Android device. I also have tried following:

        if (Input.GetButton ("JSButton"))// JSButton
        {
            chr_show = "JS Button 14";
        }

Please Help Me!

sentences:
How can I throttle certain player actions? Background
I have a variable time step, component based game, with components that collectively hold an entity's properties and different systems that act on entities with certain required components.
The player controls a ship that can fire bullets. I have an input system that works on entities with a PlayerControlComponent (nothing more specific yet) and creates an entity every frame if a key is held down.

Question
How should I manage limiting or throttling this so that it can't occur closer than 1 second apart in a reusable way?

sentences:
Stretching a tetragonal shape in a texture to a square object I'd like to write a fragment shader that stretches a tetragonal shape in a texture to a square shaped game object of mine. My problem is best described with a picture, seen below. The shader receives a texture and the four corners of the red tetragon, and I'd like to stretch the tetragon as such that that's the only thing that'll appear on my square object, nothing outside of it. In this example, the texture coordinates u and v (0, 0) would be transformed into (x1, y1), and in a similar fashion, (1, 1) would become (x4, y4).

I don't know how I should go about this though. I've done my research, I believe bilinear interpolation could be what I'm looking for, but from what I can see, it would only work if my red tetragon was a rectangle, in other words if its four corners where (x1, y1), (x1, x2), (x2, y1) and (x2, y2), which is clearly not the case here as all my four coordinates are different. Any help from a little hint to a complete code solution would be welcome.

Edit: I did try implementing bilinear interpolation, however it did not work. Here are the equations from the wikipedia article that I tried modifying to my specific case:

What R1 and R2 correspond to can be also seen on the image on wikipedia, my math notation may not entirely be correct but I tried to make it as understandable as possible. This did not give me the result I was looking for, however. I tried setting the red tetragon to be a triangle by setting (x1, y1) to (0.5, 0.5) while the remaining three coordinates went in their corresponding corners), and while I was expecting the texture to be stretched in some way, the end result still was a crystal clear, non-stretched picture (due to my testing circumstances, I can't tell the exact difference to when I set (x1, y1) to (0, 0), but the results were extremely similar).

Edit 2:
I'll also include the code from my fragment shader, for good measure.

in vec4 tex;
in vec3 normal;
out vec4 fragmentColor;

uniform struct {
    sampler2D colorTexture;
    vec2 p1;
    vec2 p2;
    vec2 p3;
    vec2 p4;
} material;

void main(void) {
    float x = tex.x / tex.w;
    float y = tex.y / tex.w;
    float x1 = material.p1.x;
    float x2 = material.p2.x;
    float x3 = material.p3.x;
    float x4 = material.p4.x;
    float y1 = material.p1.y;
    float y2 = material.p2.y;
    float y3 = material.p3.y;
    float y4 = material.p4.y;
    vec2 R1 = (x3 - x) / (x3 - x1) * material.p1 + (x - x1) / (x3 - x1) * material.p3;
    vec2 R2 = (x4 - x) / (x4 - x2) * material.p2 + (x - x2) / (x4 - x2) * material.p4;

    vec2 interpolatedPoint = (R2.y - y) / (R2.y - R1.y) * R1 + (y - R1.y) / (R2.y - R1.y) * R2;

    fragmentColor = texture(material.colorTexture, interpolatedPoint);
}

Here's what I see when I set p1 to (0, 0), p2 to (0, 1), p3 to (1, 0) and p4 to (1, 1)

And here's the same image but with p1 set to (0.5, 0.5)

The slight differences are only there because I had to position my camera manually, the two results are identical, even though in the second case I would expect to see an image that's clearly been stretched in some way.

sentences:
Continents with Simplex noise How do I turn Simplex noise like:

into something like:

or

The noise has too many white spots and varies too much to represent things like continents. Where it's water, water, water, and then land with cut out edges.

sentences:
2d starship combat, hit chances based on bearing and speed (vector)? Thinking about a 2d strategy game, where you move your starships turn by turn and fire guns at each other.

Instead of the traditional approach of "range" lowering hit chances, im thinking about some sort of system that throws vectors at each other to calculate relative bearing and speed to calculate hit chances.

I.e. a fast, small ship is harder to hit than a slow, big chip, but in addition the relative bearing (im thinking: is the target flying straight towards your X/Y = good hitchance, or is it strafing very narrowly, low hitchances depending on speed).

Getting the relative the bearing (angle) on an approaching vessel would be easy using atan2, but how could this be translated it into a hitchance that goes up if the angle is like 330 to 30 degree and goes down if its different (as an example) ?

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:
Why doesn't SDL_Mixer play my audio file? I'm coding a game in SDL2 and I'm implementing the audio system using SDL_Mixer. However, my music file won't play during the program and I don't know why. How do I get the music to play?

Audio initialization:

SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);

Opening the audio device:

if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0)
    std::cout << "Error:" << Mix_GetError() << std::endl;

Loading the sound file:

Mix_Chunk *soundEffect = Mix_LoadWAV("Sound\BetaMusic.wav");

Playing the sound file:

Mix_PlayChannel(-1, soundEffect, -1);

sentences:
How can I make a player-interactable bookshelf? In the player's house Interiors->WhiterunBrezeehouse (FormID 000165A8) I duplicated a bookshelf (CommonShelf03 FormID 000ce784 near the fire pit) and the book proxies, container, triggers, collision boxes, et cetera.

When I enter the house the duplicated book shelve is there and it shows the "E to interact" text, but when I press E nothing happens (I'm supposed to get up the book shelf manager).

Any clue of what it might be? What do I need to support proper interaction between a player and the shelf?

sentences:
LibGDX limit the PerspectiveCamera for a FPS view I'm using LibGDX and I'm trying to implement a FPS camera into my game. I'm not using the FirstPersonCameraController for multiple reasons:

I don't want to touch to roll (only yaw and pitch), with this camera when looking on sides the horizon goes up and down like waves (meaning that the roll is changing)
I don't want dragging, I want the camera to always move with the mouse.
I want movements to stay consistent whatever the player is looking at. I don't want it to go slower even if he looks at the ground.

So I've come up with this which does pretty much what I want:

    @Override
    public boolean mouseMoved(int screenX, int screenY)
    {
        float deltaX = (mousePos.x - screenX) * sensitivity;
        float deltaY = (mousePos.y - screenY) * -sensitivity;

        Vector3 tmpAxis = game.getGame().getPool().obtain(Vector3.class);

        game.getCamera().rotate(Vector3.Y, deltaX);
        tmpAxis.set(game.getCamera().direction.z, 0, -game.getCamera().direction.x);

        game.getCamera().rotate(tmpAxis, deltaY);
        //if(game.getCamera().up.y < 0)
        //  game.getCamera().up.y = 0;

        mousePos.set(screenX, screenY, 0);
        game.getGame().getPool().free(tmpAxis);
        return true;
    }

However, I have an issue described by the commented lines. When the camera goes to low or too high (when the y value of the up vector become negative), the rotation is reversed and the rotation starts to make it come back. In pratice, it just flickers a lot and when I try to go back, I have 1/2 chance of going back normally, and 1/2 chance of looking backward with my camera reversed (if the up vector is negative).

So naturally, what I want is to lock the movement so It can never look pass his feets or pass the sky. Locking the up vector is easy, I just have to prevent it from going negative but I need to replace the direction vector also. However, I don't know how to "replace" the direction vector. I search on google for how to set the camera rotation or just how to get it and didn't found anything convincing.

I've just tried also adding game.getCamera().direction.y = -1f; to my commented if to make it look down when getting past the point I don't want it to get past. However, I found out the direction vector isn't normalized and that's really confusing.

sentences:
Intersection point of two lines with given formula I have following formula to check the intersection of two line segments:

Edge is defined like point2-point1 vector.
    bool intersects(const Line2D& line2)
            {
                float s, t;
                s = (-edge.y * (point1.x - line2.point1.x) + edge.x * (point1.y - line2.point1.y)) / (-line2.edge.x * edge.y + edge.x * line2.edge.y);
                t = (line2.edge.x * (point1.y - line2.point1.y) - line2.edge.y * (point1.x - line2.point1.x)) / (-line2.edge.x * edge.y + edge.x * line2.edge.y);

                if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
                    return true;
                }
                return false;
            }

However I´m trying to figure out how to implement the "find the point of intersection" option for this as most of the answers with the same theme are "math based". Thanks for your help.

sentences:
IAP where I get paid? I have search with every word of my limited English for this question, and I think it's is not appropriate for this site but I just got to try.

I implemented Google IAP for Android. In all the tutorials I have read not one tells where I can check how much money I'm making, or specify where I get paid. I guess what I'm trying to ask is how Google is gonna pay me if I have not specified anything?

sentences:
How can I make an infinte terrain with object pooling in Unity? I am currently making a 3D endless runner game in unity in C#. I now need to make the platform(3D Tiles) infinite but I don't know how. I already did some research but I don't find the right tutorial.

I already asked a similar question and I got the answer that I need to do it with object pooling but I don't find any good tutorial for object pooling. Does someone know how to make an infinite terrain with object pooling in unity?

Thanks

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

public class TerrainScript : MonoBehaviour
{
    public GameObject[] tilePrefabs;

    public Transform playerTransform;
    private float spawnZ = 4500.56f;
    private float tileLength = 2.0f;
    private int amtOfTilesOnScreen = 2;

    void Start()
    {
        for (int i = 0; i < amtOfTilesOnScreen; i++)
        {
            SpawnTile(0);
        }
    }

    void Update()
    {
        if (playerTransform.position.z > (spawnZ - amtOfTilesOnScreen * tileLength))
        {
            SpawnTile(0);
        }
    }

    private void SpawnTile(int prefabIndx = 0)
    {
        GameObject go;
        go = Instantiate(tilePrefabs[prefabIndx]) as GameObject;
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * spawnZ;
        spawnZ += tileLength;
    }
}

sentences:
Using the same font with different sizes in libgdx I am using BitmapFonts, LabelStyles and Labels for my texts.

I want to resize some labels, so i use this.

fontType.scale(-.6f);

LabelStyle style = new LabelStyle(fontType, Color.WHITE);

titleLabel = new Label("Points", style);
titleLabel.setColor(Color.RED);
titleLabel.x = 260;
titleLabel.y = 310;

but when i want to resize another label, all the labels containing that font resize (I create a new LabelStyle). So i resize the label instead of the font, but that doesnt solve the problem, because it doesnt resize the label, any idea?

sentences:
Are there spritebatch drawing limitations on monogame? I've reached a point that it seems when I draw too much on screen, monogame starts doing weird things.

When I call this code in the Draw method

public void drawDialogBox()
    {
        if (dialogueBoxOn == 1)
        {
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.CreateScale(GameGlobals.zoom));
            spriteBatch.Draw(dialogBoxChara, new Vector2(89, 18), Color.White);
            spriteBatch.Draw(dialogBoxTexture, new Vector2(0, 108), Color.White);
            spriteBatch.DrawString(font, "àéùaDASASCZadhkjashdash", new Vector2(4, 108), Color.White);
            spriteBatch.End();
        }
    }

This happens:

This code is supposed to show the character, the textBox itself and the text. But the text isn't drawn correctly. If I comment one of the draw lines, it works.

Or this (if I only comment the character line)

Any ideas of what is happening here? I thought it was some SpriteBatch limitations, but I don't know...

EDIT: After following @Jon advice, i've reached this state

Now it shows the character and dialog properly, but the background and the walls are not displayed now. I have all the walls like this:

spriteBatch.Draw(leftcenterright4, new Vector2(0, 53), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.5f);

And the background

spriteBatch.Draw(background, new Vector2(0, 0), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1f);

And the code from earlier fixed:

spriteBatch.Draw(dialogBoxChara, new Vector2(89, 18),null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0f);
spriteBatch.Draw(dialogBoxTexture, new Vector2(0, 108),null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.1f);
spriteBatch.DrawString(font, "àéùaDASASCZadhkjashdash", new Vector2(4, 108), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0f);

sentences:
How to get UV coordinates for sphere (Cylindrical Projection) I have created one sphere and I want to map onto it a texture map. But I want first to project my map texture to cylinder and then to sphere.

So I want to create a function which takes as parameter a 3D point from sphere and calculate a uv coordinate of this point using cylindrical coordinates. My guess is that I have to transform the spherical coordinates to cylindrical but I am not sure.

Is this possible and how can I implement it ?

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:
Change width and height of 2D object based on pixel size and count I'm working on a shooting simulator with shooting goals that need to be in real world size. I know the certain size of screen display and pixel counts.

Is there anyway to change their size based on screen information?

let me explain more about question.

its a real shooter simulator with real guns. image of unity simulation is projected on a wall or... by a video projector. I want to scale goals as real ones. I know size of screen and even size of every pixel. so I want to scale my rectangular goals with size of real ones.

I think the question now is obvious

sentences:
Stop rotating when select the game object by mouse input I am new to Unity and I am confused about how to solve this problem. Initially, I want to make a platform rotate to its center vector up like this.

transform.Rotate (Vector3.up, speed * Time.deltaTime);

Then, I want to stop it from rotating when the mouse select it, like:

Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast (ray, out hit)){
  //find a way to stop rotate
}

I cannot figure out how to stop it from rotating. Can anyone help me, please?

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:
Drawing Sprites Depending On Mouse Position (LibGDX) I'm making a small game where you play as a turret in the middle of the screen trying to shoot the enemies coming after you. I am having difficulties, however, in trying to figure out how to make the turret change sprites depending on where my mouse cursor is pointing. I don't want to rotate the sprite, mind you, as I already have made different variations of the same sprite for the different directions it will face:

I have an idea of how to accomplish this, but I don't know how to make it happen:

The program generates 42 rays, (one for each turret sprite), that originate from the turret
If the cursor falls between two of those rays, a specific sprite will be drawn

How would I go about doing this? It doesn't have to be the method described above as long as it produces the same result.

Thanks for your help in advance!

Plug

sentences:
How to make a registration for my game? Me and my (new) company want to sell a very simple game, but we want it so that only the person that buys it can play it.

I want to know if it's possible to make a "registration" window pop up when the game either first starts or when it is being installed (still haven't decided whether or not to use an installer or not). It would require the person to input a registration key and it would then check that key against a database to 1. check to see if it's actually there and 2. to see if it has not been used already. If both are true, it lets you install or play the game an infinite number of times on that computer up until it is uninstalled.

Is this possible in the c#/xna code, or would i have to use some advanced form of executable programming?

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:
C++ alternative to vector for arbitrary number of objects using pointers I'm working on a prototype 'life simulation' game which incorporates any number of objects / entities that may exist in the game.

Up until this point I had been working with vectors of the objects, with every object that gets instantiated gets automatically copied into a vector that allows for some very simple all encompassing functions like:

physics_manager()
{
    for(std::size_t i = 0; i < all_objects.size(); i++)
        all_objects[i].do_physics();
}

However, I've run into a problem when it comes to using pointers. Previously I used  pointers to elements within vectors to interact with objects like this:

class object
{
    //Attributes of object
    object * other_object_to_interact_with;
    std::vector<object*> carried_objects
    //etc
}

I've now realised that changing the size of the vector (a frequent occurrence in this simulation) causes all pointers to elements within that vector to point to some random piece of memory.

I've considered using some form of unique ID for this (e.g. an int assigned to each object, then searching the vector for an object with that int to identify the right one), but this feels like an inefficient and ultimately wrong way to do things.

My question is, is there a container similar to the std::vector that:
a) can be iterated through easily for functions such as the above
b) can hold an arbitrary number of objects that changes during program running
c) is safe to use pointers to elements within it even if the container changes size

Alternatively, is there a way to use vectors to achieve the above without using pointers?

UPDATE: An additional thought - would the issue below be present if instead of vectors containing actual objects, I used vectors containing pointers to objects? Presumably then any pointers to objects outside of the vector would be to the objects themselves - how well would C++ memory manage this or would this lead me into new / delete territory?

FURTHER UPDATE: I migrated to lists rather than vectors, which was surprisingly easy. My most commonly used code snippet was:

for(std::size_t i = 0; i < vector.size(); i++)

This was very easily changed to:

for(auto & i : list)

With 'i'  now pointing to an actual object of the list rather than an int that can be used to access the vector with vector[i]. No perceptible performance hit so far with approximately 20000 objects being iterated through.

Additionally, when there is a need to use an 'int' as a reference to one of the objects within the list, that's as simple as:

int j = 0;
for(auto & i : base_class_vector)
{
    if(j == desired_number)
    {
        //Do whatever's needed here
        break;
    }

    j++;
}

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:
How to prevent collisions between instantiated prefabs I'm creating a virtual creature evolution system like here.
This type of project requires to define creatures, which are made of some 3d boxes and simulate them over and over again, making little changes along the way, until the point where they are good enough at a certain task. Basically, I'm using Genetic algorithms. I'm going to be doing a lot of simulation (a few hundred creatures each generation, times X generations, where X could be in the thousands).
In order to save time, I want to simulate multiple creatures at once, so I must run collision checks efficiently. Each creature exists on its own and therefore should not be bothered by other colliders except himself and the ground.

I have a prefab of a creature. Each creature is made of multiple 3d boxes with colliders. The nodes in the same creature should collide with themselves but should not collide with nodes that are in other creatures (because it should learn to perform based on the environment as it is). What is the most efficient way I could do this?

I thought about checking the root of the collision object but that just prevents the collision and doesn't eliminate the useless checks that are being made. I've also looked at solutions involving the "Layer Collision Matrix" but still could not find a way to make it work.

Thanks in advance.

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:
Elastic Circle-Circle collision detection and response / Slime Volleyball physics I am trying to recreate the Slime Volleyball game; however I am unsure how to go about implementing the physics of the ball movement.

The game consists of a circular ball and semi circle players that hit the ball over a net and against a wall. The ball cannot touch the floor.

I need to understand how exactly to implement the hitting of the ball against the player and what the physics entails.

I have already implemented gravity with a bouncing ball.

It is hard to find information related to implementing such physics from a game development perspective and I only have vague ideas about change in momentum from googling. If anyone could explain how to do so, I would greatly appreciate it.

sentences:
How to avoid wagon wheel illusion of a rotating gun barrel reversing direction? I didn't know which forum to post this in, but I'm going to try here first. I am making a shotgun with 3 barrels which spin. However, I also want it to have kickback in the animation, but every time I add that recoil it breaks the animation, making a strange wagon-wheel style illusion. No matter what I try, it always reappears once I add the recoil. Here is the animation:

Here is how the animation is supposed to be perceived, with the barrels spinning in one direction:

But this is what I often see when I look at it, where it seems to snap backwards one step:

It may be a bit hard to see, but if you look at it long enough it will flip between the two, similar to that animation of a ballerina which can be spinning in either direction.
I have tried having it only spin when it is down, only spin when it is up, changing the interpolation of the spinning and of the recoil, everything I can think of, but none of it works.
How do I solve this problem? Can I stop the optical illusion while keeping the recoil?

sentences:
Problem with shooting So what I am trying to achieve is have the player shoot toward the mouse positiion and I have that working but I want the player to have to charge their shot. So if the player just presses the button it only goes a certain distance but if the player holds the button down for a bit it goes farther.

I tried to make a video that kinda explains what I am going for.

This is the code that controls the shooting

public class BowController : MonoBehaviour {

    public GameObject arrow;
    public Transform shootLoc;

    public float force;
    public Camera cam;

    public float chargeMin;
    public float chargeAmount;
    public float chargeMax;

    public bool charging;

    void Start () {

    }

    void Update () {

        Ray cameraRay = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        Vector3 pointToLook;

        if (Physics.Raycast(cameraRay, out hit, 50))
        {
            pointToLook = hit.point;
            Debug.DrawLine(cameraRay.origin, pointToLook, Color.blue);

        }
        else
        {
            pointToLook = cameraRay.origin + (cameraRay.direction * 50);
        }
        transform.LookAt(pointToLook);

        if(Input.GetMouseButtonDown(0))
        {
            charging = true;

        }
        if (charging)
        {
            Charging();
        }

        if (Input.GetMouseButtonUp(0))
        {
            GameObject tempArrow;
            tempArrow = Instantiate(arrow, shootLoc.position, shootLoc.rotation) as GameObject;

            tempArrow.transform.LookAt(pointToLook);

            Rigidbody tempBody;
            tempBody = tempArrow.GetComponent<Rigidbody>();

            tempBody.AddForce(transform.forward * force, ForceMode.Impulse);

            force = 100;
            charging = false;
        }
    }

    void Charging()
    {
        force += Time.deltaTime * chargeAmount;

        if (force >= 500)
        {
            force = 500;
        }
    }
}

And this is the code that is on the arrow

  public Rigidbody rBody;
  public float speed;

    void Awake () {
        flying = true;
    }

    void Update () {
        if (flying)
        {

            //rBody.velocity = rBody.velocity.normalized * speed;
            transform.LookAt(transform.position - GetComponent<Rigidbody>().velocity);
            transform.Rotate(0, 180, 0);
        }
    }

    void FixedUpdate()
    {

        /*
        if (flying)
        {
            transform.rotation = Quaternion.LookRotation(rBody.velocity);
        }
        */
    }

    void OnCollisionEnter(Collision collision)
    {
        flying = false;
    }
}

I am still pretty new to coding so any help is appreciated. Thank you all very much in advance for the help!

sentences:
Direct3D11 and SharpDX - How to pass a model instance's world matrix as an input to a vertex shader Using Direct3D11, I'm trying to pass a matrix into my vertex shader from the instance buffer that is associated with a given model's vertices and I can't seem to construct my InputLayout without throwing an exception.

The shader looks like this:

cbuffer ConstantBuffer : register(b0)
{
    matrix World;
    matrix View;
    matrix Projection;
}

struct VIn
{
    float4 position: POSITION;
    matrix instance: INSTANCE;
    float4 color: COLOR;
};

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(VIn input)
{
    VOut output;
    output.position = mul(input.position, input.instance);
    output.position = mul(output.position, View);
    output.position = mul(output.position, Projection);
    output.color = input.color;
    return output;
}

The input layout looks like this:

var elements = new[]
{
    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
    new InputElement("INSTANCE", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerInstanceData, 1),
    new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0)
};
InputLayout = new InputLayout(device, signature, elements);

The buffer initialization looks like this:

public ModelDeviceData(Model model, Device device)
{
    Model = model;
    var vertices = Helpers.CreateBuffer(device, BindFlags.VertexBuffer, model.Vertices);
    var instances = Helpers.CreateBuffer(device, BindFlags.VertexBuffer, Model.Instances.Select(m => m.WorldMatrix).ToArray());
    VerticesBufferBinding = new VertexBufferBinding(vertices, Utilities.SizeOf<ColoredVertex>(), 0);
    InstancesBufferBinding = new VertexBufferBinding(instances, Utilities.SizeOf<Matrix>(), 0);
    IndicesBuffer = Helpers.CreateBuffer(device, BindFlags.IndexBuffer, model.Triangles);
}

The buffer creation helper method looks like this:

public static Buffer CreateBuffer<T>(Device device, BindFlags bindFlags, params T[] items)
    where T : struct
{
    var len = Utilities.SizeOf(items);
    var stream = new DataStream(len, true, true);
    foreach (var item in items)
        stream.Write(item);
    stream.Position = 0;
    var buffer = new Buffer(device, stream, len, ResourceUsage.Default,
        bindFlags, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
    return buffer;
}

The line that instantiates the InputLayout object throws this exception:

*HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.*

Note that the data for each model instance is simply an instance of SharpDX.Matrix.

EDIT

Based on Tordin's answer, it sems like I have to modify my code like so:

var elements = new[]
{
new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0),
new InputElement("INSTANCE0", 0, Format.R32G32B32A32_Float, 0, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE1", 1, Format.R32G32B32A32_Float, 16, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE2", 2, Format.R32G32B32A32_Float, 32, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE3", 3, Format.R32G32B32A32_Float, 48, 1, InputClassification.PerInstanceData, 1),
};

and in the shader:

struct VIn
{
    float3 position: POSITION;
    float4 color: COLOR;
    matrix instance: INSTANCE;
};

VOut VShader(VIn input)
{
    VOut output;
    output.position = mul(input.position, input.instance);
    output.position = mul(output.position, View);
    output.position = mul(output.position, Projection);
    output.color = input.color;
    return output;
}

However I still get an exception.

sentences:
How do I determine the look-at vector of a free-look camera? I'm trying to create a free-look camera with DirectX 10.

I've figured out how to get the directions for forward and back and left to right. However, I don't know how to rotate the look-at vector of my view matrix around the camera position so as to rotate in-place. How can I do this?

sentences:
Collision detection of cicle and rectangle How to find the collision detection of a moving rectangle on circular object?
Here i have tried to junp rectangular object but the collision detection of a small rectangular object while jumping doesnt have smooth collision detection? Can anyone please help me ?

sentences:
Save game on server side I'm working on a small management game. The player manage his hospital where he can collect items and new characters. Each player can visit others players hospital and gives collected entities.

I would like to save game state on the server side to allow this "multiplayer" part and check data to avoid cheating players.

I'm a little bit curious about the server side. Should I send all the game save file to the server then parse it to check his integrity?

My game will call specific routes to update the amount of data each 30 seconds/1 minutes.

I have made few games by the past but without the network part.

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 to effectively/properly use IntPtr in ImGui.NET How should I go about using methods that take an IntPtr in the .NET Dear ImGui wrapper, ImGui.NET?
For example, ImGui.SetDragDropPayload takes a type string, an IntPtr, and a size unint. When I ImGui.GetDragDropPayload() I don't seem to be able to just grab the type that I set (I can only query if it is a certain type)... And I'm not sure how to use IntPtr to represent an object in my game engine, which I presume is one of the use cases this parameter is intended for.
I feel like there is a fundamental paradigm that I'm not understanding here, as using IntPtr to hold game data seems like a common thing in ImGui.NET. I've done some looking into how to represent objects as IntPtr in .Net, but this seems to point me to creating IntPtr for use in WinApi functions and I haven't been able to get anything working yet or understand how I should be approaching this...
As you can probably tell, I'm also entirely unfamiliar with the C++ Dear ImGui, so this makes things even trickier for me to get my head around. Any thoughts would be appreciated!
Edit:
Here's an example of how I'm using it right now. As I mentioned, I don't know how to use the payload propertly, so I'm just using a separate static object to represent what's currently being dragged. Then checking to see if the payload's NativePtr is null or not. It seems to work, I think, but is obviously not ideal:
private static unsafe void SubmitTestWindow()
{
    ImGui.Begin("Test");

    string[] items = new string[] { "hello", "world", "how", "are", "you?" };

    for (int i = 0; i < items.Length; i++)
    {
        ImGui.Button(items[i]);
        if (ImGui.BeginDragDropSource())
        {
            ImGui.Text(items[i]);
            ImGui.SetDragDropPayload(typeof(string).FullName, IntPtr.Zero, 0);
            draggedItem = items[i];
            ImGui.EndDragDropSource();
        }
        if (ImGui.BeginDragDropTarget())
        {
            var payload = ImGui.AcceptDragDropPayload(typeof(string).FullName);
            if (payload.NativePtr != null)
            {
                Console.WriteLine("Dropped " + draggedItem + " onto " + items[i]);
                draggedItem = null;
            }
            ImGui.EndDragDropTarget();
        }
    }

    ImGui.End();
}

sentences:
problems with imported texture I have done a texture in GIMP and imported it in Unity but for some reason the texture appears to be squashed in the sides.

Image done in gimp:

And here is what happens in Unity:

sentences:
How can I create a .ico file with all the various resolution sizes within one container? I was looking at this GOG.ico in ffmeg, and was surprised to see all the streams for it...indicating it was holding multiple images in the .ico container or .ico has some kind of self-creation function where it generates the resolutions from a singular image based on condition? Or Maybe I'm overthinking it and its just a container with 7 different image variants stored inside?
Regardless I was curious on what the method of creation was for this many .ico in one hybrid, and how to replicate it. I'm already familiar with how to create a singular .ico image using gimp and/or ffmpeg....gimp is probably using ffmpeg itself. If its 7 images, those can be mapped to various streams of the .ico container using a tool like ffmpeg.
What's a more automated workflow people use to create these kinds of elaborate .iso though?

sentences: How do i draw a ray in unity So i am trying to scrap together something for vr in which the locomotion is about the player holding the direction where he wants to go to(basically planning what he is going to do)while holding down the button a ray is beeing drawn and when the player lets go the character moves until he reaches the end of the ray i tried looking up something but couldnt find anything regarding something like this

sentences:
Check if triangle collides with any object in certain LayerMask I am creating a custom navigation mesh and in order to see which triangles in my mesh are traversable I need a way to check if anything on a certain LayerMask in my scene collides with my triangle.
I have already thought about using consecutive SphereCasts to "fill in" my triangle, but this seems needlessly complex and computationally slow. Is there a built in function in Unity to achieve this?

sentences:
How to convert a rotation around an axis into pitch and yaw rotation So i want to rotate particles towards a point and i've already figured out how to calculate the angle and the rotation axis.

Currently what i do is simply use a 3 dimensional matrix, apply the rotation and then extract the euleric angles from the matrix using joml.

Now using the result i have the problem that the particle is also using the z rotation, messing up the orientation of the particles texture. The easiest way to fix this would be to only use yaw and pitch, but how do i convert the roation to just a rotation around the x and y axis?

sentences:
Timer as part of a condition I am using a sensor as the input to my game.

When a certain level of force is exerted on the sensor, for a certain amount of time, I want the next level to be reached.

How would I do this?

I have attached both the timer code and the game code, but I don't know how to use them together.

Timer code:

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

public class Timer : MonoBehaviour
{
    public int timeLeft = 5;
    public Text countdownText;

    // Use this for initialization
    void Start()
    {
        StartCoroutine("LoseTime");
    }

    // Update is called once per frame
    void Update()
    {
        countdownText.text = ("Time Left = " + timeLeft);

        if (timeLeft <= 0)
        {
            StopCoroutine("LoseTime");
            countdownText.text = "Times Up!";
        }
        //Invoke("ChangeLevel", 0.1f);
    }

    IEnumerator LoseTime()
    {
        while (true)
        {
            yield return new WaitForSeconds(1);
            timeLeft--;
        }
    }
    void ChangeLevel()
    {

        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
}

Game code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;

public class arduino : MonoBehaviour {

    SerialPort sp = new SerialPort("\\\\.\\COM6", 9600);// Com port and the baud rate of the arduino
    Material m_Material;
    GameObject Sphere;

    void Awake(){
        Sphere = GameObject.FindWithTag ("Player");
        m_Material = GameObject.FindWithTag ("Player").GetComponent<Renderer > ().material ;
    }
    void Start ()
    {
        if (!sp.IsOpen)
        { // If the serial port is not open
            sp.Open(); // Open
        }
        sp.ReadTimeout = 250; // Timeout for reading
     }
    // Update is called once per frame
    void Update () {
        if (sp.IsOpen) { // Check to see if the serial port is open
            try
            {

                string portreading = sp.ReadLine(); // get the string output of the serial port
                float amount = int.Parse(portreading);

                if ((amount > 10f) && (amount < 100f))
                {
                    m_Material.color = Color.grey;
                   // Sphere.transform.position = (new Vector3(0f, amount * 0.1f, 0f));

                }

                if ((amount > 101f) && (amount < 150f))
                {
                    m_Material.color = Color.blue;
                    //Sphere.transform.position = (new Vector3(0f, amount * 0.1f, 0f));
                }

                if ((amount > 151f) && (amount < 201f))
                {
                    m_Material.color = Color.yellow;
                    //Sphere.transform.position = (new Vector3(0f, amount * 0.1f, 0f));
                }
                if ((amount > 201f))
                {
                    m_Material.color = Color.red;
                   // Sphere.transform.position = (new Vector3(0f, amount * 0.1f, 0f));

                }
            }
            catch (System.Exception)
            {

            }
        }
    }
}

sentences:
How (if possible) would I change the BasicEffect Matrix mid draw Say, for example, I have a list of enemies.  Each enemy is a textured quad which is the stored in a singular shared VertexBuffer and IndexBuffer with the buffer usage set to BufferUsage.WriteOnly (static buffers essentially).  Then only one call to DrawIndexedPrimitives would be needed to draw all enemies.  The problem is enemies have to move around at some point.  It is quite easy to change the BasicEffect Matrixes to get the desired result of enemy movement.

My question is how can I change the BasicEffect Matrixes after each Quad using only one static VertexBuffer and IndexBuffer?

Changing the Matrixes for movement is normal, right?

I thought about using a DynamicVertexBuffer instead, is this more effcient for my case?

What about 4.0 streaming?  Would a call to GraphicsDevice.SetVertexBuffers(array);  (where array is whatever you send it that frame) be a better idea?

I know this question may seem silly for quads considering SpriteBatch is pretty good at doing this already for sprites.  But, I am going to add in my own dazzling effects and want to draw textured quads this way. Plus, I'm also OCD and want this to be organized and efficient.

Any help on the matter is appreciated.

sentences:
LibGDX Button and Table Layout I want to change the position of the Buttons inside a table, I tried setting their X and Y, or get their position when adding the Buttons on the Table, but it didn't work. It always aligns the button on the center.

Code:

    TextureAtlas ta = new TextureAtlas("Comecar.txt");
    final TextureAtlas.AtlasRegion as = ta.findRegion("comeca");
    final TextureAtlas.AtlasRegion as2 = ta.findRegion("comecaversao2");
    myTexRegionDrawable2 = new TextureRegionDrawable(as2);
    myTexRegionDrawable = new TextureRegionDrawable(as);
    myTexRegionDrawable.setMinHeight(300);
    myTexRegionDrawable.setMinWidth(260);
    myTexRegionDrawable2.setMinHeight(300);
    myTexRegionDrawable2.setMinWidth(260);
    b = new ImageButton(myTexRegionDrawable);
    op = new ImageButton(myTexRegionDrawable2);
    op.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
        }
    });
    b.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            gdxGame.setScreen(new Janela2(gdxGame));
        }
    });
    t = new Table();
    t.add(b);//I tried setting the position here
    t.add(op);
    t.setFillParent(true);
    stage.addActor(t);
    Gdx.input.setInputProcessor(stage);
}

sentences:
My game crashed... Access Violation (0xc0000005) I guess this is the first official crash I've had in Unity (that is not just an infinite loop.) The game works just fine in the editor but when build and run it, the game won't even start.

I just keep getting this error message:

So I check the folder specified but I have no idea what I'm looking at if I'm completely honest with my self. I see a bunch of directories and stuff but that's about it. I don't know how to read an error log but I'd like to. This whole game is a learning experience so I would to learn how but Idk what to do.

this is the error log : Here

If need be I'll put it in the question but I'd like to avoid making this too long. If you have any questions about my code you need to know let me know.

sentences:
How to convert Unreal Engine 4 spline to a bezier curve? I have read the source code of USplineComponent and found that for a curve in Unreal, the result is calculated via FMath::CubicInterp:

/**
 * Performs a cubic interpolation
 *
 * @param  P - end points
 * @param  T - tangent directions at end points
 * @param  Alpha - distance along spline
 *
 * @return  Interpolated value
 */
template< class T, class U >
static FORCEINLINE_DEBUGGABLE T CubicInterp( const T& P0, const T& T0, const T& P1, const T& T1, const U& A )
{
    const float A2 = A  * A;
    const float A3 = A2 * A;

    return (T)
           (((2*A3)-(3*A2)+1) * P0)
         + ((A3-(2*A2)+A) * T0)
         + ((A3-A2) * T1)
         + (((-2*A3)+(3*A2)) * P1);
}

You can follow the logic in USplineComponent::Draw to be convinced.

And the calculation approach above is the same as the cubic hermite spline:

$$
\boldsymbol{p}(t) = (2t^3-3t^2+1)\boldsymbol{p}_0 + (t^3-2t^2+t)\boldsymbol{m}_0 + (-2t^3+3t^2)\boldsymbol{p}_1 +(t^3-t^2)\boldsymbol{m}_1
$$

Then the problem becomes how to convert a cubic hermite spline to a bezier curve.

I have tried several conversion methods on SO:

https://stackoverflow.com/a/1099357/3427520
https://stackoverflow.com/a/42587252/3427520
https://stackoverflow.com/a/42590480/3427520

But all failed to get a correct bezier curve as USD that can be correctly rendered by Houdini.

But what I have been worrying most is that USplineComponet is not a cubic hermite spline. I'm not sure since I knew few about curve math, even after reading some introduction of curve wiki, PDFs and articles.

The bezier curve data to USD bezier-basis curve procedure may also fail, I don't have a solution to verify converted bezier curve is correct (can generate the same shape in UE4) or not.

sentences:
Shader - Color blending I would like to know how to blend colors in a specific way.

Let's imagine that I have a color (A) and an other color (B).

I would like to blend them in such a way that if I choose white for the (B) then the output color is (A) but if have any other color for (B) it outputs a blending of (A) and (B).

I've tried the addition, but it doesn't give the expected result.
I've tried the multiplicative blending it's quite good for the (B) white value but it fail for a blue (B) and red (A) colors.

Any idea how to do that ?
Thanks a lot.

sentences:
LibGDX: I need to get from SpriteBatch to Batch in order to draw a Touchpad I have created a little game using LibGDX and it uses a SpriteBatch when it renders the game objects. Now I want to add a Touchpad to it, and the draw method of Touchpad takes a Batch as a parameter, but my game uses SpriteBatch.
What can I do?

sentences:
LibGDX - how to make sizeToAction relative to other corner than bottom-left? I'm trying to resize a widget inside a Table.
It's a fullscreen widget and when Android Keyboard comes out, the widget is resized so it fits half of the screen from the top.

SizeByAction works from the left-bottom corner so it resizes the widget down, and I have to resize it up.

For now I use a hack with a parallel action and I change it's size and POSITION in the same time so it looks like a want (like it was staying in the left-top corner all the time).

I know there's a originX and originY but they're used to rotation, not resizing elements.

If someone did something like this before without a hack  like mine, I would be grateful for a tip! :)

How does the widget look like? It's a fullscreen widget:

How does it look after resize?

How I want it to look like?
I want it to rezise relative to it's left-up corner

sentences:
Achieving a fixed frame-rate with varying scenes I am working on an OpenGL 3D model viewer app for iOS.

I have to load, view and navigate extra detailled 3D models on an iPad. I hardly achieve 2 fps, if i load and navigate a very complex model. I tried some optimizations like view-frustum-culling, area in pixel space, back-face-culling etc but still i am unable to improve the frame rate.

I would like to set fixed frame-rate to some X fps for my app and drop-out all the objects which don't have enough time to render at run-time. I would like to know if there is any algorithm to achieve this fixed frame-rate. I would appreciate any ideas.

sentences:
How to achieve light that changes color mid-way? I thought of creating light sources, and some colored windows. Now, the windows are semi-transparent. How could I make it so that when the light (say, pure white) hits the glass and continues through it, but changes the color to the same color as the glass it passed?

I know the effect described here can be faked by using area lights on the "colored" side of the window, but what if I just wanted to have one white point light?

sentences:
Java vs Javascript for Web-based games With all the recent interest in developing HTML5 apps and games, and I am curious why all the focus is on Javascript, and not on Java.

Minecraft is a great example of what can be accomplished in a browser, and it's written in Java, not JS. I doubt if it is even possible/practical to attempt such a complex project in JS.

Java is clearly a more powerful platform, and it probably runs significantly faster (this is just my guess, though). About the only drawback of Java I can think of is that it runs as a plugin, and with the trend towards plugin-free browsers (e.g. IE10 metro) Java applets may become obsolete in mobile environments. This has already happened with Flash on iOS.

What do you think? Is there a future in developing Java-based Web apps (especially for mobile devices)?

Thanks

sentences:
problem with git on a unity project I tried to version control my project folder with git. When it came to pull the project from the repository, though, something went wrong: apparently scripts are missing and the prefabs and kind of all the graphical elements appear to be pinkish. Does anybody know how to fix this?

This is the .gitignore I'm using at the moment:

Temp/
Obj/
UnityGenerated/
Library/

ExportedObj/
*.svd
*.userprefs
*.csproj
*.pidb
*.suo
*.sln
*.user
*.unityproj
*.booproj

.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

Thanks in advance.

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:
User-friendly scripting when using an ECS? I am currently creating a small hobby project to get back into game development, and I have decided to structure my entities using an ECS (Entity Component System). This implementation of an ECS is structured like so:

Entity: In my case it's a unique int identifier that is used as a key to a list of components.
Component: Holds only data, e.g. the Position component holds an x and y coordinate, and the Movement component holds a speed and direction variable.
System: Handles components, e.g. it takes the Position and Movement components and adds the speed and direction to the position's x and y coordinates.

This works fine, but now I wish to implement scripting into my games, in the form of a scripting language. In previous projects I've used an OOP implementation of game objects, which meant that scripting was pretty straight forwards. For example, a simple script could look something like this:

function start()
    local future = entity:moveTo(pos1)
    wait(future)

    local response = entity:showDialog(dialog1)
    if wait(response) == 1 then
        local itemStack = entity:getInventory():removeItemByName("apple", 1)
        world:getPlayer():getInventory():addItemStack(itemStack)
    else
        entity:setBehavior(world:getPlayer(), BEHAVIOR_HOSTILE)
    end
end

However, when using an ECS, the entity itself does not have any functions like moveTo or getInventory, instead the above script written in ECS style would look something like this:

 function start()
    local movement = world:getComponent(MOVEMENT, entity)
    movement:moveTo(pos1)

    local position = world:getComponent(POSITION, entity)
    local future = Future:untilEquals(position.pos, pos1)
    wait(future)

    local dialogComp = world:getComponent(DIALOG, entity)
    local response = dialogComp:showDialog(dialog1)

    if wait(response) == 1 then
        local entityInventory = world:getComponent(INVENTORY, entity)
        local playerInventory = world:getComponent(INVENTORY, world:getPlayer())
        local itemStack = entityInventory:removeItemByName("apple", 1)
        playerInventory:addItemStack(itemStack)
    else
        local entityBehavior = world:getComponent(BEHAVIOR, entity)
        local playerBehavior = world:getComponent(BEHAVIOR, world:getPlayer())
        entityBehavior:set(playerBehavior, BEHAVIOR_HOSTILE)
    end
end

This is a lot more verbose compared to the OOP version, which is not desirable when the scripting is aimed towards mostly non-programmers (players of the game).

One solution would be to have some sort of wrapper object that encapsulates an Entity and supplies functions such as moveTo directly, and handles the rest internally, although such a solution seems sub-optimal since it takes a lot of work to cover all the components, and every time a new component is added you would need to change the wrapper object with new functions.

To all game developers that has implemented scripting in an ECS before - how did you do it? The main focus here is usability for the end user, with as little "maintenance" cost as possible (preferably you don't need to change it every time you add a component).

sentences:
RPG Formula - Attack and defense I'm making a game and I'm struggling with the formula to calculate the real damage the player does. I have skills which can do for example 10 hits of 20% weapon damage each of a total of 200% damage. Or another skill does 200% damage 1 hit.

However the formula I have right now is something like this

( 2 * Attack - Defense ) * 0.5

As you can see with an equal defense, the attack that does 1 hit 200% weapon damage will actually do more damage than the skill that does 10 hits 20% weapon damage each, because the reduction is greater when dealing low amounts of damage.

Or another case is a weapon does 200 physical damage and 50 fire damage. With this formula a enemy with 100 defense receives 150 physical (ok) and 0 fire damage (negative, not ok)

Can anyone help me get a formula (not too complex)? I don't know what to try. What I want to achieve is to get the same real damage (1 hit @ 200% or 10 hits @ 20%) and make the defense matter, what I mean by that is that it affects the attack.

sentences: UNITY : I want to make my UI text fade in after 5 seconds I know this question has been asked and asked but none of the topics i visited gave me an answer. I'm making a game programmed in c# where you control a boat and i want my UI to appear smoothly by fading in after X seconds. May someone help me?

sentences:
Unity 2d overlapCircle melee combat issue I have an issue with my overlapCircle melee combat in the game. I'm not good at such things, so I just copied that code from some YouTube tutorial. But the thing is that if the enemy is behind the collider, I can still damage and kill him. And I don't want this. Is there a solution to this problem except recreating the melee combat system from the ground up? Maybe changing circle radius when close to collider?...
Here's a video clip that may help show the situation.
void Attack()
{
    Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, whatIsEnemy);
    foreach (Collider2D enemy in hitEnemies)
    {
        Debug.Log("Melee hit: " + enemy.name);
        if (enemy is BoxCollider2D)
        {
            CinemachineShake.Instance.ShakeCamera(3f, 0.2f);
            SoundManager.PlaySound("Knife_kill");
            if (enemy.tag == "Melee enemy")
                enemy.GetComponent<enemy_melee>().TakeDamage(attackDamage);
            else if (enemy.tag == "Gun enemy")
                enemy.GetComponent<enemy_gun>().TakeDamage(attackDamage);
        }
    }
    animator.SetTrigger("Melee_attack");
    animator.SetBool("IsCrouching", false);
    animator.SetBool("IsJumping", false);
}

sentences:
How to stop an animation from looping I want to make Unity play a squish animation when the player hits the ground, but only once, until the player jumps and hits the ground again, although Unity its constantly detecting that the player is on the ground and keeps playing the squish animation over and over again, only jumping stops it cause the condition to play the animation is if the player is on the ground. (loop already disabled)
How I can possibly solve this?

 if (isGrounded == true)
        anim.SetTrigger("EnterGround");

sentences:
Use different values for Depth Test and Depth Write in OpenGL Is there a way to use something similar to PolygonOffset to make a depth test more permissive (move fragment depth towards eye) but still write the original depth value to the depth buffer? The only thing I can come up with is a tricky two pass solution using a stencil buffer, but I'd like to avoid that if possible.

Context of my question: We have an entity with a particle based smoke plume that is often in front of a semi-transparent building. Do to some constraints with batching, the building gets drawn after the smoke plume. Originally the smoke plume particles were rendered with a depth test but no depth write. This caused the building to be drawn on top of the smoke.

Turning the depth write on for the smoke particles fixes the building, but now the smoke particles interfere with each other. Ideally, I'd like to find a way for them to stop interfering while still writing to the depth buffer.

sentences:
2D moving objects in angle Im making simple 2D space shooter with use of html5 and JavaScript.
The idea is simple, shoot down as many aliens as you can.
I made it to the point where I have player which can move and rotate, but I want the player to move in the angle, like 80s Asteroids (you set angle then press forward key and ship goes forward in that angle)

my movement now is simple:
up = y -= speed * delta time
down y += speed * delta time
left x -= speed * delta time
right x += speed * delta time

my rotation is made like this:
ctx.save();
ctx.translate(this.x + this.w / 2, this.y + this.h / 2);
ctx.rotate(this.angle);
Draw.Rect(ctx,this.w /2 * (-1),this.h / 2 * (-1),this.w,this.h,"red",1);//context,x,y,w,h,color,opacity
ctx.restore();

angle:
if(keys.e)this.angle += 0.1;
if(keys.q)this.angle -= 0.1;

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:
Choosing frame rate in PyGame with keyboard input Using PyGame, I want to create a moving square which moves in a grid, controlled by keyboard presses of the arrows. So, pressing the "up" key moves the square to the cell directly upwards, pressing the "right" key moves the square to the cell directly to the right, etc.

In my loop, I use pygame.time.wait(x), to pause for x ms. However, choosing the correct value for x is proving difficult. If x is too large (e.g. 1000), then the square does not respond immediately, and I actually have to hold down the key to get it to move. But if x is too small (e.g. 10), then the square will move several times in a row whenever I press a key. But I just want the square to move once for every key press. How can I do this? Thanks!

Below is the important part of my code:

    x = 100
    current_pos = [0, 0]

    while True:

        pygame.event.pump()  # process event queue
        is_key_pressed = pygame.key.get_pressed()

        if is_key_pressed[pygame.K_UP]:
            current_pos[1] -= 1

        elif is_key_pressed[pygame.K_RIGHT]:
            current_pos[0] += 1

        elif is_key_pressed[pygame.K_DOWN]:
            current_pos[1] += 1

        elif is_key_pressed[pygame.K_LEFT]:
            current_pos[0] -= 1

        show_map(current_pos)

        pygame.time.wait(x)

sentences:
Sample() returns (0, 0, 0) for normal map 90% of frames I'm having some trouble reading the values from my Normal map in my lighting fragment shader.

The relevant part of the shader code is as follows:

Texture2D NormalGB : register(t0);
Texture2D DiffuseGB : register(t1);
Texture2D SpecularGB : register(t2);
Texture2D PositionGB : register(t3);

SamplerState NormalSampler : register(s0);

void GetGBValues(
    in int2 screenPosition,
    out float3 normal,
    out float3 diffuseAlbedo,
    out float3 specularAlbedo,
    out float specularPower,
    out float3 position)
{

    int3 screenPos3 = int3(screenPosition, 0);
    normal = normalize(NormalGB.Sample(NormalSampler, screenPosition).xyz); // HERE
    diffuseAlbedo = DiffuseGB.Load(screenPos3).xyz;
    float4 specularValues = SpecularGB.Load(screenPos3);
    specularAlbedo = specularValues.xyz;
    specularPower = specularValues.w * 50.0f;
    position = PositionGB.Load(screenPos3).xyz;
}

However, in 9 frames out of 10, normal is set to {0. 0, 0}. I've tried the code under the reference driver too, and get the same issue.

What's really weird is that if I change the line marked // HERE to a simple .Load call, the code works perfectly (except the obvious fact that I get no interpolation of normals). The sampler that is bound at time of the draw call (according to the graphics debugger) is:

D3D11 Sampler State (obj:18)
AddressU D3D11_TEXTURE_ADDRESS_WRAP
AddressV D3D11_TEXTURE_ADDRESS_WRAP
AddressW D3D11_TEXTURE_ADDRESS_WRAP
BorderColor (0.000f, 0.000f, 0.000f, 0.000f)
ComparisonFunc D3D11_COMPARISON_NEVER
Filter D3D11_FILTER_ANISOTROPIC
MaxAnisotropy 4
MaxLOD 340282346638528860000000000000000000000.000f
MinLOD 0.000f
MipLODBias 0.000f

Device obj:3

And finally, the normal-map (rendered to a texture by the previous pass):

sentences:
What causes SFML pollEvent to segfault here? I'm writing an SFML application in C. Currently sfRenderWindow_pollEvent() and sfRenderWindow_waitEvent() always segfault.

Here's the cleaned code that shows the issue.

sfRenderWindow* window;
sfVideoMode mode = {SCREEN_WIDTH, SCREEN_HEIGHT, 32};
window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, NULL);

sfEvent* InputEvent;

while(1)
{
    while (sfRenderWindow_pollEvent(window, InputEvent) == sfTrue)
    {
        ...
    }
}

sentences:
LibGDX multiple enemies animations Hello everyone i have a question about animating multiple enemies on the screen at the same time.

Basically, i figured out how to use the Pool for creating enemies and dispose them after use etc..
All enemies are equal to each other, and all enemies have 3 different animations for creating, moving, destroying.

Everything is working fine, but when i have multiple enemies on screen, they are all animating at the same times, even if they were (obviously) created in different times.

For example, i create 3 enemies, make them moving on the screen and they all have the same frame.. the animation must be the same for all, but i expected that the time when they change frame should be different.

The animations are instantiated inside the Enemy class, so i guess every instance of Enemy must have its own animation.

This is how i draw them in the Renderer class:

private void drawEnemies(float runTime) {
    enemyArrayLen = catta.activeEnemies.size;
    for (int i = enemyArrayLen; --i >= 0;) {
        currentEnemyAnimation = catta.activeEnemies.get(i).getCurrentAnimation();
        batcher.draw(
            currentEnemyAnimation.getKeyFrame(runTime),
            catta.activeEnemies.get(i).getX(),
            catta.activeEnemies.get(i).getY(),
            catta.activeEnemies.get(i).getWidth() / 2.0f,
            catta.activeEnemies.get(i).getHeight() / 2.0f,
            catta.activeEnemies.get(i).getWidth(),
            catta.activeEnemies.get(i).getHeight(),
            1,
            1,
            0
        );
    }
}

Enemies are stored in the catta.activeEnemies array.

currentEnemyAnimation is a "support" variable in which i put the Enemy in every cicle of the for cicle.

This is how i initialize an Enemy:

public void init(float posX, float posY, int width, int height) {
    this.position.set(posX,  posY);
    this.width = width;
    this.height = height;
    this.alive = true;
    this.enemyRunTime = 0;
    this.creationTime = 0.8f;
    this.destructionTime = 0.8f;
    this.crea_Animation = AssetLoader.enemy_creaAnimation;
    this.crea_Animation.setFrameDuration(this.creationTime / 4);
    this.mo_Animation = AssetLoader.enemy_moAnimation;
    this.des_Animation = AssetLoader.enemy_desAnimation;
    this.des_Animation.setFrameDuration(this.destructionTime / 4);
    this.enemyState = EnemyState.CREATING;
    ...

Maybe it's all a runTime and delta matter?

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:
glm direction vector rotation I'm working on a flight simulator, but I'm stuck with my airplane orientation. I tried some things but noone worked correctly. This is what I have :

To be able to move it and roll it around himself, I need two vectors, forward and up, and use them to create quaternions I need for the rotation :

void Plane::Update()
{
    m_position += ( m_forward * m_speed );

    mat4 translation = translate( mat4( 1.0f ), m_position );

    float angle = dot( vec3( 1.0f, 0.0f, 0.0f ), m_forward );
    quat direction = angleAxis( acos( angle ), cross( vec3( 1.0f, 0.0f, 0.0f ), m_forward ) );

    m_matrix = translation * mat4_cast( direction );
}

vec3( 1.0f, 0.0f, 0.0f ) is my model orientation. Note that in this code, I don't have quaternion for rolling the plane, because I first want to have a correct direction.

This works great, what doesn't work is when I want to make him taking off. To do that, I first get the right vector, then use it to create my quaternion with the angle I need, and I apply the rotation to the forward and up vector.

void Plane::FlyUp()
{
    vec3 right = cross( m_forward, m_up );

    quat temp = angleAxis( radians( 1.0f ), right );

    m_up = temp * m_up;
    m_up = normalize( m_up );

    m_forward = temp * m_forward;
    m_forward = normalize( m_forward );
}

Using debugger and an online vector visualizer, It seems to give me the good vectors, but the plane is rotating weirdly ( in fact, that's not even only rotating, he's scaled too for some reasons... ).

What am I doing/understanding wrong?

Edit :

To be more precise, here is screenshoots of what I have :

And what I'm trying to have, whatever the m_forward vector is pointing to :

sentences:
Changing animation speed at runtime Is there a way in Unity to change the animation speed of an animation managed by an animator controller (Mecanim)?

I'd like to do that at runtime so that I can speedup and slow down an animation based on conditions in code.

sentences:
Best method for 2 layer tile based map scrolling What is the best general approach to implement scrolling for a 2D tile based game?

I need to scroll the map with a constant speed, lets say 2 pixels every frame (like in a top down shooter).

The tiles are 32x32 and the map is quite big, lets say 10 x 300.

There are 2 layers:
- first is the background layer
- second is the forgeground layer with obstacles and enemies

The target plattform is android and I want to use OpenGl.

What is best practice?

a) Draw only the visible Screen all the time (every frame)
b) Load complete map into memory and just move the camera

Is there a difference in performance and determining collision etc.?

Thanks for any help!

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:
Reusing a render target to create multiple Texture2D's (XNA) i want to be able to loop through a hole bunch of textures, and render them on an object. I then want the rendered image to be placed onto a texture2D.

The point? well hopefully i will end up with an array of Texture2D's containing a model with multiple skins.

Here's my code:

        for (byte i = 1; i < allBlockIso.Count(); i++)
        {
            DisplayBox.SetValue(i);
            GraphicsDevice.SetRenderTarget(cubeTarget);
            GraphicsDevice.Clear(Color.Transparent);
            DrawIsoCube();
            GraphicsDevice.SetRenderTarget(null);
            allBlockIso[i] = (Texture2D)cubeTarget;
        }

DisplayBox.SetValue is a function which goes through and sets the texture. This is working! DrawIsoCube() draws the cube (the test model) and this is working too.
The problem is definitely something to do with the unreusability of the render target.

Pretty simple yet it's not working. It appears that whatever the last image being rendered is, is shown in every image of the allBlockIso array.

Anyone know a fix?
Cheers.

P.S. sorry if this wan't explained well. I'm not very good at explaining :P

sentences:
Dynamic frame rate in Unity I'm developing a 3D visualization tool based on Unity, targeting WebGL. The user rarely interacts with the 3D scene and when he does it's only about adjusting the camera like rotating or zooming the view. I disabled vSync (QualitySettings.vSyncCount) and locked the frame rate to 30 (Application.targetFrameRate) to reduce the CPU usage at least a bit while still having an acceptable level of responsiveness when the user moves the camera around. With 30 fps I get a CPU usage of around 30%. Considering lower-end hardware this seems still too high.
In order to further decrease CPU usage, I introduced two 'modes':

Interactive: runs with 30 fps
Idle: runs with 10 fps

I wrote some lines of code to switch between those modes depending on user interaction. So when an input is detected, the application uses more fps and after a certain amount of time without any interaction, the application uses less fps again. It works pretty well so far: The app uses 30% in interactive mode and 8% to 10% of the CPU while in idle mode.
Setting the idle frame rate to 1, CPU usage is reduced to 1.5% while in idle mode. This is really great. But as expected there's a problem. Basically I locked all the Update() methods to be called only once per second. When the user interacts with the camera, the event will be processed with an expected delay of something around one second.
Now the question: How can I detect user input immediately while having the application run with a low frame rate and also immediately apply a new frame rate (say 30) without any  noticeable delay?
Originally I wanted to have some sort of on-demand rendering. I've read some posts about how people render to a texture to reduce rendering cost in less interactive scenes. But setting the frame rate dynamically seems like a cleaner solution in my opinion. I also tried to use the FixedUpdate() method to check for inputs and switch to interactive mode, but that didn't work either.
Note Also worth mentioning, this approach produces errors in the browser, indicating that the application frame rate should be 0 (not in terms of Unity's target frame rate but as in 'let the browser handle the frame rate'). While this might be a different question it's still related to this topic. Maybe someone has an answer for that as well!

Edit 1
As mentioned in the comments below, Unity provides the callbacks MonoBehaviour.OnApplicationPause and MonoBehaviour.OnApplicationFocus to detect whether the application is about to receive or lose focus.
However, the problem is this: My application nearly never loses focus. While this is a nice additional optimization it doesn't really help me too much. My problem is that the app is idle most of the time while also having focus. It's really just the user staring at the window most of the time.
Just to make some more sense: I'm targeting WebGL. Unity's sole purpose is to visualize some stuff while the user mainly interacts with some HTML controls. In the rare case he wants to interact with the 3D scene, I want to set the frame rate to say 30. The idea is "I don't re-render the scene too often as long as you don't interact".
To emphasize: In my most relevant use case the application never loses focus. This means, the only reliable indicator to determine when to switch between frame rate profiles is based on user input.
Sorry if I wasn't too clear about that :)

Edit 2
I posted this topic on the Unity Feedback Page. If you're interested, check it out and leave a vote. Maybe this request gets enough attention to get supported by the Unity developers.

sentences:
How would I apply gravity to a bullet so that it would drop slightly the longer that it travels? How would I apply gravity to a bullet so that it would drop slightly the longer that it travels?

I somewhat understand how the gravity works, Im just asking for second opinions for more optimized ways of doing this.

VOID update()
{
    veloc_Y += gravity;//0.5f
    posX += veloc_X;
    posY += veloc_Y;

       if(posY > 650)
       {
           posY = 650.0f;
           veloc_Y = 0.0f;
           on_g = true;//lets my game know im on the ground
       }
}

so, would I apply gravity to bullet veloc_Y?

ex:

b_veloc_Y += gravity;
b_pos_Y += b_veloc_Y;

would this make my bullet drop?

thanks for help in advance

sentences:
How can I run and jump at the same time? I'm having some trouble with the game I started.
http://testing.fyrastudio.com/lab/tweetOlympics/v0.002/
The thing is that i have an athlete running and he must jump at the same time. A race with obstacles.

I have him running (with pressing the letter Q repeateadly). I also have him jumping (with letter P)
But the thing is that when he runs and jumps at the same time, he seems to be jumping at the same place, instead of going forward with the jump... any ideas how can I fix this??

This is the code I'm using for running and jumping on a continuos loop.

//if accelearing and the last time that he accelerated was less than X seconds ago, hes running an accelaring
     if (athlete.accelerating && timeCurrent - athlete.last_acceleration > athlete.delay_acceleration) {
      athlete.accelerating = false;
      athlete.last_acceleration = timeCurrent;
      athlete.running = true;
     }
     if (!athlete.accelerating && timeCurrent - athlete.last_acceleration > athlete.delay_acceleration) {
      athlete.decelerating = true;
     }
     if(athlete.decelerating && timeCurrent - athlete.last_deceleration > athlete.delay_deceleration){
      if(athlete.speed >= 1){
       //athlete starts to decelarate
       athlete.last_deceleration = timeCurrent;
       athlete.decelerate();
      }else {
       athlete.running = false;
      }
     }
     if (athlete.running) {
      athlete.position += athlete.speed;
     }
     if (athlete.jumping) {
      if (athlete.jump_height < 1) {
       athlete.jump_height = 1;
      }else {
       if (athlete.jump_height >= athlete.jump_max_height) {
            athlete.jump_height = athlete.jump_max_height;
            athlete.jumping = false;
       }else {
            athlete.jump_height = athlete.jump_height * athlete.jump_speed;
       }
      }

     }
     if (!athlete.jumping) {

      if(athlete.jump_height > 1){
       athlete.jump_height = athlete.jump_height * 0.9;
      }else {
       athlete.jump_height = 1;
      }
     }

     athlete.scaleX = athlete.scaleY = athlete.jump_height;
     athlete.x = athlete.position;

Thanks!

sentences:
(Unity) Proper way to save ScriptableObjects changed during play mode? I was wondering what the "correct" way to save scriptable objects in Unity that are changed during Play mode. So far I have something that works:

    // changes
    PartyMember Lalala = PartyMemberDictionary.Find("Lalala");
    Lalala.HP += 17;
    print("Lalala's HP: " + Lalala.HP);
    // then saves
    AssetDatabase.Refresh();
    EditorUtility.SetDirty(Lalala);
    AssetDatabase.SaveAssets();

Note: Lalala is a direct reference to a PartyMember scriptable object in my Assets/Resources folder.

I'm still a little shaky on this approach, however. I got this directly from reading this question:

https://forum.unity3d.com/threads/scriptableobject-asset-problem-the-changes-wont-saved-to-disk.229664/

But the commentator did not explain what each of these three lines of code mean.

    AssetDatabase.Refresh();
    EditorUtility.SetDirty(Lalala);
    AssetDatabase.SaveAssets();

Can someone explain these to me? I'm not sure I understand them fully. I assume "dirty" indicates that data changed; please correct me if I'm wrong.

In this link

https://docs.unity3d.com/ScriptReference/AssetDatabase.SaveAssets.html

it asserts that SaveAssets() saves all unchanged asset changes to disk, so why do I need the other Refresh and SetDirty Functions?

In this link

http://answers.unity3d.com/questions/11531/why-doesnt-my-scriptableobject-save-using-a-custom.html

The OP says "as I found out after some trial and error AssetDatabase.SaveAssets doesn't actually save the asset as expected." ... so confused at this point. That leaves me hesitant to continue until I understand what's going on. Perhaps the Refresh and SetDirty cement the job?

Also,
in this link

https://docs.unity3d.com/ScriptReference/EditorUtility.SetDirty.html

it mentioned that Undo.RecordObject is preferred. Based on your experiences, is this true? Is EditorUtility.SetDirty(); obsolete in this day and age already? I don't want to use it if I have to change my code in the future.

At the end of the day I simply want something that works.

sentences:
Pattern for modular ScriptableObject-Database? Lets say we want to store game data inside of scriptableObjects and we have plenty of them... So we need to find a way to store them efficiently in a modular way.

What pattern could we use to code a scriptableObject database for providing a substainable base for our game data- scriptableObjects?

And are there any patterns or structures for extending our game data - scriptableObjects in order to construct them modular and flexible aswell ?

sentences:
Using modified copyrighted music in non-commercial games Background: I'm making a retro style game for both fun, and an unofficial contest.

I have bought a song, song X. However, I then found notation for song X, and all the instruments. So basically, it's a program recreating song X in a sense.

I took the notation, and used another program to make it sound like a chiptune does (just for the fun of it, and it sounds good :P). However, I would like to use this in my game. It's non-commercial, but is this allowed? I would've said yes, because I'm not actually using the original, copyrighted song.

I think the main point is can I:

Use the music with no reference to the author
Use the music with a reference, since it's non-profit.
Not use the music at all since the melody and rhythm is copyright.

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:
MiniMax strategy - What is the context of the numbers? I've watched a new videos about the MiniMax concept and invariably the lecturer will say that the computer has 2 parties, Min and Max; Min always takes lower number and Max takes higher number.

The problem I have is this.

I'm finding it hard to understand why Min takes the lower number at all or why Max takes the higher number at all?

What is the reasoning and context for these numbers?

I mean, logically I know that 7 is higher than 3; but that doesn't mean anything by itself.

What is the context of the numbers?

Many thanks

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:
Which programming language should I start with in game dev? I am a front end web developer and I've always been interested in building games.  I work primarily with HTML, CSS, PHP, and JavaScript on a daily basis, so I'm not new to coding.  I would like to know which language/platform would be most useful for me to build a simple, 2D, art heavy game, like something you'd see on the Super Nintendo.

Thanks.

sentences:
nullObjectException in OnDrawGizmos Function I was studding A* Algorithm and it is showing a nullObjectException in my OnDrawGizmos function whenever it finishes compiling the code.

Here is my code - can anybody tell me what I am doing wrong?

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

namespace PathFinding {
    public class Grid : MonoBehaviour {
        public Transform Startpostion;
        public LayerMask Layer_Mask;
        public Vector2 gridWorldSize;
        public float nodeRadius;
        public float Distance;

        public Node[ , ] grid;
        float NodeDiameter;
        int GridSizeX, GridSizeY;
        public List<Node> FinalPath;

        private void Start () {
            NodeDiameter = nodeRadius / 2;
            GridSizeX = Mathf.RoundToInt (gridWorldSize.x / 2);
            GridSizeX = Mathf.RoundToInt (gridWorldSize.y / 2);
            GridCreator ();

        }
        void GridCreator () {
            grid = new Node[GridSizeX, GridSizeY];
            Vector3 bottomLeft = transform.position - Vector3.right * gridWorldSize.x / 2 - Vector3.forward * gridWorldSize.y / 2;
            for (int y = 0; y < GridSizeY; y++) {
                for (int i = 0; i < GridSizeX; i++) {
                    Vector3 WorldPositionOfCurrentNode = bottomLeft + Vector3.right * (i * NodeDiameter + nodeRadius) + Vector3.forward * (y * NodeDiameter + nodeRadius);
                    bool Wall = true;

                    if (Physics.CheckSphere (WorldPositionOfCurrentNode, nodeRadius, Layer_Mask)) {
                        Wall = false;
                    }
                    grid[i, y] = new Node (Wall, WorldPositionOfCurrentNode, i, y);
                }
            }
        }
        private void OnDrawGizmos () {
            Gizmos.DrawWireCube (transform.position, new Vector3 (gridWorldSize.x, 1, gridWorldSize.y));

            foreach (Node n in grid) {
                if (n.is_Wall) {
                    Gizmos.color = Color.white;
                } else {
                    Gizmos.color = Color.yellow;
                }
                if (FinalPath != null) {
                    if (FinalPath.Contains (n)) {
                        Gizmos.color = Color.red;
                    }
                }
                Gizmos.DrawCube (n.postion, Vector3.one * (NodeDiameter - Distance));
            }
        }
    }
}

sentences:
OpenGL Get Rotated X and Y of quad I am developing a game in 2D using LWJGL library.

So far I have a rotating box. I have done basic Rectangle collision, but it doesn't work for rotated rectangles.

Does OpenGL have a function that returns the vertices of rotated rectangle? Or is there another way of doing this using trigonometry?

I had researched how to do this and everything I found was using some matrix that I don't understand so I am asking if there is another way of doing this.

For clarification, I am trying to find out the true (rotated) X,Y of each point of the rectangle. Let's say, the first point of a rectangle (top,left) has x=10 y=10.. Width and height is 100 pixels. When I rotate the rectangle using glRotatef() the x and y stay the same. The rotation is happening inside OpenGL. I need to extract the x,y of the rectangle so I can detect collisions properly.

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:
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:
Change button sprites in scrollview Unity3D_5.2 I have a scroll view with lots of buttons on it. when i press one button, that button needs to change the sprite and stay like that. if any other button (or same one) is pressed previous button needs to revert back to original sprite..
here is some example

button 2 was pressed and changed sprite, it stays like that untill it is pressed again or any other (in this case button 3) is pressed

sentences:
Slick2D, Nifty GUI listeners problem I'm trying to get Nifty GUI to work with Slick2D. So far everything is going great, except that I can't seem to figure out how to properly interact with the GUI. I'm trying the example in the nifty manual http://sourceforge.n....0.pdf/download
but it doesn't seem to entirely work.

The Element controller is being called for bind(...), init(...) and onStartScreen() as it should, as I can see their println output, but the next() method isn't being called when I click on the GUI element that I assigned the controller to, nor the screen controller as no output from println is shown.

What's weird is, that the player is moving, so the mouse input is working.
It's supposed to be called when I click the mouse button on it from the  in the XML.

Here is my code:

My Element controller:

public class ElementController implements Controller {

private Element element;

@Override
public void bind(Nifty nifty, Screen screen, Element element, Properties parameter, Attributes controlDefinitionAttributes) {
  this.element = element;
  System.out.println("bind() called for element: " + element);
}

@Override
public void init(Properties parameter, Attributes controlDefinitionAttributes) {
  System.out.println("init()  called for element: " + element);
}

@Override
public void onStartScreen() {
  System.out.println("onStartScreen()  alled for element: " + element);
}

@Override
public void onFocus(boolean getFocus) {
  System.out.println("onFocus()  called for element: " + element + ", with: " +
    getFocus);
}

@Override
public boolean inputEvent(NiftyInputEvent inputEvent) {
  return false;
}

public void next() {
  System.out.println("next() clicked for element: " + element);
}
}

MyScreenController:

class MyScreenController implements ScreenController {
    public void bind(Nifty nifty, Screen screen) {}
    public void onEndScreen() {}
    public void onStartScreen() {}
    public void next() {
     System.out.println("next() called from MyScreenController");
}
}

And my XML file:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://niftygui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
<screen id="start" controller="predaN00b.theThing.V0004.MyScreenController">
  <layer childLayout="center" controller="predaN00b.theThing.V0004.ElementController">
   <panel width="100px" height="100px" childLayout="vertical" backgroundColor="#ff0f">
     <text font="aurulent-sans-16.fnt" color="#ffff" text="Hello World!">
      <interact onClick="next()" />
     </text>
   </panel>
  </layer>
</screen>
</nifty>

My main class, in case it's needed:

public class MainGameState extends BasicGame {

public Nifty nifty;

public MainGame() {
  super("Test");
}

public void init(GameContainer container, StateBasedGame game) throws SlickException {

  nifty = new Nifty(new SlickRenderDevice(container), new NullSoundDevice(), new PlainSlickInputSystem(), new AccurateTimeProvider());

  nifty.addXml("/xml/MainState.xml");
     nifty.gotoScreen("start");

}

public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
  nifty.update();
}

public void render(GameContainer container, StateBasedGame game, Graphics graphics) throws SlickException {
  nifty.render(false);
}

  public static void main(String[] args) throws SlickException {
     AppGameContainer app = new AppGameContainer(new MainGame());
     app.setAlwaysRender(true);
     app.setDisplayMode( 1260 , 720, false); //window size
     app.start();
}
}

sentences:
A* Implementation Produces zig-zag in positive directions I have an implementation of A* in Java. I followed this guide http://www.policyalmanac.org/games/aStarTutorial.htm.

But I noticed that the paths generated where the goal is in the positive X and Y direction, I get this zig-zag phenomenon.

Let me demonstrate with these two images (top left area is the origin [0,0]):

Here I generate a path where the goal is farther away from the origin than the start:

And here I generate a path where the goal is closer to the origin than the start:

I have tried to manipulate the heuristic algorithm I use, to no avail.

Here's the code:

public List<Vector3f> find(Vector3f startLocation, Vector3f goalLocation, NodeValidator validator) {
    start = nodes.get(grid.getNode(startLocation).index);
    goal = nodes.get(grid.getNode(goalLocation).index);

    if ( ! validator.validate(goal.node)) return null;

    open.clear();
    closed.clear();

    open.add(start);

    start.movementCost = 0;
    start.heuristic = 0;

    while(open.isEmpty() == false) {
        NodeProxy q = null;

        for(NodeProxy node : open) {
            if (q == null || node.getCost() < q.getCost()) {
                q = node;
            }
        }

        //did we get the goal?
        if (q == goal) {
            List<Vector3f> path = new ArrayList<Vector3f>();

            //get goal node
            NodeProxy nodeProxy = goal;
            while(nodeProxy != start && nodeProxy != null) {
                if (nodeProxy != null) {
                    path.add(nodeProxy.node.center);
                }

                if (nodeProxy.parent == null) {
                    break;
                }
                nodeProxy = nodeProxy.parent;
            }

            Collections.reverse(path);
            return path;
        }

        open.remove(q);
        closed.add(q);

        float g;
        for(Compass direction : Compass.values()) {
            Node n = q.node.neighbours.get(direction);
            if (n == null) continue;

            NodeProxy successor = nodes.get(n.index);

            g = direction.cost;

            if (validator.validate(successor.node) && closed.contains(successor) == false) {
                if ( ! open.contains(successor)) {
                    open.add(successor);
                    successor.movementCost = q.movementCost + g;
                    successor.heuristic = getHeuristic(successor.node, goal.node);
                    successor.parent = q;
                }else if (q.movementCost < successor.movementCost + g) {
                    successor.movementCost = q.movementCost + g;
                    successor.heuristic = getHeuristic(successor.node, goal.node);
                    successor.parent = q;
                }
            }

            closed.add(q);
        }
    }

    return null;
}

Some notes regarding the code: The validator object is simply an object tasked with checking if a node is "walkable".

sentences:
Problem With Enemy Bullets Attacking The Player Pygame I am trying to make my enemy bullets attack the player but it only attack its x and y how could I make it curve instead of zigzagging VIDEO the bullets only attack the y axis and it wont curve or go to the player only attacks 2 positions

this goes on my main loop and appends projectiles

         for shootss in shootsright:

                if shootss.x < 500 and shootss.x > 0:

                    if enemyshoots1.x < playerman.x:

                        shootss.x +=  5
                    else:
                        shootss.x -= 5
                else:
                    shootsright.pop(shootsright.index(shootss))
                if shootss.y < 500 and shootss.y >0:
                    if enemyshoots1.y < playerman.y:
                        shootss.y += 5
                    else:
                        shootss.y -= 5
                else:
                    shootsright.pop(shootsright.index(shootss))

            if len(shootsright) < 2:
                    shootsright.append(Bools(round(enemyshoots1.x+enemyshoots1.width-107),round(enemyshoots1.y + enemyshoots1.height-50),(0,0,0)))
                # projectile class for each of the bullets

my enemy bullets class

    # enemys bullets
    ksud = pygame.image.load("heart.png")
    class Bools(object):
       def __init__(self, x, y,color):
           self.x = x
           self.y = y
           self.ksud = pygame.image.load("heart.png")
           self.hitbox  = self.ksud.get_rect()
           self.rect  = self.ksud.get_rect()
           self.rect.topleft = (self.x,self.y)
           self.speed = 10
           self.color = color
           self.hitbox = (self.x + 57, self.y + 33, 29, 52) # NEW
       def draw(self, window):
            self.rect.topleft = (self.x,self.y)
            player_rect = self.ksud.get_rect(center = self.rect.center)
            player_rect.centerx += 0 # 10 is just an example
            player_rect.centery += 0 # 15 is just an example
            window.blit(self.ksud, player_rect)
            self.hitbox = (self.x + 97, self.y + 33, 10, 10) # NEW
            window.blit(self.ksud,self.rect)

I have something similar for the player where ever I click it appends bullets  how could I change it to append bullets at the player without the click?

                # this is for the bullets
                    if len(bullets) < 2:
                        shootsound.play()

                        start_x, start_y = playerman.x+playerman.width//2, playerman.y + playerman.height-54
                        mouse_x, mouse_y = event.pos

                        dir_x, dir_y = mouse_x - start_x, mouse_y - start_y
                        distance = math.sqrt(dir_x**2 + dir_y**2)
                        if distance > 0:
                            new_bullet = projectile(start_x, start_y, dir_x/distance, dir_y/distance, (0,0,0))
                            bullets.append(new_bullet)
        # this is displaying the bullets for the player
            for bullet in bullets[:]:
                bullet.move()
                if bullet.x < 0 or bullet.x > 900 or bullet.y < 0 or bullet.y > 900:
                    bullets.pop(bullets.index(bullet))

sentences:
When should I mark GameObjects as Static? Here is the corresponding Unity documentation.

According to explanations of Unity documantation pages about Static GameObjects, sometimes marking GameObjects as static may effect performance in a bad way (for example Static Batching causes more memory usage).

So when should i exactly want to use these functionalities?

Thanks in advance.

Footnotes:
I'm currently developing a 2D top-down game which has lots of Sprites and LineRenderers, but no 3D objects (not even a quad). All GameObjects are being instantiated procedurally from premade prefabs. LineRenderers get updated from scripts each frame. And nearly all Sprites are moving constantly. Majority of Sprites share same material. All LineRenderers also share same material of their own.

sentences: How to achieve graphics like those in Spy Mouse I'm really interested in making a new application for iPhone, and I have some experience in objective-c. My main problem is the visual part. I want to have graphics like in Spy Mouse. Could this be achieved using simple 2D graphics? Or would I need to use 3D, and just show it from this perspective?

sentences:
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:
How can I accurately lerp Colors over seconds? I have some code to lerp between two colors over a set number of seconds, and the lerp works fine:

private Color lerpingColor;

private IEnumerator LerpColorsOverTime(Color startingColor, Color endingColor, float time)
{
    float step = 0.0f;
    while (step < 1.0f)
    {
        step += Time.deltaTime / time;
        yield return new WaitForSecondsRealtime(Time.deltaTime);
        lerpingColor = Color.Lerp(startingColor, endingColor, step);
    }
}

The problem is, the lerp time takes longer than the time I provide in my parameter.  For example, LerpColorsOverTime(Color.white, Color.black, 5.0f); takes over 8 seconds to lerp.

My best guess is that I am being very inefficient in the way I am lerping.  I tried accounting for the calculation time, but it does not seem to work.  In the particular case shown, it is because calculationTime is always 0, since the code to update the time is never run between my Time.time checks.  I tried various approaches, with this being my best:

private Color lerpingColor;

private IEnumerator LerpColorsOverTime(Color startingColor, Color endingColor, float time)
{
    float calculationTime = Time.time;
    float step = 0.0f;
    while (step < 1.0f)
    {
        step += Time.deltaTime / time;
        calculationTime = Time.time - calculationTime;
        yield return new WaitForSecondsRealtime(Time.deltaTime - calculationTime);
        calculationTime = Time.time;
        lerpingColor = Color.Lerp(startingColor, endingColor, step);
    }
}

I also tried other variations of Time.time, such as DateTime.Now.Miliseconds / 1000.0f and Time.realtimeSinceStartup, but they failed as well.

How can I make this code efficient enough to run in the expected time, or make some sort of change with the seemingly same effect?

sentences:
How can I render from a buffer that exists and was created on on the GPU? I'm looking for a unity API or function call to allow me to do the following ...

I wrote some really complex functions that are compute shaders. These compute shaders  manage a huge compute buffer containing voxel information. I then take portions of (or the entire) voxel buffer in another compute shader and produce a vertex buffer. All of this is done on the GPU with only compute shader calls from the CPU.

Now I want to render that vertex buffer but I must be looking in the wrong place because I can't find any information on how this is done within unity despite there being other examples on how to do this using raw DX or openGL approaches.

Can anyone point me in the right direction to determine how I can render using a specified shader a buffer already in graphics RAM (and ideally give it some textures too)?

sentences:
Creating new static sprites for Warhammer 40K Armageddon Pc Game I want to create new unit sprites for the Warhammer 40K Armageddon pc game.

Game uses simple 3D static PNG sprites facing 6 different direction for all units. They don't animate in game, just pictures (as shown in link).

If I simply copy already-made sprites and just rename them with my own liking, I can integrate to game easily (with adding strings, sound and animation files etc.). But I want to create my own unique sprites. I know this can be done because other people already did this (I of course tried to contact them through game forums and steam at first but couldn't succeeded, so I wanted to ask here).

How can I make these sprites?

P.S. I don't have any kind of modelling experience, but I'm a coder.

Some of already-made sprites: http://imgur.com/a/b3M0q

sentences:
What are spline input keys? There isn't a really adequate explanation of these anywhere on the internet, so I thought I'd ask this question here.

What are spline input keys in Unreal?
How are they represented in Unreal?

Also:

FindInputKeyClosestToWorldLocation returns a float.

What is this return value?
Why is it a float?

sentences:
creating a trigger to play multiple animations at once I need a "button" like trigger. The player would walk within the invisible cube that is the trigger, once the player is in the trigger (and only in the trigger) they would be able to press 'e' on their keyboard which will cause the animations to play at once. After the animation plays, the screen fades to black and loads the next scene.

I'm still incredibly new to Unity so a brief summary of the code you provide would be much appreciated! (but not at all demanded!)

Personally I'm a lot more comfortable with C# so if the code can be in that, it would really help. Thank you!

sentences:
HLSL texture sampler always returns white I'm facing in problem in HLSL with Monogame that I can't figure out. The gist is that sampling from a texture seems to always return white rather than the texture's actual color. My pixel shader code is below, and then I'll say more.

texture2D fillTexture;

sampler fillSampler = sampler_state
{
    Texture = <fillTexture>;
};

sampler s0;

struct VertexShaderOutput
{
    float4 Color : COLOR0;
    float4 Position : SV_POSITION0;
    float2 TexCoords : TEXCOORD0;
};

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return tex2D(fillSampler, input.TexCoords);
}

technique Technique0
{
    pass Pass0
    {
        PixelShader = compile ps_4_0 PixelShaderFunction();
    }
}

First, in my C# code, I'm using the SpriteBatch to draw a large rectangle. That part works fine. Second, I have a smaller texture that I'm passing as a parameter into my pixel shader (fillTexture). No matter what I try, the resulting large rectangle is pure white.

I've already verified that my shader is being applied, as the following code results in a red block.

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return float4(1, 0, 0, 1);
}

I've also verified that my texture coordinates within the pixel shader function are correct. The following code produces the image below.

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float2 texCoords = input.TexCoords;

    return float4(texCoords.x, texCoords.y, 0, 1);
}

I've also verified that the fill texture itself has valid colors (i.e. it isn't pure white itself).

Apart from that, I've tried every combination I've seen. I've tried using sampler2D rather than sampler, fillTexture.Sample rather than tex2D, even compiling with ps_4_0_level_9_1 and level_9_3. I've tried using SamplerState rather than sampler_state, binding registers, everything I can think of.

Any help would be greatly appreciated. Thank you :)

sentences:
Finding the closest point on a concave mesh (Unity C#) One of my game systems requires that I find the closest point on a generalized mesh, which more often than not will be concave. This prevents me from just using Unity's built in ClosestPoint function, and all other alternatives have some other caveat which prevents me from using them so far.

The meshes are dynamically generated, pretty complex, and altered often, so it would be computationally unreasonable to split it into multiple convex meshes, unless there's some way I don't know about which allows fast splitting/reattachment of said meshes.

I considered checking a sphere around the point, and increasing the size of that sphere until I get a collision, but OverlapSphere and CheckSphere don't give any means to check the point of collision, only to check whether there was a collision at all.

Continuing with that train of thought, I tried a Spherecast with the same method and the maximum distance set to zero, but that didn't work either. Spherecasts don't detect any objects which are inside of the starting sphere location, so setting the distance to zero will result in no collision every time.

As a workaround to that, I tried setting the distance to a small positive number, equal to the step size which the Spherecast increases by each pass (in my case, 0.2). This almost works, but causes the cast to only detect collision points if I have a general direction to give it. There are two ways I tried to resolve this:

The first is by just passing in the direction from the point towards the center of the mesh I am trying to find collisions with, and although this works for a sphere, it breaks down for most of my other test cases, and just in a lot of different scenarios (Very concave polyhedra and shapes such as torii being two examples of situations where this method does not work.)

The second method I tried was to just take the direction to the closest point on the last frame, and pass that into the Spherecast. Again, works in some situations, but breaks down on large dihedral angles. Neither of these are really sufficient for what I need them for.

In terms of the constraints which I have to work under, the point should always be on the outside of the mesh, and the point should never be too far away from the mesh, but other than that there isn't really much else I can guarantee. Both the shape and the topology of the mesh are subject to change over time.

Any help would be greatly appreciated, thanks in advance!

sentences:
Visual Programming tool for creating game quests I've found a question for visual script editing software tool for creating game behavior logic, but I am looking for something more flexible. I would like to configure the tool to make it produce code that I need. I use Lua for creating quests in my mmorpg game, but every time there is need of creating a new quest I feel like writing the same code all the time. I'd like to allow my co-workers to do this job in some easy way. The easiest way I can think of would be some sort of making graphs that would represent the quest, and fill all the nodes with different if statements and game texts or procedures like spawning mobs.

Is there any tool that I could use for this purpose?

sentences:
Directional lights (not) rotating with camera (opposite problem) I am trying to implement a shader for directional lights correctly, but I am bit confused as to why it works when it shouldn't and vice versa.

People usually encounter problem with lights changing direction with camera. This is corrected by multiplying normals with model(view) matrix.

But my problem is opposite.

When I don't multiply normals with model(view) matrix then it works and when I try to use (supposedly) correct version it is having that "lights rotating with camera" problem.

Any ideas?

Working vertex shader:

#version 330
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 texCoord;
layout (location = 2) in vec3 normal;

out vec2 texCoord0;
out vec3 normal0;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

void main()
{
    normal0 = normal;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

Fragment shader:

#version 330
in vec2 texCoord0;
in vec3 normal0;
out vec4 outColor;

struct BaseLight
{
    vec3 color;
    float intensity;
};

struct DirectionalLight
{
    BaseLight base;
    vec3 direction;
};

uniform vec3 baseColor;
uniform vec3 ambientLight;
uniform sampler2D sampler;
uniform DirectionalLight directionalLight;

vec4 calcLight(BaseLight base, vec3 direction, vec3 normal)
{
    float diffuseFactor = dot(normal, -direction);

    vec4 diffuseColor = vec4(0,0,0,0);

    if(diffuseFactor > 0)
    {
        diffuseColor = vec4(base.color, 1.0) * base.intensity * diffuseFactor;
    }

    return diffuseColor;
}

vec4 calcDirectionalLight(DirectionalLight directionalLight, vec3 normal)
{
    return calcLight(directionalLight.base, -directionalLight.direction, normal);
}

void main()
{
    vec4 totalLight = vec4(ambientLight,1);
    vec3 normal = normalize(normal0);
    totalLight += calcDirectionalLight(directionalLight, normal);
    outColor = texture(sampler, texCoord0.xy) * vec4(baseColor, 1) * totalLight;
}

Draw method:

glBindBuffer(GL_ARRAY_BUFFER, vbo);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);

glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex::SIZE* 4, 0);
glVertexAttribPointer(1, 2, GL_FLOAT, false, Vertex::SIZE * 4, (const GLvoid*)12);
glVertexAttribPointer(2, 3, GL_FLOAT, false, Vertex::SIZE * 4, (const GLvoid*)20);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
glDrawElements(GL_TRIANGLES, size, GL_UNSIGNED_INT, 0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);

Matices:

ViewTranslate = glm::mat4(1.0f);
 cam->control(windowHandle, 0.01, 0.3, true, &ViewTranslate);
 cam->updateCamera(&ViewTranslate);

glm::mat4 Projection =
    glm::perspective(70.0f, 800.0f / 600.0f, 0.1f, 10000.0f);
glm::mat4 view = glm::lookAt(
    glm::vec3(0, 0, 1),
    glm::vec3(0.0f, 0.0f, 0.0f),
    glm::vec3(0.0f, 1.0f, 0.0f)
    );

shader->bind();
shader->setUniform("model", glm::value_ptr(ViewTranslate));
shader->setUniform("view", glm::value_ptr(view));
shader->setUniform("proj", glm::value_ptr(Projection));
shader->setUniform("ambientLight", ambientLight);

Not working shader code:

void main()
{
    normal0 = (model * vec4(normal, 0.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (model * view * vec4(normal, 0.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (model * view * vec4(normal, 1.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (transpose(inverse(model * view)) * vec4(normal, 1.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

...

Any ideas how I should do this correctly?

sentences:
LibGDX: Best Texture Sizes to use for highest resolution? I have two texture atlases: 1 is 1024x1024 (mostly used for GUI elements), the other is 2048x2048 (for game objects like characters).

I used Texture filter mip map linear on them. But when the textures (GUI textures) show up on my phone, they are blurry and vaseline-ish. The bigger textures (found on the 2048x2048) show up much more pristine and sharp.

How do I get the GUI ones to show up sharp? Do I simply have to make the textures large? If I do, wouldn't having two different 2048x2048 textures cause performance issues on an average phone?

sentences:
Physics2D.Raycast not hitting any colliders I am making a topdown 2d game and want to get the x,y of mouse clicks so I can move the character to that location.

I am writing a CharacterController script which performs the mouse-click check and raycast in the Update function:

void Update () {
    if (Input.GetMouseButtonDown (0)) {
        RaycastHit2D hit = Physics2D.Raycast(Input.mousePosition, -Vector2.up);
        if (hit.collider != null) {
            Debug.Log (hit.point);
        }
    }

This runs whenever I click the mouse, but the if(hit.collider != null) condition is never met.

I've looked around for other solutions, such as Unity - Raycast not hitting to BoxCollider2D objects, but when I change my code to the one used in that answer:

RaycastHit2D hit = Physics2D.Raycast(
  Camera.main.ScreenToWorldPoint(Input.mousePosition),
  Vector3.back
);

then the if(hit.collider != null) block is always true, even if I click on empty space, and it always returns the same coordinate. To illustrate this, here is a video of me clicking the game view. The green area has a 2d box collider that is very closely mapped to its boundaries. You can see that the logged hit.point is always the same.

video is here - https://i.imgur.com/uhNp8wC.gifv

screenshot -

sentences:
How to create a two-way teleport system? I'm trying to create a two-way teleport system in which players can move into a teleport gameobject, and is then teleported to another linked teleport gameobject.

How I was planning to have it work was very simple. On the teleport gameobject's script, it would have a public property to the other teleport's transform in which to teleport the player to. In OnTriggerEnter, I simply set the entering's collider position to that of the linked teleport.

void OnTriggerEnter(Collider other) {
    other.transform.position = DestinationPoint.position;
}

However, when the player's position is changed, it triggers the OnTriggerEnter of the destination teleport, and thus the player gets stuck bouncing back and forth between the two points.

What's a good way to prevent this? Some less than ideal solutions I came up with is to offset the position that player teleports too slightly so that he doesn't cause OnTriggerEnter to be called at the destination portal, but I'd like to avoid that.

sentences:
Tilemap collision in component based entity system I am trying to set up a collision system for a tilemap in my component based entity system, but having trouble with figuring out how to do so.

Currently I have the following approach:
My tilemap consists of a Tilemap_Component, which just holds the array, a Tilemap_Render_Component, which holds the Tileset image, and a Tilemap_Collision_Component, which holds the information which tile value is handled as a wall.

To make an entity collideable with the tilemap it needs currently the following components:
Movement_Component, which holds the X/Y Velocity, Position_Component, which holds X/Y Position and Tilemap_Collider_Component, which holds the information if the object only collides with walls or as well with some other objects in the tilemap.

Now my problem is the following:
It is very hard to determine what to do with an object which collides with the tilemap. If I set velocity to zero, it is possible to glitch through walls because Movement and Input are handled in other systems than the collisions.
If I just change the Position of the object, there occur two problems: One is, that the object starts to flicker because it has moved a bit. The other is, that I would have to know how big the object is which is colliding with the wall.
Now I could just say that a Render_Component is required for objects which can collide with the tilemap and then use the image information in the Render_Component of the object and the Tilemap_Render_Component of the tilemap to calculate collision, but I think this is a bit against the intention of component based system.

What would be your suggestions? How could I handle this problem?
Or, as well: Was anyone of you faced to such a problem? How did you solve it?

sentences:
Logic for enemy chasing main player I'm making AI to tell a minion to chase and attack the player.

I played Magicka, and the minion follows the player in a nice curved manner (left image), rather than what I currently have (right image), where the minion just keeps reacting the the player's changes in X,Y.

The code I have makes the chasing minion appear to move in a blocky way as it keeps trying to have its coordinates == the player's coordinates:

    if (enemy.pos.x <= game.data.playerX) {
        enemy.body.vel.x += enemy.body.accel.x * me.timer.tick;
    }
    else {
        enemy.body.vel.x += -enemy.body.accel.x * me.timer.tick;
    }
    if (enemy.pos.y <= game.data.playerY) {
        enemy.body.vel.y += enemy.body.accel.y * me.timer.tick;
    }
    else {
        enemy.body.vel.y += -enemy.body.accel.y * me.timer.tick;
    }

How can I achieve a more smooth transition effect?

sentences:
Projection Matrix Breaks My Rectangle This is my vertex shader, shown below.

#version 330 core

in vec3 a_position;
in vec4 a_colour;

// FOV = 70, near plane = 0.1, far plane = 1000
const mat4 u_projection = mat4(
    1.428148, 0.0, 0.0, 0.0,
    0.0, 1.428148, 0.0, 0.0,
    0.0, 0.0, -1.0001999, -0.20002,
    0.0, 0.0, -1.0, 0.0
);

//uniform mat4 u_projection;
//uniform mat4 u_view;
uniform mat4 u_transformation;

out vec4 v_colour;

void main() {

   gl_Position = u_projection * u_transformation * vec4(a_position, 1);
   v_colour = a_colour;
}

Whenever I take out u_projection, my square appears. When I add it back, the square is malformed.

The vertices of my square are as follows, aka the contents of a_position.

float[] vertices = {
    0, 0, 0.5f,
    0.5f, 0.5f, 0.5f,
    0, 0.5f, 0.5f,
    0, 0, 0.5f,
    0f, 0.5f, 0.5f,
    0, 0.5f, 0.5f
};

The position of the square is (0, 0, 0), the rotation is (0, 0, 0) and the scale is 1. These are computed into u_transformation and uploaded. This works perfectly.

If I change the -1.0001999 and the last 0 to 1 part to 1 then the square is not hidden.

void bindAttribute(int index, String name) {
    GL20.glBindAttribLocation(program, index, name);
}
bindAttribute(0, "a_position");
bindAttribute(1, "a_colour");

sentences:
How to achieve variable jump height in an elegant and natural way I am making a platformer, with a methodical approach to player physics. This is how I do variable jump height:
if not btn() then
   g_fall *= 1.5
end

if (not is_grounded) then
   // fall gravity
   p.ay = g_fall
end

p is the player, p.ay is the acceleration.
g_fall is the constant falling gravity, which I apply to the player's acceleration if it's not on the ground. If the player isn't pressing the jump button I increase g_fall so player falls down quicker thus achieving variable jump height.
This is somewhat ok, but I have a spring where player can jump and it bounces player to the air.
hit.y = ispring.y - 2
hit.dx *= 0.2
hit.dy=-v0_jump * 1.5

hit is the player, v0_jump is the constant initial velocity I give to the player to jump.
When the player presses jump while on the spring, it jumps higher because the fall gravity is lower. But I want spring to give you the same jump height whether you press jump or not.
Now I could put a flag for spring jump and an if condition to test for spring jumps and adjust the fall gravity, but I am looking for a more elegant solution.
So what are some professional techniques for variable jump height that can solve my problem out of the box.

sentences:
How to calculate continuous motion with angular velocity in 2d I'm really new with physics. Maybe someone would be able to help me to solve the next problem:
I need to calculate position of an agent on the plane(2D) in next time step where time step is large(20+ seconds)
What I know about agent's motion:

Initial Position
Direction(normalised vector)
Velocity(linear function from time ) - object always moves along it's direction
Angular Velocity(linear function from time)

Optional:

External force direction
External force (linear function from time)

Running discreet simulation with t->0 is not an option.

sentences:
How to check/read multiple elements of the same arrayList at the same time in Java? Im making an rpg game and right now I'm working on crafting. I've made a crafting slot class, and an arrayList of that class. I've got 10 of those slots in total, 9 placed in a 3x3 'order' and 1 below (like the minecraft inventory). I want to check if the 9 slots contain some items in a particular way, and if they do to put a item in the 10th slot. I can figure out how to craft stuff, but I don't know how to read all those 9 slots at the same time (btw Im using an enhanced for loop to update and render all of 'em). I figured I would check if the slots contain items in this order

4 4 4
0 3 0
0 3 0

(4 being stone and 3 being the stick item)
Each slot has its own item variable. So how can I access all of them at the same time? Or even if there is a simpler way to do this.
Thank you

sentences:
How do 3D games create the illusion of depth? How do libraries like OpenGL convert three dimensional coordinates into the two dimensional pixels we see on our screens? I'm not talking about the 3DS or games that require 3D glasses, but rather the illusion of three dimensions.

I don't need any code to create this effect - I'm just curious about the concept.

sentences: How to draw 2D pixel data with OpenGL I am fairly new to OpenGL. I have a 2D game in SDL2 that uses currently works by creating a SDL_Surface from the pixel data, copying it into a SDL_Texture, and rendering it to the screen with SDL_Renderer. But rather than using SDL to render the pixels, I'd like to switch to OpenGL. The reason I'd like to switch is because I need to render some lines on top of the pixel data and SDL_RenderDrawLine() just doesn't have all the features I need (like line thickness or glScissor). At first, I attempted to switch to OpenGL by using glDrawPixels() and I was happy with the results. However, I found out that glDrawPixels() does not seem to be available in OpenGL-ES (mobile devices). I have looked through some tutorials, but they all use shaders and other fancy stuff that I don't think I really need. Is there a simple way (like glDrawPixels()) to just draw pixel data to the screen for a 2D game? The pixel data is in the format GL_UNSIGNED_BYTE and it contains everything that I want to draw on the screen (except for several 2D line segments that I plan on using GL to render on top).

sentences:
Desktop launcher Error in Java & LibGDX What's my problem:

It says there is a null pointer exception in my desktop launcher class even though I haven't really touched it other than add a title and change the width & height. The weird thing is I haven't touched it and I've called my program before.

Desktop Launcher Code:

    package com.kymedgames.poopman.desktop;

    import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
    import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
    import com.kymedgames.poopman.Game;

    public class DesktopLauncher {
public static void main (String[] arg) {
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
        config.title = "Poopman Adventures";
        config.width = 800;
        config.height = 600;
    new LwjglApplication(new Game(), config);
}
}

My Application Listener class in my core package is named Game.

What I'm trying to accomplish:

Run my application on desktop. (Which I have done before.)

How I'm trying to accomplish it:

By pressing the run button on Eclipse and not touching my desktop launcher other than add a title, width & height.

What I need help with:

Fix this randomly occurring error.

Am I a noob?

Kind of.

sentences:
RenderTexture is not cleared after it was released I want to create some image effect. I've written a script that draws a cube mesh at the render target and then copies the render texture at the screen. I don't want to render anything except Mesh(M) in my RenderTexture(rt):

    void OnRenderImage(RenderTexture src, RenderTexture dest)
    {
        RenderTexture rt = RenderTexture.GetTemporary(Screen.width / 1, Screen.height / 1 );

        Graphics.SetRenderTarget(rt);
        Graphics.DrawMeshNow(M, new Vector3(0.0f, 0.0f, -8.0f), Quaternion.identity);
        Graphics.Blit(rt, dest);

        Graphics.SetRenderTarget(null);
        RenderTexture.ReleaseTemporary(rt);
    }

Where M is GameObject.CreatePrimitive(PrimitiveType.Cube).GetComponent<MeshFilter>().sharedMesh;

When I moved my camera, I see this:

It seems like the RenderTexture didn't cleared itself when released. Or maybe I did something wrong? Please explain why this happened and how can I fix this.

sentences:
How do I create the terrain mentioned in GPU Gems 3 So, i want to create this style of terrain:
Nvidia GPU Gems 3 - Chapter 1

However, as much as I scour the web trying to find ways to implement this inside Unity, I can't find it.

My current understanding of 3d noise is that it is just an array of 2d noise that uses a range of -1 to 1 to determine density values (if there should be ground or air at a point in space (x,y,z), and 2d noise is just a heightmap of where you want the terrain to go.

I currently have generated simplex noise in unity that I think works (it seems to go through -1 to 1 when i call the coherentNoise() function): I would love some review on it however: pastebin.com/SiX2C31t (currently, I haven't implemented the marching squares algorithm either, would love some tips on that as well).

I've been looking at several forum questions and Unity answers, but never found anything.

All I want to do is create fascinating ridges and overhangs for an underwater terrain, and I also preferably would like to know how to do it with a lower LOD, (I want it to be low poly).

Thanks.

sentences: random spike in delta time The title pretty much sums it up. I'm using delta time to move my objects and every few seconds the delta time will spike and all the objects will jump forward. Should I just Interpolate the delta time to eliminate spikes, I don't want to do this because it could cause other problems but it could be a solution

sentences:
Change the sprite of a Object in Unity Inside the script code of the the hero(object) I want add the possibility to change its sprite.

So the player hits the space button and the sprite changes into the other sprite already added to the project.

Can you provide me a sample code to do this?

sentences:
Help needed, following Unity multiplayer Health-Bar tutorial. Only working on Server Host instance of the game was really hoping someone can be good enough to look over my code, I've been trying to fix it for several days. I followed the Unity tutorial which is fairly basic but the bit that confuses me (and potentially where the problem lies) is the:

 if (!server){return;}

part at the top of my TakeDamage() function.

The problem im seeing is that once I get to that part of the tutorial, the bullet fired by the Host is registered against the other player and I can see his health has gone down (great so far!) , but when I load the instance in the editor (i did running another standalone on my laptop and connect to internet matchmaking but the same thing occurs) his bullets are not registered (even though my debug log tells me the Ray did hit the player.

The tutorial tells me to make it return if not server, it then uses [SyncVar] and a hook that is supposed to call the method "OnChangeHealth" whenever currentHealth is changed.
This DOES NOT appear to be happening, and the TakeDamage code is only happening on the Server-Client-Host instance.

I was trying to adapt the tutorial to my own game, so there are some slight differences in the function and class names, but to me it looks to be exactly the same functionality-wise. I will have to just post my full code here as I don't know which part is causing the issue:

(MANY THANKS FOR READING  AND/OR HELPING):

the Player class:

public class Player : NetworkBehaviour {
private GameObject startScreen;
public const int maxHealth = 100;

[SyncVar(hook = "OnChangeHealth")]
public int currentHealth = maxHealth;

private float playerHeight;
private AudioSource audioSource;
public AudioClip painBodySound;
public AudioClip painHeadSound;
public AudioClip painHeadSound2;
public RectTransform healthBar;

void Start () {
    startScreen = GameObject.FindGameObjectWithTag("StartScreen");
    if (startScreen != null)
    {
        startScreen.SetActive(false);
    }
    playerHeight = GetComponent<Collider>().bounds.size.y;
    currentHealth = maxHealth;
    audioSource = GetComponent<AudioSource>();
}

void Update () {

    if (!isLocalPlayer)
    {
        return;
    }
    if (Input.GetKey(KeyCode.LeftControl))
    {
        transform.localScale = new Vector3(1, 0.5f, 1);
    }
    else
    {
        transform.localScale = new Vector3(1, 1f, 1);
    }
}

public void TakeDamage(Vector3 hitPoint, int bulletDamage)
{
    // check that its Server so that damage only gets applied on the server
    if (!isServer)
    {
        return;
    }
    currentHealth -= bulletDamage;
    audioSource.PlayOneShot(painBodySound);
    if (currentHealth <= 0)
    {
        currentHealth = 0;
        Debug.Log("Dead!");
    }
}
private void OnChangeHealth(int health)
{
    healthBar.sizeDelta = new Vector2(health, healthBar.sizeDelta.y);
}

}

Inside the bullet class is this function:

private void CastBulletRay()
{
    ray = new Ray(bulletSpawnPos, bulletSpawnDirection);
    if (Physics.Raycast(ray, out hit, bulletRayDistance))
    {
        if (hit.collider.tag == "Baddie")
        {
            Debug.Log("ray has hit a baddie");
            Destroy(gameObject);
        }
        if (hit.collider.tag == "Player")
        {
            Debug.Log("ray has hit a player");
            hit.collider.gameObject.GetComponent<Player>().TakeDamage(hit.point, bulletDamage);
            Destroy(gameObject);
        }

    }
}

and inside The Unity RigidBodyController class I'm using, I added:

    [Command]
    void CmdFireBullets()
    {
        muzzleFlashObject.SetActive(true);
        audioSource.PlayOneShot(gunFireSound, 0.2f);
        //Create a new bullet
        GameObject newBullet = Instantiate(bulletPrefab, bulletSpawnPoint.transform.position, bulletSpawnPoint.transform.rotation) as GameObject;

        //Spawn the bullet on the clients:
        NetworkServer.Spawn(newBullet);
    }
}

sentences:
Calculating the poly vertices based on the result of Connected Component Labeling I am making a tile based game.

And now I can find all the connected area using the Connected Component Labeling algorithm.

But now the problem I am having is how to calculate the poly vertices of each connected area.

For example:

As you can see all the YELLOW tiles are of the same AREA and with the help of Connected Component Labeling algorithm I know all the (x, y) info of each tile.

And now I want is the generate a poly vertices array for the YELLOW AREA POLY (clockwise).

Is there any good algorithm for this ?

Any suggestion will be appreciated, thanks :)

sentences:
Do UDP game clients/servers block for receive calls? One way to implement a client/server relationship is to have the server simulate the whole game based on the clients input and send updates back to each client, while the client is is simulating the game for the player and sending back input and game state messages that the server can use to process the whole state of the game.

My question is, since a ReceiveFrom() call blocks till it receives data and a Select() call blocks for a set period of time, does that mean all clients and servers block for a certain amount of time each frame?  I am aware that a call to Select() can be set to zero which would be an effective poll to the read write states of the current sockets, but wouldn't you miss out on new data if it comes in just microseconds later?  How is this problem solved now a days?  Pro select() method handling? Asynchronously? Separate thread completely? Other?

I may be over thinking this, but I would like to know more information so I can write an effective client/sever relationship.
-Haywire

sentences:
How to make a Realtime 3D Eulerian Fluid Simulation like "From Dust" in C#/Unity3D? So, for a game project I'm going to be working on I need to make a fully working 3D fluid simulator in Unity3D using C#, that can work in real time.

The only problem is, I've never done anything like fluid simulation. I've been doing tons of research on it, and I think a Eulerian based fluid simulator would fit my needs best (just like this).

Basically what I need is something that can react to changing terrain and move realistically.

The people that made that simulator have a research paper online, and I've read through it. I understand the basics, but I have no idea how I could get that in to C# or Unity3D. So I was wondering if any of you could help me, either by linking to other fluid-simulators where the code is open source, so I can pick it apart and change it to my needs, or by giving me tips on where to start/what I would need to do.

I've spent hours looking online for fluid simulators, but haven't found a single one programmed in C# as of yet, I have a program that can convert C++ to C#, but I don't understand C++ well enough to know where to put the scripts in Unity once they're converted.

Any help at all would be extremely appreciated, I'm really interested in teaching myself how to make this system, but I just have no clue where I should start, or what has already been done that I could build off of.

sentences: Difference between Spherical Harmonics and Spherical Harmonics Lighting What is the difference between Spherical Harmonics and Spherical Harmonics Lighting in OpenGL?

sentences:
How do I make an object face the mouse position, but only on one plane? I want a game object to turn and look towards where the mouse was clicked (in world space).  It works well when considering all 3 dimensions, but I really only care for the plane formed by the x and z axis, not the y.

I've tried to fix this by setting the y of the directionTarget to the y of the object's position, but that gives weird results.

My code looks like this:

Quaternion rotationTarget;
    float rotationLerpProgress;
    float rotationLerpDuration = 1f;

    // Use this for initialization
    void Start ()
    {

    }

    // Update is called once per frame
    void Update ()
    {
            if (Input.GetMouseButtonDown (0)) {
                    var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
                    RaycastHit rayHit;
                    if (Physics.Raycast (ray, out rayHit)) {
                            var rayHitPoint = rayHit.point;
                            var rotationDirection = transform.position - rayHitPoint;
                            rotationDirection.Normalize ();
                            //rotationDirection.y = transform.position.y;
                            rotationTarget = Quaternion.LookRotation (rotationDirection);
                            rotationLerpProgress = Time.deltaTime;
                    }
                    //targetPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            }

            if (rotationTarget != transform.rotation) {

                    transform.rotation = Quaternion.Lerp (transform.rotation, rotationTarget, rotationLerpProgress / rotationLerpDuration);
                    rotationLerpProgress += Time.deltaTime;

                    if (rotationLerpProgress >= rotationLerpDuration) {

                            transform.rotation = rotationTarget;
                    }

            }

    }

I must be missing something. How do I do this right?

sentences:
Unity Text Mesh Pro can not get referenced in VSCode I am using Text Mesh Pro in my Unity 2019.3.4f. The TMP works fine in unity, but in the code editor, Visual Studio Code, the TMP related things are marked with red wave underline, which means the VSCode could not get the reference of TMP.
In my csproj file, the TMP reference exists, here are some related codes:
<ProjectReference Include="Unity.TextMeshPro.csproj">
  <Project>{e8ae9ed6-ed86-3de7-e777-7e6794b003b2}</Project>
<Name>Unity.TextMeshPro</Name>

ProjectReference Include="Unity.TextMeshPro.Editor.csproj">
  <Project>{af8771c0-66d3-f01a-48b5-78951bce8a23}</Project>
<Name>Unity.TextMeshPro.Editor</Name>

My TMP works fine in every aspects, but there are code warnings in the VScode, "could not fine the namespace of TMPro". Is there anyone know how to fix it?

sentences:
Implementing Geometry Instancing in DirectX I have a project that I'm doing in Managed DirectX (DX9) where I want to render lots of grass. My current method (many draw calls) is slow, but I've heard Geometry Instancing can fix that.

I know that I have to have one vertex buffer to store the vertices that will drawn multiple times. I know that I need another vertex buffer to store the transformations (from what I've seen you can only have one additional vertex buffer). So should the second vertex buffer store transformation matrices? I tried coding this, but when I want to create a new vertex buffer one of the required parameters is vertexFormat, but I can't supply a vertex format since this is a matrix.

I also wanted to try to have the second vertex buffer store the translation values as Vector3, but how do I tell DirectX that the values in the second vertex buffer are to be used as translation values? Secondly, I also need rotation values. Do I store these in a third vertex buffer?

Basically, I want to use geometry instancing to draw multiple instances of a  quad that are rotated and translated.

sentences: Is PID considered Steering Behavior? So I've recently used a PID controller to build a bot for a 2d physics based game. I also did a bit of reading on steering behavior but am still confused over one thing: Is a PID controller considered an implementation of steering behavior? Or are they two completely unrelated things?

sentences:
Units, Layers, and Isometric Ordering I'm currently using LibGDX and Tiled map editor to render isometric maps. I'm having a two related difficulties.

The first issue is, when do I render units that will end up changing position often and to which layer? At first I thought that I would render units with a wall layer so that walls behind of and in front of the unit are drawn correctly. However, the problem with this is that if a unit (i.e. a character) steps in front of say an object in some sort of top-level decoration layer, part of that object will be drawn on top of the unit.

The second issue is how to deal with layers that have static objects that units will often be stepping in front of or behind. Let's say you have a decoration layer where you will place trees. The problem with this layer is that depending on where some objects are placed in the layer, they will overlap inconsistently. For example, the following:

I know this is related to painter's algorithm, but I'm using LibGDX's tile map renderer so the extent to which I have control over drawing the map is rendering different layers at a time and switching out cells/tiles in a layer.

sentences:
Error drawing two VAO, each one using different shader programs (vertex + fragment shader) in OpenGL Core 4.3 / GLSL 430 I am trying to draw over a GL_TRIANGLE_FAN one texture to render video frames, using shaderProgram1, and render above it some points (GL_POINTS) using shaderProgram2.

By this way: (OpenGL Core 4.3)

void GLViewer::paintGL()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glUseProgram(handleShaderProg1);

    glUniform...(); //Set Uniforms for shaderProg1... <-- FIXED

    glBindTexture(GL_TEXTURE_2D, textureHandle); //Bind texture
    glBindVertexArray(vaoHandle1); //Bind VAO
    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
    glBindVertexArray(0); //Unbind VAO
    glBindTexture(GL_TEXTURE_2D, 0); //Unbind texture (used in shaderProg1)

    glUseProgram(handleShaderProg2);

    glUniform...(); //Set Uniforms for shaderProg2... <-- FIXED

    glBindVertexArray(vaoHandle2);  //Bind VAO
    glDrawArrays(GL_POINTS, 0, 25);
    glBindVertexArray(0);  //Unbind VAO
}

But only the points defined in vbo2 are rendered over the black glClearColor. Without using the shaderProgram2, all are rendered, texture and the points above it.

Is mandatory to use a FBO and two pass deferred rendering? If not, what could be the problem?

SOLVED : After an OpenGL debugging, I discovered a newbie bug...

In my case, I needed to pass the uniforms to the shader every time the current shader program will be changed to another shader program. I was thinking that the uniform variables will keep alive after another call to glUseProgram. I was wrong...

sentences:
Playing an animation all the way through with one quick keypress with Mechanim Unity I have an if statement inside of the Update function that is only called if three other conditions are met. The problem is that right now the function sets a boolean to true which causes the animation to play inside of unity Mechanim. This boolean is only true when I hold down the button, but I would like it to play the whole animation or keep this boolean true for a certain amount of time, thanks and here is my Code.

    //Running and jumping animation
    if (Input.GetKey (KeyCode.W) && (Input.GetKey (KeyCode.Space)) && otherAnimation == false) {
        anim.SetBool ("isRunningAndJumping", true);
    }
    else {
        //anim.SetBool ("isRunningAndJumping", false);
    }

sentences:
HTML5 Quintus button click doesn't work in local If you try to run this example http://html5quintus.com/docs/ui.html, you'll be able to click the buttons, but you won't if you download a local copy of the example and click the index file (without using a web server).

I know I need to run the code in a web server and not by just double clicking on the files when I have a .json file, but I can't understand the reason why also the click doesn't work (it does not require resource loading).

Maybe there's a simple modify I can apply to the example code or to the libs to make it work... Any suggestion? Thank you!

EDIT

I don't see any JS error:

sentences:
Endless runner player detect player drop Starting to learn/write my first game using Corona/Solar2d game engine.
And have a very basic question on how do people handle a such this situation which I assume should be common to any game engine.
I am trying to build an endless runner game, where I have an uneven terrain player have to jump between different height platforms while moving forward.
Here is the closest to what I have in mind.
https://youtu.be/qWz0vOywFdY
How do I find if the player has fallen between the the two platforms while jumping ?

sentences:
How do I create a HeightField in pybullet? I've been looking for documentation on PyBullet, the python implementation of Bullet, but I haven't yet found a way to implement the btHeightfieldTerrainShape collision object, which I need to make, well, terrain.

If this isn't possible, is there another way within PyBullet to turn a set of points into a collide-able object?

sentences:
Make enemy follow player intelligently I was trying to make a script to make my enemy follow my player intelligently (but not too much) and I want to know if there was a better way to do it (of course there is but I wanted to find a way myself)
Here is what I did:
I wanted my enemy to detect the player when he approach a certain distance from him. I have a varibale to determine what distance the nemy have to back up (when player is too close) and when it has to follow the player (player too far). Now, I didn't wanted the enemy to just forgot there is an intruder when the player goes around a corner and they can't see him. When the enemy sees the player directly (raycast), they rotate toward him and start following him directly by normalizing the difference of their 2 position. Now is the tricky part i'm not sure about. My player has a list that keeps the 1000 last positions of my player and that update every 0.01 second to add the lastest position and remove the oldest. If the enemy can't see the player directly (!raycast) he goes through all the positions in the list by checking for every Vector3:

1-is there something between the enemy and this position ?

2-is there something between this position and the player ?

Then it add up the distance between the enemy and the point and the distance between the point and the player and checks

3-is the lenght of the path by going at this point shorter than the last shortest path ?
if it's smaller, it's assigne to the best point.

If it detected a point that matches these conditions, it goes at it and if it doesn't see the player, it continues checking for new points.
If no point matches the condition, he just stop following the player (the enemy lost him).
All this works with raycasting to check positions, presence of objects between enemy, player and points and path to go.

sentences:
Does using a Community Script with Creative Commons - Attribution-NonComercial-ShareAlike prevent me from selling the game? So I have been building a game in one of the RPG Makers with the end goal to sell it. while I have been working hard coding up my own scripts one in particular is a complex Active Battle System like that of Zelda which gives me more options for enemy verities and attack patterns.

The script has in the comments a Creative Commons - Attribution-NonComercial-ShareAlike license. I asked about NonComercial and I get 2 kinds of answers

I can not sell the game at all if the script is in there as such I either have to replace the script or give the game away for free
I can not sell the script or remixes of the script for others to use as such in a compiled game which isn't open source (ie. you have to hack/decompile it to get it's scripts) it's fine to sell the game with the script

now I am a long ways away from completing the game and it might be possible that later on my scripting skills get to the level that I can rebuild the Battle System to be similar but of my own code (or even hire someone to do it for me)

however, in the situation that I complete the game and I can not replace the script, does it prevent me from selling it? or does NonComercial prevent me from selling the script for others to use for themselves?

sentences:
State / Screen management in Entity Component Systems My entity/component system is happily humming along and, despite some performance concerns I initially had, everything is working fine.

However, I've realized that I missed a crucial point when starting this thing: how do you handle different screens?

At the moment, I have a GameManager class which owns a component manager and entity manager. When I create an entity, the entity manager assigns it an ID and makes sure it's tracked.

When I modify the components that are assigned to an entity. an UpdateEntity method is called, which alerts each of the systems that they may need to add or remove the entity from their respective entity lists.

A problem with this is that the collection of entities operated on by each system is determined solely by the individual Systems, typically based on a "required component" filter. (An entity has to have a Renderable component to be rendered, for instance.)

In this situation, I can't just keep collections of entities per screen and only Update/Draw those collections. They'd have to either be added and removed depending on their applicability to the current screen, which would cause their associated components to be removed, or enable/disable entities in a group per screen to hide what's not supposed to be visible.

These approaches seem like really, really crappy kludges.

What's a good way to handle this? A pretty straightforward way that comes to mind is to create a separate GameManager (which in my implementation owns all of the systems, entities, etc.) per screen, which means that everything outside of the device context would be duplicated. That's bothersome because some things are always visible, or I might want to continue to display the game under a translucent menu window.

Another option would be to add a "layer" key to the GameManager class, which could be checked against a displayable layer stack held by the game manager. *System.Draw() would be called for each active layer, in the required order as determined by the stack. When the systems request an iterator for their respective entity collections, it would be pre-filtered to a (cached) set of those entities that participate in the active layer. Those collections could be updated from the same UpdateEntity event that's already used to maintain each system's entity collections.

Still, kinda feels like a hack. If I've coded myself into a corner, feel free to throw tomatoes as long as they're labeled with a helpful suggestion.

Hooray for learning curves.

sentences:
How to use uv mapping in Unity 2017 I want to create a game with a Minecraft style world. Now I need uv mapping for some cubes in my game. But I could not find any good tutorial in the internet. I want to use the following texture with an uv map:

Each side of the cube has a texture with 64x64 pixels. The dirt texture on the right side has to be the top of the cube.
Can anyone tell me how to use uv mapping in my case?

sentences:
Necessary design skills to develop games using Unity, UDK, etc With my question I want to know if DESIGN 2D/3D skills are necessary in order to create a game using some engine like UDK or Unity.

I have experience as a developer, and experience with openGL, I have also some experience with 3dMax, but Im NOT able to design something from scracth. I simply dont have the skills.

In this kind of engines, is there a way to create and customize levels or characters for example?

Thinking in something related, I will think in the character editor of games like World of Warcraft, etc. I would like to know if the creation of levels and characters would be  like that.

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:
Animations won't transfer states until entire animation is completed I am following the survival shooter tutorial and am using Unity 5.

I just completed this video (linked) and I tested played it to see my animations worked but it seems like it will only transition from idle to walking after the entirety of the idle animation completes. The idle animation is quite long so my character will move around when it looks like its idling since the movement responds right away.

Did I mess up something in my transitions? I followed the directions exactly and didn't change anything in the inspector that I wasn't told to do.

sentences:
SDL2 MOUSEBUTTONUP triggers more then once I've been trying to figure this out all day. I'm trying to make a simple check box. But my MOUSEBUTTONUP event keeps firing until I trigger another event like moving the mouse or clicking again.

//If a mouse button was released
if (Sdl_Setup->GetMainEvent()->type == SDL_MOUSEBUTTONUP)
{
    //If the left mouse button was pressed
    if (Sdl_Setup->GetMainEvent()->button.button == SDL_BUTTON_LEFT)
    {
        //Get the mouse offsets
        SDL_GetMouseState(&mouseX, &mouseY);

        //If the mouse is over the button
        if ((mouseX > Button->GetX()) && (mouseX < Button->GetX() + Button->GetWidth()) && (mouseY > Button->GetY()) && (mouseY < Button->GetY() + Button->GetHeight()))
        {
                //Set the button sprite
                state = selected;
                Button->SetCrop(GetFrameX(), GetFrameY(), state);
                clicked = true;
                std::cout << clicked << std::endl;
        }
    }
}

This will just spam 1 in the console (if you keep the mouse still) when all I want is for it to trigger once. From what I've read MOUSEBUTTONUP is only supposed to be sent to the event queue once

I've tried adding a bool to stop it after it's clicked by putting it in an if statement and that works but the thing is I want to be able to toggle the box on and off so when I add an else statement that changes the bool back to false it spams 101010 instead of just one.

   //If a mouse button was released
if (Sdl_Setup->GetMainEvent()->type == SDL_MOUSEBUTTONUP)
{
    //If the left mouse button was pressed
    if (Sdl_Setup->GetMainEvent()->button.button == SDL_BUTTON_LEFT)
    {
        //Get the mouse offsets
        SDL_GetMouseState(&mouseX, &mouseY);

        //If the mouse is over the button
        if ((mouseX > Button->GetX()) && (mouseX < Button->GetX() + Button->GetWidth()) && (mouseY > Button->GetY()) && (mouseY < Button->GetY() + Button->GetHeight()))
        {
            if (clicked == false)
            {
                //Set the button sprite
                state = selected;
                Button->SetCrop(GetFrameX(), GetFrameY(), state);
                clicked = true;
                std::cout << clicked << std::endl;
            }
            else
            {
                //Set the button sprite
                state = noInteraction;
                Button->SetCrop(GetFrameX(), GetFrameY(), state);
                clicked = false;
                std::cout << clicked << std::endl;
            }
        }
    }
}

sentences:
Efficient unwrapping on multi hard edge object I'm having trouble unwrapping this without creating hundreds of seams which massively increases the vertex count in the game engine (Unity).

I've tried the various projection methods without much success. Three planar maps (45 deg looking down, 45 up and one side) yielded the leat amount but still dozens.

I've tried all sorts of manual seam drawings but can't figure out what would be optimal so I'm looking for suggestions.

Regarding the texture having contiguous seams doesn't really matter.

Cross posted on Blender Stack Exchange

sentences:
Orbital mechanics: orbit as a function of time. Universal variable formulation? I am trying to model a two dimensional orbit for a two body Kepler problem but have gotten stuck when introducing the time variable.

For a satellite with known semi major axis (a), eccentricity (e), and true anomaly (theta), I have:

r = a*(1-e**2)/(1+e*cos(theta))

How can I calculate theta as a function of time using the Wiki suggested  Universal variable formulation method?  I have no idea how to implement (am using Python but any algorithm advice much appreciated!)

Alternatively, how do I calculate r as a function of time?

Note: All other orbital elements and masses are available. Also I am trying to come up with a general solution for elliptical, hyperbolic and parabolic orbits.

Cheers!

sentences:
Implementing GDPR compliance for multiple different ad networks I'm creating a Unity game that uses admob mediation to show rewarded ads. I'm using about 5-10 different ad networks.
How do I implement GDPR compliance for EU users?
I tried following some online tutorials, but none of them had content showing getting GDPR consent for multiple networks.
How can I modify this script to correctly get compliance where needed for all of my ad networks?
public class Mediation : MonoBehaviour
{
 string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
 private RewardedAd rewardedAd;
 public Button reviveBtn;

 void Start()
 {
    MobileAds.Initialize((initStatus) =>
    {
        Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
        foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
        {
            string className = keyValuePair.Key;
            AdapterStatus status = keyValuePair.Value;
            switch (status.InitializationState)
            {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
            }
        }
    });

    RequestRewardBasedVideo();
}

void Update()
{
    if (rewardedAd.IsLoaded())
    {
        reviveBtn.interactable = true;
    }
}

I'm not sure where to ask for consent as I'm using multiple ad networks and not just admob. In the documentation, there is this line of code:
AdRequest request = new AdRequest.Builder().AddExtra("npa", "1") .Build();

Where do I add this in the script above and how do I ask for consent for multiple networks, like Chartboost, Adcolony, ironSource etc?
EDIT
I have added the following code to the mainmenu script which loads up when the game starts.
public GameObject GDPR_Popup;
void Start()
{
    Invoke("CheckForGDPR",.25f);
}

void CheckForGDPR()
{
    if (PlayerPrefs.GetInt("npa", -1) == -1)
    {
        GDPR_Popup.SetActive(true);
    }
}

public void OnUserClickAccept()
{
    PlayerPrefs.SetInt("npa", 0); //this is for google admob
    AdColonyAppOptions.SetGDPRConsentString("1");
    AppLovin.SetHasUserConsent(true);
    GDPR_Popup.SetActive(false);
}

public void OnUserClickCancel()
{
    PlayerPrefs.SetInt("npa", 1);//this is for google admob
    AdColonyAppOptions.SetGDPRConsentString("0");
    AppLovin.SetHasUserConsent(false);
    GDPR_Popup.SetActive(false);
}

Would something like this work as I'm not sure how to test this?
Also, how to initialize the ad networks only when the user has accepted or canceled GDPR option(this I believe was mentioned in the google admob mediation documents but there was no code sample given).
Can someone please help?

sentences: How to make something happen every N seconds in game? I want to have something happen every N seconds, how would I do that? Maybe use a timer but how?

sentences:
Is it possible to correctly catch up a particle system simulation based on long delta time between many frames? I have a particle system with a physics simulation integrator based on delta time (elapsed time between frames) which is implemented on the GPU in a compute shader. I also have a frustum culling system implemented on the GPU. The frustum culling gives me the possibility to cull away draw calls and the dispatch calls for the particle simulation. The culling of draw calls works well, I also don't have a problem with culling the particle simulation when the camera is looking away.
My problem happens when I want to catch up the particle system simulation when the camera looks back at the particle system after looking away for a while. What I do is accumulate the time passed while looking away, then I resume the simulation using all that accumulated time. The problem with this approach is that if the simulation is anything but a simple constant velocity change in one direction, the simulation just doesn't look the same as if the simulation was playing one frame delta at a time.
From what I have read this is a common issue with using time elapsed between frames to simulate physics. What I wonder is if there's a different approach that can actually allow me to correctly play back many seconds of simulation (let's say 20 seconds) the same as if it was played one frame delta at a time?

sentences:
How to detect whether my Java application is active? I want to pause my game (written in Java Swing), when the player switches to another application.

But I did not find a way to detect this switch. window.isActive() only works for multiple windows within one Java application. But it does return true, when a different application has the focus.

The same is true for the KeyboardFocusManager, it returns the window of my application that had the focus before the focus was given to another application.

sentences: Find projectile initial velocity, and air time, given projectile elevation, distance, angle I have a target X position (D). I have a turret Y elevation (E). Turret is always pointed at 45 degrees (A). I need to calculate the initial projectile velocity required to hit the target, with an arbitrary gravity constant (G).

sentences:
How can I determine that a user actually followed me to give them an in-game reward? I have seen many apps where they will reward you if you follow them on social media. However, all you need to do is click on the link and then close the browser opened up and you will still be rewarded.

I would like to be able to spread my app through social media. I want people to get a reward only if they follow me so that the game can be spread through social media.

This does nothing if all they have to do is click on a link and then they can close the browser. Is there a way that I can only reward the user if they have actually followed me on social media.

Thanks

sentences:
Unity Matrix4x4 to rotate a point around a pivot / axis I need the Matrix4x4 to rotate around a given axis that does not go through (0,0,0). Is there some built in straightforward way to do this in the Unity libraries, or do I need to build and maintain my own?
Below is the formula I'd use to build my own in case somebody needs it:

We will define an arbitrary line by a point the line goes through and
a direction vector. If the axis of rotation is given by two points P1
= (a,b,c) and P2 = (d,e,f), then a direction vector can be obtained by ⟨u,v,w⟩ = ⟨d-a,e-b,f -c⟩. [...] Assuming that ⟨u,v,w⟩ is a unit vector
so that L = 1, we obtain [...]

Source

I do need the rotation Matrix, not just the rotation. If I didn't need the Matrix I could use (not tested, may contain flaws, but you get the idea):
public Vector3 RotatePointAroundAxis(Vector3 point, Ray axis, float rotation) {
    return Quaternion.AngleAxis(rotation,axis.direction) * (point - axis.origin) + axis.origin;
}

So far the best I've got is the equivalent of the above (not tested, may contain flaws, but you get the idea), but it looks quite wasteful:
public Matrix4x4 RotationMatrixAroundAxis(Ray axis, float rotation) {
    return Matrix4x4.TRS(-Axis.origin, Quaternion.AngleAxis(rotation, Axis.direction), Vector3.one)
         * Matrix4x4.TRS(Axis.origin, Quaternion.identity, Vector3.one);
}

sentences:
Unity3D - Android pause screen - double click issue I made a pause script for the game im developing for android.

I added the script to the GUITexture I created and placed on the top right side of the screen.The issue stands at the part where if the player clicks the pause button then clicks resume then he wants to pause the game again.When he clicks pause the second time the buttons dont show up unless he clicks again.

This is the script :

#pragma strict

var paused = false;
var isButtonVisible : boolean = true;

function OnMouseDown(){
    this.paused = !this.paused;
    Time.timeScale = 0;
    isButtonVisible = true;
}

function OnGUI(){
    if ( isButtonVisible ) {
        if(this.paused){
            if (GUI.Button(Rect(Screen.width/2-100,Screen.height/2+3,200,50),"Restart")){
                Application.LoadLevel(Application.loadedLevel);
                Time.timeScale = 1;
                isButtonVisible = false;
            }

            if (GUI.Button(Rect(Screen.width/2-100,Screen.height/2-50,200,50),"Resume")){
                Time.timeScale = 1;
                isButtonVisible = false;
            }

            // Insert the rest of the pause menu logic
            if (GUI.Button(Rect(Screen.width/2-100,Screen.height/2+56,200,50),"Main Menu")){
                Application.LoadLevel ("MainMenu");
                isButtonVisible = false;
                Time.timeScale = 1;
            }
        }
    }
}

Thank you.

sentences:
What do shaders encompass? I'm researching shaders as I'm thinking about doing them for my final year project at Uni. I've looked at a lot of examples online and I think I get it. It's something that you apply to an object or scene in order to create a desired effect without changing the original object/scene, I think. I know that there are different types of shaders but that's the basic goal right?

Furthermore, what do shaders encompass? Are weather systems in games shaders? Particle effects? Landslides? I don't know where the line is drawn between animations/cinematics and shaders. Also I guess shaders which effect something in the game world, for example, a tower blowing up in BF4. The explosion itself would be shaders but the way the tower effects the world around it would be physics and collisions. Am I right?

sentences:
Pong - Changing the Ball's Y location depending on where it hits the paddle I'm making my first game in, Pong, and I'm trying to make the ball's Y increase or decrease, depending on where it impacts the paddle. After implementing the code below, the ball only goes down, but not up. What could the problem be?

if(paddle.detectCollison(ball)){
    //30px on either side of the actual center of the paddle is considered the center
    if((ball.getY() > ((paddle.getH() / 2) + 30)))
        ball.setY(ball.getY() + 10);
    else if ((ball.getY() < ((paddle.getH() /2) - 30)))
        ball.setY(ball.getY() - 10);
    ball.setDX(-(ball.getDX()));
}

sentences:
Generating a grid (Array) of Tetris Pieces What I want to do is quite self explanatory. Just like the title states. I want to code something that will generate a grid which contains is filled of Tetris pieces.
However some conditions must be met :

Having no empty holes for the final grid (all sections of the grid filled)
Having no blocks sticking out (e.g. a long tetris block sticking out of the square grid)

I have tried to approach the problem using my way since the methods used online are too complicated for me.
The first idea I had was to use a 2D array which each row will be gone through to have some generation algorithm. The next row will depend on the previous row. Such as making a 2x2 block. It will check if the current row position is empty, if it is then it will check if the previous row is empty. If it is then it will make keep note that this point is being used. But if the previous block is already been used. It will check what kind of block it is and depending on what information is on that position. It will either be a connecting piece of just a blank piece.

The second idea i have in mind is similar to the first idea.
That is, it will also go through each row but this way is dependent on maths.
Lets say we have a 10x10 grid. We can say each row is made of 10 blocks. And from that we can say each tetris shape is made of miniblocks. E.g the 2x2 block is made of 2x2 small blocks.
So from this we can, go through the first row and for the first 2 blocks of the 10 keep note in the array that we want to generate the a 2x2 tetris block. And we can go to the next row and we know that the previous row there was a 2x2 tetris block that is need to be finished creating in the second row. And so we repeat this to try and get a filled grid of tetris blocks.

Sorry I am not good at explaining/implementating/reading code. Sorry for the inconvenience.
I have been suggested by some people to look at Tetris AI. And maybe use the AI to solve my problem. But I'm not good with reading other people's code. Plus it isn't in the language i understand. And i dont have anyone to go through the code with me.
 So i prefer to use my own idea since i know what is going on. But i don't know how to implement the code.

If there is anyone who could help me in any way it would be my honor.
Thank you in advance.

sentences:
Attempting to have a group of units create random values independently in python 3 for a salvage loot system I am working on creating a salvage mechanic for my game.  I want different units to calculate salvage after an encounter to randomly determine how much each one was able to scavenge from fallen allies or attackers.

As I have it setup up now its calculate as a group.
IE:  If I have group of units whom collectively can salvage value of 5 and for each point of salvage I can potentially gain 1-4 piece of salvage then I have a range of 5-20 pieces of salvage (provided there are 20 or more pieces of salvage to collect).  I am simply multiplying the total salvage value of the group by a randomly determined number in a range of 1-4.

My question is, how can I get each unit to calculate its salvage individually from its own range, rather than as a group as I'm doing now to give greater variance in the amount of salvage generated?

I am rather new and any suggestion or insight would be appreciated.

Below is the code for a demo I setup for the salvage system:

import random

parts_inventory = 0
undif_unit_count = 999
haulers = 2
foragers = 1
salvage_value = (haulers * 2) + foragers
temp_salvage = 0
salvage_random = random.randint(1, 4)

attack = random.randint(1, 6)
fatalities = attack
salvage_pool = fatalities * 4

print("There were {} units destroyed resulting in {} pieces of potential salvage".format(attack, salvage_pool))
print("Your units can haul away {} peice of salvage".format(salvage_value))

def salvage_operation(parts_inventory=parts_inventory):
    print("Encounter Haul {}".format(salvage_value))
    if salvage_value <= salvage_pool:
        print("You gained {} salvaged parts.".format(salvage_value))
        parts_inventory = parts_inventory + salvage_value
    if salvage_value > salvage_pool:
        print("You gained {} salvaged parts.".format(salvage_pool))
        parts_inventory = parts_inventory + salvage_pool
salvage_operation()

sentences: Collider for Unity Line Renderer I have several line renderers that are using as gas pipelines. A user can select one end of the pipe and attach it to one connector. Now the problem is some pipes (line renderer) are overlapping and penetrating with each other. Is there any way to avoid penetration using colliders so they look realistic?

sentences:
Dynamic libraries are not allowed on iOS but what about this? I'm currently using LuaJIT and its FFI interface to call C functions from LUA scripts. What FFI does is to look at dynamic libraries' exported symbols and let the developer use it directly form LUA. Kind of like Python ctypes.

Obviously using dynamic libraries is not permitted in iOS for security reasons. So in order to come up with a solution I found the following snippet.

/*
(c) 2012 +++ Filip Stoklas, aka FipS, http://www.4FipS.com +++
THIS CODE IS FREE - LICENSED UNDER THE MIT LICENSE
ARTICLE URL: http://forums.4fips.com/viewtopic.php?f=3&t=589
*/

extern "C" {

#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

} // extern "C"

#include <cassert>

// Please note that despite the fact that we build this code as a regular
// executable (exe), we still use __declspec(dllexport) to export
// symbols. Without doing that FFI wouldn't be able to locate them!

extern "C" __declspec(dllexport) void __cdecl hello_from_lua(const char *msg)
{
    printf("A message from LUA: %s\n", msg);
}

const char *lua_code =
"local ffi = require('ffi')                   \n"
"ffi.cdef[[                                   \n"
"const char * hello_from_lua(const char *);   \n" // matches the C prototype
"]]                                           \n"
"ffi.C.hello_from_lua('Hello from LUA!')      \n" // do actual C call
;

int main()
{
    lua_State *lua = luaL_newstate();
    assert(lua);
    luaL_openlibs(lua);

    const int status = luaL_dostring(lua, lua_code);
    if(status)
        printf("Couldn't execute LUA code: %s\n", lua_tostring(lua, -1));

    lua_close(lua);
    return 0;
}

// output:
// A message from LUA: Hello from LUA!

Basically, instead of using a dynamic library, the symbols are exported directly inside the executable file.

The question is: is this permitted by Apple?

Thanks.

sentences:
Horizontal scroll only part of the view I would like to know the best way on how to implement horizontal scrolling to only part of the view and vertical scrolling to complete view. I was able to achieve horizontal and vertical scrolling to the complete view. If I have to use layers can you explain a bit more on how to achieve layers and draw shapes on those layers separately.

I tried using two different SurfaceViews it does not work. Here is my code for scrolling horizontally.

@Override public void onDrawFrame(GL10 unused) {

GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

// Set the camera position (View matrix)
Matrix.setLookAtM(mVMatrix, 0, mXOffset, mYOffset, -3, mXOffset, mYOffset, 0f, 0.0f, 1.0f, 0.0f);

// Calculate the projection and view transformation
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0);

mGraph.draw(mMVPMatrix);

mLine.draw(mMVPMatrix);
msquare.draw(mMVPMatrix);

}

sentences:
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:
I found out how to rotate both Sphere and Cube (1) like a Turret facing a target but why is it so hard? I just added 3 objects to my scene to a new project.
To be sure where the problem is I created a new project.

Then added to the scene: 2 Cubes and 1 Sphere 1 empty GameObject.

Cube is the target.

Sphere and Cube (1) are the Turret and both are childs of the empty GameObject.
The script is attached to the empty GameObject.

The logic say if I will rotate the empty GameObject both Sphere and Cube (1) will rotate at the same time. But I found that if I'm not setting both Sphere and Cube (1) same direction before running the game they will never face to the target only the Sphere.

I had to figure out where is the Sphere facing direction before running the game and change the Cube (1) to face the same direction of the Sphere on the Z Blue axis.

I can't figure out yet and understand why is it so hard to rotate two objects at the same time to be facing the same direction (target).

Now it's working once the sphere and the cube (1) are facing same direction before running the game. It didn't work if I made them childs or parents or changed the Cube (1) position to 0,0,0 nothing.

They were both rotating but never faced the target only the Sphere faced the target.

So now each time I want to rotate two objects at the same time to face another gameobject like a turret, or cannon or anything that is built of two parts I need first to make them facing same direction ?

I guess I did something wrong but not sure what.

The script:

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

public class Rotateturret : MonoBehaviour
{
    public float speed = 3.0f;
    public GameObject m_target = null;
    Vector3 m_lastKnownPosition = Vector3.zero;
    Quaternion m_lookAtRotation;

    private void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (m_target)
        {
            if (m_lastKnownPosition != m_target.transform.position)
            {
                m_lastKnownPosition = m_target.transform.position;
                m_lookAtRotation = Quaternion.LookRotation(m_lastKnownPosition - transform.position);
            }

            if (transform.rotation != m_lookAtRotation)
            {
                transform.rotation = Quaternion.RotateTowards(transform.rotation, m_lookAtRotation, speed * Time.deltaTime);
            }
        }
    }

    bool SetTarget(GameObject target)
    {
        if (!target)
        {
            return false;
        }

        m_target = target;

        return true;
    }
}

Here is a link for a short video clip I recorded showing what I mean:

Video clip of the problem

sentences:
DirectX11 pixel shader in pipeline is missing I'm writing a program which displays a MS3D model using DirectX, and unfortunately, the result shows nothing on the screen.
When I use the Graphics Debugger from Visual Studio 13, I notice that the pixel shader is missing from the pipeline, as it is shown in the below picture

This is my pixel shader source code:

 cbuffer SkinningTransforms
 {
    matrix WorldMatrix;
    matrix ViewProjMatrix;
 };
//--------------------------------------------------------------------------------
// Inter-stage structures
//--------------------------------------------------------------------------------
struct VS_INPUT
{
    float3  position        : POSITION;
    int4    bone            : BONEID;
    float4  weights         : BONEWEIGHT;
    float3  normal          : NORMAL;
    float3  tangent         : TANGENT;
    float2  tex             : TEXCOORD;
};
//--------------------------------------------------------------------------------
struct VS_OUTPUT
{
    float4 position         : SV_Position;
    float3 normal           : NORMAL;
    float3 light            : LIGHT;
    float2 tex              : TEXCOORDS;
};

Texture2D       ColorTexture : register( t0 );
SamplerState    LinearSampler : register( s0 );

//--------------------------------------------------------------------------------
VS_OUTPUT VSMAIN( in VS_INPUT input )
{
    VS_OUTPUT output;
    //Transform vertex and pass them to the pixel shader
    return output;
}

//--------------------------------------------------------------------------------
float4 PSMAIN( in VS_OUTPUT input ) : SV_Target
{
    // Calculate the lighting
    float3 n = normalize( input.normal );
    float3 l = normalize( input.light );

    float4 texColor = ColorTexture.Sample( LinearSampler, input.tex );

    float4 color = texColor * (max(dot(n,l),0) + 0.05f );
    return( color );
}

As I was known from Graphics Debugger, all of the graphics event are right. I listed in below important events, which might be relating to Pixel Shader:

106:(obj:4) ID3D11Device::CreateDepthStencilView(obj:24,NULL,obj:25)*
108:(obj:5) ID3D11DeviceContext::OMSetRenderTargets(8,{obj:1,NULL,NULL,NULL,NULL,NULL,NULL,NULL},obj:25)*
109:(obj:5) ID3D11DeviceContext::ClearRenderTargetView(obj:1,addr:21)*
111:(obj:5) ID3D11DeviceContext::ClearDepthStencilView(obj:25,1,1.000f,0)*
119:(obj:4) ID3D11Device::CreateSamplerState(addr:24,obj:27)*
134:(obj:4) ID3D11Device::CreatePixelShader(addr:27,21056,NULL,obj:30)*
135:CreateObject(D3D11 Pixel Shader,obj:30)
136:(obj:5) ID3D11DeviceContext::PSSetShader(obj:30,NULL,0)*
137:(obj:5) ID3D11DeviceContext::PSSetSamplers(0,1,{obj:27})*
139:(obj:4) ID3D11Device::CreateTexture2D(addr:28,addr:5,obj:31)*
140:CreateObject(D3D11 Texture2D,obj:31)
142:(obj:4) ID3D11Device::CreateShaderResourceView(obj:31,NULL,obj:32)*
143:CreateObject(D3D11 Shader Resource View,obj:32)
144:(obj:5) ID3D11DeviceContext::PSSetShaderResources(0,1,{obj:32})*
146:(obj:4) ID3D11Device::CreateRasterizerState(addr:29,obj:33)*
147:CreateObject(D3D11 Rasterizer State,obj:33)
152:(obj:5) ID3D11DeviceContext::RSSetState(obj:33)*
154:(obj:5) ID3D11DeviceContext::RSSetViewports(1,addr:30)*
156:(obj:4) ID3D11Device::CreateBlendState(addr:11,obj:34)*
157:CreateObject(D3D11 Blend State,obj:34)
159:(obj:5) ID3D11DeviceContext::OMSetBlendState(obj:34,addr:31,-1)*
162:(obj:4) ID3D11Device::CreateDepthStencilState(addr:32,obj:35)*
163:CreateObject(D3D11 Depth-Stencil State,obj:35)
165:(obj:5) ID3D11DeviceContext::OMSetDepthStencilState(obj:35,0)*

I debugged all of the function in the above list, and all of them return OK. Nothing wrong.
My question is what is the reason the pixex shader is missing from pipleline, which in turn may result in the empty screen.

sentences: LibGdx Scalling sprites on Android I have a sprite that is a few buttons but need them in the center of the screen for all android devices. I tried setting it's location to the center of the screen by dividing the orthogonal camera by 2, but it doesn't help. Any simple way to fix this?

sentences:
GameObject remains null for some reason The idea is to access the function BlockWasDestroyed(); from Combo class.
Instead of var combo = gameObject.GetComponent(Combo); I've also tried with

var combo = GetComponent(Combo);
var combo:Combo = gameObject.GetComponent(Combo);
var combo:Combo = GetComponent(Combo);

But the console keeps telling it's null. However it could work when the function was static, but thing is now that function is calling another function, and so the errors happen once again.
Here's my code so far:
Brick.js
#pragma strict

public class Brick extends MonoBehaviour{

    function OnCollisionEnter(col : Collision){
        if(col.gameObject.name == "Ball"){
            var ballb = gameObject.GetComponent(BouncingBall);
            var combo = gameObject.GetComponent(Combo);
            combo.BlockWasDestroyed();
            ballb.velocityZ = ballb.velocityZ * -1;
            Score.score += 20;
            Destroy(this.gameObject);
        }
    }
}

sentences:
Dynamic items in Scrollable Vertical Layout overlap Unity I have followed steps from this tutorial site to create dynamic scrollable vertical layout. I am trying to show 10 prefab buttons in a scrollview dynamically. I can see buttons at runtime, but they are overlapped.

ScrollPanel:

Content Container

I am probably missing some components tweaks. Or problem is due to anchors? Please guide me to resolve this issue. Thanks.

sentences: Use Ashley with Scene2d in libGDX? I want to use Ashley but I also want to use actions and listeners with Scene2d. I read that it is not a good idea, but why? Ican create a system with stage.act(); and stage.draw(); in the update method or is it a bad idea? Thanks.

sentences:
Custom effects on Model in XNA If I have a Model that is drawn with a different effect occasionally, what is the typical approach to this?

Models have effects stored in each of their meshes, and you seem to be forced to use those.

Typically this is done:

foreach (ModelMesh mesh in model.Meshes)
{
    foreach (Effect effect in mesh.Effects)
    {
        effect.Parameters["World"].SetValue(world);
        // Other stuff related to this specific effect is done here.
    }
    mesh.Draw();
}

I want to be able to do this:

foreach (ModelMesh mesh in model.Meshes)
{
    myEffect.CurrentTechnique.Passes[0].Apply();
    mesh.Draw(); // Mesh will be drawn with "myEffect".
}

What are our options?

sentences:
How to design a character damage system with ECS architecture? I am developing an game with ECS architecture and trying to design a character damage system.
Does the following design fits into ECS conception and will it be extendable in future?

I have an Actor component with health percent attribute and ActorsDamage system.

I also have an inventory system, so actors can use some food to increase their health.

When actors use inventory items, their Lua handlers executes and generates ActorHit event.

ActorDamage system receives this event and increases or decreases the actor's health.

Other game systems link actors' AI system or actors' keyboard control systems can also trigger hit events.

So, is this an appropriate design conception, or is there something I need to correct or improve?

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: generating complex maps in xna I just wonder how does these maps like in this video are made. http://www.youtube.com/watch?v=TM6kcOau5oQ  I was looking for some tutorials on the web but no success. All I found was some 2D Vectors (Matrixes) with 0,1,2 values on it but I think these maps are generated and stored in a different ways. Can somebody help me or give me some advice about these maps.  I saw some presentations about indie games and I was just amazed by these games. I want to make my own game. I am a beginner and already started an XNA book and some tutorials. I would like to learn how these games are made. Thanks!

sentences:
How can I render something like the swirling clouds of Jupiter? The effect should be as similar as possible to this, though it does not need to be at planetary scale.

I was thinking that it could be done offline via particles, perhaps by directing their motion in some way. Then rendering the frames to a texture and playing these back in a loop for real-time rendering?

But I wonder if there is some other real-time way... maybe mesh patches shaped like swirls can be moved around, after being textured carefully, to imitate the motion of swirls of gaseous matter?

sentences:
Does Game Maker use use intrinsic or extrinsic rotations? I have a pretty difficult problem on my hands. My 3D character moves through space and rotates. I do not know the angle of rotation at any given time, but I do have three X, Y, Z unit vectors serving as basis vectors for the character's coordinate system.

I see that in the Euler angle page on Wikipedia there are three formula for extrinsic rotation. My problem is that they do not seem to work in any manner whatsoever. Either my reading of that page misled me, or game maker does not use extrinsic rotation.

Do Game Maker's rotation transformations always rotate globally in 3D space, or does it use the current set of transformations and rotate around the current X, Y, or Z axis?

sentences:
How can I resolve this error I'm getting in my movement script? For my player controlling script, I have attempted to do it so the player can only jump two times, I've not had any errors in the script itself but when I save it and go back on Unity, the error I keep getting is this:

  error CS0120: An object reference is required for the non-static field, method, or property Collision.gameObject

This is my code:

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

public class playerController : MonoBehaviour
{
    public float speed;
    public float power;
    private Rigidbody2D rb;
    int numberofJumps = 0;
    public int doubleJump = 2;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        numberofJumps = doubleJump;
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.D))
        {
            rb.AddForce(Vector3.right * speed);
        }

        if (Input.GetKey(KeyCode.A))
        {
            rb.AddForce(Vector3.left * speed);
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            if (numberofJumps > 0)
            {
                Jump();
            }
        }
    }

    public void Jump()
    {
        rb.AddForce(Vector3.up * power, ForceMode2D.Impulse);
        numberofJumps -= 1;
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        if (Collision.gameObject.tag == "ground")
        {
            numberofJumps = doubleJump;
        }

    }
}

The error seems to be specifically regarding this line:

if (Collision.gameObject.tag == "ground")

sentences:
Blender mesh mirroring screws up normals when importing in Unity My issue is as follows:

I've modeled a robot in Blender 2.6. It's a mech-like biped or if you prefer, it kindda looks like a chicken. Since it's symmetrical on the XZ plane, I've decided to mirror some of its parts instead of re-modeling them. Problem is, those mirrored meshes look fine in Blender (faces all show up properly and light falls on them as it should) but in Unity faces and lighting on those very same mirrored meshes is wrong. What also stumps me is the fact that even if I flip normals in Blender, I still get bad results in Unity for those meshes (though now I get different bad results than before).

Here's the details:

Here's a Blender screen shot of the robot. I've took 2 pictures and slightly rotated the camera around so the geometry in question can be clearly seen:

Now, the selected cog-wheel-like piece is the mirrored mesh obtained from mirroring the other cog-wheel on the other (far) side of the robot torso. The back-face culling is turned of here, so it's actually showing the faces as dictated by their normals. As you can see it looks ok, faces are orientated correctly and light falls on it ok (as it does on the original cog-wheel from which it was mirrored).

Now if I export this as fbx using the following settings:

and then import it into Unity, it looks all screwy:

It looks like the normals are in the wrong direction. This is already very strange, because, while in Blender, the original cog-wheel and its mirrored counter part both had normals facing one way, when importing this in Unity, the original cog-wheel still looks ok (like in Blender) but the mirrored one now has normals inverted.

First thing I've tried is to go "ok, so I'll flip normals in Blender for the mirrored cog-wheel and then it'll display ok in Unity and that's that". So I went back to Blender, flipped the normals on that mesh, so now it looks bad in Blender:

and then re-exported as fbx with the same settings as before, and re-imported into Unity. Sure enough the cog-wheel now looks ok in Unity, in the sense where the faces show up properly, but if you look closely you'll notice that light and shadows are now wrong:

Now in Unity, even though the light comes from the back of the robot, the cog-wheel in question acts as if light was coming from some-where else, its faces which should be in shadow are lit up, and those that should be lit up are dark.

Here's some things I've tried and which didn't do anything:

in Blender I tried mirroring the mesh in 2 ways: first by using the scale to -1 trick, then by using the mirroring tool (select mesh, hit crtl-m, select mirror axis), both ways yield the exact same result
in Unity I've tried playing around with the prefab import settings like "normals: import/calculate", "tangents: import/calculate"
I've also tired not exporting as fbx manually from Blender, but just dropping the .blend file in the assets folder inside the Unity project

So, my question is: is there a way to actually mirror a mesh in Blender and then have it imported in Unity so that it displays properly (as it does in Blender)? If yes, how?

Thank you, and please excuse the TL;DR style.

sentences:
Mechanim "Hand Closing / Opening" Animation control with trigger I wish to control any given Animator state "Playhead", with a variable - rather than have it play automatically with time. This is for an animation of a hand making a "clench gesture" which will be bound to an analog controller trigger output value.

I have considered the following:

Inside: StateMachineBehaviour.OnStateUpdate method (State machine behavior script attached to a state in the Mechanim graph)

Call Animator.Play or Animator.CrossFade to play a given clip from a given time with speed set to 0. This should get called every update while in the state.

The issue with this is that the whole state will stop, then start again which means OnStateEnter and OnStateExit continually fire, rather than just the OnStateUpdate method to control the "Playhead".
Animator.ForceStateNormalizedTime(time)

This would be fine but it has been depreciated.
Use timers and the Animator speed variable to calculate when to toggle playing a clip at a certain speed such to match the displacement of the trigger. Seems the wrong way to go about it.
Use the legacy animation system

This works fine but you don't get the perks of Mechanim FSM eg. blend trees.

Since Unity seem to have removed the ability to manipulate the time of a running clip or Mechanim state, it makes me think it's something I shouldn't be doing. Am I going about this the wrong way? Why does it seem difficult to play an animation via something other than the time domain?

sentences:
How To Animate A JavaScript Function I've been making this game where one of the characters, The Bandit, runs away from you mistaking you for a zombie. However, I can't seem to be able to animate the bandit. Is there a way I could use this w3schools example and make it fit with this canvas function?

The code for bandit is here or the second site:

   function drawBanditFacingDown(){
        //His face
    ctx.fillStyle = "#FFDE7A";
    ctx.fillRect(banditX, banditY, 25, 25);
    //His left eye (your left not his)
    ctx.fillStyle = "black";
    ctx.fillRect(banditX + 5, banditY + 5, 5, 8);
    //His right eye (again your right)
    ctx.fillRect(banditX + 15, banditY + 5, 5, 8);
    //His bandit thing on his mouth? I don't know what it's called
    ctx.fillStyle = "red";
    ctx.fillRect(banditX, banditY + 15, 25, 10);

    //His shirt
    ctx.fillStyle = "black";
    ctx.fillRect(banditX + 5, banditY + 25, 16, 25);

    //His arms
    //His right arm (YOUR RIGHT!!!!)
    ctx.fillStyle = "#FFDE7A";
    ctx.fillRect(banditX + 21, banditY + 25, 8, 20);
    //His left arm (On your left side)
    ctx.fillRect(banditX - 3, banditY + 25, 8, 20);

    //His pants
    //His right pant leg (ur right)
    ctx.fillStyle = "#11226B";
    ctx.fillRect(banditX + 12, banditY + 49, 8, 20);
    //his left pant leg
    ctx.fillRect(banditX + 5, banditY + 49, 8, 20);
    ctx.fillStyle = "black";
    ctx.fillRect(banditX + 11, banditY + 53, 3, 15);
    //his shoes
    //200 LINES!!!!!!
    ctx.fillStyle = "black";
    ctx.fillRect(banditX + 5, banditY + 68, 15, 5);
    }

sentences:
Simulating building stress I need to simulate the effects of adding supporting materials to a building structure for a genetic algorithm in a block-based world. Essentially I am planning to use a genetic algorithm to optimise the viability of a structure for a game in Java.

I've tried looking around for examples of algorithms, but so far have only come up with JBullet. How would the stress be calculated from a list of materials and their properties?

sentences:
How can I avoid "Moonwalking" Let me explain my question:

I have a sprite sheet with the different frames of the animations. Each animation has 8 frames.

Based on the player's input, I modify the character's coordinates, thus I also modify where the given frame of the animation should be rendered. Based on if the character is running or walking, I either speed up the animation or slow it down (since while running he should take 3 steps per second, and 2 steps per second when walking, so I play 12 frames per second when he's running, and 8 when he's walking).

However in the case of the walk cycle, I also get an unwanted side effect: the character "moonwalks". This means that while the X and Y coordinates are changing, thus the character is moving forward, his current sprite does not change at that instance. This gives the impression that the character is sliding or skating on his feet.

I'm trying to create something similar to Prince of Persia or Flashback. As I see they don't have this problem in their animation, and I wonder how could I eliminate it in mine.

I can not simply just speed up my walk cycle animation, since a fast walking looks weird. Maybe I should have more frames in my animation? Is there a simpler way of doing it? When I search for sprite sheet animation algorithm I find so little.

Update: I have added an image to demonstrate the issue. As you can see, the character does this weird sliding.

sentences: deciding user movement path - slick 2D i'm going to describe what need to be done... "there are circular areas marked in a map, large areas a person can easily move in to them and out of them" what i'm trying to do is deciding weather the person is moving in to or moving out of that circular area. i can get the user location and see weather it falls inside the circle(weather the person is inside the circle) by pure mathematics theories(theories of circle), but how can we decide weather the person in moving in to the circle or moving out of the circle? please give me some advice guys?

sentences:
Objects do not stop when colliding each other while using mouse drag I work on a 2D game and I have multiple objects that the player can control.

The objects each have a RigidBody2D and a Collider, and a method OnMouseDrag() with which I can drag the objects.

I want the dragging to stop when the objects hit each other.

I tried by using this:

rigidbody2d.velocity = Vector3.zero;
rigidbody.isKinematic = true;

But the objects do not stop.

I want exactly like this video.
I tried this but it isn't work too.

https://www.youtube.com/watch?v=ZfjVR-0ZFHU&t=270s

using UnityEngine;
 using System.Collections;
public class NewBehaviourScript1 : MonoBehaviour
{

bool allowDrag = true;
void OnCollisionEnter(Collision collision)
{
    allowDrag = false;
}

void OnMouseDrag()
{
    if(allowDrag)
    {
    float distance = 7;
    Vector3 mousePosition = new Vector3 (Input.mousePosition.x, Input.mousePosition.y , distance);
    Vector3 objPosition = Camera.main.ScreenToWorldPoint (mousePosition);
    transform.position = objPosition;
        if ((transform.position.x <0))
            {
            Vector3 _tmp = transform.position;
            _tmp.x = 0;
            transform.position = _tmp;
            }
            if ((transform.position.x > 4.5f))
            {
            Vector3 _tp = transform.position;
            _tp.x = 4.5f;
            transform.position = _tp;
            }

    }
}
void OnMouseUp()
{
    if ((transform.position.x > 0) && (transform.position.x < 0.375f))
        {
        Vector3 _tr = transform.position;
        _tr.x = 0;
        transform.position = _tr;
        }
    if ((transform.position.x > 0.375f) && (transform.position.x < 1.25f))
        {
        Vector3 _fs = transform.position;
        _fs.x = 0.75f;
        transform.position = _fs;
        }
    if ((transform.position.x > 1.125f) && (transform.position.x < 1.875f))
        {
        Vector3 _tr2 = transform.position;
        _tr2.x = 1.5f;
        transform.position = _tr2;
        }
    if ((transform.position.x > 1.875f) && (transform.position.x < 2.625f))
        {
        Vector3 _tr4 = transform.position;
        _tr4.x = 2.25f;
        transform.position = _tr4;
        }
    if ((transform.position.x > 2.625f) && (transform.position.x < 3.375f))
        {
        Vector3 _tr6 = transform.position;
        _tr6.x = 3;
        transform.position = _tr6;
        }
        if ((transform.position.x > 3.375f) && (transform.position.x < 4.125f))
        {
        Vector3 _tr7 = transform.position;
        _tr7.x = 3.75f;
        transform.position = _tr7;
        }
    if ((transform.position.x > 4.125f) && (transform.position.x < 4.875f))
        {
        Vector3 _tr8 = transform.position;
        _tr8.x = 4.5f;
        transform.position = _tr8;
        }
}
void Start ()
{
}
void Update()
{
}

}

Please help!

sentences:
Pathfinding for a lot of units, mostly random movement I'm using a uniform cost eight-directional grid as a map, with buildings that represent unpassable terrain - the map tries to simulate a top-down flat city. I'm trying to fill the city with randomly walking citizens, and with player units with controlled paths.

So far, for the random walking I've just chosen a direction and set a direct line on it ( using berensham's line algorithm), until the unit strikes a wall, but even this slows down the game with 200 units, and that's before more complex routes are looked for by the player.

So, I need:

An algorithm to quickly compute a lot of simple routes.
A good pathfinding algorithm - so far I've read about HPA* and A* with JPS, but to both I haven't managed to find an implementation, which is a problem because the articles are a bit too theoretical for me.

For illustration, the situation is somewhat similar to the movement in Atom Zombie Smasher - there are uncontrolled civilians that walk randomly / run away from a threat, and few player units that walk on prescribed paths, only in my game the player can't affect the path mid-walk.

So, to summarize - I'm looking for a system for pathfinding for a couple of hundred of units which is as quick as possible.

sentences:
SDL2 not rendering larger texture to smaller texture With SDL2 I created texture1 of 28800 x 28800 which contains a drawing of a grass background all over the texture.

Then I created texture2 of 2880 x 1620.

Then I set the render target to texture2.

The I set the logical size to 2880 x 1620.

The I renderclear texture2.

Then I rendercopy a rectangle of 2880 x 1620 from texture1 to texture2

Then I renderpresent texture2 but my screen is black.

Is that because I am trying to copy from a larger texture to a smaller texture? What are the limits when it comes to copying from texture to texture with SDL2?

Let me know if you need my code and where to put it. Some websites don't like it when you put your code in a post.

sentences:
example for creating button programmatically Can someone give me an example of programmatically (not using a prefab) creating a button in Unity 5 using C# that has the following features?

a text on the button (that I can change)
an OnClickListener
attached to a script that will store values for the button and contain the OnClick event handler
the create method for the button should return a reference to the button so I can modify it at a later point from another script

My attempt was:

main.cs

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

public class main : MonoBehaviour {

    public Canvas c;

    // Use this for initialization
    void Start () {
        createButton ("minion",999);
    }

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

    }

    //this is giving a button prefab all the methods from the class btnController
    void createButton(string name,int val){
        GameObject go =new GameObject();
        go.AddComponent<btnController>();
        go.transform.SetParent (c.transform,false); //add the gameobject to the canvas

        go.AddComponent<Button> ();
        //Button btnChild = go.GetComponent<Button> ();
        //btnChild.GetComponent<Text>().text = "hello";//doesnt work
        //go.GetComponentInChildren<Text>().text = "hello!";

        btnController bc= go.GetComponent<btnController>(); //get reference to script for this button prefab
        bc.Setup(name,val);//set values in this script for the GameObject to hold

        GameObject inst =Instantiate (go);
    }

}

btnController.cs

using UnityEngine;
using System.Collections;

public class btnController : MonoBehaviour {
    string name="test";
    int value=6;

    //this script is attached to the button prefab. the onClick of the button prefab points to this OnClick method

    public void Setup(string n, int v){
        this.name = n;
        this.value = v;
        //Debug.Log ("in button setup:"+name+" "+value.ToString());
    }

    //OnClick is public so I can set the On Click () function to this method (in the prefab button)
    public void OnClick(){
        Debug.Log("btn clicked: "+this.name+" "+this.value.ToString());
    }
}

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:
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:
Unity Procedural Build/Exe Creation I want to export ingame items to seperate data files. Those files should also be "openable" to display information about the item. My idea is to create every item as an .exe that will open a small windowed unity app with and image and some texts/tabs.

How would I handle this "procedural building of .exes" from within another application? For exeample I have a game with an inventory. And when I press "export to file", the item is build to an "item data exe file", that is then portable and openable as a standalone "item previewer".

Thank you for help. For the start a general assessment of this idea could also be helpful.

sentences:
libpng warning: iCCP: known incorrect sRGB profile I was working with SDL2 and when I loaded some textures, I got this warning in the console libpng warning: iCCP: known incorrect sRGB profile
Though this doesn't cause any error, everything works fine but I just wanted to know what this warning is about.

This is the picture I'm trying to load, maybe the fault is in the picture?

sentences:
How do I loop my animations seamlessly? I am trying a complete my method, which crops Maya-Animations (from Maya-Models) to specific ones using the SkinnedModelProcessor.

My only problem is, that after one animation-loop completes, the model stays in its last position for about 2-3 seconds until he catches up to the run-cycle again.

My goal is to get rid of that freeze time.
I want to loop it seamlessly.

Here is what I wrote:

public AnimationClip getCurrentAnimation(string clipName, string cropName, float blendTime, int beginFrame, int endFrame, int totalFrames)
{
    //The new list which only has the specific keyframes
    List<Keyframe> region = new List<Keyframe>();

    //The original clip "Take 001" from Maya, which has every
    //animation in one timeline
    AnimationClip clip = _skinningData.AnimationClips[clipName];

    //The new duration of the cropped clip
    int duration = 0;

    //Since XNA makes 7502 frames out of 21, I have to
    //calc the region-keyframes to proper numbers
    if (endFrame == 0)
        endFrame = clip.Keyframes.Count;
    else
        endFrame = ((endFrame * clip.Keyframes.Count) / totalFrames);

        beginFrame = ((beginFrame * clip.Keyframes.Count) / totalFrames);

    //Start to sort out
        for (int i = beginFrame; i < endFrame; i += 1)
        {
           Keyframe k = clip.Keyframes[i];

           //Add duration of 16 (60fps) to overall-length
           //of animation, if this keyframe does some "real"
           //transformation, instead of being a static keyframe of XNA
           if (k.Time.Milliseconds > duration)
                duration += 16;

            k.Time = TimeSpan.FromMilliseconds(duration);
            region.Add(k);
         }

         AnimationClip cropped = new AnimationClip(cropName, TimeSpan.FromMilliseconds(duration), region);
         return cropped;
}

sentences:
Starting off with coordinate systems Where is a good place to start with learning how to program custom coordinate systems in a 3d environment?

Are there any good books on he topic of gaming coordinate systems? I would like to build a real life data structure based on techniques used for game programming.

sentences:
Writing a server for a multiplayer game I've been looking on the internet, but I can't really find any good answers to all my questions..

I started to think about writing a little multiplayer game on my own and after thinking and thinking and thinking about how I should begin I came to the conclusion, that implementing the network communication part at first wouldn't be a bad idea since the testing part becomes "easier".

So my first question is:

Is there any library that would make my life easier if I wanted to write the server part in C++?

I just don't know how one would implement the communication between server and client. Imagine a game that is made up of blocks (like minecraft if you want) but the client should only receive a tiny part of that map. So my question at this one is: Would you send raw byte data? Or would you use more abstract formats like XML? Let us assume that this should work with "many" clients as well..

And here is another thing..

Would one use either a single thread that collects all connections and sends requests to specific worker threads or would you create a new thread for every single connection that is established to the server?

sentences:
GameState management hierarchical FSM vs stack based FSM I'm reading a bit on Finite State Machines to handle game states (or screens). I would like to build a rather decent FSM that can handle multiple screens.

e.g. while the game is running I want to be able to pop-up an ingame menu and when that happens the main screen must stop updating (the game is paused) but must still be visible in the background. However when I open an inventory pop-up the main screen must be visible and continue updating etc.

I'm a bit confused about the difference in implementation and functionality between hierarchical FSM's and FSM's that handle a stack of states instead. Are they basically the same? Or are there important differences?

sentences:
How can I make alternate fragments drop (or make them black) based on a checkerboard texture? How can I make alternate fragments drop(or make them black) based on a checkerboard texture in a Unity fragment shader?

I am using forward path rendering in my shader passes for lighting and shadows for every object in the scene.

Now,I need a shader (or something) that drops alternate pixels from the overall screen space after everything is rendered. How can I achieve this effect?

sentences:
Is this the right architecture for our MMORPG mobile game? These days I am trying to design architecture of a new MMORPG mobile game for my company. This game is similar to Mafia Wars, iMobsters, or RISK. Basic idea is to prepare an army to battle your opponents (online users).

Although I have previously worked on multiple mobile apps but this is something new to me. After a lot of struggle, I have come up with an architecture which is illustrated with the help of a high-level flow diagram:

We have decided to go with client-server model. There will be a centralized database on server. Each client will have its own local database which will remain in sync with server. This database acts as a cache for storing things that do not change frequently e.g. maps, products, inventory etc.

With this model in place, I am not sure how to tackle following issues:

What would be the best way of synchronizing server and client databases?
Should an event get saved to local DB before updating it to server? What if app terminates for some reason before saving changes to centralized DB?
Will simple HTTP requests serve the purpose of synchronization?
How to know which users are currently logged in? (One way could be to have client keep on sending a request to server after every x minutes to notify that it is active. Otherwise consider a client inactive).
Are client side validations enough? If not, how to revert an action if server does not validate something?

I am not sure if this is an efficient solution and how it will scale. I would really appreciate if people who have already worked on such apps can share their experiences which might help me to come up with something better. Thanks in advance.

Additional Info:

Client-side is implemented in C++ game engine called marmalade. This is a cross platform game engine which means you can run your app on all major mobile OS. We certainly can achieve threading and which is also illustrated in my flow diagram. I am planning to use MySQL for server and SQLite for client.

This is not a turn based game so there is not much interaction with other players. Server will provide a list of online players and you can battle them by clicking battle button and after some animation, result will be announced.

For database synchronization I have two solutions in mind:

Store timestamp for each record. Also keep track of when local DB was last updated. When synchronizing, only select those rows that have a greater timestamp and send to local DB. Keep a isDeleted flag for deleted rows so every deletion simply behaves as an update. But I have serious doubts about performance as for every sync request we would have to scan the complete DB and look for updated rows.
Another technique might be to keep a log of each insertion or update that takes place against a user. When the client app asks for sync, go to this table and find out which rows of which table have been updated or inserted. Once these rows are successfully transferred to client remove this log. But then I think of what happens if a user uses another device. According to logs table all updates have been transferred for that user but actually that was done on another device. So we might have to keep track of device also. Implementing this technique is more time consuming but not sure if it out performs the first one.

sentences:
FBO and VBO for performance I discovered VBO's recently and changed my code to use them instead of immediate mode. Now I'm rendering 25000 squares and it's really slowing down my FPS.  If I drew all the squares VBO's to an FBO,  then bound it to a single VBO, would it increases performance?
The 25000 squares is more of a stress test,  im trying to optimize my rendering code for snow.
Edit : Each snow particle draws one of three static VBO's,  this helped performance.

sentences:
libgdx glClearColor not setting right color? i just new to libgdx and trying to understand the example code, the following code sets the bg color

        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        Gdx.gl.glClearColor(60,181,00,0f);

my expected color is green,  R:60 Green:181 B:0, but the about code show me yellow color in my android app, anything  i'm doing wrong?

http://rapid-tools.net/online-color-picker/

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:
Good practices while working with multiple game engines, porting a game to a new engine I have to work with multiple game engines, like

Cocos2d
Unity3d
Galaxy

While working with multiple game engines, what practices should I follow?

For instance, we made a game with Cocos2d and released it on the AppStore. Now we want to port it to other platforms using Unity.

What would be the course of actions to follow?

sentences:
Does my companion app infringe copyrights? I'm making an android app that is supposed to be just a companion app for a board game. Twilight Imperium 4 is the game, and it has a boatload of techs/actions cards/strategy cards with tons of text on how they work, so the point of the app is to make it easier to look through game effects. It does not intend to be a copy of the game or to replace the gameboard at all.

So, given this context, would it be ok to try and sell it on GooglePlay or would this violate copyright in some way?

sentences:
Get the dropped object using IDropHandler.OnDrop In Canvas, I drag some UI objects to a panel using this code:

public void OnDrag(PointerEventData eventData)
{
   Vector3 screenPoint = Input.mousePosition;
   screenPoint.z = 10.0f;
   Item2Drag.position = Camera.main.ScreenToWorldPoint(screenPoint);
}

But what I can't figure out is when I dropped an object on the panel, how can I get the gameObject which has been dropped?

sentences:
How to perform game object smoothing in multiplayer games We're developing an infrastructure to support multiplayer games for our game engine.

In simple terms, each client (player) engine sends some pieces of data regarding the relevant game objects at a given time interval.

On the receiving end, we step the incoming data to current time (to compensate for latency), followed by a smoothing step (which is the subject of this question).

I was wondering how smoothing should be performed ?

Currently the algorithm is similar to this:

Receive incoming state for an object (position, velocity, acceleration, rotation, custom data like visual properties, etc).
Calculate a diff between local object position and the position we have after previous prediction steps.
If diff doesn't exceed some threshold value, start a smoothing step:

Mark the object's CURRENT POSITION and the TARGET POSITION.
Linear interpolate between these values for 0.3 seconds.

I wonder if this scheme is any good, or if there is any other common implementation or algorithm that should be used?

(For example - should i only smooth out the position? or other values, such as speed, etc)

any help will be appreciated.

sentences:
Spawning large numbers of navmeshagents causes them to jump position Cross posted on StackOverflow

I'm making a tower defense style game in 3D using Unity. I'm experiencing a frustrating issue with spawning large numbers of characters in an area of navmesh where if I spawn too many near the same location many of them will 'teleport' immediately after instantiation to near the navmesh destination.

Here's a doodle of one of the levels:

The black spot is the player base the NPCs have to get to. The green scenery has no navmesh and uses mesh colliders. Scenery is mostly steep hills forming a valley the NPCs should path through. It is composed of multiple meshes marked Unwalkable in navigation. The large blue spot is the first spawn location I tried, I later tried a larger area indicated in the right side of the image (see 'things I've tried' below).

When instantiating at the original spawn location if I spawn more than about 20 NPCs at once many of them will jump to the the area indicated by the red spots.
The NPCs have a radius of about 1.5m, as do their colliders and navmeshagents avoidance property.

Things I've tried:

Spawning to a random position inside a circle with a radius of 50m.
Adding a large new hidden area of navmesh as in the image above,
defining an array of vector positions spread well apart and spawning
at each position in turn so no two navmeshagents spawn near each
other.
Adding a delay to navmeshAgent.SetDestination(playerBase)
after instantiation hoping this would prevent the immediate jump to
near the destination.
Reducing navmeshagents avoidance radius. This sometimes
reduces the problem a little but still, even with a radius of 0.1 any
more than around 50 NPCs triggers the problem.
Turning avoidance off althogether (setting to none in navmeshagent), again, can spawn more but problem still happens
Turning off auto traverse links and auto repath in navmeshagent
Increasing the time between instantiations, a large gap of several seconds works but makes the game too easy
Not setting a destination - oddly they still teleport to near the player base,  so I guess destination is not a factor

How can I spawn large numbers of navmeshagents in a short timeframe, avoiding this 'teleporting' behaviour?

sentences:
Variable value in inspector is not updating automatically? Something weird is happening when I change a variable value in script and hit play the var value doesn't update I have to reset the script in inspector. Is this normal? Aren't the values suppose to update when we hit play?

The Simple Code I used to test this:

var a:int=0;

function Start () {
print(a);
}

sentences:
Translating yaw degrees into 2D movement I've been hitting my head on the wall for a while with this, and I'm almost sure I'm overcomplicating it.

I have a variable for yaw in degrees (and also pitch and roll, but those should be irrelevant). I want to turn that variable into normalized 2D movement, so the distance traveled per frame should always be a constant.

I was easily able to to workout movement when I had a fixed view direction, but translating it with yaw is what's confusing me. I've been trying a combination of converting to radians, then using cos(x) and sin(x) but it only works if I'm looking in a certain direction.

sentences:
How to create 3d picking ray with the cursor position I'm new here and I'm not sure how to go about doing this. I am creating an application that is supposed to use the cursor's position in the window to perform 3d picking. The tutorials I have found only explain casting a ray out of the center of the camera (like from a cross-hair), but this isn't helpful because the mouse isn't always in the center. I'm looking to understand how I could go about extruding the picking ray based on the mouse's x and y position over the window.

Also, it's not as much about the picking as it is casting the ray in the right direction. Picking will be handled by getting points in the ray and checking to see if the unit at that point is full or not.

Any help is greatly appreciated, please be respectful, and thanks in advance!

sentences: How do games programmatically manipulate 3d models? The title says it all. An artist makes a 3d model of a character. How does a programmer use the model to make the character run around?

sentences:
What are the semantics of these quaternion functions in XNA/Monogame? I am having trouble understanding the semantics of some members of the XNA/Monogame Quaternion class. The docs are not helpful, and tutorials trying to explain quaternions are using heavy math, which isn't helpful for me either, since I simply do not have proper background for that.

My main questions currently are:

Is there any difference between Multiply and Concatenate?
What is the exact difference between Inverse and Negate?

sentences:
Allegro 5 al_draw_text skips characters I'm using Allegro 5.0.8 al_draw_text to draw text on a bitmap (backbuffer). However, I've noticed that the first character of the string is always skipped. Moreover, whenever the same character appears in the string, it is skipped again.

For example:

font = al_load_font(path.c_str(), 100, 0);
std::string str = "01230450678";
al_draw_text(font, color, 100, 100, 0, str.c_str());

Will print "12345678", skipping all occurrences of '0'

I've tried several TTF fonts, which work with other graphic software. I've noticed that this sometimes may or may not happen with the same font, depending only on the text size on screen (font size)

Edit:
I've formatted the code and added the arguments I've used to load the font.

Edit2:
Here is a complete code to replicate this using Allegro 5.0.8.

This code should print "0123045670890", but, instead, it renders the following image:
(Note: I didn't cleared the memory because the error appears before program finishes)

//---------------------------------------------------------------------------

#include <string>

#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_opengl.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_primitives.h>
//---------------------------------------------------------------------------

using namespace std;

//---------------------------------------------------------------------------

int main(int argc, char * argv[])
{
    al_init();
    al_install_keyboard();
    al_init_image_addon();
    al_init_primitives_addon();
    al_init_font_addon();
    al_init_ttf_addon();

    al_set_new_display_flags(ALLEGRO_OPENGL);
    ALLEGRO_DISPLAY * mainWindow= al_create_display(1200, 1000);

    ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
    string file = al_path_cstr(path, '/');
    file = file + "arial.ttf";
    ALLEGRO_FONT * font = al_load_font(file.c_str(), 50, 0);

    al_set_target_bitmap(al_get_backbuffer(mainWindow));
    al_draw_filled_rectangle(0, 0, 1200, 1000, al_map_rgb(0,0,0));

    al_draw_text(font, al_map_rgb(255,0,0), 50, 50, 0, "0123045670890");

    al_save_bitmap("d:\\teste.bmp", al_get_backbuffer(mainWindow));

    al_flip_display();

    al_rest(5.0);

    return 0;
}

sentences:
Creating a voxel chunk with a VBO - How to translate the coordinates of each block and add it to the VBO chunk? I'm trying to make a voxel engine similar to minecraft as a little learning experience and a way to learn some opengl.
I have created a chunk class and I want to put all of the vertices for the whole chunk into a single VBO. I was previously only putting each block into a vbo and making a call to render each block.
Anyways, I am a bit confused about how I can translate the coordinates of each block in the chunk when I'm putting all vertices into one vbo.

This is what I have at the moment.

public void putVertices(float tx, float ty, float tz) {
    float l_length = 1.0f;
    float l_height = 1.0f;
    float l_width = 1.0f;
    vertexPositionData.put(new float[]{
            xOffset + l_length + tx, l_height + ty, zOffset + -l_width + tz,
            xOffset + -l_length + tx, l_height + ty, zOffset + -l_width + tz,
            xOffset + -l_length + tx, l_height + ty, zOffset + l_width + tz,
            xOffset + l_length + tx, l_height + ty, zOffset + l_width + tz,

            xOffset + l_length + tx, -l_height + ty, zOffset + l_width + tz,
            xOffset + -l_length + tx, -l_height + ty, zOffset + l_width + tz,
            xOffset + -l_length + tx, -l_height + ty, zOffset + -l_width + tz,
            xOffset + l_length + tx, -l_height + ty, zOffset + -l_width + tz,

            xOffset + l_length + tx, l_height + ty, zOffset + l_width + tz,
            xOffset + -l_length + tx, l_height + ty,zOffset +  l_width + tz,
            xOffset + -l_length + tx, -l_height + ty,zOffset +  l_width + tz,
            xOffset + l_length + tx, -l_height + ty, zOffset + l_width + tz,

            xOffset + l_length + tx, -l_height + ty, zOffset + -l_width + tz,
            xOffset + -l_length + tx, -l_height + ty,zOffset +  -l_width + tz,
            xOffset + -l_length + tx, l_height + ty, zOffset + -l_width + tz,
            xOffset + l_length + tx, l_height + ty, zOffset + -l_width + tz,

            xOffset + -l_length + tx, l_height + ty, zOffset + l_width + tz,
            xOffset + -l_length + tx, l_height + ty, zOffset + -l_width + tz,
            xOffset + -l_length + tx, -l_height + ty, zOffset + -l_width + tz,
            xOffset + -l_length + tx, -l_height + ty,zOffset +  l_width + tz,

            xOffset + l_length + tx, l_height + ty,zOffset +  -l_width + tz,
            xOffset + l_length + tx, l_height + ty, zOffset + l_width + tz,
            xOffset + l_length + tx, -l_height + ty, zOffset + l_width + tz,
            xOffset + l_length + tx, -l_height + ty, zOffset + -l_width + tz

    });
}

public void createChunk() {
    vertexPositionData = BufferUtils.createFloatBuffer((24*3)*activateBlocks);

    Random random = new Random();
    for (int x = 0; x < CHUNK_SIZE; x++) {
        for (int y = 0; y < CHUNK_SIZE; y++) {
            for (int z = 0; z < CHUNK_SIZE; z++) {
                if(blocks[x][y][z].getActive()) {
                    putVertices(x*2.0f, y*2.0f, z*2.0f);
                }
            }
        }
    }

What's any easy way to translate the vertices of each block into its correct position? I was previously using glTranslatef with each call to render block but this won't work now.
What I am doing now also does not work, the blocks all render in stacks on top of each other and it looks like this:

Thanks

sentences:
How can I restart an animation? The first time the player clicks a button, my animation plays properly.

The problem is that when the player presses the button a second time, the animation does not play.

Here is the code I'm using to control my animation:

public Animator anim;

public Animator animsfirst;
public Animator animssecond;
public Animator animsthird;

public Animator reanimsfirst;
public Animator reanimssecond;
public Animator reanimsthird;
public Animator closeinstruct;

public void instructionpanel()      //(instruction panel open animation)
{
    anim.enabled = true;         //when button click instruction panel open
    animsfirst.enabled = true;
    animssecond.enabled = true;
    animsthird.enabled = true;
}

public void closeinstructionpanel()  //(instruction panel close animation)
{
    Debug.Log("animationrun");   //when button click instruction panel close
    reanimsfirst.Play("freverse");
    reanimssecond.Play("srevese");
    reanimsthird.Play("lreverse");
    closeinstruct.Play("clreverse");
}

Here is the animator controller setup for the animsfirst object:

And for the reanimsfirst object:

How can I resolve this issue?

sentences:
Convert game replay into video format My game outputs a replay file for each individual game and allows the player to watch past games.

Just a quick example of what our replay files look like:

m 6 2098.25 917.125 -1 0 224 56ööööö843949615
m 2 1715.25 1835.25 1 0 224 44ööööö843949621
m 11 1661.125 1890.875 1 0 224 56ööööö843949627
m 5 1818.125 929.0 0 1 224 56ööööö843949633
death 9 3 4 5ööööö843949663
hit 9 3 4 48 26 2114 1987 2.8266926 1865 1891ööööö843949663

Some info on the identifiers:

Movement: // m (player id) (x coord) (y coord) (x-movement) (y-movement) (remaining health) (shot energy remaining) (timestamp)

Death: // death (dead player id) (killer player id)

Hit: // hit (hit player id) (hitter player id) (weapon (1-4)) (damage dealt) (life remaining ) (x coord) (y coord) (angle of hit) (total damage dealt) (total damage taken)

There are a lot more than what I listed, but you get the idea.

What's in the replay files are essentially the same as what is sent to the server during a live game.

Right now, if we want to take a video of the game, we just go into our replay system and record it with Fraps, but I'd like to convert our replays into some kind of video format.

I know this may be a bit far-fetched, but I thought I'd give it a shot here.

The game is written in Java and is sprite based.

sentences:
How to compute tangent and bitangent vectors I have a texture loaded in three.js, then passed to the shaders. In the vertex shader I compute the normal, and I save into a variable the uv vector.

<script id="vertexShader" type="x-shader/x-vertex">

                varying vec3 N,P;
                varying vec2 UV;

                void main() {
                    gl_Position= projectionMatrix * modelViewMatrix * vec4(position,1.0);
                    P= position;
                    N= normalMatrix * vec3(normal);
                    UV= uv;
                }
            </script>
            <script id="fragmentShader" type="x-shader/x-fragment">

                varying vec3 N,P;
                varying vec2 UV;
                uniform sampler2D texture;

                void main() {
                    gl_FragColor= texture2D(texture,UV);
                }

            </script>

How do I compute the T and B vectors?

sentences:
Object made of cubes looks different based on the distance in Unity3D? I made a "Wall" from basic Unity3D cubes. They are placed tightly so the wall looks like one big rectangular prism.

If I look at it from close distance, it looks as it should be: one big rectangular prism.

But if I start moving backwards, away from the wall, the cubes' edges become visible:

And this whole thing happens in a circular way.

If I just start moving backwards from the wall,
first I start to see the cubes' edges just at the further parts of the object, and then the pure white circle starts shrinking, the edges become visible at bigger and bigger parts of the object.
then the blurrier edges appear at the further places and the previously appeared sharper edges circle starts shrinking as well. (this phase is shown on the image above)

This should be some kind of shading optimization, like mipmap, right?

How can I fix this? I want the wall to be seamless from all distances.

Update:

Changing the shader to Unlit > Color, fixes the issue.
This thing only occurs on the lit side of the wall. The shadowy side of the wall, (which isn't lit directly by the directional light of the scene) is rendered normally.

sentences:
Unity third person controller and hills So I've been building a game and using the out of the box unity third person controller demo stuff.

I found that even the tiniest of slopes seems to stop the "dude" dead in his tracks.

Is there an easy way to adjust the sensitivity on the scripts somewhere?

I tried messing with the sensitivity options in the input options setup thinking that it might help but it didn't and I don't really want to go messing about in the scripts unless I really have to because i end up complicating my life when I do that.

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:
Why is my ad not showing? My ad does not appear. I want to click the button and have an ad appear.

using UnityEngine.SceneManagement;
using GoogleMobileAds.Api;

public class GameOverControl : MonoBehaviour {
  InterstitialAd interstitital;

  [SerializeField]
  private AudioSource OverSes;

  void Start () {
    OverSes.Play ();
    MobileAds.Initialize ("");

    RequestinterstitialAd ();
  }

  public void Tekrar () {
    SceneManager.LoadScene ("BonyBony");
    ShowinterstitialAd ();
  }

  public void MenuyeDon () {
    SceneManager.LoadScene ("MainMenu");
    ShowinterstitialAd ();
  }

  private void RequestinterstitialAd() {
    interstitital = new InterstitialAd ("");
    AdRequest adRequest = new AdRequest.Builder ().Build ();
    interstitital.LoadAd (adRequest);
  }

  private void ShowinterstitialAd() {
    if (interstitital.IsLoaded ()) {
      interstitital.Show ();
    }
  }
}

sentences:
C# OpenTK Text rendering I've been looking everywhere for a solution on how to render/draw text for my 2D OpenTK-based game.

Been trying quite a few QuickFont ones without success (either a AccessViolation exception or text just not rendering), which is why I finally decided to ask here.

So my question is;
How do I render/draw text in OpenTK for my 2D game?

Thanks!

EDIT

I have tried the following example from QuickFont.Desktop GitHub

QFont _myFont;
QFont _myFont2;
QFontDrawing _drawing;

_myFont  = new QFont("Fonts/HappySans.ttf", 72, new QFontBuilderConfiguration(true));
_myFont2 = new QFont("basics.qfont", new QFontBuilderConfiguration(true));
_drawing = new QFontDrawing();  //This line throws exception "Exception thrown: 'System.AccessViolationException' in QuickFont.dll"

As I get an error here, It's hard to tell if the rest is wrong or not. It's all in the link above for anyone interested.

What I am looking for is basically a complete "working" guide for the latest OpenTK build with .NET Framework 4.5.2

sentences:
Do any games support different lighting effects according to whether a surface is wet or dry? I've noticed that when driving at night, when the road surface is dry, my headlights appear to illuminate much further than when the road surface is wet. I presume that this is due to the differences in how my headlights is being reflected under wet and dry conditions.

In dry conditions, my headlight will reflect in a diffuse way, producing producing enough scatter to allow me to see the texture of the road for quite a long distance. In the wet however, the thin layer of water over the road surface, combined with the shallow angle of incidence, causes the light from my headlights to be reflected in a specular way and not back scattered to me.

Thinking about this, I realised that I can't remember ever having seen this effect being reproduced in a game.

Has this wet/dry effect been implemented in any game?

If so, what is the name of the technique used to produce the effect?
If not, could this effect be produced without ray-tracing?

sentences:
Running subsystems at difference update intervals I want to update the rendering at 60fps, but the logic at some lower rate, say 15Hz. But if an object only moves when the game logic updates, then it would appear to stutter badly especially for lower frequencies. I guess the rendering system could interpolate an entity's vector and draw the model moving at a lower dt, but if the game logic causes the entity to change direction it will appear to teleport back, and so on. I can imagine many more problems.

How is this usually solved in games? Surely most engines want to decouple rendering from game logic, so there must have been some though put into this. Or does everyone just update all systems that have graphical effects at the same rate?

sentences:
How can I instantiate in the current rotation in Unity 2d? Backstory

I'm currently working on a 2D sidescroller/platform game as a hobby, and I just started recently. Followed a few tutorials and such I managed to wrote my own code for basic command like walk, jump, health and so on. However my basic code wasnt perforning as I would expect, I needed a more "Tight" feeling with the movements so I followed a suggestion to use a physics based controller (Prime31's PC2D, Acrocatic or even Corgi Engine...)

Well, now the movements are what I feel is good, So I kind of dived in the scripts to add/remove/customize some code.

Question

I'm stuck now on a simple issue, I added these lines

public Transform weaponMuzzle;
public GameObject projectile;
float fireRate = 0.5f;
float nextFire = 0;

then in my Update()

if (Input.GetButtonDown("Fire2"))
{
  animator.Play.Weapon();
  fireProjectile ();
}

and here is the problem I have

void fireProjectile ()
{
  if (Time.time > nextFire)
  {
    nextFire = Time.time + fireRate;

    if (_motor.facingLeft)
    {
      Instantiate (projectile, weaponMuzzle.position, Quaternion.Euler (new Vector3 (0,0,180f)));
    }
    else if (!_motor.facingLeft)
    {
      Instantiate (projectile, weaponMuzzle.position, Quaternion.Euler (new Vector3 (0, 0, 0)));
    }
  }
}

The prefabs are also physics based and they are fired with no problems, however they don't want to follow the current rotation of the player, they always go in the right X axis.

First of all, the facingLeft on my code is what I understand is the reference to the character controller motor, I tried with _motor.normalizedXMovement > 0 and _motor.normalizedXMovement < 0 (normalizedXMovement -1 is full left and 1 is full right) this just make it that you can only fire while moving, not stopped and the problem still persists.

I also tried with Quaternion.Identity instead of Euler and it's the same.

For a full source code : https://github.com/prime31/CharacterController2D

I'm kinda lost and it would means a lot if you can help me out on this issue.

Ps: I already searched here and other related forums but cannot find the answer, this is not a repost.

sentences:
Web application interacts bi-directional with server program? I want to write a web application to play chess against the engine Crafty. I'm not new to PHP and javascript, but must learn how to interact with a server process : how can a web application and/or (jQuery) ajax interact bi-directionally with a (linux) program running on the server?

At this moment i am developing on (Apache) local host. Crafty is installed on my Ubuntu PC. This well-known chess engine has no GUI, it runs in terminal by the command

$ /usr/games/crafty

and so you can play chess against it and even see it's calculations. I can make Crafty run by PHP, using the functions proc_open() or exec(), and most documentation i found states that the output stream should be a file .. But i think i don't want such setup, because then the webpage should be constanty polling that file (eg. by ajax) to see if some new data was appended, right?

How can Crafty talk to the web page directly, saying "i have calculated another variation" or "i have decided a move" etc, then display this info on the web page and let the user give some counter move, just like in terminal. Isn't it possible to use some session / stream / listener?

I have no clue at all, can anybody point me in a right direction?

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:
how can i make an object in a canvas always look at the mouse cursor this is my code

var myGamePiece;

function startGame() {
    myGamePiece = new component(30, 30, "red", 10, 120);
    myGameArea.start();
}

var myGameArea = {
    canvas : document.createElement("canvas");
    start : function() {
        this.canvas.width = 480;
        this.canvas.height = 270;
        this.context = this.canvas.getContext("2d");
        document.body.insertBefore(this.canvas, document.body.childNodes[0]);
        this.interval = setInterval(updateGameArea, 20);
         window.addEventListener('keydown', function (e) {
            myGameArea.keys = (myGameArea.keys || []);
            myGameArea.keys[e.keyCode] = (e.type == "keydown");
        })
        window.addEventListener('keyup', function (e) {
            myGameArea.keys[e.keyCode] = (e.type == "keydown");
        })
    },
    clear : function() {
        this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
    }
    }

function component(width, height, color, x, y) {
    this.gamearea = myGameArea;
    this.width = width;
    this.height = height;
    this.speedX = 0;
    this.speedY = 0;
    this.x = x;
    this.y = y;
    this.update = function(){
        ctx = myGameArea.context;
        ctx.fillStyle = color;
        ctx.fillRect(this.x, this.y, this.width, this.height);
    }
    this.newPos = function() {
        this.x += this.speedX;
        this.y += this.speedY;
    }
}

function updateGameArea() {
    myGameArea.clear();
    myGamePiece.speedX = 0;
    myGamePiece.speedY = 0;
    if (myGameArea.keys && myGameArea.keys[37]) {myGamePiece.speedX = -5; }
    if (myGameArea.keys && myGameArea.keys[39]) {myGamePiece.speedX = 5; }
    if (myGameArea.keys && myGameArea.keys[38]) {myGamePiece.speedY = -5; }
    if (myGameArea.keys && myGameArea.keys[40]) {myGamePiece.speedY = 5; }
    if (myGamePiece < 299) {myGamePiece.speedX = -5}
    myGamePiece.newPos();
    myGamePiece.update();
}

I want myGamePiece to look exactly were the mouse cursor is looking. How can I do this?

sentences:
How can I recreate the Darwin Project's Particle? I want to recreate electronic particle in Darwin Project.but I don't know how can I use vfx graph to make this effect.I upload this effect in youtube you can see in the link below:
Darwin Project Electronic Particle Effect Youtube
Condensation

sentences:
Is it legal to record music with a synthesizer and use it in my game? I want to make music for game on my own because I don't have professional composer hired. I have found some softwares for making music, but most of them cost some money.
I have an idea to record music on synthesizer, then edit it and use in my game.
My question is:

Is it legal to record music (that I have composed and edited) on synthesizer and use it in my game (the game may be free or charged)?

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:
Procedural Dungeon Generation Connect Rooms With Passageways I've been working on a simple procedural generation class which currently places rooms on a x, y grid and selects a starting room. Each room needs to be connected with passageways so the player will be able to access them. The part that I am having issues with is how to actually connect the rooms.

There's a number of algorithms I've seen online, but I am unsure how to implement most of them.

As for my implementation of placing the rooms, the code tries placing them randomly on the grid until I get the desired density of rooms. After each room is placed, it is added to a list which stores the dimensions of the room. A room is them randomly selected to be the starting room.

Edit

Here's an example of the generated dungeons (the room with the "S" is the starting room):

Preferably, the rooms should be connected with their nearest neighbor. I'm not sure what the best way to go about this is.

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

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

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

        NetworkServer.RegisterHandler<PlayerInfo>(CreateLobbyCharacter);
    }

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

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

        conn.Send(info);
    }

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

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

        NetworkServer.AddPlayerForConnection(conn, gameobject);
    }
}

sentences:
Why is my texture displaying incorrect colours using dx11? I am trying to load my data from a binary file (ppm) and create a texture using this data. It is important that I learn to do it this way as I am eventually going to be packing all of my textures into a single binary file and then index them so creating the texture with pure binary data is something that I need to be able to do.

It seems that the texture is drawing correctly, but the colours are incorrect. I saved my image as .ppm just for this test application.

Here is the code to load my data

ppm ppm;

ppm.read(std::string("textureppm.ppm"));

//just to ensure the data is correct
uint32_t val = ppm.pixels[0];
unsigned char r = (val & 0xFF000000) >> 24;
unsigned char g = (val & 0x00FF0000) >> 16;
unsigned char b = (val & 0x0000FF00) >> 8;
unsigned char a = (val & 0x000000FF);

ID3D11ShaderResourceView* texSRV = nullptr;
D3D11_SUBRESOURCE_DATA initData = { &ppm.pixels, ppm.width * sizeof(uint32_t), 0};

D3D11_TEXTURE2D_DESC desc = {};
desc.Width = ppm.width; desc.Height = ppm.height; desc.MipLevels = 1; desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.SampleDesc.Count = 1;
desc.Usage = D3D11_USAGE_IMMUTABLE;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;

ID3D11Texture2D* tex;
HRESULT hr = getDevice()->CreateTexture2D(&desc, &initData, &tex);

if (SUCCEEDED(hr))
{
    D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
    SRVDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    SRVDesc.Texture2D.MipLevels = 1;

    hr = getDevice()->CreateShaderResourceView(tex,
        &SRVDesc, &texSRV);
}

if (FAILED(hr)) {
    throw 0;
}
else {
    setTexture(texSRV);
}

I have packed each byte into a uint32_t as it seems that is the format that is required DXGI_FORMAT_R8G8B8A8_UNORM

Here is the packing

uint32_t ppm::CreateRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
    uint32_t value = 0;
    int r2 = (r & 0xff) << 24;
    int g2 = (g & 0xff) << 16;
    int b2 = (b & 0xff) << 8;
    int a2 = (a & 0xff);

    value += r2 + g2 + b2 + a2;

    return value;
}

This code produces the following texture

When the original texture is

Does anyone know what I am doing wrong?

sentences:
How do I swap two objects in C# (specifically Mono) without triggering GC? I have two array lists. that I want to swap each frame. My question is, does the variable 'temp' need to be a member variable to avoid triggering GC, assuming this method is called on dozens of objects each frame? I'm not creating a new object, just a new reference to an object.

public void LateUpdate(){
    ArrayList<int> temp = previousFrameCollisions;
    previousFrameCollisions = currentFrameCollisions;
    currentFrameCollisions = temp;
    currentFrameCollisions.clear();
}

I've been told there's no reason to make a primitive into a member variable just to avoid GC, so my best guess is that this also applies to object references.

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: Unity3d How to add collider to borders I have a box with a hole in it. Is it posible to add a collider only to the dark blue showed at the img? (But only at the borders, not a box collider. Let's say i want some object to get in the box, but cannot touch the blue bars). And how to?

sentences:
Removing texture wrapping artifacts in OpenGLES I'm drawing an 2D array of cubes in 3D space using OpenGLES.  The texture that I have bound is spritesheet-style; that is, it's multiple textures packed into one.  If you look closely at the front of the image below, you can see 1-pixel thick lines that are lighter than the crates.  And, thicker lines in the back of the image.  They are not supposed to be there, and are what I believe to be pixels from another texture in the spritesheet.

I'm using GL_NEAREST_MIPMAP_NEAREST and GL_NEAREST for the min and mag filters, and I've tried all of the different clamping modes and nothing changes (GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRROR_REPEAT).

At  first I thought it was float precision error, but now I think it's something else (since using precision highp float in the shader makes no difference).

sentences:
How to rotate CharacterController on slope I'm trying to rotate my characterController player on a slope on the 'x' and 'z' axises, however things aren't going so well.

The player does rotate, but if I move and look in another direction, the characterController will still be on the same axis, and won't look down an up slope, and instead will be looking up a down slope.

void Update ()
{
   Vector3 rotateDirection = (camera.forward * Input.GetAxis("Vertical"))
                           + (camera.right * Input.GetAxis("Horizontal"));

   Quaternion newRotation = Quaternion.LookRotation(
                               new Vector3(rotateDirection.x, 0f, rotateDirection.z));
   transform.rotation = Quaternion.Slerp(
                               transform.rotation, newRotation, rotSpeed * Time.deltaTime);
 }

private void OnControllerColliderHit(ControllerColliderHit hit)
{
      transform.rotation = Quaternion.Euler(hit.transform.rotation.eulerAngles.x,
                   transform.rotation.eulerAngles.y, hit.transform.rotation.eulerAngles.z);
}

Also, it doesn't work at all with spheres and terrain since their rotation is zero. Anyone know how to achieve what I am talking about? Also, the goal is to allow for the 'y' axis to be free and do what it needs to in void Update().

sentences:
Vertex shader in OpenGL/GLSL - transformation of the interior of a textured quad I have a LWJGL project and ran into a problem with a vertex shader I wrote.
In my scene I am rendering a map whose ground consists of rectangular tiles.
On top of that there are other objects (I used tiny white balls here).
Here is a screenshot of my scene:

screenshot of my scene http://110.imagebam.com/download/0-Ktu6XjdWSMpKytTr3Trg/34736/347358711/scene_static.jpg

You can also click here to see the image.

Each of the four larger rectangles at the bottom is one huge quad drawn in one piece.
Every one of them contains four coordinates (the corners: top-left, top-right, bottom-right, bottom-left).
Their interior is filled with a texture.

The small white balls on top are single game objects each drawn by itself.
Note that I aligned them with the vertical edges of the underlying rectangles.

I used the following vertex shader to render the scene:

/* default shader */
#version 120

void main()
{
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Now imagine the scene getting covered with water.
I modified the shader adding a little water effect:

/* water shader */
#version 120

uniform float amplitude;
uniform float phase;

void main()
{
    gl_TexCoord[0] = gl_MultiTexCoord0;

    // transform x
    vec4 a_position = gl_Vertex;
    a_position.x = a_position.x + amplitude * sin(phase + a_position.x);

    gl_Position = gl_ModelViewProjectionMatrix * a_position;
}

An animated image of my scene can be found here or here.

You can see that the borders of the rectangles keep aligned with the white balls on top of them. However, vertices inside the rectangles (I marked the most distinct areas red) suffer a displacement relative to the white balls. In the last rectangle you can even see the balls cross the white line in the middle.

I need the interior of my textured rectangles to be transformed exactly like the white balls on top and move uniformly when being animated by my shader.
Please let me know if my problem is clear and if any other information is needed.

Thank you very much for your help.
Greetings Xoric

sentences:
Does scaling affect performance in OpenGL? I've never been able to understand the best practice in this context. I usually want to ship my game with as minimum size as possible. So whereever possible, I try to use scaling of my graphics. Let's suppose I have to draw a 1000 X 300 px wall of yellow color in my game. So I usually just use a 3 X 3 px yellow image and stretch it in game (using nearest neighbor filter). Is this the right approach?

Let us consider another situation. Let's suppose I wish to render rain in my game. Basically 2 X 30 px blue white gradient streaks . Let us suppose at any time 200 drops max are going to be rendered . Now if I just ship a 2 X 6 px streak with the game and scale it at runtime , will it affect performance?

In short, how does scaling affect performance in OpenGL?

sentences:
how can we define dynamic Path of ViewObject(Bitmap) On Canvas I am Currently working on One 2D Android Game,

In this game One ViewObject(Bitmap) is moving Across Screen On Parabola Path Like in this Image, But this Path is Static, the Static path is getting throught the Drawing with Fingure on canvas,

As Same as signature Drawing.

The Bitmap Move code On this Static Path is

//animation step
private static int iMaxAnimationStep = 900;
private int iCurStep = 0;
private Path ptCurve = new Path(); //curve
private PathMeasure pm;            //curve measure
private float fSegmentLen;         //curve segment length

 //init smooth curve
    PointF point = aPoints.get(0);
    ptCurve.moveTo(point.x, point.y);

    for(int i = 0; i < aPoints.size() - 1; i++){
        point = aPoints.get(i);
        PointF next = aPoints.get(i+1);
  ptCurve.quadTo(point.x, point.y, (next.x + point.x) / 2, (point.y + next.y) / 2);
    }

    pm = new PathMeasure(ptCurve, false);
    fSegmentLen = pm.getLength() / iMaxAnimationStep;//20 animation steps

    //animate the Bitmap
    Matrix  mxTransform = new Matrix();
    if (iCurStep <= iMaxAnimationStep)
    {

        pm.getMatrix(fSegmentLen * iCurStep, mxTransform,
                PathMeasure.POSITION_MATRIX_FLAG);
        mxTransform.preTranslate(-Bitmap.getWidth(), -Bitmap.getHeight());

       canvas.drawBitmap(Bitmap, mxTransform, null);

        iCurStep++; //advance to the next step
        mPauseViewHandler.post(mPauseViewRunnable);
    } else {
        iCurStep = 0;

    }

But My Problem is I want to Move This ViewObject(Bitmap) On Dynamic Path(in parabola curve) & that Dynamic curved path will work in Any Device.

I have searched Lot but i can't Find Solution How to get Dynamic Path (in parabola curve).

help! If you have Any Solution,Suggestion, idea ,tutorial regarding this post is Mostly Appreciated.

sentences:
Long occluding geometries in Resonance Audio for Unity I'm currently looking into using resonance audio (https://resonance-audio.github.io/resonance-audio/) for accurately modelling the audio for an environment that approximates to a long corridor with a series of bends. I want to have a sound at the end of this corridor that the user can hear at any point in the corridor based on the sound reflections along the corridor.
I have tried a few of the options presented by Resonance Audio:

Placing reverb probes along the corridor. This seems like the ideal option, however a reverb probe will only apply its baked in reverb profile to sound sources inside the probe. If I try to make the probes larger then they seem to take into account all of the geometry of the corridor at once and things get exceedingly echo-ey and consistent regardless of where I am in the corridor.
Turning the corridor model into an audio room. This isn't apropriate as it has many of the same issues as a large reverb probe, and also doesn't actually model the space itself.

Has anyone had any experience with hearing distant sounds in Resonance Audio environments like this? At this point I have a feeling that Resonance Audio is just not built for this particular situation.

sentences:
Rotate can I rotate an object to a target angle using Euler Angles? How do I rotate an object from its current angle to the desired angle in increments on 1 axis? The problem is the wraparound at 360 degrees
What I have so far (Note: pseudocode):

double MaxSpeed = 5;

double CurrentAngle = -170;
double DesiredAngle = 40;

double Distance = DesiredAngle - CurrentAngle; //How do I calculate this value considering angle wraparound?

CurrentAngle += Mathd.clamp(Distance, -MaxSpeed, MaxSpeed); //Caps the rotation speed

sentences:
Make Unity Text Area to act like a logger I'm trying to create a text area in Unity using UI.Text that contains multi-line text which should act like a log view, i.e the text area Vertical Overflow is set to Truncate and a new line of text is added to the text property every now and then but instead of the text being eventually cut of at the bottom when the text area is full I want the text to 'scroll' up so that the newest added line is always the last displayed at the bottom of the text area, e.g.

  Line 1
  Line 2
+------------------------------------------+
| Line 3                                   |
| Line 4                                   |
| Line 5                                   |
| Line 6                                   |
| Line 7                                   |
| Line 8                                   |
+------------------------------------------+

... When Line 7 is logged Line 1 goes out of the text area at the top, when Line 8 is logged, Line 2 goes out, etc. Can this be done with UI.Text?

sentences:
Unity Round(Circle) Buttons I have been using unity and C# scripting now for the past 2 or 3 weeks. So yeah i am very new to unity and C#.

I wanted to know if there is a way to make a round(circle) button without using the rect.

The problem I have now, I am using a 2d sprite to make the button appear round, however when you hover or click with in the rect, it still works.

I saw this asset in the asset store called Alpha Raycaster

Check asset out: Alpha Raycaster on Unity Asset Store

I cannot afford to pay for it right now so I was wondering if there is a free alternative to the Alpha Raycaster for now.

Dose anyone know how we can solve this issue? I obviously only want the button to function when the user hovers or clicks within the sprite and NOT on the alpha surrounding the sprite.

sentences: FBX exported from C4D and imported into Unity creating new materials When importing a FBX model created in C4D, unity is creating new materials for certain meshes. For example, I have a material in C4D applied to my model called Metal. When imported into unity a new Material called Metal.1 is created and assigned to the mesh. I have no idea why this is happening.

sentences:
Doubt about texture waves in CG Ocean Shader I'm new on graphical programming, and I'm having some trouble understanding the Ocean Shader described on "Effective Water Simulation from Physical Models" from GPU Gems. The source code associated to this article is here.

My problem has been to understand the concept of texture waves. First of all, what is achieved by texture waves? I'm having a hard time trying to figure out it's usefulness.

In the section 1.2.4 of the article, it does say that the waves summed into the texture have the same parametrization as the waves used for vertex positioning. Does it mean that I can't use the texture provided by the source code if I change the parameters of the waves, or add more waves to sum?

And in the section 1.4.1, is said that we can assume that there is no rotation between texture space and world space if the texture coordinates for our normal map are implicit.
What does mean that the "normal map are implicit'? And why do I need a rotation between texture and world spaces if the normal map are not implicit?

I would be very grateful for any help on this.

sentences:
Updating score in collision detection game in XNA I created a collision detection game in XNA but I have a problem with the scoring.
As online tutorials says,
I initialised it

score = 0;

This is in the update section to check if the person hit the object

// Check collision with person
                if (personRectangle.Intersects(numberRectangle))
                    personHit = true;

Then in the draw section..

if (personHit)
            {
               score = +score + 1;
               spriteBatch.Draw(greenBackground, mainFrame, Color.White);
            }
            else if (personHit2)
            {
                score = +score - 1;

                //device.Clear(Color.Red);
                spriteBatch.Draw(redBackground, mainFrame, Color.White);
            }

But when the person hits the objects that fall, the score goes up until that object is on the person image.
I don't know if I am clear.
The score doesn't go up by one per hit,  it goes up until that object stops touching the person..

I was wondering how can I fix this so the score goes up by 1 only?

sentences:
Dual touch controls turning on one axis I wanted a swift look around functionality to be put in the middle of a room and just look around.
So obviously I imported the standard assets and put the FPS controller in the middle and then dragged in the Dual touch controls and build it to android.
The problem is that it only rotates horizontally and not vertically. I tried playing around with the values a bit but nothing seems to be working.

sentences:
Libgdx/Android/2D RPG game: optimizing time consuming when switching from Map to Map I am completely new in game developing and even more new in the use of Libgdx. So far I have successfully done great thing on my game project thanks to all the advices I could have gathered on this forum. I would need your brilliant help once again.

- Context:

I have several TiledMaps and on each one of them, there is an object layer named “trigger”. This layer contains objects with name corresponding to an animation in my code.
All the animations of this layer are loaded thanks to TextureRegion.split.

- Issue:

When I load a new map or for instance a new floor in a house, the time spent to preload the animations of this new floor is too high. Here are the tests of the time spent to load 3 animations of 4 frames each and dimension 64x64 pixels (corresponding to 16 tiles):

0.7 sec on a Samsung Galaxy S6 (this is far too much for a powerful device and only 3 animations).
1.1 secs on a 4 years old Samsung Galaxy Note2.
2.2 secs on a 4 years old Sony Xperia M (pretty old and powerless though).

Here is the logic of my gamescreen class:

- Possible solutions:

1) Preload all the animations of the game in the OnCreate and loading screen:

Far from being a good idea with my current game architecture. I expect having 300+ animations (with the fighting ones, cutscenes…). With above tests, it would take 3+ minutes on a powerful device as the Samsung Galaxy S6 for instance.

2) Preload new map animations in another Thread when the user is approaching a teleport trigger:

It will be a good idea on device with good double core CPU but I am afraid of a big FPS drop on single core device or not good double core CPU (like double 600Mhz ones).

3) Label a group of animations with a level-flag and preload them only if level flag changes:

For instance: Level1 flag for 2 exteriors which contains 10 interiors (houses for example)

Level2 flag for 1 exterior and 6 interiors.

On that example, it will just require to preload and having a loading screen when we change of level but with the current architecture of my game code, it will still be a lot of time consuming.

If there is 20 animations and 20 fights animation per level it will be still 40 animations which represent about 7-9 sec on Samsung Galaxy S6 without including sounds loading…

4) Refactor all my code and include logic I was not aware of.

I think it is the best option here. I heard of AsseManager for instance but I have no idea how it is working with Animation object.

Thank you all for your help in advance!

sentences:
How to calculate where specular highlights converge with an anisotropic shader? If you look at a rendering with an anisotropic shader applied you will notice that there are special spots on the 3D surface/mesh where the lights seems to converge, a point where a given vector radiates from or converges to.

For example:

The specular highlights seem to converge to the corner of the mouth.

Now given a 3D mesh I would like to calculate those points programmatically: what is the formula for that in linear algebra with vectors ?

sentences: CharacterController - should I work with FixedUpdate or with Update? I know that updates related to the physics engine should be made in FixedUpdate, but I am not sure about updates related to CharacterController: should they be done in Update or FixedUpdate? I tried both options and putting them in FixedUpdate appears smoother, but this may be due to other factors, so I would be happy to know what the recommended practice is.

sentences:
How would you guys call a class to instantiate both NPCs and players? My idea is having a class to instantiate both NPCs and players. I have thought of some names like Entity but that is way too broad, as it could refer to anything from a block to an event really. I've also thought of Character, but that name seems to refer to only important characters in the story, not any NPC that you might encounter in the world.
It's a pretty straightforward question, yet I've been racking my brain for about an hour and can't seem to get any useful ideas.

Thanks guys, and peace.

sentences: How do I find the intersections between colliding circles? I want to find whether 2 circles with radii r1 and r2 intersect, and if so, where they do so. Is there a simple solution?

sentences:
SDL2: Why is my player's position not updating? I've just started getting into game development, SDL in particular, so please go easy on me. I'm struggling to understand why my player's position isn't chaning when I press the left arrow button.

main.cpp

#include <iostream>
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"

typedef struct
{
  float x, y;
  SDL_Texture *sprite;
} Player;

int processEvents(SDL_Window *window, Player *player) {
    SDL_Event event;
    int done = 0;
    while(SDL_PollEvent(&event)) {
        switch(event.type) {
            case SDL_WINDOWEVENT_CLOSE: {
                if(window) {
                    SDL_DestroyWindow(window);
                    window = NULL;
                    done = 1;
                }
            }
            break;
            case SDL_QUIT: {
                done = 1;
            }
            break;
        }
    }

    const Uint8 *keyState = SDL_GetKeyboardState(NULL);
    if( keyState[SDL_SCANCODE_LEFT] ) {
      player->x = 120;
    }
    return done;
}

void render(SDL_Renderer *renderer, Player *player) {
    SDL_RenderClear(renderer);

    SDL_Rect playerRect;
    playerRect.x = 0;
    playerRect.y = 0;
    playerRect.w = 32;
    playerRect.h = 32;
    SDL_RenderCopy(renderer, player->sprite, NULL, &playerRect);
    SDL_RenderPresent(renderer);
}

void update(Player *player) {
     player->x += 10;
}

int main( int argc, char *args[] ) {
    SDL_Window* window;
    SDL_Renderer* renderer;
    SDL_Event event;

    Player player;
    player.x = 50;
    player.y = 0;

    SDL_Init(SDL_INIT_EVERYTHING);
    window = SDL_CreateWindow("Dungeon", 100 , 100, 640, 480, SDL_WINDOW_SHOWN);
    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

    player.sprite = IMG_LoadTexture(renderer, "assets/player.png");

    int done = 0;
    while( !done ) {
        done = processEvents(window, &player);
        update(&player);
        render(renderer, &player);
    }
    SDL_DestroyWindow(window);
    SDL_DestroyRenderer(renderer);
    SDL_Quit;
    return 0;
}

Any help would be much appreciated.

Thanks :)

sentences:
Implement an upper FPS limit in the gameloop I implemented my game-loop as described in deWiTTER's article, using the last approach with an unlimited FPS and a constant game-speed.

My problem is, that the unlimited FPS cranks up my CPU usage to nearly 100%. I understand that this is desired (as the hardware does as much as it can), but for my game, it's not really necessary (it's pretty simple). So I'd like to limit the FPS to some upper bound.

Consider my game-loop:

private static final int UPDATES_PER_SECOND = 25;
private static final int WAIT_TICKS = 1000 / UPDATES_PER_SECOND;
private static final int MAX_FRAMESKIP = 5;

long next_update = System.currentTimeMillis();
int frames_skipped;
float interpolation;

// Start the loop:
while (isRunning){
    // Update game:
    frames_skipped = 0;
    while (System.currentTimeMillis() > next_update
            && frames_skipped < MAX_FRAMESKIP){
        // Update input, move objects, do collision detection...
        // Schedule next update:
        next_update += WAIT_TICKS;
        frames_skipped++;
    }
    // Calculate interpolation for smooth animation between states:
    interpolation = ((float)(System.currentTimeMillis() + WAIT_TICKS - next_update)) / ((float)WAIT_TICKS);
    // Render-events:
    repaint(interpolation);
}

How would I implement a maximum FPS?

If i implement the repaint the way I implemented the update (or use a sleep instead of "do-nothing-cycles"), then the FPS is locked, right? That is not what I want. I want the game to be able to work with lower FPS (just as it does now), but limit the FPS to a maximum of, say 250.

sentences:
How can I remove scores or ban users from Google Play leaderboards? I have included Google Play game services in my Android game. I see lot of users posting fake scores.

Can I ban them or can I delete these scores somehow?

sentences:
Is the GraphicsDevice.Clear call in XNA necessary in 3D? It's a touch embarrassing to ask I think, but I've just never paid it any attention before and used it as I've seen in tutorials or the like in the past I believe.

Is there a need to use GraphicsDevice.Clear?
If you don't use a skybox or similar, how do you change the "void" color from purple to something else?

I'm not seeing a way to change the backcolor or w/e you'd call it in 3D. I also can comment out the GraphicsDevice.Clear call I've always seemed to use and nothing seems to change.

Thanks!

Edit: With the code below, I still get a purple background:

    //Part of Game1.cs
    protected override void Draw(GameTime gameTime) {
        frameRate++;
        Map.ResortChunkPriority(Player);
        //GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.White, 1f, 0);
        Map.Render(GraphicsDevice, clsResources.eTerrain, Player);
        base.Draw(gameTime);
    }

    //Map.Render call
    public void Render(GraphicsDevice device, Effect effect, clsEntity Player) {
        effect.CurrentTechnique = effect.Techniques["MainTech"];
        effect.Parameters["VP"].SetValue(clsCamera.viewMatrix * clsResources.projectionMatrix);

        device.Indices = clsResources.indexBuffer;

        for (int i = 0; i < RenderQueue.Count; i++) {
            //if (RenderQueue[i].fDist > 10) continue;
            RenderQueue[i].Render(device, effect, Player.ChunkPosition);
        }
    }

    //RenderQueue's Render call
    public void Render(GraphicsDevice device, Effect effect, strVector2 CurrentChunk) {
        if (iGenState != 4) return;
        effect.Parameters["xOffset"].SetValue(CubeOffset.X);// + ChunkPos.X);
        effect.Parameters["zOffset"].SetValue(CubeOffset.Z);// + ChunkPos.Z);

        for (int i = 0; i < effect.CurrentTechnique.Passes.Count; i++) {
            effect.CurrentTechnique.Passes[i].Apply();
            FaceStrips[0].Render(device, effect); FaceStrips[1].Render(device, effect);
            if (CurrentChunk.Z >= ChunkPos.Z) FaceStrips[2].Render(device, effect);
            if (CurrentChunk.Z <= ChunkPos.Z) FaceStrips[3].Render(device, effect);
            if (CurrentChunk.X <= ChunkPos.X) FaceStrips[4].Render(device, effect);
            if (CurrentChunk.X >= ChunkPos.X) FaceStrips[5].Render(device, effect);
        }
    }

    //FaceStrip's Render call
    public void Render(GraphicsDevice device, Effect effect) {
        if (iVertCounter == 0) return;

        for (int j = 0; j < geometryBuffer.Length; j++) {
            device.SetVertexBuffer(geometryBuffer[j]);
            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, geometryBuffer[j].VertexCount, 0, geometryBuffer[j].VertexCount / 2);
        }
    }

sentences:
Should items in an RPG be hardcoded or loaded in some other way? Should static weapons (ie.. Iron Sword, Mythril Axe) be their own (static) classes that derive from something like ItemWeapon, which itself is derived from a standard Item class with their own (inherited) methods?

Or possibly should there be just a standard Item class, an ItemWeapon class, and then every weapon is just an ItemWeapon instance loaded in at the start of the game?

If I was going to do that approach, where would I be loading all the items and weapons into the game? init?

If some weapons have special properties such as doing multiple attacks or a different effect, would it be beneficial to make them the separate classes to do it on an as-is basis instead of having every Weapon in the game have that function except it doesn't do anything?

sentences:
Monogame Effect World Translation Z and alpha in objects not visible behind I have an effect in each triangle and rectangle:

In the triangle class I have:

Effect.World = worldScaling * worldRotation * worldTranslation;
Effect.Alpha = Opacity;

triangle = new[]
{
    new VertexPositionColor(new Vector3(X0, Y0, 0), EFill),
    new VertexPositionColor(new Vector3(X2, Y2, 0), EFill),
    new VertexPositionColor(new Vector3(X1, Y1, 0), EFill),
};

where EFill is a solid Color.

In the Rectangle class the equivalent.

Now I set the example to the following:

background = new Quad(new Vector2(0, 0), new Vector2(1000, 1000), "Red", "White", 0, camera);
background.Opacity = 0.2f;
WindowPanel.Children.Add(background);

triangle = new Triangle(0, -50 + 90, 20, 0 + 90, -20, 0 + 90, "Black", "Red", 1);
triangle.Translation.X = 160;
triangle.Translation.Y = 160;
triangle.Translation.Z = -10;
triangle.Opacity = 0.5f;
WindowPanel.Children.Add(triangle0);

But I do not see the triangle when it is behind the rectangle. (If I exchange the Z to the rectangle, the triangle is like the image)

I am new in the '3D' Monogame environment and I read a lot of documentation that could be outdated about AlphaBlend, Depth, etc. and I do not know what exactly applies and what do not.

So the triangle and the rectangle have alpha but are like independent of each  other when rendered.

Any idea how to solve this?

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:
Any idea why my openGL camera is stuttering only on the X axis? and only when using nvidia drivers? As part of my assignment, I've been building a scene graph framework in C++/OpenGL.

My camera works absolutely fine going backwards and forwards, but when I strafe / move on the X axis, the camera just starts stuttering. It doesn't make much sense to me, because it's the same principle to move back/forward as it is to move right/left.

Everything is also normalised and being applied by deltaTime, so that's not an issue. Interestingly, this didn't happen when I was using my intel built in gpu, but only started occurring when I forced my nvidia card to handle the program.

Here is a video of the aforementioned stutter: https://www.youtube.com/watch?v=DyTIv0yiaP0&feature=youtu.be

My scene graph is available for viewing on my GitHub:

The repo: https://github.com/charliegillies/fullmetal.
The camera https://github.com/charliegillies/fullmetal/blob/master/fullmetal.cpp (line 503-730, mostly get/set methods.)
The camera controller https://github.com/charliegillies/fullmetal/blob/master/fullmetal-helpers.cpp (line 14-204)

Please note that this framework is still in its early days.

Let me know what you think, and I'll be sure to post a fix if I find it.

sentences:
How do I get the InputManager to recognize a certain axis/Vector2D with a Vive motion controller? Right. So basically I want to map the Vive motion controller touchpads (certain locations) to the certain inputs in Unity's InputManager. How do I do this? Like I want a certain area on the touchpad to equate to forwards/backwards in the InputManager. How would I do this? I am not seeing a way to do it natively.

Long story short I'm wondering if I can use the Vive with the InputManager or not.

sentences:
Calculate 2D tile map tiles within a "field of view" cone I need to calculate which tiles make up a "cone", originating at my player and extending outward for a specific tile distance.

My player can only face North, South, East, West and I'm not sure yet on the angles I'll use for the cone.

I've found several posts/articles already covering this but they're trying to determine visibility and are a lot more complex than I need. I'm not lighting a room or calculating shadows/occlusions.

sentences: Windows Class Library vs XNA Class Library I'm going to start a library in C# for Navigational Meshes. I would like to use it in both WPF/Winforms and in XNA. Can I create a windows class library and still use it in XNA?

sentences:
How do I control which calculations are done on the CPU and which are done on the GPU? My current understanding is that anything done in a shader file is done on the GPU, and anything done in my (Java, in my case) code is done on the CPU.

Is this an accurate description?

sentences:
How to run DOTween tweens in succession? I have a function in my Unity game which marks a given cell GameObject as a valid cell for next move by changing the texture on it. I wanted to spice things up a bit by adding some tweens to the changing cells so I decided to use a simple tween in DOTween - I wanted to rotate the cell 360 degrees in-place while changing the texture when it's facing away from the player (so that the texture doesn't suddenly pop to a different one when it's visible). So I did something like that:

public void markAsLegal()
{
    centerPivot.DOLocalRotate(new Vector3(180, 0, 0), .5f, RotateMode.WorldAxisAdd);
    this.GetComponent<Renderer>().material.mainTexture = Resources.Load("textures/legal_hex") as Texture2D;
    centerPivot.DOLocalRotate(new Vector3(180, 0, 0), .5f, RotateMode.WorldAxisAdd);
    isLegal = true;
}

This, however, doesn't seem to wait for one rotate before starting the next one and so the cells end up in some weird middle ground, slanted. How can I make DOTween/Unity know that I want these commands to be executed in progression, ie. 180 degree rotation ends -> change texture -> finish the remaining 180 degrees?

sentences:
Custom complex body shape with cut feature I need to create sprites (or scene2d actors or whatever) with custom shape, preferably generated from a png image (marching squares?).

I followed some Mesh tutorials but they all hardcode the triangularized-shape vertices in an array, which is completely insane.

I will later have to give my sprite a cut feature, like this game.
so I'll have to regenerate and redraw a new shape several times. Some told me to review the Drawable classes as well as Mesh, and create my own MeshDrawable that renders using meshes.

Do you have an idea of how to dynamically generate vertices and shapes instead of hardcoding coordinates?

at what level will my Mesh be responding to touch events and reacting with the user?

Any clarification will be welcome, I'm kind of lost.

sentences:
HDR / Tone Mapping - choosing parameters I implement HDR in my graphics engine (deferred rendering) based on this document: link I save a luminance in a texture (RGBA16F) this way:

const float delta = 1e-6;
vec3 color = texture(texture0, texCoord).xyz;
float luminance = dot(color, vec3(0.2125, 0.7154, 0.0721));
float logLuminance = log(delta + luminance);
fragColor = vec4(logLuminance, logLuminance, 0.0, 0.0);
// first channel stores max luminance during a minification process

Then I can calculate an average luminance and find a max luminance.

The delta = 1e-6. Is that a good choice ?

Can I calculate "a" (equation 2) dynamically to achieve better results ?

sentences:
Admob banner not getting remove from superview I am developing one 2d game using cocos2d framework, in this game i am using admob for advertising, in some classes not in all classes but admob banner is visible in every class and after some time game getting crash also.

I am not getting how admob banner is comes in every class in fact i have not declare in Rootviewcontroller class. can any one suggest me how to integrate Admob in cocos2d game, i want Admob banner in particular classes not in every class,
I am using latest google admob sdk, my code is below:

Thanks in advance

`

-(void)AdMob{
NSLog(@"ADMOB");

CGSize winSize = [[CCDirector sharedDirector]winSize];
// Create a view of the standard size at the bottom of the screen.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){

    bannerView_ = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(size.width/2-364,
                                           size.height -
                                           GAD_SIZE_728x90.height,
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];

}
else { // It's an iPhone

    bannerView_ = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(size.width/2-160,
                                           size.height -
                                           GAD_SIZE_320x50.height,
                                           GAD_SIZE_320x50.width,
                                           GAD_SIZE_320x50.height)];
}

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    bannerView_.adUnitID =@"a15062384653c9e";
}
else {
    bannerView_.adUnitID =@"a15062392a0aa0a";
}

bannerView_.rootViewController = self;
[[[CCDirector sharedDirector]openGLView]addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];

GADRequest *request = [[GADRequest alloc] init];
request.testing =  [NSArray arrayWithObjects:
                  GAD_SIMULATOR_ID, nil];                              // Simulator

[bannerView_ loadRequest:request];
 }

   //best practice for removing the barnnerView_

-(void)removeSubviews{
 NSArray* subviews = [[CCDirector sharedDirector]openGLView].subviews;
 for (id SUB in subviews){
    [(UIView*)SUB removeFromSuperview];
    [SUB release];
 }
 NSLog(@"remove from view");
  }

    //this makes the refreshTimer count
-(void)targetMethod:(NSTimer *)theTimer{

//INCREASE OF THE TIMER AND SECONDS
elapsedTime++;
seconds++;

//INCREASE OF THE MINUTOS EACH 60 SECONDS
if (seconds>=60) {
    seconds=0; minutes++;
    [self removeSubviews];
    [self AdMob];
  }
NSLog(@"TIME: %02d:%02d", minutes, seconds);
 }

`

sentences:
Trying to make a character jump I'm trying to learn Android, so I'm creating a basic 2D game which using a background scrolling image, I've already made it and the character is already walking with animation my current goal is to make it jump. I've also created the character class btw am I going to put it on ontouchevent?

  import android.annotation.SuppressLint;
  import android.app.Activity;
  import android.content.Context;
  import android.content.SharedPreferences;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.graphics.Canvas;
  import android.graphics.Paint;
  import android.graphics.Rect;
  import android.view.Display;
  import android.view.MotionEvent;
  import android.view.SurfaceHolder;
  import android.view.SurfaceView;

  import java.util.ArrayList;
  import java.util.Random;

public class GamePanel extends SurfaceView implements SurfaceHolder.Callback {

public static final int WIDTH = 856;
public static final int HEIGHT = 480;
public static int Score = 0;
public static int Highscore;
private MainThread thread;
private Background bg;
private Deer deer;

public GamePanel (Context context) {
    super(context);
    getHolder().addCallback(this);
    setFocusable(true);

}

@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

}

@Override
public void surfaceDestroyed(SurfaceHolder holder) {

    boolean retry = true;
    while (retry) {
        try {
            thread.setRunning(false);
            thread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
            retry = false;
        }
    }
}

@Override
public void surfaceCreated(SurfaceHolder holder) {
    bg = new Background(BitmapFactory.decodeResource(getResources(), R.drawable.gamebg));
    deer = new Deer(BitmapFactory.decodeResource(getResources(), R.drawable.deer), 48,60,3);
    bg.setVector(-5);

    thread = new MainThread(getHolder(), this);
    thread.setRunning(true);
    thread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
    return super.onTouchEvent(event);
}
public void update() {
    Score += 2;
    if (Score > Highscore) {
        Highscore = Score;
    }
    bg.update();
    deer.update();
}

@SuppressLint("MissingSuperCall")
@Override
public void draw (Canvas canvas)  {

    final float scaleFactorX = (float)getWidth()/WIDTH;
    final float scaleFactorY = (float)getHeight()/HEIGHT;
    if(canvas !=null) {
        final int savedState = canvas.save();
        canvas.scale(scaleFactorX, scaleFactorY);
        bg.draw(canvas);
        deer.draw(canvas);

        canvas.restoreToCount(savedState);

        Paint textpaint = new Paint();
        textpaint.setTextSize(30);
        canvas.drawText("Score:" +String.valueOf(Score), 0, 32, textpaint);
        canvas.drawText("High Score: "+String.valueOf(Highscore), 0, 64, textpaint);

    }
}
}

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:
Shimmering, scrolling/panning a texture Shimmering

I understand shimmering in textures is caused by sub-pixel accuracy aliasing against the regular grid of pixels on the screen when drawn.  I have a good example of it here, whereby I'm attempting to scroll/pan a 2d texture by modifying the texture coordinates rather than by moving some actual geometry.  The texture is "wrapped" and my idea was to fill in the bit falling off the left (or right), filling it in on the other side, to effect a single scrolling/panning surface of (almost) infinite size.

Unfortunately with random noise on the texture, when I'm zoomed all the way out the shimmering is kind-of horrific.  When I zoom in a bit it seems OK, which is kind-of confusing to me.

But anyway, is there a filter of some kind I can put into my shader to prevent this shimmering?  I'm at something of a loss here.

(To complicate matters my texture is actually just L16 luminance and I'm palettising it in the shader - the L16 is sampled with LINEAR, the palette texture is POINT, though I'm pretty sure this makes little difference to the shimmering).

Please note that with the video, YouTube has done its absolute best to remove any detail from it, meaning it's difficult to see the shimmer under the encoding artifacts.

sentences:
What does it mean to "bake lights"? What does it mean to bake lightmap ? I heard this in Unity3d, and again found this LightUp plugin for sketchup that bakes lightmap.

From what I observe, the lightmap baked gives the 3d object a much more realistic feel. Is the purpose of baking light on object to give that cg animation look you see on pre-rendered animations?

sentences:
How do I flip upside down fonts in FTGL I just use FTGL to use it in my app. I want to use the version FTBufferFont to render font but it renders in the wrong way. The font(texture?buffer?) is flipped in the wrong axis.

I want to use this kind of orthographic settings:

void enable2D(int w, int h)
{
    winWidth = w;
    winHeight = h;

    glViewport(0, 0, w, h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //I don't even want to swap the 3rd and 4th param
    //because I like to retain the top-left as the origin
    glOrtho(0, w, h, 0, 0, +1);
    glMatrixMode(GL_MODELVIEW);
}

I render the font like this:

//No pushing and popping of matrices
//No translation

font.Render("Hello World!", -1, position, spacing, FTGL::RenderMode::RENDER_FRONT);

On the other forums, they said, just scaled it down to -1, but it wont work in mine. Example:

font is above the screen

I can't see relevant problem like in mine in google so I decide to ask this here again.

How can I invert texture's v-coordinate without modifying its source code ? (assume its read only)

sentences:
Browser Game - Model or not Model I'm planing on making a browser game just for fun and to improve my skills, but I have an issue regarding the Software Architecture of the game:

I will be using an ORM to communicate with my database. Let's just talk about a browser game like Ogame or Tribal Wars. What is a model an what not?
Would I make a Model for each Unit Type and each Building Type? Or will I just save the information (for example: which level a certain building is at) in one table and a dataset would look like this:

Village

building1: 10
building2: 5
unit1: 89
...

Which is the approach I should use and how can I determine what feature is a model and which not?

Thank you!

Edit:

I see three approaches in general:

1) Each type has an own model (Main Building, Mine, Barracks). When a structure is built or upgraded the instance is modified (in it's own table). This instance is linked to a village.

2) There is a model for structures. There is an instance for each type. When a structure is built or upgraded a many to many relation is created or updated (with the level as a pivot)

3) I have a property for each building type on my village model.

Notice how this implementation use different amounts of rows in the DB.

Even more interesting: How to handle the units? I guess it's not that efficient if I'd have an instance for each unit, when I'm having 10,000 units per village.

I hope you get what problem I mean

sentences:
Unity Mirror Network Transform not working I am having an issue with Mirror's network transform component in unity. Players cannot see each other move, and in the inspector window only the host's player moves (this is not updated to the connected player though). In the inspector window you see a sphere moving and facing in the direction of the connected player (I did not program this so it must be Unity trying to tell me something) as per the picture below.

Any help is much appreciated as there doesn't seem to be anybody that I can find online with a similar problem.

Thank you!

sentences:
How to have an AI controlled GameObject naively avoid another one? I have an idea of an AI controlled game which the gameobject will follow a path but it will change its path if I put another gameobject in front of it. For instance, if the moving game object is moving horizontally, and I put a static game object on its path, I want it to turn and continue its progression vertically just before it hits it.

How can I achieve this?

sentences:
Using different shaders based on desktop or mobile? Most of my assets use the Unity standard shader. It looks and runs fine on Desktop, but on mobile the performance isn't good.

I assume the solution is to switch to one of the mobile friendly vertex-lit shaders for mobile. But how can I switch shaders depending on platform? Is there a way that Unity can do this for you, or do I need to manually change them before building? Also, would I be able to just specify the shader, or would I need to create all new materials for all my assets?

I really have no idea how to approach this, and I'd appreciate it if I can be pointed in the right direction.

sentences:
Is there a good reason I shouldn't use a java applet for a game? I want to make a multiplayer browser-based game. The nice thing about using an applet is that I can make the client and the server in the same language (java/closure/scala/etc). I know there's html5 and javascript, but server side javascript isn't as mature as the jvm platform and browser support is still kind of flaky.

Applets don't seem to be widely used (except for Runescape), but is there a reason they're unsuitable or is it just because of the bad reputation they developed in their infancy?

sentences:
Password-less player identification I'm working on the server side part of my game (develop your village/farm) and trying to build user identification system. I'd like to have a password-less mechanism: user downloads my app from the store, run it and that's all. He doesn't have to type any login or password. The game connects with the server requesting new player creation so he can start playing as soon as he opens the app.

I assume that this process is connected with GameCenter/GooglePlayGames. A game retrieves player ID from those services and then use it for future requests (saving user progress, game specific data - like village/farm facilities' positions, other information on my server). Is it a valid and safe assumption? If not can ask you to describe how it works/should be done?

I have some doubts regarding security? Single PlayerID seems to be quite weak solution, isn't it?

Edit:

I didn't mention it but I would like to move my progress from one device to another also without creation of any account with login and password.

sentences:
why isn't onTrigger invoking on collision with a trigger or a rigidbody? void onTriggerEnter(Collider other)
{
    if (other.gameObject.CompareTag("Pick Up"))
    {
        other.gameObject.SetActive(false);
        count = count + 1;
        setCountText ();
    }
}

This is the methodI want to invoke, on collision of a sphere with another cube. The cube is set as a trigger, and a rigidbody component is attached to both of the objects. Still, on collision, the method is not invoked. Is there anything else that may be done, for this method to execute?

sentences:
How to use traditional pixel coordinates system in OpenGL? (with C++/SDL2) I find the normalized, centralized coordinate system used in OpenGL weird and annoying, is there anything I can do at all to make it work like normal pixel coordinates on everything ever except OpenGL? And yes, of course I Googled it.

EDIT: I'm using OpenGL 2.1

sentences:
How can I draw beautiful lines with XNA on WP7? I'm trying to figure out how to draw good looking lines using XNA on the WP7 platform. By good looking I mean something not skinny and flat that a simple primitive gives you. A nice gradient, or texture or something applied.
It would be pretty easy if the lines were all straight, but I need to be able to make 45* and 90* turns.
Has anyone else tried doing this? I have found ways to do it, but they all require custom shaders which the platform doesn't support. Like this one for example
Example output from that library:

sentences:
How do 3D player collision work? I don't really know how to explain this but I have always wondered how simple player movement collision work. Take Half-Life or Counter-Strike for example.

Their player collision against the world are very simple - AABB collision box vs. simple brushes. For example, you walk towards a wall and when you collide with it, you are perfectly still.

While in Unity, there we have PhysX which is not even the slightest suitable to achieve perfect, almost pixelated(in 3D) player collisions.

sentences:
Unity 2D camera drifts from player as speed increases I have a dilemma that I did not have in XNA before porting my game to Unity.

First-- my goal is to mimic Super Mario World 2's camera tracking in x. The camera tracks to 1 block ahead of the player, to the left or right, depending on the direction, even if the player stops moving during the camera tracking process, otherwise I would simply make the camera a child of the character and then be done.

As the speed of my character increases, the camera drags behind. The distance (lag) between the camera and the player increases with speed, but catches up instantly when the player stops moving. I figure this is because the FixedUpdate call is somehow getting the last player position from my controller script.

This did not occur in my XNA project, and the algorithms are essentially the same.

cameraTargetX = position.transform.x - margin;

in this case the margin would be +2 blocks or -2 blocks depending on direction. Even if I get input for movement into fixed update in my player script, I still get the same delay amount. Is there a way to essentially lock the camera to a position directly in front of or behind the player without gradual delay?

If one could point me to an example of a detailed or elaborate 2D platformer with similar camera controls, that would be much appreciated since the Unity 2D example platformer's camera script is really nothing like what I'm trying to do here.

sentences:
Blender UV unwrapping causes texture to repeat in UDK material I've made pillow kinda thing, unwrapped it in Blender and then I imported my mesh to UDK, applied a material:

The material splits, but I don't want that to happen, I want to cover the mesh with only big texture, like this one for example:

How do I do that?

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: What is the difference between OpenGL ES and OpenGL? Android uses OpenGL ES, what is the difference between it and OpenGL?

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:
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: Tools/methods for creating demo videos of iPhone/iPod Touch games? I'd like to create a simple demo video of a game for iPhone and iPod Touch.  What tools do people use for this?  Ideally I can capture the device's screen... as opposed to the simulator.  Also the game uses tilt controls... hence capturing the device's screen helps put actual game play into the demo video.

sentences: gazing and lip syncing in Unity 5.2 Is it possible to achieve gazing or lip syncing in Unity 5.2 at all, similar to Locomotion done through MecAnim?

sentences:
What elements make a simple game addictive? Possible Duplicates:
What should a game have in order to keep humans playing it?
How can I make my score-based game addictive
What makes puzzle games addictive?

I am creating simple game for iPhone like "Bubble Explode". Generally, what elements of game make it addictive and exciting for similar simple games.

sentences:
GLSL - multiplying fragment output color by normal after calling texture function displays wrong texture So I'm quite new to OpenGL/GLSL. I'm trying to make multitexturing and simple normal lighting work.
Here is a Vertex shader:

#version 130

uniform mat4 transform;

in vec3 vertPos;
in vec2 texUV;
in vec3 vertNorm;
in uint thisLayer;

out vec2 fragTexCoord;
out vec3 fragNorm;
out float fragLayer;

void main()
{
    gl_Position = transform * vec4(vertPos, 1.0f);

    fragTexCoord = texUV;
    fragLayer = float(thisLayer);
    fragNorm = vertNorm;
}

... and here is Fragment shader:

#version 130

uniform sampler2DArray texArray;
uniform uint texCount;
uniform float rTime;

in vec2 fragTexCoord;
in vec3 fragNorm;
in float fragLayer;

out vec4 color;

void main()
{
    float actual_layer = max(0, min(texCount - uint(1), floor(fragLayer + 0.5))); // Getting texture layer
    vec3 texCoord = vec3(fragTexCoord, actual_layer);

    color = texture(texArray, texCoord);
}

And it works fine:

Multiplying color.rbg by any constant works as expected:

color = texture(texArray, texCoord);
color.rgb *= vec3(0.5, 0.5, 0.5);

But if I try to multiply color.rgb by a normal, like this:

vec3 finalNorm = (normalize(fragNorm) + vec3(1,1,1))/vec3(2,2,2);
color = texture(texArray, texCoord);
color.rgb *= finalNorm;

The wall texture changes to the last texture in the array (the one on the top):

I have no idea why this happens. I normalize vertex normals and map their values into [0, 1] range, so colors will stay in [0, 1] range after multiplication as well. It is supposed to simply shift the colors intensity, like it did while multiplying by a constant, not change the texture itself, right?
I am aware of the fact that this is not how you perform normal lighting, however, this is not the correct behavior as well, and I'm ripping my hair off as to why.
Any help is appreciated. I will provide more info if needed.

EDIT:
OS is Windows 10. GPU's: Intel HD 4600/Nvidia GTX 860M (happens on both of them). OpenGL version 4.3.0 build 20.19.15.4624.

Some additional info:

I use SOIL library to load data from PNG files. I use:

glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, img_width, img_height, layer_count * 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

to create a container for texture array, and use:

glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, i, img_width, img_height, layer_count, GL_RGBA, GL_UNSIGNED_BYTE, data);

to load data into it. One issue I have with this is that glTexImage3D takes layer_count (the number of textures) multiplied by 2, and I have no idea why as well! Maybe this is somehow related to the issue I'm having above?

sentences:
Make colour change depending on time I'm making a Flash game (ActionScript 3) and for dynamics I'd like to make the background change colour depending on the clients' time of day.

I have a rough idea on how I want to do this,

At sunrise, I want the background to be yellow-orange
In the middle of the day, I want the background to be cyan/clear sky colour
At sunset, a reddish-orange
During the night, a navy blue.

I will be using this method to change the colour of the symbol, which is at default a dark grey colour. (unless someone points out a better way to do this). This means I have access to the red, blue and green components of the background.

On implementing the system itself;
I suppose I could simply get the client time and do

if (hour > 9) and (hour < 18)
{
    colour = SKY_BLUE
}

and similar for the other times of day, but I'd like it to tween slowly between colours as time progresses. For example, if 6AM is yellow-orange and 9AM is blue, 7:30AM would be yellow moving towards blue. I have a feeling I need to come up with an algorithm to link time to the RGB components of the colour, but I've always been terrible at maths and I can't think of how to do this, so that's why I'm asking.

Please tell me how I would do this, both concept outlining and sample code, or even just tips are welcome. :)

sentences:
How to get light level (brightness) of a particular location? I'm making a 2D top-down survival game similar to Rimworld, I'm trying to emulate a day-night system.
Many features depend on whether any tile is light (or dark) enough, based on time of day or other light sources such as torches, so I'm wondering if there's an easy way to detect how much light there is on a certain tile without making a whole system that tracks light on a per-tile level (or maybe the latter option is better)?
I am using Unity 2020.3.6f1 and the URP, which means I'm going to be using the 'new' 2D lights.
EXAMPLE:
When it's nighttime, I'm going to disable the global light (sun) so those tiles will be pitch black.
When it's daytime, the global light will have an intensity of 1 so that tile will have 100% brightness (look normal).
When it's nighttime, but there's a torch, the tile where the torch is sitting on will have 100% brightness, and that will slowly fade to 0% over a span of 5 tiles.
Making a system that updates every single tile in the game with information about the light level seems pretty expensive. Is there a way we can observe a block "graphically", or in other words, literally look at the pixel on the screen, and determine it's alpha value to check for light level?
Any suggestion is super welcome.
EDIT:
Every tile does not need to know its brightness every frame, but they do need to know it less often. Some examples are:

A plant checking every couple of frames to see if it can grow
A character checking every couple of frames to see if he's in the dark (and if he is, he needs to start panicking)

More importantly, I need my characters to make decisions based on light amount. For an example, if there is a job that needs to be done at a certain location, a character should first check the light level of that location before going to do it.

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:
"The server isn't currently responsive" error when trying to log into Unity Hub I had reinstalled Unity and Unity Hub to fix package manager error, and when I try to log into Unity Hub after it installs, i get the following error

"The server is currently unresponsive"

I tried to log in through both Google and facebook, but it didn't work (i created my account through those methods)

How do i fix this?

sentences: How can I simulate a bad internet connection for testing purposes? I am developing an online multiplayer game. It works well when I test it on the local area network, but before I release it I would like to test how the user-experience works out for someone who has not such a good connection to the server. How can I simulate a bad internet connection with high latency, low bandwidth, jitter and occasional packet loss when in a local environment?

sentences:
Skewed 3d model when moving device around with Unity and Vuforia I am having trouble with the orientation of a 3d model that is larger (think queen-sized bed) than the target image(a4 size bond paper). The model appears to be slanted in a way that looks totally unrealistic especially when moving the device around. Is there a way to keep the model horizontally aligned with the real-world floor?

I have already enabled Extended Tracking but the behavior is still present. I have also set the world center to Specific Target and set Device Camera focus mode to FOCUS_MODE_CONTINUOUSAUTO.

Thank you.

sentences: What do game developers do when they have to port their DirectX games to PS4/Switch? I'm not a game developer (hope to be one day though!) and was wondering how devs handle porting their games that use DirectX to PS4/Switch? From what I know neither supports DirectX, only OpenGL, and Vulkan. Do the devs just have to recreate their game with OpenGL or Vulkan? That seems like a lot of work. I'd imagine it would probably be a fairly common scenario, especially with AAA games so I'd assume that there would be something somebody has made to make it easier?

sentences:
How can auto-click software be detected to stop botting/cheating? I have to completely change my question, because it was far too general. I now want to focus on how I can detect one type of cheating method.

How can auto-clicking be detected? In general, I am referring to software that will simulate mouse clicks or keyboard input automatically. It seems this would be useful for botting behaviour.

Can my software see other software the user's computer is running. If so, how does the software know what the other program is doing? Will it need to check the byte code for routines that simulate mouse/keyboard input?

Would it be useful for my software to detect if the mouse is jumping across the screen in a non-human-like behaviour? That is the first thing I can think of to stop it, as it would be the simplest but also the cheater might be able to simulate mouse movement that is human-like.

I should probably mention that I am most comfortable with Python and C++, and I am currently learning the Windows API.

sentences:
How to make a drawing action run in an left released event in Game Maker? At first I tried to make the progress bar update using only one object that would command everything (obj_Control), linking to the global left released event a script containing the draw_rectangle function, but I got no results.

The Game Maker did not acknowledge any errors, but the progress bar did not update when I clicked on the created rectangles.

obj_Control (already without the draw_rectangle event):

Because of this I decided to create 3 new objects (obj_Vida, obj_Fome, obj_Energia), each containing a sprite and when each was clicked it would perform the action to update the progress bar:

obj_Vida:

scpt 1 => obj_Control.vida+=10; (applies to self)

scpt 2 => draw_healthbar(120,100,240,120,vida,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

obj_Fome:

script 1 => obj_Control.fome+=10; (applies to self)

script 2 => draw_healthbar(120,150,240,170,fome,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

obj_Energia:

script 1 => obj_Control.energia+=10; (applies to self)

script 2 => draw_healthbar(120,200,240,220,energia,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

Room:

Room size => 360x640

Translate => vida/life, fome/hungry, energia/energy

What happens is that even dying of clicking on objects (obj_Vida, obj_Fome, obj_Energia) nothing happens to the progress bar. I discovered that it is because of the event, it would have to be a draw event. I added one below the left released event, but it did not work.

I apologize for any typing errors. I am not an English speaker and I had to translate everything. If something was not clear, please signal.

Thanks for everything.

sentences:
Are wheeled vehicles usually controlled by force applied to wheels or is movement simulated by a force applied to the vehicle? I'm building a tank in my game and I was hoping to have moving wheels with rotation and shocks. I can get the wheels to bounce and rotate but they do not actually propel the car forward.

Should I not be trying to apply a force to the wheels and instead just show the wheel rotating as I apply a force to the body of the tank?

EDIT: ALRIGHT! I did it! I rigged the tank! But the question still remains, is vehicle movement with spinning wheels usually just an animation with a force applied to the car or is it not ridiculous to apply a force to the wheels?

sentences: What is some game development literature purely in javascript? I'm mainly interested in the videogames development in pure javascript, since nowadays there's so many books about htm5 and javascript I couldn't find any book about game development with javascript only.

sentences:
Midpoint Displacement Algorithm This question has come mainly out of sheer desperation, after spending several hours trying to figure out the problem.

If you cast your eyes to the picture above, you should see that my midpoint displacement algorithm algorithm is working (somewhat) successfully; in producing a somewhat coherent noise pattern.

However, it is leaving behind a black dotted grid on the image, and I have no idea why. I can foresee this being an issue in the math, but I just cannot see it; nor was this pointed out in any online resources as a possible issue; so any help will be appreciated as to hunting down this bug.

unsigned char** mdp(unsigned char** base, unsigned base_n, unsigned char r) {
    size_t n = (2 * base_n) - 1;

    unsigned char** map = new unsigned char*[n];
    for (unsigned i = 0; i < n; ++i) map[i] = new unsigned char[n];

    // Resize
    // 1 0 1
    // 0 0 0
    // 1 0 1
    for (size_t i = 0; i < n; i += 2) {
        for (size_t j = !(i % 2 == 0); j < n; j += 2) {
            map[i][j] = base[i / 2][j / 2];
        }
    }

    // Diamond algorithm
    // 0 0 0
    // 0 X 0
    // 0 0 0
    for (size_t i = 1; i < n; i += 2) {
        for (size_t j = 1; j < n; j += 2) {
            unsigned char& map_ij = map[i][j];

            unsigned char a = map[i - 1][j - 1];
            unsigned char b = map[i - 1][j + 1];
            unsigned char c = map[i + 1][j - 1];
            unsigned char d = map[i + 1][j + 1];
            map_ij = (a + b + c + d) / 4;

            unsigned char rv = std::rand() % r;
            if (map_ij + r < 255) map_ij += rv; // EDIT: <-- thanks! the bug! `map_ij + rv`, not `r`
            else map_ij = 255;
        }
    }

    // Square algorithm
    // 0 1 0
    // 1 0 1
    // 0 1 0
    for (size_t i = 0; i < n; ++i) {
        for (size_t j = (i % 2 == 0); j < n; j += 2) {
            unsigned char& map_ij = map[i][j];

            // get surrounding values
            unsigned char a = 0, b = a, c = a, d = a;
            if (i != 0) a = map[i - 1][j];
            if (j != 0) b = map[i][j - 1];
            if (j + 1 != n) c = map[i][j + 1];
            if (i + 1 != n) d = map[i + 1][j];

            // average calculation
            if (i == 0) map_ij = (b + c + d) / 3;
            else if (j == 0) map_ij = (a + c + d) / 3;
            else if (j + 1 == n) map_ij = (a + b + d) / 3;
            else if (i + 1 == n) map_ij = (a + b + c) / 3;
            else map_ij = (a + b + c + d) / 4;

            unsigned char rv = std::rand() % r;
            if (map_ij + r < 255) map_ij += rv;
            else map_ij = 255;
        }

    }

    return map;
}

If you have any tips or resources other than http://www.gameprogrammer.com/fractal.html and http://www.lighthouse3d.com/opengl/terrain/index.php?mpd2 for fractal based terrain generation, I would appreciate them as comments also.

Edit:

This is the new image, as per Fabians suggestion (ty), however it still has some strange quirks, which you should be able to see straight away (small 'dimples' everywhere).

What could be causing this strange behavior? Updated source code: http://www.pastie.org/1924223

Edit:

Many thanks to Fabian in finding the bounds check error, for those interested, here is the current solution as 512x512 png. And current source code (modified by Fabian).

Edit (years later):
Python version https://gist.github.com/dcousens/5573724#file-mdp-py

sentences:
Three.js recover camera values When I start the script, camera has starting values. When I will move it and click button to set up startign values it is never same. What values I missed?

The best way, I suppose, it is to look at the example: http://jsfiddle.net/VsWb9/6652/

I used console.log for debbuging camera values.

HTML:

<button id="buttonTest">
TEST
</button>
 Please, move cube before click!
<div id="wrapper">

</div>

JS:

var camera, scene, renderer, geometry, material, mesh;

init();
animate();

function init() {
        window.wrapper = document.getElementById('wrapper');
    var buttonTest = document.getElementById('buttonTest');
    buttonTest.addEventListener('click', function() {
        test();
    });

    scene = new THREE.Scene();

    camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000);
    camera.position.z = 500;
    scene.add(camera);

    geometry = new THREE.CubeGeometry(200, 200, 200);
    material = new THREE.MeshNormalMaterial();

    mesh = new THREE.Mesh(geometry, material);
    scene.add(mesh);

    renderer = new THREE.WebGLRenderer({
        preserveDrawingBuffer: true
    });
    renderer.setPixelRatio(window.devicePixelRatio);
    renderer.setSize(window.innerWidth, window.innerHeight);
    renderer.setClearColor(new THREE.Color("hsl(193, 50%, 57%)"));

    wrapper.appendChild(renderer.domElement);

        controls = new THREE.TrackballControls(camera, renderer.domElement);
    controls.rotateSpeed = 4.0;
    controls.zoomSpeed = 1.2;
    controls.panSpeed = 0.1;
    controls.noZoom = false;
    controls.noPan = false;
    controls.staticMoving = true;
    controls.dynamicDampingFactor = 0.3;
    controls.keys = [ 65, 83, 68 ];
    controls.addEventListener( 'change', render );

     console.log('camera_default: '+camera.position.x+', '+camera.position.y+', '+camera.position.z);
    console.log('quaternion_default: '+camera.quaternion.x+', '+
            camera.quaternion.y+', '+camera.quaternion.z+', '+camera.quaternion.w);
}

function animate() {

    requestAnimationFrame(animate);
    controls.update();
    render();

}

function render() {
        camera.lookAt(scene.position);
    renderer.render(scene, camera);
}

function test() {
        // lines below shows actual settings
    console.log('camera_now: '+camera.position.x+', '+camera.position.y+', '+camera.position.z);
    console.log('quaternion_now: '+camera.quaternion.x+', '+
            camera.quaternion.y+', '+camera.quaternion.z+', '+camera.quaternion.w);

    window.setTimeout(function() {
        // this is recovering camera values like
        // it was on the sart of script
        // it is not enought, what I missed?
        camera.position.x = 0;
        camera.position.y = 0;
        camera.position.z = 500;
        camera.quaternion.x = 0.0;
            camera.quaternion.y = 0.0;
            camera.quaternion.z = 0.0;
            camera.quaternion.w = 1.0;

        console.log('camera_recover_default: '+camera.position.x+', '+camera.position.y+', '+camera.position.z);
        console.log('quaternion_recover_default: '+camera.quaternion.x+', '+
            camera.quaternion.y+', '+camera.quaternion.z+', '+camera.quaternion.w);
        },1500);
}

sentences:
2D Tile Based Particle Collisions I have a basic 2D particle system  and I'm now looking to implement collisions, however I'm not sure on what the best way to do it is. My game is tile based and runs in XNA Game Studio 4.0. I've seen the platformer sample which has the player's collisions system working like this:

for(int x = leftTile; x <= rightTile; x++)
{
    for(int y = topTile; y <= bottomTile; y++)
    {
        if(TileIsSolid(x, y))
        {
            //Resolve...
        }
    }
}

But I don't know if this is feasible to run on 300 particles at one time, and it needs it support tiny fast moving objects such as bullets from a weapon. So how do I go about implementing 2D tile based particle collisions?

sentences:
Is it possible to use Unity components individually outside of the Unity Studio? Such as physics, rendering or math libraries/objects. I would like create a project which would benefit from a few game engine related things but rather than use a mixture of separate libraries I thought a unified solution would be less hassle in the long run.

I'd like to build it using Visual Studio and utilize Unity components or would Unity studio be suitable to build this non-game application which ultimately would almost be like a 3d level editor.

sentences:
Converting Shader to ShaderGraph for URP conversion I know there are a bunch of threads asking for help with converting old shaders to ShaderGraph, and this one is no different.
I spent a lot of time trying to get a shader to cast shadows from sprites that also works with transparency. Eventually landing on this thread
I was able to work out the following shader that did what I wanted
Shader "Custom/SpriteShadowWithAlpha"{
    Properties
    {
        [PerRendererData] _MainTex("Texture", 2D) = "white" {}
        _EffectColor1("Effect Color", Color) = (1,1,1,1)
        _Crossfade("Fade", float) = 0
        _FlashColor("Flash Color", Color) = (1,1,1,1)
        _FlashAmount("Flash Amount",Range(0.0,1.0)) = 0
        _Cutoff("Alpha Cutoff", Range(0,1)) = 0.9
        _Color ("Color", Color) = (1,1,1,1)
    [Toggle(_ALPHABLEND_ON)] ALPHABLEND_ON("Enable Dithered Shadows", Float) = 0.0

    }
    SubShader
    {
        Tags
        {
            "Queue" = "Transparent"
            "IgnoreProjector" = "True"
            "RenderType" = "TransparentCutOut"
            "PreviewType" = "Plane"
            "CanUseSpriteAtlas" = "True"
        }

        Cull Off
        Lighting Off
        ZWrite Off
        Blend SrcAlpha OneMinusSrcAlpha
        CGPROGRAM
            #pragma surface surf Lambert alpha:blend fullforwardshadows alphatest:_Cutoff
            #pragma target 3.0

            struct Input {
                fixed2 uv_MainTex;
                fixed4 color : COLOR;
            };
            sampler2D _MainTex;
            fixed4 _EffectColor1;
            fixed _Crossfade;
            fixed4 _FlashColor;
            float _FlashAmount;
            void surf(Input IN, inout SurfaceOutput o)
            {
                fixed4 col = tex2D(_MainTex, IN.uv_MainTex);
                fixed4 returnColor = lerp(col, col * _EffectColor1, _Crossfade) * _EffectColor1.a + col * (1.0 - _EffectColor1.a);
                o.Albedo = returnColor.rgb * IN.color.rgb;
                o.Alpha = col.a * IN.color.a;
                o.Albedo = lerp(o.Albedo,_FlashColor.rgb,_FlashAmount);

            }
        ENDCG
    }
    Fallback "Standard"
}

After that I found that using the built-in render pipeline was the difference between 40% and 7% GPU utilization when converted to URP using a different sprite shadow shader.
Problem is the URP shader I found did make sprites cast shadows, but all the lighting was off, and messing with the X rotation on the sprites to get them to stand off the ground would cause them to explode into balls of white light from the directional light....I don't get why.
So I set off to try and convert my old working Shader to ShaderGraph
I have been trying to deduce what parts of this code corelate to what blocks exist in ShaderGraph.
I understand when 2 variables have a * between them I need to use a multiply block
After about 3 hours of linking different blocks I was left with....nothing and a mess

I was wondering if anyone could point me in the right direction as to what blocks correspond to what variables.
Like the code
void surf(Input IN, inout SurfaceOutput o)

I am not too sure what sort of block this would be, it seems like a function, and I have no clue how to make that visually
or the block of "Tags" no idea where to start there
or the toggling of _ALPHABLEND_ON

sentences:
How much to modify yaw? XNA 4.0 Heres a picture that explains better than my words can

For rotating an object I'm using quaternions.
    CreateFromAxisAngle(vector3.Right,yaw)

Maybe this isn't how I should be doing it but I also keep my yaw as radians that
are always between 0 and 360;more or less than 0 or 360 puts it at 0 or 360 respectively.

(object is build up of vertices and indices)

I can rotate it no problem. Move it all about.
But what I really want to do is to find how much I should alter the
yaw so that the my models right vector will sync up with the line
I can draw between the objects center and the camera's position(y is always 0).

Which I guess is the problem now, but long term I am trying to find how I modify the yaw to match any direction.

Say I am travelling Left, I may want to rotate my yaw so that my objects forward is also left.

I have been researching here and elsewhere and there seem to be solutions, I just can't wrap my head around any. Maybe someone could help shed some light?

sentences:
Function call to AndroidJabaObject to an instance of com.prime31.PlayGameServicesPlugin causes the application to stop responding Using Prime31 PlayGameServices attempting to call 'authenticate' causes the game to stop responding very soon after.

There isn't much I can show as there's literally no logs showing up in logcat.

Is there any way I can debug this?

I did notice 'enableDebugPrints' on the AndroidJavaObject was 'false' and I don't know how to set it to true, which might help with prints?

I've tried catching an exception but that hasn't worked.

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:
How do I turn a game idea, into a game? I have an idea for a game, and I was wondering, how would I go about grabbing people in the gaming development community to help build this baby that is in my head. I am no coder, but I do understand coding concepts etc.

Are there sites for discussing possible game design ideas, or game concepts? (I'm hoping here is such a site :) )

sentences:
Draw 3D model on top of another one I am trying to draw a 3D model I made with Blender in Monogame/XNA and this is the result I get when I draw 2 of them on top of each other

How can I make it so that the colors don't add up, but the one covers the other ? Here is my drawing code:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Black);
    Vector3 modelPosition = new Vector3(-2500, 1500.0f, 0.0f);
    Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 5000.0f);
    float aspectRatio = (float)graphics.GraphicsDevice.Viewport.Width /
          (float)graphics.GraphicsDevice.Viewport.Height;
    Vector3 scale = new Vector3(1f, 1, 1);
    Matrix[] transforms = new Matrix[Brick.Bones.Count];
    Brick.CopyAbsoluteBoneTransformsTo(transforms);
    foreach (ModelMesh mesh in Brick.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = transforms[mesh.ParentBone.Index]*Matrix.CreateScale(scale)*
           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);
        }
        mesh.Draw();
    }
    base.Draw(gameTime);
}

sentences:
Overlapping Vertex in DynamicVertexBuffer draw priority? I am creating a voxel game, and I have recently run into an issue. My world is drawn by a DynamicVertexBuffer, which just consists of vertices for the blocks themselves. On top of that, I switch vertex buffers to my  "Selected" vertex buffer which draws a white outline of a block for now. (This includes alpha but I have it turned off until I figure this glitch out).

This issue I run into is here:

Rather than the selected buffer overwriting my world block, it sort of does depending on the angle. Sometimes I see no overlap, sometimes weird glitches like shown above.

I was wondering, what can I do to prioritize the "Selected" buffer so that it is drawn on top of anything else sharing coordinates? Note that I did have this working, when everything used a basic effect. After switching to my own custom effect.fx (which supports fog and lighting, if that has anything to do with it), I run into this issue.

Any help is appreciated, thank you!

EDIT:

Just got the "flickering" of sorts to stop, I changed the DepthStencilState of the buffer to:

GraphicsDevice.DepthStencilState = DepthStencilState.None;

The only downside here is that it draws all 6 sides of the selected block now and it overlaps the world completely, again I don't know if this would be the right way to do it but any help would be appreciated:

The above picture is flat with the rest of the terrain around it, as you can see it draws the two sides that wouldn't actually be visible as well.

sentences:
How a 3D game map is stored and handled I'm a programmer but have not yet developed any games.

I have played various 3D games and always wondered how the Map of the field is stored and rendered.

I know some acceleration card is a necessary hardware, but how exactly the view is changed without even a single flicker on the screen.

Do you have any online material to help me understand this.

Thanks

sentences:
How to Generate Level Map Based on Golden Ratio I am trying to generate a map based on the Golden Ratio:

a+b is to a as a is to b.

I was looking at a JavaScript math library that had a built-in phi, but I wasn't sure how to apply it.
I also tried using hard-coded values as can be seen in this example:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>Konva Drag and Drop Demo</title>

Which creates the following pattern:

What I am looking for is more like this:

Note: this grid was roughly hand drawn and is not to scale.

sentences:
C++ OOP Implementation of a game I've been recently trying to get into Object Oriented Programming by porting a game I've made in C to C++. The problem is, even though my implementation works, I don't know if is the best approach.

The game is a tower defense, which contain 3 main elements: Tiles, Enemies and Towers. Each of the three elements have a "engine" class, which manipulates and allocates the individual objects. For example:

Tiles:

Class Tile
{
  private:
  int  posX, posY;
  bool visible;

  public:
  void DrawItself();

};

Class TileEngine
{
  private:
  Tile tileArray[m][n];

  public:
  int GetTileXPosition(int m, int n);
  int GetTileYPosition(int m, int n);
  void DrawArray();
};

Enemies:

Class Enemy
{
  private:
  int  posX, posY;
  bool health;

  public:
  void DrawItself();
  void MoveItself();

};

Class EnemyEngine
{
  private:
  Enemy enemyArray[m][n]

  public:
  void DrawArray();
  void MoveArray();
};

TileEngine and EnemyEngine are then instantiated on a Game class, and their public methods are then called on a loop:

Loop()
{
  TileEngine TileEngine;
  EnemyEngine EnemyEngine;
  /*FPS controlling routine omitted*/
  while(1)
  {
    EnemyEngine.Movement();

    TileEngine.DrawArray();
    EnemyEngine.DrawArray()
  }

}

The problem is that the EnemyEngine.Movement() method requires information from the TileArray, of which it doesn't have access. My temporary solution has been giving the EnemyEngine class a pointer to the TileEngine class:

void Loop()
{
  TileEngine TileEngine;
  EnemyEngine EnemyEngine;

  EnemyEngine.pTileEngine = &TileEngine;

  while(1)
  {
    /*...*/
  }

}

But doesn't that defeat the purpose of object oriented programming?
Is there a better approach to get information between the "engine" classes? Or is the Element -> ElementEngine -> Gameloop implementation flawed altogether?

sentences:
ShapeRenderer efficiency on games I want to draw a rectangle box to use as a text background for a visual novel library I'm writing, I wanted some flexibility of color and transparency and the ShapeRenderer class seems to fit the need but the doc brings this disclaimer:

This class is not meant to be used for performance sensitive applications but more oriented towards debugging.

If I use it as background the most action on screen would probably be the text scrolling over it.
Can someone more experient on the engine tell me if it is viable to use it under those premises, or it is really for debug only?

sentences:
Generating Unique Identifiers for Procedural Item Generation I have been writing all the necessary code for procedurally generated items within my game. The database mechanism that I have built supports new items at runtime, such as when a player opens a chest. Everything works fine, but I realized a fatal flaw with the way that I generate the "unique" item identifiers. I generate items using a Prefix, such as Fiery, an item type, such as Claymore, and a suffix, such as of Greater Shadow.

I generate the database Identifier using the format of:

Proc_ + Prefix + Type + Suffix + Iteration

As an actual example, the procedural item "Fiery Claymore of Greater Shadow" would then become:

Proc_FCOGS_01

All seems well right? This looks like it could work quite nicely. However, I then realized that I can easily receive identifier clashes. Or as an example: "Freezing Claymore of Greater Striking" would also be created as:

Proc_FCOGS_01

And that's where the problem arises. Because I went through all my affixes, located here and found that a few more of my chosen affixes could also lead to clashing within the database, despite the generated item not actually being the same as the one that is already entered. The routine that I am using to generate these identifiers is as follows:

        public string CreateIdentifier(string prefix, string itemType, string suffix)
        {
            if (!String.IsNullOrEmpty(prefix) && !String.IsNullOrEmpty(itemType) && !String.IsNullOrEmpty(suffix))
            {
                string input = prefix + " " + itemType + " " + suffix;
                string[] segments = input.Split(' ');
                StringBuilder builder = new StringBuilder(segments.Length + 5);
                builder.Append("Proc_");
                for (int i = 0; i < segments.Length; i++)
                {
                    builder.Append(Char.ToUpper(segments[i][0]));
                }
                return builder.ToString();
            }
            return null;
        }

After all of this, I can really only see two options:

Scrap my current Unique Identifier routine and think of another one.
If a collision exists within the Database, simply iterate the generated identifier ending number by 1, check again, and if necessary, iterate the the ending number by 1 again until an unused identifier is found.

As for number 1, that's why I'm here showing you all this. I need ideas about how I can do this in a way that will result in zero clashes unless the item is actually the same thing as previously generated.

And as for number 2, I would really prefer not doing this. I feel as though having fifteen or more database entries of Proc_FGSOTE plus the unique iteration, to be a little silly. Why have fifteen database entries of the same item? Although, I guess that would indeed be putting the iteration value to use...it's just not what I had intended it to be used for and seems like a terrible waste of resources. I really feel as though a better routine is the way to go.

Does anyone know of a better way that I can be generating unique identifiers?

Edit:

Sorry, I fogot to mention that I don't want to use the entire item name as an identifier, even if it's compressed to trim out all the spaces, mainly because the identifiers are still going to be way too long. This seems like an arbitrary limitation, I know, it's just one that I wanted to enforce so that way the Database could be loaded/parsed faster later down the road.

sentences:
Delta compressed world state when networking in JavaScript Lets say we send a snapshot from the server to the clients about world details, containing object positions, velocities etc, every second. We should send only delta-data based on the previous snapshot that was sent.

For example, if the player moved from (x:50, y:0) to (x:100, y:0), then the snapshot will only contain (move_x:50: move_y:0), and the clients will add the previous position and move_x. We should sending delta values, as it is less data to send.

How do I achieve this in Javascript?

My objects already have data stored in Float32 (by TypedArray) and there is no Float16 data type in JavaScript.

For example:

delta = currentPos - prevPos
20 = 100 - 80

okey, now I have 20 instead of 80, but this isn't less data to send.. still both will be send as Float32.

data.writeFloat32(delta); //for simplesness

there is no Float16 and I am afraid that even if JS will has Float16 TypedArrays, then it still would be not enough, because for example 20.3454356 from Float32 to Float16 will lose precision to lets say sth like 20.34, or I'm wrong?

How to send delta data in JS and gain the benefits of this technique in JS?

sentences:
XNA ignoring the Z-coordinate? XNA seems to be ignoring my Z coordinate. There is no form of Z-culling at all it seems. How come? I am doing an orthographic projection, and clearing the depth stencil buffer for every draw-call.

My elements rendered are quads with textures, through instancing. These elements have 1 difference in the Z-coordinate in order to eachother, based on theri Z-index.

sentences:
How to detect whether a transform has rotated left or right I have a game object in my scene, and I want to know how can I calculate whether this game object rotating to the right or to the left.

For example :

if(check whether the transform rotated to the right)
{
    print("rotate to right");
}
else if(check whether the transform rotated to the left)
{
    print("rotate to left");
}
else
{
    print("no rotation");
}

sentences:
Is it possible to make windows games using Havok's Project Anarchy? I'm interrested in Havok's Project Anarchy as I plan to learn how to make 3D Games, so I've done some research and it seems focused on mobile platforms.

So before I engage myself I would like to know if it is possible to make PC Windows games with It since it is not explicitly mentionned.

sentences:
Finding the site of the potential collision between 2 vehicles I've been trying to implement the unaligned collision avoidance steering behavior. I get what needs to be done on a high level, but struggle with the maths behind it.

On Craig Reynolds site, he describes

  Collision avoidance is obtained for a vehicle by considering each of the other vehicles, and determining (based on current velocities) when and where the two will make their nearest approach. A potential for collision exists if that nearest approach is in the future, and if the distance between the vehicles at nearest approach is small enough. The nearest of these potential collisions, if any, is determined. The vehicle then steers to avoid the site of the predicted collision.

For the trajectory of the vehicles, I simply store a velocity vector (x, y), and to change it an acceleration vector is used. The collision avoidance behavior should return a force (in the form of a vector).

How you would find the nearest approach (Isn't this just where they collide?) and the site of the predicted collision?

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:
searching for "university kind"  free online course about OPENGL I know there are a lot of free university courses, but I'm trying to find one about OpenGL.
Do you know where can I find one, online?

sentences: Handling bad network clients using socket.io Currently I'm working on a MMO game which players can join and exit game whenever they want. I have a connection manager server (CMS) written in golang using socket io library. World connects to CMS and clients connect to CMS and talk to world and world update clients with snapshots of game state. For testing I wrote a client that connects to CMS and act as a player for testing how many clients can my CMS handle. I reach around 80 clients per one core vcpu and 1 gig ram and that's acceptable for my game and resources. I released the game but in real life when there is around 5 or 6 real players and one player with bad network connection joins game it massively take effect the another players game experience. Packets don't receive to another clients or delayed heavily! I believe it's because socket io uses tcp and when a bad network client joins it should send messages many times for client received it completely. How should I overcome this? I know I should used udp for my game but it's too late and I released my game in play store and it got around 700 installs. Is there anyway I can put a time to live like attribute to messages that if client don't received them at a certain time dropped them? Any idea whould be helpful.

sentences:
How Frustum Culling and Sky Box Working Together ? The skybox appears where it should not appear When i did frustum culling, far parts of land not rendering. It is good like i want. But after I see sky box instead of these parts. My question is, is this normal ? Or what i need to see or what i need to do ? Because it doesn't look nice in the game.

I will show my problem to you with pictures. Over "Blender" program.

I ADDED NEW PICTURE:

sentences:
How to find the ideal path done inside a given shape in LibGDX? I'm trying to make an android/libgdx game in which for every level you have a different shape as a png, and you have to drag your finger inside the shape and try to be as close as the ideal path created after the shape. At the end of the level the game will show you in a percentage how close you were from the ideal path.

My question is how can I find the ideal way that the player has to follow? Is there any function that i can use to find out the array of points created after the shape?

My problem is that the shape width is different along the way, so I can't use the pixels path. I already have an algorithm which gives me the array of points from the path of the player so I have to compare it with the ideal one.

If you have any ideas of any algorithm or functions that can help please let me know. Any answer will be helpful.

sentences:
Different shader programs but same buffer drawing I've setup 3 different instances of the same shader code (e.g. I've compiled the code into 3 separate programs)

For each program, I've gone through the whole route of something like this:

//Setup
gl.useProgram(program);
const buffer = gl.createBuffer();
const location = gl.getAttribLocation(program, aName);

//Upload (each uses the buffer/location it created in Setup
gl.useProgram(program);
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(gl.ARRAY_BUFFER, data, usagePattern);
gl.vertexAttribPointer(location, nComponents, dataType, false, 0, 0);
gl.enableVertexAttribArray(location);

//Draw
gl.useProgram(program);
gl.vertexAttribPointer(location, 2, gl.FLOAT, false, 0, 0);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);

However, no matter what I pass into data - e.g. different sized quads, all three are the same size.

Notably, changes to other uniforms/attributes like matrices and color do change per object

How do I change this so that the changes to data per instance will be drawn properly?

(I realize if they actually use the same shader I should maybe keep a reference to one program and use some sort of buffer pool- but I'm not there yet, just getting started with WebGL)

sentences:
How can i fix "get_transform can only be called from the main thread" error in my code? Here's my code:

var forward = transform.TransformDirection(Vector3.forward);
var input = Input.GetAxis("Vertical");
function Update(){
transform.position += forward * input * Time.deltaTime;
transform.Rotate( 0 , Input.GetAxis("Horizontal") * 45 * Time.deltaTime , 0 );
}

I keep getting this error:

 get_transform  can only be called from the main thread.
 Constructors and field initializers will be executed from the loading thread when loading a scene.
 Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

sentences:
Why does the pitch affect the x component of the front vector? In every tutorial for implementing a camera in OpenGL, the front vector is calculated with something like this :

front.x = cos(pitch)*cos(yaw);
front.y = sin(pitch);
front.z = cos(pitch)*sin(yaw);

What I don't understand is why the pitch affects the x component? Shouldn't it just be :

front.x = cos(yaw);

Also, for the z component, why do we multiply cos(pitch) with sin(yaw). I understand that the pitch and the yaw both affect the z component, but why multiply? Why not add or something else?

sentences:
Overriding CoRoutine doesn't execute base code I want to have a CoRoutine declared as virtual in parent class and then overridden in child classes.

protected override IEnumerator f(Vector3 to)
{
...
    yield return base.f(to);
...
}

What happens (or doesn't happen) is that the base code doesn't get executed. Debuggin it I step into the base.f(to) and the cursor just stand on function name. If I press step next control returns to the child.

I really have no clue how to handle this situation. Any clue?

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:
terrain grid rendering problem I'm using DirectX 9 and attempting to write a simple terrain generation object.

I'm running into trouble with the rendering - I'm hoping that this is a common problem, and someone could spot the problem by the output:

I've generated vertices, indices and I'm attempting to render a triangle strip (as it's supposed to be the most efficent way to do a grid.

It looks like I've made some kind of error in vertex or index generation, although I can't see what.  I've posted my terrain class here.  Can someone have a look and suggest what I've done wrong?

sentences:
How should I traverse entities and components for their per-frame updates? I am implementing a simple entity/component-based engine in C++ and am unsure about the best way to store references to entities/components and what the best way to traverse them each game step would be.

My current thoughts are to:

Store a reference to the parent entity of each entity in the game.
Instantiate the game engine with a root entity (e.g. a Scene entity).
Traverse all entities in the game starting from the root entity and call the update method.

My entity interface is such that each entity in the game will have an update method which will call the update method for each of the entities components:

class Entity
{
public:
    virtual void update();
};

However I don't think a tree traversal would be the most optimal solution - would it be better to store references to every entity in the game in a flat data structure and loop this every game step?

sentences:
GLFW mouselook under OSX I'm continuing to port an OpenGL app from Visual Studio 2012 to XCode 5.

The only major issue I'm having is mouselook. It "doesn't work" under OSX (Mavericks).

Here's the (pseudocode):

Pre-update, executed at the start of the frame:

void Dispatcher::PreUpdate(GameTime &time)
{
    m_currentKeyboardState = m_nextKeyboardState;
    m_previousMousePosition = m_currentMousePosition;

    GetMousePosition(m_currentMousePosition);
}

Post-update, executed, well, after input processing, at the end of the frame:

void Dispatcher::PostUpdate(GameTime &time)
{
    m_previousKeyboardState = m_currentKeyboardState;

    if (m_captureMouse)
        RecenterMouse();
}

Method to recenter the mouse:

void Dispatcher::RecenterMouse()
{
    glfwSetCursorPos(m_window, m_windowSize.x / 2.f, m_windowSize.y / 2.f);

    GetMousePosition(m_currentMousePosition);

    if (m_previousMousePosition != m_currentMousePosition)
        cout << "Mouse: " << m_currentMousePosition.x << "," << m_currentMousePosition.y << endl;

    m_previousMousePosition = m_currentMousePosition;
}

And, jut for completeness:

void Dispatcher::GetMouseMotion(Vector2 &movedBy)
{
    if(m_captureMouse)
    {
        movedBy.x = (m_currentMousePosition.x - m_previousMousePosition.x);
        movedBy.y = (m_currentMousePosition.y - m_previousMousePosition.y);
    }
    else
    {
        movedBy.x=movedBy.y=0;
    }
}

If m_captureMouse is true, and m_previousMousePosition != m_currentMousePosition, the y delta is always 1, no matter how far I've moved the mouse. (Actually, using the trackpad, but should be indentical.)

This code works perfectly under Win7, but never returns anything other motion than (0,1) under OSX.

Suggestions? I've seen other questions regarding glfw and osx, but no solutions.

EDIT

It's worth noting if I turn off mouse capture (which basically does everything but recenter the mouse at the end of the frame), mouselook works correctly but, of course, the cursor is free to wander outside of the window, which doesn't really work for a first-person app.

sentences:
Cocos2d-x setContentSize, setScale give poor graphic quality I want to create sprite with size is relative to the screen size. I.e: Sprite size is equal to screen width * 0.2.

I use setContentSize and setScale but it gives ugly and poor graphic quality. I've read about multiple resolution supports, but it doesn't work on this case because i need sprite size adapt to the any screen size.

Testing on iPhone 7, i scale an image from 512x512 to 64x64.

This is error of cocos2d-x or anyway to archive it?

sentences:
storing game options in java I'm making a game using java. I'm wondering what would be the best way to store games options (like screen height and width, full screen boolean and many other similar options the user can select) at run time?

Currently, I read the options from a text file so everything that comes out of the reader is a string. I would like to add the value of the string to the appropriate variable in as few steps as possible. I would also avoid having to code getters and setters for all variables there is and have a general getter and setter that takes the name of the option as a parameter.
ex:

    public void set(String name, Object value){
        options[name] = value;
    }

    public Object get(String name){
        return (Object options[name]);
    }

I was thinking about a hashmap of variable names and values but the problem is: not all variables are of the same type, I'll have ints and doubles and booleans. so what would be the best way to store all those different variable types and access them with general calls? Should I leave them as Object and cast them as I need to use them? Or do i really have to set them all manually in my code (which would be quite the hassle should i decide to add more options down the line)?

UPDATE: So, here's the code i got so far for serialization but still not working:

Options.java:

public class Options implements java.io.Serializable{

//Final variables declaration
static transient final String SAVE_DIR = System.getProperty("user.dir") + "\\res\\saves\\";
static transient final String OPTION_FILE = "options.ser";

//Static variables declaration
public int s_width;
public int s_height;
public float fov;
private static transient Options instance;

private Options()
{
    this.s_width = (this.s_width == 0)? 800 : this.s_width;
    this.s_height = (this.s_height == 0)? 600 : this.s_height;
    this.fov = (this.fov == 0)? 60 : this.fov;
}

public static Options GetInstance()
{
    if(instance ==  null)
        instance = new Options();
    return instance;
}

Serializer.java:

public class Serializer {
private static Options o = Options.GetInstance();

    public static void loadOptions()
    {
        File dir = new File(Options.SAVE_DIR);
        if(dir.exists())
        {
            File file = new File(dir + "\\" + Options.OPTION_FILE);
            if(!file.exists())
            {
                saveOptions();
            }

            try {
                FileInputStream fileIn = new FileInputStream(file);
                ObjectInputStream in = new ObjectInputStream(fileIn);
                o = (Options) in.readObject();
                in.close();
                fileIn.close();
            } catch (IOException | ClassNotFoundException e) {
                e.printStackTrace();
            }
        }
        else
        {
            dir.mkdir();
            saveOptions();
        }
    }

    public static void saveOptions()
    {
        File dir = new File(Options.SAVE_DIR + "\\" + Options.OPTION_FILE);
        try {
            if(!dir.exists())
            {
                dir.createNewFile();
                o = Options.GetInstance();
                System.out.println("otpion.ser created and initialised succesfully!");
            }
            FileOutputStream f = new FileOutputStream(dir);
            ObjectOutputStream out = new ObjectOutputStream(f);
            out.writeObject(o);
            out.close();
            f.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

sentences:
The value of VSync on vSync Count in Unity In Unity, we can set the vSync value as "No sync" = 0, "Every V Blank" (60 fps) = 1 and "Every Second V Blank" (30 fps) = 2. But in the Unity Quality Setting documentation , it's written the vSync count value must be either 0, 1, 2, 3, or 4. What is 3 and 4 ?

You can set this vSync value on your code, the value must be either 0, 1, 2, 3, 4. But in Quality Setting in Unity, the option is only for : No Sync, Every V Blank, and Every Second V Blank. So basically only for 0, 1, and 2.

There's no option for 3,4. If we set the value on the code as 3 or 4, how should we set the value in Quality Setting Properties ? Because we need to choose a value other than No Sync for the vSync to work. How the vSync count in Properties and Code related if they accept different value ?

sentences:
Get all points of a parabola I'm wondering how to get all points (x,y) that constitute a given parabola.
It's barely to simulate a jump of an object from point A to point B.
I know:
-The coordinate of point A
-The coordinate of point B
-The coordinate of the parabola's top

What i'm trying to do is to loop from start_x to dest_x to calculate the Y-coordinate at that moment, but I don't know how to do that part.

pixels = []
for x in start_x to dest_x
   y = (calculate the Y-coord here based on x )
   pixels.push( [x,y] )
end
return pixels

My math skills are not exceptional.
Thank you.

sentences:
What is the signifigance of the Dot Product in World to Local Transformations? Looking for help understanding why this World to Local Space function works.

I'm working my way through Buckland's Programming Game AI By Example The following function is used in the book to convert a point from world space to an agent's local coordinate space (its i hat and j hat are AgentHeading and AgentSide respectively)

    inline Vector2D PointToLocalSpace(const Vector2D &point,
                             Vector2D &AgentHeading,
                             Vector2D &AgentSide,
                              Vector2D &AgentPosition)
{

    //make a copy of the point
  Vector2D TransPoint = point;

  //create a transformation matrix
    C2DMatrix matTransform;

  double Tx = -AgentPosition.Dot(AgentHeading);
  double Ty = -AgentPosition.Dot(AgentSide);

  //create the transformation matrix
  matTransform._11(AgentHeading.x); matTransform._12(AgentSide.x);
  matTransform._21(AgentHeading.y); matTransform._22(AgentSide.y);
  matTransform._31(Tx);           matTransform._32(Ty);

  //now transform the vertices
  matTransform.TransformVector2Ds(TransPoint);

  return TransPoint;
}

I've been learning about vectors and matrices for the last three weeks and still I'm having a lot of trouble understanding why this works in terms of vectors and matrices. What is the reason for using a a dot product in the translation coordinates? Why is it the dot product of the agent's position and its heading? What does this dot product correspond to geometrically?

Why not just translate by the Agent's position?

Are there any simpler ways of representing this algorithm?

sentences:
How do you execute Trigger-collider collision only in one gameobject? I'm trying to deal with units (generated from the same prefab) dealing damage to each other on collisions.
Each Unit has both a Collider2D and a trigger on the front, that deals damage to other units that enter it.

I drew a small image (with Paint, sorry) to better illustrate what I mean and want.

The problem I am having is that when a collision occurs (one unit enters the trigger of the other), both units damage each other, meaning Unit 2 also deals damage to Unit 1.

I have seen that you can create a separate gameObject as a child of the unit and attach the trigger to this gameObject.

However, the number of units will be very high so if possible I don't want to double the number of gameObjects used by units.

Also, the amount of damage dealt is calculated from many other parameters from many other scripts on the units and doubling all those references doesn't look like an elegant solution.

Any Ideas?
Thanks

sentences:
Deformable meshes based on torsional spring I am trying to learn physics-based animation thanks to the book "Foundation of Physically-Based Modelling and Animation".
They introduce the mass-spring model for deformable meshes. Although making each pair of vertices a mass-spring system would give good results, it would be too heavy to compute. So, the authors introduce another technique : between each pair of adjacent triangles, the evolution of the angle is based on a torsional spring model. I don't know if you can read it on the Google preview. It's on page 161 : https://books.google.fr/books?id=vaqdDQAAQBAJ&printsec=frontcover&dq=torsional+spring+foundation+of+physics+based+animation&hl=fr&sa=X&ved=0ahUKEwj-oPTkvobcAhVDtBQKHfj2AaYQ6AEIKzAA#v=onepage&q&f=false

I struggle to understand this model.

For instance, let's imagine we have two adjacent triangles \$ABC\$ and \$BCD\$. Let's \$ \theta \$ be the angle between both triangles. The torque is \$ \tau = k(\theta - \theta_0) \$. We want to compute the equivalent forces \$ f_{A} \$,\$ f_{B} \$,\$ f_{C} \$,\$ f_{D} \$, and torques \$ \tau_{A} \$, \$ \tau_{B} \$, \$ \tau_{C} \$, \$ \tau_{D} \$ relatively to \$ B \$.

They state that all sums must be equal to zero :
$$ f_{A} + f_{B} + f_{C} + f_{D} = 0 $$
$$ \tau_{A} +\tau_{B} + \tau_{C} + \tau_{D} = 0 $$

I don't understand why.
Can you give me some help ?

Thanks.

sentences:
Is the output from D3DCompile specific to one GPU, or not? In Direct3D 11 there is a two-stage shader compilation process; you first pass the HLSL source code into D3DCompile, which outputs a "blob" of bytecode.  You then take this blob and call CreatePixelShader or another of the CreateWhateverShader methods to finally get an object that can be bound to the D3D pipeline and used.

My question is: is the bytecode produced by the first stage machine-independent or is it specific to the GPU on which it was compiled?  I could not find a straight answer to this in the MSDN docs.  I heard somewhere that HLSL compiles to machine-independent bytecode which is then translated into GPU-specific machine code by the driver, but I have not been able to confirm this.

sentences:
Wireframe shader sometimes won't render parts depending on camera rotation I'm trying to make a stylized wireframe shader for a game using this method, but it seems to be conflicting with my character controller.
Here's some images to better show what's going on: https://imgur.com/a/f48F3lN
Basically, as I look around, some lines will disappear and reappear. It might have something to do with culling but the face is still visible, so theoretically shouldn't all the vertices still be rendered?
It would also help if you knew of a better method for doing this as well. If it helps, I'm using OpenGL with c++, and my shader code is functionally the same as what I linked to.

sentences:
Store data on server or only in database? I have been working on programming an online RPG in Java for a while now. It's a huge project and way too hard for me, but I'm having fun learning.

server and client: Java
database: MySQL

I have mainly been working on the GUI but now have started to draw a map based on the tileset returned from my server. I am now ready to grab my users coordinates from the db, but I am wondering if I should have them sitting in a temp variable on my server or just access/change the coordinates in the database.

Long story short: hit db always for lookups and changes or have a LinkedList or something on the server?

sentences:
Lighting shadow casting sprites with box2Dlights I currently have something like this using box2Dlights

Ideally, I would like objects casting shadows to be lit, so the object is lit but there is still a shadow cast around it. Right now the object is covered by shadow. I am aware of the soft and softnesslength settings in box2dlights but this is not really what I'm looking for. Softness seems to light up a certain radius from the player rather than just lighting objects. It ends up kind of weird looking:

So for example in the above picture, I would want the entire grey box to be lit, and none of the area to the left/right/behind it to be lit.

Any thoughts would be appreciated. Thanks

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:
Simulating an object floating on water I'm working on a top down fishing game. I want to implement some physics and collision detection regarding the boat moving around the lake. I would like for be able to implement thrust from either the main motor or trolling motor, the effect of wind on the object, and the drag of the water on the object.

I've been looking at the farseer physics engine, but not having any experience using a physics engine, I am not quite sure that farseer is suitable for this type of thing(Most of the demos seem to be the application of gravity to a vertical top/down type model).

Would the farseer engine be suitable? or would a different engine be more suitable?

sentences:
Channelling an explosion along a narrow passage I am simulating explosions in a 2D maze game.

If an explosion occurs in an open area, it covers a circular region (this is the easy bit.)

However if an explosion occurs in a narrow passage (i.e narrower than the blast range) then it should be "compressed", so that it goes further and also it should go around corners.

Ultimately, unless it is completely boxed-in, then it should cover a constant number of pixels, spreading in whatever direction is necessary to reach this total area.

I have tried using a shortest-path algorithm to pick the nearest N pixels to the origin avoiding walls, but the effect is exaggerated - the blast travels around corners too easily, making U-turns even when there is a clear path in another direction.  I don't know whether this is realistic or not but it is counter-intuitive to players who assume that they can hide around a corner and the blast will take the path of least resistance in a different direction.

Is there a well-known (and fast) algorithm for this?

sentences:
How can I rotate the camera for a player walking around the surface of a sphere? I'm making a 3D game where the player can walk across the surface of a planet.

I am having a problem correctly rotating the camera's frame of reference, so that the camera is oriented correctly anywhere on the planet.

My strategy so far has been to create a quaternion that represents the rotation from an "up" vector (i.e. north pole) to the current position vector of the camera:

var up = new THREE.Vector3(0, 1, 0);
camera.quaternion.setFromUnitVectors(up, camera.position.clone().normalize());

To get the final rotation of the camera, I apply the rotation of where the player is looking:

camera.quaternion.multiply(sensor.getState().orientation);

This means that wherever the player is, if they look down they will look towards the center of the planet.

I then apply that rotation to the up vector to get the direction the player is looking:

var direction = up.clone().applyQuaternion(camera.quaternion);

Assuming the player is looking directly forward, if the player travels in that direction, I would expect them to walk around the planet in a straight line.

This works correctly near the north pole, however as I approach the south pole, the camera seems to rotate laterally (from the perspective of the player), finally as I reach the south pole the camera rapidly rotates 360 degrees around the pole.

What is causing this and how can I avoid it?

sentences:
Why does Unity editor freeze up if left unfocused for a while? If Unity editor loses focus for too long (such as because I'm tabbed out into my browser or Blender), then I find that it needs about 15-30 seconds until I can interact with it again when it gets focus again. It seems like it is paused.

Is this a bug or my fault?

sentences:
Creating an unbiased deterministic collision resolution order I'm working on a game with a replay system, so I need the game logic to be deterministic. A part of this is collision detection and I'm having a bit of a conceptual problem here. (I'm programming in Python but I think my question is more general than that.)

I need collisions to be solved in a deterministic unbiased order. For example, it would be unfair if collisions would always be solved first for the red team, because e.g. they would always collide with (and thus pick up) ammo first. I can't imagine I'm the first person experiencing this problem.

The way the engine works is somewhat as follows:

Until no objects colliding:

Find overlapping objects and separate them
Add the object pair to a "collided" set (so no duplicates).

Finally:

Sort the "collided" set based on some property.
Iterate through "collided" set and tell each object pair that they collided with the other object.

Is there a way to sort the set for this final iteration while keeping it fair?

Things that won't work:

Memory location (python's default for sorting objects) because this is nondeterministic.
Internal object ID's, because these ID's are always lower for the "red team", as they are added first.
X/Y coordinates, don't give a complete sorting order, because objects can have identical positions, additionally, this is biased because the "red team" spawns at X=0.

sentences: Does Blitz3D use its own 3D engine or does it wrap OpenGL? How does Blitz3D work? I mean internally, does it use OpenGL with basic wrappers or it using some open source 3D engine that itself wraps OpenGL?

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:
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:
Phong lighting model - R vector In Phong lighting model a vector R is used to calculate the spectral component of light. The equation used to obtain it is

R = 2(N•L)N - L

I can't understand why we use this equation. Could someone give me a demonstration of how we obtain this equation?

sentences:
Best way to store game-wide variables I have an options screen for things like difficulty, resolution, full-screen, etc., but I'm struggling to find the "best" way to store/obtain these variables at run-time.

Currently, I've implemented a Constants class which contains all the GameOption enums, but how do I choose a default for all of these options? Also, how do I get the currently selected enum?

Regarding the resolution, specifically, I've decided to store the values, but I'm unsure of how to get the default, or currently stored, values. Any direction would be great; thanks! :)

namespace V1.test.RPG
{
  public class GameOptions
  {
    public enum Difficulty { EASY, MEDIUM, HARD }
    public enum Sound { ON, QUIET, OFF }
    public enum Music { ON, QUIET, OFF }
    public enum ResolutionWidth
    {
        SMALL      = 1280,
        MEDIUM     = 1366,
        LARGE      = 1920,
        WIDESCREEN = 2560
    }
    public enum ResolutionHeight
    {
        SMALL      = 800,
        MEDIUM     = 768,
        LARGE      = 1080,
        WIDESCREEN = 1080
    }
    public Boolean fullScreen = false;
  }
}

NB: I asked over at SO and they pointed me to this place. There is a comment there but I'd like to hear different ways of doing it / the most used ways.

sentences:
Anchored Unity text ...not anchoring! I've added some text to a unity UI and set both the achor and pivot to the top right corner as shown here:

When I start this in debug in unity the text looks fine:

What's weird is that when I build the app and run it as an executable as a host (this is a multiplayer networked game) the text also looks fine. But when I start a client instance the text doesn't appear.

I debugged and paused the game in unity in client mode and noticed that the text object is miles away from where I'm expecting it to be (and as a result doesn't show on the camera).

You can just about see the black line on the below image which is my level and the text anchored miles up and right of the level.

It seems like I've done something stupid here but I can't work out what :s

EDIT: Leo's answer was correct conceptually, but here's how I implemented the suggestion.

Created an empty game object GameStateManager in the hierarchy
Add a GameState script to the manager with a network identity
Added my 'RemainingTime' property to the game state script and put the [SyncVar] attribute on it
Put logic in the game state Update method to update the remaining time
Added a ClientTimer script to the text object (mono behaviour), which retrieved the GameState from within the clients copy of the game state manager.
In the update method of the client time, get a reference to the Text object and set the .text property to the value of the remaining time.

I'm not sure if this is correct, but it does seem to work, and now the ClientTimer script isn't networked, which resolved the issues with placement of the text.

sentences:
Animations in FBX exported from Maya are anchored in the wrong place We are trying to export a model and animation from Maya into Unity3d.

In Maya, the model is anchored (pivot point) at the feet (and the body moves up and down). However after we have performed the FBX export, and imported the file into Unity the model is now appears to be anchored by the waist/head and the feet move.

These example videos probably help explain the problem more clearly:

Example video - Maya - Correct
Example video - Unity - Wrong

We have also noticed that if we take the FBX file and import it back into Maya we have exactly the same problem.

It seems to be that the constraints no longer work after the FBX is reimported back to Maya, which just kills the connection between the joints and the control objects.

When we exported the FBX we have tried checking the 'bake animations' check box.

The fact that the same problem exist when importing the FBX back into both Maya and Unity suggests that the source of the problem is most likely with the Maya FBX export.

Has anyone encountered this problem before and have any ideas how to fix it?

sentences:
How do i draw sprite on fixture position? b2BodyDef bd;
    bd.position.Set(1700 / sfdd::SCALE, 150 / sfdd::SCALE);
    bd.type = b2_dynamicBody;
    b2PolygonShape squareShape;
    squareShape.SetAsBox(70 / sfdd::SCALE, 13 / sfdd::SCALE);
    m_body1 = m_world->CreateBody(&bd);
    m_body1->CreateFixture(&squareShape, 100);
    squareShape.SetAsBox(38 / sfdd::SCALE, 16 / sfdd::SCALE,b2Vec2(-54/sfdd::SCALE,-30/sfdd::SCALE),90*DEGTORAD);
    m_body1->CreateFixture(&squareShape, 20);

    squareShape.SetAsBox(30 / sfdd::SCALE, 10 / sfdd::SCALE, b2Vec2(60 / sfdd::SCALE, -20 / sfdd::SCALE), 90 * DEGTORAD);
    m_body1->CreateFixture(&squareShape, 100);

sentences:
Is there a specific name for this type of concept art and the artist who does them? Let's say you already have the fundamentals of your game: you created gameplay that you and your (possible) playtesters find enjoyable to play, and you think you can flesh out your game more. However, it's all just colorless blocks and cones at this stage. It's still just a prototype and you don't have a clear vision of how you want the game to actually look.

Before you try to glue together something compelling in your game engine, you want to create a mockup of how your game could possibly look like, just like how Bloodstained did on their Kickstarter page:

These aren't ingame screenshots, those were made before the game even started. How are these prototype images called and what are their artists called? What kind of "keywords" do I have to look for if I want to hire an artist to prototype one or multiple possible looks for my game?

sentences:
How to fix thi gameover scene audio transition? I created a gameover scene in a crafty.js project but it does not run.

  Crafty.scene('gameover', function() {
    Crafty.background("#ccc");
    Crafty.audio.stop("bg");
  });

 var gameOver = function () {
    Crafty.scene('gameOver');
  };

The background music ("bg") doesn't stop playing once the game ends. How do I fix this?

sentences:
3D collision-detection middleware (I've split this question into two. For 2D, see: 2D collision-detection middleware)

Are there any recommendable middleware available for 3D collision detection?

I believe I've heard Bullet has a pretty good 3D collision detection that can be used without the physics engine. I'd like to hear if people have any experiences on Bullet or other libraries for 3D collision detection specifically.

sentences:
Tutorial System in Unity C# I am having trouble creating a tutorial level for my game in Unity. The first problem is efficiency. I have a script below, which displays the dialogue. And I want to know the best way to create goals that the player can meet without excessive amounts of script.

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

public class TutorialSystem : MonoBehaviour
{
bool canSpeak = true;
protected StreamReader reader;
public Text Dialogue;
string sLine = " ";
public string SourceName;
string[] lines;
ArrayList arrText = new ArrayList();
int i = 0;

void Start()
{

    reader = new StreamReader("Assets/Resources/" + SourceName + ".txt");
    while(sLine != null)
    {
        sLine = reader.ReadLine();
        if(sLine != null)
        {
            arrText.Add(sLine);
        }
    }
    reader.Close();
    sLine = arrText[i].ToString();
    StartCoroutine(Typewrite(sLine));
    i++;
}

void Update()
{
    if(Input.GetButtonDown("Submit") && canSpeak)
    {
        sLine = arrText[i].ToString();
        StartCoroutine(Typewrite(sLine));
        i++;
    }
    if (Input.GetButtonDown("Submit") && !canSpeak && i == arrText.Count)
    {
        Dialogue.text = null;
    }

}

IEnumerator Typewrite(string message)
{
    canSpeak = false;
    Dialogue.text = null;
    foreach (char letter in message.ToCharArray())
    {
        Dialogue.text = Dialogue.text + letter;

        yield return new WaitForSeconds(0.01f);
    }
    canSpeak = true;
    if (i == arrText.Count)
    {
        canSpeak = false;
    }
}

}

The second problem is how to I make it expandable, currently the text reads a .txt file line by line. Does anyone have a suggestion on how I can change this to be used in situations such as character interaction or should I just make another script entirely for that?

Many thanks in advance.

sentences:
TexturePacker ignores extensions I'm using TexturePacker in one of my games, though when packing a bunch of textures their extension is kept in the data file. So when I want to find a texture I need to search for "image.png" instead of just "image". Is there an option to let texture packer ignore the extensions of my source images in the data file?

Solved:

So if anyone else wants this, here's the exported I made: https://www.box.com/s/bf12q1i1yc9jr2c5yehd Just extract it into "C:\Program Files (x86)\CodeAndWeb\TexturePacker\bin\exporters\UIToolkit No Extensions" (or something similar) and it should show op as an exporter.

sentences:
Good book or tutorial for learning how to apply integration methods I'm looking to animate a graph layout using edges as springs and nodes as weights (a node with more links will have a bigger weight).

I'm not capable of wrapping my head around the usage of mathematical and physics relations in my application.

As far as I've read, Runge Kutta 4 (preferably) or Verlet will be a good choice, but I have problems with understanding how they really work, and what physics equations I should apply.

If I can't understand them, I can't use them. I'm looking for a book or a tutorial which describes the things that I need.

sentences:
How can I detect continuous touches/pressed with Unity 4.6's UI elements? I've recently switched to Unity 4.6. My previous workflow when creating continuous-input controls (the kind where you measure continuous touch input on a single button) was to create a GUITexture and then perform hit-testing on that texture as long as a finger was touching the screen.

With the new GUI there seems to be no way to measure this type of input, as GUITextures objects can no longer be created and the new UI types don't support hit testing.

I'm talking about a button that's supposed to act like a car accelerator where, for example, a simple OnClick() doesn't work because I need to measure if the button is being pressed continuously rather than it working as an on/off toggle. How can I implement this?

sentences:
Input events slow on unity Update function I have this running on the Update() on Unity.  I am trying to create a page swipe feature on my game, but the problem is there is a half second delay when printing "dragging" to "end drag" when I release the mouse.

Does anyone have a method that will register input events faster?

void Update()
{
    if(isDragOn)
    {
        if(Input.GetMouseButton(0))
        {
            print ("dragging");
            //moveContainers((Input.mousePosition.x - mouseLastPosition) * 0.01f);
            mouseLastPosition = Input.mousePosition.x;
        }
        else if(Input.GetMouseButtonUp(0))
        {
            print ("end drag");
            isDragMoved = false;
            isDragOn = false;
            endDrag();
        }
        else if(Input.touchCount > 0)
        {
            if(Input.GetTouch(0).phase == TouchPhase.Moved)
            {
                //moveContainers(Input.GetTouch(0).deltaPosition.x);
            }
            else if(Input.GetTouch(0).phase == TouchPhase.Ended)
            {
                isDragMoved = false;
                isDragOn = false;
                endDrag();
            }
        }
    }
}

sentences:
Is there a way to specify normals as per-face instead of per-vertex in Unity? The documentation says that mesh.normals

  are assigned to vertices, not triangles.

I've got a somewhat detailed mesh where faces are joining at right angles. If I don't set the normals, everything takes on a kind of metallic appearance. If I set the normals on the vertices, though, then I have to specify which face I'm using and then the edges are very rounded.

I don't mind making separate meshes for each surface, but it seems kind of a waste to not share the vertices. Is there a way to specify per-face normals instead of per-vertex?

sentences:
XNA Multiple Key Input I'm using the KeyboardState state way (if there are any others) of handling key presses for a PC game. It has been working fine for single key presses but now I am trying to handle multiple key presses at once.

I have it grab the newState at the top and then save it to the oldState at the bottom. I've tried it this way:

if (newState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D2) && newState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt))
{
    if (equipment_accessory2 != null)
        UseItem(equipment_accessory2, "Accessory 2");
}

And I've also tried:

Microsoft.Xna.Framework.Input.Keys[] currentPressedKeys = newState.GetPressedKeys();
bool altPressed = false, twoPressed = false;
for (int i = 0; i < currentPressedKeys.Length; i++)
{
    if (currentPressedKeys[i] == Microsoft.Xna.Framework.Input.Keys.LeftAlt)
                altPressed = true;
    else if (currentPressedKeys[i] == Microsoft.Xna.Framework.Input.Keys.D2)
                twoPressed = true;
}

...

if (altPressed)
{
    if (equipment_accessory2 != null && twoPressed)
        UseItem(equipment_accessory2, "Accessory 2");
}

Both ways work to a certain degree. The end result is that you're able to press alt and then a key between 1 and 5 to quick use a consumable. Normally you have skills in those slots so holding down alt makes the skills you have bound disappear and instead shows your quick use items.

The problem I'm having is that no matter what I have tried, the only way it works is that you have to hold 2 then hold alt. If you hold alt first and press/hold 2 it does nothing and doesn't work. I have spent 4 or 5 hours trying to figure out why it only works when you hold down 2 and then press alt. The problem with having it only work this way is if they have a skill bound to 2 then they're going to use the skill so the system is supposed to be to hold down left alt to swap the skill bar to the quick use bar.

I can't figure out why both ways I've tried doing multi key input aren't working when I press alt first.

EDIT: ok it must be something with my keyboard because alt+1 works but 2, 3, 4, and 5 don't work.
EDIT2: restarted and 2-5 work now too, was something with my keyboard apparently.

sentences:
js canvas tiled map - for loop, while, or matrix I am making a top-down view tiled map in canvas, where player is always in the middle of the screen, and map scrolls depending on where you go, like in moba games. I also want it to loop infinitely in every direction.

That means that when I cross the top border of the map I should end up at the bottom of the map, when I cross the left side of the map I should end up on the right side, etc. At the same time I only want the part visible on screen to be rendered.

Normaly I would just use for loop, but in cases when I am at the border, or corner of a map, and I need to display the same map, but the other end of it, it gets complicated with lots of nested loops.

I could make the map as math.matrix, and do multiple operations to fragment it and arrange so that it represents only the part visible on screen, like so:

So when I am at one of bottom tiles for example and I am at the center of the screen, I will need to fill the bottom with top tiles, and since the map is bigger than what is displayed on screen I would need to also extract only part of it to render.

But that would require a few math functions each draw, and I wonder if it is ok to do it.

It is hard to explain, especially in a language that is not my native, but I hope that someone will help me.

What is the right way to do it?

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:
how to solve slow framerate (how to solve situation when user uses computer much slower then minimum requirement) We have some minimum requirements set for the game, however, it's possible to play the game on much slower computers and we argue in the team how to approach the situation when the hardware is too slow to run the game the way it's meant to run.

We generally have three ideas:

run benchmark in the beginning and if the computer won't pass it inform the player he can't play, he should update drivers etc,
under certain framerate pause the game and ask the player to disable thing running in background or update drivers etc.

(1. and 2. can be combined)

under certain framerate slow the game down - so let's say the game should run on 60 FPS and between 60 and 20 the speed will be normal and if it goes lower than 20 fps it will progressively slow down so the player sees the same amount of frames as it'd run at 20FPS

In our case, the game looks pretty bad when we simulate 10 FPS and less and it isn't nice under 20.

Is there any common approach to this?

sentences:
Problem with Input.GetKeyDown to set a counter in Unity: multiple values in only one pressing Using Unity 5, I want to use have one keyboard key ("f") increase a counter when pressed. It means, using Input.GetKeyDown("f") function in a way that: if "f" is pressed when the counter=1, then the counter is set to be equal 2. If counter was equal 2 when "f" is pressed, then counter is set to 3.

However, it does not work properly: it seems that Unity detects the key being pressed many times, no matter if it was only pressed once. See the code that illustrates the situation:

using UnityEngine;
using System.Collections;

public class TestingKeyGetRecursion : MonoBehaviour {

int counter = 1;

void Update () {

    if(counter == 1 && Input.GetKeyDown("f"))
    {
        counter = 2;
        Debug.Log(counter);
    }
    if(counter == 2 && Input.GetKeyDown("f"))
    {
        counter = 3;
        Debug.Log(counter);
    }
    if(counter == 3 && Input.GetKeyDown("f"))
    {
        counter = 1;
        Debug.Log(counter);
    }
}

void OnGUI()
{
    GUI.Label(new Rect(30, 10, 250, 20),  "counter: " + counter.ToString());
}
}

As you can see in the console if you run the above example, the values are properly set into the counter variable and printed in the console. However, it happens several times in the same key-hit and, in the end, the counter ends up equal as it started, i.e. equal 1.

Can anyone please explain:

1) why does the Engine behave like that;

2) is there a way to solve such situation? I cannot substitute the counter with a bool variable and just do "counter != counter" when "f" is pressed.

sentences:
Ball vs 45-degree slope collision detection I have a simple game in which the player moves a ball around. The ball bounces off of walls. Right now I have square walls(■) implemented: I use simple bounding-box collisions to check if the player will move into a wall when updating its x or y speed and if so, I multiply that speed with -1 to make them bounce.

However, I also want to implement triangular pieces(◢◣◤◥). To bounce back I believe one can simply use:

   newxspeed = -1*yspeed;
   newyspeed = -1*xspeed;

However, what I am having trouble with is the collision detection: When does the player hit the diagonal?

sentences:
How can I make a spline out of three points that define a circular arc? I was looking at the descriptions of various curve techniques here and noticed the mention of circular arcs. I want to implement something like this, but I'm not quite sure what the correct formula to use is. I can easily find formulas for Bezier or Hermite curves, but when I search for circular arc splines or circular arc interpolation I get a lot of ultra technical articles that are far beyond what I need. My hunch is that I take the angle formed between the endpoints and the control point and use that radius, but I'm still a little too wobbly conceptually to be able to guess a formula.

For those who cannot follow the link, the circle data is given by a starting point and end point which lie on the circle as well as a control point which is used to control the angle.

What formula can I use to interpolate over and approximate an arc of a circle given these three points?

sentences:
Circular Dependencies in an Entity Component System I'm developing a top-down shooter in C++ using an entity-component system, and have run into a problem when attempting to refactor powerups. Currently I have a PowerupSystem that is essentially a load of if...else statements that directly modifies player entity attributes (for example speed).

I'd like to move towards using different powerup classes that inherit from a base PowerupComponent class that encapsulate powerup behaviour. An example of this would be SpeedPowerup. These derived classes would have a constructor that changes a value in the player entity, and a destructor that sets it back to its original value.

The problem I'm having is that the powerup constructors and destructors need access to the player entity data to make these changes (stored in my World class), giving me a circular dependency issue.

The dependency is:

world -> powerup system -> powerup -> world

Any ideas on how I could overcome this issue are appreciated.

Thanks in advance,
Rich.

sentences:
Multiplayer Network Game - Interpolation and Frame Rate Consider the following scenario:

Let's say, for sake of example and simplicity, that you have an authoritative game server that sends state to its clients every 45ms.  The clients are interpolating state with an interpolation delay of 100 ms.  Finally, the clients are rendering a new frame every 15ms.

When state is updated on the client, the client time is set from the incoming state update.  Each time a frame renders, we take the render time (client time - interpolation delay) and identify a previous and target state to interpolate from.  To calculate the interpolation amount/factor, we take the difference of the render time and previous state time and divide by the difference of the target state and previous state times:

var factor = ((renderTime - previousStateTime) / (targetStateTime - previousStateTime))

Problem:  In the example above, we are effectively displaying the same interpolated state for 3 frames before we collected the next server update and a new client (render) time is set.

The rendering is mostly smooth, but there is a dash of jaggedness to it.

Question:  Given the example above, I'd like to think that the interpolation amount/factor should increase with each frame render to smooth out the movement.  Should this be considered and, if so, what is the best way to achieve this given the information from above?

sentences:
Sharing functions across multiple shaders Simple question:

In GLSL, is there a way to share functions across multiple shaders, or do I have to define all functions in every shader that needs them?

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 imbue an ability system with information about how abilities interact and can be targetted? I am making a turn based game where player chooses a team of heroes with specific abilities for each of them. (ex. stun one enemy, deal 20 damage to all enemies, heal 10 HP to one ally,...)
The design right now is that every non-instant effect (direct heal and damage are instant) is placed as a buff/debuff on the hero. So once a spell affects an enemy it can apply a stun for 2 turns or a DoT for 3 turns, etc.

My problem is that whenever you click on an ability in the GUI, the game should show you who you can target, but enemies can have immunities to certain effects like immune to stun or immune to damage.
My first thought was to make an interface AbilityStun and then once I start checking for viable targets check in the immunity buff if the ability is an instance of a stun and if yes, don't show it as a viable target.

But I soon realized this is a bad solution because I have an ability which damages my own team member and stuns an opponent and it would show him as not viable. Or I want to apply a debuff that will disable healing abilities. Or I want to stun and deal damage.
Suddenly interfaces piled up and I would end up with 50 of them and a systems that feels like a hack.

I am pretty sure there is a better way of doing this but I simply can't figure it out even after looking through other similar articles. Maybe you guys (and girls) who are more experienced can be of more help and point me in the right direction.

Thank you for your help.

EDIT:

Current Solution

So I created a system based on CamH's answer. I have an ability which has information like cooldown, manacost, target, etc. and I added a group of effects to it. Effects can be either stun effect, heal effect, or any other effect in the future with required parameters like heal amount or stun duration as part of the effect.

Most importantly the effect has a group of checks that know what to look for in a group of buffs/debuffs and returns true/false based on whether the target passes the test.

Example: Hero A wants to cast a stun and damage spell on Hero B who is immune to stun. On target selection the Stun effect performs a check against Hero B's buffs and returns false since he is immune. The Damage check passes and since at least one check passed Hero B is a valid target.
After the ability lands every effect is applied separately and checks are performed again this time the stun won't apply and the damage takes place.

The system is more complex than this but this part shows how I solved my problem with targeting and applying abilities.

sentences:
Authoritative Server Movement and Collision I am attempting to write a proof of concept in preparation to do my first networked game. I have decided to do an authoritative server with client side prediction.

I am trying to implement my architecture like this diagram from an excellent article on the subject

In the article, the data that is synchronized is the player's position. This works great for turn based games, but what about real time games?

In my game, each entity has a position and a velocity vector. It is the server's job to detect collisions. I have attempted to send the server velocity changes, but I am having an issue where the server's position and the client's position begins to diverge because their clocks are not perfectly synchronized.

So my question is, is it standard practice to send positions as the synchronized state between a client and server instead of a velocity vector? Will changing to synchronizing positions instead of velocities open my game up to cheating? Is there a better way to synchronize the players' states with the server?

Also, if I use positions, doesn't that mean that the other players are going to be seen in a past state? Will that mean that the server might send a player killed message before the collision is visible to the player in the present?

sentences:
Do i need to integrate leader-board and achievement in my game and then publish in alpha testing for google play? I'm confused about whether I need to publish my .apk file on Google Play Console with or without achievements and leaderboard.

If I publish the game without achievements and leaderboards, then, how can I integrate the google play service at a later date?
The first thing I saw was that I should go for alpha publish. Is that necessary?
If I do publish the alpha version for the game without including achievements and leaderboard, how can I add these later? In this video, first the game is published without the achievements/leaderboard, and later he integrates them. So how does it show results since we didn't include these buttons for leaderboard and achievements?

sentences: How could I remove part of a Terrain Collider? After reading through this site, I began to think on how could I remove the colliders of vertexes with a transparent texture on it? I had read a suggestion  (forgot where it was) to disable the whole terrain collider, but I also have NPC's, so having them plumet through the map wouldn't go over well.

sentences:
How to apply blur effect to 2D textures using shaders? I'm making a 2D game in Monogame and I'd like to learn how to apply the blur effect for layers that are "out of focus" in the deep background or very close in the foreground using shaders.

By manipulating the bitmap array of a Texture2D (it's pretty slow), I figured it would be better to draw each layer onto its own Texture2D and blur the whole thing instead of blurring individual textures. But then I learned there are shaders which are supposed to make this much faster. I've never used shaders for anything yet. How would I use shaders for the blur effect?

Most of the shader tutorials for monogame/xna I've seen so far deal only with 3D or do something I don't understand in 2D which doesn't seem to do the blur effect.

Following DMGregory's suggestion in the comments, I decided to try the second shader which is:

// Pixel shader applies a one dimensional gaussian blur filter.
// This is used twice by the bloom postprocess, first to
// blur horizontally, and then again to blur vertically.

sampler TextureSampler : register(s0);

#define SAMPLE_COUNT 15

float2 SampleOffsets[SAMPLE_COUNT];
float SampleWeights[SAMPLE_COUNT];

float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 c = 0;

    // Combine a number of weighted image filter taps.
    for (int i = 0; i < SAMPLE_COUNT; i++)
    {
        c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
    }

    return c;
}

technique GaussianBlur
{
    pass Pass1
    {
#if SM4
        PixelShader = compile ps_4_0_level_9_1 PixelShaderF();
#elif SM3
        PixelShader = compile ps_3_0 PixelShaderF();
#else
        PixelShader = compile ps_2_0 PixelShaderF();
#endif
    }
}

Populating it with some random floats and Vector2s in the range from 0 to 1, then 0 to 100, then -100 to 100 and it just doesn't produce any effect. I tried moving the line blurEffect.CurrentTechnique.Passes[0].Apply(); before and after all the drawing methods and in-between, but nothing happens.

I had trouble loading it at first but then I figured it out with the content folder thing, so that doesn't seem to be the issue, or else it would probably throw an exception on the loading methods.

I've seen the exception for setting the effect parameters  incorrectly, so seems like I'm doing that right too. I think the problem might be with the values themselves. I don't know what I'm supposed to use there and why the 15 samples and not some other number.

Ideally I would like a complete noob guide to shaders on this one example of gaussian blur applied to everything (or only to certain background textures).

sentences:
Top-down conveyor belt with Box2D I'm trying to code a conveyor belt for a project made with LibGDX and Box2D and I would like to make it like this one from Bomberman Land Touch.

As you can see, the entities standing on it should be able to go in the opposite direction moving slower, the ones not moving should just be transported towards the direction of the belt, and the ones going along its direction should go faster.

For a single direction belt I first detect when the center of an entity's body is inside the block, and then with body.applyLinearImpulse(direction) I move the body. This is working fine because it's applying a lower impulse than the one that the player uses to move and by checking the center of the entity instead of relying on the collide event, when the body is between two belts, it doesn't receive two impulses. This is the outcome:

I see two problems with that: the obvious one is that since it's checking the center of the body, as soon as it's in a belt with a different direction, it instantly changes direction without going to the center of the block. The other one is that while going backwards in a turn, it does a little "jump" due to the previous impulse.

I also tried to replicate the Bomberman mechanism by diving the corners into two fixtures but the result is quite the same (except a bug where the player doesn't move, probably because the center doesn't touch the next half of the block):

How can I mitigate these two problems or how can I rethink the whole structure/mechanism of the block?

Edit:
I tried to implement the first part of @Theraot answer with this code:

if (active) {
        for (Entity e : entities) {
            // Check if the origin of the entity is inside the block
            if (getBody().getFixtureList().get(0).testPoint(e.getOrigin())) {
                // Take the x of the entity center if the inputDirection is horizontal, y otherwise
                float entityAxis = inputDirection.y == 0 ? e.getOrigin().x : e.getOrigin().y;
                // Same for the conveyor block
                float blockAxis = inputDirection.y == 0 ? getOrigin().x : getOrigin().y;
                Vector2 impulse = null;
                // If they are really close
                if (Math.abs(blockAxis - entityAxis) < 0.1f) {
                    impulse = outputDirection;
                }
                else {
                    impulse = inputDirection;
                }
                // Apply the impulse
                e.getBody().applyLinearImpulse(impulse, e.getBody().getWorldCenter(), true);
            }
        }
    }

and this is the result.

sentences:
What tool should I use for drawing 2D OpenGL shapes? I'm working on a very simple OpenGL ES 2.0 game, and I'm not sure what tool to use to create the vertex data I need. My first thought was adobe illustrator, but I can't seem to find any info on how to convert an .ai file to vertices. I'm only going to be using very simple 2D shapes so I wonder if I need to use a 3d modelling program?

How is this typically done, when you are working with 2D non-sprite shapes?

sentences:
Realtime inverse kinematics on unity apps for android and iOS Hello I want to understand how much overheads do implementing inverse kinematics in realtime add.

I am looking at an implementation as such demonstrated in the video. https://www.youtube.com/watch?v=Gyakxv34404&feature=youtu.be

Let me explain the exact requirement now.

Assuming a game of mario, where mario is a 3D Character. And there is a coin placed at a height. So when mario comes into area of effect for the coin, we know the initial position of his arms, and we know the expected final position which is the position of the coin.

So we create a trajectory from initial to final position in realtime and the main character moves accordingly in the trajectory.

Now I can understand this would work fine in editor but if we have exported the game and this computations happen realtime for every object, how much CPU intensive would this be? Do all the existing IK assets provided on store

for example in this video of final IK https://www.youtube.com/watch?v=ZuWvGq3yV44 the characters are following the trajectory in real time I suppose. But what if we were to create the trajectory realtime depending on player positions, would that be a CPU intensive task to NOT work on mobile devices?

sentences:
How can I implement smart scripting, in my game? I'm developing a game engine. It is supposed to be an entity/components based one. For developing my game, itself, I thought to use some scripting language to actually create the entities.

For example, if I want to add a kind of monster that is aggressive to the player, it will be an entity with several components; those components will change with the monster type, so if I have one hundred different types of monsters, in my game, I will not have to create a new method for each of them straight in my game code.

Should I use a scripting language to describe this entity, in term of components or is there something else that would work better? More generally, how should I use scripting, in my game?

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:
Detecting collision on a grid with a fast-moving object I am working in a 2D collision system where I need to detect a collision of a rectangle on a grid, but since the rectangle may be fast enough to jump more than one of the grid squares (sometimes several) I need to check collision of everything in the middle of point A to B.

Does anyone know a way to achieve that?

In the image below, I am starting at point A and in one update it's at point B. I would need to check collision on the whole gray area. As you can see in the image, the rectangle don't need to be on a fixed position on the grid.

The grid squares in my case have 30x30 pixels and the rectangle has 35x65. My grid is also on a list, but this can change if needed.

Thank you in advance for any help.

sentences:
Sending changes to a terrain heightmap over UDP This is a more conceptual, thinking-out-loud question than a technical one. I have a 3D heightmapped terrain as part of a multiplayer RTS that I would like to terraform over a network. The terraforming will be done by units within the gameworld; the player will paint a "target heightmap" that they'd like the current terrain to resemble and units will deform towards that on their own (a la Perimeter).

Given my terrain is 257x257 vertices, the naive approach of sending heights when they change will flood the bandwidth very quickly - updating a quarter of the terrain every second will hit ~66kB/s. This is clearly way too much.

My next thought was to move to a brush-based system, where you send e.g. the centre of a circle, its radius, and some function defining the influence of the brush from the centre going outwards. But even with reliable UDP the "start" and "stop" messages could still be delayed. I guess I could compare timestamps and compensate for this, although it'd likely mean that clients would deform verts too much on their local simulations and then have to smooth them back to the correct heights. I could also send absolute vert heights in the "start" and "stop" messages to guarantee correct data on the clients.

Alternatively I could treat brushes in a similar way to units, and do the standard position + velocity + client-side prediction jazz on them, with the added stipulation that they deform terrain within a certain radius around them. The server could then intermittently do a pass and send (a subset of) recently updated verts to clients as and when there's bandwidth to spare.

Any other suggestions, or indications that I'm on the right (or wrong!) track with any of these ideas would be greatly appreciated.

sentences: Is it okay for UVs to touch border? As a matter of habit I always shrink UVs to just below the full texture space, even for single island things like sprites. Can I have my UVs touching the actual border or is this bad practice?

sentences:
Creating a game with in game programmable AI I am looking to make a game where the player can access an in game terminal and then use this terminal to write AI logic in a programming language such as C++ or C#, then they can compile the code and apply the AI to NPC characters.

Of course if the code failed to compile error free then it would not be applied to the NPC. Mostly the code would be function calls with a few basic constructs available like int, float, bool etc.

My question is how could I achieve this in say Unity or another game engine. Would I need to use a scripting language such as LUA or Python to create the AI or could I be done in real time on a separate thread in Unity somehow?

sentences:
Reinhard tone mapping and color space I found two ways of doing tone mapping (first, second):

//Ld - this part of the code is the same for both versions
float lum = dot(rgb, vec3(0.2126f, 0.7152f, 0.0722f));
float L = (scale / averageLum) * lum;
float Ld = (L * (1.0 + L / lumwhite2)) / (1.0 + L);
//first
vec3 xyY = RGBtoxyY(rgb);
xyY.z *= Ld;
rgb = xyYtoRGB(xyY);
//second
rgb = (rgb / lum) * Ld;

For an example pixel data above equations produces different results. Which way is correct ?

sentences:
How to throw b2body with various speed at fixed position? Above image is for ref to better representation.

I have box2d object and i know start point & end point position.

Now i want to give any force or impulse such that b2body will first collide at end point BUT with different speed also should collide at that same end point.

How should i achieve this?

sentences:
How do I get the proper swapchain enumeration for getting the backbuffer? I have code that I'm trying to update from DirectX 8, and so far I have been doing just fine until I reached this line of code:

r = g_pDevice->GetBackBuffer(/*,*/ 0, D3DBACKBUFFER_TYPE_MONO, &pBackSurf);

Because of this I decided to look up the changes that were made between DirectX 8 and DirectX 9 regarding GetBackBuffer, and found that it needed a parameter called iSwapChain. What it's asking for is the swap chain ordinal value, and referred me to D3DCAPS9's code - more specifically the Number of Adapters in Group variable.

Of course I want to have the correct value to correspond with whatever ordinal would give me the proper backsurface to write stuff to (i.e. the last-to-render backsurface in the chain) but that information is elusive and when I was guided to DCAP.NoAiG it doesn't lead me anywhere else.

How do I get the proper swapchain enumeration for getting the backbuffer?

sentences:
What language and tools are good to start with for Linux game development? I would like to start learning about game development and I would like to do it using Linux. My main experience has been with Java and a bit of C++, but that was for applications and not games.

Now that I want to try with gaming, I'm wondering which IDE/language should I use in Linux, whether I should go with C++ and compiling files manually at the beginning, or maybe continue with Java/Eclipse, also I think I can use Eclipse with C++, I have also started reading about Python...

I was thinking in starting with the typical "Tetris" just to understand how a game works internally, and I think I can achieve that with all the previous options, but what do you recommend me or how have you started game developming under Linux?

sentences:
OpenGL ES 2.0. Sprite Sheet Animation I've found a bunch of tutorials on how to make this work on Open GL 1 & 1.1 but I can't find it for 2.0.

I would work it out by loading the texture and use a matrix on the vertex shader to move through the sprite sheet.

I'm looking for the most efficient way to do it. I've read that when you do the thing I'm proposing you are constantly changing the VBO's and that that is not good.

Edit:
Been doing some research myself. Came upon this two Updating Texture and referring to the one before PBO's. I can't use PBO's since i'm using ES version of OpenGL so I suppose the best way is to make FBO's but, what I still don't get, is if I should create a Sprite atlas/batch and make a FBO/loadtexture for each frame of if I should load every frame into the buffer and change just de texture directions.

sentences:
Is it possible to generate a Spheremap from a Texture2D in Unity at run-time? I was trying to create a spheremap from a Texture2D for a skybox at run-time (Standalone build) in Unity. Does anyone know if this is possible and how to do that in Unity?

In the editor you can set a texture to a cubemap and then select it's import setting as a spheremap, but I can't find a way to do this at run-time using the Unity API.

sentences:
How would I go about adding a tooltip to a Unity UI Image? I'm going to try out the community here once more, I haven't had very good look in the past with getting help.
I'm iterating through a series of List() and I'm creating a bar graph and a line graph based on those values, Later I'll replace the List with a file which it retrieves the values from. I'm having a problem though with creating a tooltip. I know how to add them to buttons created under OnGui() but that's about it. I've spent the past 2 days trying to figure this out and I'm just not sure how to go about making the bar images and dot's show up under public void OnPointerEnter(PointerEventData eventData) {} and OnPointerExit()
I know that print(eventData.pointerCurrentRaycast.ToString()); will display the item I'm hovering over and it seems to work fine for everything except the GameObjects that are created by my script:
        private GameObject CreateBar(Vector2 graphPos, float barWidth)
    {
        GameObject gameObject = new GameObject("bar", typeof(Image));
        gameObject.transform.SetParent(graphContainer, false);
        gameObject.GetComponent<Image>().color = barColor;
        RectTransform rectTransform = gameObject.GetComponent<RectTransform>();
        rectTransform.anchoredPosition = new Vector2(graphPos.x, 0f);
        rectTransform.sizeDelta = new Vector2(barWidth * barWidthMultiplier, graphPos.y);
        rectTransform.anchorMax = new Vector2(0, 0);
        rectTransform.anchorMin = new Vector2(0, 0);
        rectTransform.pivot = new Vector2(.5f, 0f);

        return gameObject;
    }

If anyone could give me a hand on how to make this show up under eventData I can figure the rest out from there. Or if you have a better method you wouldn't mind sharing I would appreciate that.

sentences:
Get the up vector of the camera in ARKit I'm trying to get the four vectors that make up the boundaries of the frustum in ARKit, and the solution I came up with is as follows:

Find the field of view angles of the camera
Then find the direction and up vectors of the camera
Using these information, find the four vectors using cross products and rotations

This may be a sloppy way of doing it, however it is the best one I got so far.

I am able to get the FOV angles and the direction vector from the ARCamera.intrinsics and ARCamera.transform properties. However, I don't know how to get the up vector of the camera at this point.

Below is the piece of code I use to find the FOV angles and the direction vector:

func session(_ session: ARSession, didUpdate frame: ARFrame) {
  if xFovDegrees == nil || yFovDegrees == nil {
    let imageResolution = frame.camera.imageResolution
    let intrinsics = frame.camera.intrinsics
    xFovDegrees = 2 * atan(Float(imageResolution.width) / (2 * intrinsics[0,0])) * 180 / Float.pi
    yFovDegrees = 2 * atan(Float(imageResolution.height) / (2 * intrinsics[1,1])) * 180 / Float.pi
  }

  let cameraTransform = SCNMatrix4(frame.camera.transform)
  let cameraDirection = SCNVector3(-1 * cameraTransform.m31,
                                   -1 * cameraTransform.m32,
                                   -1 * cameraTransform.m33)
}

I am also open to suggestions for ways to find the the four vectors I'm trying to get.

sentences:
Uniforms stop working when loading multiple programs via glUseProgram() The rendering keeps happening, and the debugger shows my camera is getting its position updated properly, but for some reason the camera doesn't appear to have its position updated. I'm not sure what I'm doing wrong.

Can uniforms fail to get set when swapping between different programs/shaders?

sentences:
How do I avoid losing prediction responsiveness due to client interpolation? In my online game, I am using client prediction and client interpolation to give the illusion of responsiveness over a networked connection.

The client prediction applies inputs that haven't yet been acknowledged by the server to incoming server states. When the input is acknowledged, the client's entity will already be in the final position.

The client interpolation works by buffering world snapshots and rendering the entities 100 ms in the past. While new snapshots arrive within the next 100 ms, there will always be valid data to interpolate between.

My problem is that the responsiveness gained from client prediction is lost due to client interpolation. The client's local inputs are applied to incoming server states. However, those incoming states aren't actually rendered on the client until 100 ms later, due to the client interpolation. The result is that there is always a 100 ms lag between pressing a key and rendering the change to the screen.

How can I get the best of both worlds, rendering entities in the past, but rendering the client's inputs instantly?

sentences:
Setting Orientation of Character in Bullet/Ogre I've been suffering from an issue regarding the implementation of orienting characters in a game I'm implementing using Ogre3D and Bullet physics.

What I have: A Direction Vector that the character is moving in, along with its current orientation.

What I need: To set the orientation of the character to face the way it is moving.

I have a snippet of code that sort of does what I want:

btTransform src = body->getCenterOfMassTransform();
btVector3 up = BtOgre::Convert::toBullet(Ogre::Vector3::UNIT_X);
btVector3 normDirection = mDirection.normalized();
btScalar angle = acos(up.dot(normDirection));
btVector3 axis = up.cross(normDirection);
src.setRotation(btQuaternion(axis, angle));
body->setCenterOfMassTransform(src);

Where 'body' is the rigidbody I'm trying to orient.

This snippet has a couple of problems however:

1) When changing direction, it tends to 'jitter' i.e. it rapidly faces one way, then the opposite for a second or so before correcting itself to the orientation it is supposed to be at.

2) Most times that the code is run I get an assertion error from Bullet's btQuaternion on

assert(d != btScalar(0.0));

Can anyone help?

Thanks!

sentences:
Building a simple bomberman game with Node.js and Socket.io I'm building this game mostly because I want to experiment with Node.js and Socket.io, and the game is more like a proof of concept.

To start with, I have a 2D grid system as the game map.

_________________________________________.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|.

Each position with values:

0: empty
1: wall - can not be destroyed by explosion
2: obstacles - can be destroyed by explosion
3: bomb
4-9: some powerups
10>=: the id of player

CLIENT-SIDE

I'm not planning to have any game logic happen on the client side, so the client simply send left, right, up, down and plant a bomb command to my server. There is however, some simple check that happen on the client side - 1. check that there's no wall at the direction the client is moving to; 2. the client didn't plant a bomb in the last 3 seconds.

The client also receives the state of the map as a 2d array and knows how to draw everything using that info.

SERVER-SIDE

Main game logic happen on the server side, which includes updating the position of player, calculating the damage of bomb explosion - destroy stuff in the range, except walls and space behind walls

Questions:

When the player is moving, he won't see himself moved until he gets the data back from server that updates his position. So I worry this delay may affect user experience, is it better that I move his position on his browser right away, and only update other players' position using info received from server, that means his own movement is rendered away, while his position info is sent to server.
When rendering everything, it's simple to implement that whenever anything on the map move or change, redraw everything with the new data. Is that a waste? Can I only update things that change, for example, a player move right 1 position, nothing else changed on the game map, do I still have to redraw everything? I think I'm going to use Canvas to render.
Please feel free to comment or answer if you think there are places I can improve or I simply thought wrong, thanks!

sentences:
Render scene twice in OpenGL, overlay second render with tranparency Is it possible to render two scenes (same scene with different setups) without any alpha, and after that is done just overlay the result from the second render on top of the first layer with a static transparency?

And how do I do it? I want it fast so the transparency should not be implemented
during rendering, only on the final overlay process.

Basically I am asking for an efficient OpenGL post-processing method to combine the two different renders when drawing to screen.

sentences:
I want to blit a standing man on pygame I was making a game with pygame and python and I wanted to blit an image of a standing man and when a right key is pressed I want the man to run and when the right key is released I want the man to stand again... I tried to make it like that but couldn't work... here's the code I tried

import pygame
from pygame.locals import *
from sys import exit

pygame.init()

screen = pygame.display.set_mode((600,600))
pygame.display.set_caption('running man')

image_1 = pygame.image.load('standing-man.jpg')
image_2 = pygame.image.load('running-man-1.jpg')
image_3 = pygame.image.load('running-man-2.jpg')

move_x = 0
x = 0

clock = pygame.time.Clock()

while True:
    running_man = [0]
    #creates a loop and make the image look like its running by swithching the two man images
    for man in running_man:
        screen.fill((255,255,255))
        x += move_x
        #first i want a standing man to be seen on the screen and when a right key is pressed i want the other two images to blit on the screen
        if man == 0:
            screen.blit(image_1,(x,100))
        if man == 1:
            screen.blit(image_2,(x,100))
        if man == 2:
            screen.blit(image_3,(x,100))
        pygame.display.update()
        clock.tick(7)

        for event in pygame.event.get():
            if event.type == QUIT:
                exit()
            if event.type == KEYDOWN:
                if event.key == K_RIGHT:
                    move_x = +1
                    #here i want the variable running_man to be 1,2 so to blit the otherr images and remove the standing man image
                    running_man = [1,2]
            if event.type == KEYUP:
                if event.key == K_RIGHT:
                    move_x = +0
                    #when the right key is released i want the value of the variable running_man to be 0 again so to blit the standing man image again
                    running_man = [0]
        pygame.display.update()

sentences: How to make a triangle move and rotate using GDI in C++ I want to make a triangle move from one place to another then rotate it 270 degrees using Polygon() function does anyone knows how to?? Just a simple one.

sentences:
Designing an RPG damage type system I made this thread to gather what the majority of RPG players like in terms of damage variety in a hack-and-slash game. I play quite a bit of ARPG (mostly Diablo 3 and Grim Dawn as of now) and recently have generated some game ideas of my own.

One specific criteria that I am reaching is intuitiveness. The players should be able to easily distinguish between the damage types and choose the correct way to build their character suiting to their flavors.

At the moment, I am stuck with deciding the right number of damage types and what they are. I have a basic list for myself:

Physical

Magical

Fire

Ice/Cold

Lightning

Poison

Here comes another question: should Magical be there? Is it a redundancy since the 4 elemental Fire,Cold,Lightning and Poison is "magical" already? or Should there be an independent and unique type called Magical? Or, should the Magical damage, if increased, will also modify all those elemental damage? I am looking for a good desgin here.

Next question, I want to implement the mechanics of Bleeding as a Damage Over Time type of damage. Then, what type of damage should Bleeding be? Physical? or Poison? I have a solution, which is: for each damage type, add a "Duration" counterpart which represents the DOT of this damage type, then the list becomes:

(Type,Duration damage of this type)

Physical, Bleeding

Magical, Corruption(just a random word to fill in)

Fire, Burn

Cold, Chill

Lightning, Electrified

Poison..........???

Here comes the problem, Poison is already a DOT, introducing another DOT counterpart for Poison would be weird. Another problem with this system is that it is complicated, so many stats. So my question is, how do we efficiently implement the least amount of damage type to produce the most amount of diversity in gamestyles and build types. I really want to promote freedom and creativity, which means that if someone likes playing DOT lightning he could.

Sorry if my questions aren't clear, but I would love if everyone shares their ideas of a Damage type system, how many are there is good, and how does damage over time works.

sentences:
Unity FPS style turning I have 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 = tf.eulerAngles + new Vector3 (0,
Input.GetAxis("Mouse X") * speed, 0);
    }
}
}

I would like to know how to use this so that when I move my mouse and hole right click the character will turn but the mouse will not move from the center of the screen

sentences:
How do "community patches" for commercial games work? For a lot of games, mostly role-playing games (Gothic 3, Oblivion, Skyrim, Titan Quest to name a few), there exist community patches. So, patches that are made by the communities, not by the developers.

How does this work? Most commercial games are not open source.

How can someone without source code access provide a patch?

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:
Writing an autopilot for a 2d game with newtonian physics The subject says it all. I am making a 2d space game with newtonian physics and I need pointers on how to write an autopilot for it. The requirements are best explained by an example.

There is a target object which has speed and position vectors and there is a spaceship that is controlled by the autopilot. This spaceship also has speed, position and maximum acceleration. The autopilot needs to control the ship so that it either collides with the target or intercepts the target with matching speed and position.

Could someone give me some pointers how to achieve this behavior or perhaps even a ready implementation? I am sure someone has written something like this before and there is no point in reinventing the wheel.

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:
How is software rendering done? I would like to explore realtime software based rasterization. I know everything is going towards the GPU these days but there are a few games where it still makes sense to use a software renderer.

For example: Voxeltron

  Voxatron is an arena shooter that takes place in a world made of
  voxels (little cubes, kind of). Everything in the game is displayed in
  a virtual 128x128x64 voxel display, including the menus and player
  inventory. If you look closely, you can sometimes see the inventory
  (score/life/ammo) casting a shadow on some of the objects on the
  ground.

  I've been working on voxel rendering and modeling tools for a long
  time now, with the ultimate goal of making a large explorey adventure
  game. About half a year ago it fused with work I was doing on arena
  shooters for Conflux, and this is the result.

  It's quite a simple game at heart -- mostly just Robotron set in a 3d
  destructible world with goofy creatures. I'm unsure how major the
  implications of destructibility will be for gameplay, but it sure is
  fun to blast away pieces of wall. I've also added an experimental
  wall-building pickup you can use to construct barriers to hide from
  scary monsters.

  The game takes place in a small set of arenas. Some of them feature
  rooms with set action pieces, somewhere between Knightlore and Smash
  TV. This is some of the original adventure based design sneaking back
  in, and an excuse to create thematic environments.

  Features:

  Custom software rendering with soft shadows.
  Built-in sound and music    synthesizer (also used to make the
  trailer music).
  Playback & post game recording.

sentences:
Get the tile in unity tile map I am trying to get the sprite of a tile in unity from where a raycast hits. Right now it only works in some cases, and always in positive x.

This is my current code.

Vector3Int LocalPos = new Vector3Int((int)hit.point.x, (int)hit.point.y,0);

Sprite spr = tilemap.GetSprite(LocalPos);

From what I can tell it gets the correct sprite.

Edit: I removed pointless code

sentences:
UnityEditor related classes can not be referenced. Why? I have two classes. Both of them are placed in the editor/interface_field folder.
using System;
using UnityEngine;

namespace editor.interface_field
{
    public class RequiredInterfaceAttribute : PropertyAttribute
    {
        public readonly Type type;

        public RequiredInterfaceAttribute(Type type)
        {
            this.type = type;
        }
    }
}

    using UnityEditor;
    using UnityEngine;

    namespace editor.interface_field
    {
        [CustomPropertyDrawer(typeof(RequiredInterfaceAttribute))]
        public class RequireInterfaceDrawer : PropertyDrawer
        {
            public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
            {
                if(property.propertyType == SerializedPropertyType.ObjectReference)
                {
                    var requiredAttribute = this.attribute as RequiredInterfaceAttribute;

                    EditorGUI.BeginProperty(position, label, property);

                    property.objectReferenceValue =
                        EditorGUI.ObjectField(position, label, property.objectReferenceValue, requiredAttribute.type, true);

                    EditorGUI.EndProperty();
                }
                else
                {
                    var previousColor = GUI.color;
                    GUI.color = Color.red;

                    EditorGUI.LabelField(position, label, new GUIContent("Property is not a reference type"));

                    GUI.color = previousColor;
                }
            }
        }
    }

I have another class.
using editor.interface_field;
using UnityEngine;

namespace interface_user.implementations
{
    public interface IInterface {}
    public class InterfaceUser : MonoBehaviour
    {
        [SerializeField]
        [RequiredInterface(typeof(IInterface))]
        UnityEngine.Object interfaceImplementation;
    }
}

The [RequiredInterface(typeof(IInterface))] line throws the following error:

The type or namespace name 'RequiredInterfaceAttribute' could not be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]csharp(CS0246)

I can not understand why does not Unity see the RequiredInterfaceAttribute class and how could I make it see it.

sentences:
How can I make a swinging rope? Base question: How can I make a swinging rope in box2d?

Context: The idea is to have a rope where the player can grab it, swing a little bit to get more "momentum" and reach the next platform. Like in the Mario games for Nintendo DS and Wii.

What I did: I constructed a chain like rope with a series of RevoluteJoint. This is the fixture of the different links:

fixtureDef.shape = robeLinkShape;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.0f;
fixtureDef.restitution = 0.0f;
fixtureDef.filter.categoryBits = Box2DConst.BIT_ROPE;
fixtureDef.filter.maskBits = Box2DConst.BIT_PLAYER;

BodyDef bodyDef = new BodyDef();
bodyDef.angularDamping = 1.0f;
bodyDef.linearDamping = 1.0f;

I've implemented a ContactListener which creates a RevoluteJoint to connect the body and on of the links of the body. Now the problem I face is this: The rope does not swing, if I apply a linearImpulse to the player (attached to the rope) e.g. to the left, it goes to the left but it doesn't swing back. If the player isn't attached the rope swings.

Last points:

I made the player a dynamic body with a density of 1. Is it better, if the player body does not have a density set?
If the chain is to "light" (lower density) the player can torn it apart if he is attached to the rope. If I connect the last link with the first link of the chain with a RopeJoint the last and the first link stay at the same distance but for some reason, the links between still get torn apart. Question is, should I make my rope only of RopeJoins?

I know there are some tutorials out there with some instructions but some of them use a special class which is not available to me and other simply construct a rope and use a MouseJoint. Again in this scenario my rope thing looks good the problem that when the player body is attached to it it behaves a little bit strange. I know there are also similar posts to mine but since I have some sort of a working solution there solution (if the have any) was not helpful.

Update

If I create the rope solely from RopeJoints I get a nice swinging rope. It behaves exaclty as I woulrd expect. If I then a RevoluteJoint with a density (my player body fixture also has a density) the rope does no longer swing.

sentences:
What are the basic equations in 2D physics collisions? I'm making a 2D fighter, and I have gotten a basic engine, but right now I need to add the collisions, but I'm sure a basic AABB check will not be enough.

I'm sure it needs some basic 2D physics equations, but every resource I see on the web is extremelly complex or try to teach you everything you need to know to make a 2D physics engine.

So far, I'm sure it's related to momentum and forces, but don't know if those are enough for a 2D collision in a fighting game and what are the simplest ways to implement them.

sentences:
Attaching objects on collision in Unity? I'm trying to make a game where the player can connect objects Lego style with objects becoming children of any object they come into contact with, so if the parent object is moved the child is moved too, but the child object can be dragged away to disconnect it.

What is the best way to go about doing this?

sentences: Creating multiple fixtures in one body I want to create this type of fixture in one body. Here square and circle both are different fixtures but attach to one body. How do I do this?

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:
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:
Polygons and actionlisteners Libgdx I've been browsing these forums for a while now and I nearly always am able to find an answer without having to ask my own question! Such a great community!

This is the first time I've been stumped so I hope that someone can help me, I'm just learning libgdx so any help is appreciated I know the code is rough but please be gentle as I'm learning everyday!!! :)

I'm trying to create 6 shapes with inputlisteners which eventually will return the index of the shape which will correspond to an answer, but I can only seem to get the last input listener I create to actually fire...

    public Panel(final int count){
    this.count = count;

    img = new Texture("badlogic.jpg");

    handlerShapeVertices = new float[]{128,30,0,256,256,256};
    handlerShape = new Polygon(handlerShapeVertices);

    triangle = new PolygonRegion(new TextureRegion(img), handlerShapeVertices,new short[]{0, 1, 2});

    triangleSprite = new PolygonSprite(triangle);

    triangleSprite.setOrigin(img.getWidth()/2,30);
    triangleSprite.setX(x);
    triangleSprite.setY(y);
    triangleSprite.setRotation(count * 60);

    handlerShape.setOrigin(triangleSprite.getOriginX(), triangleSprite.getOriginY());
    handlerShape.setPosition(x, y);
    handlerShape.rotate(count * 60);

    setBounds(x,y, 256, 256);

    addListener(new InputListener(){
        public boolean touchDown (InputEvent event, float xP, float yP, int pointer, int button) {
            //float [] temp = handlerShape.getTransformedVertices();

            if(resourceManager.getInstance().interSector.isPointInPolygon(handlerShape.getVertices(),0,6,xP,yP)) {
                System.out.println("CLICK INSIDE : " + count);
            }
            return true;
        }
    });

}

I figured the polygon.getTransformedVertices() should work and to check they were correct I drew them in as you can see by the white lines surrounding the polygonsprites however it doesn't seem to and none of the listeners are actually fired when I use that... I'm completely stumped and hope someone has some insight or can point me in the right direction? I don't want someone to write my code for me but a pointer would be greatly appreciated!

sentences:
Upgrade items on shop menu I made a game and I made a Magnet upgrade and I have 8 game objects to set active 1 by 1 every time when I upgrade the magnet and I have (int upgrade = 0;).

But when I upgrade these game objects it's set active, but if I quit the game and start again all these game objects are FALSE.

How can I make e.g if I upgrade to (int upgrade = 6) and to make my game objects active only from element 0 to element 6. I do upgradeMagnet(); to void Update but its make active only 1 game object depends from (int upgrade) if (int upgrade) is 5 and only game object element 5 is active.

    public GameObject[] upgranded;
    public int upgrade = 0;

    public void upgrandeMagnetButton()
    {
        upgrade += 1;
        upgradeMagnet();
    }

        void upgradeMagnet()
    {
        if (upgranded[upgrade])
        {
            upgranded[upgrade].SetActive(true);
        }
    }

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: LibGDX - Draw multiple textures with different positions with one shader? currently I'm optimizing my render calls by drawing multiple textures with one shader. The background textures who all share the same position are no problem. But now I want to draw some Textures with different positions with one shader. I think it isn't possible, because the textures don't have the same geometry. But maybe there is a possible way to do this? I never worked with the geometry shader for example. For example, draw a 512x512 texture to position (100, 50), draw a 256x256 texture to position (500, 300)... , like in this picture:

sentences:
Unity2D: Child class inheriting onCollisionEnter() methods I may be an idiot for asking this but I can't seem to solve it myself, I have a GenericWeapon class which has a onCollisionEnter() method which I want applying to all child classes which inherit from it, here is the code:

public void onCollisionEnter(Collider target){
    Debug.Log("Collided with player!");
    if(target.GetComponent<Player>()){
        bc2d.enabled = false;
        rb2d.Sleep();
        equip(target.GetComponent<Player>());
    }
}

My child class is the following:

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

public class RangedWeapon : GenericWeapon
{
    // Start is called before the first frame update
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
    }
    public void attack(){
    }
}

and my in GameObject has the RangedWeapon class as a component however the GameObject does not seem to be picking up any collisions with the player. Could someone point out where I'm going wrong with this?

sentences:
Reorder a set of points in order to draw a triangle fan (example) I'm doing a light engine (c++, using sfml), and to connect the light vertices, I thought about drawing a triangle fan.
Here is a representation of a triangle fan (sfml documentation):

The points HAVE TO be "ordered" to draw the shape correctly, otherwise it would mess the shape I suppose.

I drew the desired effect in ms paint:

As you can probably see, there is a central point, a light, and other points that I want to connect together. The problem is that the points are not always ... "In a row/Ordered" ? Let's see an example and simplify this problem.

In the example above, I can't connect the points from 0 to 8 because it would mess the shape.

I would like to reorder the points so I can connect them properly, like :

Do you have any ideas ?

I thought about doing something based on the "point in polygon" algorithm, like checking if the point is "on the right/left" but it seems complicated.

I don't necessarily need code (if you have time it would be nice) but I can try to do some, I just need ideas. Thanks

sentences:
Why do many games have “timeouts”? I noticed that many social games have the concept of "timeouts". In farm games etc. it obviously makes sense (stuff grows, etc.). But I also noticed that angry birds introduced this as well. Individual angry bird games are pretty much stateless, so it doesn't seem to make a lot of sense at first glance (and some users are upset because of this).

What is the purpose of this? Does it bring more money somehow? Does it help retaining the users? Is this a new concept? Does it have any other applications, particularly in non-game realms?

sentences:
Aligning cube faces Unity I am using a shader that uses a gradient noise node and time to add a wavy effect to a grid like texture. The issue with doing this is that it causes the lines to be misaligned on the different faces of the cubes.

What I would like is for the lines to be conjoined, like this (wavy effect not applied)

The shader graph layout I am using to generate this effect is

How can I go about fixing this issue so that all the lines are conjoined, but also have a wavy effect over time?

Edit

A rough sketch of what I am after. Here the black dots represent the physical shape of the object and the lines should be able to wave around the whole object and all be connected, regardless of whether there is an edge there or not.

sentences:
Unity C# - Raycasts, How to Ignore Triggers? Let's say I have a Raycast, but I don't want it to collide with any triggers. I don't want to change the Project settings since that's a little inflexible.

How can I have a Raycast ignore any triggers?

sentences:
How does one measure and reward social aspects in virtual worlds? Well this sounds like a pretty vague question but please bear with me.

I know of how Gaiaonline gave gold to people who participated in forum posts.

I'm curious if in theory these could be applied to social aspects of games like Second life or Sims Online.

The question what would be specific quantifiable actions/interactions could be measured tracked for rewards and achievements that would help build a community?

(this'll probably end up as community wiki though)

sentences:
Unity 5 - Textures look strange in Deferred Rendering I've created an exterior terrain scene in Unity 5 which features lots of trees and grass but some textures look awful and I'm wondering why. Please see the attached image:

This texture problem is especially obvious at night (I'm using Time of Day unity asset for Day/Night cycle) but also during day light it doesn't look good. The tree bark looks like plastic and also the ground textures are too bright and lack contrast. Stone texture on the other hand look perfectly fine.

Can somebody point me into the right direction of what I'm doing wrong here with my lighting and rendering?

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

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

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

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

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

sentences:
Doubling the DPI with a shader? I'm developing a game where the map is generated with Perlin Noise, but on the CPU. I am generating some perlin noise onto a texture with a small size, and then I stretch it out to the whole screen to simulate a map.

The reason for the CPU generating the noise is that I want it to look the same on all devices.

Now, here's the end-result.

Please ignore the bullets and the explosion on the picture. What matters is the background (the black/gray pixels) and the ground (the brown-ish pixels). They are rendered to the same texture through perlin noise.

However, this doesn't look very pretty. So I was wondering if it would be possible to double the amount of pixels using a shader, and rounding edges at the same time? In other words, improve the DPI.

I'm using SharpDX with DirectX 11, through its toolkit feature. But any help that'll lead me in the right direction (for instance through HLSL) would be a great help.

Thanks in advance.

sentences:
Is it possible to make a TileMap that adjust it self to multiple screens? I need to build a tile map that is supposed to fit nicely in several screen Sizes.
However, Tiled the tile map editor I use allows only to produce absolute fixed size tile maps.

Is there an easy way to make adaptable tile maps or should I build one for each screen size?

sentences:
How do I get a table of AABB's? I am not sure if this is the right site to put this question on.

What would be a good, time saving method to reference an AABB with an integer id in Java programming language?

AABB class:

public class AABB {
private EndPoint[] min = new EndPoint[3];
private EndPoint[] max = new EndPoint[3];
private int entityId = 0;
private Boolean isStatic = false;
private static Map<Integer, AABB> table = new HashMap<>();
private Vector3f pos;
private int id = 0;

public AABB(Vector3f min,Vector3f max,Vector3f pos,int entityId,Boolean isStatic) {
    this.min[0] = new EndPoint(true,pos.x - min.x,id);
    this.min[1] = new EndPoint(true,pos.y - min.y,id);
    this.min[2] = new EndPoint(true,pos.z - min.z,id);

    this.max[0] = new EndPoint(false, pos.x + max.x,id);
    this.max[1] = new EndPoint(false,pos.y + max.y,id);
    this.max[2] = new EndPoint(false,pos.z + max.z,id);
    this.pos = pos;
    this.entityId = entityId;
    this.id = UniqueIdentifier.nextInt();
    this.isStatic = isStatic;
}
public static AABB setAABB(AABB aabb) {
    return table.put(Integer.valueOf(aabb.getId()), aabb);
}

public static AABB getAABB(int id) {
    return table.get(Integer.valueOf(id));

}

public static AABB getAABB(EndPoint endpoint) {
    return getAABB(endpoint.getId());

}

@Override
public boolean equals(Object arg0) {
    if(arg0 == this) {
        return true;
    }
    if((arg0 == null) || !(arg0 instanceof AABB)) {
        return false;
    }

    AABB aabb = null;
    try {
        aabb = (AABB) arg0;
    } catch (ClassCastException e) {
        return false;
    }

    return ((aabb.getMax() == getMax()) && (aabb.getMin() == getMin()) && (aabb.isStatic() == isStatic || aabb.isStatic().equals(isStatic())) && (aabb.getPos() == getPos()) && (aabb.getId() == getId()) && (aabb.getEntityId() == getEntityId()));

}

@Override
public int hashCode() {
    int hash = 17;
    hash += 5 * ((Boolean) isStatic).hashCode();
    hash += 5 * ( min == null ? 0 : min.hashCode());
    hash += 5 * ( max == null ? 0 : max.hashCode());
    hash += 5 * ( pos == null ? 0 : pos.hashCode());
    hash += 5 * id;
    hash += 5 * entityId;
    return hash;
}

}

SAP class:

 public class SAP {
public static List<EndPoint> xaxis = new ArrayList<>();
public static List<EndPoint> yaxis = new ArrayList<>();
public static List<EndPoint> zaxis = new ArrayList<>();
private SAP() {}

public static void addObject(AABB aabb) {
    if(!PairManager.isInPairs(aabb)) {
        xaxis.add(aabb.getMax()[0]);
        xaxis.add(aabb.getMin()[0]);

        yaxis.add(aabb.getMax()[1]);
        yaxis.add(aabb.getMin()[1]);

        zaxis.add(aabb.getMax()[2]);
        zaxis.add(aabb.getMin()[2]);

                    // Where i set table
        AABB.setAABB(aabb);
    }
}

private static boolean  intersects(AABB a,AABB b, int axis)
{
            // Where exeption is thrown a and b == null
    return !(a.getMax()[axis].getValue() < b.getMin()[axis].getValue() || b.getMax()[axis].getValue() < a.getMin()[axis].getValue());
}

private static boolean intersects(AABB a,AABB b) {
    return intersects(a,b,0) && intersects(a,b,1) && intersects(a,b,2);
}

}

sentences:
Artifacts on top of platform sprite only when moving I made a floating platform in Unity which has a propeller movement animation. I attached a script I wrote to the game object that adds slight vertical and horizontal movement using the game object transform.position. This is creating some weird artifacts at the top of the sprite, but only when the movement code is active. When I don't move the platform and just leave it still to animate there are no artifacts.

Gameplay:

Sprite Import Settings:

Sprite Renderer:

Camera Settings:

Resolution:

sentences:
How to apply two pixel shaders in one go Is there any possible way to apply two pixel shader simultaneously in directx-9.
For example I am having two pixel shaders one to apply ripple effect and another to modify the color of the texture rendered on the screen. Is there any way that I can render the effect of the two pixel shaders simultaneously without combining them in the same shader file.
Any kind of help is appreciated.

sentences:
How can I store point voxel terrain in octrees I am writing a voxel engine in LWJGL3 - binding for OpenGL 4 for JVM.
Recently I implemented an octree storage of cubic voxels.
In my implementation each leaf node of an octree has one voxel, voxels can't overlap each over.
But now I changed my mind and my goal is to create a dynamic point voxel engine.
How can I store point voxels in an octree ?
My reference is EverQuest Next Landmark.

sentences:
Why do my objects with colliders go through each other, and how do I fix it? I am new to Unity and I am just experimenting with a player controller script (which I got off youtube) and another object which doesn't move. Both my player and the stand-alone object have colliders and rigidbodies but when I move the player it goes straight through the other object.

My player controller script is:

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

public class PlayController : MonoBehaviour
{
    public float speed;

    private Rigidbody2D rb;
    private Vector2 moveVelocity;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        Vector2 moveInput = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
        moveVelocity = moveInput.normalized * speed;
    }

    private void FixedUpdate()
    {
        rb.MovePosition(rb.position + moveVelocity * Time.fixedDeltaTime);
    }
}

Nothing has been changed on the colliders (nothing ticked), and the rigidbody2D has been changed to kinematic.

sentences:
Applying movement to a Rigid Body Isometric in Unity 3D I'm making an isometric dungeon crawler. I initially used transform to get isometric movement and things worked well, but I couldn't use collision which meant it was unsuitable. So I'm now trying to use Rigidbody and I'm having some weird issues.

First of all, this is the code I currently have:

public class CharControllerRigid : MonoBehaviour{
    [SerializeField]
    private Rigidbody characterRigid;
    private Vector3 inputVector;
    void Start()
    {
        characterRigid = GetComponent<Rigidbody>();
    }

    void Update()
    {
        inputVector = new Vector3(Input.GetAxis("Horizontal") * 10f, characterRigid.velocity.y, Input.GetAxisRaw("Vertical"));
        transform.LookAt(transform.position + new Vector3(inputVector.x, 0, inputVector.z));
    }
    private void FixedUpdate()
    {
        characterRigid.velocity = inputVector;
    }
}

I have two issues:

First, how do I get the movement to work on an isometric plain?

Second, how do I get the movement to work in all directions? Current when I move left and right the movement is good, but up and down are really slow in comparison.

sentences:
Third person and LineTracing C++ Problem

I have a crosshair in the middle of the screen.

I need to create a lineTrace that passes straight through this crosshair.

As this is a third person game, I need the line trace to cast through the crosshair

Question

How do I do this

Code sample

    #include "GameFramework/PlayerController.h"
    #include "Engine/World.h"
    #include "DrawDebugHelpers.h"
    #include "Camera/PlayerCameraManager.h"
    #include "GrabObjects.h"
    #include "CollisionQueryParams.h"

    #define OUT

    //...

    // Called every frame
    void UGrabObjects::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
    {
        //...

        FVector PlayerViewPointLocation;
        FRotator PlayerViewPointRotation;

        // Get player viewport
        GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
            OUT PlayerViewPointLocation,
            OUT PlayerViewPointRotation
            );

        // Draw a line from player showing reach
        // PlayerViewPointRotation.Vector() is the unit vector
        FVector LineTraceEnd = PlayerViewPointLocation + PlayerViewPointRotation.Vector() * Reach;

        DrawDebugLine(
            GetWorld(),
            PlayerViewPointLocation,
            LineTraceEnd,
            FColor(0, 255, 0),
            0.f,
            0,
            5.f
        );

        //...
    }

```

sentences:
Texture2D can't find my sprite - how to setup the content directory in XNA So I keep getting told that spr_lives can't be found.  I'm working out of a book and using the samples given to me (have not changed the code or folder structure, so it /should/ work) but nothing's working unfortunately.  I know it's a directory issue but I'm unclear on how to remedy it.

Picture of both code and folder structure:

sentences:
How to only allow a certain amount of the same instance in Game Maker? I am creating a simple jump n' run game. For some reason my game sometimes spawns two instances of the same enemy on top of each other. So you can't tell there are two of him until he uses his attack where he shoots a barrage of bullets in random directions.

So now when the game spawns two of them, there are also twice as many bullets which makes the game too difficult to play.

I don't know what causes the game to spawn two. It only happens very rarely. I would just make it so that if there are two instances of the same enemy, it destroys one of them.

That would solve the problem.

sentences:
Run FSX (Flight Simulator) on remote desktop Obviously I cannot run FSX in a remote desktop session. When I try to start it appears the message: Flight Simulator cannot run during a Remote Desktop session and will now quit

Especially for development (coding on a second machine) a RDP session would be handy. Any workarounds for this?

sentences:
Create edges in Blender I've worked with 3DS Max in Uni and am trying to learn Blender.

My problem is I know a lot of simple techniques from 3DS max that I'm having trouble translating into Blender. So my question is:

Say I have a poly in the middle of a mesh and I want to split it in two. Simply adding an edge between two edges. This would cause a two 5gons either side.

It's a simple technique I use every now and then when I want to modify geometry. It's called "Edge connect" in 3DS Max.

In Blender the only edge connect method I can find is to create edge loops, not helpful when aiming at low poly iPhone games.

Is there an equivalent in blender?

sentences:
Manipulating an animation towards a target object (ie. The hand and arm lean towards the target) I am trying to make a boxing game just for fun (I dont expect the end product to be anything decent lol) . I have my boxers in the ring and they are animated quite well so far, with Idle, and punch Left and Right. They also rotate so they are always looking at each other.

What I want to do is give the punch some aim towards the head. I will give the punch a set amount which it can move from the standard animation and move the hand bone in the direction of the targets head object. But I don't know how to do this :S

So far i have used dragged the 3 animation files into Mecanim and coded it to do the animations when a button is pressed.

Is there a way to manipulate the animation in this way? (ie. actually make the arm reach towards the target object )

sentences:
Why does Unity require an EventSystem component for input during a play-test, where input works fine without it in a build? Please be aware that this was initially a question about how to get the input to work. A comment pointed me in the direction of a fix, but only left me with more questions in regards to understanding the problem I was originally having, so I have edited my question to include the initial solution and focus on the question I still have.

The Problem:

Recently, I have moved from using GUIText and GUITexture objects to using the Canvas to display UI elements. In effort to set up a prototype, some external GUI elements were imported, and when the game is built and run from my phone, everything works as intended.

However, if I simply run the game from inside Unity, input is completely ignored. I originally thought this may have been a response to grabbing touch screen input, and expecting it to work on a regular screen with mouse input, but I have since confirmed that it still does not work when using Unity Remote to test the game on my phone.

It has since been pointed out that I was not using an EventSystem, along side my Event Trigger objects. After implementing an EventSystem component, and the default input module supplied by the EventSystem interface, the input works. However, this still leaves me confused. What is the point of enforcing the implementation of the EventSystem, if it only ensures functionality during play test? Why would I want this system in my end build, when I can confirm that the build version functions properly, without it?

Below you will find my setup, contextual to the problem. Click for a zoomed in view, as I have included the component structure of my UICanvas and MainCamera objects, in case it is helpful. In this case, we have a button that increases the max speed, when pressed. Everything works in a build, but nothing works during a play-test.

Additional Information:

I have enabled 'show touch input' on my phone, to confirm that the phone is still registering touch input.
I moved to using the Canvas object after the 'depreciated warning' for using GUIText and GUITexture turned into a 'depreciated error'. Even if there is a suitable way to still perform these actions with the GUIText and GUITexture objects, I still wish to persist with using the Canvas. I am also personally curious as to why this issue exists within the Canvas, as it seems lead to obvious cases of severe inefficiency, in a system that seems to have been put together with the sole point of being more efficient.
I can create manual OnMouseDown buttons that will work during play test, however, some GUI elements are more complex and persisting with this sort of solution seems like an incredible waste of time.
As previously mentioned, I do not have any input issues if I simply build and run the game from my phone. However, this takes considerably more time than a simply debug test, and even without the high efficiency cost, I do not have access inspector-manipulation during my play-test.
I am using Unity version 5.3.5 personal. Any solution that does not include updating Unity will be well preferred. While I have no physical problems updating Unity, in some previous projects updating Unity versions has lead to massive issues that we would prefer to outright avoid, if possible.

TL;DR:

Unity will not accept input on my input canvas during debug. I literally have to build and run my project each time I want to test input, or create dodgy hacks to provide input from the Inspector. The addition of an EventSystem allows input during debug play-testing, but is not needed for input post-build. Why does Unity act this way, and why do I need an EventSystem entirely for play-test input?

sentences:
How to get the texture coordinate of a neighbouring pixel for a blur shader? I'm still having some trouble to get my head around fragment shaders and doing some image processing on textures. The context is a 2D sprite: a simple texture painted on a quad. All done with OpenGL ES 2.0.

My very basic goal is a simple blur filter using a 3x3 Kernel with average weights: every pixel used is weighed 1/9th and summed up.

Besides many ways to improve the performance of the fragment shader(code below) so far I'm still having some difficulties to find the right texture coordinate for the kernel.

My approach so far is to use the actual size of the quad on the screen on which the texture is painted and pass those two values to the shader. This is done outside the shader and passed as a uniform to the shader program.

glUniform2f(_offset, 1 / spriteWidth, 1 / spriteHeight);

This should result in the step in both directions to calculate a texture coordinate in the 0 to 1 space.

The result is kind of looking good. BUT I am still struggling if this is something that could be done within the shader. Is there a way to get the size of the texture within the fragment shader? If we would be only doing this on a bitmap, I'll just go from pixel to pixel and read the color of the surrounding pixels. I am wondering if my understanding of a fragment shader is quite right: It's run per rendered pixel on the screen. I found some examples for the GLSL to do this but I wasn't able to port it to OpenGL ES, so I had to start from scratch.

For the sake of readability I write a bit more code in hope it's easier to understand the fragment shader:

varying vec2 v_texCoord;
uniform vec2 u_offset;
uniform sampler2D u_texture;

const int size = 3;
const int KernelSize = size * size;

void main()
{
    int i, j;

    vec4 sum = vec4(0.0);
    vec4 intensityOfPixel;
    vec2 texCoordForKernel;

    for (i = 0; i < size; i++)
    {
        for (j = 0; j < size; j++)
        {
            texCoordForKernel = vec2(v_texCoord.x + (float(i) - 1.0) * u_offset.x,
                                     v_texCoord.y + (float(j) - 1.0) * u_offset.y);

            intensityOfPixel = texture2D(u_texture, texCoordForKernel);

            sum += intensityOfPixel * 1.0 / float(KernelSize);
        }
    }

    gl_FragColor = sum;
}

Thanks alot in advance!

sentences:
SDL2 - Inconsistent FPS with VSYNC I'm working on a game using SDL2. Today I noticed the game has some jolty issues when not fullscreened so I made an extremely simplified program that simply moves a square from left to right to see if the result is the same.

I expected the squares movement to be very smooth but instead it's very jolty/laggy (when not fullscreened).

At first I thought it was to do with how I was calculating the time between each frame but after outputting the 'ftime' I can see the time each frame takes ranges from 13 to 30(ish) as opposed to a consistent 16/17.

Here's the code:

#include <iostream>
#include <SDL.h>

const int GAME_WIDTH = 1920;
const int GAME_HEIGHT = 1080;

//frame independent movement variables
double old_time = 0;
double current_time = 0;
double ftime = 0;

#undef main
int main(int argc, char** argv)
{
    SDL_Window* mainWindow;
    SDL_Renderer* mainRenderer;

    SDL_Init(SDL_INIT_EVERYTHING);

    mainWindow = SDL_CreateWindow("MiracleSquare", 50, 50, GAME_WIDTH, GAME_HEIGHT, 0);
    mainRenderer = SDL_CreateRenderer(mainWindow, -1, SDL_RENDERER_PRESENTVSYNC);

    SDL_Rect miracleRect; //creating the SDL square
    miracleRect.x = 0;
    miracleRect.y = 400;
    miracleRect.w = 100;
    miracleRect.h = 100;

    bool running = true;

    while (running)
    {
        old_time = current_time;
        current_time = SDL_GetTicks();
        ftime = current_time - old_time;

        std::cout << ftime << std::endl;

        SDL_Event e; //stops crashing on input
        if (SDL_PollEvent(&e))
        {
            switch (e.type)
            {
            case SDL_KEYDOWN:
                break;
            default:
                break;
            }
        }

        miracleRect.x += (ftime / 1000.0f) * 100.0f;
        if (miracleRect.x> 1920) miracleRect.x = 0;

        SDL_SetRenderDrawColor(mainRenderer, 0, 0, 0, 255);
        SDL_RenderClear(mainRenderer);
        SDL_SetRenderDrawColor(mainRenderer, 255, 255, 255, 255);
        SDL_RenderDrawRect(mainRenderer, &miracleRect);
        SDL_RenderPresent(mainRenderer);
    }

    return 0;
}

Am I doing something wrong? As far as I can tell this should produce a smooth movement.

Any help would be greatly appreciated!

Edit: Since posting this I've figured out it has something to do with my use of dual monitors. If, for example, I have a video playing on chrome on my secondary monitor, the lag issue is very prominent. I'm now looking into if this issue is avoidable, or if I'll just have to ignore it.

sentences:
How to implement "model quality" in OpenGL In many games, there is an option named: "Model Quality", which ranges from Low to High. Low model quality simply removes a lot of vertices from the model, to make it faster, while High preserves the original model vertices (I think).

So I'm wondering, how do I implement this in my game?

sentences:
What are mental ray shaders and can I use them in my own game? I'm using the FBX SDK to import and display FBX models in my OpenGL app. It works fine so far with a simple phong shader and displays basic models.

However I have some FBX models that have custom (Mental Ray) Arch & Design materials. Can I render these models with such materials in my app?

My (completely noob) understanding of how this works is that the Arch & Design thing is a shader. A graphic designer edited some data fields, and the way the model is rendered is that such data is passed to the Arch & Design shader during rendering, and the shader takes care of it (ie does all the lighting calculations etc).

Is it possible for me to use that flashy Arch & Design shader in my app, so I manually parse the FBX model and send the data fields to the shader? How do I get hold of it?

Any clarification will be appreciated, you can probably tell that I'm somewhat confused.

sentences:
How to have a successful beta test with a small team? I've done a lot of work (pro-bono) on a patch to a commercial game from ~11 years ago that needs some beta testing. Loads of people are waiting for it.

What are some ways to get good (by that I mean useful) feedback during the beta test phase for a game? I've got lots of people who want to play with it, but I'm concerned about getting good feedback without getting bogged down in the development. I'm also concerned that people will be more concerned about having the tweaks they want to see added to the patch than really testing the work that has been done.

Do you provide the ability to log bugs directly into a bug tracker, or send them all to a person on the development team?
How do you ensure you cover all the platforms you support (in my case: Mac OSX (x86/ppc), Windows (multiple versions), Linux (multiple versions)?

Are there any good software packages (like a web portal) for running a beta test for a project like this? Any good documents out there with tips?

sentences:
Box2dMapObjectParser isometric map - bodies have wrong position and size I'm using Box2dMapObjectParser to load Tiled objects layer onto my IsometricTiledMapRenderer'ed TiledMap.
It works OK with a UnitScale of 1 but the position is wrong and some shapes have weird rotation and size.

Map in Tiled:

Map in game:

I've found another similar question but the answer is unfortunately far from being clear, at least to me.

Relevant code:

mParser.load(mWorld, mMap);
mRenderer = new IsometricTiledMapRenderer(mMap, mParser.getUnitScale());

Notice the 'Ellipse' is not drawn at all, the Rectangle is way off and Polygons/Polylines are just not positioned right.

Did anyone experience the same issue and/or have any idea how to fix this?

sentences:
Input before or after update/draw? This is how I understood the game loop, and I wanted to know if I'm correct or not:

1) Draw/render -> input
CPU    |    GPU
------------------
Update |
Draw   |
Input  | Rendering

2) Input -> Draw/render
CPU        |    GPU
------------------
Input      |
Update     |
Draw       |
(nothing?) | Rendering

By rendering I mean updating the actual frame. What happens in the second case? Is the CPU doing nothing or is it checking input for the next frame already? Are there any differences from checking input before or after the update/draw part?

sentences:
Java 2D Game looks like 3D i have fair experience with java game programming,
i already made a simple mario game (side-Scrolling)
i'm wondering how can i make a "Java" Game like that

http://www.youtube.com/watch?v=utwtXEYW1L0
or that
http://www.youtube.com/watch?v=uqz4dunlhX4
the main problem is that i don't know how to make a 2D game looks like 3D
i just need a tutorial or the idea behind such things.
Thanks in Advance :)

sentences: Android in-game pause screen Right now Im calling a new activity with an xml-view when I pause my game, but Since I do this I need to use context in my real-time code, and this is causing a memory leak. Is there any preffered way to pause the game? By pause I mean if game is over, if I die, or if I press pause-button. Would a custom dialog work just aswell? this would mean I wont have to leave my main-activity while im in-game.

sentences:
Is there any documentation comparing/contrasting C++ standard library implementations? (This is not game programming per se, but I'm certain if I asked this on SO I'd get told not to prematurely optimize, even though history tells us every large game ends up worrying about these things.)

Is there a document anywhere that summarizes the differences in performance, and particularly memory usage, between different C++ standard library implementations? The details of some implementations are protected by NDA, but a comparison between even STLport vs. libstdc++ vs. libc++ vs. MSVC/Dinkumware (vs. EASTL?) seems like it would be immensely useful.

In particular I'm looking for answers to questions like:

How much memory overhead is associated with the standard containers?
What containers, if any, do dynamic allocations merely by being declared?
Does std::string do copy-on-write? Short string optimization? Ropes?
Does std::deque use a ring buffer or is it crap?

sentences:
Alternative in-game dev console implementations I'm developing a dev console for my game. Currently I have a simple parser which is basically a regex which accepts words with dashes and dots (ie. list, 1.0, list -i) or simplistic arrays and maps (ie. [1,2,3], [x:1.0, y:2.0]). I plan on making an AST parser later on but for now this works well enough.

When these tokens get parsed first token in parsed line is the command token which is used to invoke a registered command. Commands are classes which implement a ConsoleCommand interface which looks like this (basic command pattern):

interface ConsoleCommand {
    val description: String
    val instructions: String
    fun execute(args: Array<Any>): String
}

This works, but I'm not quite satisfied since to actually register any console commands I must do so where I can access the entity. For example if I want to register the player as an interactable console command I must do so either in a custom system only created for the specific console command, or add console specific code into existing systems, basically polluting my codebase with console specific code.

My question here is what are alternative dev console implementations? Is there a way to implement a console which wouldn't affect the rest of the codebase?

I have an inkling of an idea where the console could be some sort of an observer and it itself would register onto entities and stuff, but I don't see a way of implementing that without having the entities implement some sort of special observable interface so that they can actually be observed, as well as the fact that observers usually don't manipulate the entities themselves....

sentences:
Unity: parallel vectors and cross product, how to compare vectors I read this post explaining a method to understand if the angle between 2 given vectors and the normal to the plane described by them, is clockwise or anticlockwise:

public static AngleDir GetAngleDirection(Vector3 beginDir, Vector3 endDir, Vector3 upDir)
{
    Vector3 cross = Vector3.Cross(beginDir, endDir);

    float dot = Vector3.Dot(cross, upDir);

    if (dot > 0.0f)
        return AngleDir.CLOCK;
    else if (dot < 0.0f)
        return AngleDir.ANTICLOCK;
    return AngleDir.PARALLEL;
}

After having used it a little bit, I think it's wrong.
If I supply the same vector as input (beginDir equal to endDir), the cross product is zero, but the dot product is a little bit more than zero.

I think that to fix that I can simply check if the cross product is zero, means that the 2 vectors are parallel, but my code doesn't work.

I tried the following solution:

Vector3 cross = Vector3.Cross(beginDir, endDir);
if (cross == Vector.zero)
    return AngleDir.PARALLEL;

And it doesn't work because comparison between Vector.zero and cross is always different from zero (even if cross is actually [0.0f, 0.0f, 0.0f]).

I tried also this:

Vector3 cross = Vector3.Cross(beginDir, endDir);
if (cross.magnitude == 0.0f)
    return AngleDir.PARALLEL;

it also fails because magnitude is slightly more than zero.

So my question is: given 2 Vector3 in Unity, how to compare them?

I need the elegant equivalent version of this:

if (beginDir.x == endDir.x && beginDir.y == endDir.y && beginDir.z == endDir.z)
    return true;

sentences:
How to implement translation, scale, rotation gizmos for manipulating 3D object's transforms? I am in the process of developing a basic 3D editor. It uses OpenGL for rendering a 3D world. Right now my scene is just a few boxes of different sizes and I am at the stage where I want to be able to select each box and then move/scale/rotate it to achieve any transform I want.

How can I solve the problem of implementing both the rendering of these tool's gizmos(or handles, or how people usually call them), and also picking them on each axis to perform the change in the transform with my mouse? For clarity:

My research so far suggested the cleanest approach is to have an axis aligned bounding box per arrow in the gizmo and another one per square (the ones that move the object in a plane rather than a single axis) and then cast a ray from the mouse position and see what it collides with. But this is still a bit too abstract for me, I would appreciate further guidance in how this algorithm would go (pseudocode is more than enough)

sentences: Can I sell a game made with OpenGL? I love creating games, and I've always made games using OpenGL and not with game engines such as Unity or Unreal. Can I legally sell the games I made with OpenGL?

sentences:
Platform independent replacement for LuaInterface I'm currently working on a project in C#/XNA, however I'm planning to migrate this to MonoGame so that it can go onto more platforms. The problem is that I am currently using a lot of Lua, and for that in XNA, I am using LuaInterface.

The issue I now have is that LuaInterface only runs on Windows because of the dlls that it requires, but I would like to make this project available on Linux and Macs as well. Does anyone know of a good alternative to LuaInterface that could slot into Mono quite nicely?

Re-writing the parts which are currently in Lua in another language wouldn't be too much of a problem, but I need to be able to use scripting as I want to make large portions of my game open to players for modding.

sentences:
Unity build issue - GooglePlayGamesManifest and GameServicesManifest I have added leaderboard to my unity game for which I have used the google play services plugin. But when I try to build, this is the error I get:
 Execution failed for task 'processReleaseManifest'.
> Manifest merger failed : Attribute meta-data#com.google.android.gms.games.APP_ID@value value=
(\728999946156) from [:unityLibrary:GameServicesManifest.plugin] AndroidManifest.xml:10:13-42
is also present at [:unityLibrary:GooglePlayGamesManifest.plugin] AndroidManifest.xml:20:13-46 value=
(\u003728999946156).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:8:9-
10:45 to override.

Here's what's in the first manifest file:
<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by the Google Play Games plugin for Unity
 Do not edit. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.example.games.mainlibproj"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="14" />
<application>
    <!-- The space in these forces it to be interpreted as a string vs. int -->
    <meta-data android:name="com.google.android.gms.games.APP_ID"
        android:value="\u003728999946156" />
    <!-- Keep track of which plugin is being used -->
    <meta-data android:name="com.google.android.gms.games.unityVersion"
        android:value="\u0020.20.20" />
    <activity android:name="com.google.games.bridge.NativeBridgeActivity"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>

and the second file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android = "http://schemas.android.com/apk/res/android"
package="com.google.example.games.mainlibproj">
<application>
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value = "\728999946156" />
<activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme =
"@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>
</manifest>

sentences:
How to check for collisions in "diagonal" tiles? I want to create a tiled map in the following scheme:

The player should be able to walk on the blue line (street). Now, what is the best way to solve collision detection in this case? For example, in the case of tiles C1 and C2: If I make them walkable, then the player could also move in on those black parts of the tiles that should not be walkable.

On the other hand, if I make both C1 and C2 blocked, then the player would not be able to walk on these tiles (and therefore on the street) at all.

Any best practices?
Thanks.

sentences:
Why does this game loop stop my process from responding? I implemented a fixed time step loop for my C# game. All it does at the moment is make a square bounce around the screen. The problem I'm having is that when I execute the program, I can't close it from the window's close button and the cursor is stuck on the "busy" icon. I have to go into Visual Studio and stop the program manually.

Here's the loop at the moment:

public void run()
    {
        int updates = 0;
        int frames = 0;
        double msPerTick = 1000.0 / 60.0;
        double threshhold = 0;
        long lastTime = getCurrentTime();
        long lastTimer = getCurrentTime();

        while (true)
        {
            long currTime = getCurrentTime();
            threshhold += (currTime - lastTime) / msPerTick;
            lastTime = currTime;

            while (threshhold >= 1)
            {
                update();
                updates++;
                threshhold -= 1;
            }

            this.Refresh();
            frames++;

            if ((getCurrentTime() - lastTimer) >= 1000)
            {
                this.Text = updates + " updates and " + frames + " frames per second";
                updates = 0;
                frames = 0;
                lastTimer += 1000;
            }
        }
    }

Why is this happening?

sentences:
Character coding / programming Lately I tryed a few times to create characters for some games, but at some certain point (especially when collision detection came in) everything became messy and the interaction between chars, the world and certain items had a lot of bugs. So here is my question, how do you ussualy keep track of actions that your character is allowed to do, or more in general do you have some links / advices how to set up a char efficiantly?

I´m working on a char right now, who should at least be able to run, jump, pick items up and use different fighting animations. Most ideas I came up with until now use some kind of action.priority / action.duration system to determain whats possible and what not, or a "action-manager" which defines for every action what is possible from that action on but it all doesnt work that well together.

sentences:
How can I support remappable controls? I am trying to allow players of my game to remap the controls (eventually from the menu). Currently, some of the buttons have been defined, but they can't be changed. They are hard-coded. For example, this is how I handle key events now:

    switch(e.getKeyCode())
    {
        case KeyEvent.VK_A:
            ...
            break;
        case KeyEvent.VK_D:
            ...
            break;
        ...et cetera...
    }
}

How can I build a system that allows the actual keys for various actions to be remapped by the user?

sentences:
Making body (box2d) a sprite (andengine) in Android I can't make body (box2d) a sprite (andengine) and at the same time apply MoveModifier to sprite which is body. If i can make just body, it works namely the sprites can collide. If I apply just MoveModifier to sprites, the sprites can move where i want. But I want to make body (they can collide) and apply MoveModifier (they can move where I want) at the same time. How can i do it? This my code just run MoveModifier not as body at the same time.

    circles[i] = new Sprite(startX, startY, textRegCircle[i]);
    body[i] = PhysicsFactory.createCircleBody(physicsWorld, circles[i], BodyType.DynamicBody, FIXTURE_DEF);
    physicsWorld.registerPhysicsConnector(new PhysicsConnector(circles[i], body[i], true, true));
    circles[i].registerEntityModifier(
            (IEntityModifier) new SequenceEntityModifier (
                        new MoveModifier(10.0f, circles[i].getX(),  circles[i].getX(),
                                circles[i].getY(),CAMERA_HEIGHT+64.0f)));
    scene.getLastChild().attachChild(circles[i]);
    scene.registerUpdateHandler(physicsWorld);

sentences:
set sprite to current animation texture In my game I have some box2d bodies where I add sprites using the following code in my render() method.

for (Body body : worldBodies) {
        if (body.getUserData() instanceof Sprite) {
            Sprite sprite = (Sprite) body.getUserData();

            Vector2 position = body.getPosition();
            sprite.setPosition(position.x - sprite.getWidth() / 2 , position.y - sprite.getHeight() / 2);
            sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
            sprite.draw(batch);
        }
    }

One of the bodies has to be animated.

birdAnimation = new Animation(1, birdAtlas.getRegions());
birdAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);

This is the animation and now I tried to set the body's sprite obstacle6 to the current textureRegion from the Animation unsing this code:

obstacle6.setRegion(birdAnimation.getKeyFrame(delta));

Somehow it just shows the first texture of the atlas. How can I get it to change? Or is there an other way to animate a box2d body?
If you need any other information just comment.

sentences:
How do open-world game saves work? (Sorry if this shouldn't be asked here, I'm unsure if it's appropriate based on what's allowed here.)

I'm not developing a game, but I'm very curious about this. I've played some large open-world games recently (Dishonored, for example), and it boggles my mind how much information must be stored for save files. If I pick up a bottle from where it spawned and throw it, then save while it's in mid-air, the save file needs to contain a) what type of bottle it is, b) where it is right now, c) what orientation it's currently in, and d) what its current trajectory is. This is the case for every non-fixed asset in the current level. Pathing NPCs have to have their current state tracked as well.

So, in general, how do games accomplish this? I'm sure the implementation varies, I'm not asking for any specific game, but the overall concept must be similar across games. Even more impressive to me is that quick saves often seem to be instant, with no delay whatsoever after pressing the key.

sentences:
How to Change position + rotation of a parent while keeping X and Z Rotation Sooo this question is a problem , a evolution by another solution of this problem here:

How can I change the parents rotation so the childs rotation is looking at a specific direction

Basically:

We have a "Eye" (HTC Vive).
We have a "Parent" which is the Parent of "Eye".

We can not change the position or rotation of the Eye in code.
We can only change the position and rotation of the Parent.

1.We want to modify the Parent Position so that Eye to goes to a certain "Target 1" position.

2.We want to modify the Parent Y-Rotation so that the Eye looks at a certain  "Target 2" position.

3.While doing this we dont want to modify the Parent X or Z , because this would lead to a Rotated game experience.

The Parent Position changes so the Eye gets to "Target 1" position.
The Parent Position changes so Y- Rotation should look at Target 2 position
The Parent X/Z Rotation should not modify the Eye X/Z

sentences:
HTML5 Canvas Tileset Animation How to do in HTML5 canvas Image animating?

I am have this code now: http://jsfiddle.net/WnjB6/1/

In here I am can add animations something like -> Animation.add('stand', [0, 1, 2, 3, 4, 5]);

But how to play this animation? My image drawing function is -> drawTile(canvasX, canvasY, tile, tileWidth, tileHeight);

Animation['stand']; return 0, 1, 2, 3, 4, 5

I am need something like when I am run Animation.play('stand') run animation from 'stand' array.

I am try to do this something like one day, but no have more idea how. :(

Thanks and sorry for my bad English language.

sentences:
Unity: Move Collider up stairs/ramps The bots have a simple Capsule collider which cannot tilt. Movement is applied across the horizontal axes, gravity is enabled on the rigidbody. It moves up stairs okay with steps roughly 0.2 units high. When the bots speed is too slow or he is moving up steep ramps he gets stuck. I've tried tinkering to fix the problem but to no avail.

    float gravity = currentMovementSpeed * 2f;
    Physics.gravity = new Vector3(0, -gravity, 0);

Here is the problem: https://youtu.be/ypCavT3_As0

What is a simple way to consistently force a collider up ramps and stairs?

sentences:
How do I simulate the mouse and keyboard using C# or C++? I want to start develop for Kinect, but hardest theme for it - how to send keyboard and mouse input to any application. In previous question I got an advice to develop my own driver for this devices, but this will take a while.

I imagine application like a gate, that can translate SendMessage's into system wide input or driver application with API to send this inputs. So I wonder, is there are drivers or simulators that can interact with C# or C++?

Small edition: SendMessage, PostMessage, keybd_event will work only on Windows application with common messages loop. So I need driver application that will work on low, kernel, level.

sentences:
Looking for collision detection algorithms for broad and narrow phases between non-convex polyhedrons I have some experiences on particle system simulation (namely DEM - Discrete element method), in which an individual particle with realistic shape (convex and non-convex) is approximated by gluing 3D spheres together (non-overlapping or overlapping), and act like rigid body. The collision detection is performed by the simplest sphere-sphere contact.

Nevertheless, for particle shape representing by polyhedrons, almost all the collision detection algorithms for broad and narrow phases are based on convex polyhedron (e.g. GJK). For non-convex/concave shapes, convex decomposition is required to divide the concave object into many convex components (e.g. V-HACD).

At this point, I really want to know the details on:

  1) how to store the concave objects via many convex components into memory (like BSP tree?);

  2) collision detection and contact forces calculation between
  convex-concave, concave-concave objects.

I have searched quite a few relevant books like "Real-time collision detection" and "3D game engine design", etc,  unfortunately I haven't find any details on this topic yet. Could some veteran game developers give some advice or insight on how to implement collision between concave objects?

Cheers,

David

Update 1:

Seems the physics engines likes Bullet3 and reactPhysics3D are able to simulate collision of non-convex objects. Can someone give some rough idea on how to do this? before I dig into the source codes, since i have only some academic experiences on molecular dynamics / DEM simulations mainly based on 3D spheres.

sentences:
Unity C# GameObject Clones Sharing the Same Script When I Don't want them to I've been having issues with a game I've been working on for a while. It's a pretty big project. I'm having some issues with two tree prefab game objects sharing code, where I don't want them to.

When the player presses E while facing them, they start searching the tree for items like apples. It was all working well, until I added another tree. Now, when I search one tree, it searches all trees in the scene. Obviously, I don't want that to happen.

I have provided my code, below. What am I doing wrong?

public class Search : MonoBehaviour
{
    public List<Item> items;
    public bool searched = false;
    public GameObject inventory;
    public Inventory inv;
    public Log log;
    public AudioSource takeSFX;
    public GameObject player;

    void Awake()
    {
        inventory = GameObject.Find("  Inventory Master");
        inv = inventory.GetComponent<Inventory>();
    }

    void Start()
    {
        log = GameObject.Find("  Game Master").GetComponent<Log>();
        AddItems();
        items = new List<Item>();
    }

    void Update()
    {
        SearchObject();
    }

    public void AddItems()
    {
        int rand = (int)Random.Range(0, 2);
        Debug.Log(rand);

        for (int i = 0; i < rand; i++)
        {
            items.Add(inv.database.FetchItemByID(0));
        }
    }

    public void SearchObject()
    {
        if (Input.GetButtonDown("Interact"))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();
            Debug.Log("Raycasting");

            if (Physics.Raycast(ray, out hit, 10))
            {
                Debug.Log("Searching");

                if (!searched)
                {
                    this.takeSFX.Play();

                    if (items.Count >= -0)
                    {
                        for (int i = 0; i < items.Count; i++)
                        {
                            this.inv.AddItem(items[i].ID);
                        }
                    }

                    if (items.Count == 0)
                        log.UpdateLog("No items found in search.");
                    else if (items.Count == 1)
                        log.UpdateLog("1 item found in search.");
                    else
                        log.UpdateLog(items.Count + " items found in search.");
                    searched = true;
                }
            }
        }
    }
}

sentences:
Minecraft-Style Voxel Sunlight Algorithm I'm implementing a pure Minecraft clone, and I want to implement sunlight.
I have a basic sunlight algorithm working perfectly in 2D, and I understand how to scale it to 3D.  But how do I make it so I don't have to recompute the entire sunlight every time I place a block?

Pseudocode, because the actual algorithm is not written very well :)

FUNC propogateSunlight(x,y,z):
    IF (x,y,z) is out of bounds then RETURN
    IF light_at(x,y,z) is <= 0 then RETURN

    # PROPOGATE
    IF light_can_spread(x,y-1,z) AND light_at(x,y-1,z)<light_at(x,y,z) then:
        set_light_at(x,y-1,z) to light_at(x,y,z)
        propogateSunlight(x,y-1,z)
    IF light_can_spread(x-1,y,z) AND light_at(x-1,y,z)<light_at(x,y,z) then:
        set_light_at(x-1,y,z) to light_at(x,y,z)-1
        propogateSunlight(x-1,y,z)
    *repeat above IF statement for (x-1,y,z), (x+1,y,z), (x,y,z-1), (x,y,z+1) and (x,y+1,z)

Then it sets the top layer to 16 (the max light level) and calls propogateSunlight on the top level.

This algorithm does what I want it to PERFECTLY.  The only downside is that it is really really slow.

So what (psuedocode) algorithm is there to place / remove blocks (without transparency) that make it so I don't have to recalculate the entire world?

P.S. The coordinate system is standard 3d graphics, XZ is ground plane, +Y is up and -Y is down.

sentences:
Unity 2D graphical glitch cuts sprite diagonally While making a game in unity, we found a graphical glitch that only happens on one of our mobile devices (a htc) where the screen will be oddly sliced by a triangle as shown in this image;

I've searched online but found no problem. We're using unity 2D, it only does it on the HTC but we have no idea why.
The background is a 3D quad with a texture wrapped around it (so we can make it move with the character when the character is running, without having one large background).
Any help would be greatly appreciated.
Thanks

sentences:
Divide screen in eight sectors Currently in our game we use a 4 directional movement. Some abilities are triggered on mouse click and "fired" in the direction the player has clicked.
For this, I have split the screen in 4 sectors (like 2 diagonal cuts) to determine in which general direction the player has clicked.

Back then, I found a short helper class for this:

public static class Triangle
{
    private static Vector2 topLeft = new Vector2(0, 0);
    private static Vector2 topRight = new Vector2(Orbs.graphics.PreferredBackBufferWidth, 0);
    private static Vector2 bottomRight = new Vector2(Orbs.graphics.PreferredBackBufferWidth, Orbs.graphics.PreferredBackBufferHeight);
    private static Vector2 bottomLeft = new Vector2(0, Orbs.graphics.PreferredBackBufferHeight);

    //Return true if p1 and p2 are on the same side of BA
    private static bool SameSide(Vector2 p1, Vector2 p2, Vector2 A, Vector2 B)
    {
        // Convert points to Vector3 for use the Cross product, which is Vector3-only
        Vector3 cp1 = Vector3.Cross(new Vector3(B - A, 0), new Vector3(p1 - A, 0));
        Vector3 cp2 = Vector3.Cross(new Vector3(B - A, 0), new Vector3(p2 - A, 0));
        return Vector3.Dot(cp1, cp2) >= 0;
    }

    //Return true if the point p is in the triangle ABC
    private static bool PointInTriangle(Vector2 p, Vector2 A, Vector2 B, Vector2 C)
    {
        return SameSide(p, A, B, C) && SameSide(p, B, A, C) && SameSide(p, C, A, B);
    }

    public static string GetAndSetPlayerOrientationByClickedSector()
    {
        Vector2 playerCenter = new Vector2(//getPlayerCenter);
        Vector2 mouseWindowPos = Microsoft.Xna.Framework.Input.Mouse.GetState().Position.ToVector2();

        if (PointInTriangle(mouseWindowPos, topLeft, playerCenter, topRight))
            return "North";

        if (PointInTriangle(mouseWindowPos, topRight, playerCenter, bottomRight))
            return "East";

        if (PointInTriangle(mouseWindowPos, bottomRight, playerCenter, bottomLeft))
            return "South";

        if (PointInTriangle(mouseWindowPos, topLeft, playerCenter, bottomLeft))
            return "West";

        return "";
    }
}

Now, we are extending our movement in eight directions and therefore I need to extend this helper class to return the diagonal directions (SouthEast and so on) as well.

I am not even sure if this is doable properly with this approach, but I guess I only need to define the points of the additional triangles.
Any suggestions on how to solve this are welcome.

sentences:
Maya users; how can I create my own particle emitter in Maya? (Originally posted in the Programmers Stack Exchange, but was told to ask here instead. Whoops.)

Before you answer this with "well, use the built-in particle emitter", read further.

For one of my university assignments, I have to build a scene involving a Catherine wheel (a spinning firework, basically) attached to a fence post in Maya 2015. I had intended on using Maya's built-in particle emitter, but my lecturer has told me that he would prefer me to create my own.

I have only a vague idea of what to do. I know that I need to assign a position, velocity, lifespan and a trigger flag that re-spawns each particle (all of which are arrays that depend on the number of particles the user wishes to spawn), but I don't know how to arrange them.

Any tips and advice would be appreciated.

Thanks

sentences:
Ball always showing in Unity Some weird "ball" is showing when I select an element in Unity, preventing me to see the object itself:

I've tried to hide some layers, but even with all layers hidden it's still here:

Do you know how to hide this thing?
Any idea is greatly welcomed :)

sentences:
Weird "jiggly"/"warping" effect on my tiles I need help with a problem I'm having in Unity regarding a "jiggly"/"warping" effect. It is a strange effect which occurs when I move my sprite character and makes the tiles have additional pixels which aren't on the sprite and disappear when you move more.
I've also linked a video of my issue; you can see it more clearly on the tree.
To note:

My tiles are 16x16, my fox sprite is 64x64 and the enemy sprite is 48x48.
I'm using Cinemachine.

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:
Window handle is invalid I'm trying to implement an input listener for FNA (modern version of XNA). Since FNA does not supply any sort of way to listen to native input this has to be done through the windows API and native calls. This is how I set this up:
public KeyboardListener(GameWindow window) {
    var procedurePointer = Marshal.GetFunctionPointerForDelegate<WindowProcedure>(Procedure);
    procedure = new IntPtr(SetWindowLongPtr(window.Handle, GWL_WNDPROC, procedurePointer.ToInt64()));
    if (procedure == IntPtr.Zero)
    {
        var error = GetLastError();
        throw error switch
        {
            ERROR_INVALID_WINDOW_HANDLE => new InvalidOperationException("Invalid window handle"),
            _ => new InvalidOperationException($"Unknown error message '0x{error:X4}'")
        };
    }
}

// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptra#parameters
private const int GWL_WNDPROC = -4;

// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlonga
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
private static extern int SetWindowLongPtr(IntPtr hWnd, int nIndex, long dwNewLong);

[DllImport("Kernel32.dll", CharSet = CharSet.Unicode)]
private static extern uint GetLastError();

I construct the keyboard listener during the Initialize method of Game:
class MyGame : Game {
    protected override void Initialize() {
        new KeyboardListener(Window);
    }
}

This is the method call that reports the error: SetWindowLongPtr(window.Handle, GWL_WNDPROC, procedurePointer.ToInt64()) and it throws "Invalid window handle". It's worth noting that the example code I saw converted the pointers to Int32 instead of Int64, but I am on a 64 bit machine so the pointers can not fit in 32 bits.

What I've tried & figured out so far...

Debugging tells me that both window.Handle and procedurePointer
are non-null and at least point to something.
I have tried to initialize it earlier or later, but that doesn't seem to make a
difference.
Other native methods such as SDL2.SDL.SDL_MinimizeWindow(Window.Handle) work perfectly fine and don't complain about the window handle.

sentences:
Android OpenGLES, getting number of fragments passed depth test/Occlusion Query? Afeter reading many blogs and searching on Internet, I did not get any sloution for getting number of fragments/pixels which are occludded or not occludded of the object on OpenGL ES3.0 Android version.
GL_SAMPLES_PASSED is not present on OpenGL ES3.0.
Is there any way to get these occluded or non occluded fragments on Android OpenGl ES3.0?

sentences:
Move Particle to touch position on android I am attempting to make a Particle start moving to the position of my finger on the touch of the screen.

I have been using this as the basis so far:

public void update()
{
    deltaX *= .9;
    deltaY *= .9;

    this.x += this.deltaX;
    this.y += this.deltaY;
}

public void moveTo(int newX, int newY)
{
    float dx = newX-this.x;
    float dy = newY-this.y;

    float length = (float) Math.sqrt(dx*dx+dy*dy);

    dx/=length;
    dy/=length;

    dx *= 10;
    dy *= 10;

    deltaX = dx;
    deltaY= dy;
}

now while it does move the Particle, it is rarely in the direction of my finger.
How can I make the particle have the correct amount of velocity to get to the position of my finger, but no farther?

Thanks in advance!

sentences:
Box2D fixed timestep updating is twitchy on constant FPS I'm messing around with libgdx and box2d and I'm trying to implement sidescroller movement with fixed timestep logic according to the famous Fix Your Timestep! tutorial/guide. However, logic updating seems to be twitchy and I'm not exactly sure why.

Here's the render method where the issue lies:

public void render() {
    handleCameraInput();
    handleTestBodyInputImpulse();
  //handleTestBodyInputVelocity();

    accumulator += Math.min(Gdx.graphics.getDeltaTime(), STEP);

    int logicStepCount = 0;
    while (accumulator >= STEP) {
        world.step(STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
        accumulator -= STEP;
        ++logicStepCount;
    }

    Gdx.graphics.setTitle("FPS: " + Gdx.graphics.getFramesPerSecond() + ", Logic steps: " + logicStepCount + ", Test body vel: " + testBody.getLinearVelocity());

    cam.update(); // update box2d world camera
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.render(world, cam.combined); // renders box2d bodies
}

From what I've noticed the logic while loop responsible for updating the physics sometimes doesn't execute (counter goes from 1 to 0 for one frame) and that seems to be causing the twitching. This is weird to me since delta time added to the accumulator is clamped and since the FPS is constant 60 on my machine I'd assume that the loop should always execute once. Am I doing something wrong? Is this behavior normal and is it something I am supposed to solve during rendering with interpolation?

Complete minimal example can be found here on Gist and can be run on any LibGdx project with Box2d dependency.

sentences:
Quit the application when clicking cancel button of Alert View in C# Can someone guide me as to how can I make an application quit when you press the cancel button of an Alert View in C# code?

Thanks

I forgot to add that I am trying to quit application on clicking ok button on alert view which I am developing on Unity platform.

sentences:
Transmission implementation in a car game I'm trying to create a simple car game with manual gear changes. However, I'm having a bit of trouble implementing the gear changes.

Here's my current code for the "car":

int gear = 1; // Current gear, initially the 1st
int gearCount = 5; // Total no. of gears

int speed = 0; // Speed (km/h), initially 0
int[] maxSpeedsPerGear = new int[]
{
    40,  // First gear max. speed at max. RPM
    70,  // Second gear max. speed at max. RPM
    100, // and so on
    130,
    170
}

int rpm = 0; // Current engine RPM
int maxRPM = 8500; // Max. RPM

public void update(float dt)
{
    if(rpm < maxRPM)
    {
        rpm += 65 / gear; // The higher the gear, the slower the RPM increases
    }

    speed = (int) ((float)rpm / (float)maxRPM) * (float)maxSpeedsPerGear[gear - 1]);

    if(isKeyPressed(Keys.SPACE))
    {
        if(gear < gearCount)
        {
            gear++; // Change the gear
            rpm -= 3600; // Drop the RPM by a fixed amount
            if(rpm < 1500) rpm = 1500; // Just a silly "lower limit" for RPM
        }
    }
}

However, this implementation doesn't really work. The first gear works fine, but the following gear changes cause the speed drop. By adding some debugging messages, I get these speed values when changing at the RPM limit:

Speed at gear 1 before change: 40
Speed after changing from gear 1 to gear 2: 41

Speed at gear 2 before change: 70
Speed after changing from gear 2 to gear 3: 59

Speed at gear 3 before change: 100
Speed after changing from gear 3 to gear 4: 76

Speed at gear 4 before change: 130
Speed after changing from gear 4 to gear 5: 100

As you can see, the speed after each change is slower before the change. How would you take into consideration the speed before the gear change so that the speed wouldn't drop when changing gears?

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:
Animator from another gameobject keeps disappearing from script on play I am working on a gun script and it worked fine until earlier today when I made a change to the script and it stopped working. I put it back, but for some reason now the animator object attached to the script keeps disappearing.

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

public class RifleShooting : MonoBehaviour
{
    private float NextTimeToFire = 0f;
    private int CurrentAmmo;
    private bool IsReloading = false;

    [Space(10)]
    [Header("Floats")]
    public float Damage = 10.0f;
    public float Range = 100.0f;
    public float ImpactForce = 60f;
    public float FireRate = 15f;
    public float ReloadTime = 1.0f;

    [Space(10)]
    [Header("Others")]
    [Space(5)]

    [Space(10)]
    [Header("Others")]
    [Space(5)]
    public int MaxAmmo = 10;
    public Camera FPSCamera;
    public Animator GunAnimations;
    public ParticleSystem MuzzleFlash;
    public GameObject impactEffect;
    public bool AllowedToShoot = true;
// Start is called before the first frame update
    void Start()
    {
        GunAnimations = GetComponent<Animator>();
        if (CurrentAmmo == -1)
            CurrentAmmo = MaxAmmo;
    }

    private void OnEnable()
    {
       IsReloading = false;
        GunAnimations.SetBool("Reloading", false);
    }
    // Update is called once per frame
    void Update()
    {
        if (IsReloading)
        return;

        if (CurrentAmmo <= 0)
        {
            StartCoroutine(Reload());
            return;
        }

        if (AllowedToShoot == false) return;
        {
            if (Input.GetButton("Fire1") || Input.GetButtonDown("Fire1") && Time.time >= NextTimeToFire)
            {
                NextTimeToFire = Time.time + 1f / FireRate;
                Shoot();
            }
        }
    }

    IEnumerator Reload()
    {
        IsReloading = true;
        Debug.Log("Reloading...");
        GunAnimations.SetBool("Reloading", true);
        GunAnimations.SetBool("IsShooting", false);
        yield return new WaitForSeconds(ReloadTime - .25f);
        GunAnimations.SetBool("Reloading", false);
        yield return new WaitForSeconds(.25f);
        GunAnimations.SetBool("IsShooting", true);
        CurrentAmmo = MaxAmmo;
        IsReloading = false;
    }

    void Shoot()
    {
        //shooting script here
    }
}

Also if it helps here is what I see in the console when I try to fire:

MissingComponentException: There is no 'Animator' attached to the "M4A1" game object, but a script is trying to access it.

sentences:
How to rotate a sprite on touch/drag done on the screen wih Andengine? when I look at the andengine examples I saw an example about rotate a sprite with joystick. Here is the code;

    final float y2 = (this.mPlaceOnScreenControlsAtDifferentVerticalLocations) ? 0 : y1;
    final float x2 = CAMERA_WIDTH - this.mOnScreenControlBaseTextureRegion.getWidth();
    final float x1 = 0;
    final float y1 = CAMERA_HEIGHT - this.mOnScreenControlBaseTextureRegion.getHeight();
    final AnalogOnScreenControl rotationOnScreenControl = new AnalogOnScreenControl(x2, y2, this.mCamera, this.mOnScreenControlBaseTextureRegion, this.mOnScreenControlKnobTextureRegion, 0.1f, this.getVertexBufferObjectManager(), new IAnalogOnScreenControlListener() {
        @Override
        public void onControlChange(final BaseOnScreenControl pBaseOnScreenControl, final float pValueX, final float pValueY) {
            if(pValueX == x1 && pValueY == x1) {
                face.setRotation(x1);
            } else {
                face.setRotation(MathUtils.radToDeg((float)Math.atan2(pValueX, -pValueY)));
            }
        }

        @Override
        public void onControlClick(final AnalogOnScreenControl pAnalogOnScreenControl) {
            /* Nothing. */
        }
    });

That is okay for joystick BUT I want to implement this without joystick.. I mean when user drag/slip the screen with finger than sprite will also rotate according to finger movement. By the way I only want to rotate NOT move.. And here is code that I try to;

mScene.setOnAreaTouchListener(new IOnAreaTouchListener() {

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                ITouchArea pTouchArea,final float pTouchAreaLocalX,
                final float pTouchAreaLocalY) {
            if(pTouchAreaLocalX == x1 && pTouchAreaLocalY == x1) {
                face.setRotation(x1);
            } else {
                face.setRotation(MathUtils.radToDeg((float)Math.atan2(pSceneTouchEvent.getX(), -pSceneTouchEvent.getY())));
            }
            return false;
        }
    });

and my code didn't work.. Is there any suggestion ? Thanks...

sentences:
Distance between two lines (textbook answer vs practical application) I'm reading through "Mathematics for 3D Game Programming, and Computer Graphics" as a refresher, and leading in to some more complex real world problems down the line. However, one of the early chapters has a bit of math that seems overly complicated. This question deals with a problem from the textbook, that I believe the solution is far simpler than their recommended one.

The problem is to find the distance between two lines (in 2 or 3 dimensions).

Some set up:

1) Lines are set up parametrically as opposed to two points.

Line 1:

Line 2:

Where P = S + tV -- S is the starting point (say, A) and equals (1-t) * A

Now the book states to use this solution :

Expanded looks like:

Then the books next step is to reduce this, and take the derivatives with respect to time for both

 and

Once the derivatives have been calculated. We move to a matrix form, and solve using some linear algebra.

My question is this, why would I use that series of steps when I already know the [ x, y, z ] for both points using the parametric. With those values wouldn't the simpler solution be just to do:

Then:

Finally:

Is there some direct application of the former equations that I am missing (the book does not elaborate currently on its applications here)? I've had some discussion with other game developers, and we haven't found much a use case for the linear algebra set up.

Edit: (The linear algebra solution)

First both derivatives with respect to time:

Then in matrix form, solve for both t variables:

sentences:
Catmull Rom Spline - Constant Speed Given the equations found in the answer here:

Determine arc-length of a Catmull-Rom spline to move at a constant speed

How would one A) Apply this to a 3D Catmull-Rom Spline, and B) write A out programmatically (for the math illiterate)?

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:
Difference between GUILayout and EditorGUILayout? Is it matter if I use GUILayout or EditorGUILayout for my custom editor? I need to use one of them in the OnInspectorGUI function.

which one should I use? What are the differences between the two?

Thank you in advance.

sentences:
3D Collisions - Walking below a slope pushes me through the floor Here's a really short video (less than 30s) of this issue : https://www.youtube.com/watch?v=JrKbpTY8cMU

When I move the player towards a slope (the player is below it), it pushes the player inside the floor Collider instead of blocking it.

I've searched the Internet for a while but haven't found anything about it

Do you have something in mind ?Thanks for your time

Info : I move the player using rigidbody.MovePosition()

The collision of the player is a Capsule.

sentences:
Best way to deal with a large variety of items? I am currently working on my first java game and I am having trouble figuring out how I should implement my classes that will have heavy variety.  For example, I am considering having an abstract item class that every item in the game will inherit from, but I don't really know how specific I should get with the sub classes.  Is an armor class enough?  Should I break it down into where the armor will be equipped(head, chest, etc)?  Should I go so far as to give every single item it's own class and use a factory?

I apologize in advance for the noobie question, I have been searching around for a couple of hours but haven't been able to find a solid best practices guide that really goes in depth with this kind of stuff.

sentences:
What shapes interlock solidly like cubes? What basic geometric shapes, besides cubes, interlock "minecraft" style like cubes?

A small edit to make question more suited to Game Dev:

I am experimenting with game dynamics to create geometric solids interlock seamlessly on their faces much the way the cubes do in minecraft. The objective is to create an interlock system that is also memory efficient consistent enough to maintain interlock over the course of many connections without deviating from the main grid.

sentences:
Designing for multiple screen resolutions and aspect ratios, target one resolution then scale to meet others or use normalized values? I feel like what I'm currently doing is stupid but would just like reaffirmation it is. Basically I'm writing games which target a certain screen resolution (800x480), so all positions, widths and heights I set for sprites is for that resolution.

On the engine side I have special scalers which will change the width and height of what is being drawn to meet the current platforms res, so for example if the platforms screen res is 1200x720 I will stretch a sprite by a factor of:

1280 / 800.0f;
720 / 480.0f;

Positions are also offset and manipulated in a similar way.

I really feel I should move to a normalized system for widths and positions (i.e. 0 to 1) but at the same time feel this is more intuitive since the first platform I target is 800x480 and I already kind of have a good udnerstanding of dimensions and such for that.

So my question is, is it really that bad to target a specific ccreen res then in the engine side modify this res to meet different platforms?

sentences:
Determining and culling non-visible vertices Ahoy!

After posting my previous question on tile maps, i've been tinkering with an implementation i'm rather pleased with so far but would like to gather some more information about submitting geometry to be rendered by OpenGL.

A little background information:

I've set up a tile map which renders "volumes" in a layered manner very much like Minecraft's implementation using voxels (note; i'm not creating another bloody minecraft clone!) but with a twist in that any "volume" can be extruded along the Y-axis to create variably sized tiles. This all works fine and for the purposes of my tile map, is exactly what I set out to achieve.

My question:

My current confusion lies within the realms of how the vertex data is submitted to be rendered. I'm conscious that when two volumes are rendered in a single tile (think of them as layers; rock on the bottom, mud or water on top), the bottom volume is not actually visible unless there are no neighbouring tiles. To this end, is there any point in submitting the vertices for an object that may not be visible?

Consider two cuboids side by side. From any angle, you can only ever see 5 faces of each cuboid as the other faces are adjacent. Does OpenGL recognise this and discard them (if glCullFace or another appropriate method is used/enabled?) or do I need to actually determine what is visible and remove redundant vertices myself? Is there any harm in not removing them?

For the purposes of my tile map, I don't imagine that my "world" will ever be large enough to cause issues with rendering speed but I'd would like to optimise this so non-visible volumes are simply not rendered. I've been toying with a few ideas for determining which volumes are visible before adding them to the VBO but was wondering how much leg work OpenGL would do for me. There's no point me trying to solve a problem that doesn't exist and also, would OpenGL be able to calculate this much quicker that my own implementation?

I'd like the tile map to be deformable whereby the top-most volumes can be removed or resized to reveal the volumes below (also, some tiles may be transparent, such as water) so rendering the whole tile map (or at least what is visible on screen) would seem necessary.

I have the implementation down and working so far and it's running at a reasonable speed without any issues. I'm just not sure how much work OpenGL does in the background with regards to rendering and culling vertex data that isn't actually visible due to it being obscured by other objects. Can anyone provide insight into this, or at least point me in the direction of where I can read up on such matters?

Any help and information would be greatly appreciated :)

sentences:
Real-time MMO: how should authoritative server update client position I'm trying to build a real-time MMO game. I'm using Phaser for FE and Node.js + socket.io for BE. I have read all the tutorials like http://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html and so on.

Different players might have different FPS, this is how I update position on the client:

const data = {
  down: this.cursors.down.isDown,
  timestamp: Date.now()
};

var deltaTime = (data.timestamp - this.lastTimestamp) / 1000;
if (data.down) {
    player.position.y += speed * deltaTime;
    socket.emit('input', data);
}

This ensures speed is FPS independent (every player is moving with the same speed).

The server is running a tick at 60 FPS. This method is processing saved inputs from players.
How should the server correct player positions? It doesn't know their delta times. It can't use server's delta time since it would be always around 0.016 and it doesn't reflect player's update interval.

tick() {
    var now = Date.now();
    var serverDelta = (now - this.prevTimestamp) / 1000;
    this.prevTimestamp = now;

    for (var player of players) {
        player.update();
    }
}

player.update() {
    for (input in savedInputs) {
          player.y += input.down * speed;
    }
}

sentences:
Can you run OpenGL 2.0 on modern machines? I'm looking to get into 3d with OpenGL, using SDL to help with other stuff.

I found plenty of good tutorials (lazyfoo is a big one), but "Learning Modern 3d Graphics Programming" uses a newer version of openGL that I'm not able to run!

I opened up OpenGL extensions viewer, and I can only run OpenGL 2.0, whereas most tutorials are in higher versions.

I ask this because I've heard that just about everything in 2.* got depreciated in the newer versions, so I'm worried that my code might not work.

I'm looking at a few other tutorials, but I'm so used to SDL that those just confuse me...

So should I bother trying to do graphics programming now,  or should I just wait until I can upgrade my computer?

sentences:
Can I directly pass a Boost ptr_vector list to glBufferData? I have a data structure like this:

typedef struct vertex_ {
float x;
float y;
float z;
float s;
float t;
}vertex;

Then I add to a list called: boost::ptr_vector<vector> vertices;

Is there a way to use vertices to provide the parameters for glBufferData?

sentences:
Autoscroll a TextArea to youngest/freshest row/line I want to use a TextArea UI widget as a UI integrated Logger.
Therefore the TextArea should always show the youngest message.

I browsed the whole API to find the proper method but could not find any.
TextArea$setCursorPosition while passing TextArea$getLines as its parameter did not worked as intended.

I read about TextArea$setPrefRows and used it with getLines but also no luck.

How can I use TextArea to get autoscroll behaviour down to the most recent line?

sentences:
Why does the order of Farseer collision categories affect collisions? I've discovered a bizarre issue with the Farseer Physics Engine that I can't figure out. I have two Farseer bodies that I'd like to only collide with each other. To that end, I have the following code.

body1.CollisionCategories = Category.Cat1;
body1.CollidesWith = Category.Cat2;

body2.CollisionCategories = Category.Cat2;
body2.CollidesWith = Category.Cat1;

Which works fine. However, if I switch the categories around (shown below), the bodies no longer collide.

body1.CollisionCategories = Category.Cat2;
body1.CollidesWith = Category.Cat1;

body2.CollisionCategories = Category.Cat1;
body2.CollidesWith = Category.Cat2;

Some additional notes that might be relevant:

body1 is static, while body2 is dynamic.
body1 is created before body2 (although I switched the order and nothing changed).

Does anyone know why this happens? Based on my understanding of how Farseer uses collision categories (i.e. as masks using bitwise operations), the order shouldn't matter. Is it something silly I'm missing?

Thank you.

sentences:
How to code a simple torch light? How would you code a simple "8 bit fire torch" (just one, nothing else to worry about on screen), without using any sprites?

For instance, how would you "animate" a torch that looks like this one:

sentences:
Skinning, Bones, IK of character lost after Unity restart. Reproduceable After i properly rig my character for skeletal animation with IK and everything works as expected but I quit my editor and restart, all bones are gone, IK does not correspond to the limbs and nothing works.

It is reproducible. What can I do?

Image is after restart and nothing works.

sentences:
After building a .exe file game view does not show whole viewport So, I went to build a game today in a .exe, and when I build it, it doesn't show the whole viewport as it does in the unity engine itself. So the game is cut off. It does this no matter what I do.

What I see in Unity:

What I get running the exe:

Anyone know what's causing this?

sentences:
How to synchronize damage with attack animation in a RTS game? I have been working on a RTS game in unity and did damage deal through code and a timer but it does not fit with the animations quet well. The damage is dealt in the beginning of the animation and about 4 attacks it fits perfectly and after more 4 attacks the damage is dealt delayed after the animation.

My big question is if hitboxes would be a good answer to solve this problem or is it to preformance heavy?

sentences:
Check gap in 3d environnement I am in a 3d environnement, when I jump, i'm calculating the hitPoint of the end jump. I want to know when I jump, if there is a GAP between my initial point, and the end point.

But I don't want to set any trigger in the Level Design...

My Initial Idea is to do Raycast each 5-6 steps, but I wonder if this is too much cost effective. MayBe it isn't ?

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:
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:
BIM Model clipping issues in Unity 2020 I have BIM model that I am using in 2018 version of Unity engine. When import the model into my project on 2019 OR 2020 version of the Unity engine, clippings on certain surfaces of the model occurs.
Has anyone encountered this issue with Unity 2020? Any solutions that can be suggested for me to try?
Examples attached.
Appreciate any help in advance...

sentences:
How to Make Objects Fall Faster in a Physics Simulation I used the collision physics (i.e. Box2d, Physics Body Editor) and implemented onto the java code. I'm trying to make the fall speed higher according to the examples:

It falls slower if light object (i.e. feather).
It falls faster depending on the object (i.e. pebble, rock, car).

I decided to double its falling speed for more excitement. I tried adding the mass but the speed of falling is constant instead of gaining more speed. check my code that something I put under input processor's touchUp() return method under same roof of the class that implements InputProcessor and Screen:

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button)
{
    // TODO Touch Up Event

    if(is_Next_Fruit_Touched)
    {
        BodyEditorLoader Fruit_Loader = new BodyEditorLoader(Gdx.files.internal("Shape_Physics/Fruity Physics.json"));

        Fruit_BD.type = BodyType.DynamicBody;
        Fruit_BD.position.set(x, y);

        FixtureDef Fruit_FD = new FixtureDef(); // --> Allows you to make the object's physics.
        Fruit_FD.density = 1.0f;
        Fruit_FD.friction = 0.7f;
        Fruit_FD.restitution = 0.2f;

        MassData mass = new MassData();
        mass.mass = 5f;

        Fruit_Body[n] = world.createBody(Fruit_BD);
        Fruit_Body[n].setActive(true); // --> Let your dragon fall.
        Fruit_Body[n].setMassData(mass);
        Fruit_Body[n].setGravityScale(1.0f);

        System.out.println("Eggs... " + n);

        Fruit_Loader.attachFixture(Fruit_Body[n], Body, Fruit_FD, Fruit_IMG.getWidth());
        Fruit_Origin = Fruit_Loader.getOrigin(Body, Fruit_IMG.getWidth()).cpy();

        is_Next_Fruit_Touched = false;
        up = y;
        Gdx.app.log("Initial Y-coordinate", "Y at " + up);

        //Once it's touched, the next fruit will set to drag.
        if(n < 50)
        {
            n++;

        }else{

            System.exit(0);

        }
    }

    return true;
}

And take note, at show() method , the view size from the camera is at 720x1280:

    camera_1 = new OrthographicCamera();
    camera_1.viewportHeight = 1280;
    camera_1.viewportWidth = 720;
    camera_1.position.set(camera_1.viewportWidth * 0.5f, camera_1.viewportHeight * 0.5f, 0f);
    camera_1.update();

I know it's a good idea to add weight to make the falling object falls faster once I released the finger from the touchUp() after I picked the object from the upper right of the screen but the speed remains either constant or slow. How can I solve this? Can you help?

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

What should I correct?

sentences:
How should a Unity object control it's state? I've been using Unity's component based design, and the biggest problem I've faced is how to control an object's( not component's ) state.

The problem is, some components must act differently based on the object's state. However, checking an object's state within a non-specific component( imagine we have a "DamageEnemyComponent" ) won't work at all because it makes assumptions about the object it's attached to.

The alternative is to make each component perform one, and only one function. The components are then disabled/enabled or added/removed depending on the object's state( probably managed by a more specific component. )

Imagine we have a "Boomerang" object. Assume it has only two states; idle( being held by the player ) and firing. In the idle state, the boomerang would have very few components, because we don't want it to interact with the world while it's simply being held. It may have components to listen for a "throw", though. Once it is thrown, some state manager on the object needs to update the object to have components for moving, damaging enemies, maybe picking up items etc. When the boomerang is back in the hands of the player, it's component list would need to be restored. This would work, but it would basically be building a new game object for each state, which is incredibly tedious and messy without Unity's editor. Not to mention the inheritance and interfaces can't be used well here( since the state specific components will be built into the state manager script. )

I can't see a way to control state using Unity's components. How is this usually done? It feels as if Unity should provide a way to build different states in the editor, much like building an object.

sentences:
Animate/Interpolate and wait for completion. I'm implementing a blackjack game in flash and so far the logic is fine but there is no animation for the cards so they just appear and disappear which doesn't look very pleasing to the eye. I want to add some animations for when cards are dealt where they slide across to their position one by one.

Is there a simple way to just tell a displayobject to interpolate from one position to another while waiting for it to complete?

My current thought would be to just do something like this:

on enter frame:
   if a card is animating:
      move it further towards its destination;
      continue;
   else (if it is done animating):
      process as usual;
   end;
end;

I believe this would produce the results I'd expect because the game should only continue after the card being dealt is where it should be. However, this feels like a weird approach and I'm probably over thinking it which is why I'd like to know if any of you have a better solution.

sentences:
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 pick zoomed objects in an isometric game? I´m currently working on an isometric game engine and right now I'm looking for help concerning my zoom function.

On my tilemap there are several objects, some of them are selectable. When a house (texture size 128 x 256) is placed on the map I create an array containing all pixels (= 32768 pixels). Therefore each pixel has an alpha value; I check if the alpha value is bigger than 200 so it seems to be a pixel which belongs to the building. So if the mouse cursor is on this pixel the building will be selected -> PixelCollision.

Now I've already implemented my zooming function which works quite well. I use a scale variable which will change my calculation on drawing all map items.

What I'm looking for right now is a precise way to find out if a zoomed out/in house is selected. My formula works for values like 0.5 (zoomed out) or 2 (zoomed in) but not for values in between.

Here is the code I use for the pixel index:

var pixelIndex = (int)(((yPos / (Scale * Scale)) * width) + (xPos / Scale) + 1);

Example:

Let´s assume my mouse is over pixel coordinate (38, 222) on the original house texture. Using the code above we get the following pixel index:

var pixelIndex = ((222 / (1 * 1)) * 128) + (38 / 1) + 1;
               = (222 * 128) + 39
               = 28416 + 39
               = 28455

If we now zoom out to scale 0.5, the texture size will change to 64 x 128 and the amount of pixels will decrease from 32768 to 8192. Of course also our mouse coordinate changes by the scale to (19, 111). The formula makes it easy to calculate the original pixelIndex using our new coordinates:

var pixelIndex = ((111 / (0.5 * 0.5)) * 64) + (19 / 0.5) + 1;
               = (444 * 64) + 39
               = 28416 + 39
               = 28455

But now comes the problem. If I zoom out just to scale 0.75 it does not work any more. The pixel amount changes from 32768 to 18432 pixels since texture size is 96 x 192. Mouse coordinate is transformed to point (28, 166). The formula gives me a wrong pixelIndex.

var pixelIndex = ((166 / (0.75 * 0.75)) * 96) + (28 / 0.75) + 1;
               = (295.11 * 96) + 38.33
               = 28330.66 + 38.33
               = 28369

Does anyone have a clue what's wrong in my code? Must be the first part (28330.66) which causes the calculation problem.

sentences:
Streaming webcam via websocket performance issues (Code included) I finally figured out, how I can stream my webcam, but I'm getting not the best performance. In low resolutions it's working fine, but as soon as I turn the resolution up, the performance gets worse. I think Unity can't handle the decoding in that quality and speed so that the game is getting slowed down. Here is my Code :

Texture2D screenshot = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);
screenshot.ReadPixels(new Rect(0,0,Screen.width,Screen.height),0,0);
screenshot.Apply();
ws.Send(System.Convert.ToBase64String(screenshot.EncodeToJPG(quality)));

Hopefully there is something to improve.

sentences:
Unity - SpriteAtlas memory consumption I'm in the process of optimizing my application memory consumption.
To do so, I'm using Unity profiler while connecting to an Android device, which runs a development build of the application.

The application is using two types of sprite containers:

Sprite sheets created by the Texture packer.
Sprite Atlases created by unity.

Using the profiler, it is observed that while the sprite sheets (created by the Texture packer) take the expected amount of RAM, the sprite atlases created by unity consume DOUBLE the expected amount of RAM.

For example, the sprite atlas UIATLAS, whose size is 4096x4096 is supposed to consume 16MB of RAM:

But looking at the profiler, after running "Take Sample", you see the value 32MB:

My sprite atlas settings are:

Any help is welcome here.

One more comment (please review): UIAtlas belongs to an asset bundle called "atlas_ui". It is defined on several directories containing its sprites, all of which belong to the same asset bundle, atlas_ui. Is that the correct way to define it?

Thanks in advance!

sentences:
Is a dynamic enviroment map using pincushion curvilinear perspective projection possible? I'm wondering if it is possible to generate a dynamic spherical environment map using a single frame render using a pincushion curvilinear perspective projection matrix (phew, that's a mouthful)?

I've been researching this for a few days now and the closest thing I can find is a curvilinear perspective but it isn't a commonly used projection matrix so there isn't any help I was easily able to find and I still don't know if it supports a full circle FOV.

Why?

The standard perspective matrix but it begins to look very strange and distorted above 180 degrees vertical FOV and completely fails to render when approaching 360 degrees. So instead most games render the scene six times using 90 degree FOV facing the faces of a cube.

Rendering the scene 6 times seems like a waste if it might be possible to simply imagine a camera that has a 360 degree view across both axis and then render that to a spherical environment map.

sentences:
Rotating and pitching a turret I am new to game development and I was trying to build a turret model, and control it through lua script in shiva3d. I can rotate it around the y axis which is no problem, but when it comes to pitching, I am not sure how to do that in a way which is independent of the Y rotation, for example,

in the default position, rotating with a positive value around X aims upwards, which is what I expect.

when I rotate it by 180 degrees around Y, the positive rotation around X aims downwards towards the ground instead of upwards.

on the other hand, if I rotate by 90 degrees, the turret rotates around it self as if its rolling...

I am not sure what to look for in order to understand how rotation in a 3d world should happen, so any pointers on that would be much appreciated

sentences:
Line stipple with OpenGL ES 2.0 I found many threads about line stipple (dashed or dotted lines) with OpenGL ES2.0, but there are never any code examples or tutorials on how to implement it.

How do I implement line stipple in OpenGL ES 2.0?

sentences:
Alpha blending without depth writing A recurring problem I get is this one: given two different billboard sets with alpha textures intended to create particle special effects (such as point lights and smoke puffs), rendering them correctly is tedious.

The issue arising in this scenario is that there's no way to use depth writing and make certain billboards obey depth information as they appear in front of others that are clearly closer to the camera. I've described the problem on the Ogre forums several times without any suggestions being given (since the application I'm writing uses their engine).

What could be done then? sort all individual billboards from different billboard sets to avoid writing the depth and still have nice alpha blended results? If yes, please do point out some resources to start with in the frames of the aforementioned Ogre engine. Any other suggestions are welcome!

sentences:
Accounting for drift between ticks What are some solid techniques to account for the gap between processing time and frame update ticks? In other words, the game/render loop looks like this:

Some important points:

Tick timings are determined by the web api (roughly 16ms consistently)
Workers could either be triggered at the start of each tick (first checking if the previous one finished) or run continuously in their own loop.
I think running continuously is better if we can account for the gap, so as to not waste time being idle which could lead to skipped frames.
Either way - the size of the gap will vary between updates. It's not constant

note this article is a good reference: https://gafferongames.com/post/fix_your_timestep/ ... I haven't really tried applying it yet and I'm not sure if it fits the web constraints exactly.

sentences:
Managing past/present game state I'm not sure if "game state" is the correct term, as my searching shows me a lot of results that are not relevant to my question. When I say "game state", I'm talking about the internal state of the game being played: what units are spawned, where they are located and headed, what players are playing, what their current scores are, etc. Everything that would get wiped out if you were to start a "new game".

That said...

I'm curious how other people or other games handle the issues of client and servers appearing to need access to more than one copy of the game state.

For example, the client's job is to accept game state updates from the server, and render them. However, the server updates are usually much slower than the client render speed, so the client needs two copies of the state information in order to interpolate between the two and make everything appear to be moving smoothly. I'm not sure how you would accomplish this without having the client hold two copies of the game state, copying the current to the previous whenever the server sends an update.

Likewise, the server needs to make decisions on the current game state, and apply changes. However, if it only has one copy of the game state, then any changes it has already made will influence future decisions. If two players shoot at each other at the same time, and the server processes one shot before the other and writes the result to the same game state, it'll see the second player as now being dead and unable to shoot. If it had two different game states, "current" and "next", any new changes (such as player death) would be written to the "next" state, and since they are both still alive in the "current" state, each shot would get processed and both players would end up dead, as expected.

However, having multiple game states creates a lot of other problems:

Each copy of the game state could be very large, with many players playing, and hundreds or thousands of units moving around the game world. This would be a lot of data to be copying around just to keep multiple game states synchronized.
While having two separate game states fixes the server problem of two entities killing each other at the same time, it presents new problems when an entity is newly-spawned. You might spawn an object into the world, and then want to immediately have it perform an action, or have other entities start to interact with it. Problem is, that new entity doesn't exist in the "current" game state, it only exists in the "next" game state. The server would have to wait until the next cycle, when the "next" state became the new "current" state, before the new entity was available for interaction.

I'm leaning towards just having a single state for the server, just for simplicity, but I don't see how to avoid keeping two copies for the client. How do other games handle this?

sentences:
How do I dynamically set a WheelJoint's anchor points? I've created a car in RUBE and imported it into my game. The game has a tuning menu, allowing the ride height of the car to be adjusted with a slider.

I can't work out how to change the position of the WheelJoint relative to the car body. The result I'm looking for is as if I had changed the anchorA Y-value in RUBE. I thought this would be equivalent, but it isn't:

    car.rearWheelJoint.getAnchorA().set(xvalue,yvalue);

I've tried instead creating a whole new jointdef:

        WheelJointDef d = new WheelJointDef();

        d.initialize(car.rearWheelJoint.getBodyA(), car.rearWheelJoint.getBodyB(),
                car.rearWheelJoint.getAnchorA().add(0,(val-100)*0.01f),
                car.rearWheelJoint.getAnchorB());

        car.rearWheelJoint = (WheelJoint) game.world.createJoint(d);

...but I think this is messing up the pointer to the wheel joint.

How can I do this?

sentences:
How can I orient a circle relative to the position of a 3D object? How can I orient a circle that has a position to a 3D object? If I have a 3D object which is a hemisphere, I would like to let the circle be underneath that hemi-sphere and whenever the hemisphere moves, the circle move with the same angle and position, and underneath it.

In other words, I would like to attach a 2D circle to a hemisphere and parallel to it.

sentences: How can I do something after an audio has finished How can I enable the SetActive() property of a game object after the audio has finished?

sentences:
Action button: only true once per press I'm using SFML2.0 and am trying to make a wrapper class for my controller/joystick.
I read all the input data from my controller and send it off to my controllable object.

I want to have two types of buttons per button press, one that is continues(true false state ) and one that is an action and is set to false after the next frame update.

Here is an example of how I set my button A to true or false with the SFML api.
Whereas data is my struct of buttons, and A holds my true/false state every update.

data.A = sf::Joystick::isButtonPressed(i,st::input::A);

But I've also added "data.actionA" which represents the one time action state.

Basically what I want is for actionA to be set false after the update its been set to true. I'm trying to keep track of the previous state. But I seem to fall into this loop where it toggles between true and false every update.

Anyone an idea?

sentences:
What alternatives are there for creating Keyboard/Mouse controls in LWJGL? So I'm currently working my way through openGL tutorials, using LWJGL to do all my work in. However as I get to the part on how to access Keyboard and Mouse events in this library, I stumble across this little gem:

public static void poll()

Polls the keyboard for its current state. Access the polled values using the isKeyDown method. By using this method, it is possible to "miss" keyboard keys if you don't poll fast enough...
(from http://www.lwjgl.org/javadoc/org/lwjgl/input/Keyboard.html#poll())

So in order to make use of Buffered Input (as the top answer in LWJGL multiple keyboard/mouse input checks calls it) you have to use this poll() method.

This means that no matter what I do, I will miss key presses if I use LWJGL for this. I have made a test with this bit of code:

while(Keyboard.next()) {
    int character = Keyboard.getEventCharacter();
    int key = Keyboard.getEventKey();
    String charName= Keyboard.getKeyName(key);
    System.out.println(charName+""+character);
}

When pressing the buttons Z X C V at the same time, an example output is as follows: Z122
V118
X120
C0
V0
Z0

As you can see the C press and X release aren't found in the buffer. In some cases a single keystroke had both the press and release missing from the buffer.

I need this to not be the case and polling faster doesn't solve the issue at all (why would that even be a solution?). So what are the alternatives for this system?

(P.S. Yes pressing those 4 buttons at the same time was properly recorded in other applications)

sentences:
How does a character creator system works? Like in Aion for example, how does it work?

Do I just need to take a basic 3D mesh of a character I created and then make some modifications to it with sliders or do I need to create different clone meshes?

Is a system like that hard to create? If it is just long and tedious work no problem I have time, but my skills are limited so I don't know if I'm able to make such a system at all.

Also what kind of scripts and programs are best to start and make some prototypes and training? Are there some that aren't compatible with others?

sentences:
Count the number of Vulnerable and Invulnerable crops I have this code that counts how many GameObjects (crops) in the scene

GameObject[] crops;

and the code to get the health component of each crops

    Health[] health;
    crops = GameObject.FindGameObjectsWithTag("Crop");
    health = new Health[crops.Length];
    for (int i = 0; i < crops.Length; i++)
    {
        health[i] = crops[i].GetComponent<Health>();
    }

I can now access the state of these crops using

    health[i].Invulnerable //this is a bool from the Health.cs script

now I want to count the crops that are Vulnerable and Invulnerable. How can I achieve that? Thanks!

sentences:
What exactly causes a surface to overlap another? I cannot really figure out what causes one surface to overlap another. In a 3D engine I'm creating, my technique is failing in edge cases.

My method is sorting the surfaces to be painted from the furthest to the closest. To determine the closeness, I'm comparing the average z values. Sometimes, however, an overlapping surface has a higher average z value than the one it is overlapping. Thus, the surface further away is painted over the closer one - resulting in bizarre rendering like this:

What one is meant to see is the purple front surface of the cube only, whilst the red side surface is painted over the purple one. The average z value of the purple surface is higher, and therefore 'further away'. So I'm having some doubt as to whether this technique is correct.

What I also tried is getting the distance from the camera (i.e. origin) to the surface, but then I needed a point. I chose the middle of each surface but also this doesn't always seem to work because not all surfaces are as large as each other.

Therefore, what is a reliable way to determine the order of closeness of surfaces towards the origin?

sentences:
Looking for a clever way to differentiate objects I have a lot of cubes in my game (2d squares) and I decided to add some skins to them. However the colors that they have don't really make them look appealing.

For example, I have this sprite:

Here is how the squares look with that particular sprite:

As you can see, they don't really look that great with all these bright colors.

Is there any way that I can make this look better, but for the users to still be able to differentiate between the different cubes?

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:
C# XNA colliders, physics, inclined plane/terrain/colliders Currently I'm working on a project to learn game programming. But I'm not sure if I have the right approach on several things, and that's what I'm here for.

What I'm trying to create is a small world in 3d and simulate some simple physics. The world can be seen below.

The world is basically a box, note that I've left out the walls in the front and side view, but they will be there. The goal is to drop a ball somewhere in the green area and let physics do its work. Then the simulation will end once the ball falls into the hole. Later, once I got a better understanding of everything I want to create a pinball game out of it, but that's for a later stage.

Currently I'm creating this project in C# XNA/MonoDevelop and want to create everything from scratch. So I got my own physics engine, collider classes, math library, et cetera, which I find quite challenging, especially since I knew/know nothing about all of this, especially the math, but I am learning a lot from it, and I find it a lot of fun!

So what do I have now:

I got a GameObject class, which contains a position, a model, update and draw methods, etc. And a Physics Engine which uses PhysicsObjects and ModelObjects (both inheriting from the GameObject).

The PhysicsObject contains a mass, velocity, gravity, a collider update and draw method and the ModelObject just has a position and a collider and update and draw method.

The PhysicsEngine has a Run(deltatime) method which is being called in the update method and integrates through all the PhysicsObjects in step one, updating it's velocity, applying gravity, and finally position. In the next step the PhysicsEngine handles the collisions. It checks whether a collision was found between PhysicsObjects and PhysicsObjects and PhysicsObjects and ModelObjects and if a collision was detected it will handle the collision response.

So far I only have an Axis-Aligned Bounding Box, BoundingSphere and Plane class. And implemented the Sphere-Sphere collision, and Sphere-Plane collision.

I soon realized the AABB wouldn't be possible since I can't rotate them. So I tried creating planes, since as far as I understand, a Plane exists out of a normal vector to determine the 'up' side and a distance from the center/origin. The problem only is that there isn't a begin or end position so I can't have a hole in the terrain. So this is where I'm stuck, I have no idea on how to approach this and what to use and how most people would solve this problem. I'm not asking for code snippets or anything, but want to know if my general approach to all of this is 'correct' and how I should approach this problem for the terrain. What kind of collider should I use for the terrain to also make it possible to rotate it?

sentences:
How can I move number of objects between two points with random speed? In the Hierarchy I have a Cube and the script is attached to the cube.
And I also have in the Hierarchy two spheres as waypoints.

public class WP : MonoBehaviour
{
    public Transform[] waypoints;
    public float movingSpeed;

    GameObject[] allLines;
    GameObject[] duplicatedPrefabs;

    private void Start()
    {
        allLines = GameObject.FindGameObjectsWithTag("FrameLine");

        DuplicatePrefabEffects(allLines.Length);
        duplicatedPrefabs = GameObject.FindGameObjectsWithTag("Duplicated Prefab");
    }

    private void DuplicatePrefabEffects(int duplicationNumber)
    {
        for (int i = 0; i < duplicationNumber; i++)
        {
            var go = Instantiate(prefabEffect);
            go.tag = "Duplicated Prefab";
            go.name = "Duplicated Prefab";
        }
    }

    private void MoveDuplicated()
    {
        for (int i = 0; i < duplicatedPrefabs.Length; i++)
        {
           duplicatedPrefabs[i].transform.position = Vector3.Lerp(pointA.position, pointB.position, movingSpeed *Time.deltaTime);
        }
    }

    void Update()
    {
     MoveDuplicated();
    }
}

The duplicatedPrefabs are moving very very fast no matter what value I put for movingSpeed and then they are all stuck in the second waypoint and seems like moving on very specific small area on the second waypoint.

What I want to do is to move them smooth slowly between the two waypoints and with random speed range from each object. For example one will move at speed 1 the other on speed 20 third on speed 2.

sentences:
Generate 4 vectors rotated in cardinal directions from a central vector There is some unit vector, which is a coordinate in a spherical space. It is necessary to obtain from it 4 vectors diverted in different directions (right, left, forward, backward) by a certain number of degrees. For these actions I use the following code:

Vector3 center = point;
Vector3 left = Quaternion.Euler(-30, 0, 0) * center;
Vector3 right = Quaternion.Euler(30, 0, 0) * center;
Vector3 back = Quaternion.Euler(0, 0, -30) * center;
Vector3 front = Quaternion.Euler(0, 0, 30) * center;

The problem is that this works when point is equal or close to Vector3.up. When deviating from the vertical position, the lateral vectors begin to "stick together".

Here is a visualization of what I need:

Test code is attached:

using System.Collections;
using UnityEngine;

public class Test : MonoBehaviour
{
    public GameObject centerGO;
    public GameObject leftGO;
    public GameObject rightGO;
    public GameObject backGO;
    public GameObject frontGO;

    ArrayList list = new ArrayList();

    void Start()
    {
        SetCenterPoint(Vector3.up);
    }

    void Update()
    {
        DrawDebugRays();

        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            SetCenterPoint(hit.point);
        }
    }

    void SetCenterPoint(Vector3 point)
    {
        Vector3 center = point;
        Vector3 left = Quaternion.Euler(-30, 0, 0) * center;
        Vector3 right = Quaternion.Euler(30, 0, 0) * center;
        Vector3 back = Quaternion.Euler(0, 0, -30) * center;
        Vector3 front = Quaternion.Euler(0, 0, 30) * center;

        centerGO.transform.position = center;
        leftGO.transform.position = left;
        rightGO.transform.position = right;
        backGO.transform.position = back;
        frontGO.transform.position = front;

        list.Clear();
        list.Add(center);
        list.Add(left);
        list.Add(right);
        list.Add(front);
        list.Add(back);
    }

    void DrawDebugRays()
    {
        for (int i = 0; i < list.Count; i++)
        {
            Color color = Color.red;
            switch (i)
            {
                case 0:
                    color = Color.green;
                    break;
                case 1:
                case 2:
                    color = Color.blue;
                    break;
            }
            Debug.DrawRay(Vector3.zero, (Vector3)list[i], color);
        }
    }
}

sentences:
Rotating a scene around a fixed axis I am looking for a way to move my scene so that when I translate forward/back/left right it moves directly up/down/left/right on the screen.  Currently it does do that until I rotate (by anything other than 360...).  After rotation the up/down/left/right moves in the direction of the rotation.  I need it to move directly up/down/left/right on screen.  I've been racking my brains trying all kinds of different matrix rotations and multiplication but I can't get it.  MOST IMPORTANTLY - I need it to maintain a single rotation axis of 0,0,0 so the centre of rotation is always near the middle of the screen regardless of how far I scroll.  I can easily rotate on the centre of the scene itself and have it translate how I want (translate to co-ord, rotate, translate back, go to position) but I need that axis to remain fixed.  Otherwise the centre of rotation could be somewhere way off-screen.

Fig 1. Shows the starting position of the model(scene).
Fig 2. The modelview is rotated 45deg.
Fig 3. Decrementing the z-value causes the model to move out along z - which I do not want.
Fig 4 I need the model to move straight back (between z and x).

I have tried using sin / cos rule in an attempt to translate the vertices back along the arc between the undesired position (Fig 3) and the desired one (Fig 4) but the math is off and the process is messy.  I just know there has to be a clean/simple solution out there.
I am coding this in Java (JOGL) and passing modelview and projection matrices to a vertex shader.
Also, I am not using deprecated functions (no begin/end/glRotate etc).

Does anyone know of a matrix multiplication that will accomplish this?

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:
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:
Volumetric lighting not working when building and running game I have a volumetric lighting system implemented into Unity and when I am making the game and run it in the Unity editor the volumetric lighting shows up. When I build it and run it though it doesn't.
I think this is caused because it has not exported the script with the volumetric lighting so I exported it again and it still didn't show. I dont know what is up. Any suggestions would be appreciated.
In Unity with the thing working:

Unity built game:

sentences:
Tile sizes in 2D games While developing a small game using tile-mapping method a question came to my mind:

I would develop the game on Windows but wouldn't exclude adapting it to another platform.

What size(in pixels) would you recommend using for creating the tiles of a tile-mapped game(ie: RPG) with the following requirements?

Have an acceptable level of detail without having too many tiles.
Having a decent map size.
Allow adaptation of the game on a handheld(ie: PSP), smartphone or a computer without too much loss of detail or slowdowns.
Allow more or less important zoom-in / zoom-out.
Have a resolution of tile that permits either pixel-perfect collision or block-collision.

Anything from a good explanation to a game example is useful as long as it can fit the requirements.

This question may seem a bit simplistic, but I noticed that many Indies game developer were using inappropriate scales scenery.

Also sorry for the poor syntax and the lack of vocabulary of my question, being a non-native English speaker doesn't help when talking about computers programming.

sentences:
Why does invoking glm::refract function return NaN? At the present time, I make a simple raytracing project and I encounter an issue : When I invoking the glm::refract function, it returns me a vec3 with "NaN" values. However, my input data seems to be correct (2 normalized vec3 and my refractive-index is 1.0). Have you got an idea of the problem ? This function is not so well documented.

EDIT :

Very strange, if my refractive index is 1.0f it's working well actually :

glm::vec3 view = glm::vec3(0.191318035, -0.0721754059, 0.978870869);
glm::vec3 normal = glm::vec3(-0.151046738, -0.988510013, -0.00574064208);
float refractIndex = 1.0f;
glm::vec3 output = glm::refract(view, normal, refractIndex);

However, if I invoke the function and passing a refractive index of 1.10000002f for example (my program seems to approximate values and I don't know why...), it doesn't work => returns vec3 with "NaN" values. Like below :

glm::vec3 view = glm::vec3(0.191318035, -0.0721754059, 0.978870869);
glm::vec3 normal = glm::vec3(-0.151046738, -0.988510013, -0.00574064208);
float refractIndex = 1.10000002f;
glm::vec3 output = glm::refract(view, normal, refractIndex);

EDIT 2 :

More weird : If I try with a refractive-index of 1.1f it doesn't work. Same error.

sentences: How to move an object in a heart shape pattern in javascript? How can I move an object in a heart shaped pattern? I have a move(x, y) function that I can use to move the object, but how to I make a function that will move the object in a heart shaped pattern, with something like a setInterval?

sentences:
Unity or MonoTouch with XNATouch/MonoGame? same price After figuring out the pricing of monoTouch and Unity, I've found that the pricing will be the same ($800). With XnaTouch/MonoGame for monoTouch I am able to port my games to droid/apple. I am just curious if anyone has tried both XnaTouch and Unity and which one they prefer.

I do mostly 2D games (if Unity had a 2d Engine I would be all over that) so xnaTouch seems that it might be better, but Unity seems better for more advance/professional (more companies are using it, so if I ever wanted to do this for more than just myself I have more options, which I've thought about)

(I also read somewhere that monoTouch is against the new apple term of agreement?)

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:
Velocity Issue With MonoGame I'm relatively new to programming velocity and such as I used to use Unity so it was already implemented. Right now, I'm using MonoGame and have an issue with my velocity code. Whenever I decelerate, my "velocity.X" never becomes 0 it just keeps going down to numbers like "-8.775121E-10". I tried to check if it's less than or equal to 0.05 but that just causes issues.

Movement Code:

currentState = Keyboard.GetState();

        deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

        bounds.X = (int)position.X;
        bounds.Y = (int)position.Y;

        position.X += velocity.X;
        position.Y += velocity.Y;

        if (velocity.X >= MAX_ACCELERATION)
            velocity.X = MAX_ACCELERATION;
        if (velocity.X <= -MAX_ACCELERATION)
            velocity.X = -MAX_ACCELERATION;

        if (currentState.IsKeyDown(Keys.A))
        {
            if (velocity.X > -MAX_ACCELERATION)
                velocity.X -= acceleration * deltaTime;
        }
        else if (currentState.IsKeyDown(Keys.D))
        {
            if (velocity.X < MAX_ACCELERATION)
                velocity.X += acceleration * deltaTime;
        }

        Console.WriteLine("Velocity: " + velocity);
        Console.WriteLine("Current KeyState: " + currentState.IsKeyUp(Keys.A));

        prevState = currentState;

        Console.WriteLine("Prev KeyState: " + prevState.IsKeyDown(Keys.A));

        SlowDown();

SlowDown Method:

            /*if (!prevState.IsKeyUp(Keys.A) && currentState.IsKeyUp(Keys.A))
        {
            if (velocity.X >= -0.5f)
                velocity.X = 0;
        }*/

        velocity.X *= FRICTION;

sentences:
How to detect 2D line on line collision? I'm a flash actionscript game developer who is a bit backward with mathematics, though I find physics both interesting and cool.

For reference this is a similar game to the one I'm making: Untangled flash game

I have made this untangled game almost to full completion of logic. But, when two lines intersect, I need those intersected or 'tangled' lines to show a different color; red.

It would be really kind of you people if you could suggest an algorithm for detecting line segment collisions.
I'm basically a person who likes to think 'visually' than 'arithmetically' :)

Edit: I'd like to add a few diagrams to make convey the idea more clearly

P.S I'm trying to make a function as

private function isIntersecting(A:Point, B:Point, C:Point, D:Point):Boolean

Thanks in advance.

sentences:
JOGL hardware based shadow mapping - computing the texture matrix I am implementing hardware shadow mapping as described here.

I've rendered the scene successfully from the light POV, and loaded the depth buffer of the scene into a texture. This texture has correctly been loaded - I check this by rendering a small thumbnail, as you can see in the screenshot below, upper left corner. The depth of the scene appears to be correct - objects further away are darker, and that are closer to the light are lighter.

However, I run into trouble while rendering the scene from the camera's point of view using the depth texture - the texture on the polygons in the scene is rendered in a weird, nondeterministic fashion, as shown in the screenshot.
I believe I am making an error while computing the texture transformation matrix, but I am unsure where exactly.

Since I have no matrix utilities in JOGL other then the gl[Load|Mult]Matrix procedures, I multiply the matrices using them, like this:

void calcTextureMatrix() {
  glPushMatrix();

  glLoadIdentity();
  glLoadMatrixf(biasmatrix, 0);
  glMultMatrixf(lightprojmatrix, 0);
  glMultMatrixf(lightviewmatrix, 0);
  glGetFloatv(GL_MODELVIEW_MATRIX, shadowtexmatrix, 0);

  glPopMatrix();
}

I obtained these matrices by using the glOrtho and gluLookAt procedures:

  glLoadIdentity()
  val wdt = width / 45
  val hgt = height / 45
  glOrtho(wdt, -wdt, -hgt, hgt, -45.0, 45.0)
  glGetFloatv(GL_MODELVIEW_MATRIX, lightprojmatrix, 0)

  glLoadIdentity()
  glu.gluLookAt(
    xlook + lightpos._1, ylook + lightpos._2, lightpos._3,
    xlook, ylook, 0.0f,
    0.f, 0.f, 1.0f)
  glGetFloatv(GL_MODELVIEW_MATRIX, lightviewmatrix, 0)

My bias matrix is:

float[] biasmatrix = new float[16] {
  0.5f, 0.f, 0.f, 0.f,
  0.f, 0.5f, 0.f, 0.f,
  0.f, 0.f, 0.5f, 0.f,
  0.5f, 0.5f, 0.5f, 1.f
}

After applying the camera projection and view matrices, I do:

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)
glTexGenfv(GL_S, GL_EYE_PLANE, shadowtexmatrix, 0)
glEnable(GL_TEXTURE_GEN_S)

for each component.

Does anybody know why the texture is not being rendered correctly?

Thank you.

sentences:
2D terrain with midpoint displacement and collision I followed this theory Here to implement a simple scrolling 2D terrain for my running game. I am used to dealing with collision via a tile system but am looking for a good theory on how to perform terrain collision (keeping the player on-top the land) with a midpoint displacement 2D terrain

I am not worried about the physics aspect but how to determine if a character intersects an array of points generated by the theory above. Example if I have an array of points

Points[]

these points are used to draw lines to make a terrain. Now in my mind I would first find the player center. Take the center X and see which two points it is between. So if X is 4.6 lets say it is between points that lay on X=3 and X=6.

Player X = 4.6
Point1 X = 3, Y = 3
Point2 X = 6, Y = 5

So now knowing this I somehow need to calculate  what Y would be giving that X = 4.6. And once I have Y ensure that the Player Y > CalculatedY. If it is not push the player up to what Y the player should be.

So I guess what I a saying is

X = 3, Y = 3
X = 6, Y = 5
X = 4.6, Solve for Y

sentences:
Can I animate render targets or the swap chain? I want to animate some synthetic video bits to fullscreen w/o tearing. Can I set up D3D 9/10/11 in exclusive mode, and have it present a series of buffers that I'm writing to?

I know how to copy system memory bits into a texture, then draw that texture as a fullscreen quad, but it seems like overkill. Why should I use the triangle rasterizer when I want to do something so simple?

All I want to do is set up a long (4-8 buffer) swapchain and set the bits of the back buffer that is about to be displayed. Or, I want to allocate 4-8 RenderTargets, and on each frame, copy the bits from system memory to the RenderTarget, then set it as the next thing to display. I've never seen or heard about anybody doing this, but it seems so dead simple!

sentences:
Are there performance benefits to full-screen haze filters? Some games apply a full-screen filter effect that desaturates picture, causing the colors to be "washed out".

For example, in Zelda: Breath of the Wild:

Someone used Photoshop to remove the filter, giving this result:

Is there a performance or other technical benefit to applying this kind of filter, or is it a purely aesthetic choice?

sentences:
Processing large multi layered images with SharpDX I'm currently working on an image processing project that pans and zooms on multi-layer high resolution images.

The goal is colorize (including color, gain and noise) n layers (n having a minimum of 5) and merge them via shaders. On top of that, there are 5–6 layers of 2D geometry each colored and merged as well.

The normal image size is 7440 x 7440.

These are then merged and rendered on a single Quad. I've been able to get this working very well and the results are good.

This is being processed on a Xeon based workstation with a M4000 Nvidia Quadro or a Xeon based Lenovo p51 with M2200 Nvidia Quadro.

The issue comes when I need to process a very large image (34,992 x 34,992) that requires splitting the image over 9 quads on the same systems.

These images must go through the same process of colorization and merging. The images are 11,664 x 11,664 per quad.

When zoomed in, we are still processing areas we can't see—can I apply some form of frustum culling here?

And, when zoomed out, is there a way to process a lower resolution image so the GPU is not pegged and none responsive?

sentences:
How do you generate seamless Perlin noise? I've done a research and tried implementing for months, but I've gotten nowhere trying to make seamless/tileable Perlin noise.
Here is my current Perlin noise file without seamless implementation. In my program, I am calling FractionalBrownianMotion to generate.
Each of the research articles have given me issues. In FractionalBrownianMotion I change the call from Perlin to PerlinSeamless.
Research Articles

How to make one-axis tileable simplex noise? Produces broken noise using x2, y2 as period; xsize, ysize as map size. Also tried vice-versa.

Added code:
public float PerlinSeamless(float x, float y)
{
    int width = gradientArray.GetLength(0);
    int length = gradientArray.GetLength(1);

    // map size 250
    float x1 = 0, x2 = 50;
    float y1 = 0, y2 = 50;
    float dx = x2 - x1;
    float dy = y2 - y1;

    //Sample noise at smaller intervals
    float s = x / width;
    float t = y / length;

    // Calculate our 3D coordinates
    float nx = x1 + Mathf.Cos(s * 2 * Mathf.PI) * dx / (2 * Mathf.PI);
    float ny = y1 + Mathf.Sin(t * 2 * Mathf.PI) * dy / (2 * Mathf.PI);
    float nz = t;

    return Perlin3D(nx, ny, nz);
}

public float Perlin3D(float x, float y, float z)
{
    y += 1;
    z += 2;
    float xy = perlin3DFixed(x, y);
    float xz = perlin3DFixed(x, z);
    float yz = perlin3DFixed(y, z);
    float yx = perlin3DFixed(y, x);
    float zx = perlin3DFixed(z, x);
    float zy = perlin3DFixed(z, y);
    return xy * xz * yz * yx * zx * zy;
}
private float perlin3DFixed(float a, float b)
{
    return Mathf.Sin(Mathf.PI * Perlin(a, b));
}

How do you generate tileable Perlin noise? hashed = perm[perm[int(gridX)%per] + int(gridY)%per] goes OOB.
3D Perlin Noise Technique does not replicate 2D noise when z value always 0, but using this method for 3D Perlin noise assuming that's the way it's supposed to be

I have also tried various implementations of non-answer accepted comments in these articles to see only broken noise.

sentences: Loading multi-texture 3ds c++ I have a question about loading 3ds using this tutorial. I want to use more than one texture on the model (because here all the models have more than one) but it seems that this library can't do that. Do you know any other alternatives or a way to edit this existing library to reach my aim?

sentences:
collision detection and normals from rigidbody Until now I've been developing my player character using a Character Controller, but have since decided to switch to rigidbody due to the controller's limitations. In order for my movement code to run as expected I need to know when the player is colliding with anything, and the normal of the surface it's colliding with. This is easy with a Character Controller, but is there a simple way to do it with a rigidbody?

Here is a stripped down version of the script I'm using for collisions.

 // Used in other scripts (Necessary)
    public GameObject ground = null;
    public Vector3 groundNormal;
    public bool onGround;

    // Used internally
    public bool isColliding;
    public float slopeLimit;

    // Character Controller
    public CharacterController controller;

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

    void Update()
    {
        // Check if the player is colliding with anything (Character Controller)
        if (controller.collisionFlags == CollisionFlags.None)
        {
            isColliding = false;
        }
        else
        {
            isColliding = true;
        }

        // Check if the player is standing on the ground
        if (isColliding && groundNormal != Vector3.zero)
        {
            onGround = true;
        }
        else
        {
            onGround = false;
        }
    }

    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        // Check for floor
        if (Vector3.Angle(transform.up, hit.normal) <= slopeLimit)
        {
            // Store floor object data
            ground = hit.gameObject;
            // Store ground surface normal
            groundNormal = Vector3.Normalize(hit.normal);
        }
        else
        {
            // reset variables
            ground = null;
            groundNormal = Vector3.zero;
        }
    }

slopeLimit is a static value. Additionally, getting the ground object isn't actually necessary atm, but I plan on using it later.

Edit:
Currently I'm using controller.collisionFlags to detect when the player is colliding with something and haven't been able to find a similar alternative. Setting the isColliding bool to true using Rigidbody.OnCollisionStay would be simple, but setting it to false without use of another void function seems difficult. is that possible at all?

sentences:
How do i get effect when gems come together in godot? I'm create gems puzzle game, In my game there is requirement that 2x2 matrix gem will group and then it will convert in power gem. check below image.

I'm new in game development, so anyone can point me out ? any suggestion or link will be helpfull.

Thank you

sentences:
Can I load OGRE's mesh file via direct3d? I just posted this question over at the the OGRE 3D forums, and I wanted to post it here as well.

I'm a newbie here, just found that OGRE is an amazing engine for 3d programming.

Using the Entity class it's easy to load a static model which was exported via some kind of 3ds max plugin.

But I did't read the source-code of OGRE Because I'm not familar with it, and I just got started with OGRE a couple days ago.

So the question is: Does anyone know if I can load a OGRE mesh via d3d?

Or has anyone been doing something using the OgreEntity.h and split it out into a separate class which can directly be used in raw direct3d?

I would appreciate if anyone could share some information about the OGRE mesh file format.

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:
How to create a vertex array from any shape in JBox2D? I have a code, that add a vertex array to a shape, my code is:

PolygonDef shape = new PolygonDef();
for (int i=0; i<vertices.size(); i++) {
    Vec2 v = vertices.get(i);
    shape.addVertex(new Vec2(v.x/RATIO,v.y/RATIO));
}

But its very strange because not working good on any of my polygon creator tool.

So with a triangle, it work good:

    ArrayList<Vec2> vertices = new ArrayList<Vec2>();

    vertices.add(new Vec2(0,-size.height/2));
    vertices.add(new Vec2(size.width/2,size.height/2));
    vertices.add(new Vec2(-size.width/2,size.height/2));

but with a bigger polygon of 50 to 60 vertices it's not working.

How I can create a usable vertex array from a shape? I have a greyscaled image with black and white colors... How can use this shape (image) to define my vertex array good?

And in box2D with the addVertex how I can add this points to make a normal usable polygon? (counter clockwise?)

sentences:
URP cant get Pixel Perfect Camera to work I am currently using URP to add bloom to my particlesystems. The problem im facing is that I cant pixelate the game. I have tried to implement several methods to post pixelate (via shaders and render texture) but none conserve the bloom on the particlesystem. This is the effect im after https://youtu.be/edaf2I-qwBg (using pixel perfect camera and zooming the editor window) but I cant achive this in build mode, any help on how I should pixelate the game so you can still see the character?

This is without 4x zoom:

This is my current settings:

sentences: How to add scene after build and deployed in Unity? I want to be able to make new levels after build. I could use a map tool and script but I rather just add scene with all the resource packed with it. But what is the best practice forward?

sentences: Declaring another alpha or beta testing after a game app for Android (APK file) is uploaded and already published in Google Play Store This question is related about alpha or beta release in Google Play Store. . Let's say my app (APK file) was uploaded in alpha/beta testing. If one of the testers satisfied or quick fixes on the bugs, then I'm gonna go promote to production, which means publishing an app. Now, let's say I wanna go for another alpha or beta testing for the next version before updating new version in production. I have to test it; let's say testing for the leaderboard or achievements created from the Game Services at Google Play Developers Console, adding Google Play Games plugins for Unity to the app, and then uploading the new APK version for the next beta release before updating new version in production. Is it possible or not?

sentences:
Deployed Android APK file size was more tha expected when developed in Unity I developed a game, and build it as an Android APK file. I was not using any assets, only a UI panel and a UI Button. I thought the APK file woul be 3 MB, but it was 18MB.

On the Google Play store, there are many good games using good graphics that have a small size. Some are only 5MB or 6MB. I want to know why I am getting such a large APK file.

How do I reduce the size of my APK file?

sentences:
How can I implement rectangle collision response? I am working on a game in JavaScript and my current implementation of collision uses the shortest distance to push the intersecting object away, which isn't always correct. I've made this diagram of the ideal collision. The red box represents the starting position, the green box represents the proper position and the black box represents the static object it is colliding against. The blue arrow is the velocity vector. With my current implementation, the object would be placed in its final position and pushed out (and in this case it would be pushed left)

How can I fix this?

sentences:
Game Development Resources? I want to make an iPhone game and I was wondering if somebody could point me to some resources. Before you rage and close this, I am not looking for just a tutorial on programming, I could just google that.

I need to find a tutorial on how to actually make a game, as in how to organize your code, what type of methods to run in separate threads, how to manage these threads in a game, etc. I already know everything I need; I can write a physics engine from scratch, I can write a 3D graphics pipeline from scratch, and so on. What I cannot figure out is how to combine all of this knowledge into correctly and efficiently making a game. Obviously for this one would probably go to college, but seeing as I am still in high school, that is not an option.

If anyone would know some tutorials or resources, any pointers would be appreciated.

sentences:
How do I draw a 2d plane and rotate camara (To be a board) in a 3d XNA game? I am trying to create a simple board game, but the 3d part of this is really killing me.

From what I can gather I have created a plane, but it never moves even though I turn the camara, but that partially makes sense as I only turn the camara with a 3d model, but in my head that makes 0 sense, in my head if I turn the camara it should affect ALL my models? But with this code the camara only "cares" about the 3d cylinder, the plane is just completely still

private void OnDraw(object sender, GameTimerEventArgs e)
    {
        SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);

        foreach (ModelMesh mesh in cylinderModel.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                //effect.World = Matrix.CreateRotationX((float)e.TotalTime.TotalSeconds * 2);
                effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);

                effect.EnableDefaultLighting();
            }

            mesh.Draw();
        }

        //cameraPosition.Z -= 5.0f;
        _effect.World = Matrix.CreateRotationZ((MathHelper.ToRadians(((float)e.TotalTime.Milliseconds / 2) % 360)));
        foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
        {
            pass.Apply();

            SharedGraphicsDeviceManager.Current.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, _vertices, 0, 1, VertexPositionColor.VertexDeclaration);
        }
    }

Is there a way to get the camara to affect all models?

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:
Changing Pixels Per Unit First off, excuse my ignorance. I am just getting started in game dev. and ran into a little issue. So I had these weird rippling-lines going across my screen, and saw in a couple forums that this means I don't have what is called a "pixel perfect" game. To fix this, I am supposed to change the pixels-per-unit of each sprite down to 1. Currently I had it on 32 because that is my sprite size and I am a complete noob.
Now, I change it down to one but it completely destroyed my game. Everything that is generated on my map/grid is sucked into the center in this giant orb of sprites (I procedurally generate my map off a grid of 1/0s). I am guessing there is just a setting or some such thing that I am missing. Any ideas?
Also would be happy with an alternative to remove the rippling lines.

sentences:
Diamond shaped map: converting tile number to coordinates and back I have a diamond shaped map that is displayed as follows:
*  *  *  0  1  *  *  *
*  *  2  3  4  5  *  *
*  6  7  8  9 10 11  *
12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27
* 28 29 30 31 32 33  *
*  * 34 35 36 37  *  *
*  *  * 38 39  *  *  *

The tiles are stored as a uni-dimensional array in a file. So, I need to convert from tile number to coordinates, so I can make an array of arrays map[i][j]. I want to convert the tile number to its coordinates in the map (i, j) and back.
To do this, I have simplified it to this form (all tiles flushed to the left):
   j  0  1  2  3  4  5  6  7
i
0     0  1  *  *  *  *  *  *
1     2  3  4  5  *  *  *  *
2     6  7  8  9 10 11  *  *
3    12 13 14 15 16 17 18 19
4    20 21 22 23 24 25 26 27
5    28 29 30 31 32 33  *  *
6    34 35 36 37  *  *  *  *
7    38 39  *  *  *  *  *  *

I have managed to convert a coordinate to its tile number like so:
def get_tile_number(i, j):
    # Given a map width and height n:
    if i < (n/2):
        number = i*(i+1) + j
    else:
        number = (2*((n/2)*((n/2)+1))) - ((n-i)*(n-i+1))) + j

So:
get_tile_number(0, 0) -> 0;
get_tile_number(6, 0) -> 34;

However, I cannot figure out to go back to the coordinates from the tile numbers, because I have trouble with distilling the i parameter from the tile number.
I have tried googling with terms like "diamond shaped map tile numbers coordinates convert", but no luck.
Can someone point me in the right direction?
Solution
Based on Ed Marty's answer, the formula looks as follows:
def get_ij(tile_number):
    n_serialized_tiles = (2*((n/2)*((n/2)+1)))
    if tile_number < n_serialized_tiles/2: # If before the halfway point of the diamond
        i = math.floor(0.5 * ((math.sqrt((4 * tile_number) + 1)) - 1))
    else:
        i = math.floor(n- (0.5 * ((math.sqrt((4 * ((2 * ((n/ 2) * ((n/ 2) + 1))) - tile_number)) + 1)) - 1)))

This finds the i component, after which I can find j by imputing get_tile_number(i, j=0) in the previous formula which gets me the tile_number at the start of that row. I then subtract the real tile_number from that number to get j j = tile_number - get_tile_number(i, j = 0).

sentences:
How do you create an over world styled like Pokémon Black and White, with both 2D and 3D elements? The over world of Pokémon white uses 3D models for objects like houses, and 2D sprites for characters like the player.  What would I have to do to create an over world styled like this?

Here is an example:

sentences:
what's wrong with my lookAt and move forward code? so am still in the process of getting familiar with libGdx and one of the fun things i love to do is to make basics method for reusability on future projects, and for now am stacked on getting a Sprite rotate toward target (vector2) and then move forward based on that rotation
the code am using is this :

    // set angle
   public void lookAt(Vector2 target) {

      float angle = (float) Math.atan2(target.y - this.position.y, target.x
            - this.position.x);
      angle = (float) (angle * (180 / Math.PI));

      setAngle(angle);

   }

   // move forward
   public void moveForward() {
      this.position.x += Math.cos(getAngle())*this.speed;
      this.position.y += Math.sin(getAngle())*this.speed;
   }

and this is my render method  :

    @Override
   public void render(float delta) {
      // TODO Auto-generated method stub
      Gdx.gl.glClearColor(0, 0, 0.0f, 1);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

      // groupUpdate();

      Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
      camera.unproject(mousePos);
      ball.lookAt(new Vector2(mousePos.x, mousePos.y));
      //

      if (Gdx.input.isTouched()) {
         ball.moveForward();
      }

      batch.begin();
      batch.draw(ball.getSprite(), ball.getPos().x, ball.getPos().y, ball
            .getSprite().getOriginX(), ball.getSprite().getOriginY(), ball
            .getSprite().getWidth(), ball.getSprite().getHeight(), .5f,
            .5f, ball.getAngle());
      batch.end();
   }

the goal is to make the ball always look at the mouse cursor, and then move forward when i click, am also using this camera :

// create the camera and the SpriteBatch
  camera = new OrthographicCamera();
  camera.setToOrtho(false, 800, 480);

aaaand the result was so creepy lol

Thank you

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

sentences:
How can I simulate relatively realistic weather? I'm trying to create relatively realistic weather patterns for my game. The simulation should handle temperature, wind, cloud formation and evolution, fog/mist, rain, snow, etc., and account for terrain (including seas/oceans).

My question: how can I achieve this? I've tried looking up how weather systems work but it hasn't been that helpful.

I've given it a shot anyway. I started with a 2D pressure grid that diffused and advected in the regular fluid-dynamical way (which generates a pressure-velocity grid, i.e. wind). Then I added a humidity grid that is pushed according to the wind. I made clouds form / un-form (rain?) based on the humidity (I gave the air a humidity 'carrying capacity' based on its pressure. Any extra humidity is converted into cloud).

Anyway, I've sort of lost faith in my work so far. Am I going in the right direction? One idea would be to simulate warm / cloud fronts themselves. Would that work out?

Any direction would be nice, I really don't know what I'm doing here. Thanks.

sentences:
How can I optimise collision checks for a large number of AI units? Let's say I got 100 Orcs in my 3D world and they all aim to kill each other.

That means for every 1 Orc I have to check for collision with the 99 others. That will give me 99^2 which is about 10,000! That many collision checks every update (24-60 times a second) only for the AI will probably use my whole GPU + CPU.

How can I handle such a large number of AI?

How is this is done in games with large numbers of NPCs (e.g. Skyrim, Fallout, Red Dead Dedemption...).

sentences:
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:
Automatically setting tile variations in a 2D map editor I'm looking to make a map editor for a 2D strategy tile-based game (I am using OpenGL with SDL and writing the game in C). My game levels are made up of a set amount of different tiles, like a river tile, a mountain tile, a sea tile, etc.

A level is a struct holding the tiles like this:

struct Level {
    Tile[LEVEL_ROWS_AMOUNT][LEVEL_COLUMNS_AMOUNT];
    ....

I initialize the level by filling it with a plain default tile. Then I just iterate every tile and render them one by one.

Every one of these tiles always has the same properties no matter what, BUT should look different depending on the tiles surrounding them. For example, if a river tile has a river tile to its left and to its bottom, it should take a top-right corner "L" shape appearance, while the river tile to the left should be horizontal and the one to the bottom should be vertical.

Here's an illustration of what I mean:

All of my tiles' visuals are loaded into a single sprite sheet image, and I have a JSON file pointing to the coordinates of every tile inside the image, where every entry looks like this:

{
"variations": {
    "horizontal": [
        {
            "x": 32,
            "y": 0
        }
    ],
    "top_right": [
        {
            "x": 320,
            "y": 96
        }
    ],
    ...
},

So every tile I place down in my game has multiple possible visual variations, and I'm able to manually set which one a given tile should have. But like stated above, I would like to make this process automatic upon placement of the tile.

What would be a good way to implement this? I have a good amount of unique tiles (around 20 or so) and most of them would require unique logic. I'll also probably be adding more tiles in the future, so I'm hoping I can find a way that doesn't involve long hard-coded if statements.

sentences:
Events, Posting vs Queuing I'm implementing a messaging system and I'm wondering about how I should handle events. Should I post them and send them to the appropriate listeners as soon as I receive them, or should I queue them and only dispatch when I am prompted to (most likely by the main game loop)?

Edit: More info

My game is a 2D platformer, so performance isn't going to be very hard to achieve. Considering what Roy T. said, I guess I might as well send out the event as soon as it is posted; there doesn't seem to be a need to queue it (unless I'm missing something, of course).

sentences:
Opengl Es 1.1 Setting Different Transformations For Different Parts of Array I have the following code:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix();
glTranslatef(.03f * state, 0.0f, 0.0f);

state = 0;

glDrawArrays(GL_TRIANGLES, 0, LOC);

glPopMatrix();

I pop the matrix at the end so that I can apply a different transformation to a different part of the array. The problem is, when glPopMatrix() is present at the end of this code, the object drawn keeps wiggling instead of moving like its supposed to.

Note: State is set somewhere out of the loop and does not cause the draw function to stop working (as the function works without glPopMatrix()).

sentences:
How can I record my vector graphics game without  blurring the graphics? A lot of people asked for a trailer for my game, because screenshots do not do it justice. I have tested PlayClaw, Fraps, CamStudio, VirtualDub, and some other minor tools; none have produced a viable result. My game uses vector graphics and is designed to run at 60fps, so lossy compression of a regular screen capture video destroys the graphical appeal.

How can I record gameplay without blurring my graphics and slowing down the framerate?

sentences:
Loading Texture2D is extremly slow on XBOX360 I have ~100 sprites for each level im my XNA game. On windows it takes ~2 seconds to load them all. Unfortunately on XBOX360 it takes ~30-60 seconds. Am i doing something wrong? Essentially the loading code ist just like this:

Texture2D sprite1 = levelContent.Load<Texture2D>("images/level_1/my_sprite_1");
...
Texture2D sprite100 = levelContent.Load<Texture2D>("images/level_1/my_sprite_100");

(i use an own content manager for each level to release all level-specific textures at once)
Of course i can reduse the ammount of sprites using a spritesheet, but it's extremly painfull for me now. Do i have a better option? And just curious - why is there such huge difference in image loading time?

sentences:
Stuck on development of turn-based-strategy game I am developing a turn based political/military strategy game similar to the DOS game Conflict.  I have my game design document completed, but I'm having trouble actually putting together the logic of the turns.

How do I determine the strengths/weakness of the various nation-states in my game?  Is there a common set of mathematical formulas somewhere on the interwebs that I can modify?  Or do I need to come up with my own?

If I do need to come up with my own, how do I go about doing this?  I have very limited experience playing games like Dungeons and Dragons and Settlers of Catan--would it be a good idea for me to buy a copy of a board game that is similar to my idea and model my game off that?

sentences:
Overriding component behavior I was thinking of how to implement overriding of behaviors in a component based entity system.  A concrete example, an entity has a heath component that can be damaged, healed, killed etc.  The entity also has an armor component that limits the amount of damage a character receives.

Has anyone implemented behaviors like this in a component based system before?
How did you do it?

If no one has ever done this before why do you think that is.  Is there anything particularly wrong headed about overriding component behaviors?

Below is rough sketch up of how I imagine it would work.  Components in an entity are ordered.  Those at the front get a chance to service an interface first.  I don't detail how that is done, just assume it uses evil dynamic_casts (it doesn't but the end effect is the same without the need for RTTI).

class IHealth
{
public:
   float get_health( void ) const = 0;
   void do_damage( float amount ) = 0;
};

class Health : public Component, public IHealth
{
public:
   void do_damage( float amount )
   {
      m_damage -= amount;
   }
private:
   float m_health;
};

class Armor : public Component, public IHealth
{
public:
   float get_health( void ) const
   {
      return next<IHealth>().get_health();
   }

   void do_damage( float amount )
   {
      next<IHealth>().do_damage( amount / 2 );
  }
};

entity.add( new Health( 100 ) );
entity.add( new Armor() );
assert( entity.get<IHealth>().get_health() == 100 );
entity.get<IHealth>().do_damage( 10 );
assert( entity.get<IHealth>().get_health() == 95 );

Is there anything particularly naive about the way I'm proposing to do this?

sentences:
Which server platform to choose I'm going to write a server for an online multiplayer with these requirements:

Pretty simple turn based game (think a card game) that is played entirely on the server (security reasons)
Must be able to run multiple games (tables) with 4 players per table, but no lobby system required (another server takes care of that)
Can support as many players at once as possible; Might need multiple servers
Chat between players
Socket connection to a Flash/AIR client
Must be able to communicate with other servers (for player accounts and such)

Now, I'm considering two options:

Smartfox (or equivalent)
A custom Java solution in something like Tomcat

Why Smartfox?

It handles multiple rooms and chat natively
It presumably has solutions for well-known multiplayer gaming issues

Why custom?

Smartfox has many unneeded functions, bad for performance
Smartfox communicates with an XML-based format, I could use a more efficient binary one.
Don't know if running the entire game model on the server is convenient with Smartfox' extension mechanism
Multiple rooms and chat are easy to reimplement
Tomcat or a lightweight container is easier to deploy than Smartfox
Better IDE support for developing on Tomcat (automatic deploy, etc)

What do you think? Are my assumptions correct? Do you have anything to add? What option should I choose (or maybe a different one entirely)?

sentences:
2D RGBA texture is gray in GLSL shader I have a shader to perform LUT coloring of a texture and a c++/c# programs that call it which work perfectly when i use a 1D texture.
Since i need to support computers that don't support the 1D texture in the shader i thought the easiest would be to convert the 1D texture to a 2D texture with the height==1.
After the conversion (1D -> 2D) when i run the program it seems that the LUT 2D texture is received gray in the shader. I render the exact same texture in another place (not using a shader) in the program and the texture looks fine (same as it did when i used a 1D texture).
The shader code:

uniform sampler2D FluorImage;
uniform sampler2D FluorColorLutRGBA;

void main(void)
{
  vec3 FluorPix = texture2D(FluorImage, gl_TexCoord[0].st).rgb;
  vec2 Coord = vec2(FluorPix.g, 0.0);
  vec4 NewColorFluor = texture2D(FluorColorLutRGBA, Coord).rgba;
  gl_FragColor.rgb  = NewColorFluor.rgb;
}

The texture creation code

glGenTextures(1, &m_FluorShadersParams[fpsFused].m_LutTexture);
glBindTexture(GL_TEXTURE_2D, m_FluorShadersParams[fpsFused].m_LutTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 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_WRAP_S, GL_CLAMP_TO_EDGE);

glActiveTexture(FluorTextureIndexes[fpsFused]);
glBindTexture(GL_TEXTURE_2D, m_FluorShadersParams[fpsFused].m_LutTexture);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);

Filling the texture with data

glActiveTexture(a_FluorTextureIndexes[fpsFused]);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i, 256, 1, GL_RGBA, GL_UNSIGNED_BYTE, pLUT);
glActiveTexture(GL_TEXTURE0);

Calling the shader

glUseProgram(m_progObj[fsFluorFused]);

glActiveTexture(FluorTextureIndexes[fpsFused]);
glBindTexture(GL_TEXTURE_2D, FluorTextureIndexesNum[fpsFused]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, inputTextures[eftIR]); // Fluor image

glBindFramebuffer(GL_FRAMEBUFFER,outputFBO.m_FBO[eftFused]);

uniformLoc = glGetUniformLocation(m_progObj[fsFluorFused], "FluorImage");
if (uniformLoc != -1)
{
  glUniform1i(uniformLoc, 1);
}

uniformLoc = glGetUniformLocation(m_progObj[fsFluorFused], "FluorColorLutRGBA");
if (uniformLoc != -1)
{
  glUniform1i(uniformLoc, FluorTextureIndexesNum[fpsFused]);
}

glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_QUADS);
 glTexCoord2f(0,    fTextureRatioY);
 glVertex2f(0,      fTextureRatioY);
 glTexCoord2f(fTextureRatioX,   fTextureRatioY);
 glVertex2f(fTextureRatioX,     fTextureRatioY);
 glTexCoord2f(fTextureRatioX,   0);
 glVertex2f(fTextureRatioX,     0);
 glTexCoord2f(0,        0);
 glVertex2f(0,          0);
glEnd();

glUseProgram(0);
glActiveTexture(GL_TEXTURE0);

glBindFramebuffer(GL_FRAMEBUFFER,0);
glBindTexture(GL_TEXTURE_2D,0);

The strange thing is that if i change all the places in the code back from Texture2D into Texture1D and the sampler in the shader to 1D everything works great.
Anyone has any idea where the issue can be?

sentences:
CUDA 4.1 Particle Update I'm using CUDA 4.1 to parse in the update of my Particle system that I've made with DirectX 10. So far, my update method for the particle systems is 1 line of code within a for loop that makes each particle fall down the y axis to simulate a waterfall:

m_particleList[i].positionY = m_particleList[i].positionY - (m_particleList[i].velocity * frameTime * 0.001f);

In my .cu class I've created a struct which I copied from my particle class and is as follows:

struct ParticleType
{
    float positionX, positionY, positionZ;
    float red, green, blue;
    float velocity;
    bool active;
};

Then I have an UpdateParticle method in the .cu as well. This encompass the 3 main parameters my particles need to update themselves based off the initial line of code. :

   __global__ void UpdateParticle(float* position, float* velocity, float frameTime)
{

}

This is my first CUDA program and I'm at a loss to what to do next. I've tried to simply put the particleList line in the UpdateParticle method, but then the particles don't fall down as they should.

I believe it is because I am not calling something that I need to in the class where the particle fall code use to be. Could someone please tell me what it is I am missing to get it working as it should?

If I am doing this completely wrong in general, the please inform me as well.

sentences:
Prefab disables its script when a clone is instantiated A clone of a cube is spawned when it is destroyed, however the clones disable the script in the editor (example: http://gfycat.com/SnarlingScornfulEgg). Used the exact same script for a different kind of 'enemy' and it worked as intended.

Relevant part of script:

function Start () {
    health = 100;
}

function Update () {
    if(health <= 0){
        Dead();
    }
}

function OnCollisionEnter (col : Collision) {
    if(col.gameObject.tag == "Bullet"){
        health-=25;
    }
}

function Dead () {
    Destroy(gameObject);
    var posx = Random.Range(-50, 50);
    var posz = Random.Range(-50, 50);
    Instantiate(enemyl, Vector3(posx, 0.5, posz), transform.rotation);
}

Is there something I'm missing?

EDIT: The clone takes damage but doesn't die like the original when its health is <= 0.

sentences:
Centering an animation [libGDX] I have the following class:

public class AnimationDemo implements ApplicationListener {
    private SpriteBatch batch;
    private TextureAtlas textureAtlas;
    private Animation animation;
    private float elapsedTime = 0;
    private OrthographicCamera camera;
    private int width;
    private int height;
    private int texturewidth;
    private int textureheight;

    @Override
    public void create() {
        width = Gdx.graphics.getWidth();
        height = Gdx.graphics.getHeight();
        camera = new OrthographicCamera(width, height);
        camera.position.set(width / 2, height / 2, 0);
        camera.update();

        batch = new SpriteBatch();
        textureAtlas = new TextureAtlas(Gdx.files.internal("data/packone.atlas"));

        textureAtlas.getRegions().sort(new Comparator<TextureAtlas.AtlasRegion>() {
            @Override
            public int compare(TextureAtlas.AtlasRegion o1, TextureAtlas.AtlasRegion o2) {
                return Integer.parseInt(o1.name) > Integer.parseInt(o2.name) ? 1 : -1;
            }
        });

        animation = new Animation(1 / 15f, textureAtlas.getRegions());

    }

    @Override
    public void dispose() {
        batch.dispose();
        textureAtlas.dispose();
    }

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

        batch.begin();
        elapsedTime += Gdx.graphics.getDeltaTime();
        batch.draw(animation.getKeyFrame(elapsedTime, true), 0, 0);
        batch.end();
    }

    @Override
    public void resize(int width, int height) {
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }
}

In the above I am using the Animation class to simply draw from a texture atlas. I am following an example from another SO question which is here but the co-ordinates don't fit my equation. How should I set these:

private int texturewidth;
private int textureheight;

Any help would be great :)

sentences:
Ashikhmin-Shirley model implementation: ugly result I am trying to implement the Ashikhmin-Shirley model using these formulas:

This is the GLSL 1.2 fragment shader code:

uniform vec4 materialAmbient, materialDiffuse, materialSpecular;
uniform float materialShininess;
uniform vec4 lightAmbient, lightDiffuse, lightSpecular, lightPosition;

varying vec3 P,N;

float pi= 3.1415926535;

vec4 Fd(float NdotV, float NdotL) {
    vec4 fd= (28.0 * materialDiffuse * lightDiffuse) / (23.0 * pi) * (1.0 - materialSpecular * lightSpecular);
    fd*= 1.0 - pow(1.0-NdotV/2.0,5.0);
    fd*= 1.0 - pow(1.0-NdotL/2.0, 5.0);
    return fd;
}

vec4 Fr(float u, vec4 specular) {
    return specular + (1.0-specular) * pow(1.0 - u, 5.0);
}

// f= phi
vec4 Fs(float VdotH, float NdotH, float NdotL, float NdotV, float et, float eb, float f) {
    vec4 fs= Fr(VdotH, materialSpecular * lightSpecular);
    fs*= sqrt((et+1.0) * (eb+1.0)) / (8.0 * pi);
    fs*=  pow(NdotH, et*pow(cos(f),2.0) + eb*pow(sin(f),2.0)) / (VdotH * max(NdotL, NdotV));
    return fs;
}

void main(void) {
    vec3 L= normalize(vec3(lightPosition) - P);
    vec3 V= cameraPosition;
    vec3 H= normalize(L+V);
    float NdotL= max(dot(N,L),0.0);
    float NdotV= max(dot(N,V),0.0);
    float NdotH= max(dot(N,H),0.0);
    float VdotH= max(dot(V,H),0.0);
    gl_FragColor= Fd(NdotV, NdotL) + Fs(VdotH, NdotH, NdotL, NdotV, 128.0,128.0,1.0);
}

I already checked and it seems like all the uniforms and varying are passed in the right way, I pass P and N from the vertex shader. The variables are:

Light direction: L;
Surface normal: N;
Camera direction: V;
Half vector: H;
Fragment position: P.

The uniforms I pass are:

light{Specular | Diffuse | Ambient} : 0xffffff (converted to a rgba vector of course);
materialAmbient: 0x543807 ;
materialDiffuse:  0xc6901d;
materialSpecular: 0xfdefce;
materialShininess: 27.8974.

This is the result I get:

Which seems very strange to me, I've seen other images of Ashkhmin-Shirley implementations on the web, and they aren't similar. This is an example:

I want one like this !! Maybe I am using wrong values of phi and other values? Or there's something wrong in the formula?

sentences:
Load all sprites up-front, or stream them? I'm currently in the starting phase of my first large game in Swift and SpriteKit. It will be a Super Mario-like platformer game where each level is about two minutes long.

Since I've never made a game like this one before, I don't have much experience about how to make games effective and RAM-friendly.

I'm wondering if I should load every single SpriteNode immediately as the player launches a level, or if I should render these as the player advances through the level.

Loading everything instantly seems easier and more straightforward, but will this have a large effect on performance?

sentences:
Relative and absolute position with sprites in libgdx In libgdx, can i add a sprite as children of another an set it with the relative coordinates of the father and not the stage?

Like in HTML when you add controls they are relative to its parent, but here i want it with sprites, i add the children in a Group class but the coordinates are absolute (relative to the stage)

sentences:
OpenGL float[][] not working? I have a float[][] array in my terrainFragmentShader to load render the biomes, however the code simply does not work. No errors are being cast and when I remove the code biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)] by either deleting that section or manually setting it, it loads the appropriate texture.

vec4 textureColour = texture(backgroundTexture, pass_textureCoordinates);

float c = biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)];

if(c < 0)
    textureColour = texture(sandTexture, pass_textureCoordinates);
else if(c < 32)
    textureColour = texture(stoneTexture, pass_textureCoordinates);

All three textures load just fine and are rendered when not using this method and the biomes are being properly loaded and initialized.

Loading:

public void loadBiomes(float[][] biomeMap) {
    for(int x = 0; x < Terrain.VERTEX_COUNT; x++) {
        for(int y = 0; y < Terrain.VERTEX_COUNT; y++) {
            super.loadFloat(location_biomeMap[x][y], biomeMap[x][y]);
        }
    }
}

Initializing:

    location_biomeMap = new int[Terrain.VERTEX_COUNT][Terrain.VERTEX_COUNT];
    for(int x = 0; x < Terrain.VERTEX_COUNT; x++) {
        for(int y = 0; y < Terrain.VERTEX_COUNT; y++) {
            location_biomeMap[x][y] = super.getUniformLocation("biomeMap[" + x + "][" + y + "]");
        }
    }

And finally here is the entire terrainFragmentShader:

#version 400 core

in vec2 pass_textureCoordinates;
in vec3 surfaceNormal;
in vec3 toLightVector;
in vec3 toCameraVector;
in int biomeSize;

out vec4 out_Color;

uniform sampler2D backgroundTexture;
uniform sampler2D sandTexture;
uniform sampler2D stoneTexture;

uniform vec3 lightColour;
uniform float shineDamper;
uniform float reflectivity;

uniform float biomeMap[128][128];

uniform float offsetX;
uniform float offsetZ;

const int levels = 32;

void main(void){

    vec4 textureColour = texture(backgroundTexture, pass_textureCoordinates);

    float c = biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)];

    if(c < 0)
        textureColour = texture(sandTexture, pass_textureCoordinates);
    else if(c < 32)
        textureColour = texture(stoneTexture, pass_textureCoordinates);

    vec3 unitNormal = normalize(surfaceNormal);
    vec3 unitLightVector = normalize(toLightVector);

    float nDotl = dot(unitNormal,unitLightVector);
    float brightness = max(nDotl, 0.25);

    vec3 unitVectorToCamera = normalize(toCameraVector);
    vec3 lightDirection = -unitLightVector;
    vec3 reflectedLightDirection = reflect(lightDirection, unitNormal);

    vec3 totalDiffuse = brightness * lightColour;

    out_Color = vec4(totalDiffuse,1.0) * textureColour;

}

Why isn't the biome not loading? Is it an issue in me not getting the appropriate [x][y] from the pass_textureCoordinates?

sentences:
How far should I go in securing Groovy mod scripts? I am developing a game in java and plan to embed the Groovy script engine to allow for more robust modding options. This comes at a price, of course. Groovy can access anything java can by default, making it something of a security risk. At the moment, this doesn't worry me all too much, as mods for many other single player games such as minecraft already provide this level of access.

However, while the game does not currently have multiplayer support, I would very much like to change that at some point after the initial release. In this case, I would like to be able to allow servers to supply required mod files directly to the client. Is it safe to allow this sort interaction in any case?

My current plan of implementation for this would be to have the server supply mod files to clients, then have the clients pass the name of the mod to a public server I'd host, receiving back from me the expected hash value of that mod to compare against a locally computed hash of the files received from the client. They'd also be given the public rating and description of the mod, and be prompted from there if they wished to keep the mod or discard it.

Obviously this would still require me hosting a mod validation server, so that mods not on the server would be rejected by default. And I'd likely have to provide the ability to download mods directly from this server for users looking to get these mods in the first place, but the purpose of this is to allow players to easily connect to servers without planning out ahead of time what mods they'd need to download, while also decreasing some of the bandwidth overhead I'd have to deal with by having servers host the files and myself simply serving up short blocks of text and hashes.

In summary: Is this complete overkill? Can I even trust servers to host safe content? Can I trust servers to host safe content without checking up on the files they send? Is this not enough security? Do I need to sandbox groovy, or would I be wasting my time?

sentences:
Fail to install ML-Agents (python packages) I have been trying for hours to install pytorch and mlagents with cmd, however I am getting pretty much the same error for each package I'm trying to install -

ERROR: Could not find a version that satisfies the requirement typing-extensions (from torch==1.7.0) (from versions: none)

ERROR: No matching distribution found for typing-extensions (from torch==1.7.0)

I'm using python version 3.7.9, attaching a screenshot of the cmd.
Also, as you can probably notice - I'm getting a repeating warning every time I'm using pip and I'm not sure of it's something to avoid -

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/torch/

sentences:
LibGDX: Why won't certain actions work on my Actor? In my GameClass, I called the Stage.act and Stage.draw methods in the right order accordingly.

I have actions set up so that the actor fades in/fades out, bounces down/up, and also rotate, like so:

Label.LabelStyle font = new Label.LabelStyle(new BitmapFont(), Color.BLACK);

    Table table = new Table();
    table.center();
    table.setFillParent(true);

    Label playLabel = new Label("Text", font);

    Action fade = new SequenceAction(Actions.fadeOut(1), Actions.fadeIn(1));
    Action size = new SequenceAction(Actions.sizeBy(-20,-30,1), Actions.sizeBy(10,20,1));
    Action rotate = new SequenceAction(Actions.rotateBy(20), Actions.rotateBy(-40));

    ParallelAction pa = new ParallelAction(fade, size, rotate);

    playLabel.addAction(Actions.repeat(RepeatAction.FOREVER, pa));

    table.add(playLabel).expandX();
    table.row();

    stage.addActor(table);

The thing is, everything works except for the rotate method.

Similarly, I have similar problem when I use an Actor with Texture regions.

This is an example from another class.

public ReadyText () {
    cam = GameClass.cam;
    viewport = GameClass.viewport;
    cam.setToOrtho(true, viewport.getWorldWidth(), viewport.getWorldHeight());
    region = new TextureRegion(GameAssetLoader.Ready);
    this.setX(28);
    this.setY(165);
    this.setWidth(80);
    this.setHeight(30);

    //fade = Actions.sequence(Actions.fadeOut(1), Actions.fadeIn(1));
    Action rotate = Actions.sequence(Actions.rotateBy(80, 1), Actions.rotateBy(-90,1));
    Action resize = Actions.sequence(Actions.sizeBy(10, 5,1), Actions.sizeBy(-10,-5,1));

    ParallelAction pa = new ParallelAction(rotate, resize);

    addAction(Actions.repeat(RepeatAction.FOREVER, pa));

}

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);

    batch = GameClass.batch;
    batch.setProjectionMatrix(GameClass.cam.combined);
    batch.draw(region, this.getX(), this.getY(), this.getWidth(), this.getHeight());

}

In this example, the "sizeBy" method works fine. But for some reason, it will not rotate. I commented out the "fade in/fade out" line; it also wasn't working either.

I know people will usually use an Image Actor instead, which makes sense, but I don't think it explains why the rotation won't work, or at the very least, why the Label didn't rotate either.

sentences:
Unity3d - AudioSource is not playing if gameObject is removed after play was started I am not able to play my audio source if I deactivate the panel where the AudioSource is attached to AFTER it.

    _audioBtnEnter = tmpBtnGeneral.GetComponent<AudioSource>();
    _audioBtnEnter.Play();
    tmpBtnGeneral.SetActive(false);

I would totaly understand if this would not be possible:

    tmpBtnGeneral.SetActive(false);
    _audioBtnEnter.Play();

But why does the first code not trigger the audio play?

Is this a race condition problem?

sentences:
How to update the value of all owners of shared_ptr? I’m writing a render, there is a class that shaders should store, something like a shader manager. These shaders are stored as

std :: map <std :: string, std :: shared_ptr <BaseShader>> cache;

BaseShader is an abstract class (there are virtual methods).

Other classes want to own shaders, and request them accordingly by name. That is, they each have a copy of the smart pointer. After the change, the shaders need to be rebooted from the disk. Accordingly, new is done and written by name in the cache, the problem is that clients do not see this change. How to make sure that the reset for the smart pointer is not made, and the updated object was copied to the same address that it stores?

sentences:
Libgdx Do a fixed rotation for orthographic camera I'm trying to rotate my OrthographicCamera in the render loop to a fixed angle, but I can only make the camera spin. This is the code that I have:

in create():

OrthographicCamera camera = new OrthographicCamera();
camera.setToOrtho(true, 100, 100);
camera.position.set(50, 50, 0);
camera.update();

in the render loop:

camera.rotate(30);
camera.update();

The camera keeps spinning each frame. But I'd like the camera to stay at 30 degrees.

I have already seen this answer:

https://stackoverflow.com/questions/16509244/set-camera-rotation-in-libgdx

But I don't like it because this code is too drastic.
I wonder if there is a more "common" way to do this.

sentences:
How to move a object to a target point like sine wave in 2D world I want to move my gameobject to move point A to target point B like sine wave, I have used Vector2.Lerp but its just straight line.
so far I tried many ways and I managed this

//sine wave
vLastPos = new Vector2(transform.position.x , Mathf.Sin(Time.time)*2f+2f);
transform.position = vLastPos+Vector2.right*Time.deltaTime;

but the problem is its moving the gameobject left to right not to target position. the gameobject shold reach the target position and stop. please help me.

sentences:
Using Physics.Raycast inside OnCollisionEnter2D function void OnCollisionEnter2D(Collision2D collision)
    {
       foreach(ContactPoint2D contact in collision.contacts)
       {
           RaycastHit raycastInfo;
           Physics.Raycast(contact.point, Vector3.forward, out raycastInfo, 1000.0f);
           if(raycastInfo.collider)
           {
               Debug.Log("Hit!");
           }
       }
    }

I am using this code to raycast an abject with the contact position of collision. The collision part works fine, when collision happens this function is triggered. But when I raycast to that position, RaycastHit variable return empty.

I couldn't find what I am doing wrong.

sentences:
Unity Shader Material Only Activates when Clicked I am currently programmatically settings some shader textures, related to a Mesh Filter.  The Mesh Filter is using a standard shader, and I am merely generating and setting the Bump and Height maps, via code.

Sphere.materials [0].mainTexture = biome;
Sphere.GetComponent<MeshRenderer> ().materials [0].SetTexture ("_BumpMap", bump);
Sphere.GetComponent<MeshRenderer> ().materials [0].SetTexture ("_ParallaxMap", heightTexture);

This is fine.  The issue is that the shader only seems to activate itself once it is clicked in the inspector.  Is there some sort of Activate() function I need to call in order to apply the shader effects to the Mesh?

Notice in the example (this is running in Play mode), that the shader only activates once I click the expand button on the Shader in the inspector.

What is going on here?

sentences:
Implementing a Custom Mouse Cursor in XNA I have tried making a custom mouse cursor, hiding the real mouse, taking the real mouse delta and clamping it to a maximum speed. Here is the problem:

In windowed mode, the "real" mouse cursor moves off the window while the custom mouse cursor (since it's movement is being scaled) is still somewhere inside the game window. This becomes bizarre and is obviously not desired, as clicking at this point means clicking on things outside the game window. Is there any way to accomplish this in windowed mode?
In fullscreen mode, the "real" mouse cursor is bounded to the edges of the screen. So I get to a point where there is no more mouse delta, yet my custom cursor is still somewhere in the middle of the screen and hence can't move further in that direction. If I wanted to clamp it to the edge of the screen when the real cursor is at the edge, then I would get an abrupt jump to the edge of the screen, which isn't desired either

Any help would be appreciated. I'd like to be able to limit the speed of the mouse.

sentences: what is the difference between the regular camera and the first person camera? I'm asked to implement first person camera but all I know is the regular camera that moves when I hit specific keys and could anyone tell me the steps to implement it?

sentences:
HLSL Shader Relative Positioning I've got a shader that does the texturing, lighting, etc. for my game engine (written on top of MonoGame, in case that's relevant) for my block-terrain-based game (everything is rendered as triangles and each chunk has its own mesh made from logical block objects, recomputed when relevant). I have two versions of this shader, a SM2 one and an SM4 one (for different targets), both do the same thing and are almost identical but I primarily focus on the SM2 one since that is for the primary target.

Anyway, a week or so ago I implemented directional lighting, and it looks fine.. except it seems to fail to take the distance from the light source into account - i.e., every block looks like it's an equal distance from the light source.

I tried setting up some obvious solutions - I was already calculating the direction of the light using a parameter of the light position with the vertex position, so I took an intermediate (pre-normalization) value of this and used it as the distance to modulate the intensity of the light. Sounds good, yeah? Well, it somehow made no difference at all. I can't seem to find a piece of software to help me debug a vertex/pixel shader combo (only lone pixel shaders), so I'm basically stuck thinking through the logic and trying things. That's a familiar debug style for me, but I've been trying for a week or two and haven't come up with anything that has made a difference.

I've since stripped this out of the shader (since it didn't work, and I wanted to just work on other things for a while), but I was calculating the distance in the vertex shader (and passing it to the pixel shader) like this:

float3 final3DPos = mul(inPos, World);
float3 direction = -(final3DPos - LightPosition);
Output.LightDirection = direction;
Output.LightDistance = length(direction);

I also tried setting LightDistance to (abs(distance.x) + abs(distance.z)), with distance being what in the above is LightDistance - I ignored Y since it's constant and figured it would exaggerate the difference between positions.. same effect!

In the pixel shader, LightDirection is normalized before use.

I tried setting the end result as a color made from the distance, and everything ended up black. I tried dividing this by various values in case the numbers were too big and multiplying by 255, and no matter what i did everything was the same color.

I tried just using it in the calculations by dividing by it or deriving a multiplier to use from it, and again every block was lit the same.

I could pass the distance to the light in with the vertex information, but calculating that and sending it in for EVERY VERTEX seems really stupid and unnecessary.. :(

sentences:
How to handle GameObjects that have been destroyed but are still held by others? I'm developing my own game engine in C++ as a learning exercise. I have employed a fairly standard method of handling destroyed GameObjects:

Mark them as destroyed
Have the scene delete destroyed GameObjects at the end of the update cycle

This is perfectly fine, however if I want a GameObject to hold a reference of another GameObject then I need to decide what happens to that now destroyed object.

At the moment I'm using std::shared_ptr to support multiple ownership of GameObjects so that they are held by both the scene and any other GameObjects within the game. This means that if the scene 'destroys' them they will live on as they are still pointed to by any GameObjects still using them. This could potentially cause strange behaviour when GameObjects no longer in the scene are still used by GameObjects in the scene.

There are alternatives involving raw pointers: where the GameObject pointing to another might start trying to use an GameObject that has actually been deleted, or std::unique_ptrs where GameObjects would not be able to hold a pointer to another.

Is the best strategy simply to ask the object if it has been destroyed before using it everywhere in the code base? This seems like a fairly risky way of ensuring issues don't occur.

sentences:
what options do I have for rendering "large" terrains? I am trying to design a game with some interesting features but one question I have is regarding terrain. I want a terrain that will make for a very large game world, and I want to be able to have such features as "roads" and "rivers".

What options do I have in terms of terrain and what will give me the best result in terms of best looking, obviously I want to also keep the game playable with a reasonable frame-rate, but this game will specifically target higher end hardware.

sentences:
Resizing a parallax background (bug) I'm attempting my first 2D vertical scroller and can't seem to get the background size to work. For some reason, it stays small. I think in the beginning of the parallax scrolling class, I was told to initialize variables and I know which ones I have to change.

public Texture2D picture;
public Vector2 position = Vector2.Zero;
public Vector2 offset = Vector2.Zero;
public float depth = 0.0f;
public float moveRate = 0.0f;
public Vector2 pictureSize = Vector2.Zero;
public Color color = Color.White;

I think I must change pictureSize to make it bigger, as the current sizing I get this:

Finally, how can I remove the whitespace from the ship image?

EDIT: Here is the code for the rendering of the actual ship:

public void Render(SpriteBatch batch)
{
    batch.Begin();
    batch.Draw(shipSprite, position, null, Color.White, 0.0f, spriteOrigin, 1.0f,
    SpriteEffects.None, 0.0f);
    batch.End();
}

The whitespace seems to be provided by XNA as I've tried clearing it using Photoshop. Because I can't directly upload to the site, I have put it here

This renders the background:

public void Draw()
{
layerList.Sort(CompareDepth);
batch.Begin();
for (int i = 0; i < layerList.Count; i++)
{
   if (!moveLeftRight)
   {
       if (layerList[i].position.Y < windowSize.Y)
       {
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y), layerList[i].color);
       }
       if (layerList[i].position.Y > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y - layerList[i].pictureSize.Y),
           layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y + layerList[i].pictureSize.Y),
           layerList[i].color);
   }
   else
   {
       if (layerList[i].position.X < windowSize.X)
       {
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X,
           0.0f), layerList[i].color);
       }
       if (layerList[i].position.X > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X -
           layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X +
       layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       }
   }
   batch.End();
}

(It's from a XNA tutorial book I'm reading.)

sentences:
How can I easily create/edit a level for a scrolling shooter game? I've been asking this question over the years many a time, but I still haven't found an answer when i search for one. Now I have slightly more knowledge of how programming is done and want to start making some full games.

I want to start with a side scrolling shooter (space style like R-Type/Gradius). I have many ideas in my head for good levels, and i even have some basic 3d skills in Maya/Blender to make the assets, but I do not know how best to formulate the levels. Lets say the space shooter has 30 levels. Each level might have about 10-15 enemy types and a boss on some levels. How best to store the location of all the enemies? (Same scenario for all the background objects,obstacles, powerup locations etc.)

Is there a better way than manually building the whole level in a Unity Scene editor view? Another way I have tried is to set spawn positions for every single object as a Vector2 or similar in XML or JSON, but how i did it that seemed even harder to make the levels than just inside the editor (not even accounting for having to write the functionality to get the data from the textfile).

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:
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:
How to create activity again in Android? I am making some game and I want to create activity again after click on  some Button.

For example:
I have activities A (game) and B (after game menu). I want to go back to activity A after clicking "Play again" in activity B. But I don't want to resume it but to create it again, so it starts from the beginning. Is there any way of doing this?

I am using android studio.

sentences:
DirectCompute information I've been trying to make use of the GPU as part of a project of mine. I've looked into both CUDA and OpenCL, but the lack of information showing you how to introduce these into a project is shocking. Even their dedicated forum groups are dead. So now, I'm looking into DirectCompute.

From what I can tell, it's simply a new type of shader file that makes use of HLSL. My question is this, does my program (aside from being DirectX 10 / 11 ) need its structure changed?

I mean, is it simply a case of creating the CS file, setting in the project like I would any other shader, and watch the magic happen?

Any information on this would be appreciated.

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:
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: 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 should I store levels in a C++ game? I am writing in C++. I am storing game levels as a 2-dimensional int array. This may be a hacky way of doing things, but I am not ready to change it unless I have to. I store values in the array and then draw them as I read the array. These are constant for me but I need to access them from multiple files.

How can I do this? If I put the level arrays in a header (.h) file and include it in many places I get a redefined variable compilation error. Is there a way to define a variable so it can't be used more than once?

How can I go about this in a better way?

sentences:
Make the components of an ECS polymorphic I have implemented an entity component sytsem (ECS) in my game engine (SFML and C++ 17). An entity has an array of components. You can get a components by its type e.g.: myEntity.GetComponent<RenderComponent>(). So far so good.

The problem

Best to illustrate this point by an (admittedly oversimplified) example:

Some systems or possibly other components might want to be able to call myEntity.GetComponent<RenderComponent>() without knowing the type of that render component (e.g. whether it is a house render component with a sprite and a paritcle system for smoke or a character) but knowing that every render component has e.g. a GetPixelMask() method.

A more concrete case of this is the collision component that might be implemented as a collision box or a pixel mask that may come from any type of render component. However, every collision component would have a method bool Contains(Position). I would like to be able to loop through all entities with a collition component and check whether e.g. the mouse click lies within them.

I want a clean solution. It must not use polymorphism, it should solve the problem in a neat way.

Possible Solutions

This is bad code smell to me but still its a solution. Screw polymorphic behaivour and just add an if cause to the systems. Something like If(myEntity.HasComponent<HouseRenderComponent>()) { /*Call method a*/ } and If(myEntity.HasComponent<CharacterRenderComponent>()) { /*Also call method a*/ }
Another solution would be to make it so that the component are 'configured'. This is my current solution which kinda works but isn't all to clean (I find). This would mean making some RenderObject base class and letting the RenderComponent manage a dictionary of RenderObject pointers. RenderObjects would have to be added through a method like AddRenderObject() and accessed through an id which isn't all too efficient (Not my biggest concirn here). However, every RenderComponent would have the same methods and the specific type of the RenderComponent would be defined through the RenderObjects added.

Question

I'm pretty sure that adding some kind of real polymorphism to the components would be possible and I could figure out how to do it. The question is: is that good design? - as for me it kind of defeats the point of the ECS. I'd be grateful if you could share your experiences and how you have dealt with this. I can't be the first one to have come across this problem!

Thanks for your help!

sentences:
How to set up the camera for a PS Vita game? I am starting my first project for Unity and I want to start a new game for PS Vita. This console has a resolution of 960x544 pixels.

How do I have to set up my camera so that it adapts to this aspect ratio?

sentences:
Cocos2d-x supporting multi-resolution using density independent pixels Is there a way to use Density Independent pixels(dp) in cocos2d-x?

I am developing an Android game using Cocos2d-x 3.0.

The Android reference http://developer.android.com/guide/practices/screens_support.html tells me not to use pixels in code but use dp when supporting multi-resolution support. It also tells me to provide different images for different screen size groups and different density groups.

However, cocos2d-x tutorials use pixels for multi-resolution support. If I were to use pixels, I think it means I need to have images for all these different resolutions:

240x320, 240x400, 240x432
320x480
480x640, 480x800, 480x854
600x1024
640x960
1024x600, 1024x768
1280x768, 1280x800
1536x1152
1920x1152, 1920x1200
2048x1536
2560x1536, 2560x1600

Even if I don't support every screen resolutions, I think this requires more work than following the Android reference's best practice.

Am I missing something on how supporting multi-resolution works or do I indeed do need to do much more work using cocos2d-x?

sentences:
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:
App using LWJGL can't find display mode extension on Linux I'm running LWJGL app on Ubuntu virtual machine with no phisical graphic card. I set up Xvfb and Mesa3D but it fails with exception

java.lang.ExceptionInInitializerError: null
        at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:234) ~[lwjgl.jar:na]
        at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:219) ~[lwjgl.jar:na]
        at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:190) ~[lwjgl.jar:na]
...
Caused by: java.lang.RuntimeException: org.lwjgl.LWJGLException: No display mode extension is available
        at org.lwjgl.opengl.Display.<clinit>(Display.java:141) ~[lwjgl.jar:na]
        ... 7 common frames omitted
Caused by: org.lwjgl.LWJGLException: No display mode extension is available
        at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:724) ~[lwjgl.jar:na]
        at org.lwjgl.opengl.Display.<clinit>(Display.java:138) ~[lwjgl.jar:na]

App is running from cron using script

export DISPLAY=localhost:1.0
export XAUTHORITY=/home/ubuntu/.Xauthority
xauth add localhost:1 . 11111111111111111111111111111111
Xvfb :1 -screen 0 1024x768x16 -nolisten tcp
/home/username/start.sh

Most of steps above were adopted from here but I'm not sure I did it correctly.
Any help would be appreciated!

sentences:
Is there a difference in these two ways of rendering sprites? I use an OrthogonalTiledMapRenderer:

renderer = new OrthogonalTiledMapRenderer(world.getMap());

and I wonder if there is a differnce between this call:

renderer.getSpriteBatch().draw(sprite, sprite.getX(), sprite.getY());

and this:

sprite.draw(renderer.getSpriteBatch());

If there is a difference, what is it?

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:
Create Levels using blender I am creating a game and I have a custom level format for levels in my game. I wanted to know if it is possible to create levels for that kinda format in Blender. My format is XML based and just declares the positions of certain objects. Online I have seen many people use Blender to create levels in their own custom format that blender can understand.

How do i get blender to understand my format and use blender to create levels for my game?

sentences:
Is it possible to use one if statement for each level scene? I'm working on a platform game where you as a player have to collect logs, to keep on all the fires in the level. Each campfire has a timer, which ensures that every x number of seconds the animation of the fire is changed to a numb fire. The timer of a campfire is blocked by the script, when the player has received the fire at 100%. When all fires are 100% you won, if not you lose.

Know I use the following if statement to check if the player has won or lose:

if (Application.loadedLevelName == "Level 0") {

        if (campfireAmount == allCampfireFull) {
            // Do something
            print ("level 1 complete");
            Application.LoadLevel (6);
        }

        if (campfireAmount == allCampfireEmpty) {
            // Do something
            print ("level 1 failed");
            //Application.LoadLevel ("GameOver");
        }

    }

What I searching for is how I can make this if statement useful for each level, whiteout use for each level scene above if statement. Beside that, what I want is that after each level you get a win scene (if possible a reusable scene) and after clicking in that scene on a button, you should go to the next level scene. Is there a way to load the next level, whiteout set a hard number of the rang list of "Build Settings"?

sentences:
Sprite doesn't change material or picture I am quite new to unity and currenty I'm practicing with a 2D topdown game.

I created a tile map with "tiled", imported it in Unity with "TiledToUnity" and changed some things like player movement, camera and so on.

Now I wanted to create collectible coins. So I created a new 2D Sprite and added the picture of the coin I had to it. But the picture of the coin did not change. I tried the same with adding a material with the coin as picture but it did not work out either.

To check if the object is even there I added a collide box to the coin and my player body did indeed collide.

What did I do wrong while adding a picture to the sprite?

Thanks in advance!

(Sorry fotgot the pictures. )
-- Edit--

sentences:
Am I allowed to make my Minecraft clone open source? I'm developing in my spare time a game like Minecraft. In fact, it isn't "like Minecraft", because I'm trying to make it a close as possible copy of it (meant as exercise for myself at the age of 16 and simply because of it is fun to me). Of course, I'm not copying the code using the Minecraft Coder Pack (MCP). I started the game from scratch in Java using OpenGL.

So, my question is: am I allowed to put my source code online on a public source code versioning host like GitHub, Google Code, et cetera (which makes my code open source, because I don't want to pay to use a private host)? Of course, I don't want to sell the game, because the game is from Notch.

A detail which might be important is that I'm using a custom texture pack (so, not the one that is shipped with the real Minecraft).

If it is allowed, are there any rules? I took a look to this page, but it seems that he doesn't say anything about this: http://www.minecraft.net/terms

Edit: There is the game called Terasology (started under the name Blockmania) from Begla. That is a nice project, but it is not meant to be as close as possible to Minecraft. That project is open source.

sentences:
How do I convert two vectors into a bounding box with 8 vertices? I created two vectors named bboxmin and bboxmax using the functions
vector3
applymin_xyz() and vector3
applymax_xyz().

How do I convert them to 8 vertices,so I can test cull with them?

sentences:
Storing rendering data for voxel game 1 VAO and VBO or 1 for every chunk I have a minecraft style voxel game with placing and digging blocks. it runs at 400+ fps on my computer but when I added semi-transparent water it started running at ~40 fps. so a time per frame increase of 0.0175s or 8 times what is used to be. What I am currently doing is having a VAO and VBO for each chunk and every time a chunk is changed or loaded it finds all of the non occluded blocks and puts their positions into another buffer in the chunk. then I use instancing to render the whole chunk in one draw call so every frame I am doing ~300 draw calls.

Once I added the water(using order independent transparency http://www.openglsuperbible.com/2013/08/20/is-order-independent-transparency-really-necessary/) I was individually calling gldrawelements() for every visible water block so around 9000 if half the visible area is ocean. I know using instancing with these blocks would help but then I have 2 VAOs for every chunk and 600+ draw calls of buffers with only a couple hundred blocks in them. would there be a better way to organize these things.

sentences:
Normal map causing certain faces to get shaded I added a normal map to a MR arch & design material in Max 2012. I have a specular in the reflection color slot and a diffuse in the diffuse slot. As i increase the intensity of the normal map i certain faces get darker and they get really "obvious". Last time i was fiddling with this the exact same thing happened which made me quit normal maps and all. Some UV's are overlapping and the normal map is made with the Nvidia photoshop plugin. My scene just has a daylight system with a MR sun and MR sky.

Does anyone have an idea what is causing this?

As you can see the face gets shadowed as a whole. The face next to it has the same problem on the opposite corner you see the same effect but much less hard.

sentences:
Suitable Client Server setup for Network Game testing I want to test my Client/Server game for which, currently, I am using localhost for both Client and Server.

Obviously I'm not getting any fluctuation in data and measure idea of performance, and in other parameters, what I wanted to ask how I would test a real world scenario:

if i create a little network with two computers or

if check that on LAN on which i am or

Are these cases (localhost included) equivalent?

or do I really need to test my game on different LANs to have reliable and realistic testing data?

How these different network setups influence the testing process?

Can somebody please suggest methods for testing the effect of network latency and packet loss on my game?

which above setup will give me more up and downs in number with LEAST setup/implementing efforts.

The game is supposed to be played on a LAN but it IS capable of more.

sentences:
Independent Column sizes in Scene2D Table in LibGDX For my game's (mostly GUI based) UI i am using table from Scene2D in libGDX. I want independent column sizes in my table but first cell width is the width for all other rows in column. Is it possible to have a table in Scene2D with independent cell width in each row? For example, first cell in first row should have 10% width and first cell in second row should have 15% width.
I tried using Horizontal Groups, Containers but they make my code too shabby and cluttered.

sentences:
Google leaderboards, up to a maximum of 70? I see in the doc that the limit for the number of leaderboards on Google Play Services is 70. However, I am able to create more than 70 leaderboards and they are all working when I test my app. Is this limit still up to date? Does this mean that if I publish my game some of the leaderboards will be deactivated or something?
Thank you in advance if you know the answer. I just want to make sure of what I can expect for when I publish my game.

sentences: How to read the binary file generated by the Unity profiler? I'd like to know how can I read the binary file generated by profiling Unity game and how can I save it on external hard disk.

sentences:
Damage indicator screen overlay I want to make something already done by a lot of games , which is when I am taking so much hits from enemy red screen drawn like the following  , using XNA 4.0:

after it's drawn and I am still alive I want to be removed slightly as in the call of duty !!!

sentences: How do you program diagonal movement? I'm wondering how a diagonal element that moves along a diagonal path that hops at each tick of the computer clock is able to travel a greater distance along the screen than an element moving at each tick along left-right or up-down paths (since it's a square lattice and the diagonal element of a triangle is the same length of the two legs of a 45-45-90 triangle, or just take a square grouping of nine pixels, the diagonal is 3 pixels, and the left-right and up-down direction are 3 pixels also, a violation of the hypotenuse, but you can still measure the diagonal distance of a square pixel with a ruler), so things move faster along the diagonal, and you'd have to also take into account variations of lower angled paths that move at a lower angle diagonal (they still move faster than left-right elements).  I'm wondering if that's a source of jitter in a character object that is composed of a large blob of pixels, has somebody already figured out a ratio in reducing the speed of the diagonal moving pixels while still maintaining the shape of the blob of the character moving.

sentences: Using 10 materials for one Model? I made more than 10 robots. all of them had not less than 4 materials, and some had 12 materials. I can't go back and fix this. How this will effect on the game performance later ?

sentences:
How to monetize and protect a engine's and its framework's copyrights and patents? I created a game engine that handles:

Rendering levels with 2d textured curved surfaces
Collisions with curved surfaces
Animationn paths on and navigation in 2d-sapce

I have also made a framework for:

Procedural organic level generation with round surfaces
Level editing
Light weight sprite design

The engine and framework are written in AS3 and I am in the process of translating the code into HaXe to better support other platforms.

I am also interested in adding

Animated curved platforms
More advanced level editing features

Currently, I have a part time job and any time I spend on this engine is either taken out of my limited free time (I'm a student working to support myself through school) or out my time working at my job.

I really believe this engine can make life much easier for people designing Tower Defence games, Shooters and and Platformers while also possibly improving their results. It could also support RTS, RPGs and racing games very well.

It continains original algorithms that could be used for procedural generation of organic round and smooth levels. The algorithms I used are new and are not available in any other level editor I've seen.

In order to constantly improve the Engine and have it tested thoroughly I think the best route is releasing it to the public.

What are the best ways to benefit myself and others with my new framework?

I want to have some lisence, allowing me to share the framework and still benefit from it.

Any advice would be appreciated. This issue has been on my mind a lot this year. I am hoping to find a solution that will bring me some relief.

I am thinking of designing three sample games, releasing them and starting a kickstarter, any advice and thoughts on the matter would be valuable.

My goal is like Markus von Broady suggested, to get people involved in developing the engine and let people use it for games for either a symbolic fee or for free and charge for support.
That or use some form of croud sourcing.

Do I need to hire a lawyer to get some sort of legal document to protect my work?

sentences:
2D graphic over 3D perspective projection To draw a 2D HUD (just a simple trianlge, for now) over 3D graphics in OpenGL I :

draw all 3D objects, then
call glDisable(GL_DEPTH_TEST) before drawing 2D HUD
draw 2D triangle
call glEnable(GL_DEPTH_TEST);

however it seems I am missing something and the triangle is only rendered when I set Model-View-Projection matrix to Identity :

DrawFrame() {
.
.. // Draw 3D objects
.
/*
*  Coordinates of 2D triangle
vert[0] = 0.0f; vert[1] = 0.5f; vert[2] = 0.0f;   // TOP
vert[3] = -0.5f; vert[4] = -0.5f; vert[5] = 0.0f;  // LEFT
vert[6] = 0.5f; vert[7] = -0.5f; vert[8] = 0.0f;   // RIGHT
*/

glDisable(GL_DEPTH_TEST);

glm::mat4 guiMVP = glm::mat4(1.0f);
//glm::mat4 guiMVP = Ortho * View * glm::mat4(1.0f);   // This does not render triangle
//glm::mat4 guiMVP = Projection * View * glm::mat4(1.0f);   // This DOES render triangle at its place but in 3D world
glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &guiMVP[0][0]);
...
.. // render2D triangle
glEnable(GL_DEPTH_TEST);
}

OnSurfaceChanged(int width, int height) {

    glViewport(0, 0, width, height);

    aspect = (float) width / height;

    // Projection Matrix
    Projection = glm::perspective(45.0f, aspect, 0.1f, 10000.0f);
    // Orthographic Matrix for 2D HUD
    Ortho = glm::ortho(0.0f, (float)width, (float)height, 0.0f);
}

setCamera(float cameraX, float cameraY, float cameraZ, float cameraLX, float cameraLY, float cameraLZ) {
    // Camera/View matrix
    View = glm::lookAt(
        glm::vec3(cameraX, cameraY, cameraZ),     // Camera position
        glm::vec3(cameraLX, cameraLY, cameraLZ),     // pointing at
        glm::vec3(0, 1, 0)      // Angle
     );
}

here's my Vertex shader :

attribute vec3 in_Position;

uniform mat4 MVP;

void main(void) {
    vec4 v = vec4(in_Position, 1.0);

    gl_Position = MVP * v;

}

This is screenshot of what I want :

I DO get this output by using an Identity MVP matrix for 2D graphics. I know this is an ugly hack that works for now.

How to do this properly using Orthographic matrix ?

sentences:
How do I find the 2D direction to a 3D location? I'm writing a 3D space flightsim, and I'm trying to display a 2D arrow on screen that points to the player's selected target. To clarify, the arrow needs to point in the direction that the player has to turn to reach the target.

I've tried several approaches but I can't seem to make this work for all cases. My current attempt involves constructing a plane from the player's local X/Y, projecting the target position onto it (to make the calculation 2D) then calculating the angle between the player's up and the vector to the projected target position.

I can't help but think I'm over-thinking this and there must be a better, simpler way. Anyone have any suggestions?

UPDATE:

Based on Sam's answer, I've tried the following code:

//Find the direction to the target, and normalize it
kglt::Vec3 target_dir = (target_pos - ship_pos);
target_dir.normalize();

kglt::Vec3 v1, v2;
v1 = ship_up.cross(ship_dir);
v2 = ship_up.cross(target_dir);
v1.normalize();
v2.normalize();

//Get the angle of rotation for the arrow
float angle = kmRadiansToDegrees(atan2(ship_up.dot(v1.cross(v2)), v1.dot(v2)));

But the returned angle is always around 180.0 (although normally -179.xx). Is there any obvious error somewhere? I'll continue debugging and update if I figure it out!

UPDATE2

Nevermind, the bug isn't in this section of code. My bad!

sentences:
How do I create a rocket projectile that is "dropped", then accelerates toward the enemy? I'm making an Asteroids-like game.  I've successfully implemented linear bullets.

Now I want to add some rocket-styled bullets, with a certain flight path:
The rockets should be "dropped" back first, then accelerate towards the enemy.

I'm having difficulty making this work when the shooter is rotated.
To visualize what I mean:

Bullets have a lifeTime which increases every frame.

sentences:
Downsides of using this integration formula for movement? So I read that Gaffron integration basics tutorial and noticed how the Euler integration method gives a small error over time. I implemented the RK4 and noticed that with constant acceleration, I could simplify the formula. Over the course of an hour with some use of wolframalpha, I noticed that the formula eventually just simplifies down to just this:

float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

Position += (0.5f * Acceleration * dt + Velocity) * dt;
Velocity += Acceleration * dt;

I ran it through a console and sure enough, it gives the proper values for each timestep and the correct final value.

Will this formula always yield perfectly accurate answers? My acceleration will always be constant. Is there a name for this formula?

sentences:
How to make Unity3D Camera focusing on one area? In my Unity3D project, I have a board created dynamically (using c#) and located on the screen as follow:

0 < x < 12
0 < z < 12
y = -1

How can I make the camera focusing on the board and make it centered for different screen resolutions and for different platforms?

EDIT:

What I have tried so far

public class PositionCamera : MonoBehaviour {

    public float fWidth = 9.0f;  // Desired width

    void Start () {

        float fT = fWidth / Screen.width * Screen.height;
        fT = fT / (2.0f * Mathf.Tan (0.5f * Camera.main.fieldOfView * Mathf.Deg2Rad));
        Vector3 v3T = Camera.main.transform.position;
        v3T.z = -fT;
        v3T.y = 3f;
        transform.position = v3T;
    }
}

I have attached this script to my camera. Actually, it makes the board look much better but not centered on the screen.

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:
Screen Space - Camera improper scaling on iOS device only I've reproduced the issue in a simple setup where I have two canvas's, one overlay and one camera. I put an image under both set to maintain aspect ratio, and set them to use anchors for sizing instead of pixels. On iOS the camera space canvas stretches the image improperly, and the overlay is fine. Both have identical settings, with Canvas Scaler set to screen size and to match width. This only seems to happen on older iOS devices, but my sample size is too small to say that for certain.
I expect both images to maintain aspect ratio on device, but the image under Screen Space - Camera stretches out of aspect ratio. Local Scale on all objects is what I would expect it to be so nothing interesting there.
Has anybody run into this issue before or have any idea what might be causing it?

sentences:
Vector Math question Suppose I have two game object located at two Vector3s v1 and v2, respectively.
If I wanted to locate a position between v1 ad v2, but 3 units away from v2, how would I manage that in terms of calculating the target vector (vT)?  Basically, I want object 1 to translate toward object2, so that it can play an attack animation a reasonable distance away from the combat target without being on top of it.

I calculate a vector pointing from v2 to v1:

Vector3 heading = v1 - v2;
Vector3 headingNorm = heading.Normalize();

From there, how to I "add 3 units in the direction of v1 from v2" to get the target position?

Thanks in advance!

sentences:
Xna, after mouse click cpu usage goes 100% Hi i have following code and it is enough just if i click on blue window then cpu goes to 100% for like at least one minute even with my i7 4 cores. I just check even with empty project and is the same !!!

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    private Texture2D cursorTex;
    private Vector2 cursorPos;
    GraphicsDevice device;

    float xPosition;
    float yPosition;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);

        Content.RootDirectory = "Content";

    }

    protected override void Initialize()
    {
        Viewport vp = GraphicsDevice.Viewport;

        xPosition = vp.X + (vp.Width / 2);
        yPosition = vp.Y + (vp.Height / 2);
        device = graphics.GraphicsDevice;
        base.Initialize();
    }

    protected override void LoadContent()
    {

        spriteBatch = new SpriteBatch(GraphicsDevice);
        cursorTex = Content.Load<Texture2D>("strzalka");
    }

    protected override void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }

    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {

        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();
        spriteBatch.Draw(cursorTex, cursorPos, Color.White);
        spriteBatch.End();
        base.Draw(gameTime);
    }
}

sentences:
How can I extrude a regular, grid-based 2D shape to 3D? I have a list of vertex coordinates which encircle several 2D areas. Orthogonal lines only, but not necessarily convex areas... similar to PCB traces of conductive copper areas. I want to draw them like solid objects in 3D using OpenGL, but I'm still very new to 3D and struggling.

Please point me how to do this. I've managed to draw the outline only using GL_LINE_STRIP, but when I try GL_QUAD_STRIP or GL_TRIANGLE_STRIP, the list of coordinates is not properly ordered for triangle strip and the fact the areas are not convex prevent me from doing a simple triangular tessellation.

These are the 2D shapes:

I'd like to render them like this:

sentences: How to make shake effect on camera in LibGDX? I want to shake my OrhographicCamera on some event (i.e. click on the keyboard). How can I do that?

sentences:
Limit mouse movement within 2 points I have a circle sprite that i only want to move between 2 empty game objects (points). Using Vector3.Lerp() I'm able to move the circle between those points

void FixedUpdate()
{
    float speed = 10 * Time.deltaTime;
    float current = Mathf.PingPong(Time.time * speed, 1.0f);
    transform.position = Vector3.Lerp(startPoint.position, endPoint.position, current);
}

The output:

The problem:

I want to move that circle using a mouse drag (basically like a UI slider from point a to point b) and as soon as the mouse leaves the circle to stop moving it

I can currently move the circle anywhere on the screen using the mouse. I've set a circleCollider2D around the circle sprite and I have this code that moves the circle

bool Selected = false;
void Update()
{
    if (Selected)
    {
        Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        transform.position = cursorPos;
    }

    if (Input.GetMouseButtonUp(0))
        Selected = false;
}

void OnMouseOver()
{
    if (Input.GetMouseButton(0))
        Selected = true;
}

What I've tried:

I have tried adding a gameobject with a box collider between the two points and using triggers to detect when the circle exits the trigger
(OnTriggerExit2D), but this solution only works when the circle fully leaves the collider (which i don't want). I want a way for the circle to move just like its moving currently with Vector3.Lerp but with mouse control
I tried locking the circle to only one axis and moving it. While this worked, it failed when i rotated the whole slider as its only locked on one axis and rotation doesn't change that
I have also tried to implement the mouse position into the Vector3.Lerp function with no luck
Vector3.Lerp(startPoint.position, endPoint.position, mousePosition.x);

I tried with y and z, all of it failed. And this way wouldn't work when i go to rotate the slider

sentences:
Loading scene doesn't reactivate gameobjects I have some levels and a main menu. When starting the game from the main menu (in the editor debug mode) I can select a level a load it, no problem. However, when I wish to go back to the main menu using

SceneManager.LoadScene(index);

A whole lot of my gameobjects throw exceptions like

  The gameobjects is destroyed, but you are trying to access it

and

  Missing reference exception

and so on.

However, when i start the level from the editor (and not using the main menu), I can go back to the main menu, it works as it should.

NOTE that I don't have any persistent gameobjects. I do have singletons, but no persistence here. Any ideas what could cause the issue?

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:
How can I fix glitchy Collision on my 2D game? Update: I fixed the Negative axis glitch but the Invisible wall glitch still exists
I have made a 2D game in Java and I rewrote collision as I added chunks.
I have been having problems with the collision detection function, in the negative x-axis coordinates you fall through the world, and in the positive X-axis you sometimes hit into an invisible wall when there are no blocks next to you in that position.
I have tried altering all the numbers until it worked but the problems still happen
Here is the collision function (True = Yes, they are colliding with a Block | False = They are not colliding):
public boolean isCollidingWithBlock(final Point2D.Double pt1, final Point2D.Double pt2) {
        for(int i=0;i<Level.Chunks.size();i++) {
            if (Math.floor((x)/(Level.chunkX*Tile.tileSize)) == Level.Chunks.get(i).chunkNumber) {
                int chunkN = Level.Chunks.get(i).chunkNumber;
                Point2D.Double chunkpoint = pt1;
                if (chunkpoint.x >= 0) {
                    chunkpoint.x = chunkpoint.x%(Level.chunkX*Tile.tileSize);
                } else {
                    chunkpoint.x = (chunkpoint.x%(Level.chunkX*Tile.tileSize))+((Level.chunkX*Tile.tileSize)*1);
                }
                Point2D.Double chunkpoint2 = pt2;
                if (chunkpoint2.x >= 0) {
                    chunkpoint2.x = chunkpoint2.x%(Level.chunkX*Tile.tileSize);
                } else {
                    chunkpoint2.x = (chunkpoint2.x%(Level.chunkX*Tile.tileSize))+((Level.chunkX*Tile.tileSize)*1);
                }

                for (int x = (int)((this.x) / Tile.tileSize); x < (int)((this.x) / Tile.tileSize + 3.0); ++x) {
                    for (int y = (int)(this.y / Tile.tileSize); y < (int)(this.y / Tile.tileSize + 3.0); ++y) {
                        int chunkXPos = 0;
                        if (x >= 0) {
                            chunkXPos = (x%(Level.chunkX));
                        } else {
                            chunkXPos = (x%(Level.chunkX))+((Level.chunkX)*1);
                        }
                        if (chunkXPos >= 0 && y >= 0 && chunkXPos < Level.Chunks.get(i).blockData.length && y < Level.Chunks.get(i).blockData[0].length && Level.Chunks.get(i).blockData[chunkXPos][y].id != Tile.air && Level.Chunks.get(i).blockData[chunkXPos][y].id != Tile.water && (Level.Chunks.get(i).blockData[chunkXPos][y].contains(chunkpoint) || Level.Chunks.get(i).blockData[chunkXPos][y].contains(chunkpoint2))) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

sentences:
SFML position problem when drawing a CircleShape I am not sure but I think it's a problem with Windows 10 borderless windows
The problem is when I draw the circle its always drawn with a little offset from where it should be.

In the top of the window the shape is drawn above the mouse, in the bottom the shape is drawn under the mouse and so for each side of the window

This is my code:

#include "SFML/Graphics.hpp"
#include <stdio.h>
int main(int argc, char **argv){
        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Application");
        window.setFramerateLimit(60);

        sf::RenderTexture renderTexture;
        renderTexture.create(800,600);
        renderTexture.setSmooth(true);
        renderTexture.clear(sf::Color(255,255,255,255));
        renderTexture.display();

        int wpoint=10;
        sf::CircleShape point(wpoint,50);
        point.setFillColor(sf::Color(255, 0, 0, 128));

        while(1){
                sf::Event event;
                while (window.pollEvent(event)){
                        if (event.type==sf::Event::MouseMoved && sf::Mouse::isButtonPressed(sf::Mouse::Left)){
                                //printf("%d\n",sf::Mouse::isButtonPressed(sf::Mouse::Left));
                                //point.setPosition(event.mouseMove.x-(wpoint/2),event.mouseMove.y-(wpoint/2));
                                //point.setPosition(event.mouseMove.x,event.mouseMove.y);
                                //auto pos=sf::Mouse::getPosition();
                                auto poswindow=window.getPosition();
                                printf("%d,%d\n",poswindow.x,poswindow.y); //This prints -8,0 when I position the window on the left-top corner (0,0)!!
                                //auto pos=sf::Mouse::getPosition(window);
                                auto pos=window.mapPixelToCoords(sf::Mouse::getPosition(window));
                                point.setPosition(pos.x,pos.y);
                                renderTexture.draw(point, sf::BlendAlpha);
                        }
                        if (event.type==sf::Event::Closed
                         || event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::Escape)
                                return 0;
                }

                sf::Sprite canvas(renderTexture.getTexture());
                // draw
                window.clear();
                window.draw(canvas);
                window.display();
        }
        return 0;
}

One thing I noticed is when I tried to draw the circle on (10,10) it was painted under the title bar.

I read somewhere that it's probably a thing that only happens with some Intel drivers, I just hope that the users don't have it or I will be in troubles. It's weird because I have been working with the Winapi for a long time and the mouse coordinates have always been correct.

sentences:
How to make a vision cone for the enemy in game maker? I'm making an enemy object where the enemy look for the player when he's going on a patrol

I want the vision cone to changes direction corresponding to the sprite.When the sprite turn right,the cone will faces right,left and the cone will faces left and when he move to any direction the cone will move with him and changes direction accordingly

I also want to give the cone certain ranges.The longest range's where the enemy will be in doubt and get to that position to investigate,medium range he'll start chasing,shortest range he'll attack.

I hope someone can help me.

sentences:
How to make an application architecture a global strategy game? I am doing a global libgdx strategy, how can I properly design the architecture?
So far, I'm in some kind of chaos, because there are different events that need to be shown to the player in the form of widgets.
For example, one problem is that I need to understand how the Province class will display a message that there is a hunger problem. Should it:

immediately inside itself display a message?
send event data to the main class of the game, which processes the data and, depending on the event, display the message or take some other action?
do something else entirely?

I had the idea to make a separate class of events and so that all game objects create this object and pass it to the main class of the game, which handles them and decides what to do with it, and if necessary, pass it to the players.
And I read about the fact that there is a class java.util.EventObject. Is it worth implementing it with the help of it, or should it be implemented like that yourself? Or maybe it should be done in a completely different way?
The game is turn-based. There are separate provinces and the units move from one province to the neighboring one in 1 turn.
At the beginning of each turn, a series of windows appear in turn, notifying of certain events, for example, famine in a province or enemy troops attacked a province, etc.
There are classes of the province, the player, various UI - windows, which display information about events.

sentences:
Are there any command line swf packing tools? I want to packing image files(png, jpg) into swf, then game can load files easily. But I want to do this by a Makefile, not FLASH CS.
Do you know any command line swf tool set can do that? And can I packing XML files into it as well?

sentences: Need ideas for an algorithm to draw irregular blotchy shapes I'm looking to draw irregular shapes on an x,y grid, and I'd like to come up with a simple, fast method if possible.  My only idea so far is to draw a bunch of circles of random sizes very near each other, but at a random distance apart from a more or less central coordinate, then fill in any blank spaces.  I realize this is a clunky, inelegant method, hopefully it will give you a rough idea of the kinds of rounded, random blotchy shapesI'm shooting for.  Please suggest methods to accomplish this, I'm not so much interested in code.  I can noodle that part out myself. Thanks!

sentences:
How could I prevent a player from cheating by taking a picture with their phone? I'm making a game with a primary mechanic of a very limited amount of time that you can see a maze, and must navigate it blindly as much as possible to conserve your torch fuel. It's possible you could snap a photo with your phone and then beat every level.

My initial thought is, "so what?" if someone wants to cheat, they are just taking the fun out for themselves. But I'd like to add a leaderboard to the game, which would make cheating even more enticing to some players who value bragging rights over having fun.

The obvious answer is that there is NO way to prevent this.... but is there? I am trying to find an out-of-the-box idea that renders cheating nearly impossible or pointless.
Any ideas?
Curious if anyone has any thoughts first without altering your perspective by playing my game first. Let me know if you want the link and I'll give it to you.
Thanks!

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:
UE4 Multiplayer how to replicate Player name in lobby I've been working on a little 1V1 snipper project to try and get a better grip on the replication and the game framework of unreal engine.

So after the core gameplay, I'm trying to make a lobby system. I've been able to make the player join together without any issues, but I struggle a little bit with the replication. I'm trying to show the player's name over their pawn in the lobby, and I can't get it to work. In the client, both their name doesn't get replicated, and in the server, only the server name appear:

And I get this error from the server logs

[2020.01.21-00.45.03:318][906]PIE: Error: Only Local Player Controllers can be assigned to widgets. BP_PlayerLobbyController_C_1 is not a Local Player Controller.
[2020.01.21-00.45.03:321][906]LogScript: Warning: Accessed None trying to read property CallFunc_Create_ReturnValue
        BP_PlayerLobbyController_C /Game/Maps/Lobby.Lobby:PersistentLevel.BP_PlayerLobbyController_C_1
        Function /Game/Player/Controller/BP_PlayerLobbyController.BP_PlayerLobbyController_C:ExecuteUbergraph_BP_PlayerLobbyController:0049
[2020.01.21-00.45.03:323][906]LogScript: Warning: Script call stack:
        Function /Game/Player/Controller/BP_PlayerLobbyController.BP_PlayerLobbyController_C:ReceiveBeginPlay
        Function /Game/Player/Controller/BP_PlayerLobbyController.BP_PlayerLobbyController_C:ExecuteUbergraph_BP_PlayerLobbyController

[2020.01.21-00.45.03:325][906]LogOnlineSession: Warning: OSS: No game present to join for session (GameSession)
[2020.01.21-00.45.03:326][906]LogTemp: POST LOGIN FOR
[2020.01.21-00.45.03:331][906]LogScript: Warning: Accessed None trying to read property CallFunc_GetController_ReturnValue
        BP_Character_Lobby_C /Game/Maps/Lobby.Lobby:PersistentLevel.BP_Character_Lobby_C_1
        Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:Display Player Name:00CC
[2020.01.21-00.45.03:333][906]LogScript: Warning: Script call stack:
        Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:ReceiveBeginPlay
        Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:ExecuteUbergraph_BP_Character_Lobby
        Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:Display Player Name

[2020.01.21-00.45.03:335][906]LogScript: Warning: Accessed None
        BP_Character_Lobby_C /Game/Maps/Lobby.Lobby:PersistentLevel.BP_Character_Lobby_C_1
        Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:Display Player Name:00E1
[2020.01.21-00.45.03:337][906]LogScript: Warning: Script call stack:
        Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:ReceiveBeginPlay
        Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:ExecuteUbergraph_BP_Character_Lobby
        Function /Game/Player/Character/BP_Character_Lobby.BP_Character_Lobby_C:Display Player Name

So I get that something is wrong with accessing the 2nd player controller from bluprint like this

But I don't know how to make it work other wise. I've set the PlayerName widget to replicated, but it doesn't seem to work.

Any idea on how I could get this to work?

sentences:
Why has my object detached itself from the parent? I made an two objects in blender, animated them, and saved them.

Firstly, when I reloaded them, half of the animations I created had disappeared, which is annoying itself but the real annoyance is that the item, a sword, detached itself from the parent, the character. I exported as fbx but for some reason it is completely seperated.

Also, my mesh has holes everywhere. Is this normal for untextured objects?

  How it should look

  Whats actually happening

sentences:
Hide game data from player? I'm working on my first (C++) game, and I want to use a component based design. I've read a lot about this lately and yesterday I decided I wanted to store object data in external JSON files, to allow for more flexibility and ease of access.

Then it dawned on me that leaving these files in the game's directory tree would allow the players to modify anything they want very easily.

I'm not worried about showing the code to developers, because the game will be open source, but I'm afraid an inexperienced gamer might break the game or at least ruin the fun.

Am I missing something? What's the policy about hiding game data (in open source games)? Is it normal to leave everything plainly accessible to anyone?

If not, what is a good way to hide the data?

sentences:
How to colour blend between two materials? I've been trying to get a material (with an image texture) to animate towards a colour mix with transparency, but either I'm attempting something the wrong way, or unable to find the right keyword to find about similar examples.
What I'm trying to accomplish is to make a 3D character blush; I have the face area on it's own material, with textures set, but that's where my problem is. If it was animating between two colours, I would simply use Color.Lerp, but since textures are included, that makes me think I have to somehow have a colour mix option for this.
I've also tried to just use the built-in animator to see if Unity would blend between the colours of two different materials, but after all it turned out to be an instant change on the new keyframe; which leaves me to think so far my only exit could be to manually create several keyframes, and create several materials to get it close to acceptable.
Although my knowledge about it is close to zero, is this after all only possible with a custom fragment shader? I don't know if there's a suitable package, or built-in Unity feature that makes something like this possible, or if at all I'm approaching this problem the right way...
Update: This is the shader I'm using right now, from 魔王. It might be a little confusing since inputs are all abbreviated, so here are some example files that are being used.

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:
3D collision physics. Response when hitting wall, floor or roof I am having problem with the most basic physic response when the player collide with static wall, floor or roof. I have a simple 3D maze, true means solid while false means air:

bool bMap[100][100][100];

The player is a sphere. I have keys for moving x++, x--, y++, y-- and diagonal at speed 0.1f (0.1 * ftime). The player can also jump. And there is gravity pulling the player down. Relative movement is saved in: relx, rely and relz.

One solid cube on the map is exactly 1.0f width, height and depth. The problem I have is to adjust the player position when colliding with solids, I don't want it to bounce or anything like that, just stop. But if moving diagonal left/up and hitting solid up, the player should continue moving left, sliding along the wall.

Before moving the player I save the old player position:

    oxpos = xpos;
    oypos = ypos;
    ozpos = zpos;

    vec3 direction;
    direction = vec3(relx, rely, relz);

    xpos += direction.x*ftime;
    ypos += direction.y*ftime;
    zpos += direction.z*ftime;

    gx = floor(xpos+0.25);
    gy = floor(ypos+0.25);
    gz = floor(zpos+0.25);
    if (bMap[gx][gy][gz] == true) {

        vec3 normal = vec3(0.0, 0.0, 1.0); // <- Problem.
        vec3 invNormal = vec3(-normal.x, -normal.y, -normal.z) * length(direction * normal);
        vec3 wallDir = direction - invNormal;
        xpos = oxpos + wallDir.x;
        ypos = oypos + wallDir.y;
        zpos = ozpos + wallDir.z;
    }

The problem with my version is that I do not know how to chose the correct normal for the cube side. I only have the bool array to look at, nothing else. One theory I have is to use old values of gx, gy and gz, but I do not know have to use them to calculate the correct cube side normal.

sentences:
OpenGL - Make two images blend together I have 2 images that are .png and they mix together, The problem is that one overwrite the other. I know that the draw order matters, but In that case I should redraw the icons 2 times ( there is a lot of them)

the black is in fact transparent and drawing a star on top of the other "cuts" a part of the underlying one, In other words, it overwrites with transparency

How I see it now

How I want to see it

My blending code :

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMarcaDataHandle);

    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);

    Matrix.setIdentityM(mModelMatrix, 0);
    aplicarRotacion();
    Matrix.translateM(mModelMatrix, 0, marcador.posX, marcador.posY, marcador.posZ);

    drawMarca();

    GLES20.glDisable(GLES20.GL_BLEND);

private void drawMarca()
{
    coordinate.drawMarca(mPositionHandle, mNormalHandle, mTextureCoordinateHandle);

    // This multiplies the view matrix by the model matrix, and stores the
    // result in the MVP matrix
    // (which currently contains model * view).
    Matrix.multiplyMM(mMVMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);

    GLES20.glUniformMatrix4fv(mMVMatrixHandle, 1, false, mMVMatrix, 0);

    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVMatrix, 0);

    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);
}

sentences: Keeping 2 objects within cameras view I have two object to control and I wanted to keep them at cameras view without adjusting the cameras size but the camera can move only in positive y-axis meaning ones it goes up it shouldn't move down but it's okay if one object gets out of bounds. Since its 2D the camera is Orthographic view.

sentences:
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 much do inconsistencies in update timing matter? Yesterday I wrote my first game loop with fixed timesteps.
It is supposed to run every 50 ms, however it runs at 50-53 ms.
Does it matter?

I'm guessing no, but I figured I would ask anyway.

startTime = std::chrono::high_resolution_clock::now();

while(running == true){

    updateTime = std::chrono::high_resolution_clock::now();

    deltaTime = std::chrono::duration_cast<std::chrono::milliseconds>(updateTime - lastUpdateTime).count();
    lag += deltaTime;

    eventChecker();
    keyboardManager();

    while(lag >= MS_PER_UPDATE){
        update();
        lastUpdateTime = updateTime;
        //cout << lag << "|";
        lag -= MS_PER_UPDATE;
    }

    render(lag / MS_PER_UPDATE);

}

sentences:
Particles placed in the middle of the screen (OpenGL ES 2 / Android) It seems like each of my particles is placed at (0, 0, 0) even though I'm setting different positions for each of them (debugger also confirms this). It must be something really silly that I'm missing. My intention is to paint 250 particles at random positions on the screen. Here's my code:

@Override
public void onDrawFrame(GL10 gl) {
    if(time++ == MAXTIME) {
        time = 0;
    }

    //my own helper methods
    GLUtils.sendBufferData(a_Position, 3, position);
    GLUtils.sendBufferData(a_Velocity, 3, velocity);
    GLUtils.sendBufferData(a_Offset, 1, offset);

    Matrix.setIdentityM(mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, camera.getViewMatrix(), 0, mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, camera.getProjectionMatrix(), 0, mMVPMatrix, 0);

    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);

    GLES20.glUniform1f(u_Time, time);

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture);
    GLES20.glUniform1i(u_Texture, 0);

    GLES20.glDrawArrays(GLES20.GL_POINTS, 0, particlesCount); //particlesCount = 250
}

@Override
protected void initData() {
    float[] positions = new float[3 * count];
    float[] velocities = new float[3 * count];
    float[] offsets = new float[count];

    int index = 0;

    for(int i = 0; i < count; i++) {
        offsets[i] = MathUtils.random() * 60 + 20;

        positions[index] = MathUtils.random() * 2 - 1;
        velocities[index] = -0.025f;
        index++;

        positions[index] = MathUtils.random() * 2 - 1;
        velocities[index] = -0.035f;
        index++;

        positions[index] = 0;
        velocities[index] = 0;
        index++;
    }
    //my own helper method
    texture = GLUtils.loadTexture(mContext, R.drawable.snowflake);

    position = ByteBuffer.allocateDirect(positions.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    velocity = ByteBuffer.allocateDirect(velocities.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    offset = ByteBuffer.allocateDirect(offsets.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();

    position.put(positions).position(0);
    velocity.put(velocities).position(0);
    offset.put(offsets).position(0);
}

private static final String vertexShader() {
    return "" +
            "uniform mat4 u_MVPMatrix;\n" +
            "uniform float u_Lifetime;\n" +
            "uniform float u_CurrentTime;\n" +
            "\n" +
            "attribute vec4 a_Position;\n" +
            "attribute vec3 a_Velocity;\n" +
            "attribute float a_Offset;\n" +
            "\n" +
            "void main() {\n" +
            "    gl_PointSize = 10.0;\n" +
            "    gl_Position = u_MVPMatrix * a_Position;\n" +
            "}";
}

private static final String fragmentShader() {
    return "precision mediump float;\n" +
            "\n" +
            "uniform sampler2D u_Texture;\n" +
            "\n" +
            "void main() {\n" +
            "    gl_FragColor = texture2D(u_Texture, gl_PointCoord);\n" +
            "}";
}

Note: I deliberately deleted some lines from the vertex shader since I don't think they are relevant in this case.

Edit: It may be that gl_PointCoord is always set to 0. I'm looking into this now.

sentences:
IOS very simple 2d engine/api rendering showdown So after taking some time running through a course, I believe I have enough experience with referring back to the course how to make the game I wish to all apart from one thing. How to draw the game on screen, I know how the game would work behind the screen, but don't know how to draw it. I'm looking for an experienced, informed answer based upon certain factors.

To provide some context, the game in question's interface would be very simple:

Grid of lines
Control each cell's content: (text and colour)
Pan and zoom

The game at the minute is based upon an excel spreadsheet as shown to show how simple it is:

My aim to keep this question open to others is to create a pros and cons of each.

I've narrowed down possibilities to this list. These are taken from the apple developer page under the section 'Graphics and Games':

Core Animation
Core Graphics
GLKit
Metal
OpenGL ES
cocoas 2d?
Other Noteworthy

I'm asking for an informed opinion as to which I should choose. This is narrowed down from research, however I assume I will have missed things that may make this task much easier. My problem thus far is that most games assumed I needed sprites but in something this simple I'm assuming I don't.

If it makes any difference, my current knowledge is only swift, high school math and hopeful abundance of learning resources. I've been stuck with this problem for a long time and I would be overjoyed if I could get some experienced advice. Thanks! :)

sentences:
ASSIMP skeletal animation with some FBX files has issues - weird node added Hi I'm trying to work load fbx files to my OpenGL Renderer using ASSIMP.

However, weird nodes that are not in the original fbx file are added whenever I load the file with the ASSIMP importer.

For example, this is part of the node hierarchy printed while loading the nodes in a DFS matter.

mixamorig:LeftForeArm_$AssimpFbx$_Translation
ㄴmixamorig:LeftForeArm_$AssimpFbx$_PreRotation
 ㄴmixamorig:LeftForeArm_$AssimpFbx$_Rotation
  ㄴmixamorig:LeftForeArm_$AssimpFbx$_Scaling
   ㄴmixamorig:LeftForeArm

However, according to the original file, there should only be mixamorig:LeftForeArm.

This fbx file might be weird since usually in the case of other fbx files, I can get the node's translation, rotation, scaling keyframes directly from aiNodeAnim using the node's name. I never saw a case where the keyframe itself become a node.

Is there a way to resolve this issue?

sentences:
How is a normal map applied to a triangle mesh? I'm working on writing my own parser/renderer for the obj file type, and right now I have it working so that I can draw the model correctly and use the vt texture coordinates to apply a texture to the model. The next step that I want to do is apply a normal map to make the surface look smoother, but I'm not completely sure how this is done.
I've applied normal maps to a sphere before, and part of the trouble that I had in implementing that was figuring out how to get a consistent pair of tangent vectors in order to adjust the normal. On a sphere, that's done using spherical coordinates and calculating dp/du and dp/dv, but how is it done in an obj file? It seems like local coordinates, normal coordinates, and texture coordinates are the only thing stored for each vertex, no tangent vectors. I know that the surface can also be smoothed by interpolating the normal vectors defined at each vertex, but the model I'm working with doesn't even have those defined. And I know it should be possible with the model because if I open it in the windows 3d viewer I can see that it smooths out the triangles.
How are the tangent vectors found on a triangle mesh? In case it matters, the specific model that I'm using is one that I downloaded from here.

sentences:
How can I load a text file from Content? I created a small Windows Phone game with XNA, but I have some trouble with loading a text file from Content. I added the text file to my Content project and marked the Build Action to "Content". The static text file should be loaded when the game starts, but I always get an exception in this line of the method:

if (File.Exists(filename))

  An exception of type 'System.MethodAccessException' occurred in
  mscorlib.ni.dll but was not handled in user code

If there is a handler for this exception, the program may be safely continued.

What is wrong? How can I load a text file from Content?

private const string filename = "Level1.txt";
public void LoadfromContent()
    {
        if (File.Exists(filename))
        {
            using (StreamReader reader = new StreamReader(File.OpenRead(filename)))
            {
                strs = reader.ReadLine().Split(';');
                game1.HowManyEnemies = int.Parse(strs[1]);
            }
        }
    }

sentences:
With what structure do you manage the graphics of a game? Im currently trying to program a little game (in Java - Libgdx; if thats necessary).

I currently use a GameWorld and a GameRenderer, the GameRenderer just getting all the info it needs from the GameWorld object and calling a method for every different class there is (for example drawPlayer(), drawWorld() etc.).

Should I let my actors draw themselves or encapsulate the data inside of another class and then pass an object of it to the GameRenderer?

sentences:
Lazy way to figure out the two sides of a border? We have a 3d model. There is a simple path on that model's surface graph G of the form:
<v_0, v_1 ... v_n-1, v_n> where if v_i == v_j then i == j

Great! now the simple question appears:
How do you programmatically tell in the human sense if v_orange and v_green are on the same side of the trail and if v_green and v_blue are on the same side or not?
My intuition is that you Dijkstra the shortest path between them and if it goes through the trail an even number of times their on the same side. However that is not defined if you don't know what goes through the trail computes to. If thinking if it was 2d and we could project these trail edges on some flat surface this would be made trivial.
My current solution is a lie. Each edge is normally shared by two faces unless it's an orbifold which is currently not interesting to this question's input population set. Also, in our world, each face has percisely three vertices.

Use Dijkstra to find the shortest path between them. If the path does not touch the trail, their relation to the trail isn't well defined or their on the same side (for now it outputs they are on the same side).
Assuming the path does go through the path, we pick one of the edges it went through.
Each edge belongs to two faces, each of these faces has precisely one vertex that is not on the edge trail. we now have two vertices that are supposed to be on different sides of the trail.
Dijkstra from each of the trail side vertices to the vertices in question.
If the shorter path to both vertices in question is from the same side then maybe they are on the same side. If it each vertex prefers a different side then maybe they are not.

Here is one fault in this solution:

Sometimes the two are on the same side and the other route is shorter.

Clarification
This is a clarification inspired by wondra that felt nothing can be on the right side or the left side of a trail, something that in my opinion people would disagree with as we have a good sense of left & right.
Lets "split" the model where the trail is and add more faces between the two new trails (lips) and get something like this:
Trail 1 is Blue, trail 2 Red and some epsilon wide faces between them. Now we use Dijkstra to find the shortest distance from both trails (Blue and Red). Some vertices are closer to the Red, some to Blue. Very few are (the same), closest simply to the last or first vertex in the original trail that are conjoined between the trails.

sentences:
Vertex ordering with THREEjs's exporter I'm using THREEjs's exporter to export a 2D polygon plane. The resulting JSON gives me the vertices. I'm trying to properly order these vertices as to make the actual polygon shape, without luck.

Right: Default vertex order

Left: Actual order

I manually put the needed order together and found it to be this.
0,1,2,3,4,5,6,7,8,9,11,13,17,16,15,19,21,22,23,25,27,29,39,38,37,36,35,34,33,32,31,30,28,26,24,20,18,14,12,10 (element represents index in default order).

Is there a pattern to this ordering? Does the JSON file reveal more information on how to properly order it? Seems the only other information in there is the faces array. I do not understand how to read it or what it represents.

sentences:
How to load data for specific level at runtime? I'm trying to create a game with many levels loaded from XML files. In my game I have many objects in each level.

At present my game contains 20 levels, and I load all the textures at once on startup. But I think the correct way to do it is to only load textures used in the current level. I don't know how to do that. So please explain this by providing some example code.

At present I create a class for each type of entity by extending my Sprite class. This subclass loads the appropriate image. I know this is not the best way to do things.

Basically I want to know how to load large levels efficiently in Andengine.  What is the proper method for loading textures, level data and background images from files when the level is run?

sentences:
Tracking launch errors for your game with a simple c++ app I am trying to create a simple app to track launch errors for my game. The idea is to launch a c++ program, that in turn launches the main game .EXE file with CreateProcess(). The c++ app then proceeds to wait untill the process finishes and shows an error report to the user, if the error happened. This is how I implemented this:

#include <windows.h>
#include <iostream>
#include <string>
using namespace std;

int main()
{
    // additional information
    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    // set the size of the structures
    ZeroMemory(&si, sizeof(si));
    si.cb = sizeof(si);
    ZeroMemory(&pi, sizeof(pi));

    const string appName = "MAIN.exe";
    const string appLocation = "";

    // start the program up
    BOOL result = CreateProcess((appLocation + appName).c_str(),   // the path ".." <- перейти вверх "\\" <- относительный путь.
        NULL,        // Command line
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory
        &si,            // Pointer to si structure
        &pi);           // Pointer to PROCESS_INFORMATION structure

    if (!result)
    {
        MessageBox(HWND_DESKTOP, ("Could not locate " + appName + "! Please reinstall the game!").c_str(), "Error!", MB_OK);

        // We failed.
        return FALSE;
    }
    else
    {
        // Successfully created the process.  Wait for it to finish.
        WaitForSingleObject(pi.hProcess, INFINITE);

        DWORD exitCode = NULL;
        // Get the exit code.
        result = GetExitCodeProcess(pi.hProcess, &exitCode);

        // Close process and thread handles.
        CloseHandle(pi.hProcess);
        CloseHandle(pi.hThread);

        if (!result)
        {
            // Could not get exit code.
            MessageBox(HWND_DESKTOP, "ERROR!", "Error!", MB_OK);
            return FALSE;
        }
        else if (exitCode != 259 && exitCode != 2)
        {
            if (exitCode == 1)
                MessageBox(HWND_DESKTOP, "ERROR!", "Error!", MB_OK);
            else
            {
                string errorString = to_string(exitCode);
                LPCSTR errorText = errorString.c_str();
                MessageBox(HWND_DESKTOP, errorText, "Launch error!", MB_OK);
            }
        }

        // We succeeded.
        return TRUE;
    }

    //MessageBox(HWND_DESKTOP, "Text here", "Text here", MB_OK);
    return 0;
}

From my humble tests I did not see any performance decrease, however, the c++ process is constantly sitting in the background and I wonder if there might be any problems with I that I should know about. Maybe there is a safer/easier way to implement this?

UPDATE: Just to clarify here are the reasons why I need this app (alongside trying to track errors internaly, which I already do):

I am developing on c# and XNA 4.0 for .Net Framework 4.5.1. And just that setup can lead to several issues:

1)The user might not have XNA 4.0 redist installed;

2)The user might have Windows 7 with vanila .Net 4.0 and not 4.5.1;

3)The user might have Windows XP which I do not support (due to .Net target 4.5.1);

4)The user might have a GPU which does not support DX 10, (a requirenment for XNA 4.0).

But in most of those cases the app will simply crash on startup, and from what I read, there is no way to catch an error internaly as they happen at an assembly level.

sentences:
Unity + Oculus Rift - Setting field of view or rendering part of display I need to render a small portion of the display to a texture.

I found a script to simulate a scissor rect by modifying the projection matrix - Unity 5 doesn't seem to provide any out-of-the-box scissor functionality. However, modifying the matrix in this way causes my scene to render monoscopic.

Suggestions? There used to be an OVRCameraController class that provided a SetVerticalFOV() method, but that appears to have been removed from the SDK.

sentences:
Can I output a text file on build with build details in it? We have an issue with organizing our builds. They get copied around and moved so much that it's hard to keep track of what is the newest.

I would like to output a simple text file to the build root (same level as exe) that contains info like the build date and time, platform, etc.

Is this possible from within Unity?  Right now we have no automated build process (CI/CD).

edit: I found onPreprocessBuild() but unfortunately one of our main projects still uses Unity 5.3.6f1, so this will not work. Is there an alternative?

sentences:
Programmatically creating new tags in Unity I'm writing a custom editor script to add tags programmatically.

I got the error of IndexOutOfRangeException: Array index is out of range from the lines below:

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty tagsProp = tagManager.FindProperty("tags");

These are my codes:

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty tagsProp = tagManager.FindProperty("tags");

// Adding a Tag
string s = "Instantiated";

// First check if it is not already present
bool found = false;

for (int i = 0; i < tagsProp.arraySize; i++)
{
    SerializedProperty t = tagsProp.GetArrayElementAtIndex(i);
    if (t.stringValue.Equals(s)) { found = true; break; }
}

// if not found, add it
if (!found)
{
    tagsProp.InsertArrayElementAtIndex(0);
    SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
    n.stringValue = s;
}

Latest Update:
Error IndexOutOfRangeException: Array index is out of range is solved by resolving file location in my original script. I apologized for that.

Fixed:
Added a line in the script to update the properties

if (!found)
{
    tagsProp.InsertArrayElementAtIndex(0);
    SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
    n.stringValue = s;
    tagManager.ApplyModifiedPropertiesWithoutUndo();
}

sentences:
Can a Component.gameObject be null in Unity? Can a Component.gameObject be null in Unity? If it can what can cause it to be null?

The context for the question is a NullReferenceException I got from the users, which specifies only method, but not line in which it occurred.

So, I suspect that there may were conditions which cause Component.gameObject to be null.

sentences:
Projecting grid textures to select parts of the terrain (Unity) So I'm trying to be smart and not use 500+ some tile prefabs to make a grid, and so far the back-end portion has gone swimmingly. I initially used a dedicated mesh to represent the grid, but as I'm now opting for 3D terrain (and not tilemapping), I figured that was a lot of unnecessary vertices - especially if I want to have the grid conform to the terrain.

My shader inexperience, on the other hand, is causing me to stop and overthink this.

Using FE as inspiration, I'm thinking about projecting the transparent grid texture onto a base terrain layer.

If I wanted parts of the terrain to not be covered by the grid (such as the water area in the picture), would I simply use the world coordinates to tell the shader don't do anything there?

The most confusing part for me, however, is how to go about highlighting tiles. I want movement and attack tiles to also be 'painted' onto the terrain in specific colors, but obviously they only affect an even smaller portion than the terrain than the grid.

Would I simply be using the same shader to grab world coordinates once again and more or less start/stop overlaying the movement/attack texture over the grid/terrain? And if I'm really being efficient, those textures belong to the same png and I just use UV's to switch between them like a sprite sheet?
Is this even a good practice for shaders in the first place? Redrawing and adding textures to only parts of a material? Should I be redrawing and updating the whole texture instead?

I guess I get thrown off because I'm only familiar with a 1:1 mesh to material design, so the so the thought of a single mesh but multiple textures on discrete parts that may or may not overlap makes somewhat sense on paper -- but implementation in Unity is just above me atm.

Thanks!

sentences:
Using a different "max texture size" depending on the device I am developing an Unity game for a wide range of iOS devices. I noticed that some scenes load pretty fast in the iPad mini 3, but very slow in the iPad mini 1. Of course, that's to be expected as one is much faster than the other.

The scene is composed mostly of several sprites. As an optimization attempt, one could reduce the max texture size property of the sprites, as I'd imagine this will allow them to load faster.

Is it possible to have a max size of 2048 for the iPad mini 3, but only 1024 for the iPad mini 1?

I suspect that the answer is no, as Unity "compiles" the images depending on the settings you used when building the game.

sentences: Mesh vs LineRenderer Performance I've created a script, which is drawing a line along a bezier curve, so that I can animate whatever I want with lines, mostly for UI purposes. For the moment I'm using a line renderer, which works, but the performance is not that great in my opinion. So I was wondering if there are actually some better methods to draw lines, like simply creating a mesh along the path I've got.

sentences: How do I make the PS4 controller vibrate in Unity3D on mac? I am currently working on a 2D game in Unity3D with an option to play with a gamepad/controller. I would like the PS4/dualshock 4 controller to vibrate. I am on mac. I have looked into Xinput but I think it is only for Windows, I may be wrong.

sentences:
How to implement soft edge areas with particles My game is created using Phaser, but the question itself is engine-agnostic.

In my game I have several environments, essentially polygonal areas that player characters can move into and be affected by. For example ice, fire, poison etc'
The graphic element of these areas is the color filled polygon area itself, and particles of the suitable type (in this example ice shards).
This is how I'm currently implementing this - with a polygon mask covering a tilesprite with the particle pattern:

The hard edge looks bad. I'd like to improve by doing two things:
1. Making the polygon fill area to have a soft edge, and blend into the background.
2. Have some of the shards go out of the polygon area, so that they are not cut in the middle and the area doesn't have a straight line

for example (mockup):

I think 1 can be achieved with blurring the polygon, but I'm not sure how to go about with 2.

How would you go about implementing this?

sentences:
How do I slow down my character while running? void Movement()
{
    transform.Translate(Vector3.forward * 10 * Time.deltaTime);

    if(Input.GetKey(KeyCode.S))
    {
        transform.Translate(Vector3.forward * 3 * Time.deltaTime);
    }

    if(Input.GetKeyUp(KeyCode.S))
    {
        transform.Translate(Vector3.forward * 10 * Time.deltaTime);
    }
}

I tried this code but seems to me, it didn't work as I expected it to.

What I expect:

my character moves along at a speed of 10 automatically
when the S key is held, the character slows down to a speed of 3 instead
when the S key is released, the character goes back to their default speed of 10

What I observe:

the character does not slow down when the S key is pressed

How can I fix this?

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:
What are the implications of not owning the IP of a character graphic in my game? I'm currently talking with a design studio for the artworks of my game. They are saying they want to still own the IP of their chracter graphic in my game as they want to sell merchandise with my character idea and their artwork.

I'd like to know what kind of stuffs should I look out for in such an agreement. Does owning the character graphics mean, later they can come up and say me I can't use it in my game?

sentences:
Pathfinding in non tile-based 2d map (maybe potential field) I am developing a top-down 2d zombie shooter in AS3.
I have implemented collisions against segments (line from point a to point b), polygons (array of points, convex) and round obstacles (center and radius)
Player and enemies are basically moving round obstacles, with different radii.

Now, I'm having trouble with zombie AI's pathfinding.
I have read about potential fields, and I found it fascinating, but I can't figure out how to adapt it to a non tile-based map.
I can calculate the distance from a point to the closest obstacle, and get the obstacle repulsive potential in that point.
I don't know how to get the player's attracting potential in that point though. In tile-based maps you use the A* algorithm, considering every walkable tile as a node. This is my first problem.

Once I have calculated the player's attracting potential in a point, what I get is a Number. In tile-based maps, I would test this number against the potential of the 8 adjacent tiles, and move the enemy to the tile with the lowest potential. In my non-tile based map instead I do not have a fixed set of tiles to test, so I can't understand how to get the moviment vector to apply to the enemy. This is my second problem.

If I, say, set a waypoint every x*y pixels, I could use it as the centre of a tile, but that sounds very unelegant, mainly because enemies would be forced to move along the 8 directions of adjacent nodes.

Should I forget PFs and try a different approach?

sentences:
How do I make a game object move at an angle in an integer-indexed grid? I'm making a game in SDL2 and C++. I want a way to make any game object move in a specific direction. I've thought of assigning each object a direction in radians, from 0 until 2 PI where 0 would represent movement in the positive x direction, and PI movement in the negative x direction (0.5 PI would be positive y, 1.5 PI negative y, etc).

My problem occurs when trying to translate these directions into actually moving an object on the screen - moving objects with directions of 0, 0.25 PI, 0.5 PI, 0.75 PI, etc are trivial, as one would either decrement or increment only x, or only y, or alternate x and y.

To approximate other angles of movement in x and y, I figured I could calculate how much each object should move in x, before it increments y, (or vice versa, depending on whether the direction is bigger or smaller than 0.25 PI, and assuming we're only considering the positive x and y quadrant ). And then restricting how many moves in x and y the object makes each time it is moved, in an attempt to preserve the speed of the object, though this would still result in an object moving along an axis moving slower than one moving in at an angle. Is this a reasonable solution?

Is there a more elegant or precise way of accomplishing this problem?

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:
Destroying the instance that instantiated the prefab What I have so far:

A fuel that has Fuel script attached to it.
The fuel prefab is first instantiated from another script in its Start() method.

problem:
The Fuel script is such that it results in instantiation of prefab fuel repeatedly at some intervals of time and keeps destroying the earlier ones.
But

the prefab that was instantiated from the other script stays there always. I want this prefab to be destroyed as well(or atleast made invisible) while the process of instantiation and destruction of of fuel prefabs continues to go on.

How do I achieve this?

sentences:
LIBGDX: Shoot a bullet using mouse position I want to shoot a bullet towards my mouse position but I think that my math is probably wrong since the position the bullets travel to isn't the right one.
Here's my code
Vector2 bulletDirection = new Vector2(screenX - player.getX(), Gdx.graphics.getHeight() - (player.getY() - screenY)).nor();
bullet.setPosiion(player.getX(), player.getY());
bullet.translate(bulletDirection.x * flightSpeed, bulletDirection.y * flightSpeed);

Can you tell me what I'm doing wrong? The "bullet" object is my current bullet sprite

sentences:
Libgdx change the image inside table dynamically I am trying to draw a HUD that shows the score and time and image like loading but I want to update and change the image when the score get higher but I tried to do that but it is not working. I thought maybe I can define new table in the update method and put different image each time but I don't want to define new table each time. is there anyway to update the image only inside the table: this is the code:

public class Hud implements Disposable{

        public Stage stage;
        private Viewport viewport;
        private static Integer worldTimer;
        private float timecount;
        private static Integer score;
        Label countdownLabel;
        private static Label scorelabel;
        private Label timelabel;
        private Label levellabel;
        private Label worldlabel;
        private Label mariolabel;
        private Image loading;
        private Table table;
        public Hud(SpriteBatch sb)
        {
            worldTimer=40;
            timecount=0;
            score=0;
            viewport=new FitViewport(Fruits.V_WIDTH,Fruits.V_HIEGT,new OrthographicCamera());//2
            stage=new Stage(viewport,sb);//stage is as box and try to put widget and organize things inside that table
            table = new Table();
            table.top();//table at top of our stage
            table.setFillParent(true);//table is now fill all the stage
            countdownLabel=new Label(String.format("%02d",worldTimer),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            scorelabel=new Label(String.format("%02d",score),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            timelabel=new Label("TIME",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            levellabel=new Label("1-1",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            worldlabel=new Label("WORLD",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            mariolabel=new Label("Score"    ,new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            loading = new Image(new Texture("10%.png"));
            //loading.setSize(40, 10);
            table.add(mariolabel).expandX().padTop(10);

            table.add(timelabel).expandX().padTop(10);
            table.add(worldlabel).expandX().padTop(10);
            table.row();
            table.add(scorelabel).expandX();

            table.add(countdownLabel).expandX();
            table.add(loading).width(50).height(10);

            stage.addActor(table);

        }
        public void update(float dt)
        {
            timecount+=dt;
            if (timecount>1)
            {
                worldTimer--;
                if(worldTimer>=0) {
                    countdownLabel.setText(String.format("%02d", worldTimer));
                    loading=new Image(new Texture("90.png"));
                }
                timecount=0;

            }
        }
        public static int getTime()
        {

            return worldTimer;
        }

        public static void addScore(int value)
        {
            score +=value;
            scorelabel.setText(String.format("%02d",score));
        }
        public static int getScore()
        {
            return score;
        }
        @Override
        public void dispose() {
            stage.dispose();
        }
    }

sentences:
What is the optimal way to update different entities in an engine? EDIT: half of my question seemed to disappear, but thankfully, it was still in the clipboard.
When I say entities, I mean instantiations of various classes in my engine (example class: Engine.Animation, or Engine.Scene). The language in question is Javascript.
 The situation:

The current structure of my engine goes something like this:
// The single engine object that only stores constructor functions,
// aka classes (or at least it used to only store those).
Engine = {};

Engine.Scene = function()
{
    ...
}

Lets take the Scene class as an example... It basically stores all the information needed to render the visual part of the game state, which is done by the Renderer class (renderer.render(scene, camera)).

 The problem:

All worked well, but then I realized that the entities sometimes needed to be updated! The best (and, for now, the only) example of this is the scene.AlphaDown() method, which makes the scene transparent, "shuts it down", in a way.
I implemented this with the use of setInterval (the interval would call a function that used to lower the scene's alpha depending on how much time passed. This is the kind of "update method" I am talking about: the one that needs to be called iteratively, usually at 60FPS.) But, I was told that it was a bad practice (here and here). It was suggested to me that I use alternative ways of updating entities (without the use of setInterval).

 The possible solution:

I meant to have an array in Engine, called toUpdate, in which different entities would push their update methods. Then, the Engine would have a central update() method, which would calculate the time since last updated, and call the entities' registered update methods, giving that time as an argument. In the previous example with a scene, AlphaDown() would register an update method by pushing it into the Engine.toUpdate array.
When the task of an update method (ie scene.alpha = 0) was completed, it would be removed from the toUpdate array.

 The problem with the solution:

This method has it's flaws, though. First, it would require the user to call Engine.update() on each of his game loop iterations. Then, it would make the global Engine object have methods, but I just want to keep it a namespace of some sort, a collection of useful classes. I don't want to dictate how a loop should be structured!

 The question:

Is my solution an acceptable way of updating entities? Are there some other, more standard ways? Should I strive to have my entities not have update methods that need to be iteratively called, and let the user implement them?

sentences:
Could someone help me understand this game loop logic? I'm learning Java game development and trying to dissect this game loop:

// Game loop
    final int TICKS_PER_SECOND = 60;
    final int SKIP_TICKS = 1000 / TICKS_PER_SECOND;
    final int MAX_FRAMESKIP = 5;

    long nextGameTick = System.currentTimeMillis();
    int loops;
    float interpolation;

    boolean running = true;
    while(running) {
        loops = 0;

        while(System.currentTimeMillis() > nextGameTick && loops < MAX_FRAMESKIP) {
            System.out.println(System.currentTimeMillis() + " > " + nextGameTick);
            update();
            ticks++;

            nextGameTick += SKIP_TICKS;
            loops++;
        }

        interpolation = (float) (System.currentTimeMillis() + SKIP_TICKS - nextGameTick)
                        / (float) SKIP_TICKS;
        render(interpolation);

        if(System.currentTimeMillis() - timeAtLastFPSCheck >= 1000) {
            System.out.println("FPS: " + ticks);
            gameWindow.setTitle(gameName + " - FPS: " + ticks);
            ticks = 0;
            timeAtLastFPSCheck = System.currentTimeMillis();
        }
    }

So far, here's what I understand:

TICKS_PER_SECOND is the amount of times we want the game to update per second
SKIP_TICKS is the max time that a game tick should take if we want to keep to our TICKS_PER_SECOND value
MAX_FRAMESKIP is the max amount of updates per render

Here's where I'm confused: the 'nextGameTick' variable takes the current time and then we go into the loop. The first logic that we come across is that while the current time is GREATER THAN 'nextGameTick' AND the loops of this logic is LESS THAN the MAX_FRAMESKIP (the max updates per render). I cannot get my head around why we are comparing if the current time is greater than the 'nextGameTick' - as far as I can see from the code the 'nextGameTick' is basically the time value if the update took the maximum amount of time allowed. But surely then we should be comparing if the current time is LESS THAN the maximum time allowed for the update - i.e. if the update is taking too long we break from the loop immediately and go to render. However if I change the GREATER THAN to a LESS THAN then update is never called.

I think what this logic is trying to do/doing (but I don't know how) is basically allowing the game to update more times than it renders - because a lot of people's computers will be fast enough to do so. So it allows us to update 5 times per render (while loops < MAX_FRAMESKIP). HOWEVER we also have the comparison to check if these updates are taking longer than expected in which case we should stop being greedy with the updates and go ahead and render (at least, this is what I think it's trying to do, please correct me if I'm wrong). But surely the current time being LESS THAN the time expected to take is the condition on which we want to continue updating?

As for the next part of the logic, the interpolation, I know we receive a value that we can use within rendering logic to draw game objects "in-between" updates so the movement doesn't seem jerky. Could someone expand on this though? And possibly even break down the actual code and how it arrives at the value we get.

So, to clarify, my overall question about this is:
 - Why do we check if the current time is greater than the time it was expected to take (this would surely mean it took longer than expected?? which is a BAD thing)
 - How does the interpolation value work, and how to we obtain it?

Thanks to anyone who can help me. Please just ask if you need more information from me.

sentences:
how to release unity webgl memory from asset bundle I have stuck in a weird problem, in my Webgl project i am loading asset bundle frequently which is working fine but after unloading the asset bundle the memory is still not releasing. I am using WWW.LoadFromCacheOrDownload method to download and cache asset bundle data.

 IEnumerator DownloadAndCacheAB(string assetName)
    {
        // Wait for the Caching system to be ready
        while (!Caching.ready)
            yield return null;

        // Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
        using (WWW www = WWW.LoadFromCacheOrDownload(finalUrl, 1))
        {

            yield return www;

            if (www.error != null)
            {
                Debug.Log("WWW download had an error:" + www.error);
            }

            AssetBundle bundle = www.assetBundle;

            if (assetName == "")
            {
                GameObject abObject = (GameObject)Instantiate(bundle.mainAsset, gameObject.transform.position, gameObject.transform.rotation);
                abObject.transform.parent = this.transform;
                SetTreeShaderSettings(abObject);
            }
            else
            {
                GameObject abObject = (GameObject)Instantiate(bundle.LoadAsset(assetName), gameObject.transform.position, gameObject.transform.rotation);
                abObject.transform.parent = this.transform;

            }

            // Unload the AssetBundles compressed contents to conserve memory
            bundle.Unload(false);

        } // memory is freed from the web stream (www.Dispose() gets called implicitly)
    }

And even calling GC Collect to remove data

public void RemoveBundleObject()
    {

        if (loadBundleRef != null)
        {
            StopCoroutine(loadBundleRef);
        }
        if (this.gameObject.transform.childCount > 0)
        {
            Destroy(this.gameObject.transform.GetChild(0).gameObject);
            System.GC.Collect();
        }

    }

but the problem is memory is not releasing, it keep going up when i again use/load asset bundle.

Edit: I found that using LoadFromCacheOrDownload function is not good so i have updated it with UnityWebRequest but the still problem persist.

sentences:
How can I improve this architecture? In a roguelike I'm developing in Ruby, I started with a traditional object hierarchy where all game logic relevant to creatures were contained in the Creature class. Movement logic, for example:

Creature.instance_methods(false)    # => [ :move ]

In my design, the map and creatures are decoupled: the map has no idea what's on a tile and the creature has no idea which kind of tile it is on. What brings them together are coordinates.

Movement logic requires information about where on the map the creature is, so the creature would need access to the map. The map belonged to the game, so I just added a game attribute to every creature as a quick solution. I didn't really want to pass a map instance every time the creature needed to move around because the map the creature is on isn't likely to change.

In the end, I removed the game logic from the Creature class, and separated them into modules:

Game::Logic::Movement.singleton_methods(false)    # => [ :move ]

The way I understand it, these logic modules integrate multiple game parts which depend on each other in a way not easily expressed hierarchically. The methods are just algorithms that operate on the given information. For example, the implementation of the move method:

def self.move(creature, map, dx, dy)
  coordinates = Map::Coordinates[dx + creature.x, dy + creature.y]
  tile = map[coordinates]
  creature.coordinates = coordinates if tile and tile.passable? # Teleport!
end

These methods are called directly from the game loop:

def handle(input)
  case input
    when :up then Logic::Movement.move character, map, 0, 1
    # ...
  end
end

This is how the game is currently organized. Movement is the only game logic I've added as of now, so I think it would be wise if I revised the architecture while it is still small. So, what do you think of it? What are the problems, and what can I do to improve it?

I'm also interested in how it compares to component-based game architecture. I've read a lot about it during my research, and it seems to be the most maintainable and reusable way to write game code. I think it would fit naturally in the Ruby world, due to its dynamic nature and message-based method invocation. The thing is, I really never understood how different components interact with each other, and I'm looking for something I can make sense of.

sentences:
How to update a game off a database I am currently writing a sports strategy management game (cricket) in PHP, with a MYSQL database, and I have come across one stumbling block - how do I update games where neither player is online?

Cricket is a game played between two players, and when they (or one of them) is online then everything is fine; but what if neither player is online?  This occurs when championship games are played, and these games need to happen at certain times for game reasons.

At the moment I have a private web page that updates every 5 seconds, and each time it loads all games are updated; but then I have the problem that when my private web page stops (for example my computer crashes or my web browser plays up) the game stops updating!

sentences:
How do I calculate the x,y of the rectangle after rotating? I'm using SDL2. I want to draw a textured rectangle and I'd like it rotated so I'm using SDL_RenderCopyEx. However SDL2 doesn't give me the option of repeating texture so I need to manually do it myself. The problem is I have no idea how to do the math.
My texture us 20x20, so I make the rects 20x20, I chosen a fixed angle of 45, my rotation point is 10,5 which appears to make the left middle of the rect the point it rotates from. I can see the two rects aren't touching if the second rect is (firstX+15,firstY+15). However if I change one of them to 14 they touch and it looks solid
I don't understand how to find the numbers. I'm finding the angle but doing
double angle = atan2(mouseX - x, mouseY - y) * 180 / PI;

Making the second rect relative to the first by +15,+14 only works if it's a 45 deg angle but is complete wrong for other angles.
How do I figure out the x,y the subsequent rect based on the angle?

sentences:
Multiple UV coordinates in Unreal Engine Procedural Mesh Component? How can I have multiple UV coordinates per vertex in a Procedural Mesh Component? My goal is to create a UV editor.

I know it is possible to generate multiple vertices per corner, as in UKismetProceduralMeshLibrary::GenerateBoxMesh but that's 24 vertices instead of 8 for a simple box. Would this be a performance problem?

I know that FRawMesh (used when importing an FBX into a static mesh) contains multiple UVs per "wedge" (properties stored for each corner of each face). But I don't know how to set or create the equivalent in custom mesh component (except by duplicating vertices).

I know that casperjeff modified the Procedural Mesh Component plugin to add an additional UV set (as he explains here), but I don't really know how to make one UV set correspond to one face.

I am looking for an efficient solution in terms of performances.

sentences:
How Do I Do Alpha Transparency Properly In XNA 4.0? Okay, I've read several articles, tutorials, and questions regarding this.  Most point to the same technique which doesn't solve my problem.  I need the ability to create semi-transparent sprites (texture2D's really) and have them overlay another sprite.

I can achieve that somewhat with the code samples I've found but I'm not satisfied with the results and I know there is a way to do this.  In mobile programming (BREW) we did it old school and actually checked each pixel for transparency before rendering.

In this case it seems to render the sprite below it blended with the alpha above it.  This may be an artifact of how I'm rendering the texture but, as I said before, all examples point to this one technique.  Before I go any further I'll go ahead and paste my example code.

    public void Draw(SpriteBatch batch, Camera camera, float alpha)
    {
        int tileMapWidth = Width;
        int tileMapHeight = Height;

        batch.Begin(SpriteSortMode.Texture,
            BlendState.AlphaBlend,
            SamplerState.PointWrap,
            DepthStencilState.Default,
            RasterizerState.CullNone,
            null, camera.TransformMatrix);

        for (int x = 0; x < tileMapWidth; x++)
        {
            for (int y = 0; y < tileMapHeight; y++)
            {
                int tileIndex = _map[y, x];

                if (tileIndex != -1)
                {
                    Texture2D texture = _tileTextures[tileIndex];

                    batch.Draw(
                        texture,
                        new Rectangle(
                            (x * Engine.TileWidth),
                            (y * Engine.TileHeight),
                            Engine.TileWidth,
                            Engine.TileHeight),
                        new Color(new Vector4(1f, 1f, 1f, alpha )));
                }
            }
        }

        batch.End();

    }

As you can see, in this code I'm using the overloaded SpriteBatch.Begin method which takes, among other things, a blend state.  I'm almost positive that's my problem.  I don't want to BLEND the sprites, I want them to be transparent when alpha is 0.  In this example I can set alpha to 0 but it still renders both tiles, with the lower z ordered sprite showing through, discolored because of the blending.  This is not a desired effect, I want the higher z-ordered sprite to fade out and not effect the color beneath it in such a manner.

I might be way off here as I'm fairly new to XNA development so feel free to steer me in the correct direction in the event I'm going down the wrong rabbit hole.

TIA

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:
How do we export blender material with shaders and blender texture to unity? I've blender model, it has noise texture and glossy shaders, when I import it to unity, they are not the same.
I tried both cycle and Eevee render and was looking for different ways to export the fbx file, but nothing seems to work.

I am not sure, if it is even possible to export to shaders and noise texture from blender to unity or do I have to create material from scratch in unity?

This seems to be very common problem while importing material from blender to unity.
I am able to find way to get UV color mapped material, I did it by creating new material in unity and add same texture image file that I used in blender.

Her is the my material in blender.

I tried using copy path option while exporting, but no luck

When I imported the file in blender,I've extracted the material like this

After extracting a .mat file appeared, but it doesn't have information related to noise texture or any blender shaders.
this is the only file I can see after extracting the material.

sentences:
Units of measurement in a tile world I've started to make a 2D sidescroller, the camera and world rendering works as I expect, but now comes the physics part of world.

What I need is that one tile in x or direction should correspond to 1 meter. Since I have a variable time step (Android mobile game), I can't figure it out, since the timing and velocity always will be dependent of the device. So, is there any good way to make one tile to correspond 1 meter? This would be good, otherwise the physics implementation would later be weird.

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:
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:
How to design context menus based on whatever the object is? I'm looking for a solution for a "Right Click Options" behaviour.

Basically any and every item in a game, when right clicked, can display a set of options based on whatever the object is.

Right click examples for different scenarios:

Inventory: Helmet shows options (Equip, Use, Drop, Description)

Bank: Helmet shows options (Take 1, Take X, Take All, Description)

Floor: Helmet shows options (Take, Walk Here, Description)

Obviously each option somehow points to a certain method that does what is says. This is part of the issue I'm trying to figure out. With so many potention options for a single item, how would I have my classes designed in such a way as to not be extremely messy?

I've thought about inheritance but that could be really long winded and the chain could be huge.
I've thought about using interfaces, but this would probably restrict me a little as I wouldn't be able to load item data from an Xml file and place it into a generic "Item" class.

I'm basing my desired end result on a game called Runescape. Every object can be right clicked in the game and depending on what it is, and where it is (inventory, floor, bank etc.) displays a different set of options available to the player to interact with.

How would I go about achieving this? What approach should I take to first of all, decide which options SHOULD be displayed and once clicked, how to call the corresponding method.

I am using C# and Unity3D, but any examples provided do not have to be related to either of them as I'm after a pattern as opposed to actual code.

Any help is much appreciated and if I have not been clear in my question or desired results, please post a comment and I'll tend to it ASAP.

Here is what I have tried so far:

I've actually managed to implement a generic "Item" class that holds all of the values for different types of items (extra attack, extra defence, cost etc...). These variables get populated by data from an Xml file.
I have thought about placing every single possible interaction method inside of the Item class but I think this is unbelievably messy and poor form. I've probably taken the wrong approach for implementing this kind of system by only using the one class and not sub-classing to different items, but its the only way I can load the data from an Xml and store it in the class.
The reason I've chose to load all my items from an Xml file is due to this game having the possibility for 40,000+ items. If my math is correct, a class for each item is a lot of classes.

sentences:
Why isn't particle hair more popular in games? Blender 2.80 introduced EEVEE, a new realtime renderer, and after interacting with it for a while I was impressed by how well it handles particle hair in terms of performance and visuals. It even manages to reflect light through SSR.

Sphere with 200 parent hair particles, 50 child particles per parent

Blender isn't a game and they probably have different concerns and priorities regarding the performance of the application, so this might be a good reason not to see this being implemented in games right now but still, seeing how well EEVEE manages it and also knowing that games have user-customizable graphic settings, I don't understand why we're still using planes with textures and other techniques like that as our best effort for realtime graphics in games.

Of course having one million strands makes even Blender struggle to keep a reasonable framerate, but a game probably wouldn't need such a dense hair to look convincing and could cheat by having baked hair textures on the scalp in case gaps become visible close-up.

A friend of mine has said Nvidia HairWorks accomplishes just this, but looking at some screenshots I doubt that's the case (if it is, then maybe the technology has evolved a lot lately and nvidia has some catch up to do? I don't know but from what I've seen it doesn't look that good).

So, why isn't particle hair more popular in games?

sentences:
How to have a tilted FNT font on Godot? Since FNT is a bitmap font I was thinking perhaps making the padding negative to the right and left side of the characters and rasterizing each glyph already skewed by an angle could make the font appear to be tilted. Does any one know whether FNT sports negative padding or whether Godot support some form of skewing that could accomplish that?
Please take a look at the image to see what I'm describing

sentences:
Why is Particle System Not Visible Without Scene Window Viewing the Origin? I have a particle system, which is supposed to be highlighting an important game object, but the Particle System doesn't show on the game window unless the Scene window camera has the Origin (0,0,0) in view. The origin is at the corner of my UI canvases, in which you can see the two white lines marking the edges.

Take a look at these screenshots. On the 1st screenshot, the particle system is not visible. The 2nd screenshot was taken just moments later and the particle system is completely visible (and the number of particles is as if it had already been emitting the whole time.) The only difference is that I slightly rotated the camera of the Scene Window in between screenshots.  The camera was rotated down just a tiny bit to put the origin visible in the scene view.

The particle system immediately becomes visible on the game window as soon as I rotate the SceneView camera so that the Origin is in view.

This is Unity version 5.6.0f3.

There are other questions about particle systems not working, but the cause and solutions appear to be very different.

Here are things I've already tried:

The particle system is already set to "Play on Awake" both before and
after rotating the camera.
I've ensured that all of components and game objects are visible and
enabled both before rotating toward the origin and after.
All of the particle settings (size, etc.) are correct both before
rotating to the origin and after.

Why is the particle system not visible without the origin in the scene view?

sentences:
How can I avoid applying textures to a fragment in a shader when the surface normal is (0, 1, 0)? I have a small GLSL shader with a vertex shader and a fragment shader. I want to avoid applying textures to faces that have a normal equal to (0, 1, 0). Is this possible? These are my shaders:

Vertex:

#version 120

varying vec2 UV;
varying vec3 normal;

void main()
{
  UV = gl_MultiTexCoord0;
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
  normal = gl_Normal;
}

Fragment:

#version 120

varying vec2 UV;
uniform sampler2D diffuseMap;

void main(void)
{
  gl_FragColor = texture(diffuseMap, UV);
}

sentences:
Controlling screen and window size in Unity In Java I know how to make a window of a certain size and make it not resizable.

How do I control my game's window size in Unity and prevent players from resizing it?

sentences:
How does Texture Mapping work? I read the answers from What exactly is UV and UVW Mapping? and How does UVW texture mapping work?, which are quite nice, but am still not 100% sure, if I understand correctly.

Lets start with a 2D example. So, say I have a triangle (obviously described by 3 vertices). Now my question is, how do I convert a (x,y)-coordinate to the (u,v)-coordinate of my texture? Since {x,y} could be any value between [0,n] with n being all real numbers, considering that it is in object space. But my texture coordinates are between [0,1]. How do I know how to map lets say (3,4) to (u,v)? If I know how to map the object coordinates to the texture coordinate it is easy to interpolate the values, I assume (either using bilinear interpolation or barycentric interpolation).

And then how would this work for 3D? Lets say in this case we would have a pyramide with 5 vertices (4 bottom, 1 tip). I guess the procedure would be similar, with the exception that I know have an additional depth value. But how does the mapping of a 2D texture work on a 3D object, when I don't have nice flat surfaces like on a pyramide, but instead have a circular surface, like a tea pot?

I hope I'm clear in my questions. I'm still little confused myself. I just don't quite get the mathematical background of texture mapping.

It would be enough, if you could point me to some website with good explanation, maybe with clear graphics and step by step description.

Thanks for your time!

sentences:
Maintain Vuforia tracking during Unity Ad My game uses Vuforia pos and ground plane tracking.

During gameplay players are given the option to watch a video to gain additional health.

When 'No' is chosen gameplay resumes fine. However when 'yes' is chosen Vuforia tracking is lost during the video and afterwards all gameobjects are locked in a static position in relation to the AR camera.

Is there anyway to maintain pos tracking during the video?

sentences:
same 8bit created surface resulting in a different pitch value Given:
const int w = 10;
const int h = 10;
const int d = 8;
uint8_t* pixels = new uint8_t[w * h]

SDL_Surface* src = SDL_CreateRGBSurfaceFrom(pixels, w, h, d, w, 0, 0, 0, 0);
SDL_Surface* dst = SDL_ConvertSurface(src, src->format, 0);
// src->pitch == 10;
// dst->pitch == 12;
//std:: cout << src->pitch == dst->pitch << std::endl;

My expected result is that the two pitches must match.
In this case I have the "weird" 12 pitch value for the dst image create from the src.

Is that due to memory alignment optimization?
Is there any reasonable explanation about it?
Are those padding bytes used somehow or just wasted?

sentences:
Would it be possible to edit character models of a PS1 game, to be played on an emulator? There are some abandoned PS1 oldies out there that I would love to see revamped with improved assets. I have some skills with some some modelling programs, so I was wondering if it would be possible to rip some models with or without their textures so that I could try to update them, and experience them on an emulator. Is this possible?

Even if the edited copies cannot be reinserted into the game, would it still be possible to rip the models out so that I could edit them?

sentences:
Why does glBindVertexArray sometimes fail (but mostly not)? Quick outline:

Test program that loads and displays big (3k x 4k) 16bit gray scale images (ca. 32MB).
Using modern OpenGL (eg. 3.3 or so) with shaders VBOs VAOs etc.
Running on Windows with OpenTK (WinForms inside WPF) - C#
developing on ATI FireGL and Nvidia Quadro FX
using MipMapping

My test program is actually working quite well (seems like I am doing not so much wrong). I've written a load test to find threading errors and resource leaks. So ater a while of loading and closing viewers and their images, sporadically glBindVertexArray() fails in one viewer instance and works in another viewer instance. Speak: Different OpenGL contexts, same graphics card, same process, same thread.

Visually I see my OpenGL HWND filled with a red cross and a red frame.

The failing viewers become more over time. Never the less some still keep working.

My background loading of textures is currently disabled. So threading issues should be out of scope.
I do 'MakeCurrent()' the context before I draw.
As of WPF law, all my Viewers work in the same UI thread. (that's what I think)

So what is wrong?

It seems little like a resource problem... because the problems become more over runtime. But what could be the reasons why glBindVertexArray() fails. My workflow should be most of the time OK. So are there any data operations I have to glFlush() before I call?

Actually I tried to add a  glFlush() before it but it did not resolve it.

My Program flow is a little convoluted by OO patterns but essentially boils down to that:

Creation of VAO:

int a =GL.GenVertexArray();
GL.BindVertexArray(a);
int b1= GL.GenBuffer();
GL.BindBuffer(BufferTarget.ArrayBuffer, b1);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(BufferSize), data, BufferUsageHint.StaticDraw);

int b2= GL.GenBuffer();
GL.BindBuffer(BufferTarget.ArrayBuffer, b2);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(BufferSize), data, BufferUsageHint.StaticDraw);
//->vertex data  (OO implication of multi calls)
GL.BindBuffer(BufferTarget.ArrayBuffer, b1);
GL.BindBuffer(BufferTarget.ArrayBuffer, b1);
GL.EnableVertexAttribArray(0);
//-> texcoords
GL.VertexAttribPointer(0, elements, attrType, normalized, stride, offset);
GL.BindBuffer(BufferTarget.ArrayBuffer, b2);
GL.BindBuffer(BufferTarget.ArrayBuffer, b2);
GL.EnableVertexAttribArray(0);
GL.VertexAttribPointer(0, elements, attrType, normalized, stride, offset);

consider generic valid parameters.

The Draw happens about like that sequence of calls (which I hopefully reflect correctly)

MakeCurrent();
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.UseProgram(prg);

// Set texture uniform
GL.Uniform1(Handle);
GL.ActiveTexture(unitnumber);
GL.BindTexture(Texture2D, Handle);

//... set some more Uniforms...
GL.GetError(); // returns NoError
// then it is over
GL.BindVertexArray(a);  // <<-- this is where it crashes sometimes!!

// this is my LUT-data but does not matter after the failing call
GL.ActiveTexture(1);
GL.BindTexture(TexTarget.TextureArray, Handle);

GL.DrawArrays(PrimitiveType.TRIANGLES, first, count);

sentences:
XNA draw texture/font and DrawIndexedPrimitives at the same time When i Draw a texture2d or a font with spriteBatch and also draw GraphicsDevice.DrawIndexedPrimitives, the frame is draw weird

SpriteBatch  spriteBatch = new SpriteBatch(GraphicsDevice);
BasicEffect basicEffect = new BasicEffect(GraphicsDevice);

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.LightSteelBlue);
    RasterizerState rasterizerState = new RasterizerState();
    rasterizerState.CullMode = CullMode.None;
    GraphicsDevice.RasterizerState = rasterizerState;

    //for(...) {
    GraphicsDevice.SetVertexBuffer(vertexBuffer);
    GraphicsDevice.Indices = indexBuffer;

    foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
    {
        pass.Apply();
        GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 20);
    }
    // } end for

    spriteBatch.Begin();
    spriteBatch.DrawString(MainFont, "FPS: " + Math.Round(1 / (float)gameTime.ElapsedGameTime.TotalSeconds, 2), new Vector2(200, 10), Color.Red);
    spriteBatch.End();

How can i solve this ?

sentences:
Transform coordinates from 3d to 2d without matrix or built in methods Not to long ago i started to create a small 3D engine in javascript to combine this with an html5 canvas.

One of the issues I run into is how can you transform 3d to 2d coords.
Since I cannot use matrices or built in transformation methods I need another way.

I've tried implementing the next explanation + pseudo code:
http://freespace.virgin.net/hugo.elias/routines/3d_to_2d.htm

Unfortunately no luck there. I've replace all the input variables with data from my own camera and object classes.

I have the following data:
An object with a rotation, position vector and an array of 4 3d coords (its just a plane)
a camera with a position and rotation vector
the viewport -> a square 600 x 600 surface.
The example uses a zoom factor which I've set as 1

Most hits on google use either matrix calculations or don't implement camera rotation.
Basic transformation should  be like this:
screen.x = x / z * zoom
screen.y = y / z * zoom

Can anyone point me in the right direction or explain to me howto achieve this?

edit:
Thanks for all your posts, I haven't been able to apply all this to my project yet but I hope to do this soon.

Ok after playing around a while some issues still remain.
I've created a new projection matrix:

    var w = (2 * nearPlane) / viewportWidth;
    var h = (2 * nearPlane) / viewportHeight;
    var q = farPlane / (farPlane - nearPlane);

    this.ProjectionMatrix = $M([
      [w, 0, 0, 0],
      [0, h, 0, 0],
      [0, 0, q, 1],
      [0, 0, (nearPlane * farPlane) / (nearPlane - farPlane), 0]
    ]);

where viewport = 600 * 450

and near plane = 0.5 and far plane = 500

the original code for drawing the vertices is this:

 var comboMatrix = world.WorldMatrix.x(camera.ViewMatrix);
    for (i = 0; i != this.NumberOfPolygons; i++) {
        var transformedVertices = new Array(verticesPerPolygon);
        var valid = new Boolean(1);
        for (j = 0; j != verticesPerPolygon; j++) {

            currentVertex = this.Mesh[i][j].x(comboMatrix);

            currentVertex.elements[0][0] = currentVertex.elements[0][0] / currentVertex.elements[0][2];
            currentVertex.elements[0][1] = currentVertex.elements[0][1] / currentVertex.elements[0][2];

            if (currentVertex.elements[0][0] < -1 || currentVertex.elements[0][0] > 1 || currentVertex.elements[0][1] < -1 || currentVertex.elements[0][1] > 1) {
                valid = new Boolean(0);
                break;
            }

            // Process Viewport Mapping Transformation
            currentVertex.elements[0][0] = currentVertex.elements[0][0] * 300 + 300;
            currentVertex.elements[0][1] = -currentVertex.elements[0][1] * 300 + 300;

            transformedVertices[j] = currentVertex;
        }

        // Draw the polygon
        if (valid == true) {
            this.DrawQuad(context, transformedVertices, true, new Boolean(0), new Boolean(1));
        }
    }

which kinda works since the letter H is drawn on my screen. Moving the camera however makes parts of the letter stop being drawn whenever one of the vertices is outside a 300 * 300 region.
I'm assuming this has something to do with a very basic implementation of a projection in these lines:

            currentVertex.elements[0][0] = currentVertex.elements[0][0] * 300 + 300;
            currentVertex.elements[0][1] = -currentVertex.elements[0][1] * 300 + 300;

Can anybody help me out howto change this piece of code so it works with my projection matrix?

I've tried removing the last 2 lines and changing transformedVertices[j] = currentVertex; into transformedVertices[j] = currentVertex.x(projection);
with no result.

sentences:
What all should be happening during the "Loading" screen? Do I just need to be creating instances of all of my graphics into memory that are loaded from file?  What is the best way to handle this?  Do I just need some sort of assets manager that creates these graphic instances during the loading screen and is then referred to later?

What are common things that need to be pre-loaded in games?  How  much should I pre-load?

Is it worth showing some sort of progress bar?  How can I keep load times short?  What should the loading screen look like?

What are some good examples of loading screens?  Any code examples?

Specifically, my game is for Andriod (Java/mobile), but feel free to make your answers generic.

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:
Event-driven vs state synchronizing networking model I was going through the Tribes network model and the network model used in Quake3. What I understand is that Tribes is more of an event based model where as the Quake model uses game states and delta game states to sync clients. Is my understanding right?

What kind of games do these models favor? Also what are the drawbacks of one model compared to the other. I am currently developing a two player First Person maze solver game and trying to choose between the two models.

sentences:
Physics / drag of object falling through atomsphere Trying to simulate an object plunging into atmosphere.  It seems to work, until the velocity falls past terminal velocity... down to zero... and then back up!

Something must be wrong with how I am applying drag?  I've looked at the code so long, I've managed to confuse myself.

Here I set variables/constants:

Mass = 5;                           //Object Mass
Radius = 7;                         //Radius of the blunt end facing the air stream (too sensitive!!!)
Area = power(Radius,2)*pi;          //The total area of the blunt end facing the air stream
Gravity = 9.8;                      //Earth
DragCoeff = 1.61;
Velocity = 10000;                   //Initial velocity straight down (vector needs to be added)
Acceleration = Gravity * (1/Mass);  //this is acceleration FORCE... subtract drag from this
Altitude = 100000;                  //initial altitude(meters) (atmosphere "begins" at 100Km)

Then, in the main loop of the program:
(note, delta_time is provided by the system in microseconds from the last execution of the loop)

d_time = delta_time / 1000000;                                          //Convert delta_time to seconds
AirDensity = 1.07* power(2.718,-.00005*Altitude);                       //How dense is the air right now?

TermVel = sqrt(2 * Mass * Gravity / AirDensity * Area * DragCoeff);     //Terminal Velocity at our altitude
Velocity = Velocity + Acceleration * d_time;                            //Acceleration added
Drag = 0.5 * AirDensity * sqr(Velocity)* DragCoeff * Area;              //Drag calculated
Velocity = Velocity - (clamp(Drag, 0, TermVel) * d_time);               //Drag subtracted
Altitude = Altitude - Velocity * d_time;                                //Update the position

Thanks ever so much for your kind help in understanding what I've done wrong here.

SS

Edit:
Thanks, Jason... I think I have the correct changes made... but my mass of "5" was causing it to behave really poorly.... the velocity went way negative... so I increased the mass significantly, and it seems to behave better... I will explore it a bit more.

Does it look like I have it right?

Thank you again, ever so much.

SS

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:
Frame timer does not show time I am currently using DirectX11 and MFC. The top of the window should tell me how long it takes to render the cube (in seconds).  At the moment the cube is rendered but when I try to work out how many seconds it took to render the cube I keep getting 0 on the top of the window. This cannot be right. Help please?

This is my Ondraw function:

void CLearningVisualCView::OnDraw(CDC* pDC)
// I want the OnDraw function to create the cube..
{

    CString TimerReports;

    // TODO: add draw code for native data here

    CLearningVisualCDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    if (!pDoc)
        return;

    Timer.GetStartTime();
    Render(); // This renders the cube

    Timer.GetEndTime(); // The counts stopwatch ends.
    Timer.DeltaCountDifference(Timer.StartTime, Timer.EndTime);
    Timer.GetSecondsPerCount();
    Timer.FrameTime(Timer.DeltaCounts, Timer.SecondsPerCount);

    TimerReports.Format(_T("%.100I64d"), Timer.Time);

    //TimerReports.Format(_T("%.5I64d"), Timer.FrameTime(Timer.DeltaCounts, Timer.SecondsPerCount)); // This converts the DeltaCountDifference into a CString. It has 5 d.p.
    AfxGetMainWnd()->SetWindowText(TimerReports); // This displays my count difference to the top of the window.

}

This is my Timer class:

#include "stdafx.h"
#include "GameTimer.h"

GameTimer::GameTimer()
{

//  QueryPerformanceFrequency((LARGE_INTEGER*)&countsPerSec);
//  SecondsPerCount = 1.0 / (double)countsPerSec;

}

GameTimer::~GameTimer()
{

}

_int64 GameTimer::GetStartTime()
{

 QueryPerformanceCounter((LARGE_INTEGER*)&StartTime);

 return StartTime;

}

_int64 GameTimer::GetEndTime()
{

    QueryPerformanceCounter((LARGE_INTEGER*)&EndTime);

    return EndTime;

}

// The _int64& are references. We will link them to the StartTime and the EndTime in the CLearningVisualCView - OnDraw(). This is done by adding them as arguments.

_int64 GameTimer::DeltaCountDifference(_int64& TimeA, _int64& TimeB)
{

        _int64 DeltaCounts = TimeB - TimeA;

    return DeltaCounts;
}

float GameTimer::GetSecondsPerCount()
{

    QueryPerformanceFrequency((LARGE_INTEGER*)&CountsPerSecond);

    SecondsPerCount = 1 / CountsPerSecond;

    return SecondsPerCount;
}

_int64 GameTimer::FrameTime(_int64& TheDeltaCounts, float& SecsPerCount)
{

    Time = TheDeltaCounts * SecsPerCount;

    return Time;
}

sentences:
Lightmap not moving properly with camera movement I´ve implemented a 2d lighting system (also with support of 2d shadows). Everything was fine until today when I realised that its not working when moving the camera, as it looks like the lightmap has still some offset than the camera position (for example, if camera.x is 100, the lightmap is x=-200)

Little video showing the problem :
Video

I can post any piece of code, for now Im sending you my light shader(fragment)

#version 440

in vec4 fragmentColor;
in vec2 TexCoords;

out vec4 color;

uniform float ambientStrength;

uniform vec2 resolution;
uniform sampler2D textureSampler;
uniform sampler2D lightMapTexture;

uniform bool textureON;

void main(){

    //Calc the ligthMap
    vec2 lightCoord = (gl_FragCoord.xy / resolution);
    vec4 lightMap = texture(lightMapTexture,lightCoord);

    if (textureON){

        vec4 textureColor =  texture(textureSampler, TexCoords);

        vec4 finalColor = lightMap * textureColor * fragmentColor;
        color =  vec4(finalColor.rgb,textureColor.a* fragmentColor.a);

    } else {

        color = fragmentColor;
    }
}

Vertex

#version 440

in vec3 vertexPosition;
in vec4 vertexColor;
in vec2 vertexUV;

out vec4 fragmentColor;
out vec2 TexCoords;

uniform mat4 Projection;
uniform mat4 View;
uniform mat4 Model;

void main(){

    gl_Position = Projection * View * Model * vec4(vertexPosition.xy,0,1);

    fragmentColor = vertexColor;

    TexCoords = vec2(vertexUV.x, 1.0 - vertexUV.y);
}

At first I thought that its a problem with resolution, but everything is good. Everything is working fine until I move the camera(or change its position from 0,0 to something else - all other objects have good position, also mouse coords)

sentences:
Algorithm for procedureral 2D map with connected paths Problem to solve: Generate a random 2D dungeon map for a tile-based game where all rooms are connected.

I am looking for better solutions than what I currently have.

My current solution is that I run two algorithms. The first generates the dungeon with its rooms. The second make sure that all rooms are connected. I am curious what other soltions may exist. Faster and / or easier etc. Speed is not really a concern, but if speed can be gained at no real cost, well, that is a good thing. More important is that I, and others that read, may learn different ways to approach and solve the problem.

Below are my current implementation. Rooms currently have no exits or exits in any 2, 3 or 4 directions.

Generating the dungeon rooms

Setup: Set the current room to the top left room.

Get a valid room type for the room (where valid room type is a type with no exits out of the dungeon and that have exits that matches the exits of the room above and the room to the left. Only need to check above and to the left due to step 2 below).
Put down the room and advance the x-coordinate one step. If the x-coordinate exceeds the dungeon width, set the x-coordinate to 0 and advance the y-coordinate one step. If the y-coordinate exceeds the dungeon height, we are done.
Repeat from #1.

I then check to see if all rooms are connected If they are not all connected I run a second algorithm that, in a non-sexy but definately good enough way in terms of dungeon layout, goes through the rooms and change them so that all end up being connected.

Checking to see if all rooms are connected

Setup: Create a 2D map of integers representing paths and initialize the entries to a "unprocessed" (not yet traversed) value, -1. Set a start path index integer that keeps track of the current path to 1. Set the current room to the top left room by adding it to a stack of rooms to check.

If the stack contains rooms to check, pop it set the path index of the room to the current path index. If the stack does not contain any rooms, increase the path index and try to get a room by advancing column by column, row by row, until we get a room that has not been processed yet. If no room can be found, we are done.
Check to see if the room has an exit to the left. If it has add the left room to the stack if it is not already on there.
Repeat step 2 for down, right and top directions (since we are using a stack that means the rooms are traversed in clockwise order, starting with the top direction).
Repeat from step 1.
If the path indices count is greater than one, there are disconnected rooms.

If there are disconnected rooms I then group the rooms by their path index, get the index of the biggest path and connect all other rooms to those rooms. This is a work in progress, but my (current, "brutish") plan is to go through each room in a room group (except the first) check to see if there is a horizontal or vertical path to the biggeset room group, and if so, create a horizontal / vertical path there by injecting / updating the rooms inbetween. Rinse and repeat. Ugly, yes, but it is something that will not be noticable in terms of visual pattern so it works in that sense.

sentences:
About the cameras in the original Metal Gear Solid for PSX Since I first played MGS on the PSX I have been wondering about this.
To my understanding, MGS loads the geometry of the 'room' where you are and lets you move through it by using semi-fixed cameras that can follow you to a certain degree until your character gets in the range of another camera, and then seems to transition from the last angle of the previous camera to the initial angle of the current camera.
However, since this game does not seem to have a great deal of reverse engineering done, I wonder if anybody has replicated this scheme on any game (stealth or not) to study it.
As far as I know, the only one I have found with a similar approach is Resident Evil Code: Veronica, which switched from pre-rendered backgrounds to 3D but restricted the cameras available, as in the previous installments, giving the cameras certain degree of freedom in following the player (but less than MGS since RECV is about being afraid, not being stealthy).
I know I am asking a questio too broad and risk to be tagged as such... but it's been a lot of time since MGS got out and I still wonder about if anybody has more concrete answers to my guess about how MGS works.

sentences:
Front Face Culling with Shadowmapping To avoid shadow acne I usualy use front face culling which works great. But for my current implementation the mesh is a quite complex terrain (depending on the lod level) and than the shading (dot product of the normals face with the negative light direction) is not always correct as some normals are actually facing the light. But still there is no information in the shadowmap to shadow these fragments in the shadowmap because of the front face culling ( like it is not exact enough).
What I end up with, is that there are some bright spots in the shadowed area.
I am not really sure why this does not work, because that would mean, that the front face culling is also culling some back faces, if the mesh has a very high level of detail, right?

In the Image with Front Face Culling (top picture) you can see these bright lines in the shadowed area where as without FF Culling (bottom image) the shadowed area is completely black.

My current workaround is, that I check the highest LOD level that is currently displaying and than according to that switch back an forth between ff culling and bias.

I use OpenGL:

The front face culling:

glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);

The shading in the fragment shader:

float shading = max(dot(normal,-lightDir), 0.0);

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:
What is the point of this hard-coded vector when calculating luminance in glow/bloom effects? I have looked at two different vertex shaders that calculate luminance and both use a "magic" vector that I'm not sure the meaning of the the actual values. For instance:

const mediump vec3 Perception = vec3(0.299, 0.587, 0.114);

void main(void)
{
    mediump vec3 color = texture2D(Sampler, TextureCoord).xyz;
    mediump float luminance = dot(Perception, color);
    gl_FragColor = (luminance > Threshold) ? vec4(color, 1) : vec4(0);
}

This was taken from the iPhone 3D programming book.

This perception vector is the magic vector I'm trying to figure out. I added the rgb/xyz values and the add to 1.

I saw another example that used vec3( 0.2125, 0.7154, 0.0721), which also adds to 1.

Can someone explain how one comes up with these values and what they really mean?

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:
Easing equations with moving end points Usually easing equations have 4 parameters:

time
duration
begin point
end point

For example:

public static float EaseOutQuad(float currTime, float begin, float end, float duration)
{
    currTime /= duration;

    return -end * currTime * (currTime - 2f) + begin;
}

Now afaik begin and end point are fixed values.
In my game I have an object oscillating between 2 points on its local X axis. I'm interpolating its position using easing equations, but I would like to be able to modify the end point dynamically avoiding discontinous or abrupt changes.

Is it possible to do this using easing equations or something similar?
Any suggestion?

sentences:
How do mipmapping, anti-aliasing and anisotropic filtering contribute to rendering quality? To my understanding, mipmaps exist to save on computations and memory when textures are far away. In an ideal world, we wouldn't want them. We'd just use the same high quality textures far away and not care about wasted resources.

But in reality, we need anisotropic filtering to smooth the disconnect between varying LOD mipmaps (or so I think).

However, do images using mipmaps with anisotropic filtering look better than no mipmaps without anisotropic filtering? See here (the first image looks worse than the third even though the first has no mipmaps). Is it because anisotropic filtering has anti-aliasing built in? And if we didn't have mipmaps, but added anti-aliasing, would the resulting image look better?

sentences:
When pausing an XNA Xbox game and showing a "pause menu", which controller buttons should I use? I'm making a simple 2D XNA game for Xbox 360. My game can be paused by pressing the Start button on the Xbox controller. While paused, a simple menu pops up with options like Resume and Exit to Title Screen. The way I've currently programmed it, the menu options can only be selected with the A button on the Xbox controller, but I've found that I intuitively want to press Start to resume the action again.

I think it's a given that Start pauses the game and displays the pause menu, but once the pause menu is displayed, I can think of 3 options for dealing with input:

Menu options can be selected with the A button. Start does nothing.
Menu options can be selected with the A button or the Start button.
Menu options can be selected with the A button. Start resumes gameplay regardless of which menu option is selected.

What's the best control scheme to pause a game and accept input on a pause screen menu? Are there any guidelines or standards to help choose between these options?

sentences:
How to create a map-like (clouds) texture If you place a map of the world on a sphere, it will look like the image is continuous. Basically the left end of the image is sort of a continuation of the right end. You won't be able to see any cuts.

I'm trying to create a clouds texture to add to my planet such that it will seem it has clouds. I managed to create the clouds in GIMP, however, I can't figure out how to make sure the left end of my image is a smooth continuation of the right end. For example if you were to map the below image to your sphere (I removed transparency to make it clearer), there would be a very obvious transition from the right end of the image back to the left end on your sphere. How would I create a texture such that I get rid of that?

Sorry for my lack of terminology.

sentences:
Seamless tilemap rendering (borderless adjacent images) I have a 2D game engine that draws tilemaps by drawing tiles from a tileset image. Because by default OpenGL can only wrap the entire texture (GL_REPEAT), and not just part of it, each tile is split off in to a separate texture. Then regions of the same tile are rendered adjacent to each other. Here's what it looks like when it's working as intended:

However as soon as you introduce fractional scaling, seams appear:

Why does this happen? I thought it was due to linear filtering blending the borders of the quads, but it still happens with point filtering. The only solution I've found so far is to ensure all positioning and scaling only happens at integer values, and use point filtering. This can degrade the visual quality of the game (particularly that sub-pixel positioning no longer works so motion is not so smooth).

Things I have tried/considered:

antialiasing reduces, but does not entirely eliminate, the seams
turning off mipmapping, has no effect
render each tile individually and extrude the edges by 1px - but this is a de-optimisation, since it can no longer render regions of tiles in one go, and creates other artefacts along the edges of areas of transparency
add a 1px border around source images and repeat the last pixels - but then they are no longer power-of-two, causing compatibility problems with systems without NPOT support
writing a custom shader to handle tiled images - but then what would you do differently? GL_REPEAT should be grabbing the pixel from the opposite side of the image at the borders, and not pick transparency.
the geometry is exactly adjacent, there are no floating point rounding errors.
if the fragment shader is hard coded to return the same color, the seams disappear.
if the textures are set to GL_CLAMP instead of GL_REPEAT, the seams disappear (although the rendering is wrong).
if the textures are set to GL_MIRRORED_REPEAT, the seams disappear (although the rendering is wrong again).
if I make the background red, the seams are still white. This suggests it's sampling opaque white from somewhere rather than transparency.

So the seams appear only when GL_REPEAT is set. For some reason in this mode only, at the edges of the geometry there is some bleed/leakage/transparency. How can that be? The entire texture is opaque.

sentences:
Loading .PNG file and using it for UnityEngine.UI.Image Have an Unity UI Image.

I want to load a .PNG file that is in my persistent data path and use it as the sprite source for the UI Image. Code:

    byte[] bytes = File.ReadAllBytes(Application.persistentDataPath + "/sprite.png");
    Texture2D texture = new Texture2D(width, height);
    texture.filterMode = FilterMode.Trilinear;
    texture.LoadImage(bytes);
    Sprite sprite = Sprite.Create(texture, new Rect(0,0,width, height), new Vector2(0.5f,0.0f), 1.0f);

    myObject.GetComponent<UnityEngine.UI.Image> ().sprite = sprite;

This almost works. Only a portion of the image is displayed.

The initial guess would be that I didn't load the image properly. However, if you use a SpriteRenderer instead of UnityEngine.UI.Image like

    myObject.GetComponent<SpriteRenderer>().sprite = sprite;

The image is displayed in full. So this seems to be a problem with UnityEngine.UI.Image specifically...

... However, if you drag an image from the editor into the Sprite Source property of UnityEngine.UI.Image, then such image is displayed in full - then suggesting that there is something wrong with the way I load my image bytes.

What should I do?

Edit: If you set the image type to Tiled, you can see that it tiles with the full image... So apparently the UI Image component DOES have all the image data but for some reason it won't render all of it.

sentences:
OpenGL glDisable(GL_TEXTURE_2D) vs glBindTexture(GL_TEXTURE_2D,0) I would like to ask which one of these is better to use after I finished my texture rendering.

glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,0)

Is there any difference performance-wise?

sentences:
What to focus on in developing a game demo for an interview? In other threads on this very website, it has been repeatedly stressed that having a game demo to showcase at a job interview is of paramount importance, so I decided to have a go and write my own game demo.

I would like to know what is typical for interviewers to focus their attention on while reviewing your game demo.

I shall clarify that I don't have a specific opening available to me right now, but that I would probably target gameplay and/or AI programming positions. Because of this I can answer by myself in terms of broad categories: "fancy graphics" shouldn't be my priority focus while "computer's players behaviour" should... Yet - having no direct experience of this industry - I would like to know if there are less obvious stuff I should pay attention to:

How important is code modularity?
How important is to showcase a typical algorithm implementation?
How important is to include novel features?
How important is playability?
Should I privilege code readability or code optimisation?
How important is code documentation?
etc...

Mind that the above are just examples to illustrate the level of detail I would appreciate in the answer, they are not specific subquestion that I would necessarily like to be addressed (unless you think it's relevant to discuss some of them).

Thanks in advance for your time and expertise.

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:
Help me Make Sense of Unity 2D Resolution Management I am trying to set up an environment for a retro style pixel art game in Unity 2D. I aim for a vertical resolution of 240 pixels, and then, I would like the horizontal resolution to be dependent on the target screen's aspect ratio, so, on a 4:3 screen 320x240, on 16:9 around ˜432x240, and so on.
I have read a bunch of tutorials, added pixel perfect to my main camera, set up a target resolution in player preferences, set the pixel in a unit to 8 pixels everywhere, but still cannot make heads or tails of how it actually works.
Here is an image of my scene with my camera selected:

If I am correct, the dashed line of the camera is my target resolution, although it is weird as the green image I used as a background has a native resolution of 216 pixel vertical, yet it fills up the supposedly 240 pixel high camera. I have no idea what the solid green line is, and don't even get me started of the canvas, whose render target is set for camera yet it is obviously many times bigger than that.
Can someone please explain it to me how to properly set up a 2D environment described in my opening, point out my mistakes, point me to a good tutorial, or just give me advice on how to understand Unity's resolution management?

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:
Coroutine problem, I don't know what's happening Calling function.

 private const int deathHangTime = 2;
 private void Die()
    {
          Debug.Log("1 " + Time.time);
          StartCoroutine(DelayForTime(deathHangTime));
          Debug.Log("4 " + Time.time);
    }

  Coroutine

IEnumerator DelayForTime(float time)
{
     Debug.Log("2 " + Time.time);
     yield return new WaitForSeconds(time);
     Debug.Log("3 " + Time.time);
}

Why doesn't it wait for 2 seconds?
Why doesn't it print the 3rd Debug line?

sentences:
Need help with a complex 3d scene (using Ogre and bullet) In my setup there is a box with a hole on one side, and a freely movable "stick" (or bar, tube). This stick can be inserted/moved through the hole into the box. This hole is exactly as wide as the diameter of the stick.

In reality, when you would now hold the end of the stick in your hand and move the hand left/right or up/down, the other end of the stick, which is inside the box, would move into the opposite direction of your hand movement (because the stick is affixed at the pivot point where it is entering the box through the hole).

(I hope you understand what I mean so far.)

Now I need to simulate such a setup in a 3d program. I have already successfully developed an Ogre3d framework for this application, including bullet. But what I don't know is how I can implement in my program what I have described above. This application must include two more features:

The scene camera is attached to the end of the stick that is inserted into the box. So when the user would move the mouse (to control "his" end of the stick outside the box), then the camera attached to the stick would move in the opposite direction, as described above.
The stick has some length, and the user can push it further into the box, or pull it closer to him again. That means of course that the max. radius on which the end of the stick inside the box can move depends on how far the stick is pushed into the box. Thus, the more the stick is pushed into the box, the larger the max. radius of this end of the stick with the camera will be.

I understand this is maybe quite a complex thing, so I don't expect any real source code here. I already have the Ogre and bullet part as said up and running, as well as a camera attached to the stick. This works fine. What I don't know though is how I can simulate the setup described above. Especially the requirement that the stick is affixed at the position of the hole on the box, where it is inserted into the box.

Any ideas how I could approach to implement the described setup?

sentences:
Android Java: Way to effectively pause system time while debugging? In my project, I call nanoTime and use that to get a deltaTime which I pass to my entities and animations.

However, while debugging (for example, stepping through my code), the system time on my phone is happily chugging along, so it's impossible to look at, say, two sequential frames of data in the debugger (since by the time I'm done looking at the first frame, the system time has continued to move ahead by seconds or even minutes).

Is there a programming practice or method to pause the system clock (or a way for my code to intercept and fake my deltaTime) whenever I pause execution from the debugger?

Additional Information:

I'm using Eclipse Classic with the ADT plugin and a Samsung SII, coding in Java.
My code invoking nanoTime: http://pastebin.com/0ZciyBtN
I do all display via a Canvas object (2D sprites and animations).

sentences:
Need help with rally point and spawning in StarCraft 2 map editor I want to make a Tower Defense game using the StarCraft 2 editor.

How can I make a rally point to control AI appear at one point and go to specific point? How do I make creep spawn properly at specific times?

sentences:
How do I get to the Terrain Tools and Advance option in Package Manager in Unity? I am not able to find the Terrain Tools option in Package Manager when I search it. I am new to Unity and that's why I was following a tutorial. The video was about building a terrain and there he told to get the terrain tools first.
For the terrain tools we need to go: Window > Package Manager > Packages > All Packages and then search it
But in the Packages I don't have the All packages option and also I don't have the Advance option as told in the video. I am sure that the Unity editor in the video is of an old version. Currently I am using 2020.3.8 version of Unity.
If there are some major changes between that version(used in the video) and my version(2020.3.8) then where do I find the Terrain Tools and the Advance option?
Screenshot From My Computer -

[NOTE: If there are any confusions, please refer the video]

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:
Render Occluded pixels to gray color In 3d space, objects can be occluded by another objects.
By depth testing, the occluded faces are skipped rendering. Only the nearest(smallest) depth value pixels are drawn.
But, sometime we need to render the occluded object or pixels for game play.

To differentiate the occluded object's pixels from foreground pixels, some game use gray color to render the pixels.

This is the sample images for the case.

I guess this can be achieved by some sort of shader.
How can I make this effects in Unity 3D Engine? Any hints or idea plz.

sentences:
Which is better a computer science degree or a Software engineer degree? I'm asking here so since you all have experience in or around game programming, that's what I want to do, and I’m trying to find as many options as I can before my senior year, which is next year. So do you have any opinions on the matter of which would give me a better education in programming?

Please no talking about anything other than the two degrees because I know of game programming degrees out there but I like to see which of these would provide the best alternate choice.

sentences:
Pygame set_colorkey transparency issues I'm having a strange issue that I cannot seem to remedy.  I am doing some prototyping with Pygame on a desktop running windows and a laptop running OS X.  Both are running python v2.7.3 (installed via homebrew for the Macbook) and pygame v1.9.1.

For transparency, I have been using set_colorkey with a transparency color of (255, 0, 255).  Here is the applicable code:

transColor = pygame.Color(255, 0, 255)
image = pygame.image.load(playerPath + "idle.png").convert()
image.set_colorkey(transColor)

This works flawlessly on my windows machine.  On my laptop, it does not work.  It just shows the hideous magenta color.  Here's the strange part.  If I change the transColor to (0, 0, 0), all black pixels in my images are transparent.  Has anyone run into this issue before?

sentences:
Failed to spawn server object, Unity UNET I'm familiar with Unity and programming but I'm new to this site.

So I have an issue with clients on Unity. I start servers with no errors, flawless. But when I join a server as a client I get a bunch of the error mentioned in the title. What causes this issue? I am using the UNET networking components.

I think it's lines like these, when executed by a client:

    NetworkServer.Spawn (objectNameHere);

How can I fix it if that's the case?

Edit

After hours of having this issue I have become so frustrated that I think it's best I take a break. I'll check back on this site from time to time.

sentences:
What does the update button in the Unreal Engine launcher actually update the engine to? Unreal Engine 4 seems to have a very handy way of managing different versions of the engine - mainly you get to keep several copies and choose which one to launch.

That said, not having used the new launcher recently I see that I am quite behind in engine versions but where previously I had to download the new version (as can be seen by my several copies of the engine) there is now an update button on the engines.

My internet is really slow so I'm curious if anyone could tell me what the update button actually does? For example, in the circled one, will it update to some 4.2.x minor version or will it update to the 4.7.2 version that I can freshly install? If I can save some bandwidth by upgrading to 4.7.2 over downloading a fresh copy that would be ideal.

sentences:
Scene Graph in Separate Thread I develop my own game engine for fun (but not profit).  I have rendering in one thread and my scene graph updates (velocity, etc.) in another.  When it's time to render, the render thread adds the visible nodes to a new linear buffer and traverses them.

In more detail, my scene graph is triple-buffered.  Each node in my scene graph has three copies of its relative and absolute transformation matrices (4x4).  At any given time, one copy is written to by the scene graph thread, one copy is read by the renderer, and a third exists so that the reader or writer can move on to the next without waiting on the other.  This prevents writing to something while it's being rendered and from rendering a half-updated scene graph.  Somehow I've also got a fourth copy of each matrix for the user to work with so as to not conflict with the update thread.  This seems to perform well by avoiding having to synchronize all the time.

However, this is a mess.

These are my ultimate goals for the system:

Rendering and scene graph updating stay in separate threads.
Minimize how much these threads have to wait on one another.
Don't render a scene that's been halfway updated by the update thread.  This is particularly noticeable if the camera is moving fast and sometimes it's rendered before or after an update.
Reduced memory usage.  I have way too many matrices per Node.  I'm also considering moving to vectors for position/rotation/scale due to increased floating point drift with matrices.
Ability to handle tens of thousands of Nodes.  The current system does this reasonably well.

I also hope to incorporate Bullet (the physics engine) and networking in the future, neither of which I've given much thought.

What are some approaches for accomplishing a better scene graph?

sentences:
How do I handle specific tile/object collisions? What do I do after the bounding box test against a tile to determine whether there is a real collision against the contents of that tile?  And if there is, how should I move the object in response to that collision?

I have a small object, and test for collisions against the tiles that each corner of it is on.

Here's my current code, which I run for each of those (up to) four tiles:

// get the bounding box of the object, in world space
objectBounds = object->bounds + object->position;
if ( (objectBounds.right >= tileBounds.left) &&
     (objectBounds.left <= tileBounds.right) &&
     (objectBounds.top >= tileBounds.bottom) &&
     (objectBounds.bottom <= tileBounds.top))
{
    // perform specific test to see if it's a left, top , bottom
    // or right collision. If so, I check to see the nature of it
    // and where I need to place the object to respond to that collision...
    // [THIS IS THE PART THAT NEEDS WORK]
    //
    if( lastkey==keydown[right] && ((objectBounds.right >= tileBounds.left) &&
                                   (objectBounds.right <= tileBounds.right) &&
                                   (objectBounds.bottom >= tileBounds.bottom) &&
                                   (objectBounds.bottom <= tileBounds.top)) )
    {
        object->position.x = tileBounds.left - objectBounds.width;
    }
    // etc.

sentences:
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 I generate random mountains in a sidescroller? So I'm trying to make a simplified Terraria style world using Perlin noise. I got that working and the terrain is randomized. However the terrain always looks like like a weird cosines curve. Hills and bottoms with different heights repeating. The effect I want to achieve is something similar to this:

Where the terrain is mostly flat looking and sometimes a large mountain will appear.

Is there an algorithm or "noise" that could achieve this effect or what other things do I need to do?

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

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

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

sentences: How do I get started making Android games? I am new to game development. I am interested in developing 2D games for the Android platform. What is the best place to start with (i.e) What are the basics and how to proceed? I already have programming experience in Java but don't have any experience with graphics or animation.

sentences:
Monogame / XNA - Is there a limit when drawing at far position (> 1 billion ? = strange behavior) So I'm making an "unlimited" 2D Tile-Engine with procedural generation (simple noise based) in Monogame, and I'm loading/unloading Chunck by Chunck as you go along. It's working pretty well now.

Only problem I encounter when I'm positioning my character at a high value like for example int.Maxvalue / 2 (and higher), drawing tiles and every sprites from a high Position becomes all glitchy. Tiles take random sizes with a higher width and height (see pictures).

Drawing tiles :

 spriteBatch.Draw(
   textToDraw,
   new Vector2(i * TILE_SIZE, j * TILE_SIZE),
   new Rectangle(0, 0, TILE_SIZE, TILE_SIZE),
   drawColor,
   0,
   new Vector2(0, 0),
   1f,
   SpriteEffects.None,
   depth
 );

Camera Transform :

public Matrix Transform(GraphicsDevice graphicsDevice)
{
   m_Transform =
     Matrix.CreateTranslation(new Vector3(-m_CameraPosition.X, -m_CameraPosition.Y, 0.0f)) *
     Matrix.CreateTranslation(new Vector3(graphicsDevice.Viewport.Width * 0.5f , graphicsDevice.Viewport.Height * 0.5f , 0.0f)); // on redivise par 0.5 à cause du renderTarget 720x450

   return m_Transform;
}

Begin spriteBatch :

matrix = this.Manager.camera.Transform(this.GraphicsDevice);
spriteBatch.Begin(SpriteSortMode.BackToFront,
    BlendState.AlphaBlend,
    SamplerState.PointClamp,
    null,
    null,
    null,
    matrix
);

Drawing at position x = 1 million, y = 1 million :
Drawing at position x = 1 billion, y = 1 billion:
Red tile is a random tile I draw in another color to be able to get the size. But all the tiles are glitchy.

To isolate the problem as it didn't seem to come from my code, I tested in an Internet XNA sample I modified (From xnagpa.net "Eyes of the Dragons" samples) working with a similar Camera and tile engine. I forced the Camera position to a high value (x = 1 billion, y, 1 billion) and drawing Tiles on the screen at that position. Same problem. So my newb guess is it has to do with calculation of the Matrix, but after that it gets too complicated for me.

Anyone had the problem ? Can confirm it is a limitation of some sort. I don't think it can be fixed, but I'm trying to determine what is the "limit" of my "unlimited world".

Code is from my code base, pictures are from the example I cited and modified

sentences: How can I record gameplay footage as a video within Unity? I am building a traffic simulator in Unity. I need to record my game as a video, so that I can use the video for machine learning purposes. I used fraps for the same but didn't find it worked for me since it's not within Unity. How can I make a video recording of the gameplay?

sentences: What game development tool can I use on a computer that does not support shaders? I tried SFML, but found out that my computer does not support shaders. Given this restriction, what could I use instead?

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:
Unity crash upon opening a specific scene I have this one specific scene that I spent over 20 hours building. But as of today when I attempt to open it unity crashes. I have opened the error log and it states:

Unity.exe caused an Access Violation (0xc0000005)
  in module Unity.exe at 0033:4150123b.

Error occurred at 2017-09-22_200636.
C:\Program Files\Unity\Editor\Unity.exe, run by MarcR.
62% memory in use.
16257 MB physical memory [6165 MB free].
32641 MB paging file [18590 MB free].
134217728 MB user address space [134213224 MB free].
Read from location 00000098 caused an access violation.

I have tried running the program as administrator, updating the unity editor and cleaning the cache.

The funny thing is that I am actually able to open the scene additive to my current scene.

Can anyone tell me whats going on?

(On an end note I did not want to post ALL of the error log if you need to see please comment and I will, of course, link it)

sentences:
What is original Pong ball behaviour? I am building a Pong clone to learn interactive programming and I've stumbled in getting the ball movement and bouncing on the paddles right.

If I play the original game I can't really understand how the "spin" and the paddle bounce works.

I've been searching a bit on the internet and all I got was just more confusion.

Can anybody explain me how the bounce is handled?
If the paddle stands perfectly still and the ball, just moving on x, hits the paddle at the center I simply get -x, that is clear.

What happens if you hit the paddle on the sides?
What changes if when the ball hits the paddle the paddle is also moving?

I did an Arkanoid-like implementation but it is far from the real Pong feeling.

sentences:
How to scale image at runtime in GameMaker? I use this code to create a new enemy and preset some values:

It runs in the step event of the player object.

var inst_inst = instance_create_layer(newX, newY, "Instances_Enemies", obj_Asteroid01);
inst_inst.image_index.image_xscale = 0.1;
inst_inst.speed = 4;

The speed is set correctly but the code scales the image of the player sprite and not the sprite of obj_Asteroid01

Edit after getting the answer

My fault was to trust the autocomplete and the fact, that there were no compile errors.

This is something you need to get used to :)

sentences:
Location of "units" in Code So, I've been playing around with the concept of a game, mechanically think of the Civilization games(Tile, turn-based strategy) but I am quite uncertain about where I should store the units location in the code. The tiles exist on a X and Y coordination of integers and that's how I imagine that the unit's would work too.

To clarify, I am unsure what's most effective, if it's example one: To have the tiles have a variable for which units are standing upon it and then when the unit move destroy them and recreate them on the tiles they are moving to.

That way when the tile is clicked it should be very easy to get the unit but it seems like it might be unsafe to remove and recreate units or sending a variable along. This might also be very unpractical when issuing an order to move somewhere, though, I am don't know.

The second example is to add the units to some kind of unit arraylist (or alike) but by that the game would have to find the unit with the right coordinates in said list (right?), this might appear as if the game is unresponsive and slow. Though it might not matter when you sort the list every x interval...

Any other ways to do it, ideas, fixes or even comments from you guys would be much appreciated.

sentences:
How to find out the vertices of the polyhedron formed by the overlapping area of two rotated boxes? What is the most efficient way for finding out the vertices of the polyhedron formed by the overlapping area of two rotated 3D boxes?

If it is still confusing what I mean by "polyhedron formed by...", see the picture below:

Of course, in that picture the boxes are still not rotated*.

But imagine I rotate both. I would like to identify the vertices that form the inner area of the overlapping.

What is the less expensive way for doing so? (I'm using C#, but can read C++ well).

*The picture comes from a blog post that teaches how to get the overlapping area of two 3D AABBs: http://blog.meltinglogic.com/2015/04/aabb-overlapping-area/

sentences:
Constraining Movement to Path/Splines First of all take a quick look at this :

https://www.youtube.com/watch?v=LQtKP-EymFM

So this is to give a idea of what I mean by following a path, basicly I am trying to understand how something like that would work out, I don't mean the sonic like motion, what I want is how do I constraint the movement to predefined path. But still being able to Jump.

The trouble I am having is how does it behave when falling from the loop? how does it know in the Spline/Path  it should align to?

What I want is a some sort or explanation on how something like that would be implemented, the motion is not my concern.

sentences:
Unity: Create large Terrain with accurate raycast detection? I'm not using the Unity Terrain because it lacks certain features.

Amongst them, you cannot tile them:

You cannot create concave walls or make holes in it:

No custom textures, no detail textures, awful sculpting tools... the list goes on and on. So I imported my own Terrain as a Mesh. The collision works perfectly, however raycasting onto the Terrain is horribly inaccurate. Unity seems to compress the Mesh Collider depending on distance to player. See the video linked below. Since Unity is (by my knowledge) the only Game Engine that supports convex colliders, how do other game engines create Terrain colliders?

For a racing game or a RTS or RPG the colliders are no problem, but for a shooter it's unacceptable. Here's a video showing the problem:

https://youtu.be/coiFS6IT4wI

I've researched long and hard and there seems to be no known solution for this. So my question remains, if it's possible at all, how can i create large scale Terrains for Unity? This problem makes it completely impossible for me to create outdoor scenes. There HAS to be some kind of solution.

1) Raycasting script:

//Spread
        float spreadAmount = Mathf.Lerp(spreadMin, spreadMax, burstTimer / spreadThreshold); //Current Spread lerps between spreadMin and spreadMax by burstTimer (increases per shot)

        int i = 0;
        totalShotDamage = 0; //Buckshot sends 8 rays down the range. totalShotDamage gets total damage done by all rays. Needed for displaying damage text

        while (i < bulletCount) //Repeats Shooting Vector for bulletCount amount (needed for buckshot)
        {
            Vector3 shootDirection = shootOrigin.transform.forward; //Shoot Vector 100% accuracy

            shootDirection += shootOrigin.transform.right * (Random.Range(-spreadAmount, spreadAmount)); //Randomizes Vector horizontally, reduces accuracy
            shootDirection += shootOrigin.transform.up * (Random.Range(-spreadAmount, spreadAmount)); //Randomizes Vector Vectically, reduces accuracy

            Ray ray = new Ray(shootOrigin.transform.position, shootDirection); //Ray from Shoot vector
            RaycastHit hitInfo;

            if (Physics.Raycast(ray, out hitInfo, 2000, shootLayerMask)) //Sets range of gun & sends ray
            {
                Vector3 hitPoint = hitInfo.point; //Point of impact with any object
                GameObject go = hitInfo.collider.gameObject; //GameObject of impacted Object

                string targetTag = hitInfo.collider.gameObject.tag; //Tag of GameObject of impacted Object

                addHitParticleEffects(targetTag, hitInfo, enableBulletholes); //Add hitparticle effects based on Tag (IMPACTmaterial)
                damageEnemy(targetTag, hitInfo, damage, damageRollOff); //Damage enemy
            }
            i++; //total bullet count (needed for buckshot)
        }

2) Terrain Inspector Settings

3) LOD Settings

There are no LOD Settings (yet). Individual Planes of the whole Terrain and objects on top of it simply pop in and out of existence depending on the Players position.

sentences:
Why Does unity_LightPosition[0] Seem to Depend on Camera Position? I'm trying to write a fairly basic shader but I keep running into lighting issues with Unity.  My first problem was trying to figure out which variable stored the light's position in world space.  (I'm only working with one light, at least at the moment).

I finally found something that responds to movement of my light source: unity_LightPosition[0].  However the shader still didn't do what I wanted it to do, so I did some debugging:

I have a basic vertex and fragment shader and what I'm currently doing in the fragment shader is:

float4 c = float4(0, 0, 0, 1);
float3 lp = normalize(unity_LightPosition[0]);
c.rgb = lp;
return c;

This should just set the color of my object to the normalized position of the light source, correct?  What I see in my scene is my object changes colors when I move my camera around it (I'm not moving the light source at all, it is a separate entity).  The color also seems to increase in strength as I zoom in.

To me, it seems as if unity_LightPosition[0] is related to my camera's position, as well as orientation and zoom level, yet the documentation I've found says it should represent the position of the light in world space.

I tried switching to using the following:

float3 lp = float4(
    unity_4LightPosX0[0],
    unity_4LightPosY0[0],
    unity_4LightPosZ0[0],
    1.0
);

...but that only colors my object red regardless of the light's actual position.

Additionally, I've set the LightMode tag to Vertex.

It seems like simply getting the world position of the light source shouldn't be this difficult.  What am I not doing correctly?

EDIT:
I've been playing around with the camera and light position and I think that unity_LightPosition[0] actually puts out position in the projection space.  If I place the light source in the lower-left corner of the screen, the object is black.  Upper-left the object is green (0, 1), upper-right is orange (1, 1), and lower-right is red (1, 0).  When I place it in the lower-left (0, 0) and move the camera in front of it, it becomes blue.  This is consistent with the depth value behavior.  (0, 0, >0) would appear as blue.

Now, how to get it from projection back to world?...or should I use a different variable?

sentences:
How can I automate high-level user interactions to test correctness of my game? I am trying to automatically simulate the game experience in my programming game. I think Expect is the way to do it because it creates its own tty for the process, becoming independent process of the main process but I want that some key sequence is pressed down in some pattern, such as press the key Z down every minute or press this that with this that pauses, without really expecting any specific file descriptors. Is there some ready programs to automate this kind of high-level debugging?

I have access to obsd and ubuntu.

sentences:
How to obtain "gravity" and "initial impulse" given "desired time to reach max height" and "desired max height"? I'm developing a 2d fighting game, using time steps based on frames ie, each call to Update() of the game represents a frame so, no variable time at all.

My jump physics code doesn't need to consider delta time, since each Update() corresponds exactly to the next frame step. Here how it looks:

double gravity = 0.78;
double initialImpulse = -17.5;

Vector2 actualPosition;
double actualVerticalVelocity;

InitializeJump() {
    actualVerticalVelocity = initialImpulse;
}

Update() {
    actualPosition.Y += actualVerticalVelocity;

    actualVerticalVelocity += gravity;
}

It works great and results in a smooth arc. However, it's hard to determine the values for "gravity" and "initialImpulse" that will generate the jump that I want.

Do you know if it's possible to calculate the "gravity" and "initialImpulse", if the only known variable is the "desired time to reach max height" (in frames) and "desired max height"?

This question should lead to the answer I'm looking for, but its current answer does not fit my needs.

UPDATE:

As @MickLH figured me out, I was using an inefficient Euler integration. Here is the correct Update() code:

Update() {
    actualVerticalVelocity += gravity / 2;

    actualPosition.Y += actualVerticalVelocity;

    actualVerticalVelocity += gravity / 2;
}

Only the very first step of the Update() will change and will move the object by initialVelocity plus the half of the gravity, instead of the full gravity. Each step after the first will add the full gravity to the current velocity.

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:
How to draw a diagonal fade-in and fade-out? How to draw a diagonal fade-in/fade-out in 2D using MonoGame draw API?

For a simple (non-directional) fade-in/out drawing the background with alpha variation do  the tricks, but what is the standard way to fade-in/fade-out directionally in 2D?

(The background is a texture, not a unicolored background)

sentences:
How to optimize pathfinding on a very large dynamic 2d grid? I have a large 2d tilemap, ranging anywhere from hundreds to thousands in size. The map is formed by 8x8 chunks. I am currently using A* but it isn't quite efficient because I may have as many as a hundred objects pathfinding simultaneously. The path doesn't have to be the absolute shortest, but a certain degree of shortness is expected.

I've looked here and saw that HPA* might work for me since my map is broken into smaller chunks. However, because the map is highly dynamic (let's assume that at least two chunks are modified per second) it seems there may be better alternatives.

Also, D*/Lite (mentioned in the link) might work, but how can it be optimized for a chunk based grid?

My question isn't particularly about HPA* or D*, but rather about finding an optimal algorithm for a large and dynamic, chunk-based, tilemap.

EDIT: The chunks contain procedurally generated content. Most of the time this will mean that the chunk is empty except for about 10-20% of its tiles, however sometimes this number can go up to 90% (that is in the case of generated "blobs"). The chunks will contain near-arbitrary data, and two chunks will rarely be the same.

Furthermore, each agent will have an independent path, however because the map is dynamic, it may contain man-made corridors and long passage ways that might result in them being shared often by many agents.

Most goals will be arbitrarily located, however there will be some predefined goals (locations) as well. For those predefined locations, I am considering using a vector field (sort of like a heat map) that can be used to approach it. However, doing this for every goal would be terribly inefficient especially since I would use the generated field only once (or in better cases, maybe a few times).

sentences:
Entity component system - where did attributes and behaviors come from? I recently spent quite some time understanding and building a component-based system. I got stuck on  a few problems and after searching for quite some time ran across this answer which is talking about behaviours and attributes.

From what I understand, attributes are an entity's data; I thought that's what the component is? And what are behaviours? Is it another term for Entity Processing System?

sentences:
How to create button prompts for interactable objects in Unity? I have a class of objects tagged as interactables that my player can interact with when within range.

When my player is near them, I want to display a button prompt at the bottom of the screen, along with a description of the type of interaction possible (for example, "inspect", "use", etc.).

I want to account for the possibility that the player might be within range of two or more of them at once, and thus allow him to toggle through them, displaying their button prompts in turn.

If my player interacts with something which generates a text box or other modal, I want the button prompt to disappear, but to return when the text box or modal is closed.

Any advice on how to go about achieving this?

I've done it in the past in different engines, but I have always been unhappy with how convoluted my method was. I'd like to hear how others might tackle this. Given how common this kind of thing is in games, I'm surprised I haven't found a good tutorial on it yet.

You can be as general or as specific as you'd like in your answer.

sentences:
Why doesn't JavaScript's Math.cos function match this vector tutorial? I'm following this MATHguide lesson on combining vectors and have reached this part:

Next, we need to convert their forces to horizontal and vertical components. Let's use k for Kim's vector and n for Noah's vector.
k = <30, 130°> = <30 cos 130°, 30 sin 130°> = <-19.3, 23.0>.
n = <40, 65°> = <40 cos 65°, 40 sin 65°> = <16.9, 36.3>.

To get the X part of Kim's vector, I run 30 * Math.cos(130), I get -11.018739913640896, which is not -19.3.
To get the Y part of Kim's vector, I run 30 * Math.sin(130) which is -27.903178505602853, which is not the 23.0 listed by the example.
Where did I go wrong?

sentences:
Why I don't have the DX templates even with the Windows 8 SDK installed? I have Windows 7, 64 bit.
I installed the Windows 8.1 SDK from here, and I installed Visual Studio Ultimate 2013. I chose to install everything; the size of the install was around 11GB.
Yet I don't have any of the templates shown here. What am I doing wrong? Do I need to install some other version of Visual Studio, like Express? Do I need Windows 8.1?

sentences:
Does it make sense to do more calculations in the fragment shader if there are more vertices than pixels? I'm very new to graphics programming, and as I understand it vertex shaders are called per vertex and fragment shaders are per pixel (ignoring anti-aliasing). When it comes to optimization all sources I refer to say that calculations that could be done in either shaders should be done in the vertex shader, and it makes sense: 5*8 done 3 times is way better than 5*8 done 300'000 (640×480 for example).

And that's fine for this scale but the question almost poses itself: what happens when the amount of vertices exceeds the resolution. Here's a practical example: a typical AAA game could have upto 3'000'000 polys rendering on the screen, for the sake of simplicity let's say it's a very detailed triangle strip, that would give it exactly 3'000'002 vertices; while a full HD screen has 1920*1080 ≈ 2'000'000 pixels. As you can tell a difference of a million operation could be a substantial performance increase.

Is my thought process sound, or does my ignorance of some details leave something to be desired?

sentences:
How can I detect hex edges and corners for Catan map? The following messy code implements a decent hex map, but I have no way to detect edges and corners:

function blankMap($scenario_array){
    $hexMap = null;
    $hexCss = "";
      echo $hexCss.$hexMap;
    }
}

How do I move on from here so that I can click on edges and corners of the hexes?

sentences: AABBs in lwjgl 2.9.3 I think I have succeeded in making an aabb out of 6 quads in opengGL but how would i get it to stay with its centre-point at the centre-point of all objects. I know it is easy for one object how would I do it automatically for all objects?

sentences:
Data structures in older games I'm curious about the data structures used when programming older games like Super Mario Brothers for NES and Super Mario World for SNES.  My understanding is that games of this period were written in assembly.  Did the programmers define/use any data structures?

For example: when a group of coins appears on the screen how are they stored?  Did the programmers just use arrays?  Or perhaps they had linked-lists?

Cheers!

Edit: I'm interested in various approaches... not necessarily a universal approach.

Edit 2:  In a few of my games I use a (potentially bad) approach towards collections and I want to know if any of the older games used a similar approach.  I like to do the following:

// statically allocated arrays (max number of coins is 4)
int coinsXs[4] = {0, 0, 0, 0};
int coinsYs[4] = {0, 0, 0, 0};

// bitset that keeps track of which coins are active
int coinsActive = 0;

// ...

// update the active coins in an update function
for(int i = 0; i < 4; i++){
    if(coinsActive & (1 << i)){
        // update ith coin
    }
 }

sentences:
RPG Game Graphics Help/Review I've been working on an simple RPG game and I'm having troubles figuring out how my graphics should look.

I'm wondering if any of you could give some advice on how they are/could be more pleasing to the eye.

Here is a couple of screen shots of the game itself:

Any suggetions/comments!

Thanks!

Sorry, I'm unable to post more pictures, because of my repution :(

Edit:
 After some working on the look of the game here is where I got to...

sentences:
Unity Android: Truecolor texture performance hit and alternatives for truecolor After integrating the graphics assets to my application, I noticed that when the textures are compressed they look very bad compared to truecolor. This happens to all the textures and it did not seem to help changing the texture type to GUI nor did it help to switch the 32-bit display buffering on.

Does using truecolor textures make the application much heavier to run? Or does it just increase the size of the .APK? Are there alternatives to getting a good texture quality and a smaller texture size instead of using truecolor?

EDIT:
I did some experiments with the dithering. I created a textures in GIMP 2.8, one which was RGB and one which was indexed with 255 colours and Floyd-Steinberg dithering with reduced colour bleeding. In the Windows Explorer this looked promising, the image quality had hardly been reduced but the size was halved.

But when they were imported to Unity, they were exactly the same size. And trying out different formats, there was not much noticeable difference between the image quality. Although the banding was a little bit less pronounced but still clearly seen.

EDIT 2:
I played around with the importing settings. And the only conclusion I can come up with is: Don't use alpha! Without the alpha channel, there is no banding with the ETC-compression which is supported by all OpenGL ES 2.0 GPUs.

To have an alpha channel and no banding. I had to go all the way to RGBA 32-bit, which increased the texture file size to 64Kb compared to the no alpha channel ETC's 8Kb.

Here again: not much difference between the GIMP dithered and the RGB versions. So conclusion with this: Dithering in GIMP did next to nothing.

sentences:
understanding game networking I have been working on a real-time game, and am closing in on the point where I send and receive data. I have previously accomplished this before with a couple other test games, but I have never really learned the correct way to pass data from server to clients efficiently.

My question: What is the best practice for a real time game to pass data? I have my doubts that I should be sending an update every frame (currently running at ~30 fps), but in all honestly I dont know what is best.

Most of the games ive worked on have passed the data instantly when they happen and continue to update every frame. Any suggestions or advice? Ill post more info if needed as well.

Thank you

sentences:
Things to do to port game made for iOS in Unity to Android? I have just made my first game for iOS and submitted it to app store. I was thinking of porting my game to Android also. I would like to know things one need to do/remember to port game made for iOS in Unity to Android. How to handle different screen resolutions and pixel densities, optimizations required, etc. Any other suggestions and important things you think I should know?

EDIT:
Also, should I handle builds according to device resolutions or by pixel density?

sentences:
Clearing memory from variables? So, I've heard of the delete keyword, which clears variables that use the new or new[] keywords.

I have a class called Box, which I made a object of in my main.cpp.

What if I want to clear a variables memory in my Box object, from my main.cpp?

I've tried adding the new keyword to the variables, but the variable types has no default constructor so I can't use it on them :

b2Body* body = new b2Body;

Is there any way to clear the memory of a variable that looks like this :

b2Body* body = nullptr;

(note that when I want to clear it, it has assigned a value to it.)

Example :
In minecraft when an item is dropped on the ground, and it disappears after some time, I'm guessing it's texture variables, animations, stats etc is not saved?

This is what I want to do.

I want to remove the memory of a variable I no longer need to use.

sentences:
XNA/C# Shadows look strange in orthographic I have implemented shadows in to my game engine. They look fine when rendered in projection mode as a projected light, however I get a strange "blocky" look when they are put into orho'. I will be rendering much bigger scenes (MMO size maps, for example) and Ive heard that rendering in orthographic for the shadow map will give a better result, and it does in some ways. I dislike rendering with projective perspective as you can see the view frustum, whereas this doesnt happen with orthographic.

Here is the code I have for rendering every update:

    public void UpdateLightData()
    {
        Matrix lightsView;
        Matrix lightsProjection;
        ambientPower = 0.2f;
        lightPower = 2f;

        cameraFrustum.Matrix = player.view * player.projection;
        lightPos = new Vector3(0, 30, 0);
        lightsView = Matrix.CreateLookAt(lightPos, new Vector3(-2, 3, -10), new Vector3(0, 1, 0));
        lightsProjection = Matrix.CreateOrthographic(Globals.device.Viewport.Width, Globals.device.Viewport.Height, 0.1f, 100f);
        //lightsProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, 1f, 5f, 100f);

        lightsViewProjectionMatrix = lightsView * lightsProjection;
    }

Here is a screenshot of ProjectionPerspective:
https://www.dropbox.com/s/yen671frsft4kdl/Screenshot%202015-03-07%2016.00.32.png?dl=0

Here is what it looks like in orthographic:
https://www.dropbox.com/s/jj6h4zgodda38fe/Screenshot%202015-03-07%2016.01.19.png?dl=0

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:
HumanIK Z axis Up in Maya for Unreal Engine I am pretty stumped! I want to use HumanIK in Maya to throw together some prototype animations for my game that is being developed in Unreal Engine 4.7

The issue is that Unreal requires Z axis to be UP and this results in HumanIK Skellies to end up on their backs in Maya when Created.

Is there a way to Configure HumanIK to use Z axis as Up?

Or is there another way around this? I see plenty articles on studios using HumanIK for Unreal so I must be missing something really silly in regards to this issue!

Any help will or suggestions would be greatly appreciated!

sentences:
IK handle for 'Back' bones. Allowing me to move body downwards and have the knees bend So I've followed several tutorials and documentation about rigging my humanoid character in Maya. I've had the same problem with the automatic rig from Mixamo, as well as my own one I just made following the Maya official docs.
I have IK Handles for the legs and arms, they work as expected. But I have seen in some peoples videos they can move the root or lower-back bone downwards and have the characters knees bend with the feet staying correctly grounded.
When I move the root down, as I expected, the whole skeleton just moves down. I tried adding some other ik handles along the spine and hips and lots of variations. If I move the Pelvis, the torso just crunches down into the hips area and the legs dont bend.
The actual cause for me to need my own rig was I need a skiing 'hunched' animation for my character and Mixamo didn't have one.
I've tried maybe 4 or 5 different rig hierarchy already now and always the problem is there. I tried binding my leg joint chains to the pelvis (and the 'back root' which was what is recommended).
So to be clear I want to be able to move the root of the body down and the knees just bend without me modifying each joint. This video shows someone whose character does this (I've pasted it time-stamped at the specific time, you only need to watch 5 seconds, i suggest muting the voice! https://youtu.be/i8cmDK_O-1g?t=70)
Here are some screenshots showing my rig and the outliner showing joints and ikhandles etc:

How can I make my character bend like the guy in the video?
Honestly I have spent a whole day watching videos and reading about this. But none of them seemed to help me with this specific problem. Your help is massively appreciated.

sentences: calculate new vertex position given a transform matrix? How can I get the new position of my vertex given a 4x4 transform matrix or simply 9 floats (positionX, positionY, positionZ, rotationH, rotationP, rotationR, scaleX, scaleY, scaleZ)? Usually I can assign the matrix to my final mesh (or "node", or "object", or "geom"), but right now I need to do it manually.

sentences:
What features should a moddable game have to make it easy to mod? One of the objectives I have for a tactical RPG I'm making is moddability. My hope is that anything can be replaced with custom code.

For example: you can replace the combat system I did with, say, rules from other systems, like the combat system in tabeltop RPGs like d20 or Pathfinder (with enough perseverance, coding the whole thing), and just let the game use that, even though I'm not really sure how to go about designing my game to support that.

I don't have much experience with mods, save for trying out a few in Oblivion and Skyrim (*ahem* caliente, ENB mods, etc.).

So, to modders out there, what are the features that's there in easy-to-mod games that you like, that make you think "wow if this didn't exist, making my mod would have been almost impossible". Stuff that just isn't there in games where you have a bad modding experience?

To start off, here are my initial thoughts:

I'm thinking of adding a Lua interpreter in my game, giving various objects in the game script access.
Resources will be saved in text format (in JSON). For example, behaviour trees will be serialized in JSON text files that can be edited. An in-game visual editor will also be provided.
A mod manager for the game will likely be good also (like BOSS in Oblivion).
The idea of "mod packages" for easy distribution.

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:
Effects to make a speeding spaceship look faster I have a spaceship and I've created a "boost" functionality that speeds up my spaceship, what effects should I implement to create the impression of high speed?

I was thinking of making everything except my spaceship blurry but I think there would be something missing. Any ideas?

Btw. I am working in XNA C# but if you aren't familiar to XNA describing some effects is still useful.

The Game is 3d and i've attached some printscreens of the game

This is in normal mode ( none boosted )

and here is the boosted mode ( the craft speeds up forward while the camera speeds in its normal speed , the non boosted speed )

sentences:
Image Not Loading Crafty.js I am experimenting with Crafty.js, and I have called .image() on an entity, and the image is not loading. When I look through the web inspector, I can see that the cloud entity exists, and that the cloud image is found, but it is not showing up. What is the proper way to load an image on an entity, and what is wrong with my code?

mainCrafty.js:

Crafty.e('myCloud, 2D, DOM, Image')        // cloud
        .attr({x: 300, y: 10, w: 45, h: 30})
        .image('images/cloud.png');

Here is the directory structure:

index.html
images/
   cloud.png
scripts/
   crafty.js
   mainCrafty.js

sentences:
Is the way I remove objects causing a memory leak? The game I'm working on consumes memory, and the memory used in megabytes increases around 2MB every 4 seconds.

It starts at 5MB and grows to hundreds of megabytes in minutes.

I was careful, and have little to no new variable declarations in the main game loop (and the existing ones are integers and floats, not SDL_Surface's and images).

However, I keep creating new instances of classes, such as bullets and enemies, but I'm also careful with those:

/* Is a bullet out of the screen? Remove it from the list! */
for (i = 0; i < bullets.size(); i++) {
  if (!bullets[i].is_on_screen(screen))
    bullets.erase(bullets.begin() + i);
}

I remove them from the respective vectors when they are no longer needed, and with enemies too:

/* Is the enemy death? Put it out of the array! */
for (i = 0; i < enemies.size(); i++) {
  if (enemies[i].health <= 0) enemies.erase(enemies.begin() + i);
}

Also, I create new Enemy(ies) with an image, but I only load the image on the beginning of the game, and then pass a pointer of it to the newly created class, so that it can draw it. I'm not creating hundreds of new images of enemies and bullets, am I?

When I erase the instances from the vectors, am I not fully deleting them from RAM?

sentences:
How to change object curve path in playmode in Unity? I would like to make some sort of this simulation below, where user can interact with the white rod and drag it into the magnetic fields, which in resulting the blue line that represent the magnetic field of the permanent magnet to move in semi-circular motion.

I managed to get that kind of effect using animation

I wish I do not have to make an animation for it by manipulation path for the sphere to be automatically correcting it's own path after colliding with the round object since the sphere will suddenly moving faster than usual when colliding with much bigger round object.

I have tried using splines etc, but most tutorial I've seen are not editable in play mode, which is I cannot alter any of the curve values inside my script. So can anyone could provide me some insight or another better alternative than this? I've been stuck here for three days now.

Thanks!

EDIT:

sentences:
Photon-Unity Instantiation not working I use Unity and Photon for the multiplayer. I Instantiate my gameObjects using this method :

void LoadGameObject(PhotonPlayer player,bool isMaster)
 {
  if (isMaster)
  {
    GameObject baby = PhotonNetwork.InstantiateSceneObject(babies[0].name,
    babies[0].transform.position, Quaternion.identity, 0,null);
    baby.SetActive(true);
    Debug.Log("playerpref created on " + player.ID);
  }
  else
  {
   //Nothing for the moment
  }
}

I call the method in "OnJoinedRoom()" and "OnPhotonPlayerConnected(PhotonPlayer other)", but when the second player join the room, he can't see the gameObjects because they aren't activated on his scene.

Any Idea of the mistake ?

sentences:
Minecraft Mod portable torch/lantern I have just started making a mod for minecraft, I learned how to make items and import custom png's and have gotten all of that to work. I have been searching around the code trying to find a way to make an item being held or in the inventory give off light around the player. I do have experience coding in java, but I am not well acquainted with the minecraft code.

(This is using mcp 5.6 with modloader in minecraft 1.1 with eclipse)

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:
What is instancing, and how can I update my graphics code to do it? This question directly follows on from this one:

How can I implement a renderer that can draw many kinds of primitives?

I have a small amount of drawing code structured in the following way:

A mesh object can be instantiated with different configurations of vertices and indices in order to form any desired shape. A reference to this mesh is then passed to every gameObject class, this class holds spacial information and a draw method that combines this data with that of the mesh to draw that object with the proper transforms.

The mesh is simply responsible for holding pointers to the appropriate buffers.

I was under the impression (wrongly I think) that because I actually only have one object of each type that I'm drawing multiple times, that this WAS instancing. I know this isn't the case.

What EXACTLY is the difference between what I'm doing and hardware instancing and what changes do I need to make to achieve it?

sentences:
How do you make a particle system collision add a force to an object towards the particle system? I have a lightning particle that gets shot at the ground. I want the particles to collide with the object they hit and add an upward force. I tried just entering a negative force in the Collider Force tab but it defaults to 0. If anyone knows a way to do this it would be greatly appreciated!

Edit: I want to send the cube in the photo upwards by adding a force on its y-axis. The Particles should remain as they are.

sentences:
Unintended window opening when pressing Unity's "Submit" button I've been working on a top down 2D game for a while now, and yesterday I found a strange bug that I just can't explain to myself whatsoever. I have a loot window for looting enemies, as well as a character panel to equip gear/see stats. I realized that after I open and close a loot window, if I press the space button (used for attacking, not for opening any windows) while holding A/LeftArrow or W/UpArrow it opens the character panel. Once this happens, I can press space to open/close the character panel.

Went to the character panels OpenClose() function (all it does is set the canvas group alpha to 0 and block raycast to false and vice versa) which is being called unintentionally, put a debug.log inside to verify if it really was being called, and yes, it is. I look up all references to see where I used it, but I only use it in a single place in the project that is behind an if-statement looking for they keycode C (NOT space). I added a debug.log for the Input.inputstring to see if somehow a magic C button press is ending up in that function, but no. If I press C to open the window, the debug log pops up, if I press space, the inputstring appears to be empty, so the if statement to get to the only place in the code referencing that function cannot be met. Removed the space button from my Player entirely, the behaviour still persists.

Added another debug.log with stackTrace.GetFrame(1).GetMethod().Name to show who is actually running this function, but it turns out that if I run it and press C, it says it's being opened by the update function in the UIManager (as expected). If I run it the strange, unintended way, it says it is being run by the EventSystems Invoke function. Coupled with the fact that the behaviour persists despite the space button being removed from the player, I realized that it's Unity's built in "Submit" button being pressed.

Strange behaviour:

It appears to call the submit function on the OpenClose button for the character panel, but only under the circumstance that I closed a loot window and haven't clicked the mouse anywhere yet afterwards. If I deactivate the button that holds the character panels OpenClose function, the behaviour stops. The button shouldn't be pressed though, because it is on a canvas group with alpha 0/block raycast=false, just like all the other buttons with the identical function that work fine. The loot window has no idea about the character panel either, and all the windows are properly wired to their own OpenClose function.
Upon further inspection, the window only starts showing up if, after closing a loot window, i press A/LeftArrow+Space or W/UpArrow+Space. This is getting more and more confusing for me.

So basically my issue is; how do I figure out why this function is being called? It feels as if closing the loot window somehow "caches" the OpenClose button for the character panel onto the submit button, but only until I click elsewhere on the screen. Did you guys have any experience with a similar situation? Could you share some pointers on how to debug this? What is the "submit" button usually used for, and what would make it only work in combination with the left/top directional buttons?  I've spent about 4 hours on this now and don't know how to get any further.

sentences:
Special character's with LibGDX's I18NBundle such as "ü" or "ö" are marked as unknown I am loading my I18NBundle like this :

    assetManager.load("i18n/language", I18NBundle.class);
    assetManager.finishLoading();
    i18NBundle = assetManager.get("i18n/language", I18NBundle.class);

When I get(String key) the values of the german localization I get these symbols for the ü and ö characters. This is what it looks like when I use the debugger to see the mapped values :

In-game, it will display Huser instead of Häuser.

The french localization works fine with é and è. So I'm quite confused as why only the german localization fails.

sentences:
How to capture image from camera with post effects? Mysteriously only get emission(?) pass I have a separate camera from my main camera, whose purpose is to take screenshots, or render a "live feed" of the action, at different angles.  Hierarchy as such:

The game object labeled as "main camera" captures the 3D scene just like a normal main camera would, including post-processing components.

The GUI camera captures just the UI layer.
The canvas and image are simply a watermark, rendered by the GUI camera.  I have removed this and it has no bearing on the issue at hand.

I point both the main camera and GUI camera to the same target render texture.  The result of the render texture appears to be correct in the inspector.

One way or another, it appears that I can only get access to the "bloom," and nothing else:

(On black so it's easier to see.)
If I assign the render texture onto a Raw Image canvas element, it only shows the "bloom."
If I try to convert the render texture to a regular texture, it also only shows the "bloom."
RenderTexture.active = renderTexture;
destination.ReadPixels(new Rect(0f, 0f, renderTexture.width, renderTexture.height), 0, 0);
destination.Apply();

(I have also tried AsyncGPUReadback.  Its resulting texture looks like a flat gray without variance in the inspector.)
I have found if I disable post-processing, everything works as intended, no changes required.  Of course, I am missing the post processing, which I want!
Somehow, somewhere, Unity is getting data external of the texture itself, depending on context:

Using Unity's ReadPixels method only picks up the "bloom."
Using Unity's EncodeToPNG method only picks up the "bloom."
Putting the RenderTexture on a Raw Image only picks up the "bloom."
If I use a separate PNG encoder using the same Color32 data, I get the final correct image.
The inspector successfully renders the final correct image.

I have actually run into this issue multiple times, and never found a proper solution, and definitely never a real-time solution, which I now desperately need.

sentences: Will a Game written using HTML5 work on smartphones? I would like to write a game that could be played on smart phones and was wondering if HTML5 might be a way to write games to work on a wide selection of smart phones.

sentences:
How to display the counter in pygame.time.set_timer? in pygame, we use pygame.time.set_timer() to repeatedly create an event. This function takes 2 arguments : the event type and the delay time after which the event occurs in milliseconds.
For my case, that delay time is the reload time. So, i'm looking for a way to display that reload time on the screen. This is what i tried :
...
pygame.time.set_timer(pygame.USEREVENT+1, time)
...
reload_time = myfont.render(time, True, 'black')
myscreen.blit(reload_time, (670, 650))
...
pygame.display.flip()

This resulted in displaying the time delay value forever (it's not decreasing or resetting)
So what should i do?

sentences:
What is the relationship between Frames-Per-Second and a game loop? What is the relationship between FPS - Frames Per Second and a game loop?
I'm confused how my book is using theses terms.

sentences:
SharpDX.Toolkit setting constant buffer I am trying to use a constant buffer in a program using SharpDX.Toolkit. I use the Toolkit because it has nice font support for writing on the screen.

The problem I face is in assigning data to the constant buffer.

In the screen below you may see a debug of my code. When it comes to the Draw event the buffer gets empty (obj:9 is active) and in Geometry Shader all values are 0.0f. On event 76 - GSSetShader the obj:16 is active, which contains the data I want to use, non-zero values. I have no idea why it gets overwritten/cleared. I tried assigning or updating buffer in numerous places in the draw method, but none of them helped. For sure it is not a problem of a slot, as in the debug window both (populated and empty) buffers are in slot 0.

NOTE: this way of loading data to constant buffer worked before I switched to using Toolkit, but then the device was explicitly created with SwapChain. I am not so experienced to tell if it may make any difference.

In my effect file I have defined the buffer as

cbuffer ConstantBuffer : register(b0)
{
    float slideX;
    float sinPi075;
    float cosPi075;
    float scaleK;
}

and in the main program

[StructLayout(LayoutKind.Explicit, Size = 16)]
struct GS_CONSTANT_BUF_DATA
{
    [FieldOffset(0)]
    public float slideX;
    [FieldOffset(4)]
    public float sinPi075;
    [FieldOffset(8)]
    public float cosPi075;
    [FieldOffset(12)]
    public float scaleK;
};

followed by

private SharpDX.Direct3D11.Buffer _constantBuffer;
private GS_CONSTANT_BUF_DATA constData;
private int sizeOfconstData;
private SharpDX.Direct3D11.Device _device;
private void InitializeConstantBuffer()
{
    System.Diagnostics.Debug.WriteLine("InitializeConstantBuffer");
    constData = new GS_CONSTANT_BUF_DATA
    {
        slideX = 0.0f,
        sinPi075 = (float)Math.Sin(Math.PI * 0.75),
        cosPi075 = (float)Math.Cos(Math.PI * 0.75),
        scaleK = 0.003f
    };
    _device = (SharpDX.Direct3D11.Device)GraphicsDevice.MainDevice;
    sizeOfconstData = Utilities.SizeOf<GS_CONSTANT_BUF_DATA>();
    _constantBuffer = new SharpDX.Direct3D11.Buffer(
                                       _device
                                     , sizeOfconstData
                                     , ResourceUsage.Default
                                     , BindFlags.ConstantBuffer
                                     , CpuAccessFlags.None
                                     , ResourceOptionFlags.None
                                     , 0);
    _device.ImmediateContext.GeometryShader.SetConstantBuffer(0, _constantBuffer);
    _device.ImmediateContext.UpdateSubresource(ref constData, _constantBuffer);
}

Draw method in the main program

  protected override void Draw(GameTime gameTime)
    {
 GraphicsDevice.Clear(Color.CornflowerBlue);
 for (int i = 0; i < technique.Passes.Count; ++i)
    {
     _device.ImmediateContext.GeometryShader.SetConstantBuffer(0, _constantBuffer);
    _chartGeometry.Draw(
                        GraphicsDevice
                      , SharpDX.Toolkit.Graphics.PrimitiveType.LineList
                      , technique.Passes[i]);
    }
}

And the Draw method associated with _chartGeometry

 public void Draw(GraphicsDevice graphicsDevice, PrimitiveType primitiveType, EffectPass pass)
    {
        if (pass != null)
            pass.Apply();

        // Setup the Vertex Buffer
        graphicsDevice.SetVertexBuffer(0, vertexBuffer);

        // Setup the Vertex Buffer Input layout
        graphicsDevice.SetVertexInputLayout(InputLayout);

        graphicsDevice.Draw(primitiveType, 4, 0);
    }

I have also tried changing buffer to dynamic, and hence, changing UpdateSubresource to Map/Unmap. The result is the same, see creen below, this time obj:16 (has data) and obj:8 (does not).

and while debuging GeometryShader locals show

sentences:
DirectX11 Using Multiple Shaders I currently have a scenario where I am rendering terrain with a shadow map.  I have two passes, one for the depth buffer to create the shadow map (which is rendered to a texture) and a second that takes the shadow map texture as input and actually shadows the terrain, the terrain gets drawn once for each pass.  Within the second shader I also texture the terrain.

I now want to split the second shader so that shadows and texturing are separate shaders.  How do I go about getting the output from the shadow shader to the texture shader (or vice versa), or do I simply do it in the same way as I have with the shadows (rendering to a texture, passing it as an input).

sentences:
Control diamond square algorithm to generate islands/pangea I generated a height map with the diamond square algorithm. The thing is i do not manage to create islands, this is, restrict the height other than water level range to a certain value in the center of the map.

I manualy seeded a circle in the middle of the map but the rest of the map still receives heights over the water level.

I dont fully understand the Perlin noise algorithm so i'd like to work with my current implementation of the diamond square algorithm which took me 3 days to interpret and code in PHP. :P

UPDATE:

I'm trying to get a gradient and its working (it's late and have to refine it, i'll try tomorrow). I tried to work with gradients but silly me, I had been clamping the affected values to a radius, giving me a circle when generating the map.

The seeding option is NOT working. I may get some bigger landmass, but may be located in any sector in the map, not even close to the center.

Please have in mind that the DSA generates the middle value averaging it's corners, so its not possible to seed the middle of a square.

a     b
   f
c     d

f = (a+b+c+d) / 4 + random(-value,value)

Perhaps that's why seeding it's not working.

sentences:
Leaderboard Testing on Google Play Services I have a shared Google Play Developer account so that he allowed me to publish a game app. Next, I want to know if in order to test the online highscore is to upload the APK and publish it first before adding a new game at the Game Services section.

One thing, according to this link and this link on setting up Google Play Services, these tutorials on implementing code for the leaderboard is possibly applied on the Manifest. Is it still the same in Unity if I added the lib folder onto the plugins folder of the Unity project and how?

sentences:
World Space canvas rendering in front of line mesh I'm attempting to attach a pointer to my steamvr controller to simplify world interactions. I'm very new to unity, but found a nice volumetric line asset (VolumetricLines) that aesthetically is exactly what I want. However, it seems to be rendering behind my canvas, as you can see here:

The canvas is set to world space with the event camera set to the VR camera, and renders properly for all world objects except this line. The line also renders properly with all objects except this canvas.

What exactly is the mechanic that causes the line to render behind the canvas, when it renders in front of other game objects, and what could I do to fix the render order?

sentences:
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:
How do I correctly destroy a MobFox ad? Is anyone here using MobFox to display their Android app's ads?  I was previously using the AdMob SDK but recently switched to MobFox and while it only took a short time to integrate it, there are a few outstanding issues which I can't work out.

With the AdMob SDK, in my onDestroy method, I would have this line:

adView.destroy();

However, I've looked through MobFox but I can't see an equivalent, am I missing something?!

(there is all the usual pause();, resume methods etc..... just can't find a destroy() method)

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:
Tagging "regions" in rot.js map generator I'm working on a small roguelike and I'd like to be able to tag the various "regions" generated via the Map generators so that I can use it as a lookup to environment descriptions.  I see that there are "Rooms" that are generated in the dungeon generator algorithms, however I didn't really see anything similar in say, the cellular automata generator.  Is there a way to leverage the generator in rot.js, or am I stuck with manually determining if I'm in a particular open area (and breaking encapsulation of internal, private variables along the way)?
Basically, I'd like to be able to link up my player's location to the text you see at the bottom of , but can't seem to figure out how to do it generically.  I'm fairly certain I could use the 'Rooms' object in the first 2 screenshots, and everything else is a hallway, but I'm not clear on how I could get a particular 'region' in a cellular automata generator (or one of the maze generators, for instance).

sentences:
How can I merge multiple sprite into one sprite or texture using Unity3d? I have an avatar generator where someone can create a custom avatar with layers superimposed.
And in order to reuse this image multiple times, i want to merge all layers in one image.
Is there any way on unity3D to create this image.

I've already coded that :

atlas = new Texture2D (width, height, TextureFormat.RGBA32, false);
foreach (Sprite s in allSprite) {
        atlas.SetPixels (0, 0, atlas.width, atlas.height, s.texture.GetPixels (0, 0, atlas.width, atlas.height));
        atlas.Apply ();
}

My problem is to keep the transparency and not erase old layers where pixels are transparent.
The setPixels method replace old pixels in atlas by new one.
I can't loop over pixels because of the size of the image (1024*1024) and more than 6 layers.

sentences:
Is nVidia's CUDA suited to performing pathfinding calculations? I want to know if it would be worth executing pathfinding on the GPU (using nVidia's CUDA, or an equivalent) in certain situations, or whether it would be a wasted effort. The situation I imagine would be a headless multiplayer server responsible for finding paths for bots.

I'm specifically interested in A* pathfinding using navigation meshes, but if there is another pathfinding algorithm that would benefit more from GPU execution I'd love to hear it.

sentences:
How to make collisions occur between objects using the same script? Well what I’m trying to do is have cars travelling on the road. The cars have a trigger at the front and a hitbox at the back of the cars. What I want to happen is when the trigger hits the hitbox it compares the Variables for speed of the two cars in the collision, i.e. the make the car at the back slow down or equal the speed of the car in the front. However, what I am having trouble with is referencing the speed of both cars and comparing them. This is due to them both being prefabs using the same script. Which I’m learning means that I’m just referencing the same script and not the actual values of the individual car. But how could I get round this? Is it possible to have collisions occurring between objects using the same script?

    private void OnTriggerStay2D(Collider2D collision)
    {
        Debug.Log("TriggerStay");

        GameObject collidedParent = collision.gameObject.transform.parent.gameObject; // get parent transform and then its gameobject
        Traffic Col_speed = collidedParent.GetComponent<Traffic>();

        if (speed > Col_speed.speed)
        {
            Accelerate = false;
            ApplyBreak = true;
        }
        else if (speed < Col_speed.speed)
        {
            Accelerate = false;
            ApplyBreak = false;
            speed = Col_speed.speed;
        }

        if (transform.position.y > collision.transform.position.y)
        {
            turn = turn + 1;
            Debug.Log(this.gameObject.name + "someMessage");

        }
        if (transform.position.y < collision.transform.position.y)
        {
            turn = turn - 1;
            Col_speed.turn = 0;
            Debug.Log(this.gameObject.name + "someMessage");

        }
    }
    private void OnTriggerExit2D(Collider2D collision)
    {
        turn = 0;
        Accelerate = true;
        ApplyBreak = false;
    }

}

sentences:
Are there any good 2D fighting game engines that can be used to make a commercial product? I'm looking for a good 2D fighting game engine based on sprites. I really dont care much about which language that it is programmed in.  Specifically I'm looking for an engine I can use for a game I can sell later and could be exportable to different systems.

Something like 2D Fighter Maker or MUGEN would be great, but that could have a product sold using the tech.

sentences:
Filling of a multidimensional array with string I'm trying to fill a dropdown with a lis,t if some input is correct.

now when trying to create the list from a text file (to save the program) i should split the line on a comma so i have 3 settings for one asset:
For ex asset1,colour,used,broken.
the list should show the asset if the item is broken (0 is not broken, 1 is broken).

 public string[,,,] UsedAssetList;

string[] lines = System.IO.File.ReadAllLines(@"" + Application.persistentDataPath + "/assetlist.txt");
    cmbAssetNumber.ClearOptions();
    for (int i = 0; i < lines.GetLength(0); i++)
    {

        UsedAssetList = ***lines[i].Split(',')***;
        if (UsedAssetList[i,0,0,1] == "1")
        {
            list = new Dropdown.OptionData(UsedAssetList[i,0,0,0]);
        cmbAssetNumber.GetComponent<Dropdown>().options.Add(list);
        }
    }

The lines[i].Split(',')gives me the error:

Error   CS0029  Cannot implicitly convert type 'string[]' to 'string[*,*,*,*]'

I think everything is on point, except the filling of my list. any idea on how i can get this right?

EDIT: I was thinking the list should look like this: {{"asset1","Gold","1","0"},{"asset2","Green","0","1"} , ... }

EDIT: While the text file looks like:

asset1,Gold,1,0

asset2,Green,0,1

...

sentences: More efficient using invokerepeating or update? Im fairly new to unity development and I am working on repeating an enemy. I currently have the functionality working correctly in which I use invokerepeating to spam an enemy. Now, I have an if statement that drops a different enemy if a specific Item is hit. This functionality works in both invokerepeating and update. Could someone explain to me which one is more efficient? And why?

sentences:
XNA Textures dissappear when game window is resized [SOLVED] - See linked post in the P.S.

I have a set of Texture2Ds generated in the Load method with this function:

Texture Generation:

private Texture2D[,] createTextureSet(TileInfo[,] map)
    {
        Texture2D[,] texSet = new Texture2D[map.GetLength(0), map.GetLength(1)];

        using (SpriteBatch sprb = new SpriteBatch(GraphicsDevice))
        {
            for (int row = 0; row < map.GetLength(0); row++)
            {
                System.Threading.Thread.Sleep(10);
                for (int col = 0; col < map.GetLength(1); col++)
                {
                    RenderTarget2D renderer = new RenderTarget2D(this.GraphicsDevice, 300, 300);
                    System.Threading.Thread.Sleep(2);
                    GraphicsDevice.SetRenderTarget(renderer);
                    renderer.Name = map[row, col].buildings[0].buildingType;
                    GraphicsDevice.Clear(Color.Transparent);
                    sprb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
                    sprb.Draw(TextureFromFile(resourceDirectory + @"Images\Tile Backgrounds\" + map[row, col].tileType + @"\" + map[row, col].tileBackground + ".png"), renderer.Bounds, Color.White);
                    sprb.Draw(TextureFromFile(resourceDirectory + @"Images\Buildings\" + map[row, col].buildings[0].buildingType + ".png"), (Vector2)map[row, col].buildings[0].pointWithinTile, Color.White);
                    sprb.End();
                    texSet[row, col] = renderer;
                }
            }
        }

        GraphicsDevice.SetRenderTarget(null);
        return texSet;
    }

The tiles are drawn on the screen using the following code:

Texture Rendering

for (int tx = -1; tx < 2; tx++)
        {
            for (int ty = -1; ty < 2; ty++)
            {
                gameSpriteBatch.Draw(mapTextureSet[gameCharacter.characterTile.tileX + tx, gameCharacter.characterTile.tileY + ty], determinePositionToDrawTile(gameCharacter, map[gameCharacter.characterTile.tileX + tx, gameCharacter.characterTile.tileY + ty], tx, ty, resizeX, resizeY), null, Color.White, 0f, Vector2.Zero, new Vector2(resizeX, resizeY), SpriteEffects.None, 0f);
            }
         }

These textures are then drawn on the screen based on where on the map the player is. The game runs fine, until the game window is resized by the user. After that, only the character sprite remains on the screen during the redraws, and the screen remains the default Color.BlanchedAlmond background of my game. Any help is thanked in advance.

[ ! ] P.S. [ ! ]

Before marking this as a duplicate! I have looked at this and tried most of the applicable solutions from it, none of which have worked, so I assume that this error is deeper than that one.

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:
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:
Where can a game developer/programmer get freelance jobs? I'm a game programmer looking for freelance jobs online. I know that there are lots of sites for freelance jobs, but I haven't been lucky with them, I was wondering, which sites are the best for looking for jobs? I know that Freelance.com and upwork.com are some of them, but they ask a lot of profile information and, although I complete it, added a portfolio and have a low hourly rate price for starting (and, by the way, what would be an ideal hourly rate for a starter?) I can't get any jobs because the vicious cycle of not having reputation in the site because I'm not hired because I don't have reputation...

So, resuming the question: What would be the best sites/way to get a freelance job as a Game Programmer through the web?

Thanks!

sentences:
Why do XNA/Monogame models create new BasicEffect instances? My question is fairly straightforward, I think. Using Monogame, when I load a model using contentManager.Load<Model>("Model"), the model's mesh has a BasicEffect attached. That means that if I load multiple models, I'll have multiple BasicEffect instances created, which seems wasteful. Based on other questions I've seen here (and based on instinct), I shouldn't need multiple effects for rendering simple models, but those effects are created by the content pipeline when the model is imported.

How do I resolve this problem? Is there a way to tell Monogame to not create effects on load, or do I have to override the effects created by the models manually? Is there something I'm missing in my logic?

sentences:
How can i make my program use 2 windows? I'm working in Xna 4.0 and iwant to make a program that uses the same code in 2 different windows.
What i want out of this is that one player plays in one window and the other player to play in the second window.

So i have 2 different questions:

Is it possible to use 2 windows for the same program?

Is it possible for 1 window to have focus on one controller and the other window on the other?

sentences:
Internal Game Economy I need to set up a monetary system for my game however I am unsure how to craft an internal economy for that money. I want to make an rpg with a economy system that keeps the player for a time from just selling numerous of the same item to grind for money. So when the player sells to much of a certain item the buy price for that item will go down temporarily. Also, I would like to add a system where certain items go up in terms of what they can be sold for temporarily as well.

For example, in "Story of Seasons" I can sell items to vendors in order to get money, however if I sell to much of that type of item the price I get for it goes down. Also, there is a system where for a certain vendor or more the price I can get for the items actually increases.

sentences:
Update animation based on distance traveled instead of elapsed time? 2D sprite Animation is supposed to be based on the elapsed time from the previous update so that it runs (and looks the same) no matter the speed of the machine/device it's running on.

The method that moves my game objects already takes into account the elapsed time.  The distance the object moves during updates is the elapsed time (delta) * the objects velocity.

Because the object's location changes based on the elapsed time, would it look (/run the same on all machines) passing the "distance delta" to my Animation update method instead of the delta time?  The distance delta would be a number of pixels.  Using the distance would ensure my frame animation lines up with how far the object has traveled.

sentences:
How should the player unlock things? Imagine a mobile phone game that is meant to be played in short sessions (5-10 mins). You can choose one out of many characters, and each character slightly alters the way the game plays.

Those characters are all locked and have to be unlocked by purchasing them with in-game money.

Should the player be able to choose which one to unlock?

Besides the obvious benefit of being able to choose who you want to unlock, the downside of this method is that players often end up having choice paralysis: With tons of characters to choose from, the player will just not bother reading every character's pros and cons and make a choice.

Should the player just be able to unlock a random character?

This is a more casual friendly method, as the player will just spend their in-game money without thinking because there's no other options. The downside of this is that paying for a character that doesn't suit your playstyle may feel bad.

Other solutions?

Maybe you have another solution on your mind? Note that some characters make the game more high risk/high reward, aimed for veteran players, while other characters just make the game easier to play.

sentences:
Algorithm that cover one mesh by another mesh Suppose I have two meshes (Let call me  first MeshShirt and second - MeshBody)
Meshes are aligned (if i render both MeshShirt "covers" MeshBody). But some parts of the body are not "under" the MeshShirt (because MeshShirt shape differs from MeshBody)

How can i "pull up" parts of MeshShirt which are under MeshBody and hold other parts in their places? Of course i want  save shape of MeshShirt if it possible

I think about following algorithm

mark all points of MeshShire which under MehsBody by tracing
intersection of its normals and MeshBody.

But if MeshShirt "hidden" parts have complex shape normal tracing will not work. So some way to detect bad points is needed
move every marked
point to the plane of its nearest triangle of MeshBody.

But i afraid
that these algoritm may produce significant  deformation of MeshShirt.
So some shape preserved deformation is needed too.

Sorry for my poor English and fuzzy problem definition

sentences:
Drawing sprites only under certain conditions - alternatives to using 'if statements'? Within my game (which is Java/Android), I wish to draw a sprite only under certain conditions, so up until now, I've been using if statements to accomplish this.  Something like so:

if (powerUpActive){

    draw(shieldSprite);

}

So the above, uses a simple boolean primitive (powerUpActive) and only draws the sprite (shieldSprite) when the boolean is true.

This works, however, my logic code is littered with if statements and I'm not sure this is a good thing.  I keeps reading that too many if statements are a bad thing however, I can't work out how to accomplish this without using them.

Note, the above is just an example, I use many other boolean flags in my code

The only alternative that I can think of is to use a batch of sprites where I can specify the number to draw. (This is OpenGL ES 2.0 so I use a for loop to upload the vertices for the sprites I want to draw within the batch).  If I simply set the number to draw to 0, it won't draw any. However, it seems a little overkill to use a batch when I know there will only ever be one sprite in it.

public void draw(){

    for (int i = 0;i < numberToDraw; i++){

        //Code here to upload vertices
    }

    //Code here to draw sprite (draws nothing if numberToDraw is set to 0)

}

So I'm really not if there is a better way do things in java on condition without using if's or switch statements.

sentences: how large should a map be in blender I'm learning blender and am wondering what size(blender units) I should be making my characters and maps. should i consider 1 blender unit as 1 inch, foot, meter or does it not not matter?

sentences:
How can I put Google Ads in a flash game? What I want to do is put Google Ads in my flash game.

The first question is how can I do that?

The second question is the best place to put it; while loading, after finishing the game?

sentences: .PNG tiles to .PNG map I was wondering how I can get my 110+ .png map tiles conveniently into a 1:1 pixel ratio size map .png. I've been scrolling through Google and forums for the free ware game that I am modding, but the app I'm using recognizes only .png files, and I want more than 1% of the map. If you guys know of a program I would be very appreciative.

sentences:
How to reset the score to 0 when reloading the game? My scoring system uses DontDestroyOnLoad to persist between scenes:

public class ScoringSystem : MonoBehaviour {
 private int score = 0;

 public void Correct(int number){
     // If correct add score;
     score = score + number;
 }

 void Start () {
     score = 0;
 }

 void Awake() {
   DontDestroyOnLoad(transform.gameObject);
 }

 public int GetScore(){
     return score;
 }
}

Here is another script that I should include a description about:

  public void iniTag()
 {
     jawab = true;
     Time.timeScale = 0;

         GameObject objek1 = GameObject.FindGameObjectWithTag("Benar1");
         GameObject objek2 = GameObject.FindGameObjectWithTag("Benar2");
         GameObject objek3 = GameObject.FindGameObjectWithTag("Benar3");
         GameObject objek4 = GameObject.FindGameObjectWithTag("Benar4");

         if (objek1.transform.parent.tag == "Jawab4" && objek2.transform.parent.tag == "Jawab3" &&
             objek3.transform.parent.tag == "Jawab2" && objek4.transform.parent.tag == "Jawab1")
         {
             PanelBenar.SetActive(true);
             buttonNext.SetActive(true);
             GameObject.Find("QuizManager").SendMessage("Correct", playerScore);

     }}

     void Start () {
       if (GameObject.Find ("QuizManager") != null) {
         ScoringSystem scoringSystem = GameObject.Find ("QuizManager").GetComponent<ScoringSystem> ();
         gameObject.GetComponent<Text>().text = scoringSystem.GetScore().ToString ();
             } else {
         Debug.Log("No Scoring system found. To test scoring system start from the front page scene");
       }
     }

sentences:
What technique should I use to implement the following type of "diggable" terrain? I'm trying to replicate a certain game mechanic from the game Diggles.
This game takes place in a vertical cross-section of the earth and allows the player to dig tunnels and caves into the environment.
You can see this bevhaviour in action in the following Let's Play on Youtube.

https://www.youtube.com/watch?v=3lIN37JyNTU&t=7m40s

My question is: How can I implement such a modifiable terrain?

My first idea would be to keep a copy of the vertex and index buffer in memory, modify it accordingly and send it to the gpu each time it is modified. However, this seems very inefficient considering the size of the map and how often it would need to be updated.

sentences:
Why wouldn't one use Canvas for HTML 5 game development? I'm just getting into the HTML 5 game development. I've discovered that some games seem to be created using just JS/CSS/HTML instead of the canvas.

Since canvas seems to enjoy good browser compatibility (http://caniuse.com/#feat=canvas), I'm wondering why someone wouldn't use it?

sentences:
Unexpected results with D3D9 depth bias I've run in to some problems with the D3DRS_DEPTHBIAS render state after converting an older game's D3D8 renderer to D3D9.

D3D9 replaced the old (and poorly supported) D3DRS_ZBIAS with D3DRS_DEPTHBIAS, but it doesn't seem possible to get it to work the same way that ZBIAS did. This game renders shadows and other "decals" onto the ground as flat textures, and to avoid the obvious z-fighting issues that would result would set D3DRS_ZBIAS to 2 when rendering decals in the D3D8 renderer (which I did not write).

The best approximation of the old D3D8 behavior that I've been able to come up with is setting D3DRS_DEPTHBIAS to -0.00003 when rendering shadows. This works fine for shadows on flat terrain that are relatively close to the camera, but when the camera is far above a shadowed object, the shadow will draw on top of the object itself. This can also happen even on near objects if they are on uneven terrain.

It doesn't seem possible to solve this by manipulating the DEPTHBIAS value alone, as no change fixes it entirely without causing other problems.

Is there any way to solve this? Failing that, is there a more modern technique for rendering decals that could be used? I would much rather avoid lots of rewriting as I'm not very familiar with D3D and didn't write any of the original code, but if that is the only option...

sentences:
How to create a forest game scene in unity3d? I am pretty new to game development. I have started using unity3d.

I have created simple games for which I have used plane (3d gameObject). Now, I want to move a step forward I want to create a forest with mountain and trees. So, I went through few tutorials and concluded terrain (3d Object) will be best fit.

Issue: My player falls down from the terrain due to gravity and if i disable gravity then my player flies up in y axes when moved over mountains. What is the way i can create terrain with gravity and so that my player doesn't fall from the terrain.

Can anyone throw light on how do overcome above mentioned issue.

sentences:
How can I find a bounding box for a bezier curve I am using the code from the question Adding functionality to make individual anchor points of bezier continuous or non-continuous to create bezier curves (I added a line renderer).

How can I find the center of the curve for multiple cubic Bézier segments, where the centre of a bounding box is the centre of the curve (as in the image below)?

sentences:
Differences between Unity/UE shaders and Opengl Shaders At first, I thought that they are the same, shaders in game editor write by programmers(or use some graph flow tools nowadays) just get compiled into opengl shaders.

But now I'm writing my own render engine, and found that my engine's shader should not be replaced, since it will do the coordinate transformations.

So, is a shader in Unity/UE the same thing as a shader is in Opengl?

In other words, does the shader in game editor directly change the shaders in the pipeline, or it just use some technical to insert into the render's own shaders?

sentences: Can LWJGL support multiple displays Can LWJGL support multiple displays either as separated windows or as part of an AWT Window?

sentences:
Why is 3D game development supposed to be so hard? This may be kind of a dumb question. I have little experience in programming and no experience in game programming. I've only done simple "if, then" programming and simple circuit board chip programming. I do have experience with graphics software similar to  3DS Max. I was wondering what makes programming a game so difficult. All I want to create is a game world the size of a room with earth like physics such as gravity. More of a physics simulator than a true game. Would that be very difficult?

From what I've read it sounds like it would be difficult but I don't know why. I know the physics and have the graphics and rendering experience. Why is it supposed to be so difficult? Is C++ just really hard to learn or am I missing something. I'm curious because I'm considering learning C++ but don't know if it's worth it.

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:
XNA - 3D AABB collision detection and response I've been fiddling around with 3D AABB collision in my voxel engine for the last couple of days, and every method I've come up with thus far has been almost correct, but each one never quite worked exactly the way I hoped it would.

Currently what I do is get two bounding boxes for my entity, one modified by the X translation component and the other by the Z component, and check if each collides with any of the surrounding chunks (chunks have their own octrees that are populated only with blocks that support collision). If there is a collision, then I cast out rays into that chunk to get the shortest collision distance, and set the translation component to that distance if the component is greater than the distance.

The problem is that sometimes collisions aren't even registered. Here's a video on YouTube that I created showing what I mean. I suspect the problem may be with the rays that I cast to get the collision distance not being where I think they are, but I'm not entirely sure what would be wrong with them if they are indeed the problem.

Here is my code for collision detection and response in the X direction (the Z direction is basically the same):

// create the XZ offset vector
Vector3 offsXZ = new Vector3(
    ( _translation.X > 0.0f ) ? SizeX / 2.0f : ( _translation.X < 0.0f ) ? -SizeX / 2.0f : 0.0f,
    0.0f,
    ( _translation.Z > 0.0f ) ? SizeZ / 2.0f : ( _translation.Z < 0.0f ) ? -SizeZ / 2.0f : 0.0f
);

// X physics
BoundingBox boxx = GetBounds( _translation.X, 0.0f, 0.0f );
if ( _translation.X > 0.0f )
{
    foreach ( Chunk chunk in surrounding )
    {
        if ( chunk.Collides( boxx ) )
        {
            float dist = GetShortestCollisionDistance( chunk, Vector3.Right, offsXZ ) - 0.0001f;
            if ( dist < _translation.X )
            {
                _translation.X = dist;
            }
        }
    }
}
else if ( _translation.X < 0.0f )
{
    foreach ( Chunk chunk in surrounding )
    {
        if ( chunk.Collides( boxx ) )
        {
            float dist = GetShortestCollisionDistance( chunk, Vector3.Left, offsXZ ) - 0.0001f;
            if ( dist < -_translation.X )
            {
                _translation.X = -dist;
            }
        }
    }
}

And here is my implementation for GetShortestCollisionDistance:

private float GetShortestCollisionDistance( Chunk chunk, Vector3 rayDir, Vector3 offs )
{
    int startY = (int)( -SizeY / 2.0f );
    int endY   = (int)(  SizeY / 2.0f );
    int incY   = (int)Cube.Size;

    float dist = Chunk.Size;
    for ( int y = startY; y <= endY; y += incY )
    {
        // Position is the center of the entity's bounding box
        Ray ray = new Ray(
            new Vector3(
                Position.X + offs.X,
                Position.Y + offs.Y + y,
                Position.Z + offs.Z
            ),
            rayDir
        );

        // Chunk.GetIntersections(Ray) returns Dictionary<Block, float?>
        foreach ( var pair in chunk.GetIntersections( ray ) )
        {
            if ( pair.Value.HasValue && pair.Value.Value < dist )
            {
                dist = pair.Value.Value;
            }
        }
    }

    return dist;
}

I realize some of this code can be consolidated to help with speed, but my main concern right now is to get this bit of physics programming to actually work.

sentences:
Rendering part of an equirectangular video on a plane For a Unity project I have a 360 camera which produces an equirectangular video.
I need to realize preview of this video for putting it on a plane.

In most cases the part of the video to be drawn on the plane is the central part of the video, which is not so stretched and so it can be drawn as is. In some cases, instead, the camera has to be put above the scene, upside down, in order to capture the scene below, as shown in the following image.

In this kind of situation I need to produce a preview from the upper part of the video; in other words I need to project a portion of the upper part of the video on a plane.

I imagined two ways, the first one is easy but not so effective, the second one is tricky but surely better.

I project the video on a sphere and capture, with a virtual camera, the interesting part, which is taken and rendered on a plane.
I write an appropriate shader which, given the equirectangular video, crops the portion of it and draws it correctly on a plane.

May you give me a hand on writing the shader?

sentences:
UI Button Click Animation We have animation states for Normal, Highlighted, Pressed and Disabled. How to set animation when a button is clicked?(after button released not pressed)?

Thanks in advance

sentences:
Monogame render between constraints I have, in MonoGame, a project for which I require the game to not use the full screen depending on the resolution. The game elements etc all behave as they should (So they bounce off for example between 25% and 75% of the screen, instead of the edges). Yet I'm trying to draw a background between these two constraints, and it doesn't work.

To draw the background I am using the following code

spriteBatch.Draw(Background, new Rectangle(leftEdge,0,rightEdge,top),Color.White);

Yet when running the game, the image starts at "LeftEdge" but goes beyond "rightEdge". How would I go about scaling the image appropriately in this scenario?

sentences:
Why do I get "UObject" has no member "BeginPlay" errors? I loaded up UE4 to work on a new project. I created two C++ classes, one for a bullet, one for a cannon. Upon loading into Visual Studio 2015 I immediately get the error:

  "UObject" has no member "BeginPlay"

Keep in mind I have not written a single line of code. This error just popped up. I have not written a single comment, a single variable, I don't even get to enter some white space so that I have room for new code. I just get the error. I tried remaking the project with different settings (like a blank project, third person, et cetera) and I keep getting that error.

sentences:
How do I project the Earth globe on a flat plane with minimal distortion? I want to build a game where the game map is the planet Earth.
The game map needs to be on a 2d plane, with the Earth texture projected on it
If the player walks endelessly in one direction, it should just run laps around the Earth.
I want to split the map in several small tiles and Load on Demand as the player walks

I'm not sure how to best solve this problem. What Map Projection do I use? From my research it seems like most maping apps like Google Maps, or OSM etc use variations of the Mercator Projection. I can't use that because, while the player would be able lap around the earth when walking east, he wouldn't be able to walk north. It won't tile vertically.

Then the Peirce Quincuncial Projection looked promising, it's a perfectly tiled projection. But the problem then becomes distortion is too extreme here. Some places don't look the same. I can live with a tiny bit of distortion, but this is too much.

Then I found another common solution was using a Truncated Icosahedron (probably subdivided into smaller tiles for LoD). This looks like the best alternative so far. But now my problem is I'm not sure exactly how I would work out the algorithm to take tiles from the 3d Icosahedron and tile them side by side on a 2d plane. That would look like this:

How would I stretch it to fill the holes?

Is there some other obvious solution I'm missing? How do games like Pokémon Go do this kind of thing?

sentences: Ara matrices calculated on the GPU or on the CPU? Would built-in matrix functions be faster than my custom ones? If I add a math library (for example containing a Matrix class) and use it in my program drawing with OpenGL, will my be work slower than if I used standard OpenGL functions for matrix calculations? Does the same hold true for DirectX?

sentences:
Weird issue in collision resolution of non-static bodies I'm a bit of a beginner in engine development, so I decided to write my own engine from scratch so I could learn more about what happens under everything.

I've been progressing fairly well, except the physics engine side of things have been giving me a bit of a headache.

Here's a gif of what I mean:

Essentially, the engine works just fine as long as the player is not colliding with another non-static body from either above, or from right to left.

Here's my collision resolution code written in go:

package resources

import (
  "game/pidgeot-socket/ecs"

  "github.com/bxcodec/saint"
)

type PhysicsSystem struct {
  Hub *Hub
}

func (system PhysicsSystem) Loop() {
  entities, err := system.Hub.World.AllEntitiesWithComponent(ecs.CollisionComponent)
  if err != nil { return }

  for e, _ := range entities {
    // apply impulse
    c_p, _ := system.Hub.World.GetComponent(e, ecs.CollisionComponent)
    c := (*c_p).(*ecs.Collision)

    p_p, _ := system.Hub.World.GetComponent(e, ecs.PositionComponent)
    p := (*p_p).(*ecs.Position)

    if c.WithGravity {
      // Add gravity
      c.ImpulseY = saint.Min(c.ImpulseY + 1, c.MaxSpeedY)
    }

    // apply impulse
    p.NextY = p.Y + c.ImpulseY
    p.NextX = p.X + c.ImpulseX
  }

  // resolving collisions
  for e1, _ := range entities {
    c1_p, _ := system.Hub.World.GetComponent(e1, ecs.CollisionComponent)
    c1 := (*c1_p).(*ecs.Collision)

    if c1.IsStatic { continue }

    for e2, _ := range entities {
      if e1 == e2 { continue }

      system.ResolveCollision(entities, e1, e2)
    }
  }

  // moving entities
  for e, _ := range entities {
    p_p, _ := system.Hub.World.GetComponent(e, ecs.PositionComponent)
    p := (*p_p).(*ecs.Position)

    if (p.X != p.NextX || p.Y != p.NextY) {
      p.X = p.NextX
      p.Y = p.NextY

      system.Hub.broadcast <- system.Hub.World.GetComponentMessage(e, p_p)
    }
  }
}

func (system PhysicsSystem) ResolveCollision(entities map[ecs.EID]*ecs.Component, e1 ecs.EID, e2 ecs.EID) {
  c1_p, _ := system.Hub.World.GetComponent(e1, ecs.CollisionComponent)
  p1_p, _ := system.Hub.World.GetComponent(e1, ecs.PositionComponent)
  c1 := (*c1_p).(*ecs.Collision)
  p1 := (*p1_p).(*ecs.Position)

  c2_p, _ := system.Hub.World.GetComponent(e2, ecs.CollisionComponent)
  p2_p, _ := system.Hub.World.GetComponent(e2, ecs.PositionComponent)
  c2 := (*c2_p).(*ecs.Collision)
  p2 := (*p2_p).(*ecs.Position)

  // resolve y-axis
  collidingX := IsOverlapping(p1.X, p1.X + c1.W, p2.X, p2.X + c2.W)
  collidingY := IsOverlapping(p1.NextY, p1.NextY + c1.H, p2.NextY, p2.NextY + c2.H)
  colliding := collidingX && collidingY

  if colliding {
    direction := func (impulse int) int {if impulse < 0 { return 1 } else { return -1 }}(c1.ImpulseY)
    overlap := CalculateOverlap(p1.NextY, p1.NextY + c1.H, p2.NextY, p2.NextY + c2.H)

    p1.NextY += (direction * overlap)
    c1.ImpulseY = 0
    c1.IsJumping = false
  }

  // resolve x-axis
  collidingX = IsOverlapping(p1.NextX, p1.NextX + c1.W, p2.NextX, p2.NextX + c2.W)
  collidingY = IsOverlapping(p1.Y, p1.Y + c1.H, p2.Y, p2.Y + c2.H)
  colliding = collidingX && collidingY

  if colliding {
    direction := func (impulse int) int {if impulse < 0 { return 1 } else { return -1 }}(c1.ImpulseX)
    overlap := CalculateOverlap(p1.NextX, p1.NextX + c1.W, p2.NextX, p2.NextX + c2.W)

    p1.NextX += (direction * overlap)
  }

  for e3, _ := range entities {
    if e1 == e3 { continue }

    c3_p, _ := system.Hub.World.GetComponent(e3, ecs.CollisionComponent)
    p3_p, _ := system.Hub.World.GetComponent(e3, ecs.PositionComponent)
    c3 := (*c3_p).(*ecs.Collision)
    p3 := (*p3_p).(*ecs.Position)

    collidingX = IsOverlapping(p1.NextX, p1.NextX + c1.W, p3.NextX, p3.NextX + c3.W)
    collidingY = IsOverlapping(p1.NextY, p1.NextY + c1.H, p3.NextY, p3.NextY + c3.H)
    colliding = collidingX && collidingY

    if colliding { system.ResolveCollision(entities, e1, e3) }
  }
}

Anything I could do to solve that issue?

sentences:
set zfar/znear in openGL using shaders (QT env) I have a QT canvas and I'm using shaders to build my scence.
I've set the camera image plane at some position, and would like to view object from the image plane to infinity. How do I set the zfar and znear values?

sentences:
create a city top view I want to create my first game with java. I need a top view map of a city and i am stuck. Randomly there will be happening events in that city and the player should click on it.

Now is my first problem how to create the map in java. I designed a small map with tiled but not sure how to use it now:

I want to use this in the java game. I am stuck. I want to let the events happen on the streets. How do i do this? I am looking for some good tutorials but i am not sure what i am looking for so i could use some help in that direction.

Sorry for my english :(

sentences:
Xna Particle Explosion like Geometry Wars I am making a game, in similar graphics display as Geometry Wars. In Geometry Wars (noticeable in the title, as well as when you blow up an enemy), there are these colorful explosions that emit, then fade away at the end. An example is this video. I know very little about particles. I already have an effect that will make objects glow (Bloom, if you didn't know). I would like to know if there is an Xna library that can do this effect. If not, is there code that I can use? Or some documentation that I could implement?

And also, could the code for the explosions be modified slightly to simulate the stream effect that the ship emits when it is moving around?

sentences:
C++ GameState management I have been attempting to make a game engine in C++ and have come across the dilemma of game state management. I have done a lot of research and found numerous ways of accomplishing from game engine with derived classes to using enums and I would like to know the most effective/efficient way of managing game states.

EDIT
I would like to know how other people implement their game state management, i.e. what you like the most and why you like it. Also, any tutorials/code examples that are generally about game state would also be much appreciated.

sentences:
How do you freeze your cursor in Unity? In a typical MMORPG, when I hold down the right click button and drag, the cursor disappears and stays in the same position.

How does one do that?

sentences:
How to combine the camera that follows the player and the camera shake effect in Unity? I need to combine both camera that follows the player and the camera shake effect in the same moment. The problem is in that, if I make the shake effect for the camera, then the camera doesn't follow the player and if I make the camera follow the player, then the shake effect doesn't appear. The basic idea of my script is next:`

Vector3 originalPos;
GameObject targetPlayer;
bool canShake;
void OnEnable()
 {
     originalPos = camTransform.localPosition;
 }

 void Update()
 {
         // Camera shakes
     if (CanShake)
     {
         transform.localPosition = originalPos + Random.insideUnitSphere * shakeAmount;
     }
         // Camera follows the player
     else
     {
         transform.position = new Vector3(targetPlayer.transform.position.x, transform.position.y, transform.position.z;
     }
 }

Does anyone have ideas how to combine these two things (camera shake effect and camera that follows the player) at the same moment?

sentences:
Why are setcolor and color not reset When I do a color exchange directly on the material in playmode, but then I go back to editmode, why do the settings still remain?
For example:
mymaterial.SetColor("_Color", blue);
or
mymaterial.color = blue;

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:
Blender & Unity - Move texture with Bone in way that works with Unity? I created a character model in Blender with non-spherical eyes. The only way I can make the eye movement look good is if I move the pupil Image Textures along the eye meshes.

The way I've achieved the pupil movement in Blender is with modifiers, which Unity apparently doesn't work with. I've tried "UV Warp" controlled by bone and "UV Project" controlled by bone, and moving the eye bones in Unity does nothing.

So, I'm kind of stumped and desperate for something that will work for my use case. Any ideas that will be Unity-friendly, please?

sentences:
Textures created with Photoshop show up with a white border All of a sudden, I started having this problem. I've used libGDX + Photoshop before and never had this problem. One of my textures is showing up with a white border/glow around.

The texture is the black blob on the middle, which is a 256 pixels png with a few black brushstrokes I created with Photoshop, just to test it.

Everything in libGDX is on default. I haven't changed the blending function, I'm just using a SpriteBatch to render the image without any changes.

The weird thing is, some other textures I created with Photoshop, same size, RBG 8 bit color mode (just like my blob image), look fine. These are temporary textures I created by downloading a png from the web, pasting it into Photoshop, applying a solid color overlay effect to it and saving it back as a png.

Any idea what's causing this?

Edit: Here's how I'm loading my textures:

private static Texture createTexture(String fileName, boolean maxQuality, Texture.TextureWrap textureWrap) {
    Texture result = new Texture(Gdx.files.internal(fileName), true);
    result.setFilter(maxQuality ? Texture.TextureFilter.MipMapLinearLinear : Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.Linear); // TODO: Are these the best?
    if(textureWrap != null)
        result.setWrap(textureWrap, textureWrap);
    return result;
}

texture = new TextureRegion(createTexture("data/blob.png"));

I just found out using this technique that the transparent pixels in my texture are white (1, 1, 1, 0). So I'm pretty sure the cause is a combination of this, the linear resizing and probably the blending function. Not sure what's the right way to fix it though. Don't want to change the resizing to nearest.

sentences:
Checklist for finished game? I and a couple of friends are doing a game on our spare time and we've finished about 80% of the game.. so all the obvious stuff and core mechanincs. We've done a couple of games before and we always have problems finishing.

The problem isn't that we're not passionate enough about the game, it's rather that no one of us sees those last details that need to be added, we've become blind somehow with the game. It's really frustrating. It can be stuff like.. "maybe we should have a pause function?" "Uhh, yeah, of course, why didn't we think of that earlier?"

Sometimes even though it takes a long time to realise the need, afterwards it's really obvious that it needed to be done/added.

Do you use any kind of checklist to force a finish or do you rely on your keen senses to know when it's done?

A checklist would be nice to have when estimating project time as well..

sentences:
Contact friction for overlapping rectangles I am currently developing a top-down "tabletop simulator" where you are able to drag, drop and rotate playing cards on a table. The cards are able to overlap but do not interact as of yet. What I now want to implement is that whenever a card is being dragged over another card, that the bottom starts moving as a result of the dynamic friction between the overlapping cards. Right now I am thinking of two ways to approach this:

Determine the area of overlap and use the center of mass of this area as the point where the friction force is acting on
Rasterize the cards and determine the overlapping raster and let the friction force act on these points.

Unfortunately I expect these methods to be computationally demanding and was wondering if there are more efficient methods out there. So far I have not found any material referencing this type of problem. I assume it relates to determining the area of contact for 3D objects and applying a friction force.

sentences:
Is requirements analysis useful in game development? I'm a software engineering student with a game development focus. How big of a part does requirement analysis play in game development?

I'm asking because I'm trying to decide whether to take a class on requirements analysis. Here is a description:

  An in-depth study of current research and practice in requirements elicitation, requirements, analysis, requirements specification,requirements verification and validation, and requirements management.

Would this type of knowledge be useful for an independent game developer? (The alternatives are artificial intelligence or software architecture.)

sentences:
Robust "soft" platform collision using SAT We'll start with the questions, then a pile of background:

How do you rigorously and thoroughly define "soft collision" of the Mario-esque type (if I start above, or in a jump my feet apex above a "soft platform", I'll land on it)?
Can you suggest a definition in terms of object-versus-segment (or line, or ray, or whatever similar terrain boundary), in a SAT framework?
Any good examples/references for soft collision out there, even in non-SAT frameworks?
Finally, any edge/corner cases, literal or otherwise, that might not be obvious?

The background:

6+ years ago, I built a simple AABB object versus line-segment terrain collision system for $work, based heavily on N Tutorial A - Collision Detection and Response.  (This goes against my advice to never write physics/collision for production code oneself, but we had strange requirements: no FPU, blazingly fast SRAM and bus, and a relatively slow CPU.)

Over the years, we've dealt with a number of (sometimes quite literal) "corner cases", including how we deal with fast-moving objects (currently very fine-grained multisampling), order of collision resolution, et cetera.  This is the usual difficult stuff for naïve SAT, it would seem.

Recently another issue with our "soft collision" -- that is, platforms one can jump "up" through, but not fall "down" through (where "up" and "down" are relative to a unit normal off the line segment) -- has cropped up.

This has me wondering if I've "stated the problem" correctly vis a vis soft platforms.

As background, the bug in this case involved characters jumping with an arc such that their "head" just hit the bottom of the soft line segment.  Our collision system does, roughly:

early-miss if movement.dot( segmentUnitNormal ) > 0 // moving away from segment, for all segments (debatable whether this should be here, but probably largely irrelevant for this problem)
normal three-axis SAT (x-axis, y-axis, and line-axis) with miss if any axis shows separation; compute proposed projection to displace box out of segment if hit
late-miss unless 0 <= projection.dot( segmentUnitNormal ) < 1 // for "soft" segments only
finally, hit

Step #3 -- specifically the 0 == part of 0 <= -- is the issue here.  (On the other end of the range, the choice of 1 as cutoff for maximum interpenetration is arbitrary: it's based on our multisample worst case projection response.)

Amusingly, the comment above step #3 in the code says something like "Miss unless we started 'above' the segment, or if interpenetration is too deep."

The logic as stated says nothing about starting above, instead dealing only with response along unit normal.

As mentioned, the 0 case here is the issue: if the character's "head" hits the segment exactly at the peak of his jump and we compute a zero response, we'll treat that as a hit, when we'd expect to only get hits when our "feet" are at or just above the segment.

We could just exclude the 0 case here, and deal with a little "bounce" when resting on our soft platform, but then we'd have strange cases where we might not seem to be in contact with the world geometry every other frame, which has other implications for the animation system and the like.  I'd like to preserve 0 interpenetration = hit behavior.

I have a few possible solutions, mostly boiling down to things like:

"check if AABB centerpoint started on the correct side of the segment", or
"retain the directionality of the projection even if it collapses to zero length" (something like a "signed zero" here -- we already have this from our SAT calculations earlier),

...coupled with a little more care re whether we're using "computed projection along the line axis" versus "shortest computed projection" in these tests.

All of these solutions seem to be robust, in my initial tests.

But it has me wondering if I'm missing something obvious; hence the questions above.

sentences: What is the difference between ambient lighting and skylight? What is the difference between ambient and skylight lighting? Please give me a detailed description of the differences.

sentences:
How to avoid material copying error message in Edit-mode? I created a component called "AphaGroup" (an analog of the existing CanvasGroup for UI) which should be able to change alpha of the whole game object tree. My component finds all the MeshRenderer components, takes their material.color and changes its alpha. It should work both in play- & edit- modes. When it's run in edit-mode there is an error in the console when the material is copied for the first time:

  Instantiating material due to calling renderer.material during edit
  mode. This will leak materials into the scene. You most likely want to
  use renderer.sharedMaterial instead.

I've read most of the similar questions on the Internet but still haven't found the answer on how to manage this situation properly. How to avoid both: this error message and memory leaks?

I tried Renderer.material, Renderer.materials and Renderer.GetMaterials, but all they cause the same error.

sentences:
Binding c++ templated functions to lua I have started using Lua as a scripting language for my game engine. It works perfectly for things like input, audio etc. However, I'm now trying to bind my entity component system functions which make heavy use of templates.

For example, getting a component of an entity in c++ would look like this:

uint32 entity = 1;
Transform &transform = registry.get<Transform>(entity);

and adding a component to an entity:

registry.add<Velocity>(entity, 0.0f, 0.0f);

From what I can tell, Lua cannot handle templated functions - I would have to bind a new function for each component e.g getTransformComponent(entity). This obviously isn't great and becomes a huge pain for the end user. I've had a look around and can't find anything that is particually helpful for my problem. I see a few people suggesting things like getComponent("Transform") but I don't see how this would be implemented in c++ as my components are PODs, no base 'Component' class?

sentences:
Sound composition/compilation softwares I'm a one man developer company. I'm working on a game for which I need some variety of sounds. I searched online stock music and it does not give me what I'm exactly looking for.

As a desperate and unsatisfied enthusiast and low-budget game maker, I would like to give a try to compose sound myself.

Is there any sound composing software for games available(with some instruments) ?
I believe I have some good music taste. but, it needs some time to achieve what I need. I'm willing to put this much for my super game.

sentences:
UDK - problem packaging/publishing 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/packaged?

sentences:
Understanding Unity3d physics: where is the force applied? I'm trying to understand which is the right way to apply forces to a RigidBody.

I noticed that there are AddForce and AddRelativeForce methods, one applied in world space coordinate system meanwhile the other in the local space.
The thing that I do not understand is the following: usually in physics library (es. Bullet) we can specify the force vector and also the force application point.

How can I do this in Unity? Is it possible to apply a force vector in a specific point relative to the given RigidBody coordinate system?
Where does AddForce apply the force?

sentences:
Matte reflection effect in Unity? I'm trying to achieve that kind of scene but in real time using Unity.

It's basically composed of some primitives, a skybox, and a plane. I'm intrigued on how to do this effect in particular:

The plane acts like a mirror, but tainted and matte (and it appears to be less blurry at the bottom of the buildings... but I'm not quite sure). I have found some shaders to create mirrors in Unity but nothing about the matte effect like in this picture. Could you guide me on how to achieve this kind of effect (knowing that I'm pretty lame when it comes to write shaders but I want to learn).

Thanks.

sentences: How to know when all 2d rigid bodies have stopped in unity3d? Is there anyway to know if all 2d rigid bodies in untiy 3d phisics world have stopped?

sentences:
Game (Physics) work in Unity Editor/Remote but won't on Android? I have a script attached to a car game object that allows the player to tap the screen and then accelerate, the game object has a RB2D and collider set to it , it works fine in Unity Remote , but when I download the APK , as soon as I tap the screen , collisions go completely bezerk and the car just starts ignoring collisions , what's going on? As I need this to work to complete my game , as the player can move side to side with the accelerometer but I also want them to move forward when they touch the screen. Also , my game is 2D. Plus , since then , when the car ( my object) collides with anything else in the scene , it ignores it ( the obstacles just have Box Colliders on them). I had to freeze rotation so it could stop spinning out when it hit soemthing , now it just won't recognize collision at all. What's going on?
The code I think is causing the error starts at line 32. I have obstacles the player has to dodge and they all have box colliders and an appropiate script attached to them as well ( so when they collide with my player , it destroys it)

I've figured it out , Collision works when I first start the game , but when the player dies and I press "Replay" , it goes crazy. Here's the script that controls the enemy cars spawning , what the hell do I do to fix this?

 Code (CSharp):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyCar : MonoBehaviour {
public float speed ;
public float acceleration = 0.5f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
    speed += Time.deltaTime * acceleration;
    transform.Translate(new Vector3(0, 1, 0) * speed * Time.deltaTime);

}
void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "Coin")
    {
        Destroy(col.gameObject);
    }
}
}

I've done everything in the book trying to solve this , re-install unity , add different colliders etc. What's weirder is that it is FLAWLESS in Unity Remote and the Editor , these issues only arise when I test out the apk.

Here's how my game usually looks when the collisions work.

Now when it collides with a car ( on android) , it just ignores it and is slightly pushed back.

Help me!

Here is my script attached to enemy cars ( the cars that should destroy the player on Collision)

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

public class EnemyCar : MonoBehaviour {
    public float speed ;
    public float acceleration = 0.5f;
 // Use this for initialization
 void Start () {

    }

    // Update is called once per frame
    void Update () {
        speed += Time.deltaTime * acceleration;

        transform.Translate(new Vector3(0, 1, 0) * speed * Time.deltaTime);

 }
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "Coin")
        {
            Destroy(col.gameObject);
        }
    }
}

Also here is the inspector view of my Player Car

Here is the inspector view of an enemy car ( they all have the same things)

sentences:
Should NPC dialog be stored in XML or in a script? I'm developing an action RPG with some friends. I would like to know the differences and pros/cons of making NPC's dialogue using a file in XMLformat instead of using a script.

I see that script method is often used by game developers for NPC text, but is it better then a XML file? We've thought that a XML file with tags like

<FirstText>[text1]<SecondText>[text2]

et cetera is perfect for NPC text and also for possible quests to give the player.

So what are the differences between this two methods? Is a script suitable for this aim?

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:
Cocos2d CCSpriteFrameCache: couldn't load texture file I am currently doing this Cocos2d tutorial: http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d

...and get the following error messages:

2011-12-30 16:36:28.536 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.537 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.537 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCache: couldn't load texture file. File not found: AnimBear_default.png.ccz
2011-12-30 16:36:28.538 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.538 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.539 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCache: couldn't load texture file. File not found: AnimBear_default.png.ccz
2011-12-30 16:36:28.540 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.540 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.541 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCa[Switching to process 11273 thread 0x1410b]
[Switching to process 11273 thread 0x10a03]
che: Frame 'bear1.png' not found
2011-12-30 16:36:28.598 AnimBear[11273:10a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x17e4052 0x1975d0a 0x17d136e 0x17d2220 0xc1997 0x3fcf1 0xc16dd 0xc0d7c 0x828b0e 0x8298a6 0x838743 0x8391f8 0x82caa9 0x2798fa9 0x17b81c5 0x171d022 0x171b90a 0x171adb4 0x171accb 0x8292a7 0x82aa9b 0xc085f 0x2135)
terminate called throwing an exceptionsharedlibrary apply-load-rules all

I have the following files in the Resource folder:

AnimBear_default.png.ccz
AnimBear_default.plist

The texture consists of eight(8) bears named Bear1.png - Bear8.png. I have bought and done the texture in Zwoptex, latest version.

The code looks like:

-(id) init {

if((self = [super init])) {

    [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"AnimBear_default.plist" textureFile:@"AnimBear_default.png.ccz"];
    CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"AnimBear_default.png.ccz"];
    [self addChild:spriteSheet];

    NSMutableArray *walkAnimFrames = [NSMutableArray array];
    for (int i = 1; i <= 8 ; ++i) {
        [walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"bear%d.png", i]]];
    }

    CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:0.1f];

    CGSize winSize = [CCDirector sharedDirector].winSize;
    self.bear = [CCSprite spriteWithSpriteFrameName:@"bear1.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;

}

I am completely new to Cocos2d and have been trying to search the web and tried different things but with no success :-(

sentences:
Handmade Terrain vs. Terrain Engine in Unity? I'm planning a game right now, to be made in Unity, and I'm trying to decide how I'll approach the basic level construction. Essentially, my game takes place on an island in an infinite ocean, very similar to Wuhu Island:

My question concerns all the stuff heightmaps can't handle. To use Wuhu Island as an example, note the lighthouse cliff, and the nearby similarly jutting-out cliff. The volcano itself is also empty, and there are some tunnels through it on the other side.

I was thinking I would just model the entire island myself in Cinema 4D, but as I read more about the terrain system, it seems Unity has special optimized rendering systems in place for terrain objects. Would I be shooting myself in the foot performance-wise if I just built my island entirely by hand? This will be for mobile, so the little stuff might well count. Am I even approaching this question correctly - if not, how would you best go about creating (something very close to) Wuhu Island as a level in Unity? Is there any reason for me to not do it as one mesh? I have effectively zero experience with 3D game dev - only rendered 3D video/stills for other applications, so this is a learning process.

sentences:
Improve (adding randomness) minmax algorithm for Connect Four I have implemented the minmax algorithm for the Connect Four game. It works well (almost...), but if the player does the same moves, the computer will do the same moves as well, for each match. There is no randomness in the computer choices. This is the code for the minmax:

private int[] minmax(int depth, Seed player) {
    // Generate possible next moves in a List of int[2] of {row, col}.
    List<int[]> nextMoves = generateMoves();

    // mySeed is maximizing; while oppSeed is minimizing
    int bestScore = (player == mySeed) ? Integer.MIN_VALUE : Integer.MAX_VALUE;
    int currentScore;
    int bestRow = -1;
    int bestCol = -1;

    if (nextMoves.isEmpty() || depth == 0) {
        // Gameover or depth reached, evaluate score
        bestScore = evaluate();
    } else {
        for (int[] move : nextMoves) {
            // Try this move for the current "player"
            cells[move[0]][move[1]].setContent(player);
            if (player == mySeed) { // mySeed (computer) is maximizing player
                currentScore = minmax(depth - 1, oppSeed)[0];
                if (currentScore > bestScore) {
                    bestScore = currentScore;
                    bestRow = move[0];
                    bestCol = move[1];
                }
            } else { // oppSeed is minimizing player
                currentScore = minmax(depth - 1, mySeed)[0];
                if (currentScore < bestScore) {
                    bestScore = currentScore;
                    bestRow = move[0];
                    bestCol = move[1];
                }
            }
            // Undo move
            cells[move[0]][move[1]].setContent(Seed.EMPTY);
        }
    }
    return new int[] { bestScore, bestRow, bestCol };
}

/**
 * Find all valid next moves. Return List of moves in int[2] of {row, col}
 * or empty list if gameover
 */
private List<int[]> generateMoves() {
    List<int[]> nextMoves = new ArrayList<int[]>(); // allocate List

    boolean[] columns = {false,false,false,false,false,false,false};

    // If gameover, i.e., no next move
    if (hasWon(mySeed) || hasWon(oppSeed)) {
        return nextMoves; // return empty list
    }

    // Search for possible moves and add to the List
    for(int row = GameMain.ROWS - 1; row >= 0; row--) {
        for(int col = 0; col < GameMain.COLS; col++) {
            if(columns[col] == false && cells[row][col].getContent() == Seed.EMPTY) {
                columns[col] = true;
                nextMoves.add(new int[] { row, col });
            }
        }
    }

    return nextMoves;
}

/**
 * The heuristic evaluation function for the current board
 *
 * Counts open 3 in a row for each player
 */
private int evaluate() {
    int score = 0;

    // very good move for computer
    if(hasWon(mySeed)) {
        return Integer.MAX_VALUE;
    }

    // very bad move, player wins!
    if(hasWon(oppSeed)) {
        return -Integer.MIN_VALUE;
    }

    // counts open 3 in a row for the computer and the player
    int myThree = openThree(mySeed);
    int oppThree = openThree(oppSeed);

    score = myThree - oppThree; // if negative, player advantage, otherwise computer advantage

    return score;
}

I have omitted the openThree method for brevity.

Bug: the computer skips his turn when is destined to lose.

Ps: the main code for minmax is taken from a tutorial.

This is a situation in which the computer skips his turn:

Red is the player, blue is the computer.

The computer does not freeze, he can continue to play, but not always. For example in this situation if i place my red circle over 15, the computer will skip his turn again, while if i place my red circle over 9, the computer will win placing his blue circle over this last one placed by me.

Project zip

sentences:
Saving with PlayerPref problems I'm having troubles saving how much of an item I have in my game. Right now I have it so the price goes up the more items you buy, that works, but every time I reset the game, the count goes back to 0, while the price acts as if the count is at a higher number.

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

public class ItemManager : MonoBehaviour {

public UnityEngine.UI.Text itemInfo;
public GPS gps;
public Click click;
public float cost;
public int tickValue;
public int count = 0;
public string itemName;
private float baseCost;
private Slider _slider;

void Start()
{

    Load ();
    baseCost = cost;
    _slider = GetComponentInChildren<Slider> ();
}

void Update()
{
    PlayerPrefs.SetFloat ("Count", count);
    PlayerPrefs.SetFloat ("Cost", cost);

    itemInfo.text = itemName + " (" + count + ") " + "\nCost: " + cost + "\nGold: " + tickValue + "/s";

    _slider.value = click.gold / cost * 100;

    if (_slider.value >= 100) {
        GetComponent<Image> ().color = buyColor;
    }else{
        GetComponent<Image>().color = standard;
    }
}

public void BuyItem()
{
    if (click.gold >= cost)
    {
        click.gold -= cost;
        count += 1;
        cost = Mathf.Round (baseCost + Mathf.Pow (2f, count));
    }
}

public void Load()
{
    count = PlayerPrefs.GetInt ("Count");
    cost = PlayerPrefs.GetFloat ("Cost");
}
}

I've tried to figure this our for hours, and I just don't know what to do with this.

sentences:
Issues with ECS performance I'm currently implementing ECS in "classic" sense, as defined by this wonderful post, where we have Entities, Components and Systems. And I'm having a serious (for me) performance issues. They come from the fact that System may need access to several components of the entity:

IList<int> es = _ecsManager.GetComponentEntities(ComponentType.RENDER);

int cacheRender = -1;
int cacheMovement = -1;
foreach (var entityId in es) {
    var rc = _ecsManager.GetEntityComponent<RenderComponent>(entityId, ComponentType.RENDER, ref cacheRender);
    var mc = _ecsManager.GetEntityComponent<MovementComponent>(entityId, ComponentType.MOVEMENT, ref cacheMovement);
    rc.Sprite.Position = mc.Position;
    QueueSprite(rc.Sprite);
}

the QueueSprite is my sprite batching, it's backed by regular arrays and Lists with no dynamic in long run. And GetEntityComponent is:

public T GetEntityComponent<T>(int entityId, int componentId, ref int idxCache) where T : PslComponent {
    var cs = GetEntityComponents(entityId);
    // try for cache
    if (idxCache != CACHE_NULL && idxCache < cs.Count) {
        var tmp = cs[idxCache];
        if (tmp.TypeId == componentId) {
            return (T)tmp;
        }
        // cache miss
        idxCache = CACHE_NULL;
    }
    // cache failed, sequental search
    for (var i = 0; i < cs.Count; i++) {
        var component = cs[i];
        if (component.TypeId == componentId) {
            // update cache
            idxCache = i;
            return (T)component;
        }
    }
    // not found
    return null;
}

and GetEntityComponents:

public IList<PslComponent> GetEntityComponents(int entityId) {
    return _componentsByEntity[entityId];
}

with _componentsByEntity being a array, GetComponentEntities works similarly backed by regular array too:

public IList<int> GetComponentEntities(int componentId) {
    return _entitiesByComponent[componentId];
}

the abovementioned foreach loop is taking a lot of time. More than rendering.

As you can see, I'm pretty much tried to optimize a lot of things already, removing all Dictonary<>-type lookups, replacing all by arrays and Lists. There is no dynamic allocation in long-run. The only problem, as I see it, is sequental search in entity Component loookup.

Is there any possibility to improve component lookup speed, while remaining true to classic implementation?
Is this major performance penalty is usually assumed then ECS is used? Are ECS "bad" then high performance is required?

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:
Solving the "bullet problem" I have a 3D matrix filled with "empty space" where I put some objects (objects are represented as bunch of occupied space).

The bullet is fired from coordinates (x1,y1,z1) at angles (verticalAngle,horizontalAngle).

How do I find the first coordinates in the bullet's trajectory line which is not market as "empty space"?

I suppose I'd have to loop through all the coordinates in that line till I find the not empty one (or the end of the matrix). But how do I calculate what are those coordinates that I have to go through?

When firing a bullet in 2D space I suppose this would be calculated as
y = cos(angle) * x + startPosition where I'd increment x (in a for loop) to get y and check (x,y) cell for objects or "empty". Actually I'd have to increment y in the for loop to get x instead in case the trajectory line is closer to y-axis than x-axis.

But can someone help me with doing this in 3D space?

EDIT:
Well I found this formula: (x,y,z)=(x0,y0,z0)+t(a,b,c) where (x0,y0,z0) are starting points and (a,b,c) direction factors, so I think I could increment t in a loop to get the coordinates.

sentences:
How can I draw crisp per-pixel images with OpenGL ES on Android? I have made many Android applications and games in Java before, however I am very new to OpenGL ES. Using guides online, I have made simple things in OpenGL ES, including a simple triangle and a cube.

I would like to make a 2D game with OpenGL ES, but what I've been doing isn't working quite so well, as the images I draw aren't to scale, and no matter what guide I use, the image is always choppy and not the right size (I'm debugging on my Nexus S).

How can I draw crisp, HD images to the screen with GL ES?

Here is an example of what happens when I try to do it:

And the actual image:

Here is how my texture is created:

//get id
int id = -1;
gl.glGenTextures(1, texture, 0);
id = texture[0];

//get bitmap
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.ball);

//parameters
gl.glBindTexture(GL10.GL_TEXTURE_2D, id);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
        GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
        GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
        GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
        GL10.GL_CLAMP_TO_EDGE);
gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
        GL10.GL_REPLACE);

GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

//crop image
mCropWorkspace[0] = 0;
mCropWorkspace[1] = height;
mCropWorkspace[2] = width;
mCropWorkspace[3] = -height;
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);

sentences:
Triangulation A* (TA*) pathfinding algorithm I need help understanding the Triangle A* (TA*) algorithm that is described by Demyen in his paper Efficient Triangulation-Based Pathfinding, on pages 76-81.

He describes how to adapt the regular A* algorithm for triangulation, to search for other possibly more optimal paths, even after the final node is reached/expanded. Regular A* stops when the final node is expanded, but this is not always the best path when used in a triangulated graph. This is exactly the problem I'm having.

The problem is illustrated on page 78, Figure 5.4:

I understand how to calculate the g and h values presented in the paper (page 80).

And I think the search stop condition is:

if (currentNode.fCost > shortestDistanceFound)
{
    // stop
    break;
}

where currentNode is the search node popped from the open list (priority queue), which has the lowest f-score. shortestDistanceFound is the actual distance of the shortest path found so far.

But how do I exclude the previously found paths from future searches? Because if I do the search again, it will obviously find the same path. Do I reset the closed list? I need to modify something, but I don't know what it is I need to change. The paper lacks pseudocode, so that would be helpful.

sentences:
Coroutine different behaviour when called from another script I am quite new with game dev, specially with unity. In order to understand how it works, I decided to start small with a pong game.

I have a Ball script, which in the Update() method move the ball depending to the speed, and if a player score, it increment a score field and reset the ball to the center (and stop the ball for 2 seconds) trough a coroutine function.

Ball script:

public class Ball : MonoBehaviour
{
    [SerializeField]
    float speed;
    int isMoving = 1;
    float radius;
    Vector2 direction;
    Vector2 startPosition;

    // Start is called before the first frame update
    void Start()
    {
        direction = Vector2.one.normalized;
        radius = transform.localScale.x / 2; // half the width
        startPosition = new Vector2(transform.position.x, transform.position.y);
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(direction * speed * isMoving * Time.deltaTime);

        if (transform.position.y < GameManager.bottomLeft.y + radius && direction.y < 0) {
            direction.y = -direction.y;
        }
        if (transform.position.y > GameManager.topRight.y - radius && direction.y > 0) {
            direction.y = -direction.y;
        }

        // Ball go in any goal
        if (transform.position.x < GameManager.bottomLeft.x + radius && direction.x < 0) {
            GameManager.instance.addScorePlayer("p2");
            StartCoroutine( Reset() );
        }
        if (transform.position.x > GameManager.topRight.x - radius && direction.x > 0) {
            GameManager.instance.addScorePlayer("p1");
            StartCoroutine( Reset() );
        }
    }

    IEnumerator Reset() {
        isMoving = 0;
        transform.position = startPosition;

        yield return new WaitForSeconds(2);

        isMoving = 1;
    }
}

This works as expected! The score is incremented, the ball go back to the center, wait for 2 seconds and start to move again.
However, now I want to call the Ball Reset() method trough my GameManager (because I want to code some logics inside the GameManager).

So here are my modifications:

Ball script: (remove Reset() calls and update Reset() method to public)

public class Ball : MonoBehaviour
{
    ...

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

        // Ball go in any goal
        if (transform.position.x < GameManager.bottomLeft.x + radius && direction.x < 0) {
            GameManager.instance.addScorePlayer("p2");
        }
        if (transform.position.x > GameManager.topRight.x - radius && direction.x > 0) {
            GameManager.instance.addScorePlayer("p1");
        }
    }

    public IEnumerator Reset() {
        isMoving = 0;
        transform.position = startPosition;

        yield return new WaitForSeconds(2);

        isMoving = 1;
    }

GameManager script:

public class GameManager : MonoBehaviour
{

    public Ball ball;

    ...

    void Start()
    {
        ...

        // Create ball
        Instantiate (ball);

    }

    public void addScorePlayer(string player) {

        if (player == "p1") {
            score1 += 1;
            score1Text.text = score1.ToString();
        }
        else if (player == "p2") {
            score2 += 1;
            score2Text.text = score2.ToString();
        }

        StartCoroutine( ball.Reset() );
    }

This doesn't work for some reason. The ball don't come back to the center, and the score increment infinitely.

I have tried many things and I have figured out that the behaviour is the same as running the Reset() method trough the Ball script without the StartCoroutine.

So it seems that the Coroutine don't work properly if called trough the GameManager ?
I have also printed some logs into my console in the Ball.Reset() method, and the method is being called, so I don't understand why the ball don't go back to the center.

(Link to my public github repository https://github.com/Sewake/Unity2D-Pong)

sentences:
Problem with bullet movement I'm trying to draw "bullets" in my game, but I think something is wrong with velocity computation. Sometimes the "bullets" are going in the right way, but sometimes they won't. The CameraFront is constructed with euler angles. Can you help? Thanks in advance
So this is how I create bullets:
Bullet_tracer makeBulletTracer(v3 cameraFront,v3 startP, v3 endP)
{

    Bullet_tracer result = {};

    //assert((gTracersCount + 1) <= MAX_BULLET_TRACERS);

    mat4 model = indentity();
    model = scale(model, v3(.5f,.5f,1.5f));
    v3 up = v3(0.0f,1.0f,0.0f);
    v3 right = normalize(cross(cameraFront,up));
    mat4 M = rows3x3(right,up,cameraFront);
    model = model * M;
    model = translate(model, startP + v3(0.0f,3.0f,0.0f));
    result.model = model;
    result.velocity = cameraFront;
    gTracersCount++;
    return result;
}

This is how I draw them:
for (u32 tracerIndex = 0; tracerIndex < gTracersCount; tracerIndex++)
{
    Bullet_tracer *tracer = gameState->tracers + tracerIndex;

    v3 p = getTranslationPart(tracer->model);
     v3 offset = (p + tracer->velocity) * input->dtForFrame * 0.01f;
    tracer->model = translate(tracer->model, offset);

    passUniformMatrix(opengl.shaderProgram,tracer->model,false,"model");
    glDrawArrays(GL_TRIANGLES, 0, 36);
}

sentences:
Retrieve the original prefab from a game object How would one proceed to retrieve the original prefab used for instantiating an object?

In the editor these two functions work :

        Debug.Log(PrefabUtility.GetPrefabParent(gameObject));
        Debug.Log(PrefabUtility.GetPrefabObject(gameObject));

But I need something that works in the release version.

I have objects that can be transported between scenes ands I need to save their data and original prefab to be able to instantiate them outside of the scene they have been originally instantiated.

ie:

Game designers create new prefabs.
Game designers create objects from prefabs and place them in scenes (50 to 150 scenes).
Game is played and objects are moved across scenes.
Game is saved and infos about objects which have moved are saved in the save streams (files or network).

This is where I got stuck. Currently, to palliate to the shortcomings, we're saving the name of the prefab in the prefab. But each time a prefab is moved, renamed or duplicated the string must be changed too, sometimes the objects created from the prefab keep the original name (game designer might have edited the prefabPath field).

Maybe there is a better way to achieve proper save games without having to access to the original prefab/name. But currently we keep the saves segmented on a per level basis (easier and safer to save/load to files and transfer the save games to/from servers)

sentences:
2D Skier physics looks very artificial I am creating a ski slalom game and I coded a new physics routine, because I was told the rigidbodies are pure "not overly good thing" to use by my boss. With my physics routine it indeed looks much better, but I have no idea how could I make the skier look less plastic. Which means I want to achieve similar level of control like in Skiing Yeti Mountain, because there the physics is quite enjoyable, though still arcade. Basically the requirements are that I need to set up acceleration, top speed and the amount of grip to use when turning, but it somehow bites me back

    [SerializeField]
    private Vector2 slopeDirection = -Vector2.up;

    var dt = Time.fixedDeltaTime;
    var dirVector = Vector2.zero;

    dirVector.x = Mathf.Cos( radianOrientation );
    dirVector.y = Mathf.Sin( radianOrientation );

    float actualAcceleration = Mathf.Abs(Vector2.Dot(dirVector, slopeDirection));
    actualAcceleration = Mathf.Lerp(maximumAcceleration, 0, actualAcceleration) * Mathf.Pow(maximumAcceleration, accelerationSmoothing);

    velocity.x += actualAcceleration * dirVector.x * dt;
    velocity.y += actualAcceleration * dirVector.y * dt;

    Vector2 velocityDirection = velocity;
    velocityDirection.Normalize();

    float actualFriction = Mathf.Abs(Vector2.Dot(dirVector, slopeDirection));
    actualFriction = Mathf.Lerp(minimumFriction, maximumFriction, actualFriction) * Mathf.Pow(actualFriction, frictionSmoothing);

    // Simulate friction
    velocity *= actualFriction;
    Debug.Log(velocity);

    if(!_isFinished)
    {
        this.transform.position += new Vector3(velocity.y, -velocity.x, 0);
    }

why it is overly odd is that when I turn to the side it has a very abrupt power loss and when I turn the skis to 45 degrees to the slope. how could I achieve that the skier will slow down when he turns his skis, but after a little while it will accelerate again like in Skiing Yeti Mountain?

sentences: Way to Get Collision Box Width Gamemaker I was coding the wall collision system for my game, and I wanted to do it using intersect boundaries instead of checking every step if they are off the screen. When the player crosses the boundary they get moved back to half of the sprite, but because the intersect boundary uses the collision box, it appears to jitter when you walk into the wall. Is there a way to get the width and height of the collision box so I can move them half of that away from the wall?

sentences:
How to restrict jumping to a single jump? I'm making a VolleyBall game in HTML5 with PandaJs GameEngine and plugin is used physics and Box2D.

The problem is that players can jump, but they can jump over the net with multiple jumps. I have already implemented collision detection but i don't know how the restrict move space for player. I also attaching my screen shot here so look at this
:

In the picture Player1 goes Player2 side and vise-versa.

sentences:
Finding the shorter turning direction towards a target I'm trying to implement a type of movement where the object gradually faces the target. The problem I've run into is figuring out which turning direction is faster. The following code works until the object's orientation crosses the -PI or PI threshold, at which point it will start turning into the opposite direction

void moveToPoint(sf::Vector2f destination) {
    if (destination == position) return;

    auto distance = distanceBetweenPoints(position, destination);
    auto direction = angleBetweenPoints(position, destination);

    /// Decides whether incrementing or decrementing orientation is faster
    /// the next line is the problem
    if (atan2(sin(direction - rotation), cos(direction - rotation)) > 0 ) {
        /// Increment rotation
        rotation += rotation_speed;
    } else {
        /// Decrement rotation
        rotation -= rotation_speed;
    }

    if (distance < movement_speed) {
        position = destination;
    } else {
        position.x = position.x + movement_speed*cos(rotation);
        position.y = position.y + movement_speed*sin(rotation);
    }
    updateGraphics();
}

'rotation' and 'rotation_speed' are implemented as custom data type for radians which cannot have values lower than -PI and greater than PI. Any excess or deficit "wraps around". For example, -3.2 becomes ~3.08.

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 can I render two scenes simultaneously on LibGDX? In my LibGDX game, I'm trying to render two 'views' (one next to the other) at the same time.

The idea is to have each view rendered according to global coordinates, but everything inside would be relative to their parent view. (e.g.: if I draw a rectangle inside View 1 and its coordinates are x=0, y=0, It would appear in the upper corner of View 1).

sentences:
Blender: How to merge multiple meshes of same object? I have run into a bit of a problem creating my 3D model. I started with a single mesh and added additional meshes (all in edit mode) to create my geometric shape. They are all part of the same object, but now I can't figure out how to "carve" my desired shape of this geometric mesh pattern because some of my faces are going to get deleted etc.

Here are pictures of what I have, and what I want to achieve.

sentences:
Positive Evaluation Function - Territory AI Help I am trying to implement some positive evaluation into my game. Let me explain.

I have a series (anywhere from 5 to 25 (might vary)) of circles (three sizes, big medium small). And each player starts with a main circle which gains 1 every turn (like risk the circles gain at different speeds, the big one gains the fastest and the small one gains the slowest). You can use these numbers to take over other circles, if the "enemy" is on this circle it does a risk thing (you fight to see who takes it over, who ever has more wins most of the time, I'm not getting into this logic as it is rather irreverent).

So this is a very basic overview of what occurs, now what I need some help with is how I can create an AI which will look at all available (and taken) circles and determine where it wants to move to. There would be circles closes to it, and circles in the enemies area and circles available and circles taken over. And it would need to determine where to move it's forces too next, and so on and so forth.

So after some research I read a lot about Positive Evaluation, which it takes all possible moves and determines the best one.

So I am wondering if anyone could help me out or give me some direction as to where to go from here. I think what I need to do is take all the circles with any forces on them, throw them into a table/array with the cords of each circle and determine which would be best, then I would need to determine how many forces I want to send and where from.

Help!

ADDITION:

Allow me to explain a bit, http://imm.io/4Xwy see that diagram lets assume the circles are sections of forces, and you gain a new force each "time interval" and lets say I want to take all my forces (I'm pink) the circle directly below me and capture it, well the AI would need look at all available circles and pick for example the big green on in the top right (since big would make more troops and its close to the "main"). I'm assuming what you said would still work? Weighted options?

sentences:
ASSIMP transformation hierarchy and animations I don't fully understand the transformation hierarchy used by ASSIMP.

According to the docs (http://assimp.sourceforge.net/lib_html/structai_node.html) an aiNode's transformation is relative to its parent. Does this mean I need to concatenate its parents (and their parents) matrices with the nodes matrix to get the LOCAL matrix for the model? Or is the nodes transform already per-multiplied with all the parents, meaning transforming the nodes vertices by the nodes transform directly puts the vertices in the models LOCAL space (and not just the 'NODE' space)?
Kinda same as 1) but does transforming the vertices with the aiNodes transform put it in the "bind pose"?
What is the point of even having a transform per aiNode? Why not just pretransform all the vertices? From what I understand the counter-argument has something to do with animations... but each animation step already has its own position/scale/rotation!

Any help is much appreciated, I don't fully grasp the transform hierarchy which makes it hard to formulate good questions.

sentences:
How do I sync entity ids with the server and client? I'm continuing my experimentation with entity component design by making a multiplayer space/trading/combat game with python and panda3d. My component system is a simple version of java's artimis. The entity id is stored in a simple list with it's position as its id. Components are stored in a second list of dictionaries with the position as the entity id. Components are then mapped in a {Class: instance} dictionary.

The client will only know about entities near it's local space. Entities to be networked will have a ClientComponent which tracks what clients that object is broadcasting to. The server and client sends updates with the entity id of the object being acted on, then the action type, followed by the relevant data and yes, the server will check if it is a valid action by the client. The client needs to have a local copy of the relevant entities and components but I am running into issues on how to set this up.

My initial reaction is to just use the entity id's from the server on a client. The client will probably need its own entities for elements like the UI which can interfere with a future entity from a server. I could reserve the first 64-128ish entities for client local use only, but that seems very awkward
Next though was to have the client generate the entity ids locally and have a map of client vs server entity ids. The problem here is that some components will have an id of what entity owns it, which can make the mapping system fall apart and hard to debug.

Here are my two questions. Is there a better way to set up the network protocol where I wont run into this issue. If not, what is a decent solution for the client to know the server's entity ids.

sentences:
How are 3D images drawn? When A computer is to draw a 3d model, does it use maths similar to vector projection? Like when a 3d model is drawn and rotated, does it use vectors/and maybe some other math to know where to draw each of the edges?

If so, is this calculation made everytime the screen is refreshed?

Just want to see if I can create a basic square that looks like its spinning in 3D space. Just for the challenge, not anything practical.

Sorry if I wasn't clear, it is one of those questions where it's difficult to explain.

sentences:
How can I execute GLFW fullsceen in a secondary monitor (Xorg)? I am currently learning GLFW using C++. I have found many tutorials on initializing windows, but not many on initializing full screen, and next to nothing on initializing full screen on a secondary display (In this case, my television). This way I can use my primary display for logging and debugging.

I have visited the man-pages for GLFW. However, even after going over examples for glfwGetMonitors(), I am still not entirely sure how to use these in conjunction with  glfwCreateWindow().

I have included links to the reference pages.

GLFW Monitor Guide

GLFW Window Guide

sentences: Are there any web frameworks used primarily to produce games? Basically, the title says it all. I've seen and worked with Django, Rails and a bit with Cake PHP. I'd like to know if there is a framework that is excellent for supporting casual, 2d, browser based game development. The closest that I've seen is flash, but I'd like to find something open source. Something that could handle both the graphics and communication to a database would be ideal. Any suggestions?

sentences:
Can't read .cso files but I can read their .hlsl versions? Well I've been trying to read a .cso file to use as a shader for a DirectX program I'm currently making.

Problem is no matter how I implemented a way to read the file it never worked. And after fidgeting around I discover that it's only the .cso files I can't read.

I can read anything else (which means it works) even their .hlsl files. Which is strange because the .hlsl (high level shader language) files are supposed to turn into .cso (compiled shader object) files.

What I'm currently doing is:

vector<byte> Read(string File){
    vector<byte> Text;
    fstream file(File, ios::in | ios::ate | ios::binary);

    if(file.is_open()){
        Text.resize(file.tellg());
        file.seekg(0 , ios::beg);
        file.read(reinterpret_cast<char*>(&Text[0]), Text.size());
        file.close();
    }

    return Text;
};

If I then implement it.

Read("VertexShader.hlsl"); //Works
Read("VertexShader.cso"); //Doesn't Works?!?!

And I need the .cso version of the shader to draw my sexy triangles. Without it my life and application will never continue and I have no idea what could be wrong.

(I've also asked this at stack overflow but still no answers.)

sentences:
Invalid GLSL on some machines I'm writing a game engine using OpenGL 4.3 using gcc 5, mainly to teach myself graphics programming.

Initial development was on my Surface Pro 3 using mingw-w64 and worked like a charm.

I've decided to move to my desktop, which is running two GTX 670s, and both Windows and Arch Linux. I've made sure that I have the latest NVIDIA drivers installed on both operating systems, but am having issues with my vertex and fragment shaders. All I know is that neither system compiles the shaders, but the OpenGL Reference Compiler simply issues a warning saying that OpenGL 4.3 might not be fully implemented. I've also tried downgrading all the way to OpenGL 4.0, but this doesn't seem to fix the issue.

Below are the shaders that I'm currently trying out. Hoping someone more experienced than I can lend a hand?

shader.vert:

#version 430

layout (location = 0) in vec3 vertex_position;
layout (location = 1) in vec2 vt;

uniform mat4 cam_view, cam_proj, sprite_matrix;

out vec2 texture_coordinates;

void main()
{
   texture_coordinates = vt;
   gl_Position = cam_proj * cam_view * sprite_matrix * vec4(vertex_position, 1.0);
}

shader.frag:

#version 430

in vec2 texture_coordinates;
layout (binding = 0) uniform sampler2D tex;

out vec4 frag_colour;

void main()
{
   vec4 texel = texture(tex, texture_coordinates);
   frag_colour = texel;
}

Thanks in advance :)

sentences: Load Unity game launch options from file I have a need to disable the resolution dialogue when the game launches, but have a config file that will have all of the dialogue options (resolution, quality, monitor (monitor is most important, because none of the solutions to change the active monitor after launch have worked out with a decent result)). Is there a way for a unity game to load options from a file instead of the resolution dialogue?

sentences:
Textures "don't work" when I don't specify any texture parameters. Is this a driver bug or intended behavior? Whenever I try to use textures, I have to at least specify the sample filtering parameters (GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER) for textures to work at all. If I don't, sampling the textures in a shader will usually just return a value of 0 for all texels in the texture, even though glReadPixels return the correct values, and rendering to the textures actually works. Debugging tools like Nsight and gDebugger confirm this.

I tested this on two NVIDIA GPUs (GTX 970, GT 555m) with the latest driver versions (347.09), and the behavior is the same.

However, I can't find any reference to this in docs like this or this

I assumed that not specifying these parameters just made them take on their default values. So is this actually intended standard behavior (probably meaning "undefined behavior") or can I assume this is a driver bug?

sentences:
GLSL variables as main function params vs on their own line? I am learning OpenGL and GLSL. I was taught that the in/out variables should be formatted like this:

in vec3 something;
out vec3 somethingElse;

int main()
{
    // etc...
}

However, I ran across code like this online (ShaderToy):

int main(in vec3 something, out vec3 somethingElse)
{
    Is there a difference?
}

Is there any difference?

sentences:
How can I have my third-person camera track slightly ahead of the player as he or she moves? I have a 3rd person camera controller in a top-down game. I have my cameran following the player and I currently use linear interpolation to make the movement smooth and a little laggy. But I would like to do the opposite: when the player moves in a certain direction the camera moves a little bit ahead, so as to reveal more of what is ahead of the player.

    void Update ()
    {
            var newX = player.transform.position.x;
            var newZ = player.transform.position.z - 17;
            var y = transform.position.y;
            var targetPosition = new Vector3 (newX, y, newZ);
            transform.position = Vector3.Lerp (transform.position, targetPosition, 0.01f);
    }

sentences:
How do I find more details about a Vuforia error when going into play mode? I want to make an AR app in Unity using Vuforia Engine. But when I try to enter play mode nothing appeared. Here's the error alert:

Since this error does not give me any clue about what went wrong, I'd like to know if there is a way to get more details about it so I can eventually figure out how to fix it.

sentences:
Best visual way to build a "near isometric" 2D view I'm working hard in a 2D platform game, as far as I got is a standard 2D view (only x and y are visible)

But I want to change the perspective so I can see the floor also.

But the MapBuilder I developed works perfectly based on TILES (so my 2D works very well)

I wanna know the easiest way to add the ground on top of the floor without switching to full 3D with rotationed Rectangles.

The best I tought is to create a "magic" rectangle on top of my ordinary floor to make this fake perspective. But this still lead me to problems on multi-floors.

sentences:
Generate Mesh of Shadow Volume Given a mesh, I want to generate another mesh that is effectively a shadow volume of this mesh.

I am looking for an algorithm/solution/implementation/reference that can do this under the following constraints:

I have a single, point light source. Thus:

Not a polygon;
I want hard edges/faces (not soft shadows)

The light source is at infinity, in fact can be assumed to by directly above the mesh. Thus:

The projection is actually orthographic and depends only on a single direction.

I want an exact solution.

The result mesh is not used for display so cannot be based on resolution dependent rasterization as many algorithms are.

A naive algorithm is to extrude all mesh triangles in the direction away from the light, e.g. downward, and do a CSG union of all these extruded "prisms".
The drawback here is that:

It does this for all triangles and not just the visible ones (how to do exact visibility?);
it requires a massive amount of CSG operations which are expensive.

I'm looking for a more efficient algorithm.

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:
How long to display each sentence? When creating a sequence where text advances automatically, is there a metric which will allow me to calculate a reasonable duration to display each "sentence"?

My intuition tells me that because of the way we read, the number of words is probably more relevant than the number of characters, but I'm curious what people may have already figured out about this problem.

sentences:
Separating Axis Theorem - Calculate Normals from Points in 3D So while researching for a method to detect collisions in a 3D space between (arbitrary rotated) boxes, I stumbled upon this excellent question with great resources for my further research and great answers: How many and which axes to use for 3D OBB collision with SAT

I now managed to implement nearly everything in C++, and I understand why I have to check all 15 axis and why they are important. Yet I don't understand, how to calculate a0, a1, a2, b0, b1 and b2 (the normals of A and B). Since I only have cuboids for collision detection, I would rather use normals instead of the edges. It does seem to be easier.

To be more precise: First of all, my data structure to save a OBB is a loose collection of 8 vertices of the cuboid 1]. I understand, how to calculate a normal mathematically. I just calculate the cross product of two edges... But I don't know which two edges to choose. If I look at a face of the cubiod, I have 4 edges I could use to calculate the normal for that face. Another problem is, that using the above mentioned data structure, I can't tell whether two vertices belong to one face.

So what can I do to get the 3 normals of a cuboid programmatically?

Do I have to expand my data structure, or can the missing information be derived somehow in a easy way?

1] Example for a cuboid in my data structure (represented in JSON, with (x,y,z) being a point in double^3):

[(0,0,0), (0,1,0), (1,0,1), (1,1,1), (0,1,1), (1,1,0), (1,0,0), (0,0,1)]

sentences:
Unity - plain material colour darker than expected I want to add to scene object without textures, only plain material, here is my import flow:
I create object in Sketch and export to SVG:

Then I import SVG to blender (Material do not use nodes, has plain color #96DFE4) and export it to FBX.
Then I import FBX to unity, as you can see material colour is much darker than SVG created:

The only Lighting source I use is Ambient with colour white and Intensity 0.
How to render object with exactly same material colour as SVG? I don't want any shadows etc, just plain color.

sentences:
How to randomly generate biome with perlin noise? I want to generate a procedural world using perlin noise. As expected, my terrain is generating with a repetitive patern. I'd like to add biomes, zones separated with higher or lower amplitude to simulate mountains or plain.
I first thought I could randomly select rectangles of verticesof random sizes and then give them bigger amplitude to simulate mountains. The problem with that is that It wont seem natural, since I will only have rectangle biomes and also I don't know how to make it so the mountains would connect with the plain to avoid things like this
Here is my script:
public int size = 10;
public float amplitude;
public float frequence;
void GenerateTerrain(float amp, float freq)
{
    Mesh meshy;

    MeshRenderer meshRenderer = GetComponent<MeshRenderer>();
    meshRenderer.sharedMaterial = new Material(Shader.Find("Standard"));
    MeshFilter meshFilter = gameObject.GetComponent<MeshFilter>();

    List<Vector2> uv = new List<Vector2>();
    Vector3[] vert = new Vector3[size * size];
    List<int> tri = new List<int>();
    List<Vector3> norm = new List<Vector3>();
    meshy = new Mesh();

    for (int i = 0, x = 0; x < size; x++){
        for(int z = 0; z < size; z++){
            float y = Mathf.PerlinNoise(x * amp, z * amp) * freq;
            vert[i] = new Vector3(x, y, z);
            i++;}}

    for (int i = 0; i < vert.Length; i++){
        norm.Add(-Vector3.forward);}

    for (int x = 0; x < size - 1; x++){
        for (int z = 0; z < size - 1; z++){
            int i = size * x + z;

            tri.Add(i);
            tri.Add(i + 1);
            tri.Add(i + size);
            tri.Add(i + size + 1);
            tri.Add(i + size);
            tri.Add(i + 1);}}

    for (int i = 0; i < vert.Length; i++){
        uv.Add(new Vector2(vert[i].x, vert[i].z));}

    meshy.vertices = vert;
    meshy.triangles = tri.ToArray();
    meshy.uv = uv.ToArray();
    meshy.normals = norm.ToArray();
    meshFilter.mesh = meshy;
}

void Update()
{
    if (Input.GetKeyDown("u"))
        GenerateTerrain(frequence, amplitude);
}

sentences:
Application of Game trees in AI My specific area of interest is designing the AI of real-time multiplayer games, for example, RTS games. Moves by players happen simultaneously, so I was wondering whether or not it would be modeled with a sequential (extensive form) game tree or something else. I don't know if this is even the correct approach at all, and if some other algorithms are more applicable.

How much of Artificial Intelligence design is based off of game trees or extensive-form games, and are there any suggested textbooks which thoroughly cover the subject game tree application to AI or AI of RTS games?

sentences:
Resource and game state management for multiplayer game server I'm building a virtual world kind of engine. It's mostly for fun and learning. But I would like to get it right from the very beginning, so it is stable and can be scaled relatively easily.

I've been reading a lot lately about architecture of multiplayer real-time games (and real-time 3D games in general) but still there are some questions unanswered.

For now, I know the following:

the server will be the authority, and clients will be "slaves";
the game engine core will be based on subsystems (like physics subsystem, game logic subsystem etc.) and all the communications
between those subsystems will be implemented using pub/sub approach;
I'll use enet for networking, and my network layer will be as a separate subsystem, which will just plug into the pub/sub system (so other game server components don't have to know anything about the network layer);
physics engine - some free library, haven't decided yet. I guess, I'll use the same physics engine on the server and on the clients,
and implement client-side prediction;
I would like my server to be cross-platform (Windows and Unix/Linux) so I'm thinking about using new C++11 features (like cross-platform threading support etc.). I know, C++11 is not stable yet, but I guess, it will be stable at the time when I have something working (Visual Studio 11 Beta and the latest GCC already support many C++11 features, so I guess, it's good to go). Using C++11 I could avoid some other 3rd party libraries, like Boost;
game state storage - MySQL. I'm not yet sure, what strategy I'll use to flush the game state from memory to the database, but I think, it'll be mixed - more important state changes will be stored immediately, and less important ones will be stored in batches in some background process.

I guess, this information should be enough to see where I'm going to. And now the questions.

There are going to be lots of various resource files - textures, audio, meshes etc. Do I need a resource manager also on the game server or it will be enough to have a good resource manager on the clients only?
As the game world gets bigger and the number of clients grow, the resource manager needs lots of careful planing to avoid loading all the resources in memory and thus possibly causing low-memory issues. What is the best practice - do game servers load and keep the resources cached in RAM (and also unload them as necessary to avoid low memory issues) or this task is relayed completely to clients?

I've heard a lot about memory managers/heap allocators and how the game engine might benefit from a custom memory manager to track memory allocations, collect statistics, debug etc.
Will a custom memory manager give something valuable to the multiplayer server or it is enough to use custom macros around new/delete to track standard C++ memory allocations?

Could I use some NoSQL RAM database engine which periodically (or when there are enough dirty objects, or when system goes out of free physical RAM) flushes its state to some persistent database? Will the game server benefit from such approach? I don't want to use something just because it's modern and cool, I prefer simple (but still scalable) solutions.

sentences:
Square collision: Detect which side of the wall it collided I'm using a standard square collision in my 2D game. The player shoots little balls, and when they hit any wall it should bounce.

The problem is that I know when it hits a wall but I don't know if the collision happened on the side or top/bottom of the wall.

Here's my collision algorithm (pseudo code):

If
A.x < (B.x + B.width) AND
B.x < (A.x + A.width) AND
A.y < (B.y + B.height) AND
B.y < (A.y + A.height)
Then a collision happened

Is it easy to detect if the collision happened on a side or top/bottom? If yes how should I do it?

sentences:
XNA - Strange Texture Rendering Issue Using XNA BasicEffect I have been reading and working through Riemers 3D XNA tutorials to expand my knowledge of XNA from 2D into 3D. Unfortunately I am having rendering issues that I am unable to solve and I need a point in the right direction.

I am not expecting the Models to look identical to Blender but there is some serious discoloring from the texture files once rendering through XNA. The Character model is using completely incorrect colors (Red where Grey should be) and the Cube is rendering a strange pattern where a flat color should be drawn.

My sampling mode is set to PointClamp.

The Character model that I created has a 32 by 32 pixel texture that has been UV mapped to the model in blender. The model was then exported to .FBX. For the Cube Model a 64 by 64 pixel texture is used.

foreach (ModelMesh mesh in samuraiModel.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
        effect.Projection = Projection;
        effect.View = View;
        effect.World = World;
    }
    mesh.Draw();
}

Does this look like it is caused by a mistake I made while UV Mapping or Creating Materials in Blender?
Is this a problem with using the default XNA BasicEffect?
Or something completely different that i have not considered?

Thank You!

sentences:
How can you make a jump to a point using the Character Controller? I found an example with which the CharacterController can jump, but it does not work to remake it so that it jumps to a certain point/distance, and the jumpHeight itself was calculated for speed and gravity, I found this article on Wikipedia, but I don't even know why to begin.
public class ExampleClass : MonoBehaviour
{
    public float speed = 6f;
    public float jumpHeight = 8f;
    public float gravity = 20f;

    private Vector3 moveDirection = Vector3.zero;

    CharacterController controller;

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

    void Update()
    {

        if (controller.isGrounded)
        {
            moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
            moveDirection = transform.TransformDirection(moveDirection);
            moveDirection *= speed;
            if (Input.GetButton("Jump"))
                moveDirection.y = jumpSpeed;

        }
        moveDirection.y -= gravity * Time.deltaTime;
        controller.Move(moveDirection * Time.deltaTime);
    }

    // Method for jump, calling from other script.
    void Jump(float pointX)
    {
    }
}

I can't find examples for the Character Controller, although I did find one for the Rigidbody.

sentences:
libgdx : Scrolling background from spritesheet causes lag when sprite is repositioned... am I doing something wrong? So, I use a sprite from a spritesheet to draw the background and repeat it. (I am drawing it twice) However, the moment that the background is re-positioned to make it look infinite, it causes a lag.

What's the right way to do this without having the background image in a separate file?

BetterSprite sprite = new BetterSprite(new TextureRegion(sprites_texture), spritedef.x, spritedef.y, spritedef.width, spritedef.height);

// BetterSprite is just my extended class that returns .scaledWidth and scaledHeight for scaled sprites

this is how I draw the background

    //initial scrollingX = 0

    floor.setScale(textureScale);
    floor.setY(0);
    floor.setX(scrollingX);
    floor.draw(batch);

    // fill screen
    floor.setX(scrollingX + floor.getScaledWidth());
    floor.draw(batch);

    //fill screen
    floor.setX(scrollingX + ( floor.getScaledWidth() *2) );
    floor.draw(batch);

    if(scrollingX < -floor.getScaledWidth() ){
        scrollingX += floor.getScaledWidth();
    }

The 'scrollingX' gets updated in the doUpdate() method.

It's pretty good when scrolling, but when scrollingx<-floor.getScaledWidth() happens, I get lag.

What's the correct way to do this?

sentences:
Push or Pull Input Data In the Game Logic? In the process of preparing my game for networking I'm adding a layer of seperation between the physical input (mouse/keyboard) and the actual game "engine"/logic. All input that has any relation to the game logic is wrapped inside action objects such as BuildBuildingAction.

I was thinking of having an action processing layer that would determine what to do with the input. This layer could then be set up to either just pass the actions locally to the game engine or send it via sockets to the network server depending on whether the game was single- or multiplayer.

In network games it would make sense that the player's actions should be sent to the server, but should the game logic be pulling (polling?) the data through some sort of interface or should the action processing layer be adding the actions to an input queue in the game logic code?

sentences:
Using coroutines to instantiate larger GameObjects in Unity/C# We are making a scroller type game for mobile platforms and we got pretty far (Beta is already out). Now we are adding some additional content and are starting to experience a noticable lag when starting the game. I know about coroutines, but never actually used them, so I was wandering if it's possible to use them to instantiate larger GameObjects (or groups of objects). This is the code we use at the moment to create bullets (this is just an example, I have more similar methods):

Func<string, Pool.Poolable> bulletCreator = x => { return Instantiate(Resources.Load<Pool.Poolable>(x)) as Pool.Poolable; };

and then we use this method to create a certain amount of bullets:

Bullets = new Pool(4, () => { return bulletCreator("Bullet"); });

This creates 4 bullets (it fits our game desing, the player is restricted to 4 bullets and can refill them with powerups). There are different types of bullets that we create with the same function, and we create them at the start, pool them, and then use them when they are needed.

Now this is one of the "heavier" methods, and I'm trying to find a way to speed it up. I tried something like this:

  IEnumerator CreateBullets()
  {
     Func<string, Pool.Poolable> bulletCreator = x => { return Instantiate(Resources.Load<Pool.Poolable>(x)) as Pool.Poolable; };
     Bullets = new Pool(4, () => { return bulletCreator("Bullet"); });
     yield return Bullets;
}

Bullets is a global private variable of type Pool. The problem we are having is that when we try to shoot, Unity trhows the Object not set to an instance error.
Is what I'm trying possible, or is it like in the regular C# that no crossthread calls are allowed. If it's not possible, what are our options? I know we could probably make a short animation and run that in the coroutine while the main thread instantiates everything. Any advice is very welcome.

Thanks in advance.

sentences:
Procedurally generating dungeons using predefined rooms Most attempts at procedurally generating dungeons I have stumbled upon do space out areas that will be rooms and connect them will corridors and hallways but what about instances where you have a collection of possible rooms in various dimensions and want to generate a dungeon that uses some of these specific rooms without those corridors and connections? To answer this question I found this particular video on the topic of generating levels in Path of Exile (~5:20 - ~7:20 about the dungeon part I am referring to) which left questions open on how to technically implement the algorithm described.

In general I understand the idea but I am struggling to figure out how this would be translated into code (most efficiently) and therefore here are a few questions:

When he shows how the entire level is sliced up I could not come up with a graph that would allow to represent this structure. My naive approach would be to have the entire level consist of 1x1 rooms and arbitrarily merge nodes in the graph to form rooms of valid dimensions (valid = there is a predefined room that can be inserted there later on). What would be a suggested approach to this?
Coloring the rooms should be just assigning random distances (in a given interval) to edges of connected nodes and just applying Dijkstra to find the sequence of rooms from start to finish I presume?
When he adds branching rooms I noticed that they do not allow another alternative path to the exit (which could be random of course) but how would one implement the branching? Just a recursive traversal with diminishing chances of continuing deeper into the graph?

Description of the algorithm in the video

Step 1. Place a start and end room arbitrarily into the level (presumably with a given minimum distance to prevent degenerate layouts):

Step 2. Slice the entire level into areas that have exactly the sizes of your predefined rooms:

Step 3. Assign each room a random weighting/distance which is depicted with colors in this example:

Step 4. Find a shortest path to get a nonlinear path from start to end:

Step 5. You have your basic layout with a single successful path in which you can place random rooms of corresponding sizes that have to be connected with appropriate doors:

Step 6. Finally, add some branching rooms:

sentences:
I accidently changed the cursor image in Unity In the Unity Editor I accidently changed the image for the mouse cursor in project settings > player

How can I restore it to the default, preferably not through programming?

sentences:
What are the newest alternative to all-in-one game engines? I have been seaching a while for recent alternative to engines like unity or unreal, however, I haven't found one actively maintained that meet my needs.

For instance, I tried irrlicht with maps editors such as 3D world studio or irrEdit, but those didn't have any big feature update since 2010.

That is why I'm looking for new alternatives, here are my constrains :
- Language : C, C++ or JAVA
- Able to render 2D sprites in 3D world ( like the battles of agarest)
- Native Bumpmap support
- Lightweight
- Run both on linux and windows
- Compatible with free or low-cost map editors
- Able to do Borderless fullscreen

sentences: How do you do very simple texturing in OpenGL 3+? I managed to create a sphere (calculating all the vertices etc etc). Now I want to apply a texture on it. I have no idea how. I googled some "OpenGL 3 texture tutorials" but I can't seem to find anything simple. I am using shaders btw. Is there anywhere a very basic step by step tutorial on how to implement a texture? A texture is just an image that wraps around a shape right? Sounds simple, but from what I have seen on the web it's kinda complicated.

sentences:
Problems with Obstacle Avoidance steering behavior I learned how to implement the Obstacle Avoidance steering behavior from this tutorial. The approach depicted in this tutorial (simplified) is this (note that I'm using rectangular OBBs for obstacles, not circles):

The entity that avoids obstacles will have a 'ahead' vector, representing the entity's 'sight'. It will be equal to the velocity vector, but scaled to some length (the "sight distance").

For each entity in the "sight distance" radius from the entity, we check if it contains the the 'edge' of the ahead vector, marked with a red dot (actually the vector itself treated as a point):

For an entity that contains the red dot, we calculate the vector from the center of the entity to the red dot:

This vector (scaled by a scalar MAX_AVOIDANCE_FORCE) is the avoidance force. We apply it on our entity, and it should avoid the obstacle.

However, what happens in practice after applying the force is this:

As you can see, the entity is about to get stuck on the obstacle. That's because it doesn't sense it's about to collide, because the obstacle doesn't contain the edge of the 'ahead' vector.

So: what would be a good solution to this problem? How should I implement the algorithm?

sentences:
Unity Transform Origin during Animation I have a sliding animation on this penguin model which moves the penguin from a standing position to a belly position. During this animation, I've noticed that the object transform origin stays locked relative to the animation, using the encoded origin from blender.  In my case this is an undesired pivot point and is often buried beneath other game objects I may want to raycast against.

Ideally, I am hoping to have the origin centered in the model with respect to the XZ plane throughout the animation. Toggling the handle position tool to "Center" in the editor gives me an origin that is closer to what I would like, however I understand this is just a feature of the editor and does not reflect the true object transform.
My question for everyone is:
What are some ways I can achieve a transform that follows the body of my animation?
I have parenting an empty game object, but this transform still would not follow the body animation.
For raycasting below the body specifically, I am considering following the transform of my armature's spine which does follow the animation. Would this be a valid approach?
Any help is much appreciated!

sentences:
How to limit resolutions display in monogame I can Add resolutions to the list. Here is part of code.

List<Vector2> resolutions = new List<Vector2>();
foreach (var item in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
{

    for (int i = 0; i < item.Width; i++)
    {
        for (int z = 0; z < item.Height; z++)
        {

            resolutions.Add(new Vector2(i,z));
        }
    }
}

That is all great and dandy...but i wanna for example remove 320x200 up to 1024x768? Is there is any way to do that and how can i set/see refresh rate?

sentences:
Problem with sensor in box2d I have two bodies: one green static sensor (spikes) and one orange dynamic body (brick).

I have bullet and it's a dynamic body too, but with bullet flag set.

My problem is that when the bullet is moving left to right, it sometimes hits the orange brick instead of the spikes and it flies away. There is code to remove the bullet when it hits spikes. How can I make sure it hits the spikes first?

sentences:
Unreal Engine Linux Support I use multiple game Engines, but havn't used Unreal engine for quite a while, Now with the recent changes in Unreal Engine there are quite some interesting features which would be interesting to use in games.

However I also recently heard that UE4 recently dropped build support for Linux.
So my main 2 questions are
1. Did UE4 truly drop Linux build support?
and if so
2. Is there a way to get Linux build support in the latest version of UE4?

I can check the first question myself but due to the large engine size and my slow network connection this would take very long, so I figured it would save a lot of time if someone who already has the newest version installed knew the answer.

sentences:
Have any video game designs used non-uniform random numbers in interesting ways? A variety of video games use uniformly distributed numbers to decide the outcome of an event, such as a "50% chance to hit" almost always means to check if a random floating point number from 0-1 is greater than 0.5. Many games will layer a few of these uniform percentages on top of each other, for instance a D&D hit roll is a uniformly distributed number from 1-20, except that 1 and 20 have special outcomes. To my mind it seems like things like critical hits are added by designers to try and emulate the fact that in reality hitting/missing or winning/losing is not actually a binary outcome.

In many cases the real life amount of "damage" done by an attack would likely be closer to a gaussian/bell curve distribution, which many results in the middle but the occasional very exciting outlier and smooth curve connecting them. Dice games like Settlers of Catan emulate gaussian distributions by adding together multiple independent rolls, but I feel like I've almost never seen this mechanic in video games.

It seems like games like Civilization (Sid Meier talked extensively at GDC about player perception not matching the actual math used in the game) would benefit from results that matched how things work in the real world. Have any video games used a gaussian or otherwise non-uniform distribution of random numbers in interesting ways?

sentences:
Networking server/client library to setup p2p connection I'm making a multiplayer game, and I want to setup a p2p network.
I'm coding a server in python to make the matches and send each player it's adversary ip and port, but I'm having trouble to make udp hole punching to work.
On the client side I'm using ENET library that works over UDP.
Is there any library specific for game networking that will include all necesary from making the match to setup the p2p?

sentences:
Can you record raw sound data in XNA? XNA 4 includes the Microsoft.Xna.Framework.Audio.Microphone class which can seemingly read the raw sound data off the microphone via its API as documented:

GetData - Gets the latest recorded data from the microphone.
GetSampleDuration - Returns the duration of audio playback based on the size of the buffer.
GetSampleSizeInBytes - Returns the size of the byte array required to hold the specified duration of audio for this microphone object.

Can I read sound data using this class, record it in an array and then play it back? On the Xbox 360?

sentences: How do I make my Slick2D game fullscreen? How do I make my game fullscreen? It's always in windowed mode. I'm using Eclipse on a Mac.

sentences:
Remove "dots" noise (like from dot-matrix printer) I have 2D array of floats. Using the floats, I generate image by doing proportional selection of color from between COLOR_MIN, COLOR_MAX – for maximal float value at given (x,y), I choose COLOR_MAX and put pixel at (x,y), for minimum float value – I choose COLOR_MIN.

Resulting 128x128 image (created from 128x128 float array) is then used as texture, which is then scaled to about 500x500 size. Image displayed this way has "dot-noise", like if the image would be printed from needle printer (example image/screenshot attached below).

How to avoid the noise? I could scale the image myself to 512x512, but I probably need some filtering? Or will be setting some OpenGL (ES) options for the texture sufficient?

PS.: The image is result of GL_LINEAR magnifying filter. Using GL_NEAREST results in large pixels being clearly visible (green below). So apparently, I need programmatic filter to run on CPU.

sentences:
Dealing with curved lines in GJK I'm currently using a GJK implementation (supported by EPA for penetration) and I'm trying to optimise the calculation times of distance calculations.
One of the biggest hits is trying to solve for distance between a simple 3D shape (ie a cylinder) and a curved line in the shape of a helix (https://en.wikipedia.org/wiki/Helix).

I'm just brute forcing them by chopping the helix into a lot of smaller straight lines and solving each one against the 3D shape.

Is there a better way to do this?

The image below shows the relative shape of the objects and how they can come into contact (the red disk is the moving object). In this screenshot its contacting an end point of the curve, but it will commonly contact anywhere between the end points of the helix.

sentences: How does a developer ask for the rights to use a character? What channels must a developer go through to ask for the rights to a character? I want to make a point and click adventure based on Freddy Krueger, and I know my chances are slim, but how do you even go about asking?

sentences:
Unity Profiler - What would cause PlayerEndOfFrame to have 10-16MB in GC Alloc? I can't find much documentation on what "PlayerEndOfFrame" does. Sure it is the end of a frame but what would cause the GC Alloc to go so high?

This is the profiler results from a debug build on a remote machine using the IP connect to unity profiler.

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:
How do the PhysWalking and similar functions actually handle input? As the title may suggest, I'm developing a CustomMovementComponent and I'm on the stage where I am developing my own PhysCustom function.

As such, I am trying to copy the style of Epic's development for these functions.

One thing that has bewildered me thus far is how these functions : PhysWalking, PhysFalling etc actually handle input.

I understand that they work based on time steps but where in these functions is the input actually taken into account?

Thanks

sentences:
How to convert world coordinates to grid movement I'm producing a tactical 3D RPG game and I have the following issue:

I want the NPC to move through the grid. The grid is formed by tiles and each tile has a script attached to it. In this script, there is a variable called TilePosition which is a Vector2Int, that I use it to stores its X and Y values in the grid. The NPC character has a script attached to it called NPCPlayer, where a use a Vectir2Int named NPCGridPosition to stores its position in the grid.

Also regarding the NPC, he has a script called NPCMovement. In this script, I've set a raycast that starts from the NPC feet and goes down. I use the raycast to take the TilePosition variable as it is written in the code:

public void MoveNPC()
    {
        if (Physics.Raycast(transform.position, Vector3.down * MaxDistance, out hitDown))
        {
            if(hitDown.transform.tag == "Tile")
            {
                Tile TilesPosition = hitDown.transform.gameObject.GetComponent<Tile>();
                NPCPlayer NPCPosition = this.GetComponent<NPCPlayer>();
            }
        }
    }

However, when I try to move the NPC through the grid, 3 rows ahead, he goes away, because he moves according to the world position, rather than moving according to his tile position.

I'm using these lines of code to make him move:

public void MoveNPC()
    {
        if (Physics.Raycast(transform.position, Vector3.down * MaxDistance, out hitDown))
        {
            if(hitDown.transform.tag == "Tile")
            {
                Tile TilesPosition = hitDown.transform.gameObject.GetComponent<Tile>();
                NPCPlayer NPCPosition = this.GetComponent<NPCPlayer>();

                targetPosition.x = TilesPosition.TilePosition.x + 3 ;
                targetPosition.y = TilesPosition.TilePosition.y;

                this.transform.position = Vector3.MoveTowards(this.transform.position, targetPosition,velocity);
            }
        }
    }

How could I make the NPC to move according to its position in the grid?

I'll be glad if someone can help me a little bit with this.

sentences:
In Photon, What happens networked GameObject's ownership when master client disconnects? I'm creating multiplayer game with Photon. When player disconnects, especially master client does, every GameObject instantiated from Master client is gone, so I can prevent with this:

PhotonNetwork.autoCleanUpPlayerObjects = false;

Now GameObjects are still there even Master is gone, but what about their ownership? I needed to destroy some of enemies when they dies, but if master is gone and other player got selected as Master, is he automatically receive ownership of them too?

If not, is there a way to do that automatically? Any advice will very appreciate it!

sentences:
Can I use p/invoke in libraries loaded as assets in Unity Free? I am interested in using utilising third-party libraries in Unity Free.

I know Unity can use managed libraries as assets, but only the Pro version supports using native libraries (DllImport within scripts). This thread, however suggests that it is possible to import DLLs in the free version.

I would like to utilise native libraries (as a hobbyist I cannot afford the Pro version), but want to do it the supported way so I don't have to worry about Unity 'fixing' this hole if that is what it is.

Is there any supported way to use native libraries with Unity free (in other words, is the method described in that thread using DllImport safe and reliable, or is it a workaround that might be patched away)?

sentences:
Why are most characters all the same height in games? In the majority of video games I play, I notice that NPC's are the same height. What's up with that?

It kinda takes me out of the experience, when I see ten people in a row that are 5 foot 8. Anyone else notice this, or am I crazy?

sentences:
Color Correction in DirectX After playing games like Star Wars Battlefront & GTA 5 I was wondering how dev's implement Color Correction in their Engines. I know that this can be done through the use of 3D LUT's but I was wondering if there are any other ways to do this. A good example of this would be in GTA 5 when a Characters special ability is triggered the colors on screen have a tint applied to them which over a period of 2 seconds the intensity of the effect gradually increases.

https://www.youtube.com/watch?v=LNGF7J3y5_Y

If someone can explain how this is done/ implemented that would be great.

sentences:
creating model mesh and face explosions on Panda3d and Blender I'm quite new to Panda3d and Python (1 year) and I've been trying for longer than 4 months to find out how to create a simple mesh explosion in Panda3d.
I've created lots of different explosions using Blender and they all look good and work fine in Blender but when I export them through .x or .egg files the animation is always blank. I know Panda3d normally uses armature to do animations but with a mesh explosion on a space ship or box or any static object it does not have armature and maybe this is why it never really exports the visual effect...
I've been trying so long now just to explode anything on Panda3d but cannot work out how to go about this. It's really getting me down as the particle effects panel is great for things like smoke and fire, etc but I want to see the actual mesh and faces explode into pieces, so I can continue working and learning how to create and develop games.
I've looked into everything on the web and Blender and Pand3d but can't find anyone or anything that has had this problem or solution.
I've got demo code but I'm not sure how to upload the models I've created. Do I need to include them here as it's not the code that is the problem but the .egg files and Blender...
The models I've created have separate animation files and I've tried animation files within the .egg. I've got other animated models to work so I know it's not that, like I said I've tried everything and all the different export settings and combinations to get my ship to explode.

sentences:
Dividing coordinate into unit cube I'm trying to write a Java class to generate Perlin Noise from a Cartesian coordinate. I'm trying to follow this tutorial but I am struggling to understand the theory.

Specifically, how do you divide coordinates into a unit square or unit cube?

My original though was to a find which was higher the X or Y, then divide one by the other, So either X = 1, y < 1, or Y = 1, X < 1. But doing this doesn't really make sense as the point would always lie on one of the cube/square vertices.

Can someone explain the math to me please.

sentences:
Does using [STAThread] with XNA have any negative implications? I'm working on a game in XNA, which has an inbuilt level editor. To facilitate this I want use the FileOpenDialog from Winforms. I followed the instructions as per this answer. This involves setting the [STAThread] attribute on my Program class.

Does using STAThread have any negative implications? Meaning will it cause worse performance or limit me in some way?

sentences:
Game loop delta, factoring execution time? Was thinking this morning, I 99.9% of the time, only see a main game loop, looking like this, just as much so where the delta is passed into update():

while running
getDeltaTime()
...
f(deltatime)
---

Now the question I was thinking to myself was what if between getDeltaTime() and f(deltaTime), the code in the middle took 1 second (large value to be easy). That means f(deltaTime) would have moved whatever object less distance than it was supposed to. This would of course be solved by grabbing the delta time directly before it is used.

Should this be a factor to be concerned with in any case?

sentences:
How do I create the formula for calculate the damage of a skill I'm trying to calculate the output damage of a skill. The skill can go up from level 1 to 100, it can scale with own levels and the attack of the character.

Here some parameters

Edit:

I need a formula for determine the amount of damage that a skill or ability can do.

I have some data that I don't have create myself, but I just taken from a game.

A character can grow up from lv 1 to 100, and he has a set of skills.

Every skill can go up from lv 1 to (current level of the character)

The skill damage is linear but influenced of character's attack, so more attack the character has and more damage can do the skill.

A character that we call John has the follow parameters

Max stats that John can reach

Level 100
Attack 7337
Skill damage (lv 100) 16574

Minimum stats

Level 1
Attack 71
Skill damage (lv 1) 479

The current stats of John

Level 13
Attack 202
Skill damage (lv 13) 805

When the skill was a previous level

Level 13
Attack 202
Skill damage (lv 12) 788

In theory the skill damage should get 7 points for level, of course with the current amount of John's attack, but is linear.

What I'm trying to do is get the basic damage of a skill plus the correct multiplier

sentences:
Can I keep get out of Unity editor features if I'm using ECS Pattern? I'm learning about ECS Pattern to use it in my Unity game, as I saw until now, most of stuffs is created by code.

As I know, each Unity GameObject is a Entity which contains many of Components and GameObjects are instantiated by code (created by my script, for example).

My question is, when I use ECS Pattern, can I keep using the bunch of features offered by Unity editor (like Prefabs, ScriptObjects, Drag Dropg to position, etc) or I need to control all of them by code?

sentences:
Should pathfinder in A* hold closedSet and openedSet or each object should hold its sets? I am about to implement A* pathfinding algorithm and I wonder how should I implement this - from the point of view of architecture.

I have the pathfinder as a class - I think I will instantiate only one object of this class (or maybe make it a Singleton - this is not so important).

The hardest part for me is whether the closedSet and openedSet should be attached to objects that can find the path for them or should be stored in pathfinder class ?

I am opened to any hints and critique whatsoever.

What is the best practice considering pathfinding in terms of design ?

sentences:
Colors set in Blender not displayed in XNA I'm trying to create a colored 3D model for my XNA game in Blender. I don't want to use textures - I need only solid colors. Here's the model, as seen in Blender:

After exporting to FBX and opening in Visual Studio 2012 (some kind of built-in viewer I guess), the lightning isn't perfect but the colors are preserved:

But something's wrong when I try to display it using XNA:

Here's my code for displaying objects:

protected void DrawModel(GameObject obj, bool semitransparent = false, float angle = 0.0f)
{
    var transforms = new Matrix[obj.Model.Bones.Count];
    obj.Model.CopyAbsoluteBoneTransformsTo(transforms);

    foreach(var mesh in obj.Model.Meshes)
    {
        foreach(BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();

            Game.GraphicsDevice.BlendState = semitransparent ? BlendState.AlphaBlend : BlendState.Opaque;
            effect.Alpha = semitransparent ? 0.5f : 1.0f;

            if(obj is Player == false)
                effect.DiffuseColor = obj.IsHighlighted ? new Vector3(1.0f, 0.0f, 0.0f) : new Vector3(1.0f, 1.0f, 1.0f);

            effect.World = transforms[mesh.ParentBone.Index]*Matrix.CreateRotationY(angle)*obj.TransformMatrix;
            effect.View = ViewMatrix;
            effect.Projection = ProjectionMatrix;
        }

        mesh.Draw();
    }
}

Why is the whole model white instead of colored? I set colors of the parts by creating a new material and setting its diffuse component to the color I want. All other settings have their default values.

I thought that it's a matter of setting effect.VertexColorEnabled to true, but that gives me an InvalidOperationException saying The current vertex declaration does not include all the elements required by the current vertex shader. Color0 is missing.. Do I need some kind of shader that will understand Blender's vertex properties and will display the model correctly?

sentences:
Different resolution for UI? I'm developing my first game for mobile devices in Unity3D. My game uses a 720p-resolution. Currently the UI uses the same one. So far so good.

I heard that professional game-developers create their games in a way where the UI uses a much higher resolution than the game itself in order to deliver high-definition graphics for the UI-system.

So in my case does that mean I have to create a much higher resolution for the UI so it looks crisp and sharp even on large mobile-displays (e.g. tablets like the iPad Pro, etc.)? Is 1080p a good resolution for the UI I'm creating? Or shall I stick with 720p? If I use e.g. 1080p for the UI do I need to scale down the UI in Unity3D?

sentences:
I am getting different results when using 'Maximize on play '? so i'll be straight to point.
when i move my character without using 'max on play' it works fine just as i wanted it to be.
but when i switch to 'max on play' my character moves very fast.
i am using addForce() to make me character move in Update().
after some googling i found that as i am working with physics i need to use FixedUpdate();
But when i tried with fixed update i felt like it was not registering the keystrokes as it would in Update().
i would really appreciate if someone would help me out here.
Edit - Movement Script Added
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    [SerializeField] float jump_speed;
    [SerializeField] float walk_speed;
    [SerializeField] float max_speed;
    Rigidbody2D rb;
    int jump_counter;
    Animator animator;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        animator = GetComponent<Animator>();
        jump_counter = 0;
        animator.SetBool("isIdle", true);
        animator.SetBool("isWalkingLeft", false);
        animator.SetBool("isWalkingRight", false);
    }
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space)  && jump_counter <=1)
        {
            rb.AddForce(transform.up * jump_speed);
            jump_counter++;
        }
       else if (Input.GetKey(KeyCode.D))
        {
            rb.AddForce(transform.right * walk_speed);
            PlayWalkingRightAnimation();
        }
       else if (Input.GetKey(KeyCode.A))
        {
            rb.AddForce(-transform.right * walk_speed);
            PlayWalkingLeftAnimation();
        }
        else
        {
            if(jump_counter<=0) PlayIdleAnimation();
        }
    }
    void FixedUpdate()
{
     rb.velocity = Vector2.ClampMagnitude(rb.velocity, max_speed);

}
    private void OnCollisionEnter2D(Collision2D collision)
    {
        jump_counter = 0;
    }

    void PlayWalkingLeftAnimation()
    {
        animator.SetBool("isWalkingLeft", true);
        animator.SetBool("isWalkingRight", false);
        animator.SetBool("isIdle", false);
    }
    void PlayWalkingRightAnimation()
    {
        animator.SetBool("isWalkingRight", true);
        animator.SetBool("isWalkingLeft", false);
        animator.SetBool("isIdle", false);
    }
    void PlayIdleAnimation()
    {
        animator.SetBool("isWalkingLeft", false);
        animator.SetBool("isWalkingRight", false);
        animator.SetBool("isIdle", true);
    }

}

I have added whole script hope this helps understand my problems.

sentences:
Why is my Admob reward interstitial ad connected to Unity stuck on pending? I am trying to better monetize my game by using rewarded interstitials. I have set these up on my admob console. I have also linked the ad source on the admob console to my game through the Unity ads service using my game's id.

It seems to be stuck on "pending". I can't find any further options on admob or on the unity ads console to remedy this. In the game itself, my rewarded ads are not loading.

Is there some step I am missing either through Admob or Unity ads? How long does pending take because it has been like this for a few days.

Edit with more info
Unity version 5.5.1f1
I am using the example code from the admob site (I removed my apps id's here for privacy reasons):

    public RewardBasedVideoAd nonskipInterstich;
    public void NonSkipGoogleAd(){

    #if UNITY_ANDROID
    string adUnitId = "--------------------------------------";
    #elif UNITY_IPHONE
    string adUnitId = "------------------------------------------";
    #else
    string adUnitId = "unexpected_platform";
    #endif

    nonskipInterstich = RewardBasedVideoAd.Instance;

    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder().Build();
    // Load the interstitial with the request.
    nonskipInterstich.LoadAd(request, adUnitId );

    nonskipInterstich.OnAdFailedToLoad += LogFailedToLoadError;

}

if I display the failed to load event I get "No fill".
I haven't ever gotten it to fill a request, but I am only using remediation linked to the UnityAds source.

I read a post online that recommended importing the Unity Ads plugin from the asset store into the project. I did this and the google request is still not filling. I do not use the unity ads plugin directly to make the request. I also have the unity ads adapter jar found here

sentences:
Quaternion rotation is inverse of what I expect I'm trying to learn quaternions and decided to implement my own quaternion class.

To test it I made a couple vertex shaders, one that gets a model matrix (calculated from the quaternion) and another that gets the rotation quaternion directly and rotates vertices in-shader.

I then feed these a quaternion that rotates around the Y axis t / 10000 radians (t = time):

const rotation = Quat.fromAxisAngle(new Vec3([0, 1, 0]), t / 10000)

The result surprises me because my model is rotating counter-clockwise but I expected it to rotate clockwise, since the angle is increasing (checked it, quat's xyz increase with time). Rotation around the X or Z axes is also backwards.

All translations as well as matrix rotations work as expected in my coordinate system. I suspect my formulas are wrong, and probably assume +Z is forward. If I transpose my model matrix (or post-multiply with it) it rotates as expected, which suggests it's a handedness problem.

Where are my formulas wrong and how can I understand the math behind this?

Details

My matrices are column-major in memory (to match GLSL's mat4).
My coordinate system is +X right, +Y up, -Z forward.

My code

Quaternion from axis + angle

function fromAxisAngle(axis: Vec3, angle: number, dest = new Quat()): Quat {
  angle *= 0.5
  const sin = Math.sin(angle)

  dest.x = axis.x * sin
  dest.y = axis.y * sin
  dest.z = axis.z * sin
  dest.w = Math.cos(angle)

  return dest
}

Note: I noticed if I negate this quaternion's x, y and z, everthing works as expected. Is this the root cause? I thought quaternions didn't have handedness!

Since this is actually just inverting the quaternion (and thus its rotation) I'm afraid I'm just patching over the root cause. I don't want to patch the issue, I want to fix my math!

Matrix from quaternion

toMat4(dest = new Mat4()): Mat4 {
  const { x, y, z, w } = this

  const x2 = x + x
  const y2 = y + y
  const z2 = z + z

  const xx = x * x2
  const xy = x * y2
  const xz = x * z2
  const yy = y * y2
  const yz = y * z2
  const zz = z * z2
  const wx = w * x2
  const wy = w * y2
  const wz = w * z2

  // Notice matrix is column-major
  // Source:
  // https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Quaternion-derived_rotation_matrix
  dest.init([
    1 - (yy + zz), xy - wz,       xz + wy,       0,
    xy + wz,       1 - (xx + zz), yz - wx,       0,
    xz - wy,       yz + wx,       1 - (xx + yy), 0,
    0,             0,             0,             1,
  ])

  return dest
}

Matrix vertex shader

precision mediump float;

attribute vec3 aVertexPosition;
attribute vec2 aVertexUV;

uniform mat4 uModelMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;

varying vec2 vUV;

void main(void) {
  vUV = aVertexUV;

  gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aVertexPosition.xyz, 1.0);
}

Quaternion vertex shader

precision mediump float;

attribute vec3 aVertexPosition;
attribute vec2 aVertexUV;

struct Transform {
  float scale;
  vec3 translation;
  vec4 rotation;
};

uniform Transform uModel;
uniform Transform uView;
uniform mat4 uProjection;

varying vec2 vUV;

// Source:
// https://twistedpairdevelopment.wordpress.com/2013/02/11/rotating-a-vector-by-a-quaternion-in-glsl/
vec3 rotateVector(vec4 quat, vec3 vec) {
  return vec + 2.0 * cross(cross(vec, quat.xyz) + quat.w * vec, quat.xyz);
}

void main(void) {
  vUV = aVertexUV;

  vec3 world = rotateVector(uModel.rotation, aVertexPosition * uModel.scale) + uModel.translation;
  vec3 view = rotateVector(uView.rotation, world * uView.scale) + uView.translation;

  gl_Position = uProjection * vec4(view, 1.0);
}

sentences:
Collision detection between triangle and polygon I have some difficulties to understand how to be sure if there is a collision between a space ship (black) and an asteroid (in blue). A space ship is placed on a case and an asteroid comes from the right, like on the image.

Also Y1 != Y2, there are not exactly on the same line. What is the best way, in that case, to detect if there is a collision ? Is AABB collision the correct algorith I need ?

sentences:
Problem with baked lights I'm working on a 3D gallery experience and I'm having some difficulties regarding directional and point baked lights.

When I build it for web with webgl, only global lights are rendered, but when my prefabs are triggered those rooms comes with the directional/point lights perfectly working, and all planes and lights have the same config... I have spend to much time trying to get them right or understanding why is this happening, any help would be appreciated.

sentences:
Creating placement grid in Unity I'm fairly new to C# and Unity, so I don't really know much about it.

I want to create an RTS like game where you have a huge grid that the whole world is placed on. Then you can place houses, walls etc on the tiles just like a lot other RTS games (i.e. Age of Empires, Stronghold Series etc).

How would I go about this in Unity? I could imagine having some Terrain/World manager that handles all the models and objects that you can interact with etc. And probably a lot of prefabs too with the different items, soldiers and so.

So if anyone have any smart way of doing this or maybe a link to a tutorial explaining, then the help would be greatly appreciated.

sentences:
Complex Game AI for Turn-based Strategy Games I'm doing some research for a turn-based Strategy game project and looking for good resources on this topic. The game is a typical war game where countries can fight each other, deploy units and have these units move around on a hexagonal tilemap, attack each other, etc.

I'm particularly interested in how the AI of Civilization V is organized! According to Wikipedia the game uses four different AI systems for different layers of the game's AI:

tactical AI controls individual units
the operational AI oversees the entire war front
the strategic AI manages the entire empire
the grand strategic AI sets long-term goals and determines how to win the game

Conceptually this looks like it makes a lot of sense to achieve a complex AI and it makes me curious to find out about how these different AI systems work (and work together). The tactical AI is probably the most easy to understand since it handles the decision-making for a single unit (move, attack, repair, retreat, etc.) but I think the other AI systems are where it really gets interesting. For example what does the operational AI do and how does it do that? I'm sure these are best-kept secrets by Firaxis Games but it would be cool to get some discussion started on this to find out more about it.

Also if anyone knows any good books that handle turn-based strategy game AI it would be great to know. Obviously this is a sparsely seeded topic on the web. I got "Programming Game AI by Example" but that book is more about single agent behavior AI than high-level goal-oriented AI.

sentences:
Why must the transpose value of glUniformMatrix4fv in webgl/OpenGL ES be false? Why must the transpose value of glUniformMatrix4fv in webgl/OpenGL ES be false?

The OpenGL ES spec says that the transpose value must be false or an INVALID_VALUE is generated. Why then have the parameter?

sentences:
Why object spawn duplicate and double sides.? I have a script, I am using this script to instantiate new path and also wall (as border) to generate new path and wall. Before some time all scripts work fine. but at this time my player enter in empty trigger collider 3 times to generate new path.

I am using capsule as player and also capsule collider. when my game start my player enter 2/3 times to empty collider(PathSpawnCollider) so it give me unwanted path and boundary walls.

Any one can help me what is problem here in my code.?

PathSpawnCollider.cs

using UnityEngine;
using System.Collections;

public class PathSpawnCollider : MonoBehaviour {

public float positionY = 0.81f;
public Transform[] PathSpawnPoints;
public GameObject Path;
public GameObject DangerousBorder;
public Transform[] BorderSpawnPoints;

void OnTriggerEnter(Collider hit)
{
    //player has hit the collider
    if (hit.gameObject.tag == "Player") {

            //find whether the next path will be straight, left or right
            int randomSpawnPoint = Random.Range (0, PathSpawnPoints.Length);
            //int randomBSP = Random.Range (0, BorderSpawnPoints.Length);
            for (int i = 0; i < PathSpawnPoints.Length; i++) {

                //instantiate the path, on the set rotation
            if (i == randomSpawnPoint) {
                Debug.LogError ("Value of if i : " + i);
                Instantiate (Path, PathSpawnPoints [i].position, PathSpawnPoints [i].rotation);
            }
                else {
                Debug.LogError ("Value of else i : "+i);
                    //instantiate the border, but rotate it 90 degrees first
                Vector3 rotation = BorderSpawnPoints [i].rotation.eulerAngles;
                    rotation.y += 90;
                Vector3 position = BorderSpawnPoints [i].position;
                    position.y += positionY;
                    Instantiate (DangerousBorder, position, Quaternion.Euler (rotation));
                }
            }
        }
    }

}

sentences: Game with static scene and bouncing balls. How to? How to make a game with a static scene and balls that can bounce on it? What is used for this, generally? Physics engines? Even if this is a simplistic example?

sentences:
Geometric clipping of triangles intersecting near plane I was reading about how rasterization works but there is one topic I can't quite understand.
After perspective projection, our point is in clip space as I understand it.
Now we test all points in a triangle like so
rejected = true
for every point:
   if (abs(point.x) <= abs(point.w) &&
      abs(point.x) <= abs(point.w) &&
      abs(point.x) <= abs(point.w)
      point.w > 0) {
      rejected = false;
    }

So the triangle is only rejected if all points are behind the near clipping plane or fall out boundaries, but it can happen that one point is behind the near clipping plane and others are in front.
Now there is a part I don't understand.
To deal with this we somehow clip points in 3d space by constructing new triangles.
So how is this exactly works?
And why we can't just interpolate our z values to test if the point is behind or in front of the near plane?

sentences:
Libgdx crash on dispose()? Whenever I try to manually call the dispose method in one of my screen my game just crashes.

My dispose looks something like this

@Override
public void dispose() {
    battletheme.dispose();
    renderer.dispose();
    bg.dispose();
    enemy.dispose();
    dialouge.dispose();
    GameTools.fontText.dispose();
}

and I use

this.dispose();

When I switch to another screen, otherwise my memory begins to pile up. Is there any reason for this?

EDIT: My spritebatch called "renderer" seems to crash on dispose, any reason?

sentences:
Why are games using interpreted languages instead of compiling code into libraries and calling them at runtime? Say I want to include a game mechanic where players are invited to code up some algorithm to control robots which would defeat the enemy and protect the tower efficiently. Most games I've seen to implement something like that, support Lua. But what if they accepted a .Net compiled library with implemented in C# (or Java for example) interfaces, essentially doing the same thing? How is it a better or a worse choice?

Code may (not) compile in either case. Some players may (not) be familiar with one of the languages. The computer may not have .Net (or Java) framework installed (but then the game usually comes with at least some redistributable packages, so it may as well include those too). These obvious arguments go either way. Is there some important reason that interpreted languages are the norm, and not compiled which I'm not aware of?

sentences:
Literature about Open World Games, Freedom to Choose I'm doing a diploma thesis about the development of games with freedom to choose or open world.

Topics will be i.e. development issues in programming and the design itself, mechanics etc.

For that I need literature and lot's of it. Do you have any suggestions?

sentences:
What is a Game Engine? I am new to Game Development, All I have developed is some 2d Games, using Game Maker by YoYo Games. There game development is much more easy, just as simple as Drag and Drop.
But, Now I wish to evolve in Game Development, and wanna try some hands with the common programming languages like, Java, C++ or C. In order to achieve this, I came around the first topic, Game Engine.
So, What is Game Engine.?
That is a broad question, with various answers. I came out with some conclusion after reading various links,

Wikipedia:
A game engine is a system designed for the creation and development of video games. The core functionality typically provided by a game engine includes a rendering engine for 2D or 3D graphics, a physics engine or collision detection (and collision response), sound, scripting, animation, artificial intelligence, networking, streaming, memory management, threading, localization support, and a scene graph.
GameCareerGuide.com
It exists to abstract the (sometime platform-dependent) details of doing common game-related tasks, like rendering, physics, and input, so that developers (artists, designers, scripters and, yes, even other programmers) can focus on the details that make their games unique.
Engines offer reusable components that can be manipulated to bring a game to life. Loading, displaying, and animating models, collision detection between objects, physics, input, graphical user interfaces, and even portions of a game's artificial intelligence can all be components that make up the engine.

Now what I understand is, Game Engine takes care of all the common work, like physics, loading etc...
As far my question is concerned, what is a Game Engine (Programmatically)?
Is it a Library? With pre-defined functions and classes, which can be inherited? Or what so ever, what is it?

sentences:
Subtract waves from tilemap I'm wondering how I could create a shader that would turn a randomly generated shape like this:

And turn it into something more like this:

Essentially just creating a top down view of ocean waves that would flow in and out. I would prefer to be able to subtract this shape from a tilemap.

Any resources or pseudo code on how I could get started with this would be great.

sentences: How to put the output of one game into another? I want to add the screen of vrchat into a unity game environment so that I could play vrchat from a screen inside the unity environment. Is that possible? If not, why not?

sentences:
Which Design Patterns Should I consider for Quest Management? I am working on an fantasy RPG and I would like to get some ideas about how I am implementing Quests.

Quests in my game are very generic. The quest goal can be almost anything in the game. The goal can be: press a GUI button; pick up a certain object; kill a creature; steal an object; collect 10 items; walk to a certain location; etc. Therefor, quests need to be somehow tied to many other objects in my game.

I've been flirting with the Observer design pattern, but I'm not sure if this is the best approach.

Currently, my Quest Manager singleton is an observer, and it registers itself with many subjects. For example, I have a menu class with GUI buttons that has an EventHandler, and the Quest Manager registers with the menu class to have its own function called when a certain button is pressed. When the function gets called, the Quest Manager checks to see if the "Press the button" quest is in progress, and if it is, then that Quest becomes "Completed"!

Is this a good design or are there other design patterns that I should consider?

sentences:
Physx gravity not working as expected We have been facing a strange issue with physx vehicles. The game behaves correctly in almost every situation: jumps, impacts, etc.

Gravity is applied correctly downward.

But when the vehicle is put upside down in a track, in a loop or twist, somehow it's stuck to the track as if SpiderCar was playing.

Find a video of it here. And an image below:

We are using PxVehicleUpdate::updateDrive4W as coming in the framework version 3.2.2
So the call is just

void VehicleManager::updateVehicle(const PxF32 timestep,
const PxVec3& gravity,PxVehicleDrivableSurfaceToTireFrictionPairs * mSurfaceTirePairs)
{
    PxVehicleUpdates(timestep,gravity,*mSurfaceTirePairs,mNumVehicles,mVehicles);
}

Gravity is a vector (0.0,-9.8,0) being Y the vertical coordinates.
Inside it calls updateDrive4W for all the vehicles, which is about 400 lines

sentences:
Simple collision detection for pong I'm making a simple pong game, and things are great so far, but I have an odd bug which causes my ball (well, it's a box really) to get stuck on occasion when detecting collision against the ceiling or floor. It looks as though it is trying to update too frequently to get out of the collision check.

Basically the box slides against the top or bottom of the screen from one paddle to the other, and quickly bounces on and off the wall while doing so, but only bounces a few pixels from the wall.

What can I do to avoid this problem? It seems to occur at random. Below is my collision detection for the wall, as well as my update method for the ball.

public void UpdatePosition()
{
    size.X = (int)position.X;
    size.Y = (int)position.Y;
    position.X += speed * (float)Math.Cos(direction);
    position.Y += speed * (float)Math.Sin(direction);
    CheckWallHit();
}

// Checks for collision with the ceiling or floor.
// 2*Math.pi = 360 degrees
// TODO: Change collision so that ball bounces from wall after getting caught
private void CheckWallHit()
{
    while (direction > 2 * Math.PI)
    {
        direction -= 2 * Math.PI;
    }

    while (direction < 0)
    {
        direction += 2 * Math.PI;
    }

    if (position.Y <= 0 || (position.Y > resetPos.Y * 2 - size.Height))
    {
        direction = 2 * Math.PI - direction;
    }
}

sentences:
Space of Tangent and Bitangent Vectors I have a really simple question I cannot be sure about the answer.

What is the space of tangent (T), and bitangent (B) vectors when we calculate them using vertex positions, and texture coordinates?

sentences:
Can't change the textures of a .FBX or an .X exported from 3dsmax I created a model (real simple) in 3DSMax 2010, exported it to FBX format and loaded it in an XNA 4.0 content project. I also tried with .X files using kW X-port and it has the same behavior.

I can load the model in a game, and it has it's 3DSMax texture. I can't however change the texture of a face (or all) at runtime. When I do this, it doesn't crash or anything, it just doesn't apply the textures.

I've tried with a sample model from a microsoft creative tutorial (the famous spaceship one) and on that model, with my texture, it works. This is why I think my model isn't working properly.

Anyone care to comment/help?

Note: Even though I don't think the problem is there since I've made it work with another model, here is my LoadContent method to load the model and change the texture of all mesh :

protected override void LoadContent()
{
    base.LoadContent();

    ContentManager contentManager = new ContentManager(Game.Services, "Content");

    Model = (Model)contentManager.Load<Model>(ModelName);
    Texture = (Texture2D)contentManager.Load<Texture2D>(TextureName);

    foreach (ModelMesh mesh in Model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.Texture = Texture;
        }
    }
}

sentences:
Make object follow mouse angle? what I'm trying to do is make the paddle follow the mouse position(red dot).
I know how to rotate the paddle relatively to the center of the screen, but I'm not sure how to determinate the coordinates.

thanks.

sentences:
how can I add animated shadow on my flag? this is my flag:

I need to adding shadow effect on my animated flag like below image but I don't know how can I do this:

here is my shader:

Shader "Custom/Flag" {
    Properties {
        _MainTex ("Texture", 2D) = "white" {}
        _Ambient ("Ambient", Range(0., 1.)) = 0.2
        [Header(Waves)]
        _WaveSpeed("Speed", Range(1,50)) = 20
        _WaveStrength("Strength", Range(0.0, 1.0)) = 0.0
    }

        SubShader {
        Cull Off
        CGPROGRAM

        #pragma surface surf Standard fullforwardshadows vertex:vert

        #pragma target 3.0

        struct Input {
          float4 pos : POSITION;
          float2 uv_MainTex: TEXCOORD0;
        };

        struct VertexInput{

          float4 vertex : POSITION;
          float4 texcoord : TEXCOORD0;
          float3 normal : NORMAL;

        };

            float _Ambient;
            sampler2D _MainTex;

            // Compute the diffuse light
            fixed3 diffuseLambert(float3 normal)
            {
                float diffuse = max(_Ambient, dot(normalize(normal), _WorldSpaceLightPos0.xyz));
                return _LightColor0.rgb * diffuse;
            }
            float _WaveStrength;
            float _WaveSpeed;

            // Deformation
            float4 movement(float4 pos, float2 uv) {
                float sinOff = (pos.x + pos.y + pos.z) * _WaveStrength +_Time.z;
                float t = _Time.y * _WaveSpeed;
                float fx = uv.x;
                float fy = uv.x * uv.y;
                pos.x += sin(t * 1.45 + sinOff) * fx * 0.5;
                pos.y = sin(t * 3.12 + sinOff) * fx * 0.5 - fy * 0.9;
                pos.z -= sin(t * 2.2 + sinOff) * fx * 0.2;
                return pos;
            }

        void vert (inout VertexInput v, out Input o){
            UNITY_INITIALIZE_OUTPUT(Input,o);

            float sinOff=v.vertex.x+v.vertex.y+v.vertex.z;
            float t=_Time*_WaveSpeed;
            float fx=v.texcoord.x;
            float fy=v.texcoord.x*v.texcoord.y;

            v.vertex.x+=sin(t*1.45+sinOff)*fx*0.5;
            v.vertex.y=sin(t*3.12+sinOff)*fx*0.5-fy*0.9;
            v.vertex.z-=sin(t*2.2+sinOff)*fx*0.2;

              o.pos = UnityObjectToClipPos( v.vertex );
              o.uv_MainTex = v.texcoord ;
        }
        void surf (Input IN, inout SurfaceOutputStandard o) {
            o.Albedo = tex2D(_MainTex,IN.uv_MainTex);
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Update:

finally I use normal vector for shading but shadow isn't smooth how can I fix this:

v.normal.x+=sin(t*1.45+sinOff)*fx*0.5;
v.normal.y+=sin(t*3.12+sinOff)*fx*0.5-fy*0.9;
v.normal.z-=sin(t*2.2+sinOff)*fx*0.2;

sentences:
Unity3D: Making heavy calculation on separate thread So, I've created a program with Kinect as its input. As you know, Kinect will send the data 30 frame per second.

I have a model that will mimic Kinect's input motion, so on Update() I read the motion from Kinect.

The problem is, on Update(), I've done a heavy computational algorithm. It makes the system lag and freezing. I've tried to do the calculation every 60 frames instead of each frame, but the system still got lag.

void Update(){
        ...
        //GET DATA FROM KINECT
        frame = new SkeletonRecorded();
        frame.root.rotation = skeletons[kinect2SensorID, playerID].root.rotation;
            ...
        frame.rightShoulder.position = skeletons[kinect2SensorID, playerID].rightShoulder.position;
        frames.Add(frame);
        if (frames.Count >= 60) {
            //CALLING THE CALCULATION METHOD (Here is the heavy part begin)
            comparatorClass.GetSkeletonData(frames);
            frames.Clear();
        }

}

The above code is just small parts of the Update() method (I cut it short for convenience). So, how should I call the GetSkeletonData() method without making the interface lag?

sentences:
Unity: Failed to build APK. See console for details i am getting this error whenever i am trying to build a project. i looked at so many solutions but this one just doesn't go away.

This is the error:

CommandInvokationFailure: Failed to build apk.
C:\Program Files\Java\jdk-9\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Mohit/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at SDKMain.main(SDKMain.java:130)
Caused by: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
    at com.android.sdklib.internal.build.SignedJarBuilder.<init>(SignedJarBuilder.java:177)
    at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)
    at UnityApkBuilder.<init>(UnityApkBuilder.java:214)
    at UnityApkBuilder.main(UnityApkBuilder.java:34)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 11 more
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()

what i have tried so far:

1) downgrading android sdk
2) moving zipalign file from build-tools to tools folder
3) setting up keystore

sentences:
How much latency can I expect from Apple Game Center connections? I would need a few bytes of data roughly every 0.1 seconds between players to have a smooth multiplayer snake game on iOS.

Is the iOS Game Center fast enough for this? What latency values can I expect?

sentences:
How can I make iPhone apps (games) on Windows? I want to start making iPhone games, but sadly I'm a Windows geek.. Is there a way to make good profesional iPhone games without Xcode/owning a Mac computer?

If not, what do you recommend, a Mac Mini?

Thanks in advance!

sentences: Unity Ragdoll moves away from parent So this is a weird one. I've looked it up but can't find anyone with similar issues. Basically I have a simple combat system and after the enemy health is zero I go through each rigidbody component in the enemy object and add a force to make it go flying on death. For some reason, the parent object isn't affected and stays still while the Skeleton goes flying. Does anybody know how to make the parent object follow the skeleton, or make the skeleton follow the parent because as of now they act as separate entities? I've tried just adding force to the parent but that only moves the parent object and none of the children. Would appreciate any advice! Thanks.

sentences:
UI Toolkit, Get the topmost Element under the cursor Basically, I'm making a small node system, Just for fun.
And I need to know if I can get the topmost Element under the cursor. I need it to connect nodes.
Thanks!

sentences:
Get GPU Visualizer widget info I want to read some info from the GPU Visualizer widget and use it in my plugin, but I have no idea how.
I guess this code is responsible for running the ProfileGPU console command:
        // Create and display profile visualizer data
        if (RHIConfig::ShouldShowProfilerAfterProfilingGPU())
        {

        // execute on main thread
            {
                struct FDisplayProfilerVisualizer
                {
                    void Thread( TSharedPtr<FVisualizerEvent> InVisualizerData, const FText InVsyncEnabledWarningText )
                    {
                        static FName TaskGraphModule(TEXT("TaskGraph"));
                        if (FModuleManager::Get().IsModuleLoaded(TaskGraphModule))
                        {
                            IProfileVisualizerModule& ProfileVisualizer = FModuleManager::GetModuleChecked<IProfileVisualizerModule>(TaskGraphModule);
                            // Display a warning if this is a GPU profile and the GPU was profiled with v-sync enabled (otherwise InVsyncEnabledWarningText is empty)
                            ProfileVisualizer.DisplayProfileVisualizer( InVisualizerData, TEXT("GPU"), InVsyncEnabledWarningText, FLinearColor::Red );
                        }
                    }
                } DisplayProfilerVisualizer;

                TSharedPtr<FVisualizerEvent> VisualizerData = CreateVisualizerData( EventTree );

                DECLARE_CYCLE_STAT(TEXT("FSimpleDelegateGraphTask.DisplayProfilerVisualizer"),
                    STAT_FSimpleDelegateGraphTask_DisplayProfilerVisualizer,
                    STATGROUP_TaskGraphTasks);

                FSimpleDelegateGraphTask::CreateAndDispatchWhenReady(
                    FSimpleDelegateGraphTask::FDelegate::CreateRaw(&DisplayProfilerVisualizer, &FDisplayProfilerVisualizer::Thread, VisualizerData, VsyncEnabledWarningText),
                    GET_STATID(STAT_FSimpleDelegateGraphTask_DisplayProfilerVisualizer), nullptr, ENamedThreads::GameThread
                );
            }

        }

Any ideas on how to get the widget? Or maybe there is an easier way to get that info?

sentences:
Calculating and detecting curves How can I detect the 'steepness' of a curve? For example, if the user swipes their finger across the screen in a curve, what's the best way of detecting whether the curve is almost a semi-circle, or whether it's straight?

Is it also possible to extend this to possibly recognise multiple curves (e.g. a sigmoidal shape)?

Thanks for any advice

sentences:
D3D/OpenGL: Question about shaders in larger projects I'm a game dev student and last semester we had a '3D-programming' course, in which we did some basic stuff such as rendering a textured quad spinning around in the "scene". We used quite basic vertex-, geometry-, and fragment-shaders to do this.

My question is, how are shaders "managed" in a larger projects?
For example, I might have a sphere in the scene that uses a shader to generate some effect on it, some VS or FS to generate water ripples or waves on a water 'model', etc.
How would all these different shaders be combined in the same project? Do we just create new shader programs for the different shaders(as you can do in OpenGL)? Do you use some kind of condition-statement in the shader and use only one program? Some other approach?
I've heard you really want to minimize API-calls, especially for realtime apps (Multiple shader programs would need at least 2 calls to set the shader programs, EVERY frame.)
I'm really confused about this part, and our next course involves making a small game so this will be quite important I'd imagine. (also im personally very paranoid when it comes to performance; I want to do things right from the start when possible)

Sorry if the question is poorly formulated, hope it makes some sense. ^^'

An example would be great, HLSL/D3D or GLSL/OpenGL doesnt matter, I've fiddled with both.

sentences:
How can I exploit multithreading in collision resolution? I'm trying to speed up my collision resolution by using multiple threads.

I'v read through Box2D's source code and while it was challenging and educating, it didn't really point me to how I could use multiple threads.

I'm ready to make some sacrifices with accuracy. I am investigating this because I have boatloads of game objects.

My current implementation handles AABB checks for 100000 objects in about 10 ms. I have no idea if this number is good, but for my purposes it seems sufficient.

Next, I'm trying to figure out how to resolve collisions. How could I get power out of multiple threads here?

This is what i'm currently planning to do: (Do you see any issues with it?)

Calculate position for each object in separate threads based on manifold data
Update existing manifolds in separate threads
get New collisions for moved objects in separate threads
Repeat 10 times or until no changes

sentences:
How to make an authoritative multiplayer game deterministic for all clients? I'm starting to create a multiplayer online game, with an authoritative server. As it is, the clients send inputs to the server which do the simulation and then send back to clients the updated state. The game is a top-down shooter, so it's fast-paced and input lags are not allowed here, so to avoid this I'm doing the simulation on the client too, and when the server update come back I compare the local simulation with the server response. If they are compatible everything is fine, otherwise, the client version is corrected.

I was expecting that the client simulation desync at some point, because of all of the variables on physics, floating points, network etc... But this happens much more than I thought.

Just by sending the inputs and simulating on the server, the results are very different, even on simple movements, like forwards and backwards on a clear space.

Green is local, red is server response

I need help on this step, a way of keeping, at least this kind of simple movement, consistent on the server and the clients.

sentences:
Delay when moving elements How you can see my mouse goes little bit faster than widget.

My movement algorithm is:

cursorPositionPrev.set(cursorPosition);
cursorPosition.set(getCurrentPos());
...
Vector2f delta = new Vector2f(cursorPosition).sub(cursorPositionPrev);
widget.getPosition().add(delta);

I am using LWJGL and my own GUI solution.

Here is visual structure of event processor part.
One thread for processing events generated by user and another thread render current gui state.

Even if rendering and processing events is in one thread the issue is still exist.

So what can I do to make to avoid this delay and make widget to keep up with the mouse movement?

sentences:
Collision in EdgeCollider Unity I want to make a collider for a line that I've drawn on the screen using mouse. so the detection should be cover the whole line that has drawn.

What I've learned from edge collider is you can have collider if you assign the position of a certain point in col.transform.position (for example I can assign the startpos of my line and the collider works only for that point).

the green line which is drawn by mouse in front of car is using the LineRenderer and requires EdgeCollider to be a road that car can drive on it's surface

and my functions:

private LineRenderer line; // Reference to LineRenderer
private Vector3 mousePos;
private Vector3 startPos;   // Start position of line
private Vector3 endPos; // End position of line
public Material material;

void Update()
{
    // On mouse down new line will be created
    if (Input.GetMouseButtonDown(0))
    {
        if (line == null)
        {
            createLine();
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(0, mousePos);
            startPos = mousePos;
        }
    }
    else if (Input.GetMouseButtonUp(0))
    {
        if (line)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(1, mousePos);
            endPos = mousePos;
            addColliderToLine();
            line = null;
        }
    }
    else if (Input.GetMouseButton(0))
    {
        if (line)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(1, mousePos);
        }
    }
}
// Following method creates line runtime using Line Renderer component
private void createLine()
{
    line = new GameObject("Line").AddComponent<LineRenderer>();
    line.material = material;
    line.SetVertexCount(2);
    line.SetWidth(1.1f, 1.1f);
    line.SetColors(Color.black, Color.black);
    line.useWorldSpace = true;
}
// Following method adds collider to created line
private void addColliderToLine()
{
    EdgeCollider2D col = new GameObject("Collider").AddComponent<EdgeCollider2D>();
    col.transform.parent = line.transform; // Collider is added as child object of line

    col.points[0] = startPos;
    col.points[1] = endPos;

    Vector3 midPoint = (startPos + endPos) / 2;
    col.transform.position = midPoint; // setting position of collider object
    // Following lines calculate the angle between startPos and endPos
    float angle = (Mathf.Abs(startPos.y - endPos.y) / Mathf.Abs(startPos.x - endPos.x));
    if ((startPos.y < endPos.y && startPos.x > endPos.x) || (endPos.y < startPos.y && endPos.x > startPos.x))
    {
        angle *= -1;
    }
    angle = Mathf.Rad2Deg * Mathf.Atan(angle);
    col.transform.Rotate(0, 0, angle);
}

btw i don't know what that col.points[] used for. I just found it from the unity documentation which won't make any collision

sentences:
Why does editing the client's memory in some MMOs allow them to cheat? Why editing the memory of the game client works? Why so many "Hack protection" tools coming with the clients?

If I were to design a client-server game, everything would happen at the server (the simulation of the game world) and clients would be only passive consumers receiving status updates of the part of the world near their characters, sending only some information like keystrokes or move/action commands. Maybe I missing something here, but with that design, any hack like raising my STR by 200 in the client memory (if the value is present at all), just won't have any effect.

The only explanation I can think is that games in which memory editing works let parts of the simulation run in the client and the server then just synchronize all the clients periodically. I can understand that design for Real Time Strategy games with a fixed number of players once a match is configured, but, why in MMORPGs? Is it a strategy to reduce server load?

sentences:
Android game crashes when attempting to start wifi hotspots I have two methods that will try to start the WiFi hotspot on the android device so that others can connect and play the game.the problem is both method have problems and don't work.
the first method:

    public void ConnectWiFi()
    {
        try
        {

            using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"))
            {
                using (var wifiManager = activity.Call("getSystemService", "wifi"))
                {
                    AndroidJavaObject wifiConfiguration = new AndroidJavaClass("android.net.wifi.WifiConfiguration");
                    wifiConfiguration.Set("SSID", meSSID); // string
                    wifiConfiguration.Set("preSharedKey", mePassword); // string
                    wifiManager.Call("setWifiApEnabled", wifiConfiguration, enabled);
                }
            }
        }
        catch (System.Exception E)
        {
            T.text += "\nE - " + E.Message;
            T.text += "\n\t" + E.StackTrace+"\n";
        }
    }

it crashes the game and I can't debug it.
the secont method:

    public void ConnectWiFiHardWay()
    {
        try
        {

            using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"))
            {
                using (var wifiManager = activity.Call("getSystemService", "wifi"))
                {

                    using (AndroidJavaObject classObj = wifiManager.Call("getClass"))
                    {
                        using (AndroidJavaObject wifiConfiguration = new AndroidJavaObject("setWifiApEnabled"))
                        {
                            wifiConfiguration.Set("SSID", meSSID); // string
                            wifiConfiguration.Set("preSharedKey", mePassword);
                            using (AndroidJavaObject wifiCfgClass = wifiConfiguration.Call("getClass"))
                            {
                                using (AndroidJavaObject booleanObj = new AndroidJavaObject("java.lang.Boolean"))
                                {
                                    using (AndroidJavaObject booleanClass = booleanObj.Call("getClass"))
                                    using (AndroidJavaObject methodObj = classObj.Call("getMethod", "setWifiApEnabled", wifiCfgClass, booleanClass))
                                    {
                                        methodObj.Call("invoke", wifiManager, wifiConfiguration, enabled);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        catch (System.Exception E)
        {
            T.text += "\nH - " + E.Message;
            T.text += "\n\t" + E.StackTrace+"\n";
        }

this one throws an exception that says setWifiApEnabled Cannot be found
I can post the complete error text if that helps.
Also I followed this questions instructions.

sentences:
Texture rotation inside a quad How can I rotate a texture inside a quad without rotating the quad? Here's the code but I'm rotating the whole quad here.

glBindTexture(GL_TEXTURE_2D, texName5);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);

    glPushMatrix();
            glTranslatef(12.8, 10, 10);
            glRotatef(rotateAd, 1, 0, 0);
            glBegin(GL_QUADS);
                    glNormal3f(1, 0, 0);
                    glTexCoord2f(0.0, 0.0); glVertex3f(0, -3,  -3);
                    glTexCoord2f(0.0, 1.0); glVertex3f(0, -3,  3);
                    glTexCoord2f(1.0, 0.0); glVertex3f(0, 3, 3);
                    glTexCoord2f(1.0, 1.0); glVertex3f(0, 3, -3);
            glEnd();
    glPopMatrix();

Thanks.

sentences: What resources are available for using Qt as a toolkit for games Qt is an excellent application toolkit and overall the best for C++. While some large projects use Qt (KDE for example), I haven't seen many games using it. So I decided to make my own. But what does Qt provide that may be useful when writing a game (in my case a 2D game)?

sentences:
Code optimalization - Mass selecting units (RTS) Yo fellow game developers!

So recently gamedev became my favorite hobby and I started working on my RTS game module which would then let me create different RTS games with just few changes (W3 inpiration :3). Anyway I am new to optimalization since my previous games had quite serious optimalization issues so I need your help with a pieace of code!

I am having a mass selection of units with drawn rectangle on screen. I've got it all worked out but now I am wondering if there could be anything done about optimalization for cycling through list of units every time my mouse position changes even for a little bit.

This is inside my Update function. There is much more in there so i cut it out but this is the piece I am worried about:

    void Update(){
        //...previous code blah blah blah...
        if (Input.GetMouseButton(0)) {
            oldPos2 = point2;
            point2 = Input.mousePosition;
            if (oldPos2!=point2) {//performance optimalization
                Debug.Log ("Performing selection");
                if (Vector2.Distance(point1,point2) >= selBoxIniDist) {
                    isSelecting = true;
                    foreach (var item in Game.Units) {
                        if (IsWithinSelectionBounds (item.gameObject)) {
                            item.Selected = true;
                        } else {
                            item.Selected = false;
                        }
                    }
                }
            }
        }
        //...rest of the code here...
    }

So as i told you, there is no problem with the code. I just need your opinion if there could be any changes especialy to this part of the code. Or maybe general advices for optimalization.

Even tho I am checking every update if the mouse moved (so I dont cycle every update) I still feel like checking every "milimeter" 5 times if any of the units are contained in the viewport rectangle is a little bit overkill just for the selecting units. At the end of selection I usualy end up with around less than 100 cycles.

What do you think?

EDIT:
I might as well add a method that checks if the unit is in the viewport bounds and a utility method that calculate the bounds. Just so you why I am worried about performance.

Checking if bounds contain unit:

public bool IsWithinSelectionBounds( GameObject gameObject )
    {
        if (!isSelecting) {
            return false;
        }

        var camera = Camera.main;
        var viewportBounds = Utilities.GetViewportBounds( camera, point1, point2);

        return viewportBounds.Contains(camera.WorldToViewportPoint(gameObject.transform.position));
    }

Static utilities:

public static Bounds GetViewportBounds( Camera camera, Vector2 screenPosition1, Vector2 screenPosition2 )
{
    var cam = Camera.main;
    var v1 = cam.ScreenToViewportPoint( screenPosition1 );
    var v2 = cam.ScreenToViewportPoint( screenPosition2 );
    var min = Vector3.Min( v1, v2 );
    var max = Vector3.Max( v1, v2 );
    min.z = camera.nearClipPlane;
    max.z = camera.farClipPlane;

    var bounds = new Bounds();
    bounds.SetMinMax( min, max );
    return bounds;
}

sentences:
Editor throwing NullReferenceException I have the following exception being thrown at compile time:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.Edge.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Edge.cs:114)
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:387)
UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:286)
UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:272)
UnityEditor.Graphs.Graph.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:250)
UnityEditor.Graphs.Graph.OnEnable () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:245)

I know well enough what a NullReferenceException is and what causes one, but the stack trace above implies that it's being thrown by the editor or some other internal thing.

Does anyone have any advice on how to debug this?

sentences:
Three button combination to open next scene I have thirty (30) buttons in a trivia game, they are laid out in the following configuration with three rows:

( A, B, C, D, E, F, G, H, I, J)
( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
(00,01,02,03,04,05,06,07,08,09)

Using these combinations of buttons and clicking one and only one from each row I have a thousand (1000) - three (3) button combinations. E.g.: A27 would be one combination of the thousand possibilities. These are not random combinations each opens a very specific scene.

What I am trying to do is create a C# script that when I click any of these three (3) button combinations it will open a new scene. Once that scene is open I’m okay because then have my own scripts attached to the single buttons in the new scene to continue to a further scene.

What I can’t figure out is the syntax, should I use if Statements such as -  if (Btn_A)  &&  (Btn_1)  &&  (Btn_01) then load scene such and such? Then do I attach the script to the canvas then to each of the three button combinations (A 1000 Scripts combinations)?

sentences:
Unity Quaternion.LookRotation meaning I've gone through Unity's documentation for Quaternion.LookRotation, but I didn't get the full understanding of how it works.

What is the meaning of Creates a rotation with the specified forward and upwards directions?
And if I have to rotate my object in X axis I have to modify both X and Z axisVector3 lookAt = new Vector3(relativePos.x, 0, relativePos.z);
transform.rotation = Quaternion.LookRotation(lookAt);, why can't I only just modify the X axis directly to rotate?

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:
Resizing the window moves and stretches the texture I have a basic screen with 3 TextureRegions rendered on the screen rendered with this code(Ignore the hardcoded numbers, bad decision I know will be replaced later):

Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 225);
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 150);
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 75);
batch.end();

and it renders like this:

But if I resize the window it becomes like this:

Why does the texture become like that when the window is resized and what are the solutions?

P.S. I am aware of this question and it does not solve my problem

sentences:
3D infinite platform generation: Can't increase space between platforms. (Unity) As seen in the images, changing the value of 'spawnZ' affects the distance between the initial platform and the first generated platform but afterwards it has no affect whatsoever.

public GameObject[] tilePrefabs;

public float spawnZ = 10f;
public float tilelength;
public int amnTilesOnScreen = 5;
public Transform playerTransform;

// Use this for initialization
void Start () {
    for (int i = 0; i<amnTilesOnScreen; i++)
    {
        SpawnTile();
    }
}

// Update is called once per frame
void Update () {
if(playerTransform.position.z>(spawnZ - amnTilesOnScreen * tilelength))
    {
        SpawnTile();
    }
}

private void SpawnTile(int prefabIndex = -1) {
    GameObject go;
    go = Instantiate(tilePrefabs[0]) as GameObject;
    go.transform.SetParent(transform);
    go.transform.position = Vector3.forward * spawnZ;
    spawnZ += tilelength;

}

sentences:
XNA windows phone release black textures i just made a 3d game in XNA for windows phone 7. I build it in release mode on visual studio 2010 and suddenly when I run game there is no textures on models - 2 models are black and one is transparent. Models are in .X format exported from 3dsmax and have textures in .jpg also added to game content. I set build action to none and all worked fine in debug mode. When I change to release mode - black textures. When I set build action to compile it gives me warning:

Asset was built 2 times with different settings: using TextureImporter and TextureProcessor using TextureImporter and TextureProcessor, referenced by...

and still no textures.

What can I do?

sentences:
Accessibility in Games We're currently developing a 2D Platformer and we decided to take some time to implement Accessibility Features. But we couldn't find good information about Accessibility Features, muss less how to implenent them. With Accessibility Features we mean things like to reduce risk of seizure (Photosensitive Epilepsy). There will be a Accessibility Menu to manually activate these.

So does anybody have some Ideas what Features we could implement and some helpful tips about how to implement them?

sentences:
Pausing and resuming in Unity I've been writing this code quite late so please bear with me.
I'm trying to pause the game and show a menu when I'm inside a collider and then when i press a key it should unpause the game and continue but it wont and i cant figure out why.

Here's the very simple (in my eyes) code:

var savedTimeScale : float;
var playerStatus : Player_Status;
var inTheZone : boolean = false;
private var startTime: float = 0.1;
var start:GameObject;

enum Upgrade { None,Main }
private var currentPage:Upgrade;

function Start()
{
    currentPage = Upgrade.None;
}

//function for ontriggerenter and pressing button to show menu
function OnTriggerEnter(collider:Collider)
{
    playerStatus = collider.GetComponent(Player_Status);
    if(playerStatus == null) return;

    inTheZone = true;
}

function OnTriggerExit(collider: Collider)
{
    playerStatus = collider.GetComponent(Player_Status);
    if(playerStatus == null) return;

    inTheZone = false;
}

function Pause()
{
    savedTimeScale = Time.timeScale;
    Time.timeScale = 0;
    AudioListener.pause = true;
    currentPage = Upgrade.Main;
}

function UnPause()
{
    Time.timeScale = savedTimeScale;
    AudioListener.pause = false;
    currentPage = Upgrade.None;
    if(IsBeginning() && start != null)
    {
        start.SetActive(true);
    }
}

function IsGamePaused()
{
    return Time.timeScale == 0;
}

function OnGUI()
{
    if(inTheZone == true && Input.GetKeyDown(KeyCode.E))
    {
        Pause();
    }

    if(Input.GetKeyDown(KeyCode.N))
    {
        UnPause();
    }

    if(IsGamePaused() && !IsBeginning())
    {
        UpgradeMenu();
    }
}

function UpgradeMenu()
{
    BeginPage(200,200);
    GUILayout.Button("Hello");
    EndPage();
}

function BeginPage(width, height)
{
    //GUI.DrawTexture
    GUILayout.BeginArea(Rect((Screen.width-width)/2,(Screen.height-height)/2,width,height));
}
function EndPage()
{
    GUILayout.EndArea();
    ShowBackButton();
}
function ShowBackButton()
{
    if(GUI.Button(Rect(20, Screen.height-50,50,20), "Resume"))
    {
        UnPause();
    }
}

function IsBeginning()
{
    return Time.time < startTime;
}

I think it's just a case of a new set of eyes. But by my logic this should work.

sentences: Game networking topology - dealing with host leaving I am working on a P2P game in Flash and I'm wondering what network topology would be most robust for dealing with people randomly joining/leaving. I was thinking the first user to join could be the host, but if the host leaves the whole session would be killed. I am looking for a way to deal with this with no (or little) disruption.

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

As far as I know it's very simple:

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

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

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

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

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

    void Start ()
    {
    }

    void Update ()
    {
        StartTurntableRotation();

        StopTurntableRotation();
    }

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

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

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

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

This second script is my work in progress

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

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

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

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

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

sentences:
OpenGL ES GL_FIXED versus GL_FLOAT I am writing an app for Android, using OpenGL ES 1.x

I am confused as to whether I should use GL_FLOAT or GL_FIXED, the priority being performance regarding GPU operations(does GL_FIXED need to be converted etc. ex: GL_FIXED fits EXACTLY with the precision I need but if it is converted to a float then using it is pointless).

This book seems to say that it is ALWAYS preferable to use GL_FIXED for vertices: "The major exception is with vertex data, which should never be given in floating point..."
Here (paragraph right above the subtitle "Vertex data")

But I have seen others saying floating point is better..

sentences:
How to export unreal assets in a package like in unity? Unity has an asset exporter that export it into a .unitypackage format. This ensure that the prefab has all the links to its child assets.

In Unreal 4, its migrate tool allow for moving of assets. However, it require that both project be on the same machine to migrate from one content folder to another content folder.

How can I export unreal assets for easy sharing in a similar way to unity?

sentences:
How do I wait to execute code? I'm trying to make a relatively simple elevator (which essentially teleports the player), but I don't want it to instantly teleport them. I want the player to enter the collider, wait 2-3 seconds, and then do it to take make it seem somewhat more natural.

My code thus far:

using UnityEngine;
using System.Collections;

public class Teleporter : MonoBehaviour
{
    public GameObject TeleportTo;
    //public Material NewSkybox;

    void TimerInvoke()
    {

    }

    void OnTriggerEnter(Collider other)
    {

        Vector3 displacement = other.transform.position - this.transform.position;

        other.transform.position = TeleportTo.transform.position;
        other.transform.position += displacement;

        //RenderSettings.skybox = NewSkybox;
    }
}

Also if possible I'd like to stray away from coroutines. How should I do this?

sentences:
Problem with Raycasting in a 2D Game I'm new to using unity and came across a problem when I was following a tutorial. The game is in two dimensional space, and when my player walks over a certain tile the detection never goes off. Here's the code that I have,

function calculateWalk() {

    yield WaitForSeconds(0.3);

    var hit : RaycastHit;

    if(Physics.Raycast (transform.position, Vector3.down, 100.0)) { // Never evaluates to being true
        var distanceToGround = hit.distance;
        Debug.Log("Hit");

        if(hit.collider.gameObject.tag == "tallGrass") {
            walkCounter++;
            Debug.Log("Tall Grass");
        } // END if
    } // END if
} // END calculateWalk()

I've made sure to attach the script to my player, as well as tag the tiles that I want with "tallGrass". I've followed what was done in the tutorial, but for some reason it's not working out for me, not sure if this is all the code needed to help solve this problem, if more information is needed let me know, I also set my player 1 unit above the tiles.

sentences:
How to draw connecting lines in plain color? Since there is no option for flat shading in OpenGL ES2, is there a workaround to disable the color interpolation when different color is being passed to each of the vertices?

Update:
I'm working with OpengGL ES 2.0 in android. I'm given with these vertices which I used to draw shapes by connecting them with lines. Now I need to change color of each of these lines individually. I tried passing a color matrix for each vertex through vertex shader to fragment shader but the color gets interpolated (which actually makes sense, since I'm giving different color to two vertices). I did some googling about that and found out glSmoothShader cannot be disabled in OpengGL ES.

Is there a way to color those lines without the colors getting interpolated?

Or is there a way to use multiple triangles to draw a line between two vertices that way i can flat color each of those triangles.

sentences:
how to make my camera follow script work for Photon Pun2 I´m currently working on the Multiplayer part for a 2D top-down game. I´m using Photon Pun2, to do this. My problem is, that always just the last player, who joined the game get´s my camera follow script attached. I´ve tried setting an
if (!myPV.IsMine)
return;

on top of the function, but it doesn´t seem to work. I give you the script here, so it would be nice, if you tell me, where I have to do what, to get 2 (and more) different views of the camera
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour
{
    public Transform followTransform;

    // Update is called once per frame
    void FixedUpdate()
    {
        this.transform.position = new Vector3(followTransform.position.x, followTransform.position.y, this.transform.position.z);

    }
}

sentences:
How can I create a cel-shaded, comic book appearance in Unity? I am working in Unity, I have imported the post-processing stack and I own a license to Amplify. But I'm having trouble making my models appear cel-shaded enough to make them appear as if they are from a comic book. I'd specifically like to achieve a result similar to that of Telltale's games like Wolf Among Us and Game of Thrones.

Here is a in-editor screen capture of the effect + shader values:

How can I get effects such as below?

sentences: Maya Rigging - Shoulder joint attached to head? I'm fairly new to modeling and rigging in Maya; so my question is: in the image below how can I unbind the rigs head from the shoulder pivot? I've searched online for why this occurs and I can only guess that it's due to bad Joint placement?

sentences:
What is the relationship between clipping and the fog of war concept? I'm currently developing a 2D top down game and recently implemented clipping.

I understand clipping in a 2D top down game as rectangle or any other geometrical form which defines a viewport for the player of what exactly he sees and what is technically rendered from the engine. As I'm centering the clipping area around the player I recognized that it is similiar to the fog of war concept.
So the player has a limited view perspective depending on his current position.

My questen is what is the concrete difference to the fog of war concept? Is this concept usually using clipping? I often recognized that for example the map is rendered but simply not the objects which are on that map. Are these objects rendered and simply invisible or are they not rendered at all because of the clipping? Could clipping be defined as a way to achieve fog of war?

Would be cool if anyone could shed some light on this topic.

sentences:
Spine, Dragonbones or Live2D for interactive 2D animation? I'm planning to make a game with some interactive 2D animation. For example, when the player holds mouse button, the character gradually pulls his bow, and releases it when the player releases mouse button. I think skeletal animation works better than frame-by-frame sprites for this purpose, right?
I googled for a while and it seems there are several tools can do that, like Spine, Dragonbones and Live2D. But I have no idea what's the difference and which one I should choose. Could you share your advice/experience on it? Also do they have API for Unity?
I'm have a bit programming experience with Unity, but I know nothing about 2D animation, so please bear with me if this question makes no sense.

sentences:
How to randomly spawn obstacles for infinite runner? I am trying to create randomly generated path properly? Think of flappy bird (its not really) but my code/algorithm is all wrong. If I make BarMax, BarMin too large, then player can cheat cos in centre there will always be space. Make it too small and pipes are spawned randomly and sometimes very close to each other (unlike flappy). So my player sometimes could run into a situation where its impossible to move past two pipes. My adjacent pipes are really close together as well unlike flappy birds big gap between pipes.

So this is what i dont want to happen.  I have also thought about spawning sets of pre-configured pipes but then i thought they might run into this impossible situation at some point too. I had my level set-up like this  So when a bar touches the looper, it spawns again - code is above.

int numBGPanels = 35;

float BarsMax = 1.5f; float BarsMin = -1.5f;

float widthOfBGObject = 1; float offset = 0.75f; Vector3 pos;

void Start() {
    StartBarsPosition(); }

void OnTriggerEnter2D(Collider2D collider) {

    if(collider.tag == "Bars") {       // this is not getting called cos theres no collider attached atm
        pos = collider.transform.position;
        pos.x += widthOfBGObject * numBGPanels * offset;

        pos.y = Random.Range(BarsMin, BarsMax);
        collider.transform.position = pos;

    }

}

void StartBarsPosition() {
    GameObject[] bars = GameObject.FindGameObjectsWithTag("Bars");

    foreach(GameObject bar in bars) {
        Vector3 initialpos = bar.transform.position;
        initialpos.y = Random.Range(BarsMin, BarsMax);
        bar.transform.position = initialpos;
    }

}

sentences:
Preparing a 2D character to export from Blender to Unity? I'm an animator for a game currently, and I don't have Unity (can't download due to too much gigs coupled with slow internet,) but the game designer told me I can use Blender to export animations into Unity.

I asked if I needed to prepare multiple files to export, and they told me that I could just have one file with all the animations in it. The game, as stated in the title, is 2D.

My problem now is, how do I turn a rig into an actual character with different animations under it? (Right now I only have an 'idle' animation, but need to make running, jumping, walking, etc.) I mean how do I save this 'idle' animation and work on another animation without overwriting the previously finished animation(s)?

Thank you much

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: How to code simple Goomba-like AI for 3D Platformer? I'm making a 3D Platformer and have an enemy similar to a Goomba in terms of AI. How do I get the enemy to walk around and then follow the player when they're in range?

sentences:
Prevent weapon from clipping during animations I am trying my ways with Unity 3d animations, and so far so good.

The only problem is, when I equip an weapon in the player model's hand, the weapon clip through player's head during some frames of some animations. Please refer to the gif and the screenshot below for an example.

Here you can see that the top of the bow is clipping through the player head during the arrow fire animation.

Here you can see a demonstration gif of the problem.

I've been thinking and I will probably need to adjust the weapon rotation/position so it fits the animations, right?

sentences:
How i can play movie in unity by script(android platform)? my script is correct in pc platform but when i switch on android platform i have compiler error cs0246, why i can not export my apk file.
how i can play movie in unity android platform by other way?

     public class NewBehaviourScript : MonoBehaviour {
     public MovieTexture myMovie;

     void Start()
     {
         myMovie.Play();
     }

     void OnGUI()
     {
         GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), myMovie);
     }
 }

sentences:
How to bend a 2D rectangle in an animation? It is something done often in 3D but I've never heard of it in 2D. I want to bend a 2D rectangle looking a bit like that:

I've seen people adding lots of vertex around knees and elbows of 3D models for that purpose. Should I make my 2D rectangle be lots of smaller triangles in order to bend it, just like in 3D? I feel like it's overkill just to bend a rectangle. Is there a better way to do this? I'm using LibGDX. I would like the rectangle to stay proportioned. Is there common algorithms to do that?

sentences: Daily Unlock in LibGDX I am trying to make a game that is a collection of mini games. The mini games will unlock daily. There are story for each day. And the story cannot be repeated so for example the player start playing the game on Monday. He/she will unlock the story for day one and the first mini game. To unlock the next story he/she must wait until the next day. If the player skip playing at Tuesday and resume at Wednesday then he/she will lose the second story and the second mini game. My question is how to get current time that is not taken from android settings to prevent cheating? I want to prevent the player from cheating by changing android time from settings.

sentences:
JVM voxel game engine lag spikes I'm experiencing short lag spikes after some voxel chunks have been created while not moving the camera around. I profiled the application: the JVM implementation uses a lot more memory, about 2.5 times more, compared to c++ exact implementation. Also, according to the profiler, the cause of the lag is the garbage collector. But there is nothing to collect ! All voxel data is static, references are kept, nothing gets allocated while profiling. I also turned off all the rendering to make sure that native memory is not leaking. Still lagging.

What could be it ? If you need any code, I'll add it here. (Writing in scala)

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:
How to blend biomes with procedural terrain I'm working on a terrain generator. Through multiple noise functions, I'm able to create many kinds of terrain I like, but I'm having a bit of difficulty joining them together in a seamless fashion.

My first thought was to use a single noise call (calling it the mask) and then I could simply say things like:

if (returnVal < .1) GenerateBiome1();
if (returnVal < .2) GenerateBiome2();
if (returnVal < .3) GenerateBiome3();

and so on...

The issue here is that the height of the terrain doesn't blend together when doing this. If biome 1 was more mountainous and biome 2 was flat land, it's a drastic switch from one to the other and it looks atrocious.

My next thought was to attempt blending by giving a 'strength' to each biome based on what my mask noise returns. In C# code, it looks something like this at the moment:

static public float GetHeight(float X, float Z)
{
    float fRollingHills_Location = .25f, fRollingHills_Impact = .5f, fRollingHills = 0;
    float fMountains_Location = .75f, fMountains_Impact = .5f, fMountains = 0;

    float fMask = Game1.GetNoise2(0, X, Z, .01f);
    float fRollingHills_Strength = (fRollingHills_Impact - Math.Abs(fMask - fRollingHills_Location)) / fRollingHills_Impact;
    float fMountains_Strength = (fMountains_Impact - Math.Abs(fMask - fMountains_Location)) / fMountains_Impact;

    if (fRollingHills_Strength > 0) fRollingHills = fRollingHills_Strength * (Game1.GetNoise2(0, X, Z, .02f) * 10f + 10f);
    if (fMountains_Strength > 0) fMountains = fMountains_Strength * (Game1.GetNoise2(0, X, Z, .05f) * 25f + 10f);

    return fRollingHills + fMountains;
}

The issue I have here is that even for only two biomes, it's pretty important for me to manually choose the "location" and "impact" values to ensure I'm getting some combination of strengths to total 100% by the time it returns a value (if not, I get things like giant cliffs making the borders from one biome to another ugly and obvious).

I don't know if I can give a good true question here other than, how should I actually be going about this? While I've managed a few good looking maps, I feel like I'm going about this in an overly complicated way that still doesn't give me all the customization I'm looking for.

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:
Why do I have to run my 2D game at 300+ FPS for movement to be passably smooth? I'm working on a simple game with SFML, and the only way to make the game reasonably smooth is to allow it the highest framerate my machine can handle (that is, giving it no limit). 60 FPS in my game looks like 5 FPS in most games.

I've made sure it wasn't any weird timing issue with sf::Clock by making my delta variable constant, and I've made a simple moving square with the default SFML template to make sure it wasn't anything else in my code.

Limiting framerate using window.setFramerateLimit(80), window.setVerticalSync(true), or by placing usleep(1000 * 15), a 15-millisecond pause (~67 FPS, in theory) in the game loop, cause the terribly glitchy, asymmetric animation.

I think the problem is my Mac. I hesitate to blame anything other than my code, but I just can't explain the problem otherwise. I'm running OS X Mavericks on a 15-inch MacBook Pro with a Retina display (2.4 GHz i7, Nvidia, 8GB RAM).

Is it the Retina display, or some issue with the sleep() system calls? Any thoughts are welcome. Thanks!

sentences:
Drawing isometric walls I'm having some trouble with isometric walls.

I'm drawing isometric floor tiles using the back to front rendering method, and it works fine. I also keep my floor tiles lined up properly in a nice grid. The code (and this seems to be pretty much standard for isometric floor drawing) is as follows:

for(int x = 0; x < 6; x++){
    for(int y  = 3; y >=0 ; y--){

        int xCo = (y+x)*(tileWidth/2);
        int yCo = (x-y)*(tileHeight/2);
        tile.draw(g, xCo, yCo);
    }
}

This makes a nice little floor grid. See here.

Unfortunately, when I use the same logic for walls, it all goes right to hell.

for(int x = 0; x < 6; x++){
    for(int y  = 3; y >= 0 ; y--){

        int xCo = (y+x)*(wallWidth()/2);
        int yCo = (x-y)*(wallHeight()/2);
        walls.draw(g, xCo, yCo);
    }
}

I'm using a placeholder as my wall tile (it's a placeholder from google image search, but it should work all the same), and this is the result I get.

The rendering order for my walls is clearly correct, nearer walls render on top of farther away walls, which is what I want, but the positioning is also painfully incorrect, and I don't know exactly how I ought to correct that short of using pixel values.

For reference, I did do a trial using hardcoded pixel vals, because I found that from one wall's right corner to the next wall's right corner, the change was exactly (200, -100) pixels. When I made my rendering loop account for that

int xCo = (x+y)*200;
int yCo = (y-x)*-100;

it worked fine, but that is not a viable solution because it doesn't allow for any versatility.

So, looking for suggestions on how to make my isometric walls line up. What am I doing wrong?

Thanks!

sentences:
How to connect to a socket.io server from a Cocos2d-x game? The question can also be asked more specifically as; How do I connect to a socket.io server with C++ from a mobile game?

I am aware of Boost (and Socket.io C++ client libraries using Boost) but compiling them for iOS and Android is beyond me. So what do you guys recommend?

sentences:
Help Understanding Cameras/View Matrices in DirectX11 (C#) So I'm designing a soft game engine in C# on top of the SharpDX API (a C# wrapper for DirectX). As I'm designing the camera, though, I'm running into some issues getting the 3D perspective correct. I've read through a few tutorials and articles, but I can't seem to find what I'm doing explicitly wrong.

This is my current understanding: The world matrix is the identity matrix (of the world...) times the translation matrix of the model, times the rotation matrix of the model, times the scale matrix of the model, which should then give me the transformed location of each vertex in "world space." The view matrix would then be the output matrix of LookAtLH(cameraPositionVec, targetPositionVec, upVec);. Finally, the projection matrix seems to be the output of the PerspectiveFovLH(fov, aspectRatio, nearDist, farDist); So, I then took the transpose of each of these matrices, multiplied world * view * projection and I should be left with the final transformed vertex coordinate.

Here's the code I have so far. I've left the world matrix untouched by just setting the translation to the origin, the rotation of the model to the identity matrix, and the Scale to 1, which should mean I don't have to actually perform any world matrix calculations for the sake of simplicity right now.

// Setup and create the projection matrix.
projectionMatrix = Matrix.PerspectiveFovLH((float)(Math.PI / 4.0f), ((float)GameWindow.WIN_WIDTH / (float)GameWindow.WIN_HEIGHT), 0.1f, 100.0f);

// Initialize the world matrix to the identity matrix.
worldMatrix = Matrix.Identity

...
//camera class
public Camera(Vector3 _position, Vector3 _target, Vector3 _rotation)
{
    position = _position;
    target = _target;
    rotation = _rotation;
}
public Matrix GetViewMatrix()
{
    //convert degrees to radians
    float pitch = rotation.X * 0.0174532925f;
    float yaw = rotation.Y * 0.0174532925f;
    float roll = rotation.Z * 0.0174532925f;

    //get rotation matrix and the relative up vector
    Matrix rotationMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, roll);
    Vector3 up = Vector3.TransformCoordinate(Vector3.UnitY, rotationMatrix);

    return Matrix.LookAtLH(position, target, up);
}

....

//set the view matrix
viewMatrix = camera.GetViewMatrix();

...
//Transpose the matrices
worldMatrix.Transpose();
viewMatrix.Transpose();
projectionMatrix.Transpose();

From there they are fed to the vertex shader, which is below. If I comment out the projectionMatrix multiplication though, the image shows up. If It's not commented out though, nothing renders to the screen, which leads me to believe that may be the issue.

//vertex shader
cbuffer MatrixBuffer
{
    matrix worldMatrix;
    matrix viewMatrix;
    matrix projectionMatrix;
};

struct VertexInputType
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
};

struct PixelInputType
{
    float4 position : SV_POSITION;
    float2 tex : texCoord0;
};

PixelInputType main(VertexInputType input)
{
    PixelInputType output;

    // Change the position vector to be 4 units for proper matrix calculations.
    input.position.w = 1.0f;

    // Calculate the position of the vertex against the world, view, and     projection matrices.
    output.position = mul(input.position, worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix); //<-- If I comment this line, it renders to the screen
    // Store the texture coordinates for the pixel shader.
    output.tex = input.tex;

     return output;
}

I feel like I'm missing something really basic, because I think I'm pretty close. Thanks for any help you can provide.

sentences: Inspector does not appear to match actual value A text object is where the inspector says, but not where I expected it, and not where Debug.Logerror says it is. What I read as my "strengthTextObj.transform.position.x" is -213 in the inspector but transform.position.x is logged as 111. Why might these be different?

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 use UpdateSubresource and Map/Unmap? From what I understood (from reading various pages) there are 2 ways to update a buffer:

UpdateSubresource() (when buffer is created with DEFAULT usage)
Map(), copy the new data, Unmap() (when buffer is created with DYNAMIC usage)

In the first case do I only call this one function (nothing more)? Because I've seen people say they map the buffer and then update subresource, or maybe I misunderstood them.

Also is there any other way (doubt it :P)? Do I understand things correctly?

sentences:
How to pass an interface to Java from Unity code? First, let me say that this is my first experience with Unity, so the answer may be right under my nose. I've also posted this question on Unity's answers site, but plugin questions don't seem to be as frequently answered there.

I'm trying to create a plugin that allows me to access an SDK from my game. I can call SDK methods just fine using AndroidJavaObject and I can pass data to them with no issue. But there are some SDK methods that require an interface to be passed.

For example, my Java function:

public void attemptLogin(String username, String password, LoginListener listener);

Where listener; is a callback interface. I would normally run this code from Java as such:

attemptLogin("username", "password", new LoginListener() {
    @Override
    public void onSuccess() {
        //Yay! do some stuff in the game
    }

    @Override
    public void onFailure(int error) {
        //Uh oh, find out what happened based on error
    }
});

Is there a way to pass a C# interface through JNI/Unity to my attemptLogin function? Or is there a way to create a mimic-ing interface in C# that I can call from inside the Java code (and pass in any kind of parameter)?

Thanks in advance! :)

sentences:
How to create high quality and fast portal effect? EDIT:
So I've gotten the portal visual effect working with no performance hit, and I've got the physics set up of objects with rigidbodies moving through portals seamlessly, and objects with character controllers moving through it seamlessly. The only thing I'm trying to figure out now is blending two camera views to get the proper first person transition effect. Any ideas on how I'd blend those two? I'm thinking something using a depth only shader, or the normalized viewport rect. My main problem is calculating that in real time, and with angles.

So I've been working on creating a portal effect in Unity3D. Obviously I've taken Valve's Portal as a great influence to programming this. Currently I'm simply using a camera's rendertexture to get the graphical effect across, and then some code to do the rest. The problem is at 2048x2048 it looks as high quality as Portal's, but causes heavy FPS loss. To solve this I'd either have to lower the texture quality or the number of times I update the texture.

Valve has accomplished a high quality portal effect without causing high frame rate loss. How can I do the same? Does anybody have any good ideas for rendering to a high resolution texture without causing frame loss?

I'm considering making my own code for rendering to textures rather then using Unity's built in system, it's doable but would definitely be a hassle. So any thoughts, ideas, or suggestions are highly appreciated.

sentences:
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:
How to draw a mini map OpenGL & OpenGL ES? I'm trying to draw a mini map. Succeeded to put current screen to smaller screen (mini map) via FBO.

But I do not know how to make the mini screen brighter when hover. You can imagine that, the real screen is very large, and you have a mini screen in the left bottom (like StarCraft), and when you hover on it, it's brighter than others.

I'm trying to use multiple attachment in FBO but it doesn't work. In fact that I don't know how does multiple attachment work, how is it used for?.

My way, draw map with  attachment_0 first, draw a hovering rectangle with attachment_1. Bind then draw all of the attachment textures in legal sequence (NOT WORKED).

I mean, the first draws a mini "large screen".

The second draws a brighter rectangle when hover.

Can anyone lead me how to do this or give me any suggestion?

Thank you very much!

sentences:
2D grid based game merging boxes Basically what i have at the moment is a tile based game with a grid containing a number of colored cells.

this is what i've done so far

The prinipal idea of the game is that the user has to connect all the shapes with the same color. but when two (or more) cells of the same color join they cannot be separated.

for example:

the player cannot go from image 1 to image 2 because the blue cells are attached, it should become what is in image 3

i need help how to make the attached cells move as a unit not separately one by one (like in image 2 which is what i have right now).

each cell is a Cell object and they are held in an array like this:

private Cell[][] grid;

and this is the code i'm using to move the cells around.

public void move(int dx, int dy) {
  // if (dx == -1) ==> move left
  // if (dx == 1) ==> move right
  // if (dy == -1) ==> move down
  // if (dy == -1) ==> move up
    if (clickedCell == null) {
        return;
    }
    if (dx > 0) {
        if (clickedCol < numCols - 1) {
            Cell temp = grid[clickedRow][clickedCol];
            grid[clickedRow][clickedCol] = grid[clickedRow][clickedCol + 1];
            grid[clickedRow][clickedCol + 1] = temp;
            grid[clickedRow][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            grid[clickedRow][clickedCol + 1].setPosition(x + (clickedCol + 1) * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            clickedCell = null;
        }
    } else if (dx < 0) {
        if (clickedCol > 0) {
            Cell temp = grid[clickedRow][clickedCol];
            grid[clickedRow][clickedCol] = grid[clickedRow][clickedCol - 1];
            grid[clickedRow][clickedCol - 1] = temp;
            grid[clickedRow][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            grid[clickedRow][clickedCol - 1].setPosition(x + (clickedCol - 1) * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            clickedCell = null;
        }
    } else if (dy > 0) {
        if (clickedRow > 0) {
            Cell temp = grid[clickedRow][clickedCol];
            grid[clickedRow][clickedCol] = grid[clickedRow - 1][clickedCol];
            grid[clickedRow - 1][clickedCol] = temp;
            grid[clickedRow][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            grid[clickedRow - 1][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 0) * Cell.SIZE);
            clickedCell = null;
        }
    } else if (dy < 0) {
        if (clickedRow < numRows - 1) {
            Cell temp = grid[clickedRow][clickedCol];
            grid[clickedRow][clickedCol] = grid[clickedRow + 1][clickedCol];
            grid[clickedRow + 1][clickedCol] = temp;
            grid[clickedRow][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            grid[clickedRow + 1][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 2) * Cell.SIZE);
            clickedCell = null;
        }
    }
}

thanks in advance and by the way this game is built using LibGDX.

sentences:
How do I prevent getting an access denied loading a file in XNA, when I have the application running in the program files directory (in Windows 7)? I'm creating an app in XNA.

I'm trying to load a custom save file. I named the file with my own custom extension. It's an XML file serialized with the DataContractSerializer.

I've tried several things to load the file. And they all work when I'm running in my development environment, or when the game is running from most folders, but if the game has been placed in the program files folder (or any other protected by Windows 7), the game won't load my custom files, but it will load images and other items that the content importer handles naturally.

Things I have tried:

Directly loading the file using the DirectoryInfo.CurrentDirectory() then scanning for files, and loading them.
Using the StorageContainer.TitleLocation
Creating a custom importer, and loading them into the content pipeline

In all cases, it works fine running in my IDE (C# Express 2008), but when the app is running from Program Files, I get the following error:

Access to the path 'C:\Program Files\MyFolder\MyAppName\Content\CustomFolder\Blah.CustomExtension' is denied.

I am running as administrator (though obviously, I eventually don't want the end user to need this right).

Any suggestions?

sentences:
Add Lerp on only the Y axis I want my camera to be smooth on only the Y axis.How do I do that it?

Current code:

public Transform target;
public float smoothSpeed = 0.3f;
public float offsetX = 1f;
public float offsetY = 1f;
public float offsetZ = 1f;

void FixedUpdate ()
{
    Vector3 pos = transform.position;
    pos.x = target.position.x;
    pos.y = target.position.y;
    pos.z = target.position.z;
    Vector3 positionz = pos.z;

    Vector3 smoothedPosition = Vector3.Lerp(transform.position, pos, smoothSpeed);
    transform.position = smoothedPosition;
}

sentences:
Creating a database with special items, like in Diablo I am in the middle of creating a browser game. I need to add 'special items' like in Diablo, but simpler. Item names are fixed (e.g. 'ring of power'), so only their attributes change.

In my game there are different towns. Each town may trade a different set of items with randomized characteristics. For instance, in Town A a 'ring of power' will have better attributes than the same item in Town B (and, thus, it will cost more).

My question is how to construct the database to handle this.

After constructing the database I will create a small script that will assign a different subset of items in each town. Each item with random attributes and a price that reflects its value.

I can make the script; what I need help on is creating the database.

sentences:
Raycasting mouse coordinates to rotated object? I am trying to cast a ray from my mouse to a plane at a specified position with a known width and length and height.

I know that you can use the NDC (Normalized Device Coordinates) to cast ray but I don't know how can I detect if the ray actually hit the plane and when it did. The plane is translated -100 on the Y and rotated 60 on the X then translated again -100.

Can anyone please give me a good tutorial on this? For a complete noob! I am almost new to matrix and vector transformations.

sentences:
How many developers are there? We game developers appear to be a pretty big community. But how big is that community exactly?

How many developers, professional as well as amateur, are working on games all around the world? Do sources to get that number even exist?

sentences:
OpenGL - drawElements 2D imposible z-sorting (textured) I am creating a 2D program in OpenGL 3.2 Now to render what I do is have a VBO for each texture and add the elements of the objects that use that texture to this vbo. Now as you know the order you render objects will be the (fliped) order you see them on the screen.

Here is the problem, as you know its possible to sort objects by their Z value in the same VBO (by inserting them to the vbo according to their Z value). But when you want to sort them between VBOs thats impossible because they have to be in the correct VBO to have the correct texture, Meaning the VBOs that are drawn last will have positive Z value priority over VBOs that are drawn first.

This causes the Z value to transfer from the actual objects, to their textures and makes the Z value be grouped for all objects that use the same texture.

That was kinda confusing so to recap, because of the way VBOs work this is what is going to happen:

Turtule texture id 1

Box texture id 2

(Each textures has its own VBO)

There is one turtle and one box, the turtle (z = -1) is behind the box (z = 0) . if I render the box VBO then the Turtle VBO
What will happen is we will see the turtle over the box even though it has a z value that is less then the box.

Here is some art I drew to help you visualize the problem:

^^^ That makes the Z value of the actual turtle meaning less compared to the " Z " value of the VBO. This can be worked around by having a Z value for each VBO but that limits the program because if the Z of the boxes is bigger than turtles no matter what every turtles is gonna be hidden behind every box. And its a stupid way of doing it.

So finally to the question:

  What can I do to fix this, to have a meaning full Z value to each
  OBJECT.

Notes:

I cannot draw the object individually because I use drawElements and
because I add them to texture coresponding VBOs to reduce the VBO
count and texture binding count.

Stuff I have tried* : I have tried using the actual opengl Z-buffer, but I cannot blend layers because of that so its not a solution.

sentences:
OnDrag does not work, but OnMouseDown works There is a code:

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

public class DragAndDropGame : MonoBehaviour, IBeginDragHandler, IDragHandler
{

    Camera MainCamera;

    void Awake()
    {
        MainCamera = Camera.allCameras[0];
        Debug.Log(MainCamera);
    }

    public void OnBeginDrag(PointerEventData eventData)
    {
        Debug.Log("OnBeginDrag");
    }

    public void OnDrag(PointerEventData eventData)
    {
        Vector3 newPos = MainCamera.ScreenToWorldPoint(eventData.position);
        newPos.z = 0;
        transform.position = newPos;
    }

    void OnMouseDown()
    {
        Debug.Log("OnMouseDown");
    }
}

OnMouseDown fulfills, but the implementation ofIBeginDragHandler, IDragHandler - not. What can be wrong?

sentences: Unity, Cannot See Items on the Scene I am new to unity. I have created an asset by using Blender and managed to put it in the scene. But somehow now I can only see one item at a scene. For example I can only see camera when I clicked "Main camera" at the Hierarchy toolbar. When I clicked the asset, the camera is hidden from the scene along with lighting etc. This is difficult for me since I need to put my asset in front of the camera. Where can I toggle back the views for everything in the scene?

sentences:
Tile Palette problem in Unity I am working on isometric tilemap in Unity 2019.4.8f1.
In the Tile Palette panel, the selection is always 1 block away. Please see this screenshot:

In the screenshot, apparently I selected an empty tile, but in fact I am select the green tile with flowers. How come? Every selection is one tile away. The same issue happens in the Tilemap selection mode too. I have to select the adjacent tile in order to select the tile I want.
How do I fix it? It's quite annoying.
UPDATE I have added the settings of Grid, Tilemap as well as the import settings of the tile sprite sheet below.

UPDATE 2 Changed the Pivot in Sprite Editor to Bottom Center
Recreated the Tile Palette, and it looks like hovering 0.5 unit up.

sentences:
Is Gresham's Law relevant for modern online games that allow the use of real money as additional currency? More and more online games are planning to allow the use of real money to purchase ingame items in addition to the standard ingame currency. Diablo III for example, which will be released next year, will feature a gold-auction house (only ingame gold allowed) and a real money auction house (only real money allowed) to trade items between players inside the game.

Gresham's Law says that: "When government compulsorily overvalues one money and undervalues another, the undervalued money will leave the country or disappear from circulation into hoards, while the overvalued money will flood into circulation."

People are worried that ingame gold will be severely undervalued and real money will be dominating because the developers of the game get their share from real money transactions and want to push this currency. They are the government that might compulsorily overvalue real money and undervalue ingame-gold. This means according to Gresham's Law that we will see the ingame currency gold vanish over time, leaving the real money auction house as the only option to buy and sell items.

This leads to the question, if Gresham's Law can be applied to this scenario. What are the reasons why or why not Gresham's Law will effect online games with real money and virtual currencies combined in the same market.

sentences:
How long will it take to jump from point A to point B? I need to know how long it takes to jump from one point to another. Because if the jump time takes for example 2.0f(float jumptime = 2.0f), a jump animation is played during a time interval of exactly 2.0f. The difficult thing is, I need to know the jump time before the jump was executed.

Is it possible to calculate that right before the jump is executed or is it impossible to calculate that?

I use the following formula to let an object(ball) jump from one platform to another platform:

impulse = Vector2(distance.x / time * mass + gravity.x / 2 * time * mass, distance.y / time * mass + gravity.y / 2 * time * mass);

Description of the jump

Update:

My calculations:

float gravity = 3, timetopeak, timetoground, totaljumptime, waytothetop, waytotheground;

timetopeak = jumpForce.Y / -gravity;
waytothetop = (float)(0*timetopeak + 0.5*-gravity*timetopeak*timetopeak);
waytotheground = Ball.Position.Y + waytothetop - (PlatformB.Position.Y - PlatformBHeight / 2.0f - BallHeight / 2.0f);
timetoground = (float)(Math.Sqrt(2 * waytotheground / -gravity));
totaljumptime = timetopeak + timetoground;
Ball.ApplyLinearImpulse(ref jumpForce);
//I divide the totaljumptime because the animation has 5 frames.
BallAnimation = new Animation(totaljumptime/5, 32, 32, Animation.Sequences.forwards, 0, 5, false, true);

Are my calculations correct? Because the totaljumptime is very small and my animation runs much too fast.

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:
Rotating coordinate system Lets say that you want to rotate simple cube around fixed point in center.

Is it possible to use such coordinate system, that you need to use only sine and cosine in order to rotate?

I have done some 3d stuff in VHDL, but i screwed whith coordinate system and is not working correct. I need to make rotation that works in at least two axes.

sentences:
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:
THREE.JS - How to know the shortest rotation direction an object must do to look at other? I am trying to understand a way in THREE.JS (and the mathematical foundation) to get the direction an object should rotate to lookAt other but without actually rotate it.
I've tried to use lookAt but that rotates the object completely.

I want to apply a small custom parameterized rotation on that direction.
So I don't want all the rotation, just the direction of that shortest to look at rotation.

So, basically I have 2 object positions and I want the shortest rotation direction of one of them so that one looks at the second object position, independently of the second object rotation.
And limit the axis so it works on a over the top 2d game setting (although the graphics are 3d)..

The rotation must be around Z for example.

And relative to the current object heading as this will be computed on each game loop iteration depending on the player position.

This is intended for a game where enemies try to follow the player but turn slow to look at him.

Thank you in advance

sentences:
Access Single-Pass RenderTexture I'm trying to achieve a mirror effect where a second camera renders to a render texture, which is then passed into a shader using SetGlobalTexture.

Everything works fine outside of VR, but in Steam VR it seems like the render texture only stores the texture for one eye (left), even with single-pass stereo enabled in player settings.

How can I access the texture for the second eye? Or rather, how can I access the texture where both eyes have been drawn, one on each half of the screen?

What I'm doing at the moment:

void Awake()
{
    mirrorCameraRenderTexture = new RenderTexture(vrCam.pixelWidth, vrCam.pixelHeight, 24);
    mirrorCamera.targetTexture = mirrorCameraRenderTexture;

    Shader.SetGlobalTexture("_MirrorCameraRenderTexture", mirrorCameraRenderTexture);
}

sentences:
How to prevent Rigidbodies with restricted movement from clipping My player is a rigidbody cube with a box collider that can push other "NPC" rigidbody cubes that also have a box collider. These NPC cubes have restricted movement either in horizontal or vertical direction. If the player pushes a cube that can only move horizontally into a cube that can only move vertically, the cubes start clipping. I recorded the whole situation in this video. Note that the NPC cube on the left has frozen X position, while the one on the right has frozen Z position.
I know that one way of preventing this would be to increase the mass of the NPC cubes, but that would only resolve the problem proportionally to the increased mass (the higher the mass, the lower the clipping), and at some point my player is not strong enough to move the NPC cubes anymore.
How can I solve this?

sentences:
Performing simple network call to retreive JSON in Unity? I have looked at the network documentation for Unity and most examples seem to be related to networking your game for multiplayer. I am just looking to grab a JSON response from an API for dynamically generating a menu.

Are there some good examples for doing just simple network calls to get a response from a web server?

sentences:
XNA Rotate Vector2 around Origin I have a Rectangle and a Vector2 position, my sprite is being drawn at this position. The rectangle is meant to be a collision system with the cursor, when I rotate my sprite around the origin and stuff in a draw call

public virtual void Draw(SpriteBatch spriteBatch)
{
    spriteBatch.Draw(texture, position, null, Color.White, rot, Origin, SCALEFACTOR, SpriteEffects.None, 0f);
}

It works fine, my object is rotated, at it's centre, by Pi/2, or whatever I put in.
However, rotating the rectangle isn't as easy, I read almost every stack overflow question on this problem and still haven't found a fix. I then followed a youtube guide, this is the resulting code for rotating a rectangle.

private void RotateItem(float rotation)
{
    rot += rotation;
    UpdateRectangle();
}

private void UpdateRectangle()
{
    Vector2 tl = Vector2.Transform(Vector2.Zero, transform);
    Vector2 tr = Vector2.Transform(new Vector2(scaledWidth, 0), transform);
    Vector2 bl = Vector2.Transform(new Vector2(0, scaledHeight), transform);
    Vector2 br = Vector2.Transform(new Vector2(scaledWidth, scaledHeight), transform);

    Vector2 min = new Vector2(FindSmallest(tl.X, tr.X, bl.X, br.X), FindSmallest(tl.Y, tr.Y, bl.Y, br.Y));
    Vector2 max = new Vector2(FindBiggest(tl.X, tr.X, bl.X, br.X), FindBiggest(tl.Y, tr.Y, bl.Y, br.Y));

    rectangle = new Rectangle((int)min.X, (int)min.Y, (int)(max.X - min.X), (int)(max.Y - min.Y));
}

private void UpdateTransformMatrix()
{
    transform = Matrix.CreateTranslation(new Vector3(-Origin, 0))
                * Matrix.CreateRotationZ(rot)
                * Matrix.CreateTranslation(new Vector3(position, 0));
}

The width + height don't seem to change until I click on the box (which isn't even drawn properly over the sprite because Origin + and doesn't seem to rotate at all tbh)... I'll show you an example https://gyazo.com/c045b844f306a0ea25f48a0d45127f21

And this is my full draw code + including the rectangle's rectTex

public virtual void Draw(SpriteBatch spriteBatch)
{
    spriteBatch.Draw(texture, position, null, Color.White, rot, Origin, SCALEFACTOR, SpriteEffects.None, 0f);
    if (ShowRectangle)
        spriteBatch.Draw(rectTex, rectangle, null, Color.White, rot, Vector2.Zero, SpriteEffects.None, 0f);
}

sentences:
Why is my model rotating opposite direction around the Y axis? I have a simple scenario. I have a simple scene, and in it I'm drawing a grid and a model, with some axis for orientation.

I noticed when I rotate the model about it's local Y axis, if I rotate the model clockwise, the vertices end up rendering as if they've been rotated counterclockwise. I can see this by rendering the model's local forward vector.

Here's a picture of what I mean. Initially, the world forward, local forward, and model all face the same direction.

However, after I begin rotating the object clockwise, I notice the "world forward vector" is rotating clockwise, but my model rotates counterclockwise?

When I export the model from Blender3D I use the coordinate system "Forward: -Z" and "UP: Y Up", which matches the RHS coordinate system I'm using in opengl.

When I "rotate the object", I mean I multiply the object's rotation matrix like so:

float constexpr angle = 1.0f;
glm::vec3 const axis = glm::vec3{0.0, 1.0, 0.0};
object.rotation = glm::angleAxis(glm::radians(angle), axis) * object.rotation;

Here's my vertex shader, I'm just multiplying the vertices by the MVP matrix.

vertex shader:

in vec4 a_position;
in vec4 a_color;

out vec4 v_color;

uniform mat4 u_mvpmatrix;

void main()
{
  gl_Position = u_mvpmatrix * a_position;
  v_color = a_color;
}

The rotation object.rotation 's initial value is the quaternion identity. Here's how I calculate the MVP matrix uniform value:

glm::mat4 const tmatrix = glm::translate(glm::mat4{}, this->translation);
glm::mat4 const rmatrix = glm::toMat4(this->rotation);
glm::mat4 const smatrix = glm::scale(glm::mat4{}, this->scale);
glm::mat4 const model_matrix = tmatrix * rmatrix * smatrix;

// camera_xyz are world-coords for the camera
// target_xyz is world-coords of the object
glm::vec3 const UP = glm::vec3{0.0f, 1.0f, 0.0f};
glm::mat4 const view = glm::lookAt(camera_xyz, target_xyz, UP);
glm::mat4 const projection = glm::perspective(fov, aspect_ratio, near, far);
glm::mat4 const mvp_matrix = projection * view * model_matrix;

Other relavent calculations:

glm::vec3 eye_forward() const { return forward_; }
glm::vec3 eye_up() const { return up_; }
glm::vec3 eye_backward() const { return -eye_forward(); }

glm::vec3 eye_left() const { return -eye_right(); }
glm::vec3 eye_right() const { return glm::normalize(glm::cross(eye_forward(), eye_up())); }
glm::vec3 eye_down() const { return -eye_up(); }

glm::vec3 world_forward() const { return forward_ * orientation(); }
glm::vec3 world_up() const { return up_ * orientation(); }
glm::vec3 world_backward() const { return -world_forward(); }

glm::vec3 world_left() const { return -world_right(); }
glm::vec3 world_right() const { return glm::normalize(glm::cross(world_forward(), world_up())); }
glm::vec3 world_down() const { return -world_up(); }

From what I can tell, it seems like I'm doing everything right. Can someone explain it to me? I also have a video showing this in more detail. This is important, because I move the object "forward" based on it's forward vector, so when I rotate the object and move it "forward" it's not moving in the direction it is facing.

edit: Am I calculating the "local forward" correctly with this calculation?

double edit:
I just noticed I labeled the "World" and "Object space" vectors backwards. The green arrow is the World forward vector (0, 0, -1) and the light blue is the object's local forward vector.

// forward_ is initialized with -Z (0.0, 0.0, -1.0)
glm::vec3 world_forward() const { return forward_ * orientation();
glm::quat const& orientation() const { return object.rotation; }

sentences:
Numerical stability in continuous physics simulation Pretty much all of the game development I have been involved with runs afoul of simulating a physical world in discrete time steps. This is of course very simple, but hardly elegant (not to mention mathematically inaccurate). It also has severe disadvantages when large values are involved (either very large speeds, or very large time intervals).

I'm trying to make a continuous physics simulation, just for learning, which goes like this:

time = get_time()
while true do
    new_time = get_time()
    update_world(new_time - time)
    render()
    time = new_time
end

And update_world() is a continuous physical simulation. Meaning that for example, for an accelerated object, instead of doing

object.x = object.x + object.vx * timestep
object.vx = object.vx + object.ax * timestep -- timestep is fixed

I'm doing something like

object.x = object.x + object.vx * deltatime + object.ax * ((deltatime ^ 2) / 2)
object.vx = object.vx + object.ax * deltatime

However, I'm having a hard time with the numerical stability of my solutions, especially for very large time intervals (think of simulating a physical world for hundreds of thousands of virtual years). Depending on the framerate, I get wildly different solutions.

How can I improve the numerical stability of my continuous physical simulations?

sentences:
Why do I get a jitter/stutter when moving and following a target? I am using the script below to move a transform to quickly follow a target (the player), and come to a stop close to the player.
When I move the player around, the transform is following the player, keeping the 1.5 distance.
To ensure the transform can keep up with the player, I set the moveSpeed to 5, But when I do that, the transform jitters/stutters when moving.
If I set the moveSpeed to 1 for example, the transform will move smoothly but will not keep up with the player - the player has to stop moving and wait for it to catch up. But increasing the speed makes the stutter return.
Why is this stutter happening, and how can I make the movement smooth?
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public class Follow : MonoBehaviour
{
    public Transform targetToFollow;
    public Text text;
    public Text text1;
    public float lookAtRotationSpeed;
    public float moveSpeed;

    private float minMoveSpeed = 0f;
    private Vector3 originPos;

    // Start is called before the first frame update
    void Start()
    {
        originPos = targetToFollow.position;
    }

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

        var distance = Vector3.Distance(transform.position, targetToFollow.position);

        text.text = "Transform Distance From Target " + distance.ToString();

        float ms = moveSpeed;

        if (distance > 5f)
        {
            ms = moveSpeed + 0.5f;
        }
        else if (distance < 1.5f)
        {
            ms = Mathf.Max(minMoveSpeed, ms - 0.3f);
        }
        else
        {
            //transform.position = Vector3.MoveTowards(transform.position, targetToFollow.position, Time.deltaTime * ms);
        }

        if (distance < 0.5f && originPos == targetToFollow.position)
        {
            ms = 0f;
        }

        if (distance > 1.5f)
            transform.position = Vector3.MoveTowards(transform.position, targetToFollow.position, Time.deltaTime * ms);

        originPos = targetToFollow.position;
    }
}

sentences:
What does Polygon2D's polygons property do? Godot Polygon2D class has a polygons property of type Array. The documentation -at the time of writing- does not say what it does. Adding something to it makes the Polygon2D disappear. Which I would find hard to believe to be the purpose of this property, not only an Array is excessive, but we have visible for that.
I have found a question on reddit: What does a polygon2D's polygons property do? Which has a single reply saying -among other things- that "it doesn't really do anything".
Is it true that it doesn't really do anything? If it does something, what does Polygon2D's polygons actually property do?

And I can't reply on an archived question on Reddit, so I'm answering here. Yes, this is me answering my own question. again.

sentences:
Unity: material has shiny white outline I have two different projects open in Unity. But my grass material appears different in each project, despite all the parameters being the same.

See this image:

On the left is the desired appearance. But on the right my material has a strange white-ish outline. How do I get rid of it?

I have tried copying the material between the projects, and the problem seems to be independent of the available lighting

sentences: What applications can I use to generate music? In my cocos2d iPhone app I wanted to have in game music. But I don't want to use garageband! It is just dragging prewritten loops. I wanted to compose the music for my game. Is there software that I can use to write music, such as techno music? Not taking songs that were made by someone else and adding effects.

sentences:
Creating a 2D game on the X-Z plane instead of the X-Y plane in Unity, any adverse effects or challenges with this? After coming to the realization that some things I wish to do in a 2D RTS are easier to do on the X-Z plane instead of the default X-Y plane, I'm considering moving my game over to the other plane.

What I am wondering, past the scripting changes to accommodate the different plane, is what specific challenges will this cause for a 2D game (using 3d physics, not 2d physics)? I did a test and flipped some assets to the X-Z plane and things seemed to work just fine, though I am not sure what unique challenges I will end up facing are.

All our objects will have a 90 degree X-Axis rotation so that their sprites display.

sentences:
detecting the coordinates where a bullet hits a mesh I have a lot of complex objects in a scene and im looking for an efficient way to find which object a fired bullet hits and to find the hit coordinates.
It would be best if there was a lightweight library to do this.
it seems that PhysX can do this, but i didnt find a way except to give every face in every mesh a physX system and that seems to become a bottleneck.

thanks in advance.

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:
Making sense of the Game State manager tutorial? I have come across the Game State Managemnet tutorial at http://create.msdn.com/en-US/education/catalog/sample/game_state_management because I thought this would be a good place to start a game off.

I have added a new screen, but I am still a bit lost on how everything works.  When I make my game, do I only need one more additional screen? just for gameplay? or should I have a different screen for each level?

sentences:
What are Blackboards? I am implementing an Entity System for my game. I am aiming for a larger procedurally generated world. The world will be filled by AI entities where "on screen" and "near screen" entities will be updated regularly, while the "far away" entities will only be updated sometimes.

My initial thought was to implement a message queue... which is filled during a loop and invoked after the loop, but before the next loop. Then I read this, in there there is an answer mentioning Blackboards(the one with 12 votes), but I haven't been able to find anything detailed on Blackboards.

The question is what exactly are they and what would I gain by using them when compared to message queue ?

My language of choice is CSharp.

sentences:
Unity2D jumping inconsistancy I'm tinkering with a unity2D sidescroller, and am trying to make a player controller to jump. However, when I tell my character to jump, it sometimes jumps twice the distance, and I don't know why. Below is my controller script:

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

public class PlayerMovement : MonoBehaviour
{

    public float playerSpeed = 10;
    public float jumpForce = 20;
    private bool ableToJump = false;
    public GameObject groundCheck;  // place an empty object slightly below the character where it will collide with any ground

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("space") && ableToJump)
        {
            ableToJump = !ableToJump;
            GetComponent<Rigidbody2D>().AddForce(new Vector3(0,1,0) * jumpForce);
        }
        if (Input.GetKey("a"))
        {
            transform.Translate(-playerSpeed * Time.deltaTime, 0, 0);
        }
        if (Input.GetKey("d"))
        {
            transform.Translate(playerSpeed * Time.deltaTime, 0, 0);
        }

        // The player is grounded if a linecast to the groundcheck position hits anything on the ground layer.
        ableToJump = Physics2D.Linecast(transform.position, groundCheck.transform.position, 1 << LayerMask.NameToLayer("Wall"));
    }
}

Here is the glitch as it appears when I am previewing the game (watch how the third jump seems to be twice as high). There is no consistency to when it occurs, but it has occurred any time between two in a row and 10-12 between times it happens. I have tried long versus short presses of the jump key (space bar), moving versus standing still, and jumping on different locations. I have also tried disabling animations and waiting between presses versus pressing and holding space, versus pressing space rapidly. The only consistent thing is that sometimes I jump about three blocks (200 x 200px each) high, and sometimes I jump about six blocks high. Any tips are appreciated. Thanks!

sentences:
How to implement friction in a physics engine based on "Advanced Character Physics" I have implemented a physics engine based on the concepts in the classic text Advanced Character Physics by Thomas Jakobsen. Friction is only discussed very briefly in the article and Jakobsen himself notes how "other and better friction models than this could and should be implemented."

Generally how could one implement a believable friction model on top of the concepts from the mentioned article? And how could the found friction be translated into rotation on a circle?

I do not want this question to be about my specific implementation but about how to combine Jakobsens ideas with a great friction system more generally. But here is a live demo showing the current state of my engine which does not handle friction in any way: http://jsfiddle.net/Z7ECB/embedded/result/

Below is a picture showing and example on how collision detection could work in an engine based in the paper. In the Verlet integration the current and previous position is always stored. Based on these a new position is calculated. In every frame I calculate the distance between the circles and the lines. If this distance is less than a circles radius a collision has occurred and the circle is projected perpendicular out of the  offending line according to the size of the overlap (offset on the picture).

Velocity is implicit due to Verlet integration so changing position also changes the velocity. What I need to do know is to somehow determine the amount of friction on the circle and move it backwards parallel to the line in order to reduce its speed.

sentences:
What should i use as a board for my game? I'm a beginning programmer and i need to make a game. The rough idea revolves around fleets fighting in turn based battles while you control your factions resources and manpower.

The original concept was to make a set of routes which the fleet could follow. A graph of location nodes connected by route edges that looks a bit like this:

I don't know how to make a map and make set locations on it.

On that note, i'm making this is html/javascript/css. This is a school assignment.

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:
Procedual level generation for a platformer game (tilebased) using player physics I have been searching for information about how to build a 2d world generator (tilebased) for a platformer game I am developing. The levels should look like dungeons with a ceiling and a floor and they will have a high probability of being just made of horizontal rooms but sometimes they can have exits to a top/down room.

Here is an example of what I would like to achieve. I'm referring only to the caves part. I know level design won't be that great when generated but I think it is possible to have something good enough for people to enjoy the procedural maps (Note: Super Metroid Spoiler!):

http://www.snesmaps.com/maps/SuperMetroid/SuperMetroidMapNorfair.html

An idea I had to accomplish this was to let the computer play a level and carve the dungeon as the "computer player" plays. But don't know how to handle branches in the way, etc... Using this way of carving I could be confident that at least an exit exists in the map and that it is reachable.

Another idea I had was using a cellular automata with some heuristics to do the carving. A problem arises here: how could I make sure that all zones carved are reachable by the player (that is limited by gravity, etc...) ?. I guess I could use some kind of graph that could follow the different dungeon floors the automata is carving and then somehow I could measure  if some part would be reachable or not by the player and add platforms or new terrain to make it reachable.

sentences:
The state that is synced when a window is broken in a FPS game In order to better understand how state syncing works in games, I wanted to pose a specific example. Say you are in a FPS game with multiple players and someone breaks a window in some building. Wondering what happens in terms of state syncing. For example, there are these aspects:

Someone else is watching the player break the window in the game. So it should probably be a real-time update.
Someone isn't watching but they hear the sound of the window breaking.
Someone is out of range of hearing or seeing the window break, so wondering if it still updates their game world, or it somehow lazily picks up the changes when they go to the area with the broken window.

Wondering how it generally works in these different scenarios. Any FPS game is fine. For example, in (1), if they are sending each individual particle of broken glass over the internet, or somehow they just send the generic action "user x threw object y at window z" and it replays the action on everyone's computer who is watching. In which case somehow the game world is broken up into macro chunks rather than being composed of particles. In (2), maybe they divide the level into zones of seeing and hearing range, and somehow send just the right amount of state then (wondering what kind of state, and how much). Then in (3), if it is lazily picked up, then what sort of queue is kept on the backend. If the data is compressed when it is sent, etc.

sentences:
How do I call the sprite auto-slicer from a script in the Unity editor First of all let me start with an apology. I know this may not be the right place for this question, but the good people over at stackoverflow did not answer me and neither did I get a answer over at Unity Answers, so I'm hoping that someone here will know. So without further ado here is my problem.

I'm writing my own asset importer and would like to automatically slice the sprite sheet.Slicing it with a grid is not viable since we have sprites with different sizes and I need to use the automatic slice option form the Sprite Editor. So far if the imported file has "sheet" in the name I can set all the properties I want. All that is left is do the automatic slicing but I cant even find anything in the documentation. Is this even possible ?

Edit: here is a screen shot. I want to access this functionality from my custom EDITOR script.

In simples words I want to click this button from a script instead of the artist when he imports a new spritesheet.

sentences: How to protect Lua scripts in IOS game? I'm developing an iOS game and was considering putting level info and monster info in a Lua script for ease of use. However, since I'm using Game Center for multiplayer I'm concerned users will attempt to change these scripts to cheat. What measures can I take to protect my Lua scripts?

sentences:
Is there a command line ATI texture compression tool? Is there a command line tool that can convert PNG and JPG files to ATITC compressed textures?

I have my own export pipeline that converts all textures to PVRTC, ATITC, and DXT, so I have no use for a GUI-based tool like the Compressonator. Also, I'm running on Linux (although Wine might be able to handle simple conversion tools).

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:
Q: 2D cone and rectangle collision detection I'm working on a 2D RPG game and now I need to detect if players ability collides with enemy rectangle hitbox. Currently I have this code that detects if a point is in cone, but I need to modify it to find if rectangle is colliding with a cone like in a picture below

float skillAngleTotalWidth = 90f;
int radius = 8, x = 3, y = 4;
float startAngle = skillUsedAtAngle - skillAngleTotalWidth / 2;
float endAngle = skillUsedAtAngle + skillAngleTotalWidth / 2;
// Calculate polar co-ordinates
float polarradius = (float)Math.Sqrt(x * x + y * y);
float Angle = Helpers.RadianToDegree((float)Math.Atan(y / x));
// Check whether polarradius is less then radius of circle or not and Angle is between startAngle and endAngle or not
if (Angle >= startAngle && Angle <= endAngle && polarradius < radius)
{
   Console.WriteLine("Point ({0}, {1}) exist in " + "the circle sector", x, y);
}

Need to find if cone and rectangle collide

sentences:
Clearing a gizmo list (OnDrawGizmos) I have a list of gizmos in a simple gizmo drawing manager. This list is updated from different parts of the codebase, usually from Update() methods. It goes something like this:

public class RenderGizmos : Singleton<RenderGizmos>
{
    private List<GizmoData> gizmos = new List<GizmoData>();

    public void AddNewGizmo(GizmoData[] gizmos)
    {
        this.gizmos.AddRange(gizmos);
    }

    public void AddNewGizmo(GizmoData gizmo)
    {
        this.gizmos.Add(gizmo);
    }

    void OnDrawGizmos()
    {
        if (gizmos == null) return;
        for (var i = 0; i < gizmos.Count; i++)
        {
            //draw gizmos
        }
    }
}

Can you advise me on when to clear the gizmo list? Ideally I would like to clear it every frame. However:

Clearing it at the end of the OnDrawGizmos() method will render no gizmos (as I suspect this method might be called several times a frame).
Clearing it in an LateUpdate()/Update() method is dependent on execution order, sometimes it draws gizmos, sometimes it doesn't
Clearing it in a Coroutine has rendered no gizmos (but it might just be dependent on the execution order as well)

I would like not to be dependent on the execution order so I prefer not to use the Script Execution Order system.

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:
Render angles of a 3D model into 2D images? Is there a tool out there that you can give a 3D model file, and it will output 2D renders of it from various angles? For example if you were making a 2D RPG but you want to make your character look nice, you might make the character in 3D and then just render the character from 8 or more angles into images which then are used by the 2D engine to give a pseudo-3D look.

Does such a tool exist or will it need to be custom-written or done manually?

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:
What's the easiest way to get a JavaScript game to save? I'm doing a re-skin of and old open source web game, the current game is in HTML, CSS and JavaScript.

I'm trying to redo the save game bit as I can't make sense of it and want something I can understand. I think it's relying on a database or Dropbox? Though I've tried removing the Dropbox links it still seems to work perfectly?

So it works but I don't understand what it's doing and I'd rather want something where I can see how its done, saving the state ie variable values and open panels etc.

sentences:
3D Binary Space Partitioning with solid/empty leaves I've recently started looking into BSPs for real-time collision detection, and I'm now looking into improving the performance of my solution.

The system that I've implemented is rather similar to the solution found on wikipedia (https://en.wikipedia.org/wiki/Binary_space_partitioning), where each node contains triangles found located on the node's hyperplane, and references to two nodes found on each side of the hyperplane.

BSP generation pseudocode:

Node generate_bsp(Trimesh mesh)
Trimesh back, front
Node node(mesh[0]) // Generates the plane position and normal of the node
loop (Triangle tri : mesh)
   if (onPlane(tri, node))
      node.triangles.add(tri)
   else if (inFront(tri, node))
      front.add(tri)
   else if (Behind(tri, node))
      back.add(tri)
   // Not fully in front or behind means that the triangle is found on both sides
   // and needs to be split
   else
      Triangle[] trisSplit = tri.split(node)
      loop (tri2 : trisSplit)
         if (inFront(tri2, node))
            front.add(tri)
         else if (Behind(tri2, node))
            back.add(tri)

node.nodeBack = generate_bsp(back)
node.nodeFront = generate_bsp(front)

return node

This means that for a raycast, I iterate over the hyperplanes sorted from front to back, and determine if my ray hits any of the triangles found on each hyperplane.

BSP raycast pseudocode:

Bool ray_intersect_bsp(Vector rayPos, Vector rayDir, Node* BSP)
if (BSP == null)
   return false

if (onPlane(rayPos, node))
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
else if (inFront(rayPos, node))
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
else
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true

return false

This system however demands using ray-triangle intersection determination, which is a costly procedure. What makes matters worse is that there's a high chance that the triangles you iterate on are missed by the ray, which results in a relatively large amount of costly raycasts that need to be performed before finding the closest hit on the trimesh.

What methods can I use to optimize my BSP structure and traversal?

sentences:
Drawing & transforming matrices upwards I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale.

I get my expected results If I draw my objects from my root node in this fashion:

public void Draw(Matrix world, Matrix view, Matrix proj)
{
    foreach (var item in Children)
        item.Draw(world * item.Transform, view, proj);
}

However, I want to draw my objects by starting with a child node, drawing upwards, and achieving drawing from a child-object relative space. How would I do this?

I've tried a number of ways or drawing the parent nodes with inverted transform, but I'm not getting the correct results, I'm guessing I need to take care of the multiplication order, but I don't know what that is if I'm going up instead of down.

sentences:
Calculating the rotational force of a 2D sprite I am wondering if someone has an elegant way of calculating the following scenario.

I have an object of (n) number of squares, random shapes, but we will pretend they are all rectangles.

We are dealing with no gravity, so consider the object in space, from a top down perspective.  I am applying a force to the object at a specific square (as illustrated below).

How do I calculate the rotational angle, based on the force being applied, at the location being applied.  If applied in the center square, it would go straight.  How should it behave the further I move from the center?  How do I calculate the rotational velocity?

sentences: 2D game board for android I am trying my hand at android game development. I want to start with a simple 2D board game. What is the best way to draw a game board like the one in the image attacked below. The blue circles are points where the players can place objects.

sentences:
Game Maker Studio 2 problems with too many instances So I am trying to make a management game, a space station simulator if you will, with potentially hundreds and thousands of customers entering and leaving the station every game day. So my plan of handling this is to first create a persistent object called oManager. Over the course of the game, oManager will continuously spawn instances of this object called oPerson.

The part of oManager that spawns person:

global.dailyflow = 100;
show_debug_overlay(true);
var number_a_day = irandom_range(ceil(global.dailyflow*0.6),global.dailyflow);
trader_base = floor(number_a_day*0.02);
trader_extra = floor(trader_base*(1+global.trader_modifier/100));
tourist_base = ceil(number_a_day*0.1);
tourist_extra = ceil(tourist_base*(1+global.tourist_modifier/100));
passerby_base = ceil(number_a_day*0.53);
passerby_extra = ceil(passerby_base*(1+global.passerby_modifier/100));
shopper_base = ceil(number_a_day*0.25);
shopper_extra = ceil(shopper_base*(1+global.shopper_modifier/100));
mercenary_base = floor(number_a_day*0.1);
mercenary_extra = floor(mercenary_base*(1+global.mercenary_modifier/100));

repeat(trader_base+trader_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 0;
        event_user(0);
    }
}

repeat(tourist_base+tourist_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 1;
        event_user(0);
    }
}

repeat(passerby_base+passerby_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 2;
        event_user(0);
    }
}

repeat(shopper_base+shopper_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 3;
        event_user(0);
    }
}

repeat(mercenary_base+mercenary_extra){
    with instance_create_layer(0,0,"instances",oPerson){
        guy_type = 4;
        event_user(0);
    }
}

Each oPerson instance decides on how many days he stays, where he would go to and how much money he spends each day, with much more to come in the future. However, the problem I am currently facing is that the game would just crash after about one game day. I think the problem is there are just too many instances and the game just cannot handle it. I tried to create only one oPerson of each type per day and it worked fine. I consider it essential to make each person an instance itself, considering they have to make pretty complex decisions, but I don't know how to make it work.

The game crashes specifically when I click on a button to change room. All of the objects are persistent.

sentences:
running GL ES 2.0 code under Linux ( no Android no iOS ) I need to code OpenGL ES 2.0 bits and i would like to do this and run the programs on my desktop for practical reasons.

Now, i already have tried the official GLES SDK from ATI for my videocard but it not even runs the examples that comes with the SDK itself, i'm not looking for performance here, even a software based rendering pipeline could be enough, i just need full support for GLES 2.0 and GLSL to code and run GL stuff.

There is a reliable solution for this under Ubuntu Linux ?

sentences:
How to continuously create objects in front of the camera when moving forward? I have created a scene in Unity3D that's filled with spheres. I want to be able to move forward forever and still be passing through the spheres.

I was thinking I'd keep the player in one spot and move the spheres. Maybe destroy the previous bunch of spheres and create a new bunch in random coordinates? I really don't have idea how to start.

sentences:
Approach to implement space junk Ogre3D

I would like to put some space junk in my game environment. Make it look like the first 2 search results. Those junks don't need to be interactive. Just need to have a 3D junk circling around the earth.

Can the community give some suggestion on how to implement this? Should I use particle in Ogre3D or create entities for those junks, or any other approach? If using particle, how should I make the object still and spread out around the earth? Thanks.

sentences:
C++ inheriting functions problem So I am creating a game with C++ and SDL.
I have a "gameobject" header file and no cpp (I do not need it) the game object has 2 functions void render() & tick().

The player class inherits from the gameobject. the problem is I don't know how to inherit functions. I tried virtual but I still can't figure it out.
I am used to Java so C++ is quite complicated.

My code:

gameobject.h :

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "game.h"

class gameobject
{
    public:
        virtual ~gameobject();

        void virtual tick() = 0;
        void render();

    protected:

        int width = pos.w;
        int height = pos.h;
        int posx = pos.x;
        int posy = pos.y;

        float velox;
        float veloy;

        SDL_Rect crop;
        SDL_Rect pos;
};

#endif // GAMEOBJECT_H

player.h:

#ifndef PLAYER_H
#define PLAYER_H

#include "gameobject.h"

class gameobject;

class player : public gameobject
{
    public:

    private:

        player(SDL_Renderer* renderer,int pwidth,int pheight);
        ~player();
};
#endif // PLAYER_H

player.cpp :

#include "player.h"

player::player(SDL_Renderer* renderer,int pwidth, int pheight)
{
    this->pos.w = pwidth;
    this->pos.h = pheight;
};

void player::tick(){} /// the problem here

sentences:
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:
Borderless windowed (fake fullscreen) mode doesn't cover the entire screen I'm using Direct3D 11 running on Windows 10 20H2, but have seen this problem going back to Windows 7.
I'm adding borderless windowed (fake fullscreen) mode support, and all of the online resources I can find suggest that it's simple: just setup a windowed mode the same size as your display resolution, use WS_POPUP, and that's all you need to do.
The problem is that it doesn't actually work.
Instead, I get (on a 1920x1080 display) a 1920x1060 window, with the bottom 20-pixel high portion of the taskbar still visible.  The odd thing is, the swapchain backbuffer is sized correctly, at 1920x1080, and adding some debug output shows that my WM_SIZE message is coming through at 1920x1080; it's as if something else internal was preventing the window from covering the full screen.
Fullscreen exclusive modes work correctly.
The workflow I'm using to set this mode goes like:

Determine if the window will be the same size as the display.

If so, set WS_POPUP (not sure what to use as the ExStyle so I'm leaving it at 0 for now, but I've also tested WS_EX_TOPMOST with no success).
If not, set the usual array of styes.

Call SetWindowPos with SWP_FRAMECHANGED.
Pump my message loop to make sure that everything is brought up to date.
Call IDXGISwapChain::ResizeTarget to do the actual window resizing.
Respond to WM_SIZE to call IDXGISwapChain::ResizeBuffers, create my views, etc.

Of note is that I don't change the window size using SetWindowPos; I let IDXGISwapChain::ResizeTarget do that for me, and that works for every other combination of windowed-to-windowed, windowed-to-fullscreen, fullscreen-to-windowed and fullscreen-to-fullscreen transition (where "fullscreen" here is fullscreen exclusive).
The only thing that does not work is borderless windowed.
What sorcery am I missing?

sentences:
How do I access objects that are in the next scene I'm loading? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class HouseExit : MonoBehaviour
{
    public Transform player;

    public void Houseexit()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.CompareTag("Player"))
        {
            Houseexit();
            GameObject.Find("Wizard").transform.position = GameObject.Find("SpawnPos").transform.position;
        }
    }
}

This code belongs to the scene "Goblin House 1" and I'm trying to find the wizard and the spawn position both from level 1.

sentences:
Memory allocation patterns used in game development I have been researching creating my own allocator methods (that will support things such as a memory pool and profiling), however, as I continue my research I have been looking for how this was done in game development.

What memory allocation technique could I use, and why is it a good technique?

sentences:
How do I make my character change his ability's when his sprite changes I am making a platformer and am currently trying to have it so that my character will have different powers based on his emotions, and his sprite will change to match those emotions.

I have got it so that his sprite will change but I don't know how to get his powers to change as well. Note that I haven't even made his other powers yet, but even if I did I don't know how to change his ability's with his sprites as I am still very new to this whole coding thing. Can anyone please help me?

Here is my code for changing his sprites, if that would help.

using UnityEngine;
using System.Collections;

public class MoodManager : MonoBehaviour {

  public Sprite sprite1;// happy//
  public Sprite sprite2;// angry//
  public Sprite sprite3;//sad//
  public Sprite sprite4;//default//

  private SpriteRenderer spriteRenderer;

  void Start ()
  {
    spriteRenderer = GetComponent<SpriteRenderer>(); // we are accessing the SpriteRenderer that is attached to the Gameobject
    if (spriteRenderer.sprite == null) // if the sprite on spriteRenderer is null then
      spriteRenderer.sprite = sprite1; // set the sprite to sprite1
  }

  void Update ()
  {
    if (Input.GetKeyDown (KeyCode.Alpha1)) // If the space bar is pushed down
      ChangeMoodHappy (); // call method to change sprite

    if (Input.GetKeyDown (KeyCode.Alpha2)){
      ChangeMoodAngry ();

    if (Input.GetKeyDown (KeyCode.Alpha3)){
      ChangeMoodSad ();
  }

  void ChangeMoodHappy (){
    if (spriteRenderer.sprite == sprite1) // if the spriteRenderer sprite = sprite1 then change to sprite2
      spriteRenderer.sprite = sprite4;
    else
      spriteRenderer.sprite = sprite1; // otherwise change it back to sprite1
  }

  void ChangeMoodAngry (){
    if (spriteRenderer.sprite == sprite2) // if the spriteRenderer sprite = sprite1 then change to sprite2
      spriteRenderer.sprite = sprite4;
    else
      spriteRenderer.sprite = sprite2; // otherwise change it back to sprite1
  }

  void ChangeMoodSad (){
    if (spriteRenderer.sprite == sprite3) // if the spriteRenderer sprite = sprite1 then change to sprite2
      spriteRenderer.sprite = sprite4;
    else
      spriteRenderer.sprite = sprite3; // otherwise change it back to sprite1
    }
  }

}

sentences:
How can I draw an outline in Unity3d? I am trying to highlight a rectangle of arbitrary height. I thought the easiest way to do this would be to create a separate "box" gameobject that outlines the rectangle.

I've tried with both a MeshRenderer + Transparent Texture, and a LineRenderer to outline the four points of the rectangle. Neither are very satisfactory.

(Line renderer on in the middle, scaled cube on the right)

What's the right way to go about this? I am trying to get something like the left rectangle - a simple perimeter of fixed width through four points of my choosing.

sentences:
How can I repeat only a portion of an image in Javascript? So I'm trying to repeat a portion of my spritesheet as a background. So far, I have attempted this:

var canvas = $("#board")[0],
    ctx = canvas.getContext("2d"),
    sprite = new Image();
    sprite.src = "spritesheet.png";
sprite.onload = function(){
    ctx.fillStyle = ctx.createPattern(spriteBg, "repeat");
    ctx.fillRect(0, 25, 500, 500);
}

As you can see, it repeat the whole image, not just a part of it, and I just can't figure out how to do that last part.

sentences:
Should the modelview and projection matrices be calculated in the shader or on the CPU? At minimum I would have a camera with rotation and world position; projections parameters such as angle of view and perspective vs. orthographic; and meshes with scale, angle, and world position.

When rendering a mesh I am wondering if I should calculate the final transformation matrix on the CPU and pass it to my shader, or if I should calculate the transformation matrix inside my shader.

sentences:
How big a transition from programmer to modeler/level designer/creator So I think I may take a break from the programming side, I have put in 6 hard months learning C++ and graphics theory, I have learned a huge amount but over the last few days have been studying level design and modeling and think that is maybe more suitable to me.

So how would programming compare in a learning curve sense, C++ takes a while to grasp the core language never mind writing 100,000s lines of game engine code which you would eventually have to do.

Without being arrogant the modeling/level creation side seems a much faster progression, is that a fair thing to say?

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:
Shake a tree on chop I have a top down RTS type of game where the player (God mode style) can click a tree to chop it. I'd like to shake the tree where the base of the tree (where the position marker is) moves the least and the top the most to simulate like it's being hit by an axe so it shows visual feedback. Any ideas on how to accomplish this? Not really sure where to start.

This would be in 3D.

sentences:
Automatically zoom out the camera to show all players I am building a game in XNA that takes place in a rectangular arena. The game is multiplayer and each player may go where they like within the arena. The camera is a perspective camera that looks directly downwards.

The camera should be automatically repositioned based on the game state. Currently, the xy position is a weighted sum of the xy positions of important entities.

I would like the camera's z position to be calculated from the xy coordinates so that it zooms out to the point where all important entities are visible.

My current approach is to:

hw = the greatest x distance from the camera to an important entity
hh = the greatest y distance from the camera to an important entity
Calculate z = max(hw / tan(FoVx), hh / tan(FoVy))

My code seems to almost work as it should, but the resulting z values are always too low by a factor of about 4.

Any ideas?

sentences:
Should I do interactions between a new class and the main engine via a redirector class, or directly refer to only the classes the new class needs? I'm making an open-source voxel engine, and there's an architectural problem that I would like an answer to. I have come up with 2 different solutions, and would like your opinions on:
When I'm creating a new class for a feature that uses the voxel engine, should the new class only refer to a big re-director class called VoxelWorld that redirects the calls to whatever component is responsible for it (solution 1), OR should the new class directly refer to only the classes it actually needs. Simply put, should the new class refer to the entire voxel engine, or just the parts it needs to?
This may be similar to a monolithic vs microservice problem?
Solution 1: All interactions go through a single entry point (I shall call it the VoxelWorld class). It's a single class, which would redirect all calls to whichever component is responsible for it. Examples of those calls would be for example VoxelWorld.GetVoxelData(position) or VoxelWorld.UnloadChunk(position). These calls would be coming from wherever, maybe a custom class made by the user such as a TerrainDeformer.
The TerrainDeformer would only have a reference to VoxelWorld, and nothing else (except for all the parameters it needs to deform the terrain, such as the deformation range). The TerrainDeformer would simply call VoxelWorld.EditTerrain(listOfModifications), and that's it. The VoxelWorld would be responsible for redirecting the EditTerrain call to whichever class is responsible for editing the terrain, for example, a VoxelWorldEditor.
The VoxelWorld.UnloadChunk call would be redirected to ChunkManager, which is responsible for managing chunks. Here's a picture to better explain it:

The public VoxelWorld would be the only public class in assembly A. Everything else is internal, meaning they are only visible for other classes inside assembly A. The assembly A is also like a black box, it is mostly (except for the VoxelWorld) hidden from the outside project. It just works, that's not a good ideology, but sometimes a necessary one. Everything in assembly B is easily extensible and public to the user. It contains the code the user would be messing with.
VoxelWorld would essentially by only a redirector of calls. It would have absolutely no logic, only redirections. A function in VoxelWorld.cs could look like this:
public void LoadChunk(int x, int y, int z){
    ChunkManager.LoadChunk(x, y, z);
}

Solution 2: Everything that the user wants to add refers to only the classes it really needs. Now, forget all that public/internal/redirecting stuff from solution 1, but keep in mind the different classes. This is kind of like the interface segregation principle, but just without the interface part.

The interface-segregation principle (ISP) states that no client [e.g.
TerrainDeformer] should be forced to depend on methods it does not use
[e.g. LoadChunk]

In solution 1, everything depends on everything. That's the blessing and the curse of solution 1. In solution 2, that's not a problem because a class only depends on what it actually needs.

Solution 2 is more traditional and maybe cleaner -> easier to maintain. I feel like I like solution 2 more than solution 1, but both seem good. Here's the main benefits and disadvantages:
Solution 1:
+Easy to use API (VoxelWorld.DoWhatever())
-It contains a black box, so it's harder for the user to extend the very core features. (Of course, it wouldn't be an actual black box, this is open source, it's just something that the user shouldn't mess with)
Solution 2:
+Easier to maintain and extend
-More difficult API, everything is scattered so the user has to explicitly know if some feature already exists (in solution 2, the user can just scroll through the suggested functions for VoxelWorld.___())
So, which solution do you recommend, and why? Or is there some third solution that I haven't thought about?
This was quite a long question, but I hope it can help others who might have the same problem. I tried googling but didn't find anything related to this kind of problem, but I didn't really even know what to search for.

sentences:
Revamping my GUI to be more efficient and less brute I am building a Java game from scratch right now. So far, it runs fine, but the issue is with my GUI and how it works. Basically, it's a tile-based game. Each time the person moves a different image is displayed (basically I check to see what terrain they are on, and in what direction they moved then update that tile's Imageicon). I feel like it is a lot of brute force graphic work and I was wondering if anyone here could help me find a simpler method or class to preform the action. I use ImageIcons to basically make the game's GUI function right now. I was thinking about finding a way to have "layers", so I could have the terrain in the background and my person could just walk over it. Unless someone has a better idea.

Another long-term goal is to make the walk movement an animation. Right now, the person just pops over 1 tile, I want to implement some basic walking animation for that movement of tile to tile. I feel like that would be easier to do if I had a way make the person be a separate object compared to the terrain/map.

Any suggestions on how to do this would be very helpful! :)

IMAGE REQUEST:
Here is an older and later dated image of one region. Basically, I have a tile (ImageIcon) for each possible instance of where the hero is, and which way he is facing. But as stated, I want to get rid of that because it requires soooo much. There has to be an easier way to overlap the person and allow animation to each tile.

sentences:
GLSL to Cg: why is the effect different? With reference to this question, where I was trying to make the shader compile, I am now trying to make an effect appear.
The effect can be shown here, through a GLSL shader:

But when I use the equivalent Cg shader, the result becomes this:

Using the same images (color map + normal map) and the same code (except the way to retrieve variables).

Here is the original GLSL shader;

uniform sampler2D color_texture;
uniform sampler2D normal_texture;

void main() {
    // Extract the normal from the normal map
vec3 normal = normalize(texture2D(normal_texture, gl_TexCoord[0].st).rgb * 2.0 - 1.0);

// Determine where the light is positioned (this can be set however you like)
vec3 light_pos = normalize(vec3(1.0, 1.0, 1.5));

// Calculate the lighting diffuse value
float diffuse = max(dot(normal, light_pos), 0.0);

vec3 color = diffuse * texture2D(color_texture, gl_TexCoord[0].st).rgb;

// Set the output color of our current pixel
gl_FragColor = vec4(color, 1.0);
}

And here is the Cg shader I wrote;

struct fsOutput {
    float4 color : COLOR;
};

uniform sampler2D color_texture : TEXUNIT0;
uniform sampler2D normal_texture : TEXUNIT1;

fsOutput FS_Main(float2 colorCoords : TEXCOORD0,
            float2 normalCoords: TEXCOORD1)
{

    fsOutput fragm;

    float4 anorm = tex2D(normal_texture, normalCoords);
    float3 normal = normalize(anorm.rgb * 2.0f - 1.0f);
    float3 light_pos = normalize(float3(1.0f, 1.0f, 1.5f));
    float diffuse = max(dot(normal, light_pos), 0.0);
    float3 color = diffuse * tex2D(color_texture, colorCoords).rgb;
    fragm.color = float4(color,1.0f);
    return fragm;
}

Please let me know if something needs to be changed in order to obtain the effect, or if you need the C++ code.

sentences:
Background with small, randomly moved elements in LibGDX I'm looking to implement a 'dynamic' background (meaning, with objects moving randomly) in my libgdx game, something similar to what you can see in this video (from the Google Play game 'Finger Dodge'):

https://www.youtube.com/watch?v=Zf8mpqf0jGc

In the above example, the background has a bunch of moving squares and triangles (and some blinks) that move randomly, independently from each other. So, what exactly should be the best approach to get something like that? I'm guessing that those background elements aren't just a bunch of single, independent textures that all get rendered at the same time with a random direction, because that would seem a bit TOO much stuff to render... Or am i wrong and that's what it might be?

So, is there any way to consistently and efficiently achieve this effect in libgdx (or if not, any other way)?

Thanks in advance!

sentences: How to simulate wind in 2D For a 2D scenario, I want to have a fan blow at an object and make the object move with the "wind". How can I simulate the wind force blown by the fan?

sentences:
How do I visualize parallax layers in a level editor? I'm making a 2D game in Unity, but this would apply to any 2D game engine.

If I implement multiplane parallax with orthographic cameras, it is difficult to lay out the background layer's sprites and know where they will line up with sprites in other layers.

My first instinct was to use multiple cameras, one for each layer, and scale down the movement speed of cameras for background layers. This avoids having to move all background sprites every frame.  The problem is that a layer that moves at half speed will take up half the space of the main layer when viewed in the editor. So it is difficult to know where to place sprites as you're laying out the game. The problem gets exponentially worse as you increase the number of layers.

How do I get around this? I've tried inversely scaling the layers by their intended movement speeds while working with them in the editor. That puts all background sprites in the correct locations relative to the main layer, but they're horribly distorted.

Do I need to just suck it up and constantly switch between the editor and the running game to test the parallax backgrounds?

sentences:
2d camera shaking back and forth I'm trying to create a smooth moving 2d camera but the camera is shaking back and forth 1 pixel.

Player camera rectangle:

public Rectangle recCamPosition(Global global)
{
  return new Rectangle((int)Position.X, (int)Position.Y , 320, 240);
}

Camera rectangle:

public Rectangle recCamera(Global global)
{
  return new Rectangle((int)_pos.X / global.zoom, (int)_pos.Y / global.zoom, 320, 240);
}

The move method:

public void physic(Vector2 position, Player player, GameTime time, Global global)
{
  if(player.recCamPosition(global).X!=recCamera(global).X)
  {
    _pos.X+=(player.Position.X-160-recCamera(global).X)/16;
  }
}

sentences:
Rotating a sprite to touch I know this has been asked before and Ive looked through peoples questions and answers all over the internet and I just cant get it to work.
Im sure its down to my inexperience. Ive got an arrow attached to a sprite, this sprite appears when touched but I want the arrow to point where the sprite will launch.
I have had the arrow moving but it was very erratic and not pointing as it should. Its not moving at the moment but this is what I have.

- (void)update:(ccTime)delta
{
    arrow.rotation = dialRotation;
}

-(void) ccTouchMoved:(UITouch*)touch withEvent:(UIEvent *)event
{
    pt1 = [self convertTouchToNodeSpace:touch];

    CGPoint firstVector = ccpSub(pt, arrow.position);
    CGFloat firstRotateAngle = -ccpToAngle(firstVector);
    CGFloat previousTouch = CC_RADIANS_TO_DEGREES(firstRotateAngle);

    CGPoint vector = ccpSub(pt1, arrow.position);
    CGFloat rotateAngle = -ccpToAngle(vector);
    CGFloat currentTouch = CC_RADIANS_TO_DEGREES(rotateAngle);

    dialRotation += currentTouch - previousTouch;
    }

I have got pt from ccTouchBegan the same way as pt1

Thanks

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:
Direct3D11 Depth buffer problem Encountered a strange error when using Direct3D11, feature level 10.0.

If the depth buffer texture is created with the format DXGI_FORMAT_R24G8_TYPELESS, bind flag D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE and the depth stencil view format DXGI_FORMAT_D24_UNORM_S8_UINT, everything is correct.
Also, there are no problems when the depth buffer texture format is DXGI_FORMAT_R32G8X24_TYPELESS and the depth stencil view format is DXGI_FORMAT_D32_FLOAT_S8X24_UINT.

However, when the depth buffer format is DXGI_FORMAT_R32_TYPELESS,
and the depth stencil view format is DXGI_FORMAT_D32_FLOAT, the whole geometry is not rendered at all, only the clear color is visible. I used Visual Studio 2015's Graphics Debugger to check if the geometry is rendered as desired, but during the Output Merger stage the whole geometry is discarded because it failed the depth test. Every Direct3D function call returns no error and the Direct3D debugging output reports no error (only INFO messages about creation/destruction of resources). I do not use the stencil functionality at all, and it is disabled.

I use a Windows 7 virtual machine as a developer machine and using DXGI_FORMAT_R32_TYPELESS and DXGI_FORMAT_D32_FLOAT worked flawlessly before I switched from a Windows 7 host to an Arch Linux host, because the old hard-drive started to fail and the operating system was unable to read its own files during boot. After I switched the host operating system, this problem started to occur inside the virtual machine.

Is it possible to have a bug somewhere else in my code?

Is there a limitation when using DXGI_FORMAT_D32_FLOAT and sometimes it may not be possible to use DXGI_FORMAT_D32_FLOAT or the other depth formats on every machine (considering D3D11 feature level 10.0 is available)?

Or is this a bug somewhere else, possibly in VMware player or Linux or Bumblebee (Optimus - Intel HD 4000 + GeForce GTX 650M)?

sentences:
How to stop jumping again when character is in air (double jump)? I'm using touch inputs in my game to control the character. I would like to know how to disable my character from jumping again in the air.

if (FingerTouchy.phase == TouchPhase.Ended)
                {
       charcter.transform.Translate(Vector2.up * speed * Time.deltaTime);
       float jumpForce = 250;
                        charcter.GetComponent<Rigidbody2D>().AddForce(new Vector2(0, jumpForce));

                    }

Update

Im using Collision Detection

void OnCollisionEnter (Collision col)
    {
        if(col.gameObject.tag == "Ground")
        {
            grounded = true;

        }
    }

And checking if charcter is grounded

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

                    float jumpForce=250;
                    if (grounded)
                        continue;
                    charcter.transform.Translate(Vector2.up * speed * Time.deltaTime);
                    charcter.GetComponent<Rigidbody2D>().AddForce(new Vector2(0,jumpForce));
                        grounded=false;

                }

using collision/collision2d doesn't work too.

sentences:
change the position of f3d objects randomly in action script I have a f3d object and have different boxes to place the parts of the f3d objects.When i click on the button change the position of the boxes randomly. How it possible?This is the code for random array.

private function init(e:Event = null):void
    {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        // entry point

        var startArray:Array = generateNumberArray(10);
        var randomArray:Array = randomArray(startArray);
        trace("startArray = " + startArray);
        trace("randomArray = " + randomArray);

    }
    /**
     * generate Array of numbers by length
     * @param   length
     * @return Array of numbers
     */
    public  function generateNumberArray(length:int):Array
    {
        var numberArray:Array = [];
        for (var i:int = 0; i < length; i++)
        {
            numberArray[i] = i+1;
            //trace("ersexrfegtdrgtdrygtfr"+numberArray[i]);
        }

        return numberArray;
    }

    /**
     * generate randomly mixed array by input array
     * @param   inputArray - simple not mixed array
     * @return Array - mixed array
     */
    public function randomArray(inputArray:Array):Array
    {
        var randomArray:Array = [];
        var tempArray:Array = [];
        for (var i:int = 0; i < inputArray.length; i++)
        {
            tempArray.push(inputArray[i]);
        }
        while (tempArray.length)
        {
            var randomNumber:int = Math.round(Math.random() * (tempArray.length - 1));// get random number of left array
            randomArray.push( tempArray[randomNumber] );
            tempArray.splice(randomNumber, 1);
            trace("randommmmmmmmmmmmmmmmmmmmmmmm"+randomArray);

                 // remove randomed element from temporary aarray
        }
        tempArray = null;
        delete [tempArray];
        return randomArray;

    }
    public function loadCompleteEvent(e:Event):void
    {
      if (stage) init();
        else
            addEventListener(Event.ADDED_TO_STAGE, init);

         // my boxes (want to change the position randomly of these boxes)
        Box2.setPosition(57.49752426147461, -2.987499237060547, 10);
        Box3.setPosition(57.49752426147461, -26.987499237060547, 10);
        Box4.setPosition(-48.50247573852539, -2.987499237060547, 10);

}

sentences:
Issues loading in AudioSource at runtime using WWW class I am having an issue with loading in an OGG audio file to my project. Basically I want to set my game up so that players can drop audio files into a folder called Playlist in the game directory then they can listen to this music while they play.

For some reason my audio clip never becomes instantiated. I have an Audio Source in my scene with this script attached to it.

As you can see I have commented out some code for the time being as I am trying to get a simple case of only 1 audio file playing at this stage.

So my question is what exactly am I doing wrong here? I have printed out the file path and it comes out as file://B:/Users/Matt/Development/Unity Projects/Space Game/Playlist/19_Tumbling_Dice.ogg which is the location to my audio.

However when I print out the audioLoader.audioClip.name it comes out as blank...

[RequireComponent(typeof(AudioSource))]
public class MP3AudioImporter : MonoBehaviour {

    private List<string> playlist;
    private string musicDir = "B:/Users/Matt/Development/Unity Projects/Space Game/Playlist/";
    private int currIndex = 0;

    void Start()
    {
        string[] songs = Directory.GetFiles(@musicDir, "*.ogg", SearchOption.TopDirectoryOnly);
        playlist = new List<string>(songs);

        StartAudio();
    }

    void StartAudio()
    {
        WWW audioLoader = new WWW("file://" + playlist[currIndex]);

        Debug.Log(audioLoader.audioClip.name);

        audio.clip = audioLoader.audioClip;
        audio.Play();

        /*
        currIndex++;

        if (currIndex > playlist.Count)

            currIndex = 0;
        }

        Invoke("StartAudio", audio.clip.length + 0.5f);
        */
    }
}

sentences:
How to prevent the player from clicking too fast I'm having trouble with some bullets in my game, the M1911, which is supposed to be semi-auto is only capable of shooting one projectile per mouse click (trying to learn how to do multiple ones at once). The problem is, if the player clicks the mouse ridiculously fast it causes the bullet to reset its position back to the player (not intended).

Basically I want to limit the clicks, or implement a cooldown after the left mouse buttons pressed which prevents the player from clicking at all during a certain timeframe (or until the bullet hits something).

I want it so that when LMB is pressed it starts a timer.

sentences:
2D Collision response - rotating, moving polygon hitting a wall I'm trying to bounce a polygon that has both velocity and angular velocity off a (immovable) wall when one of the vertices collides with it. I can detect the collision, and I've worked out how to calculate the inputs and know what outputs I need, but haven't been able to find or work out an implementation for the response. Any help would be greatly appreciated.

function collisionResponse(
    c, // object center of mass position
    v, // velocity of object
    a, // the angular velocity of the object
    p, // point of contact with line
    n  // normalized normal of line
) {
    //  Make a vector from center mass to contact point
    cp = p - c;

    //  Total velocity at contact point (add angular effect)
    pv.x = v.x - cp.y * a;
    pv.y = v.y + cp.x * a;

    //  Reflect point of contact velocity off the line (wall)
    rv = reflect( pv, n );

    // magic happens..

    result.v = ?? // resulting object velocity
    result.a = ?? // resulting object angular velocity
    return result;
}

sentences:
The mosts common topics that developer technical tests ask Possible Duplicate:
  What are typical job interview questions related to game development?

I have a technical test on the horizon, and I'm brushing up on my 3D maths and algorithmic stuff - there are websites that have lists and lists of technical questions such as 'How would you check to see if a string was a palindrome?' and also perhaps, 'How would you check to see if there was a palindrome anywhere in this string?'

Also things like calculating complex recursion on paper and Big O notation. What are the other key things to practise for these kinds of test?

sentences:
Skeleton bone in incorrect spot in-game yet, blender rig, skeleton mesh and physics asset are all correct and behave properly I've made a custom character and rigged it in blender. Then exported/imported into ue4. It behaves properly in the PHAT and the skeleton mesh looks fine and it all behaves properly in the simulations.
In the BP and in-game the physics all behave fine except 1 single bone rises above the rest and appears to "flip" the root bone for unknown reasons. Almost like all the sudden the root does a 180 and then one specific bone attached rises as a result, not sure if it rises and that flips the root or the root is flipping for some unknown reason.
What I don't understand is why everything is fine until it is in-game/bp. Maybe I'm misunderstanding how physics work with skeleton mesh?

I've been banging my head on the wall trying to figure out phat, skeletons and how physics work in ue4 for about a month now and there is basically 0 docs/tutorials on this. As much as I love being stuck on this problem forever if anyone has an idea on what is going wrong that'd be great.

sentences:
flash - hitTestObject() mafunction? Is there a way that even though two objects that have different y co-ordinate collide?

In my game, I wanted to make my object rotate as explained in previousquestion. When I added the code, the object now dissapears from the scene even though it's x and y co-ordinate are in the scene. I traced(in the function that kills the characer if it touches it. i.e hitt) the x and y value of the object and found that it is still there on the scene.
The code is:

ground.addEventListener(Event.ENTER_FRAME, hitt);

function hitt(event: Event) {
    if (green.hitTestObject(ground) || blue.hitTestObject(ground) || brown.hitTestObject(ground) || black.hitTestObject(ground)) {
        dead = true;
    }
    else if (kill.hitTestObject(black) || kill.hitTestObject(green) || kill.hitTestObject(blue) || kill.hitTestObject(brown)) {
        dead = true;
        trace("here",kill.y,green.y,green.x);
    }
}

The output is:

[SWF] hello.swf - 519178 bytes after decompression
here -608.95 -401 62.55

I don't know what's going on? Please Help..!!

sentences:
SDL2 linux fullscreen issue at lower-than-desktop resolution Having a problem trying to get proper fullscreen in linux.

I'm using 1440x900 on desktop. When i set SDL to use 1280x720 as fullscreen, it does change screen resolution. But if i drag the mouse cursor to the bottom or right edge of the game screen, it "scrolls" the screen beyond the game surface and makes part of the desktop visible.

Here's how I set the window/screen:

gameWindow = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, screenWidth, screenHeight,
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS ); }

Am i missing some flag(s) perhaps?
Is this a common problem? I'm on Linux Mint MATE (Rosa).
This problem also occurs when trying to run the same build in an Openbox session.
Using nVidia drivers (x64, v340.96) from nvidia.com, on 9600 GT card(s). No twin/dual screen or second Workspaces.

Any good tips on how to avoid or workaround this issue?

sentences:
What is the most efficient way to determine collision path I am trying to create a game in which I need to know if two objects will collide in the future, and when. I have both object's position, radius (they are circles) and velocity.

A specific example of where this could be used is in a game with an asteroid field. The asteroids position, radius and a constant linear velocity. I want to determine if on their current trajectory, will they crash. If yes, in how much time.

I have tried to set up the position of the objects as a function of time:
P(t) = o + v(t)

Where P(t) is the new position, o is the original position v is the velocity and t is time.

Using this for both objects and attempting to solve for t, I get a very messy and long equation.

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:
How to make a gui button follow a path after a touch? I would like a button in my gui menu to follow a specific path if we selected it, I am wondering how I could do it: if we touch the button, then it can only move on the specific path, it is an arc such as this path :

Would you know how to achieve this?
I am using Unity, but I think the theory should be the same for other software/language ?

Thanks for your help

__

EDIT:

here is the code for the bezier curve in unity : Where should I put the script?

using UnityEngine;
using System.Collections;

public class DrawBezierHandle extends Editor {

    public Transform startT;
    public Transform endT;

    function Start(){
        startT = GameObject.Find("start").GetComponent("Transform") as Transform;
        endT = GameObject.Find("end").GetComponent("Transform") as Transform;
    }

    function OnSceneGUI() {

        var width : float = HandleUtility.GetHandleSize(Vector3.zero) * 0.1;
        Handles.DrawBezier(startT.position,
                        endT.position,
                        startT.position * 5 * Vector.up,
                        endT.position * 5 * Vector.up,
                        Color.red,
                        null,
                        width);
    }
}

sentences:
Basic billiards game: Can't detect collision between cuestick and cueball I have a basic Unity project on GitHub.

Basically, I have a Cuestick that aims and shoots using the mouse. You can rotate around the cueball with your mouse and when you're ready to shoot, you can hold down the right mouse button and move the mouse forward. The game came follows the cuetip.

However, the collision between the cuestick and cueball is wonky. The cuestick protrudes through the ball and only pushes the ball forward only a little bit.

I've created rigid bodies and colliders for both cuestick and cueball. I've set the cuestick's rigid body to kinematic (if it's unchecked, the poolstick will barely dent the ball). I've tried using OnCollisionEnter and a Debug.Log statement to no avail.

Any help would greatly be appreciated. You can find my scripts in /GameLogic (they're F# sharp scripts whose binaries get compiled and outputted into the /assets folder).

sentences:
Screen not rendering after restarting game Game works fine on the initial launch on Android, but after that restarting game does not render the graphics on the screen properly.

It is a copy of the question
Sprites not being rendered on screen change - Android Libgdx

but there is no solution yet for the question

sentences:
opengl shadow map peter panning effect I am implementing the shadow map in opengl with opentk everything works fine except I have a peter panning effect that I can't solve it by changing the face culling to front then render to the depth buffer.

the model is large so I scale it to  small value to render it to the shadow map.

what is the reason that may cause this problem?

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:
Java creating random pipes from an image Im trying to make a simple clone of flappy bird game. The tutorial that i watched used only rectangles for all the objects. But the thing is im trying to do it with nicer images. I have handled the bird and its movements but i can not generate pipes from images and terminate them after they get out of the screen.

The way i want to do is just like the tutorial. He made an arraylist of rectangles, and simply adding rectangles to that list with the position and dimension variables. When they go out of the screen, he deletes the pipes and add the new ones with "arraylist.add(new Rectangle())", and simply draws them with Graphics.fillRect(). But i cant do it with BufferedImage type or neither the Graphics2D.

Could anyone help please? I want to be able to generate random pipes like rectangles, and wanna be able to add them to an arraylist and draw them. Its pretty like creating blocks from an image in mario game

Any help would be appreciated!

sentences:
Unity: Moving player using Rigidbody with UI Buttons? i have been using transform.positionsince the start but now i want to switch to rigidbody instead since i am facing some collision problems. i can use the keyboard to move the player using this code:

input = new Vector3 (Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));

        if (GetComponent<Rigidbody> ().velocity.magnitude < maxmovespeed) {
            GetComponent<Rigidbody> ().AddForce (input * movespeed);
        }

but since i am building for mobile and have added UI buttons for right/left on screen, i wish to use those for moving my player. how can i use those buttons to move in that specific direction like left for left only and right for right?

sentences:
AssetBundles for sprites, or download the images from my server? I need to host several sprites in my server, and then have Unity download and use them. I have tested two methods:

AssetBundles

If I pack my sprites into an AssetBundle, the bundle is about 4MB. It works fine.

Download the images

If I download the image bytes from my server, you can use those bytes to create a Sprite. Curiously, this is much, much smaller than an AssetBundle (just like 1.5MB).

Both methods work. It seems pretty obvious that the second one offers an advantage due to reduced memory size. My questions are:

Why is the second method so much smaller?
Is there any reason I'd rather use AssetBundles?

sentences: How do I place a progress bar in AndEngine? I am developing game using AndEngine. I need to place a progress bar in my game to denote time remaining in the game. Is there a built-in method for doing this in AndEngine? My searches only turned up results for Android, not for AndEngine.

sentences: Was there any equivalent of glVertex3f in Direct3D? I know that OpenGL's Vertex3f is a bit old but I can't find any information about suitable equivalent for that function that was used in DirectX. Was there any equivalent in DX?

sentences:
Unity Mobile project, button problem "CrossPlatformInputManager.GetButton" not working Good afternoon, I have a problem with an input in my code:
Before testing it on mobile I tried on PC and the code to make my player sprint was like this:

        var sprintPressed = Input.GetKey(KeyCode.LeftShift);
        var targetSpeed = maxSpeed;
        if (attacking) {
            targetSpeed *= attackMoveSpeedMultiplier;
        }
        else if (sprintPressed) {

            targetSpeed *= sprintMultiplier;
        }

And everything was working fine. My player increases the movement speed as soon as I press "Left Shift" button.
Then I changed the code to make it work with a mobile button:

        var sprintPressed = CrossPlatformInputManager.GetButton("Sprint");
        var targetSpeed = maxSpeed;
        if (attacking) {
            targetSpeed *= attackMoveSpeedMultiplier;
        }
        else if (sprintPressed) {
            Debug.Log(sprintPressed ? sprintMultiplier : 1);//just to see if it take a button
            targetSpeed *= sprintMultiplier;
        }

I also make a change for a controller so instead, to press WASD I use a screen joystick. That's work fine.  But when I press a button to make a sprint, nothing happens. I insert a debug log line and when I press a button it just return 1 single value (sprintMultiplier) and not 1 per frame as it should be because this function is in the Fixed Update.
I check in Google and I found this tutorial https://www.youtube.com/watch?v=nGYObojmkO4&t=851s&list=PLXVRS21ln3JIbFLPwf9bdH3thHmmYRJGi&index=16
Pretty much what I did but in his video, it's working. In my project doesn't.
Can someone help me, please?
Many thanks beforehand

sentences:
Collision detection doesn't work for automated elements in XNA 4.0 I have a really weird problem. I made a 3D simulator of an "assembly line" as a part of a college project. Among other things it needs to be able to detect when a box object passes in front of sensor. I tried to solve this by making a model of a laser and checking if the box collides with it. I had some problems with BoundingSpheres of models meshes so I simply create a BoundingSphere and place it in the same place as the model. I organized them into a list of BoundingSpheres called "spheres" and for each model I create one BoundingSphere. All models except the box are static, so the box object has its own BoundingSphere (not a member of the "spheres" list). I also implemented a picking algorithm that I use to start the movement. This is the code that checks for collision:

if (spheres.Count != 0)
        {

            for (int i = 1; i < spheres.Count; i++)
            {
                if (spheres[i].Intersects(PickingRay) != null && Microsoft.Xna.Framework.Input.ButtonState.Pressed == Mouse.GetState().LeftButton)
                {
                    start = true;
                    break;
                }
                if (BoxSphere.Intersects(spheres[i]) && start)
                {
                    MoveBox(0, false);//The MoveBox function receives the direction (0) and a bool value that dictates whether the box should move or not (false means stop)
                    start = false;
                    break;
                }
                if (start /*&& Microsoft.Xna.Framework.Input.ButtonState.Pressed == Mouse.GetState().LeftButton*/ && !BoxSphere.Intersects(spheres[i]))
                {
                    MoveBox(0, true);
                    break;
                }

            }

The problem is this:
When I use the mouse to move the box (the commented part in the third if condition) the collision works fine (I have another part of code that I removed to simplify my question - it calculates the "address" of the box, and by that number I know that the collision is correct). But when I comment it (like in this example) the box just passes trough the lasers and does not detect the collision (the idea is that the box stops at each laser and the user passes it forth by clicking on the appropriate "switch"). Can you see the problem? Please help, and if you need more informations I will try to give them.
Thanks

sentences:
How should I handle different aspect ratios in a fullscreen game? I am creating a game using C#, GDI+ and Raster images (2D images).  For performance sake, I believe that I should have the game change the user's resolution to 800 x 600 and run the game in that setting.  However, the graphics look distorted in a wide screen since the aspect ratio for 800 x 600 is different than from a wide screen.  I cannot figure out how to determine the aspect ratio.

How is game programming normally handled on different resolutions?  Should I even change the user's resolution?  If I dont change the resolution, the game slows down a lot.

Also, some wide screens will "maintain the aspect ratio" when changing the resolution to 800 x 600 (thus creating black bars on the right and left) and some wide screens will fill up the entire screen.  How do people handle that situation??

sentences:
2D overlays in 3D environments For a 2D overlay in a 3D environment using DirectX, is the 2D overlay still coded as a surface in 3d always positioned in front of the camera?

I haven't tried this yet but I imagine that technique would lead to small jitters as a scene moves, plus lighting weirdness.  It would help me to know the correct way before I struggle in the wrong direction.

I'm very new to DirectX and game programming and I have limited experience with the paradigms of unmanaged APIs.  I'm using C# with SlimDX.  I have a re-organized version of the SlimDX Triangle tutorial working well.

What I read on this site and others regarding DirectX is that DirectX only draws/shades triangles and the rest is up to me.

SlimDX seems to have some stuff in the DirectX2D namespace - RenderTarget, which has a DrawText() method, but I can't figure out how to get such a 2D RenderTarget hooked to my scene to play with it.

Thanks!

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:
How is this rotation done? There is a video here that shows how the camera rotates around Leon.
The camera rotates around Leon in a circle, this is not difficult, but I don't understand the timing logic.

Once given a short push, the camera keeps rotating for a few more milliseconds.

If the camera would only be rotated during the real mouse movement, the camera would not keep rotating a bit after there is no more mouse movement.

However, in this video, the camera rotates a few more milliseconds even after the last mouse movement.

How could this be accomplished?

Specifically, I would like to ask if somebody can tell me if the developers add some extra movement in the direction of the mouse movement which they then "smooth out", or if they "smooth out" the end of the user's mouse movement.

Thank you!

sentences:
In XNA, how should I organize content shared between projects? I have an XNA library using several custom effects.  They need to be accessed by:

a content pipeline project (models are built with the effect), and
projects that use my game library (they should be able to load a standalone instance of the effect).

Where should I put the .fx files for the custom effects?  How do I access them from separate projects?

sentences: Is there a better way of determining direction to turn? You have an entity A that you want to turn towards another entity B.  One way to determine the direction to turn is to compute the cross-product of the direction vector of A with the vector from AB.  If the value of z is positive, then you turn right.  If the value of z is negative, you turn left.  Is this the only way of determining which way to turn?

sentences:
2D Animated Tile rendering The current game I've been working on needs to have animated tiles. I have a code for Tile and TileMap from my previous game that I recycled. However, it does not support tile animations.

The tile animations are independent from each other. Now, I have an Animation class for my sprites that looks like this (parts are ommited/abstracted):

function Animation(spriteatlas, frames, animationDelay){
    this.spriteAtlas = spriteatlas;
    this.frames = frames;                     // array of number of frames
    this.animationDelay = animationDelay;     // array of delays

    this.currentAnimationIndex = 0;

    this.currentFrame = 0;
    this.delayCounter = 0;
}

Animation.prototype.startAnimation = function(index){
    this.currentFrame = 0;
    this.delayCounter = this.animationDelay[index];
}

Animation.prototype.update = function(){
    this.delayCounter--;
    if(this.delayCounter === 0){
        this.currentFrame++;

        if(this.currentFrame == this.frames[i]){
            this.currentFrame = 0;
        }
    }
}

Animation.prototype.render = function(ctx){
    // Render the appropriate sprite
}

The actual Animation class has much more packed into it, since it is a generic animation.

I can just add an instance of the Animation in every tile, but I think it is inefficient and/or wasteful. Moreover, not all tiles are animated. One may argue that, yeah, it just costs a little memory since this is just a small game. But I do want to know and learn about more efficient ways so I can use them in my next bigger projects.

What are the techniques I can use?

sentences:
3D Position won't translate to 2D My 3D Hero-Model is positioned at a certain point in 3D-Coordinates. Whenever he's colliding with a coin, I want to place an animated sprite sheet there. But my following implementation won't give me useful result.

Viewport vP = GraphicDevice.Viewport;
Vector3 unitPos = modelPos.LocalPosition;

Vector3 screenSpace = vP.Project(unitPos, _cam.Projection, _cam.View, Matrix.Identity);
MySprite sprite = new MySprite(unitPos.X, unitPos.Y);

//... Won't draw sprite where the model is

The sprites are almost at the exact position, but there's approx. a 100px difference.
I am using a perspective camera with these settings:

Matrix Projection = Matrix.CreatePerspectiveFieldOfView((float)Math.PI / 3.0f, 800f / 480f, 1, 3000);

And when I place my camera to Z= 0 Y = 37 and Z = 220,
I have to multiply the result of Vector3 by 3.

The position of my camera is a Vector3 though.

A is the pure calculated value for SpriteY and B is the calculated value *3 (coincidentally is the right position)

So, it isn't correct. Why???

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:
Legality of AngelCode's BMFont Is it legal to use a bitmapped version of a proprietary font (such as Arial) in a commercial app?

I'm using AngelCode's BMFont to generate a bitmapped version of a few various system installed fonts for use in an iOS game. Is that legal to do without paying for a license for the font first?

sentences:
Decide which scoring system to use and number of points to assign for new game I am developing a new game and would like to know if anyone could point me in the right direction for deciding the type of scoring system to use for my new game as well as the number of points to assign to enemies and rewards so to make the game exciting to play. I remember to have read something re this in a maths' paper/assignment during my undergraduate but cannot remember what it was about any more. I think it was something to do with game theory and the formula allowed to work out the 'best' number of points to assign to enemies and rewards as well as well as their frequency within the game so that the game would always be theoretically achievable but never/ or almost never possible to achieve the highest score. There might have been something else some other assumption but I really cannot remember more about it. Does this ring a bell to anyone?

Can anyone point me to the right track if you've kind of know what this is about?

Thank you!

sentences:
Available Small Open Source Game Engines for tutorial I'm learning to create a game engine from scratch in XNA. I'm seeking examples of very small game engines, specifically the architecture and structure of source files, etc. It should include a scripting engine. Articles are also appreciated.

More specifically, I have a problem knowing how to connect the scripting engine to the rest of the game engine, like loading a models from the script.

sentences:
Godot 3 - Trying to make a character dash (wavedash) So, I'm trying to make a character do a wavedash in Godot 3 and I don't know what I'm missing here. When I press 'Z', the character should burst speed and then a few miliseconds later it should decelerate back to the normal speed. Tried to use a while loop, adding the var to the motion, but it didn't work.

Here's the code (testing only in the right direction).

extends KinematicBody2D
const UP = Vector2(0, -1)
const GRAVITY = 20
const ACCELERATION = 50
var MAX_SPEED = 150
var JUMP_HEIGHT = -400
var MAX_DSPEED = 300
var motion = Vector2()
var CAN_DASH = true
var ADD_SPEED = 0

func _physics_process(delta):

motion.y += GRAVITY
var friction = false

if Input.is_action_pressed("ui_right"):
    motion.x = min(motion.x+ACCELERATION, MAX_SPEED)
    $Sprite.flip_h = false
    $Sprite.play("Run")
    if Input.is_action_pressed("dash"):
        ADD_SPEED = 300
        while ADD_SPEED > 0:
            ADD_SPEED -= 3
            motion.x = min(motion.x+ADD_SPEED, MAX_DSPEED)

elif Input.is_action_pressed("ui_left"):
    motion.x = max(motion.x-ACCELERATION, -MAX_SPEED)
    $Sprite.flip_h = true
    $Sprite.play("Run")
else:
    $Sprite.play("Idle")
    friction = true
    motion.x = lerp(motion.x, 0, 0.2)
    JUMP_HEIGHT = -400

if is_on_floor():
    if Input.is_action_just_pressed("ui_up"):
        motion.y = JUMP_HEIGHT
    if friction == true:
        motion.x = lerp(motion.x, 0, 0.2)
else:
    if motion.y < 0:
        $Sprite.play("Jump")
    else:
        $Sprite.play("Fall")
    if friction == true:
        motion.x = lerp(motion.x, 0, 0.05)
motion = move_and_slide(motion, UP)
pass

sentences:
Can an iOS application have an explicit quit button? I've heard a rumor that you cannot have an explicit quit button on your app when it goes to the Apple App Store, can anyone verify this? It seems that most applications do not have one, and there is no explicit quit. How to developers handle quitting in general on iOS applications?

Note: I am using Unity, C#, and Xcode to develop my game for the iPad.

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:
Normal mapping for Android and iOS I'm making a mobile game for Android and iOS on Unity. At the moment I am researching and designing the technical aspects of the game. Since it is not plausible to use highly detailed models for mobile platforms, should normal mapped models be used instead?

Thus I have couple of questions about normal mapping. Are normal mapped models much more costly to make, in other words, do they take a lot longer to create? And are they much more expensive to render? At least there are no additional draw calls, but of course the shader is more complex.

sentences:
Why is the velocity of my rigid body in OnCollisionEnter always zero? My object must explode when the player touches it or when it collides at a low speed.

The problem I'm having is that its speed becomes zero when the floor collides for example and then the OnCollisionEnter event is called, it is already late and never fulfills the condition.

Someone knows what I'm doing wrong or what I should do to fix this?

void OnCollisionEnter(Collision other)
{
    Debug.Log(Mathf.Abs(rb.velocity.magnitude));
    if (Mathf.Abs(rb.velocity.magnitude) >= detonationImpactVelocity)
        Explosion(200);

    if (other.gameObject.tag == "Player")
        Explosion (600);

}

I came up with this but I guess there must be a better way to do it.

void Update()
{
    if (Mathf.Abs(rb.velocity.magnitude) >= detonationImpactVelocity)
        explosionSpeedAchieved = true;
    else
        explosionSpeedAchieved = false;
    Debug.Log(Mathf.Abs(rb.velocity.magnitude));
}

void OnCollisionEnter(Collision other)
{
    Debug.Log(Mathf.Abs(rb.velocity.magnitude));
    if (explosionSpeedAchieved)
        Explosion(200);

    if (other.gameObject.tag == "Player")
        Explosion (600);

}

sentences:
Making Bigger Touch Space in Node Using SpriteKit And Objective-C I am trying to make simple game, but I have a problem. The node is too small. On iPhones with smaller screen size, the finger can't move it. On iPad and on simulator, however, the node can be moved due to larger sizes of the screens. Due to that, I know it's not the code that causes the issue.

Due to the fact that I am using this paddle image on many levels, I create it as separate file so I can implement it anywhere I want within the app.

Here is what I got:

PaddleNode.m

- (id)init
{
    return [self initWithName:@"paddle"];
}

- (id)initWithName:(NSString *)name
{
    self = [super init];
    if (self) {

        self = [PaddleNode spriteNodeWithImageNamed: @"board.png"];
        self.userInteractionEnabled = YES;
        self.name = name;
        self.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:self.frame.size];
        self.physicsBody.dynamic = NO;
        self.physicsBody.usesPreciseCollisionDetection = YES;
        self.physicsBody.categoryBitMask = paddleCategory;
        self.physicsBody.collisionBitMask = emptyCategory;
        self.currentTouchValue = nil;
    }

    return self;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    self.previousTouchesTimestamp = event.timestamp;
    for (UITouch *touch in touches) {
        self.currentTouchValue = [NSValue valueWithNonretainedObject:touch];
    }
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    self.currentTouchValue = nil;
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    for (UITouch *touch in touches) {
        NSValue *key = [NSValue valueWithNonretainedObject:touch];
        if ([key isEqualToValue:self.currentTouchValue]) {
           CGPoint touchPoint = [touch locationInNode:self.scene];
           CGPoint movePoint = CGPointMake(self.position.x, touchPoint.y);

           if ([self withinParentFrame:movePoint])
               self.position = movePoint;
       }
    }
 }

 - (BOOL)withinParentFrame:(CGPoint)point
 {
    CGFloat offset = self.size.height / 2;
    if (point.y >= offset && point.y <= self.scene.frame.size.height - offset)
        return YES;
    else
        return NO;
 }

P.S. I am learning Objective-C by myself and English is not my first language. So, if it's OK, explain me like you would to little child.

sentences:
Unity2D: Pressing my mute button twice in order for it to set music back to 1 So far my mute button works, its just that I have to press my button twice (when game is restarted) in order for it to put my volume back to 1. Does anyone knows the problem. Anyway this is my script:

public bool mute;

void Start()
{
    // check if the player has a music volume preference
    if (PlayerPrefs.HasKey("musicVolume"))
    {
        // if yes, apply it.
        GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat("musicVolume");
    }
}

private void Muted ()
{
    AudioSource audioSource = gameObject.GetComponent<AudioSource>();

    mute = !mute;
    if (mute) {
        gameObject.GetComponent<AudioSource> ().volume = 0;
       // PlayerPrefs.SetFloat("mute", 0);
    }
    else
    {
        gameObject.GetComponent<AudioSource> ().volume = 1;
       // PlayerPrefs.SetFloat("mute", 1);
    }
    // write new music volume preference to persistent storage
    PlayerPrefs.SetFloat("musicVolume", audioSource.volume);
}

Thank you. :)

sentences: HaxeFlixel, Font gets fuzzy android upscale I made a simple game for android with a small native resolution (320x480). When text gets upscaled it loses its sharpness. Tried having anti aliasing on and off and both results were fuzzy. The size of the text is 16 (read that with some fonts the size should be dividable by 8). Also tried different fonts, but had the same result. Any solutions to that?

sentences:
Can we create same name class for different objects in unity? I have four similar objects in my game. As they are all similar therefore I have created a single script that defines mash for all of them. The script that defines mash for these objects uses a variable called radius which I have imported from other file (by classname.radius). The radius updates on every frame and it is the only property that is different for all objects.

To allow different radius for different objects, What I thought would work was, making four different classes of same name classname. Creating variable radius in all of them and giving them different values. Dragging first file to the first object, second file to second object and so on.. When executed, every time the script that generated mash considers classname.radius from the file which is dragged to that object. But that isn't working. What is wrong and how can I implement it?

Seems I'm messing with OOPS concepts!

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:
how to implement ARVR controller in unity & vuforia hello i've been strugling figuring out this thing. i'm trying to make ar controller for my vr cardboard game, so the idea is using AR and VR simultaniously. you will completely in vr game but your phone camera wil be turned on and set to AR mode. while you're in vr mode and your AR camera will detect your marker and repositioned it based on your view and the distance between camera and object. that marker will appear in your vr game and you'll make it as a controller. then maybe you want to make that marker appear as a gun, a sword, a shield or whatever it is that can be work with this concept

or maybe you just can watch it to get the idea if my explanation is not clear enough https://www.youtube.com/watch?v=a_v_a23u6n0

so i'm trying to implement it with vuforia as it's augmented reality API and of course Unity. now i'm on the stage where i already now how to use AR & VR simultaniously and how to transtition between AR to VR or otherwise. i'm still strugling on how to re-potitioning my marker to correct position in my VR world.

i already tried asking this in vuforia forum but there's still no answer until now. if you guys can help me with this it would be a big help !!

thx before

sentences:
What counts as a successful ad view in a mobile app? There is one thing about mobile ads that I can't completely understand.
Let's say I put ads in my free mobile game. What counts as a successful ad view? When it is just displayed on a user's screen or the user has to open the ad in order for it to count as viewed?

sentences:
Adding force to a 3d object in a 2d scene I have a 3d game object placed in a 2d scene (top-down view) in Unity. I want to add force to the object to move it in the direction it's facing. I attached a RigidBody2D component to it and when I use the AddForce() method, it's not working as I want it to i.e. it's moving on only one plane x or y but not in the facing direction.
Please help me.
Edit :- The game is my version of Asteroids. The ship is 3d and the asteroids are 2d. The scene is in 2d. I fixed the 'y' and 'z' rotation of the ship.
Now how do I add force to the ship in the direction its facing ?
The Update method -

void Update() {

    float rotationInput = Input.GetAxis ("Rotate");
    if (rotationInput != 0) {
        float rotationAmount = RotateDegreesPerSecond * Time.deltaTime;
        if (rotationInput < 0) {
            rotationAmount *= -1;
        }
        ship.transform.Rotate (Vector3.down, rotationAmount);
    }
    Vector3 currentRotation = ship.transform.eulerAngles;
    currentRotation.x *= Mathf.Deg2Rad;
    thrustDirection = new Vector3 (Mathf.Sin(currentRotation.x) * -1, Mathf.Cos(currentRotation.x), Mathf.Cos(currentRotation.x));

}

The FixedUpdate method -

void FixedUpdate()
{

    if (Input.GetAxis ("Thrust") > 0) {
        print (thrustDirection);
        ship.AddRelativeForce (ThrustForce * thrustDirection, ForceMode.Force);
    }

}

Thanks in advance.

sentences:
Where/how should A Star tie breaking occur? I've recently written a path finding script that utilizes a basic implementation of the A Star algorithm.  It works fine but is not very fast.  This is due, at least in part, to the fact that it isn't optimized at all.  Through a bit of searching through this site and others I've realized that at least one thing I need is a tie breaking procedure that updates the heuristic values of nodes in the open list.  Currently, whenever the pathfinder function is initiated.  The pattern the finder takes pretty much expands outward in all directions from the point of origin until the target node is found.  I've seen several videos that show A Star almost immediately traveling towards the target node thus eliminating many checks and ultimately speeding up the process.  I believe this is due to a tie breaking procedure.

My question is...  At what point in the process should I be applying the tie breaking procedure and is there a better modifier to add to the heuristic aside from the below code?:

Node.heuristic += (Mathf.Abs((Node.x * endNodeVector.z) - (endNodeVector.x * Node.z)) * 0.001F);

This seems to be the most common that I have found.  However, for some reason, this doesn't seem to effect the algorithm at all.  It still searches in all directions from the origin position. What am I missing to make my A Star favor open list nodes that are closer to the target?

sentences:
D3DX11CompileFromFile() function problem DirectX11 What do i have to include to use the D3DX11CompileFromFile() function on DirectX11? I'm using visual studio 2015 and reading the "3D Game programming guide" (Frank Luna) and i'm having problem using that function, any solutions?
I read online that is not usable anymore and that now i have to use the D3DCompileFromFile() function, but i have no idea how to do it

sentences:
Creating Slide-In Text I want to make my text slide like so:

This is from the game "Crossy Road". The movement is normally smoother that in the .GIF

Here are some more frames from the GIF to make you understand what I mean:

I'm sorry for the bad formatting, I need at least 10 reputation to post more than 2 links.

The text and the orange background seem to "expand" while moving smoothly to the right.

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:
Camera - View matrix in Android + openGLES 2 I am trying to use the touch screen on the tablet to control my camera movements and generate the view matrix accordingly.

I get the x and y coordinates of the screen and after doing some sanity checks on it I use them. My problem is I get the image and based on the movement it moves - but the object is always at a offset from the touch/pointer position. And I am not able to understand why. ( Kind of new at it)

Here is the camera logic -  Where pX and pY are coordinates of the device screen.

pitch = pY * 0.05;
yaw =   pX * 0.05;

LOGD(">>pitch %f", pY);

pitch = min(pitch,90.0f);
pitch = max(pitch,-90.0f);

LOGD(">>pitch(alter) %f", pitch);

if(yaw < 0) {
    yaw += 360.0f;
}
if(yaw > 360.0f) {
    yaw -= 360.0f;
}

I am not sure whether I am going about it in the right direction. Any suggestions will be appreciated.

sentences: Saving Game Data In Windows Store App I am creating a windows store game using unity . I want to save the current high score data . I most probably use StreamReader / StreamWriter for saving data but when i build the executable for windows store app , the compiler is giving me a error that StreamReader class is not supported . Is there any alternate way for solving this problem ?

sentences: How to resize my 2d game to fit the screen? I am currently making a 2D game using Java (Java 2D). I want to make my game resizable. If you play any game on an emulator (e.g. legend of Zelda in fceux emulator) in full screen mode, you'll see that the 8-bit or 16-bit game re-sizes to fit the screen size. How can I implement the same thing in my game programatically?

sentences:
Godot speed up mobile HTML5 Export GLES2 load time I got a small Godot project that should be played on mobile devices, however the load time of a GLES2/ HTML5 export project of Godot takes 20+ seconds to load from the server.

To decrease the load time I already tried to decrease the pack size (500kb), but this didn't make a difference. From the project and export settings I couldn't find any option that would decrease the load time either.

Are there other ways to decrease the load time of a Godot GLES2/ HTML5 project?

I can't share the project itself but if I need to display certain settings or need to add more information to make the problem clearer please let me know. =)

sentences:
Handling multiple lights of different types in GLSL I want to be able to support multiple lights of different types (point, spot & directional). Note that I also want to be able to render transparent/translucent objects, which rules out deferred rendering.

This means that I will need a fixed upper limit on the number of lights. All of the implementations I have seen use a uniform array, for example:

struct PointLight
{
    vec3 color;
    float intensity;
    float radius;
};

uniform PointLight pointLights[8];

How can I best extend this to multiple types of lights? Two possible options are:

Create multiple uniform arrays, one for each type of light.
Define a struct that can be used for all three types of light and then have some way of differentiating the types of lights in the array (e.g. using start index and count uniforms or adding some kind of type flag to the struct).

Both have disadvantages. Both waste memory (although the first more so than the second) and the second either requires additional uniforms or flag checking.

What is the usual method for handling multiple lights of various types?

sentences:
Proper Angled-Top Down Wall Collision? Sorry about the vague title, it's kind of hard to say what I want to do in a few words.

In my top-down game, I'm having a problem implementing proper collision for walls facing north (that is, you can actually see the surface of the wall, as opposed to the other directions, where you can see just the top).

I have a proper bounding box that detects the alpha values of the sprite, and generates a proper bounding box around only the visible pixels, like so:

http://a.pomf.se/kfrxtm.mp4

However, when dealing with walls, I run into a problem.
With my current implementation, there are two options I have:

Set the walls so that the player can pass through them. This leads to the player walking "on" the walls, like so:

Set the walls so that the player can not pass through them. This leads to the player's head colliding on the bottom of the wall, like so:

In the image, the player can not move forward any more.

My solution to this, would be to place the bounding box around the player's feet. However, this would interfere with my alpha-based system, and other collision systems (enemies hitting the player, etc.)

How should I approach this?

If my question is unclear, I can provide more images and descriptions of what I'm trying to achieve.

sentences:
Problem designing my pseudo-3D game with SFML I am designing the game so the objects I create (Character, Enemy, Enemycast...) can inherit all from

Collider
SpineDrawable // Sprite // AnimatedSprite
D2D // D3D

Both D2D and D3D inherit from virtual sf::Drawable. D3D also is supossed to apport the functionality of an additional axis. When the object is drawed in screen, the object is scaled and repositioned in (X, Y) with some calculations.

Collider inherits from D3D, because all my colliders are going to have 3 axis, and it creates its own AABB box from D3D interface -to be implemented by the graph type Sprite//SpineDr...-.

I am trying to have two vectors to hold all my graphics, std::vector<D2D*> and std::vector<D3D*>, because the D3D ones will need to be sorted depending on their float z.

The problem arise because D2D///D3D classes inherit virtual sf::Drawable, and I am using my class Sprite inheriting from sf::Sprite, which inherit sf::Drawable as non-virtual function from in Sprite.hpp of SFML.

So I got two questions

Must I rewrite my sprite function in lower level, so it can inherit sf::Drawable as virtual?
I think my design is poor. Which alternatives are there instead of creating two separated lists of sf::Drawable/s to order the ones which have 3 axis?

sentences:
How to force Game Center submit score failure What would cause a failure to report a score to a Game Center leaderboard?
Currently, score reporting succeeds almost all the time, so I'm trying to force failure so I can fix it.

The Game Center documentation says it would fail to report a score if there are network issues.  Are there any other scenarios where reporting a score would fail?

I'm using Prime31's Game Center plugin for Unity3D.

sentences:
(unity3d) Raycast Tags: Object reference not set to an instance of an object not working! Here is the code I have written for an AI:

public Transform player;
public NavMeshAgent Enemy;
public CharacterPowers CharPow;
public GameObject me;

// Update is called once per frame
void Update () {
    Vector3 targetDir = player.position - transform.position;
    float angleToPlayer = (Vector3.Angle(targetDir, transform.forward));

    if (angleToPlayer >= -90 && angleToPlayer <= 90)
    {
        RaycastHit hit;
        Physics.Raycast(me.transform.position, player.position, out hit);

        if(hit.transform.tag == "MainChar")
        {

            if(CharPow.IsCloaked == false)
            {
                Debug.Log("Player in sight!");
                Enemy.destination = player.position;
            }

        }

    }

}

However, according to the error message, the line

if(hit.transform.tag == "MainChar")

is missing a reference to an object. I have checked, and yes, the player character does have the tag. Everything else used to work, such as the cloaking mechanic. However, now nothing about the AI works at all.

sentences:
How to make good combinations of xp tables and xp rewards? Is there a known step by step (automatable) to define mean xp reward formula/table to bases specific challenges rewards (generically, not only defeating enemies) and total xp table that set character level progression speed? Sounds complicated.
For example, if a character defeats about
\$LevelUpEnemies(Lv) ≈ 120/max(1,6−Lv)!\ +\ 60∗clamp(0,Lv−5,3)\$
enemies like self then character grows up, initial level is 1 and final level is 10 (like WCIII),  characters has about Hp≈(8+2*Lv)², Atk≈(4+Lv)² and Def≈4+Lv, no more data and a attack damage is
\$Damage ≈ Attack_{Attacker}*\sqrt{ Attack_{Attacker} }/( \sqrt{ Attack_{Attacker} }+Defense_{Target} )\$.
How can I calculate the (fair) rewards base formula per level and the total xp table to do this?

Notes:

How can I calculate ==> the step by step text teaching or the algorithm
Fair ==> preferably proportional to the difficulty (if not, nearly, well-reasoned)

In addition, I see big xp tables with a lot of rounded digits with no beat missing, looks closely handwritten (just not). Is there a method or algorithm that besides builds the data also (perhaps) rounds to maximum digits with no kink?

sentences:
Blurred sprite in Scene view The thread between the tree and the spider here is a LineRenderer.

When the BackgroundLandscape or the Tree objects are selected it has this blur around the thread between the tree and the spider.

When anything else is selected, it renders correctly.

It always renders correctly in the Game view.

What's causing this?

sentences: Return different components by name in entity component system I'm working on an entity component system but I'm having trouble with the editor. Components take the form of structs with this formula Component healthComponent; This works fine when you know what component you want but for the game editor I'm working in a dynamic way and need to be able to simple get any component of an entity by string for example auto component = GetComponent("Health", entityId); I know c++ is strongly typed so is there any work around for this?

sentences:
How to organize timeline in a Flash project? I am starting a new Flash game and I was wondering if there is a better way to organize the timeline of the project. In my previous games I define a keyframe for each possible status of the game (loading, sponsor, intro, menu, gameplay, etc...). This method works but has some problems... For instance, it is not easy to implement transitions between the different screens in the game.

How do you do this? Do you know of some better way?

sentences:
Development pace and Balancing RPG with multi-layer character building a friend of mine and I have been working on an online RPG game where players get to build a character by allocating stats, selecting their abilities, and equipping gear before fighting each other in a sort of arena-style combat. There are currently four main stats that pertain to melee fighters with intentions of adding more stats for spell casters. We have decided the combat rules and decided what the ideal balancing should be between various possible builds at level one. After testing for a few weeks, we see results that significantly differ from our end goal.
As a junior agile developer working with a skilled, long time RPG player, our ideas on how to progress with the game differ slightly.
As stated, there are intentions to add multiple layers to this game.
With the characters being imbalanced at level one (balanced differently than anticipated), the question is:
would it be more efficient/effective in any way for us to move on from this (base stat aka layer one) balancing and instead balance our game when all of the layers are available, or to continue to tweak the balancing at layer one?
By this, I mean, at level one, a hunter may beat a warrior when the desired outcome is the other way around. However, once a knight is in a full suit of armor and equipped with more complex abilities, they would beat a hunter, this means at layer one, just counting the combat between opponents, using the same ability / no gear / same amount of stat points (allocated differently per build) a hunter beats a knight but after equipment and abilities are introduced the knight will beat the hunter which would be our desired outcome.
From an agile perspective, I understand the MVP concept of, try to get together an app quickly so it can start testing sooner. At the same time, it is essential to us that the game is fair (I understand this has to do with the rules) and that, at its core, it has a strong foundation. I am not scrum master and I'm not sure of - at what point do we move on if we aren't reaching our goal?
Neither of us are game designers so we would like to encourage responses from such viewers but all input is appreciated!

sentences:
Moving A Sprite In The Direction Its Facing XNA There are many questions on this site that explain this except they seem to all be in Java.
I want to move a sprite in the direction it's facing, in XNA. I know you must use Radians and lots of complicated maths which I am not too familiar with. I tried doing this:

position.X += RotationAngle * 5;

This code obviously makes no sense whatsoever, and that's why I need help with it. How can I accomplish the rotation?

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: Can I put real monuments like white house, statue of liberty in my open world game? I'm currently working on open world game. But I am confused about one thing that, is it ok if I put real monuments and sculptures like white house, statue of liberty etc. in my game? Please help if anyone knows and confident about his/her answer. Thanks in advance!

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:
JSON deserializing 'nested' Array Greetings!

I'm working on a class that loads and parses .json files and returns information from the loaded .json, but I have problems reading the nested arrays of my .json files.

Turning the serialized object public and looking at the Inspector, the 'Choises' array is not being read at all. It contains four objects, each contain a string and an integer correspondingly.

using SimpleJSON;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

public class JsonParser : MonoBehaviour
{
    private string loadedJson;
    public StoryData storyData;

    [Serializable]
    public struct choice
    {
        public string choiceText;
        public int choicePointer;
    }

    [Serializable]
    public struct storyImage
    {
        public string imagePath;
    }

    [Serializable]
    public struct storyText
    {
        public string text;
    }

    [Serializable]
    public struct placeholderStory
    {
        public string storyText;
        public string storyImage;
        public List<choice> choises;
    }

    [Serializable]
    public struct StoryData
    {
        public placeholderStory[] placeholderStory;
    }

    public void LoadJsonFile(string filename)
    {
        loadedJson = File.ReadAllText(Application.dataPath + filename);
        storyData = JsonUtility.FromJson<StoryData>(loadedJson);
    }

    public string GetChoiceText(int storyPosition, int choiceIndex)
    {
        string choiceString = storyData.placeholderStory[storyPosition].choises[choiceIndex].choiceText;
        Debug.Log(choiceString);
        return choiceString;
    }

    public string GetStoryText(int storyPosition)
    {
        string storyString = storyData.placeholderStory[storyPosition].storyText;
        return storyString;
    }

    public string GetStoryImage(int storyPosition)
    {
        string imageString = storyData.placeholderStory[storyPosition].storyImage;
        return imageString;
    }
}

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:
Avoid players getting stuck by placing items in the same place Let's assume a multiplayer game of two players. These two players have to place six elements at six different positions. The order or exact place does not matter. As the items are placed correctly, they cannot be replaced anymore.

Issue: Both place an item at the same position and now there are basically two items at a position where only one should be. This makes the task impossible to complete, as one item is missing now for the last position.

My assumption is that while both are really doing that in parallel, the communication between both computers is too slow so the other player can't know there is already an item.

I encountered this issue in a game recently and I wonder how to avoid this.

The simplest solution would be that the items can be replaced when placed. But let's see it more technical: A correctly placed item cannot be replaced - so how to circumvent or how to avoid this situation?

sentences:
Spritekit - gradually apply force vector in different direction (space ship turning) I have a space ship that I'm applying a force vector to using a joystick for control.  I would like this to smoothly fly around when I'm switching directions..  Exactly like minisquadron if you've ever played that..

Let's say I move the joystick to the far right and apply a force on the physics body of (1,0)  and then I abruptly switch directions without circling the joystick around and apply a force of (-1,0).  The ship will move to the right and then slowly lose speed before switching in a linear fashion.

What I want is for it to slowly transition between those two vectors so that it flies in a tight circle.

I'm trying to figure out the best way to write this.. maybe using a loop..  but I could use some help.

pseudo code:

func joystickMoved(){
    let point = pointVector;
    self.moveShip(pointVector);
}

func moveShip(pointVector: pointVector){

    // get current angle
    let curAngle = self.ship.physicsBody.velocity.toAngle()

    // get joystick angle
    let newAngle = pointVector.toAngle

    // while there is a sizeable difference in angles..
    // this loop needs to occur with some delay
    // so transition doesnt occur too quickly
    while fabsf(newAngle - curAngle) > 0.5 {

        // make tiny transitions towards newAngle.. this needs more detail
        curAngle += 1
        let newVelocity = CGPoint(cos(curAngle), sin(curAngle))
        self.ship.physicsBody.velocity = CGVector(dx: newVelocity.x, dy: newVelocity.y)

    }
}

sentences:
problem loading Collada DAE model using Assimp in OepnGL 4.4 I am loading a model in my OpenGL application using Assimp library like this :

bool CGameObject::LoadModelFromFile(char* sZFilePath)
{
std::string fn = sZFilePath;
std::string td = "\\";
std::string mfn = _getcwd(NULL, 0) + td + fn;
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(mfn,
    aiProcess_CalcTangentSpace      |
    aiProcess_Triangulate           |
    aiProcess_JoinIdenticalVertices |
    aiProcess_SortByPType);

if (!scene) {
    return false;
}

const int iVertexTotalSize = sizeof(aiVector3D) * 2 + sizeof(aiVector2D);
int iTotalVertices = 0;

for(UINT i = 0; i < scene->mNumMeshes; i++) {
    aiMesh* mesh = scene->mMeshes[i];
    int iMeshFaces = mesh->mNumFaces;
    for (UINT f = 0; f <iMeshFaces; f++) {
        const aiFace* face = &mesh->mFaces[f];
        for (UINT k = 0; k < 3; k++) {
            aiVector3D pos = mesh->mVertices[face->mIndices[k]];
            Model.vertices.push_back(pos.x);
            Model.vertices.push_back(pos.y);
            Model.vertices.push_back(pos.z);
        }
    }
}

// VAO
glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao);

// VBO
glGenBuffers(1, &m_vbo);
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
glBufferData(GL_ARRAY_BUFFER, this->Model.vertices.size() * sizeof(GLfloat), &this->Model.vertices[0], GL_STATIC_DRAW);
glVertexAttribPointer((GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);

// unbind buffers
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

// return success when everything is loaded
return true;
}

and then render it like this :

for (GameObject::iterator i = GameObjects.begin(); i != GameObjects.end(); ++i)
{
    CGameObject* pObj = *i;
    glUniformMatrix4fv(MatrixID, 1, GL_FALSE, GetMVPMatrix(pObj->position));

    glBindVertexArray(pObj->m_vao);
    glVertexAttrib3f((GLuint)1, 1.0, 0.0, 0.0); // set constant color attribute
    glDrawArrays(GL_TRIANGLES, 0, pObj->Model.vertices.size());

}
.
.
.

// function used to set MVP matrix
GLfloat* GetMVPMatrix(glm::vec3 position)
{
glm::mat4 Model = glm::translate(mat4(1.0), position);
glm::mat4 MVP3 = Projection * View * Model;
return &MVP3[0][0];
}

I created and exported my model using Blender. if I use OBJ format then it is rendered correctly :

but with DAE format it is like this :

My model has 5 meshes and debugging in Visual Studio shows that all 5 meshes are loaded.

Loading the DAE file in assimp_viewer shows the model file has been exported correctly :

Where am i doing it wrong ?

sentences:
How to decide to use OpenGL ES 1.0 or 2.0 for Android? I started learning some Android development and one of the first things I thought I could make is a simple game. However, I'm faced with one difficult question right off the bat. Should I use OpenGL ES 1.0 or 2.0?

The game I have envisioned will be pretty simple graphically, utilizing 2D(tiled top-down type graphics) and fixed-camera isometric views. I've never used OpenGL in a desktop environment, so I'm oblivious on if shaders will be something I'll use, etc.

According to this page I should use OpenGL ES 2.0 generally for new development. My own phone however just recently(past year) got an update to get it to the required Android 2.2. (I don't even know if it has OpenGL ES 2.0 support)

So basically my question is, will I benefit from any of OpenGL ES 2.0's features over 1.0 and/or is it worth it in terms of compatibility?

sentences: Game thread, render thread, animation/inverse kinematics, and synchronization In a multithreaded setup with a game logic thread and a render thread, with some kind of skin mesh animation with inverse kinematics plus etc how does animation work? Does the game logic thread just update a number saying time T in the animation and then the render thread infers Who owns the skin mesh animation, the game logic thread or the render thread? How is it stored in the scene graph if it is stored there at all? When the game logic updates does it do the computation of the skin mesh animation and the computation of the inverse kinematics and then store the result directly in the scene graph or is it stored indirectly and the render thread does the computation?

sentences:
Why is my picture distorted after switching from D3D9 to D3D11? I have moved app from Directx9 into Directx11.

After this upgrade strange thing happened with my world. Objects get skewed and became 2D, also they are clipped in unexpected places.

The two arrows at the image I attached point to my HUD reference frame - three nice cones, arranged to point along the 3 axes, which are supposed to be shown in the lower left corner of the window.

Also you can see that sphere got clipped in difference positions and all objects are 2D. There side and front view. Thanks for your suggestions.

Need to point out that sphere is moving.

I use XMMatrixPerspectiveFovLH to get projection matrix.

Example of matrices:

World
2  0  0  0
0  10 0  0
0  0  1  0
0  0  10 1

View - Identity

Proj
1.72 0    0   0
0    2.41 0   0
0    0    1.  1.
0    0   -1.  0

Both previous images are wrong rendered. Just side view and fromnt view of wrong rendering.
Thanks to Tordin i got this:

This one is almost correct, only some problems with culling in cones which form reference frame.

EDIT: Question was answered, but nobody wants to frame his comment as an asnwer. First was

  Tordin:  transpose your matrices. All of them, World, View,
  Projection. DX11 is Row major and not Colume major like dx9 was

sentences:
Facebook App  Game Canvas Size I am building a Facebook App Game and was wondering what a safe height and width for my canvas.  I know that the current standard is 760 and there are questions about that, but I would like to know what a good height would be.  I would like it to take into account smaller screen sizes.  My game is a sidescroller.

I know there are a few Facebook App questions similar to this but I feel mine is different because I am concerned with the height in addition to the width

sentences:
Fast Occlusion Discovery in 3D Point Cloud I am trying to find occluded objects given a view point at x,y,z in the scene. For instance in the example below all the points constructing trees should be returned as occluded objects (because of the building).

Is there any better approach than tracing rays and querying occupancy of every voxel on those rays within the Octree? This approach doesn't look efficient as the complexity significantly grows with number of voxels and distance from P(x,y,z) in the scene.

sentences:
Android TV game development Anybody develop games for Android TV? Especially with libGDX?

I would like to know what game controllers Android TV uses? And whether we can use libGDX to control the game controllers?

sentences:
I need an analytic formula for 3 arms inverse kinematics system I need an Analytic formula for 3 arms IK system_. I'm currently using Fabrik and CCD solutions but I'm facing low-performance and accuracy issues. So now I'm looking for an Analytic formula.

I'm working on a planar system so a 2D solution would work.

Thanks in advance for any help.

sentences:
How to make a 90 degree rotation happen over time I'm trying to take a RotateAround function and make it happen over time. I've been tinkering with Quaternions to try and get it to work but I can't quite figure it out.

This is the code:

public class RotateCamera : MonoBehaviour {

public Vector3 rotatePoint = new Vector3(0,0,5);

public void RotateLeft ()
{
    transform.RotateAround (rotatePoint, Vector3.up, 90);
}

public void RotateRight ()
{
    transform.RotateAround (rotatePoint, Vector3.up, -90);
}

I'm applying each void to a button, and this works like a Final Fantasy Tactics camera - rotate an isometric camera 90 degrees. But it happens instantly, and I want to make it happen over time, like a second or a half a second. I'm super new to programming and I can't find any guides on this or any other posts using google, so I'm asking on here as a last resort. Thanks for any help.

sentences:
Axis Aligned Bilboards in shader Hi I need to implement following effect using vertex shaders.
Basically its a shader for particle laser beam that rotates to particle along its own y axis till its "best" visible (Roughly).

My idea was:

Take  "y" axis of particle model (its a rectangle) and transform it
to view space ("vy").
Calculate the vector orthogonal to "vy" and eye vector ("w"), to get the
direction on the screen which "x" of partilce should be oriented.
Change particle vertices model coordinates using "w" instead of x.

sentences:
Could the delta frame time be negative? I'm following a tutorial about the time management and, the tutorial shows this function:

double GetFrameTime()
{
    LARGE_INTEGER currentTime;
    __int64 tickCount;
    QueryPerformanceCounter(&currentTime);

    tickCount = currentTime.QuadPart-frameTimeOld;
    frameTimeOld = currentTime.QuadPart;

    if(tickCount < 0.0f)
        tickCount = 0.0f;

    return float(tickCount)/countsPerSecond;
}

The tutorial explains that, this function basically gets the time that one frame takes, but, I don't understand how the variable tickCount can be negative, if the currentTime is
increasing all the time (calling this function every frame, obviously), so, is that if really necessary?

sentences: Can I use xna tutorials to learn monogame? Can I use xna tutorials to learn monogame? I can't find any good monogame tutorials but there are tons of xna tutorials available and from what I have seen they are pretty much the same thing.

sentences:
What is the difference between a Sprite and a Texture? I have an assignment due for University, and my task is to discuss textures used within video games, and how they have evolved.

My main question is, what is the fundamental difference between using a sprite, or using other texture methods?

Having done a little research myself, I seem to be inclined that Sprites store images in a single file, and can be used for animations etc.. and were commonly used with older video games, generally using sprites as all of their game visuals. Now, with modern games, sprites I believe tend to be less used as technology advances and other textures are available such as bump mapping. Although sprites are still used today to accommodate features such as a health bar or long distance textures.

But what are the main advantages of using textures, over sprites?

sentences:
Ingame notification - Windows Phone Im working on a simple game for windows phone.
There is one item in the game where the player can click on a enemy and shoot him. Well there is a 1:2 chance for the user to shoot the enemy and when he fails I want to tell this to the user. A Popup would stop the gameflow so I don't really want that.
What are other possible ways to do that ?
It doesn't need to be a lot of text just "Miss !" or "You missed !".

sentences:
Is there a reason online video games don't have "benches"? In many physical team sports, in addition to the players deployed on the field, there are also players on the bench who the coach can sub in when the players get tired or run into unforseen circumstances. This is more common at low levels of play.
However, in online e-sports (e.g. Overwatch, League of Legends, Counter Strike), this is almost universally absent, with everyone who queues expected to play the entire duration of the game. This is not always possible, nor, in the case of solo queue, always desired. If it does exist at all, it involves players joining games in progress, which means that the subbing team is left with no one until a replacement shows up, and players being subjected to new skill ratings that they weren't originally matched up to. I have never seen the concept of one or more bench players being available from the start, known to both teams at the start, and available to sub in as needed, akin to how a physical sport would operate.
Why is this? Are there cons to such a system that would cause it to fail or cause more problems than it solves? Has this been tried before somewhere?

sentences:
How can I create a lightning attack similar to Agahnim's in Legend of Zelda: Link to the Past? I'm currently trying to recreate this attack, and I'm unsure of how it works.

It seems like the boss creates 4 lightning bolts which move downward at 45 degree/diagonal angles, changing direction every so often.

I'm building my game in Zelda Classic. I'd preferably like to know how to do this in C++, although I am fine with Java or anything C++/C-like.

sentences: Handwriting or handwritten text recognition in augmented reality Is there any way available to detect handwriting of a user using augmented reality within Unity. Or convert user hand written text into characters?

sentences:
Managing game states (states flow, controlling the state machine...) I am currently struggling really bad to make the game states management. Before we dig into the problem, I must point out that I do know about state machines, I do have both implemented (states and state machine) and they look SIMILAR to this, or you can also see my real outdated implementation from my github.
Alright, my questions are:

Do states usually operate state machines? Eg.: when the LoadingState
finishes (based on the 'update' method) loading something, it tells
the state machine to pop the stack (which would pop the
LoadingState) and to push a new state, such as PlayingState OR
should the LoadingState only notify the state machine and the state
machine itself will be responsible of knowing whats the next state
based on the state that has requested a pop? Knowing which state has
requested a pop (pop, push or whatever) is kind of difficult because
it needs some advanced C++11 stuff, which requires a lot of
'not-easy-to-understand' code and validations (asserts), unless we
use an enumeration inside each state and do a simple switch (again,
more typing).
Should the state machine be opperated/accessed (pointer/static
functions) by any component (class, system, manager...) of the game?
Eg.: the main player has moved into a map teleport and it triggered
a map load, since it should be teleported to a new map. Should the
Map class notify the state machine to push the MapTransitionState
into the stack, through a static (it doesnt really make any sense to
have a pointer to the state machine in the map class) public
function?

Thanks a lot!

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:
Is transform.forward mutable? Suppose I have a GameObject, and I want it's transform.forward to be facing up. Is it possible to change it as seen below?

public class Main : MonoBehaviour
{
    void Start ()
    {
        Vector3 forward = transform.forward;
        forward = new Vector3 (0, 1, 0);
        transform.forward = forward;
    }
}

sentences:
Multiplayer netcode where all units, including server, are untrusted - possible, feasible, etc.? Most professional video games use either a peer-to-peer architecture or a client-server architecture. In the former, clients often trust each other, and instead employ anti-cheat techniques to ensure that all clients are using the same version of the game. In a client-server architecture, the company-owned server manages the game, and each client only needs to trust the server without trusting any other client.

My question is: how might I write a game network architecture such that the server is not necessarily trusted either (e.g. it is another client, or is buggy, or has been compromised), and do so in a way that does not take too much processing power away from the game?

I know that the blockchain algorithm (as infamously used by Bitcoin and other cryptocurrencies) does provide this as long as at least half of the computing power is owned by trusted machines. While this may work for long-term actions (such as match verdicts), it doesn't work as well for the frame-by-frame actions of action games and can also be too slow for turn-based games, to say nothing of the computing power it requires of the clients or of any dedicated servers.

sentences: Unity shaders and textures not transferring properly when using github We have the game code on github, when we try to clone onto different machines the shaders and textures do not transfer over properly. Has anyone else noticed this problem using gitHub?

sentences:
Implementing a 4x4 Game Board I struggle with efficiency in code, and I want to start my game off on the right foot.

I have a game that I'm making a 4 x 4 map of 'tiles' that a user can build their 'town' on.  To keep track of the tiles, I'm planning on simply having a size-16 array of the type of my 'mapTile' enum. EX:

enum MapTiles { defaultTile, homeBase, farm1, farm2 /*...and so on...*/ };
static MapTiles playerMap[] = MapTiles[16] { /* ... default map setup ... */ };

Is there a way that is more efficient or more easy-to-extend way to implement such a map?

I'm using Unity and C# mostly, though i'm willing to work with any Unity-capable language if you have a clever answer.

sentences:
How can i scale up a bounding box in Xna? In Xna a spritebatch can be passed a value for scale. I have A bounding
box Rectangle that i have a border drawn around my sprite using the bounding box rect.

Now my question Scale can make the sprite go up just fine,but how
can i get the bounding box rect to scale up with the scale propertie?

sentences:
Learning how to make imposters manually in Unity - how to render an object to a texture not what camera sees? I am trying to learn the most performant way to make an imposter in Unity manually - not using pre-fabricated solutions.

My first guess is that it should be achieved by using RenderTexture and a second camera and then taking different "snapshots" of different angles of the objec. If there are better alternatives in terms of performance (even if more difficult to implement), I would love to hear about.

In case that is the only path, then I have learned how to render from a camera to a texture via script, but I still couldn't figure it out how do the following, which is what I need to do first: how to render-to-texture a specific object without the background of the camera (i.e. with rest of texture being transparent) in a performant manner?

Pointers, suggestions or at least link recommendation will be great.

Thanks in advance.

sentences:
Trying to rotate a point around another point and it's not working I am trying to make a function to rotate a point around another point. My maths are very rusty but i did some research and i just dont understand why my function is not working.

public void rotatePoint(int pX,int pY,int angle) {
    int newX = 0, newY = 0;
    int centerX = 400, centerY = 300;

    angle *= Math.PI / 180; // convert angle from deg to rad

    double rotatedX = Math.cos(angle)*(pX-centerX)-Math.sin(angle)*(pY-centerY) + centerX;
    double rotatedY = Math.sin(angle) * (pX-centerX) + Math.cos(angle) * (pY-centerY) + centerY;

    newX = (int)Math.round(rotatedX);
    newY = (int)Math.round(rotatedY);
}

On the image i just provide my original point is in grey. After a rotation of 90 or 180deg i would expect the point to arrive where the green ones are. They arrive where the red points are.

sentences:
Gamemaker: Get from which children action is called I've got 3 Children in 1 Parent which has "Left pressed" action. I just want to know from which child this action is called.

I try object_index but obviously it returns Parent index.

Thanks in advance.

EDIT #1: put in Left pressed

with(other) { var id = object_index; }

will return object child which perform this event

sentences:
Vertical Camera Movement in a 2D Platformer I would like to ask about how vertical camera movement should be handled in a platformer in which the player changes his Y position frequently. For the past two days I've tried to adjust the camera movement and I haven't made any satisfying progress.

In principle, the camera's height should change as infrequently as possible, to avoid causing nausea. It also has to react quickly enough to the player's change in direction so he could see where he's going. An example of vertical camera movement done very, very well is in Rayman: Origins or Rayman: Legends.

How did you think vertical camera movement should be done in a platformer?

sentences:
What would be the simplest way to create a 2D board game for Android? I'd like to create a very simple 2D board game for Android, it would be a concept/mockup so I can see how the game works out.

Let's for the sake of this question that it's a clone of Othello - board game with score display, clickable game pieces/spots on a square grid and some animations.

I have to choose from these approaches:

do it all myself, draw the game on Canvas - I've done one game this way, and it took some time to code it. Then, that was a casual action game and the animations would be hard to implement.
implement it with Android widgets - I'd use RelativeLayout/TableLayout; the pieces will be ImageViews - this way I'd get the animations for free with Android tween animations. This would be the quickest of all solutions timewise, but I might run into some problems that may be a deal breaker.
use AppInventor - it may do the task, but don't know anything about it, this approach would also require some time to go through the tutorials.
use a proper game engine. That will take time to learn how to use it, which I view as the biggest disadvantage as I do mostly business apps, not games. And I don't know which one to choose from.

I really only want to throw this together in the shortest amount of time to see how it works, so I don't want to invest a lot of time to do it in the most "correct" way - that I'll do later if the concept works.

sentences:
Does one's choice of 3d modeling software used during asset creation affect performance at runtime? Does software used to create 3d assets (for game development specifically) have an impact on the efficiency of the program?

In other words, is it possible to reduce the operating footprint of an application merely by utilizing alternative development software during production of 3d assets? If you use two different applications to create a 3-dimensional image of a box, can one of them result in better performance if aspects of the image are identical?

I am attempting to get the information I need without causing unnecessary debate over specific software choice.

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:
In Unity, how to hide objects from specific cameras without using Layers The situation is that there are multiple players that can collect items. When a player collects an item, the item will disappear from that player's screen but still be visible to other players. I know I can use LayerMask to achieve this effect. However, what if there are more than 32 players? (Unity Layer has 32 bits). How can I still hold this effect?

I tried using OnWillRender() to check which camera is rendering the object in order to disable its renderer. This does not work because once the renderer has been disabled, OnWillRender() will not be called again for other cameras.

sentences:
OnTrigger not firing consistently I have a Prefab called Player which has a Body and a Sword.
The game uses 2 instances of Player, Player1 and Player2.

I use Player1 to strike Player2. This is code on the sword. My hope is that Sword of Player1 will log on contct with Body of Player2. It happens but only the first hit and then i have to hit several times before another strike is logged. But when i look at log from OnTriggerStay it looks like the TriggerExit is never detected untill long after the sword is gone.

    void OnTriggerEnter(Collider other)
{
    //Play sound to confirm collision
var sm = ObjectDirectory.soundManager;
    sm.PlaySoundClip(sm.gui_02);

    Debug.Log(other.name + " - ENTER" );

}

void OnTriggerStay(Collider other)
{
    Debug.Log(other.name + " - collision" );
}

void OnTriggerExit(Collider other)
{
    Debug.Log(other.name + " - HAS LEFT" );
}

DEBUG LOG:

  Player2 - ENTER
  UnityEngine.Debug:Log(Object)
  SwordControl:OnTriggerEnter(Collider) (at Assets/Scripts/SwordControl.cs:28)

  Player2 - collision
  UnityEngine.Debug:Log(Object)
  SwordControl:OnTriggerStay(Collider) (at Assets/Scripts/SwordControl.cs:34)

  (The last debug log then repeated hundreds of times long after the sword of player 1 had withdrawn and was in no contact with player 2  )

EDIT:
Further tests shows that if i move player1 backwards away form player2 i trigger the OnTriggerExit. Even if the sword is not touching Player2 since after the blow. However even after OnTriggerExit it takes many tries untill i can get another blow registered.

sentences:
How to best simulate the space in a boxing game to account for footwork and angles? When trying to prototype a (top-down, so far) boxing simulation I've run into a huge roadblock with trying to set the space in which the boxers will fight, because it's important for the fighters' reach to be a factor in setting the distance of the fight, which is easier in a continuous space. On the other hand, they should also be able to cut angles where the opponent is out of position when compared to themselves (like Tyson did below), which would probably be easier to represent in a discrete space, like a hex, but the rotation would be very rigid. The difference between stances would also be more difficult to represent in a discrete gamespace, since foot position is entirely different, as well as the reach.

I've been coding this in Godot, so it would not be that much more difficult to do a continuous space and use their signals and collision shapes to do it, my only concern being the computational cost of actions would be raised with the amount of positions available, so I'd rather have an abstraction.
Is there any obvious solution I'm missing? Some way both things can be represented (in a way an AI can easily interact with) without unnecessary granularity? Or a way to do it in a continuous space that wouldn't greatly increase computational overhead with the massive array of new positional possibilities?

sentences: Is there a known most efficient version of A* search algorithm? Is there a known 'most efficient' version of the A* search algorithm? I know some people write papers on the most efficient way to compute common operations, has this been done for A*?

sentences:
LibGdx- Sprites moving alongside camera I am trying to render some entities in random positions on the screen. The spawning positions are okay however when I move the player entity (which the camera is focused on) and pass the middle of the screen (then the camera starts moving) the sprites of the other entities also move with me, which I do not want.

I tried giving them postions in the world and not in the screen using cam.unproject(position); which converts psotions relative to the screen into positions relative to the game world, but that did not work either.

They are rendered the same way all other sprites are rendered in libgdx

This is the code where I initialize the entities:

Texture zombie = new Texture("zombie.png");
    float x, y;
    for (int i = 0; i < enemy_amout; i++) {
        x = rm.nextFloat() * (mapWidth * 8f- zombie.getWidth());
        y = rm.nextFloat() * (mapHeight * 8f - zombie.getHeight());
        Vector3 position = new Vector3(x, y, 0);
        cam.unproject(position);
        enemies[i] = new Entity(zombie, position.x, position.y, 1);
    }

This is what the game looks like when I start it

And this is what it looks like after I moved the player character to the right. As you can see they moved alongside the camera but I want them to remain on their original positions.

sentences:
C++ Raycast using SFML I know this isn't exactly C++ related, however, I was just wondering if anyone knew anything about texture mapping onto a raycaster. I'm currently trying to write my own and I'm struggling to map textures onto the walls. I know what it's doing since it's mapping the texture per ray instead of per wall, but I'm not sure how to fix it. Here's the code:
The code for the walls
void Draw3DScene()
{
  sf::Color color;
  sf::Texture texture;
  sf::Sprite sprite;

  for(int i = 0; i < NUM_OF_RAYS; i+= constant)
  {
    float correctedDistance = rays[i].totalDistance * cos(rays[i].angle - player.angle);

    float wallHeight = (TILE_SIZE / correctedDistance) * projectionPlane;

    int wallTop = (WINDOW_HEIGHT / 2) - (wallHeight / 2);
    if(wallTop < 0)
    wallTop = 0;

    int wallBottom = (WINDOW_HEIGHT / 2) + (wallHeight / 2);
    if(wallBottom > WINDOW_HEIGHT)
      wallBottom = WINDOW_HEIGHT;

    if(rays[i].wallContent == 1)
    {
      color = sf::Color::White;
      texture = texture_t[0].myTexture;
      if(rays[i].wasHitVertical == true)
      color = sf::Color(150,150,150);
    }
    if(rays[i].wallContent == 2)
    {
      color = sf::Color::Red;
      texture = texture_t[1].myTexture;
      if(rays[i].wasHitVertical == true)
      color = sf::Color(150,0,0);
    }
    if(rays[i].wallContent == 3)
    {
      color = sf::Color::Blue;
      texture = texture_t[2].myTexture;
      if(rays[i].wasHitVertical == true)
      color = sf::Color(0,0,150);
    }
    if(rays[i].wallContent == 4)
    {
      color = sf::Color::Yellow;
      texture = texture_t[3].myTexture;
      if(rays[i].wasHitVertical == true)
      color = sf::Color(150,150,0);
    }

    DrawLineWithColor(&gameWindow, sf::Vector2f(i, wallTop),  sf::Vector2f(i, wallBottom), sf::Vector2f(i + 32,wallBottom), sf::Vector2f(i + 32, wallTop), color);

    DrawTexture(sf::Vector2f(i, wallTop), sf::Vector2f(i, wallBottom), sf::Vector2f(i + 1, wallBottom), sf::Vector2f(i + 1, wallTop), texture);

  }
}

//The code for drawing the textures
void DrawTexture(sf::Vector2f point1, sf::Vector2f point2, sf::Vector2f point3, sf::Vector2f point4, sf::Texture texture)
{
  sf::VertexArray vertices(sf::Quads, 4);
  vertices[0].position = point1;
  vertices[1].position = point2;
  vertices[2].position = point3;
  vertices[3].position = point4;

  //Test

  vertices[0].texCoords = sf::Vector2f(0,0);
  vertices[1].texCoords = sf::Vector2f(0,TEXTURE_HEIGHT);
  vertices[2].texCoords = sf::Vector2f(TEXTURE_WIDTH,TEXTURE_HEIGHT);
  vertices[3].texCoords = sf::Vector2f(TEXTURE_WIDTH,0);
  gameWindow.draw(vertices, &texture);
}

I got the images from this site https://lodev.org/cgtutor/raycasting.html
Let me know if you want the whole code instead of just snippets.

This is what it looks like when I'm far back enough. If I get closer to the wall, the image becomes more distorted so to say. The thing is, the texture is being drawn per ray instead of per wall.
I apologize if I was being too vague with my question.

sentences:
How can I implement Offline Skilling An example of offline skilling would be EvE Online. Your character (pilot) does not gain skills by getting experience. Instead, your character gains skillpoints towards a skill you are training whether you are in or out of game. Also, I am fairly certain that skills continue to build even when the game servers are down.

Anyone have any broad ideas of how they go about this, or better yet how I could go about implementing something like this in a game I am developing. I'm not looking for a detailed explanation here (don't let me hold you back though), but I am looking for a signpost that points me in the correct direction.

Thanks!

sentences:
Incrementally processing large number of entitites in an entity-component system LibGDX/Ashley has a class IntervalIteratingSystem that allows you to process all entities in a particular family every X milliseconds. But if you have a lot of entities to process, it might be a bad idea to do all that at once. For example, if you want to process 10,000 entities once every 10 seconds, you might not actually want to wait 10 seconds, and then process all the entities -- you'd want to "spread it out" over many frames. Perhaps every 100ms you process 100 entities, cycling through them all.

To rephrase: I'd like to process a large number of entities but spread out across multiple frames, preferably:

providing a reasonable guarantee that all entities will processed at least once every X seconds,
enabling you to keep track of how much time has passed since that entity was last processed,
with a random entity order,
all entities are processed an equal number of times.

Here are my ideas so far...(some bad, some good)

Every time an entity is added to the Engine, add a Group1, Group2, or GroupN component (either randomly or sequentially), and then in my EntitySystem I cycle through the various families based on their Group#.
Every 10 seconds, add all 10,000 entities to a list, and then every 100ms, drain and process 100 from that list. (Memory-intensive, and might fall behind)
Every 100ms, iterate over all 10,000 entities, but skip 99% of them randomly (either using a PRNG or by checking their hashcode mod prime).
Maintain a list (a copy, really) of all relevant entities inside an EntitySystem using Engine#addEntityListener() and then process 1% of the list every 100ms by sequentially stepping through it, and wrapping around when reaching the end. (Uses LibGDX's unordered Array so removals are cheap).
Same as 4., but rely on Engine#getEntitiesFor and just let Ashley handle ordering and tracking entities instead of keeping a separate list.

At the moment, #1 and #5 seem most promising. #1 seems to meet all my requirements, but is a bit pervasive (creating and adding a bunch of components), #5 is less pervasive, but doesn't meet the requirements quite as well (#2 and #3 mostly).

Thoughts? Is there something better than these?

sentences:
Mesh from MagicaVoxel cast a strange holed shadow I have a problem with any mesh I import from MagicaVoxel into Unity. As you can see from the screenshot below, the mesh on the left cast a shadow that has holes in it. That's a basic 7-voxel mesh exported as OBJ and dragged into Unity. The light is the standard directional light Unity automatically creates in an empty scene. The glitch occurs in scene editor, preview and exported builds, I tried on multiple PCs as well.

The mesh on the right is a cube extruded on all faces created in Blender and exported as 3DS. As you can see from the wireframe, it is basically the same mesh, but its shadow looks good. Note that if I import the MagicaVoxel's OBJ in Blender first, and then I export in 3DS and into Unity, the shadow stays holed, so it's not a problem with the mesh format, but with something in the mesh itself.

What can it be? Can I solve it somehow or try some others approaches? Thank you.

sentences:
How do I call OpenGL methods that require pointers in C#? I have found the following C++ code in this tutorial to draw a triangle with OpenGL 4:

float points[] = {
   0.0f,  0.5f,  0.0f,
   0.5f, -0.5f,  0.0f,
  -0.5f, -0.5f,  0.0f
};
GLuint vbo = 0;
glGenBuffers (1, &vbo);
glBindBuffer (GL_ARRAY_BUFFER, vbo);
glBufferData (GL_ARRAY_BUFFER, 9 * sizeof (float), points, GL_STATIC_DRAW);

I use C# and OpenTK, so I tried to translate the code:

        float[] points =
        {
           0.0f,  0.5f,  0.0f,
           0.5f, -0.5f,  0.0f,
          -0.5f, -0.5f,  0.0f
        };
        uint[] vbo = {0};
        GL.GenBuffers(1, vbo);
        GL.BindBuffer(BufferTarget.ArrayBuffer, vbo[0]);
        GL.BufferData(BufferTarget.ArrayBuffer, 9 * sizeof(float), ppoints, BufferUsageHint.StaticDraw);

The problem is that GL.GenBuffers() and GL.BufferData() require pointers (Visual Studio shows *int or out int and ref float*, IntPtr).

I've tried to fix this, but it didn't work:

        float[] points =
        {
           0.0f,  0.5f,  0.0f,
           0.5f, -0.5f,  0.0f,
          -0.5f, -0.5f,  0.0f
        };
        uint[] vbo = {0};
        GL.GenBuffers(1, vbo);
        GL.BindBuffer(BufferTarget.ArrayBuffer, vbo[0]);

        unsafe
        {
            fixed (float* ppoints = points)
            {
                GL.BufferData(BufferTarget.ArrayBuffer, 9 * sizeof(float), ppoints, BufferUsageHint.StaticDraw);
            }
        }

So my question is how to use these methods in a good C# style?

sentences:
How important is online multiplayer? I am making a small game that has four players. It can be played with 1 or 2 players locally, with the remaining players controlled by AI.

I am considering online play, but it is an area I know very little about, so it will take a lot of study and work to put it in. I am using my own engine, so I would have to implement it myself, or at least search around for a free library, learn its API, and probably rearrange several of my data structures and methods to make it work. Then I would have to implement lobby screens and possibly backend stuff (I have a little php experience but not a lot).

My question is, is it really worth it? Of course it would be nice to have, but do players expect it these days? I imagine people expect it for big budget games, but how about small indie games?

sentences:
Get closest Child to cursor I'm currently rewoking my RTS cover system. This should highlight the closest coverspots from my mouse cursor and sent the units to these locations. everything works, but I can't get the closest sport, it always selects the sames ones, regardless to the mouse position.

These cover spots are child objects of the obstacle, that has this script attached.

This is my not working implementation of the idea:

 void Update()
    {

        var dist = Mathf.Abs(transform.position.z - Camera.main.transform.position.z);
        var v3Pos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, dist);
        v3Pos = Camera.main.ScreenToWorldPoint(v3Pos);
        mousePos = v3Pos;
}

...

public void getPointDistances()
    {
        foreach (CoverPosition pos in coverPositions)
        {
            if (!pos.occupied)
            {
                pos.distanceToCursor = Vector3.Distance(pos.transform.position, mousePos);
            }
        }
        Array.Sort(coverPositions, delegate (CoverPosition x, CoverPosition y) { return y.distanceToCursor.CompareTo(x.distanceToCursor); });

    }

Later, I simply Iterate over the sorted array and make it visisible.

I'm woking on this for hours, but i cannot find, a solution why it always displays the same cover spots.

I hope, someone can find my (possibly stupid) error.

Edit:

I also tried this, but tata returned always the same values, regardless of my mouse positioning:

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
            mousePos = hit.transform.position;

sentences:
How to make a layered health bar in GML I am currently working on a game in Game Maker Studio 2 where the player character is capable of increasing their maximum health beyond a starting value of 30, by increments of 10. I want to represent this graphically by adding a different-colored overlay to the character's health bar for each additional 10 points added, with the last layer added diminishing before the ones behind it, proportional to how much of the last "extra" 10 points remains.

If you are familiar with the Mega Man Zero games, and how some bosses in that game had extra health represented in "layered" health bars that decremented independently of and sequentially to each other, I am basically trying to make that, just using a different health increment for all layers beyond the first.

So far I can get the first layer to work out just fine:

draw_sprite_ext(sprite931, -1,0,0,(min(30, hp_current)/30),1,0,c_white,1);

but I am having some difficulty calculating the xscale argument for the layers representing hp_current values 31-40, 41-50, 51-60, etc. without causing visual glitches.

To summarize, I need the gauge to remain full if the player's current HP is equal or greater than its respective range's maximum, be empty if it is less than its increment range's minimum, and scale between empty and full proportional to where hp_current lies between said layer's maximum and minimum values. I am having trouble figuring out how to make each layer do this independently of each other. Does anyone else have experience with making something similar to this work?

sentences:
Why is it possible to encounter a texture coordinate greater than 1 or less than 0 I'm studying a text about texture mapping and in the preparing to draw session, I read:

Define the texture wrapping parameters. This will control what happens when a texture
coordinate greater than 1.0 or less than 0.0 is encountered:

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,wrap);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,wrap);

where wrap is:
GL_REPEAT : specifies that this pattern will repeat (i.e., wrap-around) if transformed texture coordinates less than 0.0 or greater than 1.0 are encountered.

GL_CLAMP : specifies that the pattern will “stick” to the value at 0.0 or 1.0.

But there's no explanation what is the reason of encountering such texture coordinates?
For example suppose that I have just drawen a rectangle and I want to apply an image as a texture on it, is it possible to encounter such coordinates?

sentences:
How to draw a smooth circle in Android using OpenGL? I am learning about OpenGL API on Android. I just drew a circle. Below is the code I used.

public class MyGLBall {

private int points=360;
private float vertices[]={0.0f,0.0f,0.0f};
private FloatBuffer vertBuff;

//centre of circle

public MyGLBall(){

    vertices=new float[(points+1)*3];
    for(int i=3;i<(points+1)*3;i+=3){
      double rad=(i*360/points*3)*(3.14/180);
      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float) Math.sin(rad);
      vertices[i+2]=0;
    }
      ByteBuffer bBuff=ByteBuffer.allocateDirect(vertices.length*4);
      bBuff.order(ByteOrder.nativeOrder());
      vertBuff=bBuff.asFloatBuffer();
      vertBuff.put(vertices);
      vertBuff.position(0);

}

public void draw(GL10 gl){
    gl.glPushMatrix();
    gl.glTranslatef(0, 0, 0);
//  gl.glScalef(size, size, 1.0f);
    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();
 }

 }

It is actually taken directly from here
The circle looks pretty good. But now I want to make the boundary of the circle smooth. What changes do I need to make to the code? Or do I need to use some other technique for drawing the circle?

Thanks.

sentences:
How to randomize Motion/animation without create a state for each animation? I'm using Animator and state for animating my charachter.

So, i've (example) an Idle state, associated to an Idle motion animation , and a Death State, associated to a Death animation.

But I've 5 possible animation for death so i would like to randomize death animation without create a state for each animation.

My State "Death" has a "Motion" variable. I would like to change at runtime this  "motion" variable. Is it possible ?

Thanks

sentences:
How should I handle exceptions in libGDX? I want to keep my game running as much as possible for the user, obviously. They would be dissapointed if the game suddenly quits without leaving any notice behind, and it would be difficult for them to reproduce the error so I can fix it.

So when an exception is thrown, say, an ArrayIndexOutOfBoundsException, how should I handle it?

My current flow goes: DesktopLauncher > MyGame > Menu Screen / Game Screen / other screens

sentences:
How are character creators/customizers done in other games?(Reference images inside) Possible Duplicate:
What techniques could I use to give players the ability to control certain features, e.g. fatness?

How are character creators(usually seen in RPGs) done?
Such as, the ability to change almost anything on the character, ranging from the size of the nose to overall height.
Sims also has a fairly indepth one, but I can't find a good screenshot of it.
Do they just store a lot of sub-objects for the body and scale them based on preferences? How would that affect things such as animation, and texturing?

sentences:
3D line segment AABB collision, with hit normal? I'm embarrassed I can't find this, but I'm wanting to detect intersection with a 3D line segment (not an infinite ray) with a 3D AABB, the AABB being defined as two Vec3f's which represent the Min and Max extents.  So the AABB can be arbitrarily-sized.  I also need the surface normal of the AABB, if there was a hit.

From looking at similar algorithms I at least know it seems good to calculate the inverse direction of the line beforehand, at least, if you're needing to check against multiple AABBs per frame.

I have

struct AABB
{
    VEC3F min;
    VEC3F max;
};

// a and b representing start/end points of the line segment
// returns true if intersects, also fills out "normal" if true
bool LineIntersectsAABB(const VEC3F& a, const VEC3F& b,
    const VEC3F& inv_dir, const AABB& aabb,
    VEC3F* normal);

The implementations I've found either do not find the hit normal, and/or they're intended for boxes/cubes where the three dimensions of the box are always equal length, which doesn't work for me.  Implementations seem to vary greatly, which is confusing for me (since I'm still trying to learn it), and, considering that I need the hit normal, I'd imagine that that may rule out certain implementations.

sentences:
Collision Managers and bitmaps I am rewriting a game I made to use a (custom) collision manager that uses the minimum displacement method. As of now, my simple manager can only recognize and act on a couple of shapes - Circles and AABB's. Those were pretty simple to implement, but I've run into a problem: My game also needs to be able to have bitmaps that the player (represented by an AABB) can interact with, such as the one below:

I have a couple of questions:

1) Does it make sense to have a shape BitmapShape, which does collision detection at the pixel level and searches outward in the bitmap for a place to move intersecting objects to? In the image above, it would make sense to check the players bottom-center coordinates against the bitmap of the hill, but you can imagine that this would provide odd results for an intersection from the top of the player.

2) How could any system like this allow for a rectangle to move up a hill? Wouldn't an minimum-displacement based method always move the rectangle backwards down a hill?

Thanks

sentences:
Should Starting a Quick Game via Google Game Services be Iterated? I have been following this tutorial for Google Play Game Services.  I am a little unclear as to if the room matching algorithm should be looped or not.  Can I just initialize this process once and let it time out?  Or by iterating through it is it somehow rechecking it?  If anyone had the approximate timeout that would be great as well.

The problem stems from the fact that even when both phones are signing into the Game Services (at virtually the same time, my friend and I logged in), the room is not registering multiple people.  One time my friend's phone even entered the game map, showing that he somehow was able to progress from the room initialization process.

Relevant screen update methods which I am starting this matchmaking process:

@Override
public void update(float deltaTime)
{
    game.options.updateTiles();

    if(!isInitiated)
    {
        startQuickGame();
    }
}

private void startQuickGame()
{
    // auto-match criteria to invite one random automatch opponent.
    // You can also specify more opponents (up to 3).
    if(game.mGoogleClient.isConnected() && !isInitiated)
    {
        Bundle am = RoomConfig.createAutoMatchCriteria(1, 3, 0);

        // build the room config:
        RoomConfig.Builder roomConfigBuilder = RoomConfig.builder(Network.getInstance());
        roomConfigBuilder.setMessageReceivedListener(Network.getInstance());
        roomConfigBuilder.setRoomStatusUpdateListener(Network.getInstance());
        roomConfigBuilder.setAutoMatchCriteria(am);
        RoomConfig roomConfig = roomConfigBuilder.build();

        // create room:
        Games.RealTimeMultiplayer.create(game.mGoogleClient, roomConfig);

        // go to game screen
        this.mRoom = Network.getInstance().getRoom();
        if(this.mRoom != null && this.mRoom.getParticipants().size() >= 2)
        {
        game.setScreen(new MultiGameScreen(game, this.mRoom));
        isInitiated = true;
        }
    }
    else
    {
        game.mGoogleClient.connect();
    }
}

sentences: Adjusting a skeleton to a Specific Stance Imagine having a climbing wall and you take 4 adjacent handholds and footholds where  together they create a stance. Is there any algorithm or technique with which it would give you a realistic human pose? Currently im adjusting the skeleton by firstly finding the center of the 4 holds where then i construct the chest shoulder and pelvis accordingly. And by the use of IK i give position to the remaining limbs being which the arms and legs. Is there any other more elegant/better technique how to do such positioning of a skeleton ? As how i am adjusting the skeleton isnt so much of a realistic pose.All is done in 2D

sentences: How do I maintain an online users list? In a multiplayer JavaScript game client, is it a good idea to poll the server periodically to refresh online user list, or keep track of joined/left users? Is there a better option?

sentences:
Is it better to hard code data or find an algorithm? I've been working on a boardgame that has a hex grid as this board:

Since the board will never change and the spaces on the board will always be linked to the same other spaces around it, should I just hard code every space with the values that I need? Or should I use various algorithms to calculate links and traversals?

To be more specific, my board game is a 4 player game where each player has a 5x5x5x5x5x5 hex grid (again, the image above). The object is to get from the bottom of the grid to the top, with various obstacles in the way, and each players being able to attack each other from the edge of their grid onto other players based on a range multiplier.

Since the players grid will never change and the distance of any arbitrary space from the edge of the grid will always be the same, should I just hard code this number into each of the spaces, or should I still use a breadth first search algorithm when players are attacking?

The only con I can think of for hard coding everything is that I'm going to code 9+ 2(5+6+7+8) = 61 individual cells. Is there anything else that I'm missing that I should consider using more complex algorithms?

sentences:
Rendering objects with either normal maps, either specular maps, or with both, or with neither? My hobby engine has a deferred renderer that supports normal maps and specular maps. Now, some objects may have normal maps, and some may have specular maps. In some cases, an object has both maps, and in some cases, it has neither.

The question is: how should I implement the rendering of these objects? Should I have a render queue for each different object type and render them with separate shaders like this:

Queue A: Objects without normal and specular map
Queue B: Objects with normal map, without specular map
Queue C: Objects without normal map, with specular map
Queue D: Objects with both normal map and specular map

// Render loop
bind shader for type 'A' objects
for each object in Queue A:
    render object

bind shader for type 'B' objects
for each object in Queue B:
    render object

// and so forth...

Or, should I use a single shader and bind a "default" normal map and specular map for those objects that do not have such maps? By a default map, I mean for example a normal map texture that's completely colored (128, 128, 255). This would be something like this:

bind shader
bind default normal map texture
bind default specular map texture

for each object in Queue A:
    render object

for each object in Queue B:
    bind object's normal map
    render object

bind default normal map texture
for each object in Queue C:
    bind object's specular map
    render object

for each object in Queue D:
    bind object's normal map
    bind object's specular map
    render object

Basically, the first approach would involve less texture binds and more shader binds, whereas the second approach would be the opposite. Is either of these a preferred way to approach the problem? Or have I missed something completely here?

You can assume the objects are queued correctly to the queues.

sentences:
How can I add solid collideable borders to the viewport regardless of the resolution? I'm making a game in Unity. In my game I have a sphere, what I need is for the sphere to rebound against the edges of the viewport.

For that I used a few Gameobjects with 2D box colliders.

The problem is that when game resolution changes, the edges of the camera are extended or reduced, and empty gameobjects are not on the edge.

How can I make gameobjects which always stay on the edge of the viewport?

Is this the correct way to make it bounce at the edges?

sentences:
In SDL, what is the difference between using a Surfaces and a Renderer? I am new to SDL and I've been following some tutorials; in one tutorial he used Surfaces (a window surface and image surface) and a BlitSurface function to draw images without using any renderer (used SDL Image library for JPG, PNG etc.).
And in another tutorial, he used a Renderer.
What's the difference between those two? It seemed to me they do the same thing but I'm assuming if they were the same, one wouldn't exist.

sentences:
Does it makes sense to apply perspective projection, in a 2D game? Does it makes sense to apply perspective projection, in a 2D game? What will be the cost for doing so, and does it overweigh the benefits gained from the 3rd dimension?

Perspective projection has features that could be used in 2D games. Two very beneficial characteristics that come to my mind are:

Using perspective projection as a substitute for parallax scrolling.
Using perspective projection to perform depth order for 2D sprites

On the other hand, perspective projection resizes objects with distance, including 2D sprites. That is why mip mapping has been developed. Mip mapping, however, does not always produce perfect results, as it relies on interpolation between two neighboring mip-mapped frames. This might not be sufficient, for a 2D game, where developers require pixel-based precision and detail.

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:
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:
How can I set my application to run on the High performance GPU by default? Nowadays a good deal of laptops come with 2 GPUs - a high-performance one and a power-saving one (less powerful). Most of the application, which I use on my laptop run with my integrated(power-saving) GPU, but still some of them are set to open with the high-performance card. I am trying to config the app which I am building to run on the high performance GPU by default, but I can't find any information about the topic anywhere. I hope that someone can shed a bit of light onto this. I will distribute my application with an NSIS installer and I guess that I'll have to add the path of my application to a list of applications for NVidia/ATI cards. The application is programmed in C#. Also, does anyone know how things stand with desktop PCs? What happens if a PC has 2 GPUs and I have to choose the more powerful one?

Milcho

sentences:
How do I change color of one part of sprite in Game Maker? I want to generate a competitive game like Age of Empires where each player has access to a variety of units, and each player can be distinguished by a color in each unit

And instead of sprites create 8 different colors, would have only one, with a mark where that color is changed, for example:

How do I change color of one part of sprite in Game Maker?

sentences:
Creating addons for any game? I want to be able to create addons for any game, the example I will use is League of Legends. With addons I mean, for example when my level integer changes I want to play a sound in the background.

The programming language I want to use is C#.

What I want to know is how I'm able to read my level integer inside C#, from there on I should be able to do anything I want.

What I've found out is, with a program like Cheat Engine you can look for memory values and adresses inside your RAM. And I think there is a way to assign a variable in C# to the value of a memory adress. But how can I find the value of my level in the first place? The memory adress might change each time I start the game or even level up. I think it has something to do with pointers, but where do I find the pointer?

But the biggest problem is that I can't even find some values I look for iside the memory. Maybe it encrypts the values? How can I find out what it does and where it puts it? An example is Flash games. If you look for the variable money that has a value of 100 you need to multiply it by 8 and look for 800 iside the memory of that process.

How do I find the correct memory adress each time?
How do I find out the way it might save a variable?

I'll give any extra information about the problem if you want.

sentences: Design Document Contents What is the minimum content that a game design document should have?

sentences:
How to design simple turn based combat system with multiple difficulties? I am developing a small, turn-based game with spaceships.
The user-controlled spaceship has two modes, let's call them offense and defense mode. The user can freely switch between modes.
There are three types of enemy-ships.
Whenever the user's ship meets one or more enemy-ships, a fight calculation should take place, which can have exactly two outcomes: either the user's ship wins (and does not carry away any damage), or the game is over.
Encounters are kinda, but not completely random so one can expect a certain enemy and change the mode accordingly.

For reference, multiple enemy encouters at once might happen, and as a rough idea, the userShip usually is expected to lose if it has to fight 2-5 enemies.
Like 2 are too much, if the active fight mode is disadvantageous, whereas the userShip can win against up to four ships, if the mode is advantageous.
For encounters with multiple enemy types, the numbers shall be somewhere in between.

My requirements for the combat system are:

completely deterministic
one mode must not be clearly superior to the other mode. Ideally, one mode is advantageous against a certain enemy type, while the other mode is advantageous against another enemy type (not sure what to do about the third enemy type though)
must be somehow scaleable, i.e. there should be three difficulty settings which shall be taken into account.
ships have three attributes: Attack, Defense, Speed (however, this isn't set in stone and could be changed at will)

My best idea so far:

assign each ship type base stats (Attack/Defense/Speed, floating point numbers):

userShip:  (10/10/10)
 enemy 1:   (5/10/15)
 enemy 2:   (15/5/10)
 enemy 3:   (10/15/5)

create a modifier-table that multiplicates the userShip baseStats with a multiplicator depending on a) userShip-mode and b) enemyShip-type.
have the combat system compare each of the three stats (if multiple enemies involved, their combined strength), and depending on the difficulty setting, the userShip wins if the difference of at least 2 of the 3 attributes is smaller than . That way, I would have the scalability.

However... I was unable to design the modifier table in a way that the modifiers actually make a noticeable difference AND the user has an incentive to switch between modes when he expects a certain enemy in the next turn.

The biggest problem is the nature of the binary combat outcome. This makes it that the floating point multiplicators neglegible most of the time.

Also, I feel like I have way too many parameters (fight mode, attack, defense, speed, difficulty-setting, modifier) for such a simple calculation, but I cannot really remove any other than the modifier, and they all should be at least a little bit relevant for the combat outcome.

Also, I'm not sure how to deal with the third ship type, as there only are two modes. If the mode does not matter at all, that's poor design I think. I could add a third mode for the userShip, however that would introduce even more parameters for the combat. Unsure about that.

Any ideas how to design a combat system under these conditions?

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 does 2D Game Physics work? Possible Duplicate:
  How do I build a 2D physics engine?

If we take the game Angry Birds that had big success lately I were thinking how do they implement the physics in a game like that?

Your are shooting of your birds and they hit something that will fall off and in turn creating a chain reaction of things either falling or exploding.. Are all this happening with calculations with rules considering all collisions together with gravity etc.?

sentences:
How to add local multiplayer feature in a game using bluetooth? I have developed a turn based game using android studio.I want to add local multiplayer feature to it. Don't need a detailed explanation, I need some idea about the following aspects:-

Do I need a thread for each client?

How can the server identify a client?(Which client device is sending the information or pressing a button)

I saw the code of bluetooth chat application. In that code, only two devices can communicate with one another. But my game has to be played with four players and I can't figure out a way to connect and communicate among four devices.

sentences:
Möller-Trumbore false positive I've implemented the Möller-Trumbore algorithm but I hit some false positive:

Ray: vec3(2.100000, -1.000000, 3.314214), vec3(0.685786, -1.000000, 1.900000)
Collide with: vec3(1.000000, 1.000000, -0.999999), vec3(0.999999, 1.000000, 1.000001), vec3(1.000000, -1.000000, 1.000000))
uvt=vec3(0.435307, 0.198000, -1.603999)

If I draw the collision, I see clearly that the ray does not intersect with the triangle.

From this site: http://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection
I wrote this code:

bool Node::rayIntersectTriangleDebug(const glm::vec3 orig, glm::vec3 dir
                       , const glm::vec3 vert0, const glm::vec3 vert1, const glm::vec3 vert2
                       , glm::vec3 &result)
  {
    //dir = glm::normalize(dir);

    const glm::vec3 edge1 = vert1 - vert0;
    const glm::vec3 edge2 = vert2 - vert0;
    const glm::vec3 pvec = glm::cross(dir, edge2);
    const float det = glm::dot(edge1, pvec);

    const float Epsilon = std::numeric_limits<float>::epsilon();

    if (det > -Epsilon && det < Epsilon)
      return false;

    const float invDet = 1.0f / det;

    const glm::vec3 tvec = orig - vert0;

    result.x = glm::dot(tvec, pvec) * invDet;
    if (result.x < 0.0f || result.x > 1.0f)
      return false;

    const glm::vec3 qvec = glm::cross(tvec, edge1);

    result.y = glm::dot(dir, qvec) * invDet;
    if (result.y < 0.0f || result.x + result.y > 1.0f)
      return false;

    result.z = glm::dot(edge2, qvec) * invDet;

    const float abs = std::abs(result.z);
    const float dist = std::abs(glm::distance(orig, dir));

    const glm::vec3 intersection = vert0 + result.x * edge2 + result.y * edge1;

    if (abs < dist)
      {
         return true;
      }
     return false;
  }

Also I'm not sure if I have to normalize my direction vector.

EDIT

I've red here that

  I'm not sure if it should be normalized or not, but tests I've
  conducted over a normalized version yelded valid results

I've tried to normalize my direction with the following code without success:

const glm::vec3 dir = glm::normalize(officialDirection - orig);

sentences:
Storing and using UV and Normal Data with OpenGL I'm having trouble mapping UV coordinates to vertices in OpenGL. I'm binding my buffers and enabling all of my attrib arrays perfectly well and things are rendering - but what I'm stuck on is how to map UV and Normal data.

You can't just store UV and Normal data with the Vertex data, because obviously you'll be re-using vertices, but not necessarily with the same Normal or UV.

For clarity this is the general flow of what I'm doing at the moment:

I bind my shader program.
I bind my vertex array buffer with GL.BindBuffer
I Bind my element buffer with GL.BindBuffer
I use GL.Uniform (1, 2, 3 or 4) to bind values to my uniform variables
I enable all of my vertex buffer attributes with GL.EnableVertexAttribArrau and then encode their layout using GL.VertexAttribPointer
I draw using GL.DrawElements
I disable all of my vertex attrib arrays again

I'm totally stuck on how to encode UV and Normal data to my vertex attributes. Do I need to use a second buffer? If so; how does OpenGL know to use a different set of indices to find them? I'm totally lost and any help would be greatly appreciated.

sentences:
Is there any way to convert .unr file? I'd like to examine a Harry Potter game for study purposes.
All of resources are fine except map file.
The maps are in a .unr file format. I know it is unreal map file.

Is there any way to convert .unr file to .fbx, .obj, or pskx formats?
I want to open map file to 3ds max or blender.

sentences:
How to use Audio Profiles in Cocos2d Ver 3.3 AudioEngine I have 2 audio files that I want to play at different times: background.wav a sneeze.wav.  I believe that I have to convert both wav files into mp3, caf and ogg files.  Then I do this:

static const int FILE_COUNT = 2;
std::string _audioBackgroundFiles[FILE_COUNT];
_audioBackgroundFiles[0] = "background.mp3";
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
    _audioBackgroundFiles[1] = "background.caf";
#else
    _audioBackgroundFiles[1] = "background.ogg";
#endif

for(int index = 0; index < FILE_COUNT; ++index){
        auto id = AudioEngine::play2d(_files[index], false, 1.0f, &_audioProfile);
}

I don't understand how to create an audio profile?  Do you create a profile for every sound?  I'm very confused.

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:
One side of every object is black I'm trying to make a driving game in Unity, but recently have been having lighting issues.

When I was first building it, the lighting worked fine. However, recently, one side of everything (the indirect lighting side) has turned black.

Here's an image of the issue.

I've tried changing my lighting settings, but can't seem to fix it. Here are my lighting settings.

What can I do to fix this? (I am using Unity 2017.2.0f3)

sentences:
Event/Trigger System Architecture The Plan

I am up to write write an own Trigger/Event System, an event engine or how you call it. I would like to achive something similar to Blizzard's most level editors, like Starcraft 1-2, Warcraft level editors.
They are all kind of event/trigger based, you can set actions, conditions which actually control the gameplay itself. What do you think, what would be the best architecture for this event/trigger system?

The Architecture

I thought it would look something like this:

EventManager - would handle the events, checking if the conditions
meet for any event,
                  and calls the event if so.
EventHolder - would hold the list of the events.
EventEntity - would have an ID, the actions' ID and the params for
them.

Every entity, enemies, player and other stuff would have an ID in the world, which would help to get the entity itself and fire a trigger on it.
Obviously, there would be finit and pre-set BASIC actions, but that would be stored by the current project itself. The project could pass the EventSet (list of EventEntity) to the EventHolder. Thus this whole event/trigger system would be very flexible, and could compile it as a DLL for use in future projects.
Do you have any better solution for this? Or some pro tips that I could use? Would really appreciate any help! Thanks!

Edit:
This picture shows it quite well:

Edit2:
I have wrote a raw architecture of a possible "engine", but it is missing some MAIN points:

{Initializing}

//in order
[Game]--set event list--[EventManager]--requests list of EventEntity--[Game]--sends list of EventEntity--[EventManager]

{EventManager loop}

[EventManager]--checks if any of the events meet in an EventEntity
[EventManager]--if any meets--[EventManager]--checks if all of the conditions are meeting in the EventEntity
[EventManager]--if all meets--[EventManager]--fires actions of the EventEntity

{Architecture of the Models}

[EventEntity] contains
- [List of Event Models]
- [List of Condition Models]
- [List of Action Models]

[EventModel] contains
//quite similar to the ConditionModel, an event only should fire, aka check the conditions and
//fire the actions, if these special conditions, happenings, events are fired
//like a unit dies, player reaches a specific position, etc.

[ConditionModel] contains
//model must simulate AND, OR logic statements
//model must simulate IF statements

[ActionModel] contains
- [List of Targets]
- [List of Action IDs] //One action per Target, a specific Target can be listed more than once in the [List of Targets]
//something is missing

Trying to write the "system" as standalone as possible, it must not depend on any project's source. Thus I think the best would be to seperate the data from the architecture, could store the event, condition and action datas in another DLL unit, and could read from that.

sentences:
How to set orthographic camera for libgdx I have implemented a basic demo of camera but it is not showing any sprites on screen.
I cannot figure out what's wrong with my code.

public class MyGdxGame extends ApplicationAdapter {
    private int width, height;
    private OrthographicCamera camera;

    private SpriteBatch batch;
    private Texture roboTex;

    private Sprite roboSprite;

    private World world;

    private Body robot;

    @Override
    public void create() {
        width = Gdx.graphics.getWidth();
        height = Gdx.graphics.getHeight();

        world = new World(new Vector2(0, 0f), false);
        camera = new OrthographicCamera();
        camera.setToOrtho(false, Constants.viewportWidth,  Constants.viewportWidth *(height/width));
        camera.update();
        batch = new SpriteBatch();

        //textures
        roboTex = new Texture("Images/robot.png");
        roboSprite = new Sprite(roboTex);
        roboSprite.setBounds(0,0,3,6);

    }

    @Override
    public void render() {
        batch.setProjectionMatrix(camera.combined);
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        batch.begin();
        roboSprite.draw(batch);
        batch.end();

    }

    @Override
    public void resize(int width, int height) {
        float screenAR = width / (float) height;
        camera.setToOrtho(false, Constants.viewportWidth, Constants.viewportWidth/screenAR);
        camera.update();
        batch = new SpriteBatch();
        batch.setProjectionMatrix(camera.combined);
    }

    @Override
    public void dispose() {
        world.dispose();
        roboSprite.getTexture().dispose();
        batch.dispose();
    }

}

Did I missed anything??

sentences:
Moving character controller on twisted track I am trying to move a ball using Unity's character controller component. I want to move the ball along the twisted track so that it can go upside down.
Below is the video of the problem when moving using Unity's Character Controller:
https://gfycat.com/dismalaridjoey
I want the ball to move upside-down along the twisted track.
I have the following questions:

What kind of modifications are required to achieve this using a
character controller?
Which other methods (physics or splines) can be used to implement such ball movement? I am flexible to switch the appraoch.

I would appreciate any suggestions and thoughts on this topic. Thank you.

sentences: Materials when rendering geometry When specifying the material (ambient/diffuse/specular) for use in lighting calculations, what level of detail is the material specified at? Per vertex, mesh, bone?

sentences:
How to change color of text in canvas in phaser.js? I want to change the text color in my game that is build in phaser.js. But i have no idea how to do this, because i am not a coder.

Can somebody help me to change the color of my game text?

My Game is http://games.eyebraingym.com/slotreading/

I want to change the color on the canvas where the heading is 'Slot Reading'.

sentences: How to create particle system by script I have created a gameObject called "Sphere". After 5 secs the gameobject starts rotating. Along with the rotation I need to emit partical from the object. How can I do this?

sentences:
Simple browser game help As my first "real" project, I'm working on a game that I intend to be single-player, web-based, and primarily in text. I need the ability to save choices the players make, and to have certain variables increase based on those choices. (Like bravery increasing after a heroic choice is made, for example.) There's a very small inventory; not RPG-style elaborate. The big thing about it is the choice aspect; every choice impacts where the player can go/future success or failure in other situations/etc. So I really have to be able to save those. (Choice input was being done by simple buttons, but I'm not married to that.) I'd like the player to be able to close the browser, then come back to it later where they left off- so, a login system, too.

My biggest problem is that I feel like I'm getting jerked left and right on which language(s) to use for this. I started off with Python a few months ago and started getting comfortable in that, but then didn't like how hard it was to integrate it in to a website afterward. (Hard for me, anyway. I might just be stupid, or failing to find the right tutorials on it.) I got a book on Javascript ("The Good Parts"), but found it unhelpful for what I was trying to do and my skill level. Then I got a book on PHP and MySQL ("PHP and MySQL Web Development") and started getting used to that, thinking it would be useful for saving player choices, but now all I see when I google specific questions about mySQL with games is people saying, "You don't want to use MySQL for games." So have I been wasting my time on that?

What language would you use for a single-player web game that was text-based and had to save many player choices? Or was I already going the right direction to start with?

sentences:
Advices on Linking Between Entity Component System in C++ After reading a few documentation about entity-component system, i decided to implement mine. So far, I have a World class which contains the entities and the system manager(systems), Entity class which contains the components as a std::map, and a few systems. I am holding entities as a std::vector in World. No problem so far. What confuses me is the iteration of entities, i can't have a crystal clear mind on that, so i still can't implement that part. Should every system hold a local list of entities which they are interested in ? Or should I just iterate through the entities in the World class and create a nested loop to iterate through systems and check if the entity has the components the system is interested in ? I mean :

for (entity x : listofentities) {
   for (system y : listofsystems) {
       if ((x.componentBitmask & y.bitmask) == y.bitmask)
             y.update(x, deltatime)
       }
 }

but I think a bitmask system will kinda block flexibility in case of embedding a scripting language. Or having local lists for each system will increase memory usage for classes. I am terribly confused.

sentences:
Selecting a range of hex tiles within radius of main tile What I'm doing is pretty new to me, or at least I think it is, so I'm not really sure of what I'm looking for. Hopefully someone here knows =-)

Using a grid of hexes I generate, I can hover over any tile and it will highlight just fine. Now what I'm trying to figure out is how to allow for a radial selection of tiles around that hovered tile (brush size, basically), eventually allowing for a somewhat radial soft-selection gradient to allow falloff.

Each hex already knows about their neighbors, so currently I am hard-coding logic to handle a radius of 1, 2 or 3. I could duplicate that logic over and over to handle bigger radii but this is definitely not going to work for much longer, so I am trying to figure out a more efficient and cleaner way using loops/recursion/whatever.

Can anyone offer any pseudo-code or possibly a link that explains how to do this? Below is a (probably bad) attempt at what I think it would look like.

OnMouseOver(){
    // This would select a radius of x hex tiles including center tile
    this.SelectTile(3);
}

SelectTile(selectionRadius){
    if(!this.alreadySelected){
        this.Select();
    }
    for(int i = 0; i <= selectionRadius; ++i){
        if(i < selectionRadius){
            foreach(HexTile tile in thisTile.neighbors){
                tile.SelectTile(selectionRadius - i);
            }
        }
    }
}

Edit: I'm using this fantastic resource to help with hexes - http://www.redblobgames.com/grids/hexagons/ - so might there be a section on this page that may explain what I need and I'm just missing?

sentences:
How can I compile and distribute a Torque2D game as an executable? Is it possible to compile a Torque2D into a executable rather than having to run Torque2D.exe from the project folder (where all the modules and  artwork are)?

What would be the normal procedure to distribute a game written with Torque2D?

sentences:
Are there any good techniques for reducing or smoothing stutter after a longer frame? I've been using SDL2 with OpenGL to play around with some very basic game engine development. I'm running everything on a newer laptop with Linux and Intel integrated graphics.

Regardless of whether I have VSync on or off, occasionally a call to SDL_GL_SwapWindow (glxSwapBuffers under the hood) will take ~22-33ms which causes a noticeable stutter in any moving sprites. These long frames happen even if the game loop contains nothing but a call to glClear followed by SDL_GL_SwapWindow, so I'm assuming this is just due to everything running on a relatively underpowered system (and I don't see the long frames or stutter on my desktop with dedicated graphics).

I would have given up here and left it at the laptop not being cut out for OpenGL, but when I look at some indie games running on the same laptop, I'm unable to notice any of these stutter effects leading me to believe there may be a way to eliminate them (or that I'm doing something wrong). A few of the indie games were built with Monogame and at least one is also using SDL2 and OpenGL. I used apitrace to look at the OpenGL calls being made by these games and nothing looks very different from what I'm doing.

I then spun up a very basic Monogame project on my own machine, but still experienced the long frames and sprite stutter. I've tried different variations of fixed and variable game loops / timesteps as well as deltatime averaging to try to smooth over longer frames, but I still have a noticeable stutter.

Is there anything else I can do to eliminate the stutter or the long frames?

sentences: Can I always assume that fixed time step in Unity is reliable? I was thinking about games on low end machines or phones where the CPU would be limited. If I were to move all of my game logic into FixedUpdate() can I assume that it will always be called with the same time delta? Or would it still be worth adding code to make it take the actual time delta into account?

sentences:
How to determine lowest PC requirenments for my game to run so I've created my first game in UE4 (4.9.2 version) and want to publish it. But i really don't know how to determine lowest possible environment my game runs on.Also I am unsure what other files apart from actuall build I should redistribute. I am building game via file->package project->window.

1) How to determine minimum required DirectX version?

2) How to check what other dll's I need to include into installer (apart from actuall build)? For example will I need to install VC redistributable packages? If so then which ones? The same goes with directx.

3) How to determine minimal windows version? This is limited by directx compatibility right? If my game runs on DirectX10 or higher then all OS versions with at least direct10 will be OK?

4) This may seem as stupid question but in which version 64 or 32 bit I should distribute my game? 32 is always better because anybody can run it right?

thanks for Your answers ;)

sentences:
Java - how to reduce iteration loops for enemies I have many places in my code where I'm iterating through the enemies array and it seems to me it could be optimised somehow, but I can't see how it can be done. For example these two loop checks:
private void arc1() {
    for (Enemy e : gs.getEnemies())
        if (e.distanceFromPlayer() < 32 && !e.seen) {
            arc1.setActive(true);
            return;
        }
    arc1.setActive(false);
}

private void arc2() {
    for (Enemy e : gs.getEnemies())
        if (e.distanceFromPlayer() < 24) {
            arc2.setActive(true);
            return;
        }
    arc2.setActive(false);
}

They're both just checking the distance from the player with one having an extra condition and a different distance. Is there a way to combine them into one? I tried doing it but it didn't work correctly.
Will it actually give any benefit performance wise to combine into one in any case? It does look like duplicate code but not sure if there would actually be any performance benefit.

sentences:
How do I generate coins in a pattern? In my game you collect coins (surprise!). At the moment I generate them like this:

Find a random position given a rectangle (eg. the screen size) and generate a coin
Possible positions are left and right of this coin for our next coin

If both are available, choose at random
If a coin exists in one position, use the other
If neither are available skip this step

Do the same for up and down positions of the new coin
Repeat this sequence for all available coins

This works fine but I would like to create custom shapes with my coins like arrows, stars etc. This got me thinking into how I could achieve this. One way I thought of was to use a small texture where each coloured pixel represented the position of a coin. So that a picture like this:

Can be used to generate an array of coin position coordinates in any framework supporting textures. I'm pretty sure this can be done, but was wondering if anyone has tried this or something totally different for generating coins or any other objects in a game. Ideally the game would involve several different textures and choose them at random, and combine this with the random scattering textures from simple algorithms such as the one I have above.

sentences:
How to make only-head rotation in UE4? I've made a character, attached a camera to it and setted input. But now i want only character's head to rotate with mouse, but not a whole character (player capsule rotates with Q and E keys). I tried to attach camera to head socket, but it doesn't work (i think it's a wrong way). How can i do it on C++? Thank you!

P.S.
I know, that it's a stange idea (control like this will be uncomfortable probably), but it's my work-task and i find it very intersting.

sentences:
Unique_ptr game state vs shared_ptr game state I have this (typical) base class:

class GameState
{
 public:
    GameState(){}
    GameState(GameState&& other) = default;
    GameState& operator=(GameState&& other) = default;
    virtual ~GameState() {}

    virtual int getStateID         ()const = 0;

    virtual bool onEnter           ()      = 0;
    virtual bool onExit            ()      = 0;

    virtual void update (Game& game)       = 0;
    virtual void draw              ()      = 0;

    virtual void shutDown          ()      = 0;
}

And this is a state inherited from GameState base class:

class gGameStateSplash : public GameState
{
    static bool firstSplash;
    int msplashID;
    uint32_t splashStart;
public:
    gGameStateSplash     () :GameState(), msplashID(SPLASH), splashStart(0) {}
    gGameStateSplash(gGameStateSplash&& other)
    {
        firstSplash = std::move(other.firstSplash);
        msplashID   = std::move(other.msplashID);
        splashStart = std::move(other.splashStart);
    }

    gGameStateSplash& operator=(gGameStateSplash&& other)
    {
        firstSplash = other.firstSplash;
        msplashID   = other.msplashID;
        splashStart = other.splashStart;
        return *this;
    }
    ~gGameStateSplash    ()                                                 {}

    int getStateID       ()const override { return msplashID; }

    bool onEnter         ()override;
    bool onExit          ()override;

    void update(Game& game)override;
    void draw            ()override;

   void shutDown         ()override;
};

And this 'GameStateMachine' which use states inherited from GameState:

class GameState;
class Game;

class GameStateMachine
{
    std::vector<std::unique_ptr<GameState>>mvGameStates;

public:
    GameStateMachine():mvGameStates(){}
    GameStateMachine(GameStateMachine&& other){ mvGameStates = std::move(other.mvGameStates);}
    GameStateMachine& operator=(GameStateMachine&& other) { mvGameStates = std::move(other.mvGameStates);  return *this; }
   ~GameStateMachine(){}

    void pushState(std::unique_ptr<GameState> pState);
    void changeState(std::unique_ptr<GameState> pState);
    void popState();

    void update(Game& game);
    void render();
    void cleanAndExit();
};

And instance of GameStatesMachine is used by Game class to update game. As you can see neither GameStates nor GameStatesMachine has members too fancy, just a couple of integers and some boolean.
I use VS 2019 and the program does not compile and throws compilation error c2280 pointing to the GameStates vector of GameStateMachine. I have read Microsoft documentation about it as well as several posts in StackExchange. As read, unique_ptr can not be copied and a move constructor must be implemented in order to do it and to avoid the compiler generates one itself and mark it as delete. So i have implemented move constructor in GameState base class and all inherited states classes. Nothing works. I implemented move constructor also in GameStateMachine with the same result.
But if i change unique_ptr to shared_ptr the error vanishes and all compiles and works as expected. I want to use unique_ptr because i think the states are  going to be owned only by Gameclass, so why waste memory using a shared_ptr?. Am i wrong?

sentences:
How can I generate Worms-style terrain? I'm working on a Worms-styled game and want to generate some terrain procedurally. I've previously done a lot of terrain generation using perlin noise, and this is what I started out using for this game. The only problem with it is that it's too simple and boring, giving me some hills but not the complexity I want. I'd like to have features like caves and hanging mountains and I don't mind floating islands and such. Something like this, but even crazier would be ok:

I thought of first generating the terrain using classic perlin noise, then just removing parts to create caves and what not, but I'm having trouble guiding the removal of those parts. Are there any alternatives to generating such a terrain?

sentences:
Unity : apk vs aab for the same scene I'm new to Unity , i use mac os catalina , unity 2019.4 and build for android/mobile.
I downloaded a unity project from internet. It's already in format of unity project. so i just copy it into my unity folder. THere's only 1 scene there. I can load , run and built with no problem. It created 160mb of .APK file. But now i need to bring this project into my other project (let's name it B project ). Basically i only need to bring that single scene (and all its linked assets) into that B project. What is the proper way to do this ?
Last time, what i did was: i export the whole things as package then imported it into my B project. When i open the scene  , i can run and build with no problem. But it create .AAB rather than .APK and size is 300mb (2x of the previous APK). Is this big size become the reason it become AAB ?
Can someone tell me what's wrong ? why the size is doubled when i just build the same scene. Does unity build includes unused asset ? because in B project there's already asset from my other scenes. What is the proper way to do this ?

sentences:
When I use a font in my game, do I have to include its license in the credits? For example, if I use this font from Google Fonts:
https://fonts.google.com/specimen/Open+Sans

This font is licensed under Apache License 2.0
But regardless of the license, if it allows commercial use, do I have to include a notice or the license in the credits? (assuming that I didn't modify the font)

sentences:
Is localisation important for a mobile game with little text? Let's say it's a physics puzzle (Cut the Rope, Angry Birds) or a runner (Crossy Road, Subway Surfers) clone with some gameplay twists. Assume it puts text on some of the few controls: 'Play', 'Sound Volume', 'Level 15' etc. Most labels are accompanied with "standard" icons. Story is communicated with a text-free comic strip. Tutorial is also text-free.

can I publish it to Apple App Store and Google Play Store to every market while using English labels or it will be rejected?
will sales be affected a lot or negligibly when going:

freemium
premium.

Most articles I have seen are either PR of localisation companies or dealing with large/medium story-rich games.

PS: recommendations like "just remove all the text and use only icons" and "just localize it" are not something I am looking for.

sentences: How to create a over world map with multiple sub maps my game's idea is to use a open world map consisting of say 4096x4096 size, and multiple grids of 64x64 size. When I click on any grid, the map zooms in to show that grid(either creating in from scratch or loading off a JSON) because saving all the grids could not be memory efficient. Is there any algorithm to do like this?

sentences:
Adding Libxml2 to an Android project under Cocos2D-X I am having problems porting Libxml2. I like it because it works under windows like a charm with <libxml/parser.h>. When I reference the libraries I just cannot find the right path to them, their own references are broken and I don't know how to fiddle with Android.mk

What is the procedure?

sentences: How to use sprite as font in Unity? I've started working on my first game in Unity; It's very simple, there's a spinning block in the middle, and there are spinning blocks coming from all sides. When they hit the middle block, you lose a life. You have 3 lives. I've hit a bit of a brick wall, here, though; I can't seem to find anywhere how to use a sprite atlas as a font, or at least be able to sprite my own font. Does anyone know how to do this?

sentences:
Order independent transparency in particle system I'm writing a particle system and would like to find a trick to achieve proper alpha blending without sorting particles because:

Each particle is a point sprite in a single mesh and I can't use scene graph ability to sort transparent nodes. The system node should be properly sorted, though.
Particle position is computed on shader from initial velocity, acceleration and time. In order to sort the system I would have to perform all this computations on CPU, which is something I want to avoid.
Sorting hundreds of particles against camera position and uploading it on GPU each frame seams to be quiet heavy operation.

Alpha testing seems to be fast enough on GLES 2.0 and works fine for non-transparent but "masked" textures. Still, it's not enough for semi-transparent particles.

How would you handle this?

sentences:
Why I cant change the GUILayout.Button color to green when click on a button? I used a break point and it's getting to the line:

style.normal.textColor = Color.green;

But not changing the color of the clicked button.
And there are no any errors or exceptions.

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using UnityEditor;
using UnityEngine;
using System.IO;

public class Manager : EditorWindow
{
    [MenuItem("Tools/Manager")]
    static void Manage()
    {
        EditorWindow.GetWindow<Manager>();
    }

    private void OnGUI()
    {
        var style = new GUIStyle(GUI.skin.button);
        style.normal.textColor = Color.red;
        style.fontSize = 18;

        string[] assetPaths = new string[2];
        string[0] = "Test";
        string[1] = "Test1";

        foreach (string assetPath in assetPaths)
        {
            if (assetPath.Contains(".test")
            {
                var i = assetPath.LastIndexOf("/");
                var t = assetPath.Substring(i + 1);

                if (GUILayout.Button(t, style, GUILayout.Width(1000), GUILayout.Height(50)))
                {
                    style.normal.textColor = Color.green;
                }
            }
        }
    }
}

sentences:
In Game Maker Studio, why does the image rotation have to be performed every step? I'm a software developer who's trying to get into game development casually on the side. I picked up Game Maker Studio a while ago on a Steam Sale, and I'm finally getting into using it, especially after hearing that games like Undertale and Hotline Miami were products of said studio. I'm going through Shaun Spalding's Game Maker tutorials to familiarize myself with some of Game Maker's features and GML's coding syntax.

Following this tutorial, I rolled my eyes a little when he said to put the image_angle = direction; in the step event for my object rather than the creation event to rotate my object's sprite. "Why would you want to set a variable to the same value every frame when you could just set it once upon creation?" I thought to myself in my apparent naivety. But lo and behold, when running my project, the images aren't rotated if the image_angle = direction; is in the create event, and not the step event. Why? If image_angle is a member of my bullet object, shouldn't I be able to set it once upon creation? Or does it somehow reset on every frame?

sentences:
How to implement a Trail using Cocos2dx I'd like to implement a trail (like the white circles in Angry Birds) that chase my sprite. I already used CCMotionStreak, but the trail texture is "stretched" instead.

Anyone has an idea how to make this?

sentences:
Use depth bias for shadows in deferred shading We are building a deferred shading engine and we have a problem with shadows.

To add shadows we use two maps: the first one stores the depth of the scene captured by the player's camera and the second one stores the depth of the scene captured by the light's camera. We then ran a shader that analyzes the two maps and outputs the third one with the ready shadow areas for the current frame.

The problem we face is a classic one: Self-Shadowing:

(source: microsoft.com)

A standard way to solve this is to use the slope-scale depth bias and depth offsets, however as we are doing things in a deferred way we cannot employ this algorithm. Any attempts to set depth bias when capturing light's view depth produced no or unsatisfying results.

So here is my question: MSDN article has a convoluted explanation of the slope-scale:

bias = (m × SlopeScaleDepthBias) + DepthBias
Where m is the maximum depth slope of the triangle being rendered, defined as:
m = max( abs(delta z / delta x), abs(delta z / delta y) )

Could you explain how I can implement this algorithm manually in a shader? Maybe there are better ways to fix this problem for deferred shadows?

Update: trying to implement normal-offset shadows. Current state:

Image with no bias applied:

Normal offset bias applied, it works with the teapot, but look what it does with all the other shadows:

I even tried adding the NDotL term, it does not help:

float4 worldPosition = mul(input.Position, World);
float nDotL = dot(input.Normal,(shadowCameraPosition - worldPosition));
worldPosition.xyz += input.Normal*NormalBias*(1-nDotL);

sentences:
Show Sprites on Overlap (Shader Graph) [2D] I have a character sprite mesh and mesh renderer (The black wavy box). I am hoping to be able to overlay the black box onto the character covering the sprites but I am not sure how to do that.

I looked at this question : Unity: How do I only show parts of objects that overlap [2D]

But this works more as a cover that you can see through. I am hoping to have the variable black mask the sprites of the character but I cant seem to layer these correctly. Is there a way to do this using the LWRP and shader graph?

The over arching idea is to use this as a damage marker. Moving the black box up or down depending on the health lost.

sentences:
Moving panel between two positions smoothly? I'm trying to make my panel moving from one position to another one smoothly. What I get is more faster no matter what I did to make it slower never get slow !! Both Vector3.Lerp and Vector3.MoveTowards did not give me a slow movement. Here is my script:

public GameObject gunsWindow;
private Vector3 a, b;
public bool open; // use inspector
void Start()
{
    a = gunsWindow.transform.position;
    b = new Vector3(100.0f, gunsWindow.transform.position.y, gunsWindow.transform.position.z);
}

void Update()
{

    if(open)
    {
        gunsWindow.transform.position = Vector3.MoveTowards(a, b, Time.deltaTime * 1);
        //weaponPlane.transform.position =  Vector3.Lerp(a, b, Time.deltaTime); // panel shaking
    }
    else
    {
        gunsWindow.transform.position = Vector3.MoveTowards(b, a, Time.deltaTime * 1);
        //weaponPlane.transform.position =  Vector3.Lerp(b, a, Time.deltaTime); // shaking
    }

}

sentences:
How to save characters in iOS game app BOOL = GREENIE, UIButton =GREEN. When I click the GREEN button, I coded that now you play as GREENIE character. However, I don't know how to code it that the game always remember that the I clicked on GREEN button a few games ago. The way I currently have it is when you click on GREEN button, you play the game as GREEN character then when you lose and go back to beginning of start, you play as original character instead of GREEN. So I want to make it that the game saves the choice of GREEN character instead of having to manually pick him before each game.

I tried using NSUserDefaults standardUserDefaults but it's not working.

[[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"save"];
GREENIE=[[NSUserDefaults standardUserDefaults]boolForKey:@"save"];

How do I makes GREENIE=YES saved as as character I picked instead of having to pick GREENIE manually every time before game starts?

(EDIT: NSUserDefaults StandardUserDefaults works for when saving integerForKey though but not boolForKey. Maybe I coded it wrong?)

sentences: Asset Duplication in AssetForge Is it possible to duplicate assets in AssetForge? For instance, if I build a house and want to duplicate the entire house to another spot with it.

sentences: Is it possible to move a parent object independent of the child object I need to be able to move a Parent Object without moving the Child Objects.

sentences:
Physics for space game I am making a space game where you fly a ship.

I am trying to work out the physics for such a game and so far came up with:

var thrust; //between 1 & 100 how much the engines are pushing
var mass; // the mass of the spaceship
var speed; //the speed at which the spaceship is moving

Now big ships will have more mass to therefore take longer to speed up and longer to slow down once the thrust is off. Big ships will be slow because of the mass.

Small ships will speed up faster and slow down faster but also go faster.

How will I implement this into a game? I can do the keyevents, if up is pressed for 5 frames for example will I make the thrust raise to by 10 each frame(example) and then increase the speed of the ship based on some formula of the mass & thrust?

This is the game: Only UI and menus made but wan to get an idea of my physics before I implement the movement
http://www.taffatech.com/DarkOrbit.html

sentences:
C++/SDL Snake Game: Drawing Tail Crashes Game I"ve been making a snake game in C++ using SDL (first game and first time using SDL), and I've run into a bug. As the tail of the snake gets longer, the game slows down (snake gets slower), and eventually the game crashes (once the length of the tail reaches 29 pieces/parts). I went and deleted little bits of code until I found what was causing the problem, and I found that the problem is the snake's draw() method. It is responsible for drawing the head, and also for looping through each part of the tail and drawing it. Since the tail keeps getting longer, so does the loop, as it has more to draw. When I take out the loop that draws the tail, the game works fine. Is there anything I can do that is more efficient and that will stop the game from slowing down and crashing? Maybe the structure of the program is just bad. Here is some code with all the unnecessary stuff cut out:

snake.h

#pragma once

...

class Snake
{
...

private:
    void drawPart(SDL_Renderer *renderer); // snake is made up of individual parts
    ...

public:
    void draw(SDL_Renderer *renderer); // draws whole snake
    ...

private:
    SDL_Texture *texture = nullptr;
    int x = 0, y = 0; // initialized to something else later, irreverent
    std::vector<Snake> tail; // tail is made up of objects of this class
};

snake.cpp

...
void Snake::drawPart(SDL_Renderer *renderer) {
    auto surface = IMG_Load("part.png");
    texture = SDL_CreateTextureFromSurface(renderer, surface);
    SDL_FreeSurface(surface);
    SDL_Rect rect = { x, y, WIDTH, HEIGHT };
    SDL_RenderCopy(renderer, texture, nullptr, &rect);
}

void Snake::draw(SDL_Renderer *renderer) {
    drawPart(renderer);
    // the code below is what slows down the game until it crashes
    for (auto i = 0; i < tail.size(); ++i) {
        tail[i].drawPart(renderer);
    }
}
...

If any more code is necessary, please let me know. Thanks!

sentences:
Best practice to use Sprites in a game using AndEngine GLES2 Currently I am having static reference to all my sprites and loading and initializing them in my OnCreateResource mthod of SimpleBaseGameActivity, But now I have to override onAreaTouched listener on spirtes and the way I can override it while Initializing the Sprite. But I have a static method creating Atlas and Texture Region for every sprite. And I am using these sprites in my scene class and I want to override onAreaTouched there. I can registerTouchArea for that specific sprite in my scene so that can be done But I want to Override OnAreaTouched in a way so that Code reusability can be done. Here is how I am currently creating and loading sprites.

defualtCageSprite = createAndLoadSimpleSprite("bg.png", this, 450, 444);

And this is my Method createAndLoadSimpleSprite.

public static Sprite createAndLoadSimpleSprite(String name,
    SimpleBaseGameActivity activity, int width, int height) {

BitmapTextureAtlas atlasForBGSprite = new BitmapTextureAtlas(
        activity.getTextureManager(), width, height);
TextureRegion backgroundSpriteTextureRegion = BitmapTextureAtlasTextureRegionFactory
        .createFromAsset(atlasForBGSprite, activity, name, 0, 0);
Sprite sprite = new Sprite(0, 0, backgroundSpriteTextureRegion,
        activity.getVertexBufferObjectManager());
activity.getTextureManager().loadTexture(atlasForBGSprite);

return sprite;

}
Now How Can I override onAreaTouched for some sprites while not losing the code reusability.

sentences:
How to render metaballs? How  to render metaballs?
I am a Python programmer familiar with the Panda3d and Blender3d APIs. My math kinda sucks, but I know enough to write game logic code and procedural model generation code, as well as importers/exporters for the 3d modeller Blender. So you kind of get my level of experience. So can anyone explain or link to a tutorial which explains what needs to be done, without advanced math or with mentioning what math concepts are needed?

This is what I want to achieve:

http://www.youtube.com/watch?v=dEipENLes10
http://www.dailymotion.com/video/xn3xfn_mercury-meltdown-psp-un-trailer-pour-mercury-meltdown_videogames?search_algo=2

Though with probably more metaballs on screen at the same time.

sentences:
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:
(XNA) Checking coordinates, directly vs List vs Dictionary> I'm currently working on a generator that generates rooms in biomes and i was wondering what is the fastest way of checking if a certain position is already occupied.

I've got 3 possible ways of doing this:

1. Use nested foreach loops to directly loop through all rooms and check the position. (ugh)

public bool IsOccupiedPosition(Vector2 position)
{
    foreach (Biome biome in this.Biomes)
    {
        foreach (Room room in biome.Rooms)
        {
            if (room.Position == position)
            {
                return true;
            }
        }
    }
    return false;
}

2. Use a List, put everything in there, then check that using the Contains() method.

public List<Vector2> RoomCoordinatesAsList { get; set; }

public void AddRoomCoordinates(Vector2 position)
{
    this.RoomCoordinatesAsList.Add(position);
}

public bool IsOccupiedPosition(Vector2 position)
{
    return this.RoomCoordinatesAsList.Contains(position);
}

3. Use a Dictionary, where the first type is the X position and the second a list of Y positions. (my preference)

public Dictionary<float, List<float>> RoomCoordinates { get; set; }

public void AddRoomCoordinates(Vector2 position)
{
    if (!this.RoomCoordinates.ContainsKey(position.X))
    {
        this.RoomCoordinates.Add(position.X, new List<float>());
    }
    this.RoomCoordinates[position.X].Add(position.Y);
}

public bool IsOccupiedPosition(Vector2 position)
{
    return (this.RoomCoordinates.ContainsKey(position.X) &&
        this.RoomCoordinates[position.X].Contains(position.Y));
}

sentences:
Night cycle on a globe I am working on a tile based game on a globe. I am trying to implement a simple day night cycle on my hex globe something similar to the image below

Here is the picture of my globe inside Unity

I am just using a few point lights but it doesn't look perfect. Would it be possible to do better with the current lighting system in Unity or do I have to just play around with different lights, intensity and their positions to make it look close to what I want. Also is there any way through a script that I can get information on if my gameobjects in the scene are being lit by a source of light. I would want this to get information on the tiles that are in the dark and the ones that are in the light

sentences:
Is there a 'wait' function in Allegro5? I am creating a game in allegro5 and I have come across a problem. I have a character that fires a shotgun and there needs to be a delay before he can shoot again. The code for shooting his gun is in a function called

fire_shotgun();

and I cant find a way to create a pause before he shoots again without stopping the whole game by using

al_rest();

I am wondering if there is any way to do this.

P.S. my game is running on a 60FPS timer if that is of any use.

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 can I create a mirror with Unity? Can anyone explain how I can create a mirror effect like the one in this YouTube video using Unity Pro?

I know that I need to use render textures to do it, but I am not sure how.

sentences:
How to import or "using" a custom class in Unity script? I have downloaded the JSONObject plugin for parsing JSON in Unity but when I use it in a script I get an error indicating JSONObject cannot be found. My question is how do I use a custom object class defined inside another class. I know I need a using directive to solve this but I am not sure of the path to these custom objects I have imported. They are in the root project folder inside JSONObject folder and class is called JSONObject.

Thanks

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:
In Corona SDK, how do you extract the x1, y1, x2, and y2 coordinates from a line display object? I used this command to create a line:

local myLine = display.newLine( 0,-110, 27,-35 )

How can I get the coordinates from myLine? I've looked here and here but the closest thing I could find is myLine.x and myLine.y, which appear to be x1 and y1 (not sure), but I can't figure out how to get x2 and y2.

I want this information in order to detect if two lines intersect on the screen.

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:
How to share values between different shader programs? I am using Unity but this might concerns all type of shaders. I would like to know if this is possible to share values between different shader pass.Let's imagine that I am computing something in the first pass and I would like to use this value in a second pass, is it possible ?

If this is possible, how can I do that ?

sentences:
Comparing analog stick movements to predefined flick shapes I want to create a control scheme similar to the EA Skate games, where flicking the right analog stick in various ways makes the character do various tricks:

I record the user input over a set amount of time or until the user moves the analog stick back to its resting position. The recording is a List of Vector2 Coordinates.

Depending on how fast the user flicks the analogue stick, I sometimes get a shorter (15) or longer (45) list of points.

Now I want to compare these lists of points to predefined shapes like the ones in the screenshot, to match which action the player intended to take.

My idea was to use some metric to compare the similarity of the recording to lists of arrays, however, I don't which metric I might use. I found the Hausdorff-Metric and it seems applicable, but I don't know how to implement it.
It might also be an overkill for the problem, so I wanted to ask, how other people would solve the problem.

sentences:
Unity Cinemachine+URP : 2D pixelPerfect zoom issue? There are many PixelPerfect component that exists and it confuses me.
The CM PixelPerfect component doesn't work in my 2D Tilebased game.

So I use the Camera component named "Pixel Perfect Camera (Experimental)".

I feel that the right PixelPerfect component because it seems that it's the only one working for my project ahah.
(note : I'm aware there's another PixelPerfect component in the "2D pixel perfect" package, but it's only compatible with LWRP projects if I'm right.)
The camera :

The hierarchy :

CM vcam1 and CM vcam2 are used to make transitions between Areas.
Now, I need to make a zoom on the player.
To achieve that, I have added a 3rd "CM vcamZOOM".
But nope, it's not working at all. I mean, everything else works, the rotation, etc, everything but the zoom. Even if it's the only vcam enabled, it's not zooming.
I found out that disabling the "Pixel Perfect Camera (Experimental)" component on the Camera solved the problem.
That's not a real solution since I need to use a PixelPerfect component (with the ability to Zoom).
Am I using the right PixelPerfect component for my needs?
Is this a compatibility bug between URP camera pixelperfect component and CM zoom ?
Thanks for reading and for your answers.

sentences:
Rotating points on a circle I have drawn a 2D circle in X,Y,Z. I wanted to draw something on specific vertices of that circle and I managed to do it. When I wanted to move the circle, I wanted the vertices to get the updated position, so I created another array of vertices and calculated the new vertex positions.

Now I want to rotate the circle, and while rotating it, the vertices should get the new orientation. How can I do this?

void creature::drawCircle(Vec3f Pos,float radius, int segments )
{

    // automatically determine the number of segments from the circumference
    if( segments <= 0 ) {
        segments = (int)math<double>::floor( radius * M_PI * 2 );
    }
    if( segments < 2 ) segments = 2;

    GLfloat *verts = new float[(segments+2)*3];
    GLfloat *vertsNew = new float[(segments+2)*3];
    verts[0] = 0;
    verts[1] = 0;
    verts[2] = 0;
    vertsNew[0] = 0;
    vertsNew[1] = 0;
    vertsNew[2] = 0;

    //Create circle
    for( int s = 0; s <= segments; s++ ) {
        float t = s / (float)segments * 2.0f * 3.14159f;
        verts[(s+1)*3+0] = math<float>::cos( t ) * radius;
        verts[(s+1)*3+1] = math<float>::sin( t ) * radius;
        verts[(s+1)*3+2] = 0;
    }

    //Transform points
    for( int s = 0; s <= segments; s++ ) {
    ci::Vec3f  m_newCirclePos;
        m_newCirclePos.x = verts[(s+1)*3+0];
        m_newCirclePos.y = verts[(s+1)*3+1];
        m_newCirclePos.z = verts[(s+1)*3+2];
        m_newCirclePos += ci::Vec3f(Pos);

        vertsNew[(s+1)*3+0] = m_newCirclePos.x;
        vertsNew[(s+1)*3+1] = m_newCirclePos.y;
        vertsNew[(s+1)*3+2] = 0;

    }

    // Attach tentacles on specific vertices
    for (int i=0; i<m_tentacle.size(); i++)
    {
        m_tentacle[i]->m_Nodes[0].x = vertsNew[(i+1)*3+0];
        m_tentacle[i]->m_Nodes[0].y = vertsNew[(i+1)*3+1];
        m_tentacle[i]->m_Nodes[0].z = vertsNew[(i+1)*3+2];
        m_tentacle[i]->enforceConstraints(Vec2f(0,0),0,0,0,0);
    }
    glPointSize(10);
    glEnableClientState( GL_VERTEX_ARRAY );
    glVertexPointer( 3, GL_FLOAT, 0, vertsNew );
    glDrawArrays( GL_POINTS, 0, segments + 2 );
    glDisableClientState( GL_VERTEX_ARRAY );
    delete [] verts;
    delete [] vertsNew;
}

sentences:
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 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 could I achieve an iOS high detailed level design for a platformer? I'm seeing a lot of games that use a predefined and repeating set of tiles for their level (like FlappyBird or the Super Mario game series).

I'm a graphics designer so I would like to create levels with a much higher level of details for the game levels. I'm thinking about games such as Limbo (screenshot at the end of the post) or BadLand.

I thought about designing the whole level in one big  high detailed image which could reach to 30k pixels in width, but I'm not sure if that's the way to go.

How should I structure my game to achieve that level of detail?

I'm using sprite-kit.

sentences:
Tennis game algorithm and maths Tennis courts are real dimensions and game is 3D

Ball has position (x,y,z), speed(vx,vy,vz) and acceleration (ax,ay,az)

Game has 30 fps and on each update (1/30sec) it has these properties

vx +=ax;
vy +=ay;
vz +=az;

ball.x += vx;
ball.y += vy;
ball.z += vz;

function hitBall(destinationx, destinationy=0, destinationz) {
    // calculate vx, vy, vz, so ball imapcts  the point (destinationX, 0, destinationZ)
    // destinationY = 0 = bounce on floor
    vx = ....
    vy = ....
    vz = ....
// I guess this problem has infinite solution, so we must intersect with 1 point
// intersection line is (x,1,12)
// 12 is middle of the tennis court and 1 is 1 metter above the ground.
// ball passes there 1 meter above the ground.

}

Any clue on how to resolve that math problem ?

regards

Google doc :
https://docs.google.com/presentation/d/1EiUYpalDXlJUgjg8aIxLiWENgZJW7fnH4bGHsj1jb9I/edit?usp=sharing

sentences:
How many LoD versions of a model should I have? Many games facilitate better performance by increasing/decreasing the number of triangles/polygons that are drawn, depending on how close the camera is to said object. Mountains, viewed from far away, could become literally flat. Models would steadily lose resolution as you walk further away from them, etc.

If I want to implement such a system, how many different permutations of the same model/models should I have? Suppose the model is 20,000 triangles when viewed up close, but then I halve that when the camera goes away, so now it is 10,000. Then again, when the camera is even further away, making it 5,000 triangles. Would three versions be enough? Or is this really just an arbitrary implementation? Does it depend on the game itself?

sentences:
std::vector performance for pixel buffers Doing software 2d pixel buffers, blitting, etc. Someone was telling me there's absolutely no overhead involved in using an std::vector to represent objects, I was wondering if std::vector is indeed a good container for pixel buffers or if I should instead stick with a raw array like I've always used.

Thanks

sentences:
Render to cubemap wrong Y values I'm currently trying to render to a cubemap in order to blur it. However the top and bottom faces appear much closer than they should be in the blurred version. I thought the problem came from my transformation matrices but they're just rotations. I'm beginning to believe that it's the way I'm handling the framebuffer that's causing this problem. Here's how I'm doing it :

    unsigned fbo;
    unsigned rt;
    glViewport(0, 0, size, size);
    glGenFramebuffers(1, &fbo);
    glGenRenderbuffers(1, &rt);

    glBindFramebuffer(GL_FRAMEBUFFER, fbo);
    glBindRenderbuffer(GL_RENDERBUFFER, rt);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size, size);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt);

    //...
    //enable source cubemap, set projection
    //...

    for(int i = 0; i < 6; ++i) {
        //set rotation
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, target_cubemap, 0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        //draw cube

(the images below are from the same corder)

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:
Is it a useful strategy for Mobile VR titles to render faster than their simulation loop? For example - If a title had a very heavy simulation loop (say 20ms), is it desirable to render at a greater rate, say 90hz?
This would always a present head pose correct to the view, without being stalled on simulation.
Or does this result in discomfort for the player, and instead render and sim should stay in lockstep?

sentences:
Loading screen OpenGL with glut API I'm trying to make a loading screen. My idea is to have two threads working - one in the background loading the 'game' scene, one displaying 'load' scene. When building 'game' scene is finished, it's displayed instead of 'load' scene. Before threading I want to make it work the usual way: first display 'load' scene, then 'game' scene. Both GameScene and LoadScene inherit from a virtual function Scene. Here's how my main looks like:

LoadScene *load_scene;
GameScene *game_scene;
Scene *scene;

int main(int argc, char **argv)
{
// Init GLUT and create window
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_STENCIL);
glutInitWindowPosition(initWindowX, initWindowY);
glutInitWindowSize(windowWidth, windowHeight);
glutCreateWindow("OpenGL");

// Register callback functions for change in size and rendering.
glutDisplayFunc(renderScene);
glutReshapeFunc(changeSize);
glutIdleFunc(renderScene);

// Register Input callback functions.
// 'Normal' keys processing
glutKeyboardFunc(processNormalKeys);
glutKeyboardUpFunc(processNormalKeysUp);
// Special keys processing
glutSpecialFunc(processSpecialKeys);
glutSpecialUpFunc(processSpecialKeysUp);

// Mouse callbacks
glutMotionFunc(processActiveMouseMove);
glutPassiveMotionFunc(processPassiveMouseMove);
// void glutMouseFunc(void(*func)(int button, int state, int x, int y))
glutMouseFunc(processMouseButtons);
glutMouseWheelFunc(processMouseWheel);
// Position mouse in centre of windows before main loop (window not resized
yet)
glutWarpPointer(windowWidth / 2, windowHeight / 2);
// Hide mouse cursor
glutSetCursor(GLUT_CURSOR_NONE);
// warp

// Initialise input and scene objects.
input = new Input();
//scene = new LoadingScene(input);
load_scene = new LoadScene();
game_scene = new GameScene(input);

// load scene
// Create GameScene();
// Create LoadingScene(GameScene *)
// delete LoadingScene();
// LoadingScene thread tells game to start loafing assetss

// Enter GLUT event processing cycle
glutMainLoop();

return 1;
}

The game scene reassignment must be called in changeSize function. I thought it should be in the renderScene function but it's the only way it works. Here's how it looks like:

void changeSize(int w, int h)
{
scene = load_scene;

scene->resize(w, h);
}

Any ideas how I could go on about it? So far if I assign to 'scene' pointer 'load_scene' object it's displaying 'load' scene. Same goes for 'game' scene.
Is it even possible to achieve a transition between scenes without threading?

sentences:
Bilinear filtering of output image in Direct3D 11 I'd like to render something at one resolution, but display it in a window at another resolution (e.g. render the scene at 640x480 and stretch it to a 1024x768 window).

Simply resizing the window after creation allows this to work - however, the image is filtered using nearest-neighbor. Is there a way to change the filtering algorithm to e.g. bilinear?

sentences:
LibGDX changing actors parents is resulting in unwanted (x,y) translation I have a Rolodex of task item actors I want to drag to an agenda tablet.  My drag and drop functionality is non-native, but came from modifying a book's implementation.  The problem seems to be when I change the parent of a task item, 'a', to the agenda's parent, 'other':
other.getParent().addActor(a);

When I do so the actor's coordinates shift.  I want the actor to remain in the same spot I dropped it down.  It worked as desired previously, possibly because the Rolodex's parent and the agenda's parent shared the same, whole-screen dimensions.  I've since moved away from layout to positioning actors and their groups on the screen with setBounds().  Tracking the (x,y) coordinates of my dragged item I'm getting negative values for x while it remains visible on screen, making me think actor.getX() and actor.getY() return values relative to the parent carousel container class I made, and not the screen/stage nor the agenda's container.
I found a set of methods off of Actor that looked promising, localToXXXX(Vector2), and experimented with a variety of them before settling on the following I think should work:
            Vector2 snapShot = a.localToActorCoordinates(other.getParent(), new Vector2( a.getX(), a.getY()) );
            other.getParent().addActor(a);
            a.setBounds(snapShot.x, snapShot.y, a.getWidth(), a.getHeight());

...but it doesn't.  Converting it to stage or screen coordinates with the other method options shifts it even farther away from desired. What am I misunderstanding?  How can I change an actor's parent without the x,y shifting?

sentences:
My sprites do not always respect collisions in Pygame I have a Player sprite (40x40 pixels) and Tiles (20x20 pixels) which build the terrain. At the 4 edges there are 2 rows or columns (depends on vertical or horizontal) of wall tiles. Those are the limits which the player should not be able to overpass and collisions player-wall are checked there.

Most of times, it recognizes collisions, but sometimes it doesn't. When I move the player until the map limit and it hits the wall tile, it stops, but sometimes if I continue trying to move it against the wall, it doesn't respect the collision and enters in the wall. At this point, once the player enters in the wall tile it can only moves over wall tiles...

So, am I doing something wrong or is it just a pygame collisions bug?

Here is the method to check collisions:

def checkCollision(self):
    from prueba import limitGroup
    listLimits = limitGroup.sprites()

    for i in range (0, len(listLimits)):
        if listLimits[i].kind == "wall" and self.rect.colliderect(listLimits[i]):
            return True

    return False

And here is the update() method to move the player.

def update(self):

    for event in pygame.event.get():
        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))

    key = pygame.key.get_pressed()

    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

sentences:
Implementing a glowing effect on 3D objects with Direct3D 11 I'm interested in implementing a glowing effect on some 3D objects. More specifically, I want to make a star that has a sort of halo around it, as it can be seen in the photo:

I've seen on Rastertek the 2D implementation, but I have no idea how it could be done in 3D. I've also read about HDR and bloom effects, but I'm not sure if those would apply here. What Direct3D 11 techniques should I use?

sentences:
Units issue when exporting from 3DS Max to XNA I am working on a XNA game where we have defined that 1 XNA unit equals to 1 meter. Then, I set meters as system unit in 3DS Max and set to meters the units in the FBX exporter. However, when I export my models, they are much bigger in the game. Am I missing something? What should I do to avoid problems with my units?

Investigating the FBX file, I noticed that I it has two values called UnitScaleFactor and OriginalUnitScaleFactor. They both are 100 when I export the files... And if I manually change UnitScaleFactor to 1, it works fine :S

sentences: How can I make orange/lemon skin normal map? What would be the easiest way to make a bump map of the dimples on a citrus fruit such as an orange or lemon in gimp/photoshop without using pictures of it? e.g:

sentences:
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 to make an object jump an equal height whenever it hits the ground? So, I want to make an object jump an equal height whenever it touches the ground. Something like a bouncing ball. But I can't use Physics Materials. Here are some ways that I tried:
Used Physics.CheckSphere:
isGrounded = Physics.CheckSphere(rayPoint.position, grounDistance, groundLayer);

if(isGrounded )
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

Used Raycast:
bool groundHit = Physics.Raycast(rayPoint.position, -transform.up, rayDistance, groundLayer);

if(groundHit)
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

In each cases, the object jumps a different amount of height each time it reaches the ground. How can I make it jump an equal height each time?

sentences:
In Maya how do I convert trans, rot, scale data to a 4 x 4 transformation matrix? I have been given the following Maya camera data:

trans X: 1.542
trans y: 3.319
trans z: -1.821

rot X: 117.882
rot Y: 2.189
rot Z: 154.074

scale X: 1
scale Y: 1
scale Z: 1

What is the formula for converting this to a 4 x 4 transformation matrix?

sentences:
How to draw text with characters rendered in reverse order in a Godot game? I need to have some text showing up in my Godot game in a way that each character overlaps the character directly to its right, like so:
     -- ---    -- --
   /  /     \ |  |  |
  /  /       \|  |  |
 /  /  /---\  \  |   ----
/  /  /  \  \  \ |       |
-- --     -- -- - -------

Using a BMFont (.fnt) in a Label node with the values of xadvance specified in the font smaller than the characters width I get this:
     -- ---    -- --
   /  /     \ |  |  |
  /  /       \|  |  |
 /  /  /---\  |  |   ----
/  /  /  \  \ |  |       |
-- --     -- -- - -------

What approach can I use to still be able to use my .fnt font and also store the text with the characters in their natural order, as it would be stored for using with a normal Label or Button control? Which would help for language localization purposes.

sentences:
How can I draw things just in an area that can have a shape such as the shape of the letter B and not draw outside this form? I want to draw stuff on an image, for Example, if I have a letter, as an image and I want to draw on the letter it is necessary that this image is touchable.
This is what I did:

Image.addListener (new clickListener () {
public boolean Touchdown (InputEvent event, float x, float y, int pointer, int button)
{
/ * posCurseurX = x;
posCurseurY = y * /

// Begin to draw on the screen

touch = true;
traitSprite = new Sprite (rectangleTexture, 0.0, tailleTrait, tailleTrait)

traitSprite.setPosition (x-tailleTrait / 2 (height) -y - tailleTrait / 2);
tabRectangelSprite.add (traitSprite);
counter ++;

dessinerTrait (touch);
dessinerCurseur ();
// The index of the number of meter rectangle forming a line

return true;
}
});

But I want to add another listener for mouse movements, but it does not work with MouseMove.
and the other thing I would like, is to draw that if I'm on my image. If the cursor position is not between the coordinates of the image so I will not draw.

that's what I tried:

if (posCurseurX> = image.getX posCurseurX && <= + image.getX image.getWidth) {

..}

But the texture does not necessarily have that width, that's an example:

sentences:
SDL2 Draw scene to texture. SDL2 RenderTexture like SFML I've been developing a 2D Engine using SFML + ImGui.

The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.

Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine.

I've managed to render the editor like I did in the 2D Engine using this Example that comes with ImGui.

But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.

If you can provide code will be better. And if you want me to provide any specific code tell me.

Thanks!

sentences:
How is terrain editing implemented like a sculpt tool? Some creativity/sandbox games have a terrain editing feature. When thinking of a terrain, I'm thinking of a grid of vertices. The elevation of each vertex is then determined by a heightmap (image). And the user can edit this elevations, so you get mountains and valleys.

Most times terrain editing is 'just' changing the height component of the positions of vertices in an existing grid of a fixed amount of vertices.

Now I see some games that make it possible to do the following:

This seems way more complex than just a grid and a heightmap.

I have thought a lot about this, but what is the best/most common approach to implement this?

I think it's difficult to find a good data structure for the
vertices.
I'm pretty sure, during editing, vertices are also created and added
into the terrain, which also seems complex.
All attempts to create indices seems a hell of a job to me. (Think of rendering this in triangle strips)

sentences:
Good book/resource recommendation for HTML5 mobile game development? The problem: I am taking an existing, 5 year old, html based MMORTS game and "HTML5-ing" it, "AJAX-ing" it and most importantly, optimizing for mobile devices like iPhone, android etc. For these devices, the application will be packaged as a downloadable app that is a wrapper for a browser which actually shows the game..

The Question
Looking for a good book, or books, or in-depth articles that would help me learn:

what tools I have in iOS, andriod applications for optimizing an html based game. things like caching of images, etc
what kind of connectivity, or interactivity I can expect between the html/javascript pages and the wrapper - can I play sounds in the wrapper by triggering them from javascript? etc
tip and tricks to optimize html/html5 & Javascript application to run well on mobile devices
ETC :)

Any recommendations would be greatly appreciated!!

sentences:
How to make a 2D neon-like trail effect in Unity Recently I've been toying around with neon-ish effects for a game I'm making and wanted to share my results with you.

If you guys have any other methods of achieving this result, please be sure to share.

sentences:
How to change colors where two boxcollider2d objects intersect (Unity 5 2D) I'm creating a 2D game in Unity that relies on combining colors.  For instance, if the yellow sprite in in a position, and the player slides a magenta sprite partly over it, the area where the two intersect should become red.  If someone then slides a cyan sprite, the cyan+yellow should be green, the cyan+magenta should be blue, and the cyan+red should be black.

I was planning to use box collider 2d and use a OverlapArea on TriggerStay2D, but that didn't work.  I'm assuming in my code below that pointA is the upper left coordinate of the first sprite, and pointB is the upper left coordinate of the second sprite (though perhaps I'm wrong on that).

void OnTriggerStay2D(Collider2D collisionInfo)
{
    Debug.Log("I am still colliding");

    Vector2 pointA;
    Vector2 pointB;

    pointA = this.transform.position;
    pointB = collisionInfo.transform.position;

    Vector2 pointC = Physics2D.OverlapArea(pointA, pointB);

}

After reading the documentation, I think I'm not understanding what OverlapArea returns - it seems to return a Collision, but that doesn't make a whole lot of sense.

Any thoughts on this?  Is there a better way than trying to find a pair of 2-Tuples that would bound the collision area and create a new sprite of the new color over that area?

sentences:
Cocos2d How do I transition to a scene So I have mainScene and I have LogoScene, I am wondering If i can make logoscene show a logo, then transition to mainscene.

here is what i have

    import org.cocos2d.layers.CCLayer;
import org.cocos2d.layers.CCScene;
import org.cocos2d.menus.CCMenu;
import org.cocos2d.menus.CCMenuItemImage;
import org.cocos2d.nodes.CCDirector;
import org.cocos2d.nodes.CCSprite;
import org.cocos2d.types.CGPoint;
import org.cocos2d.types.CGSize;

import android.graphics.Color;
import android.graphics.Rect;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

public class LogoScene extends CCLayer {
    public static CCScene scene() {
        CCScene scene = CCScene.node();
        LogoScene layer = new LogoScene();
        scene.addChild(layer);
        return scene;
    }

    public LogoScene() {
        super();
        this.init();

    }

        CCSprite pSpNameText = CCSprite.sprite("img/logo_name_textfield.png");
        pSpNameText.setPosition(CGPoint.ccp(1080, 300));
        this.addChild(pSpNameText, 0);
= bingo.getLayout();
            layout.removeAllViews();

        CCDirector.sharedDirector().replaceScene(MainScene.scene());
    }
}

sentences:
Weird error with opengl in Android using Libgdx : "EGL_BAD_ATTRIBUTE" I am having a weird error when uploading my game in the phones.

E/Adreno200-EGL(5128): qeglDrvAPI_eglGetConfigAttrib:484>: EGL_BAD_ATTRIBUTE

I am uploading the textures with AssetManager.

I am using OpenGL 1.0.

It begans to upload the textures, but when it is about to finish uploading them, it finishes unexpectedly without any message in logcat.

Any ideas what is happening?

When I updated my xperia ray to ics it began having this problem

And when it loads, and I navigate through screens I get this in logcat

<qgl2DrvAPI_glClear:33>: GL_INVALID_VALUE

This is my line using the clear

this.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

The type of gl is GL10

Although the first error occurs when it is loading :/

Here is my logcat output

sentences:
Timing of coroutines in Unity is never precise I was looking an official example for coroutines in Unity here.

However, when I call WaitAndPrint the time taken is never exactly 5 seconds.

IEnumerator WaitAndPrint()
{
    float timeStart = Time.time;
    yield return new WaitForSeconds(5);
    Debug.Log(string.Format("Time taken = {0}", Time.time - timeStart));
}

if (Input.GetKeyDown(KeyCode.R))
    StartCoroutine(WaitAndPrint());

Instead, it varies around 5.003133.

This is most likely down to the frame rate, which makes me wonder how can I make sure that a coroutine takes the precise amount of time it should take despite the fluctuating frame rate?

sentences:
Vector3 Array serialization ReorderableList I've been working on a ReorderableList, but it's given me quite the headache. I've come to the point where I want to define a "drawElementCallback" -callback, which looks like this:

list.drawElementCallback = (rect, index, active, focused) => {
    EditorGUI.PropertyField(rect, list.serializedProperty.GetArrayElementAtIndex(index), GUIContent.none);
};

What it's supposed to draw is one Vector3 object from an array of Vector3 objects. I get this property like this: ("property" is a SerializedProperty that contains the property that I need)

SerializedProperty locationsProperty = property.FindPropertyRelative("locations");

The array is declared as follows:

public Vector3[] locations;

Inside a container class that is marked as "Serializable".

The problem I kept getting with different code is that the ReorderableList shows all the Vectors correctly but it doesn't allow me to reorder any of the items, nor delete them (I can add new Vector3 objects and change them as expected).

With this code, I wanted to fix that issue. However, now I keep getting the following error:

"InvalidOperationException: The operation is not possible when moved past all properties (Next returned false)"

I wanted to make a reorderable list because it seemed easy, but I can't figure out the problem and I honestly wish I hadn't started working on it. It's taken up most of the past 3 days.

If anyone knows how to fix this, I would be very grateful.

To clarify, this code shows the array properly:

list.drawElementCallback = (rect, index, active, focused) => {
    SerializedProperty item = locationsProperty.GetArrayElementAtIndex(index);

    EditorGUI.BeginChangeCheck();
    item.vector3Value = EditorGUI.Vector3Field(rect, string.Empty, item.vector3Value);
};

But doesn't allow me to remove or reorder items. I thought I should show the code to demonstrate that there are indeed array items.

sentences: Creating a 2D sidescroller with different behavior in each level I'm creating a game with levels built from tilemaps in LibGDX. I've created the logic for the game that adds entities based on object layers, however, many levels have different behaviors. Do I need to create a separate class for every single level, or should I build in logic to handle every possible scenario in the class that loads levels?

sentences:
32 bit or 16 bit textures I'm trying to build some 2d character with Photoshop and Spine. By now, I have created some of my characters using 16 bit color depth images in Photoshop. Now, I wonder whether I have to use 32 bit or just create everything with 16 bit textures...
How much does it affect my game? Considering a 2D Unity or Flash game.

sentences:
How do I draw an animated object in OpenGL ES? I have a VBO, which I initialise like this (just an example):

- (void)setupVBOs {

    GLuint vertexBuffer;
    glGenBuffers(1, &vertexBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);

    GLuint indexBuffer;
    glGenBuffers(1, &indexBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);

}

As you can see, I'm  using GL_STATIC_DRAW, which is good for visually unchanging objects (not including translations and such).

How do I draw animated objects though? I mean things that might be changed by user interaction. This video is a good example. It is obvious OpenGL is being used, as the vertices are manipulated by gestures.

How is it done? by changing the x y z coordinates on every touch? Are they using GL_DYNAMIC_DRAW? Is this hard?

sentences:
How to handle forward/backward movement in an oblique top-down view I'm making a pseudo-2D top-down game, where my assets are actually 3d but I use an orthographic projection to introduce more depth.

I saw a picture of how the game "Enter the Gungeon" was actually made in unity 3d.

When I tried doing something likes this I put the camera in orthographic view and after some adjusting I got it to look kind of like this.

The problem is that movement in the z-axis (away / toward the viewpoint, or up and down on the screen) feels very slow because of the whole orthographic thing. You can notice this when moving a player for example.

When I simply increased the speed of the player in the z-axis it felt pretty normal, but I am wondering if that would introduce some unforeseen consequences?

I couldn't find any guides, posts or videos about this. How should I solve this movement problem?

sentences: If you make a game for facebook do you have to have a "real website" on the domain name? Can you just use the domain to house your database and code?  Do you have to have a "real" front end webpage?

sentences:
2D games on Unity and collision detection performance I'm developing a 2D game for the iOS platform. I have seen a lot of packages on asset store that makes 2D asset creation for unity easier.

I have narrowed my selection to just 2, 2d toolkit and ex2d. I have to test them and see with fits my workflow better (if anyone has an useful opinion I'm all ears). But my main concern is how to do the collision detection in unity for this kind of games.

My game is a side scroller and I want it to have slopes. I have done this in my own engines using tile height maps, etc... but unity doesn't support all this, but it has a physic engine. Do you think unity own physics engine will be ok for a game like this? I really need a good control on player collision to achieve a nice playability, so, I'm a bit sceptic if I will be able to do it using the physic engine, perhaps, because of my poor knowledge on this subject.

I have thought about rolling my own 2D cuad collider and do my own collision detection on the fixed update call but not sure either if it will be faster that the built-in physics engine because unity3d could be just optimised to use its own collision system.

What do you think?

sentences:
Can I create an offscreen plain surface with a pointer to pre-allocated surface data? I thought I read somewhere that one could create a 'offscreen plain surface' from an existing system memory buffer, but I cannot seem to find the reference anymore.

My use case is copying a frame from video memory to a pre-allocated buffer, and right now I perform this in two steps: copying to an 'offscreen plain surface' (GetRenderTargetData), and from that to a pre-allocated buffer.  If I could create the surface from the pre-allocated buffer, it would save a copy. I am using Direct3D9Ex on Windows 7.

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:
How to handle jumping up a slope in a runner game? In an 2D endless runner, what should happen when the player is running "too fast" up a slope and jumps?

For example, in a "normal" case:

    .O.
   . __..O_____
  . /
 . /
 O/
_/

If he is moving to the right slowly enough, he will jump upwards and land on the flat part of the surface. However, if he is moving too fast, the jump will have no effect as his forward motion will bring him back in contact with the slope before he can get high enough to pass over it. When the speed is sufficiently high, there will effectively be no jump.

     _________
    /
 .O/
 O/
_/

Are there any known ways to solve this issue? I know it's physically correct*, but are there techniques that other games use to overcome this in a reasonable manner?

As a last resort I'll have to just remove all slopes that are too slanted.

*If you constrain the player to never jumping backwards.

sentences:
How do I keep my orbiting camera upright? I am working on code that rotates the camera around a point on the in-game map when dragging the mouse. I understand how to lock it so it stays above the map surface.

However, if I keep rotating the view up, the camera will go "up and over" and be upside-down. How can I fix the camera orientation to make sure my camera stays upright?

A representative bit of code:

x += Input.GetAxis("Mouse X") * xSpeed;
y -= Input.GetAxis("Mouse Y") * ySpeed;

// when mouse moves left and right, rotate around local y axis
transform.RotateAround(target.position,transform.up, x);

// when mouse moves up and down, rotate around the local x axis
transform.RotateAround(target.position,transform.right, y);

sentences:
Is Frustum culling still needed today? I'm reading about efficient Frustum culling algorithms. I found an article about a smart method that first use the Frustum AABB (Axis Aligned Bounding Box) to eliminate most of the scene before check again against the actual frustum representing the camera.

I didn't do any performance test yet, but maybe somebody else did and can answer this question.

Let's say I'm using an Octree to quickly check again the camera bounding box. But I do not want to do a second pass again the camera planes. If I simply render everything so far, isn't that actually faster than do the second pass?

Assume object geometry is loaded into VRAM using hardware vertex buffers.

sentences:
Rotating quaternion smoothly with acceleration and deceleration I have this code for my linear acceleration and deceleration.
var currentSpeed = velocity.translation.z;
var decelerationDistance = ((currentSpeed * currentSpeed) / movementSettings.acceleration) * 0.5f;
if (distanceFromTarget > decelerationDistance)
{
    velocity.translation = float3(0f, 0f, min(currentSpeed + (movementSettings.acceleration * deltaTime), movementSettings.maxSpeed));

}
else
{
    velocity.translation = float3(0f, 0f, max(currentSpeed - (movementSettings.acceleration * deltaTime), 0f));
}

Assuming the object is already pointed at the target, this accelerates an object up to its maximum speed at its acceleration rate, and then slows it down by the acceleration rate so that it comes to a stop exactly on the target.
I'd like to have the same behaviour apply to rotation (which is a quaternion). i.e. Assuming the object is stationary, smoothly rotate to a target rotation, obeying acceleration and max rotation speed limits.
I have made a start of converting this code to work on quaternions:
private static float Magnitude(Unity.Mathematics.quaternion quat)
{
    return CalculateQuaternionDifference(Unity.Mathematics.quaternion.identity, quat);
}

private static float CalculateQuaternionDifference(Unity.Mathematics.quaternion a, Unity.Mathematics.quaternion b)
{
    float dotProduct = dot(a, b);
    return dotProduct > 0.99999f ? 0f : acos(min(abs(dotProduct), 1f)) * 2f;
}

...

var currentRotSpeed = Magnitude(velocity.rotation);
var rotDecelerationDistance = ((currentRotSpeed * currentRotSpeed) / movementSettings.acceleration) * 0.5f;
if (distance > rotDecelerationDistance)
{
    velocity.rotation = slerp(Unity.Mathematics.quaternion.identity, mul(rotationDiff, velocity.rotation), movementSettings.acceleration);
}
else
{
    velocity.rotation = slerp(Unity.Mathematics.quaternion.identity, mul(inverse(rotationDiff), velocity.rotation), movementSettings.acceleration);
}

My questions are:

Unity.Mathematics.math.slerp() doesn't seem to play well with values of t over 1. When acceleration and deltaTime are low it works, but if they increase too much it breaks in ways I don't understand. How can I multiply a Quaternion by a scalar the same way I multiply the linear acceleration by deltaTime.
This doesn't follow any max rotational speed limits or stop at 0. What is the equivalent of min/max() for a quaternion?
rotationDiff is the rotational difference between the current orientation and the target orientation. As the current orientation gets closer to the target orientation, this distance gets smaller. I know I should be using some static value instead, but I'm not sure what. Is there a way to normalize rotationDiff so it always has a magnitude of 1 radian?

sentences: Quarter turn sprite sheets? I'm having trouble finding sprite sheets that have the characters turn in 8th movements, so that you can see back, front, left, right, and in between.  What would be a good term to search for when trying to find these kind of sprite sheets?

sentences:
How to swap row/column major order? I'm trying to get a sprite sheet clipped in the right order but I'm a bit stumped, every iteration I've tried has tended to be in the wrong order. This is my current implementation.

    Frames = (TempSurface->h / ClipHeight) * (TempSurface->w / ClipWidth);
    SDL_Rect Clips[Frames];
    for (i = 0; i < Frames; i++) {
            if (i != 0 && i % (TempSurface->h / ClipHeight) == 0)
                    ColumnIndex++;
            Clips[i].x = ColumnIndex * ClipWidth;
            Clips[i].y = i % (TempSurface->h / ClipHeight) * ClipHeight;
            Clips[i].w = ClipWidth;
            Clips[i].h = ClipHeight;
    }

Where TempSurface is the entire sheet loaded to a SDL_Surface and Clips[] is an array of SDL_Rects. What results from this is a sprite sheet set to SDL_Rects in the wrong order.

For example I need a sheet of dimensions 4x4 to look like this:

| 0 | 1 | 2 | 3 |
| 4 | 5 | 6 | 7 |
| 8 | 9 | 10| 11|
| 12| 13| 14| 15|

But instead I get this order:

| 0 | 4 | 8 | 12|
| 1 | 5 | 9 | 13|
| 2 | 6 | 10| 14|
| 3 | 7 | 11| 15|

Columns and rows order does not match. What should I do to fix the order?

sentences:
How much matrices should I use for OpenGL transformation? As I start to get some deeper(or at least a little bit better) understanding on how camera transformations works, I am curious about one thing: How much matrices should I use ?

I mean, until now I have been working with simple 2d ortho projection and I was using world positions (not in range -1.0 to 1.0 ) so I just created a matrix at the start of the program and that was it but when I wanted to get more to 3D(to get same effect of not using NDC) I noticed (in tutorials) that they use a lot of matrices(for example : they create matrix for every object ingame for translation and then send it to the GPU). This confuses me because I thought that I will use only 3 matrices (for every transform step). Can you explain me how is this done in professional games? Do I need to load new model matrix for every object(send it to vertex) ? Or change the whole MVP matrix in shader with every object being rendered? Is it still sufficient? Thanks

Edit
About efficiency : Is it efficient to change the shader variable that often ? I mean, I want use my batch system from my old code and it looks like this now:

1. Bind texture + VAO
2. Render object.1+object.n via glDrawArrays/Elements/Instanced

But what about now it would be :

1. Bind texture + VAO
2. Load model matrix of object.1(via glUniformMat4fv) and render it, then load another model matrix for object2 and same for every object in batch

Isn´t it inefficient to change shader variable that much ?

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:
Victory rewards in digital CCG I am currently polishing a digital CCG where people can play against friend and random opponents in a classical Magic the Gathering-like duel CCG.

I plan to award the players with 20 ingame currency units (lets call them gold) for each hour they are playing, 50 for each day they are playing and X for each victory.

Now, the X is what I am trying to calculate here, since I would prefer keeping the currency to a certain value, but also with to entice the players to battle.

I could go with a solid figure, say 25, for beating up an opponent. But that would result in experienced players only beating up newly started players, making the experience lame for both.

I could also make a laddered tier, where you start at level 1, and raise in level as you defeat your opponents, where winning over a player awards you his level x 2 in gold.

Which would you prefer if you were playing a game like this. There is no gold-based scoreboard, but the gold is used to purchase new cards along the way.

sentences:
DrawImage problem adjacent sprite? Context

I'm building a 2D game from scratch in JS.
I'm drawing the map by using rpgmxp tilesets for the moment just to have some resources :

Each tile is 32*32 pixels. I'm using canvas API with ctx.drawImage method to display it :

ctx.drawImage(tile.tilesetImg, tile.sX, tile.sY, this.tile.w, this.tile.h, canvasX, canvasY, Engine.Camera.tile.w, Engine.Camera.tile.h);

I use different parameters for the image source size (this.tile.w & this.tile.h) and the image destination size (Engine.Camera.tile.w, Engine.Camera.tile.h).

This has the effect of scaling the game, like that each user have the same map exactly displayed (32 tiles * 24 tiles). The current tile aspect ratio distortion doesn't matter to me for the moment.

The result displayed to the player with a 4:3 ratio :

Problem

When I change window size if I don't keep the ratio 4:3 (because i display always 32 tiles * 24 tiles for the player) one of my tile types causes strange visual artifacts. This happens in chrome and firefox and probably all browsers.

It's strange because all the other tiles are drawn from the same method, but do not exhibit this behavior.  This behavior only seems to occur when the ratio is very different from 4:3.

Here is an example of what I'm talking about.

There is some transparent lines which display the background at the right of each "bad" tile. Note this tile happens to be the first tile from the tileset (first image above).

The same thing happens if height alone is changed, except the line will appear on the bottom instead.

The thing which is again more strange is that if i change the tileset to draw a red line at the right of the first tile :

The transparent line is replaced by the red line when drawing the map :

From debugging (console.log), there doesn't apear to be any reason that tile source size would be 33px instead of 32px, but the artifacting effect makes it seem like this is the case.

Question

I appear to be using drawImage correctly by all accounts, so googled to see if this was a known problem. I was reading the w3 documentation when I found that :  (especially the last note of part 12)

  Thus, scaling an image in parts or in whole will have the same effect.
  This does mean that when sprites coming from a single sprite sheet are
  to be scaled, adjacent images in the sprite sheet can interfere. This
  can be avoided by ensuring each sprite in the sheet is surrounded by a
  border of transparent black, or by copying sprites to be scaled into
  temporary canvas elements and drawing the scaled sprites from there.

Does this explain the problem ?  Does any one know what the problem is more in detail ?

Thank you in advance, best regards.

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:
Basic Box2D collision detection I don't understand how to listen for collisions in Cocos2D/Box2D.  Say I have two dynamic circle bodies.  One is very small and the other is relatively large.  When the small circle collides w/ the large circle I'd like to do something (play a sound for example).  What's the best way to do this?

I'm currently experimenting w/ the TestPoint method.  Something like:

if(largeCircleBody->GetFixtureList()->TestPoint(smallCirclePoint)){
    // collision happened...
    // play sound etc
}

sentences: How can I eliminate these white outlines on my sprites in libgdx? I'm recently started working on a game in libgdx, and I've run into the problem that my sprites tend to get a thin, whitish outline around them. This is especially a problem for me since I'm working with ragdolls, so I'm drawing arms as separate sprites from the main torso and ending up with ugly outlines around them. After some googling, I found out this was from the linear filtering I'm doing on my textures. Problem is, linear filtering overall looks much nicer than nearest filtering. After more googling, I found out I should be able to fix this problem with alpha premultiplication. Unfortunately, I have no idea how to go about this in libgdx. Alternatively, if someone knows another way to get rid of the outline, that would be great too. Here is a screenshot showing what I'm talking about (Images are standins and don't actually belong to me). If you look at the arm, there are clear outlines at the shoulder and elbow.

sentences:
what is the simplest 3d software for unity? Ive heard a lot about Daz studio, Poser, Maya, K-3d, Anim8or, Blender, and all the rest.

My question is which one is the best choice in terms of simplicity and quality. price is not an issue really. I'm programming games in java for android mobile devices at the moment but i will eventually move onto larger platforms. I would like to utilize unity3d for the game programming itself and utilize a 3d modeling software just to create the game objects.

I just need to know the best one to get started with from scratch or should i use a combination of multiple ones? Any insight for this would be great, thanks!

sentences:
Unity: Interrupting Animations When I interrupt an Animator Controller during an Animation and reopen it the Armature gets stuck (more or less) at the point where the previous Animation was interrupted. How can I safely and instantly quit an animation without destroying it?

Please watch the Video to fully comprehend the problem: https://youtu.be/O9X5SBATHRw

Screenshot of Problem:

Screenshot of Animator Controller:

Part of the Weapon Switch Script:

disableWeaponModel(weaponNameList[activeWeapon]); //Disable active Weapon Model

if (holsteredWeapon == -1) //If player carries only 1 weapon
    holsteredWeapon = activeWeapon; //Active Weapon is holstered
else //Player already carries 2 weapons
    actionDropGun(); //Active Weapon is thrown (New LOD generated)

activeWeapon = getWeaponIDfromLOD(targetName); //Active Weapon is set to Target LOD

setWeaponVars(activeWeapon); //Set all variables to the active Weapon
setWeaponModel(weaponNameList[activeWeapon]); //Set Weapon Model to the active Weapon
setAnimator(weaponNameList[activeWeapon]); //Set Animations to the active Weapon

setAnimator(string name) Function from above (last code line):

void setAnimator(string name)
{
    //Add new guns here
    if (name == "MP5A3")
        currentWeaponAnimation = MP5A3_Animation;
    else if (name == "Rpk-74")
        currentWeaponAnimation = Rpk74_Animation;
    else if (name == "Skorpion")
        currentWeaponAnimation = Skorpion_Animation;
}

Variables from setAnimator(string name):

sentences:
bullet character controller sliding down any slope gradient I've been experimenting with the btKinematicCharacterController. I've seen very old complaints that it has issues but I can't find anything recent stating that these issues remain (and nobody ever says what the issues were).

The problem I'm seeing is that the character is sliding down slopes at absolutely ANY gradient. It will only stand still on level ground. If I have a ramp with a very gentle gradient it will slide slowly. I've found posts asking about this on the Bullet forums but haven't found any solutions.

I've set the friction and rolling friction for both the ramp and character capsule to a very high value but it doesn't seem to impact the sliding. I'm sure there's something else I'm missing or is there something wrong with the controller's implementation of recoverFromPentrations (It seems to shift the object by the collision normal on the other surface which is necessary to avoid going through walls).

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:
LibGDX viewport touch coordinates transformation I've been trying to get LibGDX's viewport and camera unproject() to work and so far none of the tutorials/answers I've found have worked for me.
I have a game window of 840x480 units with FitViewport. If the screen resolution matches the aspect ratio of the viewport, the coordinates are unprojected correctly. If it doesn't and the viewport inserts black bars, the transformation is incorrect (see below):

I'd like for the shape to be drawn where the cursor is, since the current behavior makes touch input on Android absolutely useless...

Furthermore, on Android the viewport doesn't fill the entire screen and just produces a rectangle on the bottom left quarter of my 1920x1080 px display.

Here's the code that produces this:

public class MainScreen extends ApplicationAdapter implements InputProcessor {
OrthographicCamera camera;
Viewport viewport;
Vector3 worldCoordinates = new Vector3();
Shape shape, background;
public ShapeRenderer sr;

@Override
public void create() {
    worldCoordinates = new Vector3();
    camera = new OrthographicCamera(800,480);
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
    viewport = new FitViewport(800, 480, camera);
    viewport.apply();
    sr = new ShapeRenderer();
    shape = new Shape(this, 20, 20, 0, 0);
    background = new Shape(this, 800, 480, 0, 0, Color.WHITE);
    Gdx.input.setInputProcessor(this);
}

@Override
public void resize(int width, int height) {
    viewport.update(width, height);
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
}

@Override
public void dispose() {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void render() {
    camera.update();

    Gdx.gl.glClearColor(0, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    background.render();
    sr.setProjectionMatrix(camera.combined);

    shape.posX[0] = (int) worldCoordinates.x - shape.sizeX[0] / 2;
    shape.posY[0] = (int) worldCoordinates.y - shape.sizeY[0] / 2;

    shape.render();
}

@Override
public boolean mouseMoved(int screenX, int screenY) {
    worldCoordinates = camera.unproject(new Vector3(screenX, screenY, 0));
    return true;
}

@Override
public boolean keyDown(int keycode) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean keyUp(int keycode) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean keyTyped(char character) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    return true;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    return true;
}

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    return false;
}

@Override
public boolean scrolled(int amount) {
    throw new UnsupportedOperationException("Not supported yet.");
}
}

And the Shape class:

public class Shape extends Element {
public Color background;
ShapeRenderer sr;
public Shape( MainScreen ms, int sizeX, int sizeY, int posX, int posY){
    super(sizeX, sizeY, posX, posY);
    sr=ms.sr;
    sr.setAutoShapeType(true);
    background = new Color();
    background.set(1, 0.533f, 0, 1);
}
public Shape(MainScreen ms, int sizeX, int sizeY, int posX, int posY, Color background){
    super(sizeX, sizeY, posX, posY);
    sr=ms.sr;
    sr.setAutoShapeType(true);
    this.background = background;
}

@Override
public void render(){
    sr.begin(ShapeRenderer.ShapeType.Filled);
    sr.setColor(background);
    sr.rect(posX[0],posY[0],sizeX[0],sizeY[0]);
    sr.end();
}
}

I have tried literally every option I could find without any result. Thank you for any help.

sentences:
Suggestion for C++ reinforcement learning library to control flocking algorithm I am looking to use reinforcement learning to adaptively modify the weights involved in a flocking algorithm (i.e. 'boids').

Searching google revealed several libraries, but I don't know anything about any of them.

I am far from being an expert in reinforcement learning, though I have perused Sutton and Barto's classic book on the subject, so I understand some of the concepts.

A little background, in case it helps.  I have a few steering behaviours (seperation, alignment, cohesion, forward, and wall avoidance), which each generate a 'force' vector and compete to tell the agent(s) where to move.  Each force vector is combined in, basically, a weighted sum.  I would like to 'learn' these weights adaptively so as to cause e.g. more/less clustering, reduce/increase the flock's speed, etc.

Can anyone recommend a good library to use?

I would also need some kind of linear classifier, or something, to interface the learning with the (float valued) weights for each of the flocking steering behaviours.  So a library that provides a one-stop solution for this problem would be good?

sentences:
game object disappears when I add OnTriggerEnter script I'm setting up collision detection for my enemy objects and projectile. When I add the detect collision script below, my enemy object just disappears. Projectile has the same detect collision script and also disappears.
I get this error code:
NullReferenceException: Object reference not set to an instance of an object
MoveForward.Start () (at Assets/Scripts/MoveForward.cs:16)
This is a copy of my prefab settings for enemy object:

I'd appreciate any advice. Thank you
Detect Collision Script
using System.Collections.Generic;
using UnityEngine;

public class DetectCollision : MonoBehaviour
{
  // Start is called before the first frame update
  void Start()
  {

  }

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

  }

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

}

Move Forward Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveForward : MonoBehaviour
{
  public float speed = 20f;
  public GameObject Trump;
  public GameObject Player;
  private Rigidbody enemyRb;
  // Start is called before the first frame update
  void Start()
  {
    enemyRb = GetComponent<Rigidbody>();
    Player = GameObject.Find("Player");
    this.transform.LookAt(Player.transform);

  }

  // Update is called once per frame
  void Update()
  {
    transform.Translate(Vector3.forward * Time.deltaTime * speed);

  }
}

sentences:
odd line artefacts on my screen? (C++ DirectX11) I'm getting some odd lines on my screen in my program:

They seem to be in a static location on the screen and occur at regular intervals. They are also on the horizontal too but are harder to see in the image.

So far I have tried:

turning anti-aliasing off,
turning multi-sampling off,
rendering my images at full size (no scaling) and
using texture sizes of a power of 2.

And none of that seems to work. Right now I am working on adding fonts in, but this issue means that lines of the fonts can disappear (the bottom of an 'o' the middle of a 'B' (so it looks like a 'D'), etc).

sentences:
Unity3D RigidBody adding force diagonally (x,y,0) results in two separate movements instead of one diagonal movement? The intentions of this function are to utilize the RigidBody component from a "target" object and clear its force while applying a diagonal force in the direction upwards and away from the side they are facing. I have omitted the portion in which detects the other direction for the sake of simplicity in reading the function as I've been testing this function while the user faces the right-hand direction.
Variables:

target refers to the other object currently in the scene
targBody refers to the RigidBody component of the target
object   damage refers to the current damage integer of the
object.      The damage used in this instance is from the target
object   facingRight refers to a bool in which is true
whenever the current object is facing the right-hand
direction.

    public void Damage() {
        targBody.velocity = Vector3.zero;
        if(facingRight) {
            Vector3 newVel = new Vector3(target.GetComponent().damage/16, target.GetComponent().damage/16, 0);
            targBody.AddForce(newVel, ForceMode.Impulse);
            print("Stuff");
        }
        target.GetComponent().damage+=3;
    }
For some reason, when I apply the force, the target object doesn't move diagonally. Instead, it moves horizontally before moving vertically; however, for some strange reason the horizontal speed is always greater than the vertical speed as it goes so fast that it nearly teleports!
I'm not sure if this error happens because of a coding problem on my part that I'm just not recognizing or if it's a problem with RigidBody in which I need to use a workaround for.Anyone have any ideas on what can make this function work the way I want it to?

sentences:
Generating 'Specially' shaped rooms for a Dungeon I've made a fairly simple dungeon generator but now I want to expand on it so that I can procedurally generate a dungeon with irregular shaped rooms. I don't just want any old crazy shapes popping up though, I want to be able to have room types that follow a certain pattern but ultimately have random sizes. I just don't have a clue how to generate rooms that aren't just square.

I have an idea of how to merge squares together to make rooms comprised of other rooms, but I'm more interested in how to get hexagon and octagon shaped rooms, or doughnut-like rooms.
My code for generating square rooms is:

    public static char[,] GetSquareRoom(int width, int height)
    {
        char[,] roomLayout_Square;

        roomLayout_Square = new char[width, height];

        for (int x = 0; x < roomLayout_Square.GetLength(0); x++)
            for (int y = 0; y < roomLayout_Square.GetLength(1); y++)
                if (x == 0 || y == 0 || x == width - 1 || y == height - 1)
                    roomLayout_Square[x, y] = '#';
                else
                    roomLayout_Square[x, y] = '.';

        return roomLayout_Square;
    }

I would like to create more functions like this that will accept a few variables so I can create specific variations of these room-types, so I can input specific number and randomly generated values alike.

:)

sentences:
How to make a one way trigger? In my game, there is a cat that jumps on pillars. When it lands on a pillar, force is applied and it jumps. There are three animation states which are just single image. The states are : idle,up and down.

When cat lands on the pillar, Collision is triggered where i set animation state to idle. Then, force is added and animation state is changed to up. But problem is, this collision and add force happens so fast, the cat switches between down and up without showing idle.

To overcome this, i added an empty child object to pillar. Then added Edge collider set as trigger. This child was placed slightly above the pillar. So when cat hit this, animation state would switch to idle. Then the cat would land on pillar and jump.

This worked except, the trigger is two way. When cat jumps from pillar, it collides with this trigger and state is changed from up to idle. I tried to add platform effector with one way, but the effector cannot be used on a trigger.

So, is there a way i can add a collider to the empty child which will let it go through aftyer setting state to idle?

sentences:
OpenGL ES screen to world coordinate I am currently attempting to convert my screen coordinates to world coordinates, to be able to interact with objects. I am using glm and unProject to try and achieve this, so far this is my code:

glm::vec4 viewPort = glm::vec4(0.0f, 0.0f, width, height);
glm::mat4 tmpView = sceneCamera->updateView();
glm::mat4 tmpProj = sceneCamera->updateProjection();
glm::vec3 screenPos = glm::vec3(touchPosition.x, height - touchPosition.y - 1.0f, 1.0f);
glm::vec3 worldPos = glm::unProject(screenPos, tmpView, tmpProj, viewport);

Renderer->SceneObjects[120]->translateX(worldPos.x);
Renderer->SceneObjects[120]->translateY(worldPos.y);

I am trying to get a sprite to equal the position where I tap.
The issues is that the further I click going down the screen, the further the sprite overshoots, and the same horizontally. So if I click 2/3 the way down the screen, the sprite will overshoot the bottom of the screen.

sentences:
Libgdx - Building dynamic 3d models with Modelbuilder/MeshPartBuilder while rendering Context: I'm building a mobile game targeted for android with libgdx. It's an endless highscore based game. The environment/terrain is build dynamically. It's kind of a maze/wall/block terrain. I'm using the ModelBuilder and MeshPartBuilder API of libgdx to create the model.

Problem: As the game is endless and the terrain random, I need to build the model while rendering preferably at consistent 60fps. I have put the generation code into a worker thread. This works, but the end() method of the ModelBuilder has to be called in the rendering thread, because of the needed opengl context.

Even if I only build a single rectangle using meshpartbuilder, I get a huge framedrop from calling ModelBuilder.end() .

Codesnippet:

// we are in a worker thread
modelBuilder.begin(); // ModelBuilder instance
MeshPartBuilder wallBuilder = modelBuilder.part("mazePart", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal | Usage.TextureCoordinates, modelMaterial);

... create some meshes with MeshPartBuilder ...

Gdx.app.postRunnable(new Runnable() {
    @Override
    public void run() {
        Model model = modelBuilder.end(); // method that causes a framedrop from 60 to ~35
        activeModels.add(model);
    }
});

Question: How do I achieve stable fps while building models dynamically in libgdx? Is it even possible?

sentences:
Rotate a Polygon node in Shader Graph I have a hexagon in the Polygon node I would like to rotate so the pointy side is upwards. Applying the rotation nodes, however, simply changes the color of the hexagon from white to a color in the rainbow.
What does the Vector1 of the Polygon output represent and is there a way I can rotate it as if it were a texture?

sentences:
GLSL 2d Per Pixel Lighting First time writing shaders, and having a bit of an issue getting per-pixel lighting to work.  The problem is pretty simple, but I'm afraid am doing something wrong here.

Vertex Shader:

#version 150

uniform mat4 proj;      // ortho projection matrix
uniform mat4 world;     // world transformation (usually only rotation)

in vec2 pos;            // position for this vertex

out vec2 ex_pos;        // pass position to frag shader

void main()
{
    gl_Position = proj * world * vec4(pos, 0.0, 1.0);
    ex_pos = pos;
}

Fragment Shader:

#version 150

uniform vec2  light_pos;        // light position
uniform vec3  light_color;      // light color
uniform vec3  intensity;        // intensity value to apply to the light
uniform float attenuation_c;    // constant attenuation
uniform float attenuation_l;    // linear attenuation
uniform float attenuation_q;    // quadratic attenuation

in vec2 ex_pos;     // interpolated position

out vec4 frag;      // final fragment color value

void main()
{
    // compute the current distance from light
    float d = distance(light_pos, ex_pos);

    // compute attenuation for this point
    vec3 frag_intensity = intensity / (attenuation_c + attenuation_l*d + attenuation_q*pow(d,2) );

    // blend mode is additive
    frag = vec4(frag_intensity * light_color, 1.0);
}

So, this seems pretty straightforward, but I am getting a hopelessly dark polygon (i.e., the additive fragment color always ends up 0,0,0).  I have tested that simply setting d to any positive value causes the entire light polygon area to be uniformly lit, so I'm thinking that my distance computation is just wrong, but I'm not sure how it could be.  I did have this working a bit earlier by doing vertex lighting instead of fragment, so I'm pretty sure my uniforms are being set correctly.

Is it the interpolated position that is causing a problem?

Thanks for any help.

sentences:
How can I use the Kinect as a microphone in Linux? I am using Ubuntu 14.04 LTS, and the Kinect camera has type Microsoft_Xbox_NUI_Sensor_043367545147-02-Sensor.

I can access the Kinect's camera from a Linux program that I'm writing, but I'd also like to use its microphone for voice communication. How can I do that?

sentences:
Changing the origin/pivot point of the parent in Unity I create a game object, add some children to it, and would like the pivot point of the parent to be somewhere inside the area occupied by the children, not far away in the scene.

Like in the example below, I have three blocks of platforms situated near each over. I add them into a parent, then try to move that parent and notice that the origin point of the parent is actually not somewhere between its children, but outside them on the upper right:

Does someone know a way to change the origin point in such case?

sentences:
"Instantiate" function in Unity spawns enemy but it doesn't show up So, I'm making a top down shooter (2D) and I already made an enemy prefab. It walks to the player and damages it, and reacts to bullets physically until it eventually dies. The prefab itself is ok, because I can spawn it manually and it works as intended. The problem comes when I want to automate the spawn process with a script. So I made a script to do so, here it is:

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

public class GameController : MonoBehaviour
{

    public GameObject enemy;

    private float spawnPositionX;
    private float spawnPositionY;

    Vector2 spawnVector;

    // Start is called before the first frame update
    void Start()
    {
        SpawnEnemy();
    }

    void SpawnEnemy()
    {
        spawnPositionX = Random.Range(-630f, 630f);
        spawnPositionY = Random.Range(-340f, 340f);

        spawnVector = new Vector2(spawnPositionX, spawnPositionY);

        Instantiate(enemy, spawnVector, Quaternion.identity);
    }
}

As you can see, it's nothing too complex. I just refer to a game object (which I linked by the way) and then create some variables that will hold the x and y positions in which the enemy will spawn at random. Then when I call the function, those positions get set and stored into a bi-dimensional vector to then be used with the instantiate function.

This... works... kinda? When I run the game, the instance of the enemy gets made, I can see the clone in the hierarchy and I can select it and see that it's indeed moving, but it's like... not there? I can't actually see it on the screen and it's not invisible as I can't interact with it either. It's really weird and I have no idea what's going on.

I tried to put the script on the camera, on the canvas, on a new empty object, nothing. I also checked that the prefab and the instance that's being spawned are indeed active. I thought about the coordinates being out of bounds, but when I check my player coordinates they are inbounds, so that can't be it either. I'm completely lost on this one, thoughts? Thanks.

sentences:
Converting many faces to single mesh and reduce poly-count in Blender I'm not so familiar with 3D modelling, and I'm stuck on a simple task in Blender.

I have a fairly complex model that's been imported as a .DAE file from SketchUp. This model is composed of many polygons, not as one single mesh but in many components, in fact over many hundreds of surfaces.

As I said I'm new to Blender and want to learn. If I select one of the component surfaces, I can go into Edit mode and then use the Decimate modifier to reduce the poly-count.

But it doesn't want to let me do this if I select the whole object!

I think I need to combine all the surfaces into one mesh (?) and then apply the Decimate algorithm to gracefully reduce the poly-count.

I've managed to do this before but unfortunately I forgot how and I need to try again to get the balance right on the poly-count.

Appreciate the help.

Alex

sentences:
Level editing using a 2D map for a 3D game We're trying to make a level editor for a 3D game that involves walking around outdoor environments. In many ways a heightmap satisfies the game's needs, but it also falls short in several ways, so we're considering various enhancements to the heightmap concept, but it's proving difficult to find a simple solution to this problem.

For a start, a heightmap has great difficulty with sharp edges. As long as everything is smooth a heightmap looks wonderful, but it becomes jagged around vertical cliffs, along the edges of roads, and anywhere the resolution of the heightmap becomes relevant. The obvious solution to these issues is to add a layer of vector drawing on top of the heightmap, so we can preciously define the curves of vertical cliffs and roads, and use this to insert specialized polygons into the terrain's mesh. A vertical cliff can even be a simple gap in the terrain mesh that can be filled by another mesh which allows us to render the cliff face however we like, bypassing the limitations that heighmaps usually have.

Another issue with heightmaps is the difficulty of drawing smooth slopes by hand. For the purposes of the game, terrain should either by a gentle slope or a vertical cliff, so there is no ambiguity over whether the player can traverse through it. We could scan the heightmap to detect overly steep slopes and show an error message, but what we really want to do is give the user drawing tools that will only draw acceptable slopes. But how can this be done?

Perhaps the traditional raster heightmap is causing more problems than it is solving, so an entirely different kind of heightmap is called for. Perhaps instead of adding a vector drawing layer, the whole heightmap was done as a vector image and represented as a set of polygons with each polygon having a certain elevation. This way we get smooth curves automatically, and creating meshes for vertical cliffs and flat land is trivial, but representing slopes in the editor and rendering them becomes a challenge.

We've considered a blending tool that would draw polygons on a second layer, and wherever these blend-polygons appear the underlying terrain polygons would smoothly merge together. Polygons that have shared edges would from a slope perpendicular to those edges at an angle that makes the slope walkable. Unfortunately working out the geometry of the resulting mesh is difficult, and it means that cliffs are the default for every change in elevation.

Since it seems more natural for the user to draw lines to block the player's passage rather than drawing the places where the player can traverse, another approach is to have the user draw the cliff lines in another layer just as with the raster heightmap, but now those cliff lines would act to stop the terrain from smoothing itself into pure rolling hills. Imagine each polygon of the heightmap as a pillar of sand with vertical sides, and when a mesh is formed from the map the sand flows out of its pillars, forming smooth slopes in every direction except where it encounters a cliff line and is forced to flow around. Everywhere except the cliffs need to be a gentle enough slope to walk up, so when there is a gap in a cliff the sand needs to flow through and spread out on the other side. We have some ideas about how this might be done, but it's still a major challenge to implement.

Finally, we could just use a grid with sloped blocks to represent slopes. Editing would be easy, generating the mesh would be easy, all the problems would be solved, but being confined to a grid would surely sacrifice the freedom we'd hoped to have. We don't want to be constrained to being axis aligned unless no other solution is practical.

Ultimately the question is: are there practical ways to implement any of the approaches we're considering, or are we coming at this from entirely the wrong direction?

sentences:
Fading in and fading out animations This is how I'm creating my player. Is there any way to start fading in and fading out for an amount of time when I get hit?

private Texture tex = Game.res.getTexture("player");

public Player(Body body) {
   TextureRegion[] sprites = new TextureRegion[1];
   sprites[0] = new TextureRegion(tex, 0, 0, 70, 96);
   sprites[1] = new TextureRegion(tex, 69, 193, 68, 93);
   animation.setFrames(sprites, 1 / 6f);
}

sentences:
Text anti-aliasing Unity I am trying to implement a game like BBTAN with Unity5, the point I got stuck on is drawing numbers onto the boxes in a proper way. I have done it by adding Canvas and Text elements on each boxes and set the following properties of them in order the fit the text inside to the canvas:

Render Mode: World Space
Dynamic Pixels Per Unit = 1250
Reference Pixels Per Unit = 100

Even though the text fits into the box, its being rendered without antialiasing. And it looks like this (The box is on the right hand side is the Screen Space Overlay Canvas, for comparison purpose):

I have two questions to ask:

Is adding canvas to each block an efficient way? If not how should I implement drawing dynamic numbers (Changing when got hit) onto these boxes?
Is "changing the dynamic pixels per unit" the correct way to achieve this goal? If so, how can I fix this anti-aliasing problem?

Thanks in advance for any help!

sentences:
How to make gravity in Blitz3D? I am making a game in Blitz3d and I made simple gravity, however once the object falls on the ground, it goes through it very slowly. The ground is a plane and I have collision on it.

This is a pretty old engine, and not a lot of people are using it but I decided to use it because it's easier than Unity3D for me and it's very basic and customizable.

Here's my code:

AppTitle "FPS"
Graphics3D 800,600,32,2
SetBuffer BackBuffer()
SeedRnd MilliSecs()
HidePointer

;Objects
Global player = CreatePivot()
Global camera = CreateCamera(player)
Global cube = CreateCube()
Global light = CreateLight()
Global plane = CreatePlane()
Global cube2 = CreateCube(player)
col_plane = 1
col_player = 2
col_cube = 3

;Vars
gravity# = -.00001
plx# = 0
ply# = 0
plz# = 0
pldx# = 0
pldy# = 0
pldz# = 0

;Textures
CameraClsColor camera,135,206,250
box = LoadTexture("models\box.png")
dirt = LoadTexture("models\dirt.jpg")

;Object Details
EntityType cube,col_cube
EntityType player,col_player
EntityType plane,col_plane
EntityRadius player,1.2
EntityRadius plane,1

PositionEntity player,0,10,5
PositionEntity cube,0,1,5
PositionEntity light,0,2,0
PositionEntity plane,0,0,0
EntityTexture cube,box
EntityTexture plane,dirt
ScaleTexture dirt,5,5
CameraRange camera,0.25,200

;Called Functions
While Not KeyHit(1)
    Cls
    ;Collisions
    Collisions col_player,col_plane,2,2
    Collisions col_player,col_cube,2,2

    If ply < -2 Then
        ply = 0
        pldy = -pldy*.39
    EndIf
    If ply < -1.8 Then
        pldx = .6*pldx
        pldz = .6*pldz
        If KeyDown(57) Then pldy = 2
    EndIf
    pldy = pldy + gravity
    plx = plx + pldx
    ply = ply + pldy
    plz = plz + pldz
    PositionEntity player,EntityX(player)+plx,EntityY(player)+ply,EntityZ(player)+plz

    control()
    RenderWorld()
    UpdateWorld()
    MoveMouse GraphicsWidth()/2, GraphicsHeight()/2
    Flip
Wend

End

;Functions
Function control()
    If KeyDown(42) ;Shift (for running)
        If KeyDown(17) And KeyDown(30) ;W and A
            MoveEntity player,-0.15,0,0.15
        ElseIf KeyDown(17) And KeyDown(32) ;W and D
            MoveEntity player,0.15,0,0.15
        ElseIf KeyDown(17) And KeyDown(30) ;S and A
            MoveEntity player,-0.15,0,-0.15
        ElseIf KeyDown(17) And KeyDown(32) ;S and D
            MoveEntity player,0.15,0,-0.15
        ElseIf KeyDown(17) ;W
            MoveEntity player,0,0,0.15
        ElseIf KeyDown(31) ;S
            MoveEntity player,0,0,-0.15
        ElseIf KeyDown(30) ;A
            MoveEntity player,-0.15,0,0
        ElseIf KeyDown(32) ;D
            MoveEntity player,0.15,0,0
        End If
    Else ;Walking
        If KeyDown(17) And KeyDown(30) ;W and A
            MoveEntity player,-0.1,0,0.1
        ElseIf KeyDown(17) And KeyDown(32) ;W and D
            MoveEntity player,0.1,0,0.1
        ElseIf KeyDown(17) And KeyDown(30) ;S and A
            MoveEntity player,-0.1,0,-0.1
        ElseIf KeyDown(17) And KeyDown(32) ;S and D
            MoveEntity player,0.1,0,-0.1
        ElseIf KeyDown(17) ;W
            MoveEntity player,0,0,0.1
        ElseIf KeyDown(31) ;S
            MoveEntity player,0,0,-0.1
        ElseIf KeyDown(30) ;A
            MoveEntity player,-0.1,0,0
        ElseIf KeyDown(32) ;D
            MoveEntity player,0.1,0,0
        End If
    End If

    While KeyDown(16) ;Q
        RotateEntity camera,MouseXSpeed(),10,10
    Wend
    While KeyDown(18) ;E
        RotateEntity camera,0,-10,-10
    Wend

    TurnEntity player, 0, -MouseXSpeed()/6.0, 0
    TurnEntity camera, MouseYSpeed()/6.0, 0, 0
    If EntityPitch(camera) < -70
        RotateEntity camera, -70, EntityYaw(camera), EntityRoll(camera)
    ElseIf EntityPitch(camera) > 70
        RotateEntity camera, 70, EntityYaw(camera), EntityRoll(camera)
    EndIf
End Function

If there's some one who can actually help me with this, I would appreciate it.

sentences:
How does hidden surface removal work? Lately, I've been learning some OpenGL for fun, and I've been thinking about hidden surface removal.

Say you have a high poly count static scene, with nothing that moves, no bones, physics, etc. Just static models to be drawn. I was thinking that you could put all the faces in the scene into a quad/octree. And with the camera position, and dimensions of the view frustum, you could traverse the tree to construct an index buffer of all the faces that are within the view frustum (facing towards you of course). You could then update the index buffer with glBufferSubData(), and draw with glDrawElements(), and you would do this every frame, and if my limited understanding is correct, this should theoretically draw only the faces you see, right?

So is this a good/valid way to do occulusion culling? If not, how else can you do 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:
Implementing character movement using real physics This is the first time I'm seriously developing a game so apologies if I'm missing the obvious.

In my 2D platformer I adopted Box2D since it seemed like a natural solution to model gravitational pull (player dropping off platforms) and jump arcs and in the process get collision detection for free. It was also a breeze to integrate with libgdx which I'm using as the main game engine.

One thing that I'm struggling with though is, ironically, the most simple thing: expressing player movement along the x axis using Box2D. Where previously it was as simple as translating position as a function of time, now I can only indirectly affect player position by applying a horizontal force to the rigid body representing the player, thus increasing its velocity.

I have multiple problems with this approach:

If I add friction to the platform fixtures, which seems natural, the user has to keep applying a force to the player for it to keep moving. However, my input system is based on the user pointing to a target platform or block upon which the character moves there, then stops.
If I remove the friction from any static objects the player steps on, then it's sufficient to apply force force once for the player to keep moving, but how do I tell it to stop at point x? I couldn't come up with a solution that does not feel convoluted or unnatural. I was thinking for instance to store the target position and then apply a balancing force in the opposite direction once the player reached it. Sounds complicated and prone to failure in corner cases though. I also thought about placing invisible geometry one unit ahead of the target position so that the player would collide with it and stop once reaching the position.

But seriously, both ideas sound complicated and kinda dumb. Am I missing the obvious?

I'm thinking already that maybe I should pursue a mixed approach of physics and direct controls, but I already tried that and Box2D does not like it if I set object positions manually, since this short circuits the computations behind the scenes?

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:
How can I put multiple actors on a Button? I like to have an Button with a Text and some Pictures in it.

Is there something out of the box to that ?

I mean I would like to add a Table into a button, so I could add anything I need to the table.

sentences:
Implementing Scrolling Background in LibGDX game I am making a game in LibGDX. After working for whole a day..I could not come out with a solution on  Scrolling background.

My Screen width n height is 960 x 540. I have a png image of 1024 x 540. I want to scroll the background in such a way that it contuosly goes back with camera

x-- as per camera

I tried many alternatives... drawing the image twice ..did a lot of calculations and many others....
but finally end up with this dirty code

if(bg_x2 >= - Assets.bg.getRegionWidth())   {
//calculated it to position bg .. camera was initially at 15
                bg_x2 = (16 -4*camera.position.x);
                bg_x1=bg_x2+Assets.bg.getRegionWidth();
            }
            else{
                bg_x1 = (16 -4*camera.position.x)%224;  // this 16 is not proper
//I think there can be other ways
                bg_x2=bg_x1+Assets.bg.getRegionWidth();
            }

//drawing twice
       batch.draw(Assets.bg, bg_x2, bg_y);
        batch.draw(Assets.bg, bg_x1, bg_y);

The Simple idea is SCROLLING BACKGROUND WITH SIZE SOMEWHAT MORE THAN SCREEN SIZE SO THAT IT LOOK SMOOTH. Even after a lot of search, i didn't find an online solution. Please help.

sentences:
Do I need to roll my own polygon segmentation algorithm to automate Box2d body creation from a tile map? Before re-inventing the wheel I figured I'd ask:

I'm working on a tile-based 2d-maze level generator for cocos2d + box2d. The idea is:

I'm using one of the well-known graph traversal algorithms to
generate a random maze.
This data gets encoded as an XML of the type that both Tiled and
cocos2d can work with.
Based on the generated maze tile data, my program should also
generate the polygonal data (vertices) that define the walls of the maze so that I can get them from, for instance, a Tiled's XML's object layer and into Box2d for defining bodies.

However, I'm at step 3 and so far, I'm thinking of solving this step with something along the lines of a flood/segmentation/magic wand algorithm. That is, from step 2 I get the graph's nodes which translate in Tiled's XML to, for instance, a 2d array where walls are marked with a number and open spaces are 0s. This is in the cvs non-compressed XML representation for instance.

So what I need to do now is sort of solve the convex-hull problem for a bunch of points (the non-zero numbers in this 2d array), but actually creating different polygons. I also need to then break any concave ploys into convex, but that can be done easiest with ear-clipping and, should I decided to get fancier, Delaunay or something.

Let me illustrate with images:

And in the next image you can see A the set's convex-hull (approximately), and B what I'm trying to achieve (concave subsets of the hull):

That is, I need to be able to distinguish separate polys. Of course, but for one, these also turn out to be concave which Box2d will not like. But like I said, I'll turn them to convex sets afterwards.

The question is, is there anything built-in or tested/tried that I could just grab and use or do I need to implement my magic wand algorithm?

I'm also open to different approaches all together.

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:
(Unity) what happens if i get a transform.position of a nested object Okay so here is the example

You have a plane at position 0,0,0 with a scale 15,1,15 (for demonstration)

Now you have a parent object for the sake of simplicity lets call it parentObject this parent object has the following position: 7,25,26 The parent DOES NOT have a mesh and is thereby an empty gameobject

The parent has a child gameobject Here the issue starts the child has a transform position at 5,-25,30 however this objects transform.position is relative to the parent

last take our agent i know set him to go to childObject.transform.position will he then move correctly to the object or will he, in fact, move to the position that is relative to the parent object?

I know this might seem a bit messy but the general question is if i tell an agent to go to a gameobject that is a child of another object using transform.position will he go to the place we would expect?

sentences:
Access Android Camera.Parameters from Unity I would like to access the android defined class

Camera.Parameters.getHorizontalViewAngle()

from a Unity3D c# script but my java skills are limited. Can anybody offer any help?
I have this code:

using UnityEngine;

#if UNITY_ANDROID
public class CameraParametersAndroid
{
    public static float HorizontalViewAngle { get; protected set; }
    public static float VerticalViewAngle   { get; protected set; }
    public static int   numCameras      { get; protected set; }

    static CameraParametersAndroid()
    {
        AndroidJavaClass unityPlayerClass = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"),
                         cameraClass = new AndroidJavaClass ("android.hardware.Camera"),
                         cameraParametersClass = new AndroidJavaClass ("android.hardware.Camera.Parameters"),
                         cameraInfoClass = new AndroidJavaClass ("android.hardware.Camera.CameraInfo");

        AndroidJavaObject currentActivity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
        object[] args = {currentActivity};

        AndroidJavaObject camera = cameraClass.CallStatic<AndroidJavaObject>("getCamera", args);

        if (camera != null)
        {
            AndroidJavaObject cameraParameters = camera.Call<AndroidJavaObject>("getParameters");

            numCameras = camera.Call<int>("getNumberOfCameras");
            HorizontalViewAngle = cameraParameters.Call<float>("getHorizontalViewAngle");
            VerticalViewAngle   = cameraParameters.Call<float>("getVerticalViewAngle");

        }
        else
        {
            Debug.LogError("[CameraParametersAndroid] Camera not available");
        }
    }
}
#endif

but not even the getNumberOfCameras() call works.

sentences:
How does re-glBufferData()'ing interact with glVertexAttribPointer? I understand the basic sequence: glGenBuffers() creates a "buffer object name," glBindBuffer() creates the actual buffer object (as well as binding the name), glBufferData() "creates and initializes a buffer object's data store," and glVertexAttribPointer() sets the format of the buffer data, as well as saving the buffer object binding as part of vertex attrib array state.
The tricky thing that I'm unsure of is if the glVertexAttribPointer() stuff remains valid if the the "buffer object data store" (but not the buffer object itself) is blown away by a new call to glBufferData(). I'm aware that this isn't usually a good idea - use glBufferSubData() when just rewriting buffers - but glBufferData() seems like the only option if it needs to be resized. Plus, I'm just curious.
The reference pages make it sound like it could go either way - in particular (https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glVertexAttribPointer.xhtml):

If pointer is not NULL, a non-zero named buffer object must be bound
to the GL_ARRAY_BUFFER target (see glBindBuffer), otherwise an error
is generated. pointer is treated as a byte offset into the buffer
object's data store. The buffer object binding
(GL_ARRAY_BUFFER_BINDING) is saved as generic vertex attribute array
state (GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) for index index.
When a generic vertex attribute array is specified, size, type,
normalized, stride, and pointer are saved as vertex array state, in
addition to the current vertex array buffer object binding.

It seems like both the byte offset and the buffer object binding could remain valid, even if the data store was replaced by something different. But I could also see it being implemented such that at the time of the call, the binding captures a specific pointer into the data store, which becomes invalidated if the data store is replaced. Neither way seems to be precluded by the wording.

sentences:
How to create adjustable formula for RPG level up requirements? I'm trying to create a formula that can be modified simply by changing two values: number_of_levels, and last_level_experience. This is to enable people modding the game to change the levelling requirements.

I've got it so that I can specify the number of XP needed for the last level up, but I want to be able to control the XP needed for the first level up, which in this case can differ wildly. For example, if I have 40 levels, and 1,000,000 XP for the last level, the first level up requirement is then 625. But if I change the levels to 80, the first  level up becomes 156. In both cases, the last level needs 1,000,000.

There must be some way to get the computer to work out a suitable curve given just these two basic values.

#include <iostream>

int main()
{
    int levels = 40;
    if (levels < 2) levels = 2;

    int experience_for_last_level = 1e6;
    float fraction = 1.0 / levels;

    {
        int i = 0;
        float fraction_counter = fraction;
        int counter = levels;
        int total = 0;

        for (i = 1; i <= levels; ++i, fraction_counter += fraction, --counter)
        {
            int a = static_cast<int>(fraction_counter * experience_for_last_level / counter);

            std::cout <<"Level "<<i<<":  "<<a<<" ("<<counter<<")"<<"\n";

            total += a;
        }

        std::cout << "\nTotal Exp: " << total;
    }
}

Output:

Level 1:  625   (40)      Level 15: 14423  (26)      Level 29: 60416  (12)
Level 2:  1282  (39)      Level 16: 16000  (25)      Level 30: 68181  (11)
Level 3:  1973  (38)      Level 17: 17708  (24)      Level 31: 77499  (10)
Level 4:  2702  (37)      Level 18: 19565  (23)      Level 32: 88888  (9)
Level 5:  3472  (36)      Level 19: 21590  (22)      Level 33: 103124 (8)
Level 6:  4285  (35)      Level 20: 23809  (21)      Level 34: 121428 (7)
Level 7:  5147  (34)      Level 21: 26250  (20)      Level 35: 145833 (6)
Level 8:  6060  (33)      Level 22: 28947  (19)      Level 36: 179999 (5)
Level 9:  7031  (32)      Level 23: 31944  (18)      Level 37: 231249 (4)
Level 10: 8064  (31)      Level 24: 35294  (17)      Level 38: 316666 (3)
Level 11: 9166  (30)      Level 25: 39062  (16)      Level 39: 487499 (2)
Level 12: 10344 (29)      Level 26: 43333  (15)      Level 40: 999999 (1)
Level 13: 11607 (28)      Level 27: 48214  (14)
Level 14: 12962 (27)      Level 28: 53846  (13)

sentences:
How can I draw the inside of a box as well as the outside? I have a 3D box in which I have some holes. The thing is that when I look through the holes, I can't see the wall of the box that should appear as the inner wall.

How can I draw this as well?

sentences:
Pathfinding on a uneven planetary surface My question is what would be the best approach to pathfinding on an uneven planetary surface?

Background Information

I have created a planet from displacement mapping 6 sphere projected planes. The planes initially formed a cube before being projected into a sphere shape.

I'm wondering if it is possible to use each "sphere projected cube face" as grids and use a simple A* algorithm to find the best possible route, I would also like the displacement height to be taken into account so the path avoids climbing mountains etc (I guess this would just be a heuristic within the A* algorithm)
Another consideration is that I have achieved planetary movement by leveraging Unity3d's physics engine, apply gravity towards the centre of the planet. Would my proposed solution require the agents movement to be controlled independently to gravitational physics.

To help better articulate my question this is my current planetary body:

sentences:
Unity - Array of custom class with a superclass using generics does not show in the inspector I want to create 2 classes for Scriptable Object: Weapon and Armor. Because both have similar functionality, I made a base class for both of them.

using UnityEngine;

public abstract class Gear<T> : ScriptableObject{

    public int price;
    public int level;
    public Sprite image;

    [Header("Levels List")]
    public T[] levels;

    public T CurrentLevel() {
        return this.levels[this.level];
    }

    public T NextLevel() {
        return this.levels[this.level + 1];
    }

    public bool UpgradesLeft() {
        return this.level + 1 < this.levels.Length;
    }

    public void Reset() {
        this.level = 0;
    }

    public bool Upgrade() {
        if (!this.UpgradesLeft()) return false;
        this.level++;
        return true;
    }
}

[System.Serializable]
public abstract class StatsLevel {
    public int price;
}

Both weapons and armors have the properties in common like they all have a price, they all have a Sprite Image, and so on... and more importantly they all have an array of Stat Levels. Meaning that every armor or weapon can have different levels, and depending on their level, the stats will be different. For that I used Generics.

So when I created the Armor, I did it this way:

using UnityEngine;

public enum ArmorStat { Low, Med, High, Super }

[CreateAssetMenu(fileName = "Armor", menuName = "NARG/Armor", order = 1)]
public class Armor : Gear<ArmorStatsLevel> {
    // Armor custom logic
}

[System.Serializable]
public class ArmorStatsLevel : StatsLevel {
    public int weight;
    public ArmorStat blunt, slash, range;
}

in this class I define the stats unique to an Armor. Up to here everything looks peachy. But the issue comes with the Inspector:

As you can see, the inspector is not showing the array with the list of Stats on different levels, and I after a lot of research, I think it has to do with the Generics. If instead of unifying the common code between Armor and Weapon on the Base, I duplicate it each subclass, the Array is shown without problem.

How could I make it so that the array information is shown in the inspector?

sentences:
Finding other programmers to help on a project As a semi FAQ question attempt :

Where can you find people to work with you on a project? Particularly programmers. One thing that is obvious is that all programmers have a project (or twenty), and the chances of a programmer just hanging around looking for something to do is a lot less likely than if it were an artist needed on the team.

So, where do you post? Where do you search and follow people around until it looks like they are a viable team member? Is it really difficult to assemble a team that are not close friends or chat buddies? Are there sites with this sort of posting?

To clarify : I am referring to a team.

Example 1 : I am making gameEngineOfAwesomeness. I need help.

Example 2 : I am 70% complete on this game, and i need help.

Example 3 : I have an open source project idea, with a prototype. I need help.

It doesn't necessarily mean open source, just programmers who can work with me on something (and where to find them :))

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:
Very slow direct3D texture sampling So I'm writing a small game using Direct3D 9 and I'm using multitexturing for the terrain. All I'm doing is sampling 3 textures and a blend map and getting the overall color from the three textures based on the color channels from the blend map. Anyway, I am getting a massive frame rate drop when I sample more than 1 texture, I'm going from 120+ fps to just under 50.

This is the HLSL code responsible for the slow down:

float3 ground = tex2D(GroundTex, multiTex).rgb;
float3 stone  = tex2D(StoneTex, multiTex).rgb;
float3 grass  = tex2D(GrassTex, multiTex).rgb;
float3 blend  = tex2D(BlendMapTex, blendMap).rgb;

Am I doing it wrong ? If anyone has any info or tips about texture sampling or anything, that would be nice.

Thanks.

sentences:
Resolution independence - resize on the fly or ship all sizes? My game relies heavily on textures of various sizes with some being full-screen. The game is targeted for multiple resolutions. I found that resizing textures (downsizing) works quite well for this game’s art type (it’s not Pixel Art or anything like that). I asked my artist to ensure that all textures at the edges of the screen to be created in such a way that they can safely “overflow” off screen; this means that aspect ratio is not an issue.

So with no aspect ratio issues, I figured that I would simply ask my artist to create assets in very high resolution, and then resize them down to the appropriate screen resolution. The question is, when and how do I do that?

Do I pre-resize everything to common resolutions in Photoshop and package all assets in the final product (increasing the size download that the user has to deal with) and then select the appropriate asset based on the detected resolution? Or do I ship with the largest set of Textures, detect the resolution on load, set a render target and draw all downsized assets to it and use that? Or for the latter, do I use some sort of a CPU-sided algorithm to resize on game load?

sentences: How can I make a power-up spawn system semi-random? Basically I'm working on a similar game to achtung die kurve (http://curvefever.com). I'm almost done with the game, however I'm not completely fine with the way power up spawning works. As for now, I have setup a timer loop runs the spawn code block every 1 second. I have setup so each spawning period for each power up (total of 11 powers) is between 19.25 - 1.925 seconds. However this is fine, but it's to random I would say. For example it can be times were no power-ups spawn at all and there can be times were 5 power-ups spawn at the same time. I have made alot of games and this problem comes up every time.

sentences:
How to get past Visual Studio "Setup Error" for Unity development? When I launch Visual Studio from Unity on my laptop, I get the following error:

Setup Error
The setup for this installation of Visual Studio is not complete. Please run the Visual Studio Installer again to correct the issue.

As instructed, I've tried reinstalling Visual Studio multiple times, or using the "repair" option, but nothing has resolved the error.
How can I fix this?

sentences:
How to take into consideration gravity when moving AI I'm making a 2D game. There is currently a helicopter flying around, controlled by the player. It's controlled using the arrow keys: UP, LEFT and RIGHT.

It's speed along the y axis is dy, and speed along the x axis is dx.

It's physics is as follows:

Whenever UP isn't pressed, dy accelerates in constant acceleration, indefinitely towards down. (Gravity). dx stays in it's current value.

When UP is pressed, dy accelerates in constant acceleration from whatever it currently is, up to 4 (upward, until it reaches speed 4). dx stays in it's current value.

When LEFT is pressed, dx accelerates in constant acceleration, from whatever it currently is, up to -4.

When RIGHT is pressed, dx accelerates in constant acceleration, from whatever it currently is, up to 4.

(When LEFT or RIGHT are pressed and UP is not pressed simultaneously, as I said: dy increasingly becomes smaller and smaller, because gravity is affecting the helicopter)

All of this makes the helicopter often follow arches in the air, rather than straight lines.

This creates physics that seem quite realistic.

My question is:

The opponent helicopter, an AI, should move using the same physics system.

Lets say the AI wants to get from where it currently is, to point B.

If there was no gravity and no gradual acceleration in the game, it would be easy. I would simply draw a vector from the AI's position to point B, and make the AI follow it.

But since there is gravity and gradual acceleration, the AI can never move in a straight line (almost). what would be the best way to make the AI go to point B, as time-efficiently as possible?

How can I take the gravity into consideration when moving the AI toward a specific destination?

(If it's easier to explain, please consider point B to be on the same level on the y-axis as the AI, and not in diagonal to it.)

Thanks

sentences:
How to circle an uneven object with Camera at a fixed distance? Unity3d. I am trying to move an object with Camera around a fixed terrain (Mountain), while staying an set distance from its edge.  I have the camera set to lookAt the mountain, and I want to circle the mountain.  I was thinking about sine wave for circular motion but its not an exact circle as I need to move in or out to maintain the fixed distance from the mountains edges.

It looks like I might need transform.RotateAround(..), but what about the adjusting to maintain a fixed distance from the edge of the uneven surface while maintaining the circular motion.

    transform.RotateAround (Vector3.zero, Vector3.up, 20 * Time.deltaTime);

Update:  Here is my current script for circling around mountain as first person object:

function Update () {
   var mountain : GameObject;
   mountain = GameObject.Find("QuantumCold_B");
   transform.RotateAround(mountain.transform.position, Vector3.up,20 * Time.deltaTime);

}

Unfortunately there are two problems:

1) The first person object appears to be falling or maybe its the main camera, but in any even there is a game screen looks like its falling below the mountain.
2) it is the mountain that seems to be rotating. Do I need to switch the main camera to be the first person camera. Why does the mountain appear to be rotating?

sentences:
How do I do random isometric paths? I'm working on an isometric city generator, and I am looking for a little push in the right direction. I'm looking to randomly generate roads on an isometric plane. I have never done path making before, and I've Googled it and didn't find any articles relating to what I am trying to do.

Basically, my program generates a random isometric city and I am hoping to add roads to that.

sentences:
Collision detection in SFML I am building a simple 2D game with SFML and have a GameState object that contains a Plane and a vector of Enemies. THe plane is represented by a triangle and the enemies by a rectangle. The plane object has bullets and I am wondering what is the most appropriate way of handling collision between the bullets and the enemies. The structure of the code is the following :

 GameState
    /\
   /  \
Plane Enemies
  /
Bullets

Every object has Render and Update and possibly HandleInput methods. The way I think that this could work is if I pass the enemies vector to the plane's update method which in turn calls the bullets update method and there I do the check. Is this ok ? Is there an easier and more solid method of doing it ?

sentences:
Playing an animation relative to current Transform in unity? I have an animation created with the built-in dope sheet. It plays correctly but I would like it to be played relative to current object transformation. For example I have a palm tree that moves its leaves. If I rotate the palmtree and then start the animation leaves does not play animation relative to its new position/orientation. I know it is playing this way because of the animation being absolute. Is there any way to make it realtive to current transformation?.

Thanks in advance.

sentences: is it possible to use Ui button to work continous on unity i want to use Ui buttons as joyStick arrows to move character. but as i know buttons just work once. not continous. so is it possible to make button work continous?

sentences:
cylindrical coordinate point in origin I have a camera which has the following attributes:

pos (position of the camera in the scene)
look(either direction in which camera will face, or target vector)
up vector( y axis)

I am using cylindrical coordinates system for moving camera around centre of scene. my question is 'how can I find look vector of the camera in a such a way that it will be pointing out in the origin of the scene under 45 degree?'.

According to this thread there is not such a way.

  And you can never look directly down at the focal point, no matter how high up you go.

P.S: I need somehow to get look vector if it's possible.

Thank you for you attention

sentences:
Timing in fighting game using animations time? I am developing a 2D fighting game in C++. I have made the basic components such as moving, guarding and even a combo system that works perfectly well.

My main concern now is that I want the game to be as balanced as possible, and thus I am entering a testing phase. I am even requesting the help of my father to play against as no AI has been implemented (yet).

In the game you can chain attacks using a punch/kick (PK) button. But you can also charge the attack by pressing the PK button longer, which basically pauses the animation, resuming it when the attack is fully charged or the player releases the button. One thing that I have noticed is that if your opponent is simply pressing the PK button when being hit, it can counter attack pretty easily if you end up charging your attack. This behaviour basically makes charging useless, because it can never go through if your opponent knows that.

So my point is that I need to add a delay so that the counter cannot occur (I do not want it to, because the game is based on an actual PS2 game where you cannot counter that way - for the record, there is a way to escape, either by pressing the guard button, or by hitting a button at the right timing to teleport behind and counter).

To add this delay, I can either modify the actual duration of the "damage" animation so that it does what I want or I can internally add a timer where the character enters a state where he cannot do anything.

I would want to go for the first one, since that way you SEE that you cannot counter using a punch since you are still in the damage animation. But the thing is that each character has its own set of animations and thus in theory, the developer or the designer (which is me in both cases) can modify the duration of one character while the others still have an old value.

My question is thus more on the design level. Is it a good idea to let the timing be decided via animation duration? Is it what is actually done ? If I have fifty characters when I discover another timing issue, it would mean to modify the animation of each and every one of them... But adding a timer internally seems more like a patch that actual fine tuning...

sentences:
Planning Class Inheritance for Game Objects This is specifically about the development and planning direction of the game development.

I'm creating a fairly basic RPG and am wondering about the approach that I should take. I've been trying to outline it all in a flow chart first, but want to see if this is a good way of going about it.

For example, I've created a class called "items", which then currently derives into "Weapons" "Armor" and "Potions". I then derive these classes further into specific types and I keep going and going, basically as specific as I want to get.

Before I get too deep into this (again, I'm still planning) - I just want to know if this is a good way of approaching this problem.

sentences:
Player can only dash towards to the top right, but can't in any other direction? I have a dash mechanic, but it only seems to be working when the player is going up, down, left, right, or to diagonally to the upper right. It won't work diagonally in any other directions, and I can't figure out why?
The super weird thing is this problem only happens when my game is running on my computer, not on my laptop?? Any ideas on how I can fix this? Thank you!
void FixedUpdate()
    {
        if (dashing)
        {
            myRigidbody.AddForce(direction * dashspeed/3,
            ForceMode2D.Impulse);
        }
        else
            myRigidbody.AddForce(direction* thrust/4.75f,
            ForceMode2D.Impulse);
            myRigidbody.AddForce(direction * -thrust * 7f,
            ForceMode2D.Force);
        }

void Update()
{
    direction.x = Input.GetAxisRaw("Horizontal");
    direction.y = Input.GetAxisRaw("Vertical");

    if (Input.GetKeyDown(KeyCode.Space) & powerSlider.value > 0)
      {
        if (direction.x != 0 || direction.y != 0)
      {
        if (CanDash) elapsedTime = 0f;
      }

if (elapsedTime < duration)
            {
                if (!dashing)
                {
                    CanDash = false;
                    dashing = true;
                }
                elapsedTime += Time.deltaTime;
                }

        if (elapsedTime > duration)
        {
            if (dashing)
            {
                dashing = false;
                elapsedTime = Mathf.Infinity;
                StartCoroutine("DashCoolDown");
            }
        }

        if (elapsedTime >= duration)
        {
            elapsedTime = Mathf.Infinity;
        }

    IEnumerator DashCoolDown()
    {
        Debug.Log("dash cooldown");
        yield return new WaitForSeconds(.45f);
        CanDash = true;
    }

}

sentences:
Tile-based 2D collision detection problems I'm trying to follow this tutorial http://www.tonypa.pri.ee/tbw/tut05.html to implement real-time collisions in a tile-based world.

I find the center coordinates of my entities thanks to these properties:

public float CenterX
{
    get { return X + Width / 2f; }
    set { X = value - Width / 2f; }
}
public float CenterY
{
    get { return Y + Height / 2f; }
    set { Y = value - Height / 2f; }
}

Then in my update method, in the player class, which is called every frame, I have this code:

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

    int downY = (int)Math.Floor((CenterY + Height / 2f - 1) / 16f);
    int upY = (int)Math.Floor((CenterY - Height / 2f) / 16f);
    int leftX =     (int)Math.Floor((CenterX + Speed * NextX - Width / 2f) / 16f);
    int rightX = (int)Math.Floor((CenterX + Speed * NextX + Width / 2f - 1) / 16f);

    bool upleft = Game.CurrentMap[leftX, upY] != 1;
    bool downleft = Game.CurrentMap[leftX, downY] != 1;
    bool upright = Game.CurrentMap[rightX, upY] != 1;
    bool downright = Game.CurrentMap[rightX, downY] != 1;

    if(NextX == 1)
    {
        if (upright && downright)
           CenterX += Speed;
        else
           CenterX = (Game.GetCellX(CenterX) + 1)*16 - Width / 2f;
    }
 }

downY, upY, leftX and rightX should respectively find the lowest Y position, the highest Y position, the leftmost X position and the rightmost X position. I add + Speed * NextX because in the tutorial the getMyCorners function is called with these parameters:

getMyCorners (ob.x+ob.speed*dirx, ob.y, ob);

The GetCellX and GetCellY methods:

public int GetCellX(float mX)
{
    return (int)Math.Floor(mX / SGame.Camera.TileSize);
}
public int GetCellY(float mY)
{
    return (int)Math.Floor(mY / SGame.Camera.TileSize);
}

The problem is that the player "flickers" while hitting a wall, and the corner detection doesn't even work correctly since it can overlap walls that only hit one of the corners. I do not understand what is wrong. In the tutorial the ob.x and ob.y fields should be the same as my CenterX and CenterY properties, and the ob.width and ob.height should be the same as Width / 2f and Height / 2f. However it still doesn't work.

Thanks for your help.

sentences:
Space invaders implementation I'm just wondering about the implementing of the collision response of bullets and the fours obstacles.
https://www.youtube.com/watch?v=LCNTwG3MGEg

When a bullet hit, a one black pixel is overwritten. How would one implement it in modern games, because what I feel that they overwrite the framebuffer, but right now I will only swap the sprites or images of different hit-obstacles.

If we say we will draw it as a pixels of bitmap, should then I make then a pixel to pixel collision detection If I want to clone the same behavior?

sentences:
How do I get rid of this coloured border on my sprite? I'm working on a 2D game in Unity. My triangle sprites display in-game with a line along one of the transparent sides:

Larger view here.

You might need to zoom somewhat. It's quite obvious on the leftmost triangle.

I'm unsure where this comes from. There is no border in the PNG file. As you can see in the screenshot, the border is also present in the preview.

Where does it come from? How do I get rid of it?

sentences:
Where to place "Set XYZ over life" blocks in Unity VFX graph? As the title says, I am learning VFX graph in Unity and I am curious where I should place "Set ... over Life", for example "Set Color over Life" which adjust the color based on the particle's age.
When we create a new visual effect graph, they are placed in the Output context by default, which kind of seems odd to me, since it seems more like a Update function?
It also works if I place it in the Update context, but I am afraid that I probably mess with the performance if the block should not be placed there for some reason.
Also, why can't I set it in the Initialize context - if I do, no changes over time are applied.
Probably someone could point me to the right documentation or some explanation for this, thanks.
In general, it would be nice to have a documentation that states which blocks should be used within which context (Initialize, Update, Output).

sentences: Which library to choose between SDL and GTK for C game Development (Begginer) I've been programming in C it's been some time, now I want to get into game development but I'm not sure which GUI library should I use between SDL or GTK? Is it worth sticking up with C or should I switch to C++ (taking out the learning time barrier) ? What will C++ give me that C won't when developing simple 2D games. I am not willing to switch to any other language such as "Java, python, etc" for I still want to use the low level memory management capabilities that C and C++ give. I am also not willing to use a Game Engine to learn game development.

sentences:
How do I create a prefabs when a button is clicked(Unity) So I want to be able to spawn prefabs when a button is pressed
Shop script -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shop : MonoBehaviour
{
    public static string Item01;
    public static string Item02;
    public static string Item03;
    public static string Item04;

    public static int ShopNum;
    // Update is called once per frame
    void Update()
    {
        if(ShopNum == 1) {
            Item01 = "Cannon";
            Item02 = "Tower";
            Item03 = "army Camp";
            Item04 = "Baracks";
        }
        if(ShopNum == 2) {
            Item01 = "Archer";
            Item02 = "Barbarian";
            Item03 = "Goblin";
            Item04 = "Wizard";
        }
    }
}

And then my Shop Access script -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Shop01Access : MonoBehaviour
{
    public GameObject ShopInventory;
    public GameObject Item01Text;
    public GameObject Item02Text;
    public GameObject Item03Text;
    public GameObject Item04Text;
    public GameObject ItemCompletion;
    public GameObject CompleteText;

    void OnTriggerEnter() {
        ShopInventory.SetActive(true);
        Screen.lockCursor = false;
        Shop.ShopNum = 1;
        Item01Text.GetComponent<Text>().text = "" + Shop.Item01;
        Item02Text.GetComponent<Text>().text = "" + Shop.Item02;
        Item03Text.GetComponent<Text>().text = "" + Shop.Item03;
        Item04Text.GetComponent<Text>().text = "" + Shop.Item04;
    }

    public void Item01(){
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy" + Shop.Item01 + "?";
    }
    public void Item02(){
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy" + Shop.Item02 + "?";
    }
    public void Item03(){
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy" + Shop.Item03 + "?";
    }
    public void Item04(){
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy" + Shop.Item04 + "?";
    }

    public void Cancel(){
        ItemCompletion.SetActive(false);

    }
}

How could I spawn a cannon when button item01 is pressed into my 3d scene

sentences:
Why does BorderLayout crop out JSlider on JFrame I have some working code with a small circle randomly appearing around a large circle in the middle, kinda like planets. I have implemented a JSlider that controls the speed of the small ball moving around, and has set it's location to BorderLayout.SOUTH.  The problem is that you can't see the slider when you run. You have to click fullscreen for it to appear. I have a windows computer and I know  that it is blocked by the toolbar, but I kinda don't want to move it. Is there a way to use Java and set it to fullscreen without doing it manually? Here is my code:

     package com.company;

    import javax.swing.*;
    import java.awt.*;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Main extends JPanel {

       private static JFrame frame = new JFrame();
        private static int random = 11;
        private static JSlider timeController = new JSlider(1000, 3000, 3000);
        private static Runnable number = () -> random = (int) (Math.random() * 110) + 1;

        private static ScheduledExecutorService executor1 = Executors.newScheduledThreadPool(1);

        public static void main(String[] args) {
            number = () -> random = (int) (Math.random() * 100) + 1;
            executor1.scheduleWithFixedDelay(number, 0, timeController.getValue(), TimeUnit.MILLISECONDS);
            frame.getContentPane().add(new Main());
            frame.setSize(2000, 1080);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setBackground(Color.GRAY);
            frame.setExtendedState(JFrame.MAXIMIZED_HORIZ);
            frame.setVisible(true);
            frame.setResizable(true);
            timeController.setBackground(Color.RED);

            timeController.setFont(new Font("Arial Black", Font.ITALIC, 10));
            timeController.setForeground(Color.CYAN);
            timeController.setMajorTickSpacing(100);
            timeController.setMinorTickSpacing(10);
            timeController.setPaintTicks(true);
            timeController.setPaintLabels(true);
            timeController.addChangeListener(e -> sliderChanged());
            frame.add(timeController, BorderLayout.SOUTH);

        }

        private static void sliderChanged() {
            executor1.shutdown();
            executor1 = Executors.newScheduledThreadPool(1);
            number = () -> random = (int) (Math.random() * 110) + 1;
            executor1.scheduleWithFixedDelay(number, 0, (timeController.getValue()), TimeUnit.MILLISECONDS);
        }

        public void paint(Graphics g2) {
            Graphics2D g = (Graphics2D) g2;
            g.fillOval(770, 250, 400, 400);
            g.setColor(Color.BLACK);
            if (random > 0 && random <= 15) {
                g.fillOval(920, 3, 100, 100);
            } else

 if (random > 15 && random <= 20) {
            g.fillOval(920, 797, 100, 100);
        } else if (random > 20 && random <= 35) {
            g.fillOval(523, 400, 100, 100);
        } else if (random > 35 && random <= 50) {
            g.fillOval(1317, 400, 100, 100);
        } else if (random > 50 && random <= 65) {
            g.fillOval(620, 143, 100, 100);
        } else if (random > 65 && random <= 80) {
            g.fillOval(1220, 143, 100, 100);
        } else if (random > 80 && random <= 90) {
            g.fillOval(620, 657, 100, 100);
        } else if (random > 90 && random <= 100) {
            g.fillOval(1220, 657, 100, 100);
        }
        frame.repaint();
    }
}

sentences:
How can I calculate an octree node's depth from its location code? The article Advanced Octrees 2: node representations states:

  The AABB (axis-aligned bounding box) of the node can be stored explicitly as before, or it can be computed from the node’s tree depth stored implicitly inside the locational code. To derive the tree depth at a node from its locational code a flag bit is required to indicate the end of the locational code. Without such a flag it wouldn’t be possible to distinguish e.g. between 001 and 000 001. By using a 1 bit to mark the end of the sequence 1 001 can be easily distinguished from 1 000 001. Using such a flag is equivalent to setting the locational code of the Octree root to 1.

The book Real-Time Collision Detection, Volume 1 by Christer Ericson states:

  The size of a node can be explicitly stored or it can be derived from the "depth" of the locational code. In the latter case, a sentinel bit is required in the locational code to be able to distinguish, say, 011 and 000000011, turning these into 1011 and 1000000011, respectively.

Both offer the following algorithm for computing the depth of a node:

int node_depth(unsigned int key) {
    for (int d = 0; key; ++d) {
        if (key == 1) { return d; }
        key >>=3;
    }
    assert(false);
}

How and why does this work?

The location code is a 32 bit word. That is, ... 011 and ... 000 011 might be equal, depending on what the remaining bits of the first location code are. using a sentinel, one has ... xx1 011 and ... xx1 000 011 and now they are different location codes.

What I don't understand is how can I get the depth of the nodes from the location codes and how does the sentinel help me with that.

Going back to the example above, ... xx1 011 and ... xx1 000 011, these words could be ... 000 001 011 and ... 000 001 000 011, respectively. Both cases have the sentinel bit, but since 001 (and any other xx1 combination) is a valid triple, all triples are valid, and there is no way for me to tell what the depth of the nodes is.

The only solution I've found is to store the depth of the node next to the location code, but that article and the book seem to indicate that the depth can be derived from the location code somehow.

sentences:
Simple Bounding Sphere Calculations for 2d game I'm writing a 2d game and have a question regarding the use of bounding spheres.

I'm kind of OK with the math, but I'm confused about one thing.

To work out the distance between the 2 centre points I've read that I need to do something like this:

XDistance = Sphere2_center - Sphere1_center.

And then some other calculations etc...

So if me Sphere1_center X is say, 100 pixels and my Sphere2_center is say 200, then the XDistance will equal to 100 which is fine, however, what confuses me is this.  What happens if the positions of the spheres are reversed, then the 'code' would result in -100.  This surely will affect the remainder of the calculations?

Not sure if I've got the whole thing wrong but I would be grateful if someone could advise.  Many thanks

sentences:
How do I use Sprite in libgdx ashley ecs framework? In the libgdx ashley wiki there's an example of Position and Velocity components, which is pretty easy to understand. My problem now is I don't know how do I integrate Sprite class as Component. In below example, If I use it like this the PositionComponent will be thrown away? because sprite has x and y fields. Also I want to use the method of Sprite setOriginCenter(), in that case do I still need to create another component which is OriginComponent? or completely leave it to SpriteComponent?. Do you think it's recommended to use this class (Sprite) in ECS framework?

class SpriteComponent implements Component {

    Sprite sprite;

}

sentences:
Seams between tiled textured cubes I've created a textured cube in Blender, which I have uv-mapped like this:

The tiles are 256x256, and I've mapped the coordinates exactly at the edges (e.g. x: 256, y: 512). I then export my model as an fbx-file to Unity. In Unity, if I put many cubes adjacent to each other, seams appear between the cubes, like this:

I think I understand why this happens, because the uv-coordinates are exactly on the edges, and thus two faces sample from the same points along an edge.
I could solve this in some ways:

By making the uv-tiles smaller, but it would look ugly with patterns.
By adding some space between the tiles in the texture, and aligning the uv-coordinates to them.

My question: is there a better proper way for achieving this?

UPDATE:
So, about half a year later I still have issues with the seams. I've tried many things:

Start uv-coordinates at 256.5 instead of 256, and so on...
Turned of mipmapping.
Set wrap mode to clamp.
Set filter mode to point filter.
Edge padded the texture atlas with first 4px, 8px, 16px, 32px. But still bleeding occurs at certain angles. Also updated the uv-coordinates accordingly.
Changed my atlas to be of Power of 2 instead, i.e. 1024x1024 instead of 1024x768.
Set "Non Power of 2" in Unity to None so Unity doesn't rescale my texture to nearest Power of 2.
Set texture format to Automatic Truecolor instead of Compressed.

With 32px edge padding it actually gets a lot better, but it still isn't perfect, I guess I could go on and try even more padding, but my textures will get bigger and bigger.
I understand now that it is the mip-levels that are causing the bleeding. At far distances I don't think this is a problem, but I can see this occuring just about 5-7 units away from the player, if the player is looking down.
I believe there is something trivial about this that I'm missing. This is really a showstopper for me, forever grateful to the one who helps me solve this.
Thanks in advance!
This is how I have edge padded my texture (lines not visible on real texture), the problem does not only occur when the faces has such extremes distinct difference in colors as this one. It also occurs when the faces have patterns.

sentences: Unreal Engine Size on Disk I want to install Unreal Engine 4 from the epic game launcher but I have the following problem: If I want to install the engine after about 50% it says I don't have enough space on my disk, and if I look up how much space the folder took it says 75 GB is that normal?

sentences: How can I develop a Lights Out solving algorithm? I am programming the game that named Lights Out. The purpose of this game is turning all the lights out. There's a flash version of the game here. I want to develop a way of solving the game. How can I do this?

sentences:
Distortion of color space in UDK (material editor) Question

Using UDK's material editor, I wish to use a texture as a two-dimensional array of values for mathematical computations (basically, the color components of each pixel in the texture alter the behavior of some transformations applied to another texture).

I want to retain rather precise color values for my mathematical operations to keep their meaning, but in my experiments I noticed a heavy distortion of the color space: dark colors are darker than they should be, and light colors are lighter than they should.

Additional information

This effect is best shown by the following material, which takes a simple linear gradient texture, and applies a rounding operation on the colors:

If the colors were correctly preserved, the preview on the left should have 10 bands of equal length (a black band, a 10% gray band, a 20% gray band etc. with each band being 10% of the width of the image), however the black band is huge, the next (10% gray) one rather large, and the bands get smaller and smaller as they get lighter.

In this example, I take the red channel of the image, but taking the other channels gives similar results: The red and blue channels are identical, and the distortion is slightly different with the green channel, and taking the combination of these logically produces small bands of purple and green between any two bands.

I guess this is a compression issue with the original texure, but I don't know which parameters I should change so the colors are preserved when I use the texture in the material editor.

Above is the texture I used, created with The Gimp. The colors are correct, it is a linear gradient: the color of the pixels in column 0 is (0,0,0), the pixels in the column 255 are (255,255,255) and I manually checked at many points in the image that the pixels in the column x are (x,x,x)).

Above are the properties for this texture. Nothing special here, just the defaults. Specifically, the Adjust Brightness Curve and Adjust RGB Curve properties are set to 1.0 (by default), which seems correct since they are the power to which the HSV and RGB curves must be elevated. The distortion I observed looks a lot like if the values were raised to a given power.

sentences:
How to properly handle sending arrow-key movement data to a authoritative server? I've made a little C# server which receives UDP packets and shows me the incoming information. I want to make an authoritative server in C# which simulates character movement and interaction in a 2D real-time world and sends information back to a Unity game client where the information is then represented.

My question is: How does my server know how long a button is pressed in real-time (example: right arrow key to move character right)?

My guess is that the client would send a UDP packet to the server on-key-press saying move-this-direction. The server would then simulate the character moving and new positional information is constantly sent back. When the Client releases the key a new UDP packet is sent to the server saying the movement key has been released thus stop-moving-this-direction. BUT the problem is UDP unreliability and the lag between letting the key press up, and the server knowing that the key press is up; which would make the character keep moving for a period of time after letting go of the key - is this solved with proper movement interpolation?.

Any ideas or information sources how to properly handle sending arrow key movement data to a authoratative server?

sentences:
How to aim with a spaceship in 3D considering its angular momentum? So I have a spaceship and I have 6 degrees of freedom.

At a given moment the following vectors are known of the spaceship:

Local forward.
Local up.
Local sideways (may be implied from the previous two).
Angular momentum.

The spaceship has 3 torquers to add/subtract to the angular momentum the in main directions relative to it.

Each of them can add 0 to 1 units of angular momentum per second (so it's possible to run them less than full power when needed).

So from the given vectors, how can I compute which torquers to run to lock on the target vector as quickly as possible?

I think this is a basic problem in the field of attitude control. But I couldn't find good pointers yet (maybe I didn't use the right keywords in my search).

The tricky part is that I want to consider the instantaneous angular momentum. Otherwise I would just cross multiply the forward vector and the desired direction vector to have the desired axis of rotation, but that's not what I'm looking for...

My current idea is the following: use the roll torquers to eliminate the roll component the spaceship rotation if any, while using the pitch/yaw torquers to rotate it into the direction based on pitch/yaw angular differences of the forward and the desired direction and the pitch/yaw component of the spin. But I'm not sure it's the quickest, might not even be correct.

sentences:
In Box2dFlash my b2body gets detached from my Sprite after I use setXForm() I have a scenario where I have red coin in a Carrom board game which should be moved outside of the visible window when it is pocketed, also if any coin either white or black is not pocketed in the next shot, the red coin should be replaced in the center of the board.

Now my problem is WHEN I apply the setXForm() method to move the b2body of the red coin outside of the visible area of my flash window.It moves,there is no problem in moving the body,but WHEN i replace the b2body and sprite after the event of no coin falling , the b2body is detached and works as a separate entity having no connection with the sprite of the red coin.

I'm not getting a clue as to what is happening, that is why I thought I'd try posting this here.

sentences:
Unity Application.Quit() doesn't work In the update, I have set up a counter so that after 140 frames, Unity will quit the game. But this quit command doesn't quit and it just continues to play the game. What am I doing wrong? I am using and testing in Unity 2D. There are no errors and all the prints are visible.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Normal_Car : MonoBehaviour
{
    private int counter = 0;

    public Vector3 finalPos = new Vector3(0.00f,0.00f,0.00f);

    public Transform t;

    // Start is called before the first frame update
    void Start()
    {
        t.GetComponent<Transform>();
    }

    // Update is called once per frame
    void Update()
    {
        print("Frame: " + counter.ToString());
        counter += 1;
        t.position += finalPos;
        if(counter >= 140)
        {
            Application.Quit();
            print("Quit!");
        }
    }
}

sentences:
CopperCube game engine Android export failed I am using CopperCube 6.0.2 to develop my game.

I am able to export my game to exe and webgl format, but when I try to export it to .apk format it says:

  aapt tool .exe missing error

I downloaded the sdk pakage and it now shows:

  failed to find the android jar

How can I resolve this issue?

sentences:
How to play animations (GIF, SWF... )? I have many diffrent animations made with flash.
I can make it as (1).SWF, (2).GIF or as (3).PNG (every Frame per second).
Searched in google... but coudn't find anything usefull.

SWF: For SWF i need Flash on the android phone... this is something new to me and because of that i woudn't prefer a solution with that.
-> I heard that Flash is not supported on Android for a long time, so this does not work.
GIF: If that is possible it woud be very nice. I'm thinking of something like "animation1.start();".  But i heard that android can't handle GIF.. -.-
PNG: I know how to animate many .png pictures with an animationdrawable but when i export the animations into a .png for every frame in the second... imagion how many pictures i have. The problem is that i can't make subdirectorys in the drawable folder. Why? I don't have a clue. :/ But realy, that woud suck.

Do anyone have any solution to that than pls feel free to tell me. :)

Edit:
I didn't finde a easy solution so i will make it with animationdrawables.
If you have a solution... pls pls answer here :)

sentences:
In 2d game logic, should I use pixels or world coordinates? Currently in my game I handle the logic (collisions, movement) using pixels but I find it very limiting espiecially when thinking about variable speed.

For example Box2D requires you to use coordinates in metres instead of pixels (for example 50 pixels = 1 metr). Also using normal cartesian coordinates would allow me to use trygonometry etc.

Should I use in my logic code coordinates not bound to pixels (ie metres)? Is it a better approach?

sentences:
Android frame by frame PNG animation I am new at Android game development. I have done some apps before, but none of them are games :)

So, I wanted to do a frame-by-frame animation of PNGs. I tried with AnimationDrawable, but OutOfMemory error comes quickly (I have a lot of PNGs). So I came upon SurfaceView. But I am stuck, because I really don't find any useful tutoirals/examples.

What is the best way to make an animation like this?

Here there already is a great answer to almost the same question, but all the links there don't work anymore.

I would really like to here suggestions how to make an animation frame-by-frame with PNGs in Android and if you have any tutorials or examples, I will be really happy :)

EDIT

I thought wrong about sprites, I think... Sorry, but I am a noob at game developing :) I have 60 PNG pictures (40kb, 427*420px each - on disk) which I would like to put in a animation. Is this even possible to do it with frame by frame animation?

The most similar and famous game that is close to mine is Talking Tom (but I don't know if they have frame-by-frame or any other method for animation).

sentences:
How would I display a unit that is hidden behind another object Right, I've tried searching for this but as you might be able to tell from the title, I didn't really know how to word it anyway...

In some games such as rts games, when a unit is hidden or half hidden behind another object, such as a tree of building, the player will be able to see a translucent coloured version of that unit where it is hidden.

I was wondering how it would be possible to figure out which parts of the units sprite have actually been covered, and how to then use this information to then draw the translucent coloured version of the sprite.

If possible could the answers given relate to c++ and sfml? If not other answers will still be appreciated.

Sorry if my language is unclear its the first time I've asked a question on this site.

sentences:
How to switch sprite animations in cocos2d-x? I have a "GameCharacter" class where I have a sprite for my main character in the game, I loaded the frames and animations correctly. I can switch between animations with single touches or swiping gestures. Right now I can rotate between animations.

In my touch funtion of my scene I have this:

_mychar->RunAnimation(id);

where id is the ID of the animation, just an integer I change with every touch.

the method works like this:

void GameCharacter::RunAnimation(int a){

    _sprite->stopAllActions();
    if(a<_animation.size() && a>=0){
        _sprite->runAction( CCRepeatForever::create(_animation[a]));
    }
}

_animation[] is just a vector with CCAnimate* objects retained (I release them later when I destroy the GameCharacter).

I have 2 idle animations, I want to switch between them randomly, for example, I want to "queue" the first animation 3 to 5 times and the second 1 to 2 times, and repeat like this forever... also, I want to interrupt this "infinite random idle animation" with a touch that makes the character run another animation until it ends (for example a jump animation) and when it ends, just get to the idle animation. I don't know if I explained well, I hope you can understand me.

The id for the animations are:

0-idle1 (3 frames)
1-idle2 (6 frames)
2-jump (12 frames)
3-walk (12 frames)

Right now, i just need to be able to get the character in that idle state (random times between animations 0 and 1) and whenever touch, the jump animation is done once and at the end the idle start again...

I will solve the walking animation later.

Thanks in advance!

sentences: How can the board fit the screen perfectly in Unity's 2D Roguelike tutorial? I follow the tutorial 2D Roguelike tutorial. I want to understand how happen that 10x10 board of 32x32 sprites covers screen perfectly? Like what does this depend on?

sentences:
Unity 2D: Change one instanced prefab then make all the others on the scene like it I want to get this thing working:
I have a prefab with coins, some obstacles and enemies, and i want it to be instantiated each time the player got to the right or left on the stage, to make the stage kinda loop. Then, if the player get a coin in this prefab, this coin will not exist in any other prefab, so if the player goes back to his original place, this coin wouldn't be duplicated(because the idea is a loop)

And it can't delete from the original prefab, because then if we start the game again it'll not have the coins anymore.

Exactly like this:
https://www.youtube.com/watch?v=ETxoUDWCBvE

As you can see, when the blue bird gets the other birds, the yellow bird it isn't there anymore if you go back, because the stage kinda loops, and i want to do that.

How enemies would work? Or there's another way of doing this?

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:
How would intensive AI pathing be done server-side in an MMORPG? Take WoW or Runescape for an example. You have an incredibly large map, filled with cities and forests, each filled with people and monsters.

Monsters roam around an area at random that is 25x25 tiles big (ambiguous). This is done server-side, so every player than comes across this area sees the same location of the same monster, and when a player attacks/kills that monster; other players see it too.

How is this calculated without being a massively intensive task? If you have 500 different types of monsters, all of which have 5 maximum spawned, you'll be calculating 2500 different paths continuously.

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:
what is the sequence in using the "send" and "read" commands on the game client and server? boost asio I have a voxel game in which you can run on blocks (chunks), jump and set/delete blocks. I want to write an asynchronous TCP server for it and choose boost asio as the network library. I have two commands, async_write_some and async_read_some, through them I can transfer the data structure to the JSON format.

How to organize the exchange of messages (packets?) between the server and the client, so that several people can play on the server at the same time?

For example, if you start from the server: should the client send a message and then wait for a response or should it continuously send messages and will a queue of them be made on the server? The same question about the client->server. If the client needs some kind of information from the server, then in what form should this command be sent? In the form of the word "give information about the players on the server" or what?

p.s. Do I need to compress the data being sent?

sentences:
Realistic planetary terrain generation with weights I need terrain generation for a planet. The planet will be divided up into several hundred hexes, and I need it to be realistic and based on weights. I have dabbled in terrain generation before, but nothing like this. So I figure it would be a good idea to ask the community for answers, recommended articles or the like.

By realistic, I mean not just random hexes, but continent shaped things with a few islands. More desert around the equator and more ice around the poles.

I also have two weights I need to base it around: ice percentage and water percentage. That means that around XX% of the planet will need to be water.

Does anyone have any advice or places to start? Generating arbitrary terrain is easy, but something a bit more "organic" like this seems rather difficult.

It also needs to be seamless. Should be obvious since it's a planet, but no harm in pointing it out.

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:
Grouping entities of the same component set into linear memory We start from the basic systems-components-entities approach.

Let's create assemblages (term derived from this article) merely out of  information about types of components. It is done dynamically at runtime, just like we would add/remove components to an entity one by one, but let's just name it more precisely since it is only about type information.

Then we construct entities specifying assemblage for every of them. Once we create the entity, its assemblage is immutable which means we cannot directly modify it in place, but still we can obtain existing entity's signature to a local copy (along with contents), make proper changes to it, and create a new entity out of it.

Now for the key concept: whenever an entity is created, it is assigned to an object called assemblage bucket, which means that all entities of the same signature will be in the same container (e.g. in std::vector).

Now the systems just iterate through every bucket of their interest and do their job.

This approach has some advantages:

components are stored in a few (precisely: number of buckets) contiguous memory chunks - this improves memory friendliness and it is easier to dump whole game state
systems process components in a linear manner, which means improved cache coherency - bye bye dictionaries and random memory jumps
creating a new entity is as easy as mapping an assemblage to bucket and pushing back needed components to its vector
deleting an entity is as easy as one call to std::move to swap the last element with the deleted one, because order doesn't matter at this moment

If we have a lot of entities with completely different signatures, benefits of cache coherency kind of diminish, but I don't think it would happen in most applications.

There is also a problem with pointer invalidation once vectors are reallocated - this could be solved by introducing a structure like:

struct assemblage_bucket {
    struct entity_watcher {
        assemblage_bucket* owner;
        entity_id real_index_in_vector;
    };

    std::unordered_map<entity_id, std::vector<entity_watcher*>> subscribers;

    //...
};

So whenever for some reason in our game logic we want to keep track of a newly created entity, inside the bucket we register an entity_watcher, and once the entity has to be std::move'd during removal, we lookup its watchers and update their real_index_in_vector to new values. Most of the time this imposes just a single dictionary lookup for every entity deletion.

Are there any more disadvantages to this approach?

Why is the solution nowhere mentioned, despite being pretty obvious?

EDIT: I'm editing the question to "answer the answers", since comments are insufficient.

  you lose the dynamic nature of pluggable components, which was created
  specifically to get away from static class construction.

I don't. Maybe I did not explain it clearly enough:

auto signature = world.get_signature(entity_id); // this would just return entity_id.bucket_owner->bucket_signature or so
signature.add(foo_component);
signature.remove(bar_component);
world.delete_entity(entity_id); // entity_id would hold information about its bucket owner
world.create_entity(signature); // automatically assigns new entity to an existing or a new bucket

It's as simple as just taking existing entity's signature, modifying it and uploading again as a new entity. Pluggable, dynamic nature? Of course.
Here I'd like to emphasize that there is only one "assemblage" and one "bucket" class. Buckets are data-driven and created at runtime in an optimal quantity.

  you'd need to go through all buckets that might contain a valid
  target. Without an external data structure, collision detection could
  be equally as difficult.

Well, this is why we have the aforementioned external data structures.
The workaround is as simple as introducing an iterator in System class that detects when to jump to next bucket. The jumping would be purely transparent to the logic.

sentences:
Can you suggest ways to store and track lots of objects in a turn based strategy game? I know just enough about programming to be dangerous, so please be gentle.  I've created and released few simple apps for android and do some powershell scripting at work, but that's about the extent of my programming experience.  I'll be using c# and XNA if that makes a difference.

If I need to keep track of ten thousand to several hundred thousand of the same object with a handful of variables each, what's a good way to handle that in a turn based strategy game?  The game will need to loop through each object on each turn to check a few things.

sentences:
Circular fighter motion algorithm Is there an algorithm to make ships take semi-circular patterns? I need something like the below image:

Big Blue- Command Ship
Small blues - fighters
Red lines - path of movement

I want the fighters to zip around the command ship while avoiding obsticles such as space debris and eachother. I need at most a dozen fighters zipping around each ship and there would be up to a dozen command ships zipping around at a slower pace. All the fighters should return to the ship every once in a while for repair and rearming.

I chiefly need the circular path and I need to keep the path centered constantly on the command ship despite any movements. Are there any circular path finding algorithms? (and a better question; is there an official term for this kind of algorithm/path?)? Also note that I am developing this as an RTS for mobile, so the least expensive the operation the better.

sentences:
infer half vector length in BRDF it's my first question on stack.
Is it possible to infer length of the half angle vector for specular lighting from N·L and N·V without the whole view and light vectors?
I may be completely off-track, but I have this gut feeling it's possible...
Why? I'm working on a skin shader and I'm already doing one texture lookup with N·L+N·E and one texture lookup for specular with N·H+N·V. The latter one can be transformed into N·L+N·E lookup if only I had the half vector length.
Doing so could simplify the shader a bit and move some operations into the pre-computed lookup texture.
It would make a huge difference since I'm trying to squeeze as much functionality as possible to a single pass mobile version so instruction count matters.

Thanks.

Edit, for clarity, I'm doing something like this:

float NdotL = dot(s.Normal, lightDir);
float NdotE = dot(s.Normal, viewDir);

fixed3 diffAndTransl = 2.0 * tex3D(_Lookup3d, half3(diffNdotL, NdotE * 0.5 + 0.5, depth)).rgb;

now we have diffuse with SSS and backscattering from lookup
everything below could be just a lookup if I had length(h) information when calculating the lookup

float3 h = lightDir + viewDir;
float hLen = length(h);
//float3 H = normalize(h);
float3 H = h/hLen;
//float NdotH = dot(s.Normal, H);
float NdotH = (NdotL + NdotE)/hLen;
float EdotH = dot(viewDir, H);

fixed ph_by_fresnelReflectance = tex3D(_Lookup3d, half3(NdotH* 0.5 + 0.5, EdotH * 0.5 + 0.5, s.Gloss)).a;
half spec = saturate(NdotL) * max(ph_by_fresnelReflectance / hLensq, 0 ); // this could go into lookup as well

I was thinking I could infer length(h) from NdotL and NdotE when generating the specular lookup to reduce above code.
In my mind I was imagining something like a triangle on the plane made by lightDir and viewDir vectors could be thought of in 2D space. Don't the two dot products give me the (half?) angle and since both vectors are of length one, wouldn't it be possible to infer the length of the last side?
I tried some trigonometric voodoo programming but with no luck (chord of theta inferred from dot products?).
Does anybody have any idea if it's at all possible?
Maybe I just need to sleep more.

ps.: I know tex3D won't work well on mobile, just testing the grounds...

sentences:
Is it possible to apply a texture to a 2D-sprite in unity 2-d? I want to take an (animated) 2-d sprite and apply a texture to it. Basically, I want every non-transparent pixel to be covered by the texture (color is disregarded). I understand I can probably accomplish this using masks but I am worried that may not be the most performant solution. I know you can put textures onto 3-d models, so I was wondering if there was a similar process for 2d sprites. Below I have a graphic demonstrating what I want.

What I have tried so far

I see there is an option to add a material to a sprite, so I tried creating various materials.

1. Default material

When I tried applying this material to my sprite, the sprite disappeared entirely. I suspect because this default material type only works on 3D objects

2. Sprite Material

I figured sprites probably expect sprite materials, so I tried creating one. However, there does not appear to be anywhere to upload an image to use as a texture. This appears to only be useful for adding tints to sprites.

sentences:
How do I detect the direction of 2D rectangular object collisions? After this question, I need some more help.

How can I find out which side of a rectangle a collision came from and react accordingly?

The blue arrows are the paths that some circular objects would follow if before and after colliding with the box.

How can I calculate this?

sentences:
Is this the correct implementation of a fixed timestep game loop? public static void main(String[] args) {

        long newTime, delta, timeSince1Second, startTime, oldTime;
        long ticks = 0;
        double frameCap = 1000/60;
        double time_passed = 0;

        startTime = System.currentTimeMillis();
        oldTime = System.currentTimeMillis();
        while(true)
        {
            newTime = System.currentTimeMillis();
            delta = newTime - oldTime;
            timeSince1Second = newTime - startTime;
            currentTime = newTime;

            //update game based on dynamic time step here (if needed)

            //update loop (fixed time step)
            while(time_passed >= frameCap)
            {
                //update game logic (fixed time step update)
                time_passed = time_passed - frameCap; //resetting time_passed essentially to 0
                ticks++;
            }

            time_passed = time_passed + (double) delta; //time passed since start of loop

            //render here

            //frame rate counter
            if((timeSince1Second/1000) >= 1)
            {
                System.out.println(ticks+" frames per second");
                startTime = System.currentTimeMillis();
                ticks = 0;
            }
        }
} //end main function

This code has been written in java. I'd like to know if i'm missing anything here, because in the fixed time step update loop, if i display for example a window, and move the window around, the framerate will sometimes change until i stop moving the window around, which is kind of confusing to me. Is that normal? Or perhaps I might be missing something
Guidance will be appreciated

sentences:
How do I run code for a period of time and then return to normal behavior? i wanna run a code for my special power for five seconds only and then return to my normal working. when that power activates i am changing my player's material and i wanna return to my old material after those five secs are over. this is the code i tried:

void Start () {

        transform.GetComponent<Renderer> ().material.mainTexture = texts [0];
    }

    void Update () {

        if (condition) {
            for (int t1 = 0; t1 < 5; t1 += (int)Time.deltaTime) {
                transform.GetComponent<Renderer> ().material = mats [0];
            }
            transform.GetComponent<Renderer> ().material.mainTexture = texts [0];
        }
    }

this code breaks the game i think because unity is freezing when the condition is being met.

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:
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:
Save game state information I'm working on my first game, and are looking into the option to save a number of game state settings.

One of the things I want to save is the high scores, this will contain a list of the 10 players that scored the highest.

I have been looking into this for a while, and was wondering what the best way for this is.

While being ingame I will have a list of high scores comprised of Player, Score, Level. This of course needs to be updated each time the score has been beaten, but it also needs to be saved somewhere where it won't be reset the whole time.

I would think this kind of information should be saved into a file (either xml or comma separated values).

The problem I'm facing is what to do on the initial set up (I would like to have some fake values in the high scores table), however if I add that to the file how do I know that the scores in there are the initial set up ones, or the real ones? Once the player has a endgame for the first time, these fake scores should not being shown anymore.

However the player can also reset the scores, and at that point I would like to have the fake scores shown again.

So my question is what is the best way of setting this up? Do I keep 2 files, one with the real scores, other with fake ones? or do I keep the fake ones in a list inside the game and when the file with high scores can't be found I use that list?

sentences:
How can I create a stretchy, breakable pizza cheese material? I want to create realistic pizza and allow user interact with it.

What I want:

What I created:

I created model of the pizza (8 pieces) in Blender, then imported it into Unity. The piece of pizza looks very artificial, mostly because it is "rigid triangle".

How can I make the cheese stretch and break when the user moves a piece?

sentences:
How to do a genetic algorithm's chromosome which controls movements First I would like to inform you that I'm french and 15 so my english is not very good.

I've read some articles about genetic algorithms (GA) and since I discovered the HTML5's canvas element, I can create an AI with animations, so I've created two little experiments to enjoy seeing robots moving on their own but first I'll present you the second one because it's easier :

The aim of this experiment for the white circles is to touch the red square and instead of using coordinate calculations, like I said, I would like to create an autonomous algorithm which evolves in the time.

I give to the circles their relative coordinates to the red square like so they know exactly where they are and their speed that they will be able to change.

So to do it I need a solution to create a chromosome that contains moving informations but since the x and y positions are randomly assigned to circles and the square, if a member of the population has the good solution, it's only for this particular configuration.

I'm searching how to make them know that if the x coordinate is inferior to 0, they have to go left without creating a function like this if(firstGeneInfo == 2){bot[i].x += redSquare.x - bot[i].x;}.

This is a screenshot of the canvas :

And the jsfiddle link but movements are random for the moment.

http://jsfiddle.net/KLn8r/1/

The other experiment is a sort of "survival game" where the red square has to last,
first I created it as a human-AI experience but I prefer to do an AI vs AI game,
and so implement a genetic algorithm but in this case it is a lot more complicated because they are multiple enemies, I thought that with informations like enemies's coordinates and speed once again, the red square would developp kind of a strategy. The enemies are controlled by an algorithm and there is no need to do a GA for them.

A screenshot :

and the jsfiddle link : http://jsfiddle.net/f6ghk/

If you've read all this, I already thank you ! I'm not asking for the full working code but just the principle of a chromosome that works in theses cases.

I hope that my english wasn't to horrible to read and that for my problems I don't need a simulated neural network because it seems a bit complicated to me.

Thank you for your answers !

sentences:
Attack Algorithm/Forula So I'm making a simple RPG game and I'm currently stuck on creating an attacking module for it.

I need to create a simple attack algorithm but I'm really not very good at it.

Each character has 3 base  states - Attack, Defense, Dexterity

and all characters start off with 50hp and they gain 5hp per level.

What formula should I use to determine chance of hit, and how much damage is dealt? It doesn't have to to too overly complex. Just something simple for now.

sentences:
optimizing collision detection with stationary objects (walls, floors, obstacles, etc.) For detecting collisions between sprites, I know a 2D spatial hash is a way to optimize the number of collision checks that need to happen. But is there a way to optimize even further for objects that we know won't be moving in the scene? My sensibilities tell me that there should be because:

We know exactly where the object is at all times.
(At least in my game) there are bound to be a lot of floor/wall/ceiling tiles, far more than would be efficient to include in the spatial hash.

So, is there a way to optimize collision detection for this use case?

sentences:
Automatically triggering standard spaceship controls to stop its motion I have been working on a 2D top-down space strategy/shooting game. Right now it is only in the prototyping stage (I have gotten basic movement) but now I am trying to write a function that will stop the ship based on it's velocity. This is being written in Lua, using the Love2D engine.

My code is as follows (note- object.dx is the x-velocity, object.dy is the y-velocity, object.acc is the acceleration, and object.r is the rotation in radians):

function stopMoving(object, dt)
    local targetr = math.atan2(object.dy, object.dx)
    if targetr == object.r + math.pi then
        local currentspeed = math.sqrt(object.dx*object.dx+object.dy*object.dy)
        if currentspeed ~= 0 then
            object.dx = object.dx + object.acc*dt*math.cos(object.r)
            object.dy = object.dy + object.acc*dt*math.sin(object.r)
        end
    else
        if (targetr - object.r) >= math.pi then
            object.r = object.r - object.turnspeed*dt
        else
            object.r = object.r + object.turnspeed*dt
        end
    end
end

It is implemented in the update function as:

if love.keyboard.isDown("backspace") then
    stopMoving(player, dt)
end

The problem is that when I am holding down backspace, it spins the player clockwise (though I am trying to have it go the direction that would be the most efficient at getting to the angle it would have to be) and then it never starts to accelerate the player in the direction opposite to it's velocity.

What should I change in this code to get that to work?

EDIT :

I'm not trying to just stop the player in place, I'm trying to get it to use it's normal commands to neutralize it's existing velocity.

I also changed math.atan to math.atan2, apparently it's better. I noticed no difference when running it, though.

sentences:
Predicted trajectory becomes less accurate in a side-on collision In my 2D billiards game, I have it so that when the user clicks and drags with their mouse, a Physics2D.CircleCast is projected from the cueball to wherever the mouse is. If the circle happens to hit the red ball, a line is rendered from the red ball's position to the direction of the normal of the collision. So it's supposed to predict where the red ball will go when it gets hit by the cueball.

If you look at the first gif below, you'll see that it works if the red ball gets hit at its center (or close to it). The red ball ends up moving more or less along the predicted line.

However, if you look at this second gif, you'll see that if the red ball gets hit closer to its edge, the predicted line is much less accurate.

Why is this and how can I fix it?

This is the prediction code I use:

 if (Input.GetMouseButton(0) && cueBall)
 {
        Vector2 mousePos = cam.ScreenToWorldPoint(Input.mousePosition);
        var direction = (mousePos - (Vector2)cueBall.position).normalized;
        var hit = Physics2D.CircleCast(cueBall.position, _radius, direction, Mathf.Infinity);

        if (hit)
        {
            _lineMain.Draw(cueBall.position, hit.point);
            _ghostBall.SetPosition(hit.point - (direction * _radius));
            _lineTarget.Draw(hit.point, hit.point - hit.normal); //This is the predicted trajectory.
        }
 }

sentences:
Can games be made with Win32 for Windows 10? Based on the news today of Microsoft allowing Win32 games on the Windows store, what does it mean that Win32 can be used for games now?  Couldn't Windows 10 already play Win32 games?  or is this solely for distribution over the Window Store
that is important?

Couldn't Windows 10 already play Win32 games?  What were developers using if it wasn't Win32 on Windows 10 (UWP?)

Quoted in many articles, but here is the original,

https://news.xbox.com/en-us/2019/05/30/microsoft-approach-to-pc-gaming/

sentences:
Unity: Is there any alternative to facebook SDK for facebook ads attribution? We have a Unity mobile game.
We will be showing ads for it on facebook audience network.
Now in the past when we tried this, the CPI started out good and then got terrible.. Facebook have told us that to avoid this we need to have the facebook sdk installed in our game.
But the facebook Unity SDK is the bane of my existence. In every project Ive added it to over the years, I have spent so many days bashing my face against the brick wall of getting it to build and run, and when it does the weird workaround solution is incredibly fragile.
My question is.. Do we really need the SDK? What do devs using game engines without an SDK provided by facebook do? Is there an API we can call? Surely the SDK itself is calling some api to do the attribution which allows facebook to optimise the CPI for the ads. Can we just call that?
At this point I would try any alternative.

sentences:
How do I integrate drag over distance? In my game I want to model kind-of-accurate bullet physics. I have the following drag equation (in C#):

float drag = 0.235f * density * velocity*velocity * Mathf.PI * sizeMM*sizeMM/4000000;

In non-code terms, this is the same as the drag equation:

drag = 0.5 x [density] x [speed]^2 x [area] x [drag coefficient (0.45)]

Where density is the density of the material (air being 1.225kg/m^3), velocity is the velocity in m/s, and sizeMM is the diameter of the spherical projectile in mm. 0.235 was obtained by the 1/2 in the drag equation and 0.45 from the drag coefficient for spherical objects, and 4mil was the result of squaring 2000 (2 for halving diameter, 1000 for converting to metres).

The drag value appears to be appropriate, for a 11.43mm radius bullet travelling at 251m/s through air, I get a drag value of 1.860946 (presumably in m/s). What I need to be able to do is integrate that over a set distance D to obtain the result velocity as it impacts the target, and I already know that distance value.

I'm open to all potential answers to the problem, provided no loops are used. I need the resulting math to be as fast as possible, due to the possibility of it being used upwards of 20 times per second in multi-person combat.

I need the resulting math to always use the provided input variables. Density could change based on the material (i.e. flesh, kevlar, wood), sizeMM will change based on the type of ammo, and velocity will obviously change.

Approximations are preferred if accurate. If you can give an equation that is within 0.1% of the always-exact one and runs twice as fast, I'd prefer that.

sentences:
SpriteKit and Swift or Objective-C As a newbie to iOS programming, I'm wondering which of these would be more conducive to the type of game I want to program. I've been tasked to program an iOS game for my company. They asked me to do this after learning I was studying some Swift on my own time.

The game will be a turn-based strategy game consisting of a map with irregular areas/polygons and player pieces that can be moved on the map. I'll need to be able to detect when a piece moves into different areas and restrict a piece to moving only a certain number of areas per turn.

Can this be accomplished in straight Swift/Spritekit?

sentences:
Android native database organization I am developing an Android native game, but I have problems with Data Storage.
For a better comprehension think it like as i am developing Clash of Clans, but with Native Andorid.

Now imagine I have to store all datas for Buildings, moneys, troups, ecc in my local phone DB.

I read some guides about SQLite for Android, but i don't really like it. It picks always a Cursor object and i have to create an "Helper" class for each table so I can convert the Cursor into the object I picked.

My question is: is there a way to do it in a "easier" way but still complete as SQLite?

I learned SugarORM and it is really simple and intuitive, but it has no possibilities for ID and a lot of other limitations.

I want a library or anything else that allows you to do like windows phone c#:

SQLiteConnection conn = new SQLiteConnection(DBPath);
return conn.Query<TABLE_NAME>(SQL_QUERY);
//in this way i have a list of TABLE_NAME items without any casting or similar.

Is there a way to do it?

sentences:
Action-oriented AI: evasion-algorithm takes much time Evasion, the process of evading, is the opposite of chasing. Instead of trying to decrease the distance to the target we try to maximize it.

It takes much time while evading multiple objects simultaneously. I use BFS here. To make it faster what algorithms should I use?

sentences:
Why does Unity Eventsystem lag on first touch? Hi I am making a very simple simple platformer game for android devices. I am using Unity's event system for player movement. The problem is when I touched the button first time there is a lag (hiccup) after then everything is ok. I have profiled my game there is a spike in EventSystem Update method.

here is the simplified code,

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

[RequireComponent (typeof(Rigidbody2D)) ]
[RequireComponent (typeof(BoxCollider2D)) ]
public class PlayerController : MonoBehaviour {

public float movementSpeed = 5f;
public float jumpForce = 5f;
public float distanceToGround = 0.2f;
public LayerMask staticCollider;
public playerState state;

private Rigidbody2D rBody;
public Transform leftmost;
public Transform rightmost;

Collider2D[] platforms = new Collider2D[2];
public int hrInput = 0;

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

}

//FixedUpdate is framerate independent, and therefore completely unrelated to your framerate

void FixedUpdate ()
{
    state.grounded = isGrounded ();

    if (hrInput > 0) {
        MOVE_RIGHT ();
    }
    else if (hrInput < 0) {
        MOVE_LEFT ();
    } else {
        STOP_MOVE ();

    }

}

public bool isGrounded(){
    print ("ground");
    if (Physics2D.OverlapAreaNonAlloc (leftmost.position, rightmost.position, platforms, staticCollider) > 0) {
        return true;
    } else
        return false;
}

public void setHrInput (int h ) {
//    print (h);

    hrInput = h;
}

public void JUMP(){
    if(state.grounded){
        state.onAir = true;
      //  rBody.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
        rBody.velocity = Vector2.up * jumpForce;
    }
}

public void MOVE_LEFT(){
    rBody.velocity = new Vector2 (-1 * movementSpeed * Time.deltaTime, rBody.velocity.y);
}

public void MOVE_RIGHT(){
    rBody.velocity = new Vector2(1 * movementSpeed*Time.deltaTime, rBody.velocity.y);
}

public void STOP_MOVE(){
    rBody.velocity = new Vector2(0,rBody.velocity.y);
    }

} // end

Here is the profiler Image.

Please help me to fix this issue.

sentences:
Entity polymorphism and entity attributes I want to design the entity system of my game in a way such that entities are modular, easily modified without affecting other entities, and finally easy to add new types of entities. So ideally some version of component based design.

In some parts of the code I want to deal with entities generally and abstractly, for example "update all entities" and "render all entities", however in other parts I want to deal with specific types of entity, like when a Soldier entity is fighting a Tank entity.

The problem is some entities need attributes which others do not. For example a soldier needs HP but a missile do not.

How do I keep entity attributes modular, and avoid adding every attribute in the game to the Entity object?

sentences:
Why doesn't Array.Copy to mesh.verticies work in Unity? I am rebuilding a mesh but something seems odd that I have to create a temp array just to hold the verticies rather than copy an array.

I'm not using list because this is used frequently and I do not want to resize list and instead just use height index boundary to prevent additional  garbage collection from resizing lists.

Doesn't work and results in no mesh showing:

Mesh mesh = new Mesh();
//copy myVerticiesArray to mesh.verticies. myVerticiesArray
//length has null values above verticiesIndexHeight but array copy height set in Array.Copy()
Array.Copy(myVerticiesArray, mesh.vertices, verticiesIndexHeight);
[...] code to set UVs etc omitted
mesh.Optimize();
mesh.RecalculateNormals();
mesh.RecalculateBounds();
this.GetComponent<MeshFilter>().mesh = mesh;

Also doesn't work and results in no mesh showing:

Mesh mesh = new Mesh();
//loop through built verticies array to mesh.verticies of correct size because myVerticiesArray
//length has null values above verticiesIndexHeight
mesh.verticies = new Vector3[verticiesIndexHeight];
for(int i = 0; i < verticiesIndexHeight; i++)
{
    mesh.verticies[i] = myVerticiesArray[i];
}
[...] code to set UVs etc omitted
mesh.Optimize();
mesh.RecalculateNormals();
mesh.RecalculateBounds();
this.GetComponent<MeshFilter>().mesh = mesh;

Works and renders mesh:

Mesh mesh = new Mesh();
Vector3[] tempVerticiesArray = new Vector3[verticiesIndexHeight];
//copy built verticies array to temp array of correct size because myVerticiesArray
//length has null values above verticiesIndexHeight
Array.Copy(myVerticiesArray, tempVerticiesArray, verticiesIndexHeight);
mesh.verticies= tempVerticiesArray;
[...] code to set UVs etc omitted
mesh.Optimize();
mesh.RecalculateNormals();
mesh.RecalculateBounds();
this.GetComponent<MeshFilter>().mesh = mesh;

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:
C++ -- How could I create a list that contains functions, and would either run the top or iterate through and run all? I'm not sure how to phrase this to be perfectly accurate to my goal implementation

I need a dynamic scene/menu system. I'm going to create a base class and inherit in two other classes specific to either rendering a scene or controlling a menu chain. From here I'll be creating functions with specific draw characteristics (such as a specific menu) and run them into my draw function.

What type of container system would work? I need it to be able to both run only the top and run all of the ones loaded in it (I specify because you cant iterate through a stack, from what I'm told)

sentences:
How can I implement UI in Unity using Chromium? I'm looking for an alternative to UI Builder.
Ideally I'd like to have basically a Chromium instance atop Unity3D which would have its JS calls somehow land in the C# (maybe in the "Update" loop it listens to a constant stream of potential calls and the parameters will correspond to function names in my Unity code, I don't know)
here's what I found which doesn't quite live up to my expectations:

Unity WebView doesn't support Windows.

3D WebView for Windows and macOS (Web Browser) requires the UI to be served on an actual live URL and for Unity to access it via that URL and for all interaction to be handled via API, impractical or slow at best.

PowerUI - HTML/CSS is interesting, but was made in 2011. The documentation is all gone. the support for css feature is probably incredibly slim.

Embedded Browser looks pretty good, but I'm unsure that it could be bent into a UI system. I want it to frame my game, not to cover it.

Coherent Gameface looks probably the best,
although the CSS implementation seems a tad lackluster. Also this project was started in 2012, it's probably carrying very old, very slow code.

This Unity forum thread may be relevant.
Chromium Embedded Framework was a tool used by some assets on the asset store to create chromium UI but it has been removed.
If not using these assets, how can I implement my idea of using Chromium as my UI layer?

sentences:
Using PhysX, how can I predict where I will need to generate procedural terrain collision shapes? In this situation, I have terrain height values I generate procedurally. For rendering, I use the camera's position to generate an appropriate sized height map. For collision, however, I need to have height fields generated in areas where objects may intersect.

My current potential solution, which may be naive, is to iterate over all "awake" physics actors, use their bounds/extents and velocities to generate spheres in which they may reside after a physics update, then generate height values for ranges encompassing clustered groups of actors. Much of that data is likely already calculated by PhysX already, however.

Is there some API, maybe a set of queries, even callbacks from the spatial system, that I could use to predict where terrain height values will be needed?

sentences:
Grouping units in world space I figure that I intend to generate, for group orders, one optimal path, and then use a flocking algorithm to "glue" the units together as they all follow this one optimal path. However, a naive implementation would fail if, for example, the units were ordered from two distinct locations- two optimal paths would have to be computed. So for a group of units, I need to group them into subgroups which can all share the same optimal path.

At the moment, what I'm thinking is to pick an arbitrary unit in the group, and then pick all units in a certain, relatively small radius. Then for every unit in that radius, I increase the radius.

Are there any existing algorithms for grouping units into subgroups?

sentences: Indexing a point outside of a 3D signed distance field I have a 3D signed distance field that is voxelized into a grid, surrounding an object. However, I would like to query the signed distance field to determine the shortest possible distance between points outside of the signed distance field grid, and the mesh itself. Is there any way to determine this distance without increasing the size of the signed distance field? Thank you!

sentences:
How can I 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:
Vector2.Distance on different resolutions firstTouchPos = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);

endTouchPos = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);

                        //the height of the background(previously scaled to fit the screen) / 10
minSlidedDistance = (int)(SpriteRend.bounds.size.y / 10);

if (Vector2.Distance(firstTouchPos, endTouchPos) > minSlidedDistance)
{
  //do smth
}

This way I check if the player has slided into any direction with a slided distance longer than minSlidedDistance. It works perfectly for different size devices.

Is unity going to make the calculations itself if I simply write minSlidedDistance = 100? I.e. is it still going to work same way on all devices?

P.S. this is not the full code, there are many other IF checks, like the ones for assigning the value to firstTouchPos & endTouchPos

sentences:
LibGdx: set TextButton font to a TrueTypeFont I am making my first LibGdx game, and having an hard time understanding font scaling on TextButtons.

Here is a comparison between the rendering on my Kindle Fire 7 and an high resolution tablet:

I tried using the scale() method, but the result is a pixelated mess.

I've read about TrueType fonts, and I'd like to set the font size by calculating the screen density.

I've tried to create a TextButtonStyle containing a font with the following:

//Generate the font
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Merriweather-Regular.ttf"));
TextButtonStyle style = new TextButtonStyle();
FreeTypeFontParameter param = new FreeTypeFontParameter();

//Set the font size (12 as an example)
param.size = 12;
style.font = generator.generateFont(param);

//Set the new style to the button
button = new TextButton("START GAME", style);

The TextButton correctly gets the new font, BUT loses the actual button as only the text gets rendered; I guess that's because the new TextButtonStyle only contains information about the font and is otherwise empty.

I tried setting the new font to a Skin also, but only ended with further confusion; most resources I found online don't mention font rendering on TextButtons, or end up being confusing with convulted methods.

Is there a simple way to achieve what I want? Thanks.

sentences:
draw only on stencil buffer monogame Exactly as the question says. Is there a way i can draw vertices only into the stencil buffer.

Basically i want to perform some operations on some vertices of a mesh and based on the result, draw passing vertices only onto the stencil buffer of the screen

sentences:
Sounds categories volume level in xna I am preparing sounds system to my game in xna. I am using XACT Tools, and i got problem.

There is class SoundCategory. I can change sound level for all sounds in that category easily.

SoundCategory category = engine.GetCategory("music");
category.SetVolume(float_value);

But there is no such function like:

category.AddVolume(float_value);

Which would increase or deacrease that value. There is also no function that get current volume so i can do thing like:

float vol = category.Add(float_value);
vol += 0.1;
category.SetVolume(vol);

Is there some clever way to achive what i want without creating some additional variables which keep current volume for all sounds categories ?

sentences:
Rotate object to always face camera I'm trying to make a TextMesh appear when ever an enemy prefab is hit.

I currently have this functionality working. However, the text doesn't face the direction the players camera is looking.

At the moment my OnCollisionEnter method contains the following line of code:

GameObject _go = (GameObject)Instantiate(_hitPrefab, collision.gameObject.transform.position, Camera.mainCamera.transform.rotation);

This line happily creates my TextMesh whenever my enemy is hit. I know my issue has something to do with my rotation quaterion, but I have no idea what pass in so it faces my camera. As you can see, I tried setting it Quaterion.Idenitiy thinking it'll show the same way as the enemy it's associated to, but that doesn't work either.

Each time the textmesh appears, its back to front for the player and at a slight angle.

Could someone please help me in getting it so the score always faces the players camera no matter what way he is facing?

sentences:
Make a layer over an image and adjust its co-ordinates by touch I need to make a layer over an image and adjust the layer to fit to image and get its co-ordinates of the layer.

I need to adjust the layer by touch and pinch.

The sample image is as below. I need to do this in ios, and can I get any ideas to do this?

sentences:
How to get text width in pixels in direct2d I am making the simple editor on direct2d and i want to make adaptive buttons size. When i create a button i pass text to it and a button gets width based on text width in pixels. I have tried to use IDWriteTextLayout and the method GetMetrics but i get the weird result where height more than width.
D2D1_SIZE_F Direct2D::get_text_size(const char *text)
{
    IDWriteTextLayout *text_layout = NULL;
    DWRITE_TEXT_METRICS text_metrics;

    wchar_t *wtext = char_string_wchar(text);
    HR(write_factor->CreateTextLayout(wtext, wcslen(wtext), text_format, 0.0f, 0.0f, &text_layout));

    text_layout->GetMetrics(&text_metrics);

    DELETE_ARRAY(wtext);
    RELEASE_COM(text_layout);

    D2D1_SIZE_F size;
    size.width = text_metrics.widthIncludingTrailingWhitespace;
    size.height = text_metrics.height;
    return size;
}
```

sentences:
Can I write code from 2 computers at the same time? So I know it might not be that related to game dev, but I'm now starting a project with friends and we want to code. Thing is, we are not living close, and when several programmers write different classes or parts of code, syncing is a problem. Skype is not fast enough, it actually makes it worse (you need to pack and unpack .zip solution file), nor email.

Any one got a software that can connect 2 (or more) computers, and when we write code it will show up (simultaneously) on one of them/both?

I don't care much for lags, if we need to wait few secs till it shows up, it's fine.

I thought about TeamViewer, but as far as I remember only one can write/do an action at a time.

Thanks!

sentences:
3D space game development I want to develop a 3D game (sci-fi type with spaceships) which can be played on multiplayer mode and by multiplayer i mean around 10 players for start as it will be a personal testing project and mostly educational. I have been searching for some days about the available languages and engines but i am kinda confused. Since i have been learning Java for my 1st year in I.T university and i have pretty good understanding i thought i would go with the Java language and develop that game on an applet so it could be played on a browser. After going through an applet game tutorial i understood how graphics work on an applet.

So.. 1st question: Could an applet carry the burden of a 3D game especially on multiplayer? My thinking: It's a space game so the graphics should not be such a big problem since it wont be that crowded with entities apart from ships, planets and some effects.

If the java applet is not the way for my project i would't mind "developing it on desktop"(i mean not making it a browser game). 2nd question: Should i use Unity engine for my purpose(space game)? If not name other language/engine combo.

sentences:
What use does the unary & operator have in this piece of C++ code? In an example for a little game framework (that does work), there are the lines:

ID3D10Device* device;
ID3D10Buffer* pBuffer;

followed by the line

 device()->CreateBuffer(&bd, NULL, &pBuffer());

The third argument requires a pointer, so why do you need to put an ampersand before pBuffer? an ampersand gets a memory address right? But pBuffer is already a pointer so what does the ampersand do to it?

sentences:
DX11 swap chain is 1 frame behind when presenting to screen and using multisampling After adding multisampling to a DirectX 11 project, I noticed that the screen was no longer updating when calling IDXGISwapChain ::Present. Further testing showed that it was in fact updating the screen, but it was always 1 frame behind. If I added a line to the scene and presented it, I wouldn’t see that line until I do the next present call. This behavior is specific to the use of multisampling. If I turn multisampling off, the behavior goes away. This behavior is also specific to my Intel display adapter. If I use my Nvida display adapter, the behavior goes away.

The multisampling settings are determined by using ID3D11Device::CheckMultisampleQualityLevels, and the creation of the back buffer and depth stencil work, so I don’t think the settings themselves are incorrect in any way. Also the multisampling does work; the end result is properly multisampled. I have played with various multisampling settings within the available range, and all settings produce the same behavior. Just in case I’m doing something wrong, I tried using the debug layer, but got no warnings or errors.

Through hours of testing, I found two work-arounds:

1 - Call Present twice:

HRESULT result = _swapChain->UnmanagedPointer->Present(0, 0);
if (result != S_OK)
    ExceptionThrower::Throw(result, "Failed to present the swap chain buffer.");

result = _swapChain->UnmanagedPointer->Present(0, 0);
if (result != S_OK)
    ExceptionThrower::Throw(result, "Failed to present the swap chain buffer.");

When I do this, the second Present call puts the correct information on screen.

2 - Call ID3D11DeviceContext::Flush after Present

HRESULT result = _swapChain->UnmanagedPointer->Present(0, 0);
if (result != S_OK)
    ExceptionThrower::Throw(result, "Failed to present the swap chain buffer.");

_d3dDeviceContext->Flush();

After the Flush call, the correct information is on screen.

As I understand it, both of these work arounds incur a significant penalty, so I would rather find a better solution (if on exists).  I especially dislike this work around because it penalizes everyone. There is no way for me to know when this behavior is happening. I have a feeling that I may be dealing with a driver bug since this is only an issue with the Intel adapter. I hate to force all scenarios to add this overhead when for most, it won’t be necessary. Oh and in case someone asks, I have updated the Intel drivers to the most recent, but it’s an old adapter, so these drivers date back to 2012.

Has anyone seen this type of behavior before? Is there a better work around, or perhaps a solution I’m not aware of? If forced to use one of the two work arounds, which of the two would be the best? I’m leaning towards the second (Flush call), but not sure.

In case helpful, here is my swap chain creation code

DXGI_SWAP_CHAIN_DESC desc;
ZeroMemory(desc, sizeof(DXGI_SWAP_CHAIN_DESC));

desc.BufferDesc.Width = width;
desc.BufferDesc.Height = height;
desc.BufferDesc.RefreshRate.Numerator = 60;
desc.BufferDesc.RefreshRate.Denominator = 1;
desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;

desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
desc.BufferCount = 1;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.OutputWindow = outputWindow;
desc.Windowed = true;
desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
desc.Flags = 0;

if (useMultiSampling)
{
    desc.SampleDesc.Count = _multiSampleCount;
    desc.SampleDesc.Quality =  _multiSampleQuality - 1;
}

sentences:
Unity / Rotate a point around an arbitrary axis and anchor I'm trying to find out the point which is already rotated. To solve this I did a Rotation, save the position, set the previous position and return my position, like this:

Vector3 rotatePointAroundAxis(float angle ,Vector3 axis, Vector3 anchor)
{
Vector3 oldPosition = gameobject.transform.position;
gameobject.transform.RotateAround(gameobject.GetComponent<HingeJoint>().anchor, gameobject.GetComponent<HingeJoint>().axis, angle);

Vector3 newPosition = gameobject.transform.position;
gameobject.transform.position = oldPosition;
return newPosition;
}

I searched already. And I found very hard solutions.
http://inside.mines.edu/fs_home/gmurray/ArbitraryAxisRotation/
 - by the way i dont think I understand this, it seems like too much.

Is there any way to change that function to a "simple" one, so I don't need to rotate things forth and back to get the coordinates?

EDIT:

I believe tranform.RotateAround()  takes the position and rotation from the transform parameters and calculates the solution and changes the current position and rotation of the gameobject.

So the solution should take 5 parameters:

current position of the unrotated Object
current rotation of the unrotated Object
the point the Object should be able to pass
the rotation axis
the angle

and return 2 parameters:

the rotated objects new rotation
the rotated objects new position

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:
Rigidbody not working properly I have two objects: a player and a wall.
The player is passing through the long side of the wall but it collided with the short side of the wall.
I want the player to collide with whole wall.

Here is the code:

sentences:
What could cause a pixel shader to paint outside the lines of the vertex shader output? From what I understand, the pixels that a pixel shader operates on are specified implicitly by the SV_POSITION output (in DirectX) of the vertex shader. What then could cause a pixel shader to render in the middle of nowhere?

I used the new Visual Studio 2012 graphics debugger to visualize my vertex and pixel shader output. This is the output from a DrawIndexed() call that draws a cube:

The pink part is the rendered output of the pixel shader, which takes the cube on its left as its input.

The vertex shader code:

cbuffer Buf { float4x4 final; };

struct In
{
    float4 pos:POSITION;
    float3 norm:NORMAL;
    float2 texuv:TEXCOORD;
};

struct Out
{
    float4 col:COLOR;
    float2 tex:TEXCOORD;
    float4 pos:SV_POSITION;
};

Out main(In input)
{
    Out output;
    output.pos = mul(input.pos, final);
    output.col = float4(1.0f, 0.5f, 0.5f, 1.0f);
    output.tex = input.texuv;

    return output;
}

And the pixel shader:

struct In
{
    float4 col:COLOR;
    float2 tex:TEXCOORD;
    float4 pos:SV_POSITION;
};

float4 main(In input) : SV_TARGET
{
    return input.col;
}

The raster stage is the only thing between the vertex shader and the pixel shader, so my suspicion is that it's some raster stage settings. But the raster stage shouldn't change the shape of the vertex shader output so drastically, should it?

sentences:
What is the purpose of the macro UNITY_EDITOR? I found on a tips guide in Unity that I can do:

#if UNITY_EDITOR
do_something()
#endif

And do_something() will only be executed on Unity editor. Even more, when I build the game, that section of the code won't be compiled.

I found that as something very interesting, I thought it could be useful for example to use it on DrawGizmos methods since they can only be used on Unity Editor, and you don't need them on a finished product.

What has it been designed for? Is there anything bad that could come from using it?

sentences:
How to render irregular sprite sheets in SDL2? I have a sprite sheet that's 155 x 66 pixels that I use for my game's UI. I've seen many topics regarding rendering sprite sheets by using the number of pixels and dividing that by the number of sprites to figure out where the render the sprite from. The problem with this is that the buttons on the sprite sheet cannot perfectly aligned so I'm left with differently sized sprites on the sprite sheet.

How do I render an irregular sprite sheet in SDL2?

sentences:
How do I know if memory isn't being handled right? My (2D) game's memory footprint seems to increase any time I load a texture, e.g. when I start my game it uses 30 mb private RAM, after transversing a ~367mb background file, so it's all in RAM at some point, it increases to 54 mb private RAM.

The same thing happens after going the same distance but going back and forth between two points repeatedly.

However, my readouts are showing that the program is correctly calling glDeleteTextures about a second after textures go off screen; and valgrind isn't finding any leaks.

How do I know if I should be worried about this, or if it's just a quirk of how the OS pages memory?

sentences:
How to move the camera to center an object in screen? For example, an object is located at (x,y,z) in world space. Now how to calculate the offset translation, I mean no rotation, that will be applied to the camera so as to place the object at the center of the screen?

BTW, I'm using three.js r91. But pseudo code/C++/C# is also OK.

sentences:
Programming Dynamic 3D Water/Waves? I'm a little bit stuck on how I might go about programming dynamic, interesting water in a game. To qualify that a little bit, I'm interested in creating water with broad, rolling waves that affect collision, physics, and the visual shape of the mesh. As an example, here's a screenshot from Wave Race 64, a 1996 jetski racing game for the Nintendo 64!

In Wave Race, not only do the waves move visually, but the choppy water pushes your vehicle around and creates bumps that give the game a really fun and unique feeling. I imagine that this type of thing is pretty standard in water simulation and physics, but I think the 'arcadiness' of the water physics in Wave Race makes it a pretty decent example.

I'm not really sure what steps need to be taken to create this effect though. I imagine that the visual effect of waves would be pretty simple to do create using a vertex shader, but I'm uncertain on how to program the physical 'entity' of the water. Here are some of my exact sticking points:

What might the data structure of that water look like?
And how does one 'animate' the physics/collision while keeping the visual mesh deformation in sync?

I have some "starting point" ideas, like possibly using a 2D or 3D vector field for the water. But I'm still fuzzy on the general implementation of fluid simulations, especially as a gameplay element!

sentences:
Camera follow 3D Object OpenGL I'm trying to make my camera follow a 3D object, the X and Y values from the camera position are the same as the 3D object, but the Z axis is not the same, it has an offset of 13.0f so the camera looks to the object from a distance. The problem is that, the more I go up with the object, more the object disappears on the screen, its like the camera is following it slowly, or like, since the camera is far away then the object goes up faster than the camera, so how do I center the object in the middle of the camera?

[my current code for the view matrix of the camera]

view = glm::lookAt(position, position + forward, up);

sentences:
Workflow to have character look like : Tokyo ghoul:re [Call to exist] I am looking into a lot of different software and now that I got my head around most of them, I was asking mysel if someone knew what has been used to create the characters in the game I mentionned.

Not specifically software if there is no information about it, but at least as it been modeld/sculpted, etc.

Thanks

sentences:
How do I scale a motion capture animation? I used motion capture in my room using the Kinect. As I don't have much space I make compressed running moves, i.e. I put my legs up and down while not moving far forward.

How can I stretch the animation, so me walking 1 meters amounts to the skeleton walking 3 meters or similar while not exaggerating movements to the left/right?

sentences:
How is displacement tessellation done? I'm curious because I was thinking that displacement mapping is done in the shader file only inside the domain shader. Am I correct or is it both implemented in the rendering section of the mesh and shader? So, if I make a cube for an example, I would have to read out the displacement map file then tell what vertices get positioned inside the render or only in the shader file? I'm a bit stuck on that concept.

These are the snap shots done inside the game editor of a plane. I believe the issue lies within the texture but you can always correct me.

This texture was created for the box inside 3DS Max and the UV Mapped, then baked the image.

When I load a sphere, not so much crazy gaps but it's still hasty.

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:
Creating texture and palette modification I need to create a texture from a surface with indexed color palette and alter the colors. However, after I set new colors, the rendered texture gets blank.

int main(int argc, char** argv)
{
    init();

    gSurface = TTF_RenderText_Solid(gFont, "text", fg1);

    // text is rendered properly, without following line
    SDL_SetPaletteColors(gSurface->format->palette, &fg2, 1, 1);

    gTexture = SDL_CreateTextureFromSurface(gRenderer, gSurface);

    SDL_SetRenderDrawColor(gRenderer, 255, 255, 255, 255);
    SDL_RenderClear(gRenderer);

    SDL_RenderCopy(gRenderer, gTexture, NULL, NULL);
    SDL_RenderPresent(gRenderer);

    SDL_Delay(1000);

    quit();
}

I tested this code with software rendering using window surface instead of renderer and pallete changing worked.
Could someone explain me why does it happed and how to fix it?

sentences:
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:
(LWJGL) Resize window content I am having a little issue with my game trying to get the screen to draw a ton larger. I am going for a retro type of feel for my game and I believe that this would help with that.

I am basically trying to take a small area (example 100x177) and draw it 9 times the original size while still keeping the nearest neighbor. The image below shows what I am trying to achieve.

(image taken from: http://forums.tigsource.com/index.php?topic=27928.0).

I have been trying to set the current render area to an FrameBuffer then draw the Frame Buffer larger on the window. I have not been able to find any example code or how I would go about doing that.

Thank you in advance for the help.

EDIT: Added sample code

This code is in the same method where I initialize OpenGL

    fboID = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboID);
    colID = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, colID);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, scaleWidth, scaleHeight, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    depID = GL30.glGenRenderbuffers();
    GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, depID);
    GL30.glRenderbufferStorage(GL30.GL_RENDERBUFFER, GL11.GL_DEPTH_COMPONENT, scaleWidth, scaleHeight);
    GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL30.GL_RENDERBUFFER, depID);
    //GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, colID, 0);
    drawBuffs = BufferUtils.createIntBuffer(1);
    drawBuffs.put(0, GL30.GL_COLOR_ATTACHMENT0);
    GL20.glDrawBuffers(drawBuffs);
    if(GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE){
        System.out.println("Framebuffer not complete!");
    } else {
        System.out.println("Framebuffer is complete!");
    }

And this is my render method that the game loop runs (updates at 60fps)

    // clear screen
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    // Start FBO Rendering Code
    //GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboID);
    // Resets the current viewport
    GL11.glViewport(0, 0, scaleWidth, scaleHeight);                 // Set viewport to be the size of the FBO
    // Clear the FrameBuffer
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    // Actual render code!
    gameMap.render();

    // draw the texture from the FBO
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    GL11.glViewport(0, 0, scaleWidth*scale, scaleHeight*scale);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(0.0f, 0.0f, 0.0f);
    GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f((float)scaleWidth*scale, 0.0f, 0.0f);
    GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f((float)scaleWidth*scale, (float)scaleHeight*scale, 0.0f);
    GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(0.0f, (float)scaleHeight*scale, 0.0f);
    GL11.glEnd();

    // Resets the current viewport
    GL11.glViewport(0, 0, scaleWidth*scale, scaleHeight*scale);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    // let subsystem paint
    if (callback != null) {
        callback.frameRendering();
    }

    // update window contents
    Display.update();

I had to comment out "GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER,GL30.GL_COLOR_ATTACHMENT0, colID, 0);" because it was throwing a "Function not supported" error.

Thanks

sentences:
Update function only running once For some reason, the update function is only running once. Why does this happen?

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

public class LightFlicker : MonoBehaviour
{
    float timer;
    float timetowait;
    // Use this for initialization
    void Start()
    {
        timer = 0;
        timetowait = Random.Range(0.01f, 0.8f);
    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log("Updating");
        timer += Time.deltaTime;
        if(timer >= timetowait)
        {

            if (gameObject.activeInHierarchy == true)
            {
                gameObject.SetActive(false);
            }
            else
            {
               gameObject.SetActive(true);
            }
            timetowait = Random.Range(0.01f, 0.8f);
            timer = 0;
        }
    }
}

The debug.log statement only fires 9 times. The timetowait changes, but the timer stays the same.

sentences:
How to access specific child indices (directly, not using tags or searches)? I have a game object whose prefab is structured a very specific way. It is a conveyor belt. I intend to arrange them end-to-end and animate them all at once using a script. Right now I am trying to get the normalized heading vector between two children, TargetStart and TargetEnd (see images below):

You can see that both of these objects are children of the prefab's first child. Because all of these instances will be structured the same, I want to compute the heading for the conveyor belt by accessing the locations of these children by their indices relative to the parent (which sounds like it should be simple and should be more efficient than searching by name or tag). I am anticipating a structure like this (pseudo-code):

// heading = targetEnd's position - targetStart's position
vector3 heading = gameObject.GetChild[0][1].position - gameObject.GetChild[0][0].position;
vector3 direction = heading / heading.magnitude;

How can this be done? I would like to know this so I can access any child I need to for any object by the child's index.

sentences:
Finite State Machine Horizontal Jump I'm creating a 2D Sidescrolling Action RPG with MonoGame and I am using a finite state machine. A state consists of an animation and some behavior, only one state can be executed at once, however:

If the player is moving left/right and then jumps, or if he's jumping and then moves left/right I want to play a specific horizontal jumping animation while executing the behavior of both states at once. How is this usually handled? Should I make a completely seperate state for this and copy the behaviors over? That doesn't seem right in accordance to the DRY principle.

BTW I'm going to have a lot of similar merge states, so just making an exception this time won't do.

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:
Distance per mesh in HLSL directx I'm subdividing a sphere so when distance gets greater, the sphere is subdivided less to save memory.

The sphere changes to another sphere when the distance is 10. My problem is that only one triangle gets rendered at a time in the geometry shader. This makes the rest of the sphere the different and causes holes and cracks. like the image below

How can I render all the triangles at one time?

my geometry function code is

 [maxvertexcount(50)]
void GS(triangle VertexOut gin[3], inout TriangleStream<GeoOut> stream)
{

if(distance(gin[0]) < 10.0f)
{
VertexOut v[15];
Subdivide2(gin, v);
OutputSubdivision2(v,stream);

}
else if(distance(gin[0]) >= 10)
{
VertexOut v[6];
Subdivide(gin, v);
OutputSubdivision(v,stream);

}
}

sentences:
How can I get a raycast to hit navmesh only? In Unity, I'm trying to get the raycast to hit the navmesh only, but I cannot find an option to place navmesh on a specific layer.
Is there a way to raycast to the navmesh itself?

sentences:
Continuous running vs timed tasks? I've started making a browser-based game, as a hobby, where users log in via a website and can manage a soccer team. I need to have some sort of process running to handle player development, running matches, age players, generally progressing time..

I've never done anything like this before and therefore I'm putting this out there to get some feedback from other people.

So, my idea was that I could have a continuously running application which can handle all the "off-line" processing. But, that got me thinking that another approach could be to have, f.ex. a "PlayerTrainingTask" running daily, a "RunMatchesTask", running on a fixture-based schedule, et.c.

Which approach is most appropriate? or is there another option I haven't thought of?

What are your thoughts?

sentences:
Bouncing projectile off of sprite, the sides work but top and bottom do not I'm having a problem bouncing a projectile off a sprite, we've been asked to move the projectile using the equations of motions which makes things a little more difficult but as far as I can see what I have should work.

What I'm trying to do is change the angle of the collided projectile depending on which direction it is coming from.

Here is a video that is hopefully not too laggy for you to see what is happening:

Link

When the projectile collides with the left or right hand side of the sprite everything works as expected, it just switches X direction.

When it hit's the top or bottom of the sprite however it doesn't change, it just sort of rolls along the top and the shoots off.

Here is the movement code:

float nX = get_x() + cos(nGetAngle() * 3.14 / 180) * getU() * getT();
float nY = get_y() - sin(nGetAngle() * 3.14 / 180) * getU() * getT() + 0.5 * 9.8 * getT() * getT();
set_world_position(nX, nY);

Where U is initial velocity, T is time and nGetAngle() is the angle in degrees (which is set to radians whenever the angle is set).

Here is my collision for the top of the player:

//if the projectile is colliding in any way with the player sprite

if (projectiles[currProj]->get_y() < player->get_y()) // top of player
{
    float vx = cos(projectiles[currProj]->nGetAngle());
    float vy = sin(projectiles[currProj]->nGetAngle());

    float newAngle = atan2(-vy, vx) * 180 / 3.14;

    projectiles[currProj]->nSetAngle(newAngle);
    projectiles[currProj]->set_world_position_y(player->get_y() - projectiles[currProj]->get_height() - 1);
}

and here is my collision for the left of the player:

else if (projectiles[currProj]->get_x() < player->get_x()) // left of player
{
    projectiles[currProj]->set_world_position_x(player->get_x() - projectiles[currProj]->get_width());

    float vx = cos(projectiles[currProj]->nGetAngle());
    float vy = sin(projectiles[currProj]->nGetAngle());

    float newAngle = atan2(vy, -vx) * 180 / 3.14;

    projectiles[currProj]->nSetAngle(newAngle);
}

The left side collision works, the top does not and I have no idea why.

If necessary I can post the entire project somewhere.

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:
Unable to Merge Android manifest error is showing up I used Google Admob to put ads in my game but as soon as I hit build and run this error showed up I used a Github file and imported into my unity project, I will link it right here

https://github.com/unity-plugins/Unity-Admob.

CommandInvokationFailure: Unable to merge android manifests. See the Console for more details.
C:\Program Files (x86)\Java\jdk1.8.0_101\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/Users/jayso/AppData/Local/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-ads-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-ads-lite-10.2.0\AndroidManifest.xml:7] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-base-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-basement-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-gass-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-tasks-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
]
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.BuildPlayerWindow:BuildPlayerAndRun()

sentences:
How can I add different colliders to each body part of a character in Unity? I have been using unity game engine for about two weeks now. And I'm very interested in 3D game development. I have been learning basics of Unity and third person games. I saw many tutorials about creating a 3D third person player. They just drag the character into unity and create a capsule collider around the character and freeze the rotation around x and z axis.

So my question is: is it possible to add different colliders to each body part of the character and if so how do I do accomplish that?

sentences:
2D Rectangle/Circle Continuous Collision Detection I'm looking for a fast 2D continuous collision detection algorithm for circles and rotated rects.  It needs to determine the time of collision. Both shapes may be moving at high speed, so the algorithm should not assume that one is stationary.

What I found so far (what I'm not looking for):

I've found several tutorials for swept tests for AABB's, but these all involved axis-aligned (not rotated) rects.
I've found and implemented a separating axis theorem (SAT) algorithm to determine if rotated rects are intersecting with other rects or circles, but obviously that is not continuous.
I'm not looking for reduced-time-interval-based tests here; the objects' speeds are potentially very high so that kind of inelegant solution is impractical due to computational costs.

What I already have:

I already have continuous collision detection between circles implemented  (Small, High-Speed Object Collisions: Avoiding Tunneling).  Now I just need the circle/rect and rect/rect versions.
As I said above, I also already have the SAT implemented to detect circle/rect and rect/rect intersection (but obviously that's not continuous).

Thank you very much for your time and help!

Edit: I'm not worried about rotational velocity over the space of a frame.

sentences:
Porting SDL OpenGL Game to Android and IOS I am currently learning OpenGL (3.0+) with C++. I am using SDL for input handling, window creation, etc., GLEW to use OpenGL and call OpenGL Functions, and GLM for OpenGL Math stuff.

If I fully finish a Windows game, how can I port my game with the setup above to Android, IOS, and maybe even other platforms (but my main focus is Android and IOS). I do not want to use any Game Engines.

What I am looking for is a program that could just make my game run on android and IOS. If there is a way to optimize my game using the tools listed above a little bit and change some code to make my game run on android and IOS, I am okay with that (if that is the case, please provide resources).

I have heard of OpenGL Es, not quite sure what that is, but I do not want to use it if it is a completely different library and if I have to rewrite the entirety of my game rendering engine. I also want my app to run without the user having to download any libraries such as SDL, so please make sure that my app can just run as an .apk file or whatever format that I can just tap on and it will open.

I also want my app to run on most smartphones (Android and IOS), so please be sure that what you are suggesting is not only available to a limited amount of smartphones. Another thing that I want is optimal performance. No emulators or simulators from .exe to .apk that run very slowly. It should run as fast as other apps and run at probably the same speed as my windows version. Also point out any mistakes that I may have made (for example, maybe I am just crazy thinking that smartphones use OpenGL).

sentences: Efficiently detecting objects inside multiple radius I would like to create a game for mobile that require to calculate multiple time by seconds which moving objects are in the radius of moving points. The game is highly inspired from Gratuitous Space Battles, the radius being from the weapons. Thus, I would like to know if it's realist to expect to be able to know among 1000 moving objects, in which radius they are among 1000 moving points 100 times per seconds on an average android device. In term of complexity, if there is an algorithm better than O(N*M), N being the number of moving objects and  M the number of radius from M moving center and if an algorithm can benefit from the fact that the moving objects are near their precedent position.

sentences:
How do I detect a tile map collision's direction? I'm implementing collision detection with the map for my platformer. I have a method that generates a polygon on every tile and checks if the player hits it -- that's all fine. The problem is that when ever a player touches a wall in front of him the d key which moves him to the front gets disabled so he can't walk any further that way.

This method works great for preventing him from walking into walls, but I also want him to be able to jump on the walls and there is the problem. So he falls on the tile(polygon) the game senses that and applies the same method for the d key, preventing the character from walking left or right, because the game thinks it is hitting the tile in the front but it is hitting from above.

Long story short, the game handles collision from above same as from the front or back. How do I make it recognise collisions from the side separately from above?

My code is along these lines:

if(PlayerPolygon.interesects(TiledPolygon) && dKey==1) {
         moveX = 0;
}
if(dKey==1) {
  player.x +=moveX
}

sentences:
Transformation matrix that maps a window I'm currently learning OpenGL at uni, and they give us questions to help us learn (these are not worth anything), however I'm stuck on this one question and would have to travel over an hour and a half to uni for an answer.

How do I do this question? Please include as many steps as you can, I want to be able to follow exactly how to do this.

Find the transformation that maps a window whose lower left corner is at (1,1)
and upper right corner is at (3,5) onto:

The entire device screen whose dimension is (600, 500)
A viewport that has lower left corner at (100,100) and upper right corner
at (400,400)

Edit: Damn sorry I should have added I am meant to find the matrix, so no code.

sentences:
Flexible alternatives to many many small polymorphic classes (for use as properties or messages or events) C++ There are two classes in my game that are really useful, but slowly becoming a pain. Message and Property (property is essentially a component).

They both derive from a base class and contain a static id so that systems can only pay attention to the ones they want to. It's working out very well... except...

I'm constantly making new message types and property types as I extend my game. Each time I need to write 2 files (hpp and cpp) and a ton of boilerplate to get essentially an classID and one or two standard data types or a pointer.

It's starting to make playing around and testing out new ideas a real chore. I wish when I want to create a new message or property type, I want to be able to just type something like

ShootableProperty:  int gunType, float shotspeed;

ItemCollectedMessage:  int itemType;

instead of creating a header and cpp file, writing a constructor, including the parent class, etc etc.

It's around 20 - 40 lines (including include guards, and everything) just to do what logically is 1 or 2 lines in my mind.

Is there some programming pattern to get around this?

What about with scripting (which I know nothing of)... is there a way to define a bunch of classes that are almost the same?

Here is exactly what one class looks like:

// Velocity.h

#ifndef VELOCITY_H_
#define VELOCITY_H_

#include "Properties.h"

#include <SFML/System/Vector2.hpp>

namespace LaB
{
namespace P
{

class Velocity: public LaB::Property
{
public:
    static const PropertyID id;

    Velocity(float vx = 0.0, float vy = 0.0)
    : velocity(vx,vy) {}
    Velocity(sf::Vector2f v) : velocity(v) {};

    sf::Vector2f velocity;
};

} /* namespace P */
} /* namespace LaB */
#endif /* LaB::P_VELOCITY_H_ */

// Velocity.cpp

#include "Properties/Velocity.h"

namespace LaB
{
namespace P
{

const PropertyID Velocity::id = Property::registerID();

} /* namespace P */
} /* namespace LaB */

All of that just for a 2D Vector and an ID saying to expect a 2D vector.  (Granted, some properties have more complicated elements, but it's the same idea)

sentences:
Can you use A* to make a unit move nonspecifically? A* is typically used to calculate the best way to move towards something, and it's quite flexible when it comes to threats, extra movement costs, and 'refuelling' on the way to something.

However, if you designate only threats, perhaps with a main threat first and foremost, can you use it for "finding somewhere to go"? What about adding both threats, safety, resources and other such heuristic influencers to determine what a unit does when idle?

sentences:
Generating a Sprite to cover given area I have an area say a x b of cells. actually I render every single cell in this matrix with a tile representing floor, wall, etc. What I'm trying to achieve it to replace this tiling system with a unique tile covering the whole a x b area.

I tried to play with creating a single GameObject and then adding a SpriteRenderer component with the base idea to stick in a sprite with desired size so that the image (whatever it is) gets stretched to fit it but apparently all the suitable fields which could be involved in this are readonly (I considered the rect and the bounds attribute).

In other words I feel like I'd need to attach a SpriteRenderer with a dynamic size based on given dimensions. How could I reach this goal?

sentences:
Rotate an object given only by its points? I was recently writing a simple 3D maze FPP game. Once I was done fiddling with planes in OpenGL, I wanted to add support for importing Blender objects. The approach I used was triangulization of the object, then using Three.js to export the points to plaintext and then parsing the result JSON in my app.

The example file can be seen here:
https://github.com/d33tah/tinyfpp/blob/master/Data/Models/cross.txt
The numbers represent x,y,z,u,v of a single vertex, which combined in three make a triangle.

Then I rendered such an object triangle-by-triangle and played with it. I could move it back and forth and sideways, but I still have no idea how to rotate it by some axis. Let's say I'd like to rotate all the points by five degrees to the left, how would a code doing it look like?

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:
Write Data From List To CSV File I am trying to write to a CSV file the values that I put in lists from a key press in the keyboard. It does work somehow but in my csv file I get the values 2 times. Also, when I put values to only one of the lists, I don't get any data to CSV file. How can I save the values from the lists to my csv file but to be independent from each other? This is my code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System;

public class record : MonoBehaviour
{

public List<string> inventory = new List<string>();
public List<string> OnlyX = new List<string>();

void Update()
{
    if (Input.GetKeyDown(KeyCode.F))
    {
        inventory.Add("F");
    }
    if (Input.GetKeyDown(KeyCode.J))
    {
        inventory.Add("J");
    }
    if (Input.GetKeyDown(KeyCode.X))
    {
        OnlyX.Add("X");
    }
    string filePath = getPath();
    StreamWriter writer = new StreamWriter(filePath);
    writer.WriteLine("Inventory,OnlyX");

    for (int i = 0; i < inventory.Count; ++i)
    {
        for (int j = 0; j < OnlyX.Count; ++j) {

            writer.WriteLine(inventory[i] + "," + OnlyX[j]);
        }
    }
    writer.Flush();
    writer.Close();
}
private string getPath()
{
 #if UNITY_EDITOR
    return Application.dataPath + "/Data/"  + "Saved_Inventory.csv";
 #elif UNITY_ANDROID
    return Application.persistentDataPath+"Saved_Inventory.csv";
 #elif UNITY_IPHONE
    return Application.persistentDataPath+"/"+"Saved_Inventory.csv";
 #else
    return Application.dataPath +"/"+"Saved_Inventory.csv";
 #endif
}
}

sentences:
Moving a top-down camera while keeping its height constant I'm currently writing the script for the player to explore the plane below. The camera view is set to be slightly rotated as to look down. And I have set the code to make the camera move.

This is the code, and everything is set in the update method.

        if (Input.GetKey("w"))
        {
            transform.Translate(Vector3.forward * panSpeed * Time.deltaTime);   // , Space.World if want to avoid camera going down
        }
        if (Input.GetKey("s"))
        {
            transform.Translate(Vector3.back * panSpeed * Time.deltaTime);
        }
        if (Input.GetKey("d"))
        {
            transform.Translate(Vector3.right * panSpeed * Time.deltaTime);
        }
        if (Input.GetKey("a"))
        {
            transform.Translate(Vector3.left * panSpeed * Time.deltaTime);
        }

The problem is that everytime that the camera goes forward, it goes straight down. And I don't want it to do that. I want to keep the "height" from the plane below to be the same as in the picture below. I want the camera to move along the red axis.

I know of the existence of Space.World in order to achieve this, but the problem is that if I do that, whenever I rotate, now the controllers are all screwed up, because if I rotate to the right for example. Now Forward (W) moves the camera to the left, Right (D), moves the camera forward, etc etc.

So basically what I need is 1: to make the camera keep the distance to the plane below while moving (not going down). and 2. To make it possible that even with rotations, the controllers are kept, and not having this weird behavior, when forward is not longer forward.

Any ideas how to achieve this?

sentences:
How do I do a game loop in c99? I'm having trouble with how to structure a game using c99. I've seen a few tutorials on making a game loop, but they are all done with c++ and classes. My main problem seems to be moving data around between the functions without creating a mess, and what stuff to put in what header files etc. Do I just do something similar to the c++ loops, and create a class-like header with a structure containing all items needed by more than one of the functions, along with the prototypes of said functions, and include the header in each function's header file? Then, in the main function, instantiate the structure and pass a pointer to it to every function in the loop?

Is this ok, or is there a better way to do it, and are there any good 'c' specific tutorials available?

Cheers

sentences:
Creating Level iPhone I am thinking about a new game idea for the iPhone and presumably all the levels would have to be made programatically. So Im wondering what the best method to approach it?

Say I have a game with a standard typical 2d, top down maze. Thise maze is simply made up of walls, multiple rectangles on screen, making paths.

Do I have to manually work out the position of every rectangle and put it in with an x and y position or is there a better way? I see this taking, forever, there must be certain ways developers approach these situations to get by them efficiently and quickly surely?

Thanks.

sentences:
In Unity how can I know which direction is the screen auto-rotated? From the Screen.orientation description I get

  If the value is set to ScreenOrientation.AutoRotation then the screen will select [...] automatically as the device orientation changes.

This seems to imply that if the screen does auto-rotate, then Screen.orientation has been set to ScreenOrientation.AutoRotation.

If that's so, how can I know in which direction it has been auto-rotated?

Disabling the auto-rotation doesn't count (obviously), and I need to distinguish between LandscapeLeft and LandscapeRight, so checking height and width doesn't work either.

This should be cross-platform, without including any kind of non-C# plugin.

(the answer, given this documentation, seems to be "you can't", but maybe I'm missing something)

sentences:
How many localisations are too much for a game? We are making an RTS game and we intend to add localizations to all languages our players use. So far we have 16 locales and about 3-4 are being planned.

Now some crazy ideas pop up from our community, players ask for "funny text" localizations. We have been already offered a pack that makes it for 1 of our languages. Now I was thinking where should we draw a line between official localizations which we include into the game and unofficial mods that players will have to install on their own?

Obviously overcrowding locale selection menu with all sorts of funny locales (LOL-cat, redneck, welsh, medieval, simplified, etc.) for all the languages seems way too much. But is it really? What are the hidden pros and cons of having too much locales and how much is too much?

sentences:
How can I apply the changes in runtime? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimFlyertransportationController : MonoBehaviour
{
    public GameObject JetFlame;
    public bool turnOffOn = false;

    // Start is called before the first frame update
    void Start()
    {
        TurnAllAnimtorsOff(transform, turnOffOn);

        if (turnOffOn)
        {
            JetFlame.SetActive(false);
        }
        else
        {
            JetFlame.SetActive(true);
        }
    }

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

    }

    private void TurnAllAnimtorsOff(Transform root, bool onOff)
    {
        Animator[] animators = root.GetComponentsInChildren<Animator>();

        foreach (Animator a in animators)
        {
            if (onOff)
            {
                a.enabled = false;
            }
            else
            {
                a.enabled = true;
            }
        }
    }
}

I want that if in runtime I change the turnOffOn flag state apply the changes in real time in the Update for all Animators and also for the JetFlame.  Now it's only aply the changes in the editor before running the game.

sentences:
Choosing the correct isometric character facing direction I am currently building a 3D game presented from a 2D isometric viewpoint.

The 3D coordinates start at the top left corner of the screen with x and y increasing towards the right and bottom edges respectively. An angle about the z axis starts with 0 facing right and increases CW.

The isometric coordinates use the diamond method seen in this reference:

My problem is related to choosing the correct frame for my characters. The characters each have a sprite sheet containing an image for one of the 8 compass directions. The start with the image facing right and rotate CW as in the 3D coordinates.

How can I choose the correct sub-image based on their rotation in 3D space? Is the problem is equivalent to converting the rotation into the isometric coordinate space?

sentences:
Flickering / tearing with glfwSwapBuffers I recently separated my logic and rendering threads to fix this problem:

GLFW window freezes on title bar hold/drag

This means the logic and rendering are no longer running in lock-step as they were before, so it is possible that the logic has not finished executing by the time we are ready to render. To handle this case, the rendering thread will keep sleeping for 1ms until the logic has finished executing.

Pseudo-code

Logic thread

while (!exiting) {
    timeBefore = now();
    updateGame();
    renderingDue = true;
    timeElapsed = now() - timeBefore;
    sleep(MS_PER_FRAME - timeElapsed);
}

Rendering thread

while (!exiting) {
    if (renderingDue) {
        render();
        renderingDue = false;
        GLFW.glfwSwapBuffers(window);
    } else {
        // Not yet ready to render, but try again in a short while
        sleep(1);
    }
}

This seems to work fine for me, at least with vsync disabled. When I tested with vsync enabled I encountered stuttering, which I suppose is because if we miss a rendering frame, we have to wait until the next monitor refresh interval before we can catch up.

However, on some other systems, in particular low-end laptops, there is a lot of flickering / tearing during gameplay. I don't understand what would cause this, since we are always calling glfwSwapBuffers() after rendering, not during.

Is there something fundamentally wrong with my approach?

I know ideally the rendering thread should take a delta value so that it can render the state "between" logic threads (yes, I have read Fix Your Timestep!), but I am nonetheless curious about what is happening here.

sentences:
applyForce as long as display is pressed In my project I have my main character body. I want it to move down on the y-axis as long as the screen is pressed. I tried it with

public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        jetski.applyForce(new Vector2(0,-1000), jetski.getWorldCenter(), true);
        return true;
    }

but that does it only once.

sentences: How to set LOD specifications for all meshes in unreal at once? I have a large model and want to avoid separately setting the LOD specifications for each component in the model. Is there are way set LOD specifications for all meshes in unreal at once since I want to set the same specifications for each one? (percentages, how many LOD's, and at what screen distance they kick in, using Unreal's autogenerated LOD's).

sentences:
Move object along world X/Z axes taking account it's own rotation I have a camera 9 units up, tilted down at a 60° angle (rotated around it's X-Axis), which means forward for the camera is pointed down at the floor as shown in the picture below

Now when I press W, i want the camera to move horizontally forward without changing it's Y coordinate, but not along the world Z axis, as that breaks when the camera is rotated around it's Y axis. Here are a few images demonstrating what I want
Side view:

Top view:

sentences:
Implementing `fling` logic without pan gesture recognizers So I am trying to port over a simple game that I originally wrote to iphone into cocos2d-x.  I've hit a minor bump however in implementing simple 'fling' logic I had in the iphone version that is difficult to port over to the c++.  In iOS I could get the velocity of a pan gesture very easily:

CGPoint velocity = [recognizer velocityInView:recognizer.view];

However now I basically only know where the touch began, where the touch ended, and all the touches that are logged in between.  For now I logged all the pts onto a stack then pulled the last point and the 6th to last point (seemed to work the best), find the difference between those pts multiply by a constant and use that as the velocity.  It works relatively well, but I'm wondering if anyone else has any better algorithms, when given a bunch of touch pts, to figure out a new speed upon releasing an object that feels natural (Note speed in my game is just a constant x and y, there's no drag or spin or anything tricky like that).

Bonus points if anyone has figured out how to get pan gestures into the newest version (3.0 alpha) of cocos2d-x without losing ability to build cross platform.

sentences:
What has your experience been with Torque products? I'm most interested in your experience with Torque-X, the Managed XNA version of their engine.

How did it perform in your use case? (also info on your use, would be helpful)
What was the usability of the tools?
What did you build with it? 2D, 3D, both?
Did you find any "gotchas" that you had to work around?

If you have used both Torque and Torque-X, I'd be very interested to hear your thoughts contrasting the two engines. On the website, there are some pretty amazing screensshots for the Torque engine; yet the screenshots of Torque-X look kinda cheesy. At this point I don't have the 3D artist expertise to build some of the amazing 3D scense they demoed, but I'm wondering if this would even be possible on Toreque-X engine.

As always, any thoughts are greatly appreciated.

sentences:
Prevent showing movie files after packaging unreal game I developed a game which has some videos inside it. I added videos into my project folder so that I can access them.

After packaging, on the folder all videos will be shown as its original format which everyone can play it.

How is it possible on release version no one can go to game folder and play it? Maybe some kind of encryption or change format of file which only its game can play it would help it.

For example when you have a game on your computer, the only way to see the video is that you play the game and you will see relevant videos in the right time. However, after packaging, all videos will be on a folder any everyone can go to the folder and play it and see videos even without playing game.

In Unity after releasing the game, you can't access assets, it will be shown in a file with .resource extension so no one can access it. However, in Unreal Engine, it will show the real file.

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

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

sentences:
Minimum hardware requirements for developing for iOS and Android with Unity, Cocos2d-x and GameSalad on a Mac I intend to create iOS and Android games. My main priority is to create 2D games. The software that I’m planing to use are Unity, Cocos2d-x and GameSalad.

I am a bit interest in the Mac Mini, because it is cheap compared to other Apple machines. What are the minimum hardware requirements for an Apple machine?

sentences:
Load single texture atlas for multiple sprite Recently, I am developing sudoku game. For this, I have created multiple grid 9x9,12x12 and 15x15.

For this numbers are repeated so multiple sprite renderer are created and it load same number texture multiple time.

So I want single number loaded single time only no repetition texture occur in graphical memory.

Because of this problem I am facing following problem that I already posted.

Android Device Screen Flicker

I want suggestions to overcome this problem from your side.

sentences:
glsl fragment shader work diffrently on different devices i'm making a 2d android game where i have a mechanics that allow the player to move the camera away from the main character, and to not allow him to explore the hole world, a have create a Fog shader, know the shader works very well on the emulator, and in the desktop application from libgdx, but once i run it on real devices it give me a defferent output, in Xperia SP the for never get heigher and make every thing visible, and in a Galaxy S3 the Fog act like a Circle and make every thing invisible.
my question is : are shader work differently from gpu to one other.

sentences:
Direct3D 11 : Pixel shader and Vertex shader getting set at every draw call I'm working on my own (much tinier) version of Monogame. Right now I've been able to draw triangles to the screen with custom shaders using Direct3D 11. The problem is that I can't get it to be as perfomant as Monogame. I did some graphics debugging and noticed something :

The above picture is my implementation and the other is Monogame. For some reason the pixel shader, vertex shader and constant buffers are assigned at every draw call. I don't understand why this is happening since in my code I only ever set those parameter once an then draw a buffer containing 2 triangles 1000 times (as a performance test).

sentences: DrawString and Render graphics after custom time I want to draw String after some second like "Boss is incoming",and after the string is disappeared i want to draw the Boss.I have the graphics and the string so my question is how to add timer for string and graphics?

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:
Separate collision mesh model? I want to have another go at 3D within XNA. What I have seen from some other games that they just have a separate very low poly model "cage" around the environment model. However I can not find any reference to this. I have not that much experience with XNA 3D either.

Is it possible to have this cage within each of my environmental models already? Lets just say I call the mesh within the .FBX wall and col_wall. How would I call to these different meshes within XNA?

The player would just have a tight collision cube around. To make it a bit more efficient I will be making divide the map up by cubes and only calculate collision if the player is in it.

Question two: I can't find anywhere to do cube vs mesh collision. Is there a method for this? Or perhaps it is possible to build my collision cage out of cubes in the 3D app and on loading of the models in XNA replace them directly by cubes? So I could just do box to box collision which should be very cheap and still give the player the ability to move over ledges on the static models.

sentences:
How should I automatically update my entire game's files? How should I automatically update my player's game assets and executables? It is preferable for the update software to be free. Updates must be small in size and not waste cpu-time. Also it has to be easy to run a update server to create new versions or logistically.

My use case is for updating player game versions such as in massive online clients or running distributed game testing or even normal games.

sentences:
Confused why draw code is clearing, pico-8 api demo In the API demo when they do the example of how to draw a colour pallette at the top of the screen:
I notice the commands don't work when used inside the draw function. When used inside of draw they showup for a second and disappear. removing the cls() allows them to stay, but I need cls included. What do i need to be doing to get the pallette to stay while using the following within the draw function?

function _draw()
       cls()
       rectfill(1,1,7,7,5)
       for i=0,10 do
          print(i,x,2,i)
          x = x + 6
       end
end

sentences:
Unity WebGL build throws errors I am working on a multiplayer game for WebGL platform and I am using SocketIo & node.js server for handling the game.

I am facing issues, as shown in the attached image. I have no idea about what these errors mean. I don't think that the issue is from my coding side, as my multiplayer game runs perfectly in standalone builds, with more than 4 instances of the standalone build running.

It does not even open in my WebGL build. Does WebGL does not support threading? What are these errors all about? Can these issues be solved, or do I have to change my whole project implementation?

sentences:
Adding 'xna content project' reference to monogame project(visual studio 2013 pro)? I want to add reference to an xna content project. Which should be like the content project reference we have in an xna windows game. I am on visual studio 2013. I got the xna extensions to work by following this method.
  http://jaquadro.com/2013/11/migrating-monogame-projects-to-vs2013-and-windows-8-1/

But i dont see an option to add content reference in visual studio 2013. I searched everywhere and couldnt find an answer. Is this even possible? Or am i running in the wrong direction?

sentences:
How do I draw a zoomable image in OpenGL? Up to now I have used glDrawPixels but since my image is a large geotiff one, I'm getting some horrible results for example:
this is the code used for zoom extent:

void COpenGLControl::ZoomFullExtent()
{
    GLint iViewport[4];
    glGetIntegerv(GL_VIEWPORT, iViewport);
    glPixelZoom((GLfloat) iViewport[2] / (GLfloat)width,
                (GLfloat) iViewport[3] / (GLfloat)height);
}

Since the image is a square one, it's not a good result.

This is the code used for zoom in:

void COpenGLControl::FixedZoomIn()
{
    glPixelZoom(2.0f, 2.0f);
}

but it does zoom in operation just one time and when I again click on the button the zoom in is not done I think it is because that when I call COpenGLControl::FixedZoomIn for an instance of the class COpenGLControl infact the openGL window is zoommed not the contents in it.

I have heard about texture mapping and how to zoom by changing z of the camera point.

How would I customize the class COpenGLControl for my purpose?

sentences:
Calculating the center of a turning circle I'm trying to understand how to calculate the midpoint of a turning circle. In the attached picture, my unit is at location U. I want to compute the trajectory of the unit as it turns toward the starred location.

I understand that to achieve this I need to know the location of point P, whose coordinates are (a,b). I also understand that I can do this using some simple trig:

a = x - cos(theta) * r
b = y - sin(theta) * r

My problem is that I do not know the value of the angle Theta which sits between the sides of the right-triangle named "R" and "X-A". All I know is:

The radius of the turning circle.
The orientation of the unit.

How can I solve this problem and others like it more generally?

sentences:
How do we apply different textures to different faces generated via geometry shader? I am trying to render a cube by starting of with one vertex into the shader, then geometry shader to expand into a cube, and then apply a different texture to each side. The part I am facing the issue with applying unique textures to each side.

So I am currently doing this by creating it via quads pushing the vertices, and applying the textures one by one. In fact, I drawIndexed() a set of vertices, then switch over to a different textures every 6 vertices. But pushing in so many vertices is expensive for higher FPS. So, I looked in to Geometry shader and it seems like it did the job. After studying it, I understand how to develop the vertices in the geometry shader. However, I don't know how to apply a different texture say every 6 vertices - since we are in the pipeline already.

sentences:
Creating straight lines between two Vectors? (and slopes?) (interpolation??) libgdx java I am trying to make a game with very basic physics (just gravity at this stage). Without using box2d
How is the best way to create the solid ground. I will be wanting to make ramps soon, but at this moment i am even stuck trying to make flat ground.

The approach i've been researching involves 'interpolation' between 2 or more vector2's , this sounds perfect for me as I only need very basic levels (think Excitebike for NES) so I want to be able to provide my level-creator class with just a bunch of height values and i want it to create invisible straight lines joining up those height points.

As i said ive seen about "interpolation" in the vector2 or the libgdx.math classes but I'm very confused on how to go about using those commands.

As usual any help is much appreciated, thanks for reading

(EDIT: I am thinking I could use Rectangles between the straight parts but is this going to work when i start introducing sloped ground?)

for example i have the green dots saved as vector2 and i need a method that makes the lines between (straight lines is fine no need for curves etc)

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 add Facebook Data Storage to Mobile Game? I was wondering how I would add the option for players to sign into their Facebook profiles on my mobile game and then have Facebook store their game save data, so they can recover it on any device when they sign into Facebook. Other Facebook features would include seeing their friends on the Facebook leaderboards, inviting their friends to the game and challenging their friends to beat their scores. I would hate for the Player's data to be lost, so the Facebook data save part is very important. A good reference to this feature is the Hungry Shark mobile game.

I wasn't sure how this works. My programming friend and I are creating the game together, but he doesn't know how to do this and I don't know how to program. Once I figure out exactly what has to be done, I would like to hire a programmer who knows how to add this feature.

Thank you!

sentences:
How to move gameobject with touch on Android I'm trying to make a game where you control a character via touch on Android devices.

The player will have two degrees of movement.

When you touch the touch screen and move your finger, the game object should move to your finger's location and follow your finger as you move it.

Here is an example of what I'm trying to do: http://www.youtube.com/watch?v=OoqRC8QptzM#t=01m01s (@ 1:02).

I already know I need to use Input.touches.

I've tried using Transform.translate and Vector3.Lerp, neither gave me the results I wanted.

Here is some of the code I've tried using:

#pragma strict

var speed : float = 1;

function Start () {

}

function Update () {
    if (Input.touchCount > 0 &&
        Input.GetTouch(0).phase == TouchPhase.Moved) {

        // Get movement of the finger since last frame
        var touchDeltaPosition:Vector2 = Input.GetTouch(0).deltaPosition;

        var touchPosition:Vector3;

        touchPosition.Set(touchDeltaPosition.x,
                           transform.position.y,
                           touchDeltaPosition.y);

        // Move object across XY plane
        transform.position = Vector3.Lerp(transform.position,
                                                touchPosition,
                                                Time.deltaTime*speed);
    }

}

sentences:
Use arrow keys to navigate between specific toggles, not all UI elements I'm making a game where the player needs to select a object out of three and navigates between then with the arrows of the keyboard, and I'm using toggles to make this system.
But the problem is that when I hit play, the navigation mixes the toggles with some other UI elements I dont want to include in the navigation, like sliders and buttons.
How can I lock the navigation for just these three toggles?
I also want to make the navigation switch between these toggles and another three toggles in the middle of the game. How would I change my navigation via script?

sentences:
Steady zoom on center in LWJGL (Modelview) I am having a problem in LWJGL with zooming in and out. I am using glScaled(zoom, zoom, 1) before glTranslated. There are 2 problems:
1. The rate of zoom speeds up a lot when zooming out (lower zoom value).
2. It zooms in on the bottom left corner of the screen rather than the center. Eventually, I would like to have the zoom focused on the mouse position.

I have tried to fix these problems by make it glScaled(zoom^12, zoom^12, 1) so that the greater the zoom value, the faster it will zoom in order to balance out the faster zoom at lower zoom values. To compensate for the zoom focused on the bottom left, I have tried to subtract (zoom+1)^10 + 2^10 from the X and Y of each sprite. This results in a curved zoom path, first to the left and then to the right. It is a 2D game.

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:
Tile base Farm Simulation in Unity I am thinking of creating a sprite base 2d top down farm simulation game. The game uses tiles and I was wondering (conceptually) what is the best way to handle the farm tiles. Each tiles should have the following list of features.

The player should be able to add seeds to each tile
The player should be able to plant a variety of vegetables.
Plants should have different stages of growth
The player should be able to interact with each tile (dig, cover holes, water, add fertilizer, etc).
The farm layout can have a variety of shapes (i.e. Not just a square (9 x 9) or rectangle (9 x 15) a shaped farm.)

Currently I have a script that generates a square or rectangle shaped like farm, each tile is a sprite object with a 2D collider. I have come up with a solution for planting and the different stages of growth. However, it isn't the most elegant solution. My current solution is to create prefab for each plant. Then once a seed is planted onto a tile, create a plant object in the location of the tile (using it's vector position), and make the plant a child object to that tile. Each plant will have an age counter that increase when a new day is triggered. To show the growth stage swap the texture depending on the plant's age.

My biggest problem with the implementation is that if the players farm is very large the game will have to create a hundreds object, which seem very taxing. Is that a different way achieve these features without the use of so many objects? If so, how would I implement it (conceptual of course). Thanks!

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:
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:
Does anyone know where I can find wp7 indie game sales data? I am curious about whether to develop an xna game for the windows phone 7. It would be nice to know how the games are doing on that platform sales wise.

Something like this would be very helpful:
http://www.xboxist.com/xbox-360/games/xna-community-games-is-a-failed-experiment-010122.php

sentences:
How do I calculate opposite of a vector, add some slack How can i calulate a valid range (RED) for my object's (BLACK) traveling direction (GREEN). The green is a Vector2 where x and y range is -1 to 1.

What I'm trying to do here is to create rocket fuel burn effekt. So what i got is

rocket speed (float)
rocket direction (Vector2 x = [-1, 1], y = [-1, 1])

I may think that rocket speed does not matter as fuel burn effect (particle) is created on position with its own speed.

sentences:
Cocos2d how to correctly preload a spritesheet before the scene start? I'm working on a game with Objective-C and Cocos2d, the game has a huge number of images, and obviously as I add images on the spritesheet (well yes I'm using spritesheets) the loading time get longer, I've seen a huge increasing in loading time since the last update (I had to add a lot of stuff) and that's why I truly need to preload the entire spritesheet before the game start. So here is what I don't know exactly how to do, I'm using this method in the appDelegate in the applicationDidFinishLaunchingWithOptions method:

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"spriteSheetFile.plist"];

but seems to do nothing. There is surely something I'm missing...

I've also tried:

[[CCTextureCache sharedTextureCache] addImageAsync:image_png target:self selector:@selector(loadImage:)];

but to be honest I'm not sure on how to use this with a spritesheet...

so my question is: what here is wrong and how can I preload a spritesheet full of sprites before the game start? and also what I'm not totally sure about is, if I preload a spritesheet, this means that when the game start the sprite needs to be draw the first time, there is where the loading comes from? how can I make this scene loading as fastest as It can?

any help would be great, thanks

sentences: Best practice for image compression Which is the best format or best technique to compress images without loss of quality for iPhone/iPad games?

sentences:
Multiple enemy collidiers I currently have an enemy that upon collision kills the player with a kill script, I want to add another collider that acts as the visibility radius for said enemy. However, when adding another colldier with a bigger x radius, the collidier still kills the enemy. Is there any way to assign particular colliders specific methods using

OnTriggerEnter2D (Collider2D var)
{
}

sentences:
Field of vision - Objective-c Here's where I'm at.

Here's where I want to be

Here's how it's drawn

SKShapeNode *fov = [SKShapeNode node];
UIBezierPath *fovPath = [[UIBezierPath alloc] init];
[fovPath moveToPoint:CGPointMake(0, 0)];
[fovPath addLineToPoint:CGPointMake(fovOpposite *-1, fovDistance)];
[fovPath addLineToPoint:CGPointMake(fovOpposite, fovDistance)];
[fovPath addLineToPoint:CGPointMake(0, 0)];
fov.path = fovPath.CGPath;
fov.lineWidth = 1.0;
fov.strokeColor = [UIColor clearColor];
fov.antialiased = NO;
fov.fillColor = [UIColor greenColor];
fov.alpha = 0.2;
fov.name = @"playerFOV";
[_playerImage addChild:fov];

Now, I'm not expect the answer of "use this code" I'm hoping someone can point me down a logical path of determining how to emit the field of vision, and if it encounters an obstacle, it stops drawing.

sentences: database design for browser based game I'm wondering how to design a database for the player's experience, whether to create a single table that will collect basic information such as. Class, race, number of experiences, number of occupied bases, etc. Or whether it would be more ideal to divide it into individual databases

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:
How to find monitor resolution with glfw3? For a while now, I have been playing around with making a game using OpenGL, and glfw3. I have been perfectly happy to create windows at my native resolution of 1920x1080. I'm getting to the point where I want to share it with other developers, so I cannot keep hard coding the screen resolution in. I went looking for ways to find the maximum resolution of the available monitor, which glfw provides using the function glfwGetVideoModes(GLFWwindow*, int);. It supposedly finds all available displays for a monitor (resolution, color depth, refresh rate), and returns them as an array of possibilities.

void GetMaxMonitorResolution(int* w, int* h)
{
    int count;
    const GLFWvidmode* modes = glfwGetVideoModes(glfwGetPrimaryMonitor(), &count);

    int maxWidth = 0;
    int maxHeight = 0;
    for (int i = 0; i < count; i++)
    {
        if (modes[i].width > maxWidth)
            maxWidth = modes[i].width;
        if (modes[i].height > maxHeight)
            maxHeight = modes[i].height;
    }

    *w = maxWidth;
    *h = maxHeight;
}

The problem is, even though my monitor supports 1920x1080, it keeps creating a window at 800x600, the smallest resolution possible on my monitor. I am relatively new to C++, so I am only 80% sure how pointers work, especially pointers to arrays and the such. So if I am somehow messing up the pointers, or if it truly is a problem with glfw, I would appreciate any help.

EDIT: The documentation for glfw3 monitors is here and here, in case anyone was wondering.

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:
What web technology could I use which would support a decision tree? I am a big game development fan but I haven't done any commercial work in the past. I have been asked by a non-profit to look at developing a game similar to the award-winning www.playspent.org

They want the following features:

support 5 scenarios
mobile isn't important but compatibility with older browsers would be a big bonus
they want it to be visual and audible
bonus is to have it easily modifiable
support 4 languages

I don't have much knowledge of Flash and would rather avoid using it as a solution. I started breaking down the problem into segments that I will need to examine, they are as follows:

ability to read the game flow from a file that they can produce (xml, etc.)
db design to store decision tree
language challenge
browser compatibility

I am leaning towards an Google app engine/GWT solution but I am not sure what technology is best for this.

I am really hoping to get your opinion/recommendation on my approach and on what technology is best. A special thanks (and beer if you live in Toronto) will be awarded to anyone who can help give me a ballpark estimate on how much such a game should go for. I know it's tough to estimate but any rough figure will help (how much would you charge for building something like playspent.org?)

Thanks in advance

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:
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:
Python/Kivy game for steam I'm developing a game in Python with Kivy as the gui. I've heard a few programs mentioned that compile python files to .exe's. However, I cant seem to find any that mention compiling .py and .kv files.

I wish to eventually publish my game to Steam Direct but i would like to know if my current approach to coding the game will hinder me doing so.

My actual question is, is there a way to compile a Python game with Kivy to an .exe file?

sentences:
How do I create a knockback-movement? I am a web developer new to game development, and with limited math knowledge. I am writing a character movement controller in Unity. The game has an isometric Diablo-like camera. The character moves on mouse click within a limited area.

The character moves like this now:

I want it to move like this:

I don't need you to write the code for me: I just want to understand what the math for this looks like. A Unity- and C#-specific explanation would be great, but not necessary.

sentences:
Box2D `ApplyLinearImpulse` is not working whereas `SetLinearVelocity` works I need to mimic jumping behavior for the player in my game. Player consists of two fixtures with circle and rectangle shapes. Rectangle I use to detect ground and it is a sensor. Is some point for jumping I do this:

float impulseY = body->GetMass() * PLAYER_JUMPING_VEOCITY / PTM_RATIO * std::sin(PLAYER_JUMPING_ANGLE * PI / 180);
body->ApplyLinearImpulse(b2Vec2(0, impulseY), body->GetWorldCenter(), true);

and player does not jump. But when I do this:

body->SetLinearVelocity(b2Vec2(0, PLAYER_JUMPING_VEOCITY / PTM_RATIO * std::sin(PLAYER_JUMPING_ANGLE * PI / 180)));

my player jumps. Also when I change the rectangle shape to be normal (not sensor) shape, its works again. Why? Just in case here are the parameters of my rectangular sensor:

b2PolygonShape boxShape;
boxShape.SetAsBox(width * 0.5/2/PTM_RATIO, height * 0.2/2/PTM_RATIO, b2Vec2(0, -height * 0.4 /PTM_RATIO), 0);

b2FixtureDef boxFixtureDef;
boxFixtureDef.friction = 0;
boxFixtureDef.restitution = 0;
boxFixtureDef.density = 1;
boxFixtureDef.isSensor = true;
boxFixtureDef.userData = static_cast<void*>(PLAYER_GROUP);

sentences:
Sending a struct containing a string over network I'm trying to send structs as neatly sorted packets using iPhone Game Kit..

I have a struct which looks like:

typedef struct {
   int coolStuff;
   char playerID[100];
} MyStruct;

Then I'm using strncpy() to copy the NSString I want into MyStruct.playerID. However, I would like to be able to send a playerID (string) of any size and possibly multiple strings per struct. Any suggestions?

There is a chance I'm  making this more difficult than it actually is..

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:
How can I make my tank move smoothly and not jump from 0 km/h to 10 km/h? I'm building a multiplayer game of tanks in node js. at the moment I have the movement smooth and mastered but my problem is that at them moment it's basically just unrealistic.

The tanks starts at 0 km/h but upon pressing w/Arrow up key it goes straight to 10 km/h, as you can imagine with any vehicle that's just unrealistic to do.

I want to know how to make that speed up happen without it being too bulky or confusing. I'm a beginner programmer so I'm not too informed in the world of programming. Can somebody help me with this?

I figured it would have to do with an acceleration command but I have no idea how to do that either.

sentences:
How to calculate all points in a 2D grid defined by an arc, given a starting point and range I've an unit in a 2d (integer) grid-based game, which has a bearing. Now I want to display an arc, with a given radius (for instance simulating a 90 degree cone of a sensor with respect to the bearing of the unit, attaching this sensor).

How can I efficently get all points in the 2d grid to draw that 'cone' arc ?

This question actually is about a similar issue but in contrast I want to get all points and not only check if a given point is located in that sector.

sentences:
What is actually moving in an endless runner? For example the famous Flappy Bird game, or anything that sort really,
is the player(in this case the bird, or the camera whichever you prefer) moving forward or is the whole world moving backwards(the bird only changes Y position and has a constant X position)?

sentences:
Is Spine's XNA runtime missing an importer? I'm writing an XNA 4.0 game and use Spine for animation. Until now, I've been making spritesheets with Spine and using them with a custom animation class. I recently discovered there is an official Spine runtime for XNA. I've been trying to use it but encounter an error.

The closest I've come (after adding the runtime's classes to my project) is this error:

  Cannot autodetect which importer to use for "data\goblins.atlas". There are no importers which handle this file type. Specify the importer that handles this file type in your project.

Is there such an importer in the runtime and I simply missed it? If so, how can I get XNA to recognize it? If not, is there an alternative?

sentences:
AddFontMemResourceEx and D3DXCreateFont corruption I'm trying to load a font from a buffer using AddFontMemResourceEx and then creating a D3D font with D3DXCreateFont. This works fine on every platform except Windows XP, where it causes the wrong glyphs to be rendered.

Here's the relevant code (modified slightly for brevity):

char* fontName = "FontName";

HANDLE hFont = AddFontMemResourceEx(data, size, 0, &loaded);

if(!hFont || !loaded) {
    //error handling
}

HRESULT res = D3DXCreateFont(device, 30, 0, FW_NORMAL, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
    ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, fontName, &font);

if(res != S_OK) {
    //error handling
}

...some code later...
//DrawTextA/W, makes no difference to the result
font->DrawTextW(NULL, message, -1, &rect, DT_LEFT | DT_NOCLIP, colour);

Here's an example render:

Interestingly, if I make a small change to the code to save the font to disk and then reload it with another API function, everything works fine:

char* fontName= "FontName";
char* fileName = "FontName.otf";

FILE* file = fopen(fileName, "w+b");
fwrite(data, size, 1, file);
fclose(file);

//non-ex version works fine too
AddFontResourceEx(fileName, FR_PRIVATE, 0);

HRESULT res = D3DXCreateFont(device, 30, 0, FW_NORMAL, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
    ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, fontName, &font);

if(res != S_OK) {
    //error handling
}

...some code later...
//DrawTextA/W, makes no difference to the result
font->DrawTextW(NULL, message, -1, &rect, DT_LEFT | DT_NOCLIP, colour);

One caveat is that if the FR_NOT_ENUM flag is specified, even loading from file will result in the same problem. According to the documentation, this flag is implicitly set when using AddFontMemResourceEx.

  A font that is added by AddFontMemResourceEx is always private to the process that made the call and is not enumerable.

It seems this is possibly a bug in XP's API or just poor documentation that's leading to misuse (that happens to work on newer platforms).

Is there something I've missed?

sentences:
Should I store local forward/right/up vector or calculate when necessary? I'm working on an object picking and translation/rotation/scale gizmos system in my engine where you select objects and perform transformations on them in a 3d editor-like fashion (e.g. Blender)

In my transform struct, I'm storing the position, rotation angle, rotation axis and a uniform scale value. When transforming my objects, I build the TRS matrix which forms my ModelToWorld matrix. All good.

Now I want to add the notion of local vs world translation. i.e. you select an object, and you can either move it along its local x axis, or the global x axis.

The global movement is easy I just add directly to my position vector. But for the local one, I have to build a local forward/right/up vector. e.g.

v3 GlobalUp = V3(0, 1, 0);
v3 LocalUp = m4_Rotate(Rotation->Angle, Rotation->Axis) * GlobalUp;

And then I translate my position by that amount:

Selection->Transform.Position += LocalUp;

I'm kind of torn whether I should store these local up/forward/right vectors in my transform (which means I have to calculate them once every frame in my update function, but every use of them after that point needs no calculation) or only when needed (no need to calculate every frame, but I have to call a function to do the calculation every time I need one, I could still keep the value in a local variable in my usage area if I'm using it more than once)

I'm not sure what approach to go with but I'm leaning towards calculating them as needed.

Are there any other pros/cons to each approach? or is this one of those things where there's no 'absolute right' way to do it?

Any advice is appreciated!

sentences:
Has anyone got the Krypton Lighting Engine working in MonoGame for Windows 8? I've converted the core of the Krypton Lighting Engine so that it's compatible with Windows 8.

The trouble I'm having when actually using it is that it can't load the KryptonEffect.xnb file.  I'm aware that MonoGame doesn't have XNA content processors, so I'm compiling the KryptonEffect.fx file in an XNA Content project.

When I try to load the Effect, I get an exception saying The MGFX file is corrupt in the ReadEffect method in MonoGame.  The header should be MGFX but it's a seemingly random byte array.

I then came across this page that says to use a tool named 2MGFX.  I tried this, but the tool reports: The effect must contain at least one technique and pass.  From what I can see from KryptonEffect.fx the file, it does.

Has anyone got the Krypton Lighting Engine working on MonoGame for Windows 8? Or has anyone been able to load any kind of Effect file under Windows 8?

sentences:
suggestion for a “strategy game” like platform to test AI algorithm I wrote a piece of tricky AI algorithms that simulates animals living in an environment and their food seeking, interacting with each other and especially learning new patterns of lifestyle.

now I want to add some graphics to it. so instead of a form with colored dots I would see a 3d environment with different objects moving on it, just like an strategy game.

my code is in VB.net and it uses lots of advanced oop techniques and dynamic nested classes. so changing code to another platform like python, c++ or java is not and option for me. also I am not a trained graphic programmer so which graphic platform I get is what I use as graphic output. If I could only have source of a simple strategy game it would be enough for me.

also any link to opensource .Net strategy games or any source code that can hemlp me in this concept is appreciated.

sentences:
Multiple viewpoints in Unity3D? I'm working on a 3D game in Unity.  The primary view is a top-down view, but I am also looking to do target profiles that are true animated versions that reflect the actions of the target.  The easiest way to do this, as far as I can see, is to create a second camera, a set offset from my target, facing at it.  But how do I show the view from that camera in a small area of the screen?

A possibly related question - how to handle a mini-map?  I considered doing this the same way - with a camera fixed high above the character that would show the area around him, but there may be a better way to do this, I'm open to any suggestions.

sentences:
Initiated a animation in unity via use of an animator component I've written a coroutine that starts an animation.

GameObject.FindWithTag(names[number]).GetComponent<Animator>().StartPlayback();

This is the line of code that I wrote to  start the animation. However, the animation does not start. I've even replaced the GameObject.FindWithTag(String) method with a reference to the actual object by declaring a GameObject in the script and setting it to a particular object in Unity's IDE. The animation still didn't start. Also, I must say the GameObject does have an animator component, you can see it in the inspector panel. No error messages can be seen in the console during play  mode. What can I do to get the animation to play when I want it to play.

sentences:
Stereo 3D: drawing 2D elements at apparent screen depth I'm developing an application making use of DirectX11's stereoscopic features. At such I am not relying on nVidia's automatic implementation. That means I have to replicate a way to render 2d elements in clip space at an user-defined depth.

According to their 3d vision automatic best practices whitepaper, they suggest scaling the clip position by the chosen depth factor:

pClip *= depth/pClip.w

This works because the shader "footer" they add to the intercepted draw calls does:

pClip.x+= eye * separation * (pClip.w - convergence)

Where eye is the sign which alternates between left and right draw calls. This produces offsetted 2d renderings that when fused make 2d elements appear at the chosen apparent depth. Any .w greater than convergence appear beyond the screen and vice versa. I have replicated this functionality (for regular 3d drawing I am using two projection matrices) but since I need these elements to be rendered in orthographic mode I am not entirely sure if it is correct.

I am using a value of 1.25" as the interocular distance and 24" as the viewer distance (or convergence). If I plug those values in the equation above then it produces an offset that is too great to be fused. I have eyeballed a value of 0.015 that appears to produce correct positioning. So the equation becomes:

pClip.x+= +/-1 * .015 * (pClip.w - 24)

What is the correct math to use to calculate the correct offset in clip space so that two 2d ortho renderings result in a user chosen apparent screen depth?

sentences:
Weapon Class Organization Im making a game and i want to organise my weapons, and im having a few doubts on not only the best architecture but also on how to use it properly:

The First approach is to make a single Weapon class with a Type variable, and create every weapon, melee or ranged, in there. That way, even handeling collision would be "easy" (i have a collisionManager class where i handle all the collision (with pointers to collideable game elements), but thats also a problem, since weapons might have different ways to collide, lets say if im using a projectile weapon, like a pistol, i only need to check collision with its bullets, while a knife's is all about its range, so the Type variable would be very useful for that). The downside, i believe, is that:

1 - In the future, the class might get very big and maybe complex (i intend to add lasers, flamethrowers and rocket launchers so...)

2 - Every mob that posesses a "Weapon" object initialized would have data to use every weapon, when some enemies might just use one of them (lets say i have an enemy that just melee hits, which i might say its the knife), and althought i might be overreacting about the memory it wastes, it bothers me.

The second approach is the classic, yet quite attractive, hierarchical one, where i would create a class Weapon similar to this:

public abstract class zWeapon {

//weapon attack info
protected boolean attacking = false;
protected int damage;
protected long startTime;
protected long delay;
protected long elapsed;

public void attack(double X, double Y, double angleShoot)
{
    if(attacking) return;

    startTime = System.nanoTime();
    attacking = true;

    useWeapon();
}

protected abstract void useWeapon();

public void update()
{
    if(attacking)
    {
        elapsed = (System.nanoTime()-startTime) / 1000000;
        if(elapsed >= delay)
            attacking = false;
    }
}

protected abstract void draw();}

(forget about the "z" behind Weapon)

and then create extensions like MeleeWeapon, ProjectileWeapon, Laser etc

What confuses me, is how to properly use this. My only idea to use this. if a mob has a Weapon, and a certain mob only uses Knife, it makes sense that i say weapon = new Knife(); and the mob uses the knife as it should. But lets say, for example, the player. The Player can use every weapon, eventually. And i would probabily create an array of weapons with every weapon object initialized, and id change the weapon variable everytime i had to change weapon. The problems that come up to my mind are the following:

1 - If i use it like this, if i change weapon variable from, lets say, pistol to knife, the vector of bullets in pistol would stop being updated since im now updating a different weapon.

2 - The collision would be a harder work, i dont want to use instanceof to check which type of collision i should do with the weapon against my game elements...

So as you see i have alot of confusion going on in this Weapon Class architecture, would you ease my mind with a few solutions/hints/tips?

sentences: stretch images when window is re-sized in XNA Is there a way to re-size all the images inside the view port in a XNA project. At the moment when I re-size the view port the background stays at the same size of the image when I want it to re-size, this is the same for the different sprites.  I have looked at different sources and I have not been able to find anything that has helped.

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:
Modifying an array of quaternions I have written the following function to inter-change 2 specific elements of an array of quaternions:

private void ChangeRotations(Quaternion[] rotationsArray)
{
    Quaternion bone1Rot = rotationsArray [(int)Bone1ID];
    Quaternion bone2Rot = rotationsArray [(int)Bone2ID];

    Quaternion temp = bone1Rot;
    bone1Rot = bone2Rot;
    bone2Rot = temp;
}

But when I use Debug.Log to see if this has taken effect, I realize that the 2 array elements are unchanged.

What am I doing wrong here?

sentences:
iPhone point-and-click adventure game port structure I am porting an AGS game to iPhone, and was wondering what the best approach to the port would be?

How best would you structure your code and assets?

More specifically, how would you deal with say 100+ scenes. My initial approach is to create a scene superclass with things common between all scenes, like backgrounds, music, doors, windows, characters. Then for each scene an inherited version of that superclass with more particular things like checks, dependencies etc. Upon entering the scene, you'd check for dependencies and go from there. This is all off the top of my head mind you, so probably forgetting quite a bit.

sentences:
Why am I hitting a small character limit when rendering with SDL_TTF? I'm making a text based game using SDL2 and SDL_TTF. I just started working with TTF, and I've noticed there is some kind of character limit regarding how much text you can render at a time! I can only render about 15 characters, after that, (16 characters or higher) the screen is just blank.

I really want to render large bodies of text (multiple sentences at a time) so how do I overcome this issue? For rendering text, I have this function:

void drawDialog(const char* content) {
    //Draws a dialog box with set text

    TTF_Font* font = TTF_OpenFont("assets/times.ttf", 900);
    SDL_Color textColor = { 255, 255, 255 };
    SDL_Surface* message = TTF_RenderText_Solid(font, content, textColor);
    SDL_Texture* tex;

    SDL_Rect destRect;

    destRect.x = 50;
    destRect.y = 730;

    destRect.w = 200;
    destRect.h = 30;

    tex = SDL_CreateTextureFromSurface(renderer, message);
    SDL_FreeSurface(message);
    SDL_RenderCopy(renderer, tex, NULL, &destRect);
    SDL_RenderPresent(renderer);
}

So, any advice for overcoming this limit? Any help would be greatly appreciated!

sentences:
MissingComponentException when using Animator I followed some tutorials to add WASD movement to a character; I managed to set up the animator thing and it works in the bottom right corner viewport.

Next I tried adding the following C# script with basic movements:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AppleInput : MonoBehaviour
{
    private Animator animator;
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        animator.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
        animator.SetFloat("Vertical", Input.GetAxis("Vertical"));
    }
}

Configured like so:

But then I get the error message:

MissingComponentException: There is no 'Animator' attached to the "action10Prob_normalsDONEyet" game object, but a script is trying to access it.
You probably need to add a Animator to the game object "action10Prob_normalsDONEyet". Or your script needs to check if the component is attached before using it.

How do I solve this error?

sentences: How are "game rules" considered as data, in data-driven engines? I've read the definition of a data-driven game engine, in several places, and one item usually mentioned is the game rules: separating them from the logic of the engine. What is meant by a "game rule"? How could it be considered data?

sentences:
Pitch (X-axis) rotation problem Situation:
From a first person perspective (camera position) I want to be able to grab an object and have it fixed to the center center of the screen while looking up-down (pitch) and looking left-right (yaw). The yaw works fine. The pitch only works facing the object head on when camera position z > object z. Turning 180 degrees the pitch rotation is opposite. How do I compensate for this. This is what have:

double yawRadians = Math.toRadians(yaw - oldYaw);
double pitchRadians = Math.toRadians(pitch - oldPitch);

//center position of object, minus camera position
double x = grabbedObject.x0 - position.x;
double y = grabbedObject.y0 - position.y;
double z = grabbedObject.z0 - position.z;

double sinX = Math.sin(pitchRadians);
double cosX = Math.cos(pitchRadians);

double sinY = Math.sin(yawRadians);
double cosY = Math.cos(yawRadians);

double sinXY = sinX * y;
double cosXZ = cosX * z;

double newX = cosY * x + sinY * sinXY - sinY * cosXZ;
double newY = cosX * y + sinX * z;
double newZ = sinY * x + cosY * -sinXY + cosY * cosXZ;

grabbedObject.addTranslation(newX - x, newY - y, newZ - z);

sentences:
Render hands and gun in front of everything I'm currently learning about Unreal Engine 4 by making an FPS game.
How can I render the player character's hands and gun on top of everything?
Currently when I walk up to a wall, the hands and gun can clip into the wall like this:

I want it to look like this, where even when the player is facing into a wall, the hands and gun stay on top:

How can I achieve this?
Update:
Found this solution:

Render the meshes at the end of the depth-only prepass with depth testing disabled and tagging those pixels in the stencil buffer. Then enable stencil test in the base pass to not touch those pixels. At the end of the base pass you turn off stencil test and render your foreground meshes with depth testing enabled to get their properties in the gbuffer."

sentences:
Using a vector to measure an angle relative to the screen / camera My game is supposed to have an object that changes it sprite depending on which way the mouse faces. programming this has become a challenge, because I want to calculate the angle relative to the center of the screen using the X axis.

To explain what I mean, pretend that under a sprite in the center of a screen is a protractor.

I want to measure the angle that's formed between the cursor and the center. If I use the X axis as a base, I should get an angle between 180° and -180°.

How would I achieve this? I've tried vector.angle(reference-vector), but that doesn't seem to give the desired result.

sentences:
How to create tilted (height) isometric tiles This is perhaps best explained pictorially. I am trying to create a 2.5D isometric game. My vision is for the game to look something like my goal:

I am not a graphics artist, so I'm having some trouble creating the "tilted" tiles to simulate terrain of different height. Creating the basic isometric tile was easy using the following steps:

Create a 64x64 square version of the tile
Rotate by 45 degrees
Scale the height down by a factor of 2

Creating the "tilted" tiles is more of a challenge. At my disposal I have Photoshop, but I am far from an expert at using it. Here is my current problem:

I am not sure how I can manipulate vertices, otherwise this would be easy, but basically, to get a "tilted" tile from my basic isometric tile, all I need to do is to shift the bottom and the right vertex down by 16 pixels, while fixing the other two vertices. This would generate the tile I want.

What is an easy way to accomplish this. Is Photoshop the right tool for this? Any suggestions?

sentences:
Respawn not working properly upon scene reload. Why is this? So I made a respawn function and what is supposed to happen is the script it supposed to load a saved checkpoint. However I need to reset the scene (and again this worked just fine last night which was odd...).

Essentially the checkpoint waits for a player and then when the player enters the current checkpoint is written to a .txt file. Upon reload or death the scene is restarted, the .txt file is read and grabs the checkpoint. Everything works fine without Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); //Reload scene. but I need that in order to "refresh" the scene.

CheckPoint Code:

using UnityEngine;
using System.Collections;

public class Checkpoint : MonoBehaviour {

    public LevelManager levelManager; //Empty level manager.

    // Use this for initialization
    void Start()
    {
       //levelManager = FindObjectOfType<LevelManager>(); //Unnneeded
    }

    void OnTriggerEnter(Collider coll)
    {
        if (coll.tag == "Player")
        {
            //levelManager.currentCheckPoint = gameObject; //<-DISABLE WHEN ES2 is fixed!!!
            Debug.Log("Activated Checkpoint " + transform.position);
            ES2.Save(gameObject.name, "myFile.txt?tag=checkpoint"); //Saves checkpoint to file.
        }
    }
}

LevelManger Code:

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

    public class LevelManager : MonoBehaviour {

        [Tooltip("Note this will also serve as the spawnpoint for the player!")]
        public GameObject currentCheckPoint;
        private GameObject player;
        private int PHP;
        public int RespawnHP; //Amount of health to give player upon respawn.

        void Awake ()
        {

        }

        // Use this for initialization
        void Start ()
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }

        // Update is called once per frame
        void Update ()
        {
            PHP = GameObject.Find("InventoryManager").GetComponent<InventoryManager>().PlayerHealth;

            if (PHP <= 0)
            {
                Debug.Log("Player HP has been depleted. Respawning.");
                RespawnPlayer();
            }

            if (Input.GetKeyDown("r"))
            {
                Debug.Log("Restarting level!");
                RespawnPlayer();
            }
        }

        public void RespawnPlayer()
        {
            Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); //Reload scene.
            currentCheckPoint = GameObject.Find(ES2.Load<string>("myFile.txt?tag=checkpoint")); //Load saved checkpoint.
            Debug.Log("Player Respawning...");
            player.transform.position = currentCheckPoint.transform.position;
            GameObject.Find("InventoryManager").GetComponent<InventoryManager>().PlayerHealth = RespawnHP;
        }

        void RestartLevel()
        {
            //ToDo: Restart level, and reload last check point.

        }

        public static void SaveLevel() //Saves the current level to file.
        {
            //ES2.Save(SceneManager.GetActiveScene().name, "myFile.txt?tag=levelName"); //Saves level to file.
            //ES2.Save("none", "myFile.txt?tag=checkpoint"); //Overwrite checkpoint?
        }
    }

Does anyone have a clue what is wrong? Like I said earlier the problem seems to arise on scene reloading.

Response to comment(s):

  What behaviour are you observing at the moment? - Jack

Currently what happens is the player enters a checkpoint, the checkpoint is saved to a file, and upon respawn the checkpoint is loaded. After this I get spawned to the checkpoint that was saved but then immediately the level reloads itself and the player is not respawnd at the checkpoint. Here is a video to better demonstrate the issue (it will take a minute or two to finish up processing here as I've just pasted the link).

sentences:
How can I programmatically add a Controller to an Animator during runtime? I am trying to set the Controller of an Animator during runtime using a script.
When I click on the dot in the inspector manually, I can choose one called "Standard Walk", but have not found a way to automate it.

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:
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:
XNA Framework doesn't recognise controller So just a little bit of XNA code:

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

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

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

sentences:
Rotating a camera 90 degrees around an object in Unity3D I've attached this script to the camera and am using it to rotate the camera around an object. It's currently rotating freely but I'd like it rotate 90 degrees smoothly, over 60 frames, when the button is pressed. So that four presses of the left arrow key would have the have the camera rotate the full 360 degrees over 240 frames and back to it's starting position. I can't seem to figure out how to do this. Any help would be appreciated.

public GameObject targetObject;
public float rDistance = 1.0f;
public float rSpeed = 1.0f;;

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

    // Trigger functions if Rotate is requested
    if (Input.GetKey(KeyCode.LeftArrow)) {
        RotateLeft(true);
    } else if (Input.GetKey(KeyCode.RightArrow)) {
        RotateLeft(false);
    }

}

protected void RotateLeft(bool goLeft)
{

    float step = rSpeed * Time.deltaTime;
    float orbitCircumfrance = 2F * rDistance * Mathf.PI;
    float distanceDegrees = (rSpeed / orbitCircumfrance) * 360;
    float distanceRadians = (rSpeed / orbitCircumfrance) * 2 * Mathf.PI;

    if (goLeft) {
        transform.RotateAround(targetObject.transform.position, Vector3.up, -distanceRadians);
    } else {
        transform.RotateAround(targetObject.transform.position, Vector3.up, distanceRadians);
    }

}

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:
How do I letterbox a C#/Monogame viewport within a resizeable window? I am making a 2d game with xna/monogame. I want the main view area to always show 15x15 tiles, or 480x480px.

I've got something that sort of works, following this guide. It expands the view range if you make the window smaller. However, it works somewhat properly if you expand it. It works as intended if the window is maximized.

I want the range of what is rendered to be no larger than 480px x 480px regardless of the the window's size, but I'd like the sprites to appear bigger if the window resolution is set larger (and conversely).

sentences:
How does an AI determine the bearing to follow within a nav mesh? I've done some reading on nav-meshes, and I understand how to generate a path of polygons to reach a goal. However, what I don't understand is how you determine the bearing to follow within each polygon. Without a central node to aim for, what do you aim for? I suppose you could cast a ray to the goal and then head to the point where that ray crosses into the next cell - but that would only work if that next cell is actually on your path. If your ray doesn't cross the edge into the next cell, do you instead plot a path to whichever corner of the edge is closest to the goal? I think that would get you the path shown in the 3rd diagram, but would it work in all cases?

http://udn.epicgames.com/Three/NavigationMeshReference.html

sentences:
Pathfinding towards a moving target in 2D Platformer I have an enemy in my 2D platformer that chases the player around the level.

I implemented a modified version of A* that works with gravity as described here: https://gamedevelopment.tutsplus.com/tutorials/how-to-adapt-a-pathfinding-to-a-2d-grid-based-platformer-theory--cms-24662

But for a moving target I would have to calculate a new path whenever the target moves. Of course I'm going to run the pathfinding on a separate thread and only once a second or something like that, but it's still a waste to calculate the path from scratch.

So I found this algorithm for transforming the old path to the new path with the new start and target position called FRA* http://idm-lab.org/bib/abstracts/papers/ijcai09b.pdf

However the platformer version of A* has a kind of 3D grid where nodes with different jump values in the same 2D location has a different z-coordinate.

Is it possible to use FRA* when jump values comes into play? Do I have to recalculate jump values?

sentences:
How to implement this kind of ripples with a GLSL fragment shader? So I have already implemented the reflection part:

uniform sampler2D texture;
uniform vec2 resolution;
uniform vec3 overlayColor;

void main()
{
vec2 uv = gl_FragCoord.xy / resolution.xy;

if (uv.y > 0.3)// is air - no reflection or effect
{
    gl_FragColor = texture2D(texture, vec2(uv.x, uv.y));
}
else
{
    // Compute the mirror effect.
    vec4 color = texture2D(texture, vec2(uv.x, 0.6 - uv.y));
    //
    vec4 finalColor = vec4(mix(color.rgb, overlayColor, 0.25), 1.0);
    gl_FragColor = finalColor;
}
}

source

Now the question is how are these ripples implemented?

sentences:
How can I handle mouse input and cursor in a WinAPI window? Hello I'm studying game engine programming, but I got stuck with mouse input.

As for now I have only WinAPI window, which has a message pump and processing. For the mouse I used RAWINPUT, but there is a problem: I can't find any elegant way of handling the mouse cursor, for example making a menu in a shooter.

Raw input provides relative movement data directly from mouse driver, but how can I control the cursor with it? Or maybe I should make 2 message processing queues with filters on the mouse? I haven't found any real solutions in my searching yet.

sentences:
Average points per second in a world editing game I am making an online single-player game (open beta here) with a huge emphasis on content creation and world design (sort of like Super Mario Maker or Little Big Planet but more designed for adventure or "short story" games).  The default gameplay style is a sort of Zelda-esque action RPG but it can also handle things like platformers or arcade-style shooters.  "Worlds" can vary greatly in scope, from a single short hallway to basically a full game.

In order to tie all of these diverse worlds together and make travel between them meaningful, I am using a universal currency (called Sparks) that world builders can use as collectibles and give as rewards for defeating enemies or completing challenges, and can also be used to purchase items and so on.  To prevent their abuse and discourage boring "spark farming" worlds, the amount of sparks a player can take from a world is capped based on the amount of time they spent in that world, and the world builder is rewarded for another player exploring their world based on how close the player gets to obtaining a certain percentage of that cap, encouraging them to make it easy to obtain around that amount, and possible for a skilled player to acquire more (making it worthwhile for players to replay their world in order to master it) but not exceeding the cap.

Right now, the cap is one spark per second, and the "ideal average ratio" is one fifth of that.  However, one point every five seconds seems far too low and unrewarding for most kinds of games, especially fast-paced arcade-style worlds where it is not uncommon to beat more than one basic enemy or pick up multiple collectibles per second.  However, setting the cap too high can make spark collection feel meaningless since their total value just looks like "a big number".

I have done some searching for advice or writing on typical scoring rates for different game genres or even the psychological impact of using different scoring methods.  I know that some old arcade games would add a few zeros to their score system to make things feel more rewarding but beyond that I could find very little writing on the subject.  What is a typical "points per second" value that feels rewarding and can work for a large number of possible genres?

sentences:
Light bounding geometry for deferred rendering What is the best bounding geometry to use in a deferred renderer for each one of the following light types?

Sphere area light (obviously a sphere)
Disk area light (obviously a cone)
Rectangular area light (a frustum?)
Tube area light (a frustum as well?)

And how can I create those geometries? For the sphere and the disk it's quite simple given the attenuation radius and the attenuation angle, but for the other ones?

sentences:
Creating Complex Collision Shapes in GMS2 I'm pretty new to Game Maker Studio 2 and I've hit a wall in programming with their built-in physics engine. I created a irregularly shaped object and I want to modify the collision shape so that it fits the shape of the sprite. In the built in collision shape editor it only allows you to create a convex shape with a max of 8 points. Is there another way to do this without having to plot out points individually in code?

Thanks!

sentences:
Unity3D playing sound when Player collides with an object with a specific tag I using Unity 2019.2.14f1 to create a simple 3D game.

In that game, I want to play a sound anytime my Player collides with a gameObject with a specific tag.

The MainCamera has an Audio Listener and I am using Cinemachine Free Look, that is following my avatar, inside the ThridPersonController (I am using the one that comes on Standard Assets - but I have hidden Ethan and added my own character/avatar).

The gameObject with the tag that I want to destroy have an Audio Source:

In order to make the sound playing on the collision, I started by creating an empty gameObject to serve as the AudioManager, and added a new component (C# script) to it:

using UnityEngine.Audio;
using System;
using UnityEngine;

public class AudioManager : MonoBehaviour
{

    public Sound[] sounds;

    // Start is called before the first frame update
    void Awake()
    {
        foreach (Sound s in sounds)
        {
            s.source = gameObject.AddComponent<AudioSource>();
            s.source.clip = s.clip;

            s.source.volume = s.volume;
            s.source.pitch = s.pitch;
        }
    }

    // Update is called once per frame
    public void Play (string name)
    {
        Sound s = Array.Find(sounds, sound => sound.name == name);
        s.source.Play();
    }
}

And created the script Sound.cs:

using UnityEngine.Audio;
using UnityEngine;

[System.Serializable]
public class Sound
{
    public string name;

    public AudioClip clip;

    [Range(0f, 1f)]
    public float volume;
    [Range(.1f, 3f)]
    public float pitch;

    [HideInInspector]
    public AudioSource source;
}

After that, in the Unity UI, I went to the Inspector in the gameObject AudioManager, and added a new element in the script that I named: CatchingPresent.

On the Third Person Character script, in order to destroy a gameObject (with a specific tag) when colliding with it, I have added the following:

void OnCollisionEnter(Collision other)
        {
            if (other.gameObject.CompareTag("Present"))
            {
                Destroy(other.gameObject);
                count = count - 1;
                SetCountText();

            }
        }

It is working properly as that specific object is disappearing on collision. Now, in order to play the sound "CatchingPresent" anytime the Player collides with the object with the tag, in this case, Present, I have tried adding the following to the if in the OnCollisionEnter:

FindObjectOfType<AudioManager>().Play("CatchingPresent");

But I get the error:

  The type or namespace name 'AudioManager' could not be found (are you
  missing a using directive or an assembly reference?)

AudioManager.instance.Play("CatchingPresent");

But I get the error:

  The name 'AudioManager' does not exist in the current context

As all the compiler errors need to be fixed before entering the Playmode, any guidance on how to make the sound playing after a collision between the player and the gameObject with the tag Present is appreciated.

sentences:
How do I increase the spawn rate of an object as the "difficulty" goes on? I just want my objects to spawn in a faster rate as time goes by. The print(SpawningInBetween); print out shows the percentage of the difficulty overtime.
This is the code I have:
public Vector2 spawnsMinMax;

//Spawn Positions
Vector2 SpawnPosition;
float secondsBetweenSpawn = 1;
float nextSpawnTime;

void Update()
{
    if (Time.time > nextSpawnTime)
    {
        float SpawningInBetween = Mathf.Lerp(
            spawnsMinMax.y,
            spawnsMinMax.x,
            Difficulty.GetDifficultyPercent());
        print(SpawningInBetween);
        nextSpawnTime = Time.time + SpawningInBetween;

        nextSpawnTime = Time.time + secondsBetweenSpawn;
    }

    // ...

I was thinking of going like this:
if(Time.time > Difficulty.GetDifficultyPercent < 0.9)

but it got a compiler error.

sentences:
Best strategy on VAO and texture coordinates for voxel rendering? I'm working on a game that has to render a large amount of cubes (voxels) with OpenGL. All cubes have the same geometry (so I can re-use the vertex position VBO) and a single sprite sheet texture is used for all of them. This means the texture coordinates will have to vary for the cubes, depending on which sprite to use. All six sides of a cube will use the same sprite (in other words, the same texture coordinates).

Now, what is the best strategy to approach this with a modern OpenGL renderer?

I came up with two possibilities:

Create as many VAOs as there are cube sprites in the sprite sheet. Bind the same vertex position VBO to all of them, but a different texture coordinate VBO (according to what sprite / part of the texture to show). In my specific case, this would make for about 600 different texture coordinate VBOs and therefore 600 VAOs.
Create only one VAO. Set up the texture coordinate VBO in a generic way (e.g. 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0). In the rendering loop, send the actual texture coordinates (only 4 values) as uniform variable to the shaders. In the shader, the generic texture coordinates can be used to figure out which two of the four values from the uniform should be used.

Are there other possibilities that I'm missing? What is best regarding performance?

sentences:
How can I move an object the fastest way? How can I move an object the fastest way?
What I'm trying to do is to make an object pass by at speed that you almost cannot see - like an airplane that moves from side to side in very high speed.
Here is my code:
transform.position = Vector3.MoveTowards(transform.position,
            stopPoint, Time.deltaTime * ms);

sentences:
Texture2D.SetData Method Overload Been reading up on various methods in the XNA framework, and found this one.

I've done some Google searching, but I can't seem to find any information on how to use this particular method overload. Parameters 3-5 are easy enough to understand, since they are used in another overload, but I'm not so sure about the first two.

I'm fairly sure that the first parameter is the mipmap level we are setting data to, but the second one has me completely lost.

However, I'm not exactly sure what I should be passing in here. I know it can be a null object, or a valid Rectangle object, but I'm not sure whether it is being used to specify the size of the mipmap texture like this:

Or whether it is supposed to be its position and size inside the Texture2D object like this:

Can someone shed some light on this please, and maybe provide a parameter sample or two so I can better understand? (I'm one of those people that can spend 2 hours trying to understand a theory and make absolutely no progress, and get it in about 5 minutes after a few examples [or half dozen for more complex stuff])

sentences:
How does Color.Lerp works? I want to understand how does Color.Lerp works in unity.
According to this page it is quite clear to understand how to use it but I'm interested in how it is implemented. Does it work on RGB channels? and how? In the docs it says that the t factor is clamped between 0 and 1 so i wonder to know on which values Lerp works with Color.

sentences: Can someone explain radiosity lighting to me? I already have the basics of ambient occlusion down.  I have a raycaster and am capable of shooting rays about a hemisphere uniformly.  It seems like those are the basics of what are needed for radiosity but I don't know where to go from there.  Do I find how much light comes from each face?  (I'm making my game out of cubes like minecraft)  After that what do I do?

sentences:
Why glDrawElements draws nothing? I tried to implement indexed draw, but when I call I got nothing on screen. Even more strange that I wasn't get any error when call it and buffer variables packed right.

There my constructor:

Mesh::Mesh(Shader &shader, std::vector<GLuint>* indices, std::vector<VertexData>* vertices) {
shaderProgram = &shader;
_meshLenght = (GLsizei) indices->size();
_indices = indices;

glGenBuffers(1, &_ebo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ebo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices->size(), indices, GL_STATIC_DRAW);

//create one here
glGenVertexArrays(1, &_vao);
glBindVertexArray(_vao);

std::vector<glm::vec3> positions {};
std::vector<glm::vec3> normals {};
std::vector<glm::vec2> texture {};

for (size_t i = 0; i < vertices->size(); ++i) {
    positions.push_back(vertices->at(i).positions);
    normals.push_back(vertices->at(i).normals);
    texture.push_back(vertices->at(i).texCoords);
}

glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec3)*(positions.size()+normals.size()), nullptr, GL_DYNAMIC_DRAW);

glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(glm::vec3)*positions.size(), positions.data());
glBufferSubData(GL_ARRAY_BUFFER, sizeof(glm::vec3)*positions.size(), sizeof(glm::vec3)*normals.size(), normals.data());

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<const void*>((sizeof(glm::vec3) * positions.size())));

glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}

And there my draw code:

void Mesh::Draw() {
glBindVertexArray(_vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ebo);
if (_ebo==0)
    glDrawArrays(GL_TRIANGLES, 0, _meshLenght);
else {
    glDrawElements(GL_TRIANGLES, _meshLenght, GL_UNSIGNED_INT, nullptr);
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}

Also show my vertices info screenshot:

And if you need have apitrace trace file:
https://drive.google.com/file/d/0B-dWIpzqq91mQXVIeHhTOHFhRkU/view?usp=sharing

sentences: All sides shadow outline in Unity NGUI How can I make such exactly the same shadow using NGUI?

sentences:
How to update vertices and indices in OpenGL I want to change and update the vertices and indices of the 3D object.
I am new to openGL and I do not know if this the right place to ask this question.
I searched and read about that, and I found that I should bind the VAO and VBO and make that, but nothing changed in vertices and indices.
The vertices vector class type has the position, normal and uv coords and the vertices vector class type is int. I wonder how I can make changes to these two vectors when I translate or scale the model.
here is the code:
// Create buffers/arrays
glGenVertexArrays(1, &this->VAO);
glGenBuffers(1, &this->VBO);
glGenBuffers(1, &this->EBO);

glBindVertexArray(this->VAO);
// Load data into vertex buffers
glBindBuffer(GL_ARRAY_BUFFER, this->VBO);
// A great thing about structs is that their memory layout is sequential for all its items.
// The effect is that we can simply pass a pointer to the struct and it translates perfectly to a glm::vec3/2 array which
// again translates to 3/2 floats which translates to a byte array.
glBufferData(GL_ARRAY_BUFFER,this->vertices.size() * sizeof(vertex), &this->vertices[0], GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, this->indices.size() * sizeof(int), &this->indices[0], GL_STATIC_DRAW);

// Set the vertex attribute pointers
// Vertex Positions
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)0);
// Vertex Normals
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)offsetof(vertex, normal));
// Vertex Texture Coords
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)offsetof(vertex, uv));

glBindVertexArray(0);

sentences:
Going from a solo game project to a team project, how should I organize the new team and potential revenues? I have been working on a game partial time for 2 years now, I've done the code and assets myself, but eventually I understood that I would not be able to have nice looking assets without spending a lot of time into it. And that greeting a new team member with graphic designer skills on this project would be a good idea.

My project is purely casual ATM. While I would love to earn a bit of money from it, my main goal is to have something fun to play with my friends (it's a couch console game) and I'm not sure what I want for the release of the game.

Now that I'm about to greet a graphic designer in the game project I'm excited but I want to do things right.

What should I define prior welcoming a second member in the team to make things work regarding the organization of the new team and the potential earnings?

What if things goes wrong and we split, when I have worked 900h on the game and him 20?

Any other tips from your experience regarding this aspect of welcoming a new teammate?

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:
How can I economically check if a UI DropDown is open or closed? I've recently come across a problem with the UI DropDown component. I would like to resize other UI components depending on whether the dropdown is opened or closed. Unfortunately, the dropdown dynamically creates and destroys its own "Dropdown List" component, making it difficult to check whether it is open or not, without having to check with Update or FixedUpdate (both being expensive on the performance).

I have tried to implement a solution with event handlers, but it seems as if the even handler triggers before the "Dropdown List" is created. Thus this does not work.

Am I simply missing an easy way to check whether the dropdown is open or closed?

sentences:
Circle-Circle collision resolution This seems easy but I can't figure it out, when I have one circle(c1) collide with another(c2) I give the c2 circle the heading of c1 and send the c1 circle on the normal vector to the heading (the heading is stored as vector = (cos(theta), sin(theta)) this is probably a bad solution). So this works great when c1 is colliding head-on with c2, however if c1 collides with it's tail into c2 then c2 takes the direction that c1 is facing which causes them to intersect each other. Any ideas of how I can "re-word" the heading vector so it's not dependent on theta (the angle that c1 is looking at in the cartesian plane)?

Here is an example:
Elastic Collision

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:
implementing daily challenges in games I want to know how can I define daily monthly challenges in my game? Is this something can be defined locally or its need server and external services? And which servers and technologies can implements that? Is persistent connection or … needed as server should send messages to clients with no request?

Specifically, I use unity.

sentences:
How to determine an irregular area of a CCSprite? In my simple game I use boundingBox for pick coins and other stuff, but I need use irregular area detection of Sprite(with out Alpha)... There is alternative to boundingBox?
Here is code:

-(void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event {
CGPoint location = [touch locationInView:[touch view]];
CGPoint point = [[CCDirector sharedDirector] convertToGL:location];
curentPosition = point;
arrToDel = [[NSMutableArray alloc] initWithCapacity:0];

CCSprite *coin = nil;

for (Coins *coins in self.bugs) {
    if (CGRectContainsPoint([coins boundingBox], curentPosition)) {
        coin = coins; // found sprite
    }
}

if (coin != nil) {
    NSMutableArray *checkList = [NSMutableArray arrayWithCapacity:0];

    for (Coins *coins in self.bugs) {
        if (CGRectIntersectsRect([coin boundingBoxInPixels], [coins boundingBox]) && coins != coin) {
            [checkList addObject:coins];
        }
    }

    int max = coin.zOrder;

    for (Coins *b in checkList) {
        if (b.zOrder > max)
            max = b.zOrder;
    }

    if (max == coin.zOrder) {

        [self removeChild:coin cleanup:YES];

        [arrToDel addObject:coin];

        for (Coins *coins in  arrToDel) {

            [self.bugs removeObject:coin];

        }
    }
}

}

sentences:
Build SDL_Surface before blitting it I have a function in which I'm looping y and x over my array of sprites. That's a lot of loops, and it is very slow; I'd like to improve the performance.

I would like to only have to build the surface once, calling a buildMap method at the start, and referencing the resulting surface each time I need to blit it without having to loop to find the correct sprite and position.

int aff_map(t_exe *exe)
{
    int         sprite_idx;
    int         y, x;
    SDL_Rect    srcrect, dstrect;

    dstrect.y = 0;
    srcrect.y = 0;
    srcrect.w = TILE;
    srcrect.h = TILE;

    for (y = 0; y < HEIGHT; y++)
    {
        dstrect.x = MARGE_X;

        for (x = 0; x < WIDTH; x++)
        {
            for (sprite_idx= 0; sprite_idx< NB_TILES; sprite_idx++)
            {
                if (exe->map[y][x] == g_assoc_map[sprite_idx].key)
                      srcrect.x = g_assoc_map[sprite_idx].idx * TILE;
                if (SDL_BlitSurface(exe->sprite, &srcrect, exe->screen, &dstrect)
                        < 0)
                    return (err_sdl(SDL_GetError()));
            }

            dstrect.x += TILE;
        }

      dstrect.y += TILE;
    }

  return (EXIT_SUCCESS);
}

Is it possible to build an SDL_Surface before blitting it?

sentences:
Directx11 create Texture2D using subresourceData I'm trying to create immutable texture in d3d11 so I want to use subresourceData, every tutorial on textures creates them with 2nd argument being null and after that updates subresource but I want to create it using the 2nd argument.
This code works:

hResult = m_device->CreateTexture2D(&textureDesc, NULL, &m_cubeTexture);
if (FAILED(hResult)) {
    return false;
}

int rowPitch = textureWidth * 4;
m_deviceContext->UpdateSubresource(m_cubeTexture, 0, NULL, &(decodedTexture[0]), rowPitch, rowPitch * textureHeight);

And this does not:

int rowPitch = textureWidth * 4;
D3D11_SUBRESOURCE_DATA tSData;
tSData.pSysMem = &(decodedTexture[0]);
tSData.SysMemPitch = rowPitch;
tSData.SysMemSlicePitch = rowPitch * textureHeight;

hResult = m_device->CreateTexture2D(&textureDesc, &tSData, &m_cubeTexture);
if (FAILED(hResult)) {
    return false;
}

DirectX11 debug layer outputs this:

D3D11 ERROR: ID3D11Device::CreateTexture2D: pInitialData[3].SysMemPitch cannot be 0 [ STATE_CREATION ERROR #100: CREATETEXTURE2D_INVALIDINITIALDATA]
D3D11 ERROR: ID3D11Device::CreateTexture2D: pInitialData[5].pSysMem cannot be NULL. [ STATE_CREATION ERROR #100: CREATETEXTURE2D_INVALIDINITIALDATA]

Which I don't understand since it's not even an array and texture array size is set to 1

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:
Material is flickering in Unity I'm trying to make a grid like, light up floor using Unity's Shader Graph. However, I am having an issue where the lines are flicking after a really short distance when the camera is moving.

The shader graph is below.

How can this issue be prevented and what is causing it?

sentences: Rendering of a minimized / out of focus directx game is slow I m working on a project that captures the game windows and send it to another node. As long as game is in focus or maximize, the rendering is smooth and steady. When the game is out of focus or minimized, the streaming shows jerky effect. When you maximize the windows, the affect again disappears. Is that an issue of directx game rendering or something else? How this problem can be solved?

sentences:
Parsing .OBJ to fit the gldrawelements() call. c++/opengl I'm struggling trying to get this to work like it should. Ive been able to make an obj loader that fits the glDrawArrays() call, with uv and facenormals, but when trying to modify it to fit glDrawElements() Im at a loss.

This is the code I have this far, the function takes the addresses of the vectors to be filled:

void objload3(string filename, vector<glm::vec3>&vertices, vector<glm::vec2>&texcords, vector<glm::vec3>&normals)
{
    size_t vertsize = 0; size_t texsize = 0; size_t normalsize = 0; size_t facesize = 0;  //ref size containers

    string line; string token;
    std::ifstream file(filename);

    if (file.is_open())
    {
        while (getline(file, line)) //count size
        {
            if (line.compare(0, 2, "v ") == 0)++vertsize;
            else if (line.compare(0, 2, "vt") == 0)++texsize;
            else if (line.compare(0, 2, "vn") == 0)++normalsize;
            else if (line.compare(0, 2, "f ") == 0)++facesize;
        }file.close();
    }

    //set size
    vector <glm::vec3>verticeref(vertsize);
    vector <glm::vec2>texkoordref(texsize);
    vector <glm::vec3>normalref(normalsize);

    vector<string>points(facesize * 3);

    //index filling counters
    size_t vcount = 0; size_t vtcount = 0; size_t vncount = 0; size_t fcount = 0; size_t refcount = 0;

     //fill reference vectors
    file.open(filename);
    if (file.is_open())
    {
        while (getline(file, line))
        {
            if (line.compare(0, 2, "v ") == 0) {
                istringstream s(line.substr(2));
                glm::vec3 v; s >> v.x; s >> v.y; s >> v.z;
                verticeref[vcount++] = v;
            }

            else if (line.compare(0, 2, "vt") == 0) {
                istringstream s(line.substr(2));
                glm::vec2 v; s >> v.x; s >> v.y;
                texkoordref[vtcount++] = v;
            }

            else if (line.compare(0, 2, "vn") == 0) {
                istringstream s(line.substr(2));
                glm::vec3 v; s >> v.x; s >> v.y; s >> v.z;
                normalref[vncount++] = v;
            }

            else if (line.compare(0, 2, "f ") == 0) {
                line.erase(0, 2);
                istringstream is(line);
                while (getline(is, token, ' '))points[fcount++] = token;
            }
        }file.close();
    }

    vector<int>indexref(3*points.size()); //faces allocation

//clean up faces information, convert to int
for (unsigned int a = 0; a <points.size(); ++a) {
    stringstream is(points[a]);
    while (getline(is, token, '/')) { indexref[refcount++] = stoi(token); }
    is.clear();
}

at this point, I would do this to fit it with the glDrawArrays() call:

vertices.resize(points.size());
texcords.resize(points.size());
normals.resize(points.size());

refcount = 0; //keep track of fill

for (size_t fillcount = 0; fillcount < points.size(); ++fillcount)
{
    vertices[fillcount] = verticeref[indexref[refcount++] - 1];
    texcords[fillcount] = texkoordref[indexref[refcount++] - 1];
    normals[fillcount] = normalref[indexref[refcount++] - 1];
}

But this fill doesnt take account of all the duplicate vertices, nor does it create an index. Im having problems understanding the logic behind the gldrawarrays call, and how to easily make an index and list of vertices/uv/normals to fill the vbos with.

Seems like something the 3Dmodel tool should do, but it doesnt? I cant juse use the list of faces already in obj export?

Some clarification would be much appreciated.

sentences: How to create a transparent mask in Love2D Since Love2D doesn't support SVG, I'm looking for other ways to create solid, compound shapes.  Anything that has straight edges can be drawn using a polygon, but I haven't yet found a way to mask an circle or ellipse, or in other words, subtract a circle or ellipse from the object being drawn.  Is this possible with Love2D?

sentences:
Simultaneous game states I think I understand the basic idea behind a Finite State Machine-based game loop. But I'm trying to write a little game in which the same object can simultaneously be in multiple, independent states. At least that's what I want to do.

To give you an idea: Robot may be in FleeState and FireLaserState at the same time, besides in each of them individually at any time.

Would something like this be possible using the FSM pattern? Or ought I to look elsewhere?

After all, does the whole idea make sense?

Pasted from my comment below: A little clarification of why I'd like states to be kept separate:  I want the player to have the ability to program simple state changes before a game... say "if (health_is_way_too_low) flee". But then I want multiple such rules to be active simultaneously in order to keep the game interesting, and cannot know beforehand which other states may be active.

sentences:
What makes a shader function with a LineRenderer? A LineRenderer has both Material and Color properties.
But many shaders do not work, ie the line will not respect the Color property, or the line will show black (regardless of the materials having its own color).

For example the Standard, Diffuse, Mobile/Diffuse shaders all show black.  Unlit/Color ignores the LineRenderer color and uses only the Material Color property.  Particles>Additive works great, but Particles>Standard Surface does not.

What part of the shader code is important to make a LineRenderer display using its own Color property?  When it does work, how should shader code decide how to merge between the two colors?

sentences:
Why is rotation not applied instantly? I am working though the Space Shoot tutorial and I have just applied tilt to the player object. One of the things that I have noticed is that the tilt is not applied instantly but instead the player object can be seen to rotate to the new rotation position. Why does the rotation appear to applied over time (1/2 second maybe) instead of instantly?

My expectation would be that when I set an attribute the value is changed instantly, not over time. I understand that instantly snapping to a position might not be very desirable, but I can't find anything in the unity documentation that explains the behavior I am observing. My desire is to understand this behavior so that I can account for it and take advantage of it, so please provide a link to any supporting documentaion.

Sample code that exhibits this behavior.

using UnityEngine;
using System.Collections;

public class PlayerControler : MonoBehaviour {
    void FixedUpdate(){
        float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis ("Vertical");

        rigidbody.velocity = new Vector3 (moveHorizontal, 0.0f, moveVertical);

        rigidbody.rotation = Quaternion.Euler (0, 0, rigidbody.velocity.x);
    }
}

sentences:
Ensuring linear velocity remains constant even when turning I am using Ackermann steering to rotate a vehicle. The code is as follows:

    if (turningLeft || turningRight) {
        // Rotate around a dummy pivot point
        float turnDir = turningLeft ? -1 : 1;
        Vector3 turningPivotPoint =
            dummyPivot.transform.TransformPoint(
                new Vector3(turningCenterDistance * turnDir, 0, 0));
        dummyPivot.transform.RotateAround(
                    turningPivotPoint,
                    Vector3.up * gasDir * turnDir,
                    angleVel * Time.deltaTime);
    }

    // The player is pressing the gas
    if (isGas) {
        angleVel = Mathf.Lerp (angleVel, maxAngleVel,Time.deltaTime);
    }

    if (angleVel == 0) {
        turningLeft = turningRight = false;
    }

    gasVel = Mathf.Lerp(gasVel, angleVel * Mathf.Deg2Rad * turningCenterDistance, Time.deltaTime);

    dummyPivot.transform.position =
        dummyPivot.transform.position + dummyPivot.transform.forward * Time.deltaTime * gasVel * gasDir;

The issue is that the speed of the vehicle when it is turning does not match its speed when driving straight. Driving the vehicle in circles will be slower than driving the vehicle forward.

How do I fix this?

sentences:
OpenGL fovx question To boil my question down to the simplest form, I fear I am oversimplifying how mat4 perspective works.  I am using

mat4.perspective(45, 2, 0.1, 1000.0)

(the binding is WebGL fwiw).  With a fovy of 45, and an aspect ratio of 2, I expect to have a fovx of 90.  Thus, if I position my camera at (0, 0, 50), looking towards the origin, I expect to see a cube positioned at (50, 0, 0) (45 degrees) right at the very periphery of my screen, half on, half off,.  Instead, a cube at (50, 0, 0) is totally off screen, and my actually periphery occurs at about (41.1, 0, 0).

What am I missing here?

Thanks,
nick

sentences: How to test ad mediation in cocos creator? I made a game in cocos creator and added Admob as my primary ad network and Ad Colony as secondary. But I am not sure how can I test if it's working? Can I just disable adMob ads (test ads) and see if the game still showing ads with AdColony (test ads)?

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:
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:
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:
What platform were old TV video games developed on? I am very eager to know how TV video games (which we all used to play in our childhood) were developed and on which platform.

I know how games are developed for mobile devices, Windows PC's and Mac but I'm not getting how (in those days) Contra, Duck Hunt and all those games were developed. As they have high graphics and a large number of stages. So how did they manage to develop games in such a small size environment and with lower configuration platform?

sentences:
How to define data for an input sequence game? I'm starting to program my very first game, it's a clone of DDR/Stepmania done for research purposes and learning.

I (at this early stage) get most of the UI/Music/input work that should be done, but what i still can't grasp is scripting, i've read about Lua and that you shouldn't use it with XNA/Monogame as C# is capable enough, but i cannot get the utility of it.

Assuming the needs of my game, What would be the ideal way to implement the input sequences it needs?, i thought of XML/Json, let's say Stage 1

<game>
 <level id="1">
  <step id="1" key="up" time="00:00:01"/>
  <step id="2" key="left" time="00:00:02"/>
 </level>
</game>

Is that a correct implementation? or are there better ways with more benefits?

sentences:
Xcode project runs on device, but not simulator I built a 2D game using Unity3d 5.1.1. When i build and run the project with iPhone connected, the game runs fine on the device. But when i select simulator instead of device, i get an error :
" does not have an architecture that  can execute" .
I run the game on iPhone 4S, but cannot run on the iPhone 4S simulator. Similarly, i selected iPhone 6, 5 etc and get this error every time.

sentences:
LibGDX - Trying to make a radar-like display i have an interesting question about geometry.
I have two or more moving objects outside of my stage's viewport (blue and red circle in the image below), which i want to point at with two arrows on the border of the screen (or better, viewport bounds).
The black dot never moves, because it represents viewport's center.

So, arrows must always point at the objects and must always be "locked" on the border of the screen.

Can someone help me with this?

UPDATE
Following @Stormwind answer, i managed to get a Ray from objects to screen center.
Now my problem is defining the BoundingBox.
I tried declaring it like this:

Vector3 v1 = new Vector3(0, 0, 0)
Vector3 v2 = new Vector3(screen.width, screen.height, 0)
BoundingBox box = new BoundingBox(v1, v2)

and then get the intersection by using the IntersectRayBounds() method,
but behaviour is funny.
I think i missed out something or mistakenly declared the BoundingBox.

sentences:
LibGDX - How to draw a filled rectangle behind a text? I'm new in LibGDX and I want to create a grid based game. Every square will have a rectangle and a text and the background color of the rectangles can change during the game.

The problem is when I draw a filled rectangle with ShapeRenderer, it always in front of the BitmapFont. How can I set the rectangle behind the text?

The code I use to draw the squares:

// Draw numbers and rectangles
for (int i = 0; i < map.length; i++) {
    for (int j = 0; j < map[0].length; j++) {
        String value = String.valueOf(map[i][j].getNumber());
        float offset = fontSize/3f;
        Rectangle rect = rects[i][j];

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        shapeRenderer.setColor(150/255f, 150/255f, 150/255f, 1);
        shapeRenderer.rect(rect.x, rect.y, rect.width, rect.height);
        shapeRenderer.end();

        // Draw font
        if (map[i][j].isActive()){
            fontActive.draw(batch, value, rect.x + offset, rect.y + offset);
        } else {
            font.draw(batch, value, rect.x + offset, rect.y + offset);
        }
    }
}

Thanks all!

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:
Check if coroutine crashed I can check if coroutine still running by setting boolean variable outside the coroutine and then letting the coroutine itself set the value to true when it runs and set it to false when it decide to stop .
But this method of detecting whether coroutine still active or not doesn't work when the coroutine crashed due to error (invalid input, null reference , ect) because the boolean variable remain true while the coroutine itself has stopped due to error.
How do i check if coroutine still running or not in current frame ? i can't spend my code checking for next frame .
Preferably C# , but answer in javascript also accepted.

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:
Merging box colliders for optimization Look at the picture.

The figure on the left shows the individual box colliders in green.

The yellow boxes on the right are the results of the optimization of the original box colliders.

What is the algorithm that makes this possible?

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:
First Person Mouse Aiming For one segment of my game, the player is in a fixed position (no movement) and has to aim and shoot at enemies in a first person 3D perspective using the Mouse. The player is holding a wand that shoots projectiles (which I have working) and I need it to rotate and aim towards the cursor as an aiming reticle. I also want to limit how much the player can rotate, so they can look around, but can't turn more than 180 degrees (sort of like this). However, I'm a designer and am having trouble programming this myself. I haven't been able to find a proper solution.

So far, I've been able to cobble the following code together, but the aiming is super wonky and doesn't properly point to the mouse position, making it impossible to actually aim at anything. I would really appreciate some help with figuring this out.

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

public class PlayerShoot : MonoBehaviour {

public float magnifier = 0.5f;
public Rigidbody shotPrefab;
public Transform barrelEnd;
public float shotSpeed = 500;
public Rigidbody sparkPrefab;

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

    Ray mouseRay = Camera.main.ScreenPointToRay (Input.mousePosition);
    float midPoint = (transform.position - Camera.main.transform.position).magnitude * magnifier;

    transform.LookAt (mouseRay.origin + mouseRay.direction * midPoint*magnifier);

    if (Input.GetButtonDown("Fire1"))
    {
        Rigidbody shotInstance;
        shotInstance = Instantiate(shotPrefab, barrelEnd.position, barrelEnd.rotation) as Rigidbody;
        shotInstance.AddForce(barrelEnd.forward * shotSpeed);
        sparkBlast();

    }
}
// Particle recoil effect
void sparkBlast () {
    Rigidbody shotSparks;
    shotSparks = Instantiate(sparkPrefab, barrelEnd.position, barrelEnd.rotation) as Rigidbody;
    Destroy (shotSparks,0.5f);
}

}

sentences:
3D Location Handling I am thinking about making a simulator type game that will involve having lots of small objects in a 3D space.  What is the typical solution for handling these objects?  The first thing that comes to mind is a 3D Array, but I can't help but think there is a more efficient solution.  Another idea that comes to mind is objects having possession of smaller items. For example a House possesses a Table which possesses a Cup and Bowl.

The final way I can think of handling this is just having an array of "objects" that each have an x, y, z value.  While this would make storing them easy I do not understand how you would detect collisions without just looking at every possible object and checking to see if it is in the way.

Are there other ways of holding onto these objects that is more efficient?

Edit: Following up with the comments below, are there typical thread-safe ways of implementing these structures in Java?

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:
clamp a 2D coordinate to fit within an ellipse I need to clamp a 2D coordinate to fit within an ellipse.

Call of Duty: Modern Warfare 2 does something similar where capture points are translated from a 3D vector in the world to a 2D screen coordinate and then the 2D coordinates are clamped within an ellipse.

When the capture points are in view they're within the bounds of the ellipse.

When they're behind you they are clamped to be within the bounds of the ellipse.

Given a 2D coordinate that could be off screen, etc, what is the math behind clamping it within an ellipse?

sentences:
Increasing flexibility of a data passing system in a component based entity system I'm creating a Component orientated system for a small game I'm developing. The basic structure is as follows: Every object in the game is composed of a "GameEntity"; a container holding a vector of pointers to items in the "Component" class.

Components and entities communicate with one another by calling the send method in a component's parent GameEntity class. The send method is a template which has two parameters, a Command (which is an enum which includes instructions such as STEP_TIME and the like), and a data parameter of generic type 'T'. The send function loops through the Component* vector and calls each's component's receive message, which due to the template use conveniently calls the overloaded receive method which corresponds to data type T.

Where the problem comes in however (or rather the inconvenience), is that the Component class is a pure virtual function and will always be extended. Because of the practical limitation of not allowing template functions to be virtualised, I would have to declare a virtual receive function in the header for each and every data type which could conceivably be used by a component. This is not very flexible nor extensible, and moreover at least to me seems to be a violation of the OO programming ethos of not duplicating code unnecessarily.

So my question is, how can I modify the code stubs provided below to make my component orientated object structure as flexible as possible without using a method which violates best coding practises

Here is the pertinent header stubs of each class and an example of in what ways an extended component class might be used, to provide some context for my problem:

Game Entity class:

class Component;

class GameEntity
{

public:
GameEntity(string entityName, int entityID, int layer);

~GameEntity(void){};

//Adds a pointer to a component to the components vector.
void addComponent (Component* component);

void removeComponent(Component*);

    //A template to allow values of any type to be passed to components
template<typename T>
void send(Component::Command command,T value){
       //Iterates through the vector, calling the receive method for each component
    for(std::vector<Component*>::iterator it =components.begin();  it!=components.end();it++){
        (*it)->receive(command,value);
    }
}
private:
     vector <Component*> components;

};

Component Class:

#include "GameEntity.h"
class Component
{
public:
static enum Command{STEP_TIME, TOGGLE_ANTI_ALIAS, REPLACE_SPRITE};

Component(GameEntity* parent)
    {this->compParent=parent;};

virtual ~Component (void){};

GameEntity* parent(){
    return compParent;
}
void setParent(GameEntity* parent){
    this->compParent=parent;
}

virtual void receive(Command command,int value)=0;
virtual void receive(Command command,string value)=0;
virtual void receive(Command command,double value)=0;
virtual void receive(Command command,Sprite value)=0;
    //ETC. For each and every data type

private:
GameEntity* compParent;

};

A possible extension of the Component class:

#include "Sprite.h"
#include "Component.h"
class GraphicsComponent: Component{
    public:
          GraphicsComponent(Sprite sprite, string name, GameEntity* parent);
          virtual void receive(Command command, Sprite value){
                 switch(command){
                      case REPLACE_SPRITE: this->sprite=value; break
                 }
           }

    private:
          Spite sprite;

}

Should I use a void pointer and cast it as the appropriate type? This might be feasible as in most cases the type will be known from the command, but again is not very flexible.

sentences:
In XNA, should I use the built-in game component classes? I'm just getting started on an XNA game for Window Phone 7. For my Flash games I have my own framework that I was just going to port from AS3, but I have just found the built-in game component stuff in XNA. So should I use this stuff? Should my Entity class extend game component/drawable game component? I'm sure it will be quicker just to port my AS3 code, but I thought this built-in stuff may have some advantages?

UPDATE: I decided not to use them. It doesn't seem that they are meant to be used in the way I described.

sentences: Vision Cone for Enemy AI in Unity 2d I am trying to develop an Enemy AI with vision cone in unity 2d top down game, can you please suggest me some approach or sample script, so I can get an idea.

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:
Triangular grid and rendering to a texture (Direct3D 11) Is it possible to render vertex data from a triangular grid into a texture with a same size (i.e. 3x3 vertices to 3x3 pixels - each pixel is representing one vertex)?

Consider following situation. I have a grid (3x3 to keep it simple) and in a vertex shader is a computation of Z coordinate (imagine it like some wave model of a water surface). So, each vertex has some Z value, and I need to store these values into a texture (for a comparison with a next frame). A texture is set as a render target and has a same size as the grid.

How to render a precise Z value (coordinate) of a vertex into appropriate pixel? I mean, my dilemma is a fact that rasterizer gets three vertices and interpolates their values by default, so values stored in pixels are not precise at all.

sentences:
Handling variable frame rate in SDL2 i am creating a game with C++ and SDL2 game engine but i noticed this.
I used the Vsync option for rendering, so it'll render at 60fps.
If i use this game with another monitor, fps are different (for example 75).
I understood that this depends by the monitor frame rate.
My monitor is 60Hz and the other is up to 75Hz.
The problem is if i disable the Vsync option, Rendering will be accelerated.
Fps will increase up to 200 or will be unstable.

Sorry if my english is bad but for example this:
I want a block moving 5 pixels per frame.
If i have a slow pc the block will move slow.
If i have a fast pc the block will move fast.

So i searched for Frame Independent Movement and i pick up this:

movementPerSecond * (timeElapsedInMilliseconds / 1000.0)

I got this formula but i don't know what to use for "movementPerSecond" if i want the same velocity as before.
That block will not move 5 pixels per frame but some pixels per second.
Before, frames were 60 so the blocks was moving 60*5=300 pixels per second.
300 p/s should be this movement.
I disabled Vsync and i tried to do this:

while(1) {
    ...
    // updating coords
    x += 300.f * (timer.get() / 1000.f);
    timer.start();
    // rendering..
    ...
}

i was thinking that this was correct but velocity is faster than before.
In some frames, the block doesn't go.
i use timer.get() to get the time elapsed since i used timer.start();
i tried to print to the console these values and i got (1, 2, 0, 1, 1, 0, 2, 1).
So i think time in one frames is about 1ms.
I think however that if milliseconds are 0, movement variation will be 0.. (300*(0/1000) = 0).

I hope you understand what i'm telling.
What should i do?
Thanks

sentences:
Is Ada suitable for game development? Would Ada be a practical language for game development (at least for the PC--I understand there aren't compilers for PlayStation and other consoles)?

It has bindings to OpenGL, it has decent performance, and it's less error-prone than C++. Please feel encouraged to support your point with relevant example projects you know about.

sentences:
MonoGame rendering text with black boxes? I have a UI manager that renders a background image and some images and buttons using BlendState.AlphaBlend. This works as intended. However, when I try and draw some text on top of it with the same BlendState, each character is encased in a black box and it looks awful. I played around a bit and found that BlendState.Additive was the only one that didn't render the black boxes. However, the text is now slightly transparent, which looks weird. I then decided to mess around with custom BlendStates, but after around 10 minutes I found that there could be over 67 million different BlendStates. Hmm. My last thought is that it could be the font that is breaking it, because I tried rendering with the Arial font and AlphaBlend worked fine. Is there a way round this using BlendStates without finding a new font?

tl;dr I can only render text either with black boxes or half transparent.

Text rendering code:

sb.Begin(samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend, transformMatrix: Game.Camera.GetViewMatrix());

sb.DrawString(Game.Font, text, position, color);

sb.End();

SpriteFont File (using the free Minecraftia font):

<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
  <Asset Type="Graphics:FontDescription">
    <FontName>Minecraftia</FontName>
    <Size>6</Size>
    <Spacing>0</Spacing>
    <UseKerning>true</UseKerning>
    <Style>Regular</Style>
    <DefaultCharacter>?</DefaultCharacter>
    <CharacterRegions>
      <CharacterRegion>
        <Start>&#32;</Start>
        <End>&#126;</End>
      </CharacterRegion>
    </CharacterRegions>
  </Asset>
</XnaContent>

It's a pixelly game (so I need a blocky font to avoid weird antialiasing) and I think the font is a bitmap font. Just in case that makes a difference.

Edit: I found that setting the text size (in the SpriteFont file) to anything other than it's native size fixes the problem (but also renders with antialiasing, which I don't want). Also, this problem seems to happen with other bitmap fonts (tested 'Minecraftia' and '04b03').

sentences:
Unity Destroy Unused GameObjects I'm trying to access a method in another script without using the keyword "static";

public void CreateFarm()
{
    new Farm().NewResourceBuilding(gameObject);
}

My question is; will Unity automatically delete this object once it's done calling the method? Or will I need to manually destroy it? If the latter, how will I go about that?

I've searched on Google and been on this problem for a few days until I've finally come to this solution lol. So annoying to reference a static yet want to add a gameobject via the inspector.

Edit (Left the previous content untouched as some of answers already provided for the above might be useful to others). I have since revised my code and the flow.

I have a scene with a number of "empty lots" which I use images as placeholders childed to a Canvas.

The following steps occur:

Clicking on any of these images calls Unity's event system to open a panel, from the onclick options of the inspector. This panel will allow me to select from a number of different buildings to construct.

ChangePanels.CS

public void RuralBuildingSelected()
{
    empirePanel.SetActive(false);
    characterPanel.SetActive(false);
    ruralBuildingPanel.SetActive(true);
}

Why I wanted to avoid "static" was because no static method is callable from the inspector (AFAIK). I could have created my own script and called a public onclick, but perhaps one of you might be able to advise which option of these is more efficient.

Whichever "emptylot" I clicked on, I wanted them to send through their data into a manager script so whatever building I built, could replace the emptylot.

EmptyLot.CS

public void CreateFarm()
{
    new GameManager().GetEmpty(gameObject);
}

The following follow gives you an option of a number of buildings to construct. If I click on the farm, I need to;

Instantiate a new Farm
Parent it to the emptyLot's parent
To replace the emptylot with the new farm, I set them to have the same positions
Destroy the emptylot that called the new farm into existence
Bring back the main panel

Farm.CS

new public void NewResourceBuilding(ResourceBuildings resource)
    {
        Farm newFarm = Instantiate(resource) as Farm;
        newFarm.transform.SetParent(GameManager.emptyLot.transform.parent);
        newFarm.transform.position = GameManager.emptyLot.transform.position;
        newFarm.levelText = newFarm.GetComponentInChildren<Text>();
        newFarm.name = resource.name;
        Destroy(GameManager.emptyLot);
        GameObject main = GameObject.Find("Main Canvas");
        main.GetComponent<ChangePanels>().MainScene();
    }

My Questions:

The "EmptyLot.CS" script creates a new GameManager to call a public method. I don't reference the object. Will this automatically be added to the garbage collector or should I just destroy it after using it? If I need to destroy it manually, how would I go about that?
I note that if I went ahead with the static methods and implement my own OnClick() method I can condense this to just two scripts instead of the three. So should I do that? Or based on the above code, is it just as efficient to keep it the way it is? I'm not a pro at this, but inline with Wondra's comment (to Almo's answer) it does seem like the approach of creating objects to delete instantly is a performance issue?

Thank you for taking the time to read/help/advice

sentences:
Recalculating Stats After Any Change? I have four sources of a character's stats changing (in order of calculation):

Due to leveling up (base stats)
Equipment changing (calculated after base stats)
A passive skill being toggled on or off (calculated after equipment stats)
Being afflicted by a buff/debuff (calculated after passive skill stats)

My question is, if any of these sources causes a change, should I recalculate everything from base stats, or store "sets" of the stats after each change (i.e. save a copy of the stats after passive skill changes, so if the player is hit by a "defense down" status effect, I only have to recalculate from skill stats). Unless there's a better way to deal with this problem, I don't know which of these two options is better.

sentences:
Why my stencil mask doesn't work? I've a very sipmle Unity scene.

It has two objects in it, which is Sprites, and they both use sipmle black boxes as a textures.

Here's two shaders, one should act as a mask, and second as a object, that should be rendered only in pixels, specified by that mask.

Mask shader:

Shader "Unlit/StencilUnlitShader"
{
Properties
{
    _MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
    Tags { "RenderType"="Opaque"
    "Queue" = "Geometry" }

    Pass
    {
        //AlphaTest Greater 0.5 //Only render pixels whose alpha is greater than AlphaValue.
        Stencil{
        Ref 2
        Comp Never//Never - never pass the stencil test, Always - always pass the stencil test
        Pass Replace //write Ref value into the stencil buufer
        }

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
            float4 vertex : SV_POSITION;
        };

        sampler2D _MainTex;
        float4 _MainTex_ST;

        v2f vert (appdata v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.uv = TRANSFORM_TEX(v.uv, _MainTex);
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
            // sample the texture
            fixed4 col = tex2D(_MainTex, i.uv);
            //if (col.a < 0.9) discard; //discard a pixel if it's transparent and don't draw it into a buffer
            return col;
        }
        ENDCG
    }
}
}

Object shader:

Shader "Unlit/GreenUnlitShader"
{
    Properties
    {
        _MainTex("Texture", 2D) = "white" {}
    }
        SubShader
    {
        Tags{ "RenderType" = "Opaque"
              "Queue" = "Geometry+5" //to draw after stencil object
    }

        Pass
        {
        //AlphaTest Less 0.5
        Stencil{
        Ref 1
        Comp Less //Always, Less - if ref value is greater then current value in the stencil buffer
        Pass Keep
        }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"

    struct appdata
    {
        float4 vertex : POSITION;
        float2 uv : TEXCOORD0;
    };

    struct v2f
    {
        float2 uv : TEXCOORD0;
        float4 vertex : SV_POSITION;
    };

    sampler2D _MainTex;
    float4 _MainTex_ST;

    v2f vert(appdata v)
    {
        v2f o;
        o.vertex = UnityObjectToClipPos(v.vertex);
        o.uv = TRANSFORM_TEX(v.uv, _MainTex);
        return o;
    }

    fixed4 frag(v2f i) : SV_Target
    {
        fixed4 col = tex2D(_MainTex, i.uv);//fixed4(0,1,0.5,0.6);
        //if (col.a < 0.9) discard;
        return col;
    }
ENDCG
    }
    }
}

The problem is, this doesn't seem to work, and object doesn't seems to be rendered at all (why it should in the places where mask have it's pixels)

sentences:
Drawing entities in an isometric engine I am having some problems drawing my entities in an isometric map.

Tiles are drawn using Painter's algorithm to do the z-sorting which works great for the tiles alone. Entities are parented to a particular tile and have an offset within it. They are drawn immediately after their parent tile. The problem is that when the entity is too far right or too far down; the next tile(horizontally to the right, or vertically below) is drawn over parts of it like so:

(Note, currently my player has his registration point (red circle) a little higher than right at the bottom, just to better approximate the centre of his feet.)

A couple of ideas I had to try and remedy this:

1) To simply offset the position of entities to move them so that they will always draw in a place that won't be drawn over later. I really don't like to add in strange offsets that must be compensated for all over the place but this seems like a viable option.

2) To draw everything tiles and entities, using painter's algorithm. Entities would not need to be parented to a tile anymore but every renderable graphic would need it's drawing position offset. (Tiles would have their point at the very top, entities at the very bottom so that painter's orders things correctly)

3) Implement some kind of layering system so that all floors are drawn first, then things behind entities etc etc. This seems complex and would change from scenario to scenario. As my game will have randomly generated levels, I feel this isn't the right solution.

So, do any of the above have merit? Do I have it all completely wrong and there's another solution I've missed?

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:
Mouse position to grid position not working I have a function which converts my mouse position to grid position in the game but it is not working properly... its slightly off.

I have two functions - one which converts from grid to screen position (this particular one, works fine) and the code is:

function mapToScreen(gridX,gridY,screen) {
    var grid = 64;
    var x  = (gridX - gridY) * (grid/2);
        x -= screen.offsetX; //camera scroll offset X axis
        x -= grid/2; //centre of the iso tile on X axis

    var y = (gridX + gridY) * (grid/4);
        y -= screen.offsetY; //camera scroll offset Y axis
        y -= grid/4; //centre of the iso tile on Y axis
    return [x,y];
}

So my function to do the opposite looks like this:

function screenToMap(pixelX,pixelY,screen) {
    var grid = 64;
    pixelX += screen.offsetX;
    pixelX += grid/2;
    pixelY += screen.offsetY;
    pixelY += grid/4;

    var gridX = Math.floor((pixelX / (grid/2)  + pixelY / (grid/4)) /2);
    var gridY = Math.floor((pixelY / (grid/4)  -(pixelX / (grid/2))) /2);

    return [gridX, gridY];
}

The problem is as shown below in the image, it doesn't return the correct number. The first corner tile should be [0,0].

Also notice the co-ordinate doesn't change correctly with the tile border. I don't know how to solve that either.

sentences:
How can I get/find all the UI texts and TextMesh Pro in the hierarchy? When pausing/resuming the game, I want to disable/enable all UI texts.
The following code works for finding UI texts, but I also want it to find TextMesh Pro text.
How can I do this?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class BackToMainMenu : MonoBehaviour
{
    [ContextMenuItem("Fetch", nameof(FetchAllTexts))]
    public Text[] uiTexts;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (Time.timeScale == 0)
            {
                SceneManager.UnloadSceneAsync(0);
                DisableEnableUiTexts(false);
                Cursor.visible = false;
                Time.timeScale = 1;
            }
            else
            {
                Time.timeScale = 0;
                MenuController.LoadSceneForSavedGame = false;
                DisableEnableUiTexts(true);
                SceneManager.LoadScene(0, LoadSceneMode.Additive);
                Cursor.visible = true;
            }
        }
    }

    private void FetchAllTexts()
    {
        var tmp = new List<Text>();
        foreach (var root in SceneManager.GetSceneAt(0).GetRootGameObjects())
        {
            tmp.AddRange(root.GetComponentsInChildren<Text>(true));
        }
        Text[] texts = tmp.ToArray();

        uiTexts = texts;
    }

    private void DisableEnableUiTexts(bool uiTextEnabled)
    {
        if (uiTexts.Length > 0)
        {
            foreach (Text ui in uiTexts)
            {
                ui.enabled = uiTextEnabled;
            }
        }
    }
}

sentences:
How do I run an iPhone GameSalad App on an iOS Device? I have made a simple game application with GameSalad . It runs fine in the iPhone simulator after loading the GameSalad Viewer but doesn't work in the device as it gives a code signing error. If I change the IPA according to the device then the GameSalad Viewer crashes and the app does not run.

Does anyone have a solution for this?

sentences:
Unity sprites and layouts I am trying to learn Unity for a simple board game. The question is, is it possible to use grid layout group (or any layout component) with sprites? The goal is to fit a board into my view regardless of the aspect ratio of the device.

The following grid should contain 7 by 7 sprites and it should scale up and down (no more then lets say 100 px) and have an aspect ratio of 1. I've tried adding a canvas and a panel that has a grid layout group component but it seems like sprites are not affected when added to the panel.

Also it seems like when I try to work with a panel or a canvas they have a fixed sizes in units. Having fix sizes feels a little bit off.

Is there a way to use layout components so sprites can have relative distances between them.

So far I am stuck and lost in tutorials and feeling like the answer should not be this complicated.

Any push to the right direction is welcome.

sentences:
Sprite Animation Toolkits for iPhone Does anyone know of any good (and preferably free) Sprite Animation Toolkits/Libraries for iOS development?

This library should be able to handle the collision detection and the movement of the sprites.  Back in the 90's there was a Pascal library called Sprite Animation Toolkit by Ingemar Ragnemalm that handled a lot of the heft to create animations and the such.  I am just wondering if there is anything like that in the iOS world?

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:
Libgdx: different speed on different devices I am running a simple Libgdx app that I have wrote, on my Android phone and Android tablet and I am getting the unexpected result of having different velocities when a body is moved. To move the body I am using a "drag" movement in this way (snippet):

private Body ballBody;
private int ballX1, ballY1;

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    ballX1 = screenX;
    ballY1 = screenY;
    return true;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    Vector2 v2 = new Vector2(ballX1 - screenX, screenY - ballY1);
    v2.scl(0.25f);
    ballBody.setLinearVelocity(v2);
    return true;
}

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    return false;
}

Render part with some of my attempts to fix delta-time and FPS:

private static final int SCREEN_HEIGHT = 16; //320;
private static final int SCREEN_WIDTH = 24; //480;
private static final int BOX_VELOCITY_ITERATIONS = 6;
private static final int BOX_POSITION_ITERATIONS = 2;
private static final float BALL_RADIUS = 0.1f;
private static final float MAX_FPS = 1 / 60f;
private static final float PIXELS_TO_METERS = 20f;
private static final long ONE_SECOND_NS = 1000000000;

private int maxUpdates = 10;
private long lastTime = System.nanoTime();
private World world = new World(new Vector2(0, -9.8f), true);

@Override
public void render() {
    ballIsNotMoving = ballIsNotMoving();
    if (ballIsNotMoving && ballBody.getPosition().x > landscape2d[20] && ballBody.getPosition().x < landscape2d[28]) {
        newHole();
    } else if (ballBody.getPosition().x > SCREEN_WIDTH + ball.getWidth() / 2 || ballBody.getPosition().x < - ball.getWidth() / 2) {
        resetBallPosition();
    }

    camera.update();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glClearColor(34/255f, 167/255f, 240/255f, 0);

    fixTimeStep();

    world.step(MAX_FPS, BOX_VELOCITY_ITERATIONS, BOX_POSITION_ITERATIONS);

    shapeRenderer.setProjectionMatrix(camera.combined);

    // Set the sprite's position from the updated physics body location
    ball.setPosition(
            ballBody.getPosition().x - ball.getWidth() / 2,
            ballBody.getPosition().y - ball.getHeight() / 2);

    polySpriteBatch.setProjectionMatrix(camera.combined);
    polySpriteBatch.begin();
    pitch.draw(polySpriteBatch);
    polySpriteBatch.end();

    createStartArea(shapeRenderer);

    fixFPS();

//        debugRenderer.render(world, camera.combined);
}

private boolean ballIsNotMoving() {
    float speedNow = ballBody.getLinearVelocity().len();
    recentSpeed = 0.1f * speedNow + 0.9f * recentSpeed;
    if (recentSpeed < 0.20f) {
        stopBallMovement();
        return true;
    }
    return false;
}

private void fixTimeStep() {
    long time = System.nanoTime();
    long timeDelta = time - lastTime;
    float timeDeltaSeconds = timeDelta / (float) ONE_SECOND_NS;
    lastTime = time;

    // Update the game state in capped time steps (in case we're running too slow)
    int updateCount = 0;
    while (timeDelta > 0 && (maxUpdates <= 0 || updateCount < maxUpdates)) {
        // Update using a time step in seconds
        float updateTimeStep = Math.min(timeDeltaSeconds, ONE_SECOND_NS * MAX_FPS);
        float updateTimeStepSeconds = updateTimeStep / (float) ONE_SECOND_NS;

        world.step(updateTimeStepSeconds, BOX_VELOCITY_ITERATIONS, BOX_POSITION_ITERATIONS);

        timeDelta -= updateTimeStep;
        updateCount++;
    }
}

private void fixFPS() {
    long sleepTime = Math.round((ONE_SECOND_NS / MAX_FPS) - (System.nanoTime() - lastTime));
    if (sleepTime <= 0)
        return;
    long prevTime = System.nanoTime();
    while (System.nanoTime() - prevTime <= sleepTime) {
        try {
            Thread.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

The app start with the same resolution for both devices. Any idea about how to get the same speed?

sentences:
Inheritance vs Composition I make my money in C# Generally in that language I like to decouple everything to the high heavens using interfaces. This has served me well in enterprise code but in writing games in C# I find myself tending towards inheritance due to being able to define some default behaviors for base classes. I feel dirty doing this though, like I'm disobeying some architecture god who once said "favor composition over inheritance". I know its not black and white but I also feel like i could use interfaces with a bit more work and achieve roughly the same thing.

What do other people do? Is inheritance the right approach for games or should I refactor in some interfaces?

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:
Can't figure get the conversion from cartesian to spherical("polar") correctly for my orbiting camera The two angles from the polar coordinate system are defined as hRotation and vRotation

This is how they are converted from polar to cartesian:

    // Get the distance between the object and the camera
    float distance = cam.getLocation().distance(RotationTarget);

    Vector3f pos = new Vector3f(distance * FastMath.sin(vRotation) * FastMath.cos(hRotation),
                                distance * FastMath.cos(vRotation),
                                distance * FastMath.sin(vRotation) * FastMath.sin(hRotation));

    // Add in the objects position to make the new relative position of the camera
    pos = pos.add(RotationTarget);
    cam.setLocation(pos);

Now the problem is when I try to get hRotation and vRotation from cartesian coordinates for the to initialize hRotation and vRotation, rather than setting them to an arbitrary value and having the camera jump each time. The camera is generally free roaming "a fly cam" but when an object is selected, the user can hold shift to rotate the camera around the object. So I need to base hRotation and vRotation off of the coordinates of camera and object, here is my code so far, but the issue is that the Camera will mirror its rotation rather than allowing me to fully rotate. For instance I can rotate to the left but it snaps to opposite angle from the right. I know I probably need to invert the angle when something is less than something, but I can't figure out what it is...

    float distance = cam.getLocation().distance(RotationTarget);

    Vector3f diff = cam.getLocation().subtract(RotationTarget);

    vRotation = FastMath.acos(diff.y / distance);
    hRotation = FastMath.asin(diff.z / FastMath.sqrt((diff.x * diff.x) + (diff.z * diff.z)));

Thanks,
-Tim

sentences:
Calculate occluded parts for planet like object So I have camera position (it's dynamic), planet position (also dynamic), radius and coordinates for every side (node) corners and I want to hide side that is beyond horizon (with some safety margins). I think I could easily calculate in 2D using trigonometry, but in 3D have no idea right now. I found some code online:

TileNode.prototype.isWithinHorizon = function () {
  var r = this.master.getRadius();
  var camToTile = this.master.getCamToTile(this);
  var camToCenter = this.master.getCamToCenter();

  var camDistToCenter = camToCenter.length();
  var dotCtCc = camToTile.dot(camToCenter.divideScalar(camDistToCenter));

  return dotCtCc - this.scale*0.5 < (camDistToCenter - r*r/camDistToCenter);
};

but can't make sense of it, as it is not commented. Any help appreciated!

P.S. i hope i use the term "occluded" right here

sentences:
What technique should I use in a shader to give this reflective effect? I'm working on a top-down 2D strategy game written in Java with LibGDX (though really for the purposes of this question I'll be using GLSL).

I want to give metallic materials in the game a shiny effect - but not a lightsource-based specular highlight or anything similar, I'm after a kind of global shine or shimmer, much like the effect on the word "King" in this logo from King under the Mountain:

While I'm not looking for someone to implement this for me, as a bit of a newbie to shader programming, what kind of techniques or algorithms should I be looking at to give this kind of effect?

sentences:
how to link a c++ object to a local variable in Lua I'm completing my scripting interface with Lua, but recently I've stuck at some point. I have several functions for my Entitiy events like Update(). I have a function called create_entitiy() which instantiate a new entity from a given entity index:

function Update()
  local bullet = create_entity(0, 0, "obj_bullet")
end

create_entity returns a table which is the properties of the created entity. Now how can I make a connection between bullet variable and my newly created object?

Right now for previously added objects to the scene, I simply set a global table for each of them and then after every call to Update(), I go through registered names to find object tables and perform new changes. Like the one below:

function Update()
  if keyboard_key_press(vk_right) then obj_player.x += 3
end

I can get obj_player table because I know its name from C++, plus I can get it as a global table and simply reach for the first instance named obj_player.

Is there any solution for me to make bullet variable act like this?

I was thinking to get all local variables in Update() function and check for every one to see if is it table and it has an unique field attached to it like id, this way I can determine that this is an object table and do the rest of the process.

By the way, is this interface going to work easier with luaBind if I implement it?

Bottom line:

How can I make a local variable in Lua that receives a table from create_entity function and track that local variable to capture it from C++.

e. g.

function Update()
  local bullet = create_entity(0, 0, "obj_bullet")
  bullet.x = 10 <== Commit a change in table
end

Now I want to get variable bullet from C++. And it's not just this variable, there might be a ton of these local variables with different names.

sentences:
Is this aiming mechanic usable in a third-person top-down game? Long story short: I've switched to a third person - top down perspective. The camera is fixed and looks down at the player. How can I implement 3d aiming ? The player needs to aim left and right as well as up and down.

details:
I've ditched the first person perspective in my current project - I wouldn't call it a game yet, it's more of a test-case. Instead I'd prefer a third person perspective with the user looking down at the player (slightly tilted to the back). The implementation is no problem, the aiming system is. Although the player will be rarely armed there will be situations where he's allowed to return fire.

This is more complicated than it sounds since the player needs to aim up and down. I hope you can envision my problem. In an ego shooter moving the mouse let's the player look up/down and left/right . In a top/down game the mouse points in the direction the player is moving. I'm currently casting a ray from the camera and the player looks at the first collision point of that ray. That means to aim at an enemy the player just needs to hover the mouse over him. Not very comfortable, no skill required at all.

I've thought about this: The player is always centered on the screen, the mouse 2d coordinates are computed to a 2d vector that is used as the player's viewing direction. This way he couldn't look up or down but then again that's only visuals the camera wouldn't be moved in any case. In order to shoot the player presses the right mouse button. The mouse movement is now mapped to the player just as in any common shooter. Mouse up -> look up. Mouse left -> turn left. Don't misunderstand me: I don't intend to move the camera only the player charaTo show the player where he's aiming I then draw a line to his target (or a cone for less precise weapons).

What are possible pitfalls ? Have you done something like this and can tell me if it's usable ? I've never played a game that worked this way and just wonder if it's a good idea

UPDATE: I've accepted an answer but of course I'm still interested in other options. If you've got a good idea that fits here I'd highly appreciate it.

sentences:
How can I port my Gear VR app (Java, OpenGL ES) to Unity? I want to port my Gear VR app (created in Java using the official framework) to Unity, so I can also support Microsoft's new-ish VR headsets (not talking about the Hololens!).

In my current app I'm using OpenGL ES to draw everything I need (the app reads coordinates and additional information about what it has to draw from a .txt file), which is:

GL_LINE_STRIP: The .txt file gives it a bunch of coordinate triples (x, y and z, so single vertices), it then has to automatically connects them (usually without loops)
Kind of plane: Either display a rectangular plane with a texture (using the Gear VR framework's "GVRSceneObject") OR create an outline (usually first point = last point) that then gets filled in a specific color (GL_TRIANGLE_FAN) AND that is a little bit transparent - if it includes concave areas, it's using GL_TRIANGLES and the .txt file has coordinates for single triangles that have to be displayed at the same time and filled (it's still a single object/mesh!)

What I need Unity to do (with 1. and 2.):

Display a couple of 1. (could be up to 50 or more) and 1 of 2. at the same time (there'll never be more than 1 of type 2.!)
Remove all of 1. (that are displayed at the same time) or 2. from the scene and/or replace them with a couple of different 1. or another 2.
Group a couple of 1. together, so you can remove them at the same time (which would make stuff a lot easier)
Read .obj files (including their texture) from internal storage (Android) or the HDD (Windows) and display it/them instead of 2. (the .txt file includes the path to the file and texture)

Everything has to happen at runtime, since the app doesn't come with any .txt files or pre-imported .obj scenes/objects!

My question is:

How can I do this with Unity, targeting Windows and Android?

sentences:
Implement Hearthstone disenchant extra cards particles How would you implement the hearthstone flying particles? like you can see here
These are not just simple particles flying from a to b... I think that they are flying in some random spline, and stretched...

Any information, even to something similar that you can point me to would help!
Thanks

sentences: How to set HUD elements position and size depending of resolution How can I set HUD elements' position and size when changing resolution and maintain the desired layout? All HUD elements (including menu items such as play button, setting button etc) need to get some scaling.

sentences:
Performance/architectural implications of calling SpriteBatch.Begin/End in many different places? I notice some code samples only call SpriteBatch.Begin and SpriteBatch.End in the game's main draw method and then draw everything within that method through direct SpriteBatch.Draw calls or indirect calls through method calls from other classes that store a reference to the SpriteBatch object and then use its Draw method.

Another approach I see is that in these separate classes they call SpriteBatch.Begin and SpriteBatch.End before their drawing code in each of these classes and don't rely on already being contained within a drawing session (between a begin and end call).

My question is two-fold. Firstly, as the title suggests, what are the performance implications of calling SpriteBatch.Begin/End in all these separate classes so often (once per class per drawing update) versus just calling it the one time each update. Secondly, and this question is a a bit more subjective but, which design is generally preferable?

Thanks.

sentences:
Outsourcing mobile app development, but royalty-based? Terribly sorry if this is in the wrong StackExchange site, but it looked closest to my question.

I have an idea or two floating around in my programmer's brain for mobile apps on Android or iOS. Thing is, I can't spend months programming it after my day job just to see someone else go to market first. In the same vein, I don't want to dump tens of thousands of dollars to pay someone to do it outright. I know that in other industries, you can often get paid by offering up the idea as intellectual property, allowing another company to do the work while you collect royalty checks for coming up with the idea in the first place, assuming the developing company went ahead with it and it became successful.

Does such a thing exist in the mobile application development world? If so, any recommendations for trustworthy companies? Let's assume that it actually IS a decent idea, is well vetted out and planned, and does not exist in the marketplace yet.

sentences:
C# (Mono)/Java 3D Game Engine recommendation Can you recommend a good C# game engine for cross platform (Win/Mac/Linux, I don't care about consoles) development?

I've got some experience with raw OpenGL and I played around with Java bindings and the JMonkeyEngine. However I'm somewhat disappointed those solutions and I tried Ogre3D which seemed really promising but I would rather not have to develop with the PITA that is C++.

I've had a look at this list but it is pretty overwhelming. I'm not looking for a all-in-one solution, i.e. I don't really require support for networking, audio and all that jazz but it wouldn't hurt if it's supported.

Maybe there's also an awesome Java solution out there that I don't know about?

sentences:
Pathfinding with multiple actors moving in sync I am trying to implement a path-finding routine involving the following:

Multiple agents
Multiple Goals
Obstacles
Both agents move in sync, i.e. they both move in the same direction unless one is stopped by an Obstacle. See explanation below in the edit section.

See the following image for illustration:

A1 and A2 represent the starting position of two agents. The dark squares marked with "X" represent obstacles. "G1" and "G2" represent the final goal.

I played around with A* path finding algorithm, and it works great with 1 actor with one goal. However, I couldn't get it to work with more than one actor and goal.

Any suggestions and pointers about how to go about it would be very helpful.

Edit: Synchronized movement explained

If for instance, A1 is stopped by the obstacle but A2 can move, it is a valid option. A1 would stay in place but A2 will move.

Example:

Move Right: A1 moves to (2,1) and A2 moves to (2,7)
Move Right: A1 stays in place but A2 moves to (3,7)
Move Up: A1 moves to (2,0) and A2 moves to (3,6)
Move Up: A1 stays at (2,0) and A2 moves to (3,5)

sentences: Can you write games for Rock Band or Guitar Hero controllers in XNA? Can you use the XNA framework to write games for XBox Live Arcade that require Rock Band or Guitar Hero instruments?

sentences:
Wait for AudioClip finish before destroy Object If I Play the gun sound on my "bullet" object, how can I prevent the end of Audio sound if the bullet hit something so it destroy.
To clarify:

Bullet prefab -> Audio Source -> Audio Clip = MachineGun.mp3
PlayOnAwake = true

When I instantiate bullet, MachineGun AudioClip is played.
But the bullet is fast and hit something before the clip is end.
This Kill the machine audio effect making it irrealistic.

How can I tell Unity "Play the sound to the end, despite the object is destroyed".

I've tried

Destroy(gameObject, AudioClip.length)

But it seems not works

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:
Opengl create tunnel TRIANGLES and texture coords on a 3d path I have a path, lets say a bezier, or a circle.

I d like to make a continously 3d cylinder (tunnel) on it (R=0.5f)

How can I calculate tha TRIangles (TRIANGLE_STRIP) coordinate, and the texture coords right?

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:
web based networked game physics efficiency I am writing a web based game, using websockets. its pretty simple, two players shooting at each other with bullets that have acceleration from a starting point at an angle.

The client side (frontend in web dev terms) uses phaser.io with p2js for physics.

However after reading this post, i believe that it's smarter to do some of the physics for the players on the server side. Such as collision detections, and update the player positions at regular intervals to keep the two players at sync.

Now i have two questions

if i use the Box2d javascript port on nodejs on the server side to simulate server side physics, than is it just as efficient as using the native c++ one? seeing as from what i have read so far it seems the js ports aren't that well maintained, and they are js ported - on the other hand the js codes might be easier to deal with than the c++ ones.
using p2js on the client side and using box2d on the server. The server being authoritative, and sends regular updates (once every second) as to the actual positions of the players.  will the physics simulation be in sync (atleast to the user)? Theoretically i don't see any reason for it to not, given that both user has the exact same latency (this is assumed for sake of simplicity).

sentences: 2D Camera Movement Temporal Reprojection Having an Orthographic Camera with its View Projection Matrix given from the current and last frame, how to reproject the previous frame to the new one?

sentences:
How do I generate a torus mesh? I'm trying to programmatically generate vertices and indices for a torus. I found this piece of code somewhere, and it looks like it works, but I'm not certain it is correct.

With my little knowledge of trigonometry, I figured out how the vertex generation part works, but I'm stuck at the index buffer part (though I know what the modulus operator is used for).

Does the code work correctly? Can anyone explain what it does to generate the correct indices?

I tried to output the index buffer and noticed there's a triangle with indices (10,10,10), which is weird and makes me think this may be wrong. Plus the UVs look weird for the last 'slice' of the torus, as in this pic.

int sides = 10, cs_sides = 40;
float radius = 3.5 * 10.0;
float cs_radius = 0.75 * 10.0;

numVertices = sides * cs_sides;
Vertices = malloc(sizeof(Vertex) * numVertices);

numIndices = (2 * ((sides+1) * cs_sides) + cs_sides);
Indices = malloc(sizeof(GLushort) * numIndices);

int angleincs = 360/sides;
int cs_angleincs = 360/cs_sides;
float currentradius, zval;

//calculating the vertex array
for (int j=0, m=0; j<360; j+=cs_angleincs, m++)
{
    currentradius = radius + (cs_radius * cosf(j * D_TO_R ));
    zval = cs_radius * sinf(j * D_TO_R );

    int index = (m*sides);
    for (int i=0, n=0; i<360; i+=angleincs, n++)
    {
        Vertices[index + n].Position[0] = currentradius * cosf(i * D_TO_R ); // x
        Vertices[index + n].Position[1] = currentradius * sinf(i * D_TO_R ); // y
        Vertices[index + n].Position[2] = zval;                              // z

        Vertices[index + n].Color[0] = 1.0;
        Vertices[index + n].Color[1] = 0.0;
        Vertices[index + n].Color[2] = 0.0;
        Vertices[index + n].Color[3] = 1.0;

        float u = (float)i/sides;
        float v = ((float)j + u)/cs_sides;

        Vertices[index + n].TexCoord[0] = u;
        Vertices[index + n].TexCoord[1] = v;
    }
}

// cs_sides = 40
// sides = 10

int i=0, n=0;
//calculating the index array
for (;i<cs_sides; i++) {
    for (int j=0; j<sides; j++) {
        Indices[n++] = i * sides + j;
        Indices[n++] = ((i+1) % cs_sides) * sides + j;
    }

    Indices[n++] = i * sides;
    Indices[n++] = ((i+1)%cs_sides) * sides;
    Indices[n++] = ((i+1)%cs_sides) * sides;
}

sentences: libgdx-using more than one class Hi i am very new to programming and in this community,so im recently studying on how to develop games with libgdx and all the tutorials only have one class and do all the things in that class,but is it possible to use more than one class?(ex:individual class for player, mobs , etc) thanks!

sentences:
trouble getting correct transforms for multiple meshes from assimp importer I have had excellent success in extracting almost everything i need from a collada file that i imported with assimp, however I am struggling to get the correct transforms for each mesh in the file. Each individual mesh has correct vertex data but is not transformed relative to the others.

At first I thought my issue was that I simply wasn't applying the hierarchy of transforms for the meshes, and i read http://www.assimp.org/lib_html/data.html based on an answer from another thread and implemented the void CopyNodesWithMeshes function that is given in pseudo-code there.  However I have found that this didn't help as each mesh is a child of the root node and has only the identity matrix transform for the root and each of the mesh nodes (thus the combined transform for each mesh is identity also).  The hierarchy in the scene appears as follows :

           sceneRoot (identity)
               |
-------------------------------------------------
|               |                  |            |
Mesh0           Mesh1           Mesh2           Skeleton
(identity)      (identity)      (identity)      |
                                                ------------
                                                |    |   (etc)....
                                                (not identity)

There is no reference in the Skeleton to any of the mesh nodes as far as  i can tell.  I have also extracted the skeleton and bones for animation and they work but each mesh is simply at my origin since i cannot extract their transforms.

So i tried to load the model directly with assimp viewer and the 3 meshes load correctly from the model file and are in their correct relative positions.  I even tried to step through the loader code of assimp viewer and as far as i could tell it was getting identity matrix transforms just as i was for the 3 meshes from the sceneNode hierarchy.  But somehow assimp manages to render the 3 meshes correctly.

I am stumped at this point - does anyone know what i might be missing here?

Thanks

I am calling the following from assimp

const aiScene* scene = aiImportFile (fullpath, aiProcess_Triangulate
    | aiProcess_FlipWindingOrder);

And using the following code that i wrote to extract the combined transform for each mesh (though it doesnt do me any good since i get the identity transform for each):

//based on pseudocode of assimp http://www.assimp.org/lib_html/data.html
void CopyNodesWithMeshes(const aiScene* scene, aiNode* node, Matrix& accTransform)
{
    Matrix transform;
    Matrix nodeTrans;
    convertAssimpMatrix(nodeTrans, node->mTransformation);
    //transform = node.mTransformation * accTransform;
    multiplyMatrix(transform, nodeTrans, accTransform);

    // if node has meshes, create a new scene object for it
    if( node->mNumMeshes > 0)
    {
        //new SceneObject
        SceneObj& so = s_sceneObjs[s_numSceneObjs];
        so.numMeshes = node->mNumMeshes;
        for (int i=0; i < node->mNumMeshes; ++i)
        {
            so.mesh[i] = scene->mMeshes[node->mMeshes[i]];
        }
        s_numSceneObjs++;
        assert(s_numSceneObjs < eMaxSceneObjs);
        memcpy(&so.transform, &transform, sizeof(so.transform));

    }

    // continue for all child nodes

    for (int i=0; i < node->mNumChildren; ++i)
    {
        CopyNodesWithMeshes(scene, node->mChildren[i], transform);
    }
}

sentences:
Why lib3ds can't open this max model? I'm using lib3ds's 3dsplay example to load this model, whose suffix is .max
but get this error:
3dsplayer: Error: Loading 3DS file failed.

But it can load the .3ds model shipped with lib3ds.
Why lib3ds can't open this .max model?

sentences:
How can I animate a recursive algorithm? Say I have a recursive algorithm, for example one that generates a random tree:

// Pseudocode, just a simple algorithm: it isn't perfect.
function generate_branch(angle, length, current_depth, max_depth) {
  var branch = Branch(angle, length); // creates a new branch
  if (current_depth == max_depth) {
    return branch;
  }
  current_depth++;
  // random_int(min, max)
  branch.subbranches[] = generate_branch(random_int(0, angle + random_int(-30, 30)),
                                         random_int(0, 20)
                                         current_depth,
                                         max_depth);
  // ^^^^ recursion
  return branch;
}

var trunk = generate_branch(0, random_int(10), 0, 5);
RenderTree(trunk);

The problem is that this will render the entire tree in one frame. If I want to animate this (i.e. grow the tree over time), how would I do that? What is the best way to do this?

The game uses a game loop.

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:
switch between player camera/non-camera positioning Sorry if this sounds ambiguous. But I am writing a traditional top down game.
And normally the player would be centered in the middle while moving the orthographic camera. However, I would like this to be dynamic. Therefore, use player.setPosition(x,y) near screen boundaries but center on player if its far from screen boundary.

This is some sample code:

public void centerCamOnPlayer() {
         camera.position.set(player.getX() + (player.sprite.getOriginX()),
                             player.getY() + (player.sprite.getOriginY()),
                             0);
}

public void update() {
     boolean shouldCenterOnChar = ???;
     if (shouldCenterOnChar) {
         centerCamOnPlayer();
     } else {
         player.setPosition(x,y);
     }
}

Therefore render will call update(). However how do I determine the shouldCenterOnChar?
I tried using frustum.pointInFrustum but its only when the sprite moves completely out of screen. I'm sure there is a better way to switch dynamically. Any one has an idea? Tks!

sentences:
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: Problems setting up dx12 I'm following the Frank Luna directX12 book, I have installed the windows 10 SDK etc but now, when I compile any project from his demo they wont build. Error I am getting is Cannot open source file  which I have never had a problem including before I installed windows 10 SDK, any suggestions? If any more info is needed let me know

sentences:
Premultiplied alpha, yea or nay? Should I be using premultiplied alpha?  Reading Tom Forsyth's article it seems a nobrainer.  Premultiplied alpha (AKA additive blending) is superior in every sense.
However, premultiplied alpha seems to have one major drawback, it's not well supported with tools.

Do you/have you used premultiplied alpha?

How is the tool support?

In particular, I don't think gimp will edit premultiplied alpha images well.  Are there any gimp plugins to export premultiplied alpha?  How about an external tool?

sentences:
How to Divide Responsibilities Between a Two-Man Group? A partner and I are in the midst of creating a (not so) simple game via C++ and SFML (2D). We have both created some simple games (not together) and would like to start work on a more serious, larger project that challenges our abilities to program, interact with large code as well as working together without getting in each other's way.

The problem is the getting in each other's way- well, not yet at least.

We had our first group session today (us two working on the project, one to-be tester and a friend of ours) and wrote down some ideas. It's going to be a birds-eye perspective zelda-like (from SNES) game with a streamlined map and quasi-linear gameplay like Gothic (open world, but you'll likely get yourself killed if you wander around too much).

Needless to say, I'm not sure if we're aiming too high for the moment, but our biggest concern is the division of responsibilities. Our first impulse was to work on aspects of the game that had nothing in relation to the other (I would work on the menu, he would work on the map, for example).

Our next impulse was to work on closely-related things in a list-manner. (First the menu, then a map, then the character, then the monster, etc) so we can, piece-by-piece, see our code coming to life in an orderly fashion.

We haven't picked a VCS yet, but I'm thinking it's going to be Mercurial for the simple reason that I have heard good things of it (neither of us have yet to use a VCS).

Question:  What would be the proper way to divy up the responsibilities between the two of us? How should we start, how should we continue and how do we do it together with maximum efficiency? Any other tips would be greatly appreciated!

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:
Throw ball - distance and force I have a question, I need a formula to calculate the distance and a force based on the speed that drags the finger up on the phone. And is there any way I can get a look? And also shows the trajectory of the ball with lines ...

An example is the Pokemon Go, see the image (the user presses the ball and drags the finger upwards).

Are there any examples so that I can study?

sentences: How to flip a box2d body when it can't move forward? LibGDX I'm attempting to create a simple enemy for a platformer. It should move forward constantly until it hits something like a wall, and then it should flip and move forward the other direction. How might I accomplish this?

sentences:
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:
3D Studio MAX dxf model to OpenGL and DirectX Main Question

I saw this Loading and Animating MD5 Models with OpenGL an old post explaining .md5mesh .md5anim files. Is there any similar alternate mechanisms?

Additional Questions

1.) Is there an open source tool or a Plug in for 3ds max to convert a .DXF file to such files which can be used in 3D OpenGL+DirectX game programming.

2.) If I am developing a game in this approach how to make these model files encrypted and make big single file which contains all this file, so that the user cannot crack/hack it?

3.) If I am providing an update via an online gaming server, then how to I update this models and keep it encrypted again?

sentences:
How to make borders glow in a 2D game? How can I make the borders (stationary / non moving) of my 2d Unity game glow?
I need a method that is not so expensive. I've read that post processing is very expensive, but I quite liked adding bloom to my scene. It was pretty straight forward.
But now I'm reading that one shouldn't use it, it's expensive, not so good etc.

sentences:
Aligning a gameObject to position and normal of another gameObject inside Unity So I am instantiating a GameObject (the one with cities and trees in the image below) and trying to align it to a hex tiles on a Sphere.

So after I instantiate the gameObject, I ray-cast to get it aligned to the tile normal and tile position but its always a slight offset.

    int random = Random.Range(0, middleIceTiles.Count);
    GameObject tile = middleIceTiles[random].getTileGameObject();
    HexCity cityObj = new HexCity(city, "city-" + middleIceTiles[random].getTileName());
    GameObject cityDummy = Instantiate(cityObj.getCityObj(), tile.transform.renderer.bounds.center + new Vector3(0,0.2f,0), Quaternion.identity) as GameObject;

                        //do a raycast here
    RaycastHit hit;
    Vector3 normal = Vector3.zero;
    if (Physics.Raycast(cityDummy.transform.position, cityDummy.transform.up * (-1.0f),out hit, 25.0f))
    {
       if (hit.collider.gameObject == tile.gameObject)
         {
            Debug.Log(" HIT SNOW TILE CITY " +tile.name+ " TILE TEXTURE " +HexTextureInfoDict[tile.name]);
            normal = hit.normal;
         }
    }
   cityDummy.transform.rotation = Quaternion.FromToRotation(Vector3.up, normal);

So I am getting a random hex tile on the sphere. Then instantiating the cityObj to the tile position. Doing a raycast from the cityObj to the tile to get the tileNormal and orienting it to the tile.

So on each level load, the city gets placed on a random hex tile. But currently, the orientation as well as the position is not exact and always at some offset position from the current tile.

What am I doing wrong here? Is there any other way I can achieve this?

Also, one possible solution is to snap the vertices of the hex gameObject to the hex tile itself. So essentially the 6 vertices of the hex tile has to match the 6 vertices of the hex gameObject. Is this possible? I have never dealt with meshes information of gameobjects inside unity before so I am not sure if this would work?

Something I tried was this..

 Mesh TestMesh = testTile.GetComponent<MeshFilter>().mesh;
 Vector3[] vertices = TestMesh.vertices;

And then snap these vertices of the hex tile with vertices of the gameObject that I want to place on it by looping through all points but that doesn't work either..

sentences:
MonoGame - correct overloads for SpriteBatch.Draw flipping horizontally I want to flip my sprite horizontally while drawing and I can't figure out how to use the correct parameters without either an error or a warning about the method being obsolete.

This is what I assume it would be:

sb.Draw(NumbersGame.Arrow, resolutionRightArrow, Color.White,
SpriteEffects.FlipHorizontally);

Except it comes up for errors for the color (cannot convert from color to rectangle) and the SpriteEffects bit (cannot convert from sprite effects to rectangle).

What is the correct way to lay out these arguments?

P.S: When I provide all the default values (says it's obsolete):

sb.Draw(NumbersGame.Arrow, resolutionRightArrow, null, null, null, 0f, null,
Color.White, SpriteEffects.FlipHorizontally);

sentences:
Resolution problems when porting a Unity game to Android So, I'm porting a game to the Android for the first time in Unity3D. And I've run in to a few problems along the way. My current problem is the resolution doesn't seem to be right, it cuts off the edges of the screen and my scrolling stops for scrolling the screen left/right are no longer in the right place.

After doing a bit of research, a lot of people say you need to make your game Resolution Independent to be able to run on all Androids/Iphone/Ipad. Is this true? If so, how do I go about doing that? If not, how can I help fix the resolution so when I port to mobile devices it looks right?

EDIT:
I still don't really have what I need, resolutions still aren't working properly even with the code and tricks listed below. I need some way for the resolution to adjust based on the device. For some reason when I try to retrieve the resolution of a device using Mungoid's code it returns 0x0

sentences: What should be created first in a video game? When starting developing a video game, should one focus on creating the environment (buildings, trees, mountains etc) first or the A.I. (Playable character, NPCs etc)?

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:
How do I update individual sprites within a spritegroup in pygame? I have a for loop that takes values from a text file, and then creates and adds a bunch of sprites to a group platformlist_list. The for loop will continue until every line of the text file is read.

self.object = Wall(firstarray[0] , int(firstarray[1]), int(firstarray[2]))

print int(firstarray[3]), ' x ', int(firstarray[4]), ' y'

self.object.rect.x = int(firstarray[3])
self.object.rect.y = int(firstarray[4])

initialization.platform_list.add(self.object)

What I want to be able to do is access these created sprites and move them, but if I use this code to try and move all of the sprites in the platform_list group:

if (loadterrain.character.direction == self.left):
    loadterrain.wall.rect.x += self.movementspeed
    loadterrain.object.rect.x += self.movementspeed
if (loadterrain.character.direction == self.right):
    loadterrain.wall.rect.x -= self.movementspeed
    loadterrain.object.rect.x -= self.movementspeed
    loadterrain.floor.rect.x -= self.movementspeed

The only object on screen that will move is the last object that my for loop has created.

I want to be able to access and modify the x and y positions for every sprite inside of the platform_list but have no idea how to do so because from the research I have done indexing the platform_list is unreliable as it is not ordered.

What is the best way for me to access and modify the positions of all the sprites in that group?

sentences: How do I implement an AutoParallax Background in AndEngine GLES1? I'm using AndEngine GLES1. In my game, I use AnalogOnScreenControl to move a sprite and when it moves vertically, the background image also moves vertically. I want to do something like this: that is in this link.  I know that AutoParallax Background or BackgroundParallaxScrolling may be used. But how do I use it in my game?

sentences:
How to find point on a circle that's opposite another point? How do I find the coordinate of point and angle value on circle sprite which placed on opposite side of sprite from a touch point and the center point of the sprite?

I know A position, B position and sprite circle size. How do I calculate the position of C? and the angle it is around the sprite circle?

sentences:
How do I calculate NDC coordinates in a fragment shader? I have some weird problem going on in my openGL shader.

First,, I pass the viewspace position from the vertex shader to the fragment shader like this:

vec4 view_pos = V * M * vec4(world_position.xyz, 1.0);

Then, in the fragment shader, I do this:

vec4 clip_pos = P * view_pos;
vec2 ndc_xy = clip_pos.xy / clip_pos.w
vec2 ndc_fragcoord = 2.0 * gl_FragCoord.xy / viewport_wh - 1.0

I would expect that ndc_xy is the same as ndc_fragcoord; however, when rendering them to textures, they are not nearly the same:

Can someone explain to me the differences? How can I get the same result in ndc_fragcoord by using view space position or vice versa?

This is important information for me for a later stage, when reconstructing the view space position from the depth. I have already been sitting on this the whole day, and am close to despair.

sentences: How do I implement collision detection with a sprite walking up a rocky-terrain hill? I'm working in SDL and have bounding rectangles for collisions set up for each frame of the sprite's animation. However, I recently stumbled upon the issue of putting together collisions for characters walking up and down hills/slopes with irregularly curved or rocky terrain - what's a good way to do collisions for that type of situation? Per-pixel? Loading up the points of the incline and doing player-line collision checking? Should I use bounding rectangles in general or circle collision detection?

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:
Physics.CheckSphere is not working I try to use Physics.CheckSphere to check if a coordonate is empty.
I use three for loop to cycle threw a 2 x Y x 2 chunk. The problem is that it return true if the corner is touching the coordonate

and its actually not even touching it, since I use a 0.5 sphere radius:
if(Physics.CheckSphere(new Vector3(x,y,z), 0.5f) == false)...

(by the way the white cubes you can see on the picture is only to visualize where it detected empty space, they dont have any collider enabled)

and the chunks have a mesh collider, so why is it returning true when its no even touching it ?

if(Input.GetKeyDown("i"))
    {

for(int y = 0; y <= amp + 3; y++)
{
    for(int x = 0; x <= chunkSize - 1; x++)
    {
        for(int z = 0; z <= chunkSize - 1; z++)
        {
            if(Physics.CheckSphere(new Vector3(Mathf.Round(x),Mathf.Round(y),Mathf.Round(z)),0.5f) == false)
            {
                Instantiate(grass,new Vector3(x,y,z), Quaternion.identity);
                dontPlaceHere.Add(new Vector3(x,y,z));
            }
        }
    }
}
}

sentences:
How to call a method after a yield instruction in the same frame? When I run this script...

int frameCount;

void Start()
{
    frameCount = 0;
    StartCoroutine(first());
}

void Update()
{
    frameCount++;
    Debug.Log("Frame " + frameCount);
}

public IEnumerator first()
{
    Method1();
    yield return StartCoroutine(second());
    Method2();
}

public IEnumerator second()
{
    Method3();
    yield return null;
}

void Method1() { Debug.Log("Method1"); }
void Method2() { Debug.Log("Method2"); }
void Method3() { Debug.Log("Method3"); }

I get the following output:

Method1
Method3
Frame 1
Frame 2
Method2

How can I call all three methods in same frame without changing the code structure? The output i want:

Method1
Method3
Method2
Frame1
Frame2

Note: If this is not possible, please show me whether i can get this output (without changing the code structure):

Method1
Method3
Frame1
Method2
Frame2

sentences:
To extract Grabpass image as texture2d via script We applied it to the plane object using Grabpass.
I want to import the image shown in plane through script.
I want to make the imported image in texture2d format.
Is there a way?
Below is the relevant code.

sentences:
OnCollisionEnter2D just flat out not running for certain objects I am working with the Unity3D Engine in 2D mode. Currently I am trying to make a circle collider bounce off of a composite collider for the walls of my game. The only issue is that for some reason the OnCollisionEnter2D function does not seem to even trigger when the circle collider hits the walls. I have used the log to determine this. I am curious as to why it has this behviour, since it does end up triggering when the player contacts the circle collider? Here is the important parts of the script:

public class sword : MonoBehaviour {

public Rigidbody2D rb;
public CircleCollider2D coll;

public float speed;
public Vector2 trajectory;
public GameObject Player;

// Use this for initialization
void Start () {
    speed = 0.0f;
    anim = Player.GetComponent<Animator>();
}

private void OnCollisionEnter2D(Collision2D collision)
{
    Debug.Log("collided");
    if (collision.gameObject.tag == "player")
    {
        transform.position = new Vector2(-1000, -1000);
        Player.GetComponent<movement>().equipped = true;
    }
    if (collision.gameObject.tag == "solid")
    {
        ContactPoint2D otherObject = collision.contacts[0];

        Vector2 hit = otherObject.point;
        Vector2 normal = otherObject.normal;
        trajectory = Vector2.Reflect(trajectory, normal);

    }
}

private void FixedUpdate()
{
    //constantly calculating new velocity
    rb.velocity = speed * trajectory;
    speed = speed * 0.93f; //drag
    if (speed < 0.0001f)
    {
        speed = 0.0f;
    }
    if (speed > 1)
    {
        Physics2D.IgnoreCollision(Player.GetComponent<CircleCollider2D>(), coll, true);
    }
    else
    {
        Physics2D.IgnoreCollision(Player.GetComponent<CircleCollider2D>(), coll, false);
    }
}
}

More Details: My speed variable is set from a separate script, in case you are wondering. Everything is on the layer 0.. The Rigidbody for player is dynamic, for the ball it is kinematic, and for the walls it is static. Also here is an image of what the game screen would look like, I've labelled the walls and the circle collider (used for a sword).

Thank you.

sentences:
How do I find all game objects with particular name? I'm trying to mimic FindGameObjectsWithTag with FindGameObjectsWithName. I know using tags is faster, but I'm trying create a way to search for objects I spawn with a child object I name on instantiation through the inspector.

My goal is create multiple enemy spawners. My current spawner has a drag and drop variable for enemy prefabs. It looks for enemies tagged "ReSpawn", then checks if that length is below a value, to start spawning more. I would like to upgrade my current single spawner to still check for enemies named "ReSpawn", but then check if those respawns have a child object a name specified in the editor.  This way, I can set the enemy spawners anywhere (e.g. near water, tall grass, forests, etc), and when I defeat one, the specific spawner will instantiate one of its opponents for that area.

Here is my code, so far:

var ThisSpot:String;
var Oppos : GameObject[];
var OppoCount : GameObject[];

var HowMany = 3;
var spawnSizeArea = 25;

function Start() {
    StartCoroutine ("Spawn");
}

function Update () {
    OppoCount = GameObject.FindGameObjectsWithTag("Respawn");
    // OppoCount = GameObject.FindWithName(ThisSpot);  This is what I am trying to achieve

    if(OppoCount.length < HowMany) {
        StartCoroutine ("Spawn");
    }
}

function Spawn() {
    var length = Oppos.length-1;
    var index = Mathf.Round(length*UnityEngine.Random.value);
    curSpawn = Oppos[index];

    var xz = Random.insideUnitCircle * spawnSizeArea;
    var newPosition = Vector3(xz.x,0,xz.x)+transform.position;

    yield WaitForSeconds(Random.Range(70,120));

    Instantiate(curSpawn, newPosition, transform.rotation);

    // Then I could use these 2 lines of code below to use multiple spawners
    //var newOp : GameObject = Instantiate(curSpawn, newPosition, transform.rotation);
    //newOp.transform.Find("fighter").gameObject.name=ThisSpot;

    StopCoroutine("Spawn");
}

sentences:
Best solution for "level string"? I have a game that generates a random level map at the start of the level. I want to implement some way to save and load the level.

I was thinking maybe XML would be a good option for saving all the variable, then it would be easy for me to build something that can parse that XML and generate the exact same level.

But XML is probably overkill for my needs. I remember back in the day with the old Sega console that didn't have the ability to save your game (I think the Worms game did it too), that they would give you a bunch of character that you could write down. If you punched in that string later on, it would load the exact level.

Would a "level string" be a good option? Would it be some kind of "base60" conversion? How would I implement this?

sentences:
Single object decreasing frame rate from 60 to 5 I'm new to game development and I'm not sure what I've done wrong. My game runs at about 60 frames per second until I add one instance of a model I made in Blender. As soon as I add it the frame rate drops between 5-6fps and even the Unity UI seems sluggish.

I created the model using Blender v2.77a and it has 25,925 vertices, 22,919 faces and 49,224 triangles in 3 objects plus an armature, camera and hemi light source (6 objects total). Two of the objects contain very little. They were made just for me to attach a line renderer in Unity. The third object contains the entire model so there is only 1 UV map. I created about 5 materials, Baked them to an image (using the Blender Game engine), then deleted the materials and made a single material to apply the image. Then I exported an fbx file (mainly so I could adjust the axis to match unity) and imported that along with the texture image in to Unity.

For some reason two volumes in my model also render in Unity with the faces facing the camera invisible. If I move the camera those faces become visible and the others become invisible.

My PC is a few years old now so it's not the fastest. But I didn't expect it to struggle with one object. I'm running an Intel Core2 Quad Q9400 (2.67GHz), 8GB RAM and a single Radeon HD5770. The hard drive is a standard SATA 2 with 7.2k spindle and I'm using Win 10 x64.

If you need any more info, please let me know.

Edit: Here's a screenshot of the Profiler.

sentences:
How to make controlled exchanges in an online-game? There is an online game in which you can collect things of different values: ordinary, epic, legendary. The cheapest things are ordinary, the more expensive are epic, and the most expensive are legendary.

If you have collected 10 things of the same value, then you can exchange them for one thing with a value higher. For example, if you collected 10 things of epic value, then you can exchange them for one legendary thing.

After such an exchange, the user can go into minus or plus, because 10 things with a value lower can total be worth more than one thing with a value higher or vice versa. The user can drop a thing worth 25% to 400% of the exchange value.

How can I make such exchanges controlled so that someone can get a good profit from these exchanges, someone stay at zero, and someone go minus? But the most important condition is that, as a result, the online game is in plus with exchanges.

sentences:
How can I simulate a limited (256) color palette in OpenGL? On Twitter, I found this screenshot of a game in development:

The image on top seems to be without any color limitation. But the two other pictures at the bottom have a 256 color palette.

I want to achieve a similar effect in my game (I am using OpenGL). How can I do so?

sentences:
Problems with imported model animation from Blender to Unity I've downloaded a free sculpted arm and created my own rig and animation for it in Blender. So here is how it looks like in Blender :

And the model itself looks fine in Unity, but as soon as the animation starts, the vertices are partially glued together like this :

I've simply imported the .blend file for the moment, is there some better way to import this?

sentences: Prediction of collision place and time in Unity I have two moving objects. I have chosen trajectories for objects that they would definitely collide if they don't change speed or trajectory. Is there easy way to check at which point and time the objects will collide with given parameters (current object positions, their velocity vectors and speeds or any other parameter accessible from Unity)?

sentences:
How does the SNES' Mode 7 sprite perspective projection work? I've always wanted to know how to replicate the old Mode 7 graphics mode of the Super NES. It was frequently used for a pseudo-3D effect in racing games like Top Gear (gameplay video).

Top Gear ⓒ Gremlin Graphics. Image credit: Phil at tasvideos.org.

Every explanation I can find seems a little too complex for me.

In simple terms, how does Mode 7 work?

sentences:
Can CCAnimations be paused? I am new to cocos2d. I am using CCAnimation. It's working fine, except I want to pause the animation occasionally. How do I do this?

Here's what I'm doing so far:

[mySprite runAction:[CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim]]];

sentences:
How do I tell if my enemy can see my player? Given a player and an enemy with position, and given the direction vector of each, how  can I tell if one can "see" the other?

In other words, how do I test if one position with direction is in front or behind another position with direction?

For my purposes, 'in front of' means directly in front of, or 90 degrees to either side.

sentences:
Masking OpenGL texture by a pattern Tiled terrain. User wants to build a structure. He presses build and for each tile there is an "allow" or "disallow" tile sprite added to the scene. FPS drops right away, since there are 600+ tiles added to the screen. Since map equals screen, there is no scrolling. I came to an idea to make an allow grid covering the whole map and mask the disallow fields.

Approach 1:

Create allow and disallow grid textures.
Draw a polygon on screen.
Pass both textures to the fragment shader.
Determine the position inside the polygon and use color from allowTexture if the fragment belongs to the allow field, disallow otherwise

Problem: How do I know if I'm on the field that isn't allowed if I cannot pass the matrix representing the map (enum FieldStatus[][] (Allow / Disallow)) to the shader? Therefore, inside the shader I don't know which fragments should be masked.

Approach 2:

Create allow texture.
Create an empty texture buffer same size as the allow texture
Memset the pixels of the empty texture to desired color for each pixel that doesn't allow building.
Draw a polygon on screen.
Pass both textures to the fragment shader.
Use texture2 color if alpha > 0, texture1 color otherwise.

Problem: I'm not sure what is the right way to manipulate pixels on a texture. Do I just make a buffer with width*height*4 size and memcpy the color[] to desired coordinates or is there anything else to it? Would I have to call glTexImage2D after every change to the texture?

Another problem with this approach is that it takes a lot more work to get a prettier effect since I'm manipulating the color pixels instead of just masking two textures.

varying vec2 TexCoordOut;

uniform sampler2D Texture1;
uniform sampler2D Texture2;

void main(void){
    vec4 allowColor = texture2D(Texture1, TexCoordOut);
    vec4 disallowColor = texture2D(Texture2, TexCoordOut);

if(disallowColor.a > 0){
    gl_FragColor= disallowColor;
}else{
    gl_FragColor= allowColor;
}}

I'm working with OpenGL on Windows. Any other suggestion is welcome.

sentences:
Add 1 to a PlayerPref float if a day has passed in Unity 2D I'm making a daily rewards system in my Unity 2D game. For each real-life day the user logs in (not necessarily consecutive) the player earns a Reward Point. Reward Points do two things:

Increase the rarity of what the player may obtain from Reward Chests.
Increase the frequency that a player may open a Reward Chest. The frequency starts at 24 hours, and for each Reward Point, it is decreased by 24 hours. (The frequency a player earns a Reward Point is not increased, just the frequency that the player can open a chest.)

I am asking how to check if a day has passed since the player last opened the game, and, if they have, add 1 to a PlayerPrefs float (this float contains the amount of Reward Points). I am familiar with Time, but I'm not sure how to accomplish my goal with it.
.

sentences: Unity - Custom aspect ratio in build I have made a game that was supposed to be for mobile but now I need to build it for PC. I want the aspect-ratio to be 2:3 but as you can see on the image that doesn't exist. How do I add a custom aspect-ratio for the build?

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 load normals for a model from texture2d? I know i can do this through custom shaders, but i want to know is it possible to set it through xna itself. As for each effect i have pick normals from a texture2d, i want to change normals of model.

I have done this much, but i don't know how to go further??

  foreach (ModelMesh mesh in Home.Model.Meshes)
       {
           if (mesh.Name == meshName)
           {
               foreach (ModelMeshPart part in mesh.MeshParts)
               {
                   VertexPositionNormalTexture[] normals = new VertexPositionNormalTexture[part.VertexBuffer.VertexCount];
                   part.VertexBuffer.GetData<VertexPositionNormalTexture>(normals);

                   Color[] data = new Color[normalMap.Height * normalMap.Width];
                   normalMap.GetData<Color>(data);
               }
           }

       }

Thank you

sentences:
Algo for given an amount of XP, find a character's level In a RPG context, what are the ways to quickly find a character's level, given his XP? There are two cases which I am looking at:

For when a formula is defined, like in the case of D&D, which is N = N*(N-1)*500, where N is the desired level.
When no formula is defined, each level has an amount of XP require which is defined by a table.

I guess the easiest way is to do a for loop and subtracting the XP required for that level from the character's XP pool, till he reaches a point where you can't attain the next level. What other ways are there to, given a character's XP, to find his level?

Edit: The language is PHP

sentences:
User input in game loop I am building a simple multi-player fly-around-a-3D-world game in Javascript/webGL/websocket (Chrome, Firefox mostly).

How should I handle and process user input?

My preliminary design (untested) is to first just track which keys are down in the event handler:

var keys = [];

document.onkeydown = document.onkeyup = function(evt) {
   keys[evt.charCode] = evt.type == "keydown";
   keys[CTRL] = evt.ctrlKey;
   keys[SHIFT] = evt.shiftKey;
   websock.send(JSON({time: (new Date()).gettime(),
      down: evt.type == "keydown",
      key: evt.charCode,
      shift: evt.shiftKey, ctrl: evt.ctrlKey }));
};

and then, in my requestAnimationFrame callback, compute how many time-slices (say 20 per second?) have elapsed since the last render callback, and then compute that many time-steps using the booleans in the keys array to determine if to apply a left bank, right bank, up down and accelerate and so that time-step for each player.

How effective / responsive is this?  Is there a better way?  And is there a neater way to deal with latency than just backdating changes for other user's ships?

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:
Problem with collisions with tiles, using AABB After having a little look around about collisions. I can't seem to find what i'm doing wrong every time i touch the bottom of the tile it send's me through it and throws me out to the right of the tiles. I maybe going about this the wrong way if someone could help i'd be very grateful i'll copy all the relevant code down below.

void Game::update(float dt)
{
//check collision with world
vector<Tile>* world = level.getLevel();
for (int i = 0; i < (int)world->size(); i++)
{
    if ((*world)[i].isAlive())
    {
        //if "alive" check collision
        //world tile that are not alive don't do checks
        if (checkCollision(&mario, &(*world)[i]))
        {
            mario.collisionResponse(&(*world)[i]);
        }
    }

}

bool Game::checkCollision(MySprite* sprite, MySprite* sprite2)
{
 if (sprite->getAABB().left + sprite->getAABB().width <sprite2->getAABB().left)
    return false;
 if (sprite->getAABB().left > sprite2->getAABB().left + sprite2->getAABB().width)
    return false;
 if (sprite->getAABB().top + sprite->getAABB().height < sprite2->getAABB().top)
    return false;
 if (sprite->getAABB().top > sprite2->getAABB().top + sprite2->getAABB().height)
    return false;

return true;

}

Mario Class

void Mario::collisionResponse(MySprite* sp)
{

    //setPosition(getPosition().x, sp->getPosition().y - getSize().y);
    //velocity.y = 0;
    sf::Vector2f collide(getPosition().x - sp->getPosition().x, getPosition().y - sp->getPosition().y);

    //check left side
    if (abs(collide.x) > abs(collide.y))
    {

        if (collide.x < -5)
        {
            //right side
            setPosition(sp->getPosition().x - getSize().x-1, getPosition().y);
            velocity.x = 0;
        }
        if (collide.x > 5)
        {
            //left side
            setPosition(sp->getPosition().x + sp->getSize().x + 1, getPosition().y);
            velocity.x = 0;
        }
    }
    else
    {
        if (collide.y < -5)
        {
            setPosition(getPosition().x, sp->getPosition().y - getSize().y);
            velocity.y = 0;

        }
        else if (collide.y > 5)
        {
            setPosition(getPosition().x, sp->getPosition().y  + getSize().y);
            velocity.y = 0;
            falling = false;
        }
    }

}

sentences:
Is it a bad idea to have Game1 static in XNA? Is it a really bad idea to have my Game1 class as static? As at the moment in my Game1 class I have a class called TileHandler which handles everything to do with my current set of tiles, and AnimalHandler which handles all my animals (surprisingly).

Now if I am in AnimalHandler and want to check if a tile is walkable from TileHandler then that causes problems or I have to pass a list of walkable tiles into AnimalHandler, which I'd rather not do.

What would be easier would be to make Game1 static and then in AnimalHandler just go Game1._tileHandler.WalkableTile(position).

Now I can't see anything immediately wrong with this or anything that'd cause any problems but I've only just started using static classes, so does anyone more knowledgeable see any giant reason why that's a bad idea?

sentences: Create a 2d circular maze How can I create a 2d procedurally generated circular maze like the following picture:

sentences:
Unity: How to Retrieve Port Number Used for Test Build SUMMARY
I am looking for a straightforward way to get the port number that the Unity editor is using to serve WebGL test builds after the build's browser window has been closed.
I'm supporting Unity students who are not computer savvy. I'd like to know if there's an easy way to get this information from the editor itself, short of rebuilding the project.
DETAILS
To test my Unity WebGL project from the Unity Editor, I select the menu "File > Build and Run."

Once the project is built, a Chrome window opens with a location of the form "http://localhost:53587/", where 53587 is a random port number.

WHAT I HAVE TRIED
Google searches haven't given me an easy way to discover this port.
Using Window's Resource Monitor, I can find all the ports unity test servers are listening on, but this method requires many steps and external tools. I'd like know if there is a way within Unity to discover this information.
Complicated Method

Press Ctrl+R to open the Run window.
Type resmon.exe and press ENTER
Select the Network tab
Select the Listening Ports bar
Sort on image by clicking on the image column header
Search for image mono.exe
Get port number(s) from Port column.

This is relatively complicated, Windows-specific method and it's inexact; it can return multiple instances of test builds being served.  I'd like an easy way of discovering the port being served for the project currently being edited.

sentences:
DirectX error with older XP systems I am a blind programmer, working on an audio game for the blind.
I am using SlimDX, and it has been tested on dozens of systems from XP to Win 8.1.
My code works on most systems just fine, but I am getting the following error at runtime on a handful of older XP systems:

vupgraderacer.wav SlimDX.DirectSound.DirectSoundException:
DSERR_INVALIDCALL: This call is not valid for the current state of
this object (-2005401550)
at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)
at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)
at SlimDX.DirectSound.SecondarySoundBuffer..ctor(DirectSound device, SoundBufferDescription description)
at RR.Sound..ctor(String fileName)

The same error is repeated for each sound it is trying to use.
Here is the code I am using to setup the DS device:

dsDevice = New SlimDX.DirectSound.DirectSound
dsDevice.SetCooperativeLevel(OGw.Handle,
SlimDX.DirectSound.CooperativeLevel.Normal)

I realize there are other flags that can be set, but this basic setup has worked well thus far, minus the older XP systems.
This is my first post, so hope I am entering it properly, if not, please let me know, it is sometimes difficult to tell where you are or should be with a screenreader on forums.

sentences:
How does Lua work as a scripting language in games? I'm a little hazy on what exactly Lua is and how a game that is programmed in C++ would use it. I'm asking primarily about how it is compiled and run.

For instance when you use a program written in C++ which uses Lua scripts: does the code in Lua just call to functions in the main program written in C++ and act as a uncompiled class waiting to be compiled and added to the memory heap of the C++ program?

Or does it act like a bash script in Linux where it just executes programs completely separate from the main program?

sentences: How do I smooth out of the effects of a too-sensitive control? I have a game that takes input from a joystick. If you tilt the joystick right, the ship moves right linearly according to how much the joystick is tilted. So if you tilt the joystick twice as much the ship tilts twice as much. This feels fine in cases when you want to bank the ship through a steep turn (ie. lots of tilt). But for small tilts, the controls feel far too sensitive. How do game devs flatten/smooth the effects of controls? Do I just take the log of the tilt? Mostly, I want to flatten things in the middle of the range of possible tilts.

sentences:
What is the proper way to maintain the angle of a gun mounted on a car? So I am making a simple game. I want to put a gun on top of a car. I want to be able to control the angle of the gun. Basically it can go forward all the way so that it is parallel to the ground facing the direction the car is moving or it can point behind the car and any of the angles in between these positions.

I have something like the following right now but its not really working. Is there an better way to do this that I am not seeing?

#This will place the car
glPushMatrix()
glTranslatef(self.position.x,1.5,self.position.z)
glRotated(self.rotation, 0.0, 1.0, 0.0)
glScaled(0.5, 0.5, 0.5)
glCallList(self.model.gl_list)
glPopMatrix()

#This will place the gun on top
glPushMatrix()
glTranslatef(self.position.x,2.5,self.position.z)
glRotated(self.tube_angle, self.direction.z, 0.0, self.direction.x)
print self.direction.z
glRotated(45, self.position.z, 0.0, self.position.x)
glScaled(1.0, 0.5, 1.0)
glCallList(self.tube.gl_list)
glPopMatrix()

This almost works. It moves the gun up and down. But when the car moves around, the angle of the gun changes. Not what I want.

sentences: Row order in OpenGL DXT texture I'm using FreeImage and Squish library. I think there is no matter what row order is passed to squish::CompressImage (it's simply like inversed image). FreeImage stores rows from bottom to top, the pixel(0, 0) is placed in bottom-left corner. When I put RGBA or DXTn data to glTexImage the data at index 0 should be at top-left corner or at bottom-left corner?

sentences:
WebGL - two different approaches to Point Light: what is the difference? So I'm studying Webgl and after directional light I'm approaching point light.

So I've seen two different approaches:

Take the directional light (diffuse and specular components) and multiply them by a falloff attenuation, for example with the attenuation function is by Tom Madams that anyway take in account the distance from the fragment surface point to the light point. This approach is spotted in this webgl light walkthrough tutorial, and I find it easier to understand. Seems also the same approach from this OpenGL tutorial (in the section Point Light)
The other approach listed here does not involve a light attenuation falloff but calculate the light direction from any fragment position and the light point source. It seems a little bit more complicated to me.

Is there something that I have totally misunderstood? What is the difference between this two approaches? When to use the first and when to use the second?

Thanks!

sentences:
Ortho projection of 3D points with a vector I have 3D points and I need to make an 2D orthographic projection of them onto a plane that is defined by the origin and a normal n. The meaning of this is basically looking at the points from the top (given the vertical vector). How can I do it?

What I'm thinking is:

project point P onto the 3D plane: P - P dot n * n
look at the 3D plane from the "back" in respect to the normal (not sure how to define this)
do an ortho projection using max-min coordinates of the points in the plane to define the clipping

I am working with iOS.

sentences:
Unity3D: Determine vectors parallel to terrain I am trying to determine vectors that relate the height map information from a Terrain built in Unity to vectors that are parallel to the slope of the terrain.

i.e. From the Unity built terrain, whose contour map looks like the one in the Figure below, I want to draw the vector which is along the slope of the terrain, in the direction that is perpendicular to the contour lines.

How would I do this? I've found a question here that includes an answer which supplies code to find the contour lines from a height map.

Does any one know how to find the vectors?

Thanks.

sentences:
Moving walkway in Three.js - pathfinding algo or vector math ala Nature of Code? I am trying to develop a moving walkway for a 3D virtual space made in Three.js (link here).  Right now guests navigate using WASD or the arrow keys and the mouse to look around.
My goal is to have guests would navigate themselves onto the walkway and be moved along a path through the space, like a high speed lazy river.  They could hop off any time once they reach their destination.
I was planning on using vectors and adapting some steering behaviors code from The Nature of Code series (which is based on Craig Reynolds' steering behaviors).  I would accelerate the user once they're on the path and keep them on the path using steering, until they move themselves off.
I am curious if there is a better way to do this and determine the pathway.  I checked out Don McCurdy's Three.js pathfinding work, but it requires that you build an external mesh in something like Blender and import that into Three.js, which I haven't been able to do yet.  A lot of Blender's options have also changed since he wrote the tutorials, so it's hard to map.
I'm all ears if anyone has suggestions.

sentences:
Calculate slope for linear interpolated movement I want to move rectangles to their targets the "smooth" way with linear interpolation. I hope this is right.

float slope(float x1, float x2, float y1, float y2) {
    return std::abs((y2 - y1)) / std::abs((x2 - x1));
}

int s = slope(x, target->x, y, target->y);

if(x > target->x) {
    x -= s * speed * delta;
} else if(x < target->x) {
    x += s * speed * delta;
}

if(y > target->y) {
    y -= s * speed * delta;
} else if(y < target->y) {
    y += s * speed * delta;
}

The result is that they barely move. But when they move it is very slow or fast as hell.
I would also apreciate any suggestions on how to reach the target better.
Thanks in advance.

sentences:
(XNA) Stretching Images (Sprites) without Blur (Rasterizing?) thanks for clicking on this question although it has likely one of the most un-specific and confusing titles on this site. I am somewhat new to XNA and I have only posted 1 question on this site before which I didn't understand the answer to fully, but I'll give it another go.

I am looking to create a game which allows the user to either go full-screen or re-size the window to a few preset values, like many mainstream games nowadays allow you to do.
I believe I know how to do this in XNA, the problem is, when I toggle full-screen, and it stretches the sprites, they appear blurry.

I know this is a very obvious problem, as stretching = blur (logically). The thing is, I was wondering if there was a way to make it so regardless of the zoom, your sprites look crisp and not blurry? I asked a friend of mine in real life and he said something about rasterizing (which i don't know anything about). The only other thing I can think of

I've seen this done a few times in Flash. For examples of what I mean the only game I can think of is Super Smash Flash 2. It seems regardless of the screen size, most of the sprites and images appear crisp, even on the largest of screens.

If anybody knows anything about this, please share!
-Thanks.

sentences: Executing commands at the exact same time on 2 or more computers I have an RTS game, with deterministic simulation, but if I want multiplayer to actually work, I need commands sent between computers to be executed at the exact same time. My game's networking is just sending commands between the players' computers, and the simulator executes the commands in order, which, hopefully, will result in each player seeing the exact same game. However, if the commands aren't executed at the EXACT same time, then the simulation will become out of step and everything will be wrong. How could I do this, and are there other ways to make sure everything is in sync?

sentences: How to detect a pinch in Unity? How do I detect a pinch motion on Unity for an android or Iphone?  I need to also know whether the player pinches a certain character or not.  How do i do that?

sentences:
Obtaining a certain type of object with component based design I'm trying to design my game to be component based rather than overly hierarchical. Essentially, every high level object in the game (like gun, or whatever) inherits and implements the interfaces that it needs. For example, IPhysics, IRenderable, IWeapon, etc.

There are a few cases where I'm uncertain how to obtain a specific interface from another.

For example. A Gun might inherit from IWeapon, IPhysics, and IRenderable. I then also have a player which inherits from IPlayer, IPhysics, and IRenderable. I need a way so that, when Player and Gun collide, if Player is not currently wielding a weapon, he should be able to wield the gun and hold a pointer to the IWeapon of the Gun.

Right now, when Box2D detects a collision between 2 fixtures, I use the UserData field to store the IPhysics pointer associated with the fixture, and therefore, the IPhysics.beginContact method is invoked.

From here, the Player needs to somehow be able to know that this is a weapon, and obtain an IWeapon* . This is the part I really have no idea on.

Any advice on solving something like this is appreciated, even if it means some kind of design change on my part. I'm just looking for a clear way on how to solve this sort of problem.

Thanks

sentences:
Transform inputs don't work I'm writing a C# player script for a class and when I run, the sound inputs work fine, but the movement inputs don't respond, and I don't know how to fix it.

Code:

Rigidbody rigidbody;
AudioSource audioSource;

void Start(){
    rigidbody = GetComponent<Rigidbody>();
    audioSource = GetComponent<AudioSource>();
}

void Update(){
    ProcessInputs();
}
private void ProcessInputs()
{

    if (Input.GetKey(KeyCode.Space))
    {
        rigidbody.AddRelativeForce(Vector3.up);
        if (!audioSource.isPlaying)
        {
            audioSource.Play();
        }
    }
    else
    {
        audioSource.Stop();
    }
    if (Input.GetKey(KeyCode.A))
    {
        transform.Rotate(Vector3.forward);
    }
    if (Input.GetKey(KeyCode.D))
    {
        transform.Rotate(-Vector3.forward);
    }
}

sentences:
vector subscript out of range I'm trying to setup a 2d game and have been thrown up an error on vector subscript out of range. I've been trying to look up about it, but have not seen anything that helps. If someone could help and take the time to look at my code and help me fix my error i'd be very grateful. I think it's got something to do with something about that it can't handle more then 0-9 or something but my knowledge/understanding of it is not great and would appreciate the help. I'll paste my code below so you can see what i'm trying to do.

//tile setup
level.loadTexture("gfx/Maptiles.png");
Tile tile;
vector<Tile> tiles;
for (int i = 0; i < 10; i++)
{
    tile.setSize(sf::Vector2f(32, 32));
    tile.setAlive(true);
    tiles.push_back(tile);
}

//sky tile set to false so we don't collide
tiles[0].setAlive(false);
//    X   Y   W   H  of the sprite sheet
/*tiles[0].setTextureRect(sf::IntRect(187, 51, 70, 70));
tiles[1].setTextureRect(sf::IntRect(0, 0, 70, 70));*/
tiles[0].setTextureRect(sf::IntRect(864, 221, 70, 70));
tiles[1].setTextureRect(sf::IntRect(73, 2, 70, 70));
tiles[2].setTextureRect(sf::IntRect(140, 2, 70, 70));
tiles[3].setTextureRect(sf::IntRect(210, 2, 70, 70));
tiles[4].setTextureRect(sf::IntRect(280, 2, 70, 70));
tiles[5].setTextureRect(sf::IntRect(350, 2, 70, 70));
tiles[6].setTextureRect(sf::IntRect(420, 2, 70, 70));
tiles[7].setTextureRect(sf::IntRect(506, 577, 70, 70)); //ground block
tiles[8].setTextureRect(sf::IntRect(560, 2, 70, 70));
tiles[9].setTextureRect(sf::IntRect(630, 2, 70, 70));
//tiles[].setTextureRect(sf::IntRect(630, 0, 70, 70));
//tiles[11].setTextureRect(sf::IntRect(770, 34, 70, 70));
//tiles[12].setTextureRect(sf::IntRect(840, 51, 70, 70));
//tiles[13].setTextureRect(sf::IntRect(910, 0, 70, 70)); //^^ 1st row
/*tiles[14].setTextureRect(sf::IntRect(0, 0, 70, 70));
tiles[15].setTextureRect(sf::IntRect(70, 0, 70, 70));
tiles[16].setTextureRect(sf::IntRect(140, 0, 70, 70));
tiles[17].setTextureRect(sf::IntRect(17, 34, 70, 70));
tiles[18].setTextureRect(sf::IntRect(34, 34, 70, 70));*/
level.setTileSet(tiles);
// Map dimensions
    sf::Vector2u mapSize(25, 19);
// build map
std::vector<int> map = {
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, //25 X 19
    2, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
};
//fix tile layout
level.setTileMap(map, mapSize);
level.setPosition(sf::Vector2f(0, 0));
level.buildLevel();

level.render(window);

sentences:
Catan Optimal Placement Is it possible to calculate the best possible placements for settlements in Catan without using an ML algorithm?

While it is trivial to simply add up the numbers surrounding the settlement (highest point location), I'm looking to build a deeper analysis of the settlement locations. For example, if the highest point location is around a sheep-sheep-sheep, it might be better to go to a lower point location for better resource access. It could also weight for complementary resources, blocking other players from resources, and being closer to ports.

It seems feasible to program arithmetically, yet some friends said this is an ML problem. If it is ML, how would one go about training, as the gameboard changes every game?

Edit: Catan is fairly complex, but involves a setup of placing hexagonal "tiles" randomly to make the board (example board below) . One can then, in turn with the other players, place 2 settlements on the board at corners. Settlements cannot be placed on corners directly next to each other, giving you the ability to deny spots to others. Settlements give you the ability to get the 3 resources around them. One needs certain resources to do certain things, but generally even-ish balance of resources through the game. You also want resources with number chips closer to 7, as you only get the resource if the 2 die rolled every turn land on that number. After the 2 initial settlements, you can build roads out and build new settlements. If you have a settlement on a port, you can also trade according to that port's trade type.

see this video for a tutorial on Catan

sentences:
"The associated script cannot be loaded", how can I see what script is associated? I have a couple objects that are throwing errors in the warning log:

  The referenced script on this Behaviour (Game Object 'myObject') is missing!

Here is what they look like in the inspector:

How can I see what script is (or was) associated?

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: How to activate Xbox controller vibrations in Unity? Is there any way to toggle the XBOX controller vibrations in Unity ? I came across Handheld.Vibrate() but it seems like it's not meant for controllers.

sentences:
Scene graph or just plain container? I'm trying to understand if it makes sense to call what I have a scene graph or not.

Im doing an asteroid-like game, where all objects in the game are described in world space coordinates (an asteroid will be at X 50, Y 50 and it wont have objects orbiting, the player avatar is at X 100, Y 100 and it does'nt have a turret rotating the base of the ship. Objects are all described in world space, not in relationship to each other cause it just dose'nt make any sense).

For clarity (on why I will be mentioning a view matrix and a projection matrix bellow) - this is a 3D game with 3D objects in it, but the camera is locked facing one direction.

What I have is an object with a set of vectors containing all the objects visible in the scene. To me, this is still a scene graph - it just happens to be a flat graph where everything in the scene is a single node, not a child of a parent.
The scene graph also stores the projection and view matrix, as these are common to all objects scene (the view and projection matrix are static, only world space coordinates are updated). One could consider this view matrix as a transformation "node" that will be applied to all the children in the scene graph I guess.

So my question is - am I stretching it calling this a a "Scene Graph" and should I use another name for it?

sentences: Updating a multithreaded Entity-Component-System I am currently trying to implement an (sort-of) Entity-Component-System. I've got the gist of it, that is, how an ECS is supposed to work. So far i have 4 classes in my design (not yet fully implemented): EntityWorld is a global container for systems, entities and their respective components. It is responsible for updating systems/stepping. EntitySystem represents the base class for a system, with a virtual update-function. Entity is a container, basically with a list of components and an id, nothing more. EntityComponent represents a component. Now, i thought about making it possible to multithread my systems, but i think i've ran into a problem here. Suppose my EntityWorld stores its entities in the simplest way possible, in a std::vector<Entity*> for example. Now, that list would either be fully passed to a system when it is updated, or the EntityWorld loops through this list and sends the entities to the systems one-by-one. In my understanding though, when using multiple threads, this would require me to lock the whole list every time a system is being updated. That would practically equal zero increase in performance, since the other threads are always waiting for the list to get free. Is there a better way to implement this? So multiple threads can be updated (and r/w to entites at the same time)? Thanks in advance!

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:
Ray-Box (AABB) is slower than without I'm trying to write my own ray tracer. The last days I tried implementing a bounding box algorithm for it. But I'm getting a much slower frame rate with the bounding boxes turned on. I think it has something to do with checking the box with every ray but I don't know how I could change that.
Here is my code for the intersection algorithm:
bool Intersect(Ray r, float3 lb, float3 rt)
{
    float3 dir_inv = 1 / r.direction;

    double t1 = (lb[0] - r.origin[0]) * dir_inv[0];
    double t2 = (rt[0] - r.origin[0]) * dir_inv[0];

    double tmin = min(t1, t2);
    double tmax = max(t1, t2);

    for (int i = 1; i < 3; ++i)
    {
        t1 = (lb[i] - r.origin[i]) * dir_inv[i];
        t2 = (rt[i] - r.origin[i]) * dir_inv[i];

        tmin = max(tmin, min(t1, t2));
        tmax = min(tmax, max(t1, t2));
    }

    return tmax > max(tmin, 0.0);
}

My trace function:
RayHit Trace(Ray ray)
{
    RayHit bestHit = CreateRayHit();
    uint count, stride, i;

    // Trace ground plane
    IntersectGroundPlane(ray, bestHit);

    // Trace spheres
    _Spheres.GetDimensions(count, stride);
    for (i = 0; i < count; i++)
    {
        if (Intersect(ray, _Spheres[i].position - (_Spheres[i].radius), _Spheres[i].position + (_Spheres[i].radius)))
            IntersectSphere(ray, bestHit, _Spheres[i]);
    }

    // Trace mesh objects
    _MeshObjects.GetDimensions(count, stride);
    for (i = 0; i < count; i++)
    {
        //if (Intersect(ray, float3(0.0f, 0.0f, 0.0f), float3(10.0f, 10.0f, 10.0f)))
            //IntersectMeshObject(ray, bestHit, _MeshObjects[i]);
    }

    return bestHit;
}

sentences:
LWJGL glRotatef() without rotating axes? Okay so, I noticed when you rotate around an axis, say you do this:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

That will rotate things 90 degrees around the x-axis. However, it also sort of rotates the y and z axes as well. So now the y-axis is pointing in and out of the screen, instead of up and down. So when I try to do stuff like this:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
glRotatef(whatever, 0.0f, 1.0f, 0.0f);
glRotatef(whatever2, 0.0f, 0.0f, 1.0f);

The rotations around the y and z-axes end up not how I want them. I was wondering if there is any way I can sort of rotate just the axes back to their initial position after using glRotatef(), without rotating the object back. Or something like that, just so that when I rotate around the y-axis, it rotates around a vertical axis.

EDIT: After further research, it appears I will have to learn quaternions.
EDIT2: Wait, I don't think that's right. Does anyone know? I saw this thread on another site: http://java-gaming.org/index.php?topic=24177.0 but I don't understand what he did.

sentences:
Determining the first future intersection possible between ships and a planet Somewhat of an extension of this.

The Problem

I have a ship being launched from a planet, and I would like it to travel at a constant speed and direction such that it intersects another planet the soonest that it can.

(Beautiful diagram courtesy of Ausa)

I am ignoring initial velocity, end velocity, and gravity. The angular velocity of the planets and the velocity of the ship is constant. The physics that I am trying to achieve need not be realistic.

Using some quick maths I created a function! The function determines the smallest fly-by distance from the ship to the planet over time if the ship were to take the optimal route (a linear route since there's no gravity). So by determining when the fly-by distance is 0 (when the paths of the ship and planet intersect) I can work backwards to easily determine the angle of which I must launch the ship at to achieve this.

I created an implementation of the Bisection Method to find the first root of the function but depending on the variables of the function, the bisection method isn't the best solution to this problem. So now I'm trying to solve it mathematically! This is essentially what I need to solve:

Any solutions or ideas are greatly appreciated, thank you!

TL;DR:

This means I want to find the x-intersection of the function nearest to the origin.

Desmos

If you're interested in playing around with this function, I graphed it in Desmos https://www.desmos.com/calculator/tdtzt1gqkl

r_0 radius from the planet to the sun ("magic" units)

a_0 current angle of the planet in relation to the run (clockwise radians)

s_0 angular speed of the planet (clockwise radians per second

x_1 current x-position of the ship ("magic" units)

y_1 current y-position of the ship ("magic" units)

s_1 speed of the ship ("magic" units per second)

x_p planet x-position at x time ("magic" units)

y_p planet y-position at x time ("magic" units)

d_x delta x-position from ship to planet at x time ("magic" units)

d_y delta y-position from ship to planet at x time ("magic" units)

d_net net delta position from ship to planet at x time ("magic" units)

v_x optimal x-component of ship velocity ("magic" units per second)

v_y optimal y-component of ship velocity ("magic" units per second)

x_s ship x-position at x time ("magic" units)

y_s ship y-position at x time ("magic" units)

f(x) net distance from planet to ship at x time

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:
ArgumentException: The Object you want to instantiate is null I am trying to copy data over from a binary file but when trying to instantiate a gameobject, it comes out as "null".

static void LoadBuildings(SaveBuilding[] buildings)
    {
        if (buildings.Length == 0)
            return;
        foreach(SaveBuilding b in buildings)
        {
            if(b.type.ToString() == "Farm")
            {
                Farm build = Instantiate(Resources.Load("Farm")) as Farm;
                Debug.Log("Build: " + build);
                build.position.x = b.positionX;
                build.position.y = b.positionY;
                build.level = b.level;
                build.levelText = build.GetComponentInChildren<Text>();
            }
        }
    }

The debug line shows there is no object and when the next line tries to execute I get an error ArgumentException: The Object you want to instantiate is null.

I initially had it as Farm build = Instantiate(build.prefab) as Farm; as I get an error "Use of unassigned local variable".

I tried adding a prorperty above the if statement "GameObject build", I tried doing Farm build = new Farm() above the if statement also but still get the initial error.

I have a folder titled "Resources" and confirmed a prefab labelled "Farm" is there also.

Could it have anything to do with the "static" prefix for the method?

sentences:
Changing the texture in a Sprite I'm a bit new to libGDX. My problem is ,in my code, only if I set the texture in the constructor of the Sprite instance, it will draw anything. My question is shouldn't it be working when I only call setTexture() when rendering? Or is there another way to render while changing the texture?

Following code doesn't draw anything.

public Sprite getSprite() {
    if (this.sprite == null) {
        this.sprite = new Sprite();
    }
    return this.sprite;
}

public void render(final float deltaTime, final SpriteBatch batch) {
    this.getSprite().setTexture(this.getCurrentTexture());
    this.getSprite()
            .setPosition(this.getPosition().x, this.getPosition().y);
    this.getSprite().setRotation(this.getRotation());
    this.getSprite().draw(batch);
}

Following is the working code.

public Sprite getSprite() {
    if (this.sprite == null) {
        this.sprite = new Sprite(this.getCurrentTexture());
    }
    return this.sprite;
}

public void render(final float deltaTime, final SpriteBatch batch) {
    this.getSprite().setTexture(this.getCurrentTexture());
    this.getSprite()
            .setPosition(this.getPosition().x, this.getPosition().y);
    this.getSprite().setRotation(this.getRotation());
    this.getSprite().draw(batch);
}

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:
Memory Leak in SharpDX one Thing I found out: Windows 7 produces a memory leak while using certain methods to access rendertargets. Why doesn't Windows 8 leak at this method?

public class Game : SharpDX.Toolkit.Game {
    GraphicsDeviceManager gdm;
    RenderTarget2D target;
    public Game() {
        gdm = new GraphicsDeviceManager(this);
    }
    protected override void LoadContent() {
        target = RenderTarget2D.New(GraphicsDevice, 1000, 1000, PixelFormat.R8G8B8A8.UNorm);
        base.LoadContent();
    }
    private Color GetColor(int x, int y) {
        using (Image image = target.GetDataAsImage()) {
            PixelBuffer buffer = image.PixelBuffer[0];
            Color color = buffer.GetPixel<Color>(x, y);
            buffer = null;
            return color;
        }
    }
    protected override void Update(GameTime gameTime) {
        GetColor(5, 5);
        base.Update(gameTime);
    }
}

The memory consumption with this on Windows 8 is around 25 MB, Windows 7 uses up full memory.
Any idea why Windows 8 handles memory/graphics in another way than Windows 7 (and how to fix it)?
For clarification if it was a memory leak:

The drop is caused by closing the application.

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:
Is my idea of how to use matrices to layer 2D on top of 3D correct? I'm new to using matrices, so I'd like some input on whether I've understood the use of them in the context described in the title.

Right now I have a small Direct3D 11-based game engine which renders a stack of scenes, or screens if you will, from bottom to top. I have a static 2D orthographic view-projection matrix that simply maps to screen coordinates from ( 0, 0 ) to ( screen width, screen height ). The position and resulting world matrix of the different entities are set with coordinates relative to this.

However, I'd like to expand on this by enabling different scenes to use different perspectives, so that I would be able to render a 3D scene with perspective, and then a flat 2D GUI on top of it. But since I'm very new to using matrices, I'd like confirmation on whether I have the correct idea of what will happen before I change things, because it takes a fair amount of work to refactor the engine with the way it is set up now.

Let's say I have Scene A as the 3D scene, and Scene B as my 2D overlay.

When entities in Scene A is rendered, the following matrices are passed to the shader:

View = camera position/orientation in the 3D world
Projection = perspective matrix with FoV, aspect ratio and near/far depth
World = the individual entity's position in the 3D world

Then, when I want to render Scene B, I pass these matrices instead:

View = identity matrix since the view is static
Projection = orthographic matrix with screen coordinates
World = the individual entity's position in the screen coordinate system

In both cases the vertex shader multiplies the matrices like so: world * view * projection

Is this correct? Will this draw my 3D scene as expected first, and then correctly draw the 2D elements relative to the screen coordinate system instead? Or have I misunderstood how the matrices work?

EDIT: scratch the question below; I found the answer under related questions...:
Should the modelview and projection matrices be calculated in the shader or on the CPU?

Original question:
And one more thing, would it be more efficient to compute the View-Projection-World matrix on the CPU end before passing it to the shader's constant buffer, or is the GPU better suited at receiving the three matrices and multiplying them on the shader side? I've seen both approaches used, but I haven't found any conclusions on which way is more practical/efficient. I have two constant buffers by the way, one with the View and Projection matrices which is updated once per scene, and one with the World matrix updated for each individual entity, so the memory bandwidth savings would be insignificant if I moved the multiplications to the CPU instead. But would that be faster in theory, and are there any eventual drawbacks to this?

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:
Preferred option for indicating player's movement choices on a hexagonal grid on touch I'm building a prototype turn-based game and I'm considering the best approach for user interaction with the game board. It's a hexagonal grid, where the user can select units and move to other cells on the board. The number of steps they can take in a single move is variable and depends on the unit.

I'm aiming this for use ontouch screen devices, so that will exclude hover-based indicators (which make the most sense in terms of interaction).

So, with that limitation, what methods are possible for indicating to the user the amount of cells they can move?

So far, I've come up with these options:

Allow the user to take their turn and move step by step, highlighting the nearest 1 neighbour cells each time.
Highlight all possible destination cells:

Highlight the outer ring of maximum distance:

Draw a line through the outer-most cells to indicate maximum distance:

Each of these has their own drawbacks. The first, will be done dynamically and will require creating the markers on the fly (not inconceivable) and will also look kind of strange when there are lots of options. The image shows a unit which can move 2 cells and already looks over-crowded.

The second would solve the problem of too many cells being lit up at once. Unfortunately, I'd be worried the user wouldn't understand that they could move to one of the non-highlighted cells within the ring.

The last has the same problem as the second where I'm not sure they'd understand where they can move. It would alleviate the need to create multiple markers and store temporarily as I'd only have to store a single hexagon of varying size.

So, any ideas? Am I over-thinking this one?

NOTE: I've made the images above from this extremely useful site: http://www.redblobgames.com/grids/hexagons/

sentences:
Can Unity support / use textures that are not square? I have been told by another highly skilled Unity artist that Unity cannot efficiently handle non square images. Since that doesn't sound right to me, I wanted to get a second or third confirmation to that claim.

Having worked in the game development industry for almost 15 years, I have always understood that best practice was keeping in powers of two, but that if the UV map called for it, a 1024x512 map was acceptable, rather than using a 1024x1024 map with 1024x512 pixels of wasted UV space. Granted, that was best practice on game engines other than Unity.

Can anyone confirm that in Unity's case, it is better (best practice) to have a 1024x1024 image containing UV islands occupying 1024x512 pixels, rather than using a 1024x512 image map to exactly accommodate the UVs?

Which platforms can use non-square images and which ones cannot with the Unity engine? I am particularly interested in whether or not this limitation affects PC builds.

sentences:
How is 'mass' handled in video games? Mass is one of the basic scalar quantities, which is required in most rigid body physics calculations.

In a game, does every moving object have mass defined in the code, or is it allotted by the rendered objects size? Size should not be the only solution, though, since density also comes into play.

For example how does the physics engine handle mass in the Frostbite engine used in "Battlefield 3"?

sentences:
Is there a way to rotate an Ellipse in libGDX for collision detection purposes? I'm trying to avoid having multiple overlapping Circles for a UFO-shaped sprite.

Two Ellipse objects will perfectly cover the shape of my UFO, but I want to tilt/rotate the UFO when flying left and right, while still maintaining collision areas that match the locations of the graphics.

The Ellipse reference page doesn't have anything listed for rotation options, just wondering if anyone has ever tried to do this before (and succeeded).

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:
Transform inertia tensor using quaternion I have inertia tensor T in body coordinates and quaternion q for the body. I know I can transform T to world coordinate by converting quaternion to rotation matrix R and then use the relation (R * T * R^T). However this seems unnecessarily expensive and unwieldy (especially if you are doing this often).

So my question is:

How do I transform inertia tensor from body to world coordinate directly using quaternion and without having to generate rotation matrix from quaternion?

sentences:
What strategies can I use to update the visuals of my game to be more modern? I'm  making a browser strategy game.

Now my problem is that I have a feeling that my design is dated.
For now I have only used background colors and borders to make things look nice, but I have planed to add some pictures later.

Here is what it looks like now:

(Click for larger)

You will see that the game has a top and bottom bar and has the main section in the middle.  My main concern is that this may not be best idea, because not full width and height of the window is used.

What strategies can I use to update the visuals of the site to a more modern look?

sentences:
Gun clipping through arm during third-person animation I have been setting up a Blend Tree for motion animation in Unity. I'm using Root Motion for now. I parented the gun to the root of the player and then I use OnAnimatorIK to lock the two hands in position.
The overall looks and feel is great by my standards. The only thing I am disappointed about is the butt of the gun clips through the character's upper arm when running.

Is there a way to crop this in the game? I'd like to avoid going into a 3d Editor and making it two separate meshes which I could then I guess somehow disable. I'm hoping there is a better way to handle this situation.
Also I wonder if the gun being parented to the Root player object is wise. I had tried parenting to the 'right-hand' bone but this made the gun point upwards about 45° and looked silly.

sentences:
How much is atomicAdd slower than an atomic counter? I am considering replacing an atomic counter in my shader code with a SSBO an atomicAdd operation. What I need to know is the difference in performance of these two. I know the atomic counter executes in roughly 3 clock cycles on my Geforce 840m.
The reason behind this is that I would like to add an arbitrary number to the counter rather than just increment by 1.

sentences:
Rendering fancy particles? I'm making a tower-defense game for Windows (not phone) in XNA.

I've seen this video of another tower-defense game for Windows Phone that uses particle effects, which I really like. They change color, glow and density as they move away from the explosion. Really cool stuff!

http://www.youtube.com/watch?v=YhPr4A4LRPQ&hd=1

I would like a similar result (particle-wise) to the stuff in the video, however, I don't know where to start. I suppose I need to do linelist hardware instancing to achieve the result, and then update every particle position on the CPU.

Or is there a better alternative? Post your suggestions. That'd be great, thanks.

Edit It's the explosion particle effect that I want to implement. Not the particle effects that the projectiles leave when they fire.

sentences:
How do I load a texture in OpenGL where the origin of the texture(0, 0) isn't in the bottom left? When loading a texture in OpenGL, how do I specify the origin of the data I am loading?

For example, how would I load a Targa that has it's origin at the top left instead of the bottom left of the image?

sentences:
One dimensional, bi-directional terrain generation I'm developing one-dimensional terrain generation in my game.

I give the program a seed and based on that I need to be able to walk forwards and backwards on a line that is drawn between a series of points with the same interval but a different height.

So I need a random number generator where I can request both the next and previous number from a given state.

Most PRNGs I can find generate numbers only in the forward direction, and have no ability to operate in reverse. Is there a random generator I can use that can run both forwards and backwards?

sentences:
Texture-Mapping in Blender/XNA I have a simple Blender-Model (just a few faces). I want to add 2 Textures. (a special face should get Texture 1, the other faces Texture 2). This model I want to use in XNA.

The first Texture should be replaceable at Runtime by Code (the new image is generated based on user input).

So how do I best solve this: Using UV-Maps or Normal-based Maps in Blender? How can I access the Blender UV-Mapping in XNA? Or do I completely perform the Texturing in XNA (using Code or shaders)? And how (I´m new to this)?

sentences:
algorithm for Shooting objects that bounce off the wall I'm trying to make a 2D game where my Hero is standing in a 2D plan and surrounded by enemies(highest 3) that throwing balls. and my hero have a shield in hands and and will stop the balls...

well the problem is i'm not able to found the direction on which enemy shoot the ball to reach to the Hero...
i want to make enemy little bit smarter so they don't just shoot straight

as in picture the ball can bounce of the wall same as light bounce off wall, the indecent angle and refractive angle will be same(sorry image angles not perfect. i draw them in paint) so i know that slop of this path line will be same in whole path just interchange in negative and positive.

now i want to find the directions in which i can shoot like 2 coordinates of x,y or something where i can shoot and the ball reaches to the hero.

i not want just one direction... i want the all possible directions where my enemy can shoot and that hit to the hero

and also the ball will be gone after 4-5 times bounce

there is an android game "Stupid zombies" that have exactly this kind system in game

any algorithm and solution to archive this....i'm working in java so later i can port my game to android easily

i also tried below link but my ball hitting more then 2 times and i'm not able to find solution
https://softwareengineering.stackexchange.com/questions/290628/algorithm-for-calculating-a-bullet-path-to-a-target-with-max-2-ricochets

please edit if you found anything not properly asked ...i tried to make as simple as possible, but its my first time here.

sentences:
Multi-threading for rhythm game? I'm trying to recreate a rhythm game. However trying to get the key-presses with SDL2 I ran into the problem, that you can only get an event every time a frame has been successfully rendered (I can't poll the events from another thread than the main thread). As you could separate game-logic from rendering, I thought I could run the game logic (including the polling of the events) for every 1ms and render the screen for every 16ms (60fps).

I read some articles stating that it doesn't make much sense to use multi-threading for that usage, but 16ms are quite a lot of latency for a rhythm game (which has about 30ms to determine a better rating for a better high-score).
(The problem is also described here: Accuracy and frame-rate in a rhythm game)

EDIT: Here It's being said that multi-threading shouldn't be used:

What is the best way to handle event with SDL/C++

Now my question is:"Should I really not separate game-logic from render logic, as I don't need visual feedback for this kind of game and accuracy is more important"

sentences:
Why should I use getcomponent? I have already referred the animator by using the statement,

       Animator anim;

But,What is the use of getcomponent in awake() function.What happens without it.

sentences:
Saving an arbitrary sized 2d array I'm trying to create an arbitrary sized(but not infinite) 2d tilebased world. My question is, how do i save a world like this?

My idea was to split up the tiles into bigger chunks and then save those seperately. Let's say you have a world of 5000x5000 tiles, each chunk would be 50x50 and saved in a seperate file. This leaves me with 10000 seperate files, which does not seem optimal. Is there a better way?

sentences:
How to Sort Shoebox frames by order? I ve been playing with ShoeBox lately and when trying to make a frame sheet i see that they don't appear alphabetically (frame_1 , frame_2 , etc). But they appear by best fitting. In Texture-Packer you can sort it by name but i cant see that option in ShoeBox.

How can i do this?
Thanks in advance

sentences:
Exclude removed objects from list counting? I want to count the number of objects on my list. But because I remove and add, my script keep count those empty elements.
update: This happen when I destroy the object when it inside the collider. This object does not get out from "OnTriggerExit2D".
public List<GameObject> Sorts;
public List<GameObject> ItemsInside;
public int NumSorts, NumItems;

// Update is called once per frame
void Update()
{
    NumSorts = Sorts.Count;
    NumItems = ItemsInside.Count; // it doesn't give correct number

}

void OnTriggerEnter2D(Collider2D other)
{
    if (other.CompareTag("Sort"))
    {
        Sorts.Add(other.transform.gameObject);

    }
    if (other.transform.name == ("GameItem"))
    {
        ItemsInside.Add(other.transform.gameObject);

    }
}

void OnTriggerExit2D(Collider2D otherOut)
{

    if (otherOut.CompareTag("Sort"))
    {
        Sorts.Remove(otherOut.transform.gameObject);
    }
    if (otherOut.transform.name == ("GameItem"))
    {
        ItemsInside.Remove(otherOut.transform.gameObject);
    }

}

sentences:
Projectile immediately intersecting with target I have a fairly simple and somewhat cookie cutter method for testCollisions: (FYI: BasicProjectile is a CCNode with a CCSprite member).

    for (BasicProjectile * basicProjectile in self.projectiles) {

        NSLog(@"projectile sprite %@",NSStringFromCGRect(basicProjectile.sprite.boundingBox));
        NSLog(@"destination sprite %@",NSStringFromCGRect(basicProjectile.destination.sprite.boundingBox));

            if (CGRectIntersectsRect(basicProjectile.sprite.boundingBox, basicProjectile.destination.sprite.boundingBox)) {

                [basicProjectile.destination setHealth:(basicProjectile.destination.hp - basicProjectile.damage)];

                [self.projectiles removeObject:basicProjectile];
                [self removeChild:basicProjectile cleanup:YES];
                }
        }

    }

Those NSLog statements output:

  2013-03-23 10:02:59.124 GridWars[25268:c07] projectile sprite {{-10,
  -10}, {20, 20}}

  2013-03-23 10:02:59.124 GridWars[25268:c07] destination sprite
  {{-13.5, -34}, {27, 68}}

The main problem is that the collision immediately happens.  It should take a few frames to travel from the source to the destination.  So although the logic of setting the health works fine the sprite itself is never seen on the screen because the very second its fired it is removed.
From what I understand about CGRectIntersectsRect those 2 points listed above do not intersect.  Am I wrong are they intersecting?  What can be causing these projectiles to immediately intersect with their target?

BasicProjectile class (CCNODE superclass)

-(id)initWithSourceAndDestination:(GameCharacters*)Source destination:(GameCharacters*)Destination
{
    if (self = [super init]) {
        self.damage = 25;
        self.sprite = [CCSprite spriteWithFile:@"Projectile.png"];
        [self addChild:self.sprite z:1000 ];
        self.source = Source;
        self.destination = Destination;
    }
    return self;
}

GameCharacters would look similar to this except have health and mana properties.

WizardHero Class, Method Fire:

basicProjectile.position = self.position;
    [self.hostLayer addChild:basicProjectile z:2021];

// Determine where we wish to shoot the projectile to
int realX;

// Are we shooting to the left or right?
CGPoint diff = ccpSub(basicProjectile.destination.position, basicProjectile.source.position);
if (diff.x > 0)
{
    realX = (self.hostLayer.tileMap.mapSize.width * self.hostLayer.tileMap.tileSize.width) +
    (basicProjectile.contentSize.width/2);
} else {
    realX = -(self.hostLayer.tileMap.mapSize.width * self.hostLayer.tileMap.tileSize.width) -
    (basicProjectile.contentSize.width/2);
}
float ratio = (float) diff.y / (float) diff.x;
int realY = ((realX - basicProjectile.position.x) * ratio) + basicProjectile.position.y;
CGPoint realDest = ccp(realX, realY);

// Determine the length of how far we're shooting
int offRealX = realX - basicProjectile.position.x;
int offRealY = realY - basicProjectile.position.y;
float length = sqrtf((offRealX*offRealX) + (offRealY*offRealY));
float velocity = 380/1; // 380pixels/1sec
float realMoveDuration = length/velocity;

// Move projectile to actual endpoint
id actionMoveDone = [CCCallFuncN actionWithTarget:self.hostLayer
                                         selector:@selector(projectileMoveFinished:)];
[basicProjectile runAction:
 [CCSequence actionOne:
  [CCMoveTo actionWithDuration: realMoveDuration
                      position: realDest]
                   two: actionMoveDone]];

[self.hostLayer.projectiles addObject:basicProjectile];

Basically here is the class structure

Three main superclasses

  GameProjectiles:CCNodes

  GameLevels:CCNodes

  GameChars:CCNodes

Then the actual more specific classes (used on the GameLevels)

  BasicProjectile:GameProjectiles

  Level1Layer:GameLevels

  WizardHero:GameCharacters

  RedEnemy:GameCharacters

sentences:
Do you fill all your game data in huge excel tables? Are there any better method? I really want to know how many game designers prefer to work with a huge table for all items, another table for all skills, and even another table for all mobs in a MMORPG. And these tables may grow to several hundred MBs with thousand records, but most records only use a few fields in a table.
I know some game designer works in this way. Are there any better method?

sentences:
How do I calculate rotation caused by bounce friction? Following on from my previous question: I have the ball quite realistically bouncing from surfaces it hits. Now I'd like to make it spin from the friction of the hit.

Showing this is simple enough: I rotate the ball by its angular velocity every tick and apply the same rotation when it's rendered.

When a ball hits a wall, I know that the speed of rotation is affected by...

the ball's initial speed when hitting the surface
the friction coefficients of the ball and surface (physical constants)
the angle of incidence (the angle between the ball's incoming velocity vector and the surface normal).

The angle of incidence is approximated by the dot product of the ball's impact and exit velocity vectors. (1 meaning high spin, -1 meaning no spin, and everything else relatively in between)

Multiplying all of the above together and making sure they were then transformed to the range 0 - 1, and multiplied by max rotation speed, the ball seemed to respond in rotation speed as expected. Except for one thing: It would always rotate clock-wise (because of positive values).

Is this a good method? Can you think of a simpler way?

If this method seems fine, what am I missing? How do I know when the ball should be rotating counter-clockwise?

sentences:
What is the standard way to synchronize sound effects with sprite animations? Let's take a situation where you have an RPG with spells and each spell animations have a different number of frames and they have very different requirements for sound effects. Let's assume that each spell has only 1 continuous animation associated with it (as opposed to multiple modular pieces that are used to form a full animation) ala the old 16 Bit Final Fantasy games.

The only way I can think of in order to make sure that the sounds and animations sync up is to:

Get the number of frames of an animation.
Get the time between each frame of the animation. (if it's 30 fps then it's 1/30th of a second per frame.)
Then create a sound file that is exactly the same length as the animation.

So this means that if an animation is 5 seconds long, running at 30 fps, with a total of 150 frames, the sound file will also be 5 seconds long. If the animation should have an "impact" sound on the 30th frame, that means the sound file will include the sound of impact at the 1.0 second mark.

At the end, we start the animation and the sound effect at exactly the same time and hope that the frames and the sound sync up.

This sounds like it could pose problems when frames are skipped or something happens during the animation and the sound gets played slightly too soon or too late, and will cause the sound and the animation to go out of synch. Is this the best approach or are there usually a better way that I'm just not seeing?

The answer doesn't necessarily need to be for Cocos2D specifically if it's conceptual, but if there's a specific solution for cocos2d, I'd love to hear it.

EDIT: I just also realize that with this method, if we happen to go in and adjust the number of frames or timing of the animation later, we MUST also go back and change the sound file. This sounds like a terrible cause for human error (forgetting to update sound files after animation change.) I hope there are better methods out there.

sentences:
how to do sprinkle effect of water in opengl in android? I want to achieve sprinkling effect of water in android using opengl.
so,
do i need to achieve it with graphics?
is there any other way to do it using opengl?

or how can i start working on this,any links?

sentences:
Build a Cube/Prism from other varied Cubes/Prisms I'm wondering, are there any algorithms or theories in existence (that aren't patented/proprietary/protected) that would take a series of 3d rectangular prisms (or cubes but a cube is a prism) and stacks them in such a way as they form another cube or fit together in the best possible format?

I'm working on logistics software at work and this might be an interesting feature.

I'd also accept good articles that discuss the theory of this, if an algorithm isn't already available for me to look at and study.

sentences:
Alpha blend 3D png texture in XNA I'm trying to draw a partly transparent texture a plane, but the problem is that it's incorrectly displaying what is behind that texture.

Pseudo code:

vertices1
basiceffect1
// The vertices of vertices1 are located BEHIND vertices2

vertices2
basiceffect2
// The vertices of vertices2 are located IN FRONT vertices1

GraphicsDevice.Clear(Blue);
PrimitiveBatch.Begin();

//if I draw like this:
PrimitiveBatch.Draw(vertices1, trianglestrip, basiceffect1)
PrimitiveBatch.Draw(vertices2, trianglestrip, basiceffect2)
//Everything gets draw correctly, I can see the texture of vertices2 trough
//the transparent parts of vertices1

//but if I draw like this:
PrimitiveBatch.Draw(vertices2, trianglestrip, basiceffect2)
PrimitiveBatch.Draw(vertices1, trianglestrip, basiceffect1)
//I cannot see the texture of vertices1 in behind the texture of vertices2
//Instead, the texture vertices2 gets drawn, and the transparent parts are blue
//The clear color

PrimitiveBatch.Draw(vertice
PrimitiveBatch.End();

My question is, Why does the order in which I call draw matter?

Edit: Added screenshots

It's like there is no Z buffering at all.
this is done with:
GraphicsDevice.DepthStencilState  = DepthStencilState.DepthRead;
I've tried other settings but they don't help

Edit:
I think I have to somehow set the BlendState of the graphic card in some way so that the textures behind other textures get rendered.

sentences:
How to get status of LEDs on keyboard and blink LED on keyboard from Unity 3D on Android? On Android, with Unity how do I get the status of caps lock, scroll lock and num lock LED's and blink these LEDs for caps lock, scroll lock and num lock from Unity 3D?

Blinking the LEDs will of course enable caps, num or scroll lock.

sentences:
What is the correct object-orientated approach to class design in game development? I'm in the midst of developing a 2D sprite-based game for Windows 7 Phone, using XNA. The training and tutorials available for it are pretty helpful, but the problem I face is that each of them approaches their class design differently, and the code is not particularly well-factored. As a result, it has been difficult for me to gain a good understanding of which responsibilities I should give to a particular class.

For example, I could have a base sprite class BaseSprite that knows how to draw itself, check for collisions, etc. I could then have an AnimatedSprite class that would know how to navigate its sprite sheet, an ExplodingSprite class, and so on. This technique is demonstrated in the Space Invaders example in the Windows 7 Phone Jumpstart Session 2 materials.

Alternatively, I could instead place the bulk of rendering and running the game responsibility in a GameScreen class; that class and its derived classes behave more like forms or web pages in terms of their responsibilities. Sprite classes are more simple containers with much less logic.

This is the technique used in the Windows 7 Phone Training Kit's Alien Sprite game and other game state manager examples.

What is the correct object-orientated approach to class design in game development?

sentences:
How to create a bounding box around a Sprite in C++? Hello everyone, I am trying to create a bounding box around a Sprite in my simple Pong game. The bounding box needs to be a simple rectangle around the sprite so that it can act as a collision detector between the ball and paddle.

I have already tried to create the bounding box but it's not quite working as expected.

    float current_x = paddle_right->xPos();
    float current_y = paddle_right->yPos();
    float current_x2 = paddle_left->xPos();
    float current_y2 = paddle_left->yPos();

    float width_x = current_x + 16;
    float width_y = current_y + 150;
    float width_x2 = current_x2 + 16;
    float width_y2 = current_y2 + 150;

    if((x_pos > current_x && x_pos < width_x && y_pos > current_y && y_pos < width_y)||
        (x_pos > current_x2 && x_pos < width_x2 && y_pos > current_y2 && y_pos < width_y2))
    {
        dir_vector.setX(dir_vector.getX() * -1);
    }

The above code is the code I have used to create said bounding box, but like I said, it's simply not working correctly (As in the ball will sometimes go through the Sprite or have an abnormal reaction to it such as bouncing the wrong way).

I hope I have explained this well, if not please ask me which part to explain again. Basically, I just want do create a bounding box around a Sprite (in this case, the Paddle) to which then the ball can collide from.

For reference I am using the AwesomeSauce Game Engine.

sentences:
How do I convert degrees to radians and vice versa in Godot? In a game I'm toying with in Godot engine I have angles given in degrees in some places and angles given in radians in other places. Sometimes I need to mix both angles (ie. add them).

What built-in function allows me to convert degrees to radians (and the other way around)?
Or is there none?

P.S. I realize that converting those is not rocket science and I could code something on my own, but Godot is already doing such conversions internally, so I would venture a guess that such function already exists.

sentences:
Video Ads not showing correctly on iOS I've got an annoying problem considering video ads. I've tried different networks and for all video placements (Rewarded and Interstitial) I've got same problem: the Ad shows 1 frame, then disappears, but the ad sound remains. I think It is needed to enable something in Player settings, but I was not able to find what exactly. Banner ads work fine. Currently I am testing Ad Mob. The reward works fine, but the video ad just not displaying correctly.

The example of the ad show failure: https://youtu.be/ykgI4qGCg0c

My Unity version: 2019.1.9f1 Personal
Platform: iOS
Device: iPad mini 2

 void Start()
  {
 AdMobRewardedAd = RewardBasedVideoAd.Instance;
 // Called when an ad request has successfully loaded.
 AdMobRewardedAd.OnAdLoaded += HandleRewardBasedVideoLoaded;
 // Called when an ad request failed to load.
 AdMobRewardedAd.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
 // Called when an ad is shown.
 AdMobRewardedAd.OnAdOpening += HandleRewardBasedVideoOpened;
 // Called when the ad starts to play.
 AdMobRewardedAd.OnAdStarted += HandleRewardBasedVideoStarted;
 // Called when the user should be rewarded for watching a video.
 AdMobRewardedAd.OnAdRewarded += HandleRewardBasedVideoRewarded;
 // Called when the ad is closed.
 AdMobRewardedAd.OnAdClosed += HandleRewardBasedVideoClosed;
 // Called when the ad click caused the user to leave the application.
 AdMobRewardedAd.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;
// Initialize the Google Mobile Ads SDK.
 MobileAds.Initialize(appId);

 this.Load_rewarded_video();
}
//Google ad mob Handlers======================
public void HandleRewardBasedVideoLoaded(object sender, EventArgs   args)
{
 //MonoBehaviour.print("HandleRewardBasedVideoLoaded event received");
}
 public void HandleRewardBasedVideoFailedToLoad(object sender, AdFailedToLoadEventArgs args)
{
 Time.timeScale = 1;
 //MonoBehaviour.print(
 //    "HandleRewardBasedVideoFailedToLoad event received with      message: "
 //                     + args.Message);
 }
public void HandleRewardBasedVideoOpened(object sender, EventArgs args)
{
 //MonoBehaviour.print("HandleRewardBasedVideoOpened event received");
}
public void HandleRewardBasedVideoStarted(object sender, EventArgs args)
{
 //MonoBehaviour.print("HandleRewardBasedVideoStarted event received");
}
public void HandleRewardBasedVideoClosed(object sender, EventArgs args)
{
 //MonoBehaviour.print("HandleRewardBasedVideoClosed event received");
 Time.timeScale = 1;

 this.Load_rewarded_video();

 }
 public void HandleRewardBasedVideoRewarded(object sender, Reward args)
 {
 Time.timeScale = 1;
 ContinueGameCalculations();
 }
 public void HandleRewardBasedVideoLeftApplication(object sender, EventArgs args)
 {
 //MonoBehaviour.print("HandleRewardBasedVideoLeftApplication event received");
  }
  private void Load_rewarded_video()
  {
  #if UNITY_IOS
 string ad_unit = "ca-app-pub-5759662936416666/3614416666";
 #endif
 AdMobRewardedAd.LoadAd(new AdRequest.Builder().Build(), ad_unit);
 }

For some reason the very first test ad from Admob shows the way I described above, but the next ones work fine.

Update: the issue remains for both Rewarded and Interstitial Admob ad placements.

sentences:
Compiling Ogre3d application using the OgreAppWizard I have created an ogre application using the ogreappwizard. When I try to compile the solution I get an error saying that Parameter "basePath" cannot be a relative path..

I followed all of the instructions, and have tried reinstalling both the Ogre SDK and the appwizard.

I am losing my head here. What is going on?

sentences:
Data structure to store map layers in each Tile while keeping the order of terrain, items and monsters intact My game represents its map as a 2D array of tiles, each of which stores a stack of layers. I'm looking for a data structure to efficiently represent this .

I want to be able to add layers dynamically, so fixed arrays won't do.

Additionally, the layers are applied in zones, to make sure that terrain is always drawn before items and monsters, and that items/monsters are drawn before the player. This is the order:

terrainlayer
terraineffectlayers
itemlayers
monsterlayers
playerlayers
specialeffectslayers

I want to store all those zones in the same data structure, so I can traverse it from end to end in either direction. I also need to be able to add a monster layer that would automatically go at the end of monsterlayers data structure while still having a global object that would let me traverse from the all the layers. I also need the ability to access the data structure with index, so I can get the 3rd monster in the tile easily or remove the 3rd monster. Add will always be sequential, but remove are at random indexes.

Does a data structure like this already exist or do I need to make some sort of vector/doubly linked list/deque hybrid?

I have already seen this question but it doesn't help me.

sentences:
Under what circumstances will a PIX 'Render' be different to the actual 'render'? I am trying to implement dual-pass alpha sorting using Ogre material scripts, as part of my debugging attempts I want to compare two PIX captures, but when I attempt to debug a pixel in PIX, previously working 'geometry' is not displayed correctly.

My 'reference' blended geometry which works consistently, consists of a simple box with a translucent material, sitting over a set of opaque primitives. In my app this displays fine with the 'smoked' box tinting the objects/pixels behind it.
When I load up my app starting through PIX this continues to work, but once I load a capture taken from this in PIX, it no longer blends the pixels and instead culls them.

I know it is PIX because in the debugger tab, I see the initial value of the pixel I am debugging is the correct blended colour, but the final frame buffer value is the darker incorrect colour - its as if PIX is 're-rendering' the shot and doing it wrong!

Could anyone suggest a reason for this behaviour?

sentences:
Is there an open source rhythm / music game framework? I'm trying to build a very simple rhythm game (as a one-off art installation, not a commercial project) demonstrating a novel controller, but I've got an extremely short timeframe to do it in. Are there any open-source rhythm games or frameworks out there that I could use instead of writing such a game from scratch?

I could probably bang the code together in PyGame or Processing over a few days, but any time I can save on programming can be spent instead on the physical build, which would make the overall installation better.  The requirements for the game itself are super simple -- I just need to scroll notes across the screen, register points based on how well the player matches them, and play a song (ducking one of the channels when a note is missed).

The custom controller is Arduino-based, sending its data as bytes over a serial port, so I don't need any fancy DirectX support. Just something that can run with <60ms latency.

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:
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:
Mock Collision Object in Unity Problem:

I'm trying to set up some tests with mock collision objects, but i cannot construct collisions with custom objects. What I'm trying to do:

Collision2D col = new Collision2D();
col.gameObject = this.gameObject;

There seems to be no way to do this as col.gameObject has no visible setter. Is there a way to do this? I would like to script the passing of a collision to a mono-behavior via an event that gets handled by the OnCollisionEnter2D(Collision2D collision) inherited from mono-behaviors. Thanks for your time.

sentences:
Collisions between two objects in 2D space I am implementing the collisions of my game in javascript, and at the moment what happens when the objects collide is that they have their speed changed to 0. What I'm starting to want to do is to make it a little more interesting when the player plays with other objects in motion, they collide and separate. This is a very physical 2D issue itself.
If an object A is at positive velocity at x collides with an object B is at negative velocity at x, collide head-on, what would be the best calculation to do so that they separate naturally after the collision?

What if they go in the same direction in x? and if one has going on x and another on y? How do I deal with all this?

Should I add mass and acceleration to make this separation calculation after the collision?

sentences:
Unreal Expose Terrain Layers via a blueprint I have the below play area and I have 4 terrain materials defined in a material and attached to the terrain.
What I want to achieve is a way to use a blueprint to expose the pathway layer through the entire maze while avoiding collisions.

Terrain

Terrain Material

This is what I wanted to achieve programattically via a blueprint with the path. By collision I mean it cant go through trees, rocks, bushes or walls with colliders on them.

sentences:
Box2D and OrthographicCamera working incorrectly I'm trying to build a simple game where TileMapRenderer renders a labyrinth, a ball moves in it and camera follows it. I'm currently having the following bug:

For some reason, the game renders the world incorrectly. The gamescreen is cleared with the following method:

private void clearScreen() {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}

Which is basically red, and the camera seems to show it incorrectly while moving.

Camera movement method:

public void moveCamera() {
    GameInfo.camera.position.set(player.body.getPosition().x,
            player.body.getPosition().y, 0);

    // LEFT
    if(GameInfo.camera.position.x < GameInfo.WINDOW_WIDTH / 2){
        GameInfo.camera.position.x = GameInfo.WINDOW_WIDTH / 2;
    }

    // UP
    if(GameInfo.camera.position.y > GameInfo.WORLD_HEIGHT_PIXELS / 100.0f - GameInfo.WINDOW_HEIGHT / 2) {
        GameInfo.camera.position.y = GameInfo.WORLD_HEIGHT_PIXELS / 100.0f - GameInfo.WINDOW_HEIGHT / 2;
    }

    // DOWN
    if(GameInfo.camera.position.y < GameInfo.WINDOW_HEIGHT / 2) {
        GameInfo.camera.position.y = GameInfo.WINDOW_HEIGHT / 2;
    }

    // RIGHT
    if(GameInfo.camera.position.x > GameInfo.WORLD_WIDTH_PIXELS / 100.0f - GameInfo.WINDOW_WIDTH / 2f) {
        GameInfo.camera.position.x = GameInfo.WORLD_WIDTH_PIXELS / 100.0f - GameInfo.WINDOW_WIDTH / 2f;
    }
}

As you can see, I'm using Box2D physics for the ball.

Setting up the camera:

public static OrthographicCamera camera = new OrthographicCamera();

public static void setCamera() {
    camera.setToOrtho(false, 8.0f, 4.5f);
}

Rendering method:

public void render () {
    batch.setProjectionMatrix(GameInfo.camera.combined);
    clearScreen();
    moveCamera();
    GameInfo.camera.update();
    Game.tiledMapRenderer.setView(GameInfo.camera);
    Game.tiledMapRenderer.render();
    batch.begin();
    batch.draw(player.texture,
            player.body.getPosition().x - player.radius,
            player.body.getPosition().y - player.radius,
            player.radius,                   // originX
            player.radius,                   // originY
            player.radius * 2,               // width
            player.radius * 2,               // height
            1.0f,                          // scaleX
            1.0f,                          // scaleY
            player.body.getTransform().getRotation() * MathUtils.radiansToDegrees,
            0,                             // Start drawing from x = 0
            0,                             // Start drawing from y = 0
            player.texture.getWidth(),       // End drawing x
            player.texture.getHeight(),      // End drawing y
            false,                         // flipX
            false);                        // flipY
    player.updatePlayer();
    Game.checkStateOfGame(player);
    batch.end();
    //GameInfo.doPhysicsStep(Gdx.graphics.getDeltaTime());
    Game.world.step(1/60f, 8, 3);
}

It's not only while moving either. As soon as the game starts, the red block is visible like seen in the first picture.

Also the red blocks seem to always be coming from left and down, never from up or right...

What could be wrong in here?

sentences:
Getting Past "Boring" Content Creation When I'm creating games, I really love the coding part -- designing, developing the main functionality and "core" part of the game. However, most of my games are reasonably small/easy in terms of coding, but require a lot of content -- whether graphics, levels, sounds, puzzles, story narrative, etc.

I find development speeds through the coding parts, but nearly halts when it comes to content creation -- it's tough, sometimes boring work.

What can I do to make content creation quicker and more interesting/fun? I'm already integrating content into a working game, and building/using tools as much as possible to quickly assemble my content.

Edit: my question is not about learning any particular labor-/time-intensive skills like drawing assets or picking out sound effects; it's about that psychological hurdle when you have to just sit down and grind out the rest of your game, even if it's not the most fun thing in the world to do.

sentences:
How do I enable FSAA in OpenTK? All I could find about it is this question, but GraphicsMode alone doesn't enable anti-aliasing:

using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;

class Program
{
    static void Main()
    {
        using (var window = new GameWindow(800, 60, new GraphicsMode(32, 24, 0, 8)))
        {
            window.Resize += (sender, e) => { GL.Viewport(window.Size); };
            window.RenderFrame += (sender, e) =>
            {
                GL.Clear(ClearBufferMask.ColorBufferBit);
                GL.Color3(Color.Red);
                GL.Begin(PrimitiveType.Triangles);
                GL.Vertex2(-1, 1);
                GL.Vertex2(-1, 0);
                GL.Vertex2(1, 0);
                GL.End();
                window.SwapBuffers();
            };
            window.Run();
        }
    }
}

sentences:
Given a base class and many derived classes with additional features, what's the best practice for accessing those features? This might sound strange, but let me explain. Say I want to write a safari program.
In this safari there is an object pool of 10 animals (Animal*): 2 ostrich, 5 mosquitos, 2 spiders and a snake. Each of these inherits Animal. Both snake and spider are venomous so they have data reflecting it—let's say they additionally inherit IVenomous. The mosquito inherits IFlyer. The ostrich is left out in the cold with none of these additional features.
With venomous animals around, we'd want to prepare antivenom for the safari. So let's have prepareAntidote(). This function's job would be to check what kind of antivenom is needed and simply print it out. As part of implementing IVenomous, spider and snake each have the method const std::string& getVenomName(). The base animal class doesn't have this feature.
The issue then becomes: how do we access the getVenomName() method when all we know we have is a list of Animal, and we don't know which ones implement IVenomous and have a getVenomName() method available? What's considered good practice here?
I've considerd a brute force approach of making use of dynamic_cast<IVenomous*> while iterating over all animals, but this seems wasteful. And as bad is the fact that prepareAntidote() function needs to know what an animal is to handle the pool. So it would most probably be better for it to work on a container<IVenomous*>&, wouldn't it?
My idea is to have each interface's constructor register itself with some storage class which keeps a container of pointers for each interface, and de-registers itself on destruction, so we could access a list of IVenomous animals directly. So far an unordered_map looks the most reasonable for that job, with roughly constant time for access and removal, as well as not invalidating anything except on rehash. The pointer being its own key value.
It's actually the same problem with composition like components for example in games. (That's why I'm writing it here, because of that, chances may be higher to find answers here.) In this case it screams for "object pooling" of course, but let's cast aside memory locality in this case, that should be quite easy to add in later with overloading operator.

sentences: iOS gaming with copyrighted characters? Can I use animate characters in an iOS game if I do a citation in the credits. Ex Steven univers in a fighting game and I list Rebecca Sugar in the Credits or by the character bio.

sentences:
How would I translate screen coordinates to Isometric coordinates? I have a function isoToScreen(x, y) that converts Isometric coordinates to Screen coordinates.

var tileW = 16;
var tileH = 16;

var isoToScreen = function(x, y) {
    var posX = (x - y) * tileW;
    var posY = (x + y) * tileH / 2;

    return [posX, posY];
};

But how would I make a function that converts screen coordinates back to Isometric coordinates?

var pos = screenToIso(16, 8);
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y

sentences:
Create a white background for the texture and then blend using GLSL I have a transparent png texture and I'd like to create a white background and then blend this on top of that. Is this possible using just GLSL? I can't multiply, add or mix colors because I don't want to overlay the color white. I want it to be in the background of the texture.

I can achieve what I want by creating 2 objects with the exact same dimensions and position, set the color of the object behind to white and the object in the front to the transparent texture. But this seems less than ideal to me.

Any suggestions will be much appreciated!

sentences:
Why is my texture array getting only the last link index? Here's my code:

[SerializeField] GameObject[] uitex = new GameObject[3];

void GetTextureFromServer()
{
    string dealer_img = "";

    for (int i = 0; i < PlayInfo.Instance.gametablelist.Count; i++)
    {
        dealer_img += PlayInfo.Instance.gametablelist[i].dlrimage;
        dealer_img += ",";
    }
    Debug.Log("HERE ARE THE LINKS : " + dealer_img);

    string[] links = dealer_img.Split(',');

    for (int j = 0; j < links.Length - 1; j++)
    {
        Debug.Log("HERE ARE THE NEW LINKS : " + links[j]);

        new BestHTTP.HTTPRequest(new System.Uri("*************************amazonaws.com/resources/" + "dealer/pic/" + links[j]),
        (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
        =>
        {
            for (int k = 0; k < uitex.Length; k++) {
                var tex = new Texture2D(20, 20);
                tex.LoadImage(res.Data);
                uitex[k].GetComponent<UITexture>().mainTexture = tex;
            }
        }).Send();
    }
}

The problem with this code is that it's only getting the last index of my links. What could be the problem on my iteration?

Here's an approach that works that shows what the expected behavior is:

 for (int i = 0; i < tzPlayInfo.Instance.bc_gametablelist.Count; i++)
{
    dealer_img += tzPlayInfo.Instance.bc_gametablelist[i].dlrimage;
    dealer_img += ",";
}
string[] newLinks = dealer_img.Split(',');

new BestHTTP.HTTPRequest(new System.Uri("**************************.amazonaws.com/resources/"
    + "dealer/pic/" + newLinks[0]),
    (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
    =>
    {
        var tex = new Texture2D(20, 20);
        tex.LoadImage(res.Data);
        uitex[0].GetComponent<UITexture>().mainTexture = tex;
    }).Send();

new BestHTTP.HTTPRequest(new System.Uri("**************************.amazonaws.com/resources/"
    + "dealer/pic/" + newLinks[1]),
    (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
    =>
    {
        var tex = new Texture2D(20, 20);
        tex.LoadImage(res.Data);
        uitex[1].GetComponent<UITexture>().mainTexture = tex;
    }).Send();

new BestHTTP.HTTPRequest(new System.Uri("**************************.amazonaws.com/resources/"
    + "dealer/pic/" + newLinks[2]),
    (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
    =>
    {
        var tex = new Texture2D(20, 20);
        tex.LoadImage(res.Data);
        uitex[2].GetComponent<UITexture>().mainTexture = tex;
    }).Send();

new BestHTTP.HTTPRequest(new System.Uri("**************************.amazonaws.com/resources/"
    + "dealer/pic/" + newLinks[3]),
    (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
    =>
    {
        var tex = new Texture2D(20, 20);
        tex.LoadImage(res.Data);
        uitex[3].GetComponent<UITexture>().mainTexture = tex;
    }).Send();

It's working perfectly, but now the problem is that it is not very clean code.

sentences:
Individual Skeletal Animation with OpenGL I have been able to implement a pipeline in OpenGL which reads Collada files and can animate them through interpolating the keyframes. However, as somebody brand new to graphics, I don't quite know how one would go about doing individual joint animation.

For example, if I have a sprite and I would like to move just their arm joint, none of that animation information is stored in a Collada file. How would I go about making a system that can move each joint independently?

sentences:
What type of networking system should I use With LibGDX on Android? I've been looking for a good way to implement multiplayer in an Android strategy game I'm working on, using LibGDX.
What I found:

The embedded LibGDX networking system
Kryonet
Google Play Services (I already used this system for a Unity game)

The only problem is that I don't know what system I want to use because I see multiple problems in each of these.

In LibGDX's networking and Kryonet, how can players connect to each other without having to tell each other their IP (which is not easy for everybody) ?
In Google Play Services, I don't know what are the requirement for users. Do the have to have Google Play, or maybe Google+ installed on their devices? Also, how easy is it to get Google Play Services to interface with LibGDX and Scene2D?

sentences:
Move component to: where to with child components? I have a simple static mesh attached to a scene in a blueprint. I want to move the component back to (0,0,0). If a component is not attached to any other component other than the default scene root, I just type in (0,0,0) as the Target Relative Location.

To be precise, I don't want it to go to (0,0,0) but head there and stop, so I just give it the world location and then multiply X, Y and Z by 0.67 (could be any value).

But now I have a few child components attached to an extra scene. This scene is moved (-2460, 3070, 2600). Now to make matters worse, it's ALSO rotated (0°, 0°, 90°) and every component I try to move is ALSO rotated by (0°, 90°, -90°). The numbers themselves aren't hard to crunch but I have no idea what "Target Relative Component" should be now.

I tried adding vectors, subtracting vectors (both relative and world from both the parent and every child component I want to move), inverting transforms, transform directions, rotating the  resulting vectors, unrotating the resulting vectors, nothing seemed to work, at least not the combinations I tried.

How do I get the correct Target Relative Location?

sentences:
Sprite always starts flipped Everytime I start the game, or I swap animator controllers in the inspector (in runtime), the character is flipped in X axis until I start moving him.

How do I prevent this to happen? This happens to me everytime I start a new project and I grow tired of this.

Update

8 animations which are all idle ones of just 1 frame

Down
DownRight
Right
UpRight
Up

The last 3 have the Sprite Renderer's flipX enabled within their animations:

UpLeft
Left
DownLeft

In the middle of the transitions, sprite remains flipped until it reaches 1 or -1.

I recorded recently a video to display the issue.

  https://www.youtube.com/watch?v=dC09snKvHAM

Same as above but in 1080p and showing entire Unity window.

  https://www.youtube.com/watch?v=Ww3GkUvb7bc

2nd update

PlayerControls.cs:

using UnityEngine;
using System.Collections;

public class PlayerControls : MonoBehaviour {

    Rigidbody2D rb;
    PlayerStats pStats;
    Animator anim;

    void Awake () {
        rb = GetComponent<Rigidbody2D>();
        pStats = GetComponent<PlayerStats>();
        anim = GetComponent<Animator>();
    }

    void Update () {
        if (Input.GetAxisRaw("Vertical") > 0)
        {
            rb.velocity = new Vector3(rb.velocity.x, pStats.pMoveSpeed, 0);
        }
        if (Input.GetAxisRaw("Vertical") < 0)
        {
            rb.velocity = new Vector3(rb.velocity.x, -pStats.pMoveSpeed, 0);
        }
        if (Input.GetAxisRaw("Horizontal") < 0)
        {
            rb.velocity = new Vector3(-pStats.pMoveSpeed, rb.velocity.y, 0);
        }
        if (Input.GetAxisRaw("Horizontal") > 0)
        {
            rb.velocity = new Vector3(pStats.pMoveSpeed, rb.velocity.y, 0);
        }
        if (Input.GetButton("Vertical") || Input.GetButton("Horizontal"))
        {
            anim.SetFloat("OrientationY", Input.GetAxisRaw("Vertical"));
            anim.SetFloat("OrientationX", Input.GetAxisRaw("Horizontal"));
        }
    }
}

PlayerStats.cs

using UnityEngine;
using System.Collections;

public class PlayerStats : MonoBehaviour
{

    public string pName;
    public string pClass;
    public int pLevel;
    public float pExperience;
    public float pBasicDamage;
    public float pMoveSpeed;

    public string[] pClassList;

    Animator anim;
    public RuntimeAnimatorController[] animCtrl;

    void Awake()
    {
        anim = GetComponent<Animator>();
    }

    void Update()
    {
        pLevel = 1 + (int)pExperience / 240;

        if (!CheckAssignedClass())
        {
            pClass = "Warrior";
            Debug.LogWarning("Player class not found. Using 'Warrior' as default.");
        }

        if (Input.GetKeyDown(KeyCode.J))
        {
            SetClass(pClass);
        }

    }

    bool CheckAssignedClass()
    {
        bool found = false;
        var i = 0;
        for (i = 0; i < pClassList.Length; i++)
        {
            if (pClassList[i] == pClass)
            {
                found = true;
                break;
            }
            else { found = false; }
        }
        return found;
    }

    void SetClass(string className)
    {
        switch (className) {
            case "Warrior": {
                    anim.runtimeAnimatorController = animCtrl[0];
                    break;
                }
            case "Archer": anim.runtimeAnimatorController = animCtrl[1]; break;
            case "Mage": anim.runtimeAnimatorController = animCtrl[2]; break;
            default: anim.runtimeAnimatorController = animCtrl[0]; break;
        }
    }
}

sentences:
Why aren't ModLoader's decompiled files showing up? I want to start making a Minecraft 1.6.4 mod, but have this trouble with ModLoader:

I've run the decompile.bat batch file, but when opening the eclipse folder, the bin folder is empty. The batch file ran fine with no errors, and /src/minecraft/net/minecraft contains many decompiled java files, but no modloader files like BaseMod.java.

If I open this folder with Eclipse, the package explorer menu stays empty.

What's happening here?

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:
What does HLSL's tex2D return at (0,0)? I'm trying to understand the mapping of texels to pixels, especially in the context of pixel shaders. I already found out the following:

When I define a standard quad with vertices at integer positions (texture coordinates ranging from 0 to 1), a pixel shader for the upper left pixel will be called with texture coordinates (0,0)
When I subtract 0.5 from the vertices' coordinates (as it's recommended when drawing sprites), the pixel shader for the upper left pixel will be called with texture coordinates (1/(2*quadWidth), 1/(2*quadHeight))

My question is about the behaviour of the tex2D function in HLSL:

I would have assumed that it just returns the color of the upper left pixel of the texture when called with texture coordinates of (0,0). But obviously this is not the case, since the second of the above-mentioned variants actually leads to the desired 1:1 mapping.

So is it correct that tex2D returns the original pixel values of a texture when given the following texture coordinates?

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:
Best memory allocation strategy for iOS? I'm debating myself about memory allocation on iOS. I write most of my code in C++ and I really like using ObjectPools, FreeLists, etc. In order to pre-allocate a lot of the stuff that I'll be constantly "alloc/dealloc" during the course of my game, ( like particles, game entities, etc ).

Still on iOS, it's not like we are developing for a console like PSP, where I can know for fact that I'll get a fixed amount of memory. iOS , will issue "memory warnings" when the system needs memory.

Does anyone have some suggestions about this ? Is it too serious since the new iPod touch/iPhone 4 are carrying more RAM ? or it's still a big concern?

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:
Saving virtual goods balance in Android Game I'm looking for a good way to store virtual goods and virtual currency balance in an Android game. Since these are "consumable" or "unmanaged" goods the balance is not backed up by Google and so there is a need for a solution that is:

Can't be hacked easily
Can easily be extended with additional goods and currencies
Survives application shut down and device boot

sentences:
Playing a sound only once during collisions So recently i thought i figured out a solution for it, only to find out it doesnt work when i have more than one of the same object type added to the level.

What i was doing is iterating through my different list of objects and checking if any of them are colliding with the player, if they are i play the sound for that one colliding with the player and then i set the boolean for the sound to true, meaning the sound has been played now.

When their are no collisions going on or if the current object being iterated isnt colliding with the player i set the sound boolean back to false. So as you probably can see, there is a issue when there is more than one of the same objects added because one of them will set the boolean to false and the sound will be played over and over as long as the player is colliding with one of the objects.

So i have run out of solutions to fix this so i am seeking out help.

Thanks anyone who can offer assistance.

EDIT:

Here is an example of how i am doing it now:

private void checkNeutalSwitchers() {

Iterator<Tile> switcherIT = this.neutralSwitcherTiles.iterator();

while (switcherIT.hasNext()) {
    Sprite square_sprite = switcherIT.next();
    float distance = MathUtils.distance(playerBoat.getX(),
            playerBoat.getY(), square_sprite.getX(), square_sprite.getY());
    if (distance < 11) {
        if (square_sprite.collidesWith(player)) {
            if (square_sprite.getUserData().equals("triangle")) {
                playerBoat.detachChild(player);
                player = swithcer.getTriangle();
                playerBoat.attachChild(player);
                if (this.neutralSwitcherBool == false) {
                    this.neutralSwitcherBool = true;
                    this.switchShapesSound.play();
                }

            }
            if (square_sprite.getUserData().equals("square")) {
                playerBoat.detachChild(player);
                player = swithcer.getSquare();
                playerBoat.attachChild(player);
                if (this.neutralSwitcherBool == false) {
                    this.neutralSwitcherBool = true;
                     this.switchShapesSound.play();
                }

            }
            if (square_sprite.getUserData().equals("circle")) {
                playerBoat.detachChild(player);
                player = swithcer.getCircle();
                playerBoat.attachChild(player);
                if (this.neutralSwitcherBool == false) {
                    this.neutralSwitcherBool = true;
                    this.switchShapesSound.play();
                }

            }
            if (square_sprite.getUserData().equals("rectangle")) {
                playerBoat.detachChild(player);
                player = swithcer.getRect();
                playerBoat.attachChild(player);
                if (this.neutralSwitcherBool == false) {
                    this.neutralSwitcherBool = true;
                    this.switchShapesSound.play();
                }

            }
        } else {
            this.neutralSwitcherBool = false;
        }
    }
}

}

sentences:
Graphics Pipeline, how exactly it works and how graphics card interprets it? I've looked at this Wikipedia's link, http://en.wikipedia.org/wiki/Graphics_pipeline, but the article lacks in-depth explanation.

The only thing, I suppose, I understand and can expand upon, is, Texture part:

Apply bump map
Apply specular map
Apply displacement map
Apply texture map
In between apply any other maps(?)

What interests me in the answer, is, what happens with the model on every frame rendered, like:

Application launched, requests a 3d model (OpenGL/D3D)
OpenGL/D3D calls hardware for help
Polygons get loaded into graphics card memory,
Something gets done, blah, blah
The Texture part comes in (the upper list), loading every texture in memory card memory texture that needs to be applied to the mesh.
Maybe something more?
Display to monitor or send out to operating systems display interface?

In short: OS -> Application -> OS -> Hardware -> OS -> Display device.

My examples are just what I understand/can make out of all this. But I'm looking for an answer that goes well in depth on graphics pipeline.

Would like to know how AAA tools like CryEngine, UDK does graphics rendering, where we have all the dynamic lightning and stuff like that.

I'd be more than thankful with answer that contains an example of, for instance, what does the character model (CryEngine/UDK) has to go through to get rendered in full fashion, with approximate included memory consumption/hardware instruction called, like:

Load polygons [OpenGL issues command, hardware instruction, memory used, possibly GPU usage?]
Next function [OGL, HW, Memory, GPU]

And, what are the best practices for graphics pipeline?

P.S. Please correct me if that's not Graphics Pipeline I'm referring to.

Thanks in advance!

sentences:
Friction due to gravity in an impulse based physics engine In my physics engine, I'm using impulses to solve collisions. I'm basing all calculations on these equations:

impulse = desired_velocity_change * mass
impulse = force * time
friction_force <= normal_force * coefficient

If an object moves along flat ground (infinite mass), after integration it'll be moving slowly "into" the ground due to gravity. This means that the impulse needed to react to that (given the restitution equals 0) will be the velocity in the direction of the contact normal, multiplied by mass.

The issue here is that gravity is a constant acceleration, which means that the object, no matter the mass, will always "dip" by the same amount given a constant frame rate. So the mass is never a factor in this situation, outside of the impulse calculation, which is just a flat velocity change.

Now, I can use impulse to calculate the force that was needed to react to the collision, this force can then be used in the friction equation as such:

friction_impulse / time <= normal_impulse * coefficient / time

Since time is always greater than 0, I can just multiply both sides by it, and then I can use the impulse equation, as such:

planar_velocity_change * mass <= velocity_change_along_normal * mass * coefficient

And again, I can just remove mass from the equation, which leaves me with:

planar_velocity_change * mass <= velocity_change_along_normal * mass * coefficient

This is the desired velocity change along the contact surface due to friction. The issue is, obviously, that none of this depends on mass, which means that no matter how heavy or light an object is, it'll always continue sliding along the surface by the same amount given a constant initial velocity.

What am I missing? It really looks like there's a logical mistake here. Should the dynamic friction depend on the mass in the first place? Moving a heavy object requires higher force, so static friction should be modeled properly, since it just flat-out removes velocity, though it'd be nice to hear if this has merit or just "looks good".

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:
Which image effect is this? This is a screenshot from RE7.
I have once seen the same image effect in Unity, but I don't remember the name:

I'm not talking about AA or DOF here, I mean this grainy / greenish thing, I don't know how to describe it...
At first I thought the name was something like "Anisotrophic filtering", but that didn't bring up anything that looked like it.
Can anybody tell me the name of the effect that I see here?
Edit:
It can be seen in the start screen of this video, too:
https://www.youtube.com/embed/aaN3MNb9ij0?feature=oembed
Both screenshots look pretty similar to me, so I guess it's the same effect?
Edit 2:
The pixels seem to shift into red / blue the closer they get to the edge of the screens.
I have drawn red arrows to region where this effect is very visible to me.
These pixels appear as "shifted" to me.
I think this effect is more visible at the edge of the screen.

Thank you.

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:
How do i choose what technology to use for a 2D game like Pokemon? I apologize in advance for the wall of text about to come.  I've had an idea for a game for a while now, and am stuck at step 1 of game development: Choosing a language/engine.  I've read a whole bunch of articles, comments, and posts, but everything recommends a different combination, and they all just give me more questions with less answers.  I'm hoping someone here has some experience with what I'm trying to do, and can let me know what's what.

So, for the sake of this post, let's assume I'm writing something akin to one of the old Gameboy Colour Pokemon games, but with nicer graphics. Like Pokemon, with "Zelda: A Link to the Past" graphics.  I've looked into the following options in terms of the technology:

C++ using SFML
Java using LWGl
Java using LibGDX
Python using PyGame

Each of the above has pros and cons, but I don't know which pros and cons apply to me.  I am comfortable with any language and library, I already know a lot, and am more than happy to learn more. My three questions that are holding me back from making a decision are:

How do I choose a technology now without knowing that it can "handle the load" without chugging along?  What if I choose Pygame, and 60% of the way through development I can't get the FPS above 15?
How do I know which engines are better suited to "2D Zelda/Pokemon" gameplay?  I've been recommended 1000 different engines and libraries, but most of them are for 3D effects or insane physic (which I likely won't need).
How do I handle cross-platform stuff?  I want to distribute on Windows/Mac, and Linux as well.  Java is easier for this, but what if it's not performant enough (compared to C++)?

So, does anyone have experience with anything like this?  Has anyone been where I am before?  I want to get started, and dip my feet into the proverbial water, but I'm too held back by indecision on technology to get my toes wet.

If anyone can recommend an engine/language/toolset for me, and maybe point me towards some tutorials or guides, I would be greatly appreciative.

sentences:
How is JS source protected in Chrome games? I was playing a space arcade shooter https://moonbreakers.com/ and tried to see some of the JS and shader code. However, I was unable to find anything but some server communication code. Game code is thus probably run on servers, but the shaders should at least be local, right? And I have understood that even if the server runs the true game state, clients commonly do some physics interpolation etc by themselves.

My only guess is that the game gets the code with jQuery and it doesn't show in the page source. Can that code be looked at via a debugger?

sentences:
FreeGLUT keyboard IO timing and synchronization Using FreeGLut's keyboard callbacks,
glutKeyboardFunc();
glutKeyboardUpFunc();

glutSpecialFunc();
glutSpecialUpFunc();

When in the glutMainLoop pipeline do these functions get called? In other systems (C# + OpenTK, XNA, etc.) , I'd use a polled (vs interrupt-driven) approach to perform keyboard IO. That is, in the Update phase of the game loop, I'd do the following:

update currentKeyboardState via an OpenTK, etc. framework call that returns an array with the state (up, down) of each key

Iterate through a map of keys, transition states (pressed, held, and released), and associated event handlers

Where a key transition has occurred that has an attached event handler (determined by comparing currentKeyboardState[key] with previousKeyboardState[key]), call it.

when all handlers have been processed, copy currentKeyboardState to previousKeyboardState.

In this case, there's no place or requirement for the GLut keyboard functions. However, it appears I have to do things differently in C++. I can, but I'm unsure of when the callbacks registered with GLut are actually called. Are these issued at the beginning/end of the main loop (activated through glutEnterMainLoop(), or are they arbitrarily called, interrupting the main loop no matter it's current state?
If the latter is the case, it seems that I'd need to add a new keyboard state collection, giving

previousKeyboardState(), the state of the keyboard at the end of the previous loop
currentKeyboardState(), the state of the keyboard at the beginning of the current loop
nextKeyboardState(), collection modified by the glutKeyboard*() and glutSpecial*() callbacks, and copied/moved into currentKeyboardState() before the Update phase begins.

Or, I could:

Create a std::queue<pair<int,bool>>, where ::first is the key code from one of the keyboard callbacks, and ::second indicates if it is an "up" or "down" event.

In the GLut callbacks, add events to this queue. (This may be better implemented as a map to avoid duplicate events for each key, again depending on when and how these callbacks are activated)

At the beginning of the update phase, I would use the queue contents to update the keyboard state arrays.
Of course, this doesn't really solve the problem if a keyboard callback is activated while I'm processing the queue. There are ways around that, also, but this is starting to become really hairy.

The Question
Do I need to be concerned about GLut keyboard callbacks happening during the main loop, or are they guaranteed to only be called between loop iterations (from the point of view of my application)? If the former, what are best practice for dealing with this?
Also, are these callbacks executed in the same thread as the main loop? Should I worry about concurrency issues not only on Windows, but OSX and Linux?
Edit
I've replaced freeGLut with GLFW, which works a bit more like I'd expect. I'd still like some insight on this, though.

sentences:
Unity2D - How to destroy my Instantiate particle system I'm having trouble trying to destroy my Instantiated particle system, I can only destroy my gameobject

using UnityEngine;
using System.Collections;

public class meteor_destruction : MonoBehaviour {

public GameObject meteor_d_effect;
public GameObject meteor_explo_effect;
public GameObject meteor_explo2_effect;

public int pointsIncrement = 1;

void OnCollisionEnter2D (Collision2D col)
{

    var effect_explo = Instantiate(meteor_explo_effect, col.gameObject.transform.position, col.transform.rotation);
    var effect_explo2 = Instantiate(meteor_explo2_effect, col.gameObject.transform.position, col.transform.rotation);
    var effect_d = Instantiate(meteor_d_effect, col.gameObject.transform.position, col.transform.rotation);
    Destroy (gameObject);
    Destroy (effect_explo,3);
    Destroy (effect_explo2,3);
    Destroy (effect_d,3);

}

It's generated after the meteor collide, but those 3 particle effects keeps adding inside my Hierarchy panel.

sentences:
How do I set shape density in PhysX 3.1? I'm using PhysX 3.1. I need to give shapes different densities (there are several shapes for my single rigid actor). I know that the shape's density can be set by NxShapeDesc::density in PhysX 2.8, but I can't find such an interface in PhysX 3.1.

I know mass properties can be set in PhysX 3.1 just as the snowman example in the SDK. Is there a direct interface to set density for each shape?

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:
DirectX 9 Light projection I am trying to see changes of component 'z' from light space. In vertex shader component 'z' divide 'w' is not 0. But after sending float4 with texcoord1 to pixel shader its 0. All matrices are good. Here is the code:

float4x4 MatWorld;
float4x4 MatView;
float4x4 MatProjection;

float4 LightViewMatrix;
float4 LightProjectionMatrix;
float4 LightPosition;

texture tex0;

sampler2D ShadowMap = sampler_state
{
    texture = tex0;
};

struct VertexOut
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
    float4 lightViewPosition : TEXCOORD1;
};

struct VertexIn
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
};

VertexOut VSLight(VertexIn In)
{
    VertexOut Out;

    In.position.w = 1;
    Out.position = mul(In.position, MatWorld);
    Out.lightViewPosition = Out.position;
    Out.lightViewPosition = mul(Out.lightViewPosition, LightViewMatrix);
    Out.lightViewPosition = mul(Out.lightViewPosition, LightProjectionMatrix);

    Out.position = mul(Out.position, MatView);
    Out.position = mul(Out.position, MatProjection);

    Out.tex = In.tex;
    return Out;
}

float4 PSLight(float4 Color : COLOR, float2 tex : TEXCOORD0, float4 lightViewPosition : TEXCOORD1) : COLOR
{
    float depth = lightViewPosition.z / lightViewPosition.w;
    if (depth == 0)
    {
        return float4(0, 0, 0, 1);
    }
    return float4(depth, 0, 0, 1);
}

technique T1
{
    pass P0
    {
        VertexShader = compile vs_2_0 VSLight();
        PixelShader = compile ps_2_0 PSLight();
    }
};

All objects are black. Sorry my english is slightly poor.

sentences:
Time.fixedDeltaTime & Time.deltaTime in Unity The old Unity 5.3 documentation said:

Time.fixedDeltaTime
The interval in seconds at which physics and other fixed frame rate
updates (like MonoBehaviour's FixedUpdate) are performed.
For reading the delta time it is recommended to use Time.deltaTime
instead because it automatically returns the right delta time if you
are inside a FixedUpdate function or Update function.
Note that the fixedDeltaTime interval is with respect to the in-game
time affected by timeScale.

So, it was said (paraphrased as I get it) that Time.fixedDeltaTime returns the interval at which the FixedUpdate method should be called with respect to the timeScale. But the real interval could differ (for technical reasons) and that's why Time.deltaTime should be used instead to return a real time elapsed since the previous FixedUpdate call.
The latest docs don't say that anymore: https://docs.unity3d.com/ScriptReference/Time-fixedDeltaTime.html
Does it mean that now FixedUpdate is called exactly at Time.fixedDeltaTime rate?
Now it also says:

Unity does not adjust fixedDeltaTime based on Time.timeScale. The
fixedDeltaTime interval is always relative to the in-game time which
Time.timeScale affects.

Don't these two sentences contradict each other?

sentences:
Diamond-square terrain generation problem I've implemented a diamond-square algorithm according to this article:
http://www.lighthouse3d.com/opengl/terrain/index.php?mpd2

The problem is that I get these steep cliffs all over the map. It happens on the
edges, when the terrain is recursively subdivided:

Here is the source:

void DiamondSquare(unsigned x1,unsigned y1,unsigned x2,unsigned y2,float range)
    {
    int c1 = (int)x2 - (int)x1;
    int c2 = (int)y2 - (int)y1;
    unsigned hx = (x2 - x1)/2;
    unsigned hy = (y2 - y1)/2;
    if((c1 <= 1) || (c2 <= 1))
            return;

// Diamond stage
float a = m_heightmap[x1][y1];
float b = m_heightmap[x2][y1];
float c = m_heightmap[x1][y2];
float d = m_heightmap[x2][y2];
float e = (a+b+c+d) / 4 + GetRnd() * range;

m_heightmap[x1 + hx][y1 + hy] = e;

// Square stage
float f = (a + c + e + e) / 4 + GetRnd() * range;
m_heightmap[x1][y1+hy] = f;
float g = (a + b + e + e) / 4 + GetRnd() * range;
m_heightmap[x1+hx][y1] = g;
float h = (b + d + e + e) / 4 + GetRnd() * range;
m_heightmap[x2][y1+hy] = h;
float i = (c + d + e + e) / 4 + GetRnd() * range;
m_heightmap[x1+hx][y2] = i;

DiamondSquare(x1, y1, x1+hx, y1+hy, range / 2.0);   // Upper left
DiamondSquare(x1+hx, y1, x2, y1+hy, range / 2.0);   // Upper right
DiamondSquare(x1, y1+hy, x1+hx, y2, range / 2.0);   // Lower left
DiamondSquare(x1+hx, y1+hy, x2, y2, range / 2.0);       // Lower right

}

Parameters:
(x1,y1),(x2,y2) - coordinates that define a region on a heightmap (default (0,0)(128,128)).
range - basically max. height. (default 32)

Help would be greatly appreciated.

sentences:
Best way to render multiple objects I have a scene that consists of 1 player object, 1 platform, 1 enemy, and 1 background. Currently, this is how my render function looks like:

void Sprite::Render()
{
    glUseProgram(m_Program);
    glActiveTexture(GL_TEXTURE0);

    // Background
    glBindVertexArray(BackgroundVAO);
    glBindTexture(GL_TEXTURE_2D, m_Textures[1]);
    glUniform1i(glGetUniformLocation(m_Program, "Texture1"), 0);

    m_ProjectionMatrix = m_Camera.ViewToWorldMatrix();
    m_TransformationMatrix = m_ProjectionMatrix;
    m_TransformationMatrixLoc = glGetUniformLocation(m_Program, "TransformationMatrix");
    glUniformMatrix4fv(m_TransformationMatrixLoc, 1, GL_FALSE, &m_TransformationMatrix[0][0]);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);

    // Enemy
    glBindVertexArray(EnemyVAO);
    glBindTexture(GL_TEXTURE_2D, m_Textures[2]);
    glUniform1i(glGetUniformLocation(m_Program, "Texture3"), 0);

    m_ProjectionMatrix = glm::translate(glm::mat4(), glm::vec3(EnemyX, EnemyY, 0.0f)) * m_Camera.ViewToWorldMatrix();
    m_TransformationMatrix = m_ProjectionMatrix;
    m_TransformationMatrixLoc = glGetUniformLocation(m_Program, "TransformationMatrix");
    glUniformMatrix4fv(m_TransformationMatrixLoc, 1, GL_FALSE, &m_TransformationMatrix[0][0]);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);

    // Platform One
    glBindVertexArray(PlatformVAO);
    glBindTexture(GL_TEXTURE_2D, m_Textures[3]);
    glUniform1i(glGetUniformLocation(m_Program, "Texture4"), 0);

    m_ProjectionMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, -0.5f, 0.0f)) * m_Camera.ViewToWorldMatrix();
    m_TransformationMatrix = m_ProjectionMatrix;
    m_TransformationMatrixLoc = glGetUniformLocation(m_Program, "TransformationMatrix");
    glUniformMatrix4fv(m_TransformationMatrixLoc, 1, GL_FALSE, &m_TransformationMatrix[0][0]);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);

    // Player
    glBindVertexArray(PlayerVAO);
    glBindTexture(GL_TEXTURE_2D, m_Textures[0]);
    glUniform1i(glGetUniformLocation(m_Program, "Texture2"), 0);

    m_ProjectionMatrix = glm::translate(glm::mat4(), glm::vec3(PlayerX, PlayerY, 0.0f)) * m_Camera.ViewToWorldMatrix();
    m_TransformationMatrix = m_ProjectionMatrix;
    m_TransformationMatrixLoc = glGetUniformLocation(m_Program, "TransformationMatrix");
    glUniformMatrix4fv(m_TransformationMatrixLoc, 1, GL_FALSE, &m_TransformationMatrix[0][0]);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);

    glBindTexture(GL_TEXTURE_2D, 0);
    glBindVertexArray(0);
}

As you can see, it is unnecessarily complicated. And if I want to draw, say, two or more enemies, or 4 or more platforms, then it'd get ridiculously large! My question is this, how can I make this smaller? I prefer to be able to do something like this in my main.cpp: Sprite.Render(Player); Sprite.Render(EnemyOne); etc...

Looking forward to reading your tips, thank you!

sentences:
Storing color and position (height and width) in an array which can be changed accordingly (bubble shooter) How can I store the colors and position (i.e the position of the balls in bubble shooter game) using an array? I first tried using a simple loop but I think it won't work when I need the balls to burst so the balls should be printed using arrays. Here is my simple code

DrawLine( 380 , 60 ,   mx ,  my,10,  colors[BLACK]);
DrawRectangle( 1,89 ,799,500 , colors[WHITE]);
DrawRectangle(0 , 0,330 , 90 , colors[WHITE]);
DrawRectangle(430, 0, 380  , 90  , colors[WHITE]);

int zig=0;

int wide1=25;
int high1=574;

for ( high1 ; high1>=80 ; high1=high1-50){
    for (wide1 ; wide1<=780 ; wide1= wide1+50 ) {
        DrawCircle(wide1 , high1 , 25 , colors[WHITE]);
    }
    zig=zig+1;
    if (zig%2==0){
        wide1=25;
    } else {
        wide1=50;
    }
}

sentences:
How can I simulate a rigid body bounced from a wall in 3D world? How can I simulate a rigid sword bounced from a wall and hit the ground (like in physical world)?

I want to use this for a simple animation. I can detect the figure and the size of the sword (maybe needed in doing bounce). Rotation can be controlled by quaternions/matrix/euler angles. It should turn the head and do rotations and fly to the ground.

How can I simulate this physical process?

Maybe what I need is an equation and some parameters?

I need these data, and would combine them into my movie file, I use Mathematica to do the thing that generate the movie file(If I have the data, I can also export it into a 3DSMax script for example).

sentences:
Help with 3D Double Jumping in Unity I'm having some trouble with vertical movement. I'm trying to add double-jumping but none of the scenarios online seem to be working, and I can only ever manage to get a single jump. Here's my code:

using UnityEngine;
using System.Collections;

public class Moving : MonoBehaviour {
//public float speed;
CharacterController controller;
public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
public bool candoublejump = true;
public int jumptime = 0;
private Vector3 moveDirection = Vector3.zero;
// Use this for initialization
void Start () {
    controller  = GetComponent<CharacterController>();
}

void FixedUpdate() {
    if (controller.isGrounded) {
        moveDirection = new Vector3 (Input.GetAxis ("Horizontal") * 2000, 0, Input.GetAxis ("Vertical") * 2000);
        moveDirection = transform.TransformDirection (moveDirection);
        moveDirection *= speed;
    }
    if (Input.GetButton ("Jump")) {
        if (controller.isGrounded) {
            moveDirection.y = 0;
            moveDirection.y = jumpSpeed;
            candoublejump = true;
        } else {
            if (candoublejump) {
                candoublejump = false;
                moveDirection.y = jumpSpeed;
            }
        }
    }
    moveDirection.y -= gravity * Time.deltaTime;
    controller.Move(moveDirection * Time.deltaTime);
}
}

Is there something wrong with my keyboard maybe? My theory is that it's checking for the double jump in the split second after you did the first one, which isn't helpful because you're still holding the jump button.

sentences:
UnrealScript access variable in one class from another? So there are some similar questions out there but the responses often say that you should use 'new' or 'spawn', but I'm working with the playercontroller don't want to make a new playercontroller.  Maybe this isn't the right way to be doing this but I want to view the state of a variable in the playercontroller that will change fairly often from my HUD.  Is there a way to do this?

playercontroller class

var bool bYeaNo;

exec function change() {
  bYeaNo= !bYeaNo;
}

defaultproperties
{
  bYeaNo = false
}

HUD class

event PostRender() {
  Super.PostRender();
}

function DrawHUD() {
  Super.DrawHUD();
  Canvas.SetDrawColor(0, 0, 0);
  Canvas.SetPos(25, 25);

  if (bYeaNo) { //this is wrong so what would make this work?
    Canvas.DrawText("Yea");
  } else {
    Canvas.DrawText("No");
  }
}

sentences:
Native C++ console screen buffer I'm trying to display a game in the console window using a screen buffer but cannot compile it.

I have this simple code:

#include <Windows.h>
#include <iostream>
#include <thread>

int main() {
  const int width = 120, height = 40;

  wchar_t* screen = new wchar_t[width * height];
  HANDLE console = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
  SetConsoleActiveScreenBuffer(console);
  DWORD bytesWritten = 0;

  while (true) {
    for (int i = 0; i < width * height; i++) screen[i] = L' ';
    wsprintf(&screen[width + 5], L"Testing");

    WriteConsoleOutputCharacter(console, screen, width * height, {0, 0}, &bytesWritten);
    Sleep(1000 / 30);
  }

  return 0;
}

It won't compile, getting two errors:

  test.cpp:16:44: error: cannot convert 'wchar_t*' to 'LPSTR {aka char*}' for argument '1' to 'int wsprintfA(LPSTR, LPCSTR, ...)'

and

  test.cpp:18:87: error: cannot convert 'wchar_t*' to 'LPCSTR {aka const char*}' for argument '2' to 'BOOL WriteConsoleOutputCharacterA(HANDLE, LPCSTR, DWORD, COORD, PDWORD)'

How can I get this working and how to do it even better?

I'm using g++ 6.3.0 to compile.

Thanks!

sentences:
Moving one object from one point to another with acceleration How would someone implement moving an object from one point in 2D space to another using these formulae to update objects:

m_position.setX/Y( m_position.X/Y() + m_velocity.X/Y() * dt + 0.5 * m_acc * pow(dt,2);
m_velocity.setX/Y(m_velocity.X/Y() + m_acc * dt);

I'm trying to make a pong clone and I'm having some trouble programming the AI paddle to go to the y coordinate where the ball will hit. (the y coord is predicted in a function).

Currently I have it so that it applies an acceleration of 1 until half the distance then an acceleration of -1 after it, but naturally it is overshooting by a lot, then trying to go back, etc.

sentences:
Android Bitmap: Collision Detecting I am writing an Android game right now and I would need some help in the collision of the Pawns on screen. I figured I could run a for loop on the Player class with all Pawn objects on the screen checking whether or not Width*Height intersects with each other, but is there a more efficient way to do this?

And if you do it this way, many of the transparent pixel inside the rectangular area will also be considered as collision as well. Is there a way to check for collision between Bitmap on a Canvas that disregard transparent pixels? The class for player is below and the Pawn class uses the same method of display.

Class Player {
  private Resources res; // Used for referencing Bitmap from predefined location
  private Bounds bounds; // Class that holds the boundary of the screen
  private Bitmap image;
  private float x, y;
  private Matrix position;
  private int width, height;
  private float velocity_x, velocity_y;

  public Player (Resources resources, Bounds boundary) {
    res = resources;
    bounds = boundary;
    image = BitmapFactory.decodeResource(res, R.drawable.player);
    width = image.getWidth();
    height = image.getHeight();
    position = new Matrix();
    x = bounds.xMax / 2; // Initially puts the Player in the middle of screen
    y = bounds.yMax / 2;
    position.preTranslate(x,y);
  }
  public void draw(Canvas canvas) {
    canvas.drawBitmap(image, position, null);
  }
}

sentences:
When to Dispose Textures I recently realized Texture2D implements IDisposable, and now (while trying to track down a memory leak) wonder about where and when I should dipose this.

My current architecture is that I have a SpriteComponent instance which encapsulates and hides the Texture2D. Internally, when I switch screens (eg. MainMenuScreen => WorldMapScreen), I call Dispose on the current screen, which calls dispose on the entities, which calls dispose on the textures.

But this results in some wacked-out behaviour, like textures apprearing super zoomed in momentarily, or appearing black, or appearing as garbage image data.

So my question is really, when should I call Dispose on Texture2Ds?

(FYI, I also can switch to a screen, and then later switch back to it, which currently causes me to reload the sprites, and by proxy, the textures.)

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: how do I add development build number each time I compile and play? I wanted each time I play my game, it will show in the console how many times you compiled or run the game. How do I do that?

sentences:
Are bounding volumes created by artists? I'm interested in where in the tool chain bounding boxes are created. Are they made by the artists? In the modeling tool? How are they exported? Can Maya/3DS Max/Blender/... mark geometry as bounding box? How does that work in Collada/FBX?)

Or is there a tool which calculates them? Are they calculated at run time?

I basically know how bounding volumes work, but I'm a little bit confused on where to get them from.

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: Fill with Transparency in Built-In Sprite Editor When I imported an image for a sprite, I realized it had a white background. I went into the built-in sprite editor to remove it. I tried using fill as there was a transparent color in the color selector. It did not work. Is there a way to do this, or an easier way than erasing it all by hand?

sentences:
Working in large play-area maps, what are the performance and practical differences between Unreal Terrain and a subdivided OBJ mesh terrain? I've managed to reliably use SRTM Geotiff Raster Data with some modifications to create decent terrains in unreal, but there is a small problem with how I go about city-building when I'm not using the actual terrain from unreal in my modelling program, especially with roads and other wide-area constructs.  If I were to convert my heightmap to a mesh object for use and manipulate in modelling programs instead of using the unreal terrain, what sort of difference in performance or stability would it make?  What about load times?

Would it make a large impact with object meshes for building exteriors included in the object mesh for the terrain, thus reducing the amount of information needed to load both the buildings and terrain by a small amount?

EDIT: title, player should have been play-area

sentences:
How can I read from multiple textures in an OpenGL ES 2 shader? How can I enable more than one texture in OpenGL ES 2 so that I can sample from all of them in my shader? For example, I'm trying to read from two different textures in my shader for the player's car.

This is how I'm currently dealing with the texture for my car:

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, this->texture2DObj);
glUniform1i(1, 0);
glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer);
glEnableVertexAttribArray(0);

int offset = 0;
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, this->vertexBufferSize,(const void *)offset);

offset += 3 * sizeof(GLfloat);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, this->vertexBufferSize, (const void*)offset);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->indexBuffer);
glDrawElements(GL_TRIANGLES, this->indexBufferSize, GL_UNSIGNED_SHORT, 0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);

sentences:
Delta times and frame lag in the game loop Let's say we have a standard gameloop like this, in pseudocode:

while (true) {
    dt = GetDeltaTime();
    Update(dt);
    Render();
}

Here Update(dt) either uses a true variable timestep, or it determines how many cycles of a fixed timestep physics loop to execute based on dt.

Now say we have the common case where we have mostly constant framerate except for infrequent single-frame hiccups, so let's say we have dt values like

1/60, 1/60, 1/60, 1/6, 1/60, 1/60, ...

By the time our GetDeltaTime() detects the larger timestep in the fourth frame, we have already rendered and presented the fourth frame! So one frame will already have been rendered with a wrong (too small) timestep no matter what we do.

So if we now use the larger dt=1/6 to render the fifth frame, my understanding is that we artificially create a second frame where a wrong timestep is used, this time a too large one. I wonder if this problem is acknowledged anywhere. Wouldn't it be better, say, to use the averaged dt over the previous few frames to combat this?

Here are some pictures to illustrate what I mean. I use the example of an object moving along a fixed axis with a constant speed, and using a variable timestepping scheme. The problem is essentially the same with fixed timesteps, though.

The plots have time on the x-axis, and the object position on the y-axis.

Let's say the object moving at 1 unit/s, and framerate is 1 Hz. This is the ideal situation.

Now let's say we have a frame where the time interval is 2 instead of 1. With a classical dt-based scheme, we get this:

So we have one frame where the velocity is perceived too low, and one where it is perceived too high and which corrects for the velocity in the previous frame.

What if we instead, say, always use a constant (or very slowly changing) dt? We get this:

The perceived velocity seems smoother using this approach to me. Of course, the object position is now not the "true" one, but I think humans perceive abrupt changes in velocity more clearly than such small positional offsets. Thoughts?

UPDATE:

At least Ogre can do this: http://ogre.sourcearchive.com/documentation/1.6.4.dfsg1-1/classOgre_1_1Root_1f045bf046a75d65e6ddc71f4ebe0b2c.html So I guess I just got downvoted for people not understanding my question, which is rather frustrating.

sentences:
Can I develop a game for Kinect without a Kinect? I have to make a game in Unity3D using Kinect. The problem is I don't have the Kinect yet. I need to wait until they deliver it to me.

Can I imitate Kinect's movement for debugging my app?

sentences:
How can you visualize a quaternion? When I visualise a three dimensional rotation matrix, or scaling matrix I visualize it as three axes.

Is there a similar way that I can visualize a rotation quaternion?

sentences:
Posible to export f-curves in blender? I work with some friends on a rail shooter game in openGL. For creating our world we are using Blender. Since we want our Tank to follow a path I have started to work with creating bezier curves and exporting them. That works, but takes a lot of time. Is it possible to export the f-curves you use in the graph editor to an obj-file or any other file that can be used to describe the position for a specific point in time?

I would be grateful if someone has an idea that could be helpful.

sentences:
Efficient Rendering for multiple light sources I'm building a 3D rendering engine using C++ and OpenGL.

Right now, I've added support for multiple light sources in my GLSL shaders, but I've hit a bit of a bump for my rendering methods.

I'm worried about my engines performance if it has to render a lot of objects for a lot of light sources.

The straight-forward approach would be something like this:

for every object to be rendered
    closestLights []

    for every light in the scene
        if (light closer than all lights in closestLights)
            swap furthest light from closestLights with current light

    loadLightSourcesToShader(closestLights)

    renderObject(object)

However, I'm afraid the performance of this rendering-loop will degrade quickly since when either the amount of lights or the amount of objects increases, the amount of calculations will rise even quicker.

1) Is there any way to circumvent this?

2) How is this implemented in 'real' engines?

3) How can I find the closest K lightsources to an object efficiently?

I've heard about kd-trees and octrees, but I feel like building a tree everytime I render is probably worse than what I'm thinking about doing right now.

4) I could keep an octree and a kd-tree for every object (which keeps track of all other objects), which when using (smart) pointers, could be quite efficient in terms of time (but not space?).

Is this a good approach?

I know the saying 'Premature optimization is the root of all evil', but I'm pretty sure this WILL become a problem when a game/program reaches a certain complexity/size.

sentences: How to emulate PSX's graphics with OpenGL? I want to know what options (or shaders) to set so that my OpenGL game looks like Playstation 1 game. I know it probably can not be achieved 100 % because PSX used television and television renders differently that monitor. Thanks. :)

sentences:
How to close an app correctly on desktop? When I use Gdx.app.exit() the game window closes but the resources don't appear to be released and the app is still running.

For instance, to exit on when the escape key is pressed:

public boolean keyDown(int keycode) {

//...

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

The window closes, the dispose() method is called but Eclipse still reports that the app is open (because the terminate button is still available):

If the app had exited properly, the path to the JVM would have <terminated> in front of it, and the red terminate button would be greyed out.

Also when I use hide() and then dispose():

@Override
public void hide() {
    dispose();

}

@Override
public void dispose() {
    map.dispose();
    ...
    playerHitbox.dispose();
    System.out.println("----- END OF OUTPUT -----");

}

The same thing happens. You have to terminate the app with the button provided by Eclipse, or in the release version use the kill command (or task manager).

So my question is, how can I properly exit the app so all resources are gracefully unloaded, the window hides and the process exits in LibGDX?

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:
Buying music from an independent artist I have a concern regarding buying a song from an independent/amateur music artist. How can I demonstrate, if needed, that he actually sold that song to me and agreed to let me use his work for commercial purposes?! What if he decides, for a reason or another, to screw me saying that he didn't gave me authorizations?

The transaction etc. is made entirely online.

Thank you.

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:
How to correctly synchronize a shared surface? I am trying to share a direct3d9 surface between two processes. One process (let's call it A) writes to the surface, and the other (B) displays it on screen. Currently, process A does a StretchRect of its rendering surface to a shared surface, and then sets a flag in shared system memory to tell B that it's done. When B sees the flag, it then does a StretchRect of the shared surface to its own display surface. Process B then sets the flag again to tell A it is done.
It seems however that after the StretchRect on the shared surface returns, the texture has not necessarily finished copying, because sometimes Process B gets the previous picture, or sometimes even there is tearing (i.e. one half of picture N + one half of picture N + 1).
As I understand it, Direct3D is largely asynchronous under the hood, and does not ensure synchronisation between processes. I therefore need to ensure by myself that Process A has finished copying before displaying in process B, and vice-versa. Am I correct in my interpretation of the situation, and how would I achieve this? I am experimenting with LockRect() but I'm not sure if that's optimal or even guaranteed to work.
From MSDN documentation:

Shared cross-process surfaces provide no synchronization mechanism.
Read/write changes to a shared surface may not reflect a referencing
process's view of the surface when expected. To provide
synchronization, use event queries or lock the texture.
Only the
process that initially creates a shared resource can lock it (any
process that opens a reference to that shared resource cannot lock
it).

sentences: How to render tile maps in modern opengl? I'm trying to use SDL2 and Modern OpenGL to make a 2D rpg. The problem is, I have no idea how to render a tile map. I'm using the Tiled map editor to create maps. I have a vague idea of how to parse the maps using this (https://github.com/andrewrk/tmxparser) tmx parser.  I try to parse the maps using said parser, but then I run into the problem of how to actually get the tile maps to appear on screen, when using a spritebatch class. How would I go about rendering these maps using modern OpenGL?

sentences:
IwGame (Marmalade): Does CIwGameSprite support SVG? How? I have a small question about Marmalade IwGame engine.

Does the CIwGameSprite support SVG (I've read that yes it does)

If it does support SVG, how does it handle it,

Does it convert that Vector graphic to Pixel Graphics and cache it as an image then?

If it does not then how about the game performance? How does it handles animation, does it redraw the SVG each time?

How about scaling, if it does Caches images, Can I scale an SVG before scaling it?

Hopefully Someone can help

Thank you in advance

Ahmed

sentences:
Custom Model Format & Loading I've been working on a small engine for educational purposes. I understand that going production with "raw" model files like .obj is wrong mostly because of parsing and loading time. Thus, I want to create a program which parses these raw files and formats it in a new way, let's say using protobuf.

My questions:

Are there any best practices, or any example lib I can take a look at?
What should I do with attached texture files? Seperate files?
How can I support multiple types of models and/or attributes in the models like materials, uv mapping, etc...

sentences:
Programming logic to 2D point and click adventure/puzzle? I am totally new to game development. I want to create a 2D Puzzle/Adventure point and click game similar to like 'Rooms' but scenes are connected. I have already done the inventory system but currently lack the functionality to be used with an object in a scene.

My question is how do I approach creating a system that will take in dynamic number of events?  For example, I have key that will unlock the door, and the next scene I want to use it again without pre-programming this action specifically. I want to approach this in an efficient way so that I can use the system again for future games similar to this.

Can someone give me an idea because I am really stuck at this point. I don't want to program the game assigning individual scripts to each objects but rather do this systematically.

I am using Unity and C#

sentences:
Monogame resolution problem (without scaling sprites) So I'm working on a project and started working on a scaling system for different resolutions.

I know if you change the monogame resolutions, that the texture won't scale but I noticed deformed pixels. I just changed the PreferredBackBufferWidth to 1920 and the PreferredBackBufferHeight to 1080 but my pixels are deformed.I did some research and tested some resolutions and the only ones that don't work are 1920x1080 and higher.(1920x1080 works in fullscreen)

Draw method for sprites:

public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch, Color color)
{
    spriteBatch.Draw(textureImage, position, new Rectangle(
    (currentFrame.X * frameSize.X),
    (currentFrame.Y * frameSize.Y),
    frameSize.X, frameSize.Y),
    color, 0, Vector2.Zero, 1, SpriteEffects.None, 0);
}

spriteBatch.Begin:

spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null);

The first picture is the player head with the new resolution (without scaling the textures!) and the second picture is the player head with the default resolution (you can't see all the pixels at the bottom).

You can see that in the first picture a few pixels are deformed.

Question: Why doesn't 1920x1080 work in windowed mode (it works in fullscreen though) without deformation (I use a 1920x1080 monitor)? All I do is just enlarging the game window, I'm not scaling sprites...

-> is this because I have a 1920x1080 monitor?

sentences:
LibGdx, conflicting UI button clicks and screen touch events My game's main game class is a Screen which also implements InputProcessor to handle touch events.

The screen renders a TMX map using an HexagonalMapRenderer and a Camera, like this:

_camera = new OrthographicCamera();
_map = new TmxMapLoader().load("1087.tmx");
_mapRenderer = new HexagonalTiledMapRenderer(_map);
_camera.setToOrtho(false, Gdx.graphics.getWidth(),  Gdx.graphics.getHeight());

To allow the user to scroll the map, I am overriding the touchDown and touchDragged methods; it works.

However, I also have a Scene2D Stage rendering on the Screen, which I use to display some buttons.

They get displayed. and I have created a ClickListener like this:

 button.addListener(new ClickListener(){

    @Override
    public void clicked(InputEvent e, float x, float y){
        System.out.println("Clicked!");
    }
 });

If I use

Gdx.input.setInputProcessor(this);

Only the Screen scrolling functions will work, and the buttons will become unresponsive.

On the other hand, if I use:

    Gdx.input.setInputProcessor(stage);

I will be able to use UI buttons, but the map will become unresponsive.

I'd like to enable both (map will scroll if user clicks anywhere BUT the UI buttons, it will then fire the button clicked listener), is there any way to do this?

Thanks.

sentences:
How can I access a GameObject variable in mono script from editor script? In the mono script :
using UnityEngine;

public class TileTest : MonoBehaviour
{
    public GameObject prefabPathOnTerrain;

Then in the editor script at the top :
private SerializedProperty prefabPathOnTerrain;

Then inside OnEnable()
private void OnEnable()
    {
        prefabPathOnTerrain = serializedObject.FindProperty("prefabPathOnTerrain");
    }

And then inside a method I want to use it as a GameObject :
And instead using CreatePrimitive to use Instantiate :
But doing :
GameObject go = Instantiate(prefabPathOnTerrain);

Will not work.
public void TerrainObjects(GameObject gameobject)
    {
        Terrain terrain = Terrain.activeTerrain;
        var cube = GameObject.Find(string.Format("Terrain_{0}_{1}", gameobject.transform.localPosition.x, gameobject.transform.localPosition.y));
        if (cube != null)
            return;

        if (cube == null)
        {
              GameObject go = Instantiate(prefabPathOnTerrain);

            //cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
        }

        cube.transform.localPosition = new Vector3(terrain.transform.localPosition.x + gameobject.transform.localPosition.x, 0, terrain.transform.localPosition.z + gameobject.transform.localPosition.y);
        cube.transform.localScale = new Vector3(gameobject.transform.localScale.x, gameobject.transform.localScale.y, 1);
        cube.transform.parent = GameObject.Find("Terrain Map").transform;

        cube.name = string.Format("Terrain_{0}_{1}", gameobject.transform.localPosition.x, gameobject.transform.localPosition.y);
        cube.tag = "Terrain Map";
    }

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:
Gamedev related magazines Do you know any gamedev related magazines ?
I only know http://www.gdmag.com/ and http://www.gamasutra.com/ .

I also know http://ffdmag.com/ ,there's texts about flash (sometimes related to games)

sentences:
LineRenderer not working using Vuforia in Unity So I'm trying to render a line that shows up when camera sees an image target and moves around with it. Very typical AR application. But my line renderer doesn't seem to show at all.

Here's the code:

using UnityEngine;
using System.Collections;

public class myLine : MonoBehaviour
{
    // Creates a line renderer that follows a Sin() function
    // and animates it.

    public Color c1 = Color.yellow;
    public Color c2 = Color.red;
    public int lengthOfLineRenderer = 20;

    void Start()
    {
        LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>();
        lineRenderer.material = new Material(Shader.Find("Particles/Additive"));
        lineRenderer.widthMultiplier = 0.2f;
        lineRenderer.positionCount = lengthOfLineRenderer;

        // A simple 2 color gradient with a fixed alpha of 1.0f.
        float alpha = 1.0f;
        Gradient gradient = new Gradient();
        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(c1, 0.0f), new GradientColorKey(c2, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
            );
        lineRenderer.colorGradient = gradient;
    }

    void Update()
    {
        LineRenderer lineRenderer = GetComponent<LineRenderer>();
        var t = Time.time;
        for (int i = 0; i < lengthOfLineRenderer; i++)
        {
            lineRenderer.SetPosition(i, new Vector3(i * 0.5f, Mathf.Sin(i + t), 0.0f));
        }
    }
}

and here's my set up:

I also tried attaching the script directly to the ImageTarget and nothing happened.

sentences:
Check if GameComponent is ready in Unity? I am trying to create a MessageBox in Unity, but I'm having some troubles in C#.. This is my code (I'll explain my problem later):

MsgBox.cs

public class MsgBox : MonoBehaviour
{
    private UIButton _btn_ok;  // NGUI Button
    private UILabel _caption;  // NGUI Label
    private GameObject _box;   // The message box container

    void Start()
    {
        _box = this.gameObject;
        _btn_ok = _box.transform.Find("btn_ok").GetComponent<UIButton>();
        _caption = _box.transform.Find("Title").GetComponent<UILabel>();

        // ** the line below works fine, but I don't want to change the caption here **

        // this.Caption = "This Works";
    }

    public string Caption
    {
        get
        {
            return _caption.text;
        }

        set
        {
            _caption.text = value;
        }
    }
}

My Saved Prefab

As you can see, my prefab have the MsgBox.cs attached to the Box component (wich is the _box variable).

But this code doesn't work:

Fail Code

function createBox()
{
    GameObject wnd = (GameObject)Instantiate(Resources.Load("Box"));
    MsgBox mb = wnd.GetComponent<MsgBox>();
    bool foo = true;

    if (mb == null)
    {
        Debug.Log("MsgBox is null");
        foo = false;
    }

    if (!(mb is MsgBox))
    {
        Debug.Log("mb is not MsgBox");
        foo = false;
    }

    if (foo)
    {
        Debug.Log("passed!");
        mb.Caption = "Hello!";
    }
}

Console Output

  passed!NullReferenceException: Object reference not set to an instance of an object MsgBox.set_Caption (System.String value) (at Assets/scripts/MsgBox.cs)

If I change this:

public string Caption
{
    get
    {
        return _caption.text;
    }

    set
    {
        _caption.text = value;
    }
}

to this:

public string Caption
{
    get
    {
        return _caption.text;
    }

    set
    {
        if (_caption == null)
            Debug.Log("Caption is null");
        else
            _caption.text = value;
    }
}

and call createBox, the console give me this:

  Caption is null

Why? Why I can't change the caption from outside the MsgBox? Maybe the createBox() is being called first than Start()?

PS. Using Unity 5 64 bit. My platform is WebGL.
PS². English is not my native language, sorry.

sentences:
Unity based washing/ cleaning game advice I'm thinking about a way I can create a washing/ cleaning game as part of a project I'm working on within Unity, but given my lack of experience, I'm having trouble knowing where to start.

The goal is to be able to apply an effect of some kind to a Spine based character - which has a default 'idle' animation, and have the touch/ mouse positions remove the parts of the effect according to those positions.

I'm unsure how to go about creating such an effect - would I need to create a 'dirty' version of each sprite image used within the Spine imported character and make parts of it transparent, or would something like a shader be suitable?

While I have a lot of experience with C#, I have little experience with Unity, and having Googled for examples or tutorials or creating something like this, I'm left no better off...

I was hoping for some advice or pointers from the community...

Thanks!
Kieron

sentences:
Relevant file paths for reading in from a file? Working on something in XNA, need to be able to read in data from a text file for something.

Trying to figure out how I can shorten this pathname down, so instead of it always checking there, it just checks in the directory where the actual program is.

I tried doing "\Data\Zone\"+filenamestring+".txt" as my path but it didnt work.

What I have that works:

Sub loadFromFile(ByVal fileNameString As String)
        If System.IO.File.Exists("C:\Users\user\documents\visual studio 2010\Projects\asdf\asdf\asdf\Data\Zone\" + fileNameString + ".txt") Then
            MsgBox("It found it.")
        Else
            MsgBox("Could not find it")
        End If
End Sub

While this works, unfortunately this will probably only work on my machine. How do I shorten the file path so its flexible and relevant to the directory where the program is actually located at?

sentences:
Determining IF & WHERE a line intersects with a 2D plane (in 3D space) The following problem I'm working on is for one of my favorite past-times: game development.

Problem: We're in 3D space. I'm trying to determine if a line between two vectors in said space is passing through a circle; the latter of which consists of: center vector, radius, yaw & pitch.
In order to determine that, my aim is to convert the circle to a plane which can either be infinite or just have the diameter of the circle for all it's sides.
Should the line between the two vectors in fact pass through that plane, I am left with the simple task of determining whether that intersection point is within the radius of the circle, in which case I can return either true or false.

What's already working: I have my circles set up and the general framework is there. The circles are appearing/rendered in the 3D space exactly as specified, great!

What was already tried: Copied some github gist codes and tried to make them work for my purposes. I kinda worked, sometimes at least. Unfortunately due to the nature of how the code was written, I had no idea what it was doing and just scrapped all of that. Researched the topic a lot, too. But due to me not really understanding the language people speak when talking about line/plane intersections, I could have read the answer without recognizing it as such.

Question: I'm stuck at line intersections. No idea where to go and how it works logically! So, where do I go from here and how can one comprehend all of this?

Note: I'm working with Java, but I'm not looking for spoon-fed code. It's a logical issue I'm trying to get past. If explained well enough, I will make the code work with trial and error!

sentences:
Unity's free look camera too far away I've been making a game to learn unity and I have been using the free look cam that comes default but have encountered a problem that I don't know how to fix. Basically the camera rig isn't following the target very well, it follows really far behind the target and I have turned up the move speed, messed with other settings but no luck.

Help please!

sentences:
Skeletal animation with Unity2D? I want my character to aim with the mouse so, arms and head must move following mouse cursor and when the character is stand still it could change its stance a bit to accommodate the arms position. I used to use skeletal systems and in this situation I would use a bone that would move both arms at once but it seems Unity animation only supports tweenings. Can this be done with this system?

On the other hand how would you setup the character to easily make it follow shooting position with head and arms without moving all elements from code? As an example, if I had bones I would have set one parent bone for arms and use it to move both at once, etc. I guess IK and constrains is the way to go.

sentences: How to apply shaders on primitives There are tutorials about applying shaders to 3D models, but I would like to know how to use shaders on primitives. I have a world with a lot of vertices and I would like to apply a shader to it without adding any texture to it or loading any model. I'm working with XNA and HSLS.

sentences:
TBN Matrix : Eye vs. World Space Conflict I am tired of misleading and insufficient articles making me more confused each time I read, I need a clarification that will solve my TBN matrix problem forever.

Each article I read informs me differently about from which space TBN matrix converts to tangent space. One article says that it converts from eye space, other one says that it converts from world space  to tangent space.

As far as I know, world space is ModelMatrix * vertex, eye space is ViewMatrix * ModelMatrix * vertex. Another article says that transpose of TBN Matrix actually does it.

Can you please explain me how to use TBN matrix, does it (or transposed tbn) convert from eye or world to tangent ? Should I convert my lighting vectors from eye space to world and then apply TBN on them ?

sentences:
SharpDX(DirectX 11) N-tier layering of images I have an project I'm looking for a better solution to. I have a need to render n images over each other the previous one. So I have loop if you will. This should simulate alpha bending via basic combining the target and overlay pixel color values. Please see code below.

public void Render()
    {
        Device3DModule.DeviceContext.ClearRenderTargetView(Device3DModule.RenderTargetView, Colors.Blue.ToDXColor());

        CompositeShader.Apply();

        foreach (var image in Images)
        {
            Texture2D target = null;
            var pass01 = true;

            foreach (var imageChannel in image)
            {
                if(!imageChannel.IsVisible || imageChannel.Image == null) continue;

                imageChannel.Pass01 = pass01;

                Device3DModule.DeviceContext.PixelShader.SetShaderResource(1, imageChannel.Image);
                imageChannel.CopyToDeviceBuffer(ref m_ChannelSettingBuffer);

                QuadMesh.Draw();

                target?.Dispose();

                target = new Texture2D(Device3DModule.Device, Device3DModule.RenderTarget.Description);
                Device3DModule.DeviceContext.CopyResource(Device3DModule.RenderTarget, target);

                ShaderResourceView = new ShaderResourceView(Device3DModule.Device, target);
                Device3DModule.DeviceContext.PixelShader.SetShaderResource(0, ShaderResourceView);

                pass01 = false;
            }

            target?.Dispose();
            ShaderResourceView.Dispose();
        }
    }

Does anyone have a better idea?

sentences:
How to separate production and test assets during development? this is like a complement for Assets Management, database or versioning system?.

I am wondering about how to separate development, specially programmers assets from production assets?

For example, if we keep all the assets on the same repository, how do you keep with programmers assets and final game assets? Do you keep a separate directory for each of those, allowing duplicates? Or do you use some fancy scheme for striping out the "development" and "test" assets from final build?

sentences:
Why might my Object Attributes become linked after refactoring? As part of a game design class I'm taking this semester, I'm developing the basics of a game engine. I shared what I had in the GameDev chatroom, earlier, and everything was working as expected.

Then, because I knew it needed it, I started work on refactoring the core classes within my code. I modified the ancestor GameObject class, and after the tedious process of renaming all the method and field calls (I combined two float's, xPosition and yPosition into a single, Vector2d class - yes, I realize there are existing classes out there, but it was easier to simply write a new one, given that I can't make any assumptions on the installed libraries when it comes time for grading my work. I digress), prepared to test my newly refactored code.

The results were... perplexing. Suddennly, my SpawnPoint object was moving. Not only that, but it seemed attached to the PlayerEntity object itself, always matching the position of the controllable playerEntity (though it lagged a bit behind if you moved fast enough). And yet, I know that I never move the SpawnPoint, only the player entity; a quick search (ctrl+f) through my code confirmed that. But despite this, I had somehow managed to achieve quantum entanglement of these disparate objects.

I've reproduced both constructors below. Is this a case of passing by reference instead of by value? If so, is there a general way to avoid such troubles when instantiating objects with other objects as parameters?

Original Code:

public class PlayerEntity extends GameObject{

  SpawnPoint playerSpawn;
  public boolean isDead = true;
  float xVelocity;
  float yVelocity;

  //constructor, single dimension
  PlayerEntity(SpawnPoint spawn)
  {
    this.objClass = "entity";
    this.playerSpawn = spawn;
    this.xDiameter = 15;
    this.yDiameter = 15;
    this.xVelocity = 0;
    this.yVelocity = 0;
  }

  void respawn(){
   isDead = false;
   this.xPosition = playerSpawn.xPosition;
   this.yPosition = playerSpawn.yPosition;
  }

Refactored (Bugged) Code

public class PlayerEntity extends GameObject{

  SpawnPoint playerSpawn;
  public boolean isDead = true;
  Vector2d velocityVector;
  float xDiameter;
  float yDiameter;
  //constructor, single dimension
  PlayerEntity(SpawnPoint spawn)
  {
    this.objClass = "entity";
    this.playerSpawn = spawn;
    this.xDiameter = 15;
    this.yDiameter = 15;
    this.velocityVector = new Vector2d(0,0);
    this.positionVector = this.playerSpawn.positionVector;
  }

void respawn(){
   isDead = false;
   this.positionVector = playerSpawn.positionVector;
  }

The first thing first thing the PlayerEntity does in its update() method is call "respawn()" if isDead = true (which is why I think I got away without initializing the position in the first, working, code).

With the help of a debugger, I've narrowed down the method call which (unintentionally) modifies the spawnpoint's position. I'll probably edit that into the question when I have exactly identified the culprit.

Edit: Here is the method where the value is changing (though I don't know why), taken from playerEntity.

Original (working correctly)

void moveEntity()
      {

    this.xPosition += this.xVelocity;
    this.yPosition += this.yVelocity;
}

Refactored method (bugged behavior)

void moveEntity()
      {

    this.positionVector.xCor += this.velocityVector.xCor;
    this.positionVector.yCor += this.velocityVector.yCor;
  }

for whatever reason, this is causing the spawnPoint's positionVector to alter as well.

This program is written in Processing (which is just a java library, albeit one with its own IDE).

sentences:
Typedef redefinition error when running Unity iOS project in Xcode 9 simulator I was able to run my Unity 2017.1.0b10 iOS project successfully on my iPhone 6S+ (Using Xcode 9). I changed the Target SDK to Simulator SDK to try it out on other device simulators then I got the following errors in the UnityMetalSupport.h file.

Below are screenshots of my player settings:

sentences:
Mapping decibel range to linear audible intervals I am working in an engine that encodes sound as decibels (dB). Let's assume the decibel range of human hearing is -60dB to 0dB.

Audibility is not linear across this range.

So my question is...

How does one map a decibel range to a set of numbers (for example, 1-10), such that each number corresponds to (roughly) one linear step up in audibility?

sentences:
Why do these textures tile rather than just overlap? It might help to provide all the details, so here is the YouTube tutorial which sparked my question.

There's a prefab of the background tile called "Tile Background." This prefab has the default settings, except that Pixels Per Unit is set to 512, and that it has a script attached to it called BackgroundTile which hasn't even been opened. It's just there for the other script to reference.

An empty object was created called Board, which has Tile Background as its tile prefab. It also has a script, Board.cs, the contents of which are here:

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

public class Board : MonoBehaviour
{
    public int width;
    public int height;
    public GameObject tilePrefab;
    private Backgroundtile[,] allTiles;

    // Start is called before the first frame update
    void Start()
    {
        allTiles = new Backgroundtile[width,height];
        Setup();
    }

    private void Setup() {
        for(int i = 0; i < width; i++) {
            for(int j = 0; j < height; j++) {
                Vector2 tempPosition = new Vector2(i, j);
                Instantiate(tilePrefab, tempPosition, Quaternion.identity);
            }
        }
    }
}

Width is set to 4. Height is set to 7.
Other than that, the camera position is X:1.5,Y:3 and the aspect ratio is 9:16.

My question is this: why, when this is run, does Vector2(i,j) get interpreted as tiling the sprites, rather than placing the sources of the sprites in a 4x7 pixel grid, where they overlap almost entirely? There's no place where their positions get multiplied by the size of the tiles, right? Halving the pixels per unit doesn't even just halve the height of the board - it stays a constant size and looks really weird, despite the board not having set dimension attributes.

What's going on here?

sentences:
SDL: How would I add tile layers with my area class as a singleton? I´m trying to wrap my head around how to get this done, if at all possible. So basically I have a Area class, Map class and Tile class. My Area class is a singleton, and this is causing some confusion. I´m trying to draw like this: Background / Tiles / Entities / Overlay Tiles / UI.

void C_Application::OnRender()
{
    // Fill the screen black
    SDL_FillRect( Surf_Screen, &Surf_Screen->clip_rect, SDL_MapRGB( Surf_Screen->format, 0x00, 0x00, 0x00 ) );

    // Draw background

    // Draw tiles
    C_Area::AreaControl.OnRender(Surf_Screen, -C_Camera::CameraControl.GetX(), -C_Camera::CameraControl.GetY());

    // Draw entities
    for(unsigned int i = 0;i < C_Entity::EntityList.size();i++)
    {
        if( !C_Entity::EntityList[i] )
        {
            continue;
        }

        C_Entity::EntityList[i]->OnRender( Surf_Screen );
    }

    // Draw overlay tiles

    // Draw UI

    // Update the Surf_Screen surface
    SDL_Flip( Surf_Screen);
}

Would be nice if someone could give a little input. Thanks.

sentences:
How do I handle rope physics with fixed ends and a sliding weight? I've been interested in rope physics recently—I've successfully implemented a simple Verlet rope with moveable ends. Now I am trying something a little different: I want to start by recreating the mechanic from the game Sky Tourist (video here):

I assume Sky Tourist uses Verlet integration for its rope, but it also has the main character sliding along the rope as a moving weight. How can I recreate that?

Is it just done by applying different gravity to where the character is? Also, how is the collision detection handled between the character and the rope? If the game uses a physics engine like Box2D, how does it make it play nice with the rope, considering it's not a part of the Box2d world?

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:
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:
Small collision engine How can I do AABB collision engine? What do I need? I need it to do a platformer game (don't want to use box2d etc.).

I tried to make it like this

void GameplayScreen::Update()
{
    ePlayer->Update();
    collision();
}

void GameplayScreen::Draw(SDL_Renderer *renderer)
{
    DrawMap(renderer);
    ePlayer->Draw(renderer);;
}

void GameplayScreen::DrawMap(SDL_Renderer *renderer)
{
    for (int y = 0; y < map.size(); ++y)
        for (int x = 0; x < map[y].size(); ++x)
            if (map[y][x] != 0)
            {
                SDL_Rect destRect;
                SDL_Rect srcRect;

                srcRect.w = 32;
                srcRect.h = 32;
                srcRect.x = blockID * srcRect.w;
                srcRect.y = 0;

                destRect.x = (x * 32);
                destRect.y = (y * 32 );  /
                destRect.w = 32;
                destRect.h = 32;

                vBlock[Earth]->Draw(renderer, srcRect, destRect);
            }
}

void GameplayScreen::Collision()
{
    for(int y = 0; y < map.size(); ++y)
        for(int x = 0; x < map[y].size(); ++X)
            if(map[y][x] != 0)
            {
                int mapX = x * 32;
                int mapY = y * 32;
                int mapW = x * 32 + 32; // I tried (x + 32) * 32 also
                int mapH = y * 32 + 32; // I tried (y + 32) * 32 also

                int playerX = ePlayer->getPosX();
                int playerY = ePlayer->getPosY();
                int playerW = ePlayer->getPosX() + ePlayer->getHitBoxX();
                int playerH = ePlayer->getPosY() + ePlayer->getHitBoxY();

                AABB aabb(mapX, mapY, mapW, mapH);
                if(aabb.chechCollision(playerX, playerY, playerW, playerH))
                {
                    //I don't know what do write here
                    //I wrote what I thought would be good

                    if(playerX <= mapW && playerX >= mapX)
                    {
                        std::cout<<"Player collision Left"<<std::endl;
                    }
                    else if(playerW >= mapX && playerW <= mapW)
                    {
                        std::cout<<"Player collision  right"<<std::endl;
                    }
                    else if(playerY <= mapH && playerH >= mapH)
                    {
                        std::cout<<"Player collision top" <<std::endl;
                    }
                    else if(playerH >= mapY && playerH <= mapH)
                    {
                        std::cout<<"player collision bot"<<std::endl;
                    }
                }
                else std::cout<<"NO COLLISION"<<std::endl;
            }
}

bool AABB::checkCollision(float x1, float y1, float w1, float h1)
{
    if ((x <= w1 && x >= x1)
            && (w >= x1 && w <= w1)
                && ((y <= h1 && h >= h1)
                    || h >= y1 && h <= h1)) // I tried here with &&
    {
        return true;
    }
    return false;
}

The problem with this is that, even if map[y][x] == 0 => no collision.

The game says that there is a collision.

sentences: Create BGRA texture SFML I have a texture sfml but this texture have a format RGBA how i can change it to BGRA? Or how to create texture with need able format for me?

sentences:
Isolate UI elements from 3D scene this might seem like a silly question but I'm raycasting on specific objects (Targets) in a scene and zooming in on them but i also have a few UI elements (buttons, toggles...) on the side of the screen that need to always be visible because they provide certain functionalities (isolate target, switch view...).

The problem is that sometimes when i want to click on a certain UI element I unintentionally send a Raycast that changes my target. Moving the UI elements is not helpful since the objects occupy the whole screen. What other ways do I have to make sure I'm only clicking the UI element? (especially for smaller screens)

sentences:
How can I approach writing a GUI framework for my game? The problem

I want to write a simple GUI framework designed for a game, in order to learn the inner workings and nitty-gritty of how GUI 'engines' such as Unity3D's GUI work. I can't find any resource to help me get started.

What I'm looking for exactly is the abstract methodology of GUI programming, so things like what are the components of a GUI framework, how often and in what ways should the interface be updated with data, what are the different ways to connect the visuals in the interface to the logic behind them, how should clicking events be handled, things like that.

What I tried

I've been trying to research my options for months but to no avail. Looking up keywords like "GUI programming" or "GUI programming philosophies" leads nowhere and doesn't answer the questions I mentioned above.

There are plenty of resources and tutorials out there for things like OpenGL, how to write a game loop, how to write a physics engine, but nothing like that for writing GUI systems. The wikipedia pages for these topics are also usually a good starting point, but the GUI entries are too design-focused, failing to focus on programming-specific methodology/architecture.

I also tried starting from the web GUI frameworks I know such as React and Angular, and learned a few interesting things like the the view-model-viewmodel architecture and React's virtual DOM, but I still don't know how to apply them, how to generalize them into some framework/philosophy I can follow while coding, and whether there are any other possible options.

P.S. My environment is C# and OpenGL through OpenTK, but that hopefully won't matter in terms of respondents giving a broad overview.

sentences: Getting the rightmost point of gameobject How do i determin the point on a gameobject that is most to the right (highest x value).

sentences:
Unable to hide / destroy AdMob Ads in Unity I am currently working on a small game project and I want to monetize my game with AdMob ads. So I watched this YouTube Tutorial.

It works fine, but the problem is ad appears in all the scenes. So I don't want that. I want the ads on certain scenes.

For example, look at the image below.

I want the ad on Instruction scene. So when the player clicks on Back To Main Menu button ad should disappear.

I tried

bannerView.Hide ();
bannerView.Destroy();

but Unity gives some errors, it says:

error CS0103: The name bannerView does not exist in the current context

Here is the script:

using UnityEngine;
using System.Collections;

// AdMob
using GoogleMobileAds.Api;

public class Instruction_Level_Manager_Script : MonoBehaviour
{
  // Audio
  public AudioClip My_Audio_Clip ;
  private AudioSource My_Audio ;

  // Use this for initialization
  void Start ()
  {
    My_Audio = GetComponent<AudioSource>();

    // AdMob Ad
    RequestBanner ();
  }

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

  // Back to Main Menu
  public void Back_To_Main_Menu(string Main_Menu)
  {
    //Playing Audio
    My_Audio.PlayOneShot(My_Audio_Clip);

    //Destroy when leaving the level
    bannerView.Hide ();
    bannerView.Destroy();

    Application.LoadLevel (Main_Menu);
  }

  // AdMob Advertisement
  private void RequestBanner()
  {
    #if UNITY_ANDROID
    string adUnitId = "ca-app-pub-xxxxxxxx/xxxxxxxx";
    #elif UNITY_IPHONE
    string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
    #else
    string adUnitId = "unexpected_platform";
    #endif

    // Create a 320x50 banner at the top of the screen.
    BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder().Build();
    // Load the banner with the request.
    bannerView.LoadAd(request);
  }
}

So what is wrong with this script? I Googled it, but couldn't find satisfying solution. If this method is not possible, how can I destroy the ad?

I am using Unity 5.

sentences:
boolean operations on meshes given a set of vertices and triangles for each mesh. Does anyone know of an algorithm, or a place to start looking( I tried google first but haven't found a good place to get started) to perform boolean operations on said meshes and get a set of vertices and triangle for the resulting mesh? Of particular interest are subtraction and union.

Example pictures: http://www.rhino3d.com/4/help/Commands/Booleans.htm

sentences:
What C++ libraries can be used in game development I'm currently in the planning stage for my next game, and since I've been away from C++ for a while I have some questions about helpful libraries. I plan on making a 2D game with SDL, constructing my own simple 2D engine. I plan on making this game for the PC.

What libraries would you recommend to make this process easier?

What about unittests?

What about an enforce operator to throw exceptions?

int a = 1;
enforce(a == 2); //Throws an exception,

Specifically, i'm looking for general purpose libraries, that implement that make my life easier (like boost). Also, a helpful library for physics/collision, AI, XML file parsing (specifically working with the Tiled map editor), and any others that you guys have used that are useful in a 2D game.

sentences:
Correctly transforming normals for G-Buffer in Deferred Rendering I have a deferred rendering system: first there is the G buffer generation, then there is the lighting or shading calculation on that gbuffer data.

However there seems to be an issue with various rendering algorithms and I can’t determine why that is. I think it’s because my normal’s Gbuffer texture or other G buffer texture does not have the proper format or space in terms of world space, tangent  space etc.

The algorithms that rely on normal information such as normal oriented ambient occlusion and parallax occlusion mapping don’t work they just look wrong And not what they’re supposed to be by a long shot.

In the G buffer generation stage, my vertex shader simply passes along world space vertex positions and world space normals to the Gbuffer's fragment shader. I do this by multiplying the world matrix or model matrix by the normal and by the position. In the fragment shader I then write these out as is to the G buffer.

Is this correct? Should I be passing along the Raw position & normals to the fragment shader and then multiplying the matrices in the fragment shader instead?

Edit 1:

Ok, So using the "normalMatrix" didn't change anything.  Here is a screen shot of my ambient-occlusion pass demonstrating the issue.  There is a screen space split that basically inverts the colors. and some other oddities.

The SSAO Shader is As Follows.

void main()
{

vec3 WorldPosition = texture(GPositionsTexture, In_TexCoords).xyz;
vec3 WorldNormal = normalize(UnScaleNormal( texture( GNormalsTexture, In_TexCoords ).xyz ));

vec3 Random = texture(KernalNoiseTexture, In_TexCoords * KernelNoiseScale).xyz;
vec3 Tangent = normalize(Random - WorldNormal * dot(Random, WorldNormal));
vec3 BiTangent = cross(WorldNormal, Tangent);
mat3 TBN = mat3(Tangent, BiTangent, WorldNormal);

float Occlusion = 0.0;
for (int i = 0; i < KERNEL_SIZE; ++i)
{
    // get sample position:
    vec3 Sample = TBN * Kernel[i];
    Sample = Sample * Radius + WorldPosition;

    // project sample position:
    vec4 Offset = vec4(Sample, 1.0);
    Offset = CamData.Projection * CamData.View * Offset;
    Offset.xy /= Offset.w;
    Offset.xy = Offset.xy * 0.5 + 0.5;

    // get sample depth:
    float SampleDepth = texture(GPositionsTexture, Offset.xy).z;

    // range check & accumulate:
    float RangeCheck= abs(WorldPosition.z - SampleDepth) < Radius ? 1.0 : 0.0;
    Occlusion += (SampleDepth <= Sample.z ? 1.0 : 0.0) * RangeCheck;
}

Occlusion = 1 - (Occlusion / KERNEL_SIZE);

Out_Diffuse = pow(Occlusion, Power);
}

sentences:
How to generate or smooth really large procedural terrain? I'm currently trying to generate a really large procedural terrain in WebGL. I use a quadtree for LOD and plan to generate 1 heightmap for each quadtree node (terrain patch).

The heightmaps are generated on the GPU and with such a large terrain, 32 bits floats don't have enough precision for the smaller terrain patches. This results in terrain becoming "blocky". This article uses bicubic surfaces to smooth things out.

I thought a lot about it and the only other solution I have is to generate the smallest terrain patche on the CPU (with double precision) instead of the GPU, but continue to generate the larger patches on the GPU. But this doesn't seem like the best thing to do. Does someone have an idea for a better solution?

Also, I can't use double precision on the GPU because I'm using WebGL, which doesn't support it.

Thanks a lot :)

sentences:
Skip processing individual triangles or vertices of the mesh In my game I have a billiard table, and a floor below the table. In typical situation the table covers 80% of the screen, so only small amount of the floor is visible. And I render the table first, so invisible part of the floor is discarded by the depth buffer test.

But profiling with Nsight shows me drawing the floor takes significant amount of time, and it is spent in the rasterizer. It seems generating all those pixels of the floor and depth testing them takes a long time.

I'm wondering how to solve this problem and one thing I tried is to divide the floor (a rectangle with two triangles) to multiple rectangles, so some of them could be cancelled in an earlier stage. The problem is, this is still one model / mesh, just with more triangles and I don't know how to start.

What would be a way to achieve this in Monogame + HLSL? Somewhere in vertex shader? Or gemoetry shader (is it supported in monogame?)

Or is there any other way to optimize this?

UPDATE: the whole floor is needed and might be drawn depending on where the camera is, so I can't get rid of parts of it. In typical situations table top covers 80% of the screen because of perspective and looking down at an angle. The game is in 3D.

sentences:
Using this.GameObject I once read (I actually don't remember where, I'm looking for it) that using this.GameObject to call the script owner is a very bad practice.

I believe it has to do with some sort of information hiding, but I couldn't figure out why. What are the disadvantages with this? Is there a best-practice to achieve the result?

sentences:
How do I control texture appearance based on game play events? In an FPS I am developing, I am procedurally altering the appearance of textures based on game play events, and would like to know if the way I have implemented this was a good idea.

Right now, on each frame, I am grabbing a pointer to the uncompressed image and writing to it using memset. It's pretty straightforward if I want to have game play events affect the texture's appearance, because all I have to do is tie whatever attribute I like from any game object into the function writing the image data. For example, using this I could get the player's x,y position and draw an x directly to a map texture as the player moves around.

Is there a better way to implement this functionality in general?

My first thought would be to use shaders instead, but I haven't been able to find anyone doing anything like this and I know almost nothing about shaders. I feel like I could be missing something obvious to someone.

I am trying to keep this question as engine-independent as possible, but if relevant, I am using Source Engine procedural materials.

sentences:
How can I make the cursor avoid something completely? I wrote some code for a UI button that causes the mouse to avoid it. I realize this is kind of a weird thing to do in a game design-wise, but this is a really weird game. I need a button that is not only unclickable, but also unhoverable. I got it mostly working, but I cannot seem to change the position before the mouse is drawn, probably because mouse movement is handled by the OS, unless there is a problem with my code that I missed. As a result, pushing the mouse against the button boundaries results in a stutter. The mouse briefly appears over the button before I can move it, so it is still possible to click the button.

A demonstration of the button avoidance and stutter: https://youtu.be/7tgIrJ_vMDg

[DllImport("user32.dll")]
public static extern bool SetCursorPos(int X, int Y);
[DllImport("user32.dll")]
public static extern bool GetCursorPos(out Point pos);

...

void Update () {
    var mousePos = Input.mousePosition;
    if (Application.isFocused && isOver) {

        //Get the current mouse position from OS so we can change it;
        Point cursorPos;
        GetCursorPos(out cursorPos);

        if (oldMousePos.x > xMin && oldMousePos.x < xMax)
        {
            //Coming from above or below. Figure out which one
            //and move mouse accordingly
            if (oldMousePos.y > uiPos.y)
                cursorPos.y -= (int)(rt.rect.height / 2 - (mousePos.y - uiPos.y));
            else
                cursorPos.y += (int)(rt.rect.height / 2 - (uiPos.y - mousePos.y));
        }
        else
        {
            //Coming from either left or right.
            if (oldMousePos.x < uiPos.x)
                cursorPos.x -= (int)(rt.rect.width / 2 - (uiPos.x - mousePos.x));
            else
                cursorPos.x += (int)(rt.rect.width / 2 - (mousePos.x - uiPos.x));
        }
        //Give new coordinates to OS to update mouse position
        SetCursorPos(cursorPos.x, cursorPos.y);
    }
    else
    {
        //track the old position to know what direction
        //they moved their mouse from so we can put it back
        oldMousePos = mousePos;
    }
}

I tried using the Cursor API to force it to software mode thinking that might fix it, but it still stutters, and I would prefer to use the default cursor anyway, and hardware mode if possible. Is there any way to work around this or remove the stutter?

sentences:
Understanding normal maps on terrain I'm having trouble understanding some of the math behind normal map textures even though I've got it to work using borrowed code, I want to understand it.

I have a terrain based on a heightmap. I'm generating a mesh of triangles at load time and rendering that mesh.

Now for each vertex I need to calculate a normal, a tangent, and a bitangent. My understanding is as follows, have I got this right?

normal is a unit vector facing outwards from the surface of the triangle.
For a vertex I take the average of the normals of the triangles using that vertex.

tangent is a unit vector in the direction of the 'u' coordinates of the texture map.

As my texture u,v coordinates follow the x and y coordinates of the terrain, then my understanding is that this vector is simply the vector along the surface in the x direction. So should be able to calculate this as simply the difference between vertices in the x direction to get a vector, (and normalize it).

bitangent is a unit vector in the direction of the 'v' coordinates of the texture map.

As my texture u,v coordinates follow the x and y coordinates of the terrain, then my understanding is that this vector is simply the vector along the surface in the y direction. So should be able to calculate this as simply the difference between vertices in the y direction to get a vector, (and normalize it).

However the code I have borrowed seems much more complicated than this and takes into account the actual values of u, and v at each vertex which I don't understand the need for as they increase in exactly the same direction as x, and y.

I implemented what I thought from above, and it simply doesn't work, the normals are clearly not working for lighting.

Have I misunderstood something?
Or can someone explain to me the physical meaning of the tangent and bitangent vectors when applied to a mesh generated from a hightmap like this, when u and v texture coordinates map along the x and y directions.

Thanks for any help understanding this.

sentences:
Implementing recoil in a realistic and balanced way? To clarify, I've seen this post already

I really like the idea that the chosen answer suggests, yet when I go to implement it the recoil still doesn't "feel" right. The problem is mainly the fact that I'm moving the crosshair instantly to a new location and it feels quite jerky when playing around with it. I think that in order to properly implement recoil I need to move the crosshair more than once over multiple game ticks.

I think the main issue is that many games with realistic recoil "auto re-aim" (if you will) the gun as part of the recoil algorithm. This is from my experiences with various Source Engine games like Garry's Mod and Counter Strike. My best way of describing what I see and thinking about how it is implemented is that a point is chosen with a variance (usually up and slightly right) from the fire coordinates. The gun follows a sort of parabolic path (height depending on velocity of recoil) and eventually gets to the new point.

I'm getting kind of long winded but I hope most of what I said makes sense. Should I attempt to model the recoil implementation in the Source Engine? How would you go about implementing a realistic recoil algorithm? Are there any open source fps game engines that may be able to provide some inspiration?

sentences:
How to implement own UI widget in libGDX? I want to implement my own widget, here is an image:

what I want to get. Instead of numbers there will be some names, but I think it doesn't matter. I'm pretty new in libGDX, so could you please briefly describe me plan, how can I do something like this (if there will be some code, it would be awesome)? I tried to google it, but didn't find something relevant.

Thanks in advance!

sentences:
How to properly synchronize achievements on Google Play Services? I have a mobile game with achievements on android, so the achievements are using Google Play Services.

For a couple of reasons, I must track the progress on the achievements locally (or so I think) because:

If the user is not connected to the internet
Some achievements have complex "step" that the simple increment system provided by the Google Play Service (number of steps, current step) cannot track.

When the game starts, the local copy data on the achievements is synced with what is on Google's server. Either

both are the same, do nothing
the local copy has more progress than what is shown on Google's: so update Google data (that happens if you play offline)
the copy on Google's server show more progress than locally: so update the local data (that happens if you play on a different device)

Clearly, there's a way to abuse the system here. Given two players with different achievement progress (Player_A (lots of achievements), Player_B (few achievements)) they can do the following:

Using Player_B's device, Player_B signs out of his account
Player_A signs in (the current active Google Account is now Player_A)
Start the game
All of Player_A's achievements are synced locally (they had more progress than the previous local version of Player_B)
Player_A signs out and Player_B signs in
Re-start the game: the local copy will show as more advanced than Player_B achievements, therefore they will get updated.

How do people deal with this problem? Not care? Key the local achievement progress to the logged in player (which causes some problems)? Not to track anything related to the achievements locally (but how to deal/detect being offline?)

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:
Deserializing component array using JSON I have a collection of serialized components in JSON format:

{
    "components": [{
        "class": "com.package.component.PositionComponent",
        "x": 100,
        "y": 100
    }, {
        "class": "com.package.component.VelocityComponent",
        "x": 4,
        "y": 2
    }]
}

I want to load this into a collection of base Components in Java, specifically into an Entity. I am currently using YAML (parsed using SnakeYAML) to achieve this. The following file (which is virtually identical to the JSON one) is parsed and the components are stored in an ArrayList:

components:
- ==: com.package.component.PositionComponent
  x: 100
  y: 100
- ==: com.package.component.VelocityComponent
  x: 4
  y: 2

Is there any way I can achieve this using the JSON parsing facilities provided by LibGDX? I am currently using the following code to parse the components, but I have no idea how to get it to construct the correct appropriate object for each component:

JsonReader reader = new JsonReader();
JsonValue base = reader.parse("components.json");

for (JsonValue component : base.get("components")) {
    System.out.println(component.getString("class"));
}

sentences: How to handle pixel-perfect collision detection with rotation? Does anyone have any ideas how to go about achieving rotational pixel-perfect collision detection with Bitmaps in Android? Or in general for that matter? I have pixel arrays currently but I don't know how to manipulate them based on an arbitrary number of degrees.

sentences: Animation Texture spread out when animation on 3dsMax I have a 3d model of a human biped, i did the skeleton and attached it to my 3d model with a skin modifier. But when i move his arms a part of the trunk is comming too . Is it possible to fix this ?

sentences:
How to make this vector field animation This screenshot is from Windows app called MyRadar by ACME AtronOmatic LLC. I found their wind direction animation to be very visually appealing and was wondering if anyone knew how to create this animation?

I prefer Java, Python, C++, or MATLAB answers for the code for creating this animation if possible.

Edit: So I know MATLAB and Python already have libraries for creating vector fields. However, I only found the ones that only change the direction and magnitude of the arrow. In this animation, the vector field arrow moves along the vector field.

sentences:
Find centre of rotation from two locations Ultimately I need to get c from the image and have a, b and that it takes 90 degrees to get a to d.

My solution to this was to rotate a around to get to d by the rotation. Then use the Y value from a and X from d to get c.

So far I an having trouble getting the rotation of a to d to work properly, what am I doing wrong in the rotation?

    Vector3 d = (Quaternion.Euler(0f, 0f, rotation) * (a - b)) + b;

sentences:
Get world position from depth buffer I have a buffer I am rendering gl_FragDepth (remapped to range 0-1) to a color buffer (instead of color) in OpenGL

I would like to, in a second pass, read this depth and use the x and y coordinates of the current fragment to re-calculate the world coordinates.

I'm rendering my scene to an FBO, then I screenquad this FBO's contents to the screen and during that render i'd like to find the worldspace coordinates I rendered with initially.

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:
Why does Input.GetKey("enter") never return true? I want to modify an int variable on one script by having another script subtract 1 from it. But when I try to trigger this on an "enter" key press, nothing happens.

1st script:

public class spawnenemy : MonoBehaviour {

    public int enems = 1;

2nd script:

public class collisions : MonoBehaviour {

private spawnenemy enems;

void Start () {
    enems = gameObject.GetComponent<spawnenemy> ();

  }

void FixedUpdate(){
  if (Input.GetKey("enter")){
   enems.enems--;
 }
}

Thanks.

sentences:
Help understanding gluLookAt() I am fairly new to openGL( 3 months ) and am asking for assistance in understanding the fundamentals behind gluLookAt().

Currently I have spent most of my time with openGL modeling scenes with fixed views, and I wanted to begin using gluLookAt combined with keyboard and mouse callbacks to "explore" my scenes. I created a simple program to play around with the functionality of gluLookAt when I first realized I may not understand fully what is happening.

My program creates a world using glOrtho(-4,4, -4,4, -4,4) confining my area somewhat around the origin (0,0,0) upon which I place the standard glutSolidTeapot(0.5). Then in an attempt to create a "camera" revolve around the teapot, in an idle callback function I write this

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt( cos(business), 0, sin(business), 0.0,0.0,0.0, 0.0,1.0,0.0 /*up vector*/ );
glutPostRedisplay();

Turns out, this worked. The view shows a revolving teapot. So I take another step and attempt to create an elliptical path around the teapot, multiplying either cos() or sin() (not both) by 2. This works as well but does not have the same effect I was expecting. The view rotates around the teapot, but I imagined along the path the teapot would "appear" to be closer at points, a zooming in effect of sorts. This leads to my question.

What exactly do I not understand about this?
  or..
Why is this not doing what I am expecting?

sentences:
How do I convert from the global coordinate space to a local space? Given an entity named EntityA, I want to define a local coordinate space, where the position of EntityA is the origin, its heading vector is the X axis, and the normal of the heading vector is the Y axis:

Given their global coordinates, how do I find the position of another entity in EntityA's local space?

An example: EntityA's global position is (50,50), and that of EntityB is (80,90). What is then the position of EntityB in EntityA's local space?

EDIT: Please go easy on the math.

sentences:
Can I dynamicaly modify 3D objects? I am new to OpenGL, I am able to render a model object (a human model) that is using .obj and .mtl file in iOS.

Now I want to make a modification to the loaded model. For example, I want to change the height, or change the shoulder width, stomach size, et cetera.

Is this possible ? If so, how do I go about it?

sentences:
Characteristics, what's the inverse of (x*(x+1))/2? In my game you can spend points to upgrade characteristics. Each characteristic has a formula like:

A) out = in :
for one point spent, one pont gained (you spend 1 point on Force so your force goes from 5 to 6)

B) out = last level (starting at 1) :
so the first point spent earns you 1 point, the next point spent earns you an additional 2 and so on (+3,+4,+5...)

C) The inverse of B) :
You need to spend 1 point to earn one, then you need to spend 2 to earn another one and so on.

I have already found the formula for calculating the actual level of B when points spent = x :

charac = (x*(x+1))/2

But I'd like to know what the "reverse" version of B) (usable for C) is, ie. if I have spent x points, how many have I earned if 1 spent gives 1, 1+2=3 gives 2, 1+2+3=6 gives 3 and so on.

I know I can just calculate the numbers but I'd like to have the formula because its neater and so that I can stick it in an excel sheet for example...

Thanks!

ps. I think I have nailed it down to something like charac = sqrt( x*m +k) but then I'm stuck doing number guessing for k and m and I feel I might be wrong anyway as I get close but never hits the spot.

sentences:
Component based architecture: "pure" or some inheritance? (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();
shootingCastle.addComponent(aiComponent);
shootingCastle.addComponent(rangedAttackComponent);
shootingCastle.addComponent(physicsComponent);

All of this as opposed to my old approach:

Orc orc1 = new Orc();
ShootingCastle castle1 = new ShootingCastle();

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:
Can someone explain this Pulsate code to me // Pulsate the size of the selected menu entry.
double time = gametime.TotalGameTime.TotalSeconds;
float pulsate = (float)Math.Sin(time * 6) + 1;
scale = new Scale(1 + pulsate * 0.05f,1 + pulsate * 0.05f);

I grabbed it from the XNA GameState sample and just curious.

sentences:
My Canvas has an image which I am using for my background but it is blocking my Camera from seeing my Game Scene So I am not entirely sure how to explain this as I have not had any luck searching online and I'm sure this is a simple problem but I'm being stupid and can't see it.
I have a Canvas which is for my UI obviously and I have added an Image as a Background to the Canvas. The problem I am having is that due to the Image on the Canvas it is blocking my Camera from seeing the Scene with my game object you can see in the background.
On the Canvas, I have tried playing around with Sort Order, Render Mode, and see if I could edit the Z-Position but I can't seem to do that. I'm not too sure what I have missed but I must have missed something.
Any assistance would be great.

sentences:
Video Encoding library for C++ game I'm looking for a video encoding library in C++ that I can use to record game footage.

It can not be an external application like Fraps, it must be a library.

Ideally the encoding can be done in real time without affecting game performance too much, although this is not a must have requirement.

Another preference is that the video file being saved from the game is already compressed and ready to be used by most video players without any further processing. I realize that this might not be possible especially for real time encoding, so I would accept a trade off of having to process the file later for better compression and/or better file format.

I'd like to hear about your experience integrating the library into a game if possible and any interesting trade offs you had to make.

Some libraries support more that one file format or codec, so advice on the file format would also be appreciated.

sentences:
Relative quaternion rotation (delta rotation) produces unstable results Use case: I have a currentRotation quaternion and a targetRotation quaternion and need to calculate the relative rotation between them - as in: what rotation do I need to apply to transform an object with currentRotation so that it has targetRotation.

Common solutions say that the delta rotation can be calculated by qDelta = qFrom.inverse() * qTo, which I use as well and works fine for most cases.

However, I am often running into issues for some specific rotations -
Codepen Example here (I'm using three.js and coffeescript).

While a relative rotation around the z-axis works fine:

qFrom = (new THREE.Quaternion()).setFromAxisAngle new THREE.Vector3(0, 0, 1), 2 * (Math.PI / 6)
qTo = (new THREE.Quaternion()).setFromAxisAngle new THREE.Vector3(0, 0, 1), 5 * (Math.PI / 6)
qExp = (new THREE.Quaternion()).setFromAxisAngle new THREE.Vector3(0, 0, 1), 3 * (Math.PI / 6)
qDelta = calculateRelativeRotation(qFrom, qTo)
qResult = qDelta.clone().multiply(qFrom)

Sane case results (delta):  expected x: 0.0°, y: 0.0°, z: 90.0°, got x: 0.0°, y: 0.0°, z: 90.0°

Sane case results (result): expected x: 0.0°, y: 0.0°, z: 150.0°, got x: 0.0°, y: 0.0°, z: 150.0°

... a more complicated rotation does not work out - the combination of qFrom and qDelta does not result in the expected qTo rotation:

eFrom = new THREE.Euler(0, 170 * dToR, 10 * dToR, 'XYZ')
eTo = new THREE.Euler(0, 170 * dToR, -10 * dToR, 'XYZ')
eExp = new THREE.Euler(0, 0, -20 * dToR, 'XYZ')

Problematic case results (delta): expected x: 0.0°, y: 0.0°, z: -20.0°, got x: 0.0°, y: 0.0°, z: -20.0°

Problematic case results (result): expected x: -180.0°, y: 10.0°, z: 170.0°, got x: 176.5°, y: 9.4°, z: -149.7°

expected result quaternion (qTo): {'_x':-0.086,'_y':0.992,'_z':-0.007,'_w':0.086}
*

actual result quaternion: {'_x':0.257,'_y':0.962,'_z':-0.007,'_w':0.086}

Inverting the calculated delta rotations helps for some cases, but doesn't cover all cases.

What am I missing?

sentences:
GLSL light coloring blocked surfaces I have created a very simple lighting shader. It currently only supports point lights, but it lights up surfaces that are completely blocked from the light. I know why, but I want to know how I can fix it. I was thinking of using a form of shadow mapping to darken those areas, but shadow mapping is difficult for me to understand and has very major performance issues. I was hoping for a more elegant and efficient version, even if it is not as nice.

Until something like that exists, I need a nice, efficient way of checking to see if a fragment or vertex is visible and computing things from there. I would also like to add that I intent to support semi-transparent objects, which should block light based on and alpha value.

The things I want:

Fast (25+ fps with the modified shaders, I currently run at 82)
Easily modified to incorporate more lights (three or four at most, probably).
Support for edge smoothing (user can enable it, but will lose performance)

The things I do not want:

Pulling information from the GPU during rendering (view stuttering is always visible when that happens)
Visible/noticeable moving of lighting when scene is stationary (like the light is moving when it really isn't, due to randomizing)
Expensive operations when the scene first renders.

I do not expect anybody to implement these things - just to leave room and maybe a comment where these would be done. I know this is the "holy grail" of rendering when combined with bump maps and such, but if you tone down the quality a bit, I hope it is possible. I may have to do some extra work on the CPU, but that is acceptable.

Now for the shaders I currently have working:

Vertex shader

varying vec4 color;
varying vec3 normal;
varying vec4 position;

void main (void) {
    color = gl_Color; // pass color to the fragment shader
    normal = normalize(gl_NormalMatrix * gl_Normal); // calculate useable normals from the basic normal data.

    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; // set position
    gl_TexCoord[0] = gl_MultiTexCoord0; // set texture coordinates
    position = gl_Vertex; // pass gl_Vertex to the fragment shader for light calculations.
}

Fragment shader

varying vec4 color;
varying vec3 normal;
varying vec4 position;

uniform sampler2D texture;
uniform vec4 light; // position of the light, same coordinate system as non-transformed objects

void main (void) {
    vec3 vector = light.xyz - position.xyz; // get the vector needed to determine length
    float distance = sqrt((vector.x * vector.x) + (vector.y * vector.y) + (vector.z * vector.z)); // determine length
    vec4 final = color; // set color

    final.xyz *= (1.0 / distance); // calculate light intensity on pixel

    gl_FragColor = final * texture2D(texture, gl_TexCoord[0].st); // multiply by texture color
}

I can do a lot of extra cool things with this current code, such as giving lights their own colors and giving objects their own material properties, but that is not the point now. I just want basic code, preferably without needing more buffers and shaders, to determine visibility. From my research, it sounds like the stencil and depth buffers may be of use here, and they already setup, so they may be a better way to do it.

I can not stress enough that I only need the bare essentials here - nothing overly fancy. Thanks in advance for your help.

sentences: How to scale game with orthographic camera correctly? During porting to android I encountered that the game does not fit on the screen in portrait mode. It uses an orthographic camera. How could I scale to game to fit the screen in portrait mode?

sentences:
Are there alternatives to multiple buffering? I'm learning about game programming. So far, my sources lead me to believe that multiple buffering is the best technique for redrawing in OpenGL.

Are there other redrawing techniques? What are their advantages/disadvantages?

I'm not sure about terminology yet, but googling as best as I can hasn't yielded much result yet. Does anyone have any experience with redrawing techniques besides multiple buffering?

sentences:
Unity text is very blurry. How can I fix it? Unity text is very blurry. How can I fix it?
To be honest, I have no idea why it behaves this way:

Hope that someone faced the same problem and will be able to share how it was tackled.

sentences:
Movement on a curved planet surface I'm looking for a solution for moving a variety of objects over the uneven surface of my planet. The idea is that I will have a number of objects that follow the planetary landscape moving about in random directions.

The planet surface is made up of 6 sphere projected planes, all have been displacement mapped to create a "bumpy" surface. A grid based movement system would be ideal as it lends itself to a lot of pathfinding solutions. I am also using Unity, so leveraging the Physics engine is an option, but past experience hasn't yielded very good results.

I'm having trouble understanding the best approach for realistic movement, would it be a matter of calculating gravity and then translating the object along its forward, right etc. Or on the other hand would It be more a case of pre-calculating the path from A to B and applying that movement.

I've looked all over for some ideas on this subject but have found nothing. A few suggestions would be greatly appreciated.

Thanks.

sentences:
DirectX11, how do I manage and update multiple shader constant buffers? Alright, I'm having a hard time grasping how constant buffers are bound to a pipeline stage and updated. I understand that DirectX11 can have up to 15 shader-constant buffers per stage and each buffer can hold up to 4096 constants. However, I don't understand whether the ID3D11Buffer COM used to interact with the constant buffers is just a mechanism (or handle) used for fill these buffer slots or if the object actually references a particular instance of buffer data that is pushed back and forth between the GPU and CPU.

I think my confusion on the topic is the cause of a problem I'm having using two different constant buffers.

Here is some example shader code.

cbuffer PerFrame : register(b0) {
    float4x4 view;
};

cbuffer PerObject : register(b1) {
    float4x4 scale;
    float4x4 rotation;
    float4x4 translation;
};

The way my code is organized, the camera will be handling updating the relevant per frame data and GameObjects will be updating their own per object data. Both classes have their own ID3D11Buffer that is used to do this (Using a hub architecture, so one GameObject class will handle the rendering of all the instanced GameObjects in the world).

The problem is I can only get one updated at a time, depending on the slot and I presume the update order one buffer gets filled while the other gets zero'd out.

This is essentially my code. Both classes use identical update logic.

static PerObjectShaderBuffer _updatedBuffer; // PerFrameShaderBuffer if Camera class
_updatedBuffer.scale       = _rScale;
_updatedBuffer.rotation    = _rRotation;
_updatedBuffer.translation = _rTranslation;
pDeviceContext->UpdateSubresource(pShaderBuffer, 0 , 0, &_updatedBuffer, 0, 0);

pDeviceContext->VSSetShader(pVShader->GetShaderPtr(), 0, 0);
pDeviceContext->PSSetShader(pPShader->GetShaderPtr(), 0, 0);
pDeviceContext->VSSetConstantBuffers(1, 1, &pShaderBuffer);
pDeviceContext->IASetVertexBuffers(0, 1, &pVertexBuffer, &vStride, &_offset );
pDeviceContext->IASetPrimitiveTopology(topologyType);
pDeviceContext->Draw(bufSize, 0);

My main questions are -

Do I need to set or bind the ShaderBuffer in order to update it with the UpdateSubresource call? (Meaning manipulate it only when it is in the pipeline) Or is it a blob of data that will be sent in with the VSSetConstantBuffer call? (Meaning the order of binding and updating data doesn't matter, I can update it in the pipeline or somehow on the cpu)
When setting or binding the buffer, do I need to reference slot 0 to update the PerFrame buffer and slot 1 to update the PerObject buffer? Could some kind of confusion with this call in my code cause all the buffers to be overwritten?
How does D3D11 know which buffer I want to update or map? Does it know from the ID3D11Buffer COM used?

Edit -

Changed the constant buffer register tags in the example above. Using (cb#) instead of (b#) was affecting the buffers from updating correctly for some reason. Not sure where I picked up the original syntax or if it's valid at all, but it appears to of been my main problem.

sentences:
SteamWorks.Net for unity and inviting a friend to a multiplayer game I'm trying to send an invitation to a steam friend and have it that when he accepts I create a PUN 2 room for both players and they can start their match. So far I've done this :

 protected Steamworks.Callback<GameRichPresenceJoinRequested_t> m_GameRichPresenceJoinRequested;

private void OnEnable()
{
    m_GameRichPresenceJoinRequested = Callback<GameRichPresenceJoinRequested_t>.Create(OnGameRichPresenceJoinRequested);
}

public void InviteFriend()
{

    SteamFriends.InviteUserToGame(steamFriendData.friendSteamId, "");
}

private void OnGameRichPresenceJoinRequested(GameRichPresenceJoinRequested_t pCallback)
{
     Debug.Log(pCallback.m_rgchConnect);
    Debug.Log("<color=green>Friend accepted the invite</color> ");
}

The invite is being sent to the correct friend and when he accepts it launches the game but I get no callback from that and thus have no way to place them in a room. What am I doing wrong ?

sentences:
Transform manipulator for Unity/Oculus Touch game like in Quill, Medium etc I'm trying to create a script to manipulate the transform of a gameobject using the Oculus Touch just as in for instance Quill or Medium, with rotation, translation and scaling. Can somebody help me with this? My initial attempt was to focus on rotation and I got it almost working I think. Here's the code:

void Update()
{
  // On button down
  if (OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger))
  {
    originalRotation = transform.localRotation;
    originalControllerRotation =
      OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);
  }

  // While button is down
  if (OVRInput.Get(OVRInput.Button.SecondaryIndexTrigger))
  {
    var controllerRotation =
      OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);

    var rotation = originalRotation;
    rotation *= Quaternion.Inverse(originalControllerRotation);
    rotation *= controllerRotation;
    transform.localRotation = rotation;
  }
}

This kind of works but the rotation center doesn't look right. I want it to rotate around the center of the right touch controller and it looks to be rotating around the local origo of the gameobject. How do I modify the code so it rotates around the controller instead?

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:
Learning C++ but wanting to develop iOS Apps I'm a computer engineering student and taking my second programming class. I'm learning C++ using "C++ Primer Plus" 5th edition by Prata. I want to develop for iOS. I understand the main language for Xcode is Objective-C. Am I hurting myself by learning C++ before any other language (notably before my desired lang Objective-C)? There's got to be a reason the university requires C++ to learn as a basis language.

Please offer any helpful guidance or how I should go about this. Thanks//

sentences:
Data structure for multiple Textures in materials in assimp I'm going through assimp documentation regarding  materials. Each material can have multiple textures containing various data (color maps, height maps, etc.) and blending data, etc. I'm trying to understand how to model this efficiently in a data structure, without storing textures for each mesh separately (meaning generating textures and loading the texture (bind and upload to GPU) for each and every mesh in a redundant manner, ignoring that they are re-used).

In this tutorial, they simplify the situation, by just caring about the "1st diffuse color maps". This simplifies the data structure immensely. But, theoretically at least, there can be multiple texture maps for a single material, and textures can be re-used across materials.

I'm trying to understand whether it's common practice to not share any textures between different meshes in a single scene/model.

I have a couple of questions regarding this:

What is the best way to store textures when loading models through assimp? I understand that you can store each texture per mesh per scene (space inefficient but simple). Is there a better way?
I found a few free fbx model that only contains one diffuse color map as a material (similar to the tutorial). Is it common practice for this to happen or did I come across a simplified model?

PS: I understand openGL quite well and I have no problem getting things to render. This question is only concerned about what's practical, efficient and considered best practice.

sentences:
How do I ensure that my 2D side-scroller camera stays within the world bounds? I have tried implementing a basic 2D sidescroller camera in XNA, but I don't want it to be able to scroll past the edges of my tile map!

I tried to fix it, but when I get the left side working, the right stops working...

How do I do this right?

EDIT: After Anko

public Matrix transform;
Viewport view;
Vector2 center;

public void Update(GameTime gameTime, Player player) {
    center = new Vector2(player.Position.X + (player.Bounds.Width / 2) - (960 / 2), 0);

    float cameraX = center.X;
    float cameraWidth = view.Width;

    float worldWidth = 1760;

    if (cameraX < 0)
        cameraX = 0;
    else if  ( cameraX + cameraWidth > worldWidth)
        cameraX = worldWidth - cameraWidth;

    transform = Matrix.CreateTranslation(new Vector3(-cameraX, 0, 0));

sentences:
2d Collision detection libgdx The Logic

The player which is a cube (32 by 32 pixels) checks if their is a cell next to it that has the name Wall. (This is done using a tileset).

To do this collision check I made four checks in this order:

Is their a wall under the player.
Is their a wall to the left of the player.
Is their a wall to the right of the player.
Is their a wall above the player.

If the player for example touches the wall to the left of him The x coordinates of the player are set to the tile right of the wall(cell) that was collided with.

The Problem

If for example I move the player left, the loop will first check for a collision under the player however this makes the player move up if their is a wall to the left of the player which he is touching. (Note: it doesn't always do this only if the player moved enough pixels to the left). The player should have just stopped moving to the left. Moving up was not desired.

Experiments

I tried adding the left and right check for collision first. This way the bottom check should not see the cell. This made the player teleport to the left and right of the cell the player was currently on because gravity has time now to drag the player down enough pixels. (The player is always affected by gravity and I rather not change this for it wouldn't make sense for an entity like the player to not be affected by it).

Making the movement speed of the player smaller. This did have an affect which was more desired but the players movement speed should not be effected at all as a fix.

The Code

Collision detection code

    // Floor collision
    if (map.isWall(xCoordinates, yCoordinates - 1) || map.isWall(xCoordinates + 31, yCoordinates - 1))
        yCoordinates = ((int)(yCoordinates / 32) * 32) + 32;

    // Left collision
    if (map.isWall(xCoordinates - 1, yCoordinates) || map.isWall(xCoordinates - 1, yCoordinates + 32)) {
        xCoordinates = ((int)((xCoordinates - 1) / 32) * 32) + 32;
        canMoveLeft = false;
    } else
        canMoveLeft = true;

    // Right collision
    if (map.isWall(xCoordinates + 32, yCoordinates) || map.isWall(xCoordinates + 32, yCoordinates + 32)) {
        xCoordinates = ((int)(xCoordinates / 32) * 32);
        canMoveRight = false;
    } else
        canMoveRight = true;

    // Roof collision
    if (map.isWall(xCoordinates, yCoordinates + 32) || map.isWall(xCoordinates + 31, yCoordinates + 32)) {
        canGoUp = false;
    }

The isWall function

public Cell getCellByPixel(float cellPositionX, float cellPositionY) {

    if (cellPositionX >= 0 && cellPositionY >= 0)
        if (tileid.getCell((int)cellPositionX / 32, (int)cellPositionY / 32) != null)
            return tileid.getCell((int)cellPositionX / 32, (int)cellPositionY / 32 );

    return null;
}

private TiledMapTile getTileByPixel(float cellPositionX, float cellPositionY) {
    if (getCellByPixel(cellPositionX, cellPositionY) != null)
        if (getCellByPixel(cellPositionX, cellPositionY).getTile() != null)
            return getCellByPixel(cellPositionX, cellPositionY).getTile();

    return null;
}

// Check if the cell has a tile with the property of Wall. We can see this in the tsx file.
public boolean isWall(float cellPositionX, float cellPositionY) {
    if (getTileByPixel(cellPositionX, cellPositionY) != null)
        if (getTileByPixel(cellPositionX, cellPositionY).getProperties().get("Wall") != null)
            return true;

    return false;
}

Player movement

private void Movement() {
    if (canMoveLeft)
        if (Gdx.input.isKeyPressed(Keys.A) || Gdx.input.isKeyPressed(Keys.LEFT))
            xCoordinates -= (playerMovementSpeed * Gdx.graphics.getDeltaTime());

    if (canMoveRight)
        if (Gdx.input.isKeyPressed(Keys.D) || Gdx.input.isKeyPressed(Keys.RIGHT))
            xCoordinates += (playerMovementSpeed * Gdx.graphics.getDeltaTime());
}

sentences:
How can I fix this shadow slicing the mesh on Android? I have a golf ball in my Unity game for Android, which is an icosphere (imported from blender) with a baked normal map. There are 18 tracks located in one level around the (0, 0) coordinate, rotated in different directions.

The game uses Distance Shadowmask to create realtime shadows for near objects. In the editor and Windows builds, this works perfectly.

On Android, the shadow has a lower resolution, which is fine, but it seems to slice through the ball. It is visible in the following screenshot. If the ball moves, it looks like it passes through several planes casting a shadow.

This is heavily depending on the current track the ball is on. In 3 of the 18 tracks, there are very noticeable errors. Some other locations show very small errors.

However, those tracks are on seemingly random position. While the heavy errors appear on tracks located mainly in this (-x, -z) area, the small errors appear on arbitrary other positions.

I already tried:

changing shadowmap resolution
changing the directional light's near plane
changing the directional light's bias and normal bias
changing the directional light's position and rotation
rebaking the ball's normal map
using another ball mesh
removing the normal map from the material
using a different device

sentences:
When updating to Universal Render Pipeline an Error occurs I updated to the Universal Render Pipeline and despite of using the auto upgrade from project an error messages appears in the console. Here is the error:
In order to call GetTransformInfoExpectUpToDate,
RendererUpdateManager.UpdateAll must be called first.
UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal(RenderPipelineAsset, IntPtr, AtomicSafetyHandle)

sentences:
Implementing frame-independent friction So I'm not looking for anything realistic like a physics engine, just want to say that first.  I'm working on a simple top-down game and I'm trying to get friction working with deltaTime.

This was my old code:

friction = Math.pow(0.99f, deltaTime * maxFPS);

This worked well and I applied the friction each frame.  However, I need to refactor this code since I do not know what the possible maxFPS will be (it could be 30, 60, 120 - it depends on the device limitations).

So here's my new code:

friction = Math.pow(0.6f, deltaTime);

This eliminates the need to know the maxFPS and gives me (roughly) the same output value to apply each frame.

My issue is this: I do not just set the friction to a static value, it changes depending on other factors.

So with my old code, for example, the value I would raise to a power to get friction would range anywhere from 0.6f to 1.0f.

With the new code, I have to use different values since the power is different, so the new range would be 0.0000000000001f to 1.0f.

This just doesn't seem (and feel, when playing the game) right.  The range is way too big and from 0.2 - 1.0f the results are all nearly the same value (0.98+, very "slippery" friction) - it doesn't seem like a linear gradient (if that makes sense) the way 0.6f - 1.0f with my old method was.

Just wondering what the common method is to implement frame-independent friction, if I'm doing it right and if there is anything I can do to get the same "feel" I was getting before.

sentences:
How does DrawProceduralIndirect use MeshTopology.Triangles? I'm working on a voxel terrain generation system. Currently I'm running into issues using DrawProceduralIndirect. In the call, you are able to choose how the GPU should render the data you are passing. In my case I want to render triangles, so I set the MeshTopology parameter as MeshTopology.Triangles.
The weird thing, however, is that on NVIDIA GPU's my mesh seems to render correctly. However, on my AMD GPU, the triangles are all scrambled. When rendering it with MeshTopology.Points on the AMD GPU, it seems that all of the vertices are in the correct spot, but there are a couple of extra vertices that the NVIDIA GPU's don't render.
My question is: could there be some fundamental difference on how AMD and NVIDIA GPUs handle the ComputeBuffers I'm passing into the material's shader? Also, does DrawProceduralIndirect with MeshTopology.Triangles read every three vertices in the ComputeBuffer and form a triangle with them?

sentences:
Why do Pool.Default D3D volume textures take memory from my process? I am working on a Direct3D rendering application that uses a lot of texture RAM. I notice that if I allocate a Pool.Default volume texture:

   _texture = new VolumeTexture(device, size.Width, size.Height, size.Depth, 1, Usage.None, Format.L16, Pool.Default);

my process's system memory decreases by the same amount I allocate on the video card. I think this is unexpected. This texture is supposed to be video-memory only.

Effectively this means I can not use all texture RAM on high end video cards, I can not afford to lose a whole gigabyte of system RAM. We're short on adress space as it is....

Is there anybody who knows what's happening here? Are there ways to prevent this from happening?

This was seen on Windows 7 64 bit from a 32 bit process, using Directx 9c, with several different nVidia cards. The process is marked as /LARGEADRESSAWARE to make sure we get as much as adress space as possible.

You may have guessed by now that I am not writing a game.... but I assume the Direct3D experts are here to be found.... And I can imagine this issue affects games as much as it affects us...

EDIT:

This appears to happen only with Volume Textures. If I allocate 2D textures of the same size it does not happen. By default my volume textures were 32megabytes each. If I make them smaller (I tried down to 2megabytes each), There are still blocks being allocated. According to VMMap, each texture gets a 32 meg block in my process, flagged as "Read/Write/WriteCombine".

The fact that they are labeled as "WriteCombine" makes me really curious, no other block of memory is labeled like that.

sentences:
Proper way to wrap sprite for Z dimension I am using SFML, but I need to add some emulation of 3D by wrapping the sprite with a Z component. When sprites are drawed (or when objects moved?), their X and Y will change depending on Z.

My question is, which component should hold the sprite, and the wrapped x, y, z coords?

Supossing I have objects that inherit from Sprite, GameObject and Collider (and I am not yet sure about this or if I rather should have used compositio), I could have:

A wrapper for Sprite, which could be Sprite3D. Sprite would be the holder of the coords used also for game logic and collision detection. In this case, how do I give access to base class/component(?) Collider of Sprite?
Collider (inherited or composed?), holding x, y, z. In this case, how Collider would have access to Sprite in order to update it, by having a pointer to parent object/casted base class/Sprite? Or should the Sprite3D have a pointer to the collider and update its own x,y only when drawing?
Wrapper for Both Collider and Sprite. I will need to do this with more drawable types, so this would force me to make other base class Graphic for Sprite. (Yes?)

Colliders are drawables?

Make each entity have their own x, y, z, and update their sprites and hitboxes

sentences:
How do I implement movement in a WPF Adventure game? I'm working on making a short WPF adventure game.  The only major hurdle I have right now is how to animate objects on the screen correctly.  I've experimented with DoubleAnimation and ThicknessAnimation both enable movement of the character, but the speed is a bit erratic. The objects I'm trying to move around are labels in a grid, I'm checking the mouse's position in terms of the canvas I have the grid in.

Does anyone have any suggestions for coding the movement, while still allowing mouse clicks to pick up items when needed? It would be nice if I could continue using the Visual Studio GUI Editor.  By the way, I'm fine with scrapping labels in a grid for a more ideal object to manipulate.

Here's my movement code:

ThicknessAnimation ta = new ThicknessAnimation();

The event handling movement:

private void Hansel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
     ta.FillBehavior = FillBehavior.HoldEnd;
     ta.From = Hansel.Margin;

      double newX = Mouse.GetPosition(PlayArea).X;
      double newY = Mouse.GetPosition(PlayArea).Y;
      if (newX < Convert.ToDouble(Hansel.Margin.Left))
      {
           //newX = -1 * newX;
           ta.To = new Thickness(0, newY, newX, 0);

      }
      else if (newY < Convert.ToDouble(Hansel.Margin.Top))
      {
            newY = -1 * newY;
      }
      else
      {
            ta.To = new Thickness(newX, newY, 0, 0);
      }
      ta.Duration = new Duration(TimeSpan.FromSeconds(2));
      Hansel.BeginAnimation(Grid.MarginProperty, ta);
}

Screenshot with annotations:

Screenshot with example movement:

sentences:
Particle systems on multiplayer games I'm working on a 2D javascript/Three.js multiplayer game, using web sockets and an authoritative server currently written in Python.

The combat mechanic will be similar to Geometry Wars however i'm struggling to get my head around how to implement this in an efficient way.

There are several drawbacks/concerns I need to take into account:

Efficiency is key
Three.js particle systems aren't mutable, you cannot add or remove particles once the system has been created, only move them off screen
All calculations with respect to collision and damage must be done server side
My game currently implements entity interpolation with fixed time step updates from the server
Potentially several different weapons/projectile types

I can see several solutions:

Handle each 'bullet' particle individually

Pros

Most accurate way of doing thigs

Cons

Slow on server
Lots of bandwidth
Hard to batch draw objects, will have to draw each individually

Use ray casting on server and have some form of network synced particle emitter

Pros

Much easier on the server and network

Cons

Network synching issues
What happens when a bullet hits an object? Bullet will pass right through

Use ray casting on server for collision/damage and use raycasting on client for more accurate particles

Pros

Much easier on the server and network
Will look more accurate

Cons

May still have some synching issues
More work for the client

Obviously the amount of players currently connected will have an impact on the implementation, I would ideally like to allow hundreds of players to share a game world but there may only ever by 20 or so on screen at once.

The mutable particle system is an issue for all of these but I would still like to use it as it is more efficient that drawing each particle individually. In a test I could have over 10000 particles all moving and still get 60fps.

Any help or comments on my though process would be greatly appreciated. Is there another approach that would be better?

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:
Confused on graphics rendering Implementing a viewport is just a rectangular space on the back buffer usually a 2d texture set to the size of the client window that we render to.

However in direct3d when we describe the viewport it asks for the window width and heights and the top left X,Y position

From what I understand normalized device coordinates for the top left would be represented by 1,-1 and if I chose another type of device coordinate would be represented by 0 , 0.

How does this translate To a coordinate system for primitives I draw on screen from some file formats like wavefronts OBJ format their are coordinates that are out of range from -1 to 1.

sentences: Where does my .sav file default to in XNA 4.0 when using the StorageDevice class? I am using the StorageDevice class built into XNA and am looking to delete my save file from the solution in my XNA game.  I never specify where the save file is to save, and can't find the default location on MSDN documentation.  I am developing this game for the pc, and never prompt the user to select a save device. Where can I find the save file so that I may delete it?

sentences:
Mapping of positions on images in different frames I am looking for a possibility to map different positions on a 2D Image which has different frames.
Let's say I have an image, consisting of three frames, which shows a spaceship.
The first frame shows the spaceship how it is tilted a little bit (say 20 to 30 degree) to the left side.
The second frame shows the spaceship just from the top.
The last frame shows the spaceship tilted a little bit to the right (the same amount as in frame 1).
Now I want to know, where for example the part which is in the middle of the second frame, is in the first and third frame.
The following painting should show what I mean (sorry, I am a bad artist):

The red arrows show example positions which I want to match.

The background is the following: I want to have the possibility to take away parts of the image while playing.
The problem is: I want that the parts which were taken away, are taken away on every frame at the right position.

I fail to imagine how to approach this problem as I cannot think of a possible solution.
Is there a possibility to achieve this goal or is it just impossible?

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:
How to properly use Unity component approach? It may sound like an opinion-based question, but I feel like I am not alone with such problem and this may help others too. I spent a lot of time trying to understand how to make things Unity-way, use the best of the component approach. I read almost everything I can get access to and watched every presentation that I found. But at the end I found myself very confused when it comes to implementation of all this abstract ideas that people were talking about. The last thing that I did not try is asking a question here.

Also I want to mention that I have an experience in programming (mostly OOP) and I am aware of different design pattern, difference between component approach and inheritance, Unity EC vs ECS and all that things. But when it comes to practice with Unity it seems like I am missing something. I will show you an example:

Component approach encourage us to make components small and independent. So we can composite objects from this components easily. I like this idea very much.
I decided to make a 2d roguelike to try this approach.

Firstly, I was thinking of what components do I need and there are some from my list:

Solid
Move
Health
Activate

So besides Transform and SpriteRenderer:
Wall has Solid and Health component. Actor has Solid, Move and Health component. Door has Solid and Activate component. Floor will be empty.

I decided that all objects in my game would be just containers of components, no specific names or tags. Objects interaction logic will be based just on components that object has. In other words, when object with Move components will try to move on specific tile I should somehow get all the components on that tile and then do some logic like (some crazy pseudocode):

Move(x, y) {
    components = getAllComponentsAtCoordinate(x, y);

    if (there is health component in components)
        component.TakeDamage(); //attack
        return;

    if (there is activate component in components)
        component.Activate();
        return;

    if (there is no solid components)
        startMoving();
}

And I got stuck at this point. I thought about using raycast to get all objects at the specific coordinate and then get all components from them in some array. But there gonna be too many GetComponent(); methods and this just feels like a wrong way to do it (because getComponent is an expensive operation in Unity).

Or I can use a data structure, that will represent a cell like:

Cell {
    bool passable;
    Actor currentActorStandingHere;
}

(+ inheritance for destructible walls)
and then access this cell directly and wrap my logic around this (that how I usually do it in OOP) -- but I will lost all that component prettiness. All objects are now hardcoded (also I dont think that this approach will make use of Unity inspector and all that stuff, because this will be plain c# classes representing the model).

So my question is: how can I use Unity component approach to handle this situation? May some sort of event system help here? Or am I solving this problem a wrong way? I just want to understand how components works in real life. But almost all Unity tutorials that I found were using strong dependencies between components and it seems like it violating the main principle of how unity was made.

Thank you for your attention

sentences:
Monogame Windows Phone 8 I want to port a WP7 XNA game to WP8 using MonoGame. The thing is that I have Windows 7. So here's the questions (if some sound dumb, please bare with me).

Do I need to have Windows 8?
Do I need to have the Windows Phone SDK 8?
How do I get the templates for Visual Studio so I can create a project for WP8?

I'm kinda newbie into this monogame thingy. I've been using XNA for quite a while.

sentences:
Calling Shader Functions Inside Other Shaders I'm new to OpenGL and GLSL, and bit confused about calling conventions of shader functions.

I'm trying to implement various procedural noise algorithms in GLSL. I'd like to have separate files for each noise and call these functions inside other fragment shaders.

Let say I have 2 files perlin.glsl and simplex.glsl.

perlin.glsl  consists of pnoise2, pnoise3, pnoise4

simplex.glsl consists of snoise2, snoise3, snoise4

I have another fragment shader marble.frag which calls both snoise2, pnoise2 and has a main()

How do I call fragment shader functions inside other fragment shaders?
Is this considered a good practice?
Can you think of a better alternative?

Thanks

sentences:
How should I learn about collision detection? If I want to use physics engine for my game then how should I go to learn collision-detection algorithms?

When I read AI book for games, the book talks about collision detection, so I want to learn it, but what kind of book would be best?

If I had to choose to go and learn it what would you advise me to read?

A physics book. (Game physics H.Ebrely)
A real-time collision detection book. (Same author)

I don't know much about algorithms, some people say it's better to start with a physics book, because real-time collision detection book depend heavily on algorithms.

sentences:
GLFW shift key not behvaing like other keys I am using GLFW 3.2.1

Currently I am implementing a camera. For the vertical controls I am using space to go up and shift to go down.

For all other keys, pressing the key results in the section of the code associated with the key always executing.

But for shift, it only gets exectuted when pressing and releasing but not while keeping the key pressed.

The key callbak is:

#define CAM_SPEED 0.2f
void static key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GLFW_TRUE);

    if(key == GLFW_KEY_W)
    {
        c.translateForward(CAM_SPEED);
    }
    if(key == GLFW_KEY_S)
    {
        c.translateForward(-CAM_SPEED);
    }
    if(key == GLFW_KEY_A)
    {
        c.translateSideways(-CAM_SPEED);
    }
    if(key == GLFW_KEY_D)
    {
        c.translateSideways(CAM_SPEED);
    }
    if(key == GLFW_KEY_SPACE)
    {
        c.translate(vec3(0,1,0)*CAM_SPEED);
    }
    if(key == GLFW_KEY_LEFT_SHIFT || mods==GLFW_MOD_SHIFT)
    {
        c.translate(vec3(0,-1,0)*CAM_SPEED);
    }
}

sentences:
What is the AlphaToCoverage blend state useful for? Alright, just finished most of my early UI stuff and I wanted the windows to have some transparency. So I expanded my application to initialize and bind blend states so that my UI shader could implement alpha blending. I was initially having no luck but I got the blend state configured to achieve my purpose, however the way it is configured doesn't make sense to me so I must be missing something.

Here is how I initialize my blend state.

bool BlendState::StartUp() {
    D11DeviceManager* _pDeviceManager = D11DeviceManager::GetSingleton();

    D3D11_BLEND_DESC _desc;
    _desc.AlphaToCoverageEnable = false;
    _desc.IndependentBlendEnable = false;

    _desc.RenderTarget[0].BlendEnable            = true;
    _desc.RenderTarget[0].SrcBlend               = D3D11_BLEND_SRC_COLOR;
    _desc.RenderTarget[0].DestBlend              = D3D11_BLEND_DEST_COLOR;
    _desc.RenderTarget[0].BlendOp                = D3D11_BLEND_OP_ADD;
    _desc.RenderTarget[0].SrcBlendAlpha          = D3D11_BLEND_SRC_ALPHA;
    _desc.RenderTarget[0].DestBlendAlpha         = D3D11_BLEND_DEST_ALPHA;
    _desc.RenderTarget[0].BlendOpAlpha           = D3D11_BLEND_OP_ADD;
    _desc.RenderTarget[0].RenderTargetWriteMask  = 7;

    return !FAILED(_pDeviceManager->GetDevice()->CreateBlendState(&_desc, &pBlendState));
}

Right now my alpha blending only works when the AlphaToCoverage bool is set to false... I thought this was just a bool enabling the pixel fragment blending (which upon retrospection would be redundant considering the BlendEnable flags...) but looking at the MSDN documentation is appears to do this...

  You can use the AlphaToCoverageEnable member of D3D11_BLEND_DESC1 or D3D11_BLEND_DESC to toggle whether the runtime converts the .a component (alpha) of output register SV_Target0 from the pixel shader to an n-step coverage mask (given an n-sample RenderTarget). The runtime performs an AND operation of this mask with the typical sample coverage for the pixel in the primitive (in addition to the sample mask) to determine which samples to update in all the active RenderTargets.

Could someone explain this to me and how it differs from when the AlphaToCoverageEnable bool is false? I see that it adds a new mask to the fragment but I don't quite follow what the mask exactly is.

sentences:
Instantiate an object and translate it randomly My goal through this code in C # is that each time the player presses the Q I create a cube at a fixed position given by another object, then begin translating it in a random direction. ie.

first press: a cube is created at the spawn point and moves away in direction 1
second press: a cube is created at the spawn point and moves away in direction 2
third press: a cube is created at the spawn point and moves away in direction 3

I don't understand why the code below does not work:

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

public class spawn_random_trajet : MonoBehaviour {

    public GameObject Spawn, Spawn2;
    public Transform origineSpawn;
    public float moveSpeed=5f;

    void Update () {
        if (Input.GetKeyDown (KeyCode.Q)) {
            int random_trajet_x = Random.Range (-10,10);
            int random_trajet_y = Random.Range (-10,10);
            int random_trajet_z = Random.Range (-10,10);

            Spawn2 = Instantiate(
                 Spawn,
                 origineSpawn.position,
                 origineSpawn.rotation
            ) as GameObject;

            transform.Translate (
                 random_trajet_x*Time.deltaTime*moveSpeed,
                 random_trajet_y*Time.deltaTime*moveSpeed,
                 random_trajet_z*Time.deltaTime*moveSpeed
            );
        }
    }
}

sentences: 2 component unit vector Is it possible to store a 3d unit length vector with only 2 components, for example as coordinates on a unit sphere? It seems possible but I have never seen anyone do this. Would this be at all practical?

sentences: Should I use the pathfinding client side or server side? I'm developping a game where the user can walk in a room (with the others players). There are some obstacles that blocks the user. I'm using a Javascript pathfinding library to find where the user can walk. But the question is: Should I use the pathfinding library Client side or server side? Why?

sentences:
Ogre Render Lines completely wrong I'm trying to render line list using indices of triangles as follow

float *vertices = static_cast<float *>(vertexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));

for (int i = 0; i < out.numberofpoints; i++)
{
    vertices[(i*3)] = out.pointlist[(i*3)];
    vertices[(i*3)+1] = out.pointlist[(3*i)+1];
    vertices[(i*3) + 2] = out.pointlist[(3*i)+2];

}

vertexBuffer->unlock();

uint16_t *indices = static_cast<uint16_t *>(indexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));

int  l, t;
int numTriangles = out.numberoftrifaces*3*sizeof(uint16_t);
for (l = 0, t = 0; t<numTriangles; t += 3) {
    // Each vertex has to be listed twice
    indices[l] = out.trifacelist[t];      l++;
    indices[l] = out.trifacelist[t + 1];    l++;
    indices[l] = out.trifacelist[t + 2];    l++;
    indices[l] = out.trifacelist[t + 2];    l++;
    indices[l] = out.trifacelist[t + 1];    l++;
    indices[l] = out.trifacelist[t];      l++;
}

indexBuffer->unlock();

The problem that ogre renders broken triangles and it's completely wrong. I'm not doing anything wrong regarding rendering the lines that the triangles are composed

I'm using ogre 1.9

sentences:
OpenGL Cubemap skybox edge issue I implemented a skybox into my program using a tutorial, and using the provided 6 textures from that tutorial to make a cube map texture, my skybox looked fine. However, ever since then every other skybox texture set I have tried to add has had issues with the edges not blending together. Here is generally how they always end up looking:

here is my code for for loading the textures and the parameters:

glActiveTexture(GL_TEXTURE0);
textureID = SOIL_load_OGL_cubemap(textures[0], textures[1], textures[2], textures[3], textures[4], textures[5], 0, 0, SOIL_LOAD_RGB);
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
if (textureID == 0)
{
    glGenTextures(1, &textureID);

    int width, height;
    unsigned char* image;

    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
    for (GLuint i = 0; i < 6; i++)
    {
        GLuint sID = SOIL_load_OGL_texture(textures[i], 0, 0, 0);
        image = SOIL_load_image(textures[i], &width, &height, 0, SOIL_LOAD_RGB);
        glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
        SOIL_free_image_data(image);
    }
}

glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_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);
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

And code for rendering the skybox:

glDepthMask(GL_FALSE);
shader->bind();
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
viewMatrix.r4.x = 0;
viewMatrix.r4.y = 0;
viewMatrix.r4.z = 0;
shader->loadMatrix("viewMatrix", &viewMatrix.m11);
glBindVertexArray(vao);
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
shader->unbind();
glDepthMask(GL_TRUE);

And the shader code

const char vertexShader[] =
    "#version 330\r\n"
    "in vec3 position;\r\n;"
    "out vec3 texCoord;\r\n"
    "uniform mat4 projectionMatrix;\r\n"
    "uniform mat4 viewMatrix;\r\n"
    "void main()\r\n"
    "{\r\n"
    "gl_Position = projectionMatrix * viewMatrix * vec4(position, 1);\r\n"
    "texCoord = position;\r\n"
    "}";

const char fragmentShader[] =
    "#version 330\r\n"
    "in vec3 texCoord;\r\n"
    "out vec4 color;\r\n"
    "uniform samplerCube sampler;\r\n"
    "void main()\r\n"
    "{\r\n"
    "color = texture(sampler, texCoord);\r\n"
    "}";

Does anyone see something that I might be missing that's causing my skybox to not render properly for most cube maps?

sentences:
Point Sprite Size and Coloring OpenGL ES 2.0 I am trying to render point sprites with with variable color, but they are all black. Before I added gl_PointSize = 5.0 they had color.

The environment is Android with C++, I believe OpenGL ES 2.0.

I have tried to work from point sprite size and applying color to point sprite, but have had no luck.

Vertex Shader:

precision mediump float;
precision mediump int;
attribute vec4 vertex;
uniform mat4 mvp;
varying vec4 v_color;
void main() {
  gl_Position = mvp*vertex;
  v_color = vertex;
  gl_PointSize = 5.0;
}

Fragment Shader:

precision mediump float;
precision mediump int;
varying vec4 v_color;
uniform sampler2D tex;
void main() {
  //gl_FragColor = vec4(v_color);
  //gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
  //gl_FragColor = texture2D(tex, gl_PointCoord);
  gl_FragColor = vec4(v_color.rgb, texture2D(tex, gl_PointCoord).a);
}

All of the gl_FragColor assignments both commented and active lead to black points.

How do I give these points color?

sentences:
Correct way to project a texture with alpha and colors onto surfaces in Unity I am experimenting with Unity and wanted to project a unit circle beneath a unit and my very first naive approach was to create a child plane below the unit, assign the material to it and stretch it using the Pro Builder UV editor but it looked horrible:

In order to figure out what's wrong I read a lot of various approaches to "fix" that issue which were mostly the following:

use a higher resolution for the texture
do not use any compression
do not use a POT resolution
change the filtering option from bilinear to point
...

Eventually I figured that I have to do something completely different and that is how I stumbled upon the idea to use a shader attached to a projector game object in order to project a material. Unfortunately though it turns out the shader expects a grayscale image and only tints the projection based on a parameter. For reference this is the shader I have just copied from the web (source):

Shader "Projector/AdditiveTint" {
    Properties {
        _Color ("Tint Color", Color) = (1,1,1,1)
        _Attenuation ("Falloff", Range(0.0, 1.0)) = 1.0
        _ShadowTex ("Cookie", 2D) = "gray" {}
    }
    Subshader {
        Tags {"Queue"="Transparent"}
        Pass {
            ZWrite Off
            ColorMask RGB
            Blend SrcAlpha One // Additive blending
            Offset -1, -1

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            struct v2f {
                float4 uvShadow : TEXCOORD0;
                float4 pos : SV_POSITION;
            };

            float4x4 unity_Projector;
            float4x4 unity_ProjectorClip;

            v2f vert (float4 vertex : POSITION)
            {
                v2f o;
                o.pos = UnityObjectToClipPos (vertex);
                o.uvShadow = mul (unity_Projector, vertex);
                return o;
            }

            sampler2D _ShadowTex;
            fixed4 _Color;
            float _Attenuation;

            fixed4 frag (v2f i) : SV_Target
            {
                // Apply alpha mask
                fixed4 texCookie = tex2Dproj (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));
                fixed4 outColor = _Color * texCookie.a;
                // Attenuation
                float depth = i.uvShadow.z; // [-1 (near), 1 (far)]
                return outColor * clamp(1.0 - abs(depth) + _Attenuation, 0.0, 1.0);
            }
            ENDCG
        }
    }
}

With that shader I was able to render the following effect:

Since I have no experience with shaders at all I just blatantly copy & pasted it and do not know (yet) how to customize them or even write custom ones in the first place.

Assuming my approach to combine a projector with such a shader is the way to go, I'd like to know whether there is any shader you can share that allows me to project an unlit texture with transparency and its own color such as the following example:

sentences:
How do I make a tile passable in one direction only? I want that my character can jump through some of the tiles, like Mario does in this video:
http://www.youtube.com/watch?v=zIPYzbNrNhc

In this video, Mario jumps up through orange platforms, but does not fall down through them.

How can I do that with Farseer?

sentences:
How to combine Actor.setPosition and Actor.hit? Why after using Actor.setPosition, input coordinates in Actor.hit come with a shift in the values specified in setPosition?

Create scene:

public class MyActor extends Actor {
...
    int width = 70;
    int height = 70;

    public MyActor(Texture img, int x, int y, int realX, int realY) {
...
        sprite = new Sprite(img, x, y, width, height);
        this.setPosition(realX, realY);

Standard search Actor:

public class GameScreen implements Screen, InputProcessor {

    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        Vector2 coord = stage.screenToStageCoordinates(new Vector2((float)screenX,(float)screenY));
        Gdx.app.log("touchDown", "" + coord.x +","+ coord.y);

        selectedActor = (MyActor)stage.hit(coord.x,coord.y,false);

...

public class MyActor extends Actor {

    @Override
    public Actor hit(float x, float y, boolean touchable) {
        if(!touchable)
            Gdx.app.log("Actor.hit:", "" + x +":"+ y);
        return x < getX()|| x >= getX() + width || y < getY()||  y >= getY() + height ? null : this;

But come the distorted values.

Coordinates Click:  touchDown: 26.25,81.250015.

MyActor in the values obtained from the offset, the multiple of 70:

Actor.hit: -43.75:11.250015
Actor.hit: -43.75:81.250015
Actor.hit: 26.25:11.250015
Actor.hit: 26.25:81.250015

Why? How to fix?

UPDATE

public class MyStage extends Stage {
...
    @Override
    public Actor hit(float x, float y, boolean touchable) {

        return super.hit(x,y,touchable);

sentences:
How can you extract orientation from a transformation matrix? I have a 4x4 transformation matrix M, and I want to find out the shape of a sphere when transformed by M. (Sphere is at the origin and has radius 1.)

I know I can find the center by just multiplying M by (0,0,0,1).

However, the radius becomes a problem as M can squash and rotate the sphere.  How can I find out the new radius(es) of the resulting ellipsoid?  Is there any way to find out the orientation?

More specifically, I need to know the size of the bounding sphere which would enclose the transformed sphere.  In other words, what is the maximum of |M*V - M*(0,0,0,1)|, where V is a unit vector (a point on the original sphere).

sentences:
Rigidbody2D without pushing eachother on collision TLDR; How to stop movement if two Rigidbodies collides?

Also,  here's a potato video of the problem: https://gfycat.com/ComposedArcticBetafish

Say I have three objects in a scene:

Player
Enemy
Rock

The player and enemies is moving freely, but the rock is static. So I attached a Rigidbody2D on player and enemy to move them around with script. All of them has a Box Collider 2D.

Now, if I (Player) move into an Enemy, I will start to push it (changing its position). I don't want this.
I can set the Enemy's mass to something large, but then two enemies can still push eachother. I don't want this. If I try kinematic solutions I've found, but then they can move through the rock.

I want:

Player can not move enemies
Enemies can not move players
Enemies can not move each other
Nothing can move or go through the rock
Enemies can not move through player
Player can not move through enemies

I keep reading that if I'm moving colliders, I should also use Rigidbodies for performance. But I can't see how I get this to work with Rigidbodies.

How do I set it up? Or should I move away from rigidbodies and set it up myself?

sentences:
How can I find if a GameObject is not exist in the Hierarchy? var selections = Selection.objects.OfType<GameObject>().ToList();
        if (selections.Count > 0)
        {
            tempSelections = selections;

            for (var i = selections.Count - 1; i >= 0; --i)
            {
                var selected = selections[i];
                transformSelection.Add(selected.transform);
            }

            TransformSaver.SaveTransform(transformSelection.ToArray());
            transformSelection = new List<Transform>();
        }

        for (var i = tempSelections.Count - 1; i >= 0; --i)
        {
            var selected = tempSelections[i];
            if (GameObject.Find(selected.name) == null)
            {
                GUI.enabled = true;
            }
            else
            {
                GUI.enabled = false;
            }
        }
        if (GUILayout.Button("Undo last selection if deleted"))
        {
            transformsCount = TransformSaver.LoadTransform().Length;
            PlayerPrefs.DeleteKey("transform");
        }

For testing I'm deleting one of the GameObjects in the tempSelections List

But then I'm getting exception in the editor on the line:

if (GameObject.Find(selected.name) == null)

Since the GameObject have been deleted it can't access the GameObject.

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.

sentences:
Adapting tilemap algorithm to support isometric tilemap I'm using Phaser to build an isometric game. The framework doesn't have support for isometric tilemaps yet, so I'm starting to write a PR for it to support.

What I currently have, loading an isometric tilemap on the current Phaser.Tilemap object, is this:

As you can see, the tiles are wrongly positioned because of the simple 2D tile positioning approach the framework currently uses.

The class that actually makes the parsing of the JSON map and converts it into a tilemap is Phaser.TilemapParser, specifically at line 185.

What I need is some help on where to start adapting this parser – or any other part of the code – in order for it to support isometric tilemaps.

I don't know exactly where to start extending this parser – or even writing a new parser just for isometric tilemaps. Also, I know the calculations are different for positioning isometric tiles, and I want to know too where that change should go here, as I didn't find that either.

sentences:
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:
Find out which way to rotate based on current rotation and final rotation I have one object that I want to rotate to a certain angle with 'smooth' rotation.
I looked up  on how to solve that and I came up with this: enter image description here

But how do I know in what way to rotate, positive or negative?
According the the picture on ex. 1, I need to rotate positively because it is the closest way for me to rotate. And on the second it is the negative way.
But how do I know this? I've tried several solutions but I can't seem to find anything that is correct.

sentences:
Help with Resolving Pixel Perfect Collision Hi I'm having trouble resolving "Collision detection between axis-aligned bounding box and bitmap (pixel perfect) terrain on a Worms type game". (Read previous question to find more information about the game).

The player has got properties such as velocity, acceleration, gravity applied to it on its update method. I have controls that allow the player to "land" on a surface by detecting the pixel immediately below it and then stopping the velocity if that object is solid. I am having trouble with moving the character.

Currently when I move the character left or right the code should work in my head to move the character up, but it seams to still want to go into the ground. Could you help me to resolve the collisions for moving?

Below is the code I implement for Walking left or right. It is called immediately before the update method for sprite. This method is called from the Player class update method.

            boolean solidPixel;
            //Create a bitmask from top to bottom of the pixels
            for(int i=0;i<boundHeight;i++){
                //If true then collision
                solidPixel = TerrainObj.isPixelSolid(x+(getBound().halfWidth*direction),y-getBound().halfHeight+i);
                //if any of the pixels are solid then we've hit a wall
                //so act accordingly and exit the application
                if(solidPixel && i < getBound().halfHeight/4){
                    //
                    //Cannot move in the direction
                    velocity.x = 0;
                    break;
                }
                //if the bottom (left/right)quater of the sprite is
                //solid then its a slope
                if(solidPixel && i >= getBound().halfHeight/4){
                    //Position the item -(up) by the amount of pixels the
                    //gradient is
                    position.y+=(getBound().halfHeight*2)-i;
                    break;
                }
            }

Any help is much appreciated how I could approach the issue to stop the player ever moving into the ground to provide prefect collision detection.

Sorry for the long post, wanted to put as much information in as possible.

sentences:
Is basic SDL hardware accelerated? I'm going over some SDL tutorials aimed at creating 2D games.

However, when I create a basic SDL program - is it hardware accelerated?

Or is hardware acceleration only relevant when it comes to 3D animations? Can a GPU help when it comes to pure 2D graphics?

sentences:
Articles about a plot in an open world There are plenty of articles about open world game design and writing plots. But have you guys come across articles or blog entries about designing an engaging plot in an open world game? What i mean by this? In TES:Morrowind you're introduced to mechanics and are given the "main quest" within the first 5 minutes and then you're free to go, learn, kill, do whatever you want. I've spent hundreds of hours playing the game, but i have never got to doing the "main quest" and i'm sure alot of people are in the same situation, be it Morrowind, Oblivion or Skyrim. Maybe it's the power of TES games and a true testiment to how great RPGs they are, however for me, thinking as a designer, it seems like a massive design failure. Maybe it's the fact that there's no actual threat that needs to be dealt with, maybe it's that, amongs all the well designed and interesting quest within the game, the "main quest" just doesn't seem so interesting.

I've got a game idea in the back of my head, i want to create an action platformer, but the "level selection" would be open world style "dunegons" like you find in MMOs. This is a vague and undeveloped idea, so don't focus on it, i didn't give this design much thought, however an issue arose, i can't figure out, in general, how to make the player care about the open world aspect (f.e. dealing with roaming, pillaging parties, doing a gauntlet run to get some special armor, clearing a water source from enemies, etc.) while "forcing him" to finish the game, carrot-on-a-stick kind of way. There are "crazy" people who will go search everywhere between cutscenes in FF games, but i'm aiming at the general audience. I want to create  a subtle system for guiding people throughout the game to a goal, while giving them an option of gaining power any way they want. This may aswell be impossible, but it doesn't hurt to ask.

I'm looking for articles or musings on this matter. Not solutions (since there's no design document, no direct solutions matter at this point), just thoughts from other people, probably with other games as a reference.

sentences:
Behaviour trees and agent sensors Assume I have a behaviour tree like the following:

    [A]
   / | \
[B] [C] [D]

A = Selector (Priority node)
B = Perception task
C = Idle task
D = Walk to point task

The reason the tree looks like this is because B has priority over C and D since it should trigger alert procedures. In short, what I'm trying to model here is that the Agent sensors must have priority over behaviours.

Assume now the agent is in D and this node will continue returning running until the destination point is reached.

While D is running, something might happen (for instance, the NPC see or hear something) that should break the current operation as soon as possible but, D will go on regardless until it's done.

I know I could paste the sensors code on top of each tree leaf, like for example:

// kinda javaish pseudo code
void run() {
    // The node running method
    if (this.sensors.alert()) {
        return this.fail();
    }

    // Else, keep going.
    if (! this.reachedGoal()) {
        // do the walking
        return this.running();
    }

    return this.success();
}

But with that solution the "alert" behaviour is hard coded and out of the tree logic.

What solution do you suggest?

sentences:
Simplified math formula to calculate stock price based on supply/demand I am making an overly simplified version of a stock simulator game, because I:

am fascinated with how the stock market works
learn better & faster from a project like this, rather than text-books

Before writing any actual code, I started making an Excel spreadsheet to simulate the fluctuations of 1 company's stock based on how many people buy/sell the stock on any given day, so that when I have the code, I have something to compare it against to know that it works.

Variables I have access to:

a) Total amount of stock issued - 10000
b) Starting stock price when the company goes public - $10.00
c) Stock available on any given day
d) Stock bought/sold on that day - for example, 150 on day 1
e) Stock bought/sold the previous day - when first starting the simulation, this number is 0
f) Company profits on any given day - For simulation purposes, profits are calculated daily, not quarterly or yearly
g) Stock price - This is what I need calculated

I tried using (d-e)/a which gives me a difference, like 0.015 which I use to get the stock price for the next day.
But it just seems too simple, since buying 100% of the stock on day 1 and then selling 100% of it on day 2, brings down the price to $0.00. Perhaps this would work given enough random participants who all buy/sell the stock, but in this case, I need the simulation to work with just 1 person. And the simple function I wrote just gives too much power to that 1 person.

PS: For simulation purposes, I assume there is always a buyer and always a seller for the stocks.

PPS - Edited to provide the test numbers I'm starting with

sentences:
How can I move and rotate an object in an “infinity” or “figure 8” trajectory? I know that the easiest way to move an object with the figure 8 trajectory is:

x = cos(t);
y = sin(2*t) / 2;

but I just don't know how to rotate it, lets says with a new variable r as rotation, how do I merge it into the above formula ?
can anyone please advise me on what is the simplest and cheapest way/formula to move and rotate the figure 8 trajectory ?

ref:How can I move an object in an "infinity" or "figure 8" trajectory?

sentences:
My .FBX model is not picking the .TGA texture file I'm at a complete loss.

An artist has sent me a 3D model so I can test it in Unity. This is exactly what I got:

 - Guy.fbx
 - Guy_DIF_512.tga

Alright. So I move the folder into the Unity inspector. Suddenly, a Materials folder is created within such folder. The Materials folder has one material.

Anyway, now I put the Guy prefab into the scene. It doesn't have textures applied.

No problem. A simple Google search yields this response:

  The textures for your model have to be in your Unity project for Unity
  to apply them automatically when you import.

  There are 3 different ways to make sure this happens

  1 Use Textures for your 3D model from a \textures directory already in
  your Unity project

  2 Embed them in the FBX

  3 Copy the textures into your project before you import your model

I will avoid the second option for now to avoid troubling the artist. Let's see the third option...

  3 If you are using 3D software packages that might not have newer FBX
  plugins or are importing native files you generally do not have the
  option to embed media, so you will need to copy the textures into a
  directory inside your project called textures - nested next to the
  model before you import it e.g.

  \Projectx\Assets\Models\Textures\ModelTexture.tga

  \Projectx\Assets\Models\Model.fbx

Ok, so I created Assets/Models/Textures and imported the Guy_DIF_512.tga file into it. Then in Assets/Models folder I import the Guy.fbx file.

Doesn't work. The model still doesn't have textures applied.

Alright, so let's look at the first option then.

... Let's look at the first option...

  1 If you create your textures in your Unity project to start with and
  source them from a \textures directory nested under Models for
  example, Unity should always create materials and pick up the textures
  correctly at import

  **\Assets\Models\Textures**

  **\Assets\Models**

Uh, isn't this the same as the third option?

How do I import my 3D model?

I am using Unity 5.

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:
HLSL Pixel Shader - Color depending on condition I am new to shaders and HLSL so bare with me on this one.

I have a 2D tile map in my game and want to create a mini-map, at first I was just copying all the data from one sprite batch to another and rendering it in a smaller camera. This obviously has a performance issue.

So I want to make a mini-map that is composed of coloured pixels depending on what is in that particular cell.

I have a basic shader going at the moment that converts tex coordinates to pixel position but now I need a way to determine what color to set it. My instant decision was to simply pass in a 2d array of colors and grab the color using the x and y coordinate of the pixel, this crashed lol.

Here is what I have so far for the shader:

sampler s0;

// The width and height of the texture being sampled
int width, height;

float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0
{
    float4 color = tex2D(s0, coords);
    // Covert the tex coordinates to pixel coordinates
    int2 tc = int2(width * coords.x, height * coords.y);

    // Here I need to do some sort of check or something?

    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

How can I pass the color data to the pixel shader so it knows what color to set each pixel? I already know how to pass data but not sure how I can represent that data to pass it.

My map is every changing and units are moving around constantly, so the data will be passed in almost every frame.

sentences:
Opening an XML in Unity3D when the game is built At the moment, my game can open up an XML file inside the editor when I run it. In my XMLReader.cs I'm loading in my file like so:

_xmlDocument.Load(Application.dataPath + "\\HV_Settings\\Settings.xml");

This class also deals with what the XML should do once it has been read in.

However, when I build the game and run the exe, this file isn't called. I know that I can store this file in the C drive, but I want to keep everything in one place so when I start to release what I'm working on, the user doesn't need to do anything.

Am I doing something silly which is causing the XML not to be read?

sentences:
How can I delete an object when it's not stored in an array? I have a boss appearing in my game, but since it's only one character I didn't put it in an array. Now I'm trying to make disappear if its health is less or equal to 0 but I don't know how to do that. Is there a way to remove the object? I only know how to remove a property of an object.

Here's the boss object:

function Boss1(x, y) {
    this.sprite = boss1Sprite;
    this.x = x;
    this.y = y;
    this.imgWidth = 160;
    this.imgHeight = 224;
    this.frameWidth = this.imgWidth / 4;
    this.frameHeight = this.imgHeight / 4;
    this.health = 1500;
    this.directionMode = 1;
    this.currentFrame = 0;
    this.SPEED = 1;
    this.delta = 1;
    this.updateFrame = function () {
        this.currentFrame += 0.2;
    }
    this.showHealth = function () {
        ctx.fillStyle="red";
        ctx.fillRect(this.x,this.y - 10,(this.health/100)*3.3,5);
        ctx.strokeRect(this.x, this.y-10, (100/100) * 50, 5);
    }
    this.show = function () {
        this.updateFrame();
        this.walkingMode = Math.floor(this.currentFrame) % 4;
        ctx.drawImage(this.sprite, this.walkingMode * this.frameWidth, this.directionMode * this.frameHeight, this.frameWidth, this.frameHeight, this.x, this.y, this.frameWidth, this.frameHeight);
    }
    //target == hero
    //position == this
    this.move = function () {
        this.dx = hero.x - this.x;
        this.dy = hero.y - this.y;
        this.length = Math.sqrt(this.dx * this.dx + this.dy * this.dy);
        if (this.length) {
            this.dx = this.dx / this.length;
            this.dy = this.dy / this.length;
        }
        this.x += this.dx * this.delta * this.SPEED;
        this.y += this.dy * this.delta * this.SPEED;
    }
}

//enemy wave object
function random(min, max) {
    return Math.random() * (max - min) + min;
}
function Enemy(x, y){
    this.sprite = enemySprite;
    this.x = x;
    this.y = y;
    this.imgWidth = 128;
    this.imgHeight = 192;
    this.frameWidth = this.imgWidth / 4 ;
    this.frameHeight = this.imgHeight / 4;
    this.toDelete = false;
    this.dx = random(1, 3);
    this.enemiesHealth = 100;
    this.directionMode = 1;
    this.currentFrame = 0;
    this.updateFrame = function(){
        this.currentFrame += 0.2;
    }
    this.showHealth = function (){
        ctx.fillStyle="red";
        ctx.fillRect(this.x,this.y - 10,(this.enemiesHealth/100)*50,5);
        ctx.strokeRect(this.x, this.y-10, (100/100) * 50, 5);
    }
    this.show = function(){
        this.updateFrame();
        this.walkingMode = Math.floor(this.currentFrame) % 4;
        ctx.drawImage(this.sprite,this.walkingMode * this.frameWidth,
        this.directionMode * this.frameHeight, this.frameWidth, this.frameHeight,
        this.x, this.y, this.frameWidth, this.frameHeight );
    }
    this.move = function(){
        this.x = this.x - this.dx;
    }
    this.deletion = function(){
        this.toDelete = true;
    }
}

//this is when the boss is spawning
//the game loop
function draw() {
    bullets = bullets.filter((bullet) => bullet.x <= viewLimit);
    enemies = enemies.filter((enemy) => enemy.x >= viewLimit1);
    while (enemies.length <= enemiesPerTick && kills <= 5) {
        var enemy = new Enemy(canvas.width, random(0, canvas.height - 60));
        enemies.push(enemy);
    }
    for (var v = 0; v < enemies.length; v++) {
        enemies[v].showHealth();
    }
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    hero.show();
    hero.update();
    hero.showHealth();
    for (var i = 0; i < bullets.length; i++) {
        bullets[i].show();
        bullets[i].move();
    }
    for (var j = 0; j < enemies.length; j++) {
        enemies[j].show();
        enemies[j].move();
    }
    for (var t = 0; t < enemies.length; t++) {
        enemies[t].showHealth();
    }
    collision();
    drawScore();
    if (enemies.length == 0) {
        boss1.show();
        boss1.move();
        boss1.showHealth();
    }

    requestAnimationFrame(draw);
}

console.log(enemies, bullets);
draw();

sentences:
How can i get object from TMXTiledMap and store it in Dictionary variable ? I've been following a tutorial to make tiled map in cocos2d x 3.0 ,
but i couldnt complete the rest of the tutorial because its for coco2d x 2.0 version,

How can i get a value of property that is stored in an object from TMXObjectGroup variable ?
and my code is:

tileMap = cocos2d::TMXTiledMap::create("ground.tmx");
ground = tileMap->layerNamed("ground");
this->addChild(tileMap);

TMXObjectGroup *objects = tileMap->getObjectGroup("objects");
??? sign = objects->getObject("sign");// it return ValueMap not Dictionary ?!

how can i get a Dictionary of that object so i can get its values ??

sentences:
Strange mesh import problem with Assimp and OpenGL Using the assimp library for importing 3D data into an OpenGL application. I get some strange problems regarding indexing of the vertices:

If I use the following code for importing vertex indices:

for (unsigned int t = 0; t < mesh->mNumFaces; ++t)
    {
        const struct aiFace * face = &mesh->mFaces[t];
        if (face->mNumIndices == 3)
        {
        indices->push_back(face->mIndices[0]);
        indices->push_back(face->mIndices[1]);
        indices->push_back(face->mIndices[2]);
        }
    }

I get the following result:

Instead, if I use the following code:

for(int k = 0; k < 2 ; k++)
    {
        for (unsigned int t = 0; t < mesh->mNumFaces; ++t)
        {
            const struct aiFace * face = &mesh->mFaces[t];
            if (face->mNumIndices == 3)
            {
            indices->push_back(face->mIndices[0]);
            indices->push_back(face->mIndices[1]);
            indices->push_back(face->mIndices[2]);
            }
        }
    }

I get the correct result:

Hence adding the indices twice, renders the correct result?

The OpenGL buffer is populated, like so:

glBufferData(GL_ELEMENT_ARRAY_BUFFER,
             indices->size() * sizeof(unsigned int),
             indices->data(),
             GL_STATIC_DRAW);

And rendered as follows:

glDrawElements(GL_TRIANGLES,
               vertexCount*3,
               GL_UNSIGNED_INT,
               indices->data());

sentences:
What does [dynamic] do in HLSL Here's an example (this if() is inside of a for loop, which itself has the [unroll] attribute):

[dynamic]
if (n.x > 1.0f || n.x < -1.0f || n.y > 1.0f || n.y < -1.0f || n.z < 0.0f || n.z > 1.0f)
{
    break;
}

I've never seen this before, but I stumbled across this in a shader I'm trying to convert to glsl. Searches turned up nothing but the SM 5 dynamic linking ability. I looked at the available if() attributes, and there's only [branch] and [flatten] listed.

sentences:
Implementing Galaga Style Enemy Behavior in Unity I've been trying to work on a space shooter with the idea of having enemies behaving like it is shown in this video : https://www.youtube.com/watch?v=3p7u8uCR6yw

In the video above, enemies fly from different portions outside the view area of the screen doing elaborate movement before finding a spot to form an organized formation.

I've been thinking of ways how this could all be done. One way is by having either the enemies and/or a manager use a Finite State Machine that will control when there is a "performing" state and when there is a "FindingSpot" state.

but at as far as implementing the complex patterns, I'm at a loss. Is there some sort of Math formulation that's used to generate those movement patterns?

sentences:
texture distortion at a distance I produce a strip of quads with texture coordinates to represent a path.

My texture is tiled along these quads.

When the quad is drawn very small (on my integrated Intel chip) it draws distorted.

How can I avoid this?

sentences:
Making only one side of a object receive light in Unity So I want to achieve a visial asthetic in my game that looks like this

Meaning I dont want the outer parts of my dungeon walls to be affected by light.
Now I know this is posible if the object itslef is created with 2 materials that way I can make the back material solid black. But I was wondering if there is a easy way to achieve this with a shader.

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:
Fade in rendering mode doesn't work as intended The picture shows an object made out of one model. The object works as intended when rendering with opaque rendering mode, but I want the object to fade in/out during animation. The glitch seems to have something to do with queue of rendering, but since it's only one model, and since there's only one material on the model (tried fresh materials, same problem), it seems to be weird glitch. Any help is appreciated, and if possible, I need to find a solution without using a 3d modelling software.

Forward rendering is used on the camera.

sentences:
Resize sprite to match camera width? I'm trying to resize my small background sprite to match the screen width of the user's device.

This is what I'm trying

// Use this for initialization
void Start () {
    // Set filterMode
    SpriteRenderer sr = (SpriteRenderer) GetComponent("Renderer");
    sr.sprite.texture.filterMode = FilterMode.Point;

    // Get scaling
    float multiplier = Camera.main.rect.width / sr.sprite.bounds.size.x;

    // Scale
    transform.localScale = localScale * multiplier;
}

It seems there is a problem with the measure I get from the Camera width, I also tried Screen.width but it seems it returns the value in pixels.

sentences: Create fog (smoke) on Unity3D? I'm creating a game where you are inside a boiler room, the problem is I want to create the fog (smoke) to make this more realistic.

sentences: Bullet simulation stops after windows inactivate I am having trouble when inactivating window (event resizing); all the contents get rendered and input works. Even the physics work but the btDiscreteDynamicsWorld stepSimulation function does not get called. I am using SFML for window and clock. If any more information is needed please let me know.

sentences:
Visual artifacts on long distance on plane I'm making a voxel game in XNA, and have filthy visual artifacts on long distances.

I use 2048*2048 atlases.

I'm already using mipmaps and 16x anisotropic filtering.

I've read this blog post, but I'm not quite sure that this is the problem.

This is how it looks like:

UPD:

The atlas I'm using looks like this:

The topmost left square is used on the screenshots. I'm using XNA Content Processor mipmap compiler to generate mipmaps.

Every cube on the screen is separate, there is no gigantic cubes.

Does anybody have a clue what might it be?

sentences: Track two objects on the screen at the same time I want to keep two objects visible at the same time. My current idea is to calculate a bounding box that contains the two objects and then zoom and rotate the camera so the whole box is visible, is there a different way to approach this problem?

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:
How to find the client's monitor valid refresh rates with Unreal Blueprints? I am making a settings menu. This includes a combo box where you can change the refresh rate setting.

How do I find out the maximum allowable refresh rate of the current user's monitor, using Blueprints?

sentences: How can I include vertex color information in .OBJ files? The .obj files I export are missing data for vertex colors. Is there a way to include color information in the .obj file? If not, what are the alternatives?

sentences:
Architects into videogames I'm an architecture student in my last year. I've always been interested in videogames design. I use 3d Max and Photoshop on a daily basis, and I was thinking about aiming for a career in videogames, starting as a level/environment designer.

How should approach it? Is it worthy to spend some time learning UDK or CryEngine? Should I try a smaller but more general software? I know some programming already.

Finally, will my skills as an architect be something valuable in the indusrty?

Thanks in advance.

sentences:
How would I apply my isometric art onto isometric CSS with correct Z-indexing I have been trying to wrap my head around how to apply my isometric art

into an array like so with correct z-indexing

In the long run I want to be able to select a specific tile and depending on what tile it is I can choose a different function via drop down.

I'd appreciate any help. Even links to isometric documentation on putting images onto tiles. Or even how to successfully put an isometric tile onto a div without it being selectable on the transparent parts of the tile.

Sorry if this was hard to understand.

sentences:
Unity + Admob - EEA checking The Admob plugin for Unity - Android does not supply an EEA permission request form like the standard Android plugin does.
So, I have created my own and it works great.

My only problem is how do I check if I am in the EEA and need to request permission? Again, this feature is supplied for a standard Android app.

I know I can make a simple Android plug-in and call it but that seems a bit over the top.

sentences:
GLSL subroutine not being used I'm using a gaussian blur fragment shader.  In it, I thought it would be concise to include 2 subroutines: one for selecting the horizontal texture coordinate offsets, and another for the vertical texture coordinate offsets.  This way, I just have one gaussian blur shader to manage.

Here is the code for my shader.  The {{NAME}} bits are template placeholders that I substitute in at shader compile time:

#version 420

subroutine vec2 sample_coord_type(int i);
subroutine uniform sample_coord_type sample_coord;

in vec2 texcoord;
out vec3 color;

uniform sampler2D tex;
uniform int texture_size;

const float offsets[{{NUM_SAMPLES}}] = float[]({{SAMPLE_OFFSETS}});
const float weights[{{NUM_SAMPLES}}] = float[]({{SAMPLE_WEIGHTS}});

subroutine(sample_coord_type) vec2 vertical_coord(int i) {
    return vec2(0.0, offsets[i] / texture_size);
}

subroutine(sample_coord_type) vec2 horizontal_coord(int i) {
    //return vec2(offsets[i] / texture_size, 0.0);
    return vec2(0.0, 0.0); // just for testing if this subroutine gets used
}

void main(void) {
    color = vec3(0.0);

    for (int i=0; i<{{NUM_SAMPLES}}; i++) {
        color += texture(tex, texcoord + sample_coord(i)).rgb * weights[i];
        color += texture(tex, texcoord - sample_coord(i)).rgb * weights[i];
    }
}

Here is my code for selecting the subroutine:

blur_program->start();
blur_program->set_subroutine("sample_coord", "vertical_coord", GL_FRAGMENT_SHADER);
blur_program->set_int("texture_size", width);
blur_program->set_texture("tex", *deferred_output);
blur_program->draw(); // draws a quad for the fragment shader to run on

and:

void ShaderProgram::set_subroutine(constr name, constr routine, GLenum target) {
    GLuint routine_index = glGetSubroutineIndex(id, target, routine.c_str());
    GLuint uniform_index = glGetSubroutineUniformLocation(id, target, name.c_str());
    glUniformSubroutinesuiv(target, 1, &routine_index);

    // debugging
    int num_subs;
    glGetActiveSubroutineUniformiv(id, target, uniform_index, GL_NUM_COMPATIBLE_SUBROUTINES, &num_subs);
    std::cout << uniform_index << " " << routine_index << " " << num_subs << "\n";
}

I've checked for errors, and there are none.  When I pass in vertical_coord as the routine to use, my scene is blurred vertically, as it should be.  The routine_index variable is also 1 (which is weird, because vertical_coord subroutine is the first listed in the shader code...but no matter, maybe the compiler is switching things around)

However, when I pass in horizontal_coord, my scene is STILL blurred vertically, even though the value of routine_index is 0, suggesting that a different subroutine is being used.  Yet the horizontal_coord subroutine explicitly does not blur.

What's more is, whichever subroutine comes first in the shader, is the subroutine that the shader uses permanently.  Right now, vertical_coord comes first, so the shader blurs vertically always.  If I put horizontal_coord first, the scene is unblurred, as expected, but then I cannot select the vertical_coord subroutine! :)

Also, the value of num_subs is 2, suggesting that there are 2 subroutines compatible with my sample_coord subroutine uniform.

Just to re-iterate, all of my return values are fine, and there are no glGetError() errors happening.

Any ideas?

sentences:
How do I calculate the normal of a plane defined using homogeneous coordinates? I can define a plane in 3D space using three 3D points (p0, p1, p2) that all lie in the plane and that form a non-degenerate triangle. Calculating the normal of the plane is as simple as calculating the cross product of any two non-parallel 3D vectors that lie in the plane, for instance (p1 - p0) and (p2 - p0). So far, so good.

But what if I use homogeneous coordinates for my points? How do I find the normal of the plane then? Of course, if all points have w != 0, I could simply normalize them (divide by w) and treat them as regular 3D points. But what if one or more points have w == 0?

The way I see it, there are three possible answers to this question:

You do it the same way. If so, please explain how to calculate the cross product of two 3D vectors defined using homogeneous coordinates.
You do it some other way. If so, please explain how.
You can't, your question makes no sense and you are clearly confused. If so, please explain why.

sentences:
How can I make Maya or Blender model work with mecanim? I'm working on a simple game project, where I need a stick figure. Due to being stubborn and the desire to learn a new skill, I want to make the stick figure myself! I have followed several tutorials in both Maya and blender. For Maya, I'm using the student version. I have my stick figure rigged within Maya and blender, both utilizing their respective bone tools. I can manipulate their limbs well, enough. However, I can't seem to get the models to work with Mecanim.

I have the Kinect adapter for the PC and would like to be able to use it to create the animations utilizing a tool such as the Kinect v2 mocap animator.

How I can get my model to work with Kinect based mocap?

sentences:
Spritefonts gets very messed up when scaling up I'm recoding a retro video game, but because the original resolution is very low, I scale everything up. I render to a renderTarget and render the renderTarget to the target resolution.

I'm using my spriteBatch like this:

_spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);

This allows upscaling with keeping the pixels as they are.
It works fine, but the spritefont gets really messed up:

Any idea how to fix that? When I create the spriteFont with an extremly large size and give it a low scale to the drawString method, it looks about the same.

sentences:
Adding some new velocity to player in FixedUpdate. Should I use FixedDeltaTime or nothing? I am trying to learn how to move objects in Unity without using the built in features like AddForce etc. Some tutorials on Unity website (and other places) is where I have got most of my 'knowledge' so far from.

This script for moving players (in topdown Space SHMUP) has been working fine for me and includes acceleration and artificial drag (basically 'smooth' movement, or like being on ice).

I'm sure this code is overly long, bloated, inefficient and in most cases downright wrong, but it is written for me to understand it, rather than simply using Unity Prefabs and AssetPackages i download from Store.

QUESTION: Do I need the Time.fixedDeltaTime mutlipiers when calculating my 'delta_v' values here. And also what about on the drag part at the bottom.

As usual all help and comments are greatly appreciated. Thanks!

public class Player_Movement_SpaceShooter_TopDown : MonoBehaviour
{
public Vector2 maxVelocity;
public float drag;
public float moveForce;
private Rect moveBounds;

private Rigidbody2D rb;

private void Start()
{
    rb = GetComponent<Rigidbody2D>();
    moveBounds = Game_Manager.instance.ScreenBounds;
}

private void FixedUpdate()
{
    float input_h = Input.GetAxis("Horizontal");
    float input_v = Input.GetAxis("Vertical");
    Vector2 delta_v = Vector2.zero;

    delta_v.x += input_h * moveForce * Time.fixedDeltaTime;
    delta_v.x = Mathf.Clamp(delta_v.x, -maxVelocity.x, maxVelocity.x);
    delta_v.y += input_v * moveForce * Time.fixedDeltaTime;
    delta_v.y = Mathf.Clamp(delta_v.y, -maxVelocity.y, maxVelocity.y);

    Vector2 pos = rb.position;
    Vector2 vel = rb.velocity;
    if (pos.x < moveBounds.xMin)
    {
        pos.x = moveBounds.xMin;
        vel.x = 0f;
    }
    if (pos.x > moveBounds.xMax)
    {
        pos.x = moveBounds.xMax;
        vel.x = 0f;
    }
    if (pos.y < moveBounds.yMin)
    {
        pos.y = moveBounds.yMin;
        vel.y = 0f;
    }
    if (pos.y > moveBounds.yMax)
    {
        pos.y = moveBounds.yMax;
        vel.y = 0f;
    }

    rb.position = pos;

    rb.velocity = vel + delta_v;
    rb.velocity = rb.velocity * (1 - Time.fixedDeltaTime * drag);

}

}

It appears to me that if FixedUpdate was somehow slowed down, the velocity would get  changed slower, the same with the enemy movement but I don't know how that would effect the gameplay and if/how the slowing-down would occur

sentences:
Issues compiling .fx shader to MGFX I've been trying to port Catalinzima's 2D lighting example over to MonoGame to try and get some basic understanding around it and adapt it for use in my engine. I've been trying to convert the two .fx files provided with it to MonoGame compatable .mgfxo files. The first file ran through the converter and compiles successfully. However, the second file ran into issues converting; cmd Dump:

C:\Program Files (x86)\MSBuild\MonoGame\v3.0>2MGFX.exe resolveShadowsEffect.fx /DEBUG
C:\\Program Files (x86)\\MSBuild\\MonoGame\\v3.0\\resolveShadowsEffect.fx(213,8):
error X5608: Compiled shader code uses too many arithmetic instruction slots (85). Max. allowed by the target (ps_2_0) is 64.
(1,1): error X5609: Compiled shader code uses too many instruction slots (99). Max. allowed by the target (ps_2_0) is 96.

Failed to compile the input file 'resolveShadowsEffect.fx'

So i thought fine, ill just change the PixelShader model to ps_3_0. Now this converts fine, but fails to compile in visual studio with the following errors:

A namespace cannot directly contain members such as fields or methods (1, 1)

and..

Unexpected character '' (1, 5)

In the visual studio error message this character shows as '|' but its not the same when i paste it out.

I've tried comparing the first lines of the files, but have not been able to notice any differences.

I'm pretty new to using shaders, so i haven't been able to debug whats going on effectively. Any ideas?

You can find the original shader files and compiled versions here: http://puu.sh/9ZfMe/efe8fbaf9d.zip

sentences:
How does the Unity coordinate system map to screen pixels? If I have a GameObject, say at x = 0, y = 0, and I want to move
it for a 40 pixel to x how can I make that?

In don't understand which is the unit of measurement in Unity.

If I make something like this where mov is 40 the sprite goes out of screen!

void Start()
{
    transform.Translate(new Vector3(mov, 0, 0));
}

it seems like the correct values must be very low, say 0.6, 1, 3, etc.

But why?

sentences:
How to resolve collision when both of the intersecting bodies were moving? Suppose there are two quadrilaterals A and B.  A is stationary but B is moving. They collided. Now B is inside A.

To check if they are intersecting I can use 2d separating axis theorem (SAT). To push B out of A so that they are not intersecting anymore, I can again use SAT to get the Minimum Translation Vector(MTV) and project B out of A using it.

My problem is, what should I do when both A and B were moving, and then they collided? I can't project A out of B or B out of A alone since both of them were moving. How should I separate them?

sentences:
LibGDX Deployment questions A few questions from LibGDX newbie:

How do you deploy a Mac/Windows app? If Mac app, can this be deployed to Mac App Store?
Do you need to pay monthly (for RoboVM) for iOS development/deployment?

I am using Android Studio. Thanks!

sentences:
how are semantics used when declaring a struct? I don't understand how semantics are used in shaders. While reading Unity's shader tutorials, I come across this

struct v2f {
    float worldPos: TEXCOORD0;
    half3 worldNormal: TEXCOORD1;
    float4 pos : SV_POSITION;
};

and also this

       struct v2f {
            float3 worldPos : TEXCOORD0;
            half3 tspace0 : TEXCOORD1;
            half3 tspace1 : TEXCOORD2;
            half3 tspace2 : TEXCOORD3;
            float2 uv : TEXCOORD4;
            float4 pos : SV_POSITION;
        };

Microsoft's documentation says

  A semantic is a string attached to a shader input or output that conveys information about the intended use of a parameter.

I know there is some kind of interpolation of data because vertices and pixels aren't one to one, thus I think semantics are used for telling the graphics library what to do about the data. But here it uses TEXCOORDX for things like world position and tangent space vectors. They don't seem to have anything to do with UV coordinates. So how are these semantics actully used?

sentences:
SECTR sectors & global state For our game we decided to give SECTR (https://www.assetstore.unity3d.com/en/#!/content/15356) a try. SECTR loads scenes additively into the main scene, which enables us to work on it concurrently. It also unloads scenes when they aren't used.

Time is very important in our game and objects have to perform actions at a certain time or have to be in a certain state at a time. We decided to have those actions/events local to the sector. So now when the sector is unloaded, we lose the current progress of our action/event.

What is a good way to save this progress and how could we apply differences in time between unloading and loading to this progress?
How do we handle events happening while the sector is unloaded?

The obvious solution is to use global state for these events, but we'd like to keep it local to the sectors.

sentences:
Does CharacterController benefit from adding lerp? Does CharacterController benefit from adding lerp?

as in this script.

mouse = Input.GetAxis("Mouse X");
current = Mathf.Lerp(current, mouse, Time.deltaTime * 10);
transform.Rotate(0, current * 600 * Time.deltaTime, 0);

I was using,

transform.Rotate(0, mouse * 18, 0);

But read into the idea of lerp and wrote that.

sentences:
How do I make my plane appear 3D like in the "Roll-a-ball" tutorial? I am following the first tutorial on the Unity website, which details making a 'Roll-a-ball' game.

I am stuck at a point where I need to make a 3D plane object; it looks flat, to me, and unlike how it looks like in the tutorial.

How do I make my plane look 3D?

This is what I see:

This is what I see in the tutorial:

sentences:
Is there an efficient way to identify in which run-time generated room a character is, in a non-grid 3D environment? How? Here is what I am trying to implement. I wrote a script that allows the player to place walls during run-time, in non grid-based 3D environment (walls can be diagonal with rotation increasing/decreasing in amounts of 10 degrees). Like the figure below shows, since wall can form different angles, rooms might end up having both convex and concave angles:

What I have been looking for, without success so far, is a way to detect in which room a given character is, according to its position. Of course, if that was a grid-based setting, I could only pass an ID for each cell and then retrieve the ID of the cell where the given character stands. However, that being a non-grid setting and with irregular rooms that have shapes unknown in advance, how could I accomplish that in an efficient way?

Many thanks.

EDIT:
Although it is a 3D environment, the problem may be treated as a 2D one since height is not a concern here.

sentences:
How to disable touch in Quintus? I'm  trying to build card game using the Quintus game engine. I have objects called Card. I can touch and drag it in the screen but I want just to touch and drag it one time but I can't figure out how to disable the touch after I dragged the card and I try to Google it but no luck.

My code:

Q.Sprite.extend("Card", {

init: function(p){

    this._super(p,{
        asset: "Queen_OF_Hearts.png",
        x: Q.el.width / 2,
        y: Q.el.height - 120
    });

   this.on("drag");
   this.on("touchEnd");
},

drag: function(touch) {
   this.p.dragging = true;
   this.p.x = touch.origX + touch.dx;
   this.p.y = touch.origY + touch.dy;
 },

touchEnd: function(touch) {
   this.p.dragging = false;
   // put a line on the screen if the card pass it put the card in the new position if not put the card in the orginal(old) postion
   if(touch.origY + touch.dy > Q.el.height - 200) { //define the line that the card should pass if the amount of draged > the screen line in Q.el.height - 200
       // put the card in the same old postion if is not pass the line
       this.p.x = touch.origX;
       this.p.y = touch.origY;

    } else {
        // put the card if it pass the line in the new postion
        this.p.x = Q.el.width / 2;
        this.p.y = Q.el.height - 280;

    }
}
});

so in the else statement in the touchEnd I'm trying to do some thing like that

this.p.touch = false;

but is not working.

sentences:
Feasibility of a project in certain languages My current project is a very simple browser-based game. The player moves with the keys and draws a bow with the mouse to shoot arrows at approaching enemies. This seemed to me like the perfect game for a Python/PyGame implementation and it proved to be true - except if I want it browser-based (Desktop version already works perfectly).

Is there any way I can get Python/PyGame running from a server in a browser window? I tried Kivy but it seems to have problems handling PyGame.

Is there a way to use HTML, PHP or the like to get the Python/PyGame script running in a browser window by "translating" inputs to the Python script and vice versa translating returns into view changes?

Is there an alternative (JavaScript + additional libraries?) that offers me: PNG with Alpha handling readily implemented (I don't really want to use another few days to write that on my own...), easy catching of mouse/key inputs and an "easy-going" license policy that allows me to publish it donation-based without having to pay for a license?

Note: If I really have to change to another language anyway, then I'd prefer one where I can implement catching touch-screen inputs from mobile devices.

I'd really appreciate any advice on these questions as I'm really stuck with it until I know to which language I have to translate the Python/PyGame version.

sentences: How can I move the Floor in ZBrush? I built a character is ZBrush, added some subtools and extracts and realized I have to move the angle 'cause he is "falling". Is it possible to move him and all subtools around him at once (like groups in photoshop) or change the angle of the "Floor"?

sentences:
Collision detection between 2 irregular shapes I need to implement a collision system for a vertical-shotter and the bullets can have any type of shape; i've implemented the shape class with an array of choords and an array of lines which have the references of start and end points; in case the line is bezier it have an array of anchor points.

so:

Line { Choord Start,End; Choord [] Anchors = null; ... }
Choord { float X, Y; ... }
Shape { Choord [] Vertexs; Line [] Lines; ... }

i have to handle a collision like this:

anyone have a general idea for check collision with this type of shapes?
and this model can work?

i've tryed with SAT collisions but it works only for convex polygons.

sentences:
Game lags when my player collides with a specific object (solution known, unsure how to implement) I'm developing a game in Android using LibGDX (although this is more of a JAVA problem than an engine problem). My aim is to have my player bounce off one spring onto another that will eventually take him over an obstacle like so:

I have a feeling the lag is because im creating new objects in a method that gets called in update(). This is because I had the same issue with coins in the game until I stopped initialising the Coinobject in a method that gets called by update() - now they work smoothly.

However, I'm not sure how to implement the spring collision without initialising Spring objects. Currently, objects are initialised through a text file - however, Spring is only initialised in a Box object rather than the text file. In my update() method I loop through the objects and if an object is a Box which contains a Spring, the following method is called:

public void playerSpringCollision(Box containsSpring) {
        // first spring (on the box)
        Spring boxSpring = containsSpring.getSpring();
        // second spring (on the platform)
        Spring platformSpring = containsSpring.getPartnerPlatform().getSpring();
        // 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();
        directionToSpring.x = dx;
        directionToSpring.y = dy;
        // if player collides with first spring
        if (player.getRectangle().overlaps(boxSpring.getRectangle())) {
            player.springImpulse(directionToSpring); // send player to platform spring
        }
        // if player collides with second spring
        if (player.getRectangle().overlaps(platformSpring.getRectangle())) {
            directionToObstacle.x = -directionToSpring.x;
            directionToObstacle.y = directionToSpring.y;
            player.springImpulse(directionToObstacle); // send player over obstacle
        }
}

I'm not sure how to do this without initialising Spring and Vector2 objects in the method - any ideas? Highly grateful for any help, thanks.

sentences:
How to achieve light effect on a car panel icons? I'm making a car and I want to make lightable icons on its panel. I want to add 'on' and 'off' effect to them separately. The Sprites are plane objects, with one material and UV texture for each plane.

If I change material property - it will change in all objects which use this material. I don't think creating 10 materials for 10 sprites is the best choice, what should I do in this situation?

sentences:
Update function in html5 canvas game isn't working properly Jsfiddle :  http://jsfiddle.net/seekpunk/6eeKH/15/

the code :

if (this.collection.length > 0) {
    if (((this.collection[0].blockX + this.collection[0].blockW) >= cw)
       || (this.collection[0].blockX <= 0)) {
        this.collection[0].blockSpeed *= -1;
    }
    this.collection[0].blockX += this.collection[0].blockSpeed;
}

the first block from top is drawn twin and i can't figure out why i guess the  problem is in drawing the levels can someone please help me figure out what i did wrong in my code

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:
I Can't spawn buttons in my Grid. why? Today i was following a tutorial about making a shop, but i got a problem.

and i've followed the scripting tutorial, but it seems i can't spawn a button inside the grid when i pressed GetItemButton. here's how the script goes:

public class ItemCatalogue : MonoBehaviour {

public Items[] AvailableItems;
public Text DisplayArray;

public void GetItem() {
   Items item = AvailableItems[Random.Range(0, AvailableItems.Length)];
    InventoryCatalogue.Instance.AddMaterialToCatalogue(new ItemStack(item, 1));
    DisplayArray.text = item.name;
}

// Use this for initialization
void Start () {

}

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

    }
}

and another one:

public class InventoryCatalogue : MonoBehaviour {

public static InventoryCatalogue Instance;

public List<ItemStack> MatStorage;

public Transform ScrollList;
public GameObject ItemPrefab;

void Start()
{
    if (Instance != null) {
        return;
    }
    Instance = this;
    MatStorage = new List<ItemStack>();
}

public void AddMaterialToCatalogue(ItemStack Stack) {
    bool hasItem = false;
    foreach (ItemStack i in MatStorage) {
        if (i.item.name == Stack.item.name) {
            hasItem = true;
            i.amount += Stack.amount;
        }
    }
    if (!hasItem) {
        MatStorage.Add(Stack);
    }
  }
}

Anybody know why?

sentences:
Reading text files XNA 4.0 on Xbox 360 I'm working on porting a game from PC to Xbox 360.

When I want to create a level I read a .txt file that I store in my content
I read the whole file as a string using this method

File.ReadAllText(fi.FullName);

Where I'm passing in the full path to that file.

Later on in my code I parse that string to create whatever level I need.

When I try to deploy my game onto the Xbox I usually get an error stating

'System.IO.File' does not contain a definition for 'ReadAllText'

I was wondering if there was a simple way to read the text in a .txt file when I deploy onto the Xbox 360

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: How does Unity know that you make more than one hundred thousand dollars on the Personal plan? How do they check if you make more than 100k? That is really puzzling me.

sentences:
Collision detection with entities/AI I'm making my first game in Java, a top down 2D RPG.
I've handled basic collision detection, rendering and have added an NPC, but I'm stuck on how to handle interaction between the player and the NPC.

Currently I'm drawing out my level and then drawing characters, NPCs and animated tiles on top of this. The problem is keeping track of the NPCs so that my Character class can interact with methods in the NPC classes on collision.

I'm not sure my method of drawing the level and drawing everything else on top is a good one - can anyone shed any light on this topic?

sentences:
A ball hits the corner slightly, where will it deflect? I am currently making an iOS Game but I have a small problem. The game is simply a ball which you can control to avoid obstacles and find the food. When the ball hits, e.g. the top or the bottom of an obstacle, it's easy, the y-speed is just inverted. Same with left and right, where the x-speed is inverted.

But what happens when the mass point of the ball doesn't touch a side of the obstacle, but its surface is? Where will it be deflected? What's the maths behind that?
Here's an image to illustrate the problem:

Thanks in advance for help!

sentences:
How does Unity Inspector handle values changing during play without any thread-locks? First of all, I'm a Java coder. Usually, when you write a game, you run it on thread different than the UI one like:

// pseudocode starts
new Thread(new Runnable(){
    @Override
    public void run()
        while(someVolatileBoolean){
            input();
            physics();
            graphics();
        }
    }
}

and then you declare some sort of listener for the input which usually works on application/UI thread so you need to mark it as volatile, atomic or perform a basic synchro using the synchronized keyword (depending on the situation).

Let's take a simple Unity script:

public class SomeMovementScript : MonoBehaviour {

    public Vector3 speed = new Vector3(0.1f, 0, 0);

    void Update () {
        this.transform.Translate(speed * Time.deltaTime);
    }
}

If we then play the game, the object starts to move with speed 0.1f.

Now, when the game is playing, we can change the speed variable through the inspector:

I thought from the UI coder point of view: I'm changing a variable, which is being read each frame by the game thread. How does this happen, that I don't get some sort of ConcurrentModificationException if there's no visible synchronization at all. The variable is public, not being cached in any way.

I know that this question should be asked on SO, but I thought that GD has more users specialized in Unity and it's mechanics.

I came up with immutability. Variable is considered thread-safe if it's state can't change. As components are immutable, and classes like Vector2/3/4 are immutable - it would work. But... You can make your own class [Serializable], mark their fields as public and the class is not thread-safe - but it is visible through the inspector.

How does Unity Inspector perform these real-time updates with all the classes you can think of?

sentences:
How to divide sprite sheet, but keeping the in same png? first post here, but couldn't find an exact answer in your database, so guess I'll have to ask.

I want to know how it is possible to create a ".META" file for a .png so you can extract individual sprites in a spritesheet without having to save all the sprites in individual .png's.

I know it's possible since the developer in the tutorial HERE is using a spritesheet like that.

Thank you very much in advance.

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:
How do I get a list of all available entities in a Source engine game? How do I get a list of all available entities in a Source engine game?

There is only one exported function in the server DLL - CreateInterface - so it's not an option. In GoldSrc games, the server DLL features all entities as exported functions.

sentences: RenderPipleinManager.DORenderLoop_Internal() Taking Unusual Amount In profiler I am developing for WebGL and for optimization purposes I have converted to URP. After converting the tri count has dramatically improved but the problem is my FPS is not improving. I tried to profile and found that RenderPipleinManager.DORenderLoop_Internal() is taking 13%. Is this normal? An initial search brought that it was a bug and fixed in a later unity version. But even after converting to the latest lts 2019.4.20, i am getting the same issue.

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:
glDrawElements vs glDrawArrays for polygons that do not reuse vertices Is it better to use glDrawElements or glDrawArrays when not reusing vertices?  There must be some difference, otherwise people would always use glDrawElements?

I suppose the question could be reworded as the following:

Does glDrawElements function the same as glDrawArrays if it is passed a blank indices table?

sentences:
How can I render images to multiple windows without creating double textures in SDL2? Simply put: What is the simplest way to render an image to two different sdl2 windows?

I'm pretty new to SLD2, but I have a nice little level editor working. I then decided to move the area with edit tools to a separate window. I immediately got the following error:

  Texture was not created with this renderer.

Alas, it looks like each window needs to have its own SDL_Renderer, and each renderer needs to create its own textures for the images I want to display.

IMG_LoadTexture() needs a renderer and will only render the resulting texture to that renderer.

SDL_CreateRenderer() then needs a window as a parameter and doesn't seem to be able to ever render to another output window.

So does this really mean I have to create separate textures of each of my images for each and every renderer/window? Or is there a way to load graphics into textures that can be used by any renderer, or on any window?

sentences:
How are UDP packets verified as authentic? Hey I'm writing a game and have the backend written using a sometimes-reliable UDP scheme. I want to verify that inbound packets are actually originating from the player specified in the packets.

My idea (not original by any means) was to have the player register an account once and then, once per "session", login over HTTPS/SSL by sending username+password to a simple web service. The game client would check validity of my site's SSL certificate to disallow impersonation. The username and password are submitted and the response is a generated random "secret session key".

Matchmaking happens blah blah...

Then, when playing a match/game, the game client sends packets using UDP and attaches a HMAC-SHA1 of the packet payload using the secret session key as secret. I don't care if people can see the contents of the packet -- there's nothing secret there -- so symmetric encryption isn't needed.

I don't see how the packets can be spoofed since the secret session key was transmitted to the game client over a secure channel but I don't know what I don't know, you know?

Thanks for any insights.

sentences:
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:
How to move my character by itself but I can still move its direction or where it is going, using Mobile Joystick? So, I am making a 2D airplane game right now and I wanted to know how to move my player automatically but I can still control where it should go or the direction. How do I code this using Mobile joystick?

CODE:

public float moveSpeed;

Rigidbody2D myBody;

protected Joystick joystick;

void Start()
{
    myBody = GetComponent<Rigidbody2D>();
    joystick = FindObjectOfType<Joystick>();
}

// Update is called once per frame

void Update()
{
    myBody.velocity = new Vector2( joystick.Horizontal * moveSpeed, joystick.Vertical * moveSpeed );
}

sentences: How do I recruit beta testers? We're a small company without enough employees to run a large scale beta in house.  The app is geo-location based so we're trying to recruits some beta testers from all over that aren't "friends and family".  Are there any sites or communities dedicated to something like this?

sentences:
Unity's CharacterController vs. Rigidbody with Collider With a few friends I started to make a 3D game in the style of the old platformers à la Super Mario 64 / Spyro / Banjo Kazooie.

So now we are thinking about the controls and how to do them.

There seem to be two mutually-exclusive options: Giving our character a rigidbody and however many colliders we want OR
using a character controller.

At the moment we have a rigidbody with a collider which technically works, but we have to make our own grounded check, and movement, while those two in particular are relatively easy to implement.
If we start to use a character controller OTOH, we won't have all the collisions anymore and programming logic needs to be applied in a different way.

Let's take a jumppad as example:

If we use a Rigidbody, the jumppad itself checks if someone is standing on it, and if so it increases the jumpstrength while that someone stands on it.
If we use a CharacterController, we'd have to check not only if we are standing on a jumppad, but also on which one, to determine the actual jumpstrength, as they might differ between pads.

So, is there a clear winner to use in a 3D platformer with fighting elements or do we have to work with limitations on either and just have to work around them?

sentences:
How to randomize the ball direction? I've started trying a few things with Sprite Kit for Game Development. I was creating a brick breaking game. So I've run into a issue on how to randomize the initial starting direction of the ball.

I set the following properties for my ball which launches from the paddle.

ball.physicsBody.friction = 0;
ball.physicsBody.linearDamping = 0;
ball.physicsBody.restitution = 1 ; //energy lost on impact or bounciness

To start at different direction during the gameplay, I've randomized the selection of the 4 vectors because I'm using the applyImpulse method to direct the ball in a particular direction and I need to make sure the ball does not go slow if the vector values are low.

int initialDirection = arc4random()%10;
CGVector myVector;

if(initialDirection < 2)
{
    myVector = CGVectorMake(4, 7);
}
else if(initialDirection >3 && initialDirection <= 6)
{
    myVector = CGVectorMake(-7, -5);
}
else if(initialDirection >6 && initialDirection <= 8)
{
     myVector = CGVectorMake(-5, -8);
}
else
{
     myVector = CGVectorMake(8, 5);
}
//apply the vector
[ball.physicsBody applyImpulse:myVector];

Is there any way I can randomize the direction and still maintain a speed for my ball ?

sentences:
DirectX 11 - Problem with low resolution decals I'm trying to add a decal system in my DirectX engine but i'm facing some problems with the quality of the textures projected. Every other no decal texture look fine, but these ones look really bad.

What I do in the shader is:

    float4 PSDecal(
    in float4 iPosition : SV_Position
    ) : SV_Target
{

    int3 ss_load_coords = uint3(iPosition.xy, 0);

    float3 wPos = txWorldPos.Load(ss_load_coords).xyz;

    float4 lightSpacePos = mul(float4(wPos,1), LightViewProjection);
    lightSpacePos.xyz /= lightSpacePos.w;
    lightSpacePos.x = (lightSpacePos.x + 1) * 0.5;
    lightSpacePos.y = (1 - lightSpacePos.y) * 0.5;

    float4 light_mask = txLightMask.Sample(samLightBlackBorder, lightSpacePos.xy);
    if (lightSpacePos.w < 0)
        light_mask.xyzw = .0;

    return light_mask;
}

Here you can see the result decal, the original texture and the projection space of the decal:

In the last image you can see there are noticeable artifacts, and thats why the resulting image gets distorted, but I don't understand why...

Also, I have the same problem when generating the light shadows, they get pixelated too. In this case, the shadow map is being calculated correctly, and it's not distorted.

Maybe it's the world position that is being loaded?

sentences:
Is grass object amount limited in Unity? I'm using Unity 2019.3.7f1 free version to create a small game project. I have a large terrain which I want to fill with grass. To achieve that I'm using the grass brush tool provided with the terrain.
However I cannot put more than, say 10'000 grass items (arbitrary, I don't know the real limit). Exceeding this amount, the grass objects contained in the first area I filled are removed, one by one, for a reason I cannot figure out. It's like there is a max limit of grass object I cannot exceed, and this is true for both grass textures and detail meshes.
On the other hand the amount of tree seems unlimited, which is puzzling me.
So my questions are:

Is there a limited amount of grass objects available in Unity?
If yes, how many grass objects are available, and may I increase this limit?
Is it a known bug, or a known limitation of the Unity free version?
May grass impact the global performances of the game? (I feel that my game is significantly more slow after I added the grass...)

sentences:
Exporting models from Crocotile3D to Unreal Engine 4 (.obj). Texures are always blurry. I want crisp, clean textures Can anyone help me? I am exporting models with textures (.obj) from Crocotile3D to Unreal Engine 4. I want them to be crisp and clear, as in the left image (Crocotile editor), but only get blurry, as in the right image (Unreal editor). Whether I export the model at scale x 1 or greater doesn't make any difference. My textures are 16x16 pixels.

I have watched endless videos and tinkered with settings but been stuck for two days. Any help or advice will be much appreciated!

sentences: What happens to my already-published game when I upgrade to Unity Pro? I made a game with Unity's Standard liscense, and published it (version 1.0) on Google Play. If I buy a Unity Pro license can I publish an update to my game (version 2.0) with it on Google Play, or must I create a new game on Google Play for the updated version?

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:
Using the MVC pattern in games I saw a lot oft tutorials about the mvc pattern, but always it was only a small example/Situation explained.
There was always only one model, one controller and one view.
But what if I have a lot oft models with complex logic, I cant put all the rendering code in one view and all the logic code in one controller.
How I split all in smaller pieces, because the models logic depends in each other(for example collision).
Know someone a good tutorial, or example game that explains this pattern in advanced games?

sentences:
Rendering tilemaps at a specific position libgdx I'm making an endless side scroller game like gravity guy with libgdx.

To test this I'm just creating two tiled maps with the same .tmx file to render then one after another, like:

                            [map1][map2][map3][map4]...

The thing is I'm not succeeding to do this, and I already have searched related problems... I found one topic related with this but I couldn't understand very clearly.

Would be very happy if someone could help me on this!

sentences:
Where can I download the Doom Classic source code, the iOS port? Doom classic source code for iOS was released by id software, but there is no working link on their web site where I could get it from.

Do you know an alternative source to download the Doom Game for iOS?

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:
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:
How are real world car characteristics translated to in-game? I am just entering the world of game development, starting with the racing genre of games.

Let me clarify that this question is not about car modelling or external detailing; it is about the way a car drives, handles, and the way it feels (how heavy or torque-y it is, or how fast and nimble it is, the way it moves in place when you hit the brakes, etc.) in-game.

I am looking to understand the process game developers take to translate real world car characteristics and physics into in-game cars. I am not talking specifically about simulation games; I'm including even arcade games where driving a muscle car feels very different from driving a tuner, or a sports car, or super and hyper cars.

Questions such as the following arise:

(1) Do developers have get their hands on a car physically in order to be able to map it into an in-game car? When they drive it around, what metrics are they looking to capture so their in-game car can feel as true to the real one?

(2) What if they can't get a physical car, or if the car is a concept with no drivability? What metrics, data and telemetry should the car manufacturer supply in order for the car to be represented in-game?

(3) Within cars of the same kind, such as muscle cars, how do developers ensure that a Ford Mustang, a Dodge Challenger, a Chevrolet Camaro, all feel sufficiently distinct from each other in-game? How do they ensure a Porsche 911 Turbo, a 911 GT3, a 911 GT2 all feel different, just as the real cars do?

sentences:
Implementation of a quaternion based hinge constraint I'm trying to implement a hinge joint between two rigid bodies based on Lagnange multipliers, s.t. constraint functions to be constraints on quaternions, which describe bodies orientation, itself. It's more natural than describe constraints in terms of some vectors rigidly connected with bodies as it is just implicit quaternions. Plus quaternions should handle the problem of bistability of "vectorial constraints". It is essential to write the correct constraint functions.

It seems that I found the correct constraints but something goes wrong (later). Tell me, please, if I do something wrong or miss something. Let us concentrate just on unlimited hinge rotation of two rigid bodies about some common axis. So we need to get rid of two degrees of freedom. Let

q = rAconj qAconj qB rB,

where qA and qB are usual orientation quaternions (s.t. if a vector V has a coordinates column V' in a frame of a body B (lets name this frame B') then (qB*(0, V')*qBconj).im is its coordinates column in a world frame (lets call this frame W)), rB is a quaternion which carry out rotation from frame where the axis, bodies rotate about, direction vector has coordinates (0, 0, 1) (lets call this frame B'') to frame B', rA defined by analogy.

The hinge constraint would not be violated iff vectorial part of q is collinear with Z axis. I.e. the (coordinate) constraints are just

q.x = 0,
q.y = 0.

Then differentiating this equations, minding Leibniz rule, unitarity of quaternions and dq/dt = 0.5 q (0, w) identity we get

qdot = 0.5 rAconj (qAconj qB (0, wB) - (0, wA) qAconj qB) rB

and the velocity constraints:

qdot.x = 0,
qdot.y = 0.

Velocities are "decoupled" so to get Jacobian is a matter of simple quaternion multiplication. For convenience while experimenting I just write short functions getC, getCdot by which Jacobian is calculated. I'm quite sure in that part of code 'cause I've tested with "not quaternion version" of getCdot and it works fine.

Everything works fine if one of the bodies has an infinite inertia (kinematic body) or (if both bodies are dynamic) if angular velocities are orthogonal or collinear to rotation axis. If angular velocities are in general case simulation blows up. Can you get a tip why is this happening? This is not because of quadratic term (Coriolis', gyroscopic, ...) in the Euler equations -- I ignore this term for now for the sake of stability.

sentences: Do games need installation these days? I wonder why games need installation at all. I can understand that some software like a browser needs it so it can associate some file types with it and start an executable, or add the icon to the Programs/Features component on Windows. But what's the purpose of installing, say, a Steam game? The Steam itself handles installation/removal of a game, updating, starting etc. If I develop my own game launcher (which will use installation) what are the reasons for me to use also an installer for my games?

sentences:
Pause in Seconds and resume in unity I want to pause  15 seconds then resume without any input when an object is collision other object
this is my code but not working.
Thank you

 void Start(){
    Eifftower = GameObject.FindGameObjectWithTag ("eiffeldespration");
    Eifftower.renderer.enabled = false;
    Time.timeScale = 1;
}

IEnumerator wait() {
    yield return new WaitForSeconds(15f);
    Eifftower.renderer.enabled = false;
    Time.timeScale = 1;
    Debug.Log("test");
}

void OnTriggerEnter2D(Collider2D collisionObject){
            //remove the game object
            if (collisionObject.tag == "Franch" ) {
            Eifftower.renderer.enabled = true;
            Time.timeScale = 1;
            StartCoroutine(test1());
            }
    }

sentences:
Box2D Soft Body Wheel in Unity3D I was watching this video made with IForce2D, its about creating soft bodied wheels in box2D.

http://www.youtube.com/watch?v=F-aDMZUVw0c

I wanted help in being able to increase the Radius of the Wheel gradually.

I tried increasing the natural distance of spring joint (Distance Joint) between central body and outer body.
But since outer bodies are connected by revolute joint, which force the outer bodies to not change their positions.

I then changed the Anchor Points of Revolute Joint to match the increase in Radius of Wheel. Now, the outer bodies start moving away from center body towards their natural Distance. But gradually some outer bodies rotate and move away from each other.

Check out this video i made showing what i have done:
https://drive.google.com/file/d/0B-CQHvLBg5TQNlBEZXpRaVc5MDQ/edit?usp=sharing

Note:- I am using Unity3D 4.3.4 with 2D Physics, Gravity is Off.

Any ideas?

sentences: Unity crossplatform native plugins I need to create a c++ native plugin for my game. If I want to support macOS and Windows, do I need to write my plugin twice - one in XCode with a bundle project and another in VS for windows or is there a way to support both with one codebase?

sentences:
Younger audiences and chat Most multiplayer games have some sort of way to communicate. It is usually verbal, written, or emotive gestures.

If I were to allow young children, from 11 to 13, access to a game I'm creating where anyone can type anything, what would I need to do?

The things I can think of are; hide all chat, only allow other young players to talk to each other with a list of censored words, or just allow predetermined sentences and actions to be used.

sentences:
Separating axis Theorem rotation issue I made a post yesterday to see if anyone could understand my problem.

However I did not receive much guidance, probably because my question was not clear.

I have worked on it a little more and discovered the actual issue and now have a clearer picture of what is causing the problem.

As you can see from the image, the boxes are projected correctly along their appropriate axis (all components labeled 1 are from the main white box 1 and vice versa).

The problem comes when the box is rotated. (See image 2). Box 1 has been rotated but the corner (projection?) in green clearly does not match the shape of the rotated box 1 and is much much closer to box 2 than it should be. The axis projections have changed and axis 1 is on the far left but axis 3 has gone?

THE CODE CAN BE SEEN ON MY PREVIOUS POST
Separating Axis Theorem Issue

Thank you! ;D

sentences:
Character movement relative to cursor position I want my top-down shooter character to move towards the mouse when pressing the up arrow and strafe relative at right angles to it when pressing the left and right arrow keys.

I can't figure out how to do this.

Here is my code (The character is character_mc):

import flash.events.MouseEvent;
//Event Listners
stage.addChild(crosshair_mc);
crosshair_mc.mouseEnabled = false;
crosshair_mc.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

function fl_CustomMouseCursor(event:Event)
{
    crosshair_mc.x = stage.mouseX;
    crosshair_mc.y = stage.mouseY;
}
Mouse.hide();

stage.addEventListener(MouseEvent.MOUSE_MOVE,facecursor);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_KeyboardDownHandler);
//Functions
function facecursor(event):void
{
    character_mc.rotation = (180 * Math.atan2(mouseY - character_mc.y,mouseX - character_mc.x))/Math.PI + 90;

}

function fl_KeyboardDownHandler(event:KeyboardEvent):void
{
    trace("Key Code Pressed: " + event.keyCode);
    if (event.keyCode == 38)
    {
        character_mc.y = character_mc.y - 5;
    }
    if (event.keyCode == 40)
    {
        character_mc.y = character_mc.y + 5;
    }
        if (event.keyCode == 39)
    {
        character_mc.x = character_mc.x + 5;
    }
        if (event.keyCode == 37)
    {
        character_mc.x = character_mc.x - 5;
    }

}

I'm new to actionscript, so example code would be helpful.

sentences:
How to directly set a value to an UI Image's alpha channel(not the percentage of rendering) When you write the code bellow, it renders a percentage of an image's predefined alpha value (which you define in unity's inspector - for example if you define the alpha value of an image to 100, the code bellow actually makes it 25, when the scene is being rendered)

_image.GetComponent<CanvasRenderer>.SetAlpha(.25f);

How can i rewrite the code above, to directly set an alpha value? Thanks.

sentences:
Understanding the ModelView Matrix I want to analyze the each component of my 4*4 ModelView Matrix.

I came to know that the starting 3*3 of ModelView Matrix stores rotation.

If i want my object to have no rotation with respect to camera so My ModelView Matrix looks like this

How to change my ModelView Matrix if i want to have NO Translation or Scaling ? Can anyone explain the Maths behind this

sentences:
Unity Rigidbody gets pushed through collider by another rigidbody? I'm setting up the interior of a house in a 2D platformer. Inside the house is an NPC with a box collider and rigidbody attached, and the house is boxed in by four edge colliders. My character also has a collider and rigidbody.

My NPC walks back and forth randomly, but when he pushes my character into the wall, the force of the push takes priority over the house's edge collider and my character gets pushed outside.

Is there any way to give priority to the house's collider somehow, without removing the NPC's rigidbody?

sentences:
Alternative to JSF for browser-based 4X game I intend to make browser based MMO game. Something from Master of Orion genre but with more accent on command ship operations.

I've done some tests and research and turns out that indeed, for dictionary type data (like technology tree nodes, inventory items, mission definitions) the XML files seem best approach. But there will be whole lot of them and they are inter-dependent so performance-wise there is no option to load them on each HTTP request.

I want system where application starts, loads definitions to dictionaries from XML and keeps it in memory for the whole time the application works. Application awaits requests and responds them with XHTML using the dictionary data from array/collection kept in memory. All the other data like players' data, alliances' data etc. comes normally from relational DB. I think this model would put much less strain on DB and whole application would be much less resource-hungry.

So PHP I know and used is not an option, right?. Is my only option some Java server technology like JSF? I coded in Java previously, but it was Java SE and it didn't make good impression on me. So are there alternatives? If not what specific Java server technology would be most suited?

sentences:
OpenGL Fragment Shader simulate LCD slow response time I have a very simple OpenGL view rendering 2 triangles with a single texture applied. The minimum setup for rendering a 2d game.

What i do is redraw the texture for every frame and easily get 60fps.

I would like to add an effect simulating LCD slow response by outputting pixels that are the average between the current and the previous frame.

The pseudo code of fragment shader would look like this

varying vec2 v_TexCoordinate;
uniform sampler2D u_Texture;

void main() {
    gl_FragColor   = (texture2D(u_Texture, v_TexCoordinate) + PIXEL_PREVIOUS_FRAME) / 2;
    PIXEL_PREVIOUS_FRAME = gl_FragColor;
};

Well, i think shaders can't keep a persistent variable like PIXEL_PREVIOUS_FRAME, then i really don't know how to tackle this problem.

Any suggestion?

sentences:
How can I structure my ASCII terrain object? So I have this object which represents a simple ASCII "overworld". Note the code is broken, but it's for demonstration purposes...

var TerrainObj = {
    w: { name: 'water', glyph: 'w' },
    g: { name: 'ground', glyph: 'g' },

    terrain: [[w, w, w, w],
              [w, g, g, w],
              [w, g, w, w],
              [g, g, w, w]],

    generate_display: function(terrain) {
        ...
        Code that returns an array the same as terrain but containing
        the glyphs from the objects in terrain
        ...
    }
}

So as you can see, the object contains the data for different types of terrain cell, the overworld itself, and a method to covert the terrain info into an array of glyphs for printing to the screen. But of course the problem with this code is that in the terrain array, there will be an reference error to each object.

I want to be able to write out the terrain array without using more than a one-letter name, because presumably to get this to work I'd have to do something like

terrain: function() {
    var map = [[this.w, this.w, this.w, ...],
               ...
               ...
               ];
}

So is there a nicer way I can produce my "semantic" terrain layer that references objects but without me having to write lengthy references to them in my array declaration?

sentences:
Smooth decelerate, interpolation? I have two points A and B.  I want to perform a smooth deceleration from A stopping at B over time t.  The only thing I managed to do so far was a lerp, which isn't right of course because it's unnatural.  I also tried multiplying the velocity by some factor (0.9 or similar), but then I don't know how to choose the factor such that the end point B is reached (or as near to it as some epsilon value seems reasonable).

Does anyone have something relatively simple that I could use?  I can read C++ and C# code.

sentences:
Are there any branching dialogue editors (preferably for Mac)? I'm currently looking for a branching dialogue editor that allows me to prepare all the dialogue, export it into an XML format that then can be parsed by Unity 3D.

The only editor I found until now is Chat Mapper, which is Win only. Is there something similar for Mac?

Even if there is nothing for the Mac – what would be other alternatives to Chat Mapper, if any?

sentences:
UV Packing Roadblock I noticed that when I was unwrapping and packing UV's in 3DS Max, that about 75% of the map was taken up by a bunch of repetitive small parts, because of their unique shape and inability to fit somewhere else. It's because of this that they turned out the way they did:

This is a problem for me because now I don't have much texture space for the important UV islands such as the sides of the gun handle. The circled part in viewport mode is the section that matches with parts like the one circled in UV editing, and there are a lot of them. I need them to be scaled proportionately because they are already small enough that they'll barely have any pixels on them anyways. Perhaps ovelrap them and use the same part of the texture for every other, or every third ridge? At this point I'm not sure. Any suggestions are appreciated. Thanks!

sentences:
Overdrawn pixels vs many polygons, which affects performance the most? I know that having overdrawn pixels is not desirable as well as having many polygons since they can decrease performance.
Often when I model I have an option to decrease the number of polygons by having disconnected polygons over. For example, considering this:
Let's imagine it has more turns that are not visible in this picture.
I can decrease the number of polygons by having a pathway as a single disconnected face:

As a result I would have less poly-count, but the bottom geometry would be overdrawn in many areas.

Or I can model this as a single continuous mesh. As a result I would have more poly-count, but no overdraw:

I very often have similar situations and I'm wondering which of these would be more performance efficient and cause less performance decrease on mobile devices?

sentences:
Trouble with UV Mapping Blender => Unity 3 For some reason I am getting nasty grey edges around the edges of rendered 3D models that are not present in Blender.

I seem to be able to solve the problem by reducing the size of the UV coordinates within the part of the texture that is to be mapped. But this means that:

I am wasting valuable texture space
Loss of accuracy in drawn UV maps

Could I be doing something wrong, perhaps a setting in Unity that needs changing? I have watched countless tutorials which demonstrate Blender default generated UV coordinates with "Texture Paint" which are perfectly aligned in Unity.

Here is an illustration of the problem:

Left: approximately 15 pixels of margin on each side of UV coordinates
Right: Approximately 3 pixels of margin on each side of UV coordinates

Note: Texture image resolution is 1024x1024

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:
Click event doesn't trigger when clicking I've made some buttons on my screen to navigate to other scenes of my Unity project but the Click(string command) method doesn't trigger. I've placed a breakpoint on the bold line in code below, but the pointer never hits that point.

public class GameNavigation : MonoBehaviour
{
    public void Click(string command)
    {
        switch (command)
        {
            case "again":
                Application.LoadLevel(Application.loadedLevel);
                break;

            case "go_to_menu":
                Application.LoadLevel("Navigation");
                break;

            default:
                break;
        }
    }
}

Here are also some screenshots form my Unity project.

What did I wrong?

Note one: I've made also this code that is called after the scene ends. the parameter command is always an empty string.

public void RestartLevel(string command)
{
    switch (command)
    {
        case "again":
            Application.LoadLevel(Application.loadedLevel);
            break;

        case "go_to_menu":
            Application.LoadLevel("Navigation");
            break;

        default:
            break;
    }
}

If I place it in a comment, I get this error:

  'Player' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?

Note two: I also use a mouse down event for when the player must shoot.

Update one: by a comment below I've made this code:

public Button btnAgain;
public Button btnMenu;

public void Start()
{
    btnAgain.onClick.AddListener(() => {
        Application.LoadLevel(Application.loadedLevel);
    });

    btnMenu.onClick.AddListener(() => {
        Application.LoadLevel("Navigation");
    });
}

The Start() method is always called, no problems with it. But the Application.LoadLevel(...) code never executes when I click on the methods. However btnMenu and btnAgain aren't null.

Update two: I've upload a zip file on my SharePoint that you can access. Start a game and choose level 01. You navigating to a new scene. On that scene you have on the right below side you have two buttons, these are the buttons that doesn't work. If you can find the problem, please give me the solving of the problem. Other bug fixes are also welcome. 😉

sentences:
Rendering texture buffers to one single texture I am attempting to render multiple font textures onto one single texture,
my issue is that each font texture gets repeated, but i would like to have single instance of that font character.

The characters container seems to be too large for it, but i can't figure out why.

Example of the issue below.

sentences:
Need help with a grab Shader How can I make grab Shader similar to https://docs.unity3d.com/Manual/SL-GrabPass.html in GLSL.

The idea, is that you grab exact pixels from background (ex. from composited renderTarget) and put on rendered object. So it's like 100% transparency, because it always has the pixels right behind. Later if you disort the pixels, can give very cool effects like https://www.shadertoy.com/view/Mdc3Rl.

SO far I have texture of background (plane to renderTarget), and object cube right before it. My vertex shader for cube is gl_Position = WVP * spos; and I have no idea how do the frag shader to copy the pixels from background. Any help appreciated.

sentences:
Shortcut for NodeJS server I am tired of typing  "cd c:\socket\nodejs"
                      "node testserver.js"

Into the command promt..

How do I create a shortcut or bat for it?

sentences:
Adding a Scriptable Object to the Scene Suppose a Scriptable Object e.g. NewWeapon.asset with variables such as name, description, price etc.

I've also added a public GameObject weaponObject; so that I can drag and drop the 3D model related to this weapon.

Since Scriptable Objects cannot be added in a scene, how can I add a GameObject in the scene with an attached script that will draw data from the NewWeapon.asset and display the 3DModel already specified and load up the rest of the variables?

My goal is to create a script Item.cs which will be attached to a GameObject in the scene and then based on the current ScriptableObject load its name, stats and 3Dmodel

sentences:
LWJGL Determining whether or not a polygon is on-screen Not sure whether this is an LWJGL or math question. I want to check whether a shape is on-screen, so that I don't have to render it if it isn't. First of all, is there any simple way to do this that I am overlooking? Like some method or something that I haven't found? I'm going to assume there isn't.

I tried using my trigonometry skills, but it is hard to do this because of how glRotate also distorts the image a little for perspective and realism. Or, is there any way to easily determine if a ray starting from the camera, and going outward in a straight line intersects a shape? (I can probably do it with my math skillz, but is there an easier way?)

By the way, I can easily determine the angle at which the camera is facing around the x and y axis.

EDIT: Or, possibly, I could get the angles of a vector from the camera to the object, and compare those angles to my camera angles. But I have a feeling that the distorts from glRotate and glTranslate would be an issue. I'll try it though.

sentences:
How to make a rigidbody come to rest faster I'm trying to move around a 3D rigidbody in Unity 2018.1.0f2 Personal. I am using a C# script with the basic vector3 and velocity stuff from a YouTube video:

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

public class Player : MonoBehaviour {
    [SerializeField]
    private Rigidbody playerBody;

    private Vector3 inputVector;

    private float xMovement;
    private float zMovement;

    [SerializeField]
    private float playerSpeed;

    private float maxSpeed;

    // Use this for initialization
    void Start () {
        playerBody = GetComponent<Rigidbody>();
        playerSpeed = 1;

    }

    // Update is called once per frame
    void Update () {
        xMovement = Input.GetAxisRaw("Horizontal")* playerSpeed;
        zMovement = Input.GetAxisRaw("Vertical") * playerSpeed;

        inputVector = new Vector3(xMovement, playerBody.velocity.y, zMovement);
        playerBody.velocity = inputVector;
    }
}

It works great with a cube I put it on, except for this: if I move the rigidbody and then stop, it takes a long time for it rotate from go only one of the edges or corners just touching the ground (screenshot of what I mean, another screenshot) to resting flat. How can I make it fall back to stability faster?

sentences:
Why do my trees share the same health? My trees keep on falling at the same time and I am not sure why! I am new to Unity3D javascript.

Here is my script:

#pragma strict

//INTS
var health = 5;
//GAMEOBJECTS
var tree : GameObject;
var log : GameObject;

function Start () {

tree = this.gameObject;

}

function Update () {

if(Input.GetKeyDown(KeyCode.Mouse0) && Player_script.axehave && health >= 1 && Camera_script.tree){
health -= 1;
}

if(health == 0){
tree.GetComponent.<Animation>().Play();
Destroy();
}

}

function Destroy(){

yield WaitForSeconds(2);
Destroy(tree.gameObject);

}

sentences:
How to add lighting to a 2D Tile-based game in JavaFX? I'm making a 2D roguelike tile-based game with Java and JavaFX.  I'm currently working on adding lighting and darkness to the dungeon, but whenever I try running it, it takes a very long time to load, and it eventually gives an out of memory error.

Here is Lighting.java:

package sample;

import static sample.World.worlds;

public class Lighting {
    public static void calculateLighting(int wn, int skyLighting) {
        Block[][][] world = worlds[wn];
        for (int z = 0; z < worlds[Player.cw][0][0].length; z++) {
            for (int y = 0; y < worlds[Player.cw][0].length; y++) {
                for (int x = 0; x < worlds[Player.cw].length; x++) {
                    Block b = world[x][y][z];
                    b.light = skyLighting;
                    if (b.embID == 1) { //test if a block has a torch attached to it
                        for (int distance = 0; distance <= 15; distance++) {
                            for (int x1 = x - distance; x1 < x + distance; x1++) {
                                for (int y1 = y - distance; y1 < y + distance; y1++) {
                                    for (int z1 = 0; z1 < worlds[Player.cw][0][0].length; z1++) {
                                        try {
                                            world[x1][y1][z1].light += 1;
                                        } catch (ArrayIndexOutOfBoundsException ignored) {

                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        for (int z = 0; z < worlds[Player.cw][0][0].length; z++) {
            for (int y = 0; y < worlds[Player.cw][0].length; y++) {
                for (int x = 0; x < worlds[Player.cw].length; x++) {
                    Block b = world[x][y][z];
                    if (b.light > 15) {
                        b.light = 15;

                        //If your number X falls between A and B, and you would like Y to fall between C and D, you can apply the following linear transform:
                        //Y = (X-A)/(B-A) * (D-C) + C
                        //https://stackoverflow.com/questions/345187/math-mapping-numbers
                        //(worlds[Player.cw][x][y][z].light-0)/(15-0) * (1-0.5) + 0.5
                        if (b.sprite != null) {
                            b.sprite = ImgManip.darken(b.sprite, (worlds[Player.cw][x][y][z].light) / (15d) * (1 - 0.5) + 0.5);
                        }
                    }
                }
            }
        }
    }
}

What this is doing is that it first finds torches in the world, and then increases the brightness of each block around it, depending on how far away the torch is.  Then, it takes each block's sprite and makes it darker with the darken() method.  This is what is causing it to take so long. When I just comment that out, it performs just fine, but the lighting isn't there.

Here is the darken() method:

public static Image darken(Image image, double amount) {
        PixelReader pixelReader = image.getPixelReader();
        WritableImage writableImage =
                new WritableImage(
                        (int)image.getWidth(),
                        (int)image.getHeight());
        PixelWriter pixelWriter = writableImage.getPixelWriter();

        for(int y=0; y<image.getHeight(); y++){
            for(int x=0; x<image.getWidth(); x++){
                Color color = pixelReader.getColor(x, y);

                color = color.deriveColor(0,-amount/2d,-amount,0);

                pixelWriter.setColor(x, y, color);
            }
        }
        return writableImage;
    }
```

sentences:
Understanding unknown mesh data structure I have a large number of old mesh files in a custom, undocumented binary format. I have managed to parse almost everything but am left with one group of structures, described below, that I don't understand. I hope an experienced graphics programmer can explain what is happening.

Here are the structures concerned:

// These types are defined below. We're trying to understand what
// these three arrays are used to achieve.
VertexRef vertexRefs[];
Triangle triangles[];
Unknown unknowns[];

struct VertexRef {
    // Earlier in the file, there are several vertex buffers.
    // The file can contain multiple meshes, either as components
    // of a larger mesh, or as multiple LODs.
    // This value _group_ picks out one of these buffers.
    uint8_t group;
    // Index into the vertex buffer picked out by _group_.
    uint16_t vertexIndex;
};

struct TriangleVertex {
    // Index into the array _vertexRefs_
    uint16_t vertexRef;
    // Index into the array _unknowns_
    uint16_t unknownIndex;
};

struct Triangle {
    TriangleVertex verts[3];
};

struct Unknown {
    // Index into the array _vertexRefs_
    uint16_t vertexRef1;
    // Index into the array _triangles_
    uint16_t triangleIndex1;
    // Another index into the array _vertexRefs_
    uint16_t vertexRef2;
    // triangleIndex2 can be 0xffff, while triangleIndex1 never is
    uint16_t triangleIndex2;
};

The array of VertexRef is straightforward. It picks vertices, potentially from multiple meshes, to form a composite mesh.

The array of Triangle is formed by vertices from the array of VertexRef. Each vertex is also associated with an Unknown.

I am out of my depth in understanding what Unknown is doing. Member triangleIndex2 sometimes being 0xffff (or invalid, or nonexistent?) might indicate it is a leaf node of a tree? Perhaps the structure comprising the arrays vertexRefs, triangles and unknowns is some kind of collision detection tree?

I'd be very grateful for any hints. Please ask questions if I've failed to be clear enough about something.

Edit: In answer to a request in comments, I am attaching a sample file and code to load it. The code should run on any likely system. The file is a mesh of a pair of boots. The file is hosted at uploadfiles.io: https://ufile.io/w66mh

sentences: Using NumPy arrays as 2D mathematical vectors? Right now I'm using lists as position, velocity, and acceleration vectors in my game.  Is that a better option than using NumPy's arrays (not the standard library's) as vectors (with float data types)?  I'm frequently adding vectors and changing their values directly, then placing the values in these vectors into a Pygame Rect.  The vector is used for position (because Rects can't hold floats, so we can't go "between" pixels), and the Rect is used for rendering (because Pygame will only take in Rects for rendering positions).

sentences:
TBN matrix for normal and parallax mapping I'd like to refer to this question because I didn't completely answer to my problem.

I've implemented normal and parallax mapping but because of some assumptions I have to use two different TBN matrices for each effect.

One of the most important assumptions is that I have deferred renderer with normals encoding and light calculations in view space.

This implies that I have to convert data from normal maps (which are in tangent space) to view space using below TBN matrix:

mat3 NormalMatrix = transpose(inverse(mat3(ModelViewMatrix)));
vec3 T = normalize(NormalMatrix * Tangent);
vec3 N = normalize(NormalMatrix * Normal);
vec3 B = normalize(NormalMatrix * Bitangent);

mat3 TBN = mat3(T, B, N);

On the other hand parallax mapping required view direction vector in tangent space. To compute that I use camera position and fragment position (in world space) multiplied by following TBN matrix to move this vectors from world space to tangent space:

T = normalize(mat3(ModelMatrix) * Tangent);
N = normalize(mat3(ModelMatrix) * Normal);
B = normalize(mat3(ModelMatrix) * Bitangent);

mat3 TBN = transpose(mat3(T, B, N));

I'm looking for a way to optimize that. Is it possible to make it better?

sentences:
How to seamlessly handle multiple procedural 2D levels in Unity3D? I have a dungeon generating algorithm, but I would like to generate X levels, which are all connected somehow.

I have a few approaches, but all of them has problems and questions, and I wonder how i.e. Diablo II handles them so seamlessly.

1. Approach: Upon leaving a level, generate the next one on the fly.

This would be the easiest, but would result in a relatively long loading screen everytime the player enters a new level.
So generating the levels should be at the beginning of a new game, thus the next level will just have to be loaded, which is much faster. In theory not even a loading screen is necessary.

2. Approach: Generate every level at the beginning of a new game and store them.

Okay, now levels just have to be loaded, which could be done under half a second. No loading screen is necessary, maybe just a fade out-fade in.
How do I store them?

Make custom files (i.e. scriptable objects) for them, or is there a simpler way?

3. Approach: Generate and load every level at the beginning.

Zero loading time, because everything is already generated and loaded into the tilemap.
But how do I guarantee that levels don't collide, and the player can't see level Y from level X if there are lots of levels?
And wouldn't it affect the performance? Because everything is loaded all the time. Yes, renderers, rigidbodies, scripts, etc can be turned off, improving the performance a lot... but still... this seems wrong.

What is the best way to solve this problem?

sentences:
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 be sure that a target goal in a match 3 game level will not be impossible? This is clearly not a coding problem but the logical one. I am starting to learn how to make a match 3 game.
but there is a question rising in my mind.

when i will set goal to complete the level, how will i know the goal is achievable ?

suppose in a level where i have to collect 5 Red, 12 blue, 9 green objects by matching the same(like farm heros).
how would i decide how much moves i need to set to make this goal achievable. i mean it should be challenging but  not be impossible.

since the objects spawn in a random whats the surety that there will be enough number of gem in the game to not make impossible.

is there some logical explanation for this, or i just have to test and look out how many moves it takes to achieve the goal.

Is there an algorithm which generates the gems according to target set, or they are generated in random manner?

To be more clear towards my question i am going to take an example of King.com's farm-heros-saga .

In level 9 the target is to collect number of four types of objects 26,26,14,5 respectively. and the maximum number of moves are 22.

now this goal may be achievable and challenging(i mean you can achieve it in two or three trials ) but not impossible.

Now my question is what made those guys so sure that it will not be impossible, how they decided that 22 move will be enough and challenging.

well.. they could have put the maximum number of moves to 5 or 6. but that would surely make it impossible to clear the level. so how they decided to keep move 22 or this.

Are they using static pattern to generate and spawn objects, or ratio of collectible gems is fixed(i.e in total gameplay there will be X%,Y%,Z%,M% of gems respectively ), or there is some other way.
I just need some hint what should i look for..

sentences:
How do I detect multiple sprite collisions when there are >10 sprites? I making a small program to animate the astar algorithm. If you look at the image, there are lots of yellow cars moving around. Those can collide at any moment, could be just one or all of them could just stupidly crash into each other.

How do I detect all of those collisions? How do I find out which specific car has crash into which other car?

I understand that pygame has collision function, but it only detects one collision at a time and I'd have to specify which sprites.

Right now I am just trying to iterate through each sprite to see if there is collision:

for car1 in carlist:
    for car2 in carlist:
        collide(car1, car2);

This can't be the proper way to do it, if the car list goes to a huge number, a double loop will be too slow.

sentences:
How come serverless functions are so much more expensive than a VPS hosting my PHP API? I'm working on an online turn-based game. I will have a server, but it will be used strictly for storing match data and relaying it to the match's participants (or spectators). For simplicity, no game logic will be processed in the server and the participants will be the ones to decide the legality of the enemy's moves etc.

My backend cloud knowledge is limited. I can work fine with PHP and MySQL, so I can technically make a PHP API, host it, and have the players poll it via HTTP requests every few seconds to get updates on the match (or upload commands). The PHP script will always open a MySQL connection, do one or two small queries and return a tiny bit of JSON-formatted data. To summarize, I believe that a single request would take at most 2 seconds to complete, and the output will be usually less than 100 bytes.

Given this fact, I figured I could perhaps try one of those serverless cloud functions services, like Azure's. It sounds just perfect for my kind of scenario.

For this project, I am estimating at most 100 users playing a match at any given time. And given the way the game is designed, they should probably poll data every two seconds. So 100 * 30 * 24 * 60 * 30 = ~130M executions per month. With Azure, that could be around $540 monthly just to support about 100 players.

This got me thinking, what if I just host the PHP API and MySQL database in a normal VPS, like GoDaddy's perhaps? Their cheapest option is about $50 a month. They don't meter the number of requests, concurrent users or bandwidth used (my usage is pretty low anyway, less than 15GB monthly).

So my question is, how come a 'serverless function' service is massively more expensive than just using a normal VPS to host my PHP API? Is there a catch that I may be missing?

Naturally it's all about testing - I should try both of them, but I figured someone has been through this already, or perhaps there is something obvious I am missing.

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:
Properly rendering transparent areas of textures I'm rendering a tree that contains branch meshes with partially transparent textures.

If I render it with AlphaTestEffect and set the ReferenceAlpha to something low, I'll get this.

I want to render the tree with BasicEffect, however, this is the result I get. BlendState is set to NonPremultiplied.

I am not even sure what I am looking at. It looks like the transparent area of the closest branch is covering up the one behind it (but not the trunk of the tree). If I set the DepthState to DepthRead, then all the branches are drawn out of order.

What exactly is the problem here?

sentences:
What should the Z coordinate be after transformed by the projection matrix? I'm working on an OpenGL 1.x implementation for the Sega Dreamcast. Because the Dreamcast didn't have any hardware T&L the entire vertex transformation pipeline has to be done in software.

What also has to be done in software is clipping to the near-Z plane as failure to clip results in the polygon being dropped entirely from rendering by the hardware.

I'm having some trouble getting the transform -> clip -> perspective divide process working correctly and basically I can sum up the problem as follows:

I transform polygon vertices by the modelview and projection matrices
I clip each polygon against the W = 0.000001 plane
This results in new vertices on the near plane with a W of 0.000001, but a Z which is twice the near plane distance
At perspective divide vertex.z /= vertex.w results in an extreme value because we're dividing a Z value (e.g. 0.2) by 0.000001

Something seems very wrong here. The projection matrix is being generated in the same way as described in the glFrustum docs.

So my question is, if I have a coordinate on the near plane, should its Z value be zero after transform by the projection matrix or should it be the near-z distance, or something else?

After clipping polygons to the W = 0.000001 plane, should the generated Z coordinates be -0.000001?

Update:

Here is the projection matrix as calculated by: gluPerspective(45.0f, 640.0f / 480.0f, 0.44f, 100.0f);

1.810660 0.000000 0.000000 0.000000
0.000000 2.414213 0.000000 0.000000
0.000000 0.000000 -1.008839 -0.883889
0.000000 0.000000 -1.000000 0.000000

Does this look correct? It's the value in the right-hand column I'm not sure about...

sentences:
How to store the updated score in mysql databse from android? I want to store the updated score in mysql database. So, what i do for that?

private void updateScore() {
    if (winner.equalsIgnoreCase("You")) {
        tally = 100 - computer.getId();
        MainActivity.userScore += tally;
        if (MainActivity.userScore >= MainActivity.maxEnd) {
            MainActivity.   stat++;
            MainActivity.totTurn++;
            MainActivity.userScore = 0;
            MainActivity.computerScore = 0;

        }

    }
    if (winner.equalsIgnoreCase("computer")) {
        tally = 100 - buddy.getId();
        MainActivity.computerScore += tally;
        if (MainActivity.computerScore >= MainActivity.maxEnd) {

            MainActivity.totTurn++;
            MainActivity.userScore = 0;
            MainActivity.computerScore = 0;
        }
    }
    MainActivity.saveConfig();
}

sentences:
How to calculate a perfect Super Mario speedrun? I've dedicated my time to Super Mario lately, so eventually I ended up watching some speedruns.

I thought to myself, how could one calculate the perfect set of minimal in-game movement?

I considered comparing the time needed to pass to a certain point, for example if there are two paths to take. If I wanted to write a program to measure and calculate those values for me, how would I proceed?

sentences:
How to Detect Mesh Segmentation? I have a mesh like this (it's all a single mesh):

How I can figure out that the one floating piece is completely disconnected from the rest of the mesh?

sentences:
Unwanted begincontact callbacks at high velocity I'm having some issues with jump detection due to begincontact. I have a player entity made of 2 bodies, and it looks something like this:

Note how the circle below (a body connected via a revolute joint) is not quite as wide as the rectangle. This means that when the player is up against a wall, there is no contact between the circle and the wall.

However, if the player collides with a wall at high velocity, begincontact registers a contact between the circle and the wall. Is there any way around this?

sentences:
Slow uniform array in shader causing FPS drop I'm trying to use an uniform array of matrices in my compute shader. However, it's really slow. I've narrowed it down to this lines of code:

uniform mat4 someMatrixArray[64];
...
vec4 result = vec4(0);
for (int i = 0; i < 2048; i++) {
    result += someMatrixArray[i%64][0] * 0.01;
}

When not accessing someMatrixArray I get 700+ fps. When accessing it, I have 10 fps. Anybody has an idea what could cause this? Could it be a driver issue?

I already tried to unroll the loops (via #pragma optionNV (unroll all)) but that didn't help. I'm using a GTX670 with the latest drivers on windows 7.

Edit:

The generated assembly for the inner loop is:

MAD.F R0.xyz, c[196], {0.0099999998, 0, 0, 0}.x, R0;

sentences:
What's causing this stutter when framerate fluctuates? I'm working on a class responsible for arm sway in an fps engine, and am having an issue with a stutter that appears to be related to fluctuating framerate. However I have also noticed it when locking the framerate, but to a much lesser almost unnoticeable degree (so maybe NOT related to framerate variance). As far as I can tell I have everything setup the way it should be to account for framerate fluctuations, but apparently I've missed something?? Curious if I've made a glaring oversight that might jump out at someone. I have uploaded a video where you can see exactly what it is I'm talking about.
Any ideas? update() is where the magic happens.
#include "glm/gtx/string_cast.hpp"
#include "vel/App.h"
#include "vel/helpers/functions.h"

#include "ArmSwayController.h"

ArmSwayController::ArmSwayController() :
    input(vel::App::get().getInputState()),
    swayXYPos(glm::vec2(0.0f, 0.0f)),
    maxSwayDistance(0.1f),
    swaySpeed(0.0f),
    mouseBufferSize(44),
    firstMouseInput(true),
    currentMousePosition(glm::vec2(0.0f, 0.0f)),
    lastMousePosition(glm::vec2(0.0f, 0.0f)),
    mouseDelta(glm::vec2(0.0f, 0.0f)),
{};

glm::vec2 ArmSwayController::getAverageMouse()
{
    glm::vec2 out;

    for (auto& x : this->mouseXBuffer)
    {
        out.x += x;
    }
    out.x = out.x / this->mouseXBuffer.size();

    for (auto& y : this->mouseYBuffer)
    {
        out.y += y;
    }
    out.y = out.y / this->mouseYBuffer.size();

    return out;
}

void ArmSwayController::bufferMouse(glm::vec2 in)
{
    if (this->mouseXBuffer.size() == this->mouseBufferSize)
        this->mouseXBuffer.pop_front();
    if (this->mouseYBuffer.size() == this->mouseBufferSize)
        this->mouseYBuffer.pop_front();

    this->mouseXBuffer.push_back(in.x);
    this->mouseYBuffer.push_back(in.y);
}

void ArmSwayController::bufferMouseXSpeed(float in)
{
    if (this->mouseXSpeedBuffer.size() == this->mouseBufferSize)
        this->mouseXSpeedBuffer.pop_front();

    this->mouseXSpeedBuffer.push_back(in);
}

void ArmSwayController::bufferMouseYSpeed(float in)
{
    if (this->mouseYSpeedBuffer.size() == this->mouseBufferSize)
        this->mouseYSpeedBuffer.pop_front();

    this->mouseYSpeedBuffer.push_back(in);
}

void ArmSwayController::updateMouseDelta()
{
    this->currentMousePosition.x = this->input.mouseXPos;
    this->currentMousePosition.y = this->input.mouseYPos;

    if (this->firstMouseInput)
    {
        this->lastMousePosition = this->currentMousePosition;
        this->firstMouseInput = false;
    }

    this->mouseDelta.x = this->currentMousePosition.x - this->lastMousePosition.x;
    this->mouseDelta.y = this->lastMousePosition.y - this->currentMousePosition.y;

    this->lastMousePosition = this->currentMousePosition;
}

glm::vec2 ArmSwayController::update(float dt) // called once per tick
{
    this->updateMouseDelta();

    this->bufferMouse(this->mouseDelta);
    this->swaySpeed = 0.00000625f / dt;

    glm::vec2 vecToAdd = vel::helpers::functions::invertVec2(this->getAverageMouse());

    // X
    this->bufferMouseXSpeed(vecToAdd.x);

    float pullBackAmountX = this->mouseXSpeedBuffer.size() > 1 ? this->mouseXSpeedBuffer[this->mouseXSpeedBuffer.size() - 2] : this->mouseXSpeedBuffer[0];
    pullBackAmountX = pullBackAmountX < 0 ? fabs(pullBackAmountX) : (-1.0f * pullBackAmountX);

    this->swayXYPos.x += ((vecToAdd.x + pullBackAmountX) * this->swaySpeed);

    // Y
    this->bufferMouseYSpeed(vecToAdd.y);

    float pullBackAmountY = this->mouseYSpeedBuffer.size() > 1 ? this->mouseYSpeedBuffer[this->mouseYSpeedBuffer.size() - 2] : this->mouseYSpeedBuffer[0];
    pullBackAmountY = pullBackAmountY < 0 ? fabs(pullBackAmountY) : (-1.0f * pullBackAmountY);

    this->swayXYPos.y += ((vecToAdd.y + pullBackAmountY) * this->swaySpeed);

    return this->swayXYPos;
}

sentences:
Why does my sprite animation sometimes runs faster? I don't know why each time I call the Update_Animation function, my sprite animation runs faster. Is it caused by gameTime? How to fix it?

Here's the relevant code:

class Character
{
    // <SNIP>

    public void Update_Animation(Point sheetSize, TimeSpan frameInterval, GameTime gameTime)
    {
        if (nextFrame >= frameInterval)
        {
            currentFrame.X++;

            if (currentFrame.X >= sheetSize.X)
            {
                currentFrame.X = 0;
                currentFrame.Y++;
            }

            if (currentFrame.Y >= sheetSize.Y)
                currentFrame.Y = 0;

            nextFrame = TimeSpan.Zero;
        }
        else
        {
            nextFrame += gameTime.ElapsedGameTime;
        }
    }

    // <SNIP>

    private void UpdateMovement(KeyboardState aCurrentKeyboardState, GameTime gameTime)
    {
        if (mCurrentState == State.Walking)
        {
            action = "stand";
            Update_Animation(sheetSize_Stand, frameInterval_Stand, gameTime);

            mSpeed = Vector2.Zero;
            mDirection = Vector2.Zero;

            if (aCurrentKeyboardState.IsKeyDown(Keys.Left) && !aCurrentKeyboardState.IsKeyDown(Keys.Right))
            {
                action = "run";
                effect = SpriteEffects.None;

                mSpeed.X = CHARACTER_SPEED;
                mDirection.X = MOVE_LEFT;

                Update_Animation(sheetSize_Run, frameInterval_Run, gameTime);
            }
            else if (aCurrentKeyboardState.IsKeyDown(Keys.Right) && !aCurrentKeyboardState.IsKeyDown(Keys.Left))
            {
                action = "run";
                effect = SpriteEffects.FlipHorizontally;

                mSpeed.X = CHARACTER_SPEED;
                mDirection.X = MOVE_RIGHT;

                Update_Animation(sheetSize_Run, frameInterval_Run, gameTime);
            }

            if (aCurrentKeyboardState.IsKeyDown(Keys.Z) && mPreviousKeyboardState.IsKeyUp(Keys.Z))
            {
                mCurrentState = State.Hitting;
            }
        }

        if (mCurrentState == State.Hitting)
        {
            action = "hit";

            Update_Animation(sheetSize_Hit, frameInterval_Hit, gameTime);
            mCurrentState = State.Walking;
        }
    }

    // <SNIP>
}

sentences:
Does the Maya FBX 2013.3 exporter write tangent and binormal data? I'm making an XNA game at the moment and I'm trying to knock out my bump map shader right now. However when I compile the game crashes at the mesh.Draw() line and tells me TANGENT0 is missing. Apparently the FBX 2012 exporter didn't export tangent and binormal data properly, and I'm still having this problem despite installing the most recent exporter for Maya 2012.

For the record the plug-in readme tells me that bug is fixed and I am checking 'Tangents and Binormals' when I export.

What am I doing wrong?

sentences:
Problem building a color grading map I am trying to build a default color grading map into a 1024x32 RenderTarget.
Here is my shader code:

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Position = float4(input.Position,1);

    output.TexCoord = input.TexCoord;
    return output;
}

float4 PixelShaderFunction(float2 TexCoord : TEXCOORD0) : COLOR0
{
    float temp = TexCoord.r*1024;
    float4 result = (float4)0;
    result.a = 1;
    result.r = (temp%32)/32;
    result.g = TexCoord.g;
    result.b = TexCoord.r;

    return result;
}

I'm using Catalin Zima's quad renderer to render the color grading map AND to render the contents of the texture back onto the screen. Here is the copy shader:

texture Texture;
sampler targetSampler = sampler_state
{
    Texture = (Texture);
    AddressU = CLAMP;
    AddressV = CLAMP;
    MagFilter = POINT;
    MinFilter = POINT;
    Mipfilter = POINT;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Position = float4(input.Position,1);

    output.TexCoord = input.TexCoord + halfPixel;
    return output;
}

float4 PixelShaderFunction(float2 TexCoord : TEXCOORD0) : COLOR0
{
    return tex2D(targetSampler, TexCoord);
}

When I take the resulting image into the Photoshop, the bottom right pixel of the texture always equals (247, 247, 255), even though top left color equals zero.

What could be the problem? I checked the quad renderer class - it is recording texture coordinates exactly 0,1 into the quad's corners. I am aligning pixels to texels with the halfPixel and using point texture sampling. Somewhy the V component of texture coordinates never reaches one. I have no clue where the problem can be. As I plan to use this texture for color grading, the accuracy is crucial.

UPDATE: So far I can only achieve the needed result with the folowing shader code:

float4 PixelShaderFunction(float2 TexCoord : TEXCOORD0) : COLOR0
{

    float temp = TexCoord.r*1024;
    float4 result = (float4)0;
    result.a = 1;
    float m = (temp%32);
    result.r = m/32+0.035f*m/32;
    result.g = TexCoord.g+0.035f*TexCoord.g;
    result.b = TexCoord.r;

    return result;
}

Which is very wierd.

UPDATE 2: Ok, I had to modulo divide over 33 instead of 32, but I still have to correct the V coordinate.

float4 PixelShaderFunction(float2 TexCoord : TEXCOORD0) : COLOR0
{
    float temp = TexCoord.r*1024;
    float4 result = (float4)0;
    result.a = 1;
    float m = (temp%33);
    result.r = m/33;//+0.035f*m/33;
    result.g = TexCoord.g+0.035f*TexCoord.g;
    result.b = TexCoord.r;

    return result;
}

sentences:
How to set a global alpha-blending value in Direct3D 9? Is it possible to set an alpha value globally in Direct3D 9, which modulates the pixel alpha values of every subsequent draw?

I would like to let a whole scene fade in/out. I know that for example ID3DXSprite::Draw() lets you set this in the Color parameter, but I'm using pixel shaders to draw 2D circles and rectangles as well, so I would have to pass the alpha value to each of them.

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:
Where should I put the code for objects interactions? I'm working on a 2D puzzle game, and one of the features is the ability to push crates so you can climb on top of them to get to a destination.

I've tried many things to get this to work but none of them succeed.

My main problem is that I don't know where to put my code. For example, I don't want to handle the movement of the crate in the player class because that wouldn't be neat, the same way some people say something along the lines of "If you're making chess, the rules of the pawn and knight shouldn't be in the rules of the queen".

If anyone has an answer or could provide a pseudo-code explanation it would be appreciated.

sentences:
How to get the complete width of SKSpriteNode which has many child nodes I have a Sprite node with many 6 child nodes. Each are placed one after another in X-axis.
I want to know the complete with of the Sksprite node.

SKSpriteNode *array = [SKSpriteNode node];

[array addChild:box1];
[array addChild:box2];
[array addChild:box3];
[array addChild:box4];
[array addChild:box5];
[array addChild:box6];

array.size.width dosen't get me any size, so how should i get the complete width of array with child nodes..

If i add multiple sprites to NSMutalbleArray then how can i get the width of the complete array.

sentences:
How to make a fun slot machine? We currently have a simple slot machine in our online virtual world game.

You set the amount you want to bet (in virtual money) and pull the lever, and depending on the 3 figures (there's only one line) you get a reward, a free round, lose some more money, or most of the time, get nothing at all. You can instantly pull the lever again. The previous bet will be maintained.

At the moment this slot machine isn't really fun to play. The chances of winning something are pretty low (though when you win, you can win a lot). When you pull the lever, the result is determined (though not shown) immediately, so there's also no way influence the outcome of the wheels.

How can it be made more fun?

sentences:
Is it worth to implement game mechanics/rules separately from the main code? Not sure whether it fits the scope of this community, or should go to Stackoverflow instead.

Let's suppose that I want my game be easily extendable in its core, i.e. I want that a lot of people, even without decent programming knowledge, would be able to not only tweak existing rules, but even add totally new game mechanics into it. I'm not good programmer myself, but I'm ready to learn, I'm just need some directions and assurance it can be done.

What I've thought about is whether it's possible/feasible to somehow implement game mechanics separately from the main utility code? I mean, for tabletop games we have those rulebooks which don't contain actual algorithms of all actions, but rather describe some protocols and limits, referencing context of each such item heavily. Is it possible to do something similar for PC game, like, describe all the rules in some very high-level, easily readable (and changeable) by a human programming language, which is then "consumed" and parsed by the utility code into a working instance of game mechanics?

That really seems like I need to write my own language and a compiler for it )) Which I won't be able to do, of course. But may be there is an easier approach to the problem?

FYI: my language of choice for the utility code will be Python 3.x

sentences:
Unreal Engine 4: Help with multithreading and accessing render target images I am working on an application where I need to record images seen from an in-game camera. Initially, the method was to set up a TextureRenderTargetResource from the in-game capture component, and subsequently call ReadPixels to access the frame data and save that data as an image. (code flow below)

bool saveImage() {
  USceneCaptureComponent2D* capture = getCaptureComponent(camera_type, true);
  FTextureRenderTargetResource* RenderResource = capture->TextureTarget->GameThread_GetRenderTargetResource();
  width = capture->TextureTarget->GetSurfaceWidth();
  height = capture->TextureTarget->GetSurfaceHeight();

  TArray<FColor> imageColor;
  imageColor.AddUninitialized(width * height);
  RenderResource->ReadPixels(bmp);
}

This approach was slowing the game thread down significantly, so I am trying to move the screenshot saving procedure to its own thread. My approach now is inspired by the article at https://wiki.unrealengine.com/Multi-Threading:_How_to_Create_Threads_in_UE4. I access the *AActor object from this separate thread and subsequently its camera, and then I call the saveImage() function from the thread: but this is resulting in a crash with no additional information (just "UE4Editor.exe has triggered an exception") at the call to ReadPixels(). So essentially, calling saveImage() and thereby ReadPixels() from the game thread works perfectly, and it fails when I call it from a different thread. Am I doing something wrong in my process here?

sentences:
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:
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:
SDL_image & OpenGL Problem i've been following tutorials online to load textures using SDL and display them on a opengl quad. but ive been getting weird results that no one else on the internet seems to be getting...

so when i render the texture in opengl i get something like this.
http://www.kiddiescissors.com/after.png

when the original .bmp file is this:
http://www.kiddiescissors.com/before.bmp

ive tried other images too, so its not that this particular image is corrupt. it seems like my rgb channels are all jumbled or something. im pulling my hair out at this point.

heres the relevant code from my init() function

if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) {
    return 1;
}
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_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);

SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 32, SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER | SDL_OPENGL);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(50, (GLfloat)WINDOW_WIDTH/WINDOW_HEIGHT, 1, 50);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_DEPTH_TEST);
glEnable(GL_MULTISAMPLE);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);

heres the code that is called when my main player object (the one with which this sprite is associated) is initialized

texture = 0;
SDL_Surface* surface = IMG_Load("i.bmp");
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, surface->w, surface->h, 0, GL_RGB, GL_UNSIGNED_BYTE, surface->pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
SDL_FreeSurface(surface);

and then heres the relevant code from my display function

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glColor4f(1, 1, 1, 1);
    glPushMatrix();
        glBindTexture(GL_TEXTURE_2D, texture);
        glTranslatef(getCenter().x, getCenter().y, 0);
        glRotatef(getAngle()*(180/M_PI), 0, 0, 1);
        glTranslatef(-getCenter().x, -getCenter().y, 0);
        glBegin(GL_QUADS);
            glTexCoord2f(0, 0);
            glVertex3f(getTopLeft().x, getTopLeft().y, 0);
            glTexCoord2f(0, 1);
            glVertex3f(getTopLeft().x, getTopLeft().y + size.y, 0);
            glTexCoord2f(1, 1);
            glVertex3f(getTopLeft().x + size.x, getTopLeft().y + size.y, 0);
            glTexCoord2f(1, 0);
            glVertex3f(getTopLeft().x + size.x, getTopLeft().y, 0);
        glEnd();
    glPopMatrix();

let me know if i left out anything important... or if you need more info from me.

thanks a ton,

-Dylan

sentences:
How to get a point to the left/right of a vector I have a position vector of a point in space and a quaternion for it's rotation. What i'm trying to calculate is a point too the left and a point to the right.

I have the position and rotation(quaternion) of the red dot. What I want is to get the position of the green dots. I have a float value for the distance I want these points to be.

With only the position and rotation is it possible to get a unit direction vector pointing left/right which I can multiply by my float value?

Edit: I also know the original direction vector.

sentences:
resolving per pixel collision issue In space invader, I'm doing bullet to barrier intersection using rect to rect, then I'm testing the first bullet's impact pixel, if it's green I blast a circle, if it's black, it continues travelling. now there is a situation that there is part of the barrier that won't be checked for intersection, as shown in the image, the first intersection test will fail, because the first pixel is black...

How would I resolve that issue ?

sentences:
When an object is launched off-screen, is there any way to know if it's coming back? In this scene, the object becomes invisible and then comes back

In this scene, the object becomes invisible but does not come back

Is there any way I can tell if an object will come back when it becomes invisible?
Edit:
Thank you to S. Tarık Çetin for the solution
     private void Update()
     {
         if (isInvisible)
             if (IsNotComingBack())
                 OnInvisible?.Invoke();
     }

     private void OnBecameInvisible()
     {
         isInvisible = true;
     }

     private bool IsNotComingBack()
     {
         var pos = _cam.WorldToViewportPoint(_rb.position);
         var extents = _cam.WorldToViewportPoint(_spriteRenderer.sprite.bounds.extents);
         var isNotComingBack = pos.x + extents.x < 1 || pos.x - extents.x > 0;
         return isNotComingBack;
     }

sentences:
How to update the monsters in my MMO server using Node.js and Socket.IO Currently I am creating an MMO using Node.js and Socket.IO.

The node server needs to handle connections for players, and also use a loop to update all monsters positions in my game and let them attack players in range.

For the loop I read that you can use process.nextTick or use a child process, which option would be the best choice? What are the advantages/disadvantages of using each?

Also, how many times per second should I run this loop for the monsters?

sentences:
Integrating Unity physics with Entitas I've used Entitas a bit and it appeared to me as a great way of creating clean, modular code. I've seen few examples of games created with this framework, and most of them were puzzles, TD's, simple RPG's, etc. Those made me come to think, that ECS like that is not suitable for games making big use of Unity built-in physics engine. Rigidbody in this case is part of View layer, but it would affect for example "position" component, so we can't say they are really separated. Unity Physics also works at it's own pace, so there is not really a chance for independent Component-System based simulation.

Are there any generally accepted solutions, or if I don't wan't to write my own physics engine, I should give up Entitas?

sentences:
Way to avoid excessively bright objects with specular lighting? I have a typical Phong shading with specular light. I have all the parameters tuned so to give appropriate highlights from a point light source. Now the problem I have is a new object that has a large flat surface which tends to face directly towards the light source (which is a bit offset from the camera). It also has a normal map which is primarily in one direction (steel panels). This results in a pure white object.

I have a lot of options to try and work around the problem, but I was wondering if this is a common issue and perhaps there is a clean workaround. The various options I see (and am trying) are:

Reduce specular map intensity. There are two problems here, first when the object is not facing the camera it looks dull, second on a low quality setting I don't use specular maps.
Clamp the range of specular light. This of course limits the highlights for the entire scene. It also limits the highlights when the object isn't facing the camera.
Put a per-object specular light limit. This at least doesn't affect the whole scene, but does dullen this object when not facing the camera.

sentences:
How can I give the player the impression of speed? Possible Duplicate:
  Effects to make a speeding spaceship look faster

I am currently developing a racing game akin to F-Zero in that the race is held at very fast speeds. The player is therefore placed in a 3rd person view.

Graphically, I'm thinking of using motion blur and lowering the camera angle when the ship is going faster to give the player the impression of speed. This from the fact that the closer you are to the ground, the more you percieve speed.

This question has intersting answers, but don't really apply because the effect needs to be progressive and constant, not like a boost effect.

I was wondering if these techniques are viable, and if any other techniques exist?

sentences:
How to do 1.5x scaling for pixel art where only one dimension has to scale? I'm working on a point and click adventure game where the top third of the screen is a 16:3 single piece background with sprites on top. The width has to be edge to edge. It can't be cropped because the screen doesn't move.

The bottom of the screen will be one where you can interact with objects. Think Papers, Please. It can be any dimension, it can be 16:6 for 16:9 screens and 16:9 for 4:3(16:12). The objects on the bottom screen can be scaled imperfectly so say a notebook that is 64x64 on 720p can be 2x scaled to 128x128 on 1080p. It will only be compared to other 2x scaled objects so it won't look out of place.

Shades of green indicate areas where light green can be stretched to fill, orange indicates the area that I don't know what to do with. Black can't be scaled 2x because it wouldn't fit and it can't be cropped.

Am I still forced to make 2 different sets of art if I want it to look right?

sentences:
Rigged through Blender (Rigify) and Errors in Unity I am working on a Unity scene and as the 3D model is missing the bones, I ended up going to Blender for the rigging.

For that, I followed the procedure that Unity suggests by using the add-on Rigify. I was also following this tutorial, which was really helpful.

After exporting from Blender (in .fbx) and importing it on Unity, I went through the configurations (as @vcard suggested here)

In the "Rig" section, I pressed the button "Configure" (to configure the Avatar Definitions) and came across an error "Character is not in T pose".

I solved this one quite fast by accessing the menu "Pose" (in the Inspector) and then "Enforce T Pose".

After that, back in the scene, I came across the following error on the Inspector:

  Invalid Avatar Rig Configuration: Missing or invalid transform:
  Required human bone 'Head' not found.

I went straight to the configurations and decided to add the specific bones to the Head that appeared on the inspector (in the Avatar Definitions configurator). With that, I came found out that the problem is really the organization where there were placed by Rigify.

Any guidance is appreciated.

sentences:
How do you accommodate newbies while still creating depth in the design of light/dark systems for MUDs (or other text-based games)? I've been pondering a redesign of our MUD's light/dark system. Our current system accommodates new players by simply not saddling them with being unable to see should they happen to wander outside of a populated area at night. I would like, in redesigning the light system, to stop making accommodations. I take the accommodations as a sign the system is less than ideal for everyone.

I appreciate the way visual games are afforded to handle this; we can generally see the area around our character, and in some cases can obtain bonuses to the radius within which we can see. I haven't been able to come up with a good way to port this concept to a MUD, at least without a concept of relative position that our current code-base just doesn't support. If we didn't have multiple player sub-classes based on the darkness they can create, I would be inclined to make it so all players can see the room they're in, get rid of torches, and be done with it.

I've spent a few hours searching and have failed to dig up compelling discussions on the topic. I'm sure they exist--I find it hard to believe the topic hasn't been aired somewhere. I'm curious how others would approach a light/dark system needing no exceptions for newbies, while still being able to accommodate classes, such as the undead, which need darkness (indeed, part of their power comes from their ability to keep others from seeing.)

sentences:
Simple switch to instanced draws causes consistent, but incorrect, results I have dumbed the following code down to "stupid simple" for DirectX and still cannot get any cooperation:

g_d3dContext->OMSetRenderTargets(1, g_renderTargetWorld->ColorRenderTargetView.GetAddressOf(), g_depthStencilView.Get());
g_d3dContext->OMSetDepthStencilState(g_States->DepthNone(), 0);
g_d3dContext->OMSetBlendState(g_States->AlphaBlend(), NULL, 0xffffffff);
g_d3dContext->IASetVertexBuffers(0, 2, m_segments->GetLineVertexBuffers(), s_strides, s_offsets);
g_d3dContext->IASetIndexBuffer(m_segments->GetLineIndexBuffer(), DXGI_FORMAT_R16_UINT, 0);
g_d3dContext->IASetInputLayout(s_IL_Polyline.Get());
g_d3dContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ);
g_d3dContext->VSSetShader(g_World_Polyline_VS_Segment.Get(), NULL, 0);
g_d3dContext->GSSetShader(g_World_Polyline_GS_Segment.Get(), NULL, 0);
g_d3dContext->PSSetShader(g_World_Polyline_PS_Segment.Get(), NULL, 0);
g_d3dContext->RSSetState(g_States->CullNone());
//g_d3dContext->DrawIndexed(4 * m_segments->LineCount, 0, 0);
g_d3dContext->DrawIndexedInstanced(4, m_segments->LineCount, 0, 0, 0);
g_d3dContext->GSSetShader(nullptr, NULL, 0);

-The DrawIndexed call draws all segments
-The DrawIndexedInstanced call draws only the first segment

Creating a second instance of this class, DrawIndexedInstanced draws only the first segment of each compound line. Although it is correctly created, filled, and set, I am not even using the per-instance data yet. Manually manipulating the StartIndexOffset parameter causes different, only-one, line segments to be drawn.

PIX is worthless, as usual, but, at least, allowed me to inspect the buffer contents. All of the data is correct and in-place but I cannot get the "gosh-darn" thing to work. After 18 hours of searching and getting nowhere, I'm livid, giving up, and going to bed.

Please help me explain why (4*2) != 4[0:1]

Edit:
This, stupidly, works:

for (char i = 0; i < m_segments->LineCount; i++)
{
    g_d3dContext->DrawIndexedInstanced(4, 1, i * 4, 0, i * 4);
}

So, now: (4[0] + 4[1]) == (4*2) != 4[0:1]

Verifying, again, that the data is all where it needs to be.. Stumped. It's got to be something so obvious, that it's not. I feel like I'm already over-kill on setting every possible state parameter there is and if I comment any one line, it would switch from doesn't work to shouldn't work and I can't debug it.

sentences:
Unity 5 - Input Field - How to confirm password entry with ENTER only and not a click/loss of focus I have an input field password box, currently the password is 'submitted' either by clicking Enter or by clicking elsewhere on the screen.
This seems to be the designed way, as it states this in the documentation (https://docs.unity3d.com/Manual/script-InputField.html) -

"A UnityEvent that is invoked when the user finishes editing the text content either by submitting or by clicking somewhere that removes the focus from the Input Field."

As I have other buttons on the same screen that users can click on, I would like it so mouse clicks are not counted as an invoke.

Is this possible?

Many thanks in advance

sentences:
How to draw a BitmapFont every user click Im starting learning the libgdx framework and I want to "clone" some games.
I know how to handle touch with

if(Gdx.input.isTouched())

But how do I render new fonts every time user clicks on the screen? (Like the Numbers going up and desapearing)
I tried creating new objects, and made a array to store all "y" positions, but both no success.

sentences:
THREE.ShaderMaterial cannot perform antialiasing I created a ShaderMaterial to draw a box in three.js using the following key code:

//magnetic orientation
let magnetMaterial = new THREE.ShaderMaterial({
    uniforms: { orientation: { value: new THREE.Vector3(1) } },
    vertexShader: `varying vec3 vPos;
void main() {
    vPos = position;
    gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);
}`,
    //https://stackoverflow.com/questions/15688232/check-which-side-of-a-plane-points-are-on
    fragmentShader: `#extension GL_OES_standard_derivatives : enable
varying vec3 vPos;
uniform vec3 orientation;
void main() {
    float a = dot(orientation, vPos);
    gl_FragColor = vec4(step(a, 0.), 0, step(0., a), 1.0);
}`});

See also online Demo. Even if I set WebGLRenderer.antialias to true, there's a heavy aliasing if the box is not axis-aligned.

I found Point Sampled AA  and How do I implement anti-aliasing in OpenGL?, but I didn't how to do?

In addition, the custom shader cannot work with the light if any. In order to make custom color work with the built-in effect (light). I want to try post-processing via EffectComposer.

Can anyone help me out?

Related:

Add scene lights to custom vertex/fragment shaders and shader materials?
the last shader I added point lights
threejs Adding lighting to ShaderMaterial
How do you “combine”a ShaderMaterial and LambertMaterial?

sentences:
Is it wrong to be creating new objects in Update()? I'm using Unity and sometimes I'm using th new keyword in Update, like new Vector3() etc...

I wonder is this causes memory leak? I mean in every frame a new Vector3 is created. If this is the way of working that means there are thousands of Vectors created in memory. Is it true or do I think wrong?

sentences:
Set Position of multiple bodies I have a character composed of five bodies which are tied together by a lot of joints. On of them is the overall chassis, to which all forces and impulses are applied to move the whole Character.

All in all that works very fine, except one thing: I need to set the Position of the Character so that it get Beamed from one place to the other in one single frame.

Unfortunately I cannot get this to work. I tried the following code, without any success…

playerbodies.forEach(function (bd) {
    bd.SetLinearVelocity(new b2.Vec2());
    var t = bd.GetTransform();
    t.p.x -= 10;
    bd.SetTransform(t, bd.GetAngle());
});

How can I make that happen?

sentences:
SDL_Init segfault on linux I am using Manjaro linux and SDL 2. However, when I build the application in debug mode and use gdb or something like qtcreator with gdb, to debug it, it gives me a segfault, when the function SDL_Init() is called.
The code I am trying this with:
#include <iostream>
#include <SDL2/SDL.h>

int main(int argc, char *argv[])
{
    if (SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        printf("SDL Init error: %s", SDL_GetError());
        return -1;
    }

    SDL_Window *window = SDL_CreateWindow("window", 10, 120, 800, 640, 0);

    SDL_Renderer *ren = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

    bool running = true;
    while (running)
    {
        SDL_Event e;
        if (SDL_PollEvent(&e) != 0)
        {
            switch(e.type)
            {
                case(SDL_QUIT): running = false;
            }
        }

        SDL_RenderClear(ren);

        SDL_RenderPresent(ren);
    }

    SDL_DestroyRenderer(ren);
    SDL_DestroyWindow(window);
    SDL_Quit();
    return 0;
}

I then recompiled SDL for debugging and went into the source, to find out this function in SDL.c is actually the cause:
        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
            if (SDL_VideoInit(NULL) < 0) {             <- this here is causing the segfault
                return (-1);
            }
        }

I don't know what to even do with this. None of the SDL versions work anymore. I've tried installing older ones, compiling from source.

sentences:
Unity - Part of the sprite is covered in shadow I have a sprite with Transparent/Cutout/Diffuse shader. Recieving shadows is turned on in SpriteRenderer. The light is a pointlight and I am using deffered rendering path.

However when I am above or right of the object, it is covered in shadow. When I am below or left of the object everything seem to work as it should.If I place the light in the center of the sprite, only a part of the sprite is lit up, the other part is covered in shadow.

Maybe it is something with normals? I need to get rid of the self shading effect.

Shader

Shader "Transparent/Cutout/Diffuse" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}

SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 200

CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff

sampler2D _MainTex;
fixed4 _Color;

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 "Transparent/Cutout/VertexLit"
}

I found out what unity uses for lambert lightning. Since I use deffered rendering so unity should use function with _PrePass prefix. But the implementation of the actual lighning is implemented somewhere else and is it used for all materials, that looks like dead end.

Custom Lightning

inline fixed4 LightingSLambert (SurfaceOutput s, fixed3 lightDir, fixed atten)
{
fixed diff = max (0, dot (s.Normal, lightDir));

fixed4 c;
c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
c.a = s.Alpha;
return c;
}

inline fixed4 LightingSLambert_PrePass (SurfaceOutput s, half4 light)
{
fixed4 c;
c.rgb = s.Albedo * light.rgb;
c.a = s.Alpha;
return c;
}

inline half4 LightingSLambert_DirLightmap (SurfaceOutput s, fixed4 color, fixed4 scale, bool surfFuncWritesNormal)
{
UNITY_DIRBASIS
half3 scalePerBasisVector;
half3 lm = DirLightmapDiffuse (unity_DirBasis, color, scale, s.Normal, surfFuncWritesNormal, scalePerBasisVector);
return half4(lm, 0);
}

sentences:
How can I change the highlighted color of a Unity button when it's clicked? I was playing around with buttons in Unity, and I wanted to see if I could change a button's highlighted color every time I clicked on it. I added a script in the same GameObject as a button component, and I had a changeColor function attached to the component's OnClick(). The function was in a ButtonScript class written like this:

public class ButtonScript : MonoBehaviour {
    public Button button;

    public void changeColor() {
        Debug.Log ("Changing highlighed color");
        int r = Random.Range (0, 255);
        int g = Random.Range (0, 255);
        int b = Random.Range (0, 255);
        Color currentColor = button.colors.highlightedColor;
        currentColor.r = r;
        currentColor.g = g;
        currentColor.b = b;
    }
}

I couldn't do button.colors.highlightedColor = new Color(r,g,b); because I got a "Consider storing the value in a temporary variable" error. When I tried a test play and clicked the button multiple times, the highlighted color didn't change. How can I make a function that changes a button's highlighted color when it's clicked, if it's possible?

sentences:
Pygame's sprite.collide_circle() missing several frames of head-on collision I've spent hours trying to figure why my collision detection was so crappy, with sprites visibly ovellaping for several frames, when I noticed the culprit could be pygame's detection callback pygame.sprite.collide_circle().

I've stripped down the code and created a simple demo, and results were surprising: collide_circle() still returns False for several frames after its sibling collide_rect() correctly detects a collision and returns True.

Here is the code:

import pygame

RED   = (255,   0,   0)
GREEN = (  0, 255,   0)
BLUE  = (  0,   0, 255)
BLACK = (  0,   0,   0)
WHITE = (255, 255, 255)

SCREEN_SIZE = (800, 600)
FPS = 60
BG_COLOR = BLUE

class Ball(pygame.sprite.Sprite):
    def __init__(self, color=WHITE, radius=10, position=[], velocity=[]):
        super(Ball, self).__init__()

        self.color = color
        self.radius = radius
        self.position = list(position) or [0, 0]
        self.velocity = list(velocity) or [0, 0]
        self.bounds = (screen.get_size()[0] - self.radius,
                       screen.get_size()[1] - self.radius)

        self.image = pygame.Surface(2*[self.radius*2])
        self.rect = self.image.get_rect()
        pygame.draw.circle(self.image, self.color, 2*(self.radius,), self.radius)

    def update(self, dt=1./FPS):
        super(Ball, self).update()

        for i in [0, 1]:
            self.position[i] += self.velocity[i] * dt

            if self.position[i] < self.radius:
                self.position[i] = self.radius
                self.velocity[i] *= -1

            elif self.position[i] > self.bounds[i]:
                self.position[i] = self.bounds[i]
                self.velocity[i] *= -1

        self.rect.center = self.position

pygame.init()

screen = pygame.display.set_mode(SCREEN_SIZE)
clock = pygame.time.Clock()

background = pygame.Surface(screen.get_size())
background.fill(BG_COLOR)
screen.blit(background, (0,0))

balls = pygame.sprite.Group()
balls.add(Ball(color=RED,   radius=100, position=[  0, 300], velocity=[ 100, 0]))
balls.add(Ball(color=GREEN, radius=100, position=[700, 300], velocity=[-100, 0]))

done = False
while not done:
    for event in pygame.event.get():
        if (event.type == pygame.QUIT or
            event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
            done = True

    balls.update()
    if pygame.sprite.collide_rect(*balls):
        collision = pygame.sprite.collide_circle(*balls)
        print collision
        if collision:
            for ball in balls:
                ball.velocity[0] *= -1

    balls.clear(screen, background)
    balls.draw(screen)
    pygame.display.update()
    clock.tick(FPS)

pygame.quit()

And the output:

False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False

That's 17 frames of overlap before collide_circle() realizes that hey, there's a collision there! Even at 60 FPS that's huge.

The balls are almost halfway through each other, and this behavior seems to be velocity independent: if I change the balls' speed or the FPS, the visual result (halfway overlap) remains, but for fewer frames.

So, my question is: is this a pygame bug? Or did I completely misunderstood how detection works?

sentences:
Should a 4x game use one class per planet type? I'm try to make a small 4x game for my own educational purposes.

Currently I have interfaces like IStarSystem which contains a list of IPlanets. My next step was to make classes implementing those interfaces. Is it better to make classes like BarrenPlanet, GasPlanet, et cetera or is it better to make a single Planet class and define the different types in a XML file?

sentences:
What is an alternative to scratch damage to solve combat deadlocking? Scratch damage is a game mechanic whereby any successful attack always does some minimal amount of damage. This is often used in subtractive combat systems, where the defense is subtracted directly from the damage done by an attacker. Therefore, the target will always take some minimal damage.

The downside of such a system, for me at least, is that it's a hack. It takes a simple formula like Damage = Attack - Defense and turns it into a (slightly) more complex one: Damage = max(Attack - Defense, 1).

I also feel that it detracts from a player's skill in developing their character/etc. No matter how many defense bonuses they get, every attack will do some small damage. So why get your defense so high, if it won't mean anything?

Furthermore, this now encourages the use of larger numbers for Hp and damage, so that the scratch damage is truly negligable. After all, if the minimum damage is 1, and you only have 10 Hp, that's still 10% of your health. Even with 20 Hp, that's 5%. And I would rather avoid using larger numbers like that unless it's absolutely necessary.

However, there is one very important upside of scratch damage: it solves the deadlock problem.

Deadlock happens when neither side is able to do damage to the other. If you invest all of your resources into defense, and few into attack, then your character may not take damage, but they won't be able to deal very much either. Thus, you could come upon an encounter where neither side will be able to inflict damage, so battle continues forever. This is especially if you don't have random mechanics like critical hits (which I also hate).

At least with scratch damage, someone will eventually win. It may only be the one with the most Hp or highest number of attacks, but the battle will end.

So I like having a combat system where there will always be an outcome. But I don't like having scratch damage. What are my alternatives?

Alternatives that don't involve rolling random numbers; I want combat to be 100% deterministic. If the same battle is fought, the exact same outcome must happen.

If you want specifics on the gameplay, think in terms of turn-based combat, where battle can be automated (you design your forces, then pit them against others).

sentences:
My sprite walking animation code doesn't work at all This is my first time doing code for a game so I followed some online tutorials.

When I got to the walking and the jumping animation I just can't get it to work whatever I do.

I tried multiple codes but it doesn't work.

My animation code right now:

//animation
if (!place_meeting(x,y+1,Owhitetile))
{
    sprite_index = Scute_character_jump_right;
    image_speed = 0;
    if(sign(vspeed)  < 0) image_index = 0;
}
else
{
    image_speed = 1;
    if(hspeed == 0)
    {
        sprite_index = Scute_character_right;
    }
    else
    {
        sprite_index = Scute_character_walk;
    }
}

All my code so far

//player imput
key_left = keyboard_check (vk_left);
key_right = keyboard_check (vk_right);
key_jump = keyboard_check_pressed (vk_space);

//calculate movement
var move = key_right - key_left;

hspeed = move * walksp;
vspeed = vspeed + grv;

if (place_meeting(x,y+1,Owhitetile)) and (key_jump)
{
    vspeed=-7;
}

//horizontal colision
if (place_meeting(x+hspeed,y,Owhitetile))
{
    while (!place_meeting(x+sign(hspeed),y,Owhitetile))
    {
        x = x + sign(hspeed);
    }
    hspeed = 0;
}
x = x + hspeed;

//vertical colision
if (place_meeting(x,y+vspeed,Owhitetile))
{
    while (!place_meeting(x,y+sign(vspeed),Owhitetile))
    {
        y = y + sign(vspeed);
    }
    vspeed = 0;
}
y = y + vspeed;

//player death
if (place_meeting(x,y+vspeed,Ospikes))
{

   instance_destroy()
   game_restart()

}

//animation

if (!place_meeting(x,y+1,Owhitetile))
{
    sprite_index = Scute_character_jump_right;
    image_speed = 0;
    if(sign(vspeed)  < 0) image_index = 0;
}
else
{
    image_speed = 1;
    if(hspeed == 0)
    {
        sprite_index = Scute_character_right;
    }
    else
    {
        sprite_index = Scute_character_walk;
    }
}

sentences:
Should I package and sell my game on the unity3d asset store? I'm trying to figure out if I should refurbish and refactor a game I and some friends have made. It's released on kongregate and wasn't a super hit but I feel there's a lot of interesting techniques and solutions going on that new or intermediate developers would like to see. The only thing that's holding me back is that I don't know if people are interested in it at all. Would you be interested in buying the source code and assets for this game?

Check it out and you'll see that there's a lot of things happening in the game. If we packaged it and sold it, we would of course tidy it up a bit which would involve more work so I would really appreciate your honest opinion.

We've looked around and haven't found actual released games in the unity3d asset store. Maybe we just didn't look enough though. We're thinking of setting a price tag of between 150 and 200€. What's your opinion on this price?

And in general, what's your opinion on selling assets and source code? Should I be wary of any legal implications (like my customer licensing my stuff and then forbidding me from selling it)?

I posted this over at UnityAnswers as well but I know I rather go here for gamedev questions so I'm hoping other unity devs will drop by here too.

Edit:
Reconsidering after getting some great advice we'll probably rip out the assets only and market those as space stuff or something. We'll then market the assets with the help of some free classes of code showing off some of the examples that were hard for us to do when we were (more) beginners. The unify wiki might benefit from having some of the code that we've done and that isn't all that hard but a bit tedious.

If we actually "finish" the game (it is indeed an asteroids spinoff and was never intended to be anything else, apart from some sandbox modes we've been experimenting with) we'll probably sell it with a decent price tag for an indie game like this.

sentences:
Which toolkit to use for 3D MMO game development? Lately i've been thinking about which path to follow for developing an 3D Online game.
I have googled a lot but i couldnt find a good article that covers both game development and online server & client development in same context.
This question has been in mind for about 2 weeks now.
So.. yesterday i started developing a game from scratch by using
Irrlicht.Net Wrapper to use Socket library of .NET which im already familiar.
But i found out .Net wrapper of Irrlicht is not totally finished yet and still have lacks from the original.
So i lost all my motives :/.

So i thought why not to ask the experts before i run into another dead end...

What Game Engine and Networking Library is best way to go for 3D MMO Development?

Here is some of my early conclusions:
Please let me know the ones im wrong.

C++:

Best Performance for 3D Graphics.
Most Game Engines has native C++ Libraries.
Lacks a Solid Socket Library
.NETC++ Lacks Intellisense Support.

C#:

Intellisense Support
NET Socket Library
Lacks 3D Graphics Performance
Lacks a native solid 3D Game Engine

sentences:
LibGDX: ActorGestureListener after change position I have this code to get pan touch inside an Image and it works fine, but when I uncomment this line

img.setPosition(100, 100);

it doesn't work anymore, why?

Texture tex = new Texture(Gdx.files.internal("square.png"));
        final Image img = new Image(tex);
        //img.setPosition(100, 100);
        img.setSize(157,45);
        img.setColor(0,0,0,1f);

        img.addListener( new ActorGestureListener(){

            @Override
            public void pan(InputEvent event, float x, float y, float deltaX, float deltaY) {
                super.pan(event, x, y, deltaX, deltaY);

                int minX = (int)img.getX();
                int maxX = (int)img.getX()+(int)img.getWidth();
                int minY = (int)img.getY();
                int maxY = (int)img.getY()+(int)img.getHeight();

                if ((x>minX && x<maxX)&&(y>minY && y<maxY)){

                    Utils.print("PAN");
                }
            }
        });

        stage.addActor(img);

sentences:
Why is my button script not working? Okay so i'm new to C# and i made this script. The goal i have in mind is that when the player is on the button and presses a button ( W in this case ) the button is switched from on to off ( or vice versa). The problem i have is that when the character stands on the button and presses W it doesn't always switch its state and i have no idea why. Any info would be appreciated.

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

public class Button : MonoBehaviour {
     public bool Pressed = false;
     Animator Anim;

     // Use this for initialization
     void Start () {
         Anim = GetComponent<Animator> ();
     }

     // Update is called once per frame
     void Update () {
         Anim.SetBool ("Pressed", Pressed);
     }
     void OnTriggerStay2D(Collider2D other){
        if (Input.GetKey(KeyCode.W)){
            if (Pressed){
                Pressed = false;
            } else {
                Pressed = true;
            }
        }
    }
}

sentences:
Making a weapon stay with a first person camera I was looking all over the internet for any information on how to get a gun to stay with a camera as done in FPS games.

I am using OpenGL and GLSL to carry this out. I knew a way of how to do this in earlier OpenGL versions, but I could never figure it out in the newer versions.

The type of camera that I am trying to get is something similar to this

With the view matrix and everything else, I should be able to figure out the movement of the hand and the shooting.

Here is some of the code that I have so far:

//Copyright(c) 2019 Ryan Hall All Rights Reserved
//I do not permit any of this code to be used elsewhere by anyone else except me for commercial purposes.
//The gun has two defining variables: one that actually creates the gun and another that moves it around in object space

weaponOfChoice = glm::translate(weaponOfChoice, glm::vec3(camera.GetPosition().x+ 0.15, camera.GetPosition().y - 0.15, camera.GetPosition().z -0.3));

weaponOfChoice = glm::rotate(gun, angle, glm::vec3(0.0f, 1.0f, 0.0f));

weaponOfChoice = glm::scale(gun, glm::vec3(0.005f, 0.005f, 0.005f));

         glUniformMatrix4fv(glGetUniformLocation(shader.Program, "gun"), 1, GL_FALSE, glm::value_ptr(weaponOfChoice));

I have spent quite some time working on how to fix the code so that it will render the gun correctly and have not been able to find any great sources online that will help solve my problem.

How could I do this?

Do I need an identity matrix as used by me in older versions of OpenGL?

If so, how do I create a mimicking function of glLoadIdentity() that will help me with this problem?

Thanks,

-rjhwinner03

sentences:
What is the actual formula to find the vertices of an animation frame in using a BVH file? I've read this tutorial and tried many formulas to build the skeleton. I am able to build it without the rotations, but those break everything. This, for example, is a simplified code for one of my attempts:

/* Pseudocode using overloaded operators for illustration purposes */
var build_skeleton = function(motion,frame_number){
    positions = [];
    deg_to_rad = Math.PI/180;

    (function travel_tree(node,old_pos){
        pos = [node.offsetX, node.offsetY, node.offsetZ];

        frame = node.frames[frame_number];

        x_rotation = quat_from_axis_angle([1,0,0],frame[2] * deg_ro_rad);
        y_rotation = quat_from_axis_angle([0,1,0],frame[1] * deg_ro_rad);
        z_rotation = quat_from_axis_angle([0,0,1],frame[0] * deg_ro_rad);
        rotation = x_rotation * y_rotation * z_rotation;

        pos = old_pos + apply_quaternion(rotation, pos);

        positions.push(pos);

        node.children.map(function(a){ return travel_tree(a,pos); })
    })(motion.root,[0,0,0]);

    return positions;
};

I've tried many variations of this, switching axes, signals etc. Nothing seems to work. So what is the formula to find the positions of the vertexes of an animation on the BVH format?

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:
Most efficient method to render 1,000s of unique space scenes? I'm an artist with a concept, not the developer, and I'm trying to wrap my head around the approach I should be taking for the following scenario, namely whether to model in Photoshop or 3DS Max.

Say I have a simple animation loop of a rotating planet with a moon orbiting it that I want to play in the background of a game menu screen. Thanks to your help I have some ideas as to how to represent this illusion in 2D. But what if instead I had thousands of different scenes of this nature I wanted to represent in-game, using different planets, moon configurations, orbiting ships, passing asteroids, various backgrounds, etc. I assume that attempting to render these as video files and apply individually as movie texture is out of the question due to hardware and/or storage limitations on mobile devices, and that the scenes would be too complex for spriting.

Would I be best off using a 3D game engine to individually render constituent objects (a rotating planet, an orbiting moon, a drifting debris field) and then place them in front of a static backdrop (a JPEG of a nebula and star field, for example)? I assume for the same reasons as above that you wouldn't actually pre-render these objects, but instead send instructions to the game engine to draw a sphere, map a couple of textures to it, give it rotational parameters, etc.? Is this basically how it works? What about for the non-simple shapes like asteroids, ships, etc., can you also send a model parameter?

Keeping in mind that these scenes will be backgrounds only and non-interactive, am I on the right track?

sentences:
Udp VS Tcp connection for a platformer multiplayer Tcp is connection based so it's really good for chat or login or anything that needs reliability. Udp should be used for lots of small packets like position packets... The problem is that in a game like what I'm doing right now (terraria like), I can't decide what to use and how to use it properly. I though about using both at the same time, but can't find a way to ensure the udp "connection" will work.

If I were to choose UDP, is there a way I could make a "connection" out of it? to rely on it for login or chat messages?

And if I were to use TCP, would there be a way to speed it up?

More info : I'm doing this in C#.NET with XNA (I know it's no longer developped but I like it :P).
I would also like to use Serialized objects (.Net BinaryFormatter), but it uses streams, and stream are only available in TCP... which makes it more attractive...

Thanks a lot!

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:
Box2D - Proper way to simulate player's body and feet I'm new to LibGDX and Box2D, and I'm trying to create my player's body but got some issues.

I've created the ground as a ChainShape, and my player as a Rectangle. I want to attach a fixture for its feet, so I tried adding an EdgeShape but - correct me if I'm wrong- it seems that an EdgeShape cannot collide with a ChainShape.

Is there a proper way to create the player's feet? Should I change my ground from ChainShape to Rectangles or should I use some other shape for the feet?

Edit:
Following DMGregory's advice, I've made some progress.
Since my print statements won't be of much help, I'll post this link with a very detailed explanation:
https://stackoverflow.com/questions/7459208/distinguish-between-collision-surface-orientations-in-box2d

And some background reading here:
https://www.iforce2d.net/b2dtut/collision-anatomy

sentences:
How to implement specific custom events in an Event Condition Action (ECA) game system? A while ago I implemented a simple event-condition-action system for my game trying to emulate the Warcaft 3 trigger system (in a small scale, of course):

So far, it works fine, but there is something I have not been able to implement yet. It is the specific events or conditioned events (I don't know if there is a proper name for them). Following the example of the picture, a set of actions are performed if that event is triggered and matches the condition specified PLUS another condition within the event.

Every time I have worked with event systems, events (understanding them as event types) are non-mutable strings, ints, enums or any type of unique ids that allow subscription/mapping/etc. so someone else is notified. The way the system of the picture works clashes with what I know, as the event type can be "edited". What I mean is that, from my point of view, it seems there are two type of events in the example: "A unit dies" and "A unit owned by player 12 dies". But I'm almost sure it's not how it works.

Do systems like this one keep the same "constant event structure" as I conceive it and have an inner condition layer checking for that specific event? Do they work in a completely different way that I'm unaware? How, then?

sentences:
Coding style about collisions with geometry Let's say I'm writing 3D Pacman.  I have "Dot" objects throughout my maze, that are structured as follows in the Inspector:

Dot (GameObject)
- Sphere w/Collider

When I run into the sphere trigger, I can trivially say:

"Get me your parent and check if it's a Dot"

However, I hate baking in the knowledge that some spheres have parents that are Dot objects.  If the trigger were on the Dot itself that problem would solve itself, as I could just call GetComponent().

What's a good programmatic style approach to finding out what logical Game Object actually owns the geometry you've collided with?  I could add a Tag of "Dot" to the sphere but that's just a level of confirmation, I still would have to walk up to it's parent and check.

sentences:
AI surrounding algorithm suggestions I am building up a simulation where predator groups (tribes) try to hunt other agents in the simulation (whom also are clustered in groups).

Now I got to a point where members of a group follow their leader and wait for any sort of commands (currently passed as strings and vector that they need to move towards).
Anyway the idea is to implement some interesting surrounding behaviour just like predators hunt in group they surround their prey.I shall attach a picture for better explanation:

The green circles are the agents that predators are hunting. The red circle is the leader of the predator group and the black dots are other predators. The sort of behaviours I am looking for should be similar to shown in the picture where on the right side of the picture the predators are surround the pack of green agents as instructed so by the leader of the predator pack.

What I was thinking initially was find the leftmost agent in the green pack and the right most in green agents pack and make members of the predator group move towards them.However at this point I shall mention that predators have a fixed field of view so it may not see all of the pack at first.

So I am wondering if anybody came across something like so or have any good ideas how to go about producing this sort of behaviour.

sentences:
Why do my particles appear darker the farther I get from them? I've created the following material:

I've set up a particle system that places that material around like a cloud:

Up close, I'm getting the result I expect:

But if I go far enough, it looks like this:

Why do these dark areas appear and why are they more pronounced as I look at them from farther and farther away?

I know I can make this go away by increasing environment lighting or making the material more emissive. Do I have more options beyond these two?

sentences:
Verb+Noun Parsers and Old School Visual Novels Hi
I'm working on a simple old school visual novel engine in Lua. Basically I have most of the code set up besides one important feature. The Text Parser.

Lets get into how words are generally structured.
In the screenshot I input the command "my wish is for you to die"

--How would a human understand this?

my = noun/object

wish = verb

is = connective_equator similar to =

for = connective_object (for all objects of ..)

you = noun/object

to = connective_action similar to do

die = verb

--the computer can then parse this and understand it like this (pseudo example)

my = user

you = get_current_label()

you = "Lost Coatl"

wish = user_command

user_command = for all_objects of "Lost Coatl" do die() end

execute user_command()

What other ways do videogames use text parsers, what would be the simplest way for a newbie coder such as myself?

sentences:
Releasing a game without really having an officially registered company I'm thinking of releasing my iOS game without formally registering a company at all.  I'm not sure I even want to create a company.

ITunes wants to know the copyright holder of my title. I have 2 questions regarding this:

1) Can I use my (already decided upon if will exist) company name and just register it later (if the need arises)?

2) Or should I just use my NAME as the copyright holder, regardless if I plan to formally register the company later or not?

sentences:
What are the possible options for AI path-finding etc when the world is "partitionned"? If you anticipate a large persistent game world, and you don't want to end up with some game server crashing due to overload, then you have to design from the ground up a game world that is partitioned in chunks. This is in particular true if you want to run your game servers in the cloud, where each individual VM is relatively week, and memory and CPU are at a premium.

I think the biggest challenge here is that the player receives all the parts around the location of the avatar, but mobs/monsters are normally located in the server itself, and can only directly access the data about the part of the world that the server own. So how can we make the AI behave realistically in that context?

It can send queries to the other servers that own the neighboring parts, but that sounds rather network intensive and latency prone.

It would probably be more performant for each mob AI to be spread over the neighboring parts, and proactively send the relevant info to the part that contains the actual mob atm. That would also reduce the stress in a mob crossing a border between two parts, and therefore "switching server".

Have you heard of any AI design that solves those issues? Some kind of distributed AI brain? Maybe some kind of "agent" community working together through message passing?

sentences:
Has google increased apk limit from 50mb to 149? I recently seen Angry Birds GO has apk size of 149 on google play, https://play.google.com/store/apps/details?id=com.rovio.angrybirdsgo&hl=en

Yet google says apk size limit is 50 mb.So my question is,has google increased apk size limit from 50 mb?

sentences:
Quadtree terrain splitting - I don't get it Most of the papers i've read base their terrain in some form or another on a quadtree. See this at page 38:

http://www.slideshare.net/repii/terrain-rendering-in-frostbite-using-procedural-shader-splatting-presentation?from=ss_embed

Doesn't the first point contradict the bottom two? How can you have a fixed 33x33 vertex grid per leaf yet talk about adaptive division in a quad tree? The terminology is confusing and i'd appreciate any clarity on this!

Here are my assumptions:
Re-placing the patches everytime the quadtree changes would be a hit wouldn't it?

Quadtree starting at terrain bounds.

Iterate down to observer location.

Constrained version (no more than 1 level difference between neighbours)

Frustum cull.

Place terrain patch in each resulting leaf, where the scale differs but the resolution is always 33x33.

sentences:
Pointy top hexagonal A* pathfinding I'm trying to create a game with a hex based map with the points at the top. I have most of it working, however the path finding is being a little awkward. The heuristic I'm using is called Euclidean I believe and is like so:

var dx:Number = destinationNode.c - node.c;
var dy:Number = destinationNode.r - node.r;

return Math.sqrt((dx * dx) + (dy * dy));

Node is the node the unit is currently on, c is the node's column number and r is its row number. I'm using these as a simpler x and y coords. I'm trying to limit the unit to 3 hex moves in one round, so initially I thought it'd be as simple as IF returned heuristic < 3 unit can move to that hex, however it's not working out quite like that.

As you can see in the pic above, the bottom right selected hex with the "1 + 9 = 3.162277" is moveable to in 3 moves, however the hex with "9 + 1 = 3.162277" on the far right would need 4 moves to reach it. Can anyone offer any advice on how to make this work?

EDIT: My problem was being caused because I was using a Cartesian coordinate system and was just staggering every other Y coord. Fixed this by making the Y axis go down at a 60 degree angle. Thanks to amitp for the links that showed me what I was doing wrong.

sentences:
Monogame Move objects while having a moving 2D camera I am writing my first game. In this game, I have a heroEntity object, which has fields:

float X {get; set;}
float Y {get; set;}
Monogame.Extended.Camera2D Camera {get; set;}

Since I have some background, I use Camera.Move() instead of moving my heroEntity object (which I put at the center of the Camera.BoundingRectangle after each frame)

Now, I also a List<BulletEntity> Bullets (those bullets also have X and Y properties) and they should also move independently of the heroEntity.Camera object. When I simply implement movement of the camera and bullets independently, there is an impression that my bullets are kind of shaking.

How can I fix that?

sentences:
Quick sprite contouring solutions? I want to be able to quickly outline sprites(mainly with black, but other colours too) without doing it manually, as pictured. What would be a good program/solution to do so?

Edit: I don't want it to happen at runtime, I just want to have the second version and I can scrap the first.

sentences:
Volume raycaster problems HLSL I can't seem to get my volume raycaster to work properly. I've been poking around changing things for days trying to get it to display my volume correctly but I seem only to get distorted mutations of it.

What I tried to do was a 1-pass renderer because the 2-pass one I made wasn't good enough for my purposes. I'm using C# XNA and the renderer wont have to handle transparency so it only has to get in and fetch the first color it bumps into.

How it should look:

How it looks:

float4 OnePassPS(OnePassVSOutput input, float2 pixelCoord : VPOS) : COLOR0 {

float3 rayDir = normalize(mul(float3(((pixelCoord / WindowSize) * 2) - 1.0, -FocalLength), ModelView));

float4 pos = float4(RayOrigin + (rayDir * (input.pos.z / input.pos.w)), 0);
float3 Step = rayDir * StepSize;

float4 color = float4(0, 0, 0, 0);
for(int i = 0; i < Iterations; i++)
{
    color = tex3Dlod(VolumeS, pos);

    if(color.a > 0)
        break;

    pos.xyz += Step;
}
return color; }

sentences:
Track first time leveling up Broad question, but I'm looking for some better ideas.

Currently I have a Player class and booleans for hasSeenLevel2, hasSeenLevel3, etc. When I give a player exp I call a checkLevel method that checks to see if they level up.

checkLevel(){
    if(totalExp > 100){
         level = 2;
         if(!hasSeenLevel2){
             display("You gained level 2");
             hasSeenLevel2 = true;
         }
    }

}

this works, but is incredibly tedious to setup and inefficient.

What better ways are there to organize player levels and exp?

sentences:
Navigate UI with Dpad from Xbox controller on Mac [Unity]? So, according to some documentation I found, the Xbox controller on Mac does not return Dpad presses as vertical/horizontal axes:

As you can see, the Dpad is only recognized as buttons 5, 6, 7, and 8, and not as horizontal/vertical axes. For my character's movement, I just created code that returns 1 or -1 for axis depending on the button pressed. It works perfectly fine. But then I found another problem: UI navigation.

I can't navigate my menus with the Dpad on Mac because the the EventSystem is expecting navigation via horizontal/vertical axes, which the Dpad is not providing.

Is there any way I can turn these Dpad button presses into real horizontal/vertical axes in Unity's Input system? Or is there something else I can do to make UI navigation happen on a Mac, with the Dpad?

sentences:
How can I switch between cinemachine free look cameras by script? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;

public class CamerasManager : MonoBehaviour
{
    public CinemachineFreeLook[] freeLookCameras;
    public float timeBeforeSwitching;

    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(SwitchCameras(timeBeforeSwitching));
    }

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

    }

    IEnumerator SwitchCameras(float TimeBeforeSwitching)
    {
        yield return new WaitForSeconds(TimeBeforeSwitching);

        for(int i = 0; i < freeLookCameras.Length; i++)
        {
            freeLookCameras[i].en
        }
    }
}

If I have two or more cameras I want that after X seconds start switching between all the cameras in the array by disabling/enable the cameras. disable the first enable the second then disable the second enable the third and so on.

sentences:
How to convert from frag position to UV coordinates when my viewport doesn't cover the screen? So, I'm implementing SSAO as part of my rendering pipeline using OpenGL/GLSL. It works pretty well when I have a camera that takes up the entire screen. However, when my camera is smaller than the full screen size, the SSAO texture doesn't get sampled correctly. Here is the relevant GLSL shader code:
// Convert from clip-space
vec2 fragCoords = (fragPos.xy/ fragPos.w); // fragPos is MVP * worldPosition
vec2 screenCoords = fragCoords * 0.5 + 0.5; // Convert from [-1, 1] to [0, 1] to sample UV coordinates

// Sample texture
float ssaoFactor = texture2D(ssaoTexture, screenCoords).r;

I know that there is some funkiness going on with the viewport, but the fixes that I've tried haven't worked. My first thought was to scale fragCoords by normalized size of my viewport (e.g. vec2(0.5, 0.5) for a viewport with half of the width and height of the screen), but that just produced a very strange result. Any thoughts?

sentences:
Rendering detailed martian terrain for an RTS I am trying to develop a RTS game that has:

Various planets
Each planet topology could vary between chock full of craters, to smooth hills and mountains planets
In sum each "biome" should be unique-ish (try to reusable textures/objects)

I'd like to achieve an appearance similar to Mars Battle, with its usual terrain with craters and rocks, smoothly transitioning to giant features like this detailed crater:

What I've already know/tried in my tests of terrain:

Unity terrain - it does the job for the small gravel and rocks but for example the finest detail of ridges on the crater edges is not achievable. The amount of mesh detail is not enough, makes blurry.
2D tilesets - I have experimented in the past with 2D tilesets and read some articles about how Starcraft II uses some hacks to give the impression of relief while only being a 2D image, but still this is so seamless!
2D tilesets for terrain, meshes for crater - could be a mix? In that case my doubts are the seamlessless between terrain and crater mesh. And also how can there be constructable buildings inside the crater if is a mesh?

How can I achieve something like this?

sentences:
Examples of interesting implementations of character stats? I've got this BBG going ( http://ninjawars.net ), and the character stats currently are simplistic.  I'm looking to add a few stats to the current 1/2 (strength and maximum hitpoints, essentially).
I've come up with: (strength (unchanged), speed, stamina, and some others that are somewhat interesting wildcard stats).
However, I'm not satisfied with how boring the effects of some of these stats are, because they're very linear.  Better stat, better effects of the stat, but the stats don't interact with each-other, there's no Rock-Paper-Scissors interaction, having more is always better all the time.

So what I'd really like is to see examples of interesting character stats or effects of stats?

Examples that I can think of off hand:

Call of Cthulu's Insanity stat (things get really weird/chaotic if you start losing sanity)

White Wolf stats, to a certain extent (the stats themselves have some basic effects, and all skills effectiveness base themselves off of stats as well)

What are some other ways people have used stats to check out?

sentences:
Prevent oversteering catastrophe in racing games When playing GTA III on Android I noticed something that has been annoying me in almost every racing game I've played (maybe except Mario Kart): Driving straight ahead is easy, but curves are really hard. When I switch lanes or pass somebody, the car starts swiveling back and forth, and any attempt to correct it makes it only worse. The only thing I can do is to hit the brakes. I think this is some kind of oversteering.

What makes it so irritating is that it never happens to me in real life (thank god :-)), so 90% of the games with vehicles inside feel unreal to me (despite probably having really good physics engines). I've talked to a couple of people about this, and it seems either you 'get' racing games, or you don't. With a lot of practice, I did manage to get semi-good at some games (e.g. from the Need for Speed series), by driving very cautiously, braking a lot (and usually getting a cramp in my fingers).

What can you do as a game developer to prevent the oversteering resonance catastrophe, and make driving feel right? (For a casual racing game, that doesn't strive for 100% realistic physics)

I also wonder what games like Super Mario Kart exactly do differently so that they don't have so much oversteering?

I guess one problem is that if you play with a keyboard or a touchscreen (but not wheels and pedals), you only have digital input: gas pressed or not, steering left/right or not, and it's much harder to steer appropriately for a given speed. The other thing is that you probably don't have a good sense of speed, and drive much faster than you would (safely) in reality. From the top of my head, one solution might be to vary the steering response with speed.

sentences:
Inverted left & right stick axes in SDL2 I've faced a weird problem with SDL2.

case SDL_CONTROLLERAXISMOTION:
    switch (e->caxis.axis)
    {
    /* LEFT && RIGHT Stick Movement */
    case SDL_CONTROLLER_AXIS_LEFTY:
        puts("Y");
        break;
    /* UP && DOWN Stick Movement */
    case SDL_CONTROLLER_AXIS_LEFTX:
        puts("X");
        break;
    }
    break;

Using my Xbox 360 Controller on Windows 10, I just the move the left stick forward and backward which is in the y-axis logically. But it prints X instead.

There's no problem with my controller since it works as it should be with all other games.

I've also used some gamepad tools for debugging and the results are the true y and x axes directions.

What did I miss? It's the same with the right stick too.

sentences:
How do I get information about the level to the player object? I have a design problem with my Player and Level class in my game.

So below is a picture of the game. The problem is I don't want to move on the black space and only the white space. I know how to do this as all I need to do is get the check for the sf::Color::Black and I have methods to do this in the Level class. The problem is this piece of code

   void Game::input()
{
    player.input();
}

void Game::update()
{
    (*level).update();
    player.update();
}

void Game::render()
{
    (*level).render();
    player.render();
}

So as you there is a problem in that how do I get the map information from the Level class to the Player class.

Now I was thinking if I made the Player position static and pass it into the Level as parameter in update I could do it. The problem is interaction. I don't know what to do. I could maybe make player go into the Level class. However, what if I want multiple levels?

So I have big design problems that I'm trying to solve.

sentences:
How do I storing a Score in each level? I have a problem when I store the DistanceScore to text, the problem is why the DistanceScore always storing at text number 1, this happens when I play at level 2 which is the DistanceScore could be store in text number 2and so on, FYI I have 3 levels here.
here the preview

as you can see on the top of level 2 gameplay is distance so when i dead the distance saved and storing to text each level.

and when I go to the main menu the Level 1text updated instead of Level 2.
this is my script:
public Item[] _item;

public int mapIndex;

public enum ITEM_TYPE
{
    LEVEL
}

public ITEM_TYPE _type;

private void Start()
{
    loadItemInformation();
}

public void loadItemInformation()
{
    for (int i = 0; i < _item.Length; i++)
    {
        if (_type == ITEM_TYPE.LEVEL)
        {
            _item[i].bestScore.enabled = true;
            _item[i].distance.enabled = true;

            float distanceUi = PlayerPrefs.GetFloat("distance" + i.ToString());
            float value = PlayerPrefs.GetFloat("Time" + i.ToString());
            float minutes = Mathf.FloorToInt(value / 60);
            float seconds = Mathf.FloorToInt(value % 60);

            if (value == 0)
            {
                _item[i].bestScore.text = "No Record Yet";
            }

            else
            {
                _item[i].distance.text = "Unstopable ";
                _item[i].bestScore.text = "Best Time = " + string.Format("{0:00}:{1:00}", minutes, seconds);
            }

            _item[i].distance.text = "Long distance = " + distanceUi.ToString();

        }
    }
}

}
    [System.Serializable]
    public class Item
    {
        public TextMeshProUGUI bestScore;
        public TextMeshProUGUI distance;
    }

here the distance script:
#region Distance
[Header("Distance")]
public Transform checkPoint;
public TextMeshProUGUI distanceText;
M_GameManager _GameManager;
private float distance;
private float highDistance;
float index;
#endregion

private void Start()
{
    _GameManager = FindObjectOfType<M_GameManager>();
    checkPoint = GameObject.FindGameObjectWithTag("Finish").transform;
    distanceText = GameObject.FindGameObjectWithTag("DistanceTxt").GetComponent<TextMeshProUGUI>();
    index = (float)(PlayerPrefs.GetInt("Level"));// typo here i call it set and now I've fix it
}
index = PlayerPrefs.GetFloat("Level");
distance = (checkPoint.transform.position.x - transform.position.x);
    if (transform.position.x > checkPoint.transform.position.x)
    {
        distance = 0;
        //PlayerPrefs.SetFloat("distance" + index, distance);
    }
    if (_GameManager.isDead || _GameManager.isTimeout || _GameManager.fuelFinished)
    {
        PlayerPrefs.SetFloat("distance" + index, distance);
        PlayerPrefs.Save();
    }
    distanceText.text = distance.ToString("F1") + "m";

and for _item[i].bestScore.text this work to storing each level but why for the distance not working.

sentences:
Cannot find the Cocos2d templates I am about to upgrade to the last version of Cocos2d and would like to uninstall my current Cocos2d templates before installing the new one but cannot find the templates to delete.

I have looked at a number of web comments on this such as Uninstall Cocos2D ans another uninstall example but to no avail. However, I still see Cocos2d in my Xcode (4.5) framework. I have been searching my directories but cannot find it.

Is there anyone out there who can give me a hint where to find it so i can delete in?

sentences: Mouse Input Unexplained Behavior Unity3D Input.GetMouseButtonDown(0.....6); - in documentation it says that you can pass, 0, 1, 2 as parameter. Input.GetMouseButtonDown. It doesn't accept negative numbers like -1 or numbers 7+. What does 3 4 5 6 do? What input are they calculating? Or can I use these numbers as default for None state? I couldn't find any information about this.

sentences:
Blender exported model has reduced quality in Unity when normals applied I know this topic comes up a lot in forums, however I have spent the last 2 hours googling it and can not find a solution for my specific problem...

I have exported this model from Blender, but when I import the model into Unity with normals set to "none" it appears as it does in Blender (see left image).

However, when I try to select import or calculate normals, it distorts the character mesh making it look less detailed and less human like (see right image).

I have tried messing with normals settings in Blender, tried changing quality settings etc. in Unity but I can not get it to look 1:1 with normals applied (obviously it needs lighting and shadows so I need it to have normals).

If anyone can provide assistance to fix this or a work around, I would really appreciate it a lot!

sentences:
How can I find the direction a sprite is moving? I'm trying to get the direction a sprite is moving (up, down, left, right). My current approach is to get the x and y coordinates of the target and the sprite (the sprite is the thing that I'm trying to get the direction of), and then have booleans be true/false based on the the values of the x/y coordinates (if they are greater than, less than, etc.). I'm not trying to rotate the sprite or change anything about how it's drawn, just find the direction that it's moving in. This is what I'm currently trying (this is more of a general idea of what I'm doing, and is pretty rough):
if (Target.Position.X < Position.X && Target.Position.Y < Position.Y - 500)
{
    IsFacingUp = false;
    IsFacingDown = false;
    IsFacingLeft = true;
    IsFacingRight = false;
}
else if (Target.Position.X < Position.X && Target.Position.Y > Position.Y + 500)
{
    IsFacingUp = false;
    IsFacingDown = false;
    IsFacingLeft = true;
    IsFacingRight = false;
}
else if (Target.Position.X > Position.X && Target.Position.Y < Position.Y - 500)
{
    IsFacingUp = false;
    IsFacingDown = false;
    IsFacingLeft = false;
    IsFacingRight = true;
}
else if (Target.Position.X > Position.X && Target.Position.Y > Position.Y + 500)
{
    IsFacingUp = false;
    IsFacingDown = false;
    IsFacingLeft = false;
    IsFacingRight = true;
}
else if (Target.Position.Y <= Position.Y - 500)
{
    IsFacingUp = true;
    IsFacingDown = false;
    IsFacingLeft = false;
    IsFacingRight = false;
}
else if (Target.Position.Y >= Position.Y + 500)
{
    IsFacingUp = false;
    IsFacingDown = true;
    IsFacingLeft = false;
    IsFacingRight = false;
}

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:
Accelerometer to move player left and right Please take a look on my code and help me to find problem.

I used this tutorial: COCOS2D_ACCELEROMETER_MOVEMENT
This works only sometime….some time not move..How can I resolve this problem?
Here is my sample: DOWNLOAD
Thanks for reading this…what's wrong with my code ? Is there any other way?

Here is my code:

#define kHeroMovementAction 1
#define kPlayerSpeed 500
- (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    // use the running scene to grab the appropriate game layer by it's tag

    // grab the player sprite from that layer using it's tag
    CCSprite *playerSprite = mPlayer;
    float destX, destY;
    BOOL shouldMove = NO;

    float currentX = playerSprite.position.x;
    float currentY = playerSprite.position.y;

    if(acceleration.x > 0.25) {  // tilting the device upwards
        destX = currentX - (acceleration.y * kPlayerSpeed);
        destY = currentY + (acceleration.x * kPlayerSpeed);
        shouldMove = YES;
    } else if (acceleration.x < -0.25) {  // tilting the device downwards
        destX = currentX - (acceleration.y * kPlayerSpeed);
        destY = currentY + (acceleration.x * kPlayerSpeed);
        shouldMove = YES;
    } else

        if(acceleration.y < -0.25) {  // tilting the device to the right
        destX = currentX - (acceleration.y * kPlayerSpeed);
        destY = currentY + (acceleration.x * kPlayerSpeed);
        shouldMove = YES;
    } else if (acceleration.y > 0.25) {  // tilting the device to the left
        destX = currentX - (acceleration.y * kPlayerSpeed);
        destY = currentY + (acceleration.x * kPlayerSpeed);
        shouldMove = YES;
    } else {
        destX = currentX;
        destY = currentY;
    }

    if(shouldMove)
    {
        CGSize wins = [[CCDirector sharedDirector] winSize];
        // ensure we aren't moving out of bounds
        if(destX < 30 || destX > wins.width - 30 || destY < 30 || destY > wins.height - 100) {
            // do nothing
        } else {
            CCAction *action = [CCMoveTo actionWithDuration:0.5f position: CGPointMake(destX, playerSprite.position.y)];
            [playerSprite stopActionByTag:kHeroMovementAction];
            [action setTag:kHeroMovementAction];
            [playerSprite runAction:action];
        }
    } else {
        // should stop
        [playerSprite stopActionByTag:kHeroMovementAction];
    }

}

sentences:
Drawing a one pixel wide line in 3D space I'd like to draw a line in 3D space that is always exactly one pixel wide on screen, no matter how far away from the camera it is. (And the same for single points too).

Any hints on how I could do that?

sentences:
Get closest point on box to line Eventually this problem will be 3D, so I would like a solution that works in 3D.

My player is looking forwards. There is an axis-aligned box on the screen (FOV is guaranteed to be 90, so boxes behind the player aren't considered.)

I want to get the coordinates of the point on box that is closest to the player's looking direction.

I.e., if the player turned towards the box, which point of the box would intersect with their line of vision first?

sentences:
Isometric Screen View to World View I am having trouble working out the math to transform the screen coordinates to the Grid coordinates.

The code below is how far I have got but it is totally wrong any help or resources to fix this issue would be great, had a complete mind block with this for some reason.

    private Point ScreenToIso(int mouseX, int mouseY)
    {
        int offsetX = WorldBuilder.STARTX;
        int offsetY = WorldBuilder.STARTY;

        Vector2 startV = new Vector2(offsetX, offsetY);

        int mapX = offsetX - mouseX;
        int mapY = offsetY - mouseY + (WorldBuilder.tileHeight / 2);

        mapY = -1 * (mapY / WorldBuilder.tileHeight);
        mapX = (mapX / WorldBuilder.tileHeight) + mapY;

        return new Point(mapX, mapY);
    }

sentences:
Create lamp shade material How would one go about creating a lamp shade material that lets light through from a light inside the object. I have read that turning of shadow casting for that object should work, however I have turned off Cast Shadows but it doesn't work.

Here are some pictures:

Light off:

Light on:

The lampshade remains dark. How can I fix this?

sentences:
Blender Cycles materials not showing in Second Life I ran into a problem after trying to import my own creation into second life. While I am not new to 3D modelling with Blender and other programs, I have always only created things for fun. Now I have decided to import few of those creations into Second Life but the materials I have used do not display in the preview at all. I have used the Cycles Render.

How do I solve my issue with Materials not displaying in Second Life after Exporting a Collada file from Blender Rendered in Cycles?

sentences:
Scaling web game to suit any screen size I've made a simple multiplayer game, and now trying to make it fit on any screen size. I've tried stretching it out to fit the browser size, but it just appears weird and distorted. I'm also trying to avoid having borders around the edges as it doesn't look particularly nice.

Is there a way to solve this that is fair to all players?

sentences:
SDL_DisplayFormat works, but not SDL_DisplayFormatAlpha The following code is intended to display a green square on a black background.  It executes, but the green square does not show up.  However, if I change SDL_DisplayFormatAlpha to SDL_DisplayFormat the square is rendered correctly.

So what don't I understand?  It seems to me that I am creating *surface with an alpha mask and I am using SDL_MapRGBA to map my green color, so it would be consistent to use SDL_DisplayFormatAlpha as well.

(I removed error-checking for clarity, but none of the SDL API calls fail in this example.)

#include <SDL.h>

int main(int argc, const char *argv[])
{
    SDL_Init( SDL_INIT_EVERYTHING );

    SDL_Surface *screen = SDL_SetVideoMode(
        640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF
    );

    SDL_Surface *temp = SDL_CreateRGBSurface(
        SDL_HWSURFACE, 100, 100, 32, 0, 0, 0,
        ( SDL_BYTEORDER == SDL_BIG_ENDIAN ? 0x000000ff : 0xff000000 )
    );

    SDL_Surface *surface = SDL_DisplayFormatAlpha( temp );

    SDL_FreeSurface( temp );

    SDL_FillRect(
        surface, &surface->clip_rect, SDL_MapRGBA(
            screen->format, 0x00, 0xff, 0x00, 0xff
        )
    );

    SDL_Rect r;
    r.x = 50;
    r.y = 50;

    SDL_BlitSurface( surface, NULL, screen, &r );

    SDL_Flip( screen );

    SDL_Delay( 1000 );

    SDL_Quit();

    return 0;
}

sentences:
"Line of sight" path across navigation mesh I want to calculate the line of sight in a navigation mesh.

Consider the image below, the yellow line is the result of only A* and the red line is the result of a line of sight" algorithm that uses the yellow line as input. Now the unit can move directly without “zig-zagging”.

What is an algorithm to calculate that "line of sight"?

sentences:
What is wrong with my Dot Product? I am trying to make a pong game but I wanted to use dot products to do the collisions with the paddles, however whenever I make a dot product objects it never changes much from .9 this is my code to make vectors

vector = {
    make:function(object){
        return [object.x + object.width/2,object.y + object.height/2]
    },
    normalize:function(v){
        var length = Math.sqrt(v[0] * v[0] + v[1] * v[1])
        v[0] = v[0]/length
        v[1] = v[1]/length
        return v
    },
    dot:function(v1,v2){
        return v1[0] * v2[0] + v1[1] * v2[1]
    }
}

and this is where I am calculating the dot in my code

vector1 = vector.normalize(vector.make(ball))
vector2 = vector.normalize(vector.make(object))
dot = vector.dot(vector1,vector2)

Here is a JsFiddle of my code currently the paddles don't move.

Any help would be greatly appreciated

sentences:
Do you need a license for weapon models? When creating your own model for a weapon, say the M4 carbine, and using the model in your game. Do you need a license to use it commercially?
I know that racing games like GT5 has a license for each and every car, but the same apply for weapons?

sentences: Clipping Effect in Toon Boom Harmony 15.0 I want to do similar effect like this tutorial Masking Effect. The tutorial using Toon Boom Studio 8, I'm using Toon Boom Harmony 15 and can't seem to find the Cliiping Effect they use in tutorial. Not even from Node View. Any advice to do the same effect ??

sentences:
Can ARToolKit be used for color detection? I'm trying to make an app that will show an object from different sides, but the target will be too small for any real marker detection.

Think of a cube with one or two centimeter sides. The camera distance is not a problem but it has to be at least ten centimeters out or what I'm trying to do won't work.

I was wondering whether it was possible to color one side of the cube differently than others and make ARToolKit recognize the color to know which side it's looking at. Is this possible or just not in the range of things ARToolKit can do? If so, is there any kind of AR that can do this.

sentences:
How can I calculate when a spesific amount of time has passed I am trying to get something to happen, when a spesific amount of time has passed(in my case it is in secounds). I have tried using this method:

   long elapsed = (System.nanoTime()-startTime)/1000000;
   if(elapsed > 1000)
   {
       score++;
       startTime = System.nanoTime();
   }

with the starttime beiing initiated in the constructor. But when I attack(part of the game) the app either:
chrashes
the things the game renders dissapears, and everything turns black.

I have tried asking google, but it in general gave me the save way. Any new improved ideas?

sentences:
Which structures to use for maintaining 2D objects on canvas? How to map clicks to objects? I need to draw some 2D objects on a canvas. And I need to map the 2D coordinates of clicks to objects.

What is the usual way to maintain a 2D object's size and position (which data structures,  etc.)? What's the effective way to say: this object is at coordinates (x, y)?

sentences:
Is dynamic casting Entities A good design? For my game,

Everything inherits from Entity, then other things like Player, PhysicsObject, etc, inherit from Entity. The physics engine sends collision callbacks which has an Entity* to the B that A collided on. Then, lets say A is a Bullet, A tries to cast the entity as a player, if it succeeds, it reduces the player's health.

Is this a good design?

The problem I have with a message system is that I'd need messages for everything, like:
entity.sendMessage(SET_PLAYER_HEALTH,16);

So that's why I think casting is cleaner.

sentences:
Unity Shadow shows on my Android device but NOT my Windows Mobile device Unity version: 2017.1.1f1
Problem:
I'm using Directional Light. Shadow is not showing in my Windows Mobile device (Lumia 640 XL), but works fine when I run the exact same UWP project as PC (Local Machine) as well as Android.

Attempted solutions:
1) Quality Setting: I even removed the rest of levels and left only 1 level of quality.
2) Both soft and hard shadows, 10 Shadow distance, Stable Fit of shadow projection, very high resolution, low resolution, No Cascade.
3) Tried realtime and mixed light mode.

any idea? Thanks in advance for read my question.

Screenshots:
Windows 10 Mobile (Lumia 640 XL)

Android (Redmi Note 3)

sentences:
Is there a way to run an Android Unity game in Windows? I was wondering, given a generic Unity game built for Android (with no desktop version), if I could somehow run it on windows (not in an android emulator) by using the windows version of mono.

The theory is that the script assembly (if the scripting was done in c#) is separate from the game engine.

I tried replacing the Data folder of a windows game with the Managed folder from the Android apk but got this error:

  Failed to load PlayerSettings (internal index #0). Most likely data
  file is corrupted, or built with mismatching editor and platform
  support versions.

Is there some tool I can use to change the platform of a third party unity game in order to play it ?

I'm not an unity developer myself but my concern is that games could use features not supported on desktop...

sentences:
Colour Problems When Using SDL_Resize() In a 3D SDL application I inherited (I have little 3D or SDL experience), I have a 'screenshot' routine that either saves a full-size image or a scaled image, depending on the context (differing key-press).  To save a full-size (i.e. graphics-mode-sized) screenshot I'm using:

SDL_SaveBMP(SDL_GetVideoSurface(), SDL_RWFromFile(filename.c_str(), "wb"), 1);

This works exactly as-intended, and saves an 8-bit bitmap (the display mode is always 8-bit, for another reason entirely) as expected.

However, in order to resize the image, I'm making use of a library that came heavily recommended in several places when searching for a suitable surface-/image-resizing library for SDL: SDL_Resize.

I'm implementing this as such:

SDL_Surface *toResize = SDL_GetVideoSurface();
SDL_Surface *resized = SDL_Resize(toResize, (int)w, (int)h);

SDL_SaveBMP(resized, SDL_RWFromFile(filename.c_str(), "wb"), 1);
SDL_FreeSurface(resized);

This works mostly as intended.  It saves a resized, 8-bit bitmap, seemingly with the correct palette.  However, the colours in parts of the image are incorrect, e.g.

Now, I don't need the output images to be 8-bit, I'd be perfectly happy with a 24-bit or 32-bit bitmap, if I could solve this problem; but I can't find out the answer to either of these questions:

How do I convert an SDL surface to a different bit-depth?
How do I ensure that the output image displays the colours correctly after resize?

I'm anticipating that I may have to settle for a higher-bit-depth bitmap, and that's fine... but a few pointers in the right direction would be fantastic.

Many thanks!

sentences:
How to implement swooping movement? I am trying to code some swooping behavior for a flying enemy in my 2D platformer.

The ideal behavior has the enemy starting from an arbitrary height above the ground, then accelerating downward and horizontally until flush with the ground, after which he slows and comes to a rest.

I would like to code this in such a way that I can adjust a parameter controlling the steepness of the curve.

In other words, I want a kind of asymptotic movement, similar to this:

https://www.mathsisfun.com/algebra/asymptote.html

How can I code this kind of movement in such a way that my enemy can start from any height and smoothly and elegantly accelerates down this kind of curve before gracefully stopping?

I have recourse to all the usual stuff (for example, acceleration, velocity, friction, raycasts, etc.). I would prefer to code the movement using this stuff, rather than hardcoding movement along a curve or path.

I was thinking it might be possible to achieve what I want by raycasting downward and getting the enemy's distance from the ground, and using this distance to adjust accelerations and velocities, but I'm not exactly sure how to go about it.

I work in Godot, but would like an engine-neutral explanation of how to achieve this kind of behavior.

sentences:
AI Algorithm to make enemy smarter from level to level in Runner game I am designing a City-Runner game in Unity 3D Engine.I am a beginner in game development (not in programming). The idea is really simple, the Runner will be followed by AI enemies, and if caught by one of them it will be dead or his energy will decrease.

Anyway I cannot find any Algorithm for implementing a "smart" AI, in the sense that not only he will follow the player and do Path-finding to the player, but also get smarter from the first level to the second level.

Probably AI must store some information/state in regards to the terrain and the runner position.

My question here is :

Is it a good idea to make the AI smarter (because all the runner does is running in a straight line, only the person who is playing the game can change his direction- left, right; so maybe its not like the learning will be very beneficial)
If this is a good idea, do you have any knowledge on what algorithms may be used (implementing neural-nets or something alike)
If it's not the best idea, what AI mechanism can I use expect of path-finding, wandering, seeking, flocking ??

Any kind of advice would be greatly appreciated !!

Thank you.

sentences:
Ghost replay - storage and timing I am working on a car race game and just implemented a ghost sprite for replaying past races.
I use a physics engine and after much reading I came to the conclusion that the best way to store the ghost data for replay would be to record the car's position and rotation at given timepoints, as for example described here: https://gamedev.stackexchange.com/a/8380/26261.

But what would be a good way to find those timepoints during replay?
An example would be a record with this data:

time: +3.19932 (seconds since race start)
position:  180,40 (position at that time)
rotation: 30.4 (rotation at that time)

But I have several problems with that:

When I replay, it's unlikely that I reach the exact timepoint at 3.19932 again - more likely, I will have a timepoint around 3.1 and have to find the closest matching record. When interpolating, even the closest matching above and below. This sounds very inefficient and time consuming?
In which list structure could I store these records for a later replay? An array? Doesn't that mean that search time for records matching a certain time will increase the longer the race is?
Which frequency should I use for timepoints? Each frame would be -I guess- overkill, rather I should save i.e. every nth frame and interpolate in between, which makes the storage questions in 2. even more difficult.

So is this idea even the right approach? If yes, how could I efficiently store and retrieve the data?
Please note that I generally would like to go with using the data structure above, not deterministic gamestates and recording user input etc.

Thanks for any help!

EDIT:
I realise I should describe the environment I use: Cocos2D for iPhone.
There is a method update:(ccTime)delta. Ideally, this method would be called every 1/60 seconds, but there is no guarantee - delta is the actual time passed since the last gametick and could be a lot more or less than 1/60.
It is in this method where I would like to store the current gamestate.

sentences:
Is there a way to export all the images of my tweening effect in Flash? i'm using Flash to create the animation of my character in 2D (i'm just beginning). Is it possible to make a tween effect of a character, and then automatically export all the images/frames?

So far, it's a bit fastidious : i create my tweening effect, then i put a keyframe for each frame i want to copy and paste, then i select the movieclips and shapes and copy and paste them into another flash document, i position those clips at the exact same location as the previous image, then i erase the previous image and export the image... For 30 frames! Is there any faster way?

Thanks

sentences:
Is there a rule of thumb to scale up the environment by 33%? I was reading an article on Gamasutra called A Rational Approach to Racing Game Track Design, and I found the following:

  A commonly acknowledged rule for third person games is
  that the environment should be scaled up by a factor of
  around 33 percent (on page 2)

I am just curious: has anyone else heard of such a rule, and if so, where else could I find references to it?

sentences:
XNA/MonoGame creating a player After some fine-tuning on my game's GUI I am finally ready to begin with the gameplay. But that's a tall order. My game will be something like a 2D platformer with RPG elements like collecting armor, helmets, weapons etc. So with that in mind I begun thinking about a way to create my player. First, I thought a single Player class would do the job for me but since I want to equip the armor/helmet I've acquired, I quickly abandoned this concept.

Next I got another idea. I could have the player's Head, Arms and Legs to be different classes and each of them drawing its own texture, respectively. So I can swap between different armor/helmet sprites for each of the body parts. But that would seem pretty complex to implement... or not?

Could I have a code example on how you would do this? Which path you would take if you are in my stead? Single Player class or different body parts classes? If the latter, how would you hook them so that it all looks like a single sprite?

sentences:
Share content FROM Facebook, not to it Regarding Unity 2018.x:

The Facebook SDK provides a way to get log-in information from a user's FB account, and allows information or an image from an app to be shared TO Facebook. Is it possible to link / access / reference or in any  other way make use of a specific image on Facebook within my Unity app?

Ideally, I would like to be able to access the image upon target recognition and, even better, store the image for subsequent display within the app. Finally, even more ideally ideally, this would not be the FB profile picture.

All suggestions and links welcome.

sentences:
How to change the way LibGDX scales images? I'm using FillViewport and OrthographicCamera. LibGDX is scaling my images rather badly - jagged edges, visible pixels. How can I change the scaling method?

by the way, I'm pretty sure the issue isn't my images. I've scaled them using imaging software and they look a lot better than when LibGDX scales them.

sentences: Placing a gameobject with restrictions I am newbie in programming and I am making a tower defense game 2d. My problem is I want to make a restriction to place a tower only, if the mother tower is in place or within its range. I'm sorry if my explanation is a bit confusing. For example, you can oly place a certain tower within the range of the mother tower and only if that mother tower is placed. I don't exctly know if I have to create a function for this or create a range game object for the placement attached to the mother tower. Any help and tips would be appreciated, thank you. This is by the way unity C#.

sentences:
Gameserver travel time checks I'm making a little RPG multiplayer game where each player can travel long distances. Traveling from point A to B can take up to 10 minutes and – once initiated – is an automatic process. Now, I am not quite sure how to go about this on the server-side, the server has to be the one telling the clients that the traveling player has arrived or not.

Do I have to run some sort of timer where I check every X seconds/milliseconds if all the traveling players have reached their destination in order to update the DB? (the characters are saved on the server to prevent cheating).

The way I imagined it was simply to capture the timestamp at the start of travel, then use the distance to calculate what the time should be when the player will arrive, and then run some sort of timer that checks each traveling players "start time" , "actual time" and "destination time", but since I have never done this before I'm not sure if this is a good way of doing it?

sentences: detect asset change while running in unity editor? Is it possible to detect asset change while running in the unity editor.  When I update my model, I see it change but the xml data associated with it does not change.  So it would be nice to detect that and reload the xml data while running in the unity editor.

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:
Corona SDK Continuous Integration Is it possible to build corona applications from console?
Or how can I automate build process?

sentences:
HTML5 2D Game Renderer i have a question on designing a HTML5 2D game renderer.

I've read that it's better to not let entities draw themselves but instead put all the drawing functions in the renderer. After coding for a bit, I realise that this does have its advantages. For instance, I can have a list of helper functions in my renderer system, like drawRotatedImage(), getSprite(), setFontSize(), plus the context variable etc.

However, wouldn't this lead to a very bloated renderer class, with functions like drawTree(), drawMonster(), drawPlayer(), drawBall() or whatever entity?

Also, how would i easily map the entity objects to their corresponding draw functions? Would i have to do an if (entity.type == 'monster') this.drawMonster(); else if (entity.type == 'tree') this.drawTree(); kind of thing?

sentences:
Staggered Isometric Map In Javascript I'm trying to create a staggered isometric map in Javascript.

    var x, y, row, column, top, left,
        width = window.innerWidth, height = window.innerHeight,
        tile = {width: 64, height: 32};

    row = Math.ceil(width / tile.width); // how many rows will be in map
    column = Math.ceil(height / tile.height); // how many columns will be in map

    for (x=0 ; x<row ; x++){
        for (y=0 ; y<column ; y++){
            top = y * tile.height - (y % 2 == 0 ? 0 : tile.height / 2);
            left = x * tile.width - (y % 2 == 0 ? 0 : tile.width / 2);

            $('<div />').addClass('tile').css({
                width: tile.width,
                height: tile.height,
                top: top,
                left: left
            }).appendTo('body');
        }
    }

My formula doesn't work for vertical axis. It creates something like this.
http://postimage.org/image/ekfnlbgoh/

How can I make it work? I need it to be something like this.
http://legendofmazzeroth.wikidot.com/staggered-isometric-maps

Here is the latest code:

    row = Math.ceil(height / (tile.height / 2));
    column = Math.ceil(width / tile.width);

    for (y=0 ; y<=row ; y++){
        for (x=0 ; x<=column ; x++){
            top = y * (tile.height / 2) - (tile.height / 2);
            left = x * tile.width - (y % 2 == 0 ? 0 : tile.width / 2) - (tile.height / 2);

            $('<div />').addClass('tile').css({
                width: tile.width,
                height: tile.height,
                top: top,
                left: left
            }).appendTo('body');
        }
    }

By the way, thanks to you that column/row mistake has been fixed.

sentences:
How do I figure out if a point is infront or behind my vehicle? I need to figure out whether a point is infront or behind my vehicle.

I have the vector of it's position, forward direction.

So far I have tried finding the vector perpendicular to its forward direction and then calculating what side of the line it is positioned on.

This works fine at first. But then I realised it is only calculating around the origin.

bool Car::isInfront(ngl::Vec2 _pos)
{
//http://stackoverflow.com/questions/1243614/how-do-i-calculate-the-normal-vector-of-a-line-segment

//if we define dx=x2-x1 and dy=y2-y1, then the normals are (-dy, dx) and (dy, -dx).

//create vector per to the direction of travel.
ngl::Vec2 fwdVec = m_carPhysics->getForwardVec2();
ngl::Vec2 pos = m_carPhysics->getPosVec2();

ngl::Vec2 dir = pos + fwdVec;

float dx = dir.m_x - pos.m_x;
float dy = dir.m_y - pos.m_y;

ngl::Vec2 v1(-dy, dx);
ngl::Vec2 v2(dy, -dx);

ngl::Vec2 perp = (v1) - (v2);

int turn = getLeftOrRight(_pos, perp);

if(turn == LEFT)
{
    return true;
}
else
{
    return false;
}

int Car::getLeftOrRight(ngl::Vec2 _dir, ngl::Vec2 _fwd)
{
//http://gamedev.stackexchange.com/questions/34536/calculating-angle-between-two-vectors-to-steer-towards-a-target
//cross product;
float val = (_dir.m_x * _fwd.m_y) - (_dir.m_y * _fwd.m_x);

if(val > 0)
{
    return LEFT;
}
else
{
    return RIGHT;
}

}

sentences:
How do you technically represent a procedurally-generated map in the scene? I've always wanted to create the type of map generator they use in Kingdoms and castles. Basically you provide a seed, and it generates land/water/trees/resources. Their maps are also completely flat (except water seems to be 1-2 positions down, which I assume would make it easier.

However I do not know where to look for guidance for this type of system, I am wondering if anyone can explain the logic of how that type of system works, or even better, point me to a tutorial that could get me started.

While there are tutorials on perlin noise and the like, I never really understood how to connect it to a proper tile, and what properties that tile should have, does it need colliders? is each tile a gameobject? If not, how do I create tiles with trees/rocks that I can gather? and so on.

sentences:
Is there a good comprehensive walk-through of deriving the math for 3D model rendering that starts from scratch? I'd like to fully understand the math of rendering a 3D model in a 2D perspective.

I always find tutorials that are in terms of the APIs used to do the math for you, and not the math itself.

I'd like to understand it from the standpoint of geometry as opposed to linear algebra if possible.  What I mean is, I'd like to be able to visualize what the matricies stand for in the 3D model and/or 2D image which is the result of rendering.

Is there a definitive source or sources I can consult for this?

sentences:
Unity with move gameobject line renderer I create DrawLine class, I want my character to follow the line I draw.

How do I move my character on draw line renderer ?

Thanks!

public class DrawLine : MonoBehaviour
{

    public GameObject linePrefab;
    public GameObject currentLine;

    public LineRenderer lineRenderer;
    public EdgeCollider2D edgeCollider;
    public List<Vector2> fingerPositions;

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            CreateLine();
        }
        if (Input.GetMouseButton(0))
        {
            Vector2 tempFingerPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            if (Vector2.Distance(tempFingerPos, fingerPositions[fingerPositions.Count - 1]) > .1f)
            {
               UpdateLine(tempFingerPos);
            }

        }
    }

    void CreateLine()
    {
        currentLine = Instantiate(linePrefab, Vector3.zero, Quaternion.identity);
        lineRenderer = currentLine.GetComponent<LineRenderer>();
        edgeCollider = currentLine.GetComponent<EdgeCollider2D>();
        fingerPositions.Clear();
        fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
        fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));

        lineRenderer.SetPosition(0, fingerPositions[0]);
        lineRenderer.SetPosition(1, fingerPositions[1]);

        edgeCollider.points = fingerPositions.ToArray();
    }

    void UpdateLine(Vector2 newFingerPos)
    {
        fingerPositions.Add(newFingerPos);
        lineRenderer.positionCount++;
        lineRenderer.SetPosition(lineRenderer.positionCount - 1, newFingerPos);
        edgeCollider.points = fingerPositions.ToArray();

    }

}

```

sentences: How to fix flare in unity? I have a simple sun flare that I would like to appear on my directional light (sun). However I cannot see the flare, I have tried setting the ignore layers to everything and checked and double checked that there is a flare layer on my camera. The light is also rotating constantly as I have a day/night cycle too if that means anything for the flare... Anyway, could someone show me how to fix this?

sentences:
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:
How can I loop over waypoints to move all the objects between them? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Waypoints : MonoBehaviour
{
    public enum RotationMode
    {
        Normal, Curved
    }

    public GameObject objectToDuplicate;
    public Transform[] waypoints;
    public float movingSpeed;
    public bool randomSpeed = false;

    private GameObject[] prefabsToMove;

    private void Start()
    {
        prefabsToMove = GameObject.FindGameObjectsWithTag("FrameLine");
        DuplicatePrefabEffects(prefabsToMove.Length);
    }

    private void DuplicatePrefabEffects(int duplicationNumber)
    {
        for (int i = 0; i < duplicationNumber; i++)
        {
            var go = Instantiate(objectToDuplicate);
            go.tag = "Duplicated Prefab";
            go.name = "Duplicated Prefab";
        }
    }

    private void WaypointsAI()
    {
        for (int i = 0; i < waypoints.Length; i++)
        {
            if (randomSpeed)
            {
                movingSpeed = Random.Range(1, 20);
            }
            prefabsToMove[i].transform.position = Vector3.MoveTowards(
                         prefabsToMove[i].transform.position,
                         waypoints[i].position,
                         movingSpeed * Time.deltaTime
                     );
        }
    }

    void Update()
    {
        WaypointsAI();
    }
}

The problem is inside the loop there might be less or more prefabsToMove then waypoints so it will throw exception.

Then doing prefabsToMove[i] is wrong.

sentences:
Cant find a way to set fps for sf::Time Myclass
{
void run();
sf::Clock m_clock;
float m_time;
float timestep
}
Myclass::run()
{
if (m_time>= timestep)
{
//update
m_time-=timestep;
}
restartCLock();
}
Myclass::restartCLock()
{
m_time+=m_clock.restartAsSeconds();
}

How do i do the same but when m_time is being sf::Time?

sentences:
How do I render text in a view in SFML 2.5.1 without artifacts? I'm using the following code to render text in a letterboxed view.

#include <iostream>
#include <random>
#include <math.h>
#include <cstring>
#include <ostream>

#include <SFML/Graphics.hpp>

const float FIXED_UPDATE_TIME = 16.67f;//60fps

const unsigned int DEFAULT_CAMERA_WIDTH = 1280;
const unsigned int DEFAULT_CAMERA_HEIGHT = 720;

sf::View get_letterbox_view(sf::View view, int window_width, int window_height) {

    // Compares the aspect ratio of the window to the aspect ratio of the view,
    // and sets the view's viewport accordingly in order to archieve a letterbox effect.
    // A new view (with a new viewport set) is returned.

    float window_ratio = window_width / (float) window_height;
    float view_ratio = view.getSize().x / (float) view.getSize().y;
    float sizeX = 1;
    float sizeY = 1;
    float posX = 0;
    float posY = 0;

    bool horizontal_spacing = true;
    if (window_ratio < view_ratio)
        horizontal_spacing = false;

    // If horizontal_spacing is true, the black bars will appear on the left and right side.
    // Otherwise, the black bars will appear on the top and bottom.

    if (horizontal_spacing) {
        sizeX = view_ratio / window_ratio;
        posX = (1 - sizeX) / 2.f;
    }

    else {
        sizeY = window_ratio / view_ratio;
        posY = (1 - sizeY) / 2.f;
    }

    view.setViewport( sf::FloatRect(posX, posY, sizeX, sizeY) );

    return view;
}

int main() {
    sf::RenderWindow window(sf::VideoMode(DEFAULT_CAMERA_WIDTH, DEFAULT_CAMERA_HEIGHT), "Adventure of Jaggy Font Edges");
    window.setMouseCursorVisible(false);

    // Set up resource
    sf::Font fnt;
    fnt.loadFromFile("res/fnt/Ruda-Regular.ttf");

    // Set up text
    sf::Text text;
    text.setFont(fnt);
    text.setString("TEXT RENDERING");
    text.setCharacterSize(128);
    text.setFillColor(sf::Color::White);
    text.setOutlineColor(sf::Color::Black);
    text.setOutlineThickness(3.f);

    // Center text (in world space, I believe?)
    sf::FloatRect text_rect = text.getLocalBounds();
    text.setOrigin(
        floorf(text_rect.left + text_rect.width/2),
        floorf(text_rect.top + text_rect.height/2)
    );
    text.setPosition(0, 0);

    // Set up view, and center it on the text
    sf::View camera_view(sf::FloatRect(0.f, 0.f, DEFAULT_CAMERA_WIDTH, DEFAULT_CAMERA_HEIGHT));
    camera_view.setCenter(0, 0);

    sf::Clock clock;

    while (window.isOpen()) {
        // only update 60fps
        sf::Time elapsed_time = clock.getElapsedTime();
        if (elapsed_time.asMilliseconds() < FIXED_UPDATE_TIME) {
            continue;
        }

        // handle events
        sf::Event event;
        while (window.pollEvent(event)) {
            // window closed event
            if (event.type == sf::Event::Closed) {
                window.close();
            } // window resized event/*
            else if (event.type == sf::Event::Resized) {
                camera_view = get_letterbox_view(camera_view, event.size.width, event.size.height);
            }
        }
        window.clear(sf::Color(255, 255, 255, 255));

        window.setView(camera_view);
        window.draw(text);

        window.display();
    }
    return EXIT_SUCCESS;
}

At the default resolution, it looks like this:

However, the moment I change the window size, we get artifacts:

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:
Implementing a color picker I'm making a paint program using applets in Java, and I want to create some sort of color palette where the colors blend into each other, similar to this:

However, I'm having trouble understanding the correlation between the R, G, B, values and the X, Y coordinates for both the outer circular color palette, and the inner hue selecting palette.

Representation:

sentences:
Projection type used in videogames I'm trying to create a web application, to display 3D objects on canvas. To represent the 3D object I'm using an array of Points (from application's point of view, a Point - is just an object containing x, y and z coordinate values). Then I'm connecting the points with lines.

So. My task is to represent 3D points on 2D coordinate system. As I understand, what I need is to implement the projection of these points (to transform point from 3D representation into 2D). I spent few hours reading about projection types and I can't really understand which type is actually suits my needs.

I created an array of points to represent a cube. Then I implemented a central projection to display my cube on cavnas. As a result, it lost it's proportions (what I got is a paralelipiped).

I would like that my cube would look like a cube after projection. I guess, that I have to use a parallel projection, but there are a lot of subtypes of it.

So the question. Which projection I need to choose and maybe you can give me a peace of advice of what should I read to get a base mathematical background about this topic?

sentences:
vSync for gameplay in monitor and VR headset in Unity not being consistent? Following my previous question, I'm building a project, my monitor refresh rate is 60Hz, and in my project I have set my vSync value into 2 so I can get 30fps.

QualitySettings.vSyncCount = 2

It worked perfectly, I built my project and I got stable 30fps. But after I plugged my VR headset (HTC Vive) to play the same project, my framerate drops and only reach around 10fps. Why is this happening ? FYI, Vive's refresh rate is 90Hz. In this case, will vSync adjust itself to my monitor or Vive's refresh rate ?

sentences:
How do I restart tweens in DOTween and Unity? I am trying to restart a couple of tweens when I load a new scene. So far,
I have this in MainMenuController.cs :

void Start () {
    if (currentScene.name == "MainMenuScene") {
        Debug.Log("In current scene");
        tweenList[0] = mainMenuText.transform.DOShakePosition(5, 10)
                                   .SetAutoKill(false).SetRecyclable(true);
        tweenList[1] = playGameButton.transform.DOShakePosition(5, 10)
                                     .SetAutoKill(false).SetRecyclable(true);
        tweenList[2] = exitGameButton.transform.DOShakePosition(5, 10)
                                     .SetAutoKill(false).SetRecyclable(true);
        DOTween.RestartAll(false);
    }

}

However, this does not start when I reload the scene using

public void ExitToMainMenu() {
        SceneManager.LoadScene("MainMenuScene");
    }

The above is called from another script.
Is there some way to restart my tweens when the scene is loaded again?

sentences:
A* heuristic for a map that can have roads I have a 2D grid which I am performing A* pathfinding on. Nodes are connected via a value of 3 in most cases (some connections are more expensive). In some (depends on the gameplay) circumstances the node may have a road to another node though, bringing the connection cost down to 1.
The heuristic cost is determined by multiplying the heuristic value (as stated below) with the minimum connections to take (this is known).
If I use a heuristic of 0 per connection then A* will always find the shortest path, due to just performing a Dijkstra search. Not ideal.
If I use a heuristic of 1 per connection then A* will still always find the shortest path, but will not be very efficient even when the path is straightforward. This is my fallback.
If I use a heuristic of >1 per connection then A* may not always find the shortest path, but will be more efficient. I am kind of scared of this "not always the shortest path".
I'm considering using a heuristic of 1 (or just always lower the heuristic score by a set amount without letting it get below 1) for connections heuristically close to the target (and maybe close to the start too?) to have "perfect" pathfinding in the regions where it may matter most. Useful or wrong thinking?
What would be a good way to handle this setup? Any tips?
Edit: I just found http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html and wanted to mention it, quite helpful.

sentences:
Limit sprite to windows bounds? I'm making a game in XNA and I want to limit the movement of a sprite to the screen boundaries.
How would I do this?

http://i.stack.imgur.com/ZqH0M.jpg

sentences:
Hinge joints chain movement (2D) I have some problems with hinge joint chain movement calculations...
Here is my algorithm for segments location/rotation adjustments after a previous segment update (C#):
void AdjustLocation()
{
    float halfWidth = Size.Width / 2;

    // Translations
    Vector parentBack = PrevSegment.Center - (halfWidth * new Vector(Cos(PrevSegment.Rotation), Sin(PrevSegment.Rotation))); // Green on the pic
    Vector front = this.Center + (halfWidth * new Vector(Cos(this.Rotation), Sin(this.Rotation))); // Blue on the pic

    // Const spacing between segments
    float spacing = *some_value*;

    Vector dv = parentBack - front;
    float k = spacing / dv.Length;

    // New front location
    front = parentBack - (dv * k);
    // New rotation
    dv = front - this.Center;
    this.Rotation = Atan2(dv.Y, dv.X);

    // Translate back to the center
    this.Center = front - (halfWidth * new Vector(Cos(this.Rotation), Sin(this.Rotation)));

    NextSegment?.AdjustLocation();
}

It's working (partially), but it seems I'm missing something as it doesn't behave like a chain. Segments always move one by another although they should not always do this. Also overlapped sections of a long chain form a "knot" going all the way to the end of the chain before its "untangling".
What am I missing?
Btw: everything screws up with negative spacing values.
P.S. Tried to visualize the algorithm on the picture:

sentences:
Best way to handle events for a turn base game? I'm looking for the best way to handle events for a tactic game in Unity. Every unit may need to react to different events (turn start, end, on damage to self, on damage to other, on kill, etc...).
At the moment I'm just cycling all units for any event from a central manager class, but I'm looking for a more elegant and easy-to-extend solution. I'm not worried about performance since the involved number of units will be low.
Any advice?

sentences: Gameobject with Canvas child (Unwanted inspector behavior) When I try to focus (by double clicking or pressing f) on gameobjects in my scene which have a Canvas as a child, the scene view zooms out to show the Canvas. I would like to be able to see the gameobjects themselves when focusing on them. Is there a way to do this?

sentences:
Making a symbol appear on any colour I'm developing an RPG/roguelike-style game. Instead of having maps like:

.........
.........
....@....
...h.....

Oh look, a dwarf.

I was having solid background tiles, So sort of a tile based RPG without drawn tiles. I like the idea of having ascii tiles for creatures and things. It saves a lot of artist time. I can change the tiles so I get some kind of symbol slightly more...related? But better than having 4 directions for each separate thing.

If I did this in white, and had a snow area, you wouldn't be able to see. So make it black. As soon as you reach a dark place, you're again stuck as to where your character is. Is there an algorithm or something that can say 'this is too dark between the tile and the NPC' and change the colour to something seeable, but not going to a bright cyan from a pale pink or whatever?

sentences:
Putting each animation on a thread I'm trying to make my game as friendly to multi-core as possible. as such, i'm putting each animation on a new thread. I was hoping someone could check out my proof of concept code in java;

an example of usage is as follows:

    ThreadedAnimation ta = new ThreadedAnimation();
    Thread tat = new Thread(ta);
    tat.start();
    ta.getCurrentFrame();

where the threadedAnimation class is as follows:

public class ThreadedAnimation implements Runnable{
boolean init = false, toFinish = false, toStop = false; //synchronized info
short[] delay; //delay in ms
Image[] frames; //array for the frames
public Image currentFrame = null; //for pulling the frame
int currentFrameNumber = 0; // simmillar representation. to go barebones, I would just return the int and not the number.

public ThreadedAnimation(short[] del, Image[] fram){
    if(del.length == fram.length){
        currentFrame = fram[0];
    }else{
        System.out.println("bad animation detected");
    }
}
public ThreadedAnimation(){
    delay = null;
    frames = null;
}

@Override
public void run() {
    if(init){
        while(!toFinish && !toStop){
            currentFrameNumber = 0;
            while(!toStop && !(currentFrameNumber> frames.length)){

                long currentTime = System.currentTimeMillis();
                while((System.currentTimeMillis()-currentTime) < delay[currentFrameNumber]){// The reason I don't put TrySleep(delay[i]) is because the thread is interrupted every time we try and get the image.
                    TrySleep(10);
                }
                currentFrameNumber++;
                currentFrame = frames[currentFrameNumber];
            }

        }

    }
}

private void TrySleep(int i) {
    try {
        Thread.sleep(i);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

}
public synchronized void  finish(){
    toFinish = true;

}

public synchronized void stop(){ //stops animation where it stands and kills
    toStop= true;

}

public synchronized Image getCurrentFrame(){
    return currentFrame;
}

}

sentences:
Saving and Loading File to Application.persistentDataPat not working on Android device I am trying to save data and load data on the project i am working on, but i cant seem to get it work in an Android device it works fine on Unity when i play it, not sure what i am missing or done wrong here is the following code i use to save and load data.

using System.Collections;
 using System;
 using System.Runtime.Serialization.Formatters.Binary;
 using System.IO;

public class PlayerInfo : MonoBehaviour {

 public static PlayerInfo playerData;
 public int gameCoins;

 void OnDisable()
 {
     BinaryFormatter bf = new BinaryFormatter ();
     FileStream file = File.Create (Application.persistentDataPath + "playerinfo.dat");

     PlayerData data = new PlayerData ();
     data.gameCoins = gameCoins;

     bf.Serialize (file, data);
     file.Close ();
 }

 void OnEnable()
 {
     BinaryFormatter bf = new BinaryFormatter ();
     FileStream file = File.Open (Application.persistentDataPath + "playerinfo.dat", FileMode.Open);
     PlayerData data = (PlayerData)bf.Deserialize (file);
     file.Close ();

     gameCoins = data.gameCoins;

 }

 }
 [Serializable]
 class PlayerData
 {
     public int gameCoins;
 }

Anyone can give me an idea of what i need to do or look at i will be very much appreciated, and many thanks in advance for taking the time to help.

sentences:
OnTriggerEnter error: The message parameter has to be of type: Collider I have a crate and I want to make it so if you are in the trigger of the crate a UI appears and says "Click E to loot".
I have the UI setup but the script is not working. Here is my script and after it are the errors.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UI_Appear : MonoBehaviour
{
    [SerializeField] private Image image;

    void OnTriggerEnter(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            image.enabled = true;
        }
    }

    void OnTriggerExit(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            image.enabled = false;
        }
    }
}

The errors say:

Script Error: OnTriggerEnter
The message parameter has to be of type: Collider
Script Error: OnTriggerExit
The message parameter has to be of type: Collider

sentences:
Mathematics: matrix-to-quaternion conversion in left-hand coordinate system I am implementing a typical skeletal animation system, and it requires the usage of quaternion to interpolate rotations between each poses. The asset I import only has a transform matrix for each joint, so I need code to convert a rotation matrix to a quaternion. However, my game is in left-hand system, and most code snippet online out there are for right-hand system only. I tried the code for such conversion in a right-hand system from this gamasutra post. The animation interpolates correctly in some cases, but most of the time it's not working correctly, and here's the symptom:

Say I am animating a guy, in the first key frame he is in bind pose, and in the second key frame he's supposed to raise his right arm by 30 degrees. If my system interpolates the rotation correctly, his arm would slowly raise up to 30 degrees in the interval, maybe first frame it's 10 degrees, then its 15 degrees, and eventually 30 degrees. However, with the code I have, the guy's arm is rotating the longest path. First frame, the guy's arm rotates -30 degrees, then -60 degrees, and comes to the same place to where 30 degree is. Can anyone give me the code snippet that's equivalent to the gamasutra one, but for left-hand coordinate system? Thanks!

sentences:
Aim up/down lookat aim target? I have an animation of a character aiming a handgun 'straight', and firing a handgun from that straight pose. I want to have the character be able to aim up and down and fire from those poses too. Think Resident Evil 1/2/3, Alone in the dark, etc. I want to save time on my animator by not having him do the aim/up down.

I'm trying to find a way to dynamically achieve this effect from code. Do I have to write an IK solver system or is there a more straight-forward way to do it?

I'm pretty sure there's a technical name for this kind of thing, I Googled aim offset, aim target, lookat target etc but all I came up with was UE4 links. We're using our own engine.

Looking at UE4 'aim offset' it looks very similar to what I want. I wonder how it's implemented internally.

I'm not asking for code but just ideas, hints or pointers are appreciated.

sentences:
What do you do when you are at an impasse in the design phase? I own a small web dev shop, and in our down time, I plan on having my guys work on a game (I will be paying them anyway, right?). A few buddies and I started talking about this game, and have been going through the motions of talking/designing it out.

Only problem we are at an impasse, and can't seem to get passed it. The vote is at 50/50%. Compromising hasn't worked.

I have though about just making an executive decision since I am funding the development/design of the game, but I don't want to lose my friends support for the game, and their other opinions.

I don't know what to do.

sentences:
2D bullet movement speed problem Possible Duplicate:
  Moving from A(x,y) to B(x1,y1) with constant speed?

My problem is that I can't get my bullet movement right. The current update code I have for it is:

speedX = deltaX;
speedY = deltaY;

x += speedX / 100;
y += speedY / 100;

deltaX and deltaY are the distances needed to travel on each axis, which I get from the bullet starting coordinates and the mouse coordinates. I use the divider to prevent the bullet just teleporting to it´s destination.

The problem here is that when you press far from the bullet start point the bullet goes quickly. But when you click near the bullet start point it goes really slow. I can´t figure out what I should do to repair it.

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:
Where do I store (or how do I refer to) textures for custom blocks? I'm making my first foray into Minecraft modding on Ubuntu using Minecraft Forge. I'm finding it a little hard to get started as many of the tutorials seem to refer to older versions of Minecraft (e.g. that use the BaseMod base class, which now appears to be deprecated).

I've created a simple block type:

package net.minecraft.block;

import net.minecraft.block.*;
import net.minecraft.block.material.*;

public class RolyBlock extends Block {
    public RolyBlock(int par1, Material par2Material) {
        super(par1, par2Material);
    }
}

and added the following static initialiser to the Block class:

public static final Block rolyBlock = new RolyBlock(174, Material.rock)
                                      .setHardness(1.5F)
                                      .setResistance(10)
                                      .setStepSound(soundStoneFootstep)
                                      .setUnlocalizedName("rolyBlock")
                                      .setCreativeTab(CreativeTabs.tabBlock)
                                      .setTextureName("roly_block");

I created a 256x256 PNG file called roly_block and placed it in Forge's MCP folder, in the same location as the other textures. However, when I start Minecraft (v. 1.6.5) via Eclipse, it is unable to locate the texture:

2014-03-14 11:38:34 [SEVERE] [Minecraft-Client] Using missing texture,
unable to load: minecraft:textures/blocks/roly_block.png

I suspect this is because I put the texture in the directory

forge/mcp/temp/src/minecraft/assets/minecraft/textures

(where I found the other textures) where this temp folder is presumably a decompiled version of the Minecraft 1.6.5 .jar file. I can't actually remember how I ended up with this folder, though.

My question is: how do I add a new texture to my Eclipse mod development environment? Must I rebuild a .jar each time, and if so how? Or can I have Minecraft load textures from a directory?

(I'm a complete Minecraft newbie, so there are many things about the configuration/dev environment for Minecraft that are confusing me. For example if I run recompile.py from Forge's MCP folder, I get a swathe of errors relating to IconRegister not being found.)

sentences:
What's the size of library in unity for android? In unity3d what is the size of library compiled into apk.
Is that affect when i make game without any physics(2d or 3d) or when making 2d or 3d game.

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: Unity max scene limit I want to model the earth 1:1 in unity, but I can only zoom to a certain value in the scne window of unity

sentences:
How do I create inertia when my character turns around? I've been trying to give my character some inertia when it turns in the opposite direction, but for some reason my acceleration variable only seems to apply itself when my horizontal velocity is 0. For example, if my character is standing still, and my horizontal acceleration is set to 0.5 seconds, it takes my character 0.5s to reach its maximum velocity. However if I reach this velocity and then begin to turn around, the transition is much faster. This doesn’t make sense to me because it should take less time to go from 0 to 10 than it does to go from 10 to -10.

It is very easy to see this difference in my game, as even if I change my acceleration to 3s, once I reach my maximum velocity I can turn around almost instantly. I'm using the smoothdamp function, and have tried a few other methods than the one in the code below, one of which distinguished between two distinct velocity smoothing variables. I felt that this created a better feeling of drag, but could result in jerky movement depending on input.

Should I be using smoothdamp for this kind of movement, or is there a more effective solution? Ideally I'd like to have this drag increase or decrease according to my current velocity.

private void FixedUpdate ()
{
    HandleInput();
}

private void SetHorizontalForce(float x)
{
    if (directionalInput.x != 0)
    {
        velocity.x = Mathf.SmoothDamp(velocity.x, x, ref velocityXSmoothing,
                (State.IsCollidingBelow) ? Parameters.accelerationTimeGrounded : Parameters.accelerationTimeAirborne);
    }

    else if (directionalInput.x == 0) //Prevents the character from 'sliding' if suddenly moving left and right at low velocities
    {
            velocity.x = Mathf.SmoothDamp(velocity.x, 0, ref velocityXSmoothing, Parameters.stopTime);
    }
}

private void HandleInput()
{
    directionalInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

    if (!Controller2D.State.IsClimbingLadder && !Controller2D.State.ClampLadderMovement)
    {
        SetHorizontalForce(directionalInput.x * stats.movementSpeed);
    }
}

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:
Unity 5 Networking Send Rate: Send Rate is Zero but server movement is still happening I have a client server scenario, just a player moving about on the client and he moves about on the server using the built in networking provided in Unity 5. I have my client scene running in the editor and was playing about with the Network Transform Script Values, more specifically the Network Send Rate. Setting this Value to 29 (its highest) the movement on the server is almost smooth. Setting this value to 1 and the movement on the server is very laggy as I expected. However, if I set the network send rate to 0 on the client, I expected it not to move at all on the server, but it moves and alot smoother than the value 29.

Why is it, that when the network send rate is set to 0 that my character still moves on the server?

sentences:
Swapping a mesh from MCS female to a custom mesh I'm trying to swap a mesh from the MCS female CBJacket with a custom mesh that's supposed to be a lab coat. But it keeps turning in to a ball of spiky mesh! I made sure the avatar and armature for the custom fbx was the same as the official one but i'm not getting any where with this problem.

any help (as always) is greatly appreciated

sentences:
How to use a .mtl file in Unity? I want to use a .mtl file to draw my objects in unity.
Can I somehow convert a .mtl file into a normal Unity material?

My .mtl file is like this:

newmtl phongE1SG
illum 4
Kd 0.00 1.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 1.00
Ks 0.50 0.50 0.50

Is this the same as a Unity material which has the sliders "albedo", "metallic", "smoothness", etc?

Or is there any shader to do it?

sentences:
Hemispherical Projection I'm trying to implement a radiosity processor. I'm aware of many places online to find information about radiosity. I found a great source on NVidia's website is  GPU Gems - Chapter 39 . On this page they talk about Hemispherical projection. I've implemented a projector that will place mesh 'vertices' on a unit hemisphere...the problem is that the rasterizer only linearly interpolates between vertices along an edge...

...is there a way to adjust the method of interpolation?

Here is shader code for hemispherical projection...it does place the objects correctly, however, the edges between the vertices are straight...when true hemispherical projection would create rounded edges...

float4x4 mW;
float4x4 mV;
float4x4 mP;
float4x4 mOrtho;
float2 vNearFar;
static const float PI = 3.14159265f;

texture g_TextureDiffuse;
sampler g_SamplerDiffuse = sampler_state
{
    Texture = <g_TextureDiffuse>;
    MinFilter = Point;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
};

struct VS_IN
{
    float4 Position : POSITION0;
    float3 Normal : NORMAL0;
    float2 UV : TEXCOORD0;
};

struct PS_IN
{
        float4 Position : POSITION0;
    float3 Normal : TEXCOORD0;
    float2 UV : TEXCOORD1;
    float4 Pos2 : TEXCOORD2;
};

PS_IN VS( VS_IN input )
{
    PS_IN output = ( PS_IN )0;

    float4x4 mWV = mul( mW, mV );
    float4x4 mWVP = mul( mWV, mP );
        half4 vPos = mul( input.Position, mWV );

    half3 vHemi = normalize( vPos.xyz );

    half3 fNearFar = vNearFar.y - vNearFar.x;

    output.Position.xy = vHemi.xy * fNearFar;
    output.Position.z = ( vPos.z / ( vNearFar.y - vNearFar.x ) );
    output.Position.w = fNearFar;
    output.Pos2 = output.Position;
    output.Normal = mul( input.Normal, mWV );
    output.UV = input.UV;
    return output;
}

float4 PS( PS_IN input ) : COLOR0
{
    //float2 uv = input.UV - 0.5;
    //float z = sqrt( 1.0 - input.Pos2.x * input.Pos2.x - input.Pos2.y * input.Pos2.y );
        //float a = ( z * tan( ( PI / 2 ) * 0.5 ) );
        //return tex2D( g_SamplerDiffuse, ( uv * a ) + 0.5 );

    float4 diffuse = tex2D( g_SamplerDiffuse, input.UV );
    return diffuse;
}

technique Render
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 VS();
            PixelShader = compile ps_2_0 PS();
    }
}

Here is screenshot:

It may be difficult to tell, but the cube has two faces( triangles ) per side( 6 sides, 12 faces ). From the picture you may be able to see the problem with flat edges...this problem is well documented...I'm trying to avaoid having to render 5 different images( hemicube ) to approximate a hemisphere...I'm mostly interested in hearing about methods of implementing a hemisphere...I also tried( to no avail ) to write a pixel shader that would warp the final( post scene render ) image. I didn't get great results...

...it also just came to me that I don't necessarily need a render result for computing the form factor...just the area that the projected object consumes within the area of the hemisphere base...

...any thoughts are appreciated!

... here is a screenshot of the cube subdivided...much better...still not accurate

sentences:
How do I keep a rigidbody from making unnecessary collisions on smooth surfaces in Unity3d? I have been having trouble with a custom character controller I am making. The root of the problem lies with collisions. I am trying to make movement code, but I have a problem with ground movement. Pay attention to this gif. It might be hard to notice due to the low frame rate, but the collider registers collisions with objects (in red) that do not point out of the ground. They share the same y-position as the ground. I've printed the normals of the collisions, and there are a lot of normals that are perpendicular to the normal of the ground (which is causing the rigidbody to get stuck).

The problem lies with collisions in unity. If I were to print the y-position of the bottom of my collider, it would be just a tad lower than the y-position of the ground. The collider actually rests below the ground by an almost negligible amount (which is why it doesn't always collide with these objects).

Here is what I have tried: I created a function that runs at the beginning of every FixedUpdate() that uses current collisions to change the y-position of the rigidbody. It only runs on collisions that would ground the player (meaning that they are below the collider). The problem with this approach is that the same issue can occur with walls, meaning that the collider can get stuck on walls. I cannot create another function that would do the same for walls for various reasons.

Here is what would fix the issue: I need help figuring out how I can make collisions more discrete in unity. Colliders rest slightly below objects when ontop of them. They can also "sink" just a little into walls. In other words, colliders can rest into other colliders, and I need this to stop.

Any help is appreciated. Thank you.

sentences:
When a Render Pass decides what textures it needs, how are shaders written? I am studying render graph architectures (I've seen the Frostbite presentation).
A RenderPass has outputs (i.e. textures you draw to) and inputs.
How are these inputs bound to the internal pipeline ?
Lets say I have an AO Pass and it has Normals and Depth as the input.
Do I just bind the texture to a register and that's it and sample it?
What about the actual shaders (for drawing geometry) that also use textures?

sentences:
OnMouseUp not working in unity A common problem in Unity - my OnMouseUpAsButton() is not being called, and I do not understand why. I have attached box collider 2d (though its size is set up during runtime, but by the time I click on it it has proper size and covers the whole button). My object is an UI element, created from prefab during runtime. Here you can see its inspector info:

Code:

using UnityEngine;
using System.Collections;

public class button_controller : MonoBehaviour {
void OnMouseUpAsButton()
{
    Debug.Log("Clicked event button");
    switch(click_action){
        case action.NONE:
            action_none();
            break;
    }
}

I tried going through other threads where people had similar problems but nothing seems to work. Any ideas what might be happening?

EDIT: I found out that if I add a new button , directly from the inspector to the canvas, whose collider is within the canvas all other buttons start working. Interestingly I cannot put this new button anywhere, it has to be at least a bit within the canvas

sentences:
How should I organize my matrices in a 3D game engine? I'm working with a group of people from around the world to create a game engine (and hopefully a game with it) within the next upcoming years. My first task is to write a camera class for the engine to use in order to add cameras to the scene, with position and follow points.

The problem I have is with using matrices for transformations in the class, should I keep matrices separate to each class? Such as have the model matrix in the model class, camera matrix in the camera class, or have all matrices placed in one class/chuck?  I could see pros and cons for each method, but I wanted to hear some input form a more professional standpoint.

sentences:
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:
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:
Find range between two signed 180° angles How can I find the angle between two angles that go from -180 to 180 degrees?
I would like to do :
if (angleDiff > 90)
{
    // The angle is bigger than 90 degrees...
}

I tried subtracting them but that doesn't seem to work. Thank you

sentences:
How do modern game engines handle many shadow casting lights? This is a very general question, and not aimed at any particular language or graphics API; I am more interested in the theories & algorithms behind the solutions.

I'm reasonably familiar with the basic idea behind shadow mapping:

Each spotlight and directional light requires a rendering pass to generate it's shadow map, and each point light requires 6 such passes, prior to any lighting calculations.

Such a potentially large number of rendering passes could quite easily have a substantial negative impact on performance and texture bandwidth, so how do modern game engines deal with this problem, especially in the case with deferred rendering systems, where many lights are involved?

Consider the following scenario:

A scene contains a reasonable amount of geometry, spread out over a "level". That level has a certain number (let's say 20, for brevity) stationary point lights dotted around the level. The player can place lights around the level too, and carries a torch (spotlight).

The rendering system uses the deferred shading model, given the potentially high number of lights in the scene.

How does the renderer decide which lights to render shadowmaps for?
Of those lights, during the "light pass", how is that variable number of shadow maps handled dynamically, bearing in mind that they could be 2d textures (spots and directional), or cube maps (points)?

Do graphics API's have the capability to support shaders with arrays of maps/lights, or would the shadow maps require a single discrete lighting pass for each individual light?

sentences:
How can I easily determine the z-ordering of objects in multiple glDraw calls? I have a simple 2D tile-based scene that I'm rendering with OpenGL. On each frame I first draw the static background, and then draw the dynamic elements (monsters, etc.). This way it seems that the later drawn elements "paint over" the earlier drawn ones (using separate glDraw calls).

However, when asking around, it seems that if I used a depth buffer the order in which things are drawn doesn't necessarily matter, as the depth buffer can be used to determine visibility.

But what happens when some things share the same z-value when using a depth buffer? Is the newer one "painted over" the older one?

If so, should I rely on this behavior, or rather use different z-values for my "layers"?

sentences:
Camera looking around with mouse - Unity, C# I am building a script in C# for camera logic in Unity, the camera is supposed to follow the player (a 3rd person character) around and the user should be able to look around using the mouse, so far everything works fine (the following logic and looking around on the horizontal axis) the problem is I can't get the camera to move along the vertical axis, left and right are fine but up and down are not working.

This is the C# script:

public class PlayerFollow : MonoBehaviour
{
    public Transform PlayerTransform;

    private Vector3 _cameraOffset;

    [Range(0.01f, 1.0f)]
    public float SmoothFactor = 0.5f;

    public bool LookAtPlayer = false;

    public bool RotateAroundPlayer = true;

    public bool RotateMiddleMouseButton = true;

    public float RotationsSpeed = 5.0f;

    public float CameraPitchMin = 1.5f;

    public float CameraPitchMax = 6.5f;

    // Use this for initialization
    void Start()
    {
        _cameraOffset = transform.position - PlayerTransform.position;
    }

    private bool IsRotateActive
    {
        get
        {
            if (!RotateAroundPlayer)
                return false;

            if (!RotateMiddleMouseButton)
                return true;

            if (RotateMiddleMouseButton && Input.GetMouseButton(2))
                return true;

            return false;
        }
    }

    // LateUpdate is called after Update methods
    void LateUpdate()
    {
        if (IsRotateActive)
        {

            float h = Input.GetAxis("Mouse X") * RotationsSpeed;
            float v = Input.GetAxis("Mouse Y") * RotationsSpeed;

            Quaternion camTurnAngle = Quaternion.AngleAxis(h, Vector3.up);

            Quaternion camTurnAngleY = Quaternion.AngleAxis(v, Vector3.up);

            Vector3 newCameraOffset = camTurnAngle * camTurnAngleY * _cameraOffset;

            // Limit camera pitch
            if (newCameraOffset.y < CameraPitchMin || newCameraOffset.y > CameraPitchMax)
            {
                newCameraOffset = camTurnAngle * _cameraOffset;
            }

            _cameraOffset = newCameraOffset;

        }

        Vector3 newPos = PlayerTransform.position + _cameraOffset;

        transform.position = Vector3.Slerp(transform.position, newPos, SmoothFactor);

        if (LookAtPlayer || RotateAroundPlayer)
            transform.LookAt(PlayerTransform);
    }
}

sentences:
Entity Type specific updates in entity component system I am currently familiarizing myself with the entity component paradigm.

For an example, take a collision system, that detects if entities collide and if they do let them explode.

So the collision system has to test collision based on the position component and then set the state of those entities to exploding.

But what if the "effect" (setting the state to exploding) is different for different entities? For example, a ship fades out while for an asteroid a particle system must be created.
Since entities and components are only data, this must happen in some system.

The collision system could do it, but then it must switch over the entity type, which in my opinion is a cumbersome and difficult to extend solution.

So how do I trigger "entity type dependend" updates on an entity?

sentences: How can I render a tmx map at a given location? I am using libgdx & trying to implement a Binding of Issac like dungeon. To do this I'm loading a tmx map when a dungeon room is created and rendering it to the screen. The issue is that the each room renders the map in the same place on top of each other. This all boils down to one question: How can I render a map at a specific x,y position, so that I can display the whole dungeon at once?

sentences:
How can I add an in-game level editor? I have 200 prefabs and a scene with an infinite flat plane.

I want to allow user to edit the scene - add, remove, rotate, place that prefabs and save/load resulting "scene" in some custom format.

How can I implement this?

sentences:
Evenly distribution of 2 or more shapes given their x and y points inside a bounding box I have a set of dynamically shaped objects, How do I distribute them evenly either Horizontally or Vertically.The objects are surrounded by a bounding box and the objects are placed at x,y as shown.

Can anyone help me in providing the algorithm or pseudo code.

UPDATE:
It is clear that, the shapes those stay at extremes (forming a bounded box) are kept constant and the remaining objects inside the space is distributed evenly. I used a word processing application to simulate the above example.

For 2 objects inside,

sentences:
Is the city of the GTA, L.A. Noire, Assasins Creed or Saint Row games considered a level? I'm trying to figure out whether or not the worlds in which these games take place are levels or not, for the sake of level design. I consider the world to be one big level and all the missions and such being levels as well.
While most levels in other games have specific goals, there are pretty much no objectives tied to the "mega-levels" of these games.

I just wanted to get some opinions.

sentences:
A Star pathfinding on oblique map I'm making an RPG and want to make npc ai to navigate the city. I am using polylines for collision detection, and my map is 2D, but oblique styled. I am considering using the A* algorithm to help them navigate.

I've gotten the A* algorithm to work with a top-down 2D array of nodes:

But am not sure how to go about implementing this in my game.

The overall world is 100x100 64x64px tiles, but the viewport (red box) only shows a small portion of them:

My questions are as follows:

Do I make a 2D 100x100 array, each cell size 64x64 px to mimic the real map?
How do I account for the polyline barriers/collision if 1's (unwalkable) and 0's (walkable) can only be assigned to a square cell?
Performance: is it better to just created a pathing grid for the viewport, or always generate one for the entire 100x100 map?
Barriers/Collision: I create my collision barriers directly in Tiled. Is there a way to programmatically insert unwalkable into the matrix for a given location of the barrier?

I am lost as to where to go next in translating this to my game.

Thanks!

sentences:
Pyglet Layout won't render? Here's some sample code I copy pasted to try and get a Pyglet layout to work.  I just get a blank screen.  Every time I try to write my own code based on the docs or copy/paste some example code it just will not render the layout.

Interwebs reveal a few other people with this issue but no answers given.

Labels seem to work fine although even they are quirky.

import pyglet

white = (255, 255, 255, 255)

window = pyglet.window.Window(width=200, height=200, caption='Text layout')

# document
document = pyglet.text.decode_text(
    ('Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
     'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World!'))
document.set_style(start=0, end=0, attributes=dict(font_size=12, color=white))

# text layout
text_layout = pyglet.text.layout.TextLayout(document=document,
                                            width=window.width,
                                            height=window.height,
                                            multiline=True,
                                            wrap_lines=True)
text_layout.color = (.5,.5,.5,1.0)

@window.event
def on_draw():
    window.clear()
    text_layout.draw()

pyglet.app.run()

sentences:
SDL draw dynamic select box This might seem obvious to many, but I'm stuck and I cannot find any tutorial which helped me, so it would be great to find the answer here.

I tried to make a rectangle like you have in RTS games, so to speak a dynamic select box, but it does not work correctly.
It would also be enough is someone lists up bullet points which each step for creating a box like this.

(Don't wonder I'm really new to c++)

Mouse.h :

#ifndef MOUSE_H_
#define MOUSE_H_

class Mouse {

public:
    bool leftButtonDown = false;
    bool mouseMoves = false;

    struct MouseCoords {
        int x = -1;
        int y = -1;
    };

    MouseCoords start_coords;
    MouseCoords move_coords;
    Mouse(){}

    void setState(Uint32 eventType, SDL_Event event){

        if ( eventType == SDL_MOUSEBUTTONDOWN) {
            this->leftButtonDown = true;
            SDL_GetMouseState( &this->start_coords.x, &this->start_coords.y );
        }

        if ( eventType == SDL_MOUSEBUTTONUP ) {
            this->leftButtonDown = false;
        }

        if ( eventType == SDL_MOUSEMOTION ) {
            this->mouseMoves = true;
            this->move_coords.x = event.motion.x;
            this->move_coords.y = event.motion.y;
        } else {
            this->mouseMoves = false;
        }
    }

    /**
     * Provides coordinates when mousebutton down
     */
    MouseCoords getCoordinates(){
        return move_coords;
    }

    /**
     * Refresh the coordinates. MUST be called after Mouse::clearCoordinates();
     */
    void clearCoordinates(){
        this->move_coords.x = -1;
        this->move_coords.y = -1;

    }

    /**
     * Creates selector rect, call this in the render loop
     */
     void createSelectBox(SDL_Renderer *renderer){
         if(this->leftButtonDown) {
            Block rect(
                       this->start_coords.x,
                       this->move_coords.y,
                       this->start_coords.y -this->move_coords.y ,
                       this->move_coords.x - this->start_coords.x
                       );
             rect.draw( renderer );
             this->clearCoordinates();
         }
     }
};

#endif

Block.h

#ifndef BLOCK_H_
#define BLOCK_H_
/**
 * Standard Class which can be used to build a player, enemy, or something similar
 */

class Block{
    SDL_Rect rect;
public:
    Block(int x=10, int y=10, int w=10, int h=10, int filled=true){
        rect.x = x;
        rect.y = y;
        rect.w = w;
        rect.h = h;
    }

    /**
     * draw with the given rendererer
     */
    void draw(SDL_Renderer *renderer){
        SDL_SetRenderDrawColor( renderer , 200 , 155 , 255 , 255);
        SDL_RenderDrawRect( renderer, &rect );
        SDL_RenderPresent( renderer );
    }

    bool framed(){
        return 0;
    }

};
#endif

Then in my main.cpp

SDL_Window *window;
SDL_Renderer *renderer;
Mouse mouse;
Block rect;

void renderWindow(){
    window = SDL_CreateWindow("commanding rects", 100, 100, 700, 600, 0);
    renderer = SDL_CreateRenderer(window, -1, 0);
}

void renderGame(Mouse mouse){
    SDL_RenderSetLogicalSize( renderer, 400, 300 );
    SDL_SetRenderDrawColor( renderer, 0, 0, 0, 0);
    SDL_RenderClear( renderer );
    SDL_RenderPresent( renderer );
    mouse.createSelectBox( renderer );

}

void gameLoop(){
    bool game_run = true;
    while (game_run) {
        SDL_Event event;
        while( SDL_PollEvent(&event)){
            if ( event.type == SDL_QUIT ) {
                game_run = false;
            }
            mouse.setState(event.type, event);
        }
        renderGame(mouse);
        SDL_Delay( 15 );
    }

}

int main(){
    renderWindow();
    gameLoop();
    return 0;
}

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:
My Directional light lights the floor of my cave but not the ceiling (concave mesh) I am developing a small demo with Meshes created from a vertex map.

When i put a hole in the mesh (making it concave) the physics work fine but the directional lightning only lights one part of the concave park.

All of my mesh can receive and and cast shadow (so i should have self-shadowing) but it does not seem to work.

my directional light creation:

            var dirLight = new THREE.DirectionalLight( 0xffffff, 1 );
            dirLight.position.set( -50, 50, 1 );
            dirLight.position.multiplyScalar( 50);
            dirLight.name = "dirlight";
   dirLight.castShadow = true;
            dirLight.shadowCameraVisible = true;
   dirLight.shadowDarkness = 1.0;

my shadow settings:

   renderer.setSize( window.innerWidth/1, window.innerHeight/1 );
   renderer.shadowMapEnabled = true;
   renderer.shadowMapSoft = true;

   renderer.shadowCameraNear = 3;
   renderer.shadowCameraFar = camera.far;
   renderer.shadowCameraFov = 50;

   renderer.shadowMapBias = 0.0039;
   renderer.shadowMapDarkness = 0.5;
   renderer.shadowMapWidth = 1024;
   renderer.shadowMapHeight = 1024;

Finally my mesh creation code:

var newGeometry = new THREE.Geometry();
for (var i = 0; i < rawGeometry.vertices.length; i++) {
  newGeometry.vertices.push(new THREE.Vector3(rawGeometry.vertices[i][0], rawGeometry.vertices[i][1], rawGeometry.vertices[i][2]))
}
for (var i = 0; i < rawGeometry.faces.length; i++) {
  newGeometry.faces.push(new THREE.Face3(rawGeometry.faces[i][0], rawGeometry.faces[i][1], rawGeometry.faces[i][2]))
}

newGeometry.computeFaceNormals();
;

var color = rawGeometry.color;
var newMesh = new Physijs.ConcaveMesh(newGeometry, new THREE.MeshLambertMaterial({
  color: color
}), 0, 50, 50);
newMesh.position.x = location[0];
newMesh.position.y = location[1];
newMesh.position.z = location[2];

newMesh.castShadow = true;
newMesh.receiveShadow = true;

this.Chunks[chunkIndex[0]][chunkIndex[1]][chunkIndex[2]][typeIndex] = newMesh;

scene.add(newMesh);

sentences:
Pivot not updating programmatically I have a canvas.  It has an empty game object as a child.  That object has a RectTransform component.  The RectTransform pivot value is set to 0.4, 0.5 (x, y).
In some code I wanted to update the pivot value using the following:

Debug.Log(((RectTransform)transform).pivot);  // logs: (0.4, 0.5)
((RectTransform)transform).pivot.Set(0.3f, 0.8f);
Debug.Log(((RectTransform)transform).pivot);  // logs: (0.4, 0.5)

I don't know why the set command is not working.  The tooltip for Set is: "Set x and y components of an existing Vector2"

sentences:
Consistent Shadow Map Filtering I want to filter my shadow map generated by PSSM, but the problem is that I have a inconsistent filter size.

The problem is that the shadow map sources rotate to find the best fit for the camera frustum, and thus sampling with a constant offset (e.g. 10.0 / resolution) produces inconsistent results.

A gif shows it probably best (same shadow and sun position, just different view angles):

GIF showing the issue

My idea was to, instead of using a fixed filter offset, compute the filter offset by projecting 2 world-space points to light-space and taking the difference of both, like this:

vec4 find_filter_size(mat4 projection, vec3 light, float sample_radius) {

    // Find an arbitrary tangent and bitangent to the light vector
    vec3 v0 = abs(light.z) < 0.99 ? vec3(0, 0, 1) : vec3(1, 0, 0);
    vec3 tangent = normalize(cross(v0, light));
    vec3 binormal = normalize(cross(light, tangent));

    // Project everything
    vec2 proj_origin = project(projection, vec3(0)).xy;
    vec2 dx_proj_tangent = project(projection, tangent).xy - proj_origin;
    vec2 dx_proj_binormal = project(projection, binormal).xy - proj_origin;

    return vec4(dx_proj_tangent, dx_proj_binormal) * sample_radius;
}

However that didn't quite work out, and, in fact, produces even more artifacts.

Any suggestions how I could fix this? I just need a basic idea, then I can figure out the implementation by myself.

sentences:
How do I make hit damage a Gaussian distribution centered around a value? I'd like my character's attacks to on average 10 damage, but to vary anywhere from 0 to 20.

Instead of a linear spread, I would like a normal distribution, so most of their hits are between 10-15, but they can still hit between 0-20. How can I do this?

I am using PHP.

sentences:
Game freezing when i create a body Box2D Libgdx I'm implementing a Worms game using libGDX and Box2D and I'm  having a problem I didn't have until recently. When a player shoots, it creates a bullet body and applies a force to it. I have a step system to see what the player should be doing( move, select weapon, select angle and charge force). The methods involved with shooting in player are :

public void nextStep(){
    if ( turnStep == 0){
        startingPosition = player.getPosition().x;
    }
    turnStep++;
    if(turnStep > 5){
        turnStep = 0;
        chargeBar.dispose();
        movementBar.dispose();
        arrow.dispose();
    }
    if(turnStep == 1)
        movementBar = new MovementBar(getX(),getY(),world);
    if(turnStep == 3)
        arrow = new Arrow(getX() + tex.getWidth() /2, getY() + tex.getHeight() / 2,  world);
    if(turnStep == 4)
        chargeBar = new ChargeBar(getX(),getY(),world);
    if(turnStep == 5){
        shooting = true;
    }
}

public void shoot(){
    actualWeapon.shoot( arrow.getTip(), chargeBar.getCharge() , arrow.getAngle());
    shooting = false;
}

In my main game class, I have an update method where I do the world step and update other things, and I perform the shooting here

    world.step( 1/60f, 6, 2);
    if (playerWhoseTurnItIs.isShooting()){
        playerWhoseTurnItIs.shoot();
    }

Which ends up calling :

public void shoot(Vector2 pos, float force, float angle){
    isFlaggedForDeletion = false;
    body = BodyCreators.createBox( pos.x * PPM, pos.y * PPM, projectileTex.getWidth(), projectileTex.getHeight(), false, false, world, (short) BIT_PROJECTILE, (short) (BIT_PLAYER | BIT_WALL), (short) 0 , this);
    Vector2 f = new Vector2( force * MathUtils.cos(angle * MathUtils.degreesToRadians), force * MathUtils.sin(angle * MathUtils.degreesToRadians) );
    body.applyForceToCenter( f , true);
}

Everything used to work fine, and I didn't touch any of this while working, but now every couple of turns the bullet just appears and then freezes there, on the tip of the arrow, freezing my whole game.

Also, when I started having this problem I implemented the check after the world step, it just used to shoot when i called nextStep() and the turn was five, but since applying the check didn't actually solve the problem (I thought it was like when destroying bodies you can only do it after the step) I might revert the change.

If you need more information please ask, thank you

sentences:
vkCmdCopyBuffer has no effect for transfer of staging buffer for a vulkan renderer using vulkan-hpp and Vulkan Memory Allocator I am trying to transfer vertex data to the gpu using a staging buffer.
Without using an intermediary staging buffer the transfer works and the meshes can be rendered
with no problems (just a single buffer created with VMA_MEMORY_USAGE_CPU_TO_GPU).
But with the call to vkCmdCopyBuffer the resulting vertexBuffer only contains 0s (checked with NSight).
Thinking that synchronisation using barriers might be required I tried the following code, but still have the same problem.

Maybe there is a need to synchronize the command buffer doing the copy with the later command buffer binding and sourcing from the vertex buffer? Although I didnt see this done or mentioned in any tutorials I came across.

// vulkan initialization
// VmaAllocator initialization

std::vector<Vertex> vertices = { /*filled*/ };
auto vertexBufferSize = vertices.size() * sizeof(Vertex);

vk::Buffer stagingBuffer;
auto ci = vk::BufferCreateInfo().
    setUsage(vk::BufferUsageFlagBits::eTransferSrc).
    setSharingMode(vk::SharingMode::eExclusive).
    setSize(vertexBufferSize );
VmaAllocationCreateInfo allocationCI = {};
allocationCI.usage = VMA_MEMORY_USAGE_CPU_ONLY;
vmaCreateBuffer(allocator, (VkBufferCreateInfo*)&ci,
    &allocationCI, (VkBuffer*)&stagingBuffer, &allocation, nullptr);
void* pVBufMem = nullptr;
vmaMapMemory(allocator, allocation, &pVBufMem);
std::memcpy(pVBufMem, vertices.size(), vertexBufferSize );
vmaUnmapMemory(allocator, allocation);

vk::Buffer vertexBuffer;
ci = vk::BufferCreateInfo().
    setUsage(vk::BufferUsageFlagBits::eTransferDst | vk::BufferUsageFlagBits::eVertexBuffer).
    setSharingMode(vk::SharingMode::eExclusive).
    setSize(vertexBufferSize);
allocationCI = {};
allocationCI.usage = VMA_MEMORY_USAGE_GPU_ONLY;
vmaCreateBuffer(allocator, (VkBufferCreateInfo*)&ci,
    &allocationCI, (VkBuffer*)&vertexBuffer, &allocation, nullptr);

// copy staging buffer to vertex buffer
auto allocCI = vk::CommandBufferAllocateInfo().
    setCommandBufferCount(1).
    setCommandPool(pool).
    setLevel(vk::CommandBufferLevel::ePrimary);
auto cmd = device.allocateCommandBuffers(allocCI)[0];
cmd.begin({ vk::CommandBufferUsageFlagBits::eOneTimeSubmit });

// barrier host write -> copyBuffer read
auto bufferMemoryBarrier = vk::BufferMemoryBarrier()
.setBuffer(stagingBuffer)
.setSize(vertexBufferSize)
.setSrcAccessMask(vk::AccessFlagBits::eMemoryWrite)
.setDstAccessMask(vk::AccessFlagBits::eTransferRead)
.setSrcQueueFamilyIndex(VK_QUEUE_FAMILY_IGNORED)
.setDstQueueFamilyIndex(VK_QUEUE_FAMILY_IGNORED);
cmd.pipelineBarrier(
    vk::PipelineStageFlagBits::eAllCommands, vk::PipelineStageFlagBits::eAllCommands, {},
    { }, { bufferMemoryBarrier }, { });

cmd.copyBuffer(stagingBuffer, vertexBuffer, { 0, 0, vertexBufferSize });

// copyBuffer write -> vertex read
bufferMemoryBarrier = vk::BufferMemoryBarrier()
.setBuffer(vertexBuffer)
.setSize(vertexBufferSize)
.setSrcAccessMask(vk::AccessFlagBits::eTransferWrite)
.setDstAccessMask(vk::AccessFlagBits::eVertexAttributeRead)
.setSrcQueueFamilyIndex(VK_QUEUE_FAMILY_IGNORED)
.setDstQueueFamilyIndex(VK_QUEUE_FAMILY_IGNORED);
cmd.pipelineBarrier(
    vk::PipelineStageFlagBits::eAllCommands, vk::PipelineStageFlagBits::eAllCommands, {},
    { }, { bufferMemoryBarrier }, { });

cmd.end();
auto submitInfo = vk::SubmitInfo().
    setCommandBufferCount(1).
    setPCommandBuffers(&cmdBuffer);
queue.submit({ submitInfo }, {});
queue.waitIdle();

sentences:
How to get GameElements (RigidBody) size in Unity? I've made a prefab consisting of a Cube which I've first scaled to more resemble a brick. There's also a Rigidbody added to the cube (in the prefab). Now I want to use that prefab in a c# script to make a wall out of multiple bricks.

My question is, how can I access the dimensions of my brick (width, height, the z dimension size) so that in my script I can make bricks which are placed one next to the other (and then one on top of the other)?

I've looked at the documentation for GameObject and Rigidbody but I can't find anything helpful.

Just for refference, my script so far is:

public GameObject brick;

void Start () {
        Instantiate(this.brick, new Vector3(0.01326297f, -30.07855f, 100f), Quaternion.identity);
        // int brickWidth = this.brick.????;

    }

sentences:
Platform Cannot move down when player collide buttom of platform Unity? In my unity game I've arrange different platform ,when my player collide with upper part of the platform so platform falling down but issue that when my player collide to platform buttom of part so platform falling down.

void OnCollisionEnter2D(Collision2D target)
{
        if (target.gameObject.tag == "Player") {
        gameObject.GetComponent<Rigidbody2D> ().isKinematic = false;
    }
 }

sentences:
Object to reach height depending on its gravity and mass A mathematician will probably think this was a silly question, but I'm not one and I'm in need of help :D
I'm working in Godot and with its RigidBody2Ds (objects that have automated physics behaviour).
I want to create a spring of type RigidBody2D (the 'springiness' is not the only function of this object).
I'm at the point in code where this spring and another RigidBody2D collide so I have all information about the two bodies at the moment of collision.
My goal is to make any body that touches the spring reach a certain height (from the spring), and move by certain speed horizontally, as you can see in the picture

So, the information about both bodies I have is: position, velocity, gravity scale, mass, weight.
What I want to achieve is constant line of movement of any object (that may have different properties I mentioned above) by applying a certain force to the colliding object.
I can stop the body before applying new force to it, that is, at the time of collision.
Rotation, friction, absorption and similar properties don't need to be counted on as the game I'm making is a simple one. With this I'm trying to make a predictable movement for the player to count on. I also plan to disable collision briefly at the time of collision so that the colliding object can touch the spring from any angle and the collision result would be the same.
EDIT:
Here's some of my testing
Stones have random mass from 1 to 50, in this case 45.748413, 41.445225, 24.259401 and 37.189552 and all have same gravity scale (GS), that is: 2.
The slime has GS of 5 and mass of 1.
I bothered to make a seamless gif, so you can only see the two jumps here. Because the spring has circular shape they fall apart after i think 10 bounces.

From this test I see that mass doesn't matter when I use @Sergio's method, so that's a step foreward. Thanks @Sergio!
func _on_body_entered(body):
    if body is RigidBody2D:
        body.set_linear_velocity(Vector2(0, -50 * body.gravity_scale))

Now, even though they don't reach the same height, they have same timing - from first touching the spring (yeah, i know, it doesn't look like a spring), to falling back. So that's also a step foreward, but I still don't have an idea how to get them all to get to the same height.

sentences:
If I want to create game for mobile and tablet on android and ios, which aspect ratio or screen resolution should I use? Now my game is currently use 3:4 aspect ratio ,which is 480*640
, so my game has the letterbox (I don't like stretch) on my android mobile and my friend mobile. I don't like letterbox, so I have just change color of my letter box to the color that blend with my game background, but I don't like it either. So now I think about change aspect ratio and screen resolution of my game.

how about 480x800 ?

sentences:
LibGDX Bounding Rectangles I'm creating some rectangles surrounding my sprites for my player and bullet class to detect collisions with the overlaps method in Intersector class of LibGDX.

I have a question:

When I instantiate Player and Bullet, I create a bounding box around the sprite using sprite.getBoundingRectangle() which returns a Rectangle object. I update the movement of these somewhere else in the main class.

When I update the movement of the bullet/player sprite, do I also need to update the position of the bounding box surrounding the bullet/player sprite? Or since the bounding Rectangle surrounds the sprite, will the box automatically move with the sprite?

Thanks

sentences:
How to delay jump to syncronize with an animation ? I'm using Unity and First Person Controller.
If i press the jump button, my charachter jump immediately. I want,instead, that jump movement starts after (for instance) 1 second, to be syncronized with a jumping animation I trigger.

How to do that ?

Thanks

sentences:
Find extreme points of a rotated ellipse function on a given axis How to find the points where it is most extreme on the X and Y axis?

For example lets say I have an equation that describes an ellipse that is rotated:

(x * RadiusX * Rx + y * RadiusX * Ux)^2 +
(x * RadiusY * Ry + y * RadiusY * Uy)^2 = RadiusY^2

How can I find the points where it will be most extreme on each axis

Please keep in mind the values for variables RadiusX, RadiusY, Rx, Ry, Ux, Uy are known.

An example with values:

((x * 1 * 0.70711) + (y * 1 * -0.70711))^2 +
((x * 1.414213 * -0.70711) + (y * 1.414213* -0.70711))^2 = 1.414213 * 1.414213

sentences:
Instantiating problems I'm beginner here, I'm trying to instantiate a single object every specific duration, either form the left of the screen or from the the right, at the same time I want this object to move to the other side of the screen

So the troubles I'm facing here are:

sometimes 2 objects are being instantiated at the same time.
the objects move in the direction that are defined in the first if statement (both objects on the left and the right move in one direction)

the part where I instantiate objects is in the script(smallFishes) that's attached to an empty gameobject is :

void Start () {
    timer = gameObject.AddComponent<Timer>();
    width = 2f;
    timer.Duration = 3;
    timer.Run();
    left = Resources.Load("Left") as GameObject;
    right = Resources.Load("Right") as GameObject;

}
void Update () {

    if (timer.Finished)
    {
        lr = Random.Range(1, 3);
        if (lr == 1)
        {
            var generetx = -8.8f - width / 2;
            Instantiate(left, new Vector2(generetx, Random.Range(-4.8f,4.8f)), Quaternion.identity);
        }
        else
        {
            var generetx = +8.8f + width / 2;
            Instantiate(right, new Vector2(generetx, Random.Range(-4.8f, 4.8f)), Quaternion.identity);
        }
        timer.Duration = 3;
        timer.Run();
    }

}
public int state
{
    get { return lr; }
}

the part where I make the object move from the script that's attached to the object prefab:

void Start () {
    small = gameObject.AddComponent<smallFishes>();
    rb2d = gameObject.GetComponent<Rigidbody2D>();
}

void Update()
{
    var fishes = GameObject.FindGameObjectsWithTag("small");
    if (fishes!=null)
    {
        if (small.state == 1)
        {
            moveright = new Vector2(4 * Time.deltaTime, 0);
            rb2d.AddForce(moveright, ForceMode2D.Impulse);
        }
        else
        {
            moveleft = new Vector2(-4 * Time.deltaTime, 0);
            rb2d.AddForce(moveleft, ForceMode2D.Impulse);
        }
    }
}

Thanks in advance.

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:
Should I use tiles in a snake game? I'm building a simple snake game, which is my first game ever. I'm using LibGDX, which is Java-based.

I've looked at the Tiled Map Editor, but I don't know if it is necessary in a simple game like snake. Is it?

I don't know how to make grid however, and I think that the map editor could make a grid easier than by code? I don't know.

sentences: How to remove a component of an object in a script? I want to remove a Sphere Mesh Renderer component from a certain gameobject. I want to do this in a script. How do I do it? I do not want to destroy the sphere itself, just the component

sentences: Head tracking stuttering/lag/blur issue with Google Carboard I am working on Virtual Reality app. I have created a city terrain and when I move around the terrain using keyboard it move smoothly but when using head tracking I feel a lag/blur when I move or look around the scene using Google Cardboard. How can I improve the performance.Is there any method in unity?

sentences:
How to Ignore Raycast for Boxcollider2D by layer or boolean? How do I ignore raycasts for specific objects?  I want a filter, to ignore raycasts for some objects. As an example, when my player selects the ground, I do not want them to accidentally select bullets.

Is it possible to add boolean to the BoxCollider2D component, to identify raycast targets? I want to make it similar to the Image component.

My problem is that when several objects overlap, I need some of the objects to ignore the raycast.

I can't use Queries Hit Trigger or disable the collider component, because I need them to enter the OnCollisionEnter and OnTriggerEnter methods.

Here is my Update method:

void Update ()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction, Mathf.Infinity,
                1 « LayerMask.NameToLayer("Object"));

        if (hit)
        {
          Debug.Log(hit.collider.gameObject.name);
        }
    }
}

sentences:
PBR How to correcly use standard lighting and IBL I'm creating a physically based renderer but I am a bit confused on how to put together standard lighting with IBL, since like I'm doing now I think it's wrong.

Right now, for each light, I evaluate it's contribution to the scene lighting combined with IBL lighting (I use both the light contribution and diffuse and specular coming from the IBL) but like this I sum the IBL contribution for each light, and I don't think it's right.

To put together standard lighting with IBL, do I need to process all the lights alone and then, in another step, bake into the scene the IBL? I think this would be more correct.

sentences: Can I develop libgdx game with C#? I see some articles through Google that I can use libgdx in C#. Is it true? I found no official and unonfficial about this. If there is a way, please tell me how. Thank you

sentences:
Example of Data Oriented Design I can't seem to find a nice explanation of the Data Oriented Design for a generic zombie game (it's just an example, pretty common example).

Could you make an example of the Data Oriented Design on creating a generic zombie class? Is the following good?

Zombie list class:

class ZombieList {
    GLuint vbo; // generic zombie vertex model
    std::vector<color>;    // object default color
    std::vector<texture>;  // objects textures
    std::vector<vector3D>; // objects positions
public:
    unsigned int create(); // return object id
    void move(unsigned int objId, vector3D offset);
    void rotate(unsigned int objId, float angle);
    void setColor(unsigned int objId, color c);
    void setPosition(unsigned int objId, color c);
    void setTexture(unsigned int, unsigned int);
    ...
    void update(Player*); // move towards player, attack if near
}

Example:

Player p;

Zombielist zl;
unsigned int first = zl.create();
zl.setPosition(first, vector3D(50, 50));
zl.setTexture(first, texture("zombie1.png"));
...

while (running) { // main loop
    ...
    zl.update(&p);
    zl.draw(); // draw every zombie
}

Or would creating a generic World container that contains every action from bite(zombieId, playerId) to moveTo(playerId, vector) to createPlayer() to shoot(playerId, vector) to face(radians)/face(vector); and contains:

std::vector<zombie>
std::vector<player>
...
std::vector<mapchunk>
...
std::vector<vbobufferid> player_run_animation;
...

be a good example?

Whats the proper way to organize a game with DOD?

sentences:
iPhone Game framework on top of cocos2d? I am using cocos2d to develop iPhone game, however, it is just an 2D engine and developer is too flexible to use them - i.e. codes tends to be unmanageable.

Are there any more high level framework for game development, perfer using cocos2d?

sentences:
Triggering an animation on a gameobject with a collider2D I'm creating platforms that break on trigger. The animation works and the colliders are set like they should, but I can't seem to figure out how to trigger the "stepBreak" animation I have.

This is what I have, so far:

using UnityEngine;
using System.Collections;

public class breakablePlatforms : MonoBehaviour
{
    public GameObject steps;
    private Animator animator;

    void Start()
    {
        animator = GetComponent<Animator>();
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        if(other.tag == "Player")
        {
            animator.Play("stepBreak")
        }
    }
}

These are my animations and transitions:

sentences:
Is it possible to interpolate different sprites? I can interpolate different animations based on position, rotation, and scale.  I want to do the same for different sprites, automatically.

For example, lets say I have a soda can being crushed.  I have 2 sprites:  One is the soda can uncrushed, and one is the soda can fully crushed.  I want to only use those 2 sprites, and have Unity automatically transition from the normal can to the crushes can.

How can I do this without making a bunch of key frames in between?

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:
Platform game: applying gravity and jumping I am making a 2D platform game in Java but I don't know how to apply gravity and jumping on my player and other living creatures in game that it looks natural and that it is physical correct.
I have formula: speed = v0 + gt^2/2
but i don't know how to implement it in my code...

Thanks for any help.

sentences:
Animated dice framework for XNA? I'm looking for a reusable 3d animated dice component I can reuse in my XNA board game.

I know it might be wishful thinking in hoping such a component exists, but at the same time worthwhile checking.

I'm looking for something that can give a realistic dice animation and return the dice result that matches the animation.

Does such a thing exist?

sentences:
Why is there no standard 3d file format that saves models as (collections of) primitives? I have been looking around for a file format that saves models as a collection of primitives (Boxes, Spheres, Cones, Cylinders, etc.). After some research, I came to the conclusion that pretty much every standard available file format saves models as a collection of vertices and indices (and some other stuff like UVs & materials).

Real world example
Why would one need a file format that saves primitives? Well, in my case, I am trying to build a game where I will need to import the physics separately. Since physics are optimized per primitive type, I would deem it wise to not just import everything as a mesh collider but make use of these optimizations.
For context, I am using Three.js with Ammo.js (Bullet) running server-side.

Standard
So the question really is, why is there no standard for this? Why isn't there a standard like SVG but for 3d models? I will probably end up writing my own format / implementation, so it's not like it's holding me back. It's just that I am a bit cautious, since I feel that there probably is a reason for no such standard to exist.

Related links
Here are some links I came across during research:
http://wiki.laptop.org/go/Physics_File_Format
http://bulletphysics.org/mediawiki-1.5.8/index.php/Bullet_binary_serialization

Edit:
Since comments aren't for thanking people, I'll just do that here. Thanks to all of you that answered and commented, very insightful! Much appreciated!

sentences:
Unity: How do I fix the players model rotation in a NetworkManager to spawn properly? How do I fix the players model rotation in a NetworkManager to spawn properly?

I created a game with the NetworkManager code.
Player Model is a cone I made and imported.

all works fine but when the NetworkManager spawns the player model it is sideways.
I have tried turning it in 3ds but the player remains sideways when it is spawned by NetworkManager on run, Ohterwise the model is fine in unity, and no matter how I rotate it, in or out of unity , The NetworkManager Rotates it.
All other objects attached to the main object remain with proper orientation all, All other objects including instantiated ones appear properly.

sentences:
My generated texture is flipped I'm learning OpenGL and I don't understand why my texture is flipped if I give
as UVs the "matching" vec2 of the mesh's vertex (vec3).

Example:

vert -256 -256
uv   0    0

vert 256 256
uv   1    1

I've had to try a different order for the UVs to be able to get the correct result...

Can someone explain why is that so?
Thanks.

Screenshots:
http://imgur.com/a/49ZVp

This are the snippets of code I use:

// Create texture
GLuint texDebugId;

// RGBA Texture:
// R G
// B A

unsigned char texDebugBuf[] = {
    255, 0, 0, 255,
    0, 255, 0, 255,
    0, 0, 255, 255,
    0, 0, 0, 0,
};
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &texDebugId);
glBindTexture(GL_TEXTURE_2D, texDebugId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, texDebugBuf);
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);

//------------------------------

// Prepare VBOs
static const GLfloat verts[] = {
    -256.0f, -256.0f, 0.0f,
    256.0f, -256.0f, 0.0f,
    -256.0f, 256.0f, 0.0f,
    256.0f, 256.0f, 0.0f
};

/*
// FLIPPED (but why?)
static const GLfloat uvs[] = {
    0.0f, 0.0f,
    1.0f, 0.0f,
    0.0f, 1.0f,
    1.0f, 1.0f,
};
*/

// OK
static const GLfloat uvs[] = {
    0.0f, 1.0f,
    1.0f, 1.0f,
    0.0f, 0.0f,
    1.0f, 0.0f,
};

// Upload vertices
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);

// Upload UVs
glBindBuffer(GL_ARRAY_BUFFER, vbo_tex_id);
glBufferData(GL_ARRAY_BUFFER, sizeof(uvs), uvs, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);

//------------------------------

// Render
glBindTexture(GL_TEXTURE_2D, texId);

glEnableVertexAttribArray((GLuint) pd.vertex_a);
glEnableVertexAttribArray((GLuint) pd.uv_a);

// Vertices
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
glVertexAttribPointer(
    (GLuint) pd.vertex_a,  // attribute id
    3,                     // size
    GL_FLOAT,              // type
    GL_FALSE,              // normalized?
    0,                     // stride
    (void *)0              // array buffer offset
);

// UVs
glBindBuffer(GL_ARRAY_BUFFER, vbo_tex_id);
glVertexAttribPointer(
    (GLuint) pd.uv_a,      // attribute id
    2,                     // size
    GL_FLOAT,              // type
    GL_FALSE,              // normalized?
    0,                     // stride
    (void *)0              // array buffer offset
);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glBindBuffer(GL_ARRAY_BUFFER, 0);
glDisableVertexAttribArray((GLuint) pd.uv_a);
glDisableVertexAttribArray((GLuint) pd.vertex_a);

glBindTexture(GL_TEXTURE_2D, 0);

Note:

proj matrix:
proj = glm::ortho(-320, 320, -240, 240, -1.0f, 100.0f); // 640x480 with 0,0 at center

camera matrix:
cam_target = glm::vec3();
cam_up = glm::vec3(0.0, 1.0f, 0.0f);
cam_pos = glm::vec3(0.0f, 0.0f, 5.0f);
camera = glm::lookAt(cam_pos, cam_target, cam_up);

MVP matrix:
glm::mat4 mvp = proj * camera;

sentences:
How do I use warble to package libgdx and ruby? My ruby code is as follows

include Java

Dir[File.expand_path "#{File.dirname(__FILE__)}/../libs/\*.jar"].each { |x| require x; puts "go"}

module LibGDX
        include_package "com.badlogic.gdx"
        include_package "com.badlogic.gdx.backends.lwjgl"
        include_package "com.badlogic.gdx.graphics"
end

class Game
        include LibGDX::ApplicationListener

        @LOG = Game.java.simple_name

        def create
                LibGDX::Gdx.app.log(@LOG, "Is a thing")
        end

        def resize width, height
                LibGDX::Gdx.app.log(@LOG, "Resizing game to #{width} by #{height}")
        end

        def render
                LibGDX::Gdx.gl.glClearColor(0, 0, 0, 0)
                LibGDX::Gdx.gl.glClear(LibGDX::GL20.GL_COLOR_BUFFER_BIT)
        end

        def pause
                LibGDX::Gdx.app.log(@LOG, "Pausing")
        end

        def resume
                LibGDX::Gdx.app.log(@LOG, "resuming")
        end

    def dispose
            LibGDX::Gdx.app.log(@LOG, "disposing")
    end
end

listener = Game.new

width = 800
height = 600

useOpenglES2 = false;

game = LibGDX::LwjglApplication.new(listener, "Game", width, height, useOpenglES2)

If I run this through jruby it works just fine but if I package it up with warble it skips all of the Game class's initialization and tells "AL lib: alc_cleanup: 1 device not closed" and stops.

Does anyone know the proper way to build a libGDX project with jruby and warble?

P.S. I know this seems like a very localized problem but I'm asking how to use jruby and libgdx with warble using my program as an example so... I think it's more broad then it seems... still getting used to stackexchange.

sentences:
Game running with fewer steps than desired (game created in GameMaker) I tested my game on 4 different computers and got some results.

PC 1 => AMD A4-6300 APU with Radeon HD Graphics / 2,0 GB RAM / AMD Radeon HD 8370D

In this computer I tested a few stages and I noticed a loss of 1 second in 10, ie ... In the game 10 seconds passed while here in the real world 11 seconds passed.

I calculate the time in the game based on the step event.

I set the speed of the room by default as 30.

Time code:

Step Event: currentTime+=1;

Draw Event: draw_text(x,y,string(currentTime/30));

On my computer I never had problems. Hence the need to test the game on other computers.

PC 2 => Pentium Dual-core CPU E5700 @ 3.00GHz / 4,0GB RAM / Intel G41 Express Chipset

On this computer, I performed the same tests and I detected a slightly smaller loss. Less than 1 second every 10 seconds, ie ... In the game 10 seconds passed while here in the real world 10.7 / 10.8 seconds passed.

PC 3 => Intel core i3-3217U CPU @ 1.80GHz / 4GB RAM Intel HD Graphics 4000

Worked perfectly! It's a core i3 right? I did not detect any apparent losses.

PC 4 => Intel Core 2 Duo CPU e8200 @ 2,66GHz 2,66GHz / 4GB RAM

Worked perfectly! I did not detect any apparent losses.

Detail that in this computer the game lost enough in resolution (it seems that the monitor is too large for the components of the computer).

Post with the problem => Game was resized incorrectly for no apparent reason (GameMaker)

Important!

I put a function on the shift key to accelerate the game (it would be a function for the players who wanted to analyze all the course of the stage, just playing to understand) and I defined that when clicking on the shift key the speed of the room goes to 3000 steps. On my PC the game is super fast, but I doubt it reaches exactly 3000 steps. Even so, a few hours pass in a few minutes here at home.

On PC 1 I tested this same function and accelerated by approximately 20%. In the game it was 11 seconds while 10 seconds passed in the real world.

Solutions:

1=> Stop measuring time through the steps.

I imagine there is some way to do time measurement based on another type of argument, just like unity timeDeltaTime.

That way, I imagine that a player with a GTX 1080 the game works correctly and phase 1 finishes in exact 11.23 seconds (real time).

But a player with a humbler computer that same phase finishes with 13 or 14 seconds (real time). It turns out that the same phase that lasted 11.23 seconds on the computer with a GTX 1080, it would take longer to be finalized on that more humble computer. The time was going to be measured correctly (13/14 seconds in the game), but the game was going to be running in different ways (different speeds).

2 => Based on the boost (shift key) I tested on PC 1 (the humblest computer I tested) I see that it is possible to force the game to rotate in a number of steps even on that weaker computer.

I think that using solution 2, when I make the online mode available, I may have problems (just like Fallout 76), people with a good computer could change the steps of the game and make the game work in a much larger number of steps.

The ideal would be to join the two solutions, so that time is measured regardless of the number of steps, but that the operation of the game is the same on any computer.

sentences:
Custom VertexDeclaration for Color, Texture, Normal What is the best way to create a VertexDeclaration, that makes it able to render a Shape consisting of vertices and also be able to store a color for the shape (in case the texture can't be rendered - or in case we want color instead of a texture) - instead of having both a VertexPositionNormalTexture and a VertexPositionColor struct in the same class/struct.

I'm trying this approach:

public interface IShape : IVertexType { }

public struct ShapeFace
{
    public int Count { get; set; }
    public Color Color { get; set; }
    public Vector3 Position { get; set; }
    public Vector2 TextureCoordinates { get; set; }
    public Vector3 Normal { get; set; }
    public Vector3[] Vertices { get; set; }

    // Perhaps I need this?
    // public int[] Indexs { get; set; }
}

public struct Shape : IShape
{
    public ShapeFace[] Faces { get; set; }

    /* Need to implement VertexDeclaration here */
}

How do I implement the VertexDeclaration to understand what I want to do?

A shape contains faces, each face can have it's own texture OR color, normal mapping, texture coordinates, etc.

Example A cube has 6 faces, each face needs 2 triangles, each triangle has 3 points. 6 * 2 * 3 = 36 vertices. This way I can create a cube with 6 faces instead of 36 vertices, and render it in color or with a texture.

I really want to simplify it so that I can create some kind of struct that works this way.

sentences:
Added tiles not loading in run time So I have a game object MapGenerator and 2 attached scripts: MapGenerator.cs and Lexicon.cs.
I need to be able to access a couple variables in Lexicon.cs from MapGenerator.cs, so I imported it with:
void Awake()
{
    GameObject gameObject = new GameObject("Lexicon");
    lexicon = gameObject.AddComponent<Lexicon>();
}

Now, this allows me to pull variables from Lexicon, and I am able to do that successfully for the most part. However, the public fields that are being set from Unity (tiles/sprites) are not being pulled in. They just show up as null.
Example scenario:
public class Lexicon : MonoBehaviour
{
public Tile thiccTile;
public Tile thiccTile2;
public Tile thiccTile3;
private string fact = "Yummy porchop";
private string favoritefact;
private Tile favoritetile;

 public Lexicon() {
  favoritetile = thiccTile2; //this guy is public and set in unity under components.
  favoritefact = fact;
 }

public Tile Favoritetile { get { return favoritetile; } set { favoritetile= value; } }
public string Favoritefact { get { return favoritefact; } set { favoritefact= value; } }

}
Start() {
UnityEngine.Debug.Log(lexicon.Favoritefact); //"Yummy porchop"
UnityEngine.Debug.Log(lexicon.Favoritetile); // null
}

My first thought was it was because I never explicitly call Lexicon(). However, since favoritefact works, im guessing the gameobject stuff is enough? Anyway, how can I fix this?
EDIT: This is where I set the values (Different variable names but you get the idea)

sentences:
How to create a line that is always connected to two Objects. (iPhone, Cocos2d) I'm wanting to create a rope like animation effect. I don't need any kind of rope physics, all I need is a straight line connected to Object A and the other end connected to object B. Object A and B move relative to one another. So how do I make it so that the line is always attached to both Objects, even thought the distance between the objects decrease and increase?

The game is in 2D space.

sentences: Psudo 3D(2.5D?) Projectile motion I'm trying to simulate a ball coming at the screen with a projectile motion arc in 2d space. Is there a set of equations to deal with this.  I would imagine the equation would need to take in the  initial vertical and horizontal angles of the projectile as well as it's initial velocity and the desired start and end scale of the projectile.

sentences:
How do I fix missing anti-aliasing in the Unity scene view and game? Both the editor and the game seem to lack anti-aliasing even though quality is set to Ultra.
I chose the "3D" project template when I created the project, so I am using the build-in render pipeline.

sentences:
is unity DOTS mature enough to build a whole project on it? maybe you assume this question opinion based but its not. please read the whole question.
the question has 2 aspects.

are all features implemented? just better say, can i do everything or any gameplay i did on monobehaviours, on the DOTS? all are needed features implemented? including Ai, navigation, physics, animations and...

the bigger problem about DOTS and ECS is software engineering. DOTS gives us much better performance in memory and performance and parallel processing but it takes all good OOP practices from us.

as you may know, DOTS is not OO and uses its own architectures. most of references values are gone in dots to make data more compact. so there is no solid principles. dependency injections and all those OO design patterns. instead we have a hardly coupled code and entities.
the question is: does DOTS and ECS really lacks software engineering or its just we dont know enough about it and there are standards about it?
many people say that you should make all project on old monobehaviours and you can migrate section that are expensive to DOTS.
im not really sure what is the right approach for using with new technology.

sentences:
How to calculate spherical harmonic coefficients for indirect diffuse? After reading the article "An Efficient Representation for Irradiance Environment Maps", I'm a bit confused as how to calculate the spherical harmonic coefficients.  I'd like to generate these coefficients given a cube map that I've generate dynamically in engine.

I'm currently using DirectX 11, but I have some familiarity with OpenGl. Some tips on calculating these coefficients would be greatly appreciated!

sentences:
White background on BitMapFont I've tried placing a white "background" on a font that is being rendered with LibGDX, with no success.

I'm using the font.draw to draw the loaded font on the screen, but every way that I tried, the font only contains a black border and is transparent on "the inside".

I'm using Hiero to make the .fnt from .ttf files that libGDX uses to render the fonts. Is there anyway I should modify from this application to make a font have a white background and not be transparent?

I would like to display the font the second way, although that display that you are seeing is just from the Hiero app preview option (with specific background).

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:
How can I create a large space background that repeats, in an unnoticeable way How can I create a large space background that repeats for an rts game. I want to have complex nebulae and dust fields also, but since the units will have lots of space to explore I can't have a 120000px by 1200000px jpeg, so I want to have the image repeat, but not have change lines between segments.

I'm using this with Babylon framework by Microsoft for web GL canvas

sentences:
How does delta compression reduce the amount of data sent over the network? Many games use the technique of delta compression in order to lower the data load sent. I fail to understand how this technique actually lowers the data load?

For example, let's say I want to send a position. Without delta compression I send a vector3 with the exact position of the entity, for instance (30, 2, 19). With delta compression I send a vector3 with smaller numbers (0.2, 0.1, 0.04).

I don't understand how it lowers the data load if both of the messages are vector3 - 32 bit for each float - 32 * 3 = 96 bits!

I know you can convert each float to a byte and then convert it back from a byte  to float but it causes precision errors which are visible.

sentences:
Entity component systems and DDD: violation of encapsulation? I'm using a hybrid of DDD (domain-driven development) and an entity-component system. That is to say:

I have an Entity class with a list of Components, and the ability to add/remove/get components
I have component instances like HealthComponent (health and is-alive), DrawComponent (position + display), etc.
System instances (like DrawSystem) that find a bunch of components and operate on them

I also have "domain objects" like Player and Monster, which subclass Entity. Their constructors usually add a bunch of components.

Since I'm a fan of the DDD idea of objects represent business/game entities, I model my classes around that. For a roguelike, my Player class has methods like:

Attack(Monster)
GetX and GetY (delegates to the position component)
LevelUp
RegenerateHealth
And others

It seems to me that the components are a white-box internal detail; they shouldn't be known to any outside objects. In fact, domain objects should operate on other domain objects (eg. Player.Attack(Monster)).

Most (if not all) of my actual game code operates on entities, not components. My tests usually do something like:

Create an entity
Grab a certain component
Verify that it meets expectations

In general, this raised a question in my mind: isn't this a violation of encapsulation? Aren't components just an internal implementation detail of entities (that could change or disappear at any time)?

On the other hand, I have a lot of delegation, which seems useless (like Player.getX() is just Player.get(DisplayComponent).getX()).

This seems confusing. Can someone provide some clarity? What is the right mix of DDD, encapsulation, and entity/component composition?

sentences: How can I take a screenshot of a certain part of the screen in PyGame? I need to for my pixel art tool that I'm making to help myself make games.

sentences:
Creating a WARP device in managed DirectX I have a very old graphic card that only supports shader model 2, but I need shader model 3 or up for the app I am developing. I tried to use a reference device but it seems to run very slowly, then I found some samples in C++ that allows me to change to a WARP device and the performance is good. I am using C# and I don't know how to create such type of device.
So the question is: how do I create a WARP device in C#?
Thanks in advance.

sentences:
Textures quality issues with Libgdx I have drawn several vector objets and characters ( in Adobe Illustrator ) for my game on Android. They are all scalable at any size without any quality losses ( of course it's vector ^^ ).

I have tried to simulate my gameboard directly on Illustrator just before setting my assests on libdgx to implement them in my game.

I set all the objects at the good size, so that they fit perfectly on my XHDPI device I am running my test on.

As you can see it works great ( for me at least ^^ ), the PNG quality is good for me, as expected !

So I have edited all my PNG at this size, set my assets on libgdx and build my game apk.

And here is a screenshot of my gameboard ( don't pay attention at the differences of placing and objects, but check at the objets presents on both screenshot ).

As you can see, I have a loss of my PNG quality in the game.
It can be seen clealry on the hedgehog PNG, but also ( but not as obvious ) on the mushroom ( check at the outline ) and the hole PNG. If you really pay attention, on every objects, you can see pixels that are not visible on my first screenshot.

And I just can't figure out why this is happening Oo
If you have any ideas, you are very welcome !

Thanks.

PS : You can check more clearly the 2 gameboard on this two links ( look at them at 100%, display at high resolution ) :

Good quality link, from Illustrator

Poor quality link, from the game

Second phase of tests :

We display an object ( the hedgehog ) on our main menu screen to see how it looks like.
The things is that it looks like he is suppose to, which means, high quality with no pixels.

The hedgehog PNG is coming from an atlas :

layer.addActor(hedgehog);

No loss of quality with this method

So we think the problem is comming from the method we are using to display it on our gameboard :

blocks[9][3] = new Block(TextureUtils.hedgehog, new Vector2(9, 3));

the block is getting the size from the vector we are associating to it, but we have a loss of quality with this method.

sentences:
Proper way to encapsulate components? I've tried my hand at writing component systems and entity systems.

What I haven't managed to solve is the problem of event collision.

Say, we have an components A,B and C. A triggers 'kill B' event. When B recieves it, it erases the message (doesn't propagate it further). When C recieves it, it erases B. The order of which component will get the event first is not defined.

When the order is 'A,B,C', B stays alive but with 'A,C,B' B is erased. In other words, side effects of the event are undefined. A,B and C need to know about each other (which I don't want) to handle the event properly.

I intend to use components for games so for a more substantial example: we have an arrow (Projectile component) which fires of a collision event upon striking Link (Collidable component). Link has shield (also Collidable) which stops damage from affecting Link's Health component.

Arrows and health were written without the shield in mind and my component architecture is supposed to be encapsulated, so Health processes the collision event without knowing about the arrow or shield. Whether or not the damage is stopped depends on the order of components, which is random.

The best I've came up with is keeping a 'cache' of actions the event will do at the end of processing but still this solution has the same problems, only delayed. I could ditch events and try entity component system with storing 'mutations' in systems but that's not much different from just using global data for everything.

EDIT:

Okay, my communication skills are terrible. Here's what I've done to make components working without knowing about each other:

Use 'pure' entity system (components are pure data, all logic in systems)
Components do not talk to each other. The systems talk to each other by adding system-exclusive components to entities
Systems for above situation are: Movement, HandleCollision, ApplyArrowDamage. Movemen t appends a Collision component to the 'reciever' of the collision (Link) when calculating movements. HandleCollision reacts to Collision component, appends ArrowDamage component to Link entity and removes Collision component from Link. ApplyArrowDamage does just that and removes ArrowDamage component and maybe appends Dead component to be handled elswere.
Now, to create the situation when the shield blocks arrows, I create an CheckShield system and place it between HandleCollision and ApplyArrowDamage. CheckShield works with ApplyArrowDamage, checks whenether the reciever (Link in this case) has a shield equiped and removes ArrowDamage component if so.
This way, my old code doesn't need to account for new code to work properly and vice versa.

For the 'ABC' situation I do the same: If I want C to erase B, I write a new system that works with C and fires off before the system that works with B.
The only sane way to solve this problems with event raising is to keep rethrowing the event whenether it's state changed, and keep rethrowing it until it doesn't changed in the last iteration.

sentences:
Incrase framerate in XNA I'm trying to increase the frame rate of my game from 60FPS to 100 FPS because of reasons. But i can't seem to get it higher than 60 frames. This is the count I'm using. I can slow down the frame rate by setting TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);

to a higher value, but settings it lower won't increase the frame rate, according to the counter. Anyone have any idea what's going on?

sentences:
Drawing faded lightmap in 2D polygon I have been making a 2D visiblity algorithm by following this tutorial http://simblob.blogspot.se/2012/07/2d-visibility.html

I have managed to create the light vertices and it works fine when I draw it in a single color, but I want to use a shadow map to get "faded" lights like this:

Mine looks like this now:

where the blue dot is the light center and the green is the lighted area.

How can I "apply" a sprite to this like this one?

My code lies here: http://github.com/doodlemeat/bugfree-octo-sansa

sentences:
Is there a name for this kind of mini-game? (cursor moves on a bar, press key in part of the bar to win) Today I played a game which has a mini-game in it, basically it looks like this:
here's a bar:
----------=====----------

and a cursor moves back and forth on it:
-|--------=====----------  ( cursor "|" moves in this direction -> )

-----|----=====----------

----------===|=----------

----------=====---------|  ( when the cursor reaches the end, it goes back <-)

If I hit a key when the cursor is on the specific part of the bar (which I used the "=" sign to represent), I win. Otherwise I lose.
This kind of mini-game is pretty common as I've seen many variant of it in a lot of games, yet I don't know the name of it. Does it have a name? What's the origin of it?

EDIT: There's an answer mentions QTE. Well... I'm aware of that and I don't think this mini-game belongs in that category thus I avoided using that term. Here's the reason for that:
QTEs have time limits, after all it's Quick time event, this kind of mini-game I'm asking about usually doesn't. Well, I've seen variations of it that does count as lose if you didn't hit the key in some amount of time, it's not the main focus of it.
Unlike how QTEs are all about testing player's reflex, this kind of mini-game is all about precision, as seen in many rhythm games. However, it doesn't necessary have any audible cue like rhythm games do, it's all about learning the pattern/speed of the moving cursor then press the key at the right time.
It's not about how quick you can press a key, but when to press the key. Hence I don't think this counts as a QTE.

sentences:
Issue with variables in GameMaker Studio I am having issues coding a game, in terms of variables in objects. Whgen running i get this error

FATAL ERROR in
action number 1
of  Step Event0
for object obj_text_demo_player:

Variable obj_gameManager.<unknown variable>(100020, -2147483648) not set before reading it.
at gml_Object_obj_text_demo_player_StepNormalEvent_1 (line 1) - if  (obj_gameManager.ammo == 0)

and i have no clue hope to fix this, this is where the code is used.

obj_player (player - where the issue seems to be - STEP EVENT)

if (obj_gameManager.ammo == 0)
{
     obj_gameManager.weapon = "MachineGun";
    obj_gameManager.ammo = 50000;
};

obj_pickup (pickup object - COLLISION /W PLAYER OBJECT)

obj_gameManager.weapon = "Tri-Shooter";
obj_gameManager.ammo = 900;

Obj_gameManager (object variables are from - DRAW EVENT)

global.health = 100;
global.weapon = "MachineGun";
global.ammo = 50000;

draw_healthbar(787,181,1073,231,health,c_white,c_red,c_green,0,true,true);

draw_set_colour(c_blue);
draw_set_font(fnt_speach_new);
draw_text(780, 300, global.weapon );
draw_text(780, 375, global.ammo );

Any help would be massively appreciated, as I'm new to Game Maker Studio. If you need any more info I'm happy to add it.

sentences:
In what kind of variable type is the player position stored on a MMORPG such as WoW? I even heard J. Carmack quickly talk about it...

How a software can track a player's position so accurately, being on a such huge world, without loading between zones, and on a multiplayer scale ? How is the data formatted when it passes through the netcode ?

I can understand how vertices are stored into the graphic card's memory, but when it comes to synchronize the multiplayer, I can't imagine what is best.

sentences:
Unity ScriptableObject Conversation Dialogue and Reading I'm unsure as to how I would reference a scriptable object's variables within a struct from another class. I know I'd have to make a public Conversation, but I'm stuck understanding how I could access it's struct, and how I could access individual variables such as the Position, or line string array.
Is this method even viable or should I look at creating a different way of accomplishing a dialogue conversation scriptable object?
Thanks for any insights and help~
My current code:
[System.Serializable]
[CreateAssetMenu(fileName = "New Conversation", menuName = "Create/Conversation", order = 1)]

public class Conversation : ScriptableObject
{
    [System.Serializable]
    public struct LineData
    {
        public string[] line;
        public string[] option;

        public enum Position
        {
            BottomLeft,
            BottomCentre,
            BottomRight,
            MiddleLeft,
            MiddleCentre,
            MiddleRight,
            TopLeft,
            TopCentre,
            TopRight
        }

        public Position position;

        public enum TextSpeed
        {
            Normal,
            Slow,
            Fast,
            UltraFast
        }

        public TextSpeed textSpeed;

    }
    public LineData[] Line;

}

```

sentences:
How can I apply a "genie animation" to a CCSprite? I am new to Cocos2D and following this tutorial.

I want to animate a CCSprite with the genie effect that OS X uses for hiding windows to the dock and showing them again.

Here's an example from an iOS library:

How can I do this in Cocos2D?

sentences:
How do I implement features in an entity system? After asking two questions about entity systems (1, 2), and reading some articles on them, I think that I understand them much better than before. I still have some uncertainties, mainly about building a particle emitter, an input system, and a camera. I obviously still have some problems understanding entity systems, and they might apply to a whole other range of objects, but I chose these three because they are very different concepts, should cover a pretty broad ground, and help me understand entity systems and how to handle problems like these, myself, as they come along.

I am building an engine in JavaScript, and I've implemented most of the core features, which include: input handling, flexible animation system, particle emitter, math classes and functions, scene handling, a camera and a render, and a whole bunch of other things that engines usually support. I read Byte56's answer, that got me interested into making the engine into an entity system. It would still remain a HTML5 game engine, with the basic scene philosophy, but it should support dynamic creation of entities from components.

The problem I have, now, is fitting my old engine concept into this new programming paradigm. These are some of the definitions from the previous questions, updated:

An Entity is an identifier. It doesn't have any data, it's not an object, it's a simple id that represents an index in the scenes list of all entities (which I actually plan to implement as a component matrix).
A Component is a data holder, but with methods that can operate on that data. The best example is a Vector2D, or a "Position" component. It has data: x and y, but also some methods that make operating on the data a bit easier: add(), normalize(), and so on.
A System is something that can operate on a set of entities that meet the certain requirements; usually the entities need to have a specified set of components, to be operated upon. The system is the "logic" part, the "algorithm" part, all the functionality supplied by components is purely for easier data management.

Camera

The camera has a Vector2D position property, a rotation property and some methods for centering it around a point. Each frame, it is fed to a renderer, along with a scene, and all the objects are translated according to its position. The scene is then rendered.

How could I represent this kind of an object in an entity system? Would the camera be an entity, a component, or combination (as per my answer)?

Particle Emitter

The problem I have with my particle emitter is, again, what should be what. I'm pretty sure that particles themselves shouldn't be entities, as I want to support over 10,000 of them, and I believe that creating that much entities would be a heavy blow on my performance.

How could I represent this kind of an object in an entity system?

Input Manager

The last one I want to talk about is how input should be handled. In my current version of the engine, there is a class called Input. It is a handler that subscribes to the browsers events, such as key presses and mouse position changes, and also maintains an internal state. Then, the player class has a react() method, which accepts an input object as an argument. The advantage of this is that the input object could be serialized into .JSON, and then shared over the network, allowing for smooth multiplayer simulations.

How does this translate into an entity system?

sentences:
Correct rotation with Quaternion I have some problems with a rotating marble.
I've tried it with Matrix.CreateFromYawPitchRoll and Matrix.CreateRotation but there were some problems, I think it's due to the Gimbal lock effect.

So, I've tried using quaternions instead, but nothing changed.
When moving on only an axis it works fine, but when the rotation occurs on two different axes the marble still rotates on wrong axes.

Here's my code:

// declarations
Vector3 Position = Vector3.Zero;
Vector3 Rotation = Vector3.Zero;
Quaternion qRotation = Quaternion.Identity;

AbsoluteBoneTransforms = new Matrix[Model.Bones.Count];
            Model.CopyAbsoluteBoneTransformsTo(AbsoluteBoneTransforms);

In the Update method:

Position += speed;
Rotation = speed * MathHelper.ToRadians(-1.5f);

Quaternion rot = Quaternion.CreateFromAxisAngle(Vector3.Right, Rotation.Z) *
                Quaternion.CreateFromAxisAngle(Vector3.Backward, Rotation.X);

qRotation *= rot;

And in the Draw method:

effect.World = AbsoluteBoneTransforms[mesh.ParentBone.Index] *
  Matrix.CreateFromQuaternion(qRotation) * Matrix.CreateTranslation(Position);

What's wrong?

EDIT

I've tried calculating directly the axis of rotation of my marble, instead of using combination of multiple axes:

angle += speed.Length() * angularVelocity;
qRotation = Quaternion.CreateFromAxisAngle(Vector3.Cross(speed, Vector3.Up), angle);
qRotation.Normalize();

angle is a float that keeps track of the current movement.
This solution doesn't seem to create Gimbal lock, but marble rotations aren't correct, it seems that the rotating speed is not constant, but became faster and slower over time, I can't understand why.

sentences:
How to implement the swipe up and down number select Unity3d I want to implement the UI like in the image.
I want the users to select the number by swiping up and down.
I found the tutorial on the YouTube which is similar to the what i wanted (https://www.youtube.com/watch?v=mL-FLsV3WRs)
But it shows only the numbers from 0 to 9. I want to show from 1 to N (n can be any number).
Any idea to help me to get this would be great.

sentences:
Large Scale GIS in a AAA-Quality Game Engine? (Unreal, Cryengine, Unity, Etc.) I am working on a new simulation project that requires large scale, real-world terrain and imagery (GIS).  By large scale, I mean that I would like to support databases that cover something on the order of 10,000 square miles that include at least height data and satellite imagery.  Using data of this size also means that the engine must be capable of managing the coordinate systems/projections such that some reasonable precision can be maintained.

To my knowledge OpenSceneGraph is the only graphics engine out there that makes this easy (via paged terrain support, osgEarth, etc.)  However, it would be nice to be able to leverage many of the other great features AAA-quality game engines bring to the table.  (OSG is just a graphics engine, really.  I've been using it for over a decade, but I don't want to be fixed only to what I know.)

I've seen many tutorials online for importing small postage-stamp sized bits of terrain into Unreal.  I haven't seen anything on this scale.

Asked here: "Very large terrains in Unreal-4" there is a link to Unreal's "World Composition" feature.  This seems to shift coordinates around and also doesn't seem geared towards using real-world data.

How can I represent real-world terrain data on these scales in a mainstream game engine?

sentences:
Rotate Sprite towards mouse cursor SDL I have trouble to make my sprite(Arrow) to point at the position of my mouse cursor but i don't get the Right results. I've tried this:

SDL_Point Center{ 40,40 };
int Delta_x; int Delta_y;
int mouse_x, mouse_y;
double Result;
SDL_GetMouseState(&mouse_x, &mouse_y);
Delta_x = xPos - mouse_x;
Delta_y = yPos - mouse_y;

Result = (atan2(Delta_x, Delta_y) * 180.0000)/ 3.14159265;
m_Sprite->Render(Result, Center);

RendercopyEx:

SDL_RenderCopyEx(m_Renderer, m_Texture, NULL, &m_Rect, Angle , &Center, SDL_FLIP_NONE);

This is the result I get (in the original picture, the arrow is pointing up):

sentences:
How do multi-platform games usually store save data? I realize this is a bit of a broad question, but I was wondering if there is a "standard" in the industry when it comes to storing save data for games (and is it different across platforms - Xbox/PS/PC/Mac/Android/iOS?)

For example for a game like Assassin's Creed or The Walking Dead: They are on multiple platforms and they usually have to save enough information about the player and their actions. Do they use something like XML files, databases, or just straight binary dumps? How much does it differ from platform to platform?

I would appreciate it if someone with experience in the game industry would answer this.

sentences: How to select parent of currently selected object? When i select an object, i can't find a function to select its parent. Does this basic feature exist ? I want to select the parent of selected object and then step up to find parent of parent so on without using the hierarchy window.

sentences: How to change the geometry of the scene in Unity? I'm trying to experiment with 3D spherical geometry in Unity, but it seems like Unity objects are inherently set in flat space. My first idea was to create a class inheriting from Transform that would override most of the methods, but I discovered that the transform member of a game object is read only so I cannot replace it with my custom class. I know this sort of thing is possible because the game Hyperbolica is being built in Unity using curved space. I have the math all figured out, I'm just not experienced with Unity. Anyone have other ideas for things I could try?

sentences:
Render a 3D scene in multiple windows - extended panoramic view Is there any resource location on how to view a 3D scene from an application or a game on multiple windows or monitors? Each window should continue drawing from where the neighbouring one left off (in the end, the result should be a mosaic of the scene).

My idea is to use a camera for each window and have a reference position and orientation for a meta-camera object that is used to correctly offset the other cameras (e.g. like in the above figure where the render targets of the two cameras reproduce the star when stitched together). Since there are quite some elements to consider (window specs, viewport properties, position-orientation of each render camera), what is the correct way to update the individual cameras considering the position and orientation of the central, meta-camera? I currently cannot make the cameras present the scene contiguously (and I am reluctant in working out the transformations without checking whether this is the actual way of doing things).

sentences:
Is it worth it to use Bullet for 2D physics instead of Box2D for the sake of learning Bullet? There isn't much more to the question. I'm not concerned about overhead, as I'm sure they are both fine for my purposes. Basically, I am familiar with Box2D concepts because of the Farseer Physics Engine, but I want to use Bullet when I make the jump to 3D stuff. Perhaps Bullet has some educational value for me even in the 2D realm?

The generalized version of the question is: should I use a 3D physics engine for a 2D game if I plan to utilize a 3D physics engine in the future? Or is this a waste of time which would not provide educational value?

sentences:
Match Making Groups of Players Given a situation where I have a pool of X people of different scores (ranks) S with game size N. How do I partition the pool into N sized games where the standard deviation of ranks for each games is minimized?

(quality of the game is inversely proportional to STD of ranks)

sentences:
What is the ideal way to separate presentation and logic, and when is it OK to combine them? I'm still somewhat new to "proper" design, but I'm trying to keep with it as much as possible. I thought I was OK but I've run across a slight dilemma: how should I be implementing the actual drawing and updating of entities?

For example, in my project I have a TextBox class. The 'easy' way, and the way that I usually see in tutorials across the Internet, are to give this class its own Update() and Draw() methods. But I don't think my textbox class should have to know anything about how it's being drawn, so I thought it might be good to make it implement some kind of Drawable interface, but even that still involves implementing drawing code.

So I thought of adding all my TextBoxes to a List<TextBox> that a drawing class would load to handle the drawing, but then I realized that my TextBox class itself doesn't (and shouldn't?) have a Draw() method within the class, so I would have to write a sister method in the graphics implementation somewhere as a DrawTextBox() or something like that. I guess this COULD work, but I can't shake the feeling that having to have this kind of coupling of classes is bad practice.

So where should I ultimately be placing the code to draw, and where should I have the logic behind it? A TextBox, for example, involves drawing multiple elements, and it's timed because it's a typewriter-style output, and I eventually want to add in-text commands for delays and sound. Should I include some of this stuff in the main class? Have a Draw method in some graphics class somewhere else? And then later dealing with timing and sound, how should I be separating all of it?

sentences:
Unity Redraw canvas graphic on Update() using UnityEngine;
using UnityEngine.UI;

public class DrawLoad : Graphic
{
    protected override void OnPopulateMesh(VertexHelper vh)
    {
        //==========================
        float r = rectTransform.rect.height / 2.0f;
        //float widthFactor = (rectTransform.rect.width / 2.0f) - r;
        float y = r;
        float x = 0.0f;
        int t = 20;                     // t = total vertices
        float a = 360.0f / (t-1);       // angle delta/differences between each vertex
        float aC = 0.0f;                // incrementing angles  from 0 --> 360
        int maxi = t - 1;
        Vector2[] vtR = new Vector2[t];
        UIVertex[] uivR = new UIVertex[t];

        vh.Clear();

        for (int i = 0; i <= maxi; i++)
        {
            y = r * Mathf.Cos(Mathf.Deg2Rad * aC);
            x = r * Mathf.Sin(Mathf.Deg2Rad * aC);
            vtR[i] = new Vector2(x, y);
            aC += a;

            uivR[i] = UIVertex.simpleVert;
            uivR[i].position = vtR[i];//0,0
            uivR[i].color = Color.green;
            vh.AddVert(uivR[i]);
        }

        // ======== add center point ========
        Vector2 center = new Vector2(0.0f, 0.0f);
        UIVertex c = UIVertex.simpleVert;
        c.position = center;//0,0
        c.color = Color.green;
        vh.AddVert(c);

        for (int i = 0; i <= maxi; i++)
        {
            vh.AddTriangle(t, i, i + 1);// use indexes, don't use count, start from 0
        }

        for (int i = 0; i < uivR.Length; i++)
        {
            uivR[i].color = Color.green;
            vh.SetUIVertex(uivR[i],i);
        }

    }
}

Hi, I wish to change the color dynamically of each assigned triangles.
I have these code modified from Unity documentation and I tried the SetUIVertex method but it doesn't seems to work. What is the proper way to redraw the vertices.
I want to make it in MonoBehavior.Update(). Any helps would be greatly appreciated. Thanks.

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:
Calculate velocity to hit the target on flat 2d surface I am creating a game using Python and Pygame.

I have used this function before (with JS with p5.js and Java with libwjgl, but for some reason it does not work with pygame (I am not sure if it matters here).

I'm trying to hit a static target shot from a moving object.

This is how I am doing this:

def shoot(self):
  posX, posY = 100, 100 # Static target coordinates

  diffX = self.player.x - posX
  diffY = self.player.y - posY

  distance = math.sqrt((diffX * diffX) + (diffY * diffY)) # Calculate the distance

  velX = float((-1 / distance * diffX * 6))
  velY = float((-1 / distance * diffY * 6))

  # Bullet(x, y, width, height, velocityX, velocityY)
  # Will be rendered on the screen
  self.bullets.append(Bullet(self.player.x, self.player.y, 10, 10,  velX, velY))

Updating bullet location:

  def update(self):
    self.bullet.x += self.velX
    self.bullet.y += self.velY

This works perfectly with other languages I have mentioned, but in Python the launched projectile is off...

Here is how it looks. The red square is the target.

THANK YOU, EVERYONE, FOR THE HELP. I really appreciate it :)

sentences:
Enemy walks to the nearest player? I'm trying making my enemy goes to the nearest player to him but what i get is kind of hesitated or shaking. I think is from the first line on Update but i don't know how to solve it. Here is my script

private Animator enemy_anim;
private NavMeshAgent mAgent;
private GameObject[] player;
public GameObject[] dead_point;
public int farPoint, dead_point_number,player_number;
public float dist;
public bool enemt_run, enemy_atack = false;

void Start()
{
    mAgent = GetComponent<NavMeshAgent>();
    enemy_anim = GetComponent<Animator>();
    player = GameObject.FindGameObjectsWithTag("Player");
    dead_point = GameObject.FindGameObjectsWithTag("dead_point"); // 3 points
    enemy_dirction();

}

void Update()
{
    player_number = Random.Range(0,player.Length);
    dead_point_number = dead_point.Length;
    dist = Vector3.Distance(transform.position, player[player_number].transform.position);

    if (player != null && dist <= 5.1f)
    {
        mAgent.destination = player[player_number].transform.position;
        if (dist < 1.2f)
        {
            enemy_atack = true;
        }
        else
        {
            enemy_atack = false;
        }
    }
    else
    {
        if (dead_point_number > 0)
        {
            mAgent.destination = dead_point[farPoint].transform.position;
        }
        else
        {
            mAgent.destination = player[player_number].transform.position;

        }
        if (mAgent.remainingDistance <= 1.5f)
        {
            enemy_atack = true;
        }
        else
        {
            enemy_atack = false;
            enemt_run = true;

        }
    }

    mAgent.speed = 1.0f;

    enemy_anim.SetBool("run", enemt_run);
    enemy_anim.SetBool("attack", enemy_atack);
}// end update

void enemy_dirction()
{
    if (dead_point_number > 0)
    {
        farPoint = Random.Range(0, dead_point.Length);
        mAgent.destination = dead_point[farPoint].transform.position;
    }
    else
    {

    }
}

sentences:
How to create video from camera? I have a 3d scene and a camera; I want to create video file from camera pre-set movements.
If it is possible, running application by command line (without needed to "show" at video, my camera) .

Is it possible in Unity ?

If yes what's the best approach ?

Thanks

sentences: How do mobile mmo's deal with the graphical resources? I'm am creating an MMO(probably won't be so massive), and was wondering how to deal with the graphical resources. Obviously, I can't have what could be possibly a few gigs of images and animations loaded up to the client, so I need another way of doing it. I have tried having a php webserver that updates itself and writes to a file that the client draws, however this seems slow. How can I speed up the process of updating the graphics while not having too much into the client?

sentences: Would it be more efficient to handle 2D collision detection with polygons, rather than both squares/polygons? I'm working on a 2D game engine and I'm trying to get collision detection as efficient as possible. One thing I've noted is that I have a Rectangle Collision collider, a Shape (polygon) collider and a circle collider. Would it be more efficient (either dev-time wise or runtime wise) to have just one shape collider, rather than have that and everything else? I feel it would optimize my code in the back end, but how much would it affect my game at runtime? Should I be concerned with this at all, as 3D games generally have tens of thousands of polygons?

sentences:
Problem when importing color in hexadecimal format from an ini file In my game I can import a color correctly when it is in the "engine format".
Example ("color.ini"):
[color]
color1="c_black"
color2="c_green"
color3="c_navy"

These colors were seen in this link:
https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/drawing/colour/index.html
It turns out that I can't import the color when I use its hexadecimal code (only the colors from the previous link don't supply me).
Example ("color.ini"):
[color]
color1="#FA8072"
color2="#FAEBD7"
color3="#E0FFFF"

Codes taken from this link:
https://celke.com.br/artigo/tabela-de-cores-html-nome-hexadecimal-rgb

I tried lowercase variations, with $ instead of # and nothing worked.

It is not even a case of seeing the wrong color, but of changing nothing (it always turns white).

I am using the function (asset_get_index) to apply the color.

Link where I looked for a solution before coming here:
https://www.reddit.com/r/gamemaker/comments/cc0dk6/saving_a_colour_to_an_ini_file/?ref=readnext

Code in my game (works in all colors that don't come as hexadecimal):
color[i]=ini_read_string("color","color"+string(i),"");

Draw:
draw_sprite_ext(spr_Barra,0,290,97+25*(i-1),1,1,0,asset_get_index(color[i]),1);

Code I tried, based on one of the comments, from the question:
result=0;

zero=ord("0");
nine=ord("9");
a=ord("A");
f=ord("F");

for(var i=1;i<=string_length(color1);i++){
    c=ord(string_char_at(string_upper(color1),i));
    result=result<<4;

    if (c>=zero && c<=nine){
        result=result+(c-zero);
    }else if(c>=A && c<=f){
        result=result+(c-a+10);
    }
}

I used the function (show_debug_message) to see the result of the code and got nonsense results:

1024, 2048

Link to see the code base I tried:
https://www.reddit.com/r/gamemaker/comments/9nyjbu/hexstringtonumber_script/

sentences:
How can I call a native mobile API in Construct 2? How can I use mobile API features in a Construct 2 game (HTML 5/JavaScrit engine)?

I didn't find anything about that on the net, unlike other game frameworks like Corona Enterprise or Cocos2d.

sentences:
Is Time.deltaTime different on various devices? Can someone say what is wrong with my code. I have custom timer implemented like this:

 float timeRemain = 10f;
 void Update(){
 timeRemain -= Time.deltaTime;
 if(timeRemain <= 0){
  ///...code here.
   }
 }

On PC it runs like expected but on Android device timeRemain variable becomes 0 in less then 10 secs. Who can suggest me what happens when i run it on Android device?

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 do I stop clicks on a button from also triggering my gameplay scripts? My character jumps when I press the right side of screen. The pause button is alsp in the top right corner. So when I press that button, the right side script always triggers and I don't want that to happen.

Here the script :
 if (Input.GetMouseButtonDown(0))
            {
                float xPosition = Input.mousePosition.x;

                if (xPosition > Screen.width / 2 && isGrounded && !isJump)
                {
                    // mouse is on the right part of the screen, shoot right

                    rb2d.velocity = new Vector3(0, jumpForce, 0);

                    isJump = true;

                    JumpSoundSfx();
                }
            }

            if (Input.GetMouseButton(0))
            {
                float xPosition = Input.mousePosition.x;

                if (xPosition < Screen.width / 2 && !isJump)
                {
                    // mouse is on the left part of the screen, so shoot to the left

                    crouch.SetActive(true);

                    stand.SetActive(false);
                }
            }
```

sentences:
RGBA values not coming as intended | LibGDX As it states, my RGBA values aren't coming out the way I want it to be.
My RBGBA values are
    As it states, I am trying to create a orange tinted color on my game.

221, 189, 98, 0.7

I am using a ShapRenderer called tint, and here is the code:

ShapRenderer tint = new ShapRenderer();
tint.begin(ShapeType.Fill);
tint.setColor(221, 189, 98, 0.4f);
tint.rect(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
tint.end();

I had tried this out in CSS, and it came out with the correct color. But with LibGDX, the game screen is plain white. The opacity (rgb 'A' value) does not have any affect on the tint color.

sentences:
Outsourcing Artwork: Hourly or Per-Project? I've hired people to produce art and graphics before, but only ever at a per-job rate and that has worked out well.

This question is for both artists and the people who hire them:

As a buyer, are there any situations or types of projects you've experienced where it worked out better billed at an hourly rate?

For artists, do you have a preference for one over the other and if so, why?

sentences:
Profiling code with threads and script interpreter Basically, how I profile a game that have multithreading and script interpreter? (Lua in my case)

I have no idea of where to look for that.

Also it would be nice to be able to profile code that resemble somehow the release code, my "debug" binary is about 12 times bigger...

EDIT: My game was made with C++, compiled with GCC, runs on Windows and GNU/Linux for now, compiled natively (ie: MingW on Windows, regular GCC on GNU).

sentences:
Unity. Input in function for UI button OnClick I am trying to create multiple selections for some items on my UI. To perform multiple selections of items I want a user to hold left control button. But then I add

if (Input.GetKeyDown(KeyCode.LeftControl)){
/* Logic */
}

It registers in debugger what LeftControl is pressed but it skips all logic in brackets. This function is public and created for UI button.
Is Input and Button.OnClick compatible at all?

sentences:
Semi Fixed-timestep ported to javascript In Gaffer's "Fix Your Timestep!" article, the author explains how to free your physics' loop from the paint one.

Here is the final code, written in C:

double t = 0.0;
const double dt = 0.01;

double currentTime = hires_time_in_seconds();
double accumulator = 0.0;

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

I'm trying to implement this in JavaScript but I'm quite confused about the second while loop...

Here is what I have for now (simplified):

...
(function animLoop(){
  ...

  while (accumulator >= dt) { // While? In a requestAnimation loop? Maybe if?
    ...
  }

  ...
  // render

  requestAnimationFrame(animLoop); // stand for the 1st while loop [OK]
}())

As you can see, I'm not sure about the while loop inside the requestAnimation one...

I thought replacing it with a if but I'm not sure it will be equivalent...

Maybe some can help me.

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: ATI driver bug and rendering to a texture 2d array in OpenGL I am trying to render to a texture2Darray in OpenGL, with a similar setup as descriped in this post. My question is, if anyone has gotten this to work on ATI hardware? Or is there still a bug in the driver, preventing multi layered rendering? The bug is also mentioned in the forum post.

sentences:
C++ in Unity with dependencies I am currently creating a c++ program to eventually use in Unity. This c++ program contains references to libraries like OpenCV and dlib, referenced with a include statement which calls in other files, which are installed on my machine. My question is:

How do you compile your c++ project so that it runs in Unity completely self-contained? i.e no reference to external files are needed, and all that are references are included within the program. Is there a specific tool to use, or a useful tutorial on the net?

Thanks for the help.

sentences:
How to give the player the feeling of being chased by enemies and force him/her to rush I have already asked a question about the difficulty progression in my endless runner game: How to make difficulty progression in my endless-runner game?

Now I have to decided that it is a good approach to make the following:

Camera is always drifting up, slowly, but preventing the player from idling.
If squirrels jump, the camera follows them and the spiders also update their position to be slightly below visible area. Their speed is a little bit faster than the camera's drifting speed, so the player will panic out of the fear of the spiders catching them.
Something else?

I want to make feel of constant chase by spiders and force player to run, make quick decisions and make mistakes. Player need to know exactly how close the spiders to squirrels are.

P.S: You can see earlier version of this game here: http://ludumdare.com/compo/ludum-dare-34/?action=preview&uid=66055

EDIT: The problem is that spiders are always relatively close to player and distance between them and the spiders matters. Once spiders have left the visible area, player feels safe. Firstly, spiders run with constant speed and if the player runs a little bit faster, he is always in the safe area and doesn't see any spiders.

The idea is to have player under pressure all time. The difficulty is that the visible area between the spiders and squirrels is small

FINAL DECISION: The final decision was made because of majority votes, and I suppose this answer suits for many games. But there is more than one good answer, and most of the answers are worth reading and implementing. That is what I am going to do.

Thanks everyone for your great answers!

FINAL NOTE: you can check final implementation finding released game on market - https://play.google.com/store/apps/details?id=by.Ludum.Vaverki

sentences:
C99: Dynamic dispatch in math library depending on SIMD Say I am developing a Math library and I want it to be such that it will detect whether or not user's machine support SSE (and which version) and based on that, different functions will be called. I can think of three ways to implement that:

Have global function pointers in the library and let user call mathInit() i their source. When they do, figure out the hardware details and assign the function pointers to different functions.
Same, except instead of having global function pointers, put them in a struct which is returned by mathInit(). This way, user will have to call math.vec3Add(...) or similar.
Same as 1, but instead of having global pointers, make mathInit() a macro so that the function pointers will have local scope in user's main() function (and require mathInit() to be called from main()).

Is any of these methods preferable? Is there some other, better way?

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:
Ray->triangle collision math seems to not work? First time asking, pardon any mistakes I make :)

I am programming a game from scratch, and the collision detection is giving me issues. I have AABB in place to check proximity, and if that reacts, the two models are checked by having each vertex in the moving model be a line going from the vertex' current position to its intended position. That line then gets checked against each triangle polygon in the 'obstacle' model.

My (current...) problem is that the math seems to react wrongly in the early part of that ray-triangle check (code below). I try simply to see if the two ends of the ray (vertex origin and vertex destination) are on opposite sides of the polygon plane (if they are not, the ray could not possibly be going through the polygon). I do this by getting a (not yet normalized) normal from the polygon via cross product. Then I dot the ray ends' positions with that. If it's one positive and one negative dot product, they should be on either side. Problem is, that never happens, even when i run models right through each other in tests. Never a 'positive & negative' result.

Can anyone spot my mistake(s)??

Code:

double Dot(Vec3 *a, Vec3 *b)
{
    double d = a->v[0] * b->v[0] + a->v[1] * b->v[1] + a->v[2] * b->v[2];
    return d;
}

Vec3 CrossProduct(Vec3 *a, Vec3 *b)
{
    Vec3 v;
    v.set(
        a->v[1]*b->v[2] - a->v[2]*b->v[1],
        a->v[2]*b->v[0] - a->v[0]*b->v[2],
        a->v[0]*b->v[1] - a->v[1]*b->v[0]
    );
    return v;
}

bool Collide(Vec3 *a, Vec3 *b, int target, int p)
{
    // a and b are the ray points in global space
    // target is the index number of the obstacle model
    /// p is the triangle polygon being checked (in a loop not included here)
    Vec3 poly_vert[3] = {entities[target].vertex[entities[target].poly[p].vertex[0]].pos
                    ,entities[target].vertex[entities[target].poly[p].vertex[1]].pos
                   ,entities[target].vertex[entities[target].poly[p].vertex[2]].pos};
    // poly_vert is the three vertices of the triangle polygon
    // Subtractions so poly_vert[0] essentially becomes the 0,0,0 center of the universe
    Subtract(&poly_vert[2],&poly_vert[0]);// Essentially, the vector from
                                             polyvertex 0 to polyvertex 2
    Subtract(&poly_vert[1],&poly_vert[0]);// Essentially, the vector from
                                             polyvertex 0 to polyvertex 2
    Subtract(a,&poly_vert[0]);
    Subtract(a,&entities[target].pos);// Make it relative to the obstacle model
    Subtract(b,&poly_vert[0]);
    Subtract(b,&entities[target].pos);// Make it relative to the obstacle model

    Vec3 poly_cross;
    poly_cross = CrossProduct(&poly_vert[1],&poly_vert[2]);
    double da = Dot(a,&poly_cross);
    double db = Dot(b,&poly_cross);

    if (da*db >= 0){return false;}
    return true;
}

sentences:
What is this alpha blending result? I'm having an exam soon and got a problem with one alpha blending exercise:

BlendState BS3 {
    BlendEnable[0]     = TRUE;
    SrcBlend[0]        = ONE;
    SrcBlendAlpha[0]   = ZERO;
    DestBlend[0]       = ONE;
    DestBlendAlpha[0]  = ZERO;
    BlendOp[0]         = ADD;
};

There are 3 triangles overlapping #1, #2 and #3. Each one has it's own RGBA values. The background color is 0.0, 0.0, 0.0, 0.0.

My tries:

  SrcBlendAlpha and DestBlendAlpha are both 0.0. I can calculate all rgb values with

  1*rgb#3 + 1*rgb#2 + 1*rgb#3

  The alpha value is: 0 * alpha#3 + 0 * alpha#2 + 0 * alpha#1 = 0.0

  The resulting color then is: (0.0, 0.0, 0.0, 0.0)

Is my approach correct? Does this even make sense having a color with alpha value 0?

sentences:
Remove or skip splash screen from Unity Free/Personal game binary for modding How can I modify a Unity game (Windows) binary to skip the 5-second Unity logo splash screen?
I know how to mod game code using dnspy to modify Assembly-CSharp.dll. I'm able to find isShowingSplashScreen but that appears to be irrelevant. I'm at a loss whether I can find the splash screen code in any .dll or if one would have to edit the game .exe or some other file.
Looking at the game .exe in HxD (hex editor), I see multiple occurrences of unity_SplashScreen but have no idea whether I can use this for anything.
Background
I'm modding a Unity game and I am not very good at it. I have to try a lot and start the game a lot. This means each time I test something, I lose five seconds because the game was made with the free Unity version.
As a player I made no commitment to the Unity ToS. I also have no intent to distribute a modded file that removes the splash screen. However, I want to remove it during development.
I am not asking how to remove the splash screen while building the game. I am not developing in Unity, I am modding a game made in Unity and I'm trying to streamline the process.
I did see Unity remove logo in splash screen, Alternatives to remove Unity splash screen after developing a game with the free version?, Can I legally remove the default Unity splash screen by removing it from the APK?. They revolve around the question of removing the splash screen with intent to distribute, which is not the topic here.
I had hesitations about asking this question, due to the answer being useful to developers willing to violate the ToS. However it seems on-topic and legal. I would also argue that the solution to my problem is probably going to be too much effort for active game dev projects to bother using it (having to repeat the steps for each new update) and that "bad apple" devs would rather use pirated versions of Unity Pro.

sentences:
Ponderate dijkstra relative to previous position I use dijkstra in my rust game to find path to a destination. My game is in a square grid like this:

There is, for illustration, the Rust code which use dijkstra:
use crate::map::Map;
use crate::physics::GridPoint;
use pathfinding::prelude::dijkstra;

pub fn find_path(map: &Map, from: &GridPoint, to: &GridPoint) -> Option<Vec<GridPoint>> {
    match dijkstra(from, |p| map.successors(p), |p| *p == *to) {
        None => None,
        Some(path) => Some(path.0),
    }
}

// ...

pub fn successors(&self, from: &GridPoint) -> Vec<(GridPoint, i32)> {
        let mut successors = vec![];

        for (mod_x, mod_y) in [
            (-1, -1),
            (0, -1),
            (1, -1),
            (-1, 0),
            (0, 0),
            (1, 0),
            (-1, 1),
            (0, 1),
            (1, 1),
        ]
        .iter()
        {
            let new_x = from.x + mod_x;
            let new_y = from.y + mod_y;

            if new_x < 0 || new_y < 0 {
                continue;
            }

            if let Some(next_tile) = self.terrain.tiles.get(&(new_x as u32, new_y as u32)) {
                successors.push((GridPoint::new(new_x, new_y), next_tile.pedestrian_cost))
            }
        }

        successors
    }
// ...

And visualization of found path (white is found path, pink is goal):

The found path is not a direct line. I'm not surprised, because the weight of diagonal is the same as lateral. With what I understand with dijkstra is I can return successor with weight for a coordinate. But I can't increase weight of diagonal/lateral according to previous position (ex: comming from West -> moving to Est will be less weight; maybe it is not the solution ...).
How can I achieve that ? With another algorithm than dijkstra ?

sentences:
Optimizing my 3D XNA game I've come to a point where optimizing my game is very much needed.My update() routine takes 0-2ms. My draw() routine takes about 100ms when drawing 3.5M triangles (Not the amount I really have to draw, but it's easier to debug.)
I've noticed that reducing draw calls is more effective than reducing triangles per draw call (and keeping the amount of draw calls the same), and would primarily like to know how to do that.

I've tried creating an array, adding items to that array every frame until it has about 65535 primitives in it (the maximum xna allows per draw call) and only drawing it then, but resizing the array is a terribly slow thing to do (drawing only 250k triangles takes about 500ms)

So long story short: In XNA, how do I properly optimize the drawing methods that use DrawUserIndexedPrimitives? Or primarily, how do I properly reduce draw calls?

sentences: Make standard Unity 3D objects non transparent I have a problem. When I add a cube or sphere to the scene they are transparent. How can I disable it? I tried adding materials, but it didn`t help and even if it would have helped it still a very dumb way of making standard objects non transparent.

sentences:
FBO picking in Oculus Rift applications I am writing an Oculus Rift application, I am rendering a very high poly mesh that I wish to be able to perform picking on using the Oculus Touch. Ideally, I want to be able to get the "triangle" id and other information attached to it.

Currently, I am using an OBB Tree and ray casting to perform picking on the CPU, It works perfectly, the problem is that even with OBB tree the picking process is slow. I thought I'd perform picking on the GPU by rendering the view (from the point of view of the Oculus Touch) to an FBO using a custom shader that outputs "triangle information" to the buffer and then use glReadPixels to  read the central pixel data. The problem I am facing is that the Oculus does distortion to  my on-screen scene but there is no way to apply it to the off-screen buffer, so there is significant difference between the on-screen buffer and the off-screen buffer.

My question is, Is ray casting the only feasible way to do picking in Oculus Apps or is there a way to perform the faster FBO picking even when the view distorted?

sentences:
How to make a character jump in SFML? How could I made a character jump with SFML in C++, a simple example could be very helpful.

Thanks in advance.

This is the code I currently have; how can I make the sprite jump?

#include <SFML/Graphics.hpp>
#include <iostream>
using namespace sf;

int main(){
    sf::RenderWindow ventana(sf::VideoMode(800,600),"mi ventana");
    ventana.setFramerateLimit(60);
    sf::Texture Image;
    Image.loadFromFile("tortuga.png");
    sf::Sprite sprite(Image);
    sprite.setPosition(-230,100);
    bool isPlay=true;
    bool presionarW(false);
    bool presionarA(false);
    bool presionarS(false);
    bool presionarD(false);
    //Controlar cualquier evento
    int x=30;
    int y=3;
    sf::Event miEvento;
    sf::CircleShape figura(10);
    while (isPlay)

    {
        //Eventos

        while(ventana.pollEvent(miEvento)){
            if (miEvento.type==sf::Event::Closed){
                isPlay=false;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::W){
                presionarW=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::A){
                presionarA=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::S){
                presionarS=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::D){
                presionarD=true;
            }

        }

        //Logica del juego
        if(presionarW){
            sprite.move(10,-20);
            presionarW=false;
        }
        if(presionarA){
            sprite.move(-20,5);
            presionarA=false;
        }
        if(presionarS){
            sprite.move(0,25);
            presionarS=false;
        }
        if(presionarD){
            sprite.move(25,0);
            presionarD=false;
        }

        //Renderizado
        ventana.clear();
        ventana.draw(sprite);
        ventana.display();
    }
    ventana.close();
}

sentences:
How to rotate a skybox cubemap using Unity Shadergraph @Seyed Morteza Kamali solved his own problem of rotating a mesh cubemap with shadergraph here: How can I rotate cubemap in shadergraph?
However, I have a starry night cubemap inside my Skybox shader done in Unity Shader Graph, and as there is no way to directly attach a script to a Skybox material, I've been accessing the skybox material and the shader via external script. I've been using the Bolt visual scripting, and with this script, it is fairly easy to access other properties of the skybox but not the rotation (4x4 matrix). It is possible to access floats, vector2's, texture maps and even the Cubemap, but even if I have set the cubemap rotation, which to my knowledge has to be done with a Matrix 4, as an Exposed property, when trying to access it, e.g with FindPropertyIndex it gives the value -1, indicating that the property is not found.
Edit: ok, I found this in the Unity documentation:

Matrix parameters are not exposed in the material inspector, but can be set and queried with SetMatrix and GetMatrix from scripts.

As far as I understand the documentation, the example assumes a mesh renderer, which the skybox doesn't have. Another idea would be to use 3 vectors, which could be exposed and then apply the rotation somehow to them at the same time, I did some tests in this, but all I managed to create was to distort the cubemap.
Again I am not trying to rotate the entire skybox, but just a cubemap inside the skybox shader – this would allow different rotations to daytime clouds and nighttime stars.
Would be best if everything could be done inside ShaderGraph, with the speed and axis values published as properties. A custom function perhaps? I am using URP 7.2.0 and Unity 2019.3.0f6.

sentences:
Zoom at a specific point using Orthographic camera Currently I can perform Zoom which seems to be working fine but essentially what I'm really trying to do is zoom on a position offset from center as currently when I zoom then zoom is performed at the center.

Not sure how to achieve this ?

One way i'v though is either not use the orthographic camera and rather clip the texture, so that the my clipped texture will be drawn onto my directx surface covering the entire view. I could possibly perform the clipping using a constant buffer but then that would stretch the entire clipped texture over my viewport area.

Any suggestions on the above ?

I'm using Directx11, SharpDx with D3DImage & C#.

Do note: I'v created my vertexes directly screen co-ordinates.

Edit:

    this.eye = new Vector3(0.0f, 0.0f, 0.0f);
    this.lookAt = new Vector3(0.0f, 0.0f, 1.0f);
    this.up = new Vector3(0.0f, 1.0f, 0.0f);
    viewMatrix = Matrix.LookAtLH(eye, lookAt, up);

NOTE:
My application isn't a game but rather a video player

sentences:
Trouble rigging rotating head to pivoting arm I've got a 3ds max model and I'm trying to rig it. I followed some tutorials, but I got stuck. I've got my rotating head, and the arm that holds it and pivots up and down, but the two don't "connect" well.

Here's my rigging set up:

The leftmost dummy should move up and down and control the height of the miner head (the jagged-edge wheel) and the arm that holds it.

But, when I move my dummy up vertically to test, the arm works perfectly, but the miner head ... uh, doesn't. This is from the same angle as the first shot and you can see that the miner head tilts, instead of moving straight up and down.

I tried playing with the miner head's pivot points, but they seemed perfectly centered. Is there a way to make my miner head only go straight up and down (that will still work with my rotation constraint? ) instead of doing this strange sideways tilting motion? Maybe that's not the right thing to do, I could really use some hints in where to go from here to fix this strange tilting motion..

sentences:
AndEngine Physics: Shape rotating but not updating physics effects I was looking at PhysicsExample from AndEngine's Examples. I made the following change that I added a vertical line shape and created a fixture for it. Then I registered a rotation modifier for that shape. It is rotating properly but not updating its physics properties on rotation means when it is rotating and any physics body hits it, it did not give collision effect. Here is my code:

final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
        final Rectangle ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2, vertexBufferObjectManager);
        final Rectangle roof = new Rectangle(0, 0, CAMERA_WIDTH, 2, vertexBufferObjectManager);
        final Rectangle left = new Rectangle(0, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
        final Rectangle right = new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
        final Rectangle center1 = new Rectangle((CAMERA_WIDTH/2) - 2, (CAMERA_HEIGHT/2) - 100, 10, 200, vertexBufferObjectManager);
        final Rectangle center2 = new Rectangle((CAMERA_WIDTH/2) - 100, (CAMERA_HEIGHT/2) - 2, 200, 10, vertexBufferObjectManager);

        center1.registerEntityModifier(new LoopEntityModifier(new RotationModifier(2, 0, 360)));

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

Although the body give collision effect when it reaches the shapes initial position. I am new to AndEngine. Where I a wrong...???

sentences:
Mouse click movement I need to make realistic human movement (3D) using mouse click.

Get mouse click point using Raycast.
Smoothly Slerp to LookRotation.
Move transform.forward.

Everything works fine, except I have problem with circular movement (close radius).

Example If dont move transform.forward while Slerp to LookRotation or MoveTowards instead of transform.forward it will be spinning like whirligig on circular movement.
Example If do move transform.forward while while Slerp to LookRotation it will distort trajectory of straight direct movement.

Is there any solution to move circular realistic (not spin like whirligig) and move straight direct when needed (not distort trajectory)?

I need straight movement from first example and circular movement from second.

        if (Input.GetMouseButtonDown(1))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            RaycastHit[] hits = Physics.RaycastAll(ray);

            foreach (RaycastHit hit in hits)
            {
                if (hit.transform.tag == "Ground")
                {
                    DestinationPosition = new Vector3(hit.point.x, transform.position.y, hit.point.z);

                    DestinationRotation = Quaternion.LookRotation(DestinationPosition - transform.position);

                    break;
                }
            }
        }

        if (Vector3.Distance(transform.position, DestinationPosition) > 1)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, DestinationRotation, RotationSpeed * Time.deltaTime);

            transform.position += transform.forward * MovementSpeed * Time.deltaTime;

            //transform.position = Vector3.MoveTowards(transform.position, DestinationPosition, MovementSpeed * Time.deltaTime);

            animation.CrossFade("run");
        }
        else
        {
            animation.CrossFade("idle");
        }

sentences:
Generating the distance of an intersection through a box from the camera in Unity C# So, I recently saw this fantastic video by Sebastian Lague about planetary generation-
https://www.youtube.com/watch?v=lctXaT9pxA0&t=1100s
And I decided to replicate it, however, on a flat plane, not a sphere.In the video, (at timestamp linked) he uses some mathematical expression to  figure out the distance of the camera's vector through an arbitrary sphere, and uses this to shade the ocean. I can't figure out how to write a similar estimator for an arbitrary rectangular prism. Anyone have any ideas?
EDIT- I have shifted to using surface shaders, but I can't figure out how to compensate for distance in depth-
Shader "Custom/SurfaceDepthShader"
{
    Properties {
        _ColorShallow ("Color Shallow", Color) = (1,1,1,1)
        _ColorDeep ("Color Deep", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Glossiness ("Smoothness", Range(0,1)) = 0.5

        _fadeDepth("Base Alpha", Range(0,1)) = 0.5

        _InvFade ("Soft Factor", Range(0.01,3.0)) = 1.0
    }
    SubShader {
        Tags { "Queue"="Transparent" "RenderType"="Transparent" }
        LOD 200

        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard vertex:vert alpha:fade nolightmap

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0

        sampler2D _MainTex;

        struct Input {
            float2 uv_MainTex;
            float4 screenPos;
            float3 worldPos;
            float eyeDepth;
        };

        half _Glossiness;
        half _Metallic;
        fixed4 _ColorShallow;
        fixed4 _ColorDeep;

        sampler2D_float _CameraDepthTexture;
        float4 _CameraDepthTexture_TexelSize;

        float _InvFade;
        float _fadeDepth;

        void vert (inout appdata_full v, out Input o)
        {
            UNITY_INITIALIZE_OUTPUT(Input, o);
            COMPUTE_EYEDEPTH(o.eyeDepth);
        }

        void surf (Input IN, inout SurfaceOutputStandard o) {
            // Albedo comes from a texture tinted by color
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _ColorShallow;
            //
            //  smoothness come from slider variables

            o.Smoothness = _Glossiness;

            float rawZ = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(IN.screenPos));
            float sceneZ = LinearEyeDepth(rawZ);
            float partZ = IN.eyeDepth;

            float dist = distance(_WorldSpaceCameraPos, IN.worldPos);

            float fade = 1.0;
            if ( rawZ > 0.0 ) // Make sure the depth texture exists
                fade = saturate(_InvFade * (sceneZ - partZ));

            o.Albedo = lerp(_ColorShallow, _ColorDeep, fade) * c;
            o.Alpha = c.a * fade * _fadeDepth;
        }
        ENDCG
    }
    FallBack "Diffuse"
}
```

sentences:
How to generate texture coordinates for a rectangle? I've got a function which generates geometry data for a rectangle. So far I've got the vertex, indices and the normals nailed, but I have no idea how to generate the texture coordinates - so far I've only used textures with imported 3d models, but now I want to generate my own rectangle on the fly and so need to generate the texcoords aswell.

So how do I make the texcoords? I am not sure how the mapping works.

bool CreateRectangleData(const float sizeX, const float sizeY, const float sizeZ, std::vector<float>& vertexData, std::vector<float>& normalData, std::vector<float>& texcoordData, std::vector<uint32_t>& indiceData)
{
    if (sizeX <= 0 || sizeY <= 0 || sizeZ <= 0)
        return false;

    const float X = sizeX / 2.0f;
    const float Y = sizeY / 2.0f;
    const float Z = sizeZ / 2.0f;

    float cubeVertices[] = {-X, -Y, -Z, -X, -Y, Z, X, -Y, Z,
                            X, -Y, -Z, -X, Y, -Z, -X, Y, Z,
                            X, Y, Z, X, Y, -Z, -X, -Y, -Z,
                            -X, Y, -Z, X, Y, -Z, X, -Y, -Z,
                            -X, -Y, Z, -X, Y, Z, X, Y, Z,
                            X, -Y, Z, -X, -Y, -Z, -X, -Y, Z,
                            -X, Y, Z, -X, Y, -Z, X, -Y, -Z,
                            X, -Y, Z, X, Y, Z, X, Y, -Z};

    float cubeNormals[] = {0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
                           0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
                           0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -1.0f,
                           0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f,
                           0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
                           0.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
                           -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
                           1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};

    float cubeTexCoords[] = {};  // ???

    uint32_t cubeIndices[] = {0, 2, 1, 0, 3, 2, 4, 5, 6,
                              4, 6, 7, 8, 9, 10, 8, 10, 11,
                              12, 15, 14, 12, 14, 13, 16, 17, 18,
                              16, 18, 19, 20, 23, 22, 20, 22, 21};

    vertexData.insert(vertexData.begin(), cubeVertices, cubeVertices + (sizeof(cubeVertices) / sizeof(float)));
    normalData.insert(normalData.begin(), cubeNormals, cubeNormals + (sizeof(cubeNormals) / sizeof(float)));
    texcoordData.insert(texcoordData.begin(), cubeTexCoords, cubeTexCoords + (sizeof(cubeTexCoords) / sizeof(float)));
    indiceData.insert(indiceData.begin(), cubeIndices, cubeIndices + (sizeof(cubeIndices) / sizeof(uint32_t)));

    return true;
}

Thanks

sentences: How do I change the mesh in an existing prefab in Unity? So I made a prefab some time ago and now I want to change the mesh without changing any scripts. I have an OBJ file I want to use. Is there any way to do this? I've read the documentation but I don't seem to understand how to do it.

sentences:
What can be done to recover from an exploit-related PR disaster? Let say company x makes massively multiplayer online strategy games. The game y is updated adding a feature z, but developers forgot to add server-side verification or it was bypassed (using alternative UI). Update allowed users to double their units as many times as they like. After about a day this bug was fixed. A lot of members had abused this bug - some by accident(?), others as much as possible. Damage has been done and extra units still remain.

The game has a cash shop where speedups, elite units, etc can be bought. Some members have spent hundreds of dollars to be among the best and played this game for several months if not years.

I want to know : what can be done, if rollback is not possible?

sentences:
2D Collision detection for Pinball Game So far in previous games I have used simple 2D collision with boxes then checking at pixel level for a collision.

If making a pinball game in nearly a lot of frames the ball will be in contact with a wall or another surface so is there another approach?

sentences:
Isometric Tile-Based Pixel Game Code Structure I'm starting to hit some tricky bits in my Java project.

So far, I have drawn the following isometric tile:

And written some Java code to display it as a map:

I do this by looping over an array of tiles and drawing them on a JPanel. I have also implemented layers so that I can draw objects on top of the ground, etc.
So far I have set up some basic classes such as Tile and Level but I'm starting to hit some real complexities.

My question is, with such a project, should I be drawing everything in a normal 2d perspective and rotating them? Or is drawing them isometrically and overlapping them the correct approach?

Is anyone aware of any resources that I can follow that take a similar approach to myself? I've had a Google but everyone seems to take a different approach.

sentences:
Going fullscreen without stretching in an XNA game I've got a 2D game that I'm working on that is in a single aspect ratio. When I switch it to fullscreen mode on my widescreen monitor it stretches. I tried using two viewports to give a black background to where the game shouldn't stretch to, but that left the game in the same size as before. I couldn't get it to fill the viewport that was supposed to hold the whole game.

How can I get it to go fullscreen without stretching and without me needing to modify every position and draw statement in the game?

sentences: SDL zooming/upscaling without images becoming blurry? I'm working on a game with 32px tiles and I have one question regarding this and scaling. When I try to see my game fullscreen my image just becomes blurry. I remember playing NES games and when the image was scaled you just saw pixels as big blocks but they were still as crisp as when they were small, so I'm wondering how I can do this in SDL.

sentences:
Libgdx, TiledMap, and tearing My TiledMap tears when the window is specific sizes, resized, or the camera moves.

The tileset is padded by 2px and have tried as high as 10px. Each tile is 70x70.

Here are the pack.json settings,

{
    paddingX: 2,
    paddingY: 2,
    bleed: true,
    edgePadding: true,
    duplicatePadding: true,
    maxWidth: 4096,
    maxHeight: 4096,
    filterMin: Nearest,
    filterMag: Nearest,
    ignoreBlankImages: true,
    wrapX: ClampToEdge,
    wrapY: ClampToEdge,
    grid: true,
    fast: false
}

Here is the code.

Parameters params = new Parameters();
params.textureMinFilter = TextureFilter.Nearest;
params.textureMagFilter = TextureFilter.Nearest;
TileMap map = new TmxMapLoader().load(file.getAbsolutePath(),params);

So what am I doing wrong? If nothing, does that mean libgdx absolutely cannot handle TileMaps of any sort?

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:
Spawn point not working on unity I have two GameObjects set down. One is named Spawn Point, and it is set at the beginning of my level, and Death Point, set down at about 0,-40,0. My code tries to see if the character is below the Death Point area and moves the player to the spawn point. I feel that the answer is so simple, that I could look it up, but I looked it up, and I didn't see it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class death : MonoBehaviour
{
    public GameObject spawnPoint;
    public GameObject deathPoint;
    // Start is called before the first frame update

    // Update is called once per frame
    void Update()
    {
       Vector3 playerPos = transform.position;
        if(playerPos.y < deathPoint.transform.position.y) {
            transform.position = spawnPoint.transform.position;
        }
    }
}

A big thank you in adavance.

sentences:
How can I flip a sprite in SFML? I am facing the same problem although the sprite flips but only one time after that it does not flips at all.

Here is the code snippet:

void Doodle::moveLeft()
{
    if(d_Right)
        d_Sprite.setScale(-1.0f, 1.0f);
    d_Left = true;
}

void Doodle::moveRight()
{
    if(d_Left==false)
        d_Sprite.setScale(-1.0f, 1.0f);
    d_Right = true;
}

void Doodle::stopLeft()
{
    d_Left = false;
}

void Doodle::stopRight()
{
    d_Right = false;
}

sentences:
Programmatically set brightness of a PointLight I'm a beginner, so there is definitely something I'm missing here. I'm trying to set brightness of my PointLight object from the in-game command line.

Here is what I tried, but it doesn't work:

class MyCustomGameInfo extends GameInfo;

exec function myTest(float brightness)
{
    local PointLight pointLightOut;
    local PointLight pointLight;

    foreach AllActors( class 'PointLight', pointLightOut )
    {
        pointLight = pointLightOut;
    }

    pointLight.LightComponent.SetLightProperties(brightness);
    pointLight.LightComponent.UpdateColorAndBrightness();
}

defaultproperties
{
}

So when I compile it, go to my UDK project, run it, press tab and start typing myTest, the command line autocomlpete works perfectly, and even shows the float parameter. However, it doesn't work. I have a feeling that the way I'm retrieving the object is wrong.

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 can I package and read multiple asset files into/from one file? I want to somehow "pack" (not compress) multiple game files into one bigger file. Something like Valve's .gcf, where reading from the application should be easy; like accessing an ordinary stored file.

I'm aiming for some kind of simple use, something like:

my_asset_file->setAssetFile(ASSET_FOLDER + '/file.ext');
Model *m = new Model();
m->loadFromTxtFile(my_asset_file->openTxtFile('models/props/lamp.obj'));

sentences:
Error CS1585: Member modifier 'private' must precede the member type and name I've been knocking errors out of my script after working thoroughly through them but this one has me stumped, even though I'm sure it's something really simple. This is the following error that I'm getting:

  Assets\Scripts\Movement_Scripts\FirstPersonCharacter\Scripts\FirstPersonController.cs(44,9):
  error CS1585: Member modifier 'private' must precede the member type
  and name

From my script:

using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
using UnityStandardAssets.Utility;
using Random = UnityEngine.Random;
using MouseLook = UnityEngine.MouseLook;

public class FirstPersonController : MonoBehaviour
{
    [SerializeField] private bool m_IsWalking;
    [SerializeField] private float m_WalkSpeed;
    [SerializeField] private float m_RunSpeed;
    [SerializeField] [Range(0f, 1f)] private float m_RunstepLenghten;
    [SerializeField] private float m_JumpSpeed;
    [SerializeField] private float m_StickToGroundForce;
    [SerializeField] private float m_GravityMultiplier;
    [SerializeField] private MouseLook m_MouseLook;
    [SerializeField] private bool m_UseFovKick;
    [SerializeField] private FOVKick m_FovKick = new FOVKick();
    [SerializeField] private bool m_UseHeadBob;
    [SerializeField] private CurveControlledBob m_HeadBob = new CurveControlledBob();
    [SerializeField] private LerpControlledBob m_JumpBob = new LerpControlledBob();
    [SerializeField] private float m_StepInterval;
    [SerializeField] private AudioClip[] m_FootstepSounds;    // an array of footstep sounds that will be randomly selected from.
    [SerializeField] private AudioClip m_JumpSound;           // the sound played when character leaves the ground.
    [SerializeField] private AudioClip m_LandSound;           // the sound played when character touches back on ground.

    private Camera m_Camera;
    private bool m_Jump;
    private float m_YRotation;
    private Vector2 m_Input;
    private Vector3 m_MoveDir = Vector3.zero;
    private CharacterController m_CharacterController;
    private CollisionFlags m_CollisionFlags;
    private bool m_PreviouslyGrounded;
    private Vector3 m_OriginalCameraPosition;
    private float m_StepCycle;
    private float m_NextStep;
    private bool m_Jumping;
    private AudioSource m_AudioSource;
    readonly AudioSource AudioSource;
    public UnityStandardAssets.Characters.FirstPerson.MouseLook

    // Use this for initialization
    private void Start()   /* This is line 44 */
    {
        m_CharacterController = GetComponent<CharacterController>();
        m_Camera = Camera.main;
        m_OriginalCameraPosition = m_Camera.transform.localPosition;
        m_FovKick.Setup(m_Camera);
        m_HeadBob.Setup(m_Camera, m_StepInterval);
        m_StepCycle = 0f;
        m_NextStep = m_StepCycle / 2f;
        m_Jumping = false;
        m_AudioSource = GetComponent<AudioSource>();
        m_MouseLook.Init(transform, m_Camera.transform);
    }

    // Update is called once per frame
    private void Update()
    {
        RotateView();
        // the jump state needs to read here to make sure it is not missed
        if (!m_Jump)
        {
            m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
        }

        if (!m_PreviouslyGrounded && m_CharacterController.isGrounded)
        {
            StartCoroutine(m_JumpBob.DoBobCycle());
            PlayLandingSound();
            m_MoveDir.y = 0f;
            m_Jumping = false;
        }
        if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded)
        {
            m_MoveDir.y = 0f;
        }

        m_PreviouslyGrounded = m_CharacterController.isGrounded;
    }

...

Now I know the problem is private void Start() on line 44, and from everything I've read, it's in the wrong place (to make sure, I changed it to public void, then just left it as void, both resulting in errors) however I'm stumped as to where I should move Private Void too.

I appreciate any and all advice on this.

sentences:
Reducing disk space needed to use TextMeshPro in AssetBundles My game uses AssetBundles, and quite often each of those bundles use TextMeshPro. The project is at a stage where it would be unwise to change to Addressables.

Anyway, I noticed that when a bundle has TextMeshPro involved, it easily adds roughly 2mb to the bundle - I assume it's a copy of all the dependencies to make it work.

Ideally all bundles should simply point to one copy which is guaranteed to always be present in the game, which I think Addressables sort of does, but as mentioned we cannot use it for this project for various reasons.

One way is to create/add the TextMeshPro components at runtime (e.g. have some kind of "placeholder/dummy" component that, upon Awake() will add TextMeshPro with various preset attributes).

That would work fine, and I'm willing to do that - but perhaps there are less tedious alternatives (other than Addressables) that I haven't thought of.

The goal is to be able to reduce the disk space required for each bundle just because it is using TextMeshPro components.

sentences:
Designing a flexible tile-based engine I'm trying to create a flexible tile-based game engine to make all sorts of non-realtime puzzle games, just as Bejeweled, Civilization, Sokoban, and so on.

The first approach I had was to have a 2D array of Tile objects, and then have classes inheriting from Tile that represented the game objects. Unfortunately that way I couldn't stack more game elements on the same Tile without having a 3D array.

Then I did something different: I still had the 2D array of Tile objects, but every Tile object contained a List where I put and different entities. This worked fine until 20 minutes ago, when I realized that it's too expensive to do many things, look at this example:

I have a Wall entity. Every update I have to check the 8 adjacent Tiles, then check all of the entities in the Tile's List, check if any of those entities is a Wall, then finally draw the correct sprite. (This is done to draw walls that are next to each other seamlessly)

The only solution I see now is having a 3D array, with many layers, that could suit every situation. But that way I can't stack two entities that share the same layer on the same tile. Whenever I want to do that I have to create a new layer.

Is there a better solution? What would you do?

sentences:
Rotate entity to match current velocity I have an entity in 2D space moving around, lerping between waypoints. I would like to make the entity rotate around its own origin to face the current direction that it is going, I.E. towards the next waypoint in the list.

In case the waypoint movement code is needed, I'm using the following (this is contained inside of the entity that is following the waypoints) :

    private void GoToWaypoint() {
        if (waypointList.Count > 0) {
            Vector2 origin = helper.GetOrigin(position, width, height);
            int nodeWidth = 50;
            int nodeHeight = 50;

            if (moveToPosition != waypointList[0]) {
                moveToPosition = waypointList[0];
                moveToPositionOrigin = helper.GetOrigin(moveToPosition, nodeWidth, nodeHeight);
                distanceToPosition = moveToPositionOrigin - origin;
            }

            if ((Math.Ceiling(distanceToPosition.X) < 0)) {
                position.X -= moveSpeed;
                distanceToPosition.X = (int)Math.Round(distanceToPosition.X + moveSpeed);
            }
            else if ((Math.Floor(distanceToPosition.X) > 0)) {
                position.X += moveSpeed;
                distanceToPosition.X = (int)Math.Round(distanceToPosition.X - moveSpeed);
            }

            if (Math.Ceiling(distanceToPosition.Y) < 0) {
                // Check if the entity moves below the top boundary
                if (position.Y > 0) {
                    position.Y -= moveSpeed;
                    distanceToPosition.Y = (int)Math.Round(distanceToPosition.Y + moveSpeed);
                }
                else {
                    distanceToPosition.Y = 0;
                }
            }
            else if (Math.Floor(distanceToPosition.Y) > 0) {
                // Check if the entity moves below the bottom boundary
                if (position.Y < 550) {
                    position.Y += moveSpeed;
                    distanceToPosition.Y = (int)Math.Round(distanceToPosition.Y - moveSpeed);
                }
                else {
                    distanceToPosition.Y = 0;
                }
            }

            // If the entity gets in the waypoint, or the distance to the waypoint is 0 on both axis (which can occur due to screen boundaries)
            if ((helper.InNode(position, moveToPosition, width, height, nodeWidth, nodeHeight)) || ((distanceToPosition.X == 0) && (distanceToPosition.Y == 0))) {
                waypointList.RemoveAt(0);
            }
        }
    }

I know this may have been asked elsewhere, and the bit of searching that I did on this type of problem, didn't really help me. I'm slightly math retarded, so I don't understand the explanations that don't really explain what the math is exactly achieving. So any help that breaks down the math and functions needed to achieve this would be greatly appreciated.

Thanks.

sentences:
Why my charchter fluctuate instead go down stairs? My player is a capsule with:

First person controller
Charchter controller

When my player go up stairs, it works well.
When my player go down stairs, it fluctuate in air.

What am i wrong ?

Thanks

sentences:
How to determine this kind of vector? Take a look at the picture.

I've got a camera(brown) and its ray(red). As I know ray has a direction and unlimited length(if you don't set it yourself). But now I need to determine ray's vector that starts at camera point and ends when it crosses a floor. How can I do that?

sentences: SGC toolkit for PyGame and resizeable windows Can I create a resizeable main window if I use the SGC GUI toolkit for PyGame? If so, how?

sentences:
Optimize a render call to draw out several semi-transparent sprites I'm writing a 2D side-scrolling style game in C++ and openGL. In this game I have several cloud sprites which are rendered across the top of the screen. They rotate and scale and such so they're not static. I'm wondering if there is any way that I can optimize this, because currently every time one of these sprites is rendered, GL has to perform blending between everything already rendered (like the background, etc) and these sprites.

I'm thinking something along the lines of rendering ONLY the clouds together all at once, and then performing a single call where the final result is rendered and blended into the main scene. Not sure how to even go about that or if it will even result in a performance gain. Any suggestions would be greatly appreciated!

Just for clarity, here is what a final render looks like. The clouds are formed by several smaller sprites being populated close together around certain points.

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:
Creating charging particles using Shuriken I've been trying to create a charging effect using the Shuriken Particle system for the longest time, and I've had little to no luck with it. I've tried setting different curves for the Force over Time and Color over Time, but I always come up empty. However, I've seen examples all over the place for charging particles. The most recent example of charging particles I've seen is from the Space Cowboy game jam entry LOS CUERVOS.

The game has a ship with a laser that requires the player to hold a button down before it fires. It looks like this when charging and firing. I'm specifically talking about the particles surrounding the ball of light that's slowly growing in size over time.

I was wondering if anyone here knew what I may be doing wrong when going about setting up the particle system. Any suggestions relative to the question would be much appreciative.

sentences:
Code for making Material offset follow Bone transform not exactly working In my game, I have an Eye Bone that is constantly moving.

I'm trying to make a material attached to the eye (pupil material) move in relation to the Eye bone's transform.

This Script is indeed moving the Material's offset, but it is seemingly ignoring the offsetMultiplier bit. For instance, if I set offsetMultiplier to 0, the material offset never equals 0 but instead keeps exactly following the Bone transform numbers.

What might be the mistake here?

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

public class EyeBoneMatOffset : MonoBehaviour
{
    public Transform targetBone;
    public Material mat;
    public float offsetMultiplier = 0.0f; //0 for testing purposes

    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        //Create a vector to offset the material
        var offset = new Vector2(targetBone.transform.localRotation.eulerAngles.x * offsetMultiplier,
                                 targetBone.transform.localRotation.eulerAngles.y * offsetMultiplier);

        //Apply the offset
        mat.mainTextureOffset = offset;
    }
}

Script inspector set up:

Edit:

I'm having issues getting the Eye(Pupil) Material to correctly move with the Eye bone movement.

You can see that when I hit play, the script does get the Eye Material to Initially move, but then it is (visually) frozen instead of moving back and forth. The goal is for it to correctly Eye Track the cube.

As a sidenote, for the Eye Material's X and Y offset, the visually correct range of its pupil movement is -0.45 to +0.45 (X), and -0.45 to -0.45 (Y). So it's weird to me that the X and Y offset of the Eye Materials are shown to be moving within that range (which should be good!), yet are not actually moving visually except for when the game first starts.

sentences: Any reason 3D character models aren't split into multiple models / files? I'm just curious if there as any reason why artists are so resistant to split their 3D models into multiple fbx files. I just find the code design much cleaner if 3D models are split up into multiple files, rather than having to dig through bone hierarchies to choose different parts of a model the code needs to control. Something similar is the 2D project layout with characters broken into different sprites, and being able to grab those by name. (I get that the artist can name bones to make the search nicer, but a search still needs to be done instead of giving a path) So, I get that it has to do with animating movement, but why can't that be split into multiple files? (For a maya workflow at least)

sentences:
Bounding box should rotate - Skews instead I have a method to rotate a sprite's bounding box around the center of the sprite (the sprite rotates and I need the bounding box to rotate with it. The sprite is rectangular).

Instead of being rotated, the bounding box is skewing wierdly. When the angle is 0 - the bounding box is a perfect rectangle. But when the angle changes, the bounding box is getting gradually skewed.

All of this happens in the object's move() method. This method is called every cycle of the game-loop. What I'm trying to do is this:

Move the sprite in the direction the user chose. (x += dx, y += dy).
Get the coordinates of the new center of the sprite.
Get coordinates for the four vertices of the not-rotated-version
of the sprite.
Manipulate these coordinates, so they are now the vertices of the
rotated sprite.

The coordinates that step 4 gives me, are used to create the bounding box (and temporarily draw it on the screen so I can see).

Somewhere, this fails. As I said, the bounding box doens't rotate. Instead, it skews (and maybe also rotates, not sure).

What could be the problem?

Code:

public void move(){

// Advance sprite.
x += dx;
y += dy;

// Get the new center point of the sprite.
centerx = x + width/2;
centery = y + height/2;

// Get the 4 vertices of the non-rotated version of the sprite.
xcoo[0] = (int) x;
xcoo[1] = (int) (x + width);
xcoo[2] = (int) (x + width);
xcoo[3] = (int) x;

ycoo[0] = (int) y;
ycoo[1] = (int) y;
ycoo[2] = (int) (y + height);
ycoo[3] = (int) (y + height);

// Manipulate each vertex, so it fits the rotated sprite.
for(int z=0;z<4;++z){

    xcoo[z] -= centerx;
    ycoo[z] -= centery;

    xcoo[z] = (xcoo[z] * Math.cos(Math.toRadians(angle)) - ycoo[z] * Math.sin(Math.toRadians(angle)));
    ycoo[z] = (xcoo[z] * Math.sin(Math.toRadians(angle)) + ycoo[z] * Math.cos(Math.toRadians(angle)));

    xcoo[z] += centerx;
    ycoo[z] += centery;

}

}

Help would be very appreciated. Thank you

sentences:
Is it possible to record video, depth map and 6D pose of any games? I'm not a game developer, but a researcher working on improving video quality in various contexts. For my current problem, I need to collect videos which have both RGB data as well as depth data. Video can be monocular or stereo. However, if there is egomotion, I'll need the camera pose (rotation and translation) as well. Is there any way to record all these information in any kind of games? Games can be on any platform: PC games, mobile games or VR games.
In short, I want to record gameplay but with additional information such as depth map and camera pose.

sentences:
Engaging ways to include party members in a fast-paced action RPG Imagine a dynamic action RPG, where you constantly need to use your reflex to avoid bullets and fight against hordes of enemies. What would be a best way to incorporate other team members? I can think of several ways but all have disadvantages:

Giving them orders manually is out of questions when there's so much going around that you need all your attention just to make sure your main is not hit by any incoming attack
Using a dynamic pause like in classic cRPG such as Baldur's Gate makes the game slower and interrupts action that ideally should be quick, dynamic and engaging
Making them autonomous is difficult to balance. If they're too weak or ineffective, then the player will constantly gets annoyed at them, that they can't get anything right and die constantly. If they are too efficient then they can ruin the game because player could just sit back and watch them defeat all the enemies. If they just pretend to engage the enemy to left the action to the player this can happen

Most action RPGs seem aware of these difficulties and prefer to have a single character for the player to run and control. This simplify things greatly but I don't want to lose the party, for plot related purposes, banters, interactions etc. What would be a good way to have the best of both words? How can I best include side characters in a fast and dynamic gameplay?

sentences:
Transformations and basis vectors I've been reading this very nice tutorial on OpenGL, and I encountered a statement which I can't wrap my head around. In Chapter 6, it states:

  Transformation from one space to another ultimately means this: taking the basis vectors and origin point from the original coordinate system and re-expressing them relative to the destination coordinate system. The transformation matrix from one space to another contains the basis vectors and origin of the original coordinate system, but the values of those basis vectors and origin are relative to the destination coordinate system.

This is reaffirmed in Chapter 7:

  ... And this makes sense; a transformation matrix contains the basis vector and origin of the source space, as expressed in the destination coordinate system.

... But isn't it the other way around?

Take a look at this example from the tutorial:

The transformation Matrix to transform from the space on the left to the space on the right is

[1   0   0   1  ]
[0   1   0  -1.5]
[0   0   1   0  ]
[0   0   0   1  ]

The last column of the transformation matrix is the origin of the destination space, expressed relative to the source space.

What am I missing?

Note The above transformation matrix is not from the notes, so feel free to correct it.

sentences:
How do I destroy a SDL_Finger pointer? Hello I'm using SDL with C++ and I got this code:

void handleEvents() {
    SDL_Finger* finger = SDL_GetTouchFinger(SDL_GetTouchDevice(0), 0);
}

I do not know what SDL does inside the GetTouch function, maybe it allocates memory. Do I have to "destroy" finger here? Or will it be deleted by the end of the methods scope?
Thank you.

sentences:
How to texture a VBO? I'm not sure which way is the best way to do this for my purposes.
My purposes being having a textured (with an image) cube.

Also, I've been following a blend of tutorials, so I'm not sure which way is the most right and what I'm doing wrong (currently I haven't had the texture fit right).

Do I use glDrawArrays or glDrawElements?
For pointers, do I say gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertices); and gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, textureData);
or
gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0); and gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0);
When do I bind/unbind the buffers? (gl.glBindBuffer(GL.GL_ARRAY_BUFFER, VBOVertices); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboTextureCoordHandle);) Before I establish the pointers or not in my drawing method at all?
Do I need to specify the UV coordinates/Texture Coordinates in the shader? If I'm getting a weirdly stretched texture, does that mean my fragment shader and setting the uniforms is working correctly?

Thank you!
I can supply more code, but I think I just need more information on the basics.

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:
What parts of a GPL game engine must be released? I'm hoping I can clarify this issue.

Note, a similar question has been asked here, but it doesn't really give a specific enough answer that I can comprehend at this point! :- How does one escape the GPL?

I plan to use a game engine that has been released under GPL to develop a MMOG, and I plan to distribute the client for free. I'm concerned that when it comes time to release my game, I'm going to have to release the entire source code under GPL, which opens my game to risk of abuse, where someone can learn how to potentially hack my game client and give them an unfair advantage etc.

If I understand GPL, I only need to distribute code that I've edited directly. In the case of Java, I can extend the available classes, do to what I need them to do, rather than go back and make edits in the classes themselves. If i'm using the original code in this way, do I just need to point out that the code is available from the engine developers

Does extending a class constitute 'editing the source?'

sentences:
how to do partial updates in OpenGL? It is general wisdom that you redraw the entire viewport on each frame.

I would like to use partial updates; what are the various ways can do that, and what are their pros, cons and relative performance?

(Using textures, FBOs, the accumulator buffer, any kind of scissors that can affect swapbuffers etc?)

A scenario: a scene with a fair few thousand visible trees; although the textures are mipmapped and they are drawn via VBOs roughly front-to-back with so on, its still a lot of polys.  Would streaming a single screen-sized texture be better than throwing them at the screen every frame?  You'd have to redraw and recapture them only on camera movement or as often as your wind model updates or whatever, which need not be every frame.

sentences:
Java/Android pixel perfect hit detection I am making a game for android which I need hit detection between two objects. The first bitmap I have is a flying superhero, and the second bitmap is anything that he collides with.

The superhero bitmap is created on the fly by rotating the original bitmap between -90 and 90 degrees. As a result of the rotation, the bounding box is much, much larger than the non-rotated version. I have code to detect if the bounding box of the player hits any object, but visually this creates a problem when the object comes in contact with the skewed bounding box.

I need a solution that computes pixel-perfect hit detection between the player and the object, not just the bounding boxes.

I have been searching for the past 5 days for examples, tutorials, code snippets, or anything that could help me, but I haven't found a solution. The solution I'm looking for would be simply one function call similar to public boolean(obstacle theobject), where the obstacle's bitmap. coordinates, width, and height are returned with obstacle.getbitmap, obstacle.getx, obstacle.gety, obstacle.getwidth, and obstacle.getheight. The bitmap of the player is named rotatedbm and has global variables playerx, playery, playerh, and playerw.

I do not wish to implement external game engines or libraries.

I have read much on using int arrays with Bitmap.getPixels, and then comparing the arrays, but I cannot grasp the math behind comparing the arrays nor sorting out alpha values. I cannot afford to stay stuck on this one problem much long for the sake of development.

Thank you

EDIT- This is my implementation of the pseudo code. In the log, 'hit true' is never thrown but 'hit trying' is. Its not working as intended...

public boolean gethit(obstacle second){

        int px,py,ph,pw;

        Bitmap sprite1 = rotatedbm;
        Bitmap sprite2 = second.getgfx();

        px = playerx;
        py = playery;
        ph = sprite1.getHeight();
        pw = sprite1.getWidth();

        int ox = second.obx;
        int oy = second.oby;
        int oh = second.obh;
        int ow = second.obw;

        int [] AABB1bl = {px, py+ph};
        int [] AABB1tr = {px+pw, py};
        int [] AABB2bl = {ox, oy+oh};
        int [] AABB2tr = {ox+ow, oy};

        AABB2bl[0] -= AABB1bl[0];
        AABB2bl[1] -= AABB1bl[1];

        AABB2tr[0] -= AABB1bl[0];
        AABB2tr[1] -= AABB1bl[1];

        AABB1tr[0] -= AABB1bl[0];
        AABB1tr[1] -= AABB1bl[1];

        AABB1bl[0] -= AABB1bl[0];
        AABB1bl[1] -= AABB1bl[1];

        int start_x = AABB2bl[0];
        int start_y = AABB2tr[1];
        int end_x = AABB1tr[0];
        int end_y = AABB1bl[1];

        int ALPHAMASK = 0xFF<<24; // assuming colors are represented as 0xAARRBBGG

        int alpha1;
        int alpha2;

        Log.i("hit", "trying");
        for(int x = start_x; x < end_x; x++)
            for(int y = start_y; y < end_y; y++) {
              alpha1 = sprite1.getPixel(x , y*sprite1.getWidth()) & ALPHAMASK;
              alpha2 = sprite2.getPixel(x + AABB2bl[0], (y+AABB2tr[1])*sprite2.getWidth()) & ALPHAMASK;
              if(alpha1 != 0 && alpha2 != 0) {
                Log.i("hit", "true");
                return true; // you'd probably wish to return after a colliding pixel has been found
              }
            }
        return false;
}

sentences:
Exposing type definitions to modders in Unity Note that this question is not about modding assets/data and not about security, I plan to rely on community trust.
I don't know much about DLL's and I was wondering how I can provide interface and attribute definitions for modders.
For Kerbal Space Program modders only have to reference the Assembly-CSharp.dll, UnityEngine.dll and UnityEngine.CoreModule.dll files of a games build, to create and compile their own DLLs.

Are there certain things I have to do, to mimic this behavior, or does this work out of the box?
Are there gotchas to this approach?
Will a mods DLL, that was compiled using an older version of Assembly-CSharp.dll, break if the Assembly-CSharp.dll is updated, even though no types relevant to the mod changed?
Will modders be able to use Visual Studios debugging features for their DLLs?
Is there a better approach to provide type definitions?

My question is related to this question. But I would argue that that question is kind of broad, while mine is about one specific aspect.

Might not be needed for the question, but here are the two levels of modding that I would like to support for my game:
1. Easier modding
I want to compile .cs files of modders that implement special interfaces like IAbility, IItem, etc. I will use Roslyn or cs-sript to do so.
2. More advanced modding
I also want to load .dll's that modders compiled, allowing them to register their own Types in the games DI-Framework, mark methods/classes with attributes like CallMethodOnLevelLoad and use Harmony.

sentences:
Where can I get DirectX headers for Mingw? I have downloaded the latest Mingw toolchain from mingw.org, but it seems DirectX headers are missing. Where can I get those?

I assume there are open source compatibility headers out there, in particular for ddraw.h, which is deprecated by Microsoft.

sentences:
Algorithm to find average position In the given diagram, I have the extreme left and right points, that is -2 and 4 in this case. So, obviously, I can calculate the width which is 6 in this case.

What we know:

The number of partitions:3 in this case
The partition number at at any point i.e which one is 1st,second or third partition
(numbered starting from left)

What I want:

The position of the purple line drawn which is positio of average of a particular
partition

So, basically I just want a generalized formula to calculate position of the average at any point.

sentences: Can I use models of real cars with logos removed to avoid copyright infringement? My friends and I have recently started making a video game. We were going to make it an open world simulator, but can't figure out if using real cars with the real logos is copyright infringement. How can we stay on the right side of the law here?

sentences:
How can I render a shiny, metallic surface? I am creating a game for which I want to render a kind of shiny black metallic surface with some refection property in it. I know that there would be something related to masks involved with it. But somehow I am not able to get started on it.

So could someone give me insight in the matter or give a link to a good tutorial?

sentences:
Spawn Array of GameObjects to Array of Transforms I have a question regarding spawning an array of GameObjects in Unity. What I want to happen is that when a big enemy dies, it will spawn enemies into their respective Transform positions (i.e., Enemy 1 will spawn in Position 1, Enemy 2 in position 2, and so on).

I suppose I could go on with something like:

// C#

public GameObject[] Enemies;
public Transform[] SpawnPoints;

void KillEnemy()
{
    GameObject enemy1 = Instantiate(Enemies[0], SpawnPoints[0].position, SpawnPoints[0].rotation;
    GameObject enemy2 = Instantiate(Enemies[1], SpawnPoints[1].position, SpawnPoints[1].rotation;
    GameObject enemy3 = Instantiate(Enemies[2], SpawnPoints[2].position, SpawnPoints[2].rotation;

    Destroy(gameObject)
}

But the problems are:
1. I'm aware that the code is expensive to run, especially since I'm doing a 2D game; and
2. It provides no flexibility, meaning if I want a different enemy to use the same code, then I won't be able to do stuff like adding more enemies to spawn (after the first one dies, of course).

So yeah, I hope I get some help with this. Thanks!

sentences:
How to implement the seek steering behavior in Unity3d? Following this tutorial: Understanding Steering Behaviors: Seek, I tried to add seek and steering behavior to my Unity prototype but it's not working this is my script. The cube does not steer it just follows the target.

public GameObject target;

    float maxForce = 15;
    float maxSpeed = 30;
    float maxVelocity = 200;
    float mass = 15;

    Vector3 velocity;

    void Start() {
        velocity = Vector3.zero;
    }

    void Update() {
        transform.LookAt(target.transform);

        var desiredVelocity = target.transform.position - transform.position;
        desiredVelocity = desiredVelocity.normalized * maxVelocity * Time.deltaTime;

        var steering = desiredVelocity - velocity;
        steering = Vector3.ClampMagnitude(steering, maxForce);
        steering = steering / mass;

        velocity = Vector3.ClampMagnitude(velocity + steering, maxSpeed);
        transform.position += velocity * Time.deltaTime;

    }

What could be the problem??

sentences:
why is my (from example) shader appearing as black? I have the following (very simple) shader:

#pragma kernel CSMain
RWTexture2D<float4> Result;

[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
    Result[id.xy] = float4(1,0,0,1);
}

Here is the dispatcher code:

using UnityEngine;
using System.Collections;

public class SkyShaderDispatcher : MonoBehaviour {

    public ComputeShader shader;
    public RenderTexture output;
    void Start(){
//      RenderTexture output = new RenderTexture(256,256,24);
//      output.enableRandomWrite = true;
//      output.Create();

    }
    void Update(){
        RunShader();
    }
    void RunShader()
    {
        int kernelHandle = shader.FindKernel("CSMain");
        shader.SetTexture(kernelHandle, "Result", output);
        shader.Dispatch(kernelHandle, 256/8, 256/8, 1);
    }
}

which is the default red shader (it makes the texture red).
However, when I put the texture in a material and give that to an object, then that results in the object being black. Anyone seeing what I'm doing wrong?

As the shader is the default example right now it should work suggesting that maybe something is wrong with the texture?

Edit:
Trying to fit the same code on a skybox also fails. I have changed the dispatcher code into:

using UnityEngine;
using System.Collections;

public class launchClouds : MonoBehaviour {

    public ComputeShader shader;
    private RenderTexture output;
    void Start(){

    }
    void Update(){
        RunShader();
    }

    void RunShader()
    {
        int kernelHandle = shader.FindKernel("CSMain");
        RenderTexture output = new RenderTexture(256,256,24);
        output.enableRandomWrite = true;
        output.Create();
        Material mat = gameObject.GetComponent<Skybox>().material;
        mat.SetTexture("_FrontTex",output);
        mat.SetTexture("_BackTex",output);
        mat.SetTexture("_LeftTex",output);
        mat.SetTexture("_RightTex",output);
        mat.SetTexture("_UpTex",output);
        mat.SetTexture("_DownTex",output);
        shader.SetTexture(kernelHandle,
                          "Result", output);
        shader.Dispatch(kernelHandle, 256/8, 256/8, 1);
    }
}

but that turns the sky black rather then making the sky red. This is using unity 5 32 bits with DirectX11.

sentences:
Stuck on walls or sliding on top dilemma I'm making a 2.5D platformer game. I earlier had problem with my character getting stuck on walls when holding the forward button. I solved this problem by adding a physics material with zero friction to my colliders on the wall. So now when hitting a wall the character slides down, which is correct.

My walls consits of 1 unit cubes tiled together, and box colliders are generated and merged at runtime.

Now I've created a ladder and by pressing a button the player will rotate 180 degrees, and I also add some force along the y- and z-axis:

var force = -transform.forward + Vector3.up;
force.y *= JumpOffForceY;
force.z *= JumpOffForceZ;
_rigidBody.AddForce(force, ForceMode.Impulse);

Now when the player lands on the top of the wall, which has the same box collider, and physics material, the player slides very jerky for a long time before coming to a halt.

I understand why this happens, I've been trying to find a solution. One solution I'm thinking of is to change my algorithm that creates the box colliders and divide them so there is one box collider on the top with higher friction, and one for the walls with zero friction. Before I delve into that, is that a good solution? Or is there any other way?

Have a nice day!

sentences:
RTS Style Game With Client-Side Prediction So, I am currently working on an RTS-like multiplayer game. Units are not controllable by players (they attack-move to a location automatically).

I decided not to go full lockstep but instead do a state-based / prediction hybrid. The game is fully simulated on the client with a state packet for every unit distributed only once per second (Position, health etc.). I've read that this is quite a common method of doing things these days but i'm having major issues with it. One clear problem is with health syncing. Damage is dealt locally on every client machine and corrected via the state packet. This results in issues similar to this:

Projectile hits a unit on a client machine, taking him from 100 health down to 50.
Client only then receives a state packet from the server saying he is on 100 health which spikes it back up.

Of course he will receive another corrective packet later on taking him back down to 50 but this causes really bad visual spikes. This issue gets even worse if you consider the impact of ability damage and such.

Have I completely misunderstood what is required to create a client-predicted game or do I just need to treat every variable on a case-by-case basis? (I.E. Put in silly hacks to make the health not look bad).

sentences: How do you save game state? What is the procedure followed by game programmers for saving and resuming game state? like files/mappings. I want to save it for tower defense game and I am using unity3D game engine.

sentences:
How to make a class diagram and data model of a Unity3D game? I'm developing a 3D platformer video game on Unity3D and I've been asked to present its UML class diagram and data model. If I'm not mistaken Unity uses an entity-component-system, which necessarily doesn't use heritage. How would a class diagram from a Unity game look like, in that case?

Also, I've been taught that usually data model refers to entity-relationship-models that represent a database. In the case my game doesn't use a database, how could I diagram the way the player's data is store on the game? I'm storing the player progress on a file in the user's computer.

sentences:
Help understanding Simplex Noise Introduction

This is less of a "how to" on using 2D simplex noise and more of a quest to understand what is happening both in the math and visually. I would rather not copy and paste the code I've found. I really would like to understand it.

I have done my homework on the subject and have read through Stefan Gustavson's paper and other sources many times. I feel like I understand about 70% of what my sources are saying, but when I try to manually follow my code loop through to check my understanding I either get hung up on what the variables represent or the math just doesn't add up.

I have begun to rename the variables in the code I've found in order to better understand what's going on. If someone with some knowledge of what is actually happening can cross reference the original code (basically Gustavson's code) with my code that would be most excellent. I'm not actually done with renaming the variables though, partly because I'm stuck.

My Understanding

Let's say I pass pixel (2, 3) into my noise function. At this point I'm working with a normal grid and my goal is to translate this normal grid into a simplex. This simplex is in the form of many triangles since we're working in 2D and supposedly this is better for various reasons.

To translate this point from the normal grid to the simplex grid, I must scale the point along the main diagonal line. After doing that, I apparently don't care about the decimals because I then Floor the results putting it back near the closest previous grid point.

Now I'm going to align the simplex cell to the normal grid by unskewing the simplex cell. Why I do all this work to get to the simplex cell, then undo it I'm pretty hazy on. Seriously, I think the best way for me to understand this is if someone could whiteboard out in steps what the heck is going on here. Super lost.

I didn't walk away empty handed though. I now have what I believe to be the distance between the original grid point I passed in and the simplex point I translated from that original grid point. Woo.

I think I'll stop here for now, just because I don't want this to turn into a huge wall of text. I'm pretty sure the rest of this will click once I understand the the beginning part.

Weird Math

Using the (2, 3) point from earlier, this is what I get by stepping through my own code on paper:

x = 2
y = 3

skewfactor = 1.830
unskewFactor = 1.479
unskewed_x = 1.520
unskewed_y = 2.520
simplexCell_i = 3
simplexCell_j = 4
x_distance0 = -1.520
y_distance0 = -1.520
i1 = 0
j1 = 1
x1 = -1.309
y1 = -2.309
x2 = -2.5207
y2 = -2.5207
ii = no idea why this isn't i2 or something like that. No idea what this is.
jj = same

Not sure if plotting on a graph would work, but I tried and it looks so bad. I used the original parameters (2, 3), simplexCell_i & j, i1, j1, x1, y1, x2, and y2. Doesn't make any sense visually.

Not just visually, but mathematically as well. What's with (2, 3) returning negative numbers that go off the chart? What am I doing wrong here?

sentences:
Movement with box2d using libgdx I am pretty new to using physics engine and would like to know what is best practice for movement of playercharacters.

Currently I have a class called Hero that has a CircleShape and when the user presses left/right/up/down it gets an linear impulse in the appropiate direction. All this works fine. The problem happens when the player does not produce any input, the shape is going further in the last direction for a long time, but I would like it if the shape stops faster.
The players sees the world top down, so the worlds gravity is set to (0;0).

Maybe the whole idea of using impulses to move the character around is flawed, I would just like to know what works.

sentences:
My sprite is not listening to any keyboard keys First time ever creating html canvas game. Once I finally got my sprite ant tiles drawn on the canvas, now I want to make my sprite interactive. Unfortunately, for some reason it is not working. I get a message in console when the certain key is pressed but the sprite is not changing its position. I wonder why?  The code:

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");

var mapArray = [
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 2, 2, 0],
  [0, 0, 1, 1, 1, 0, 0, 2, 0, 0],
  [0, 0, 1, 1, 1, 0, 0, 0, 0, 0],
  [0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
  [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
]

var StyleSheet = function(image, width, height) {
  this.image = image;
  this.width = width;
  this.height = height;

  this.draw = function(image, sx, sy, swidth, sheight, x, y, width, height) {
      context.drawImage(image, sx, sy, swidth, sheight,x, y, width, height);
  }
  this.drawimage = function(image, x, y, width, height) {
    context.drawImage(image, x, y, width, height);
  }
}

/* Initial Sprite Position */

var boatPosX = 230;
var boatPosY = 200;

var Loader = function(src) {
  this.image = new Image();
  this.image.src = src;
  this.image.onload = function() {
  var sprite = new StyleSheet(background, 36, 36);
  var ship = new StyleSheet(boat, 90, 100);
  for (let i = 0; i < mapArray.length; i++) {
    for (let j = 0; j < mapArray[i].length; j++) {
      if (mapArray[i][j] == 0) {
        sprite.draw(background, 190, 230, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
      if (mapArray[i][j] == 1) {
        sprite.draw(background, 30, 30, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
      if (mapArray[i][j] == 2) {
        sprite.draw(background, 200, 20, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
    }
  }
  ship.drawimage(boat, boatPosX, boatPosY, 50, 50);
}
  return this.image;
}

/* Sprite controls */

function move(e) {
  if (e.keyCode == 39) {
    boatPosX += 2;
    console.log("works");
  }
  if (e.keyCode == 37) {
    boatPosX -= 2;
  }
}

  document.onkeydown = move;

var background = new Loader("ground.png");
var boat = new Loader("ship.png");

console.log(background);

sentences:
Is Table the only layout that I can use in libgdx? I'm looking for the common way to handle the layout in libgdx.
I searched google and found only table layout.
Meanwhile I don't use any layout and just insert coordination into each visual object but I think that this is not the proper way to do it...
Is their any other layout that I can use?

p.s
The game layout should split into two parts, left is smaller that the right and contains things like score time and info about stuff in the game. The right part will display the game-play itself

sentences:
Unity Rendering Pass Before Refraction not showing In the documentation it states:

Before Refraction: Draws the GameObject before the refraction pass. This means that HDRP includes this Material when it processes refraction. To expose this option, select Transparent from the Surface Type drop-down.

I have selected the Transparent option for surface type but the Before refraction rendering pass is not in the drop down list for rendering pass. How can I get it to be there? Are there some other option that might be disabling it?

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:
Calculation of a fight with many entities User A can have many entities

A Entity is a object that has properties such as health, attack, defence, agility, stamina, etcetera.

When User A want to attack User B with x entities I am looking for the algorithm/equation to calculate the fight. I have brought some couple of ideas but they all have some pros and cons and I am not sure which one I would use or If I should use one of them at all?

Model A - The while loop
Basically I would get all the entities that is suppose to fight in this battle, I would assign each of them (objects) in to an array (the User A array and the User B array). Now I would simply loop through until one of the array is empty. Inside the loop I would let one of the User attack first, calculate the result (If the Entity has 0 health, remove it) and then let the next User attack back, calculate the result (If the Entity has 0 health, remove it) And then continue.

The Pros with Model A would be that every entity would be battling and instead of just do a calculation on all around there would be a justice fight.

The Cons To loop through like 10 entities would be fine but what about 1000-2000 entities? And how about the different strength of each entity I mean how could I decide which entity should battle against what entity? This could be just an sorted array (weakest > to strongest) But then I couldn't have like different types of entities is better against a different type of entity, meaning like a Gunner  wouldn't mean anything If it met a Swordsman even though a Gunner would most likely win such in a real fight.

Model B The idea of Model B is quite simple basically calculate all the attributes (properties) together and then If User A army has greater stats than User B army, User A army would win the fight. The Pros with this is it easy on the performance. The Cons are "Which entities would survive?" And it would basically be, the one with greatest army would win. You wouldn't even have a "chance" to win.

Model B B Then I started to think what If I take the concept of Model B  calculate the stat and then I have a battle between just those two single entities. This way User B actually would have a chance ( a small one but the possibility to win) even though the User A has greater army (better stats). The Cons are yet again, How would I know which entities that would survive on the winning team?

The answer I am looking for to this question is what Model should I use? And how would I solve the cons in that particular Model. Or should I use some completely different model (idea) ? (If possible please provide some php pseudo code)

sentences:
Swapping Y and Z in quaternion I am converting between coordinate systems where Z is the vertical axis in one, and Y in another. I have the rotation values represented as a quaternion.

I see this related issue but it's switching the handedness (DirectX and OpenGL): Switch axes and handedness of a quaternion?

How would I go about swapping these values? I'd prefer not to convert to a vector3, modify and convert back again.

sentences:
How could I implement programming as a mechanic? I am wondering how I could manage to execute programs made by players in my game via some sort of in-game computer. I have been trying to figure it out but I have no idea how it is even possible.

Examples of other games that do this are:

ComputerCraft
Space Engineers
Screeps
Glitchspace

I just need a basic explanation of how I could do it so I can start making my own games with in-game coding as a mechanic.

sentences:
What causes seemingly random triangle artifacts in OpenGL? When switching version of OpenGL from 4.5 to 4.4, I suddenly started seeing these weird random triangles flickering over my scene

They move around somewhat randomly and are always pointed towards [0,0].

Given that this only appears in 4.4 and not in 4.5, my guess would be that I have some undefined behavior that manifests only in one version? I'm not using any advanced OpenGL, just drawing basic triangles with VBO buffers.

How should I go about debugging these sorts of issues, and what are the likely causes that manifest as artifacts? (The hexes and the white-ish path are what I inteded to draw, only the black/yellow/blue triangles are the artifacts)

sentences:
C++ Passing Functions to Objects/Projectile system woes I am new to C++ development and I am trying to create a more flexible projectile system.

In my current system I apply a equation to move the point down the bullet path.

class Bullet{
    public:
      float x;
      float y;
      float speed;
      float angle;

     void Update(){
     x=(speed*cos(angle)) + x;
     y=(speed*sin(angle)) + y;
     };
}

This works fine for moving a bullet on an angle, however I would like to generate much more complex paths, without over complicating the bullet class.

My idea was to pass a function to the bullet class that would be used to move the object but I have not found any way to do this.

Example of what I want to do:

class Bullet{
    public:
      function dostuff();
      float x;
      float y;
      float angle;

     void Update(){
     dostuff(x,y,angle,speed);
     };
};

class Enemy{
    public:
      float x;
      float y;
      float speed;
      float angle;

     void shoot(){
      Bullet bullet;

      auto movangle = [](float x, float y, float angle,float speed)
      {
         x=(speed*cos(angle)) + x;
         y=(speed*sin(angle)) + y;
      };
      bullet.dostuff = movangle;
      bullet.Update();
     };
};

If anyone knows of any ways to implement a system like this, or ideas on alternatives that could produce similar results It would be appreciated as I am somewhat stumped.

sentences:
How to make a sprite above my character appear on the minimap attached to the floor? I have a project where I made 2 minimaps.

One of minimaps is linked to the character of my project and the other to the floor:

As I already said in the title of the question, my character has a sprite above the head (red arrow) that appears on the minimap attached to it, but does not appear on the minimap attached to the floor.

Image:

I looked at the rendering options and many others, but I could not get the sprite to show up. How do I get the sprite to appear on the floor minimap?

EDIT 1 (Showing how I made the minimap)

I used a SpringArm:

And a SceneCaptureComponent2D:

The PaperSprite is not the children of the SpringArm and stands a little below the SceneCaptureComponent2D:

The minimap is made from a RenderTarget. From this RenderTarget a material is created:

Widget Blueprint:

sentences:
How can I handle two collisions in the same frame? My problem is that I have a player with collisions, and enemy can collide with players collision and execute Hurt function in players script. But the problem is enemies can overlap and can hit the player in the literally same frame. So they both execute Hurt function.

In my Hurt function I change players collision layer for a 2 seconds, and he is no longer be able to seen by enemies. But it doesnt matter because of the same hit by two or more enemies in the same frame.

How can I solve this? I tried bool to check if Hurt function is executed but it doesnt work too...

Here is :

Code on Enemy:

 IEnumerator OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Player"))
    {
        //burası kediler üst üste bindiginde birden fazla kez calisabiliyor
        charMovementRef.StartCoroutine(charMovementRef.Hurt());

        Debug.Log("hasar yedi");
    }
}

Code on Player:

//Hurt should only works one at the same time
public IEnumerator Hurt()
{
    //layer değiştirerek düşman collisionlarından kaç
    gameObject.layer = 9;
    //canı azalt
    health--;
    HeartUI(); //show the new health on UI
    //karakter görüntüsü yanıp sönsün
    gameObject.GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 0.5f);
    //playerı zıplat
    rb2D.velocity = new Vector2(rb2D.velocity.x, 0);
    rb2D.AddForce(new Vector2(0, jumpPower / 1.2f));

    //2 saniyeliğine colliderları kapalı kalsın, sonra eski haline çevir
    yield return new WaitForSeconds(2);
    gameObject.layer = 0;
    gameObject.GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f);

}

sentences:
Where is the XACT documentation? All the links here are broken:

http://msdn.microsoft.com/en-us/library/bb172314.aspx

sentences:
Fastest 3D collision detection between two oriented bounding boxes (OBBs) I am at the point in my game where I need to add a collision system. I tried jBullet, and while it did work, it wasn't what I was looking for. I just want a simple way to test if two oriented bounding box (OBB) trees are colliding.

I was going to do collision by using the tree.  Make an AABB for broadphase, then if that passes test if each OBB in tree collide with the other tree.

I did find a few things on the internet, but I couldn't understand them completely. What I am asking for is a website or resource that explains 3D OBB collisions well?

I learned that GJK is faster than SAT, and it appears to be able to tell me how far the boxes penetrate each other. I found some GJK stuff, but they were not boxes; instead, more complex and confusing things.

I just want to be able to make an OBB from 3 vectors: center, size, and rotation of each axis. Then be able to test collisions with those. Thank you in advance for anything you post.

sentences:
Unity3D - Upload a image from PC memory to WebGL app I need user to upload his(her) avatar picture from PC to game

How can I create a file dialog and upload a image to WebGL game?

sentences:
Offloading processing to a remote server in a game engine? What kinds of processes can you offload to a remote server in a game engine?

I'm thinking of making a real time multiplayer RTS, like Starcraft for example.

I was trying to offload as many processes as possible onto a remote server to:

1) Practice the techniques involved in order to offer a responsive gaming experience
     while taking advantage of the latest cloud processing techniques.

2) To make an engine that's the most platform independent possible.

I've already thought of a couple of things that could be processed remotely:

AI (Path finding)
Volumetric particle effects (Smoke after an explosion)
Loading between levels?

I'm also most curious about the following things being possible:

Rendering
Physics

If anybody has any knowledge to share about this subject I'd very much appreciate some guidance.

sentences:
Maya 3d Model. 2+ Materials on a face? Snooker Table felt with lines overlay I've made a snooker table in Maya for use in a game in Unity.
The felt texture on the table is a tiled texture, I used Blinn, and 'place2dTexture' node to do the tiling.
It all looked great. Except I had hoped to 'overlay' another texture on top of the felt which is the straight line and semi-circle drawn across the table.
I couldn't use the same texture with UV mapping because the felt texture is tiled, and of course the lines texture is not (ie. It is intended to fill the whole plane on 1 to 1).
Is there a solution to this? Basically I need to know a way to overlay a non-tiled, partly transparent texture, on top of a tiled one.
Thanks for any help.

sentences:
GL_SPOT_CUTOFF not working properly I'm new to OpenGL. I'm studying OpenGL 2.1 and I'm trying to make a little program to test the GL_SPOT_CUTOFF property, but when I set a value between 0.0-90.0, the light doesn't work and everything is dark.

The code:

void lightInit(void) {

    GLfloat light0Position[] = {0.0,0.0,2.0,1.0};
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 45.0);
    glLightfv(GL_LIGHT0, GL_POSITION, light0Position);
}

void reshapeFunc(int w, int h) {

    glViewport(0, 0, (GLsizei) w, (GLsizei) h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    if (w <= h)
        glOrtho(-4, 4, -4*(GLfloat)h/(GLfloat)w, 4*(GLfloat)h/(GLfloat)w, -4.0, 4.0);
    else
        glOrtho(-4*(GLfloat)w/(GLfloat)h,4*(GLfloat)w/(GLfloat)h, -4, 4, -4, 4.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    gluLookAt(0,0,0,0,0,-1,0,1,0);

}

void displayFunc(void) {

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // center sphere
    glutSolidSphere(1, 100,100);

    // right sphere
    glPushMatrix();
        glTranslatef(3,0,0);
        glutSolidSphere(1, 100,100);
    glPopMatrix();

    // left sphere
    glPushMatrix();
        glTranslatef(-3,0,0);
        glutSolidSphere(1, 100,100);
    glPopMatrix();

    glutSwapBuffers();

}

void keyboardFunc(unsigned char key, int x, int y) {

    if (key==27) {
        exit(EXIT_SUCCESS);
    }

}

int main(int argc, char** argv) {

    //freeglut init and windows creation
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(600, 500);
    glutInitWindowPosition(300, 100);
    glutCreateWindow("OpenGL");

    //glew init and errors check
    GLenum err = glewInit();
    if (GLEW_OK != err) {
      fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
      return 1;
    }
    fprintf(stdout, "---GLEW %s---\n\n", glewGetString(GLEW_VERSION));

    //general settings
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);

    //light settings
    lightInit();

    //callback functions
    glutDisplayFunc(displayFunc);
    glutReshapeFunc(reshapeFunc);
    glutKeyboardFunc(keyboardFunc);

    glutMainLoop();

    return 0;

}

This code produces this image:

If I delete glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 45.0);, the next image is produced:

Is there some kind of bug ?

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:
glm rotating quaternion in Y axis deforms object I'm implementing my own game engine in C++ and I need help here,

I have a game object, its orientation property is a quaternion and I want to rotate it A degrees in the Y axis.

So, I have:

currentAngle += 0.01; // currentAngle is a member variable, so yes i initialized it
quat q(currentAngle, vec3(0, 1, 0));
myGameObject->SetOrientation(q);

GameObject::SetOrientation(quat q)
{
 myOrientation  = q;
}

but as the game object rotates, it also gets scaled (deformed). So I checked how I am applying the transformation matrices

myModelMatrix = Math::CreateTransformationMatrix(
    transformation->GetPosition(),
    transformation->GetOrientation(),
    transformation->GetScale());

mat4& Math::CreateTransformationMatrix(vec3&    translation, quat& orientation, vec3& scaleSize)
{

     mat4 translate = glm::translate(glm::mat4(), translation);
     mat4 rotate = glm::toMat4(orientation);
     mat4 scale = glm::scale(glm::mat4(), scaleSize);

    return  translate * rotate * scale;
}

but it looks ok (at least to me), I removed the scale matrix form the multiplication to check if somehow I was doing something with it. However, it didnt fix anything.

I also tried:

  quat q(currentAngle, vec3(0, 1, 0));
   quat orientation = myGameObject->GetOrientation();
   orientation  = orientation  *q;
   myGameObject->SetOrientation(orientation);

But it didnt work either.
I also checked the code in my shaders and I am positive is not the problem.

This is how I send the matrices to the shader:

glUseProgram(progarmId);1
    glUniformMatrix4fv(uniforms[name], 1, GL_FALSE, glm::value_ptr(matrix));

I tried modifying the 3rd parameter to True and swapping the order of the projection view matrix multiplication and it didnt work either :/

So, guys ... any ideas what could I be doing wrong ? I'm out of ideas :/

sentences:
Create 2D sprites with libGdx using a shape and a texture separately I am creating a 2D game with LibGdx that will have creatures that are generated from dozens of characteristics with potentially millions of unique combinations. For each segment of each creature, I want to use two sprites so that I can mix shapes and colors and cut down on my resources. I would like one sprite to be a black and white (or grayscale) of the shape of the body part while the second sprite is just a color pattern. I think I may need to write a shader that splices the color pattern onto my shape to give me the sprite I need. I just need some guidance on how to get started.

Another way of explaining this is with the example of clothing. I want to be able to draw a shirt shape, and pants shape, a socks shape, etc. and also draw different fabric patterns. Then I would mix and match the clothing with the pattern instead of drawing every possible combination. How can I accomplish this with LibGdx?

sentences: How to make a fan like behavior I am making a game in Unity. I have an object e.g. cube. I want to release air from it like fan so that when other cubes come closer, it throws them away. What velocity,force etc I will need to do that?

sentences:
Is it efficient to have a only-data MonoBehaviours on lots of game objects? I'm working on a voxel based game and this solution would make the implementation of networking and other features a lot more easier, it is less error-prone, easier to edit in the Editor, etc.

So the question is:

How bad is it performance-wise to have lots of MonoBehaviours in the scene, if they don't implement any of the MonoBehaviour methods?
(So they only have primitive data stored in them)

sentences:
(Unity) Is there a way to automatically create a material for each texture and assign the texture to it? I have imported hundreds of textures in my Unity project, and I'd like to create a material for each of them. This would obviously take a lot of time, so how would I go about doing this automatically?

These are just basic textures that I want to assign to albedo on the standard Unity 5 shader. No need for normal maps.

sentences:
How can I avoid jitter when working with a 2D movement system? How can I avoid jitter in Unity?

Let's suppose that I want to create a 2D movement system using a Rigidbody 2D(Dynamic), and I want make the camera follow the character (which is a pixel art sprite).

How can I create a "jitter proof" 2D movement system for 2D pixel art games in Unity?

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:
Creating a collision shape for a complex model I'm currently creating the collision system for my 3D XNA game.

To check collisions with models (especially complex ones) like trees or other plants, I thought about rendering a low poly version of this object and check if the player is in collision with that low-poly shape.

I succeeded in getting all the positions of all vertices in my models. If my model is a cube, I get the 8 vertices, but how can I check if the player is inside this shape?

sentences:
MMORPG - Representing Money in a DB table Where to begin... I'm currently busy with a few Udemy courses on game development using Unreal Engine 4. My end goal is to develop an MMORPG that I've always wanted to play, but never found online.

Q: How would I represent in-game money in a database table?

I've thought of adding it as a field in the "character" table, but then I struggle to see how I can implement it as a field in the "bank" table... Bank already has a quantity field, so I though about adding the money values as "items", but I just can't get myself to approve that...

Some information on the table fields:

Each players bank will have a size limit (upgrade-able) on how many items they can place in it. I was thinking of moving it out to the "character" table as it doesn't really have anything to do with the bank table...

As for the rest of the tables, I'm still working on them. For now I just wanted to get the communities opinion on how to represent money in an mmorpg database.

sentences:
How to structure a non rectangular maze I have built a few mazes and are familiar with maze algorithms however all examples I have learnt from are square or rectangular.

In these mazes the code structure usally has a 2d array of maze cells and it is easy to navigate or test to adjacent cells.

How do you structure the code for a say a Y or circular shaped maze to know what the avaliable joints between cells/nodes in the maze are?

sentences:
Hexagonal Game Board Modal? Tile-based games like Chess have a simple modal: an array of arrays, each coordinate with an X and a Y value. This is easy to implement, and it is easy to figure out what is going on.

Chess Board http://www.chesscentral.com/EasyEditor/assets/chess_board_blank.gif

However, when I see games like Civilization 5, I am not sure how hexagonal worlds are implemented. I have a couple ideas, but cannot confirm them.

Each row of hexagons is represented in the modal by an array of tiles. This would be much like the first chess board, but would require more effort to figure out adjacent tiles.
Each tile only know what tiles border it. When the game renders one tile, that tile loads the 6 around it, which repeats until the screen is filled with tiles.

Are either of these guesses correct? If not, how do developers implement these hexagonal maps?

sentences:
What is the name of this power or value-oriented gameplay mechanic? I would like to identify the name of a certain gameplay mechanism. It is fairly commonly seen but probably best illustrated with card games:

A game played with a pack of cards usually has card values ordered in the following way:

A > K > Q > J > 10 > 9 > 8 > 7 > 6 > 5 > 4 > 3 > 2

Sometimes the lowest-ranked card (in this case 2) is specially ruled to trump the highest-ranked card (in this case A). Is there a proper name for such a mechanism?

sentences:
How to align a hint arrow to point along a path? I am using CalculatePath and trying to use path.corners in order to give user a hint for path, that where should he lead next. I am using first two instances of Vector3 of path.corners. Lets call those vectors A and B. Let me illustrate this using figure.

Now I want to position my arrow above the midpoint of the line from B to A, and orient it so it's pointing along the direction from B to A.

When I orient the arrow with LookAt(), it doesn't point in the same direction as the path. Here is an image of my arrow prefab, showing how it's oriented:

sentences:
Project updates don't show up on mobile device I've made a small application with libgdx framework, which works perfectly on desktop. It runs on Android too, however once I change something in my main project and try to recompile it on my phone, it seems like the Android still runs the old version.

I've tried to re-install the app, but it does not help. The only way I can see the changes on my phone is to recreate a different Android project.

Any ideas what might be causing this kind of behavior?

My projects are created the way it is shown here: http://code.google.com/p/libgdx/wiki/ProjectSetup

EDIT: Not sure why, but everything seems to work fine after "re-installing" Eclipse

sentences:
Earth and sun - How to make the sun revolve around the earth in the following code? I want to imitate the planetary system with Earth and Sun drawn as solid spheres on the same window. I have drawn the two: the earth as the bigger sphere and the sun as the smaller sphere.

Now I want the earth to revolve around the sun when I press key A and when I press key B the earth must rotate around its axes. How do I achieve this? Thanks.

Here is the code so far:

 #include <GL/glut.h>
 void init(void){
 glClearColor(0.0,0.0,0.0,0.0);
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 }
 void display(void){
 glClearColor(0.05,0.05,0.5,0.0);
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 glColor3f(0.03,0.05,0.09);
 glutSolidSphere(0.5,30,30);//Earth
 glMatrixMode(GL_MODELVIEW);
 glLoadIdentity();
 glTranslatef(.7,.7,.7);
 glColor3f(1.0,1.0,1.0);
 glutSolidSphere(0.2,50,50);//Sun
 glLoadIdentity();
 glFlush();

 }
int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowPosition(10,10);
glutInitWindowSize(400,400);
init();
glutCreateWindow("Planets");
glutDisplayFunc(display);

glFlush();
glutMainLoop();

}

sentences:
Flow effect to static water on a isometric city Hello everyone I want to give the idea that the river in my city is flowing but I am having an hard time to figure how.

Do you have any idea of what I should look into to?

sentences:
Different ways to store a 2D map/landscape in XNA I was looking around at this site about eight months ago and wish I saved the location of this topic but I was wondering the different map rendering styles that you can do in XNA.  The one style I looked at was using a text file to pull characters like "X" would be a monster and "O" would be the player.  Is there another way with out an external file that I can put tiles from a sprite sheet to randomly create a map.  Of course when dealing with random buildings I would have certain building designs so that if some one was playing they wouldn't see a building with half a wall missing.

This is for a top down 2D game.

sentences:
All scripts in Unity game can not be loaded I can not provide a "why" here, because as far as I can tell it happened spontaneously - after saving an edit to one of my scripts, it just started happening. But here's the problem:

Every single one of my scripts, while still in the same Scripts file, can no longer be found and loaded. All the Script Components (take the Game Manager component for example) now look like this:

or like this:

Attempting to locate the scripts by going Add Component > Scripts > [Desired Script] doesn't work, because there isn't even a Scripts item in the Add Component menu. I have already looked this up, and none of the answers I found were applicable:

Yes, every script's file name is the same as the Class name within them
I have tried reimporting all  assets (Assets > Reimport All), no success.
Taking all scripts out of the project, restarting unity and then reimporting the scripts. Nothing
Removing all script components, then reapplying them. It didn't work because, as I said, there was no Script item in the Components menu.

This is a pretty game-breaking, literally, because this is a hobby game (I'm not doing this as a job, it's just in spare time). If I can't restore the game as it was, I won't be able to bring myself to restart it. So any help is greatly appreciated.

sentences:
Octree Terrain Destruction and LODs Meet my octree world:

My end goal is to have this world destructible, and I am having an issue warping my head around how this can be done when you have LOD. The basic principle of LOD (as I understand it) is to collapse nodes that are further away from the camera (removing them from RAM completely), and divide nodes that are closer (allocating new memory in RAM), by doing this you only have X amount of memory allocated at once.
The issue arrives when you think about how to generate the LOD back after collapsing the tree. The only way I can think of is to use the same Noise function to sample the tree at the node you are dividing (like in the initial generation of the world) and use that to figure out how the children of the tree need to look.
But what happens when a user has modified that node beyond the Noise function? How can you collapse the tree and then divide it down again while restoring the user's modifications?
(Is the only way to keep separate track of all voxels changed by the user?)
That's all folks, thanks :)
(Language: C++)

sentences:
Unreal Engine 4 Error 2738 I am having trouble installing UE4 on my computer. I keep getting Error 2738 as I start the installation and can't find a fix. Even Microsoft Fix It 50842 won't work.

I've attempted to re-download installer, reboot, use a flash drive. Still the same error.

Anybody else been having this issue? If so how did you fix it?

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 realistic rainfall animation in modern OpenGL using shaders? I see many examples of particle system in old style OpenGL with falling raindrops. Examples of rainfall that can interact with environment lighting and look realistic are hard to find. How to create realistic rainfall animation in modern OpenGL using shaders?

sentences: Analyzing movement data for a checkerboard For a psychology experiment - subject has to learn that the 2D grid is a checkerboard, and collect all the 1s (rewards). How do I test if subjects are actually doing it in the most optimal way -- making least effort for moving from one square to the next by taking smaller steps (or selecting closest reward neighbour). My guess is that if I could simulate a learning algorithm and approximate how long it takes to learn the reward distribution, and then explore it optimally (optimality is defined as a unit of time and exploring closest squares first), I could compare the behaviour.

sentences:
Is game software design the same as non-game software design? Is the software design process for a game similar to a non-game?
Do developers create UML diagrams?
I ask because of the iterative nature of game development, I wonder if creating a UML diagram would just be a waste.

sentences:
Use of FlxG.camera.follow to follow a character vertically I am developing a prototype for a game in Flixel in which a character floats upward continually to traverse the level. I would like to have a "tall" layout for levels and set the FlxG.camera to follow the character as he floats upward. My issue is in understanding the proper use of FlxG.camera. I have my game constructor coded as follows:

package
{
    import flash.display.Sprite;
    import org.flixel.*;

    [SWF(width="640",height="480",backgroundColor="#000000")]
    public class MyGame extends FlxGame
    {
        public function MyGame()
        {
            super(320,240,PlayState,2);
            forceDebugger = true;
        }
    }
}

In the override of create() in the PlayState.as file I attempt to set the camera to follow the player as follows:

public var TheClimber:BalloonHero;

        override public function create():void
        {
            /*set background color*/
            FlxG.bgColor = FlxG.BLUE;

            /*Set data for player*/
            TheClimber = new BalloonHero(FlxG.width/2-5,480);

            /*Add camera and set it to follow The Climber*/
        //which will automatically set the boundaries of the world.
        FlxG.camera.setBounds(0,1280,640,1280,true);
        FlxG.camera.follow(TheClimber,FlxCamera.STYLE_PLATFORMER);

            /*add player to the game*/
            add(TheClimber);
        }

I assumed this would set the camera bounds to twice the height of the SWF background(i.e. the FlxG height) and then scroll the background along with the specified FlxObject(TheClimber in this case) until it had reached the height of the game. However, I must be going about it incorrectly because when the zoom is 2 and the game height 720 the camera starts at the top of the screen with the player character not visible at the bottom of the game height.
Is there a way to start with the camera/game focused on the bottom of the game object(FlxG.height) ? Or am I going about this the wrong way and have other issues with the way I am using the camera? Thanks in advance.

sentences:
Xna Equivalent of Viewport.Unproject in a draw call as a matrix transformation I am making a 2D sidescroller and I would like to draw my sprite to world space instead of client space so I do not have to lock it to the center of the screen and when the camera stops the sprite will walk off screen instead of being stuck at the center. In order to do this I wanted to make a transformation matrix that goes in my draw call.

I have seen something like this: https://stackoverflow.com/questions/3570192/xna-viewport-projection-and-spritebatch

I have seen Matrix.CreateOrthographic() used to go from Worldspace to client space but, how would I go about using it to go from clientspace to worldspace?

I was going to try putting my returns from the viewport.unproject method I have into a scale matrix such as:

blah = Matrix.CreateScale(unproject.X,unproject.Y,0);

however, that doesn't seem to work correctly.

Here is what I'm calling in my draw method(where X is the coordinate my camera should follow):

Vector3 test = screentoworld(X, graphics);
var clienttoworld = Matrix.CreateScale(test.X,test.Y, 0);
animationPlayer.Draw(theSpriteBatch, new Vector2(X.X,X.Y),false,false,0,Color.White,new Vector2(1,1),clienttoworld);

Here is my code in my unproject method:

Vector3 screentoworld(Vector2 some, GraphicsDevice graphics):

Vector2 Position =(some.X,some.Y);
var project = Matrix.CreateOrthographic(5*graphicsdevice.Viewport.Width, graphicsdevice.Viewport.Height, 0, 1);
var viewMatrix = Matrix.CreateLookAt(
  new Vector3(0, 0, -4.3f), new Vector3(X.X,X.Y,0), Vector3.Up);

//I have also tried substituting (cam.Position.X,cam.Position.Y,0) in for the (0,0,-4.3f)

 Vector3 nearSource = new Vector3(Position, 0f);
 Vector3 nearPoint = graphicsdevice.Viewport.Unproject(nearSource,
        project, viewMatrix, Matrix.Identity);

return nearPoint;

I would also like to be able to move the camera around without moving my sprite.  Before I was doing something like:

if(directionofsprite == positive && sprite position is not less than 200)
 {
   sprite-=5;
   map-=5;
 }

This would make it appear as though the camera is moving to the right.  I just want to simplify all of this by making my sprites draw to worldspace.

sentences:
How to interrupt movement where the model can lag behind I have a movement system for my characters where the model is allowed to lag behind the character's actual position. In a way it is like the model is being dragged on a string behind the actual position. This works well to smooth out the movement when the character is running around corners or changing direction, because the pathfinder will supply a list of waypoints that are otherwise followed in a straight line.

The only problem I have is when the character is interrupted in his movement, if for instance he spots an enemy and wants to shoot at him. In this case the rendered model will often be a bit behind the actual position.

What is currently happening is that the character changes state to shoot, but this is not immediately reflected in the model, because it is still moving (lerping) towards the actual position. As a result, when the model finally gets there, it will not have time to play the full shoot animation, so it appears like the character just lifts his weapon halfway to aim, then lowers it again.

What is the best way to resolve this issue? It seems like there is no perfect solution...

sentences: Why do built versions of my multiplayer game act different than the version I run in the editor? (Unity / Mirror) When loading saved data from a client's PC, it act's different to how my game, running in the editor works. Saved data is only being loaded on the version being played in the editor. Without any specifics, could anyone explain some differences between the editor version of a game and the built version because I was under the impression that they were the exact same.

sentences:
How to read a custom binary file made with Adobe air into Unity 3D & C# I have a custom data file from a project that was authored in actionscript some years ago by another developer.  I am porting parts of the project over to Unity 3D.  I don't have any documentation for the original project (I hope to speak to the original developers at some point but I cannot wait for that).

The file is a special bitmap that represents the positions of objects on a grid.  The custom file is created using an editor created in Adobe air.  I believe (not knowing any better) that the source code I have for the file decoder is the same source from the editor.  I don't have the editor source code.

Where I am getting into trouble is the binary file. From what I can tell at the moment, the file is a compressed byte array on the Adobe air side of things.  I don't believe I can just load the compressed file with Unity3D as a resource object. I would like to decompress the file and use it as an asset in Unity.

I am trying to figure how to decompress the binary file.  I have tried viewing the file contents in a hex editor to establish what the compression format is with no joy; I have not done anything specifically like this before .  I have tried to use gzip and a few other apps to decompress the file.

Form what I have read in the action script documentation that the default compression should be zlib.

Here is some edited code from the original project for decoding the bitmap:

import flash.utils.ByteArray;

public function decode(byteArray:ByteArray):Boolean
    {
        var i:uint;
        var j:uint;

        if(colourMap!=null)
        {
            colourMap.dispose();
            depthMap.dispose();
        }

        byteArray.uncompress();
        byteArray.position=0;

        var fileVersion:String=byteArray.readUTFBytes(FILE_VERSION.length);

        if(fileVersion==FILE_VERSION)
        {
            numWidth=byteArray.readUnsignedInt();
            numHeight=byteArray.readUnsignedInt();

            if(numWidth==0)
            {
                numWidth=30;
                trace("WARNING FOR SOME REASON WIDTH WAS 0 FROM FILE");
            }

            if(numHeight==0)
            {
                numHeight=30;
                trace("WARNING FOR SOME REASON HEIGHT WAS 0 FROM FILE");
            }

Here is a hex dump of the initial part of the binary data file:

78 da ec bd 55 cf 6c 5d 76 a5 79 7c 53 2a ff 8c

sentences:
Depth to World Space Position problem I am having a problem with turning depth to world space position.
I am using GLSL.
What could go wrong?
Here is the code:
float x = (uv.x * 2.0) - 1.0;
float y = (uv.y * 2.0) - 1.0;
float z = (depth * 2.0) - 1.0;

vec4 pos_clip = vec4(x, y, z 1.0);

vec4 inverse_pos_view = InvCamProjMatrix * pos_clip;
inverse_pos_view.xyz /= inverse_pos_view.w;

vec4 pos_ws = InvCamViewMatrix * inverse_pos_view;

return pos_ws.xyz;

Thanks.

sentences:
Error saying attempting to reference a deleted function while using a vector list I’m making a 2d top down shooter game and I was working on shooting bullets. Im using a vector for the bullet in my player class:
std::vector b;
And I have coded a shoot function which shoots the bullet and deletes it if it is out of the screen:

void Player::shoot(float timer)
{
//Getting Key Press
if (Keyboard::isKeyPressed(Keyboard::Space))
{
    space = true;
}
else
{
    space = false;
}

Bullet b1;
b.push_back(Bullet(b1));

if (space)
{
    for (int i = 0; i < b.size(); i++)
    {
        b[i].setPos(pos);
    }

}
else
{
    for (int i = 0; i < b.size(); i++)
    {
        b[i].update(true);
        if (b[i].getPos().y < 0.0f)
        {
            b.erase(b.begin() + i);
            i--;
        }
    }
}
}

But I have encountered an error:
    Error   C2280   'Bullet &Bullet::operator =(const Bullet &)': attempting to
    reference a deleted function

I don’t understand why this is happening can someone explain?
Here is the bullet class
Header:

#pragma once
#include <SFML/Graphics.hpp>

using namespace sf;

class Bullet
{
private:
Texture t;
Sprite bullet;
Vector2f pos;
public:
Bullet();
~Bullet();
void setPos(Vector2f pos);
void move(bool up);
Sprite getSprite();
Vector2f getPos();
};

Cpp file:
    #include "stdafx.h"
    #include "Bullet.h"

Bullet::Bullet()
{
//Setting Texture
t.loadFromFile("Graphics/bullet.png");
bullet.setTexture(t);

}

Bullet::~Bullet()
{
}

void Bullet::setPos(Vector2f pos)
{

//Setting Position
this->pos = pos;
bullet.setPosition(this->pos);
}

void Bullet::move(bool up)
{
if (up)
{
    bullet.move(0.0f, -10.0f);
}
else
{
    //TODO
}
}

Sprite Bullet::getSprite()
{
return bullet;
}

Vector2f Bullet::getPos()
{
return pos;
}

sentences:
Merging several textures into one using RGB channels Would it be possible to place a texture into each RGB channel?

Example:
Red = wood.png
Blue = tiles.png
Green = metal.png

The advantages I could see are saving space, memory and draw calls and the resolution might not suffer. (unless I'm missing something)

I've seen people pack many textures into one but they have to be scaled to fit which lowers resolution.

sentences:
Creating a knockback effect I'm fairly new to creating a 2D game in java and I'd love some help. I'm trying to create a sort of knock back effect the enemies have on you. So when you are touched by a enemy you will:

lose life
be knocked back a few pixels

I thought about saying something simple such as:

    if ((player.x & player.y) == (enemy.x & enemy.y)){
        player.x += 8;
        player.y += 8;
    }

But seeing as this will only push you back with no hope of moving while being pushed, I didn't want to use it. Is there any simple, yet effective way for going about this?

sentences: What is the difference between a tech tree and crafting? Are tech trees and crafting the same thing, except the mechanism to attain them?  What the real difference between the two?

sentences:
Is my skill tree possible, balanced, or even a good idea? Like most people, I have an idea for a game. I have a particular concept I want to create with a particular set of mechanics I want to implement.

What I need help with is the underlaying player statistics, how they effect what the player can do, and how I can enable a player endless expansion down a particular path that improves only a small sub-set of those statistics.

The entire game will be turn based. The concept is to explore and learn about the world you're in. Books, scripts, notes-on-napkins will lead you to secrets and dungeons. There are no quests to do this for you. You have to read, study and venture forth.

The base stats will decide how effective you are in combat as well as other areas of exploration and general existence in the world.

It could be important to mention that combat in my system isn't realtime or even in the control of the player. The player decides to enter a dangerous area of the map and the computer decides if they get into combat. The computer also rolls some dice and applies modifiers based stats, and finally decides who is the winner. You may die, you may be able to flee. I haven't decided yet.

At this moment in time, I'm considering the following (classic) player stats:

Strength
Stamina
Intelligence
Wisdom
Agility
Intuition

I'm considering the following three class types:

Combat
Magic
Stealth

Class types have two base statistics behind them:

Combat: Strength and Stamina
Magic: Intelligence and Wisdom
Stealth: Agility and Intuition

Somewhat obvious, I guess. Moving further into the mechanics, I had the following progression system in mind:

Levels 1-50 are about learning the game and its mechanics
Advancing to level 50 is fast and is also the cap
After level 50, you gain Guild Wars 2 style "Mastery" points which allow you to enhance specialisations
The end-game is about horizontal progression and mastering your class type, but more importantly, it's about lore and finding it

The idea behind Specialisations is you invest Mastery into them and they force your character down a particular path: combat, magic, or stealth. They also lock you out of the other paths, so you can't mix and match. You have to think about what it is you want to do and whether you can do it based on your understanding of the area you're going into.

The idea behind locking a player down a particular path (which can be unlocked and reassigned, but with research, effort and work) is I want to make it difficult for players to simply construct a "super character" that can take on everything and everyone. Think about how easy it is to become a super mage in Skyrim that can blow everything up... boring!

I want a world in which a very powerful mage is useless against certain monsters simply because of the magic resistance and shear strength that monster has: it forces the player to respec' and rethink before walking into any situation.

To summarise, my thoughts so far are:

Base stats effect everything the player does
Equipment can effect the base stats as well as potions and the other classic stuff
Specialisations effect only two stats and lock out other specialisations
Mastery points go on and on, but the "leveling" curve gets harder and harder quit quickly
Mastery and leveling up a particular specialisation enables the player enter new parts of the world (which is massive, by the way) and continue exploring, but not without first researching what's there (and respeccing as a result)

Am I looking at a dead end here, or is this possible? I'm brand new to game development and really enjoy the mechanics behind games. Am I describing a classic setup here, perhaps? Or something close to one?

I would welcome and greatly appreciate all feedback. I'd even welcome a preexisting system I can copy/paste into my world and just use ;-)

Thanks again.

EDIT: Thanks for the great replies and questions. I think I'm getting this a bit backwards and will, instead, focus on my location and movment, then overlay combat when the time comes :-)

sentences:
testPoint not working - libgdx I'm making a game like angry birds with LibGDX and box2d in which I want to drag a ball (instead of the bird) back before releasing it.

I deploy with testPoint function: when I touch down the screen, I check if the point is within the body of the ball or not but testPoint function never works exactly. Here's what I'm trying thanks so much:

public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    for(Fixture fixture:bird.getBody().getFixtureList()) {
        if(fixture.testPoint(screenX/100, (mapHeight-screenY)/100)) { //100 is scaled parameter
             draggedBird = true;
             return true;
         }
    }
    return false;
}

sentences:
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:
Anti-Aliasing in OpenGL [C++] I'm trying to make anti-aliasing work inside of OpenGL, here's what I've tried:

glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

But so far none of these have worked.

I have gotten antialiasing to work by enabling it on the control panel for my video card (Catalyst Control Center in my case), but I would like to get it working inside my program instead.

This is what the rendering looks like with 4x antialiasing enabled via the video card control panel:
And this is what it looks like when I do it with my program:

How do I get antialiasing to work?

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: Why does the keyboard continue to control disabled buttons? Having the whole panel with all its children including buttons disabled by simple gameObject.SetActive(false) doesn't prevent the buttons from interacting (navigation and clicks) with the keyboard. What could be the reason?

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:
Is a Stamina Bar (ala Dark Souls) a good idea for a casual player target group? We all know the "Stamina Bar".
For those who dont: Its a "Bar" (usually right below your life-bar) which prevents spamming the attacks as much as you want.
Attacking will also reduce your stamina and you need a certain amount of stamina to use Attacks. Usually blocking , rolling and other things also require and reduce your stamina. Its a great way to balance the a real time action battle system. You can upgrade your stamina which is cool too because gives you a feeling of progress and add a little bit of fun there.

Anyway:

The Question here is:

Is this "okay" for "Casuals"?

I have a game which is open-world-ish and you can walk around and fight enemies and fight bosses too.
But the game seems "too easy" now. You can basically just spam your attack button and every enemy is easy.
Even the bosses.

A way the fix this is the stamina bar.

But wouldnt that overwhelm the casual players ?

sentences:
Public variable changed in script isn't stored in playmode I have a public variable float x in script Foo.cs. I have a Bar.cs script with a function like this:

bar() {
    Foo foo = FindObjectOfType<Foo>();
    foo.x = 1f;
}

And a custom editor which calls bar() when a button is pressed. All of that works fine in the editor, my float x is changed to 1, but when I enter playmode the value changes itself. If I change it manually in the inspector it works fine too. So for example:

I set x manually in the inspector to 10.
I enter play mode, x is still 10.
I exit playmode and call the bar() function.
x has changed to 1 in the inspector.
After hitting "Play" x changes back to 10.

How can I fix this?

sentences:
Wall checking not working correctly Basically I am working on side scrolling 2d game. For that I want to check whether player is collided with wall. I have written some code for it but can't able to decide where I have done stupid mistake. So please guide me in this. If you need any more details then I am always available.

Code for detecting wall :

 RaycastHit2D hit = Physics2D.Raycast (wallCheck.position, Vector2.right, wallCheckDistance);

     if (Physics2D.Raycast (wallCheck.position, Vector2.right, wallCheckDistance)) {
         Debug.Log ("collider name : " + hit.collider.name);
         isDead = true;
     }

     Debug.DrawRay (wallCheck.position, Vector3.right * wallCheckDistance, Color.red);

Following image gives you all idea about situation. In that I have allocated player with groundCheck and wallCheck flag. At present in wallCheck section, I am detecting ground as collider response after execution of above code. Above code I have placed in Update method for continuous checking.

For this game, I want to do game over if wallCheck object detect any object in collision.

Why wallCheck object detecting collision of ground object (stage1a)? That is big question of mine.

sentences:
Bug in XNA Developer function CalculateEigenVector() from the file "xnacollision.cpp"? I am trying to decipher the content of the Microsoft XNA Developer source file "xnacollision.cpp" and I've found a function that calculates one of the three eigenvectors of a homogeneous system of three linear equations. The name of that function is CalculateEigenVector() and its content is as follows:

//-----------------------------------------------------------------------------
static inline XMVECTOR CalculateEigenVector( FLOAT m11, FLOAT m12, FLOAT m13,
                                         FLOAT m22, FLOAT m23, FLOAT m33, FLOAT e )
{
FLOAT f1, f2, f3;

FLOAT fTmp[3];
fTmp[0] = ( FLOAT )( m12 * m23 - m13 * ( m22 - e ) );
fTmp[1] = ( FLOAT )( m13 * m12 - m23 * ( m11 - e ) );
fTmp[2] = ( FLOAT )( ( m11 - e ) * ( m22 - e ) - m12 * m12 );

XMVECTOR vTmp = XMLoadFloat3( (XMFLOAT3*)fTmp );

if( XMVector3Equal( vTmp, XMVectorZero() ) ) // planar or linear
{
    // we only have one equation - find a valid one
    if( ( m11 - e != 0.0 ) || ( m12 != 0.0 ) || ( m13 != 0.0 ) )
    {
        f1 = m11 - e; f2 = m12; f3 = m13;
    }
    else if( ( m12 != 0.0 ) || ( m22 - e != 0.0 ) || ( m23 != 0.0 ) )
    {
        f1 = m12; f2 = m22 - e; f3 = m23;
    }
    else if( ( m13 != 0.0 ) || ( m23 != 0.0 ) || ( m33 - e != 0.0 ) )
    {
        f1 = m13; f2 = m23; f3 = m33 - e;
    }
    else
    {
        // error, we'll just make something up - we have NO context
        f1 = 1.0; f2 = 0.0; f3 = 0.0;
    }

    if( f1 == 0.0 )
        vTmp = XMVectorSetX( vTmp, 0.0f );
    else
        vTmp = XMVectorSetX( vTmp, 1.0f );

    if( f2 == 0.0 )
        vTmp = XMVectorSetY( vTmp, 0.0f );
    else
        vTmp = XMVectorSetY( vTmp, 1.0f );

    if( f3 == 0.0 )
    {
        vTmp = XMVectorSetZ( vTmp, 0.0f );
        // recalculate y to make equation work
        if( m12 != 0.0 )
            vTmp = XMVectorSetY( vTmp, ( FLOAT )( -f1 / f2 ) );
    }
    else
    {
        vTmp = XMVectorSetZ( vTmp, ( FLOAT )( ( f2 - f1 ) / f3 ) );
    }
}

if( XMVectorGetX( XMVector3LengthSq( vTmp ) ) > 1e-5f )
{
    return XMVector3Normalize( vTmp );
}
else
{
    // Multiply by a value large enough to make the vector non-zero.
    vTmp *= 1e5f;
    return XMVector3Normalize( vTmp );
}
}

In my opinion there are two mistakes:

1) The code snippet:

// recalculate y to make equation work
if( m12 != 0.0 )
   vTmp = XMVectorSetY( vTmp, ( FLOAT )( -f1 / f2 ) );

should be changed with:

if( f1 != 0.0f )
   vTmp = XMVectorSetX( vTmp, ( FLOAT )( -f2 / f1 ) );

if( f2 != 0.0f )
   vTmp = XMVectorSetY( vTmp, ( FLOAT )( -f1 / f2 ) );

2) In the next else block instead:

vTmp = XMVectorSetZ( vTmp, ( FLOAT )( ( f2 - f1 ) / f3 ) );

we must have:

vTmp = XMVectorSetZ( vTmp, ( FLOAT )( ( -f2 - f1 ) / f3 ) );

Please tell me if I am wrong or right!

sentences:
My timer won't work in Unity In my game, you can spawn a cube by clicking. After 10 seconds I want the cube to disappear. That's what I'm trying to do in my code but it won't work:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class circleThing : MonoBehaviour
{
    public GameObject circle;
    public GameObject block;
    public float time;
    void Start() {
         Vector3 temp = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         temp.z = 5f;
         transform.position = temp;
         if (Input.GetMouseButtonDown(0)) {
             StartCoroutine(timer());
             Instantiate(block, temp, Quaternion.identity);
         }
         if (time >= 10) {
             Destroy(block);
         }
    }
    void Update()
    {

    }
     IEnumerator timer(){

        while (true)
        {
            Debug.Log(time);
            yield return new WaitForSeconds(1);
            time++;
        }
    }
}

What am I doing wrong? I get the error: Destroying assets is not permitted to avoid data loss.

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:
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:
Implimenting BADLAND like Body Movement in Box2d I am trying to make a body (character in my game) move and behave in the same way as the character in the BADLAND Game with regards to rotation.

The character does not have fixed rotation and behaves normally when colliding with objects but automatically fixes its rotation to face forward when there are no other world forces applied.

How do I go about this. is it a use of a revolute joint with a motor? if so what do I attach the joint to?

sentences:
Dynamic vs Kinematic, do either of these cause a collision before OnCollisionEnter2D? Firstly, it would be a great deal of help if someone could explain to me the differences between Dynamic, Kinematic and Static (especially if there is a box for static by the name of the object. I've looked at the APIs and tried playing around with them, they are so confusing. :/

Secondly, I understand that the physics engine evaluates first and can cause a collision (when the ball hits the paddle in my Pong game) but is there a way around this? I'm trying to send the ball in the opposite direction to which it hit the paddle by using OnCollisionEnter2D but this method gets called second and therefore the ball changes direction twice and the physics engine causes an unnecessary collision...

I have looked to tutorials on the movement in pong and tried following the tutorials but get the same problem (even though their game is faultless), this leads me to think that it's the Body Type property that is causing the physics engine to produce the extra collision because theirs is an older unity version. It could possibly be the bouncy material with no friction also, I don't know much purely because I'm a newbie to unity. I wonder whether anyone has had the same problem as me and can set me free.

Thanks in advance. I seriously appreciate any help I can get! :)

sentences:
Same game logic on two separate graphic libraries What code philosophy/structure of abstraction/program design would allow a game to be used with both 2D and 3D graphics (separately) WITHOUT having to re-code the Game logic?

We're talking taking the same code, changing a minimum of things (for example, exchange filenames for 2D assets with filenames for 3D assets), and maybe plugging in a few specialisations of a base class per generics/templates.

To put it in a real context where it makes sense: imagine a LAN-multiplayer game where there is one top-notch, performance-hungry 3D client for the players with some really good gamer rigs, and a more humble 2D client for the old dusty boxes that someone found in their attic. But it's still the same game - the same events are registered (someone picked up a coin), the same Network protocol is used, the worlds are proportional, etc.

To put it in a MVC context: The Controllers are the exact same (pressing the "Up" key will set the players acceleration at 3.5 units/second), the Views are totally different (2D versus 3D), and the Model is the same except for anything directly related to graphics (a collision check for the environment is performed every 5 seconds, and it uses the same algorithm. Note that this would mean there IS a Z-coordinate for all the Game Objects in the 2D version, but it's just ignored or displayed to the user in another way, for example by a shadow that is displayed further left when the player is in the air).

What makes this such a fascinating topic is that it would FORCE the developer to have a very clear idea of how his data is structured and how control flows. Note that this does not imply using anything other than a graphics library like SDL, D3DX or OpenGL. No game engines!

Since this is a mostly theoretical question, I'll leave programming languages out of it, but if you want to give an example you can use any language you like, C++ if you want to go the whole hog, or even Brainfuck if you feel up to the challenge (Any concrete answers will be appreciated, as well as any abstract ones!).

sentences: Best methodology to prepare 3d models for avatar customization? I know preparing mount points and the like. But what's the best way to prevent Z fighting with customizations close to moving parts like elbows and knees?

sentences: MonoGame performance better then XNA? I am currently thinking about porting a XNA game to other platforms using MonoGame. Do I understand this correctly that I can expect the game to render faster even under Windows 7 due to the use of SharpDX?

sentences:
How can OnMouseDown in the parent object be triggered from the child placed on top of it? I am learning Unity from a book. The example is to create a 2D memory game as follows (viewed in perspective view).

The green (background) at z=5, the purple diamond (front card) at z=0 and the red (back card) at z=-5 for example. The front card is set as the parent of the back card in the hierarchy window.
A box collider (2D) component  and a script below are attached only to the parent.
public class FrontCard: MonoBehaviour
{
    public void OnMouseDown()
    {
        Debug.Log("testing 1, 2, 3!");
    }
}

When I play the game and click the back card, the OnMouseDown gets invoked.
Question
How can the OnMouseDown get invoked when I click the back card by considering the script is attached to the front card game object that is placed below the back card?

sentences:
Particle System Tracking I have a particle system where instead of tracking the time each particle is alive, I just track the time of the oldest particle and the time of the youngest particle. Basically, the oldest particle is guaranteed to die first, so once the time since it spawned has passed, the particle is 'killed off' and that time is subtracted by the time between particle spawn (1 / rate). And for spawning particles, the time since the spawn of the youngest particle is tracked. Once this time exceeds the time between particle spawn (1 / rate), then a new particle is spawned and this time is subtracted by the time between particle spawn (1 / rate). However, there seems to be some  bug in my code that I can't seem to find. The emitter seems to spawn only a few particles which move for the duration of their lifespan and then just stop and stay visible. The visibility of the particles is dependent on the index of the particle being within the range of the particleStartIndex and the liveParticleCount (These do wrap around and have been accounted for). I am testing with an emitter with 100 max particles. Here is my code:

inline void Update(float t)
{
    timeSinceFirstLiveParticle += t;
    timeSinceLastSpawn += t;

    //Kill Live Particles
    while (liveParticleCount > 0 && timeSinceFirstLiveParticle >= lifespan)
    {
        particleStartIndex = (particleStartIndex + 1) % maxParticleCount;
        liveParticleCount--;
        timeSinceFirstLiveParticle -= timeBetweenFire;
    }

    //Update Live Particles
    for (int i = 0; i < liveParticleCount; i++)
    {
        int idx = (i + particleStartIndex) % maxParticleCount;
        particles[idx] = particles[idx] + direction * speed * t;
    }

    //Spawn New Particles
    while (timeSinceLastSpawn >= timeBetweenFire)
    {
        int idx = (particleStartIndex + liveParticleCount) % maxParticleCount;
        timeSinceLastSpawn -= timeBetweenFire;
        particles[idx] = position + direction * speed * timeSinceLastSpawn;
        liveParticleCount++;
    }

    valid = false;
}

Any ideas?

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:
One rock gameobject drops FPS heavily! Okay so this is really odd I have a game object (a rock) that even though is really high detail drops my fps from around 70 steady to 12!
Now the object is divided into LOD's and the closer I get to the object the worse it gets!
I have created a Material for each LOD of the object where i replace the normal map with a lower LOD (The other channels stay the same).
The import settings for the different LODS looks like this:

Now as of the textures they are set to 2k (all of them)
Can anyone tell me why this is happening?
The object itself looks like this inside the game:

Even my scene view has framerate issues when looking at it.

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:
Unity Mirror client scene.local player.connection to client.client owned object not working in client U hmm I'm new to mirror networking I just wanna find objects that the local player has authority, but it doesn't work on client, is there a solution to this? Well I could make an object tracking script but that will complicate things.
This question might look like I haven't research anything, truth is I've searched everywhere there is just no documentation for this

sentences:
OBJ file has more vertices than normals Here is a Pastebin of my OBJ file created using Solidworks 3D
https://pastebin.com/6MgQBF8J
I don't understand how the number of vertices (645) can be larger than the number of normals (306)
I understand that some vertices have the same exact coordinates, but how is a programmer supposed to know which normals correspond to which vertices?
Since there are no indexes to map normals to vertices, do I need to get rid of the duplicates first until the number of normals and vertices is equal?
But then why are the duplicates there in the first place?
Or do I need to create normals equal to zero for the remaining vertices?
Thanks,

sentences:
How can I create a 'flaming' effect like in Ocarina of Time's title screen? I'd like to recreate a flaming effect like the one from the logo on the title screen of the N64 game 'The Legend of Zelda: Ocarina of Time,' shown below:

A quick look into the textures used in the ROM provide a single 32x32 texture that looks similar to the effect but I don't know how that image (assuming that's the right one) is transformed into the effect seen on the logo.

How can I implement something similar?

sentences:
Creating non-rectangular hotspots and detecting clicks Say for a game with irregular hotspots (say Risk, or a strategy game like Paradox's Hearts of Iron or Crusader Kings), how do you

Define a non-rectangular hotspot of irregular shape (much like a territory on a map?), in code?
What tool can you use to trace out the hotspot and import into your game?
What is the algorithm for detecting if someone has clicked within such a hotspot?

sentences:
Can art syle proportions have copyright? I like the art of a mobile game called Battleheart.

Is it copyright infringement if I copy only the proportions of his characters?
Obviously the clothes, style of the brush, and all the rest of the art will be my own style. The gameplay of the game will be different, too.

sentences:
pixel displacement with shader Having started learning shaders and experimenting with tools like Shadertoy, I am attempting to make stereoscopic (anaglyph or autostereogram) shaders as an exercise. For this, I need to displace each pixel to the left/right depending on its depth value.

I am trying to generate a double image, based on the original image and the depth map, with each image pixel displaced to the left and right by a value depending on the depth map - so background pixels are displaced more/less (depending on the mode) than foreground pixels.

It would be easy to get the color of the pixel, say, 30 px to the left or right, if I needed a displacement of 30 for this particular pixel. The problem is, this would not actually work: instead, I need to change the color of the pixel 30 px to the left or right, and displace the color of the current pixel there.

One solution would be to use a for loop and check each pixel in the possible displacement range for its depth value. However this has an impact on performance that becomes untenable for large displacement values. With an average eye distance of 65 mm, this can easily require hundreds of pixels of displacement range.

Another solution (as per this answer) would be to generate two viewpoints and combine them, but I want to avoid doing so here. I am searching for a solution based on a single image and its depth map instead.

Is there a another, more efficient way to displace pixels in such a way using shaders?

Note: I am using Shadertoy for ease of use, but if a solution exists but is not usable in it, for example requiring a 3D engine to implement, it is still of interest.

sentences: What maps sizes did old 2D RTS games like C&C and WarCraft support? I'm looking for the size (in tiles) of the maps for the old 2D games Command and Conquer and Warcraft 1 and 2.

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:
How do I make a GameObject carry across only 2 specific scenes? I have a GameObject in my main menu and help scenes that I want to carry across both scenes but be destroyed on all other scenes. I am having multiple issues with it such as it wont destroy on other scenes or when I go back to the previous scene it will generate 2 GameObjects and so on. Here is the script:

public class DestroyObject : MonoBehaviour
{
    void Awake()
    {
        DontDestroyOnLoad(gameObject);
        SceneManager.sceneLoaded += OnSceneLoaded;
    }

    void OnSceneLoaded(UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode mode)
    {
        if ((scene.name == "Help") || (scene.name == "Main Menu"))
        {
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
}

sentences:
What's the most efficient way to implement low poly flat shading style? I want to know what's the most efficient way to implement low poly style flat shading. I have checked this post, however the options listed in the page don't feel perfect to me. I list them below for reference.

Duplicate each vertex so that same vertex can associate with a different normal.
Use flat to disable interpolation.
Evaluate normal at fragment shader using dFdx and dFdy.

To me, option 1 wastes some vertex attributes, since duplicate vertices have the same position. Option 3 perform unnecessary calculation on every fragment even though the normal should all be the same. Option 2 feels conceptually right to me, but I don't know what normal value should be saved at each vertex. This is also the approach hinted in book 'Real Time Rendering' (4e, p120).

My question is: what's the best way to implement it? Given so many commercial games used this style, I want to know how it is typically implemented by real world games?

sentences:
How to spawn enemies within a minimum distance of each other randomly? 2D So I'm making an 2D infinite runner. So I try to spawn obstacles randomly in x-coordinate, but these just spawn most of the time in the same position and too frequently. generationPoint is just a small Empty a medium distance from the camera that's where the obstacles spawn. Even if I make them spawn at a small random rate It's still impossible to play.

{

public GameObject thePlatform;
public Transform generationPoint;
public float distanceBetween;

private float platformWidth;

public ObjectPooler theObjectPool;

public float randomEnemyThreshold;
public ObjectPooler enemyPool;

public float randomReindeerThreshold;
public ObjectPooler ReindeerPool;

void Start () {
    platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x;

}

void Update () {

    if (transform.position.x < generationPoint.position.x)
    {
        transform.position = new Vector3 (transform.position.x + platformWidth + distanceBetween, transform.position.y, transform.position.z);

        GameObject newPlatform = theObjectPool.GetPooledObject();

        newPlatform.transform.position = transform.position;
        newPlatform.transform.rotation = transform.rotation;
        newPlatform.SetActive (true);

        if (Random.Range (0f, 100f) < randomEnemyThreshold)
        {
            GameObject newEnemy = enemyPool.GetPooledObject();

            Vector3 enemyPosition = new Vector3 (-10f, 0.5f, 0f);

            newEnemy.transform.position = transform.position + enemyPosition;
            newEnemy.transform.rotation = transform.rotation;
            newEnemy.SetActive(true);

        }

        if (Random.Range (0f, 100f) < randomReindeerThreshold)
        {

            GameObject newDeer = ReindeerPool.GetPooledObject ();

            Vector3 reindeerPosition = new Vector3 (5f, 0.5f, 0f);

            newDeer.transform.position = transform.position + reindeerPosition;
            newDeer.transform.rotation = transform.rotation;
            newDeer.SetActive(true);
        }
    }

}

}

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:
How do you combine multiple meshes into one in Blender? I need to combine multiple meshes into one in Blender 2.8 (Just make them into a single mesh that looks like all of them in their normal positions). I am doing this mostly for performance improvement in my game, since the teeth are all separate.

Does anyone know how to do this?

sentences:
Why does Facebook share callback return "success" if the user cancels? - Unity Here is the code piece I used to debug:

public void Share (FacebookPost post)
{
    FacebookDelegate<IShareResult> innerCallback = (result) =>
    {
        foreach (var item in result.ResultDictionary)
        {
            Debug.Log(item.Key + " " + item.Value);
        }
    }

    FB.ShareLink (post.linkURL, post.linkTitle, post.linkDescription, post.imageURL, innerCallback);
}

The callback is expected to return a "cancelled" key if user closes the share dialog without sharing, but instead it returns "posted" key with "true" value, which is exactly the same result as when user literally "posts".

And it returns no other data that can help me to decide if user actually shared or not.

So, how can i decide if user shared or cancelled?

sentences:
can i show logs in unity with different colors or different icon signs? I'm working on a project that has a lot of logging messages that pass very fast.

I can use error logs or warning logs but is there any way to log something with different colors so it is easier to find?

Right now, I just use something like this:

Debug.LogError("show missing gold popup accepted");

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:
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:
Implementing Camera Zoom in a 2D Engine I'm currently trying to implement camera scaling/zoom in my 2D Engine.
Normally I calculate the Sprite's drawing size and position similar to this pseudo code:

render()
{
    var x = sprite.x;
    var y = sprite.y;
    var sizeX = sprite.width * sprite.scaleX; // width of the sprite on the screen
    var sizeY = sprite.height * sprite.scaleY; // height of the sprite on the screen
}

To implement the scaling i changed the code to this:

class Camera
{
    var scaleX;
    var scaleY;
    var zoom;
    var finalScaleX; // = scaleX * zoom
    var finalScaleY; // = scaleY * zoom
}

render()
{
    var x = sprite.x * Camera.finalScaleX;
    var y = sprite.y * Camera.finalScaleY;
    var sizeX = sprite.width * sprite.scaleX * Camera.finalScaleX;
    var sizeY = sprite.height * sprite.scaleY * Camera.finalScaleY;
}

The problem is that when the zoom is smaller than 1.0 all sprites are moved toward the top-left corner of the screen. This is expected when looking at the code but i want the camera to zoom on the center of the screen.

Any tips on how to do that are welcome. :)

sentences:
Is this a viable architecture for lag compensation? In some games/engines (such as Source), the server compensates for latency by applying player inputs in the past. Whenever the server receives a player's input for a frame, it rewinds the game to the frame that input was intended for, applies the player input, then simulates the game again up to the current time. The server needs to do several times as much game-logic computation as the clients, as each frame can be simulated many times - so it seems like this would not scale well to many clients or processing-intensive games.

However, we can turn this around. If the client input for a particular frame always arrives before the server simulates that frame, then the server never needs to rewind - it only ever simulates each frame once.

In order for a player's input to reach the server before the frame that the player entered it on, the client needs to run in advance of the server. If a particular client has a latency of 250 ms, then it must simulate tick 51388 at least 250ms before the server simulates tick 51388.

Therefore, the client must be predicting the game state several ticks in advance. Every time the client receives an update from the server, the client rewinds the game, applies the update, and fast-forwards up to the current time.

If n is the number of clients, then the clients each do O(n) extra work per tick to support lag compensation, instead of the server doing O(n^(2)) extra work per tick (assuming the game state size scales as O(n)).

I don't know of any games that actually do this. What are the problems with this approach?

sentences:
2d Rectangle Collision Resolution My Journey...

I've long struggled with rectangle to rectangle collision resolution. I've been making games for almost 10 years and still have yet to find a foolproof, reliable strategy.

When doing research on 2d, rectangle to rectangle collision resolution, I find myself digging through piles of collision detection, or other topics that have nothing to do with my search for truth (circle to rectangle, other detection methods...)  For me, detecting collision has never been the issue...

if player.x + player.width > box.x and
   player.x < box.x + box.width and
   player.y + player.height > box.y and
   player.y < box.y + box.height then
     // A collision has been detected...
     // But now I am lost.....

Assuming both the player and box objects are positioned at their upper left corner

The Rectangular Paradox...

For those brave enough, there is the path of chaos, torture, and unknown horrors available... The road known as "creating your own". I have chosen to walk this path many times, never to find the answers I'm looking for. I'm sure I share some quarrels of this road with fellow developers.

At first you might think it a simple task: "Once you know the rectangles are overlapping, how difficult can it really be to push one out of the other?" Oh boy, how I miss that sweet innocence...

Let us say, the player in the above example is falling down on top of the box, and we want it to stop and be pushed back to the top of the box. Easy, right? We can just do a simple check if the player is above the box, and if so, push him up to the top.

// We know the player is overlapping with the box..
if player.y < box.y then
  player.y = box.y - player.height

Done. Tested and proven to work. But, let's say now we want the player to stop at the left side of the box as well..

if player.x < box.x then
  player.x = box.x - player.width

Looks like it should work fine right? But no. Upon testing you move the player to collide with the left side of the box, and bam. Suddenly, he has immediately moved to the top of the box.

Why? The player can be both above the box, and to the left of the box at the same time. So one seems to end up always being favored over the others. To mitigate this I have written 3 nested if statements, 50 line chunks of code for each side of the rectangle, and wasted near weeks of my life..

Conclusion

Although I walk my journey alone - I know there are others, battling the same demonic mystery of rectangle to rectangle collision resolution. And also.. Those who have conquered it...

I'm hoping someone can help me understand their solidified, proven methods of resolution. To help me and any other developers reading this right now, become level 100 devs.

I made a codepen for anyone who is interested to use as a playground for showcasing resolution methods.

sentences:
Should I be subclassing CCSprites? When I am working with cocos2d I can add CCSprites to the layer or 'stage' and manipulate them.

Now, to do my ongoing calculations for movement AI and such, things that will always run, should I:

subclass CCSprites and add methods to manipulate themselves and run schedules?

-OR-

create a controller class that 'owns' all of the CCSprites and manipulate them from the 'outside'? I am not really sure what would be accessible from the outside though.

My guess is that I should probably subclass the CCSprite object, I could have a different object that inherits from CCSprite for each type of sprite needed.

Player, Enemy, PowerUp, Bullet, etc...

Or what do you think?

sentences:
Divide rectangular image into fixed number of random sized rectangles + 1 fixed size rectangle I'm trying to divide a rectangular image into a fixed number of smaller rectangular image parts (of random but bounded width / height), with the exception of 1 rectangle which is predefined in position and size.

So, for example:

My first thought was:

Generate list of possible points
From this list remove all points in the fixed size rect
From this list remove all points that can't possibly meet the other requirements (e.g. points close to the image edges that wouldn't meet the required bounded min / max rect size)
Then randomly pick a point, generate a random bounded width / height, see if this intersects any current rect, until we find one that doesn't
Record rect, remove all points in rect from list
Repeat

However this seems slow, overly-complex and still results in holes because sometimes there's no more room for the minimum size of rect to fill the last bit of space.

I've looked into algorithms involving squaring the square, packing routines and such like, but nothing I've found helps with the additional constraint that one rectangle is predefined and the rest can be random.

Not looking necessarily for a full algorithm, but hints at an approach would be appreciated.

sentences:
Is it better to have object components in a variable than using GetComponent everytime? (Unity c#) Is this:

Rigidbody2D rb = GetComponent<Rigidbody2D>();

void Update()
{
    rb.AddForce(transform.up * 20 * Time.deltaTime);
}

Better than this?:

void Update()
{
    GetComponent<Rigidbody2D>().AddForce(transform.up * 20 * Time.deltaTime);
}

And can you please tell me why?

sentences:
XNA calculate normals for linesegment I am quite new to 3D graphical programming and thus far only understand that normal somehow define the direction in which a vertex faces and therefore the direction in which light is reflected. I have now idea how they are calculated though, only that they are defined by a Vector3.

For a visualizer that I am creating I am importing a bunch of coordinate which represent layer upon layer of line segments. At the moment I am only using a vertex buffer and adding the start and end point of each line and then rendering a linelist.

The thing is now that I need to calculate the normal for the vertices of these line segments so that I can get some realistic lighting. I have no idea how to calculate these normal but I know they all face sideways and not up or down. To calculate them all I have are the start and end positions of each line segment. The below image is a representation of what I think I need to do in the case of an example layer:

The red arrows represent the normal that should be calculates, the blue text represent the coordinates of the vertices and the green numbers represent their indices.

I would greatly appreciate it if someone could please explain to me how I should calculate these normal.

sentences:
Linear filter problem with diagonal lines on adjecent tiles I am quite new at using OpenGL/GLSL. Basically, the project I am working on is my first 'real' experience with it.
I do not know whether this is relevant, but I use libgdx for my project.

Currently, I am trying to use the GL_LINEAR filters to draw tile of my (tile) map (before I was using GL_NEAREST without problems).

My map contains diagonal roads (just simple lines in this example). A partial overview/example of my map (using the nearest filter without corrections):

With the GL_NEAREST filter, initially I added a 1 pixel border, so the tiles were slightly overlapping and the diagonal roads were draw without the small gaps at the edges of the tiles.

This does not work with the GL_LINEAR filter, because I suppose that the overlapping parts are drawn twice, resulting in a darker 'blob':

I tried to get rid of the blobs, by making the horizontal lines shorter, but there is always an irregularity, either a blob or an 'decrease of line width' (as seen in the diagonal part of the line).

So I removed the 1 pixel additional border and have this as a result:

Now I am trying to fill in the 'gaps' by drawing the two triangular fillers like this:

but I can't get it completely right (this is the best I managed to get):

I suppose it is virtually impossible to get this perfectly right by 'manually' drawing these triangles. Also, when looking at the third image, the lines at the 'edges' (that need to be filled) are very sharp. I suppose this is problematic..?

So, my question is: how does one solve this problem? Do I need to prepare/modify my textures for this? Can I use a shader to fill the gaps automatically? Is manually filling the gaps with the triangles the way to go? Or is there some entirely different technique to have smooth diagonal lines that span multiple tiles?

sentences:
Implementing a more reliable upwards slash? I am working on a 2D action platformer and I am currently implementing an upwards slash.

For a normal horizontal slash, the player must press the attack button. For an upwards slash, the player must hold up and press the attack button.

I notice that when trying to do an upwards slash, players often press the attack button a few milliseconds before the up  button, causing the player to do a normal slash rather than the intended upwards slash. It feels bad.

I am wondering what are some techniques I could use to get a more reliable-feeling upwards slash?

I considered waiting for some interval (for example, 20 milliseconds) after attack is pressed to see if up is pressed. If it is pressed in that interval, do upwards slash, otherwise do regular slash at the end of the interval. But this made the game feel unresponsive.

For a similar reason, I want the attacks to happen on button press rather than button release.

sentences:
Do I need forward declaration for a good message based communication system? I am thinking about a game engine like this:

I am trying to implement message-based communication. Every ReceiveMessage() method processes the Message, or forwards it into the right direction based on the messages recipentType. For example:

The EngineCore infinite loop sends render messages towards Game.
Game forwards the messages towards every GameObject.
GameObjects forward the messages towards their RenderComponent.
The RenderComponent must send its RenderData back to the RenderEngine.

As far as I know, this can only be implemented if the dependencies are bidirectional, which requires forward declaration. Is this possible in another way, or do I have to implement this in a "polling" way?

sentences:
Programatically replace color gradient on sprite Say I have the following image:

I want to tint the yellow parts on this sprites shoulder/arms by a random color. In other questions on this site, they suggest using a chroma key and replacing the constant color with whatever color I wanted, but that solution wouldn't keep the gradient.

The other solution I've seen is that I should cut out the part I want to change the color of and make it an overlay. That would work, but would require a lot of effort since I have many poses for this character + animations.

Any ideas?

sentences:
MYST/RIVEN and Quicktime Video Integration How was Quicktime video integrated into the MYST series games? I was watching a Making of MYST video and noticed that they used a small green screen and for the sequels like Riven they continued to use a green screen but with a much bigger stage. How is it that they match up the video file and integrate it seamlessly into the game? I'm really curious as to how they did it with Riven, where full body actors actually move around with a greater degree of freedom.

My guess is that the video recording is an exact duplicate of a pre-rendered scene. When the player enters into a certain area where a movie is supposed to take place, the video is drawn onto the screen and played. After the video ends, the pre-rendered screen is drawn back to the screen that reflects the changes that took place in the video.

Any other ideas how it might have been done?

sentences:
HTML5 collision with images Can anyone please help me out with a small test game I'm creating. I'm basically creating this game to learn a few things about HTML5 and so far it's all been good. I've been able to create a canvas with a air balloon that can fly and drops to the bottom when it's not. Now I want the air balloon to be able to stop on another image, which I've called "level1". If someone could perhaps have a look at it, view the source and suggest how I would do this, I would appreciate it.

Or perhaps using images isn't the most efficient way to create a level. If it isn't then please say. Thanks again. :)

Here's the game.

sentences:
Compare Lists in Unity3D/C# Hi guys I am working on a combo feature and I want to compare two C# lists, something like this
bool found = false;

List<int> combo = new List<int>();
combo.add(1);
combo.add(1);
combo.add(1);

List<int> playerCombo = new List<int>();
playerCombo.add(1);
playerCombo.add(1);
playerCombo.add(1);

if(combo == playerCombo){
  found = true
}

The thing is that == seems that does not work, always throws false, any ideas?
Update: already answered here https://stackoverflow.com/questions/3669970/compare-two-listt-objects-for-equality-ignoring-order

sentences:
Generating a particle effect on top of a GUIElement (Unity) I am working in Unity on a 2D project which is using C#.

I have a number of guitextures which are hearts in order to create a sort of life meter. I would like when the player loses a heart for the heart to change into a skull in a puff of smoke. I currently have the hearts correctly turning into skulls, and a puff of smoke is generated, however the smoke is created in the wrong location.

The smoke is currently generated by:

GameObject smokeObj = (GameObject)Instantiate (smoke, transform.TransformPoint(transform.position), Quaternion.identity);

I have also tried:

GameObject smokeObj = (GameObject)Instantiate (smoke, transform.position, Quaternion.identity);

I know that the reason that the smoke is created in to wrong location is due to GUIElements using a different coordinate system than other gameObjects.

How can I create the smoke in the correct location?

This is a 2D project and I am currently using Unity 4.5of6, with windows 8.1.

Thank you for your assistance, if you have any questions please do not hesitate to ask.

EDIT:
I have also tried the following, yet it also works incorrectly:

Vector3 worldPos = cam.ViewportToWorldPoint(transform.localPosition + Vector3.forward);
        worldPos.z=0;
        GameObject smokeObj = (GameObject)Instantiate (smoke, worldPos, Quaternion.identity);
        Debug.Log(worldPos);
                //smokeObj.layer = 5;
                smokeObj.transform.parent = this.transform;

sentences:
Points around a circumference C# Im trying to get a list of vectors that go around a circle, but i keep getting the circle to go around several times. I want one circel and the dots to be placed along its circumference. I want the first dot to start at 0 and the last dot to end just before 360. Also i need to be able to calculate the spacing by the ammount of points.

  List<Vector2> pointsInPath = new List<Vector2>();
    private int ammountOfPoints = 5;
    private int blobbSize = 200;
    private Vector2 topLeft = new Vector2(100, 100);
    private Vector2 blobbCenter;
    private int endAngle = 50;
    private int angleIncrementation;
    public Blobb()
    {
        blobbCenter = new Vector2(blobbSize / 2, blobbSize / 2) + topLeft;
        angleIncrementation = endAngle / ammountOfPoints;

        for (int i = 0; i < ammountOfPoints; i++)
        {
            pointsInPath.Add(getPointByAngle(i * angleIncrementation, 100, blobbCenter));
          //  pointsInPath.Add(getPointByAngle(i * angleIncrementation, blobbSize / 2, blobbCenter));
        }
    }

    private Vector2 getPointByAngle(float angle, float distance, Vector2 centre)
    {
        return new Vector2((float)(distance * Math.Cos(angle) ), (float)(distance * Math.Sin(angle))) + centre ;
    }

sentences:
How to create endless scrolling landscape using coco2d's CCParallaxNode I created a horizontally scrolling landscape using CCParallaxNode. However it does not seem to support endless scrolling in one direction. As soon as the first image "ends" the background shines through. Adding an unlimited number of images is of course not an option. I thought about the usual way, namely adding two sprites for each parallax layer next to each other, and simply moving one at the end of the other at the appropriate time.

However, I have two issues:

parallax child nodes can't seem to be
re-positioned
the position of the child nodes vs
how far they have moved seem to be in
no relation to the parallax factor

This is how I set up the parallax node using 4 sprites with identical horizontal width:

CGPoint topOffset = CGPointMake(0, screenSize.height);
CGPoint midOffset = CGPointMake(0, screenSize.height / 2);
CGPoint downOffset = CGPointZero;

// Create a parallax node and add the sprites to it.
CCParallaxNode* paraNode = [CCParallaxNode node];
[paraNode addChild:para1 z:1 parallaxRatio:CGPointMake(0.5f, 0)
positionOffset:topOffset];
[paraNode addChild:para2 z:2 parallaxRatio:CGPointMake(1, 0) positionOffset:topOffset];
[paraNode addChild:para3 z:4 parallaxRatio:CGPointMake(2, 0) positionOffset:midOffset];
[paraNode addChild:para4 z:3 parallaxRatio:CGPointMake(3, 0) positionOffset:downOffset];
[self addChild:paraNode z:0 tag:ParallaxSceneTagParallaxNode];

Did anyone succeed in using CCParallaxNode for seamlessly endless scrolling?

sentences:
Why is the player not resting in the center of the camera? Is it possible to create a combination of the following two cameras described in Andrew Russell's answer? XNA Platformer Sample: Supporting multiple resolutions?

I want to implement a scrolling camera that is focused on the player. In addition, I want to scale the viewport, so that the game looks on every resolution the same.

I already tried to combine the two cameras, but the player is not resting in the center of the screen. Currently scaling the viewport to any resolution higher than 800×480 de-centers the character. The character moves out of the viewport after a while.

My code:

Vector2 vp, gameWorldSize = new Vector2(800, 480);
Matrix camera;
float ScaleX, ScaleY, Scale;
float TranslateX, TranslateY;

ScaleX = vp.X / gameWorldSize.X;
ScaleY = vp.Y / gameWorldSize.Y;
Scale = Math.Min(ScaleX, ScaleY);

TranslateX = (vp.X - (gameWorldSize.X * Scale)) / 2f - player.Playerposition.X + gameWorldSize.X / 2;
TranslateY = (vp.Y - (gameWorldSize.Y * Scale)) / 2f - player.Playerposition.Y + gameWorldSize.Y / 2;

camera = Matrix.CreateScale(Scale, Scale, 1) * Matrix.CreateTranslation(TranslateX, TranslateY, 0);

What is wrong? Is it not possible to combine the two cameras?

sentences:
Cannot Get The Texture Showed Up Correctly glDrawElements I still have  this problem almost 1 month. Tried to search on Google but did not find any solution to this. I have loaded all the data correctly but don't know why the texture came up like this.

Here is my loader:

Header

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

struct STexture
{
public:
    float U, V;
};

struct SFace
{
public:
    int X, Y, Z;
};

class CBMap
{
public:
    struct SMesh
    {
        SVertex *Vertex;
        SVertex *Normal;
        STexture *TexCoord;
        SFace *Face;
        SFace *FaceNormal;

        char Texture[32];
        int TextureID;
        int TotalVertice;
        int TotalNormal;
        int TotalFace;
    };

    SMesh* Mesh;

    CBMap();
    ~CBMap();

    int TotalMesh;

    int Load(char* szFile);
    int Get_FileHeader(FILE* pFile);
    int Get_TotalMesh(FILE* pFile);
    int GetData(FILE* pFile);
};

CPP

int CBMap::Load(char* szFile)
{
    FILE* pFile = fopen(szFile, "r");

    if (!pFile) return 0;

    int iBMap = Get_FileHeader(pFile);

    if (!iBMap)
    {
        printf("BMAP file is not valid\n");
        return 0;
    }

    TotalMesh   = Get_TotalMesh(pFile);
    Mesh        = new SMesh[TotalMesh];
    GetData(pFile);

    int iMesh = 0;

    char* pJunk;
    char szHeader[32];

    while (!feof(pFile))
    {
        fscanf(pFile, "%s", &szHeader);

        if (!strncmp(szHeader, "BMAP", 4)) continue;
        if (!strncmp(szHeader, "mesh", 4)) continue;
        if (!strncmp(szHeader, "mtl", 3))
        {
            fscanf(pFile, "%s", Mesh[iMesh].Texture);
            Mesh[iMesh].TextureID = LoadTexture(Mesh[iMesh].Texture);
        }

        if (!strncmp(szHeader, "ve", 2))
        {
            fscanf(pFile, "%d", &pJunk);
            Mesh[iMesh].Vertex = (SVertex*)malloc(sizeof (SVertex) * Mesh[iMesh].TotalVertice);

            for (int i = 0; i < Mesh[iMesh].TotalVertice; ++i)
            {
                fscanf(pFile, "%f %f %f", &Mesh[iMesh].Vertex[i].X, &Mesh[iMesh].Vertex[i].Y, &Mesh[iMesh].Vertex[i].Z);
            }
        }

        if (!strncmp(szHeader, "uv", 2))
        {
            fscanf(pFile, "%d", &pJunk);
            Mesh[iMesh].TexCoord = (STexture*)malloc(sizeof (STexture) * Mesh[iMesh].TotalVertice);

            for (int i = 0; i < Mesh[iMesh].TotalVertice; ++i)
            {
                fscanf(pFile, "%f %f", &Mesh[iMesh].TexCoord[i].U, &Mesh[iMesh].TexCoord[i].V);
            }
        }

        if (!strncmp(szHeader, "vn", 2))
        {
            fscanf(pFile, "%d", &pJunk);
            Mesh[iMesh].Normal = (SVertex*)malloc(sizeof (SVertex) * Mesh[iMesh].TotalNormal);

            for (int i = 0; i < Mesh[iMesh].TotalNormal; ++i)
            {
                fscanf(pFile, "%f %f %f", &Mesh[iMesh].Normal[i].X, &Mesh[iMesh].Normal[i].Y, &Mesh[iMesh].Normal[i].Z);
            }
        }

        if (!strncmp(szHeader, "f", 1))
        {
            fscanf(pFile, "%d", &pJunk);
            Mesh[iMesh].Face = (SFace*)malloc(sizeof (SFace) * Mesh[iMesh].TotalFace * 3);
            Mesh[iMesh].FaceNormal = (SFace*)malloc(sizeof (SFace) * Mesh[iMesh].TotalFace * 3);

            for (int i = 0; i < Mesh[iMesh].TotalFace; ++i)
            {
                fscanf(pFile, "%d %d %d %d %d %d",  &Mesh[iMesh].Face[i].X, &Mesh[iMesh].Face[i].Y, &Mesh[iMesh].Face[i].Z,
                                                    &Mesh[iMesh].FaceNormal[i].X, &Mesh[iMesh].FaceNormal[i].Y, &Mesh[iMesh].FaceNormal[i].Z);
            }
        }

        if (!strncmp(szHeader, "end", 3))
        {
            if (iMesh < TotalMesh) iMesh ++;
        }
    }

    printf("CBMap::Model Loaded\n");

    fclose(pFile);
    return 1;
}

First picture is reality and second picture expectation

sentences:
Where to store OpenGL object id:s When working with OpenGL, you often recieve integer id:s to keep track of OpenGL objects.

For example, representing a simple mesh, you may have a number of references to objects like so:

GLuint arrayBuffer;
GLuint elementArrayBuffer;
GLuint texture;

Having many meshes, the id:s add up quickly. Therefore my problem is, where it is most logical and efficient to store them?

Alternative 1

My first thaught was to hand out the id:s to corresponding game entities. Something along the lines:

class Entity {
public:
    GLuint arrayBuffer;
    GLuint elementArrayBuffer;
    GLuint texture;
    // Other methods...
}

Then having a render class:

// Create the buffers and textures and pass id:s to entity.
renderer.init(entity);
// Render with corresponding buffer/texture id:s stored in entity
renderer.render(projection, view, entity);

Where it then is easy enough, in the implementation of the render method, just picking id:s and render with them.

Some disadvantages is that this is a leaky abstraction, where OpenGL concepts are "leaked" to game entities. Which does not feel quite right. An advantage might be that the method supposedly is efficient. You do not have to find id:s, you know them for each rendering pass.

Alternative 2

Another alternative would be to store the id:s internally in the renderer. For example, an internal data struct:

struct RenderData {
    GLuint arrayBuffer;
    GLuint elementArrayBuffer;
    GLuint texture;
}

Then having an unordered map with references to each entity and corresponding RenderData:

std::unordered_map<unsigned int, RenderData> render_data;

Then in the rendering method, the correct render data is fetched from the map only by a unique id that is stored in each entity.

Advantages of this approach, is that it is less "leaky", where only the entity id is passed to the renderer, to know what data to use. Disadvantages may be slightly less efficiency, because of lookups in the unordered map?

I would greatly appreciate inputs on this, what approach to prefer, or if there are any other approaches out there?

sentences:
How to add a animation to myPlayer I'm currently making a shoot em up in monogame.

I want to add just one animation to my object. No commands or transitions between animations for different actions: just an object swapping between different images all the time.

For example, my player will have 4 different images for it and I'd want it to always swap trough these images.

Animation guides I've reviewed seem way too complicated for my needs. Unlike the examples they cover, I don't want different animations for different commands.

How can I make this type of simple, always-looping frame animation?

Edit

I managed to make a constantly looping animation to a sprite and but I don't know how to insert into myPlayer.

Game1:
        Texture2D myPlayerAnim;
        Rectangle myDestRect;
        Rectangle mySourceRect;
        Texture2D myEnemyAnim;
        Rectangle myEnemyDestRect;
        Rectangle myEnemySourceRect;
        float myElapsed;
        float myDelay = 100f;
        int myFrames = 0;

Initialize:
            myDestRect = new Rectangle(0, 0, 512, 512);
            myEnemyDestRect = new Rectangle(0, 0, 808, 608);

LoadContent:

            myPlayerAnim = Content.Load<Texture2D>("SpriteSheetPlayerAnim");
            myEnemyAnim = Content.Load<Texture2D>("SpriteSheetEnemyAnim");

Update:
            myElapsed += (float)aGameTime.ElapsedGameTime.TotalMilliseconds;

            if (myElapsed >= myDelay)
            {
                if (myFrames >= 3)
                {
                    myFrames = 0;
                }
                else
                {
                    myFrames++;
                }
                myElapsed = 0;
            }

            mySourceRect = new Rectangle(512 * myFrames, 0, 512, 512);
            myEnemySourceRect = new Rectangle(808 * myFrames, 0, 808, 608);

Draw:

            mySpriteBatch.Draw(myPlayerAnim, myDestRect , mySourceRect,
            Color.White);
            mySpriteBatch.Draw(myEnemyAnim, myEnemyDestRect, myEnemySourceRect,
            Color.White);´

Draw just draws the animations out but I don't know how to insert it into myPlayer. For myPlayer I currently have this but I couldn't figure out how to do it with my animations.

Draw:
myPlayer = new Player(TextureLibrary.GetTexture("player"), myPlayerPos, 200, new Vector2(.3f, .3f), 0, Color.White, 1000, 1);

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:
Can Unity 2D be used to make pixel-art games? I'm looking at the new 2D features introduced in Unity 4.3, and I think I might be missing something.

To me it looks like they are designed for high-res 2D games, where scaling the sprites is ok, but it is unsuitable for pixel-art games.

A pixel-art sprite is designed to be displayed exactly 1:1 pixels on the screen: scaling destroys it (linear up-scaling is an exception, i.e. you may scale it 2x, 3x, 4x etc.).

However I've found no way to "just display it as-is", apparently Unity insists in scaling it to whatever resolution it sees fit: I may control the Camera.size parameter, and the "pixels to units" parameter of the sprite, but I didn't manage to obtain this result.

sentences:
I'm rotating an object on two axes, so why does it keep twisting around the third axis? I see questions come up quite often that have this underlying issue, but they're all caught up in the particulars of a given feature or tool. Here's an attempt to create a canonical answer we can refer users to when this comes up - with lots of animated examples! :)

Let's say we're making a first-person camera. The basic idea is it should yaw to look left & right, and pitch to look up & down. So we write a bit of code like this (using Unity as an example):

void Update() {
    float speed = lookSpeed * Time.deltaTime;

    // Yaw around the y axis using the player's horizontal input.
    transform.Rotate(0f, Input.GetAxis("Horizontal") * speed, 0f);

    // Pitch around the x axis using the player's vertical input.
    transform.Rotate(-Input.GetAxis("Vertical") * speed,  0f, 0f);
}

or maybe

// Construct a quaternion or a matrix representing incremental camera rotation.
Quaternion rotation = Quaternion.Euler(
                        -Input.GetAxis("Vertical") * speed,
                         Input.GetAxis("Horizontal") * speed,
                         0);

// Fold this change into the camera's current rotation.
transform.rotation *= rotation;

And it mostly works, but over time the view starts to get crooked. The camera seems to be turning on its roll axis (z) even though we only told it to rotate on the x and y!

This can also happen if we're trying to manipulate an object in front of the camera - say it's a globe we want to turn to look around:

The same problem - after a while the North pole starts to wander away to the left or right. We're giving input on two axes but we're getting this confusing rotation on a third. And it happens whether we apply all our rotations around the object's local axes or the world's global axes.

In many engines you'll also see this in the inspector - rotate the object in the world, and suddenly numbers change on an axis we didn't even touch!

So, is this an engine bug? How do we tell the program we don't want it adding extra rotation?

Does it have something to do with Euler angles? Should I use Quaternions or Rotation Matrices or Basis Vectors instead?

sentences:
Level loading with threads runs sometimes and doesn't run sometimes I am trying to load a scene in the background while displaying a loading screen till the scene loads and then changing the scene to the loaded scene and I am using threads and ResourceLoader to do so. On my computer it runs sometimes and doesn't run other times. And, on android it never gets completed the loading screen comes up and then the game just hangs.
On pressing the play button:
func _on_play_pressed():
        $loading_screen.show()
        go_to_scene(level_to_load, true)

The gotoscene():
func go_to_scene(new_scene, loading):
    if (loading):
        loading_thread = Thread.new()
        loading_thread.start(self, 'prep_scene', ResourceLoader.load_interactive(new_scene), 2)

The prep_scene():
func prep_scene(interactive_ldr):
    while (true):
        var err = interactive_ldr.poll();
        if(err == ERR_FILE_EOF):
            call_deferred("_on_load_level_done");
            return interactive_ldr.get_resource();

The onloadleveldone():
func _on_load_level_done():
    var interactive_ldr = loading_thread.wait_to_finish()
    print('thread', loading_thread.is_active())
    if get_tree().change_scene_to(interactive_ldr) != OK:
        print('error')

sentences:
Unity5 imported models show no texture I've got a problem with Unity materials.
I'm a beginner- so I used Wings3d for creating 3d models.
But there's a little Problem.
Both objects on the picture below have the same material(a Standart Material with 0 smoothness, 0 metallic and only a only an Albedo picture)-but obviously the right one has no texture( and that's the problem).

First I ignored it and used a custom shader ("Custom/WorldCoord Diffuse) which I found in a package for fixing it. Poorly this shader doesn't support Normal or Height maps and strangely slows down my game extremly (my scene with only Standart shaders ~80 FPS | my scene with this strange shader~7 FPS).
I don't know how to write my own shaders and I don't know blender, and I don't have much time to fix this.

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:
How do you calculate the rate of rotation using the accelerometer values in Android for a particular axis? I am developing a simple game which involves a character moving up and down only along the Y axis.

Currently I am using the accelerometer readings to change the Y velocity of the character. The game works fine but the biggest problem is that you have to keep the device horizontal in order to play the game properly.

What I really want is to change the characters Y velocity only when there is a change in the rate of rotation along the Y axis. I need to be able to translate this rate of change into the Y velocity of the character. In this way it will not matter how much the device is tilted and the user can play the game while holding the device normally.

Since the accelerometer is mandatory in every device, therefore older devices can run my game I want to be able to calculate this rate of change using the data retrieved from the accelerometer.

I found a link which explains how to get pitch and roll from accelerometer data. I used the exact code and came up with this,

final double alpha = 0.5;
double fXg = 0;
double fYg = 0;
double fZg = 0;
fXg = game.getInput().getAccelX() * alpha + (fXg * (1.0 - alpha));
fYg = game.getInput().getAccelY() * alpha + (fYg * (1.0 - alpha));
fZg = game.getInput().getAccelZ() * alpha + (fZg * (1.0 - alpha));
double pitch = (Math.atan2(-fYg, fZg) * 180.0) / Math.PI;
double roll = (Math.atan2(fXg, Math.sqrt(fYg * fYg + fZg * fZg)) * 180.0) / Math.PI;
pitch = (pitch >= 0) ? (180 - pitch) : (-pitch - 180);

With this piece of code I am unable grasp how to calculate the RATE of change.

Am I going in the right direction with this or is this completely different from what I want?

Also is it better if I just use the gyroscope instead of relying on the accelerometer?

Thanx in advance.

sentences:
Keeping track of onscreen objects in opengl es on Android In a small game Im working on I was able to implement ray picking with an opensource 3d engine called min3d but I cant figure how to keep track of what object is onscreen. I will some times have upwards of 120 objects to render within my scene and the raypicking is off occasionally. What id like to do is keep track of how many screen objects are within the camera and being rendered onscreen and set a boolean value based on that to add or remove objects from my arraylist I iterate through when the screen touch is registered and the ray picking method goes off.

So how can I check for which objects are onscreen and offscreen in opengl es on android.

sentences:
Starting from Scratch - Is it a Mistake if I re-invent the wheel? Usually whenever I want to start a game, I will think to have a good basic architecture for rendering and better game loop from scratch. I usually don't want to use existing engines. The reason behind it is that I want to implement it on my own to learn stuff.

But lot of blogs and devs say it's not a good option to go for re-inventing the wheel.

Am I missing something?

sentences:
Android how to get opengl 3D coordinates in ontouch event I created a cube in opengl and it rotates in ontouch event. To to this I created a CustomSurfaceView as follows

public class CustomSurfaceView extends GLSurfaceView {
    @Override
    public boolean onTouchEvent(MotionEvent e) {
        float x = e.getX()
        float y = e.getY();
    }
}

Here x and y are screen coordinates. How can I get 3D coordinated from this? I have already looked gluProject and NeHe. But I dont know how to implement this in my project, it shows that there is no GLdouble,GLfloat class.

sentences:
Unity Free Inverse Depth Mask? How would it be possible to create an inverse depth mask? In this case, I refer to a depth mask as a shader attached to a mesh that 'pokes a hole' through the current camera layer to let you see the camera render layer one depth down, usually by using ColorMask 0.

What I want is for, instead, the mesh to determine what ISN'T cut out, without everything that is NOT seen through the mesh being cut out.

sentences:
Blender: Bones get enlarged in export/import process I have a rig in blender that I want to export into a different blender project. For some reason, when I do that, some of the bones get enlarged. All the scales are applied. Why might this be happening?
I've no clue why this might be happening, as this problem seems exclusive to this project and one other project, where one bone out of the whole armature gets enlarges, but here is the information I can provide:
Some differences between the projects where this happens and the others is that the ones where this does happen have animations, and a pose library. However, this does not seem to cause the problem, as deleting the animations and poses doesn't change anything.
This problem happens when I export/import the project as an FBX.
I usually export the project to unity and in order to compensate for the unity/blender rotation, I follow this [guide][1. I rotate the armature -90 on the x axis, apply rotation. Then rotate the armature 90 on the x axis but only apply the rotation to the mesh. I export the project as a FBX, with unity unit scale, no leaf bones, and the 3rd and 4th box under animations checked off. This also does not seem to cause the problem, as not rotating the armature and such doe not change anything.

sentences:
Event-Based Entity-Componenty-System So, I'm new to ECS. The concept is very interesting in contrast to traditional OOP and heavy inheritance. I'm working on a game right now that is open-sourced, but does not actually have a game loop. It works by sending and receiving packets, and acting upon those received packets.

In that case, what would I be looking at in this relationship between Systems and Components? Let's say I have an incoming Movement packet that is telling me to move Player A 5 units to the right. And let's say I have a lot of different types of packet types (let's say up to 100), each for different stuff, like maybe making a purchase at an NPC store. Another one for purchasing at a player store.

Or maybe inviting and expelling players from a party. Or inviting and expelling players from a guild or alliance.

At that point, I start getting a little confused. I can definitely see similarities in ..

Adding/Expelling people from a party, guild, alliance

But each of those packets contain different information at their core. I'm tempted to write a component that Guilds, Alliances, and Parties can use (like AddRemoveMemberComponent), but the information coming in from the packet makes me hesitant.

How would those components handle specifically? Maybe I'm just entangling myself in traditional inheritance, so it's hard for me to see the uniqueness of data. Would I have unique systems for explicitly handling Party, Guild, Alliance expulsions and invitations? And how would I dynamically know what to do with these different packets coming in (different packets for alliance, guild, party).

sentences:
2D isometric: screen to tile coordinates I'm writing an isometric 2D game and I'm having difficulty figuring precisely on which tile the cursor is. Here's a drawing:

where xs and ys are screen coordinates (pixels), xt and yt are tile coordinates, W and H are tile width and tile height in pixels, respectively. My notation for coordinates is (y, x) which may be confusing, sorry about that.

The best I could figure out so far is this:

int xtemp = xs / (W / 2);
int ytemp = ys / (H / 2);
int xt = (xs - ys) / 2;
int yt = ytemp + xt;

This seems almost correct but is giving me a very imprecise result, making it hard to select certain tiles, or sometimes it selects a tile next to the one I'm trying to click on. I don't understand why and I'd like if someone could help me understand the logic behind this.

Thanks!

sentences:
What should I worry about when changing OpenGL origin to upper left of screen? For self education, I'm writing a 2D platformer engine in C++ using SDL / OpenGL.  I initially began with pure SDL using the tutorials on sdltutorials.com and lazyfoo.net, but I'm now using SDL to create an OpenGL rendering context and then render with OpenGL functions (specifically immediate mode but I'm learning about VAOs/VBOs). I am using SDL only for interface, audio, etc.

SDL uses a coordinate system with the origin in the upper left of the screen and the positive y-axis pointing down. It's easy to set up my orthographic projection in OpenGL to mirror this.

I know that texture coordinates are a right-hand system with values from 0 to 1 -- flipping the texture vertically before rendering (well, flip the file before loading) yields textures that render correctly... which is fine if I'm drawing the entire texture, but ultimately I'll be using tilesets and can imagine problems.

What should I be concerned about in terms of rendering when I do this?

If anybody has any advice or they've done this themselves and can point out future pitfalls, that would be great, but really any thoughts would be appreciated.

sentences:
How could one go about segmented sprite animation in Unity? I've been exploring ways of designing characters and I'm interested in this technique. It's used in many retro games, mostly for bosses, like in Gunstar Heroes(Seven Force, that one Block guy from level 1), Castlevania(Talos) and Mischief Makers. It's used for the player character in the case of Yoshi's Story, Paper Mario and more recently Hardcore Mecha.
 Currently I'm aware of the Anima 2D system in Unity, however this is more directly mimicking 3d model functionality by warping the meshes as well, and doesn't seem to support spritesheets per limb.

I'm thinking of using individual quads per limb with their own spritesheets, would it be difficult to code my own sort of skeleton system?

For anyone still curious/confused to what im referring to, This technique was used fairly often in Castlevania games or games by the company Treasure.

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:
Shooting the closest enemy that you can see I'm trying to make my main character aim at the closest enemy that he can see.

My issue is with the close range criterion taking priority. If the enemy is near the player but the player can't see him, I'd like the player to look for another enemy inside his range.

As you can see in the image, There is an enemy behind the wall. The player is not aiming at him because he can't see him. So far this is correct.

But the player is also ignoring the enemy in front of him because he's busy rejecting the one behind the wall.

What he should do is aim at the one in front of him, because he can see him and he is inside the player's range.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;
public class clickme : MonoBehaviour
{

private NavMeshAgent mAgent;
public float mark, ToPoint;
public bool actives, seeEnemy;
private Transform target;
public float range, enemyDistance; // range is player eyes field.
public float speed = 5.0f;
public Transform aiming_point, playerEye;
private GameObject[] targets;

void Start()
{
    targets = GameObject.FindGameObjectsWithTag("enemy");
    target = targets[0].transform;
    seeEnemy = false;
}

void Update()
{

    if (mAgent.remainingDistance <= mAgent.stoppingDistance)
    {
        actives = false;
        if (actives == false && playerEye == true && target != null)
        {

            if (enemyDistance <= range)
            {
                Vector3 dir = target.position - transform.position;
                Quaternion lookRotation = Quaternion.LookRotation(dir);
                Vector3 rotation = Quaternion.Lerp(transform.rotation, lookRotation, Time.deltaTime * speed).eulerAngles;
                transform.rotation = Quaternion.Euler(0f, rotation.y, 0.0f);
            }

        }
        else  {

        }

    }
    else   {
        actives = true;

    }

    updateTarget();

} // end update

void updateTarget()
{
    GameObject[] enemies = GameObject.FindGameObjectsWithTag("enemy");
    float shortesDistance = Mathf.Infinity;
    GameObject nearestEnemy = null;
    foreach (GameObject enemy in enemies)
    {
        float distanceToEnemy = Vector3.Distance(transform.position, enemy.transform.position);
        if (distanceToEnemy < shortesDistance)
        {
            shortesDistance = distanceToEnemy;
            nearestEnemy = enemy;

            RaycastHit hit; // can I see my closent enemy or not ?
            if (Physics.Linecast(playerEye.position, nearestEnemy.transform.position, out hit))
            {
                Debug.DrawLine(playerEye.position, nearestEnemy.transform.position, Color.blue, range);

                if (hit.collider.tag == "enemy")
                {
                    seeEnemy = true;
                    print(" I can see enemy !");

                }
                else
                {
                    seeEnemy = false;
                    print("No enemy here!");

                }
            }
        }

    } // end foreach

    if (nearestEnemy != null && shortesDistance <= range && seeEnemy == true)
    {
        target = nearestEnemy.transform;
        aiming_point = target.transform.Find("aim");
        enemyDistance = Vector3.Distance(transform.position, target.transform.position);
    }
    else
    {
        target = null;
        aiming_point = null;
        seeEnemy = false;
        enemyDistance = 0;
    }

} // end target

}

sentences:
How do I make a more or less realistic water surface? I want to make a similar water surface like in this picture:

I need the water surface in the same view than in the picture. Is it possible to work without shaders?
I want to develop a little game for Xbox Live Indie Marketplace, Windows Phone and maybe later iPhone/iPad.

How should I make the water surface, so that it works on multiple platforms?

sentences:
Should a bowling game use a 2d or a 3d physics engine? I'm creating a bowling game in flash+as3. I'm new to physics engines, so, to start I've begun to learn Box2D since I've heard it's one of the most popular physics game engines.
Currently, I'm not sure if it's the best solution. I'm not sure even if I should use a 2D physics engine or if I should move to 3D physics engine.
As you can see in the attached screenshot of my game, the ball should move on the lane until it hits the pins. The game has some amount of 3D behavior.
Please advise.

sentences:
Why is the button's code not running? My script for a slot machine isn't working. When the button in the Bilboard GUI is clicked, the below dosen't run. I am new to scripting and this is mostly based on wiki/stack exchange/ Dev page info.

local player = game.Players.LocalPlayer
local textLabel = script.Parent
local toggled = false
local button = script.Parent

textLabel.Text = "Click to Play for 5 Cash!"
slot1Combos = {"Bar", "Seven", "Seven", "Seven", "Cherry", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana"}
slot2Combos = {"Bar", "Seven", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange","Orange","Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana", "Banana"}
slot3Combos = {"Bar", "Seven", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange","Orange","Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana", "Banana"}

local function onButtonActivated()
    if toggled == false then
        toggled = true

        x = math.random(1,23)
        y = math.random(1,23)
        z = math.random(1,23)
        g = false
        player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value - 5
        if slot1Combos[math.floor(x)] == "Bar" and slot2Combos[math.floor(y)] == "Bar" and slot3Combos[math.floor(z)] == "Bar" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 60
            textLabel.Text = "You Got 3 Bars. You won 60 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Seven" and slot2Combos[math.floor(y)] == "Seven" and slot3Combos[math.floor(z)] == slot2Combos[math.floor(y)] then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 40
            textLabel.Text = "You Got 3 Sevens. You won 40 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == slot2Combos[math.floor(y)] and slot3Combos[math.floor(z)] == slot2Combos[math.floor(y)] then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 10
            textLabel.Text = "You Got 3 of a Kind. You won 10 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"

        elseif slot1Combos[math.floor(x)] == "Cherry" and slot2Combos[math.floor(y)] == "Cherry" and slot3Combos[math.floor(z)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 20
            textLabel.Text = "You Got 3 Cherries. You won 20 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Cherry" and slot2Combos[math.floor(y)] == "Cherry" or slot3Combos[math.floor(z)] == "Cherry" and slot1Combos[math.floor(x)] == "Cherry" or slot2Combos[math.floor(y)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 3
            textLabel.Text = "You Got 2 Cherries. You won 3 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Cherry" or  slot2Combos[math.floor(y)] == "Cherry" or  slot3Combos[math.floor(y)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 3
            textLabel.Text = "You Got 1 Cherry. You won 3 cash"
        else
            textLabel.Text = "Sorry, you didn't win"
            wait (5)
            textLabel.Text = "Click to Play for 5 Cash!"

        end
    end
button.Activated:Connect(onButtonActivated)
end)

This is the explorer tree with the script highlighted

sentences: Why are all OpenGL function calls prefixed with "q" in the Doom 3 source code? Why is every OpenGL call prefixed with a "q" in the Doom 3 source code? Are they custom functions or a different library, and if so, why use that over OpenGL? Any Google search comes up with the Qt OpenGL module, which I assume has nothing to do with it.

sentences:
Need opinions on my component based design I have an Entity class and a Component class. The Entity class has a list of attached components, and each component also has a member variable that is a reference to the entity that it is attached to (cyclical design).

Then, there is the EntityManager class, which has a list of (you guessed it!) entities, and each entity also has a reference to its encapsulating entity manager.

The reason for this cyclical design is due to data reliance. To explain further, my Entity class is essentially just a giant bucket of data: any data any type of entity needs already exists on this class when it is instantiated. However, in order to make use of this data, the Entity needs the relevant components attached. For example, my Rendering component takes the Entity's spriteData member and draws it to the backbuffer. Without a rendering component, spriteData is not utilized. Since my components need to access the Entity's member variables, each component needs a reference to the Entity it is attached to.

For an example of why my entity needs a reference to the entity manager, it is because some components (such as collision) need to access other entities' data buckets in order to function (for collision, this would be checking nearby entities' position vector and comparing it to the component's referenced entity).

There is more to it than this, but I just wanted to highlight the central idea of what I was doing, and wanted opinions on whether a cyclical approach like this (with little data encapsulation as well..) is a good idea or not. Maybe I'm just overthinking it /shrug. Opinions on how to steer the design would be hugely appreciated, as well.

sentences:
Setting Window Icon Using GLFW (LWJGL 3) What's the best, cross platform, way of setting the window icon using LWJGL 3?

I have a PNG image and would like to set it to the icon present in my dock (OS X) or the application bar (Linux).

sentences:
How to create custom 3D "areas" at runtime I've been puzzled for a few days trying to solve this problem, so far with no results.

On a map, currently a Terrain, I'd need to have some "areas" which can be controlled by a specific players. The shape of those areas can arbitrarily change during the course of the game, such as you add a  marker in any point, and the area evolves (like a spline, say) to pass through that point too.

The problem isn't drawing the boundary itself, of course, but having the GameObjects detecting the area they are in.

Currently I have absolutely zero idea on how to make this exactly.

I've thought about a nice approximation, which is splitting the terrain in fixed chunks, and having the player control them "chunk by chunk": every chunk can have its own collider, and that should be easy if not trivial. So the question is how to do it "properly", since I already have this workaround.

sentences:
Why is my texture spilling? I'm trying to create a 3D Sword Slash VFX and created the model for the effect in blender. It's basically a wedge or ufo-shaped mesh. I proceeded to paint a simple test texture to see how it would look in Unreal. Now, the UVs are setup correctly for the effect itself (bottom of the texture is outside of the ring and top of the texture is inside of the ring), but it seems like my texture is spilling.

I got clearly visible artifacts and I don't really know why. The artificats go away when I start erasing parts of texture at the bottom, but it also leads to the outside edge of the wedge model to get a gap. What can I do to prevent my texture from spilling over?

*Edit: Making the material I used Unlit helped, but it did not get rid off the problem completely. Using clamp is not an option for me, because I want to animate the texture with a UV-Offset to make it rotate. In the material editor preview there are no artifacts, but in the material instance preview window they appear again.

I created the mesh in this way: add a circle, extrude the edges up and then scale the vertices down. Then do the same but at the bottom. In the UV-Editor I dragged the UVs from the outside edge to the bottom and the vertices from the top circle and bottom circle to the top of the UV map.

sentences:
How to use LWJGL Vertex Buffer Objects? I have been learning how to make a game with LWJGL for a while now by following YouTube tutorials online but I've recently been having a problem understanding Vertex Buffer Objects. I've looked at several tutorials including the one at the LWJGL Wiki, but I still don't understand how to use them.

Can someone please clarify how Vertex Buffer Objects should be used? I understand the code behind it but I don't know how it should be used. I know that the VBO should only be created once and be rendered every frame/loop. But my main question is, is there one Vertex Buffer Object per game or one per Object to be drawn? Also, what's the difference between VBOs and Interleaved VBOs?

sentences:
How do you reference one game object from another? I am trying to reference a game object that was created in the editor and added to the scene (not created dynamically).  How can I reference this object in a script added to another gameobject?

For example I have a Mesh called QuantumCold_B (in the editor), and I try to get its position in a script to be added to First Person Player, but instead I get

  Unknown identifier ('QuantumCold_B').

Here is my script:

function Update () {
   transform.RotateAround(QuantumCold_B.position, Vector2,20 * Time.deltaTime);
}

Also is position the right way to get the Vector position on QuantumCold_B?

sentences:
Developing game progress screen I'm developing an application for iPhone with a screen where the user will track his progress. Something like so, as seen in the Two Dots game:

Currently I plan on creating this using constraints and size classes. But I feel its too much of work for each screen size. I've set a background UIImageView and I place different circles, manually hardcoding the position. The curved path in my case is made of a texture. So I can't plot it using Bezier Curves either.

Is there an easier way to do it? Perhaps using SpriteKit or Cocos2D-x?

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:
How do you compute the tangent space vectors with normals given in the mesh? Suppose you are given a mesh with normals for each vertex. These normals might not correspond to the face normals, as the artist could have tweaked them. In this case, how would you go about computing the tangent and binormal vectors for the vertex?

The best algorithm I can think of, and the one that looks to be used by assimp, is to take all the faces in a given smoothing group and compute the tangent and binormal per face. Once that is done, project them into the plane determined by the normal and average over all the faces in the smoothing group.

I am uncertain as to whether this algorithm works exactly as needed. For example, does the projection operator preserve the angle between the tangent and binormal?

Another issue I have is that the assimp implementation of the algorithm does not seem to use the smoothing groups specified in the mesh. They instead seem to calculate the smoothing groups manually using nearby vertices. What is the advantage of doing this?

Finally, is this the ideal algorithm? Some other things I have found (such as this) seem to suggest that it is not, but they do not go into any more details.

EDIT:

So I checked out the MikkTSpace algorithm that was suggested in the comments, and while it answers my question of what the industry standard method for generating tangent spaces is, I do not fully understand why the algorithm works.

As described in the paper, the algorithm works by collecting triangles into groups and then averaging the tangent spaces for each individual triangle in the group. I ran into two problems understanding this: first and once again, why discard the smoothing groups specified in the mesh? It seems wasteful to discard information that is already given to you about how the mesh is supposed to appear.

Secondly, how do the groups even work? The paper specifies that two triangles are considered to be in a group if the share two vertices, two texture coordinates, and two normals. The first two requirements make sense to me, but the third does not. Suppose you are approximating a sphere by something like an icosahedron. In this case there will be no vertex normals shared by any two vertices, so each individual triangle is going to have its own tangent space. This seems counterintuitive.

sentences:
Webgl build error in unity I get an error while trying to build a game for webgl. I have created a new 3d project with only a cube in it and have not created any scripts. When I try to build and run the webgl option, these are the errors I get.

    Failed running "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"G:\webgl\Assets\..\Temp\emcc_arguments.resp"

stdout:
stderr:INFO:root:Checking JS engine ['G:\\nodejs\\node_modules\\npm\\bin', '--stack_size=8192', '--max-old-space-size=4096'] failed. Check your config file. Details: [Error 5] Access is deniedCRITICAL:root:The JavaScript shell (['G:\\nodejs\\node_modules\\npm\\bin', '--stack_size=8192', '--max-old-space-size=4096']) does not seem to work, check the paths in the config file
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002bb] in <480b5a3bd3214ce5831f6dd8c68fdc55>:0
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <480b5a3bd3214ce5831f6dd8c68fdc55>:0
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

This is what the editor log shows:

C:\Program Files\Unity\Hub\Editor\2019.3.13f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe exited after 228169 ms.
Filename: "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe"
Arguments: -E "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"G:\webgl\Assets\..\Temp\emcc_arguments.resp"
index: -1
Failed running "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"G:\webgl\Assets\..\Temp\emcc_arguments.resp"

stdout:
stderr:INFO:root:Checking JS engine ['G:\\nodejs\\node_modules\\npm\\bin', '--stack_size=8192', '--max-old-space-size=4096'] failed. Check your config file. Details: [Error 5] Access is deniedCRITICAL:root:The JavaScript shell (['G:\\nodejs\\node_modules\\npm\\bin', '--stack_size=8192', '--max-old-space-size=4096']) does not seem to work, check the paths in the config file

I'm not sure how to resolve this....Can someone please help...

sentences:
How to play an animation backwards in Unity? I know this question has been asked before but it all involves using the Animation(?) component, so that is no longer any good in Unity 5.3.1f1, I explain a bit more later.

I'm trying to simply get an animation to play backwards. On the object that I want to have an animation play backwards on, I have an animator.

private Animator anim;
...
anim = GetComponent<Animator>();

If I do:

animator.speed = -1.0f;

It tells me Animator.speed can only be negative when Animator recorder is enabled. Animator.recorderMode != AnimatorRecorderMode.Offline

So I try putting on an Animation component on the game object, and making the clip the animation.

Every time I do anything with the Animation component in script, it tells me the component must be marked as Legacy. That is no good, because when I tried making it Legacy it caused multiple problems including not being recognized by the Animator. Also GetRef errors. The entire Animation component seems like it's treated as legacy now or is just broken.

So I decided well maybe I could just try to get the animation to play backwards in the animator and having the animator record it, and then using that backwards recorded animation in the actual game. I cannot figure out how to this, even if I click record in the Animation view anim.recorderMode != AnimatorRecorderMode.Record. I don't know what to do. All I want to do is play the same animation backwards without having to copy and paste an animation in the Project and moving all of the keys around so that they are reversed. Please help. Unity's animation system seems so convoluted in script.

sentences:
Which data structure should I use for  dynamically generated platforms? I'm creating a platform type of game with various types of platforms. Platforms that move, shake, rotate, etc. Multiple types and multiple of each type can be on the screen at once. The platforms will be procedural generated.

I'm trying to figure out which of the following would be a better platform system:

Pre-allocate all platforms when the scene loads, storing each platform type into different platform type arrays( i.e. regPlatformArray ), and just getting one when I need one.
The other option is to allocate and load what I need when my code needs it.

The problem with 1 is keeping up with the indices that are in use on screen and which aren't.

The problem with 2 is I'm having a hard time wrapping my head around how I would store these platforms so that I can call the update/draw methods on them and managing that data structure that holds them. The data structure would constantly be growing and shrinking. It seems there could be too much complexity.

I'm using the cocos2d iPhone game engine.

Anyways, which option would be best or is there a better option?

sentences:
How to create an OpenGL texture using primitives? I'm currently rendering a large proportion of the graphics of my game using custom OpenGL primitive functions (e.g. DrawCircleFilled(), DrawPolygonFilled(), etc) drawing procedurally generated objects (e.g. trees). Typically the core of these functions is a glBegin and glEnd loop, and use GL_TRIANGLE_FAN, GL_LINE_LOOP, GL_LINES, or GL_POLYGON. While this generally works, I'm seeing some performance issues if I have too many objects using these functions on screen at once.

For instance, I could render a brick wall by drawing 128 small brick-coloured rectangles with an outline. Alternatively I could render a single OpenGL texture with these bricks pre-drawn, which takes up more video memory but seems to be less processor intensive.

With this in mind, my question is: how do I take the output of the primitive functions and store them in an OpenGL texture at runtime? I'm aware of how to do with with an SDL_Surface, but I don't have access to the primitive drawing functions in SDL and SDL primitive drawing is very slow (one of the reasons why I switched to raw OpenGL in the first place).

Advice appreciated.

Thanks,
Nathan

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:
Setting oblique projection to data visualization I'm developing a small application using Directx intended to plot frequency spectra data in a waterfall plot. It should look like this:

So far, I managed to created most of the chart components(axes, title and the data can be plotted as lines or slices as the picture above). The problem now is that I could not managed to create a projection similar to that in the image. I know the projection shown in the image is an "Oblique projection" and I've tried several ways to get it:

https://www.cs.unm.edu/~angel/CS433/LECTURES/CS433_17.pdf

Here, the author proposes the projection matrix as

P = M_orth * H(θ,φ)

where M_orth is an orthogonal projection matrix and H(θ,φ) is a shear matrix defined as

H(θ,φ) =
    | 1  0  -cot(θ)  0 |
    | 0  1  -cot(φ)  0 |
    | 0  0    1      0 |
    | 0  0    0      1 |

Practical C# - Chart and Graphics, Chapter 5, Pg 247

Here, the projection matrix is defined as

P(α,θ) =
    | 1  0  cos(θ) / tan(α)  0 |
    | 0  1  sin(θ) / tan(α)  0 |
    | 0  0         0         0 |
    | 0  0         0         1 |

and the author gives two special cases:

Cavalier projection: alpha = 45°, 30 <= theta <= 45
Cabinet projection: alpha = 63.4°, 30 <= theta <= 45

But none of them have gave me good results:

And I don't understand why I'm getting this strange results? Any of you guys knows how to set the oblique projection properly?

Thanks in advance

sentences: Is ETC2 Texture Compression available in OpenGL ES 2.0? I have an ES 2.0 app and would like to use ETC2 texture compression if it is available (i.e. I am running on a device that supports ES 3.0 standard).  Is it possible to use ETC2 in ES 1.1/2.0, and if so how can I query if a device supports it?  For most forms of texture compression, there is an extension I can query for, but there is no extension for ETC2 since it is built in.

sentences:
Box-box contact information I have two colliding boxes, How i can calculate contact information like (contact normal, contact point and penetration) .

Is there any simple algorithm .

Note: i'm using XNA .

sentences:
Collisions and Lists I've run into an issue that breaks my collisions. Here's my method:

Gather Input
Project Rectangle
Check for intersection and ispassable
Update

The update method is built on object_position * seconds_passed * velocity * speed. Input changes velocity and is normalized if > 1.

This method works well with just one object comparison, however I pass a list or a for loop to the collision detector and velocity gets changed back to a non zero when the list hits an object that passes the test and the object can pass through.

Any solutions would be much appreciated. Side note is there a more proper way to simulate movement?

sentences:
What are good ways to model environment radiance (not irradiance)? I'm trying to compile a list with relevant techniques in game development to model scene radiance.
The (probably obvious) candidates I have so far is:

Discreet light source objects in the scene (point ligts, directional lights, area lights etc)
spherical [HDR] bitmap data (mapped to the sphere in various ways. long lat, cube map, oct map etc.)
spherical harmonics
halfspherical harmonics

What other relevant techniques are there to model radiance (not irradiance)?

sentences:
Is C++ "still" preferred in game development? I am a 2D Game Programmer.Some programming languages which I am good at are C,Java ,C#. I also know Actionscript 2.0,3.0 and some javascript.
I'm interested in learning 3D Game programming. So far from the research I have accumulated by googling and reading different game development forums and articles. I've noticed that most programmers tend to prefer C++.Also in an online game programming teaching course I noticed they prefer to teach C++ and Visual C++ as the starting course. The reason I am asking this question since I would like to know the "strength" difference of C++, C# and Java for 3d game programming.

Also include links to good 3d game programming articles for the already 2d game programmer.

P.S : IMHO , I also find C++ to be cryptic.

sentences:
How to make a visible area in unity3d the simple way to explain it is an image

I want to have a black background and to show only a small area around player. Which way I have to look? I have no clue where to start searching :)

Thanks.

sentences:
Bounce with multiple collisions Here's the problem: I'm writing an Arkanoid-like game in Unity 5.3. I'm using 3D physics and simply ignoring z-axis in computations. No gravity, 0 drag and velocity reset every bounce by script. My ball has sphere collider and rigidbody with continuous dynamic collision detection on it, and bricks have box colliders with continuous detection. They are set like tiles, one by one, without gaps.

The problem occurs when a ball collides with two bricks at once, which causes a wrong bounce angle. Smaller sphere colliders makes this situation occur less often, but causes the ball to ignore collisions sometimes and phase through a single brick.

I know the probable reason for this bug, I think a collision with two objects affects ball physics twice. The question is: how to avoid it?

sentences:
How to integrate PS3 & Xbox 360 games to Facebook? After some research online, I am unable to find any concrete references for how to go about implementing Facebook functionality from either Xbox 360 or PS3 games.  There is apparently some degree of integration, but how does one go about hooking into Facebook's API from within a console title?

Is there any How To documentation online?  Or alternatively, is anyone aware of a developer that specializes in incorporating this type of functionality in an existing codebase?

For an answer unaffected by NDA, does anyone know of a company that specializes in integrating PS3 or Xbox games with Facebook?

sentences:
Problem disposing content from a screen's content manager I have a problem with my game. I am using multiple classes for different screens, for exemple: Main Menu is one screen, When playing is another, and so on...

I decided to use multiple ContentManagers, different content for each screen, so the game won't consume very much RAM, and to load the screen's content when the user will navigate on that screen, and unload/dispose the content when user navigates away.

I have created different content managers for each screen that I had to, but for exemple if I navigate from main menu, to the playing screen, then back to the main menu (when the content from playing screen gets disposed), and then back to the playing screen, I get this error:

An exception of type 'System.ObjectDisposedException' occurred in MonoGame.Framework.DLL but was not handled in user code

Additional information: Cannot access a disposed object.

I googled this problem, and the only answer that I found was not to dispose the Content Manager, but each texture on that screen.

Is this the only way that I can handle this? To dispose each texture from the screen, when user navigates away?

Thanks.

sentences:
Using native code with Libgdx, (Raknet) I was searching for a game engine (Java- maybe C#) with built-in real time networking library to develop 2D cross platform (Android - iOS) multiplayer game. Actually I have not found well suited solution apart from Unity, however I don't like some of the features of Unity. (Here is Discussion)

After a while I decided to use Libgdx and tried to find a network libray that meets my requirements and I found Raknet as network engine which is written in C++ and cross-platform. So here is my question:

Is there any way to use Raknet with Libgdx, or any other solutions you recommend as engine or anything else? And also is it possible to use any C/++ library with Libgdx like Android's NDK?

sentences:
JavaScript - 2D Top-down Tile Collision Detection I am developing a small Top-down Game (Much like the old Zelda Games) and I'm having an issue in terms of Collision detection (The actual theory itself rather than assigning Tiles as solid, etc.)

I have a function called "checkTileCollision" which takes two parameters, X and Y, and is called through the Player's Move function. X and Y are the location of the player AFTER they have moved, as it's suppose to check the position the player is moving to for a solid Tile(s), and if it finds any, returns true to stop movement.

My Player is larger than a Tile (For examples sake, let's say each Tile is 32x32 and the Player is 26x60) and I need to know an efficient way to detect whether or not the player is attempting to step on to a Solid tile. The Player doesn't move on the Grid and is free-moving, so X and Y are true positions and not Tile co-ordinates.

Please note; I am aware of things such as Box2D but I'm wanting to do this without the use of third party libraries.

Any help is appreciated!

sentences:
2D non-tile based map editor I am currently developing a relatively simple 2D, topdown oriented adventure game for the iPhone and was wondering what would be the easiest way to create the maps for my game. I figured I would need some kind of visual editor that would give me immediate feedback and would allow me to place all objects in the world exactly where I want them. I could then load the saved representation of the world I create in the editor in my game.

So, I am looking for a simple map editor that allows me to do this. All the objects in my game are simply textured rectangles build up from two triangles. All I need to be able to do is position different rectangles/objects in the map, and give them a texture. I am using texture atlases, so it would be useful to be able to assign portions of textures to the objects. I then need to be able to extract all the objects from the saved representation of my maps, together with the name/identifier of the texture(atlas) they use, and the area of the texture atlas.

I have looked at some tile-based map editors like Tiled and Ogmo, but they don't seem to be able to do what I want.
Any suggestions?

EDIT: a more concrete example: something like the GameMaker level editor, but then with added export functionality in a handy format.

sentences:
Where can I get a list or data base of light reflectance values for different materials? I'm implementing lighting for a WebGL app but I'm not an artist so I don't know how to generate or where to obtain a list of materials with its values (diffuse, specular, ambient and shininess). I've been searching a lot but with no luck.

Is there any list or DB I might have overlooked? Any common repository or something similar?

Thanks in advance.

Note: English is not my main language, let me know if you don't understand something and I'll try to rephrase it.

sentences:
Rotation of bitmap using a frame by frame animation I have one large bitmap that has four frames drawn on it and I only draw one at a time by looping through the bitmap by increments to animate walking. I can get the bitmap to rotate correctly when it is not moving but once the animation starts it starts to cut off alot of the image and sometimes becomes very fuzzy.  I have tried

public void draw(Canvas canvas,int pointerX, int pointerY) {
    Matrix m;

    if (setRotation){
    //  canvas.save();
    m = new Matrix();
    m.reset();

    // spriteWidth and spriteHeight are for just the current frame showed
    m.setTranslate(spriteWidth / 2, spriteHeight / 2);

    //get and set rotation for ninja based off of joystick
    m.preRotate((float) GameControls.getRotation());

    //create the rotated bitmap
    flipedSprite = Bitmap.createBitmap(bitmap , 0, 0,bitmap.getWidth(),bitmap.getHeight() , m, true);
    //set new bitmap to rotated ninja
    setBitmap(flipedSprite);    //  canvas.restore();
    Log.d("Ninja View", "angle of rotation= " +(float) GameControls.getRotation());
    setRotation = false;
}

And then the Draw Method here

// create the destination rectangle for the ninjas current animation frame
// pointerX and pointerY are from the joystick moving the ninja around
destRect = new Rect(pointerX, pointerY, pointerX + spriteWidth, pointerY + spriteHeight);

canvas.drawBitmap(bitmap, getSourceRect(), destRect, null);

The animation is four frames long and gets incremented by 66 (the size of one of the frames on the bitmap) for every frame and then back to 0 at the end of the loop.

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:
How to build Ogre3d with boost? I have a simple question.

For people that know and built ogre3D from source as a Static library, what is the order of which the libraries should be linked?

The libraries I need to be organized are:

Ogre Plugins
'libOgreMain.a'
Ogre RenderSystems
Boost(version 1.47)link
Ogre's Dependencies

The reason I'm asking is because in the Ogre forums, I have asked about this and didn't get a good reply... yet.

The other reason is because even though I link to the boost library, I get this error:

undefined reference to '_imp___ZN5boost6thread20hardware_concurrencyEv'

My compiler is MinGW with CodeBlocks as the IDE.

And my main computer I'm building on is Windows Vista 32 bit.

sentences:
How to implement Microwave Signals in Unity? I need to implement microwave signals for object detection in Unity.

I know there are raycast sensors in Unity, but can microwave signals be simulated or can a proxy of microwave signals be created in Unity using the raycast sensors?

sentences:
How to mirror a texture in libGDX Is it possible to rotate my sprite in LibGDX?

public class Flame {
    private static final int FRAME_COLS = 6;
    private static final int FRAME_ROWS = 1;

    private Animation flameAnimation;
    private Texture flameSheet;
    private TextureRegion[] flameFrames;
    private SpriteBatch spriteBatch;
    private TextureRegion currentFrame;

    private float stateTime;

    private int xFlame;
    private int yFlame;
    private float rotation;

    /*
        Some code here
    */

    public void draw(){
        stateTime += Gdx.graphics.getDeltaTime();
        currentFrame = flameAnimation.getKeyFrame(stateTime, true);
        /*
          I also try currentFrame.flip(true, false); // but this doesn't work
        */
        spriteBatch.begin();
        spriteBatch.draw(currentFrame, xFlame, yFlame);
        spriteBatch.end();
   }

sentences:
Entity-Component-System data storage design I'm working on an ECS and I've already read a lot of articles about it. Most of these articles are talking about a simple case (store data contiguously, read it in a single for loop). However the real world is more complex: one system reads multiple components and those have to be read fast.

So I'm thinking on a new data storage model but before I start to implement it, I'd like to know what do you think: I'm not sure if this design would solve any (future) performance problem (I'm thinking about cache coherency, prefetching, etc. optimization).

So the basics are the same:

Each Entity is a handle (id + version number together).
Each Component is a(n ideally small) POD.
Each System is responsible for the processing of a set of components.

The first idea in every article is to store the component data in an array (of each type) and use a fast-lookup map (eg. hash_map) for the entity_id->component_id relation.

Eg. the Position component pack looks like this:

component data:
[pos_0][pos_1]...[pos_n]

entity->component map:
[entity_0 -> 1][entity_2 -> 0]...[entity_m -> n]

This works well if the systems are reading a single type of component linearly. If a system wants to read another component as well, it will generate at least two additional cache misses:

one for the entity_id->component_id lookup (to find the other component from the entity)
and one for the actual component data

So my idea is that instead of separating the components I could create groups. Each group has the same behaviour like before (the data laid out contiguously and an entity_id->component_id map is stored for fast component lookup) but the data stores multiple component data.

The point is that the component data is stored in the same order as the other components so if a system wants to read eg. the Position + Velocity component set it can iterate linearly on the array. Each component type has an offset to indicate where it starts on the big array.

So the Position+Velocity group looks like this:

component data:
[pos_0][pos_1]...[pos_n][... some space ...][vel_0][vel_1]...[vel_n]... and so on

entity->component map:
[entity_0 -> 1][entity_2 -> 0]...[entity_m -> n]

And if I'm interested in a component set of a single entity, I can use the map to find the component id then read the components using this id:

component_id = find(entity_id);
comp_0 = data[offset_of(comp_0_type) + component_id]
comp_1 = data[offset_of(comp_1_type) + component_id]

The biggest drawback is the larger array: when the array has to grow it has to allocate and copy more data at once. But IMHO the whole idea could work because most of the time (in my experience at least) an entity's components are not changing at run-time.

Note:
I tagged c++ as well, because I'm using c++.

Edit

Actually I've found a problem with this approach. This way the components cannot refer to each other. Eg a Transform component is responsible for structuring the "objects" in a tree, so each Transform component has a parent and a children property. However with this design I don't know how I could refer to the other Transform component since it can be in any group's array.

Edit 2

For the first iteration I'm going to implement a simple design, similar to the "Packed Array" described here.

sentences:
Flash saves in Windows, not in Linux, FileReference.save() The code below compiles fine on the Flex 4 SDK on Fedora 15.  Mouse-click opens the dialog box, I click okay, and a file is saved, but the file is empty.  I run the same SWF file (that was compiled on the Linux machine) on a Windows machine, and the created file contains the expected data.

Then I broke the FileReference declaration out of the function into the class level, hoping to avoid a known bug and to keep a reference to the file alive outside the function.  However, the same problem persists.

Hoping to set up a workaround, I added the debug Flash player to my path and ran the file from Flash without the benefit of the browser, and it works.  So now a Flex problem has become a Firefox problem, maybe owing to a shady procedure I used to install the plugin without really understanding what was happening.  I am running Firefox 5.0.

In essence my workflow is fixed, but perhaps people who performed the above will not be able to use projects with FileReference.save()?  Should I be worried about this edge case?

/*
WriteTheFile.as
Original code by Brian Hodge
Test to see if ActionScript/Flash can write files
*/
package{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.utils.ByteArray;
    import flash.net.FileReference;

    public class WriteTheFile extends Sprite
    {
        private var _xml:String;
        private var fr:FileReference;

        public function WriteTheFile():void
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }

        private function init(e:Event = null):void
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            //Calling the save method requires user interaction and Flash Player 10
            stage.addEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown);
        }
        private function _onMouseDown(e:MouseEvent):void
        {
            fr = new FileReference()
            fr.save("<xml><test>data</test></xml>", "filename.txt");
        }
    }
}

EDIT: addressed answer in code above, but the same problem exists.

EDIT: This works on the same system when the standalone player is invoked.  Therefore this is a browser (FF 5.0) plugin problem.

sentences:
Make part of albedo transparent I have a shader which creates a circle inside of a plane mesh. I would like to get get rid of the parts around the circle, which are the r and b parts of the ALBEDO but I can't seem to figure out how to do it.
The only thing I've managed to find is ALPHA but that changes the transparency of the entire shader and not just parts of it.
shader_type spatial;

float circle(vec2 position, float radius, float feather)
{
    return smoothstep(radius, radius + feather, length(position - vec2(0.5)));
}

void fragment() {
    ALBEDO = vec3(0, circle(UV - vec2(0), 0.5, 0.005), 0);
}

Which currently looks like:

sentences:
Scene Graphs and Entity Component Systems I am trying to determine how to move my current implementation of nodes in a scene graph to an entity component system and am struggling to wrap my head around how the two can work together, if at all.

I think the main cause of my confusion is breaking the habit of structuring everything in an object oriented hierarchy. I'm not overly familiar with game development as a whole so breaking what I already know works to replace with something else will be a testament to my knowledge.

Currently, I have a scene controller and a scene which handle the update and render loops accordingly. Code removed for brevity.

//scene controller
- (void)update:(NSTimeInterval)duration
{
    //loop though objects and integrate
}

- (void)render
{
    [[self scene] render];
}

//scene
- (void)render
{
    //loop through objects and render
}

This works fine with my scene nodes as is. Each node has properties for position, rotation, scale and geometry which are passed to shaders and rendered.

Now I am trying to remove all of these properties from the node and replace them with components.

Note: I realise that node means something else in an Entity Component System so this will be refactored into something else entirely.

It is my understanding that once I have transitioned from the current implementation to an ECS my game objects will expose the same position, rotation, scale and geometry properties but via components instead.

As of such, where will these new game objects sit in the hierarchy of a scene graph? My first thoughts would be to refactor the update and render loops to include the appropriate systems, a la:

//scene controller
- (void)update:(NSTimeInterval)duration
{
    //loop though objects and integrate
    [[self positionSystem] update:duration];
}

- (void)render
{
    [[self scene] render];
}

//scene
- (void)render
{
    //loop through objects and render
    [[self renderSystem] render];
}

However, it would seem odd to have the systems spread across two different objects (the scene controller and the scene). It would be possible remove the scene render loop and do this in the scene controller instead to keep everything in one place.

One final cause of confusion is how to link game objects together in the same way that my nodes are currently setup. A node can have children and a parent node which combine the parent matrices up the chain to allow me to link objects together, i.e.: a player and a sword.

From what I can gather, objects in an ECS shouldn't be linked together in this same way, or have I misunderstood the principles of an ECS? If this is the case, how would you create a scene graph from entities that aren't linked together in any way?

I'm eager to step back from my current implementation and overhaul the necessary parts but I'm not sure how to achieve a similar setup or if it is possible or even the correct way of doing things.

sentences:
How to receive broadcast message in Unity? I am trying to get the broadcasted message in overridden method of NetworkDiscovery.OnReceivedBroadcast(). For that what I had done is below:

I create class which implements NetworkDiscovery where I override the method OnReceivedBroadcast() to capture the broadcast messages.
In Unity Editor, I created an empty GameObject where I add the class in step #1 as component.

Now in code, I started the custom NetworkDiscovery class as below:

Discovery.Initialize();
Discovery.StartAsClient();

Now, when I start the broadcast in server, I am not receiving any broadcast message in OnReceivedBroadcast().

Below is my custom NetworkDiscovery class.

public class CustomNetworkDiscovery : NetworkDiscovery
{

// Use this for initialization
void Start()
{

}

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

}

public override void OnReceivedBroadcast(string fromAddress, string data)
{
    base.OnReceivedBroadcast(fromAddress, data);
}
}

One thing I noted is, If I use the NetworkDiscovery component directly in step #2; instead of using custom NetworkDiscovery class. I am able to see broadcast messages in it's default GUI.

How can I receive the broadcast message in the inherited class?

Any help will be appreciated.
Thanks.

sentences:
Circle Depth Penetration I'm resolving some collision between circles and I keep getting this problem.

Note: The rectangles are perfect squares fitting the circles so when I type rect.Width I mean the radius of the circle.

What I was trying to do was make it so that if it penetrated it would get pushed out and then the else if would take over and not call the if anymore. but the depth turns out to be a small number such as .6 and then since it's a float it rounds down and doesn't affect the rectangle at all. Even if I add a round function in there it just starts to jitter a bunch.

if (r < rect2.Width / 2 + rect1.Width / 2 && (fN + fG + fA).Length() != 0)
{
    // Resolve depth penetration
    float mDepth = rect2.Width / 2 + rect1.Width / 2 - r;
    Vector2 depth = new Vector2(mDepth * (float)Math.Cos(theta), mDepth * (float)Math.Sin(theta));
    rect2.X -= (int)depth.X;
    rect2.Y -= (int)depth.Y;

    // Apply an equal and opposite force
    fN = -fG

    // Stop the earth from moving
    v2 = Vector2.Zero;
}
else if(r == rect2.Width / 2 + rect1.Width / 2)
    fN = -fG;
else
    fN = Vector2.Zero;

I also tried changing depth penetration too this but the results are no different.

float mDepth = rect2.Width / 2 + rect1.Width / 2 - r;
Vector2 direction = rect1.Location.ToVector2() - rect2.Location.ToVector2();
direction.Normalize();
Vector2 depth = direction * mDepth;
rect2.X -= (int)depth.X;
rect2.Y -= (int)depth.Y;

The only solution we could think of is creating a range of 5 in which the object could be at rest.

if (r < rect2.Width / 2 + rect1.Width / 2 + 5 && r > rect2.Width / 2 + rect1.Width / 2)
    fN = -fG;
else if (r < rect2.Width / 2 + rect1.Width / 2 && (fN + fG + fA).Length() != 0)
{
    // Resolve depth penetration
    float mDepth = rect2.Width / 2 + rect1.Width / 2 - r;
    Vector2 depth = new Vector2(mDepth * (float)Math.Cos(theta), mDepth * (float)Math.Sin(theta));
    rect2.X -= (int)depth.X;
    rect2.Y -= (int)depth.Y;

    // Apply an equal and opposite force
    fN = -fG;

    // Stop the earth from moving
    v2 = Vector2.Zero;
}
else
    fN = Vector2.Zero;

Is there not a better way to do this?

Here is a video outlining the problem. https://www.youtube.com/watch?v=ZREQDA5BN0s Essentially since depth resolution isn't exact the == part of the if statement isn't used I know this because I placed a breakpoint in the first if statement it keeps going there with a depth of around .6. Then rounds down and doesn't move it at all. If I round it appropriately it just jitters a bunch.

sentences:
Pass large array to pixel shader I am trying to write a Pixelshader for a curve effect in Direct2d.

A curve effect maps each color channel value to a different value by using a look up table.

For this effect I would need to pass 3 arrays to the effect.
Each array has 256 entries to map the specific color channel.

How can I pass these arrays to a Pixel shader (i.e. Direct2d Effect)?

sentences:
Customizing Unity WebGL index.html Hey everyone just some css and styling tips needed! i want to use a game as a 404 page. so i would need on top to be either text or a contact form then some spacing and then the actual game window. iframes dont work that good on mobile devices and by doing a simple div in unity index although on mobile it works rather crude but nice, on desktop the text is going behind the unity game window. any tips please? Note that im adding the style in the index.html and not using the separate css file in the template folder.
So to sum up how can i make another div centered in the page and well responsive for mobile above the game container and add a margin on the bottom of that div!
Thank you!!

sentences:
Huge procedurally generated 'wilderness' worlds I'm sure you all know of games like Dwarf Fortress -  massive, procedural generated wilderness and land. Something like this, taken from this very useful article.

However, I was wondering how I could apply this to a much larger scale; the scale of Minecraft comes to mind (isn't that something like 8x the size of the Earth's surface?). Pseudo-infinite, I think the best term would be.

The article talks about fractal perlin noise. I am no way an expert on it, but I get the general idea (it's some kind of randomly generated noise which is semi-coherent, so not just random pixel values).

I could just define regions X by X in size, add some region loading type stuff, and have one bit of noise generating a region. But this would result in just huge amounts of islands.

On the other extreme, I don't think I can really generate a supermassive sheet of perlin noise. And it would just be one big island, I think.

I am pretty sure Perlin noise, or some noise, would be the answer in some way. I mean, the map is really nice looking. And you could replace the ascii with tiles, and get something very nice looking.

sentences:
SDL_AddTimer + SDL_GL_MakeCurrent not working on Windows I'm messing around with C++, OpenGL and SDL doing a game that should be able to run in Windows and Mac OS X.
I have a problem that only happens on Windows.

Let me describe the scenario.

First I create an OpenGL renderer and get the current context:

this->renderer = SDL_CreateRenderer(this->window, rendererIndex, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
this->context = SDL_GL_GetCurrentContext();

Complete code here

In my scene I add a timer to create some asteroids:

this->timer.Start(INTERVAL_CREATE_ASTEROID, SpaceshipScene::CreateAsteroidTimer, this);

Internally this timer uses SDL_AddTimer and keeps the current window and context for itself:

this->window = SDL_GL_GetCurrentWindow();
this->context = SDL_GL_GetCurrentContext();
this->callback = callback;
this->param = param;
this->timerId = SDL_AddTimer(interval, Timer::ExecuteCallback, this);

When the callback executes I use MakeCurrent to make sure that OpenGL will run in the right context (the window and context from the main thread):

bool hasContext = timer->window != NULL && timer->context != NULL;

if (hasContext) {
    SDL_GL_MakeCurrent(timer->window, timer->context);
}

Uint32 result = timer->callback(interval, timer->param);

if (hasContext) {
    SDL_GL_MakeCurrent(timer->window, NULL);
}

Complete code here

On Mac OS X this code is working perfectly, but on Windows it isn't drawing the asteroids on the window neither throwing any error.

What am I doing wrong?

sentences:
Is an extra collision-mesh for level-data worth the hassle? What is the optimal approach for collision-detection with the environment in an 3D engine (with triangle mesh based geometry, no bsp)?

A) Use the render mesh

[+] no need for additional work for artists to fiddle with collision detection
[-] high detail is harder for physics calculation
[+/-] maybe use collidable flags for materials
[+/-] compute the collision-mesh from the render-mesh

B) Use an additional collision mesh

[+] faster/more optimal collision-detection
[-] additional work (either by the artist or by the programmer who has to develop an algorithm to compute it from the render-mesh)
[-] more memory useage

How do AAA title handle this?
And what are the indie dev's approaches?

sentences:
Unreal installation and storage space requirement I am a new user of Unreal. I installed the program on Windows 7, and after using it for awhile I noticed that the C:/ partition was filling up very fast as I worked on my projects. I store my projects on a storage device different than the one with Windows- does Unreal nevertheless write files related to a project to C:/ and if it does, can such a setting be changed?

I am upgrading to Windows 10. Is there any difference in the behavior explained above between the two Windows versions? Is there any rule of thumb about how much there should be free space on the C:/ partition for Unreal to work with, regardless of where projects are stored?

sentences:
How to calculate falling speed in spritekit? Is there a way to calculate falling speed based on physics body settings, instead of waiting it to fall and getting velocity?

I would like to find what time it takes for object to fall from defined point and hit the ground. Usually using this formula time = distance / speed, but this time speed is a problem.

sentences:
Do >2-state cellular automata exist? I'm trying to implement a zone system into my game that randomly sets chunks (the cells) to a certain value from a list and that would effect nearby chunks. It's basically a cellular automaton in which instead of the cells being on/off, they would have multiple options, like red/green/blue/yellow/brown or such.

Do this kind of cellular automata exist?

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:
How would you go about rendering something like a line of coke more realistically, say with shaders? Im currently developing an app, where it simulates the snorting of cocaine. Im using LibGdx in Java to do that, I have got the mechanics down, but what Im currently left with is this:

Im currently rendering 1000 particles, which is doable by my Huawei P8, which isnt really high end. Doesnt really look good though. Any recommendations or other approaches you would use?

sentences:
How to scale-to-fit OGL viewport to GLFW window? Say my window is 1280x720. I want to render my stuff to lower resolution and then stretch it to window. I've tried this:

glViewport(0, 0, 1280 / 2, 720 / 2);

When I call glViewport and pass lesser width and height than window, I get all my OpenGL rendering in left bottom 1/4 of window. I need to scale it (linear filtering preferably) back to window size so I would get a pixelated effect.

I wonder if there is such possibility within glad/glfw API.

sentences:
Can I apply a force to particles from a script? I'm working on a game which involves streams of electrically-charged particles, being manipulated with electric and magnetic fields. Since I want a large number of small objects coming from an emitter and lasting a limited amount of time, a particle system seems like the way to go.

My only problem now is: how to apply the force? Suppose, for example, I have a charged object somewhere in the scene; I want to apply a force toward it, varying with the radius squared. If my particles were Rigidbodies, applying this force in the FixedUpdate would be easy; is there a way to do the same to an individual particle?

sentences:
Unity: UI following scene object lags or jumps I have a 3D plane with "enemies", each one has it's canvas with a health bar, that follows the enemy position. When the enemy rotates, the health bar position gets laggy and jittery (you see no fluently, like a jump)

The code that I'm using is:

 private Camera _camera;
 private RectTransform _healthBarReact;

 void Start {
     _camera = GameObject.Find("Camera").GetComponent<Camera>();
     _healthBarReact = transform.FindChild("HealthBarImage").GetComponent<RectTransform>();
 }

 void Update {
       Vector3 screenPoint = _camera.WorldToScreenPoint(transform.parent.position); // the parent is the enemy, I attached the script to the child canvas "HealthBar"
     _healthBarReact.position = screenPoint;
 }

How can I fix that "lag" issue? apparently, the issue only occurs when the enemy is rotating... when it follows you in a straight line, the healthbar looks well.

sentences:
My Earthbound-like Movement Script works in Unity Gameview, but runs differently in Gamebuild First programming question I've ever made in my short journey. I'm trying to create a script which moves members of your party in a line behind you (think Chronotrigger or Earthbound). Here's a clip of what I want it to look like.
Problem:
Everything looks fine in the Game window when I play, but when I build the game to test, the characters begin to stack one on top of each other. I assume it has something to do with Update() frames dramatically increasing the frequency with which I enqueue the positions of the leading character (although I'm not experienced enough to say for sure, clarification on this would be helpful).

I've tried increasing the offset, but this solution is variable
depending on the players computer fps so that wont work.
I've tried running both scripts in FixedUpdate() but a lot of my other
systems run on Update() and so everything stutters.
I've tried enqueue'ing from an IEnumerator and waiting for .1 second
between each enqueue but that stutters as well..

What I'm doing:
The leading character has a script called PlayerTrail which creates a Queue of Vector3s. In Update the game object's transform.position is enqueued. The following character has a script called PlayerFollower which looks at the Queue and Vector3.MoveTowards the position, then dequeues that position and repeats. Each character only looks at the trail of the character in front of it.
Everything seemingly works fine and well in the Unity program, this issue only arises once I build the actual game.
Code Supplied Bellow:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerTrail : MonoBehaviour
{
    public Queue<Vector3> LeaderTrail;
    public Vector3 LastMovement;

    private void Start()
    {
        LeaderTrail = new Queue<Vector3>();
    }

    private void  Update()
    {
        if (this.transform.position != LastMovement)
        {
            LastMovement = transform.position;
            LeaderTrail.Enqueue(this.transform.position);
        }

    }
}

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

public class PlayerFollower : MonoBehaviour
{
    public GameObject leaderObject;
    public int Offset;
    public int moveSpeed;

    private PlayerTrail leaderTrail;
    private Animator animator;

    void Start()
    {
        animator = gameObject.GetComponent<Animator>();
        leaderTrail = leaderObject.GetComponent<PlayerTrail>();
    }

    void Update()
    {
        if (leaderTrail.LeaderTrail.Count < Offset)
        {
                animator.SetBool("isMoving", false);
                return;
        }
        else
        {
            Vector3 direction = (leaderTrail.LeaderTrail.Peek() - transform.position).normalized;
            this.transform.position = Vector3.MoveTowards(this.transform.position, leaderTrail.LeaderTrail.Peek(), moveSpeed * Time.deltaTime);

            animator.SetBool("isMoving", true);
            animator.SetFloat("moveX", direction.x);
            animator.SetFloat("moveY", direction.y);

            Debug.DrawRay(this.transform.position, direction);

            leaderTrail.LeaderTrail.Dequeue();
        }
    }
}

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: If you create a game, do you automatically have the rights to it? I am creating a game in c++ that will me multiplier and am going to post it on https://indiegamestand.com  Here is one of the requirements "Must own the rights to distribute your game and to assign those rights to us (non-exclusively) for the purpose of selling here."  If I compile my game as an .exe do I have that right?  How can I make sure I retain it, and what can they do with the game if I give them that right?

sentences:
javascript game character mouse movement When a mouse button is pressed, coordinates are stored and character begins to move towards that point.

I do a check each frame if my character reached the destination, but because of the nature of how it all works, it can never be perfectly accurate. When I normalize my vector and multiply it by speed, I will always end up around that point but never directly at it. The bigger the speed, the more distance is passed in one frame and the further I get from where I wanted to be.

let startX = 110;
let startY = 110;
let endX  = 400;
let endY = 200;
let speed = 5;

let dx = endX - startX;
let dy = endY - startY;

let length = Math.sqrt(dx*dx+dy*dy);

dx /= length;
dy /= length;

dx *= speed;
dy *= speed;

So this gives me a dx:4.775320684056187 and dy:1.4819960743622644, so that is the value that is added each frame, so in the end it gets to coords 399:191 next one is 404:193 etc. I have to pick a close one, or force object to move to the one I wanted, it never reaches exactly 400:200.

It becomes a problem when path finding and collision comes to play, because I can get 2 pixels on an obstacle etc.

How is this solved? What am I doing wrong?

sentences:
How can I draw a part of a texture in slick2d? I know the method for drawing a region of a texture in slick2d:

image.draw(x, y, srcX, srcY, srcX2, srcY2);

But I have no idea how the texture coordinates work. To draw a region of x:16, y:16, width:32, height:16 from a texture. I tried:

image.draw(0, 0, 16, 16, 32, 16);

and I have tried many other things with no luck. All I get is weirdly cropped and stretched images. Help?

sentences:
Level of Detail and loading map tiles I'm making some visualization of the Earth. It just should display tiles from services like Google Map (OpenMap for example) on the Earth surface. This services provide Earth satellite image textures of different parts of Earth at different zoom levels (resolution). The goal is make something similar with Google Earth.

Of course I want to load only visible tiles at appropriate zoom level depending on distance to the camera center. So I'm interesting in how to decide which tiles on which levels should I load depending on current camera position.

I know how to find region on the Earth surface that currently visible depending on camera view and projection matrix. And I can calculate the desired resolution (zoom level) of tiles for each point inside this region. Now, how to find out tile coordinates and zooms that I need to download form OpenMap or similar services? Is there some algorithm to do it?

sentences:
Why moving platform script is not working? I have some code attached to a moving platform:

public Transform pos1, pos2;
public float speed;
public Transform startPos;

Vector3 nextPos;
// Start is called before the first frame update
void Start()
{
    nextPos = startPos.position;
}

// Update is called once per frame
void Update()
{
    if (transform.position == pos1.position)
    {
        nextPos = pos2.position;
    }
    else if (transform.position == pos2.position)
    {
        nextPos = pos1.position;
    }
    transform.position = Vector3.MoveTowards(transform.position, nextPos, speed * Time.deltaTime);
}

private void OnDrawGizmos()
{
    Gizmos.DrawLine(pos1.position, pos2.position);
}

But my platform does not go to the pos2 when it reaches the pos1. What is wrong here?

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:
RTS Attack Formation If i select a group of units and send them somewhere i form them like the following;

If i select them and order an attack, i want three things to happen:

High range units should keep the distance while attacking.
Each unit should attack if possible.
Attack formation should not look too unnatural.

Now i can handle the first two by forming the units as a circle by considering the range and unit count etc. But it looks very unnatural.

It's acceptable if some of the units are being idle for some reason, but i want most of the units join attack and they don't look so artificial.

Any ideas on that? Thanks.

sentences:
How to rotate an object around its own roll axis I have a 2-dimensional image of smiley face in a 3-dimensional space.
I want it to rotate like a fan, so the smiley would look as if it's rolling like a wheel in place. Since the smiley is placed in a 3D space it can face any direction, but I always want it to rotate around like a wheel.

I use Minecraft so the Z and Y have the opposite jobs. (Y is the height).

I use these 3 functions for rotating around the x, y and z axis.

public static final Vector rotateAroundAxisX(Vector v, double angle) {
    double y, z, cos, sin;
    cos = Math.cos(angle);
    sin = Math.sin(angle);
    y = v.getY() * cos - v.getZ() * sin;
    z = v.getY() * sin + v.getZ() * cos;
    return v.setY(y).setZ(z);
}

public static final Vector rotateAroundAxisY(Vector v, double angle) {
    double x, z, cos, sin;
    cos = Math.cos(angle);
    sin = Math.sin(angle);
    x = v.getX() * cos + v.getZ() * sin;
    z = v.getX() * -sin + v.getZ() * cos;
    return v.setX(x).setZ(z);
}

public static final Vector rotateAroundAxisZ(Vector v, double angle) {
    double x, y, cos, sin;
    cos = Math.cos(angle);
    sin = Math.sin(angle);
    x = v.getX() * cos - v.getY() * sin;
    y = v.getX() * sin + v.getY() * cos;
    return v.setX(x).setY(y);
}

Sometimes I spawn the smiley facing the negative/positive X direction so to make it look like a wheel I have to rotate it around the X axis. But sometimes I spawn the smiley facing the negative/positive Z direction so I have to rotate it around the Z axis.

I searched online and found a term for an object's axes, and the one I was looking for is called "Roll".

Is there any way to rotate this smiley like a wheel regardless of where it's facing? a.k.a rotate it around its own "roll axis"?

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:
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 or Monogame or Gamemaker 2 for an experienced application developer? So i know this question has been hammered down several times but please bear with me.

I used to be a C# .Net application developer but i am no longer employed, i am pretty good at C#.

I want to get into serious game development and i dunno where to start, i used to work with unity occasionally which is a very little and i kinda find it clunky, like it works but somehow it does not feel right and feels kinda clunky. But it works with tiled map editor without much of a hassle.

I Remember using Game maker studio when i was back in college and i found it  very good, its a breeze to work with and even have its own tiled map editor, even seems to have some good tutorials, the only con is its price.

I was initially inclined towards Monogame cause of my C# background, but i neither have time nor money and resources to support me for long enough time to be able to code every single thing from scratch and i am kinda in a pretty bad situation overall right now. It just takes too much time to do anything even to make it work with a tiled map editor, and there are very few tutorials or documentation to start with.

It seems like the only option for me is Unity at the moment, cause of ease of access and how easy it is to work with tiled map editor and lots of tutorials.

which one do you guys think is good overall?

Please keep in mind that i am currently unemployed and have very little resources to support myself, and i am a programmer so i don't even know how to compose music and do art for the game and i'd prefer if it provides some asserts to be used so i wont waste time in learning stuff when i cannot afford to spend time.

I will eventually learn them but not now, its not happening now so i prefer something that comes with some sorta free asserts that can be used (mainly music and art), I mean does it even matter if all i am trying to do is earn a decent minimum living?

I just want to make simple 2D NES/Snes style games with multiplayer support.

Thank you.

sentences:
Unity Animated Player Character Rotation Glitch I was wondering if anyone experienced this issue in Unity with Mecanim-animated characters ...

I have an animated player character with a third-person camera control (Game Camera from the asset store, even though I think it isn't really related) and if the character is standing at the default y-rotation angle I can orbit around her with the camera and she will always face the same direction, as it should be.

But if the character stands with an arbitrary other transform y-rotation (for example 90.0001 or 180, etc.) and I orbit around the character, the character's Y rotation is ever so often randomly changed.

I don't know what changes the Y rotation. Game Camera doesn't touch it as long as I don't move the character so I suppose it is related to Mecanim, even though i'm not sure about that either.

I was hoping somebody has more familiarity with this issue and know what causes this. This glitch is definitely a problem in gameplay.

sentences:
With gravity enabled, how do you move a RigidBody forwards at a specific speed? I have a perfectly smooth cube on top of a perfectly smooth plane. I am applying a forward-force of 1 unit per second, using rigidBody.AddForce(new Vector3(0, 0, 1), ForceMode.VelocityChange). I apply this force every FixedFrame(), taking into account Time.fixedDeltaTime, of course.

When the "Use Gravity" checkbox on the RigidBody is not checked, the object behaves as expected; after exactly 3 seconds, it has a speed of exactly 3 units per second.

However, when I enable the "Use Gravity" checkbox, the object barely moves. Both the object and the surface are using Physic Materials with zero friction, and the moving object's RigidBody has zero drag and zero angular drag.

Why does this happen? And more importantly, how would I apply a force to this object so that it moves forward at, say, exactly 3 units per second, with gravity enabled?

Thank you.

sentences:
XNA C# Adding objects to List in another class Hi all i started creating this XNA/C# version of Space invaders to get better at xna since i've only been using it for about 4 days.

I've managed fine till now..

So my problem is adding my Bullets to a List in another class.
So i've tried working out the solution for about 3 hours now and i hope you guys can help me.

In the Player.cs class i've got a method FireBullet() wich should create a new Bullet.cs class and add it to the list in Game1.cs (it does not do this when you debug) in theory this should work(i think).

Linking all the corresponding classes will take too much room so i've uploaded it to github

https://github.com/Breinss/Space-Invaders-XNA-C-

says C in title ran out of character ment to be C# ^^

Thanks in advanced!

sentences:
How do I stop my first person character going through walls? As per my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using Cursor = UnityEngine.Cursor;

public class FirstPersonController : MonoBehaviour
{
    public float speed = 5;
    public float jumpPower = 4;

    Rigidbody rb;
    CapsuleCollider col;

    private GameObject player;
    private float minClamp = -45;
    private float maxClamp = 45;
    [HideInInspector]
    public Vector2 rotation;
    private Vector2 currentLookRot;
    private Vector2 rotationV = new Vector2(0,0);
    public float lookSensitivity = 2;
    public float lookSmoothDamp = 0.1f;
    public Camera cam;
    public GameObject crossHair;
    bool isActive;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.visible = false;
        Cursor.lockState = CursorLockMode.Locked;

        rb = GetComponent<Rigidbody>();
        col = GetComponent<CapsuleCollider>();
        player = transform.gameObject;
        crossHair = GameObject.FindWithTag("CrossHair");

    }

    // Update is called once per frame
        void Update()
    {
        float Horizontal = Input.GetAxis("Horizontal") * speed;
        float Vertical = Input.GetAxis("Vertical") * speed;
        Horizontal *= Time.fixedDeltaTime;
        Vertical *= Time.fixedDeltaTime;
        transform.Translate(Horizontal, 0, Vertical);

        if (isGrounded() && Input.GetButtonDown("Jump"))

        {
            rb.AddForce(Vector3.up * jumpPower, ForceMode.Impulse);
        }

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

        if (Input.GetButtonDown("Sprint"))
        {
            speed = 15;
            //Debug.Log("Sprint Button Held Down");
        }

        if (Input.GetButtonUp("Sprint"))
        {
            speed = 5;
            //Debug.Log("Sprint Button Let Go");
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            isActive = !isActive;
        }

        if (isActive)
        {
            crossHair.SetActive(true);
        }
        else
        {
            crossHair.SetActive(false);
        }

        rotation.y += Input.GetAxis("Mouse Y") * lookSensitivity;
        rotation.y = Mathf.Clamp(rotation.y, minClamp, maxClamp);
        player.transform.RotateAround(transform.position, Vector3.up, Input.GetAxis("Mouse X") * lookSensitivity);
        currentLookRot.y = Mathf.SmoothDamp(currentLookRot.y, rotation.y, ref rotationV.y, lookSmoothDamp);
        cam.transform.localEulerAngles = new Vector3(-currentLookRot.y, 0, 0);
    }

    private bool isGrounded()
    {
        return Physics.Raycast(transform.position, Vector3.down, col.bounds.extents.y + 0.1f);
    }

}

I can't figure out what I am doing wrong in my code, I tried to write a first person controller from scratch.

The full project can be downloaded from: https://github.com/Some-T/FirstPersonController-CSharp

My player goes through any wall or object easily despite it having colliders on the objects and a rigidbody and collider on the player.

I have gone through my code line by line and I cannot work out what is wrong? If someone could please advise me what to change or add to my code to fix this, or / and explain the concept, presumably physics related, as to why this is going wrong please?

sentences:
How to render multiple objects as a single object for fluid simulation? I'm trying to do fluid simulation using particles in 2d game. I have larger particles, which interactive each other physically, those particles collide with environment (e.g wall,obstacles) to simulate fluid.

However drawing things doesn't go well. I'm trying to figure out how to render the circles without the gaps in between. I've tried blurring the circles like so:

But the gaps remain. Also, blurring the particles causes the particles dimension to change visually every frame. Meaning the physics shape and the visual shape don't match up.

How can I render these objects as one?

finally, i got some effect like this, even artefacts exists:

here is my solution, steps as following:
1.draw water or fluid with SPH.
2. blur all of it.
3. does metaball with it.

sentences:
Making a house in jogl java eclipse? here's what I'm trying to do:
One house, with 3 rooms, a window in two rooms, doors in the front and back of the house and into each room (the back door has to be through one of the rooms). I've added a picture as an example
I'm using JOGL 2.0, in eclipse.

Clarification: my question is how do I code it in java using jogl?

This is what I have so far:

    glBegin(GL_QUADS)
    /* Floor */
    glVertex3f(-1,-1,-1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,-1,1);
    glVertex3f(-1,-1,1);
    /* Ceiling */
    glVertex3f(-1,1,-1);
    glVertex3f(1,1,-1);
    glVertex3f(1,1,1);
    glVertex3f(-1,1,1);
    /* Walls */
    glVertex3f(-1,-1,1);
    glVertex3f(1,-1,1);
    glVertex3f(1,1,1);
    glVertex3f(-1,1,1);

    glVertex3f(-1,-1,-1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,1,-1);
    glVertex3f(-1,1,-1);

    glVertex3f(1,1,1);
    glVertex3f(1,-1,1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,1,-1);

    glVertex3f(-1,1,1);
    glVertex3f(-1,-1,1);
    glVertex3f(-1,-1,-1);
    glVertex3f(-1,1,-1);
    glEnd();

sentences:
How to make a map surface object I'm making a 2d tile based game. In pygame I could create a map like this:
screen = pygame.display(resolution)
map = pygame.Surface(width, height)
for tile in all_tiles:
    map.blit(tile)
screen.blit(map)

The strength of this is that I can scroll the map by changing the map surface x and y. Also all the in-game coordinates are conveniently set in relation to the map rather than the screen. However I can no longer use pygame, and I'm trying to switch to pyglet instead. As far as I can tell pyglet doesn't have an equivalent surface class built in, and therefore I need to build my own, this is what I need help with.
I've used pygame.Surface extensively without really understanding how it works (python programmers these days huh). So I'm hoping you can offer some insight on how to get started. I know it needs a width and height, as well as some kind of list of the sprites which have been 'blitted' to it, and that moving the surface itself moves all the contained sprites, so surfaces blitted to it are somehow anchored to the surface rather than the screen.
How is this stuff done in pygame, and how do we create a pyglet friendly version?

sentences:
How can I generate a wall/s? I want to create for example 4 cubes and then to connect them all making a square but making them scaling to one direction and not two directions as by default.
The prefab variable is a Cube.
I have this old script I did long time ago. The script is working but not what I wanted.
This script create like a cube from all the walls.
How can I add some flag bool to decide if to create a kind of cube like it is now or to create a square empty square not to fill it. I mean if I want to make it like hollow.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenerateWall : MonoBehaviour
{
    public GameObject prefab;
    public Vector3 wallsStartPosition;
    public float width = 0;
    public float height = 1;
    public float lengthX = 2;
    public float lengthZ = 2;
    public float time = 1;

    private List<GameObject> walls = new List<GameObject>();
    private IEnumerator coroutine;

    void Start()
    {
        for (int i = -2; i < 2; i++)
        {
            GameObject go = Instantiate(prefab);
            go.transform.parent = transform;
            go.tag = "Wall";
            Vector3 scale = Vector3.one;
            Vector3 adjustedPosition = wallsStartPosition;

            float sign = Mathf.Sign(i);
            if ((i * sign) % 2 == 0)
            {
                adjustedPosition.x += (lengthX * sign) / 2;
                scale.x = width;
                scale.y = height;
                scale.z *= lengthZ + width;
            }
            else
            {
                adjustedPosition.z += (lengthZ * sign) / 2;
                scale.x *= lengthX + width;
                scale.y = height;
                scale.z = width;
            }
            adjustedPosition.y -= height / 2;
            go.transform.localScale = scale;
            go.transform.localPosition = adjustedPosition;
            walls.Add(go);
        }
        coroutine = raiseWall(walls[0], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[2], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[1], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[3], height, time, 0, 100);
        StartCoroutine(coroutine);
    }

    IEnumerator raiseWall(GameObject wall, float amount, float time, float delay, float steps)
    {
        Vector3 position = wall.transform.localPosition;
        float finalHeight = position.y + amount;

        yield return new WaitForSeconds(delay);

        while (position.y < finalHeight)
        {
            float remainingHeight = finalHeight - position.y;
            position.y += Mathf.Min(remainingHeight, amount / steps);
            wall.transform.localPosition = position;
            yield return new WaitForSeconds(time / steps);
        }
        yield break;
    }
}

The result is :

but if I want it to be like this ?

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:
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:
2D platform collision I have went over and over in my head for the past month trying to get a simple platformer together. My problem is collision. So far from every tutorial I've found this tilemap based collision needs to be done this way:
Check for for tile in x+xVel / tilesize if so xVel=0
same for x axis just subtracting for when the player goes left.
Check for tile in y+yVel/tilesize. if so yVel=0. No matter how many different ways I end up programming this concept. The player always ends up clipping walls, falling through, or just hanging out 2 pixels before the collision. Can anyone tell me what's up?

By the way my collision check is a two point method. eg. Check top two points of the rectangle box if going up, bottom two for down ect.

Thanks!

sentences:
Benefits of attending highly selective colleges I live in a pretty high-income community where teachers and parents tell you that if you ever hope to have a good income, you have to go to a good, selective college. However I'm one of the few kids at my school who has developed a love for programming software (and games on occasion), and I've never had a teacher that's even understood computers; so I'm wondering if this statement is true for this the software profession as well.

How much of a difference does attending a highly selective, generic school make when entering the software or game development profession?

I've also found that almost any and all information on software development can be found on the internet or in a book. Which makes college almost seem unnecessary.

How important is it to go to college at all when entering these professions
or starting your own software or game company?

please try and give sources of information =)
Thanks

sentences:
Level editors compatible with MonoGame? I'm thinking about a future project using MonoGame and it seems there are no level editors that outright support it, though obviously there are those for XNA that may possibly be compatible.  So I suppose this is a two-part question; are there any existing level editors that can be made work with MonoGame, and also is it possible to create levels that are then inbuilt into the codebase and thus work cross-platform (for example, Android or iOS, or does the level editor have to support the platform)?

Thanks in advance.

sentences:
2D lighting theory: day-and-night cycle, spot lights at night I am writing a rogue-like  'zombie' management game. The game map will be similar to Prison Architect. A top-down 50 X 50 grid.

I want to implemented a day night cycle and during the night I would like the player to be able to position lights.

I would like to be able to lighten and dark to whole map to display the day and night cycle.

Then lights would be a circle of light blocked by game entities such as walls, players, trees etc.

How would I achieve and what is the standard way of achieving this?

sentences:
Extracting Frustum Planes (Hartmann & Gribbs method) I have been grappling with the Hartmann/Gribbs method of extracting the Frustum planes for some time now, with little success. There doesn't appear to be a "definitive" topic or tutorial which combines all the necessary information, so perhaps this can be it

First of all, I am attempting to do this in C# (For Playstation Mobile), using OpenGL style Column-Major matrices in a Right-Handed coordinate system but obviously the math will work in any language.

My projection matrix has a Near plane at 1.0, Far plane at 1000, FOV of 45.0 and Aspect of 1.7647.

I want to get my planes in World-Space, so I build my frustum from the View-Projection Matrix (that's projectionMatrix * viewMatrix). The view Matrix is the inverse of the camera's World-Transform.

The problem is; regardless of what I tweak, I can't seem to get a correct frustum. I think that I may be missing something obvious.

Focusing on the Near and Far planes for the moment (since they have the most obvious normals when correct), when my camera is positioned looking down the negative z-axis, I get two planes facing in the same direction, rather than opposite directions. If i strafe my camera left and right (while still looking along the z axis) the x value of the normal vector changes.

Obviously, something is fundamentally wrong here; I just can't figure out what - maybe someone here can?

EDIT: Applying the algorithm to just the Projection matrix (i.e. model and view matrices are identity) I get the Near and Far planes returned as the following;
Far:  normal[0,0-1],  distance 1
Near: normal[0,0,-1], distance -0.3328891

Can someone tell me if these seem correct? Using the algorithm with just the Projection Matrix should return the planes in View Space (camera space)

sentences:
How to desing an RPG system with regard to PVP When you design a RPG system focused on PVE, one usually goes "mob of level X has Y hp and Z damage". How about when we do PVP with multiple classes?

Lets say we go Diablo, so we have STR/DEX/INT/VIT, how do you balance those between classes? Do I say:

I want a fight to last 10 rounds on average (lets assume its turn based)
barb starts with 300 hp, demon hunter 250 hp, wizard 200 hp

And now try to manipulate DPS / health using stats/skills so it matches the "10 round on average" by giving mage a mana shield an a lil bit more damage per fireball than barbarians melee attack? How would You approach this?

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:
Initializing OpenFeint for Android outside the main Application I am trying to create a generic C++ bridge to use OpenFeint with Cocos2d-x, which is supposed to be just "add and run" but I am finding problems.

OpenFeint is very exquisite when initializing, it requires a Context parameter that MUST be the main Application, in the onCreate method, never the constructor. Also, the main Apps name must be edited into the manifest. I am trying to fix this. So far I have tried to create a new Application that calls my Application to test if just the type is needed, but you do really need the main Android application. I also tried using a handler for a static initialization but I found pretty much the same problem.

Has anybody been able to do it? This is my working-but-not-as-intended code snippet

public class DerpHurr extends Application{

@Override
public void onCreate() {
    super.onCreate();
    initializeOpenFeint("TestApp", "edthedthedthedth", "aeyaetyet", "65462");
}

public void initializeOpenFeint(String appname, String key, String secret, String id){
    Map<String, Object> options = new HashMap<String, Object>();
    options.put(OpenFeintSettings.SettingCloudStorageCompressionStrategy, OpenFeintSettings.CloudStorageCompressionStrategyDefault);
    OpenFeintSettings settings = new OpenFeintSettings(appname, key, secret, id, options);

//RIGHT HERE
    OpenFeint.initialize(***this***, settings, new OpenFeintDelegate() { });
    System.out.println("OpenFeint Started");
}

}

Manifest

<application
    android:debuggable="true"
    android:label="@string/app_name"
    android:name=".DerpHurr">

sentences:
Game programming course materials: What should it include? I am tasked to create the course materials for a game programming class, and I’d like your opinion on what aspects and areas of game programming, such as game state management, game object storing or simple AI, should I include in it? The course is intented to be the first step into game programming for students with novice skills in programming.

There will be mathematics as well, but I found that there are multiple questions, with good answers, on that subject already.

sentences:
LibGDX: How can i remove inner actors? How can I remove these(on the picture) actors if I only have access to root's Window methods getChildren() and getCells() ?
I've tried somthing like this:
removeActor(getCells().get(1).getTable().getCells().get(0).getTable()...getTable());

But it always return the root Table.

UPDATE

I've came to this:

Cell<FileChooser> cell = getCells().get(1);
removeActor(cell.getActor().getCells().get(0).getActor());

But now it throws nonsense Exception:

Exception in thread "LWJGL Application" java.lang.ClassCastException: com.kotcrab.vis.ui.widget.file.FileChooser$11 cannot be cast to com.kotcrab.vis.ui.widget.file.FileChooser

How class cannot be cast to its own type?

sentences:
How to export an IK structure created in Blender 2.8 to Godot 3.1? I created this IK bone structure in Blender 2.8 and exported as .escn

As you can see, in Blender it's working ok.
Now, how to use it in Godot?

I've tried export with:

.dae (native)
.dae (Better Collada)
.escn
.glb

None of them worked...

Is there any tutorial for using imported IK in Godot?

sentences:
UDK game Prisoners/Guards For school I need to make a little game with UDK, the concept of the game is:

The player is the headguard, he will have some other guard (bots) who will follow him. Between the other guards and the player are some prisoners who need to evade the other guards.

It needs to look like this

My idea was to let the guard bots follow the player at a certain distance and let the prisoners bots in the middle try to evade the guard bots.
Now is the problem i'm new to Unreal Script and the school doesn't support me that well.

Untill now I have only was able to make the guard bots follow me.
I hope you guys can help me or make me something that will make this game work.

Here is the class i'm using to let te bots follow me:

class ChaseControllerAI extends AIController;

var Pawn player;
var float minimalDistance;
var float speed;
var float distanceToPlayer;
var vector selfToPlayer;

auto state Idle
{
    function BeginState(Name PreviousStateName)
    {

        Super.BeginState(PreviousStateName);
    }

    event SeePlayer(Pawn p)
    {

        player = p;
        GotoState('Chase');
    }
Begin:

       player = none;
       self.Pawn.Velocity.x = 0.0;
       self.Pawn.Velocity.Y = 0.0;
       self.Pawn.Velocity.Z = 0.0;
}
state Chase
{
    function BeginState(Name PreviousStateName)
    {

        Super.BeginState(PreviousStateName);
    }
    event PlayerOutOfReach()
    {
        `Log("ChaseControllerAI CHASE Player out of reach.");

        GotoState('Idle');
    }
//  class ChaseController extends AIController; CONTINUED
// State Chase (continued)
    event Tick(float deltaTime)
    {
       `Log("ChaseControllerAI in Event Tick.");

       selfToPlayer =  self.player.Location - self.Pawn.Location;
       distanceToPlayer = Abs(VSize(selfToPlayer));

       if (distanceToPlayer > minimalDistance)
       {
           PlayerOutOfReach();
       }
       else
       {
          self.Pawn.Velocity = Normal(selfToPlayer) * speed;
          //self.Pawn.Acceleration =    Normal(selfToPlayer) * speed;
          self.Pawn.SetRotation(rotator(selfToPlayer));
          self.Pawn.Move(self.Pawn.Velocity*0.001); // or *deltaTime
       }
    }
Begin:
     `Log("Current state Chase:Begin: " @GetStateName()@"");
}

defaultproperties
{
    bAdjustFromWalls=true;
    bIsPlayer= true;
    minimalDistance = 1024; //org 1024
    speed = 500;
}

sentences:
How can I interpret NSF (Nintendo Sound Format) data as audio? First, I'm not asking about details regarding the layout and format of an NSF file.  The original spec (see here) covers most of the information that I need regarding finding the data associated with each track.

My question is that once I've loaded an NSF and consumed the header, how can I meaningfully interpret the data for audio playback?  I've found multiple sites that talk about the NSF format, but I've yet to find a site that explains how the data can be used once the file has been dissected into all of it's components.  How do I read and prepare this audio information for playback?

I'm not looking to emulate an NES device but I would like to pull out the raw audio information (or calculate/convert the information to raw audio data.)

For those who are interested, this is for a personal fun project. I'd like to dissect some of these sound-bytes and convert them to audio that I can manipulate within my own application.  I'm completely new to audio processing but I've done my share of low-level work.  This seemed like a fun project where I'd be jumping in way over my head but I'd have fun trying to figure out all that I want to accomplish.

To start, though, I need to get audio data that I can manipulate from sources that I am interested.  in this case it's NES carts.  Since the cartridge data is already available in NSF files, I figured I'd dissect the NSFs rather than the ROM files for audio content.

Apologies if this questions is to big for a simple specification of data layout.  Any answer that can point me in the right direction is what I'm looking for.

sentences:
Unity5x GetComponent().Play("sequence".StopAll) not working I'm working with Unity3D 5x using C#. I've attached collision detection to the character controller script that plays a "gothit" animation clip (using legacy animations).

Here are the code snippets, the first is for the collision:

void OnTriggerEnter (Collider other)
{
     if(other.gameObject.CompareTag ("dmgEnvironment")||other.gameObject.CompareTag ("dmgPlayerHit"))
    {
        GetComponent<Animation>().Play("gothit", PlayMode.StopAll);
        GetComponent<Animation>().wrapMode = WrapMode.Once;
        print("hit damage");
    }
}

The attack animation call:

public void AnimatePunch()
{
    DidAttack ();
    //play animation
    if (canHit && lastAttackTime < lastAttackButtonTime + attackTimeout) {
        SendMessage("DidAttack", SendMessageOptions.DontRequireReceiver);
    }
    GetComponent<Animation>().Play("punch", PlayMode.StopAll);
    GetComponent<Animation>().wrapMode = WrapMode.Once;
}

The problem I'm running into is that the "gothit" sequence won't play on collision but will do so when wired to the AnimatePunch().

I'm not sure why this is happening. Any help is greatly appreciated.

sentences: How to tell if a fixture is being squeezed by two other fixtures in Box2D? Let's say I had a ground fixture, a player box, and a kinematic block moving up and down. If the player stands under the block, weird things happen. I want to simply play an event where the player dies. How can I detect when the player box is crushed by the block moving down on it?

sentences:
Making a pixel-perfect viewport in LibGDX My game that uses LibGDX as the graphics library, should be playable with every display. Here's the problem: It have to be pixel-perfect. That means, the scale factor must be an integer value, so that my pixels do not stretch over two physical pixels - resulting in flickering pixels which I obviously do not want.

The player should see a constant amount Y of vertical space. The width is calculated by the screen resolution. My game field is designed for 4:3. Therefore a player with 16:9 or even 21:9 should see more in the horizontal space. Best example: An usual Pong field. The field is 4:3. A player with 16:9 should see the same field size, but with more "empty" space on the sides.

I've tried various approaches to achieve this.
The first was the ScreenViewport, provided by LibGDX. Problem: Adjusting the unitsPerPixel would result in a smaller playfield. Or even mirroring it. I could provide a high-res playfield and scale it down with unitsPerPixels, but it is not very future-proof (Think of providing a 4k field for a future 512k monitor).

My second approach was a custom viewport. (No worries! It is written in Kotlin)

worldWidth *= (screenHeight/worldHeight).toInt()
worldHeight *= (screenHeight/worldHeight).toInt()

setScreenBounds(
    screenWidth/2 - worldWidth.toInt()/2,
    screenHeight/2 - worldHeight.toInt()/2,
    worldWidth.toInt(),
    worldHeight.toInt() )

It tries to scale up the field by a integer number (making it pixel-perfect).
Problem: The unscaled zones (that would be normally covered by the non-integer-scaling) are black. Black bars. Instead, I want to show the game world.

Any ideas how to achieve this? Thanks!

sentences:
slow/fast/slow experience system I am looking for an experience ladder that 'starts' off relatively quickly like a bit of geometric series, then quickly grows like an exponential curve, and then a slow exponetial curve for later levels, in the range of levels 1-5000.

How would I do this mathematically? I am assuming I might just have three sets of equations, but then what is the correct math for getting the level (based on XP), and vice-versa, XP based on level?

I.e., I am thinking something like:

lvl 1 - 10 exp
lvl 2 - 12 exp
lvl 3 - 15 exp
lvl 4 - 18 exp
lvl 5 - 22 exp (not quite fibacconi)
lvl 6 - 26 exp
lvl 7 - 32 exp
...
then maybe around level 150 or so it starts growing quickly, like
lvl 150  -1000 exp
lvl 151 - 1200 exp
...
lvl 3000 - 30000 exp
lvl 3100 - 40000 exp
lvl 4000 - 75000 exp
lvl 5000 - 100000 exp

If it's been done, a link would be great (since I am not exactly sure what I am looking for, not quite sure how to find it). Or if it is easy for you to just write the math, please do that too, thanks for your help!

sentences: Using Burst Compile attribute on methods Can we use BurstCompile attribute without using any Jobs or ECS System in Unity? does adding [BurstCompile] attribute before methods bring us any benefits?

sentences:
XNA 2D game fullscreen issue I am creating a 2D farming game using XNA - just today I have tried applying full screen to it, and I realized I failed badly with something. It cuts off a bit of the lower part [item hotbar and a piece of character status area]

I have just started learning C# and XNA, I just totally rewrote the engine and changing everything with rendering all over again is not an option - honestly I have no idea myself how does it all work anymore [I'm using some crazy camera class thing with an array of rectangles for displaying tiles / moving them around when the player moves etc] :-P

In the previous version of the engine I used the default XNA window size and the full screen worked just fine, this time I changed it to something more ... comfortable, and it does not work anymore. Changing the preferred buffer width does nothing at all in full screen, it's still cut off, and still the same height. I have no idea what matrices or viewports are, and everything I seem to find on google refers to them and some crazy complicated stuff

The screen size I am using is 800 x 640

My screen is very long sideways [whatever the name for such screens was :|]

Is there a way to fix that without rewritting everything?

sentences:
Object updates, internal vs external? The title is a bit confusing, but I couln't think of how to explain my question in a short phrase. So here it is:

Whenever I'm writing game engines, wheter it's physics/tilebased etc, I always get to the point where I'm not sure how I should manage things. Should entities in the world handle on their own, or should there be some global system managing them?

Here's an easy example: Moving things.
Should each object see the world around him (check for collisions) and move based on that.

[note, this is a tile based game where object move per tile, so I'm not using physics to move from tile to tile]

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            if (world.getTile(location) != solid && world.objAtTile(location) == null)
            {
                Tweener.addTween(this, location);
            }
          }
        }

Or should the movement of each object be handeled in the world, where the world checks everything?

public class Actor : GameObject
    {
        private void MoveTo(Vector2 location)
        {
            world.moveTo(location);
          }
        }

public class World
{

    public void moveObject(GameObject obj, Vector2 location)
    {
      //called from object

      if (getTile(location) != solid && objAtTile(location) == null)
         {
                Tweener.addTween(obj, location);
         }
    }
}

It doesn't really matter that much for this example I suppose, but I can see myself getting into trouble later on.
Thanks in advance.

sentences:
changing a sprite width when playing a reel using Crafty.js can anyone help me with this : http://jsfiddle.net/B5UsC/20/

you can see that the sprite animation is not rendering correctly when the reel is in the last frame when animating Hardpunch is it possible to change the character width when playing a specific frame ? like you see my spritesheet does not contain a static width and height so it's a bit confusing for me

THE CODE :

// initialize the sprite
Crafty.sprite("http://i.imgur.com/bkYVEe5.png", {
    Ryu: [0, 0, plrw, plrh]
});

// initialize the component
Crafty.c("RyuAnimation", {
    init: function () {
        this.requires("SpriteAnimation,Keyboard")
        .addComponent("Ryu")
        .reel('idle', 300, [
            [0, 0],
            [plrw * 1, 0],
            [plrw * 2, 0],
            [plrw * 3, 0]
        ])
        .reel('punch', 300, [
            [plrw + 12, plrh],
            [plrw * 2 + 15, plrh]
        ])
        .reel('Hardpunch', 300, [
            [plrw * 3 - 25, plrh],
            [plrw * 4 + 32, plrh],
            [(plrw + 19) * 5 - 38, plrh]
        ]); //
        this.animate("idle", -1);

    }

    // creating the player
    plr1 = Crafty.e("2D,Canvas,RyuAnimation")
    .attr({
    x: 15,
    y: ch - 100
})
.start(3);
this.bind('KeyDown', function () {
    if (this.isDown('A')) {
        if (!this.isPlaying("Hardpunch")) {
            this.pauseAnimation().animate("Hardpunch", 1);
        }
    } else {
        this.stop();
    }

});

I read about handling complex sprite sheet with different width and height and all the answers was about creating evenly sized boxes for all sprites like this example here : How do I support animation with frames of different sizes?  but i actually couldn't understand what the mean by that and how would i do it they didn't provide an example . what is evenly sized boxes?

sentences:
Doing a passable 4X game AI I am coding a rather "simple" 4X game (if a 4X game can be simple). It's indie in scope, and I am wondering if there's anyway to come up with a passable AI without having me spending months coding on it.

The game has three major decision making portions; spending of production points, spending of movement points and spending of tech points (basically there are 3 different 'currency', currency unspent at end of turn is not saved)

Spend Production Points

Upgrade a planet (increase its tech and production)
Build ships (3 types)

Move ships from planets to planets (costing Movement Points)

Move to attack
Move to fortify

Research Tech (can partially research a tech i.e, as in Master of Orion)

The plan for me right now is a brute force approach. There are basically 4 broad options for the player -

Upgrade planet(s) to its his production and tech output
Conquer as many planets as possible
Secure as many planets as possible
Get to a certain tech as soon as possible

For each decision, I will iterate through the possible options and come up with a score; and then the AI will choose the decision with the highest score. Right now I have no idea how to 'mix decisions'. That is, for example, the AI wishes to upgrade and conquer planets at the same time. I suppose I can have another logic which do a brute force optimization on a combination of those 4 decisions....

At least, that's my plan if I can't think of anything better. Is there any faster way to make a passable AI? I don't need a very good one, to rival Deep Blue or such, just something that has the illusion of intelligence.

This is my first time doing an AI on this scale, so I dare not try something too grand too. So far I have experiences with FSM, DFS, BFS and A*

sentences:
Linking one uniform variable to many shaders Let's say, that I have 3 programs, and in each of those programs there is a view matrix uniform, which should be the same in all those programs.

Right now, when my camera moves, I need to re-upload the modified matrix to every program separately. Is it possible to create some kind of global uniforms which are constant for all programs linked to it, so I could just upload the matrix once?

I tried creating a globalUniforms object which looked kinda like this:

var globalUniforms = {
    program: {},
    // (...)
    vMatrixUniform: null,
    // (...)
    initialize: function() {
        vMatrixUniform = gl.getUniformLocation(this.program, 'uVMatrix');
    }
};

So I could just link it to proper programs like this: program.vMatrixUniform = globalUniforms.vMatrixUniform;, and then pass the matrix like this:

if (camera.isDirty.viewMatrix !== false) { camera.isDirty.viewMatrix = false;
    gl.uniformMatrix4fv(globalUniforms.vMatrixUniform, false, camera.viewMatrix.element);
}

but unfortunately it throws an error:

  Uncaught exception: gl.INVALID_VALUE was caused by call to:
  getUniformLocation called from line 272, column 2 in () in mysite/js/mesh.js:
      vMatrixUniform = gl.getUniformLocation(this.program, 'uVMatrix');

Summing up: is there a more efficient way of managing shaders which follows my logic?

sentences:
Enconding/Decoding bit value in Texture Alpha Channel I am Rendering to a SurfaceFormat.Color. (R8G8B8A8)
The alpha of this format has 8 bits and I want to be able to use those 8 bits as a bit field.

For example, in one pass of my render, I want to save a bit value like 1 or 4  passing => 00000001 = 1 or 00000010 = 4 ....

The problem is that the output data of my pixel shader need to be in the range of [0 - 1].

How can I encode, for example, the value 00100001 = 33 in my surface.

I am doing this:

PixelShaderOutput PShader( PS_INPUT pin ) : COLOR0
{
    PixelShaderOutput output;
    ///bla bla bla
    output.color.a = 33 / 255;
    return output;
}

Is this the right way?

Will I be able to read it in the other side? I mean, in another shader, when I need to read this value, can I use float value = ReadTexture(...) * 255; where value will have 33? (or 00100001)

The GPU will make the right "convertion", cause 33 / 255 = 0,1294117647058824. Will it be encoded as 00100001 in the texture?

In this new shader I want to this value as a bitfield like:

bool xTextureRepeat = fmod(value , 64) >= 32;

sentences:
What design pattern would be most suitable for RPG skills? I'm developing a small Java digital card game project. In my game, players can perform skills when using cards. Each skill does different things, like deal damage, heal etc.. I'm looking for a way to program those skills into the game.

I saw an answer to a similar question online mentioning "Strategy Design", and thus I found out about the world of Design Patterns.

Because of the sheer amount of different design patters out there, I was hoping someone could recommend me an appropriate design pattern for achieving the above. Would Strategy Design suit my needs, or is there a better choice?

Thank you.

sentences: Any ad network for XNA games on the PC platform? There's a lot of press about the ad controls included on the new 7 phone, but I'm looking for candidates for the PC platform.

sentences: What to do with empty space? On the game I am developing, I have a very small amount of left-over space on each level screen (but on no other screens.) It is a little less than 5 millimeters (~1/5in) on the left side and bottom. It is caused by the size of blocks, etc. and a few other factors. I could center the level, but still then there would still be dead space. By the way, the player cannot go past the edge of the screen or into the whitespace, so having the level appear to extend past the screen would be misleading. What should I do?

sentences:
Performance cost of creating local variables just for 'readability'? I am learning C++ and Unreal Engine. I'm wondering if creating local variables inside functions purely to help me read the function later will cost my game/code in performance (assuming if I carry on this practise over hundreds/thousands of functions/variables).

Eg:

void APostie::MoveForward(float Value)
{
FVector Delta = GetActorForwardVector() * BaseWalkSpeed * Value * GetWorld()->GetDeltaSeconds();
FRotator NewRotation = GetActorRotation();
FHitResult Hit;
GetCharacterMovement()->SafeMoveUpdatedComponent(Delta, NewRotation, true, Hit);
}

Here the 'NewRotation' variable is completely useless. But I am intending to copy-paste this function and use it in similar input functions that will require the NewRotation to have a calculation on it.

So is it much better peformance-wise to have the function like this instead (again, imagine there are several hundred similar situations in a code solution)

void APostie::MoveForward(float Value)
{
FVector Delta = GetActorForwardVector() * BaseWalkSpeed * Value * GetWorld()->GetDeltaSeconds();
FHitResult Hit;
GetCharacterMovement()->SafeMoveUpdatedComponent(Delta, GetActorRotation(), true, Hit);
}

As you see in the second version the Rotation is set directly. Does this make any difference to game performance (including Networked games) ? Thanks

sentences:
Slerp to slerp smoothing p0 ------- p1 ------- p2

I am successfully slerping between 2 points (p0-p1; p1-p2). But the transition between two slerped angles (p1_in-p1_out) do not match, and it looks jarring

Video of how it looks:

green squares are points, the position and angle between each are interpolated.

The issue is most visible at second 6.00

https://gfycat.com/unhealthygraveduckling

I tried hermite splines, although it reduces the effect, it's still visible.

I tried converting Catmull-Rom to use with quaternions by just adding the 4th index to the vector functions. This works perfectly except on some occasions, where some are interpolated from the wrong (long) "way", causing the view to flip between those points. I tried aligning, did not help.

Other questions on SO related to slerp don't ask this question, and I could not get any usable answers from some questions on 4 point slerps.

Is this a common issue, am I overseeing something?

Thanks

sentences:
Good game engine to fork? I am a student C++ developer, and while I like game development, I don't like making games. Instead, I like developing the "tech" behind the games, like game engines, tools etc. The reason for this is because it enables me to code without having to worry about creating art resources, sounds, storylines, etc.

I started working on a game engine, but I am having a hard time starting from scratch. I would much rather be given a template to work off of and modify/add as I go. What are some good open source game engine I can fork?

I would rather fork an engine, as I truly want to make it my own, but I need a base to start from.

Please let me know.

Thanks

sentences:
How do you manage versioning across platforms in Unity? I'm just beginning to look into versioning games in Unity and noticed that Unity seems to offer different things depending on the platform you are building for. For instance, Android and iOS seem to have their own individual properties for versioning while Desktop has no versioning functionality at all out of the box.

Since I'm working on a game that has builds for PC, Mac, Android, and iOS, I need to determine how we want to manage version numbers within our game without having to manually manage individual version for each platform. How do you solve this?

sentences:
Speeding up map rendering My map loading and rendering process is slow when using very large maps, so I'm looking for ways to make it more efficient.
My current solution works like this:

My map loader uses for loops for loading text based files and reading the map.

It parses the objects in the map and converts them to an array

The map is a text file that stores game map contents as a list of object information.

The input data looks like (x,y,z),material,blocktype (x,y,z),material,blocktype...
Scale does not need stored in the file because it's not implemented .

My rendering for loop traverses the array with a for loop

It checks if the entry in the array contains a pyramid

If so, then it calls the pyramid object's rendering method, taking other
parameters

The issue is simply slow rendering due this for loop in my OpenGL rendering code used for calling objects by checking values on arrays. It becomes slow with big objects. How can I make this faster?
I use different map loaders one for networking (receiving  player object sending info). Here's one for loading maps:
      void MapLoad(string filelocation)
      {

            string[] map_;

            string line = File.ReadAllText(filelocation);//
            map_ = line.Split(new char[] { ',', ';', '(', ')' }, StringSplitOptions.RemoveEmptyEntries);

            for (int xj = 0; xj < map_.Length; xj += 5)
            {
                // Here xj is an index of a X coordinate, xj + 1 is an index of a Y coordinate, xj + 2 is an index of a Z coordinate

    //object for storing the data
                    Block_ chunk_block = new Block_();
    //coordinates set
                    chunk_block.set_v1(new Vector3(Int32.Parse(map_[xj]), Int32.Parse(map_[xj + 1]), Int32.Parse(map_[xj + 2])));
    //material set
                    chunk_block.set_v1_material(Int32.Parse(map_[xj + 3]));//1
    //block type set
                    chunk_block.set_v1_blocktype(Int32.Parse(map_[xj + 4]));
                    chunk_block.set_v1_scale(new Vector3(1, 1, 1));
                    stuff__.block_file.Add(chunk_block);
                    stuff__.collision.Add(chunk_block.get_v1());

            }

        }

    //version for position
    void MapLoad(string filelocation,Vector3 position)
    {

            string[] map_;

            string line = File.ReadAllText(filelocation);//
            map_ = line.Split(new char[] { ',', ';', '(', ')' }, StringSplitOptions.RemoveEmptyEntries);

            for (int xj = 0; xj < map_.Length; xj += 5)
            {
                // Here xj is an index of a X coordinate, xj + 1 is an index of a Y coordinate, xj + 2 is an index of a Z coordinate

                Block_ chunk_block = new Block_();
    //position
                chunk_block.set_v1(new Vector3(Int32.Parse(map_[xj])+position.X, Int32.Parse(map_[xj + 1]) + position.Y, Int32.Parse(map_[xj + 2]) + position.Z));
    //mat
                chunk_block.set_v1_material(Int32.Parse(map_[xj + 3]));//1
    //blocktype
                chunk_block.set_v1_blocktype(Int32.Parse(map_[xj + 4]));
                chunk_block.set_v1_scale(new Vector3(1, 1, 1));
                stuff__.block_file.Add(chunk_block);
                stuff__.collision.Add(new Vector3(chunk_block.get_v1().X, chunk_block.get_v1().Y+1, chunk_block.get_v1().Z));

            }

        }

And here is my rendering loop:
for (int i = 0; i < stuff__.block_file.Count; i++)
{
        //block data given to block model object that takes material for textures etc but thats not about problem
        block(new Vector3(stuff__.block_file[i].get_v1().X, stuff__.block_file[i].get_v1().Y-2 + walking__, stuff__.block_file[i].get_v1().Z), stuff__.block_file[i], BeginMode.Quads, stuff__.block_file[i].get_v1_scale());
}

sentences:
In platformer games, what are "hole in the ground" obstacles called? In most jump and run games, holes in the ground are common obstacles: You need to jump over them, or you'll fall down and lose a life.

It would be helpful to know for documentation, variable naming and discussion: What are those holes called?

sentences:
How do I create a bounding frustum from a view & projection matrix? Given a left-handed Projection matrix, a left-handed View matrix, a ViewProj matrix of View * Projection - How do I create a bounding Frustum comprised of near, far, left, right and top, bottom planes?

The only example I could find on Google (Tutorial 16: Frustum Culling) seems to not work; for example, if the math is used as given, the near-plane's distance is a negative. This places the near-plane behind the camera...

sentences:
Object Transparency Dithering (as shown in Super Mario Odyssey) A couple games I've been playing recently all have a similar goal of dithering objects when they approach the near clip plane.  Super Mario Odyssey applies this dithering-near-clip-plane effect, but along with object intersection dithering for objects like Mario.  I have an example of this dithering in Super Mario Odyssey later in this post.

How would one go about creating this effect in their graphics solution of choice?

The gifs might take a little while to get started.  I couldn't get them to each be under 30 mb :(

Example in Super Mario Odyssey

The balloon of the Odyssey doesn't "exit dithering" until the camera is a good distance away from it.  This could mean dithering is calculated based on object distance from camera, instead surface distance.

Flag starts out with a small dither density, and Mario has no dithering applied to him.  Once the flag is fully opaque, Mario becomes dithered, but only in the portions that is covered.  Also note Mario's coat tail has the "transparency dithering" applied to it.  How are the object's shaders structured to allow this compound effect?

Below is a blown up image of Mario being dithered.  Notice how dithering exists in intersection regions, and when behind objects!

sentences:
OpenGL interleaved position and normal data I have an OpenGL question!

Say I have data, interleaved in the format

[vec3 normal, vec3 vert1, vec3 vert2, vec3 vert3]

all stored in one VBO (one set per triangle).
My vertex shader would have the following attributes:

in vec3 normal;
in vec3 position;

Is it possible to extract the data this way? Or would I need to duplicate the normal for each vertex (eg. [vec3 normal, vec3 vert1, vec3 normal, vec3 vert2, vec3 normal, vec3 vert3])?

sentences:
How to inform pathfinding of solid objects blocking path? I'm sure this has been asked before, but I couldn't find the thread. Let me know if you can locate the duplicate.
So, I have a my level is an array of tiles, where a tile can either be solid or walkable. I then use A-star to path-find my enemies from one location of the floor to another.
The issue is that I also have solid entities. As an example, I may spawn 3 breakable vases at a certain location. They can be larger or smaller than a single tile, and they are just objects in the world, not tiles themselves.
Because they are not a part of the A-star grid (can they? they're larger or smaller than a tile, and their position is not locked to the grid), the path-finding is not aware of their existence, since it only operates on its grid. As a result, sometimes the chosen path for the enemy to follow flows through the solid vases, so the enemy just gets stuck at that location.
Is there a solution that alleviates this problem? I want the enemies to path around the vases (until they're destroyed, of course), instead of just getting stuck trying to unsuccessfully move through them.

sentences:
Android Jump&Run - Random map generation I'm pretty new to game development but I work on an android app.
It's a 2D Jump and Run game.

I do it in Eclipse and the map is readed out of a txt file right now.
But I want to do a Jump and run game, where the player must jump over holes in the ground.
Theses holes should be created randomly. So I want an infinite map, which is created randomly.
Can somebody give me tips how to begin with this? How can I do a randomly generated map?
I don't want the full code or something else, just a little tip how to start because I don't know how I can do this randomly generating.

Thanks in advance! Hope u know, what I mean!

sentences:
How to iterate over 25 Sprite Objects (Unity 5 - C#) I wanna show a minimap on the screen. The minimap would look like this (bottom right corner, this was done time ago in Visual Studio):

Have two problems with that, I have 25 Image objects created in the scene and 25 in the playercontroller script:

public Image minimap0, minimap1, minimap2, minimap3, ... , minimap24;

but I can't make to change its sprite, and also, I don't know how to change all 25 objects sprite with a "for" loop (the foor will look like this http://imgur.com/qfi1Ht1 ).

The map is stored in an array for checking positions.

sentences:
Projective texture and deferred lighting In my previous question, I asked whether it is possible to do projective texturing with deferred lighting. Now (more than half a year later) I have a problem with my implementation of the same thing. I am trying to apply this technique in light pass. (my projector doesn't affect albedo). I have this projector View a Projection matrix:

Matrix projection = Matrix.CreateOrthographicOffCenter(-halfWidth * Scale, halfWidth * Scale, -halfHeight * Scale, halfHeight * Scale, 1, 100000);
Matrix view       = Matrix.CreateLookAt(Position, Target, Vector3.Up);

Where halfWidth and halfHeight is are half of the texture's width and height, Position is the Projector's position and target is the projector's target. This seems to be ok. I am drawing full screen quad with this shader:

float4x4 InvViewProjection;

texture2D DepthTexture;
texture2D NormalTexture;
texture2D ProjectorTexture;

float4x4 ProjectorViewProjection;

sampler2D depthSampler = sampler_state {
    texture = <DepthTexture>;
    minfilter = point;
    magfilter = point;
    mipfilter = point;
};

sampler2D normalSampler = sampler_state {
    texture = <NormalTexture>;
    minfilter = point;
    magfilter = point;
    mipfilter = point;
};

sampler2D projectorSampler = sampler_state {
    texture = <ProjectorTexture>;
    AddressU  = Clamp;
    AddressV  = Clamp;
};

float viewportWidth;
float viewportHeight;

// Calculate the 2D screen position of a 3D position
float2 postProjToScreen(float4 position) {
    float2 screenPos = position.xy / position.w;
    return 0.5f * (float2(screenPos.x, -screenPos.y) + 1);
}

// Calculate the size of one half of a pixel, to convert
// between texels and pixels
float2 halfPixel() {
    return 0.5f / float2(viewportWidth, viewportHeight);
}

struct VertexShaderInput {
    float4 Position : POSITION0;
};

struct VertexShaderOutput {
    float4 Position :POSITION0;
    float4 PositionCopy : TEXCOORD1;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input) {
    VertexShaderOutput output;
    output.Position = input.Position;
    output.PositionCopy=output.Position;
    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 {
    float2 texCoord =postProjToScreen(input.PositionCopy) + halfPixel();

    // Extract the depth for this pixel from the depth map
    float4 depth = tex2D(depthSampler, texCoord);
    //return float4(depth.r,0,0,1);
    // Recreate the position with the UV coordinates and depth value
    float4 position;
    position.x = texCoord.x * 2 - 1;
    position.y = (1 - texCoord.y) * 2 - 1;
    position.z = depth.r;
    position.w = 1.0f;

    // Transform position from screen space to world space
    position = mul(position, InvViewProjection);
    position.xyz /= position.w;
    //compute projection
    float3 projection=tex2D(projectorSampler,postProjToScreen(mul(position,ProjectorViewProjection)) + halfPixel());
    return float4(projection,1);
}

In first part of pixel shader is recovered position from G-buffer (this code I am using in other shaders without any problem) and then is tranformed to projector viewprojection space. Problem is that projection doesn't appear. Here is an image of my situation:

The green lines are the rendered projector frustum. Where is my mistake hidden? I am using XNA 4. Thanks for advice and sorry for my English.

EDIT:

Shader above is working but projection was too small. When I changed the Scale property to a large value (e.g. 100), the projection appears. But when the camera moves toward the projection, the projection expands, as can bee seen on this YouTube video.

sentences:
How do I ensure an appropriate payout ratio for a slot machine? I have done a lot of research into random number generators for slot machines, reel stop calculations and how to physically give the user a good chance on winning.

What I can't figure out is how to properly insure that the machine is going to have a payout rating of (lets say) 95%.

So, I have a reel set up wit 22 spaces on it.  Filled with 16 different symbols.

When I get my random number, mod divide it by 64 and get the remainder, I hop over to a loop up table to see how the virtual stop relates to the reel position.

Now that I have how the reels are going to stop, do I make sure the payout ratio is correct?  For every dollar they put in, how to I make sure the machine will pay out .95 cents?

Thanks for the ideas.

I am working in actionscript, if that helps with the language issues, but in general I am just looking for theory.

Edit: There is real money involved only in the fact that they can buy more tokens to play more.  There is not going to be real money paid out to the person, if they were to actually hit the any of the paylines.

sentences:
Does it make sense to use Lua scripting in a game developed in Python? Well for C++ written games using Lua scripts for easy changing ai, quets etc is very reasonable and it's common. However now I'm going to write a game in pure python and I don't know if I should use Lua. Python itself is very high level script language. However, there are things to consider why I could use lua scripts:

Lua is commonly used for game scripting and other people who will work with me know Lua and don't know python
Python module to embed lua code into python uses very fast JIT compiler so the lua code actually would be much faster than python code (big plus for AI)
It would separate the game engine itself (Python) from the scripted logic (Lua)

Do python games use Lua? Is it a resonable thing or I should just stick to pure python? I need some advice because I have no idea.

sentences:
What do colleges such as Rocky Mountain College of Art and Design look for in a portfolio? I really want to get into Rocky Mountain College of Art and Design (RMCAD), but I don't know if my skills are up to par. A representative came down today and she told me the requirements for the Game Art degree. Turns out I don't need a portfolio, but I know it would definitely help me out with scholarships, acknowledgement of skill and so on. I want one for myself anyway.

I have a few 'good' sketches and some other 'eh' sketches I don't think are anywhere near my best. I have some life drawings I've been working on as well. To improve my skill I decided to start over and I'm currently learning the human anatomy to draw better skeletons for my characters and such.

I want to be a concept artist with characters and levels/buildings, but... I'm not the best at levels or buildings since I've never really drawn them before. My characters aren't the best, but I am improving. if anyone could help me, I'd greatly appreciate knowing what I should put in my portfolio, how to prepare for college, and etc.

Note: The college is an actual college which is a plus because I can learn my major (game art) plus a minor like business or something else. Maybe architecture...

sentences:
OpenGL - Arcball camera rotation I'm implementing arcball camera rotation, whereby a camera is looking at a coordinate and rotates around it in the x-axis or the y-axis such that the camera is circulating around it; the y-axis will be capped to prevent flipping.

Suffice it to say it's not producing the output I want as it isn't rotating around the target. I'm not sure where the problem may lie, though my code:

void Camera::rotate(float x, float y)
{
    x *= pMouseSensitivity;
    y *= pMouseSensitivity;

    pYaw += x;
    pPitch += y;

    if (pPitch > 89.0f)
        pPitch = 89.0f;
    if (pPitch < -89.0f)
        pPitch = -89.0f;

    pPosition = glm::rotate(pPosition, -x, pUp);
    pPosition = glm::rotate(pPosition, -y, pRight);
}

The rotate function takes in x and y from where the mouse position is at. These values are then added to yaw and pitch respectively before the position of the camera is rotated based on the x and y. I update the camera as follows:

void Camera::update()
{
    pForward = pPosition - pTarget;
    pRight = glm::normalize(glm::cross(pForward, pWorldUp));
    pUp = glm::normalize(glm::cross(pForward, pRight));

    pViewMat = glm::lookAt(pPosition, pTarget, pUp);
    pProjMat = glm::perspective(pFieldView, pAspectRatio, pNearPlane, pFarPlane);
}

The world up vector is always vec3(0, 1, 0) and is unchanged throughout, for resetting the camera. I set the target of the camera with:

void Camera::orbitAround(glm::vec3 focus)
{
    pTarget = focus;
}

This function would then take in an arbitrary point or even the position of a 3D rendered model. I have been looking at a few tutorials regarding arcball rotation, and from what I can understand it involves pTarget being what's looked at, and the rotation revolving around it. What does strike me is that I'm not using pitch and yaw, so will have to look into what I should be doing with them. Producing the arcball rotation is what confuses me, and I require some help on it. Pseudocode would be great!

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:
Matrix transforms with SpriteBatch overloading - how do you rotate/zoom around a point? I have a transform matrix which works as intended for game objects I want to be completely controlled by my camera:

_transform = Matrix.Identity *
    Matrix.CreateTranslation(-_position.X, -_position.Y, 0) *
    Matrix.CreateRotationZ(_rotation) *
    Matrix.CreateTranslation(origin.X, origin.Y, 0) *
    Matrix.CreateScale(new Vector3(_zoom, _zoom, _zoom));

I expose this to my drawing and use the following SpriteBatch.Begin() overload:

sb.Begin(SpriteSortMode.Deferred,
    BlendState.AlphaBlend,
    SamplerState.PointClamp,
    DepthStencilState.None,
    RasterizerState.CullCounterClockwise,
    null,
    view.Transform);

This works as expected. No problems.

However, I have an object which controls it's own translation as it's a fake star field. I didn't want to have to generate potentially millions of stars to be drawn in order for it to be translated about, so the star field just loops them back to the opposite side if they past the edge of the screen. Zoom just acts really bizarrely. It's not being zoomed into the middle of the screen like it should. At some high zoom value it just swipes off the screen. I initially was having an issue with the rotation but after reordering via trial and error I was able to use the correct sequence of transforms. Here's what I'm currently doing:

_transformNoTranslation = Matrix.Identity *
    Matrix.CreateTranslation(origin.X, origin.Y, 0) *
    Matrix.CreateRotationZ(_rotation) *
    Matrix.CreateScale(new Vector3(_zoom, _zoom, _zoom)) *
    Matrix.CreateTranslation(-Origin.X, -Origin.Y, 0);

And here's what it looks like:

http://www.youtube.com/watch?v=0lg-V36M7og

How do I get the zoom to work correctly?

As a side question, any ideas as to why the ship jutters at high speeds? I don't plan to ever be at those high speeds during game play so it's not a huge cause for concern. Some kind of precision error with the high translation values?

sentences:
Moving camera vertically only after player is too high or too low In my 2D platformer game, I find it very exhausting for the player if the camera follows the player all the time. So, I looked up for some tricks to make camera movement feel more natural.

The first trick is from James Doyle, where the camera follows a target instead of the player itself. Thus, I can safely use Mathf.Lerp for the target, and avoid having jitters.

The second thing I want to do is to limit the vertical movement of the camera. That is, I don't want the camera to move up and down whenever the player jumps. It is dizzying.
Instead, I want camera to follow the player only if player is vertically too high or too low.

Here is roughly what I do:

\\PlayerController.cs

    public Transform cameraTarget;
    private void FixedUpdate()
    {
       if(Mathf.Abs(transform.position.y - cameraTarget.position.y) > verticalLimit )
         cameraTarget.position = new Vector3(cameraTarget.position.x, Mathf.Lerp(cameraTarget.position.y, transform.position.y, Time.fixedDeltaTime), cameraTarget.position.z);
        if (Input.GetAxisRaw("Horizontal") != 0)
        {
            cameraTarget.localPosition = new Vector3(Mathf.Lerp(cameraTarget.localPosition.x, Input.GetAxisRaw("Horizontal")* cameraAheadAmount, 0.8f * Time.fixedDeltaTime), cameraTarget.localPosition.y, cameraTarget.localPosition.z);
        }

    }

The problem for this approach is that whenever the vertical distance between the player and the camera target is less than the limit, the camera does not follow the player anymore.
So, what I get is basically a camera following the player from down below, again, all the times.

I thought of using a boolean flag to tell the camera follow the player when vertical limit is exceeded, but then when do I set and unset the flag?

I am new to Unity's Update() and FixedUpdate() logic, so I cannot somehow design a workaround. Is there a simple way to do this?

sentences:
How is ball_pos calculated I'm new to game development and I'm trying to build my first Pong game on the Godot engine. the tutorial I'm following is given below.

Simple Pong Game

What I don't understand is the line:

ball_pos += direction * ball_speed * delta

How is the new ball position being calculated?

As far as I know, delta is the time elapsed in seconds (float) since the last _process() call.

Also, why is the direction vector set to (1.0, 0.0)?

I'm looking for a clear explanation since the tutorial doesn't explain much. Thank you.

sentences:
HTLM5 canvas game (easeljs) slow peformance on ipad (ios7) with phonegap I have developed a game with easeljs for HTML5 Canvas. the game is a single HTML5 page with canvas and a lot of javascript.

All this time I tested the app on iOS Safari (iPad3 iOS7) with 40~50 fps via a local server. when I packed in a xcode app with phonegap, it becomes incredible slow near to 10fps.. I noticed the same behaviour when I added the page to homescreen.

There is any way to make make a good performance with html5 canvas app games for ipad (iOS7)?

sentences:
How can I rotate RigidBody and not violate physics? I'm trying to create a game that we have a falling ball and an spinning object that spin based on user mouse position. user should rotate the object and hit the ball on time to throw the ball into sky.
The problem is that if user move his finger too fast. the game object moves too fast and goes past through the ball. This is my code so far:

 void Update () {
         if (Input.GetMouseButtonDown(0)) {
             startPos = Input.mousePosition.x;
             startRot = obj.transform.localEulerAngles;
             lastDist = 0;
         }

         if (Input.GetMouseButton(0)) {
             float dist = Input.mousePosition.x - startPos;

             obj.MoveRotation(Quaternion.Euler(startRot + new Vector3(0, 0, -dist)));

             for (int i = 0; i < obj.transform.childCount; i++)
                 obj.transform.GetChild(i).GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(startRot + new Vector3(0, 0, -dist)));
         }
 }

How can I achieve this behavior for my game. The user should be able to spin the game object as fast as possible.

Thanks in advance.

sentences: How do you unzip a Texture2D from image or string from txt from a zip file using SharpZipLib How do you unzip a Texture2D from image or string from a txt file - contained in a zip file - using SharpZipLib or System.IO.Compression?

sentences:
Wrong distance in Depth-buffer I am currently trying to get the Depth Buffer as a texture to use it for edge detection algorithms. Since XNA4 does not allow direct access to the Depth Buffer as texture i have to render it into a texture. The effect i currently use looks like this:

float4x4 World;
float4x4 View;
float4x4 Projection;

struct DEPTH_VS_OUTPUT
{
    float4 Position : POSITION;
    float2 Depth : TEXCOORD;
};

DEPTH_VS_OUTPUT DepthTextureVS(float4 Position : POSITION)
{
    DEPTH_VS_OUTPUT output;

    float4 worldPosition = mul(Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);
    output.Depth = output.Position.zw;

    return output;
}

float4 DepthTexturePS(DEPTH_VS_OUTPUT input) : COLOR0
{
    float4 result;
    result.rgb = input.Depth.x / input.Depth.y;
    result.a = 1.0;
    return result;
}

technique DepthTextureRender
{
    pass P0
    {
        CullMode = NONE;
        ZEnable = TRUE;
        ZWriteEnable = TRUE;
        AlphaBlendEnable = FALSE;

        VertexShader = compile vs_2_0 DepthTextureVS();
        PixelShader = compile ps_2_0 DepthTexturePS();
    }
}

It looks like this:

The cubes in this scene are 1x1x1 the projection matrix is made like this:

var projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 16f / 9f, 0.1f, 1000f);

As far as I understood the Depth Buffer concept z/w should give me the distance from the camera position to the pixel as value between 0-1 where 0 would be the Near-plane and 1 the Far-plane but since the cubes in this scene are only about 5 Units away they shouldn't be  white.

sentences:
Optimizing falling sand simulation So, for the past couple of weeks, I've been working on a falling sand simulation inspired by games such as The Powder Toy, Noita, and Sandspiel. I've been making it in Love2D and I'm please with what I got so far. The simulation can handle 59k particles at 60FPS however pretty much anything over that amount will cause the FPS to plummet so I've been thinking of other ways to optimize it.

The way my simulation works is that I have a large table that contains numbers. These numbers refer to an index inside a table which contains particle data. The particle data is structured as:

Name, Color(table containing 4 values, r,g,b,a), Update logic function, Color variation modifier (0 = no color variation between particles)

I've got the options for optimization narrowed down to a pretty small list:

Spatialhashing/Quadtree - splitting the screen into a grid and only updating cells with particles in it
GPU simulation - Moving simulation logic to the GPU
Multithreading - Moving simulation logic to separate CPU threads

The downsides of all of these are as follow:

Spatialhashing/Quadtree - There are no unique identifiers for the particles themselves as they're only stored in the table as the index for their data so it's hard to have a reference that can be added/removed when needed
GPU simulation - I'm not good with shader code and there are no good ways to do GPU code in Love2D that's purely computational.
Multithreading - Similar to GPU simulation, I'm not knowledgable when it comes to multithreading nor do I have any idea of how to parallelize my simulation code.

Some information about how to multithread a falling sand physics simulation comes from the devs of Noita, where they split the world into chunks and updated each on a different thread in a checkerboard pattern (to make ensure that pixels weren't being updated by multiple threads at the same time). They also had 'dirty rects' which showed which particles needed updating which is similar to spatial hashing.

However, the talk the noita dev did just showed what they did, rather than how they did it. Since I lack a lot of knowledge in these fields, I don't really have much to go on for implementing them.

My code is open source and viewable on github. You'll need the latest version of Love2D to run it:

https://github.com/BradBath/Sand (either drag the Sand-master folder on the love2D executable or open the folder in VSCode and use the Love2D plugin to run it via LALT+L)

If anyone has any ideas I could implement some of these optimizations, or has any other ideas for optimization, I'd love to hear them. Thanks!

Here's a gif of my simulation at its current point

sentences:
How is the "continues road" from 80's games called and done? i like to test the "continues road" effect from 80's racing games . i call it like this i have no idea how it really called
the effect that a car is in front of you , and the road is Approaching to you ,
some thing that can seen in games like :
http://www.myabandonware.com/game/turbo-1ti
http://www.myabandonware.com/game/angel-nieto-pole-500-sp-2le

where i can find example of implementing such alurithem ? c++ is prefered but dosn't have to be c++ .
Thanks !

sentences:
"SetSelectedGameobject" only highlights button on second try (Unity 2017.3) To support the use of a gamepad in the options menu I set SetSelectedGameObject and firstSelectedGameObject (which doesn't seem to do anything) to the button in the upper left, so it's highlighted. This works fine in my pause and option menus (panels that are enabled/disabled) but there's also a third panel that displays the controls as an image. On this screen the first button is set as selected but it doesn't get highlighted until I go back to the pause menu and then open the "controls" screen again.

The Hierarchy:

The ControlsPanel looks like this: click

All 4 buttons are set to "automatic" and they're all accessible to the gamepad but, like I said, the first one ("Keyboard") doesn't light up the very first time I access the panel. It should be like this:

Click on "Controls" in the pause menu
ControlsPanel is enabled
"Keyboard" button is highlighted
Pressing right on the gamepad highlights the next button ("Controller")

What actually happens:

Click on "Controls" in the pause menu
ControlsPanel is enabled
"Keyboard" button is still grey
Pressing right on the gamepad highlights the next button ("Controller")
Press the "Back" button ("ControlsPanel" is disabled and "PausePanel" enabled)
Click on "Controls" again
This time the "Keyboard" button is highlighted

The "ControlsPanel" script:

public Image pic;
public GameObject controllerChoicePanel;
public GameObject firstControls;
private String controls;
private bool windows;

void Start() {
    controls = GetControls();
    windows = GetOS();
    pic.sprite = Resources.Load<Sprite>(controls);

    if(windows) {
        controllerChoicePanel.SetActive(true);
        EventSystem es = EventSystem.current;
        es.firstSelectedGameObject = firstControls;
        es.SetSelectedGameObject(firstControls);
    }
}

Any idea why it would work fine in my pause/options menu but not in the "Controls" one, even though I'm doing the same thing?

sentences:
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:
Trying to implement bounding box collision I've been trying to do collision detection using the Intersects() function with two rectangles.

I've got a player and multiple enemy's. When the player intersects with an enemy a bool var is set to true and the enemy is removed, the next time the player intersects with an enemy I wan't some thing else to happen.

Here is the code:

private void HandleCollision()
        {
            bool hasBlock = false;

            List<int> bulletsToRemove = new List<int> ();
            List<int> enemysToRemove = new List<int> ();

            for (int i = 0; i < Enemys.Count; i++)
            {
                if ( hasBlock == false && Enemys [i].EnemyBounds.Intersects (Player.PlayerBounds))
                {
                    enemysToRemove.Add (i);
                    Bullets.Add (new BulletEntity(EnemyBox, Player.Position));
                    hasBlock = true;
                    Console.WriteLine ("has block == false");
                }
                else if ( hasBlock == true && Enemys [i].EnemyBounds.Intersects (Player.PlayerBounds))
                {
                    Console.WriteLine ("has block == true");
                }
            }

            for (int i = 0; i < bulletsToRemove.Count; ++i)
            {
                Bullets.RemoveAt (bulletsToRemove[i]);
                i++;
            }
            for (int i = 0; i < enemysToRemove.Count; i++)
            {
                Enemys.RemoveAt (enemysToRemove [i]);
                i++;
            }
        }

My problem is  the every time the player intersects with the enemy the code after "if ( hasBlock == false && Enemys [i].EnemyBounds.Intersects (Player.PlayerBounds))" get executed. I can't for the life of me figure out what I am doing wrong. I would love some help.

In my mind when hasBlock is set to false the next enemy should pass through the player and not be removed.

sentences:
How to model interentity membership in entity-component architecture? I'm falling in love with simple grace of entity-component design, although I still have issues breaking from MVC and OOP practices. Some of my game entities have membership relationships with each other (ex: a player is a member of a city, a city is a member of a nation), and I am unsure on the best way to implement it.

My initial reaction is to have a a MemberOfCity component that points to the appropriate city component, but components are suppose to have no references to each other. My other option is to have a System do it, but that would require the system to persist data outside of a component.

Is there a clean way to do this in an entity-component design, or am I trying to use a hammer on a screw and should use a hybrid/another approach?

sentences: How can I spawn objects in a volume without intersection? I am generating a 3D scene that involves spawning lots of 3D objects in a finite volume. I need to avoid intersection of objects.

sentences:
pixel art game looks like it is lagging As you can see from the title, I'm working on a game using pixel art. To archive that, I create a 160x90 texture, draw everything onto that and scale it up.
But the player in this game only moves about 10 pixels per second in some places. Luckily, the position isn't stored in pixels, but as a float, so the player can also be at (10.234, 3.76543). Because the map is big, the player is always centered on the screen and the world moves, instead. But as of my current implementation, I round the player's position to whole pixels in each update call. Otherwise, the engine would place all the world's sprites between the pyhsical pixels and they would be interpolated and look very unsharp and not very pixel-artish.

And there comes the problem: because the player moves just 10px/sec, the world only moves on the screen every 1/10 second. And that, of course looks like the game was running at 10 fps (it actually runs at 60fps).

So what is the recommended approach for that? Should I stick to what I current have got or should I let the graphic card do what it wants to do and let it interpolate the pixels and simply ignore the blurry effect.

PS: I know this question is similar but the difference is that in his case, he wants to avoid this staircase effect, while in my case, I want to avoid the lag

sentences:
Is wireframe effect possible without geometry shader? I am trying to write a shader that highlight the edge between each pair of vertices, much like the UCLA Wireframe Shader.

All implementations I came across require geometry shader support. I am wondering if this is possible with just vertex and fragment shaders?

(Of course, I can use texture to workaround it; but I am trying to avoid create custom textures for each model that I need this effect. On the other hand, I could just use geometry shader but it presents quite a problem when porting to iOS, which lacks support.)

sentences:
How to make Snake Body in Snake Game? I'm new in cocos2d and game dev. I'm still learning in game dev. My goal is to make one game like Doodle Grub. But problem is snake body. I wrote like following

-(void)update:(ccTime)delta
{
    //NSLog(@"%f",[GameScence sharedGameScence].playerVelocity.y);

    CGPoint tmp=self.position;
    float tmprotation;
    self.position=[GameScence sharedGameScence].WormHeadPos;

    [GameScence sharedGameScence].WormHeadPos=tmp;
    tmprotation=self.rotation;

    [self setRotation:[GameScence sharedGameScence].Headrotation];

    [GameScence sharedGameScence].Headrotation=tmprotation;

}

snake is moving but problem is all of the body segments are same position when snake stop. And all of the body segments is so close and can't see segments like Doodle Grub. Any idea or Any suggestion ?

sentences:
How to create normal map from bump map in runtime? I am using this port of libnoise to generate noise. There are several methods (Noise2D.cs, 462 and 494 line) to output images. Second one, that should give me normal map does not work completely, it outputs this with low intensity (1.0f)

And this with high intensity (>100);

So i decided to use grayscale and default Bumped Diffuse shader works good, but only in Editor.

How should i modify grayscale image for correct normal map? How should i use library in proper way?

sentences:
How to simulate timed attacks in browser-based games? In my MMORTS browser-based game, I want that all attacks be performed 7 minutes later after the player does it.

So, when the player clicks on attack button, a countdown becomes visible to both the attacker and the defender.

Showing countdown and handling its events isn't my question. In fact, my Q is how can I implement this countdown in server side and database.

I haven't any idea about managing this situation. Any helps is highly appreciated...

sentences:
Need simple 3D terrain render with big texture map I have a 1000 x 700 height map

I have a 1000 x 700 texture map

I did something very similar about 8 years ago:

Using XNA. Unfortunately, when I bring up this old project and convert it to Visual Studio 2010 it will no longer compile and just throws tons of errors.

I'm looking for something very simple. Is there a 3D terrain single texture XNA example floating around out there that I can convert? I haven't touched XNA since about 2009 or 2010 and none of my old code will run anymore (I have no idea what's going on).

I need to do a 3D terrain proof of concept where the terrain texture is stretched over the height map. Nothing fancy. Maybe XNA.

Any ideas?

sentences: Why BlackBoardValue Says Invalid And False? UnrealEngine4 Think my ai do not move towards the sound because of the blackboard keys , one says invalid and another says false , i think that is the reason.... Enemy Ai should move to the location where sound is heared , here is the photo of BehaviourTree. Look at those 2 keys named "InvestigatePosistion" and "HasHearNoise" its says False and Invalid. so how make them work?

sentences:
How can I use shaders to make a square have a waving effect? I'm new to using shaders to do some fancy effects and I'm struggling with them. I'm using DirectX 11 and HLSL. I have this square in the middle of the screen:

It's just a square that I've created using 4 vertices. I want to give it this waving effect on the sides, but I don't know how to do it.

This is for a little 2D game I'm making, so I have an orthogonal projection matrix which is the one I use. View matrix is set to identity.

DirectX::XMMATRIX view = DirectX::XMMatrixIdentity();
DirectX::XMMATRIX projection = DirectX::XMMatrixOrthographicOffCenterLH(0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f);

This is the constant buffer I set each frame, so I can pass a float time variable to the shader:

struct constant_buffer {
    DirectX::XMMATRIX  WVP;
    // this value starts in 0 and increases by 1 each frame until 359 degrees
    float time;
};

constant_buffer cbuffer;

The shader that I'm currently using is very simple, it just applies the matrix to each vertex to transform it.

struct in_pshader
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

cbuffer constant_buffer
{
    float4x4 WVP;
    float time;
};

in_pshader vshader(float4 position : POSITION, float4 color : COLOR)
{
    in_pshader output;

    output.position = mul(position, WVP);
    output.color = color;

    return output;
}

float4 pshader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
    return color;
}

I'm guessing there's some sine function involved around, so that's why I decided to pass angles per frame as input. I tried many combinations, but I'm such a newbie and can't get it right. :( Any help on this would be very appreciated.

sentences:
How to get the "(human) Face" position from Webcam Texture I am searching a way to recalculate the current Position of the Face in "Virtual World Position" From a Webcam Texture.
I was thinking about a way to solve this via taking the Average Pupillary distance (which is ~60mm).
And...
With this number I somehow need to get a actual position ... somehow... of the... Face...  (The Center)

I dont know how exactly though.
Any Ideas?

sentences:
How can I efficiently render a tile-based map with many Z-levels, where the levels act like hollowed out voxels? My map setup is a little different to what you normally have with tilemaps. The map itself is a rectangular prism, with a width, height, and depth being variable. In my case, width is the x-axis horizontally across the screen, height is the y-axis vertically across the screen; and depth is the z-level, or how "deep" the map goes into/out of the screen.
In my map; you could consider the rectangular prism as "solid". Many/most of these voxels could be considered as occluders to the voxels below them. Some voxels are hollowed out to make rooms and corridors.
The map is viewed at a specific z-level, from 0, the "bottom" of the rectangular prism, to n, the top.
A "hollowed out" voxel, if viewed from it's level, would result in me rendering a floor texture in that tile. If there were 4 voxels above it hollowed out, then that floor texture would be rendered when the map is viewed from each of these z-levels, but each z-level above the "floor" would have a semi-transparent black rect rendered on top of the tile (so it gets successively darker the further "up" you are).
This occurs until you're on a z-level above the tallest voxel that is hollowed out to make the room; at which point you can't see it any longer, because this non-hollowed out voxel blocks your view to the room below.
The problem I have is that there are many z-levels to render; and most of the hollowed out sections criss-cross around in the different layers to make a very complex network of little rooms and tunnels. This results in me naively rendering a floor texture, followed by several layers of semi-transparent black rects, followed by a fully-opaque black rect; and potentially repeated for any additional overlapping rooms; for every x,y tile on the screen.
I'm trying to wrap my head around a way to render this more efficiently but I'm having trouble. Currently, for every render loop, I'm attempting to step through the z-layers, from the current viewed z-level down to 0, and finding the z-level that is occluded first (or all the way to the 0 level), so that when rendering, I can skip z-layers for that tile that are below this value.
This isn't really giving me much of a performance increase.
I'm looking for ideas on how to better perform these series of draw calls. I'm using OpenGL3.3 directly, so I'm not restricted by any library or engine constraints. Currently, I'm rendering each "tile" on each layer seperately and would prefer to keep it that way for simplicity.

sentences:
Why do my obstacles float above the ground? Unity2D I'm making an infinite runner game and I'm trying to spawn obstacles, but all of them float far above the ground instead of being at the ground level.

This is the code on summoning the bears.

  PlatformGenerator Class

    if (Random.Range (0f, 100f) < randomEnemyThreshold)
        {
            GameObject newEnemy = enemyPool.GetPooledObject();

            Vector3 enemyPosition = new Vector3 (0f, 0f, 0f);

            newEnemy.transform.position = transform.position + enemyPosition;
            newEnemy.transform.rotation = transform.rotation;
            newEnemy.SetActive(true);
        }

Ask me more about the game if you need more information.

Edit:

Here is the whole class.

  The PlatformGenerator Class

using UnityEngine;
using System.Collections;

public class PlatformGenerator : MonoBehaviour {

public GameObject thePlatform;
public Transform generationPoint;
public float distanceBetween;

private float platformWidth;

public ObjectPooler theObjectPool;

public float randomEnemyThreshold;
public ObjectPooler enemyPool;

// Käytä alkuarvon alustamiseen
void Start () {
    platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x;

}

// Päivitys tulee joka ruutu
void Update () {

    if (transform.position.x < generationPoint.position.x)
    {
        transform.position = new Vector3 (transform.position.x + platformWidth + distanceBetween, transform.position.y, transform.position.z);

        //Instantiate (thePlatform, transform.position, transform.rotation);
        GameObject newPlatform = theObjectPool.GetPooledObject();

        newPlatform.transform.position = transform.position;
        newPlatform.transform.rotation = transform.rotation;
        newPlatform.SetActive (true);

        if (Random.Range (0f, 100f) < randomEnemyThreshold)
        {
            GameObject newEnemy = enemyPool.GetPooledObject();

            Vector3 enemyPosition = new Vector3 (0f, 0.5f, 0f);

            newEnemy.transform.position = transform.position + enemyPosition;
            newEnemy.transform.rotation = transform.rotation;
            newEnemy.SetActive(true);
        }
    }

}

}

sentences:
Drawing/adding shape objects with the mouse on html canvas I've started with the canvas paint tutorial from link which worked fine with a few problems that can be fixed later. I've been checking a lot of posts on drawing shapes on the canvas but they all use draw functions in a gameloop or intervals but I do not want to use draw(); in an interval or gameloop for now, I just need to update the content on userinput.

I am trying to create a drawing software that paints objects instead of just bitmaps. I've been debugging for a while now and can't find the problem: I have problems accessing the objects in the pointsArr[]; array. I was only able to add rectangles to the screen by using contextVar.strokeRect(50,50,50,50); directly with the mouseDownVarso far.

Yes I know that the addFilledCircleFunc creats rectangles, for now I just want everything to work properly.

// to do:
// add gameloop and draw with gameloop?
// stroke line in resize  fix
// collission check + detection objects
// functions to draw detection objects
// implement resize?

// Varibale declration
var canvasVar = document.getElementById('canvasHtmlElement');
var contextVar = canvasVar.getContext('2d');
var pointRadiusVar = 10;
var mouseButtonHeld = false;
var pointsArrPosition = 0;

//Arrays
var pointsArr = [];

// Varibale declration end

//canvas setup
canvasVar.width = window.innerWidth;
canvasVar.height = window.innerHeight;

//canvas setup end

//resize fix
window.onresize = function(){
    var tempImageVar = contextVar.getImageData(0,0, canvasVar.width, canvasVar.height);
    canvasVar.width = window.innerWidth;
    canvasVar.height = window.innerHeight;
    contextVar.putImageData(tempImageVar, 0,0);
}
//resize fix end

contextVar.lineWidth = pointRadiusVar * 2; // Line Width

//functions

// Objects

 function pointObject () {
 this.x = 0;
 this.y = 0;
 this.w = 10; // default width and height?
 this.h = 10;
 this.fill = '#444444';
 this.stroke=stroke||"skyblue";
 this.strokewidth=strokewidth||2;
 }

function addFilledCircleFunc(x, y, w, h, fill){
var filledCircle = new pointObject;
    filledCircle.x = x;
    filledCircle.y = y;
    filledCircle.w = w;
    filledCircle.h = h;
    filledCircle.fill = fill;
    pointsArr.push(filledCircle);
}

//Objects end

// create circle on mouse clicked point while mousebutton is held
var addPointToCanvasVar = function (e) {
    if(mouseButtonHeld){
        addFilledCircleFunc(e.clientX, e.clientY, 10, 10, '#444444');

        /* // old drawing code
         contextVar.lineTo(e.clientX, e.clientY);
         contextVar.stroke();
         contextVar.beginPath();
         contextVar.arc(e.clientX, e.clientY, pointRadiusVar, 0, Math.PI * 2);
         contextVar.fill();
         contextVar.beginPath();
         contextVar.moveTo(e.clientX, e.clientY);
         */
    }
};

// MAKE SURE that lines work when drawn over the edge of the canvas
/*
 function clearPathIfMouseCursorLeavesCanvasFunc(e){
 //contextVar.beginPath(); // clears the path so buttonpresses dont connect the line
 //mouseButtonHeld = false;
 }
 */
// end

// mouse Up/Down Switch
var mouseDownVar = function(e){
    alert("mouseDown");
    //contextVar.strokeRect(e.clientX, e.clientY,50,50);
    draw();
    mouseButtonHeld = true;
    addPointToCanvasVar(e); // add point on first click, not just when mousebutton is held
}

var mouseUpVar = function(){
    //alert("mouseUp");
    mouseButtonHeld = false;
    contextVar.beginPath(); // clears the path so buttonpresses dont connect the line
}

// mouse Up/Down Switch end

//functions end

//listeners

canvasVar.addEventListener('mousemove', addPointToCanvasVar);
canvasVar.addEventListener('mouseup', mouseUpVar);
canvasVar.addEventListener('mousedown', mouseDownVar);
//canvasVar.addEventListener ('mouseout', clearPathIfMouseCursorLeavesCanvasFunc);

//listeners end

//draw function

function draw(){
    alert('drawing');
    contextVar.strokeRect(pointsArr[pointsArrPosition].x,pointsArr[pointsArrPosition].y,pointsArr[pointsArrPosition].w,pointsArr[pointsArrPosition].h);
    pointsArrPosition++;
}

//draw function end

sentences:
How do I configure a joint for a sliding door in Unity? I have this sliding door where i want to use a joint to limit its motion:

...but I am confused about how to configure a joint to provide this sliding motion.

I've found the Hinge Joint component, but the comments below say this is for rotating motion. What kind of joint do I use to create a sliding motion?

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:
OpenGL ES on iOS Books I was wondering if someone has read both the:

iPhone 3D Programming

And

OpenGL ES 2.0

books and have an opinion if one is better than the other?

I'm basically wanting to get into doing 3D graphics on iOS including shaders.

sentences:
XNA 3D Unable to Position Bounding Sphere I have a collision method that seems like it would work, and it does, but the bounding sphere is always at 0, 0, 0. How do I fix this? Any more code and or details are available upon request.
BoundingSphere CreateBoundingSphereForModel(Model model, Matrix worldMatrix)
{
    Matrix[] boneTransforms = new Matrix[this.model.Bones.Count];
    this.model.CopyAbsoluteBoneTransformsTo(boneTransforms);

    BoundingSphere boundingSphere = new BoundingSphere();
    BoundingSphere meshSphere;

    for (int i = 0; i < model.Meshes.Count; i++)
    {
        meshSphere = model.Meshes[i].BoundingSphere.Transform(boneTransforms[i]);
        boundingSphere = BoundingSphere.CreateMerged(boundingSphere, meshSphere);
}
return boundingSphere.Transform(worldMatrix);
}

bool IsCollision2(Model model1, Matrix world1, Model model2, Matrix world2)
{
    BoundingSphere bs1 = CreateBoundingSphereForModel(model1, world1);
    BoundingSphere bs2 = CreateBoundingSphereForModel(model2, world2);

if (bs1.Intersects(bs2))
    return true;

return false;
}

private bool checkPlayerCollision(Model model1, Matrix world1)
{
    //Make player location matrix
    Vector3 playloc = new Vector3(X, Y, Z);
    //Make ship1 matrix
    Matrix ship1WorldMatrix = Matrix.CreateTranslation(ship1loc) * Matrix.CreateScale(0.1f);
//Make ship2 matrix
Matrix ship2WorldMatrix = Matrix.CreateTranslation(ship2loc) * Matrix.CreateScale(0.1f);
//Check for collision with ship1
if (IsCollision2(model1, world1, model, ship1WorldMatrix)) return true;
//Check for collision with ship2
if (IsCollision2(model1, world1, model, ship2WorldMatrix)) return true;
return false;
}

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:
Resolving 2D Collision with Rectangles For about a week I've been trying to grasp the basics of collision, but I've been driven to the point of wanting to just give up on everything when it comes to collision. I just don't understand it. Here's my code so far:

 public static void ObjectToObjectResponseTopDown(GameObject actor1, GameObject actor2)
        {
            if (CollisionDetection2D.BoundingRectangle(actor1.Bounds.X, actor1.Bounds.Y, actor1.Bounds.Width, actor1.Bounds.Height,
 actor2.Bounds.X, actor2.Bounds.Y, actor2.Bounds.Width, actor2.Bounds.Height)) //Just a Bounding Rectangle Collision Checker
            {
                if (actor1.Bounds.Top > actor2.Bounds.Bottom) //Hit From Top
                {
                    actor1.y_position += Rectangle.Intersect(actor1.Bounds, actor2.Bounds).Height;
                    return;
                }
                if (actor1.Bounds.Bottom > actor2.Bounds.Top) //Hit From Bottom
                {
                    actor1.y_position -= Rectangle.Intersect(actor1.Bounds, actor2.Bounds).Height;
                    return;
                }
                if (actor1.Bounds.Left > actor2.Bounds.Right)
                {
                    actor1.x_position += Rectangle.Intersect(actor1.Bounds, actor2.Bounds).Width;
                    return;
                }
                if (actor1.Bounds.Right > actor2.Bounds.Left)
                {
                    actor1.x_position -= Rectangle.Intersect(actor1.Bounds, actor2.Bounds).Width;
                    return;

                }
            }
        }

Essentially what it does so far is correctly collides when the bottom of the first rectangle collides with the top of the second rectangle, but with the left an right sides it corrects it either above or below the tile, and when the top of the first rectangle collides with the bottom of the second rectangle, it slides right through the second rectangle.

I'm really not sure what to do at this point.

sentences:
Most Efficient way to read a Settings Configuration File I have been working on a game for quite a while, and I am using Ogre3D for the rendering engine. It is getting to the point I need to move adjustable settings to a configuration file such as video settings/options, player keybindings, etc.

I am using RapidXML for parsing and loading my scenes, but I am not sure this is the best way to go about doing configurations. As a long time fan of Valve games, I know there's are just a long list of settings, basically no grouping, just a list. Where as UT games do something like

[VideoOptions]
...
...

[GameSettings]
...
...

Anyways, I am just wondering what the best way to go about this is.

sentences:
Procedurally-generated 2D curved roads on map I've been experimenting with algorithms to automatically generate road maps for a game I am working on.

I'm using the "Kingdom Rush" games as a reference point as they have some great-looking maps.

I am new to procedural content generation, and was wondering if anyone here has any pointers. I have experimented with generating random road topologies, e.g. a few entrance/source nodes, several inner nodes (fork and merge), and some exit sink nodes, then using graph-layout algorithms to create an actual road map based on this information.

Here's one example using the Fruchterman-Reingold algorithm for road layout:

The blue graph uses some randomly-generated Bézier control points to make the edges look less straight.

Here's another example generated using the same algorithm but different random numbers:

The trouble is most of the results end up looking quite similar, and I am not sure what rules I can add to improve the controllability and diversity of the procedurally-generated maps.

Any advice appreciated.

sentences:
LibGDX FrameBuffer no Transparency when drawing I try to draw severeal Sprites to a FrameBuffer. The Sprites are PNGs with transparency. When I draw them directly to the screen it's fine. But when I draw on the FrameBuffer and then draw the resulting texture on the screen the transparent parts are cut out and the glBackground shines through. Any idea how to solve this?

Here is how I do it:

FrameBuffer fbo = new FrameBuffer(Format.RGBA8888, width, height, false);
Sprite fboTexture = new Sprite(frameBufferObject.getColorBufferTexture());
fboTexture.flip(false, true);

fbo.begin();
batch.begin();
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.draw(sprite1, 0,0);
batch.draw(sprite2, 0,0);
batch.draw(sprite3, 0,0);
batch.end();
fbo.end();

batch.begin();
batch.draw(fboTexture, 0,0);
batch.end();

sentences: How to calculate falling and accelerating velocity? I'm thinking of making a lander game, where you control a spaceship and need to land it without crashing. What is a simple formula to calculate speed of falling or acceleration with relation to  working time to time engines?

sentences:
Selecting objects on a 2D map I have a object selection function by checking the mouse click and getting the relevant object.

How ever there is a rare situation where if one object is partially behind the other then both objects are in the given area so im wondering how I can make the game know which one was selected, as currently my method does not know.

This is my function that works it out:

function getobj(e){
    mx = e.pageX - curleft; //mouse click x
    my = e.pageY - curtop; //mouse click y

    function searchSprites(sprites, x, y) {
        var matches = [],
        i = 0,
        data = null;
        for (i = 0; i < spritea.length; ++i) {
            data = spritea[i].data;
            if (x > data[0] && y > data[1] && x < data[2] && y < data[3]) {
                var imageData = ctx2.getImageData(x, y, 1, 1);
                if(imageData.data[3] !== 0){
                    return [spritea[i].id];
                    i = spritea.length;
                }
            }
        }
    }
    res = searchSprites(spritea, mx, my);
    bid = res[0];
    if(bid === '1'){
        alert('You selected the skyscraper in front!');
    }else if(bid === '3'){
        alert('You selected the skyscraper behind!');
    }
}

Image of the map:

It keeps telling me I clicked the skyscraper behind which is not necessarily what the user is trying to do. How can I improve the accuracy of this ?

sentences:
How can I make a random function generate a specific integer more often without using arrays and vector? I was making a ludo game and there's a rule that your pieces will only open when the 6 will shows up on a dice.

How can I make my dice generate the number 6 more often, without using arrays or vectors? I'm using c++.

sentences:
Should I use inheritance or interfaces for an inventory system? I'm about to start programmin an inventory, harvest and loot system. I will need enemies that drop items, harvestable environmentals that yield resources and an inventory system that takes items and resources.

Should I solve this with interfaces, class inheritance or both? Why?
Or is it just up to my programming style? I'm more familiar with inheritance, but if interfaces give an advantage I'd use them and get used to it.

sentences:
Center attribute of BoxCollider2D not working? I've been trying to make a laser beam for my 2D shmup. I've set up a LineRenderer, along with a box collider 2D, and I've noticed that the center of the collider is positioned at one end of the line.

My settings are

Line

2 Elements

(1)0x 0y 0z
(2)0x 0y 10z

Not using World Space
Rotated 90 on the Z axis (to face the 2D camera)

I thought the Center attribute would align the box collider, but changing the X value seems to do nothing. Is it possible to align the box collider such that it is around the beam, and not sticking outside of it?

Image reference:

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:
What is a good linear algebra book for game programmers? I was told that I should start learning Linear Algebra in order to create good games with good physics.

I'm reading Linear Algebra book and it's completely foreign to me. The author starts out with solving linear equations (two equations, two variables) and I remember learning about that in school, but almost immediately he jumps into other things that seem to be taken directly from the Necronomicon.

What book can I read to learn some good math, but starting from the fundamentals?

Thanks a lot for the help.

sentences:
UDP Netcode Architecture for Fighting Game I am programming a fighting game that uses a UDP client/server architecture for multiplayer. The server can handle multiple clients, two of which (or one being the server) are playing and the rest are watching and chatting. I would prefer to use UDP for everything, including: player input from client, player state from server, and chat going both ways.

My concern is keeping the order of the player inputs in sync from the client to the server. Since moves involve a specific sequence of inputs (e.g., Left,Left-down,Down,Light Punch), if the server processes them out of order then the game is ruined. What is a good approach for dealing with packet loss and packets arriving out of order in this case?

I have considered having a linked list of outgoing packets in the client and server. With each step the list is traversed and unsent packets are sent, and if an ack packet(one I program the receiver to send back) was received for a particular packet (which I can identify simply with an integral value) then the outgoing packet is removed from the list. However, this does not guarantee order of delivery. Perhaps the server could keep a queue of inputs and evaluate another integral value in the packet for each input, organizing them into the correct order.

I'm not entirely sure, if someone could point me in the right direction I would be very grateful. I have working client and server chat code but before I starting seriously designing the network architecture I wanted to see what others have to say.

sentences:
What determines the hit detection ordering for graphic elements in Unity (2d game)? I have a bunch of overlapping buttons spread across several UI Canvases. The default mouse behaviour only registers hover/click events with one of the overlapping buttons, which is ideal for my project. The problem is the order of which button gets activated, is not tied to the Layer it is on or the Sorting Layer the item is on. I cannot seem to control which button is the top button that gets activated.

Using a RaycastAll() function returns the name of all buttons on any given point, and reflects the problem that for some reason, the buttons are arbitrarily ordered.

How do you control the order in which buttons are registered by the mouse?

sentences:
Can I embed a game in a PDF document? I was thinking that it could be cool to have an interactive game in a digital resume. For the sake of this question, and scope of this site, let's ignore whether or not this is a good idea.

Is it possible to embed a game or some sort of interactive window inside of a PDF document? This could be using any sort of language or framework. For example, having a small area of the PDF with a CAPTCHA in it.

sentences:
How to create 3D area mask? I have two cubes, one parent and one child. I want to use the parent's cube mesh as a mask for the child cube. I want to make visible only the part of the child cube that it is inside the parent cube.

I can easily achieve this effect with 2D sprites using the Sprite Mask, but I can't find a way to do it for 3D areas or 3D objects.

What I have:

What I want:

sentences:
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:
Embed IF text parser in another game? Are there any existing interactive fiction text parsing engines that I can embed in another game or application?

I'm looking to use something as a library. I can pass it the available objects and verbs from my own side. It will parse the sentences from the user and give me back some sort of structure/AST describing what the user asked for. Then my own code can then act upon that request.

I don't need something SIRI level. The simple sentences and actions that current IF games support is fine. But I'm not looking to write a whole text/sentence parser myself.

This isn't an If game and I can't write it entirely in an interactive-fiction language like inform 7. Unfortunatly, I can't seem to find any examples of anyone using the text parsing capabilities of these engines without writing the entire game in that engine's language.

sentences:
In OpenGl ES 2, should I allocate multiple transformation matrices? In OpenGl ES 2, should I declare just one transformation matrix, and share it across all objects or should I declare a transformation matrix in each object that needs it?

for clarification... something like this:

public class someclass{
   public static float[16] transMatrix = new float[16];
   ...
   public static void translate(int x, int y){
      //do translation here
   }
}
public class someotherclass{
   ...
   void draw(GL10 unused){
      someclass.translate(10,10);
      //draw
   }
}

verses something like this:

public class obj1{
    public static float[16] transMatrix = new float[16];
   ...
   void draw(GL10 unused){
      //translate
      //draw
   }
}
public class obj2{
   public static float[16] transMatrix = new float[16];
   ...
   void draw(GL10 unused){
      //translate
      //draw
   }
}

sentences:
Raycasting from an object to the center of the screen (crosshair) without clipping through objects Am trying to learn about Raycasting, and I thought I would start with something simple, and that was a laser that would come out of an object (think laser pointer in your hand) and always go to the crosshair.

Using ViewportToWorldPoint I found it easy to cast a ray from the center of the camera, but this had an issue as you can see in this GIF below.

The line would clip through because the ray was coming from the center, not off to the side where the laser pointer would be.

Am not sure how to solve this.

void Update(){
    Vector3 ray = Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0f));

    line.SetPosition(0, transform.position);

    RaycastHit hit;

    if(Physics.Raycast(ray, Camera.main.transform.forward, out hit, raylength)){
        if(hit.collider != null){
            line.SetPosition(1, hit.point);
        }
    } else {
        Vector3 pos = line.GetPosition(0);
        line.SetPosition(1, ray + (Camera.main.transform.forward * raylength));
    }
}

The closest thing I could find that I am trying to replicate for this exercise is the No Man's Sky mining tool

sentences:
Real-time fluid simulation? I'd like to create a system in Unreal Engine 4 with glob-like fluids which interact with the environment, like the gel in Portal 2. Here's a GIF of the gel from that:

(search that I used to bring up similar images)
I was wondering how it might be possible to do something like this? An in-depth guide would be nice as I have a mostly basic understanding of blueprints in UE4, although I know it's a lot to ask for. If you know how I can achieve this, please let me know. Thank you! :)
P.S: The "fluid" stains don't need to give effects such as speed like you saw in the GIF, but I would still like the liquids to stain wherever they hit. :)

sentences:
How do I "reset" the color in OpenGl ES 1.0/1.1? In my 2D game I use glColor4f() to set the color and draw my screen border rectangles
but when I try to start drawing my game objects, made up of a texture
on a rectangular "quad", using GL10.GL_TEXTURE_2D, GL10.GL_VERTEX_ARRAY
and GL10.GL_TEXTURE_COORD_ARRAY no GL10.GL_COLOR_ARRAY, it uses the "current
color" from glColor4f().

My question is what do I need to set/reset in OpenGl ES to re-enable it to
use the colors from the texture when I try to draw them?  If I comment out the border drawing, so glColor4f() never gets called, the colors are fine.

I'm not using double buffering.  I read that once you set the color with
glColor4f() it stays set, unless you possibly use glPushAttrib(GL_CURRENT_BIT),
but I heard that that's expensive, time wise.

sentences: Why is C/C++ preferred for game developers? Some people say it offers more control to developers, but what is it precisely that can be controlled through C++ which can't be controlled using, for example, Java?

sentences:
Deterministic Multiplayer RTS game questions? I am working on a cross-platform multiplayer RTS game where the different clients and a server(flash and C#), all need to stay deterministically synchronised.

To deal with Floatpoint inconsistencies, I've come across this method: http://joshblog.net/2007/01/30/flash-floating-point-number-errors/#comment-49912 which basically truncates off the nondeterministic part:

return Math.round(1000 * float) / 1000;

Howewer my concern is that every time there is a division, there is further chance of creating additional floatpoint errors, in essence making it worse?

.

So it occured to me, how about something like this:

function floatSafe(number:Number) : Number
{return Math.round(float* 1024) / 1024; }

ie dividing with only powers of 2 ? What do you think?

.

Ironically with the above method I got less accurate results:

trace(  floatSafe(3/5) ) // 0.599609375

where as with the other method(dividing with 1000), or just tracing the raw value I am getting 3/5 = 0.6

or Maybe thats what 3/5 actually is, IE 0.6 cannot really be represented with a floatpoint datatype, and would be more consistent across different platforms?

sentences:
Should I implement Entity Component System in all my projects? I'm not here to ask for any specific code implementation, I'm here just to make my ideas clearer. But let me explain the situation:

I have already developed some little and amatorial game projects (never published tho) but I recently found some interesting articles about ECS and I began to read more about it. I found the whole ECS concept every interesting and I thought I could implement it in a very tiny game I'm working on in my free time.
The problem is: should I implement this pattern on a every little project with simple game mechanics and poor gameplay ?
The 2D game I'm working on will be entirely developed by me, so I do not actually need to make the code easier to mantain by other people. This game will basically have just 2 players, some weapons and a large variety of bullets and superpowers. No IA enemies, no vehicles, static and tiny maps and.. Just that.
It will have, of course, a simply physics system (just to make players fall and bullets move, for example), and a tiled but very little map which is editabile by players (destroying tiles).

So the point is: why should I actually write an ECS for such a basic game ? Do I really have any real advantage considering the game design ?
I mean, I know it is very good to make your code very flexible and easy to mantain even in the future, but I also know that this pattern was invented to avoid some limitations and the code duplication which the old hierarchical game structure provides, but this game doesn't have a wide hierarchical structure, as far as I can see.

I started coding it, but I discovered some aspects which, to be honest, scare me. Like having all the components talking to each other through a reference of their owner (the entity they are bound to), which as far as I know, is not very good to avoid cache misses.
The last thing is that I have the feeling that I won't write more than 2 components of the same type, and this would make the ECS less useful.

I know I don't have the whole ECS concept really clear in my mind, this is the first time I implement it, by the way, but I hope you got the point of my problem.

sentences:
How can I make huge terrains in Unity? How can I make extremely huge terrains in Unity? It seems like I can set width and length to large values. But the Heightmap resolution only goes up to 4097 and the Detail resolution only goes up to 4048.

Any ideas?

sentences:
Collision Detection For A Maze/Cave I have a simple code written in Processing 3.x that I am using to test out the collision detection for a cave/maze.

The code is here: https://github.com/NoahJon3s/New-Journey-The-Game/blob/master/sketch_190820a.pde

If you where to run said code, you'd see that I have the code so that it detects collisions on the x-axis (top of the rectangle) and y-axis (left side of the rectangle), and correctly prevents the movement of the "player" from moving out of the rectangle, but I cannot seem to find a solution for preventing the movement out of the bottom or the right side of the rectangle, even though I am able to detect the collision. Every solution I try seems to lock the "player" to those respective sides. Any suggestions?

Thanks in advance.

sentences:
How can I incrementally generate an graph? I just started a new project in which I'd like the game world to consist of procedurally-generated locations connected by teleporters.  After a bit of research, I've discovered this to be called either "graph theory" or "bloody complicated", depending on who is discussing it.  Unfortunately, I've found very little information on generating graphs; most of the tools I've seen are directed toward examining existing graphs.

Assuming I have the terminology correctly sorted out, my requirements are that the graph be:

simple — no location (vertex) should have a teleporter (edge) which connects back to itself, nor should two vertices have multiple edges connecting them
connected — it should be possible to travel between any two vertices in the graph (though I don't foresee ever needing to find the path; simply knowing the player could find one if they chose to is sufficient)
cyclic — there should be more than one path between any two vertices
undirected — all edges can be traveled in either direction
infinite — if the player so wishes, they should be able to travel indefinitely, with the graph continuing to generate incrementally as they approach its outermost unexplored vertices
locally finite — a vertex's degree should never change after the player has visited it
stably labelled — each vertex represents a location which will itself be procedurally generated from a seed; the same seed must be assigned to a vertex regardless of what path the player used to travel there or how large the graph is when they do

I've had some ideas (which I've not yet tried to implement) regarding using the local maxima of 2D perlin noise as vertices (the input x and y could then be used as its label), but that feels clunky and overcomplicated.

Is there a better way to generate a graph like this?  I'm developing in Python 2.6 using Panda3D and numpy, and would of course be willing to look at including other libraries if they'll help with this problem!

Edit

I think I've done a poor job explaining some of my requirements, so it's illustration time!  Hopefully, this will clear things up.

What I mean by having stable labels is that I want, for example, Player A to be able to do a bunch of exploring and find, among other things, a cyclic path back to their starting location and a mountain that looks like a cat.  His game now looks something like the following (vertices are numbered with their seed and edges with the order in which the player traversed them).  He started on vertex 8329 (green) and Happycat Mountain is in vertex 6745 (blue).

Player A's good friend Player B is a fan of cats, so he wants to show it to her.  He gives her the root seed for his world and directions along the shorter route to the mountain of interest.  Her game should now look like this:

The problem I'm currently having the most difficulty with is "How do I generate the same seeds for Player B when her exploration hasn't followed the same path?"  That's what led me to the idea of using Perlin noise — as long as the same root seed is used, the maxima won't move, so their coordinates could be used as stable vertex seeds.

sentences:
Normal Mapping space confusion I've been reading today about normal mapping. Up to now, the only normal mapping I encountered was with maps already in world space so I just extracted the info from the texture and transformed them with the normal matrix.

Now I wanted to try to use a normal map that is in tangent space, but I immediately became really confused.

What I've in my code up-to-now is

Vertex Shader

 ...
passedPosition = modelViewMatrix*vec4(vertexPosition,1.0);
 ...

Fragment Shader

 vec3 V = normalize(-passedPosition .xyz);   // Eye vector
 ...
 vec3 L_dir = passedPosition .xyz - lights[i].lightPosition.xyz;
 vec3 L = normalize(L_dir);
 ...

And then proceed with my lighting calculations.

All the tutorial I came across change all the light directions and the view vector into tangent space (in the vertex shader) and then extract the normal from the texture and keep going (in fragment).
My issue here is that I'd like to avoid to access all my lights informations in the vertex shader, so my questions are:

Does make sense to pass to the fragment shader the t,b,n vectors so that I transform the light directions there? Should I consider access all my lighting informations in vertex shader (I have an array of Light struct which has more than just the position) and then passed them on to the fragment shader? Is something I'd like to avoid, but if is much better I can think of it.
There is a way to perform normal mapping that is  more compatible with what I've now (snippets above posted).
Should I consider change my calculations from view space to world space? In that case, how can I perform normal mapping?

Thanks

sentences: Unity crashes if there are more than 4 terrains please can you help me with the issue that I face, that is, I decided to create open-world game by creating several terrains and connect them together in Unity and firstly respective size of the terrains was 500X500 then I decided to add more terrains to make game world bigger and once I added the 5th terrain in the scene, Unity simply crashed. Later, I thought what if I increase the sizes of terrains rather than create more new terrains then the sizes of originally created terrains were changed from 500X500 to 800X800 and again Unity crashed. Please guys help me out with that and how to overcome that and I am just trying to create game without using any ready plugins and, say, try to create the game on my own. Thank you for your attention))).

sentences:
3D player movement with Unity's new input system So, I trying to get used to the new Unity input system. "Back in the days" I just got the Vertical/Horizontal axis, put them into a Vector3, multiplied them by a certain value and then moves the player.

Now, with the new input system, that changed quite a bit. So, what I'm trying to do is, to get the input of a 2D Vector, earlier called DPAD in the new system. My approach was, like

private void Awake() {
    InputAction.performed += ctx => Movement(ctx.ReadValue<Vector2>());
    InputAction.canceled += ctx => Movement(ctx.ReadValue<Vector2>());
}

private void OnMovement(Vector2 _dir) {
    moveDirection = _dir;
}

//This performed in FixedUpdate
private void Move() {
    transform.position += moveDirection * moveSpeed * Time.deltaTime;
}

Buut, you know, kinda worked, but not really. The player did unintended things like keep moving or not reacting at all to my button press. Maybe I set something wrong up. You might help me please, thanks!

sentences:
How can I make actions that effect the position of another player appear responsive when my game server is authoritative? You are playing as Lucio in Overwatch. You boop another player and they immediately get booped away. It feels really responsive. But the server hasn't actually registered the boop yet. By the time your command reaches the server, that player might be in a different location and the result of your boop might be completely different. If we needed to wait for a server confirmation, we wouldn't see our boop for, say, 200ms. (assuming 200ms RTT.)
You are driving around in PUBG and see another player. You drive your car in to a player who is running around on foot. They appear to immediately die or at least get bumped away by the impact. You hit the player where you saw him but he is actually somewhere else on the server (you may have actually missed him!). If our game does not respond immediately, we would see the other player clip in to your car as they continue running, then, say, 200ms later they would die or get knocked around (again assuming a RTT of 200ms)

How are situations like these resolved? It seems like the result is simulated locally (prediction) but the outcomes could be so drastic that an incorrect prediction could result in a lot of confusion. (Running over a player who isn't actually in your way, booping a player to your left off a cliff, but they are actually in front of you and won't fall down the cliff)

sentences:
Where is the “Test Login Needed” in App review in Google Play? I recently uploaded a new app in the google play console to review, then I was receive an email that say:

  Please provide login credentials to the support team before you submit
  any updated version for another review (select “Test Login Needed” and
  include the test login account and password details in the open box
  field).

I can´t find the “Test Login Needed” to select it.

Can anybody tell where is this option?

sentences:
What is the speed difference between cross platform HTML5 games and native mobile games? Microsoft is advertising and promoting cross platform HTML5 game development. I am thinking of creating a simple 2D side scroller game and I am trying to decide what engine should I use for creating it. I am trying to understand if there is a big difference between developping once in Unity and exporting to different platforms or simply develop it once in HTML5 in Visual Studio and publish it everywhere.
What are the drawbacks and benefits for each? Is there any speed/lag difference?
any tips are useful

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:
About Alpha blending sprites in Direct3D9 I have a Direct3D9 application that is rendering ID3DXSprites. The problem I am experiencing is best described in this situation:

I have a texture that is totally opaque.
On top of it I draw a rectangle filled with solid color and alpha of 128.
On top of the rectangle I have a text that is totally opaque.
I draw all of this and get the resulting image through GetRenderTarget call.
The problem is that on the resulting image, on the area where the transparent rectangle is, I have semi transparent pixels. It is not a problem that the rectangle is transparent, the problem is that the resulting image is.

The question is how to setup the blending so in this situation I don't get the transparent pixels in the resulting image?

I use the sprite with D3DXSPRITE_ALPHABLEND which sets the device state to D3DBLEND_SRCALPHA and D3DBLEND_INVSRCALPHA. I tried couple of combinations of SetRenderState, like D3DBLEND_SRCALPHA, D3DBLEND_DESTALPHA etc., but couldn't make it work.

Thanks.

sentences:
Mapping 3D object coordinates to 2D screen coordinates with perspective projection Sort of following on from where this person was in their topic:
Matrix for 2D perspective

What I have at the moment is a transformation matrix that's defined as follows:
http://pastebin.com/GM6BhP0R
-- The field projMat is just a 4x4 matrix.

I have an array of 3D points that I'm trying to map to the canvas and I'm doing that by first multiplying each vertex (3D point) by a view matrix, which I've just set to the identity matrix for the time being, although if I can get this set up that will be responsible for creating a camera with I suppose.

Lastly I take this newly transformed 3D point and I multiply it by the projection matrix as defined in the code sample above. I was hoping that this would give me the screen coordinates for the points, however there appears to be no depth to the points (e.g. points with a higher Z coordinate should start to taper in, while closer points shouldn't), so objects further away from the camera appear smaller.
As I said though, after the transformations it appears to render the points in the same position irrespective of its Z coordinate. Here's how I'm rendering the points (in Java just in case you want to know):

for(int i = 0; i < vertices.length; i++) {
    Vector3f transPos = Matrix4f.multiply(projMat, Matrix4f.multiply(viewMat, vertices[i]));
    screen.drawPoint((int) transPos.getX(), (int) transPos.getY(), 0xffffffff);
}

As you can see here the inner multiplication just multiplies the vextex (point) with the view matrix, which is set to the identity, then the 3D vector that's produced by that is then multiplied by the projection matrix, which should set it to a perspective view.

If you can see where I've gone wrong I'd appreciate any help.

sentences: Detecting pixels in a rotated Texture2D in XNA? I know things similar to this have been posted, but I'm still trying to find a good solution...  I'm drawing Texture2D objects on the ground in my game, and for Mouse-Over or targeting methods, I'm detecting whether or not the pixel in that Texture at the mouse position is Color.Transparent.  This works perfectly when I do not rotate the texture, but I'd like to be able to rotate textures to add realism/variety.  However, I either need to create a new Texture2D that is rotated at the correct angle so that I can detect its pixels, or I need to find some other method of detection...  Any thoughts?

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 could an offline app store images so that they aren't trivially discoverable? There is an app I play which has lots of images. I have reverse engineered the app but couldn't find the images in the APK. The app is an offline app so it doesnt retrieve images from a server.

My question is, then, where did this app store its images? I'd like to achieve the same level of protection (to deter casual observation of the images).

sentences:
Supersampling - Pixel color average calculation I am currently trying to understand Supersampling.

Wikipedia says (or at least Wikipedia tells me) that multiple color samples are taken from one pixel to calculate the final result. But to my mind one pixel has exactly one color and logically, the average of an infinite amount of equal colors remains the same.

So, how can the resulting color differ from the original pixel's color?

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:
Random white lines appearing while translating rendering slick 2d images Hmm I'm getting this weird problem that i think may be a bug with slick but when ever i translate an image in slick 2d for some reason a weird white line appears on the left side of every image like this

This is the method for rendering each of the tiles, btw they are 32x32 textures

public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException {
    g.translate(-playerX, -playerY);
    //render the blocks here
    for(int x = 0; x <= ((Size.WIDTH/Size.Tile)+1); x++) {
        for(int y = 0; y <= ((Size.HEIGHT/Size.Tile)+1); y++) {
            g.drawImage(Sprites.dirt, x*Size.Tile, y*Size.Tile);
        }
    }
    g.translate(playerX, playerY);
    //render the player here, dont touch
    //no texture it was based off an old sheet
    g.drawImage(Sprites.grass, (Size.WIDTH-Size.Tile)/2, (Size.HEIGHT-Size.Tile)/2);

Sprite Getter :

public class Sprites {
    public static Image SpriteSheet;
    public static Image grass;
    public static Image dirt;
    public static void Init() throws SlickException {

        SpriteSheet = new Image("assets/images/SpriteSheets/Sprites.png");
        grass = SpriteSheet.getSubImage(0, 0, Size.Tile, Size.Tile);
        dirt = SpriteSheet.getSubImage(0, 1*32, Size.Tile, Size.Tile);
    }
}

if you want to see the rest of the code it is at MC2D.zip

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:
Adjacency in procedural generation of dungeon I wanted to make a procedural dungeon experimenting a new approach, it works nice for random-meaningless content (in example a procedural background to a level), however when I want it to be not-so-random I incur in some conceptual problem: basically I end up with a grid of numeric sector IDs in 2D.

Grid example:

27 |  56  | 74
---+------+----
35 |  31  | 115
---+------+----
14 |  52  | 12

The main problem is how to fix adjacency so that content is generated in a deterministic way:

Content of sector "31" should be generated as a function of adjacent sectors (this works)
However when I generate content for sector "35", I end up with a different link between sector "35" and "31".

So basically according from which direction I cross a sector I see a different passage each time (while the content of the sector is always the same).

As you see in the following image:

The passage between 35-31 is different according to which sector is used to start content generation, which is not what I want. I want the same passage arise.

To answer comments:

sector[id].content = generateContent( sector[id].neighboursIds());

sentences:
Random World Generation Possible Duplicate:
  How are voxel terrain engines made?

I'm making a game like minecraft (although a different idea) but I need a random world generator for a 1024 block wide and 256 block tall map. Basically so far I have a multidimensional array for each layer of blocks (a total of 262,114 blocks).

This is the code I have now:

Block[,] BlocksInMap = new Block[1024, 256];

public bool IsWorldGenerated = false;

Random r = new Random();

private void RunThread()
{
    for (int BH = 0; BH <= 256; BH++)
    {
        for (int BW = 0; BW <= 1024; BW++)
        {
            Block b = new Block();
            if (BH >= 192)
            {

            }
            BlocksInMap[BW, BH] = b;
        }
    }

    IsWorldGenerated = true;
}

public void GenWorld()
{
    new Thread(new ThreadStart(RunThread)).Start();
}

I want to make tunnels and water but the way blocks are set is like this:

Block MyBlock = new Block();
MyBlock.BlockType = Block.BlockTypes.Air;

How would I manage to connect blocks so the land is not a bunch of floating dirt and stone?

sentences:
What is the appropriate way to implement collision in 2D worlds? If I want to create a 2D game map which features areas traversable by a player through standard up/down/left/right inputs, and then have areas that are NOT traversable... perhaps just a bush, or a sign post, or a rock.

What is the appropriate agent to enforce these rules?

It seems like the trendy thing is to ship off these responsibilities to Box2D, but that seems wrong to me. Is there a technique with lower overhead to produce the same effect? Is it as simple as inventorying and enumerating through every rock and making sure the player can or cannot walk to the space they are trying to walk to? That's how I am doing it now.

sentences:
Shifting values or tiles on a 2D grid (1D array) I recently turned my practice project into a match3-type game.

The game uses a 6x10 grid, internally stored into a single array, with each item being a positive integer (0-based). I have a function to detect groups of the same type of a given size, but once the group has been deleted, the tiles above need to be shifted down.

The unordered index of each deleted tile is also stored into a separate array.

The language I'm working with is Linden Scripting Language (LSL), although language-specific answers aren't needed (but very helpful), so even general examples are welcome.

Edit: My recursive function so far:

shift(integer i) // i == index of Grid, COLS == columns/width (6)
{
    if( (integer)grid[i] != -1 ) return; // blocked by deleted value

    Grid[i] = (integer)Grid[i-COLS]; // copy value from above

    if(i >= COLS) // haven't reached upper limit of grid
    {
        shift(i-COLS); // recursive call up
    }
    else
    {
        Grid[i] = (integer)llFrand(TYPES); // reached top, randomize tile
                                           // TYPES == integer, maximum amount of types
    }
}

Improvements needed:

Don't copy deleted values from above (skip over)
Stop recursing early if multiple values were deleted vertically
Move horizontally and find the lowest point to begin recursing from

Limitations of the environment:

Limited to 64KB of memory (bytecode + stack/heap)
Each call may potentially use 512 bytes of stack

sentences: Unity importing Blender models with different orientations All the models apart from 'Jungle Tree' are facing right which is not a problem, because they still seem to work with my game. But how can I change the 'Jungle Tree' to face right like the other models instead of left? I haven't made the Jungle Tree drastically different to the other models so I don't see why it is doing this

sentences:
assigning values to shader parameters in the XNA content pipeline I have tried creating a simple content processor that assigns the custom effect I created to models instead of the default BasicEffect.

[ContentProcessor(DisplayName = "Shadow Mapping Model")]
public class ShadowMappingModelProcessor : ModelProcessor
{
    protected override MaterialContent ConvertMaterial(MaterialContent material, ContentProcessorContext context)
    {
        EffectMaterialContent shadowMappingMaterial = new EffectMaterialContent();
        shadowMappingMaterial.Effect = new ExternalReference<EffectContent>("Effects/MultipassShadowMapping.fx");
        return context.Convert<MaterialContent, MaterialContent>(shadowMappingMaterial, typeof(MaterialProcessor).Name);
    }
}

This works, but when I go to draw a model in a game, the effect has no material properties assigned.  How would I go about assigning, say, my DiffuseColor or SpecularColor shader parameter to white or (better) can I assign it to some value specified by the artist in the model?  (I think this may have something to do with the OpaqueDataDictionary but I am confused on how to use it--the content pipeline has always been a black box to me.)

sentences:
Non-rectangular collision detection in Python and Pygame I am programming a ray tracer in python, and I have gotten as far as making a character that can move across a 2d plane and change direction of movement when needed. The problem is this: I want to be able to use an image with transparency as the maze that the player travels through, and use transparent parts as parts that aren't walls, where as every thing else is a wall. The way I am using collision detection is by using the "pygame.sprite.spritecollide" method, which takes in a Sprite, and a Sprite Group. So I first add the map sprite object to the group, and then in the main while loop, it checks for collision. Here is a small snippet of what that might look like:
map = Map("map1.png") # "Map" class is regular sprite class but with "image" and "rect"
group = pygame.sprite.Group()
group.add(map)
# inbetween stuff would be here
# while loop \/
running = True
while running:
    # event handling stuff would be here
    if pygame.sprite.spritecollide(player, group, False):
        print True
    # screen drawing routines would be here

As I mentioned, the image has transparency. But never the less, the image rect sticks to the non transparency position that it was, so i have to move the player off screen to get the console to stop saying "True".
So what I ask, is there a way that I can check for sprite collision but with transparency?

sentences:
How can I apply my camera to all graphics objects? Is there a way to have the camera be applied to all objects?

Can you have the camera effect objects that where made with glVertex3f();

This is the fourth time I have been writing this post. It keeps deleting. The first time it deleted almost all the text was when I logged in. Anyway ---

This is some of the code that does the camera:

    Projection = glm::perspective(fov, display.Ratio(), 0.001f, 1000.0f);
    glm::vec3 Pos = glm::vec3(this->position.x, this->position.y, this->position.z);
    glm::vec3 Target = glm::vec3(this->target.x, this->target.y, this->target.z);
    glm::vec3 Up = glm::vec3(this->up.x, this->up.y, this->up.z);
    glm::mat4 Lookat = glm::lookAt(Pos, Target, Up);
    glm::mat4 ModelV = glm::rotate(glm::mat4(1.0f), 0.0f, Up);
    CamLook = this->Projection * Lookat * ModelV;

CamLook is passed to the shader as MVP

Shader Code:

#version 400

in vec3 VertexPosition;
in vec3 VertexColor;
uniform mat4 MVP;

out vec3 Color;

void main() {
    Color = vec3(1, 1, 1);
    gl_Position = MVP * vec4(1, 1, 1, 1);
}

Please someone tell me what is wrong with this? I have been working on this for almost a month now and I can move on unless this is done.

Also I have another shader that does color on the objects.

sentences:
Revolve FlxSprites Around a Central FlxSprite in Flash Game made with Flixel I have been working on a Flash game made in Flash Builder using the Flixel library. I have been trying to dynamically create a group of FlxSprites , and revolve them around a player controlled class that extends FlxSprite when the player uses a power up.

My thought on how to approach this, was to create a circle, use points on that circle to instantiate the sprites, and then somehow update those sprites to points along that circle during the game's update step. But I am not sure what would be the best way to hold information about a circle, or circular path's in ActionScript 3. I assumed that As3Math  provided some of the means to do this, and I tried to add one sprite to a circle like this:

package
{
    import As3Math.*;
    import As3Math.geo2d.amBoundCircle2d;
    import org.flixel.FlxGroup;
    import org.flixel.FlxState;

    public class ButterflyRing extends FlxGroup
    {
        [Embed(source="../Content/Images/spritesheet_butterfly_32x8.png")] var butterflySprite:Class;
        public function ButterflyRing(playState:FlxState,X:Number,Y:Number)
        {
            //add to super class
            super();

            //create a circle motion path at coordinates x:150, y:150 with a radius of 100
            var butterflyCircle:Math.amBoundCircle2d = new Math.amBoundCircle2d(150,50);

            var circDiameter:Number = butterflyCircle.radius/2;
            var pX:Number = butterflyCircle.center.x + circDiameter
            var pY:Number = butterflyCircle.center.y;

            var butterfly:SpriteButterfly = new SpriteButterfly(pX,pY);
            add(butterfly);

        }

        override public function update():void
        {
            super.update();
        }
    }
}

I realize now this is not the correct way to use As3Math, that it is accessible by default and you call it like Math.pi. My question is, Does ActionsScript 3 have the means to do this in its code base, or do you have to define your own classes to hold information for a circle, or do you use Math.pi to build circles from scratch? What is a good approach for this? Or does Flixel provide something good for this?

sentences: LibGDX: Is there a maximum amount of vertices for a PolygonShape? When you use PolygonShape.set(Vector2[] vertices), is there a limit of vertices of the array which is passed to the method?

sentences:
Unable to instantiate objects Straight in unity I am  creating a match card game in unity and I want to place cards in straight direction that is one below another and so on... But with my formula It's showing cards one after another.Please tell me whats wrong with my code.
Following is my code -

    void SpawnCards(){
    int cardsinrow = 4;
    int cardsincolumn = cardslist.Count/cardsinrow;
    if(cardslist.Count % cardsinrow > 0)
        cardsincolumn += 1;
    float spacebetweencards = .2f;

    for(int i=0; i<cardslist.Count; i++){
        GameObject mc = Instantiate(memorycard, new Vector3((i%cardsinrow+(i%cardsinrow*spacebetweencards))-(cardsinrow/2f)+spacebetweencards, 0, (i/cardsinrow+(i/cardsinrow*spacebetweencards))-(cardsincolumn/2f)+spacebetweencards), memorycard.transform.rotation) as GameObject;
        mc.GetComponentInChildren<MemoryCard>().SetMemorycard(cardslist[i].texture, cardslist[i].number);
    }
}

sentences:
How can I expose material parameters in the Unreal level editor? Is there a way to expose material parameters in Unreal 4 so that they are accessible from the level editor?

As far as I know, I can only do this through the Material Editor, but I wish to do it more fluently.

E.g. to edit a color for the currently selected object in a level:

sentences:
What causes the iOS OpenGLES driver to allocate extra memory? I'm trying to optimize the memory usage of our iOS game and I'm puzzled about when/why the iOS GLES driver allocates extra memory at runtime... When I run our game through Instruments with the OpenGL ES Driver instrument the gartUsedBytes value can fluctuate quite wildly. We preload all our textures and build the buffer objects up front, so it's not the game engine requesting extra memory from GL.

Currently we are manually requesting around 50MB of GL memory, yet the gartUsedBytes value sits at around 90MB most of the time, peaking at 125MB from time to time. It seems to be linked to what you are rendering that frame - our PVS only submits VBO's for visible meshes.

Can anyone shed some light on what the driver is doing in the background ? Like I said earlier, all our game engine allocations are done on level load, so in theory there shouldn't be any fluctuation on GL memory usage while the level is running.

Thanks.

sentences:
How to make a Sprite using CoreGraphics iOS - Cocos2d-iPhone I'm trying to make a sprite that uses the graphics that are made with core graphics.   I cant seem to find anything to explain how to make shapes using core graphics to create a sprite to use in cocos2d-iPhone.

Thanks for any insights and help!

sentences:
Is it easy to switch from Chipmunk to Box2D? Currently I'm doing some prototyping with physics in Python and I later plan to port the code over to C++.

Box2D has some features that I really like so I'd rather use that library instead. The problem is that the Python port of Box2D is pretty tedious to install and I'm lazy, :D while the Chipmunk port is very easy to install.

Is it hard for me to switch libraries later on when I port the code to C++? (Will I have to do big architectural changes?)

sentences:
Libgdx particle editor absorb effect I am trying to achieve a certain kind of absorb effect within libgdx via the particle editor.

To be more descriptive: I want particles to spawn in a circle and then move towards the center point of that circle (and then disappear there).

I can of course spawn the particles in a circle, but then I cannot seem to find a way to make sure they all move toward a center point.

So my questions can be divided into two parts:

Is their any way I could use the particle editor to achieve this absorb effect I described?
If not, then what would the best way to achieve it in libgdx? Is their some way I could hack into the particle effect behavior itself and make this work?

sentences:
Three js raycaster WITHOUT camera I seem to find only examples to use the raycaster with the camera, but none that just have a raycaster from Point A to Point B.

I have a working raycaster, it retrieves my Helpers, Lines etc. but it seems it does not recognize my sphere.

My first thought was my points are off, so i decided to create a line from my pointA to my pointB with a direction like so:

var pointA = new Vector3( 50, 0, 0 );
var direction = new Vector3( 0, 1, 0 );
direction.normalize();
var distance = 100;

var pointB = new Vector3();
pointB.addVectors ( pointA, direction.multiplyScalar( distance ) );

var geometry = new Geometry();
geometry.vertices.push( pointA );
geometry.vertices.push( pointB );
var material = new LineBasicMaterial( { color : 0xff0000 } );

var line = new Line( geometry, material );

This will show a line from my point (50 0 0) to (50 100 0) right trough my sphere which is at point (50, 50, 0) so my pointA and direction values are correct.

Next i add a raycaster:
To avoid conflicts with any side effects i recreated my points here:

var raycaster = new Raycaster(new Vector3( 50, 0, 0 ), new Vector3( 0, 1, 0 ).normalize());
var intersects = raycaster.intersectObject(target);
console.log(intersects);

Seems pretty straight forward to me, i also tried to use raycaster.intersectObjects(scene.children) but it gives Lines, helpers etc. but not my sphere.

What am i doing wrong? I am surely missing something here.

IMG of the line and the sphere:

sentences:
Rotating a 3rd person camera toward a target I have a 3rd person camera that doesn't look directly at the player but somewhere in front of him.

When the user enter shooting mode, I want the camera to turn around the player to face the target.

In the image above. "O" is the player (Origin), "L" is the lookat, "C" is the camera position and "T" is the target. I want to rotate the lookat line C->L so that it passes by T (C'->L'->T') around the Origin ("O").

Basically I need to find the angle alpha that I put in red in the picture.

I store my camera position in a structure like such :

struct CameraTarget {
     Quaternion absoluteRotation;
     Vec3 absolutePosition;
     Vec3 cameraOffset;
     Vec3 lookatOffset;
     float FOV;
}

So if I could find the angle I'm looking for I could do something like :

cam->absoluteRotation = cam->absoluteRotation * alpha;

To get the player to always look at the target.

If the lookat was passing by the Origin I could simply do

Vec3 origDir = cam->lookAtOffset - cam->absolutePosition;
origDir.normalize();
Vec3 newDir = cam->target - cam->absolutePosition;
newDir.normalize();
Quaternion q(origDir, newDir); // from->to
cam->absoluteRotation = cam->absoluteRotation * q;

However in the diagram above this doesn't quite work since the rotation is offset from the Origin.

sentences:
I found a game with the same name as mine! What should I do? I published my game Eyeroller on Google Play the other day. I checked there was no game on Google Play with the same name. But today I searched for "eyeroller" on Google (Yes, I should have done it a long time ago) and realized there is a game named eyeRoller on the AppStore. They are completely different games, as you can see.

What are the legal implications of this? Can things like trademarks and copyrights be a problem? Should I change my game's name?

sentences: How to design reward and points system? There are few events in my game, like complete levels , complete puzzles , kill enemies and so on. Each such event will reward the player points and bonus powers. Now each "master" task (for example puzzles) can reward the player different points so the hierarchy can be big. How do I design such module ?

sentences:
Why isn't the texture correctly loading onto sphere? I am trying to make a moon object. I have a (mostly) spherical object model that I want to place the moon texture on top of. The moon texture is an equirectangular projection as seen below.

However, the moon drawn is rendered like this:

As you can see, not all of the north pole is rendering. Roughly 3/4 of the moon seems to have rendered, but it doesnt seem to have any of the red transition color in the north pole.
The moon model was made in Blender by simply creating a UV Sphere and then exporting it with triangulation enabled. No changes were made. The moon obj file can be found here in text version. Maybe the normals aren't correct? I tried using an ico sphere as well, but the results with that were even worse. Any advice for why it isn't rendering correctly?
Here is the sphere mesh if that helps:

sentences:
Why in the dialogue system it's showing in the conversation only 2 sentences and not the whole 3 sentences? The first script the manager is attached to new empty gameobject:
I want the conversation to start automatic when running the game so i'm calling the method TriggerDialogue in the manager:

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

public class DialogueManager : MonoBehaviour
{
    public DialogueTrigger dialoguetrigger;

    private Queue<string> sentences;

    // Use this for initialization
    void Start ()
    {
        sentences = new Queue<string>();

        dialoguetrigger.TriggerDialogue();
        DisplayNextSentence();
    }

    public void StartDialogue(Dialogue dialogue)
    {
        Debug.Log("Starting conversation with " + 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();
        Debug.Log(sentence);
    }

    void EndDialogue()
    {
        Debug.Log("End of conversation.");
    }
}

Next the DialogueTrigger:

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

public class DialogueTrigger : MonoBehaviour
{
    public Dialogue dialogue;

    public void TriggerDialogue()
    {
        FindObjectOfType<DialogueManager>().StartDialogue(dialogue);
    }
}

Last the Dialogue:

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

[System.Serializable]
public class Dialogue
{
    public string name;

    [TextArea(3, 10)]
    public string[] sentences;
}

In the editor I filled the all 3 TextAreas each one with a sentence.

Hello world

Hi everyone

I have woke up

When running the game it's showing only to the Hi everyone it's not showing the I have woke up.
And it also not showing the "End of conversation." in the log.

sentences:
indices for surface of revolution I'd like to implement a surface of revolution.

I already implemented creating Vertices based on a 2D line.
I now want to get the indices to render the mesh with GL_TRIANGLES

Here's the code to create the 3D Vertices out of a 2D line:

void createVertices(vector<Vector2>& points,unsigned int iterations)
{
    int i;
    int j;

    unsigned int index;

    vector<Vertex> newVertices;
    vector<unsigned int> newIndices;
    for(j = 0; j < points.size();++j)
    {
        for(i =0; i < iterations;++i)
        {
            Vector2 p = points.at(j);
            float theta = M_PI*2.0*(float)i/(float)iterations;
            float x = sinf(theta)*p.x;
            float z = cosf(theta)*p.x;
            newVertices.push_back(Vertex(x,p.y,z));
        }
    }
}

and here's the code that will be called to save the Vertices:

void addVertices(vector<Vertex>& vertices,vector<unsigned int>& indices)
{
    this->vertices = vertices;
    this->indices = indices;

    unsigned int verticesSize = vertices.size() * sizeof(Vertex);
    unsigned int indicesSize = indices.size() * sizeof(unsigned int);

    float* vertexBuffer = new float[vertices.size()*sizeof(Vertex)];

    createBuffers(vertices,vertexBuffer);

    glGenVertexArrays(1,&VAO);
    glBindVertexArray(VAO);

    glGenBuffers(1,&verticesVBO);
    glBindBuffer(GL_ARRAY_BUFFER,verticesVBO);
    glBufferData(GL_ARRAY_BUFFER,verticesSize,vertexBuffer,GL_STATIC_DRAW);

    glGenBuffers(1,&indicesVBO);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,indicesVBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER,indicesSize,&indices[0],GL_STATIC_DRAW);

    delete[] vertexBuffer;
}

someone has a basic idea?

sentences:
How to maximize enclosed area and minimize perimeter on a grid with obstacles? Developing an RTS game, I have a tile-based terrain (grid) filled with obstacles. It looks like this (red shapes are obstacles):

Now I need to plan an enclosed area on the terrain with some restrictions:

tile marked with a "star" must be included (it is a seed)
area needs to be at least 20 tiles (for this example)
farthest area tile from the seed needs to be no more than 7 steps away (for this example)
area needs to traversable by moving in 4 directions
area should be bound by existing obstacles and by new fences
new fences building takes time and resources, it is beneficial to use existing obstacles as much as possible and have the smallest number of fences placed.
there are cases where terrain could be free of any obstacles, or contrary to that - be a maze-like labyrinth)
it is okay to fail (e.g. there's not enough walkable tiles around the seed), or the area/fences ratio is too low.
processing is done on CPU (if that matters)

So, here are some "manual" attempts at outlining an area of required size using the least fences:

As you can see, there are 3 enclosed areas (green, blue, orange) with very similar perimeters, yet different areas. Best one in this case would be "green" one - it has the least fences added (just 10) and has the sufficient area (21).
What is the algorithm to allow to plan area of given size (~20) while minimizing the amount of additional fences required?

So far I have tried to take the larger area and try to clip it - using BFS to get the area within possible reach (7 steps), clipped the last step (since it is touching the unexplored and has no neighbor info) and clipped the obvious protruding buds - leaves plenty of tiles to work with. I'm out of good ideas on how to improve from that:

yellow tile is the seed
red tiles are walkable (saturation shows distance from the seed)
dark grey tiles are obstacles
light grey tiles are obstacles that also need fences
purple tiles got clipped by existing incomplete algo
black tiles are unexplored
yellow dashes are required fences

As you can see, it looks quite sub-optimal, but I'm at loss as to how to proceed.

sentences:
How to search for a visible player? I've an enemy static tank with a "rotable" cannon turret.
I would like to rotate it in the player's direction .
How to implement it ?
I've thought something like

void Update {
    SearchForPlayer();
    RotateTurret();
}

I don't know how to implement a sort of radar function.
Thanks

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 approach a coloring app? I want to make a coloring app in unity. I don't need flood filling. THe player will select a color and click the shape to fill that color. The app will have designs as shown below:

Here the problem is, design has to be empty with black outline. One way would be to create textures using the jpg of each shape. However, there are thousands of shapes and each can be colored in about 7 colors. So, i will have to create 7 textures for each shape.Is there any way to create model with black outline so that only inner color can be changed?

sentences: Finding if a point is inside of a mesh (Point-in-polyhedron) How can I find if a point (Vector3) is inside of a mesh? Would this work for both concave and convex objects? I read somewhere that if you raycast in both directions of every axis (X, -X, Y, -Y, Z, -Z), take the count of the hits, and if it is even it is outside, if it is odd it is inside. I tried this and it didn't work.

sentences:
Question about JPanel "transition" for Java Swing I want to make like a sort of main menu (in GUI).
When the user clicks the start button, the screen transition into another "screen" (JPanel). This image will make it easier to understand.
http://i.imgur.com/Cfdry.png

Currently, I have a MainMenu extends JPanel and that gets added into a driver class with a JFrame. I can't figure how to switch to another class like Game extends JPanel.
So when the user clicks the start button in MainMenu, I want it to somehow hide itself and the Game to show itself.
Thanks.

sentences:
I want to test the Animator component of a gameobject using nunit, but I am having issues I made a Blender 3D model with animations. Then I used the Animator Controller, and attached it to the model. The Animator Controller has a few Boolean parameter variables like isWaving, isDoing, and isIdle and more variables like that. If, say, a non-idle action is true, then the animation of my model transitions to the next one. I am into test-driven development, but I have never done it with Unity.

I tried writing the following code to test my project:

[SetUp]
public void SetUp()
{
    Crystal = GameObject.FindGameObjectWithTag("CrystalModel");
    CrystalScript = Crystal.GetComponent<CrystalChanPlayer>();
    CrystalAnimator = Crystal.GetComponent<Animator>(); // unity game animator
}

[Test]
public void ifSetAnimationIstodoThenToDoAnimationIsPlayed()
{
    CrystalScript.setAnimationStrategy("todo"); // set strategy
    CrystalScript.playAnimation(); // sets todo boolean to true and idle to false

    // first debug output
    Debug.LogError("todo is " + CrystalAnimator.GetBool("isDoing") +
        " idle is " + CrystalAnimator.GetBool("isIdle"));

    //second output
    Debug.LogError("current state is " +
        CrystalAnimator.GetCurrentAnimatorStateInfo(0).IsName("idle"));

    Assert.True(CrystalAnimator.GetCurrentAnimatorStateInfo(0).IsName("todoAnimation"));
}

I received the following output:

  "todo is true and idle is false"
  "true"

I think this is because Unity isn't really running, and my Animator doesn't get to update based on the variable changes. The first output assures me that todo is set to true and idle is false, hence the Animator should transition that animation to the todoAnimation. Yet, I can't seem to show that, in my tests.

Is there any way to test the Animator class? Are there any design patterns I can use?

sentences:
Problems with BlendOp Max I'm trying to write a shader that doesn't blend additively etc etc. I'd like to take whichever of the source or destination colours is brighter and use that and BlendOp Max seemed like the tool for the job.

However, as you can see below, the shadow of one light seems to be occluding the other, which doesn't match up with how I understand BlendOp Max is supposed to work:

Unity Docs
NVidia
OpenGL

Could anyone clarify where I'm going wrong or provide an alternative?

Interestingly, Blend One One is working fine, however, BlendOp Add (along with all the other BlendOps apart from the 'logical' ones) are creating the same issue.

Update

Shader Code:

Shader "Lantern/Flat Pullup" {
Properties {
    _LitTex ("Lit (RGB)", 2D) = "white" {}
    _UnlitTex ("Unlit (RGB)", 2D) = "white" {}
    _Pullup ("Pull up Point", Range(0,1)) = 0.7
    _BlendSize ("Blend Size", Float) = 0.3
}
SubShader {
    Pass{
        Tags { "LightMode" = "ForwardBase" }
        LOD 200

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        uniform sampler2D _UnlitTex;
        uniform float4 _UnlitTex_ST;
        uniform sampler2D _LitTex;
        uniform float4 _LitTex_ST;
        uniform float _Pullup;
        uniform float _BlendSize;

        uniform float4 _LightColor0;

        struct VI {
            float4 vertex : POSITION;
            float4 tex : TEXCOORD0;
        };

        struct V2F {
            float4 pos : SV_POSITION;
            float4 tex : TEXCOORD0;
            float4 posWorld : TEXCOORD1;
        };

        V2F vert(VI v){
            V2F o;
            o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
            o.tex = v.tex;
            o.posWorld = mul(_Object2World, v.vertex);
            return o;
        }

        float4 frag(V2F i) : COLOR {
            float3 flatReflection = _LightColor0.xyz *
                (1 / length(_WorldSpaceLightPos0.xyz - i.posWorld.xyz));

            return lerp(
                tex2D(_UnlitTex, i.tex.xy * _UnlitTex_ST.xy + _UnlitTex_ST.zw),
                tex2D(_LitTex, i.tex.xy * _LitTex_ST.xy + _LitTex_ST.zw),
                clamp((length(flatReflection) - _Pullup + _BlendSize) / (2 * _BlendSize), 0, 1)
            );

        }

        ENDCG
    }

    Pass{
        Tags{"LightMode" = "ForwardAdd"}
        //Blend One One
        BlendOp Max
        LOD 200
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        uniform sampler2D _UnlitTex;
        uniform float4 _UnlitTex_ST;
        uniform sampler2D _LitTex;
        uniform float4 _LitTex_ST;
        uniform float _Pullup;
        uniform float _BlendSize;

        uniform float4 _LightColor0;

        struct VI {
            float4 vertex : POSITION;
            float4 tex : TEXCOORD0;
        };

        struct V2F {
            float4 pos : SV_POSITION;
            float4 tex : TEXCOORD0;
            float4 posWorld : TEXCOORD1;
        };

        V2F vert(VI v){
            V2F o;
            o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
            o.tex = v.tex;
            o.posWorld = mul(_Object2World, v.vertex);
            return o;
        }

        float4 frag(V2F i) : COLOR {
            float3 flatReflection = _LightColor0.xyz *
                (1 / length(_WorldSpaceLightPos0.xyz - i.posWorld.xyz));
            return lerp(
                float4(0,0,0,1),
                tex2D(_LitTex, i.tex.xy * _LitTex_ST.xy + _LitTex_ST.zw),
                clamp((length(flatReflection) - _Pullup + _BlendSize) / (2 * _BlendSize), 0, 1)
            );
        }
        ENDCG

    }
}
FallBack "Diffuse"
}

Update 2

The same plane and lights rendered using Unity's standard shader, for illustrative purposes.

sentences:
Creating an OpenGL FPS camera: I have the position and orientation vectors, now what? I have been struggling to create a first person camera in OpenGL ES 2.0 without using gluLookAt(). I grab the camera's orientation vectors (the way it's looking) from the current modelview matrix, and use that to calculate the new forward/backward (Z) translation value. I then calculate the strafe (X) value from the dot product of Z and Y (which is always 1.0). So, I have all the information I need to create a view matrix, but how do I do that without using gluLookAt? Almost all the examples I've seen use gluLookAt, but no such function exists in OpenGL ES 2.0. Besides, one of the moderators on cprogramming.com mentioned that gluLookAt is not appropriate for FPS cameras:

http://cboard.cprogramming.com/game-programming/135390-how-properly-move-strafe-yaw-pitch-camera-opengl-glut-using-glulookat.html

I am really confused by all the conflicting information I'm getting. I just want to create a first person camera that goes forward (W,S keys), side-to-side (A,D keys) and rotates around its center (Y axis only), Wolfenstein style.

Here's more-or-less my existing code:

vec4 cur_look,dir_move,dir_strafe,cam_pos;
mat4 mat_modelview,mat_rot,mat_temp;
float lr; //left/right keypress increment value
float ud; //up/down keypress increment value

//grab current camera orientation (look at) from the modelview matrix
cur_look[0] = mat_modelview[8];
cur_look[1] = mat_modelview[9];
cur_look[2] = mat_modelview[10];
cur_look[3] = mat_modelview[11];

//rotate the direction vector using the rotation matrix
mat4_identity(mat_rot);
mat4_identity(mat_temp);
mat4_rotate_Y(mat_rot,mat_temp,lr); //create rotation matrix

//multiply the current direction vector by the rotation
//matrix and place the result in dir_move
mat4_mul_vec4(dir_move, mat_rot, cur_look);

//normalize the fwd/back direction vector
vec4_norm(dir_move,dir_move);

//calculate strafe vector using cross product of Z and Y
vec4_cross(dir_strafe,dir_move,(vec4){0.0,1.0,0.0,0.0});

//normalize strafe vector
vec4_norm(dir_strafe,dir_strafe);

//detect key input

//FWD/BACK
if(key_pressed == 'w'){
    cam_pos[2] += (dir_move[2] * -INPUT_SENS_Z); //z
}
if(key_pressed == 's'){
    cam_pos[2] += (dir_move[2] * INPUT_SENS_Z); //z
}

//ROTATION
if(key_pressed == LEFT_ARROW){
    lr += INPUT_SENS_ROT;
}
if(key_pressed == RIGHT_ARROW){
    lr +=  -INPUT_SENS_ROT;
}

//build new modelview matrix
mat4_identity(mat_modelview);

//multiply modelview matrix by rotation matrix
mat4_mul(mat_modelview,mat_modelview,mat_rot);

//create translation matrix
mat4_translate(mat_tran,-cam_pos[0], 0.0, -cam_pos[2]);
//multiple modelview matrix by translation matrix
mat4_mul(mat_modelview,mat_modelview,mat_tran);

//update uniforms and draw scene using glDrawArrays()
glUniformMatrix4fv(loc_modelview, 1, GL_FALSE, mat_modelview);

Any help on this would be much appreciated!

sentences: Looking for JMonkeyEngine tutorials and documentation I'm looking for tutorials and documentation for JMonkeyEngine, beside the material on the official website. Any clue?

sentences:
How can I increase framerate, when drawing tiles to a HTML canvas? I am using the HTML 5 canvas to make a simple platformer game. I am currently drawing the tiles using a for loop that runs through a list of tiles and checks if they will be drawn to the screen.

for (var i = 0; i < tiles.length; i++) {
    if (tiles[i].x + scale > pos.x - (canvas.width / 2)
            && tiles[i].x < (pos.x + scale) + (canvas.width)) {
        canvas.drawImage(tiles[i].x - pos.x, tiles[i].y - pos.y, scale, scale,
                "img/Tiles/" + tiles[i].Tile + ".png")
    }
}

I am also using this custom library to draw the image to the screen:

this.drawImage = function(x, y, width, height, src, alpha) {
    if (alpha) {
        ctx.globalAlpha = alpha
    }

    if (document.getElementById(src) == undefined) {
        document.head.innerHTML
                += ''
    }

    var img = document.getElementById(src)
    ctx.drawImage(img, x, y, width, height);
    ctx.globalAlpha = 1.0
    document.getElementById(src).outerHTML = ""
}

When I run the for loop, the frame rate of the game seems to drop. Is there an alternate option to going through every element of the array that I'm not aware of?

sentences:
Texture filtering of look-up table in post process shader I am doing post processing by drawing to an FBO and then applying a certain fragment shader when drawing the FBO's texture to the screen. I want to use a look-up table texture to apply color grading. Since I am targeting OpenGL ES 2.0 and possibly older PCs, I cannot use 3D textures. Instead I can use a 2D texture as an atlas of the layers of my 3D look-up table.

What I'm concerned about is correctness and performance when the texture lookup is performed. My look-up texture needs to have linear filtering so I don't have to have a full 256^3 sized look-up table to cover all hues.

My fragment shader would look something like this: Round B up and down to get the two regions of the texture to sample from, add offsets accordingly to R/G and sample the texture twice with the two offset .rg values. And finally linearly interpolate based on B.

But I as I understand it, the when the GPU encounters a texture2D call on a texture with linear filtering, it will be calculating the input coordinates for those calls for neighboring pixels in parallel to get a derivative. This derivative is used to determine how to sample the texture pixels.

Since this is a post process, I don't want two neighboring pixels to influence each other. It could be a black pixel from the edge of a sprite next to a bright blue sky pixel. In the look-up table, these two would need to sample distant points. So is the GPU going to decide the derivative is huge (minification) and try to linearly sample and involve all the random in-between texels on my look-up table?

Is there a way to get my linear filter to ignore neighboring pixels and only interpolate from the 4 nearest texels? Sort of like treating everything as magnification?

The problem is similar to this question that was asked in regards to HLSL, but I'm targeting OpenGL 3.0 and OpenGL ES 2.0: Color grading, shaders and 3d textures

sentences:
Implementing a FSM with ActionScript 2 without using classes? I have seen several references of A.I. and FSM,
but sadly I still can't understand the point of an FSM in AS2.0.
Is it a must to create a class for each state?

I have a game-project which also it has an A.I.,
the A.I. has 3 states: distanceCheck, ChaseTarget, and Hit the target.

It's an FPS game and played via mouse.

I have created the A.I. successfully, but I want to convert it to FSM method...

My first state is CheckDistanceState() and in that function I look for the nearest target and trigger the function ChaseState(), there I insert the Hit() function to destroy the enemy,

The 3 functions that I created are being called in AI_cursor.onEnterframe.

Is there any chance to implement an FSM without the need to create a class?
From what I've read before, you have to create a class. I prefer to write the code on frames in flash and I still don't understand how to have external classes.

sentences:
Light levels - How to determine if a character should be spotted Our team is trying to develop a stealth system with the UDK. Part of this will involve lighting.

The idea being that if you're hiding in a dark corner of the room, the armed goons will not start attacking you.

I've been looking for a few hours now. And while I can't say I have no leads it seems that now is a good time to start asking for help.

At the simplest level, I'm looking for a way to determine how brightly lit an actor is (primarily the player right now).

A bit beyond that, what they are wearing might also be a factor. Someone wearing solid dark clothing is going to be harder to spot than someone in a loud Hawaiin t-shirt covered in (given the stealth context probably stolen) diamonds.

The lighting will be dynamic, so the solution needs to be dynamic. As an example, a guard might get rather upset, grab a torch on the wall and throw it in your direction.

sentences:
How do I merge colliders in a tile-based game? I'm doing a tiled based platformer in unity, and I was having some issues with collisions and I figured the problem was the way my colliders were arranged.

So right now, my collision look like this:

You see each tile has its own collider, outlined in black. Polygon colliders in unity are formed by lists of points in space, and I can manipulate them freely.
What I would ultimately want, is to have all this colliders in the example image to merge into just two colliders ( or maybe one, depending on how the edges of those squares touching would be handled ):

How could I achieve that? Is there any known algorithm?

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:
Bad quality of the sprite in Unity I need to import a few sprites (background platform and sky) into my game scene but it seems that their quality after importing into Unity is too bad (they are blurred). The original resolution of this two images is big enough (2048 X 400 for background) and they are looking very nice in standard Windows image viewer. Here are the settings for these two textures:

maxSize = 2048
Format = truecolor
TextureType = Sprite(2d)/nGUI
FilterMode - point

I am using Unity2D 4.5 Target resolution of my project is 1280*800.

Can anyone help me to solve these problem?
As you can see the grass on foreground looks very bloory (1 picture)
Texture settings (2 picture)
Original image (3 picture)

sentences:
How do I calculate the required force to launch an object? I want to use a rigidbody AddForce() method on an object to launch it over from the enemy to the player, like throwing a ball at a target.
The problem is, I'm not sure how much force is required to use in the AddForce() method and it is taking too long to figure it out, and adding to that, the force would be different if I was farther away.
I found this helpful guide but it is not in 3D: https://forum.unity.com/threads/how-to-calculate-force-needed-to-jump-towards-target-point.372288/#post-2415612.
Could someone explain step by step in an easy to understand manner how to calculate the force required to get an object launched perfectly onto a target? (I'm not very good at math, haha...) Here's some images from that thread that will help illustrate the desired result:

sentences:
Unity Augmenter Reality on Android with Video playing Hey sisters and brothers,
So, I created an augmented reality marker, which works perfectly, I was able to display 3 shape on the screen with my Nexus 5.

I would like to replace my shapes with a Video. So, when the user track on the marker, I would like to start to play a video above the marker as a part of the augmented reality (No full screen playing).

I tried to use this video tutorial (https://www.youtube.com/watch?v=YBc3ubr18ks) , but on Android you can't use MovieTexture (they say).

My question(s): how can I display a shape above the marker, with a video on it and what it the video format ? When I trying to build the project with mp4, it failing, but when I do with AVI it's okay, but the app crashing.

Thank you,

sentences:
Java JBullet Mesh collsion problem I have a problem with JBullet mesh collsion. Everything works fine when I create a mesh from my object without scaling, but the problem starts when I want to scale the object. I also tried scaling in Blender, but it has the same problem. Here is my code for creating a mesh from an object:

    int numtriangles = mesh.vertices.length / 3;
    int numverts = mesh.vertices.length;

    ByteBuffer indexBuffer = BufferUtils.createByteBuffer(numverts * 3 * 4).order(ByteOrder.nativeOrder());
    indexBuffer.clear();
    for(int i=0;i<numtriangles;i++) {
       indexBuffer.putInt(i);
       indexBuffer.putInt(i);
       indexBuffer.putInt(i);
    }

    ByteBuffer geometry = BufferUtils.createByteBuffer(numtriangles * 3 * 4).order(ByteOrder.nativeOrder());
    geometry.clear();
    for(int i=0;i<numtriangles;i++) {
       geometry.putFloat(mesh.vertices[i].getPos().x);
       geometry.putFloat(mesh.vertices[i].getPos().y);
       geometry.putFloat(mesh.vertices[i].getPos().z);
    }

    geometry.rewind();
    indexBuffer.rewind();

    TriangleIndexVertexArray trimesh = new TriangleIndexVertexArray(numtriangles, indexBuffer, 3 * 4, numtriangles, geometry, 3 * 4);
    BvhTriangleMeshShape shape = new BvhTriangleMeshShape(trimesh,true);
    return shape;

My scaling was something like this:

    for(int i = 0; i < vertices.length; i++) {
        Vertex acc = vertices[i];

        Vector3 pos = acc.getPos();
        pos.x *= scale.x;
        pos.y *= scale.y;
        pos.z *= scale.z;
        acc.setPos(pos);

        Vector2 tex_coord = acc.getTexCords();
        tex_coord.x *= scale.x;
        tex_coord.y *= scale.z;
        acc.setTexCords(tex_coord);

        vertices[i] = acc;
    }

The problem is when I scale the object, it no longer collides with other objects.

sentences:
Make openGL program only update every 1/60 seconds I'm learning C++ and openGL and have this program as a result from tutorials and playing around. The problem is that the main loop is running at "full speed", making the program unnecessarily cpu intensive. I have managed to make it only perform rendering every 16.7 ms or so, but the outside loop that is waiting to render still is iterating as fast as my computer can handle.

This is the full main.cpp:
http://pastebin.com/KaCW7wZw

This is the main loop at line 95:

while (!terminate) {
    if (SDL_GetTicks() >= time_start + frame_rate)
    {
        time_start = SDL_GetTicks();
        while (SDL_PollEvent(&event))
        {
            if (event.type == SDL_QUIT) {
                terminate = true;
                break;
            }
        }

        glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        renderLoop(entities, &counter);
        SDL_GL_SwapWindow(m_window);;
        counter += 1.0f;
    }
}

I've tried googling and haven't found anything concrete (obviously), except that using some kind of sleep is bad design for these loops.

So how can I alter this to slow the whole thing down, and avoid having 100% cpu usage for a program that's not doing much at the moment?

sentences:
How to change the border color of a button in libGDX? How to change the border color of a button. I know how to change the background, but I don’t know this, although I reviewed the entire documentation.
And is it possible to find out whether the button is pressed or not

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:
How to prevent corner slipping with a shortest axis collision solver Currently I use AABB's to represent objects in my game engine, I resolve collisions between them by finding the shallowest axis, but this leads to a problem if an object is approaching another in a way that their corners would collide at a fast velocity, they will slip past each other and resolve on the wrong axis because one penetrated too deeply, for example:

We can see that the red square is approaching the green rectangle. They intersect and the solver sees that the smallest intersection is on the Y axis

Thus they sepparate on the Y axis, and the red square flies by the green rectangle, when it should have stopped on the left edge

I'm currently at a loss on how to solve this, any sugestions or fixes would be greatly appreciated!

sentences:
How should I handle a modelview stack with multiple shader programs involved? I'm building a framework where each object has an associated program and each object has a 'draw' method.

What is the best choice, to have a single modelview stack handled by a Renderer class or to have a modelview stack for each program? In the preferred case how can I handle optimally a "world" transformation that affects all the objects independently by the program (i.e. moving the camera)

sentences:
OpenGL VBO - load a normals index Okay I have the following code that works correctly. It loads a vertex array, a normal array and a vertex index array then draws them with some simple light shading.

To load the buffers:

//Load Buffers
//vertices
glGenBuffers(1, &vertexbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, verts.size() * sizeof(verts), &verts[0], GL_STATIC_DRAW); //verts is std::vector<float>
//normals
glGenBuffers(1, &normalbuffer);
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer);
glBufferData(GL_ARRAY_BUFFER, normals.size() * sizeof(normals), &normals[0], GL_STATIC_DRAW); //normals is std::vector<float>
//indices
glGenBuffers(1, &elementbuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(GLushort), &indices[0] , GL_STATIC_DRAW);
//indices is std::vector<unsigned short> and in this working example only
//contains indices into the vertex array (I will add interleaved normal indices)

To draw the buffers:

//Draw Object
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_NORMAL_ARRAY );

//vertices
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE, 0, (void*)0);
glEnableVertexAttribArray(0);

//Indices
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);

//Normals
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer);
glNormalPointer(GL_FLOAT, 0, (void*)0 );

//Draw the mesh
glDrawElements( GL_TRIANGLES, indices.size(), GL_UNSIGNED_SHORT, (void*)0);

//Clean up
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);

In this code, normals are not indexed. I would like to change it so that the normals are based on the the index in indices[] (same as vertices are now). indices[] is interleaved (not in the above code) as such: {vertex index,normal index,vertex index,normal index...}.

I've been trying to get this to work for some time without success and every example I've found online seems to use a different approach to VBOs making it very difficult to combine multiple examples into one that does what I need.

Help would be greatly appreciated. And if I'm doing anything in a less than ideal way, I'm open to suggestions.

sentences:
How can I get a Box Collider's "corners" (vertices) positions? I attached a Box Collider to a object, which has not the center as its pivot.
Now I need the 8 corner points.

Right now I can only get the points in a unrotated state. But whenever I rotate the Object (which rotates in the center of the boxCollider) - everything gets messed up, because the rotation alters the gameObject-Position.

EDIT2: Solution

public Vector3[] GetColliderVertexPositions (GameObject obj)
{
    BoxCollider b = obj.GetComponent<BoxCollider>(); //retrieves the Box Collider of the GameObject called obj
    Vector3[] vertices = new Vector3[8];
    vertices[0] = obj.transform.TransformPoint(b.center + new Vector3(-b.size.x, -b.size.y, -b.size.z) * 0.5f);
    vertices[1] = obj.transform.TransformPoint(b.center + new Vector3(b.size.x, -b.size.y, -b.size.z) * 0.5f);
    vertices[2] = obj.transform.TransformPoint(b.center + new Vector3(b.size.x, -b.size.y, b.size.z) * 0.5f);
    vertices[3] = obj.transform.TransformPoint(b.center + new Vector3(-b.size.x, -b.size.y, b.size.z) * 0.5f);
    vertices[4] = obj.transform.TransformPoint(b.center + new Vector3(-b.size.x, b.size.y, -b.size.z) * 0.5f);
    vertices[5] = obj.transform.TransformPoint(b.center + new Vector3(b.size.x, b.size.y, -b.size.z) * 0.5f);
    vertices[6] = obj.transform.TransformPoint(b.center + new Vector3(b.size.x, b.size.y, b.size.z) * 0.5f);
    vertices[7] = obj.transform.TransformPoint(b.center + new Vector3(-b.size.x, b.size.y, b.size.z) * 0.5f);

    return vertices;
}

Found that:

Most efficient way to get the world position of the 8 vertexes of a Box Collider (C#)

sentences:
Python/java framework for developing artificial intelligence for board games like Diplomacy/Risk I am trying to pick a python/java framework for developing artificial intelligence for board games like Diplomacy/Risk for research purpose. I am specifically looking for multiplayer, multiple-round games without any dominant strategies that require players to cooperate as well as non-cooperate at certain times.

The idea of the research is to not build the game itself or the AI bot, but to discover novel methods for game theory, specifically to deceive other players- bots or humans.

This research is specifically based on Deceptive Artificial Intelligence. Please share any frameworks(game code with stubs for decision making) that you may know about. It would be a lot of help for my work.

If you have any ideas about some other game that I can pick, please mention that as well.

I have tried a few frameworks but the lack of documentation is extremely annoying and I haven't been able to move forward in the process.

Thanks and Regards!

sentences: How do you make use of all texture units on today's graphics cards? I saw a review of the GeForce GTX 460 graphics card.  It has 56 texture units.  I'm not that knowledgeable about graphics effects.  But, the ones I know use around 3 or 4 texture units.  In this graphics card case, that would leave a lot of texture units idle.  How are these graphics cards with so many texture units used?

sentences:
Why does the engine crash when I POST data to a server? I am working on communications between my game and a cloud database. I'm working on the authentication part but when I try to pass data to the server in a POST the engine crashes. If I pass in a simple string like "username" it does not crash and I get an error response from the server as expected. But when I try to pass in a JSON string the engine crashes. Here is my code:
OnAuthCookieResponse = cookieResponseDelegate;
TSharedRef<IHttpRequest> request = FHttpModule::Get().CreateRequest();
FString url = NewObject<UURLBuilder>()
     ->Host(BASE_URL)
     ->Path(SESSION)
     ->Build();

request->SetURL(url);
request->SetVerb("POST");
request->SetContentAsString("{\"username\":xxxxxxxx}");
request->OnProcessRequestComplete().BindUObject(this, &UAClass::ReceivedAuth);
request->ProcessRequest();

The stack trace points me to line 559 in CurlHttp.cpp. IsURLEncoded() returns false which causes the check() to fail.
check(!GetHeader("Content-Type").IsEmpty() || IsURLEncoded(RequestPayload));

However when the engine passes data here, IsURLEncoded() returns true and the check() passes. Here is a sample of some data from the engine that passes. You can see it is a JSON string.

Here is what my data looks like that causes the engine to crash

You can see they are both JSON strings but mine causes the check to fail. I have also tried to completely URL encode the JSON string and the check still fails.
So why does this fail for me but passes when used by the engine?

sentences:
How can I dissuade alliances? I'm designing a game where players are able to form alliances with each other.

The game has two winning conditions: When all other players are eliminated, the remaining player wins; or if all the teams work together to solve the problem that was set them against each other in the first place, then they all win.

I'd like to encourage the single player victory, as it's more fun, but I don't want to flat-out remove the cooperative victory.

How would I go about discouraging players from attempting to cooperate with each other?

One idea I had was to make alliances a vector for mistrust - alliances might be able to steal items from each other, for example.

For some small amount of context: the game involves capturing territory and destroying territory belonging to other players. When a player runs out of territory they are eliminated.

Cheers for any suggestions!

sentences:
Maya keyframe animation to unity Sorry guys! I am super new to this, and I'm trying to teach myself Unity. I have a very small knowledge of Maya from a 3d modeling course I took a year ago in college, and have made a very simple object and animated it using keyframes (2 keyframes to be exact) in maya, but I can't seem to figure out how to get that animation into Unity.

I've been playing around with this for hours now, and all the tutorials and such I find online are for really complex objects like people, and they have joints and stuff going on. Are joints required for an animation to work in Unity?

I've saved my maya file into my assets folder, but I don't see any animations in the import settings in Unity.

Here is my object:

And it animates to this position:

sentences:
How to sync entities in an ECS game? I'm wondering how to engineer a client server sync of entities in a multiplayer game which is using an ECS.

When the server changes some values of the components of an entity, I thought the best approach is to send a new update message over the network,
which holds some ID or name of the entity. And then on the client site, I'm trying to resolve the client-side-counterpart of that entity.

But, In my ECS solution (ashley) the entities are not held in a list. So I can't just search for a special entity by ID or something.

I was thinking about giving every entity a new component like "NetworkSyncComponent" which holds an ID, but than
I have to iterate over all entities on the target system which are holding such an component. This seems very bad and slow approach for me.

TL;DR
Can you tell me what a better (faster/performance optimized) technique could look like?

sentences: How can I scale/zoom to a point in canvas in the game? I am using html5 canvas to build a MMO game. When I scale my background by default it scales to (0, 0) which is the top left corner of the background. If I have other sprites on the screen they all will look like they are shifting to the bottom right a little bit. Suppose my sprite(player) is at (x,y) of the map and it is placed center on the canvas.How can I make the background scale or zoom to (x,y) instead of (0,0)? Its world position is (x,y) but its screen position is always (canvas.width / 2, canvas.height / 2). I think in this way the sprites around my player wouldn't shift their position to unexpected places. But I don't know how to do this.

sentences:
Moving with rotating in 3D world in Libgdx I'm trying to create a first person system in my game which consist of a big cube with grass texture , so the problem happens when I move and try to rotate the camera the world rotate and I'm not on the main axis this is code

Vector3 position = new Vector3();

private void movement() {
    block.transform.getTranslation(position);
    position.x = x;
    position.z = z;
    position.y = y;
    block.transform.setTranslation(position);

}

private void rotate() {
    //camera.rotate(Vector3.Y,angleX);
    //block.transform.rotate(Vector3.Y,360.0f - angleY);
    block.transform.setFromEulerAngles(angleY, 0, 0).trn(position.x, position.y, position.z);
    carinstance.transform.rotate(Vector3.Y,angleY);
}

@Override
public void render () {
    Gdx.gl.glClearColor(.5f, .7f, .9f, 1);
    Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT|GL30.GL_DEPTH_BUFFER_BIT);

    movement();
    rotate();

    modelBatch.begin(camera);
    modelBatch.render(modelInstance,environment);

    modelBatch.end();
    camera.update();

}

I know that we must rotate the world and move it not the camera and I did this in openGL so I used

glrotatef(anglex,0,1,0);

To rotate the all world but in libgdx I can't find a way to do this .

I just want a way to move and rotate camera in libgdx.

sentences:
Understanding dot notation Here's my interpretation of dot notation:

a = [2,6]
b = [1,4]
c = [0,8]
a . b . c = (2*6)+(1*4)+(0*8) = 12 + 4 + 0 = 16

What is the significance of 16? Apparently it's a scalar.

Am I right in thinking that a scalar is the number we times a unit vector by to get a vector that has a scaled up magnitude but the same direction as the unit vector? So again, what is the relevance of 16? When is it used? It's not the magnitude of all the vectors added up.

The magnitude of all of them is calculated as follows:

sqrt( ax * ax + ay * ay ) + sqrt( bx * bx + by * by ) + sqrt( cx * cx + cy * cy)
sqrt( 2 * 2 + 6 * 6 ) + sqrt( 1 * 1 + 4 * 4 ) + sqrt( 0 * 0 + 8 * 8)
sqrt( 4 + 36 ) + sqrt( 1 + 16 ) + sqrt( 0 + 64)
sqrt( 40 ) + sqrt( 17 ) + sqrt( 64)
6.3 + 4.1 + 8
10.4 + 8
18.4

So I don't really get this diagram:

Attempting with sensible numbers:

a = [1,0]
b = [4,3]

a . b = (1*0) + (4*3) = 0 + 12 = 12

So what exactly is a . b describing here? The magnitude of that vector? Because that isn't right:

the 'a.b' vector = [4,0]
sqrt( x*x + y*y )
sqrt( 4*4 + 0*0 )
sqrt( 16 + 0 )
4

So what is 12 describing?

sentences: What use for a 3d browser based multiplayer online game? Can you help me choosing the right tools for this project? It's a 3d browser based multiplayer online fighting game. A few 3d functions are necessary for positioning, but no heavy rendering will happen. It needs very low ping rates, though, as it will be very dynamic. HTML5 + three.js + some networking lib seems like a fair choice, but I'm concerned about performance and cross-browserism. It's for learning purposes but I can use it for professional showoff. Thoughts?

sentences:
How to construct this collision vector? I have a 3d game, but for movement I use only two axes (X and Z) - X is vertical, Z is horizontal

Here's what I'm trying to achieve:

Player is the circle, InputDirection is Blue, NewInputDirection is Green.
I'm struggling on getting the desired green direction.

Image 1
The player moves up (he's pushing onto the wall)

InputDirection: (-1f, 0f, 0f)

NewInputDirection: (0f, 0f, 0f) because we should stop him.

Image 2
The player moves towards the wall and the bottom. When he reaches the wall, his horizontal axis should be blocked - set to 0, so he slides)

InputDirection: (0.5f, 0f, -0.5f)

NewInputDirection: (0.5f, 0f, 0f)

Image 3
Same thing as above, but the wall is rotated.

Right now, my code looks like this:

RaycastHit hit;
bool collides = Physics.Raycast(this.playerRigidbody.position, inputDirection, out hit, 1f); // ray in front of the player

if(collides){ // if there's a collision
    // calculate the direction from the player to the collision contact point
    Vector3 collisionNormal = (hit.point - playerRigidbody.position).normalized;
    // idk...
}

I don't know how to calculate it. I've tried various ways. Should I also take the wall's rotation into account?

sentences:
Implementing a switch statement based on user input I'm trying to delay the time it takes for the main menu screen to pop up after a user has won / lost a match. As it stands, the game immediately displays a message stating "you won / lost" and waits for 6 seconds before loading the menu screen.

I would also like players to have the ability to press a key to advance to the menu screen immediately but thus far my switch statement doesn't seem to do the trick. I've included the switch statement, along with my (theoretical) inputs. What could I be doing wrong here?

if (gamestate == GameStates.End)
                    switch (input.IsMenuDown(ControllingPlayer))
                    {
                        case true:
                            ScreenManager.AddScreen(new MainMenuScreen(), null); // Draws the MainMenuScreen
                            break;

                        case false:
                            if (screenLoadDelay > 0)
                            {
                                screenLoadDelay -= gameTime.ElapsedGameTime.TotalSeconds;
                            }
                            ScreenManager.AddScreen(new MainMenuScreen(), null); // Draws the MainMenuScreen
                            break;
                    }

     /// <summary>
    /// Checks for a "menu down" input action.
    /// The controllingPlayer parameter specifies which player to read
    /// input for. If this is null, it will accept input from any player.
    /// </summary>
    public bool IsMenuDown(PlayerIndex? controllingPlayer)
    {
        PlayerIndex playerIndex;

        return IsNewKeyPress(Keys.Down, controllingPlayer, out playerIndex)
               || IsNewButtonPress(Buttons.DPadDown, controllingPlayer, out playerIndex)
               || IsNewButtonPress(Buttons.LeftThumbstickDown, controllingPlayer, out playerIndex);
    }

sentences: 3D Camera manager tool – is there any? Are there some libraries or example codes, of a camera manager – a tool, that would move camera using some smooth lines (bsplines or similar)? So basically I request an animation to move to a new eye/center possition, and the tool takes care of the rest?

sentences: Adding 2 sounds to 1 asset I've got a sound looping from the start of the game, working exactly as I need it to. What I need is a second sound to alert the player that they have located the hidden object (the first sound is a locator sound to help them go in the right direction). My problem is that when I add the second sound to the object, there seems to be no change. Is there a way to add this second sound to go off when the player gets within the attenuation sphere? I don't want it to shut off the first sound though, just make the sound over it. That way if the player wanders away, they know where to go back to because the first sound will still be playing.

sentences:
Paint with soft brush (logic) During the last few days I was coding a painting behavior for a game am working on, and am currently in a very advanced phase, I can say that I have 90% of the work done and working perfectly, now what I need to do is being able to draw with a "soft brush" cause for now it's like am painting with "pixel style" and that was totally expected because that's what I wrote.

My current goal consist of using this solution :

Import a brush texture
Create an array that contain all The alpha values of that texture
When drawing use the array elements in order to define the new pixels alpha

And this is my code to do that (it's not very long, there is too much comments)

//The main painting method
//theObject     = the object to be painted
//tmpTexture    = the object current texture
//targetTexture = the new texture
void paint (GameObject theObject, Texture2D tmpTexture, Texture2D targetTexture)
{
    //x and y are 2 floats from another class
    //they store the coordinates of the pixel
    //that get hit by the RayCast
    int x = (int)(coordinates.pixelPos.x);
    int y = (int)(coordinates.pixelPos.y);

    //iterate through a block of pixels that goes fro
    //Y and X and go #brushHeight Pixels up
    // and #brushWeight Pixels right
    for (int tmpY = y; tmpY<y+brushHeight; tmpY++) {
        for (int tmpX = x; tmpX<x+brushWidth; tmpX++) {
           //check if the current pixel is different from the target pixel
           if (tmpTexture.GetPixel (tmpX, tmpY) != targetTexture.GetPixel (tmpX, tmpY)) {
               //create a temporary color from the target pixel at the given coordinates
                Color tmpCol = targetTexture.GetPixel (tmpX, tmpY);
                //change the alpha of that pixel based on the brush alpha
                //myBrushAlpha is a 2 Dimensional array that contain
                //the different Alpha values of the brush
                //the substractions are to keep the index in range
                if (myBrushAlpha [tmpY - y, tmpX - x].a > 0) {
                    tmpCol.a = myBrushAlpha [tmpY - y, tmpX - x].a;
                }
                //set the new pixel to the current texture
                tmpTexture.SetPixel (tmpX, tmpY, tmpCol);
            }
        }
    }
    //Apply
    tmpTexture.Apply ();
    //change the object main texture
    theObject.renderer.material.mainTexture = tmpTexture;
}

Now the fun (and bad) part is the code did exactly what I asked for, but by asking to draw anytime with the brush alpha I found myself create a very weird effect which is decreasing the alpha value of an "old" pixel, so I tried to fix that by adding an if statement that check if the current alpha of the pixel is less than the equivalent brush alpha pixel, if it is, then augment the alpha to be equal to the brush, and if the pixel alpha is bigger, then keep adding the brush alpha value to it in order to have that "soft brushing" effect, and in code it become this  :

if (myBrushAlpha [tmpY - y, tmpX - x].a > tmpCol.a) {
  tmpCol.a = myBrushAlpha [tmpY - y, tmpX - x].a;
} else {
  tmpCol.a += myBrushAlpha [tmpY - y, tmpX - x].a;
}

But after I've done that, I got the "pixelized brush" effect back, am not sure but I think maybe it's because I'm making these conditions inside a for loop so everything is executed before the end of the current frame so I don't see the effect, could it be that?

Am really lost here and hope that you can put me in the right direction.

sentences: How to cache a large object I have an object made up of many vertices that changes very rare (for the most part of time, it looks the same) and I'm trying to figure out a way to avoid rendering all its vertices every frame. However, being a OpenGL beginner I have no idea how to do it. I was thinking I could render it to a texture and only show the texture every frame. But I don't know if it's possible or if there are better ways.

sentences:
How can I render all objects behind a plane with a specific transparency value? I have a game where there a multiple floor levels between the player switches. The floor is not present everywhere, so you can look through it. When 'working' (playing, building stuff, etc.) on a specific floor I want to add a transparency value to everything that is NOT on the current floor.
Ho can I accomplish that, and what is the best/most efficient way to do that?

sentences:
Why aren't regular quadratic and cubic splines used much in games? After investigating a bit about splines and reading a bunch of docs, I have noticed regular quadratic and cubic splines are not used very much in games.

Splines using quadratic/cubic Bézier curves, Catmull-Rom, B-splines, and other spline interpolation methods seem to be used widely though.

I can be totally wrong here but from books and tutorials I have seen that for regular cubic/quadratic you have to solve systems including first derivative for continuity and second derivative to match curvature. It seems that the most used splines (Bézier, Catmull-Rom, etc...) implicitly bring these features with fewer calculations.

Is this the reason that regular quadratic and cubic spline interpolation are not often used in game programming?

sentences:
Recursively find neighbors I'm making a Bubble Shooter game in Unity. I came to the point where I can hit another bubble and it destroys all of its neighbors.

Now I'm trying to use recursion to destroy all of its neighbors neighbors and it causes a stack overflow.

private List<Bubble> FindAllRecursiveNeighbors(Vector2Int originPosition)
{
    List<Bubble> allNeighbors = FindNeighbors(originPosition);
    List<Bubble> result = new List<Bubble>();

    foreach (Bubble bubble in allNeighbors)
    {
        if (result.Contains(bubble)) { continue; }
        result.Add(bubble);
    }

    // Recursion starts here.
    foreach (Bubble bubble in result)
    {
        List<Bubble> neighbors = FindAllRecursiveNeighbors(FindPositionOfBubble(bubble));
        foreach (Bubble neighbor in neighbors)
        {
            if (result.Contains(neighbor)) { continue; }
            result.Add(neighbor);
        }
    }
    return result;
}

sentences:
Binding BoundingSpheres to a world matrix in XNA I made a program that loads the locations of items on the scene from a file like this:

using (StreamReader sr = new StreamReader(OpenFileDialog1.FileName))
                    {
                        String line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            red = line.Split(',');
                            model = row[0];
                            x = row[1];
                            y = row[2];
                            z = row[3];
                            elements.Add(Convert.ToInt32(model));
                            data.Add(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)));
                            sfepheres.Add(new BoundingSphere(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)), 1f));
                        }

I also have a list of BoundingSpheres (called spheres) that adds a new bounding sphere for each line from the file.
In this program I have one item (a simple box) that moves (it has its world matrix called matrixBox), and other items are static entire time (there is a world matrix that holds those elements called simply world). The problem i that when I move the box, bounding spheres move with it. So how can I bind all BoundingSpheres (except the one corresponding to the box) to the static world matrix so that they stay in their place when the box moves?

sentences:
What sorts of stats do games companies track when people play their games ? I've seen interviews with certain games companies where they talk about getting stats back from their users, particularly with games on facebook.
This data allows the companies to monitor and adjust the difficulty of levels, see what's keeping people engaged etc.
I am just wondering exactly what sort of data would they be collecting?
How common is this practice and would developers of Android and iOS games be involved in similar practices?

sentences:
How can I distribute the source code of my project without the imported assets? I have a Unity project that uses some assets that I downloaded for free in the Unity asset store. I would like to make my project open source and distribute its source code in GitHub. But, I do not want to put the assets I downloaded in my GitHub, since they are not mine. Also, these assets take a lot of space in my repository.

Can I arrange my project in such a way that any user who downloads it will be automatically sent to the Unity asset store to download the required assets?

I found that it works well with TextMesh Pro: I can remove the TextMesh Pro folder from my Assets folder, and then when I open the project in Unity, it prompts me to re-import TextMesh Pro, and when the import is done, the game works well. Is it possible to achieve a similar effect with other assets?

sentences:
Rotate object relative to camera position I am trying to write code that is able to rotate object, based on camera position. So far I ended up with a code posted below. Moving mouse up and down (y input) caused to rotate object in y axis, instead of x. That's why I used cross product.
Achieved result is working not exactly as I expected. Rotation is different for every object, dependent on their pivot. I am not exactly sure how it fix it properly.
public class DragRotate : MonoBehaviour
{
    public Camera camera;
    public float rotationSpeed = 1;

    private void Update ()
    {
        float x = Input.mousePosition.x * rotationSpeed;
        float y = Input.mousePosition.y * rotationSpeed;

        var rot = camera.transform.TransformDirection (new Vector3 (x, y));
        rot = Vector3.Cross(rot, camera.transform.forward);

        transform.rotation *= Quaternion.Euler (rot);
    }
}

This script will be primarily used with one axis rotation, this feature is not implemented in code yet, but it's shown in the use case.
According to attachment, I want to rotate selected cube (visible pivot is set to global). It's worth to say, that in this examples padlock has always same position and rotation, the only thing that changes is position and rotation of the camera:

a) Swipe from bottom to top - negative rotation on X axis.b) Top
to    bottom positive on X axis.  c) Other axes should be locked,
but for    example swipe from right bottom to left top should rotate
like    example a), but taking into consideration only y (vertical)
input.
This should behave exactly like example 1, but taking camera rotation into account. So 1a is 1b, 1b is 1a etc.
Swipe from left to right should result in 1a rotation, swipe from right to left should result in 1b rotation. Bottom to top or top to bottom should have no effect at all.

sentences:
Object oriented approach to debug mode I'd like to introduce a way to turn off/on debug messages and in-game tooling (tweak menus, for example) without non-game related branches, e.g:

if(DEBUG_MODE) {
    // show tweak menu

    // some message
    console.log("In this function");
}

Is there a more reusable approach to this problem?

sentences:
Why transform.find() does not need actual object[unity] I m new to unity and C#.

I suspect that transform.find() function below does not need actual object reference like

  player.transform.find()

because it transform find is already applied to the gameObject the script is attached to? Am I right?
Why transform.find() does not have any game object in front of it?

public class PlayerControl : MonoBehaviour{

private Transform groundCheck ;

void Awake()
{
    groundCheck = transform.Find("groundCheck");
}

sentences:
Polygon draw order issue I'm working on a software and I'd to move the rendering API from SlimDX to SharpDX. I've done that but I noticed that the solid polygon are not drawn correctly i.e., even if the polygon is at the back side of another polygon, part of it is visible, also part of the polygon lie inside terrain that is also visible. Below are the images from SlimDX implementation and SharpDX implementation for reference:

I tried to set the Stencil & ZBuffer but there are not working as expected. I've already applied DepthBias to it which worked fine with SlimDX but not with SharpDX.
Please let me know if, I'm missing something or I'm doing something wrong.
Update 1 (Polygon rendering):
// set the render state to device
device.SetRenderState(RenderState.AlphaTestEnable,
                      true);
device.SetRenderState(RenderState.AlphaBlendEnable,
                      true);
device.SetRenderState(RenderState.SourceBlend,
                      Blend.SourceAlpha);
device.SetRenderState(RenderState.SeparateAlphaBlendEnable,
                      true);
device.SetRenderState(RenderState.DestinationBlendAlpha,
                      Blend.One);
device.SetRenderState(RenderState.SourceBlendAlpha,
                      Blend.InverseDestinationAlpha);

// set the render state to the device
device.SetRenderState(RenderState.DepthBias,
                      -1E-06f);

this.effectVectoring.Begin(FX.None);

// binds the vertex buffer to device data stream
device.SetStreamSource(0,
                       this.vertexBuffer,
                       dataGeometry.FillVertexOffset,
                       stride);
// pass 1 to shader as a pass if it is 3D mode else 0
this.effectVectoring.BeginPass(is3D ? 1 : 0);
// renders the non-index geometric primitives using the data from current input stream
device.DrawPrimitives(SharpDX.Direct3D9.PrimitiveType.TriangleList,
                      0,
                      primitiveCount);
// end the pass
this.effectVectoring.EndPass();

this.effectVectoring.End();
device.SetRenderState(RenderState.AlphaBlendEnable,
                    false);
device.SetRenderState(RenderState.AlphaTestEnable,
                    false);
device.SetRenderState(RenderState.DepthBias,
                    0);
device.SetRenderState(RenderState.FillMode,
                    FillMode.Solid);
device.SetRenderState(RenderState.SeparateAlphaBlendEnable,
                    false);

Update 2 (Terrain rendering):
device.SetRenderState(RenderState.AlphaBlendEnable,
                      false);
device.SetRenderState(RenderState.AlphaTestEnable,
                      false);
device.SetRenderState(RenderState.CullMode,
                      Cull.Counterclockwise);

device.Indices = this.terrainIB;
device.SetStreamSource(0,
                       this.terrainVB,
                       0,
                       12);
device.VertexFormat = VertexFormat.Position;

// Set texture in effect...

effect.Begin(FX.None);

effect.BeginPass(pass);
device.DrawIndexedPrimitive(PrimitiveType.TriangleStrip,
                            baseVertexIndex,
                            0,
                            vertexCount,
                            startIndex,
                            primitiveCount);
effect.EndPass();

effect.End();
device.SetRenderState(RenderState.FillMode,
                      FillMode.Solid);
device.SetRenderState(RenderState.CullMode,
                      Cull.None);

sentences:
Populate triangles array when you already have sorted vertices array Input is a Vector3[] of verticies. Length is unknown, it could be anything above 2 - so these vertices form all kinds of multifaceted shapes with 3 being a triangle and 6 hexagon-ish.

Poor example to visualize:

vertices = [Vector3(..), Vector3(..), Vector3(..), Vector3(..), Vector3(..)];

Coordinates in that array are ordered counterclockwise. I also have the coordinates of center point that these verticies form (look at illustration below) - it doesn't have to be used but if it helps..

Few examples of which shapes can occur and which cannot:

Now I need to build meshes out of them. For each shape I need:

Vertices array (which I already have, nicely ordered)
Triangles array - 3 indices (from vertices array) per triangle until all vertices are covered

How to populate triangles array with these relatively easy shapes where each vertex has "direct line of sight" to every other vertices? Number of vertices is unknown of course.

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:
How to promote my free javascript game? Possible Duplicate:
  Effective marketing strategies for independent game projects

I created a javascript game for browsers.
Do you know easy ways to promote it?

sentences:
How do I delete all saved preferences in my libgdx project? I want to delete the preferences that saved my last highscore. How can I do this?

Here's how I am saving preferences at the moment:

prefs = Gdx.app.getPreferences("ZombieBird");
if (!prefs.contains("highScore")){
    prefs.putInteger("highScore", 0);
}

public static void setHighScore(int val) {
   prefs.putInteger("highScore", val);
   prefs.flush();
}

sentences:
LibGDX MainMenu with ScrollPane - Select Level and press Play In my level Menu, I am using tables that have images and text to identify each game level.
Those tables are in a table that is inside a ScrollPane so the player can browse the levels available.

Here is how i've written the code:

//top of my show() method

    stage = new Stage();

    Gdx.input.setInputProcessor((com.badlogic.gdx.InputProcessor) stage);

    atlas = new TextureAtlas("levelsmenu/levelmenu.pack");

    skin = new Skin(Gdx.files.internal("levelsmenu/liststyle.json"), atlas);

//example of the tables with image and text identifying each level

    tableLevel1 = new Table();
    tableLevel1.add(new Image(skin, "rhlevelone"));

    tableLevel1.add(new Label("THE HOOD", skin));

//table with the levels available

    Table levelList = new Table(skin);
    levelList.add(tableLevel1);
    levelList.row();
    levelList.add(tableLevel2);
    levelList.row();
    // etc.

// ScrollPane

    scrollPane = new ScrollPane(levelList, skin);

//
table3.add(scrollPane).padLeft(220).expandY();

//
stage.addActor(table3);

On the stage I have a button to go back to the Main Menu and a button to play the level selected.

I would like to request help to figure out how to set the right listeners so a level can be selected in the ScrollPane and then played cliking the Play Button.

Should I use FocusListener or ClickListener?

Here is an illustration of what I want do do:

Thanks in advance for any help that may come!!!

Rich Days

sentences:
Text width phaser.js Does phaser have any function that returns the width of the text or if not, how can I center text inside rectangle I've drawn?

Thanks!

sentences: What is the unit of speed in unity3d? I have cars in my unity scene, I am not sure in what units speed is specified in unity.

sentences:
Is using something like MakeHuman frowned upon while developing 3D games? I came across this interesting application called MakeHuman, and I was wondering what developers in the gaming community thought about creating and exporting characters to Unity using this application. I'm not an artist, so a tool like this helps me create characters without having to pay someone else to model them from scratch.

If I were taking a class in game development, would it be permissible to use something like this to create characters rather than create them myself (in Blender or Maya, for example)? What benefits are there to consulting an artist rather than using tools like this?

sentences: Prevent Animation Tab from changing the position of an object I am quite new to Unity. I am using the latest version. When I try to make a door open animation, it goes well with rotation. But when I add the position property it takes it to the Vector3(40,12.5,7.5) instead of (10,2.5,15) at the first frame. I try to change the value but it reverts after I write.

sentences:
How do I know when a player has crossed a point threshold? I’m needing help figuring out logic when adding a time bonus to my game.

I only want to reward the player with extra time if they level up.

Currently when the player’s score is less than 100 no bonus is given. If the player’s score reaches 200 I want to reward the player with some bonus time.

My issue is if the score is 190 and then jumps to 210, the 200 level mark is passed and the player isn't rewarded.

If I turn on the logic to say if the score is between 190 and 210, it could reward the player at the 190, 200, 210 mark or skip from 180 to 220, bypassing the reward altogether. I have tinkered with the idea of setting a bool BonusFlag, but the same issue arises, when I set the flag.

Can anyone help provide some logic on how to overcome this obstacle?

sentences:
How to create a grid of 3d objects without making them actual GameObjects Very simple question:
If I'm going to be generating and placing a lot of 3d objects (in this case cubes), that are not going to be interactive, like no collision, no raycasting intersections etc.  Should they be GameObjects or is there a lighter solution that doesn't inherit the GameObject blob?

Cheers,

sentences:
How to create a correct Unity package copy, which will not be replaced when you import? I create a "Package 1" consisting of section A (unique) + section B (which will be repeated in all my other packages). This package works correctly is he is alone.

Next, I create a "Package 2" consisting of: section C (unique)  + Section B (from Package 1).

To save time, I replaced the texture maps in the materials belong to old section A parts and replace this part on section C (directly on models in the Mesh.)

I renamed most objects in the scene and in the package as a whole.

I delete all prefabs of «section A» and create prefabs «section C», because they are not pick up name changes. The prefabs of «section B», I left as is.

Now when I import «Package 2» in the scene that already contains the «Package 1», it begins the mess: «Package 1» Files are replaced by «Package 2», even them are named differently.

How to avoid it?

I can’t create each scene from scratch, unfortunately it will lead to the insane time-consuming.

Huge thanks for your support!

sentences:
How to convert font size to pixels? I'm trying to add text to my game using SDL_TTF, and it's working pretty well.

Except for one thing :

My text's SDL_Surface needs a width and a height, if I don't give it one it will automatically set it to 0, making the text invisible.

However, if I insert a value like 100 width and 100 height, it will stretch the image.

I need to know how I would convert ANY font size on the font arial to pixels in width and height.

sentences:
How do I disassemble a 3x3 transformation matrix into rotation and scaling matrices? I have a transformation matrix that rotates and scales. Is there any easy way to disassemble it into the original rotation and scaling matrices?

For instance:

M = R * S;
// I need f and h such that
R = f(M); S = h(M);

sentences:
Which image format to use for sprites in an HTML5 game? In a 2D HTML5 game, what is the best image format to use and why? Should I use different formats in different situations? For example, .png for the background image, .jpeg for the animation frames and so on...

The "why" part is important to me. It doesn't really have to be localized to HTML5, it can be general advice as well.

sentences:
Why is this Mono Behavior in the animator? I'm looking through the 3D Game Kit from the asset store to accustom myself with the animator, and I'm just wondering what this is referring to.
I was looking into controlling MonoBehaviors through the animation controller the other day and thought I had come to the conclusion that it couldn't be done directly, so what's this?

sentences: Opengl-es 1.1 draw blur on model? How can I draw blurred models/images in 3d space like here:

sentences:
Finding the contact point of two spheres Is there a way to get the normal and depth of two spheres that have collided.

I know that it is something to do with the center and radius of two spheres but I am not sure what

sentences:
How to blur entire scene but a specific spot in Unity? What I want is basically: A way to blur every object/sprite on the scene, but have a "blur-free" circular zone, that can move. And everything that's behind that circular zone won't have the blur effect applied to it.

In a 2D mobile game, how would I do that, especially in a way that's not too heavy, performance-wise(if possible).

And if it's not possible to do that in a way that won't completely destroy my performance, I also have those sprites already "pre-blurred" so maybe there's a way to have both blurred and "unblurred" objects at the same position, and only draw the right parts of them as they go through the scene and reach the blur-free zone. If there's a way to do that, that'd also help immensely.

Thanks for your time.

sentences:
Stats on Screen Size for Flash Games I'm working on a Flash game after many, many years. I'm trying to figure out size to make my application run (eg. 600x800). Because it's a tall (not wide) game, I'm confused.

I know about (and love) the Steam hardware stats. However, for Flash gaming, I have two nit-picks with their survey sample:

1) Caters to more hardcore gamers with better hardware (overall)
2) Captures only a subset of Flash gamers. Doesn't capture people who play at school, work, etc. or not netbooks and lighter machines.

Are there any sort of statistics I can use to determine which size to use? Ideally, I would like to know something like:

800x600 will fit 94% of users screens
1024x768 will fit 74% of users screens
1200x960 will fit 53% of users screens
etc.

sentences:
how to convert FoV into zoom 2x, 3x, 4x...? so I have the value of the FoV in degrees,
now I need to convert it to a zoom value of 2x, or 3x, for scopes and  binoculars.

I placed some objects equally distanced between each other,
but when I zoom in from FoV 100 to FoV 90, (and I am calling that a 2x zoom), the visible objects in the edges of the reticle are not the ones I expected.
Yes, I am using this big FoV of 100 to 10 just to try to calculate the 2x, 3x value properly.

So I need the ending/maximum FoV to be at 10 degrees.

what happens in the highest zoom levels, from FoV 30 to 10, is that the zooming becomes too high and hard to control, so I wonder if I am calculating it wrong?

I mean, should the FoV steps, to let results of zoom 2x, zoom 3x, be not a fixed value like:
FoV 100 = zoom 1x
FoV 90 = zoom 2x
FoV 80 = zoom 3x
I should instead use some calculation to give me a result something like (or not like):
FoV 100 = zoom 1x
FoV 85 = zoom 2x
FoV 73 = zoom 3x
and what could be such calculation?

or should I use some other rule, like impose some FoV limits and fixed fov values instead of making any calculation?

sentences:
Unity3D | Cost of accessing a script via a static reference to the instance I saw this pattern around and I was wondering what would be the pros and cons about it. Does this suffer performance issues ? If so what would be a better alternative?

using UnityEngine;
using System.Collections;

public class SomeClass : MonoBehaviour
{

    public static SomeClass instance;

    void Awake ()
    {
        instance = this;
    }

}

And in an other script use it like so:

SomeClass.instance.SomeMethod();

sentences:
How to find the total bounds rectangle around a list of rectangles How can I find the total bounds rectangle around a list of rectangles?

Rectangle object: a simple data structure of 4 floats (w,h,x,y).
I have an array of 2 or more rectangles and want to create a rectangle that surrounds all of them:

The result rectangle, calculated from rectangles A and B:
 Rectangle T : ( Ht, Wt, Xt , Yt)

sentences:
Unity2017 WWW Requests fail My WWW requests are returning an error that is empty since I switched my project to 2017. Anyone experiencing the same or have a solution?

void Start()
  {
    StartCoroutine(RetrieveQuests());
  }

IEnumerator RetrieveQuests() {
  WWW www;
  www = new WWW("URL that I dont want to share here.");
  yield return www;
  if (www.error != null) {
    Debug.Log("There was an error sending request: " + www.error);
  } else {
    Debug.Log(www.text);
  }
}

I get the following log when I run it: "There was an error sending request: ", which means www.error is empty but there is an error.

NOTE: This does work on earlier versions of Unity.

sentences:
Easy way to generate colour-per-vertex models for input to Blender I procedurally generate 3D planet models that I would like to import into Blender.

I use colour per vertex rendering in my shaders (In practice, I use the same colour for all vertices of a face, but my vertex attributes include RGBA.)

I like generating wavefront .obj files, because the syntax is so easy. But wavefront obj does not let me specify colour per vertex, or colour per face. Instead, the entire object is coloured with a material from the material-library that accompanies the obj geometry file.

I've looked into collada .dae as well, but frankly, that seems like a very complex format, and it still seems to work with material libraries, like the .obj format does.

Is there an easy to generate 3d model format that lets me specify a colour per vert (or face) without material libraries, and can be imported into Blender?

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:
How do you handle pathfinding for non-tilemap 2d games? What methods do you use to handle path finding in non-tiled 2D games?
Tilemap based methods can use A* and 3D has NavMesh available.
The only success I’ve had is with raycasts but it doesn’t seem like a great way to handle things with hand draw sprites or uneven terrain.

sentences:
3D Collision Detection with XNA So I'm trying to implement some collision detection in XNA. I'm aware of the Bounding Spheres, but I worry with the accuracy, most items in my game are cubic in nature, so it seems very square-peg in a round hole, so it seems to me bounding boxes would be the best solution.

I looked at having libraries(JigLibX, Henge3D) to do it for me, but most have heavy physics systems attached and that's really not what I'm wanting
I've also tried to implement solutions utilizing the Vertex buffers for Bounding Boxes after XNA's importers and processors pack the .fbx model into the Content Pipeline to no avail.

So the two things I feel I'm left with are:

Using Primitives as collisions "skins" for my objects.

Same problem here as using XNA's default bounding box, after Importation, I have no clue how to get it's size or even the vertices.

Creating a Custom Content Processor to determine the vertices at Load, and then apply transformations to the Bounding Box along with the Model itself at run-time.

problem Here is that this is a very daunting task. I'm finding it hard to locate thorough documentation on XNA's default importer, so it's highly difficult to just create a custom Processor.
I wouldn't even know how to begin to write my own importer.

TL;DR- I've hit a brick wall with 3D Collision using Bounding Boxes, Halp?

sentences:
Understanding callbacks for connecting/disconnecting controller I am using glfw and let's say I track controllers with a simple struct:

struct Controller {
  int id;
  std::vector<InputListener> listeners;
}
std::vector<Controller> controllers;

And I have setup a callback to detect connection and disconnection events with glfwSetJoystickCallback.

Now every frame I iterate over the controllers and poll their input states to detect button presses etc. But when the GLFW_DISCONNECTED event is triggered, and I try to remove the controller from the vector of controllers, the iteration loop crashes as the iterator becomes invalid.

for(auto it = controllers.begin(); it != controllers.end(); ++it){
  // Poll inputs...
}

void joystick_callback(int joy, int event)
{
    if (event == GLFW_CONNECTED)
    {
        // The joystick was connected
    }
    else if (event == GLFW_DISCONNECTED)
    {
        for(auto it = controllers.begin(); it != controllers.end();){
          if((*it).id == joy){
            it = controllers.erase(it);
            return;
          }
          ++it;
        }
    }
}

I tried protecting controllers with a mutex, but on disconnection, locking the mutex throws an exception because it's double locking, which leads me to believe it's on the same thread.

So how does this execution work then? Does the original loop pause, while the callback takes over, then after it's done the loop resumes execution?

I was able to fix it by adding a disconnected flag to the Controller struct, and then test for it in the loop, which will then remove the controller.

sentences:
Playing multiple sounds in Unity5 I have multiple AudioClips that I have attached to a GameObject and I'm trying to play them when certain conditions are met.  Each clip is in an array and I have each array item attached to a variable.  I'm also getting the GameObject's Audio Source.  My problem is, I can't get the clips to actually play, how do I get them to do so?

C#

private Rigidbody playerCar;
private AudioSource engine;
public AudioClip[] carSounds = new AudioClip[3];
AudioClip accelerate;
AudioClip toppedOut;
AudioClip idle;
private bool accelerating;
private bool idling;
private bool maxed;

void Start(){
    playerCar = GetComponent<Rigidbody>();
    engine = playerCar.GetComponent<AudioSource>();
    carSounds = playerCar.GetComponents<AudioClip>();
    idle = carSounds[0];
    accelerate = carSounds[1];
    toppedOut = carSounds[2];
    idling = true;
}

void Update(){
    if(idling){
        engine.PlayOneShot(idle);
        accelerating = false;
        maxed = false;
    }
}

Editor

For further clarification, here is the exact error Unity is giving me.

ArgumentException: GetComponent requires that the requested component 'AudioClip' derives from MonoBehaviour or Component or is an interface.
UnityEngine.GameObject.GetComponents[AudioClip] () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineGameObjectBindings.gen.cs:100)
UnityEngine.Component.GetComponents[AudioClip] () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineComponentBindings.gen.cs:183)
MoveCar.Start () (at Assets/Scripts/MoveCar.cs:28)

Line 28 is carSounds = playerCar.GetComponents<AudioClip>();

sentences:
Rendering shadow sprites in cocos2d-x I am writing a 2D game with cocos2d-x. I want to put a "shadow" sprite on a background sprite using the equation:

  MAX(0, Cd * 1 - Cs * S)

where Cd is the destination color (that is, a background pixel), Cs is the source color (the shadow pixel), and S is the scale factor (between 0 and 1).
The MAX() function is used to avoid negative results. This is a lighting effect: when the shadow sprite pixel is 0, there is no effect on the background
pixel, otherwise, the background pixel becomes darker.

Now, the only way that comes to my mind is to change the blending equation to GL_FUNC_SUBTRACT, but it doesn't compile with cocos2d-x (can't found it).

I would subclass the CCSprite class in order to implement the draw() method in order to change, when needed, the blending equation, call the original draw() method and restore the blending equation to its previous state at the end of the method.

So my questions are two:

How to use glBlendEquation() with cocos2d-x? Keep in mind that I am writing a game for iPhone/Android/Windows.
Are shadows handled this way in 2D games?

sentences:
Objective-C or C++ of game engine header file for iOS developers? We've developed a game engine written in C++. Now we are preparing our game engine for iOS developers.

I guess that many game developers use C++ or Objective-C for their game apps. So I think we should expose the API of our library in both Objective-C (@class blahblah) header files and in C++ (class blahblah) header files.

Am I on the right track? If not, what is the most recommended way of exposing the API for our library?

sentences:
Directory paths for resources and assets If I have a file stucture for my final, released game something like:

Main folder

Media

Images
Other assets
Sounds

Executable
List item

And a different one for my 'in development' project, with the same Media folder but:

Main

Source and .obj, etc.
Media with everything
Bin folder with executable

I obviously cannot hardcode file pathnames into this, like:  "../Media/Image/evilguy.png" or "Media/Image/foo.jpg"  because they wouldn't work with one of the builds and would require a lot of switching names.

Instead, does it make sense for my resource manager, that loads everything, to have some kind of prefix path? Then, I can just do  Get("foo.jpg") or Get("Sounds/boom.ogg")
And simply switch out, for the final release, the ctr argument from the relative path for the development build to the release layout?

If not, how have other people sorted these sorts of things out?

sentences:
Does Transform.childCount not work correctly? This is my code:

void OnTriggerEnter(Collider collide) {
  if (collide.gameObject.transform.tag == "Laser") {
    Debug.Log ("Inside If");
    Transform resourceTransform = collide.transform;
    Transform[] tf = new Transform[resourceTransform.childCount];
    for(int i = 0; i<= resourceTransform.childCount-1; i++){
      tf[i] = resourceTransform.GetChild(i);
    }

    Debug.Log ("Child Count Before: " + resourceTransform.childCount);
    resourceTransform.transform.DetachChildren();

    Debug.Log ("Child Count After: " + resourceTransform.childCount);
    Vector3 centerOfMass = resourceRb.centerOfMass;
    Explode (tf, centerOfMass);
  }
}

Everything is working fine, except the childCount property is always zero and that screws everything else up. Here's an image of the hierarchy:

The script is on cube1 and the object has 12 or so children. So why is childCount equal to zero? Is it a problem with Unity itself?

sentences:
Anti-aliasing a sphere I render everything in my game in 2D with SpriteBatch with the exception of a spherical entity (orb) that I render as a spinning and dynamically lit (custom effect) sphere in 3D. I capture the sphere into a RenderTarget every frame and then use the image in the SpriteBatch to render in 2D. The composed image is aliased as any model.

I do not enable MSAA because various platforms that my game runs on (WinRT, as an example) do not support it. I tried FXAA as a custom effect, but the problem is that it does not appear to support transparency (I render the sphere on a transparent background).

My rudimentary solution is to render the sphere into a RenderTarget of size X and then render the result with SpriteBatch into a RenderTarget of size X/2. I set the SamplerState for the SpriteBatch draw call for the half size rendering to anisotropic, although I am not 100% sure this increases the quality of the final output dramatically (and at what cost?).

This solution appears to work fine but is not without its flaws. Mobile devices are slowed down by the multiple SetRenderTarget calls per frame, especially since I render more than one orb type.

Are there other approaching to this?

sentences:
How can I compute a Jacobian matrix with dual quaternions? I'm trying to understand an inverse kinematics algorithm realized with dual quaternions as presented here.

My Jacobian matrix, however, seems to be calculated wrong. Could somebody explain, step-by-step, how I would compute a Jacobian matrix with dual quaternions so that I can check my implementation?

I've read dozens of papers that cover dual quaternions but it's all theory. I'd love to see is an example (e.g. for a single one-, or two-linked chain).

sentences:
relationship between eye height and collision body in UDK We are using the UDK in a research lab setting so we must understand exactly how tall users feel in the virtual world (camera position). By Googling and digging through code, we have discovered the BaseEyeHeight parameter and also the dimensions of the collision cylinder (CollisionHeight). We attempted to set these using Remote Control and could not deduce the relationship between the variables.

For one thing, it seems that BaseEyeHeight has a ceiling. We cannot set it arbitrarily high but the height that is allowable seems to be dependent on the height of the collision cylinder, though it can be higher than the cylinder. Is there a ceiling for the eye height?

Secondly, the height we set for the collision cylinder does not seem to match the height of an object in the world that should be the same height. Is the collision cylinder in the same units as the rest of the world? Is there some padding that I am not accounting for?

Finally, BaseEyeHeight does not seem to be the height from the ground. I read somewhere that it should be the height from the center of the cylinder. Is this true? I would expect the eye height to be a bit lower than the actual collision height (as in the real world). Is this the case?

The big picture problem is that we cannot find a diagram or detailed description of how these numbers relate to one another. Is there a comprehensive source we've missed?

sentences:
How to design a damage formula in an RPG which keeps weapons with different attack speeds balanced? I'm making a mobile rpg game, an infinite one where there is a loot system like Diablo 3. Weapons have attack and speed, armor pieces have a resistance value (not percentage).

The formula I'm using is:

float realDamage = SkillDmg * BaseDamage / ( BaseDamage + Defense )

The results are good, the damage gets bigger if the defense gets lower and it doesn't exponentially go up because of the division between ( BaseDamage + Defense ).

Lets say I have a sword with 1.0 attack speed that deals 50 damage. Thats 50 dps, and I have a dagger that I want it to attack faster, but of course deal less damage, to maintain the dps the logic says that if the daggers attack speed is doubled, the damage needs to be halfed (2.0 speed with 25 dmg ). But using the formula above you'll see that the actual real damage DPS is lower than the sword.

Iv'e solved this by making the dagger not do 25 damage but a bit more, doing some calculations I can make the real dps be the same to balance things. In this case the dagger at 2.0 speed would need to deal 32 damage to be the same real damage dps as the sword.

However, I want to display the DPS number on weapons. If I just display the daggers DPS as 32 dmg * 2 attackspeed it's going to be 64 dps, compared to the sword 50 dps, one will clearly say that the dagger is better, but of course it's not.

Possible solutions? Change the initial damage formula? If so to which one? Lets assume I don't change the formula, is there any solution? I really don't like having to trick the dagger to deal more damage than half to make it even...

I'd really wish I'd know the damage formula for diablo 3. I know that diablo 3 weapons DPS it's simply base damage * attack speed.

Edit:

Lets assume defense = 50 and normal attack (skillDmg = baseDmg)

Sword 1.0 attack speed dealing 50 dmg -> real damage hit=  50 * 50 / ( 50 + 50 ) = **25 dmg** = 25 dps

Dagger 2.0 attack speed dealing 32 dmg -> real damage hit = 32 * 32 / ( 32 + 50 ) = **12.5 dmg** = 25 dps

Sword item, lets display the actual sword dps, 50 * 1.0 = **50 dps**
Dagger item, lets display the dagger dps, 32 * 2.0 = **64 dps** (SHOULD BE THE SAME)

sentences:
LibGDX simple button with image I want to make two image buttons (play, restart) in my main menu screen but I dont know how to do it. I tried this:

Texture playTexture = new Texture(...)
Image playImage = new Image(playTexture)
ImageButton playButton = new ImageButton(drawable?)

but I have no idea what is drawable.

sentences:
Rending 2D Tile World (With Player In The Middle) What I have at the moment is a series of data structures I'm using, and I would like to render the world onto the screen (just the visible parts).

I've actually already done this several times (lots of rewrites), but it's a bit buggy (rounding seems to make the screen jump ever so slightly every x tiles the player walks past).

Basically I've been confusing myself heavily on what I feel should be a pretty simple problem... so here I am asking for some help!

OK!
So I have a 50x50 array holding the tiles of the world.
I have the player position as 2 floats, x ([0, 49]) and y ([0, 49]) in that array.
I have the application size exactly in pixels (x and y).
I have an arbitrary TILE_SIZE static int (based on screen pixels).

What I think is heavily confusing me is using a 2d orthogonal projection in opengl which maps (0,0) to the top left of the screen and (SCREEN_SIZE_X, SCREEN_SIZE_Y) to the bottom right of the screen.

    gl.glMatrixMode(GL.GL_PROJECTION);
    gl.glLoadIdentity();

    glu.gluOrtho2D(0, getActualWidth(), getActualHeight(), 0);

    gl.glMatrixMode(GL.GL_MODELVIEW);
    gl.glLoadIdentity();

The map tiles are set so that the (0,0) in the array is the bottom left.

And the player has to be in the middle on the screen (SCREEN_SIZE_X/2, SCREEN_SIZE_Y/2).

What I've been doing so far is trying to render 1-2 tiles more all around what would be displayed on the screen so that I don't have to worry about figuring out rendering half a tile from the top left, depending where the player is.

It seems like such an easy problem but after spending about 40+hours on it rewriting it many times I think I'm at a point where I just can't think clearly anymore...

Any help would be appreciated. It would be great if someone can provide some very basic pseudo code on keeping the player in the middle when your projection is mapped to screen coordinates and only rendering basically the tiles that you would be any be see.

Thanks!

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

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

sentences:
How to do "realistic" plastic material? How can i do "realistic" plastic material in Unity 3d , using standard shader or other shader ?

Can you suggest me options ?

Thanks

sentences:
Mathematics help. Preliminary grid checking assistance. (Supercover Z) Problem outline: A ray passes through a gridcell. The gridcell's max z's must be compared to the ray segment's min z. This is the preliminary check, so it must be quick.
2 values must be obtained, the 2 points on the ray segment which are directly outside of the grid.
To determine the z values, the distance of the ray from these 2 points must be obtained.
The red shows the points (and distance) of the ray of z values that must be checked as max and min.

The sloppy solution
Instead of getting the points directly touching, calculate the hypotenuse and offset it doing various calculations. I tried this way and there are a lot of operations to be done. I am not sure if this is the best way.
(cant upload more than 3 pics)

The sloppiest (and possibly best) solution
The best sloppy solution would be to create a line offset by the hypotenuse, and have it congruent to the main line then use line_line_collision to determine the distance for point 1 then subtract that distance by hypotenuse*2 for point 2.

The streamlined solution
The best way would have the z's directly retrieved as part of the actual supercover algorithm.
Unfortunately retrieving the n values or error values in tandem with n values couldn't actually yield me the intersection points of the line and grid. My brain is utterly fried at the moment.
My code is here, possibly someone can find an inherent method to retrieve the intersection points of the line and grid.

iX=0 iY=0 s=16 res=8
repeat (res*res)
{
draw_rectangle(iX*s,iY*s,(iX+1)*s,(iY+1)*s,1)
iX+=1;
if iX>res-1
    {iY+=1; iX=0}
}
if mouse_check_button(mb_left) direction+=5

xfrom=mouse_x/s yfrom=mouse_y/s l=300

vecx=lengthdir_x(l,direction)/s vecy=lengthdir_y(l,direction)/s
direction=point_direction(0,0,vecx,vecy)
xto=xfrom+vecx yto=yfrom+vecy

draw_line(xfrom*s,yfrom*s,xto*s,yto*s)
x0=xfrom y0=yfrom x1=xto y1=yto it=0

{
    dx = abs(x1 - x0);
    dy = abs(y1 - y0);

    x = floor(x0);
    y = floor(y0);

    n = 1;
    var x_inc, y_inc;
    error=0;

    if (dx == 0)
    {
        x_inc = 0;
        error = 1000000;
    }
    else if (x1 > x0)
    {
        x_inc = 1
        n += (floor(x1)) - x;
        error = (floor(x0) + 1 - x0) * dy;
    }
    else
    {
        x_inc = -1
        n += x - (floor(x1));
        error = (x0 - floor(x0)) * dy;
    }

    if (dy == 0)
    {
        y_inc = 0;
        error -= 1000000;
    }
    else if (y1 > y0)
    {
        y_inc = 1
        n += (floor(y1)) - y;
        error -= (floor(y0) + 1 - y0) * dx;
    }
    else
    {
        y_inc = -1
        n += y - (floor(y1));
        error -= (y0 - floor(y0)) * dx;
    }
mn=n
    for (n=n; n > 0; n-=1)
    {

   draw_set_color(merge_color(c_red,c_white,it))
   draw_rectangle(x*s, y*s,x*s+s,y*s+s,1)
        it+=1
        draw_set_color(c_green)
        draw_circle((xfrom+lengthdir_x(it+.5,direction))*s,(yfrom+lengthdir_y(it+.5,direction))*s,2,0)draw_set_color(c_red)
        draw_circle((xfrom+lengthdir_x(it-.5,direction))*s,(yfrom+lengthdir_y(it-.5,direction))*s,2,0)
draw_set_color(c_black)
        if (error > 0)
        {
            y += y_inc;
            error -= dx;
        }
        else
        {
            x += x_inc;
            error += dy;
        }
    }
}

There are some other stuff I would like to know...such as 3d triangle/line collisions, but I don't want to boggle the thread down with too much information at the moment...

sentences:
Is SDL conducive to detailed 2D in-Game Animation and intricate particle effects? Is SDL (when used CORRECTLY) conducive to detailed in-Game animation and displaying interesting high quality particle effects?

If my question seems too vague, at the other end of this link I have an animation reel:

http://zeebashew.squarespace.com/

(30 seconds in a troop of the kinds of characters I will be using run into screen)

I would like to get my games to run at about the level of pixel-detail (if not slightly better as the video is a little bit overcompressed) with 10-15 characters on screen, and 1-4 pre-rendered 2D explosions flying around at the same time.

I just can't help but wonder, is this even possible in SDL?

I can't stress enough though: I absolutely love C++ so far, and SDL has been really cool, but I would really love to feel more certain that I am learning the specifics of the best tool for what I am trying to do.

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:
How can I create a random "world" in a tile engine? I am designing a game that is working on a classic tile engine, but whose world is generated randomly. Are there existing games or algorithms that do this?
The procedural generation algorithms I have found are never using a tile system...
What would be the best way to generate a whole "world" using a tile system? I am not talking about mazes of blocks, but an overall "world map"
thanks

sentences:
Game programming: common methods and design patterns I begun writing a very simple game engine so that I can learn OpenGL 3.x better but since my inexperience and my sparse knowledge of how a 3D game should be designed, I usually get into problems where I realize that I should have designed my classes differently. Other problems I'm facing is how to keep track of time in a concise manner in the game and update movement as needed and how to tell the renderer that it needs to redraw. Also I keep needing to make Get and Set functions for passing various flags from one object to another, is that a bad practice?

So, as the title says, I'm interested in any books or articles/tutorials and source which could help me out and would explain some common design patterns in game design (i.e. game state handlers, fonts etc).

Btw, I'm still using freeglut, would you recommend I move to a better windowing system before progressing or after I get a better grasp of OpenGL?

sentences:
Why is my depth buffer texture so bright? https://www.youtube.com/watch?v=QuvAEqgHrMY&feature=youtu.be

https://www.youtube.com/watch?v=5ob1JsPIGAs&feature=youtu.be

gluPerspective(60, (float)CONTEXT_WIDTH / CONTEXT_HEIGHT, 0.1f, 1.f); //values used for first video
gluPerspective(60, (float)CONTEXT_WIDTH / CONTEXT_HEIGHT, 0.1f, 2000.f);//values used for second video, the further z clip value seems to improve the depth rendered, but far from example images below.

I set my projection matrix with gluPerspective.

This seems to happen when I try gluPerspective; when I set my projection matrix to first person.

The type of image I would like to get is

Is the visual result I am getting correct? Then are the listed examples of depth buffer images are merely a result of refining post rendering process, that are simply added in order for humans to see it better?

sentences: What is the general strategy to pre-load game data(entities/map) I'm new to games programming and am wondering what tactics games use to pre-load entity and map data. Will a game initialise with the fundamental map data stored in memory?

sentences:
Rotate OpenGL quad around its center Sorry, I searched it but couldn't figure how to apply it to my code reading the other answers to similar questions. I what to rotate a quad, my code is the following:

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, player_texture);
glBegin(GL_QUADS);
    glColor4ub(255, 255, 255, 255);
    glTexCoord2d(0,0); glVertex2f(hero.xValue(), hero.yValue());
    glTexCoord2d(1,0); glVertex2f(hero.xValue()+hero.lValue(), hero.yValue());
    glTexCoord2d(1,1); glVertex2f(hero.xValue()+hero.lValue(), hero.yValue()+hero.hValue());
    glTexCoord2d(0,1); glVertex2f(hero.xValue(), hero.yValue()+hero.hValue());
glEnd();
glDisable(GL_TEXTURE_2D);

I'm not sure about how to use the glTranslatef function, I tell it what is the center of my object?

In that case it would be:
hero.xValue()+hero.lValue()/2 (x) and hero.yValue()+hero.hValue()/2  (y)

I know I have to use both glTranslatef and glRotate, by the way. When I try, setting glTranslatef with the values I mentioned above, I get a texture floating far from where the hero actually is.

Any help on this matter will be appreciated, thank you.

Obs: hValue = height, lValue = lenght

Edit: New information to show the changes I made after @user55564's comment:

I call init() once, on there I set basic openGL and SDL stuff, among them:

glViewport(0, 0, WIDTH, HEIGHT);
glMatrixMode(GL_MODELVIEW);

then I call my draw function, it has in it:

while (running) {
    glLoadIdentity();

.
. stuff non-related to drawing
.

glClear(GL_COLOR_BUFFER_BIT);
    glClearColor(0, 0, 0, 0);
    glPushMatrix();
    glOrtho(0, WIDTH, HEIGHT, 0, -1, 1);

    // draws the player
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, player_texture);
    glTranslatef(hero.xValue(), hero.yValue(), 0);
    glRotatef(0, 0, 0, 1);
    glTranslatef(-(hero.xValue()+hero.lValue()/2), -(hero.yValue()+hero.hValue()/2), 0);
    glBegin(GL_QUADS);
        glColor4ub(255, 255, 255, 255);
        glTexCoord2d(0,0); glVertex2f(hero.xValue(), hero.yValue());
        glTexCoord2d(1,0); glVertex2f(hero.xValue()+hero.lValue(), hero.yValue());
        glTexCoord2d(1,1); glVertex2f(hero.xValue()+hero.lValue(), hero.yValue()+hero.hValue());
        glTexCoord2d(0,1); glVertex2f(hero.xValue(), hero.yValue()+hero.hValue());
    glEnd();
    glDisable(GL_TEXTURE_2D);
    glPopMatrix();

// then I use pushmatrix again to draw the enemies and the health bars of both enemies and player (these don't need rotation);
glPushMatrix();
    glOrtho(0, WIDTH, HEIGHT, 0, -1, 1);
.
.
.

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:
What exactly is a 'set of states'? Whilst looking into game-oriented applications of programming patterns I discovered a question on this site which suggests that a 'set of states' is superior to a 'stack of states' but does not clarify how a 'set of states' would be applied.

A stack of states is simple enough to comprehend - the state on the top is the active state.

But what exactly is a set of states? A set as I understand it is merely a collection of unique objects (i.e. there are no duplicates). Presumably all the states in the set are currently active. But sets are unordered, so how does one maintain order in an unordered collection? An ordered set could be used, but that then brings the question of why use a sorted set and not a list - what benefit does the uniqueness bring?
I'm just not sure I can imagine how such a thing would be implemented or what benefits it would bring. (Presumably the former issue is causing the latter).

So what exactly is a 'set of states'? (In the context of game design/programming).

sentences:
Rotation angle based on touch move I want to rotate my stick based on the movement of the touch on the screen. From my calculation I did not able to find correct angle in degree. So please provide guidance, my code snippet for that are below.

if (pSceneTouchEvent.isActionMove()) {
    pValueX = pSceneTouchEvent.getX();
    pValueY = CAMERA_HEIGHT - pSceneTouchEvent.getY();
    rotationAngle = (float) Math.atan2(pValueX, pValueY);
    stick.setRotation((float) MathUtils.radToDeg(rotationAngle));

}

sentences:
How do I use transparent textures in panda3d? I need to map a partially transparent texture on a flat quad with panda3d. With the quad as a canvas I'd like to create something like sprites positioned in the 3d coordinate system.

I wanted to render a tree. As you can see the color values of the trees border have been stretched over the texture. How can I change the texture mode to include the alpha channel ?

I just don't know how to get hold of the right settings. A link to the right manpage would be perfect. If you need more information about the setup you might want to look at my other question: How do I use setFilmSize in panda3d to achieve the correct view?

sentences: Game Development Institute? Can you suggest a game development Institute? I am a newbie programmer and is really interested in developing my own game using C++ or other programming language. I would like to enroll my self in an institution who offers this kind of course?

sentences:
How can I develop Flash games without expensive software? I've been playing with writing flash games in my spare time, but up to this point, I've just been using a trial version of Adobe Flash Professional. I'm aware of FlashDevelop, but their documentation is basically non-existent when it comes to the workflow of developing purely with FlashDevelop.

Does anyone know of any good tutorials for developing Flash games purely with FlashDevelop?

Alternatively, does anyone have any other free/cheap software recommendations to use in place of Flash Professional?

sentences:
How to Fill the Gap Between Camera Clip Plane And Skybox? I'm talking about the brown-greyish area i marked with blue. How can i fill it with something that does fit the environment?

I'm looking for a solution like this plugin.

sentences:
In Unity, is there a way to Set a new MeshRenderer? Here is what I want to do in Unity for a given GameObject go = new GameObject(). I want to create a MeshRenderer, change its properties and only in the end set it as the component of go. For instance:

MeshRenderer newmeshrenderer;
(...) //do stuff with newmeshrenderer
go.AddComponent<MeshRenderer>() = newmeshrenderer;
(or)
go.GetComponent<MeshRenderer>(newmeshrenderer);

But both way fail. What is the correct way of setting a MeshRenderer previously created to be the MeshRenderer of an object?

sentences:
Prevent cheating in html Javascript game I have made a Javascript/html game. Now the problem I have is anyone can edit the client code and cheat in game for example there is a man shooting a enemy.

Man HP:          100
Enemy HP:      50

<div id ="man" hp="100" >
</div>

Now if someone changes the hp attribute to a very high value then he becomes literally immortal making the game easy.  Now how can I prevent this type of thing ?

sentences:
FBO result not drawing to screen I recently added framebuffer rendering to my game and rendering to the FBO works (verified with glGetTexImage), but when I go to render a quad to show the result nothing is drawn to the screen. I'm using OpenGL 3.3 Core, so I'm drawing using vertex buffers for the quad and I have two simple pass-through shaders to display the quad. I apologize for the amount of code that follows, but I felt it was all necessary for anyone who ends up looking at this.

Quad generation:

// create vertices
// Vertex(position, normal, tex coord)
quadVertices.Add( Vertex( Vector3( -1.0f,  1.0f, 0.0f ), Vector3(), Vector2( 0.0f, 1.0f ) ) );
quadVertices.Add( Vertex( Vector3( -1.0f, -1.0f, 0.0f ), Vector3(), Vector2( 0.0f, 0.0f ) ) );
quadVertices.Add( Vertex( Vector3(  1.0f, -1.0f, 0.0f ), Vector3(), Vector2( 1.0f, 0.0f ) ) );
quadVertices.Add( Vertex( Vector3(  1.0f,  1.0f, 0.0f ), Vector3(), Vector2( 1.0f, 1.0f ) ) );
quadVertices.SendData(); // gl*Buffer* methods wrapper

// create indices (quadIndices is a buffer of 16-bit integers)
quadIndices.Add( 0 );
quadIndices.Add( 1 );
quadIndices.Add( 2 );
quadIndices.Add( 0 );
quadIndices.Add( 2 );
quadIndices.Add( 3 );
quadIndices.SendData();

Quad rendering:

glDisable( GL_DEPTH_TEST );
glDisable( GL_CULL_FACE );

// bind the texture
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, framebuffer.GetColorHandle() );
_shader.Seti( "texture0", 0 );

 // projection matrix is glm::ortho( -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f );
_shader.Set( "proj", _projection );

// get attributes
int vertex   = _shader.GetAttribLoc( "vertex" );
int texCoord = _shader.GetAttribLoc( "texCoordV" );

// bind buffers
quadVertices.Bind();
quadIndices.Bind();

// enable arrays and point to data
glEnableVertexAttribArray( vertex );
glVertexAttribPointer    ( vertex,   3, GL_FLOAT, GL_FALSE, sizeof( Vertex ), (void*)( 0 ) );
glEnableVertexAttribArray( texCoord );
glVertexAttribPointer    ( texCoord, 2, GL_FLOAT, GL_FALSE, sizeof( Vertex ), (void*)( sizeof( Vector3 ) * 2 ) );

// draw!
glDrawElements( GL_TRIANGLES, quadIndices.Size(), GL_UNSIGNED_SHORT, 0 );

// disable arrays
glDisableVertexAttribArray( vertex   );
glDisableVertexAttribArray( texCoord );

// unbind everything
quadVertices.Unbind();
quadIndices.Unbind();
glBindTexture( GL_TEXTURE_2D, 0 );

glEnable( GL_CULL_FACE );
glEnable( GL_DEPTH_TEST );

Vertex shader:

#version 330 core

in  vec3 vertex;
in  vec2 texCoordV;
out vec2 texCoordF;

uniform mat4 proj;

void main()
{
    texCoordF = texCoordV;
    gl_Position = proj * vec4( vertex, 1.0 );
}

Fragment shader:

#version 330 core

layout(location=0) out vec4 fragColor;

in vec2 texCoordF;

uniform sampler2D texture0;

void main()
{
    fragColor = texture( texture0, texCoordF );
}

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:
How to I get a rotated sprite to move left or right? Using Java/Slick 2D, I'm using the mouse to rotate a sprite on the screen and the directional keys (in this case, WASD) to move the spite. Forwards and backwards is easy, just position += cos(ang)*speed or position -= cos(ang)*speed. But how do I get the sprite to move left or right? I'm thinking it has something to do with adding 90 degrees to the angle or something. Any ideas?

Rotation code:

int mX = Mouse.getX();
        int mY = HEIGHT - Mouse.getY();
        int pX = sprite.x+sprite.image.getWidth()/2;
        int pY = sprite.y+sprite.image.getHeight()/2;
        double mAng;

        if(mX!=pX){
            mAng = Math.toDegrees(Math.atan2(mY - pY, mX - pX));
            if(mAng==0 && mX<=pX)
                mAng=180;
        }
        else{
            if(mY>pY)
                mAng=90;
            else
                mAng=270;
        }

        sprite.angle = mAng;
        sprite.image.setRotation((float) mAng);

And the movement code (delta is change in time):

Input input = gc.getInput();

                Vector2f direction = new Vector2f();
                Vector2f velocity = new Vector2f();

                direction.x = (float) Math.cos(Math.toRadians(sprite.angle));
                direction.y = (float) Math.sin(Math.toRadians(sprite.angle));
                if(direction.length()>0)
                    direction = direction.normalise(); //On a separate note, what does this line of code do?

                velocity.x = (float) (direction.x * sprite.moveSpeed);
                velocity.y = (float) (direction.y * sprite.moveSpeed);

                if(input.isKeyDown(sprite.up)){
                    sprite.x += velocity.x*delta;
                    sprite.y += velocity.y*delta;
                }if (input.isKeyDown(sprite.down)){
                    sprite.x -= velocity.x*delta;
                    sprite.y -= velocity.y*delta;
                }if (input.isKeyDown(sprite.left)){
                    //???
                }if (input.isKeyDown(sprite.right)){
                    //???
                }

sentences:
What methods exist to implement a 2D looping world? I would like to know what other methods exist to implement a 2D wrapping world.

I know the simple modulo solution (ObjectPosition % MapSize) but that doesn't really fulfills my requirements. My issue with this easy solution that it only works on points and not on objects.

I was trying to clone / duplicate my objects and make them visible on both sides of the level that way but it doesn't really works out with box2d physics. So i am thinking if there is any other solution?

I would like to make my game world a truly looping cylindrical world, but i don't know what other methods exist to implement such a thing in 2D.

sentences:
What method replaces GL_SELECT for box selection? Last 2 weeks I started working on a box selection that selects shapes using GL_SELECT and I just got it working finally.

When looking up resources online, there is a significant number of posts that say GL_SELECT is deprecated in OpenGL 3.0, but there is no mention of what had replace that function.

I learnt OpenGL 1.2 in back in college 2 years back but checking wikipedia now, I realise we already have OpenGL 4.0 but I am unaware of what I need to do to keep myself up to date.

So, in the meantime, what would be the latest preferred method for box selection?

EDIT: I found http://www.khronos.org/files/opengl-quick-reference-card.pdf on page 5 this card still lists glRenderMode(GL_SELECT) as part of the OpenGL 3.2 reference.

sentences:
Accessing the Properties of an object already in Scene in Unreal Engine using C++ I am trying to learn more about raycasting in C++ and am trying to implement raycasts in a mini third-person game I am creating. In order to shoot a raycast, I first need to determine its starting location, which in this case I intend it to be from the center of the third-person camera already built-in.

In order to do that, however, I need to access the properties of the camera already in the scene and store its location in a variable using c++. I am relatively new to unreal so I have no idea how to access an object's properties that's already in the scene using C++.

Any help is appreciated

I am still searching, but I couldn't find a satisfying answer yet.

sentences:
How do I switch between different Update behaviour states in Unity? I have a bird entity that needs different update rules when it's moving or dying (among potentially other states).

I want to avoid making my Update method a clutter of if-else branches like this:

void Update() {
   if(state == movingState) {
       // Do moving logic.
   else if(state == dyingState) {
       // Do dying logic.
   else if...

Instead, I thought I could make a base class for all my bird behaviours, then derive classes for each state with their own update functions, and use the appropriate derived version based on the current state.

public class BirdBaseModel : MonoBehaviour
{
    void Update()
    {
        // ...
    }
}

public class BirdMoving : BirdBaseModel
{
    void Update()
    {
        // ...
    }
}

public class BirdDying : BirdBaseModel
{
    void Update()
    {
        // ...
    }
}

My BirdBaseModel is attached to the bird game object. Based on game states, I want to dynamically reference it in the GameController class.

BirdBaseModel b;

if(State == 1)
{
    b = new BirdMoving();
}
else if(State == 2)
{
    b = new BirdDying();
}

Based on the above logic, I want to call the Update function of that particular class. How do I invoke the Update of the subclass?

sentences: 2D js physics engine for HTML4 Is there any engine for Javascript like box2dweb that does not use Canvas? I need to build a game that works in HTML4 browsers.

sentences:
JButton image and background color I have read through and tried several approaches to changing the background color of a JButton with a buffered image, but I am consistently getting the same results. I am using a 2D array of ImageIcons, some with file names such as:
ImageIcon blackRook1 = new ImageIcon("ChessPiece/Chess_rdt60.png");

the png's I am using do not fill the entire square, just the actual chess piece
and others with BufferedImages such as:
ImageIcon space = new ImageIcon(new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB));

I am then looping through chessBoardSquares, which is an empty 8x8 2D array of JButtons, with:
Insets buttonMargin = new Insets(0, 0, 0, 0);
for(int i = 0; i < chessBoardSquares.length; i++) {
      for(int j = 0; j < chessBoardSquares[i].length; j++) {
        JButton b = new JButton();
        b.setMargin(buttonMargin); // Insets object
        ImageIcon icon = this.chessPieces[i][j]; // 2D array of ImageIcons
        BufferedImage bi = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);[![enter image description here][1]][1]

        Graphics2D g = bi.createGraphics();

        //determine color of graphic and jbutton background
        int colorDeterminator = j + i;
        if(colorDeterminator % 2 == 0) {
          // System.out.println("Getting here and coloring white");
          b.setBackground(Color.WHITE);
          g.setColor(Color.WHITE); // I have also tried with this line commented out
        } else {
          // System.out.println("Getting here and coloring black");
          b.setBackground(Color.BLACK);
          g.setColor(Color.BLACK);
        }
        g.fillRect(0, 0, bi.getWidth(), bi.getHeight());

        icon.paintIcon(null, g, 0, 0);
        g.dispose();
        b.setOpaque(true);
        b.setIcon(icon);

the if statement using color determinator has definitely run as the print statements have executed
I keep getting the look of the attached image which, while it is a bit trippy, isn't what I want as I am aiming for the whole square to be filled in around the image. (For those that cannot see the image, the edges of the squares are black and white, but the majority of each square is filled white, which I believed is where the BufferedImage is.) Thank you for your help!

sentences:
Isometric Map with different Z-axis values I want to create a isometric tile map editor just like the one shown in the images ( pictures are from the game Zoo Tycoon ).
I know how to render the tiles when there is only one Z value ( zero ), but I have no clue how I could archieve something like in the pictures where you can raise certain tiles in 1/2 unit steps, either creating a sharp edge/cliff or a smooth transition.

Can anyone give me some good reference materials or help me out here? Thanks in advance :)

Oh yea and you can also rotate the view by 90 in any direction like this:

EDIT :

I am using SFML with C++ for this project. There I am creating an array of vertices, 4 of which represent an quad/tile in the map. In SFML each vertex has two main properties, a position in space and a position in the texture mapped to it. I adjust the first one based on the simple projection formula. The textures are represented in a simple tileset. I simply calculate the corresponding 4 edges of a tile in the texture based on a level data array that contains the number of the tile in the texture, starting from 0.

Here's a very very simple tileset that I made myself

Here's how this looks so far:

Oh yea and this is how far I come with rendering different z values. The 4 tiles on the top right are raised 1 unit. But as you can see the faces of the blocks are incomplete. I don't know how I draw them yet.

UPDATE :
I managed to display sharp edges correctly now, even though it's really unoptimised (I am drawing every front-facing face of the blocks, even the ones that are covered by others. Any tips on how I can prevent this?)

sentences:
MonoGame - 2x2 texture scaling issue I've just recently switched from XNA to MonoGame and now I've run into something that has never happened to me in XNA before.

I've created a 2x2 texture and filled it with a color by doing this:

//Generates a texture from the color.
Texture2D texture = new Texture2D(Constants.GAME.GraphicsDevice, 2, 2, false, SurfaceFormat.Color);
texture.SetData<Color>(new Color[] { alternateColor });

AlternateColor = texture;

What I use this texture for is for drawing rectangles of different sizes using the specified color.
This has usually worked just fine for me in XNA but when I do this in MonoGame I get this:

The screen is suppose to be black here as I'm scaling that 2x2 texture up to fill the entire screen.

I've tried turning mipmaps off, I've tried turning multisampling off and I've tried setting my sample state [0] to use PointWrap but I just can't seem to get this to work.

Any suggestions would be much welcomed.

Thanks!

sentences:
How to 'point' an arrow in the direction that it's going? I am relatively new to OpenGL and 3D environments and am having trouble creating a rotation matrix that will rotate an arrow model so it 'points' in the direction that it is going. I am using GLM as a math library. My current approach is to predict the position the arrow will be at next frame and try to rotate the arrow to face that position.

double nextVelY = velocity.y - (gravity * (((glfwGetTime() + dt) - clock) / 1000.0));
glm::vec3 nextVelocity = velocity;
nextVelocity.y = pos.y - 0.5 > -3 ? nextVelY : velocity.y;

glm::vec3 lookat = glm::vec3((nextVelocity * glm::vec3(20) * glm::vec3(dt)));
glm::vec3 pos2 = glm::vec3(0);

And then try to calculate angles between the current position and the predicted position

model = glm::translate(model, pos);
model = glm::scale(model, glm::vec3(0.05));

float angleX = atan(nextVelocity.y / nextVelocity.z);
float angleY = atan(nextVelocity.x / nextVelocity.z);
float angleZ = atan(nextVelocity.x / nextVelocity.y);

glm::vec3 zAxis = glm::normalize(lookat - pos2);
glm::vec3 xAxis = glm::normalize(glm::cross(up, zAxis));
glm::vec3 yAxis = glm::cross(zAxis, yAxis);

model = glm::rotate(model, angleX, xAxis);
model = glm::rotate(model, angleY, yAxis);
model = glm::rotate(model, angleZ, zAxis);

I'm not at all sure if this is a good way to try and achieve this. I've also tried using glm::lookAt

model = glm::transpose(glm::lookAt(pos2, lookat, glm::vec3(0, 1, 0)));

and various other methods I've found with no success.

sentences:
In a top down game, once I have detected collision, how do I prevent it? I'm making a top-down game in Java. I watched some videos, and this is the code I currently use when the player is colliding with an object:
x += -velX
y += -velY

When I apply force to a wall, the player dips into it, and can't move along the wall.
Does anyone have a better method?

sentences:
Help me please to choose proper path-finding algorithm I am new to game development and just want to ask for advice. I need to know which path-finding algoritm will be suitable for my scenario:

Units - any shape. But in most cases rectangles of different sizes.
I have random generated maze and destination point or area.
Because of different maze borders not all unit can fit and move to the end.

How to find path from unit to destination area and check that shape can move to this area?

sentences:
How to make physics of motion on an inclined surface There is the following platform:

And a coin above it:

And the following code using arcade physics:

gravity: { y: 100, x: 10 }, - in config

function preload ()
{
this.load.image('platform', 'assets/platform.png');
this.load.image('star', 'assets/star.png');
}

function create ()
{
platforms = this.physics.add.staticGroup();

platforms.create(400, 568, 'platform');

player = this.physics.add.sprite(100, 450, 'star');

player.setCollideWorldBounds(true);
}

The code is approximate, a coin above the platform, sprites in png format. But the coin falls and does not roll, but moves horizontally, after which it falls again. How to make it "roll"?

UPD: Will it help me? https://github.com/photonstorm/phaser-examples/blob/master/examples/arcade%20physics/circle%20body.js
And how to be with the platform?

sentences:
Deforming a lip mesh to match face-tracking points I'm creating a lipstick filter. I have a basic mesh for the lip shape ( 140 vertices ) which I am able to render on screen.
I need the mesh since I have my own lighting system, and hence need the normal info. Plus I don't want to create a model at runtime since if I load an obj file I have the flexibility of rendering high quality meshes.
The problem that I am now facing is that when a user is going to use it, their face will be moving around in the video frame, and I will be getting the lips' positions accordingly. Hence at each frame the mesh will be rendered differently ( in one frame he might be smiling, the other he might be frowning etc), in different places in the screen.
How can I set the OpenGL vertices to match the positions of the tracked feature points, and interpolate the rest? I have only 20-ish detection landmark points for each of the upper and lower lip.

sentences:
Do google game services require the users to have a g+ account to enter lobby? I've been reading Google Game Services (GGS) API about multiplayer lobby/rooms and the documentation doesn't make it very clear if the users are required to sign in with a Google+ account (which I don't want).

The web GGS SDK mentions this:

  The simplest way to add a sign-in button to your page is to implement
  the HTML-based sign-in button. For implementation details, see Adding
  the HTML sign-in button to your page on the Google+ Sign-In
  documentation.

What I am looking for is a simple way (service or library) to connect anonymous users together (matchmaking).
My application being in Java, a Java compatible API is also needed.

Can Google Game Services fit the bill or should I keep looking?

sentences:
Ground texture comes up blurry using the UV Rect Tool Im trying to recreate the ground as this sample sprite sheet: https://opengameart.org/content/post-apocalyptic-expansion

I downloaded the sprite sheet and extracted the top left block and saved it separately and added it as a default object not Sprite/UI. I then added a UI > Raw Image to my scene, added the imported texture. But as I expand it, it becomes blurry, even the UV rect does not seem to help. I though the UV rect was supposed to repeat the texture.

Am I doing this wrong?

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:
Help With Rotating Turret and Muzzle Flare Sprites I am making a top down game that involved tanks rotating their turrets and firing at other tanks.

I have the turrets rotating independently of the tank itself about the center. However, I am now trying to rotate a muzzle flare sprite animation around with the turret.

I am struggling with keeping the muzzle flare at the end of the barrel when the turret rotates.

Here is the two sprites lined up at position (0, 0):

And here is the position I would like the muzzle flare to be at:

The problem is, the muzzle flare does not maintain the offset (45, 8) when the turret rotates.

I have tried using the equations:

x2 = x * cos(theta) - y * sin(theta)

y2 = x * sin(theta) + y * cos(theta)

Where x = 45 and y = 8.

But I have had no luck.

Where is my math wrong?

sentences:
Why do actors stretch when I add them to a stage in LibGDX? I have started learning LibGDX and I have been making a few little games to learn how it all works but ever since I started using stages and actors, all of my textures stretch horizontally and I can't seem to fix it at

public class GameScreen extends BaseScreen
{
private BaseActor background;
private PhysicsActor spaceship;
private BaseActor rocketfire;

private PhysicsActor baseLaser;
private AnimatedActor baseExplosion;

private ArrayList<PhysicsActor> laserList;
private ArrayList<PhysicsActor> rockList;
private ArrayList<BaseActor> removeList;

public GameScreen(BaseGame g)
{
    super(g);
}

public void create()
{
    spaceship = new PhysicsActor();
    Texture shipTex = new Texture("fire.png");
    shipTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    spaceship.storeAnimation("default", shipTex);
    spaceship.setPosition(400, 300);
    spaceship.setOriginCenter();
    spaceship.setMaxSpeed(200);
    spaceship.setDeceleration(20);
    spaceship.setEllipseBoundary();
    mainStage.addActor(spaceship);
}

public void update(float dt)
{

}
}

BaseScreen class

public abstract class BaseScreen implements Screen, InputProcessor
{
protected BaseGame game;
protected Stage mainStage;
protected Stage uiStage;
public final int viewWidth;
public final int viewHeight;
private boolean paused;

public BaseScreen(BaseGame g)
{
    this(g, 1024, 600);
}

public BaseScreen(BaseGame g, int viewWidth, int viewHeight)
{
    game = g;
    this.viewWidth = viewWidth;
    this.viewHeight = viewHeight;
    mainStage = new Stage(new FitViewport(viewHeight, viewHeight));
    uiStage = new Stage(new FitViewport(viewWidth, viewHeight));
    paused = false;
    InputMultiplexer im = new InputMultiplexer(this, uiStage, mainStage);
    Gdx.input.setInputProcessor(im);
    create();
}

public abstract void create();
public abstract void update(float dt);

public void render(float dt)
{
    uiStage.act(dt);
    if (!isPaused())
    {
        mainStage.act(dt);
        update(dt);
    }

    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    mainStage.draw();
    uiStage.draw();
}

I changed the texture to a perfect red square but when renderered on the screen it was more rectangle shaped than square (horizontally) and I have no idea why. I read somewhere that it was something to do with the camera but I have no idea what to do to fix it! Please help :O

sentences:
How should I handle collectable/droppable/stackable items in an inventory? I am working on a game with an inventory system, but am trying to figure out the best way of doing it. I have read the post about adding WorldItems or InventoryItems to a list, which is fair enough and I figured that out myself anyway.

However, perhaps I add two SwordItems to this list (for example). I want the game to show that I have quantity 2 of these, not two individual items. What is the best way to achieve this with a List based inventory structure. I think I saw a GroupBy method, where I could GroupBy item type Sword. Is this a good way to achieve this? Or can you suggest a better alternative?

sentences:
Refactoring fighting game Movement class responsibilities I'm a web developer, new to C# and trying to learn Unity. I've learned the C# syntax, I understand how to write working code, although I'm having a hard time understanding when and to what classes should I split my code.
At the moment I'm doing a simple 2D fighting game, similar to Mortal Kombat, I've started out with creating some basic sprites and basic scripts for the environment, like clouds spawning and moving (the action takes places on a rooftop), created a fighter character with animations and started with writing the movement script.
At this point, the Movement script deals with moving, jumping, animations (also triggers for punches and kicks) and player input (I'm using the new Input System), also I want to make the game a two player game, so the Movement script also checks if the the fighter is controlled by player 1 or player 2 and everything is crammed in this little Movement script, not that it's too large, it's just funny that a Movement script is doing so much and furthermore I'll need to add health and attacks (not just animations).
I think it's about time I refactor, my questions are:

Should I create a Character, CharacterController, CharacterManager or whatever script that inherits from MonoBehaviour and other scripts as simple C# scripts, or should all of my scripts inherit from MonoBehaviour and be attached as components to my GameObject with references to each other?

Should I have a separate script for my animations or should they be at their respective scripts as in Attack, Movement, maybe Jumping or Death, whatsoever?

What would be the best way or what would be the ways of managing my Fighter GameObject to determine if it is controlled by player 1 or player 2 and if I'll plan to add an AI for example? Should I have a PlayerController/AIController inherit from Character script, or have a separate AI class, or just have some variable to check against?

My problem with various tutorials is that most of them don't give a larger overview of the whole picture, most of them just focus on a single subject: movement, animations, spawning, pathfinding or some other concrete thing or term, etc. and don't show how they are intertwined together.

sentences:
360+ degree rotation skips back to 0 degrees when using Math.Atan2(y, x) I'm new to XNA and this is my first actual project, so forgive my noobness.

I'm using

 jointAngle = System.Math.Atan2(RightStick.Y, RightStick.X);

in order to set an angle of a joint (farseer) so that the attached body points in the direction pushed with the right joystick. This all works great and i get values from negative pi to pi which correlate with the pushed direction. The problem arises when i go from 360 degrees to 361. Instead of the continued rotation beyond 360 degrees that one might expect, it jumps back to 0 degrees (or -3.14 radians), which causes a jerking motion as the joint suddenly shifts 359 degrees back instead of 1 forward.

Is there a simple way to account for this? I came up with a few solutions, but they're all pretty messy at best and completely unreliable at worst.

Please help!

sentences:
Has an open console any chance to give more strength to the indie game world? I have heard about the GPX, but i don't really think the embedded market is mature enough in terms of performance, but what about the home console market ?

I'm not talking about last-generation graphics, because that would be economically impossible, but what about an hardware as fast as a playstation 2/Xbox 1/Gamecube ?

For games, the trick would be to ask some editors to recompile their best sellers  for the new machine: those games being from the PSX age or even older console generations, I think this would have a very low cost job and they could still make some good profit, but I need to know if this is doable technically, considering the architecture which can be quite exotic.

Do you think it would be a viable project to talk about to investors ?

sentences: Any problems with flipping a sprite by scale? (2d Platformer) I am wondering if there are any problems with flipping a sprite on the x-axis using vector2 to tell which direction it is facing/flip. Though doing this helps me write less code for Ray-cast direction and creating single states with a single animation (using 1 animation player facing right than using 2 animation facing left and right). If there is a better solution please tell me and thanks. Btw I am still pretty new and learning.

sentences:
What is the difference between WaitForSecondsRealtime and a counter? I am making my own button using the Unity UI code, but now I got to the OnFinishSubmit () coroutine
private IEnumerator OnFinishSubmit()
{
    float fadeTime = base.colors.fadeDuration;
    float elapsedTime = 0f;
    while (elapsedTime < fadeTime)
    {
        elapsedTime += Time.unscaledDeltaTime;
        yield return null;
    }
    this.DoStateTransition(base.currentSelectionState, false);
    yield break;
}

But I want to use a different code to delay time
IEnumerator FinishSumbit()
{
    yield return new WaitForSecondsRealtime(colors.fadeDuration);

    DoStateTransition(currentSelectionState, false);
}

Will this also work?
Why didn't the Unity developers use WaitForSecondsRealtime?

sentences:
What are the legal issues when using free Unity Assets on a commercial game? In the unity asset store one can find tons of thousands of assets, a lot of them being distributed for free.

When using a free Unity Asset is it implied that you can do anything with it(commercial or not)?

Is there any legal agreement concerning free Unity Assets?

sentences:
How do I get the camera's local XYZ axis in Direct X 11? I'm currently working on quaternion rotation and I have them working, but it seems to be using the world XYZ axis to rotate around, which is an issue as the camera rotates itself around an axis.

Similar to the last image, how do I rotate the camera around its local XYZ axis rather than the world XYZ?

Edit:

The camera now rotates around its local axis, but when doing so, it does not change its values in world space. I can hold a key down and it will rotate around the correct axis, but once I release the key it will snap back to its original position before the rotation began. What must I do to allow the local changes to be applied to world space?

sentences:
Unity 5.6.0f3 Inspector Tooltips are off in macOS, is me or everyone the same? Running latest version (5.6.0f3) in macOS, my tooltips are always misalign to the left of my screen, is me or anyone else also experience the same? And, it is still misalign even after I reset the layout setting to factory default.

Here are the screenshots http://imgur.com/a/dR0Pv

Update: Filed a bug report.

sentences:
PreferredBackBufferWidth/Height from GraphicsDeviceManager not working? It works fine in other "projects" so it has something to do with project.
The project im talking about here has tons of classes but nothing with graphicsdevicemanager other than game1.cs
game1.cs starts with

    GraphicsDeviceManager graphics;

then in public game1()

        graphics = new GraphicsDeviceManager(this);
        graphics.PreferredBackBufferWidth = 1024;

nope, the game is still 800x600.
I have also tried adding graphics.ApplyChanges(); while I dont need it in game1 and would be calling twice, still didnt work.

HOWEVER, if I add

        graphics.PreferredBackBufferWidth = 1024;
        graphics.ApplyChanges();

to "Initialize" (graphics' init is still from game1) it works

as you can see, I can fix it by going to Initialize and wasting some resource but I wonder why this is happening ? Im sure someone else in my code doesnt interfere.(I have no idea if something like this exist in properties etc. tho)

sentences:
Why would a property be returning null? I'm working on learning how pass data from one script to the other in Unity and I'm getting a little confused.  I have two scripts, PlayerData and CreateCharacter.  PlayerData is used to pass persistent data from one scene to another, so it's not going to be attached to any GameObject or Transform.  CreateCharacter, however, is attached to a button which gets the information from user input.  Here are the two scripts:

PlayerData

public class PlayerData{
    private string playerName;

    public string PlayerName{
        get{return playerName;}
        set{playerName = value;}
    }
}

CreateCharacter

public class CreateCharacter:MonoBehaviour{
    public InputField playerName;
    public PlayerData playerData = new PlayerData();
    public void AddStats(){}
    public void SubtractStats(){}

    public void CreateCharacterOnClick(){
        playerData.PlayerName = playerName.text;
        Debug.Log(playerData.PlayerName);
    }
}

What's happening is, when I click the button I'm getting a null reference error on playerData.PlayerName but if I just log playerData I actually get the object to return.  What I'm trying to see is that the character name(playerName) is logged when the button is clicked.  Can anyone explain to me what I'm doing wrong and how to fix it?

sentences:
When entities don't draw themselves, who actually does? There are countless questions here about whether entities should draw themselves or not. The answer is almost universally no, there should be a renderer. And I do see a point in having a single place where everything is rendered. Makes asset management easier and the code less convoluted.

However, I'm struggling to find a good approach to implement this in my 2D game. Currently, every entity is told to draw itself, and I pass the renderer object to it. Now, I want the renderer to draw each entity, but I don't want the renderer to actually know about entities, so I need a more generic class, e.g. RenderObject, and a way to construct render objects from entities.

One obvious approach would be to have a GetRenderObject() method on each entity. However, some of my entities actually draw multiple textures, relative to their position, so I'd probably need a GetRenderObjects() function instead.

But that wouldn't really remove any rendering logic from my entities. I'd still have to refer particular assets and their positions relative to the entity position in the render objects I create.

So my question is: Doesn't having a renderer mean that my entities don't have any drawing logic anymore? If so, who will generate these render objects? Does it even make sense to take the render objects detour?

And, bonus question: How can this work together with a UI system? I'd rather not have the renderer know about widgets and containers and such, so my hunch so far is to have widgets stick to drawing themselves.

sentences:
Why bother with a separate normal matrix, if there is never non-uniform scaling on the view matrix? I am updating one of my shaders to a version of OpenGL/GLSL that doesn't automatically provide gl_NormalMatrix (for educational purposes; I'm not ripping out working code for the sake of it). Therefore, I need to compute my own normal matrix on the CPU and pass it in.

I understand that a separate normal matrix is used to avoid issues with non-uniform scaling affecting the direction of normals. However, I've noticed that in my code I never perform any scaling let alone a non-uniform one. So, I'm tempted to use the upper left 3x3 sub-matrix for transforming my normals and calling it a day (perhaps normalising them to allow for uniform scaling).

My program assumes that every mesh it loads is already at the correct size, with no scaling required.

Will I soon run into something that requires scaling (uniform or otherwise), or is there another reason for using a separate normal matrix that I haven't realised?

sentences: Framerate limited by lack of mouse movement? Using Torque, it appears that the program is running at around 25fps when the mouse is still, but as long as I keep the mouse moving, the framerate can hit well over 300fps. What in the world would cause the framerate to be tied to mouse movement?

sentences:
How can I calculate where my camera can be to avoid showing something outside a region? I have a landscape model, which goes from the coordinate -45, -45 to 90, 90.

The edge of the model just cuts off and i would like to somehow stop the screen from ever passing these points. Basically sticking a boundary so that you can't see off the side. The game is always in top view, with the camera directly facing down.

However the problem is that the player can zoom in and out, obviously you have a wider range of view when zoomed out. (There is a limit to how far you can zoom out, you couldn't zoom out say, so that opposite sides of the map are seen at once).

I am assuming using something like Viewport.Project or Unproject, which changes screen coordinates to 3d space and the other way round, could somehow help me in the situation.

My initial idea may lag too much, which would be a while loop saying "While projection of screen point.X is less that -45, add 1 to the camera.X" etc.

Does anyone have any ideas for this? To sum it up, i need to find a way of stopping anything outside the area of -45, -45 to 90, 90 from being shown on the screen.

Thanks for any help!

sentences:
How can I achieve a flickering torch/candle effect in 2D? I'm currently working on a 2D lighting system that has point lights effectively rendered as a quad in a top-down 2D view, something like this for each light:

I'd like to achieve a somewhat realistic "flickering" effect by changing the position and attenuation of the light over time, simulating the light emitted from a torch or candle. What would be a good way to adjust these attributes of the light, and how quickly / over how much time?

sentences:
How to create a linear plateform between two points? I have a set of 2D coordinates. Their positions are regular on the X axis, but unpredictable on the Y axis:

I would like to create slim platform between each point in order tu use it as ground for my game, expecting a result like this:

I'm working with Box2D, so I thought about create boxes like this:

float x1, y1, x2, y2; // Coordinates between two points
float centerX, centerY;
float differenceX, differenceY;
float width;
b2BodyDef bodyDef;
b2Body* body;
b2PolygonShape shape;

centerX = (x1 + x2) / 2.0;
centerY = (y1 + y2) / 2.0;
differenceX = x2 - x1;
differenceY = y2 - y1;
width = sqrtf(differenceX * differenceX + differenceY * differenceY);
height = 10.0f

bodyDef.position.Set(centerX, centerY);
bodyDef.angle = -M_PI / 4.0f * width / height
body = world.CreateBody(&bodyDef);
shape.SetAsBox(width, 10.0f);
body->CreateFixture(&box, 0.0f);

But the wrong part of this code seems to be on angle. I cannot find the correct rotation between two points from their coordinates.

Is there a correct math formula to find it?
Or am I simply wrong to use rectangular boxes to trace it, and should I use something else? Like a b2PolygonShape?

sentences:
How can I rotate an object with random speed with some delays? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Turn_Move : MonoBehaviour {
    public int TurnX;
    public int TurnY;
    public int TurnZ;

    public int MoveX;
    public int MoveY;
    public int MoveZ;

    public bool World;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        if (World == true) {
            transform.Rotate(TurnX * Time.deltaTime,TurnY * Time.deltaTime,TurnZ * Time.deltaTime, Space.World);
            transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.World);
        }else{
            transform.Rotate(TurnX * Time.deltaTime,Random.Range(3,300) * Time.deltaTime,TurnZ * Time.deltaTime, Space.Self);
            transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.Self);
        }
    }
}

This is the random part :

Random.Range(3,300)

but sine it's changing the random numbers too quick the changes are almost not visible. I want somehow to make that if for example the next random will stay for example 5 seconds at this speed number then move to the next random number and again stay at this number 5 seconds and so on.

Tried this :

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

public class Turn_Move : MonoBehaviour {
    public int TurnX;
    public int TurnY;
    public int TurnZ;

    public int MoveX;
    public int MoveY;
    public int MoveZ;

    public bool World;

    private bool IsGameRunning = false;

    // Use this for initialization
    void Start ()
    {
        IsGameRunning = true;
        StartCoroutine(SpeedWaitForSeconds());
    }

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

    }

    IEnumerator SpeedWaitForSeconds()
    {
        var delay = new WaitForSeconds(3);//define ONCE to avoid memory leak
        while (IsGameRunning)
        {
            if (World == true)
            {
                transform.Rotate(TurnX * Time.deltaTime, TurnY * Time.deltaTime, TurnZ * Time.deltaTime, Space.World);
                transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.World);
            }
            else
            {
                transform.Rotate(TurnX * Time.deltaTime, Random.Range(3, 300) * Time.deltaTime, TurnZ * Time.deltaTime, Space.Self);
                transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.Self);
            }

            yield return delay;//wait
        }
    }
}

but that just rotate the object once each 3 seconds. and not rotating it all the time with speed changing every 3 seconds.

but now it's not rotating for 3 seconds it rotating every 3 seconds.

better to describe what I want is like intervals. The object should spin all the time nonstop like i Update but then each 3 seconds to change for a random speed.

for example spin at speed 5 ....after 3 seconds spin at speed 77 ....after 3 second spin at speed 199

sentences: Optimization for Normal maps with lots of wasted space? I'm working on level/character assets where I'm finding that I use only very little amounts of normal mapping on them, resulting in 2048x2048 textures that are mostly blue/purple. Is there any method to better optimize this, perhaps use one normal map for several assets?

sentences:
Rotating each quad in a batch separately? Background

In my app I use the following code to rotate my quad:

Code

    //Rotate the quad

Matrix.setIdentityM(mRotationMatrix, 0);
Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
Matrix.rotateM(mRotationMatrix, 0, -angle, 0, 0, 0.1f);
Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);

And then apply the matrices:

// Combine the rotation matrix with the projection and camera view
Matrix.multiplyMM(mvpMatrix2, 0, mvpMatrix, 0,  mRotationMatrix, 0);
// get handle to shape's transformation matrix
mMVPMatrixHandle = GLES20.glGetUniformLocation(iProgId, "uMVPMatrix");
// Apply the projection and view transformation
GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix2, 0);

The above code works great when I'm drawing single quads.

Problem

However, if I have a few quads with the same texture to draw, I batch them up and draw them with one call to glDrawArrays.

I can't work out if it is possible to rotate each individual quad before drawing them (or how to do it if it is possible) - I realise, they will all be rotated the same amount at the same time but this isn't an issue).

Rotation method

public void rotateBatchQuads(int[] coordinates, int angle){

    for (x=0;x<coordinates.length;x+=2){

        //Center of quad (Along the x)
        float centreX = coordinates[x]+quadWidth/2;  //Pseudo code
        float centreY = coordinates[x+1]+quadHeight/2 //Pseudo code
        //Center of quad (Along the y)

        //Rotate the quad
        Matrix.setIdentityM(mRotationMatrix, 0);
        Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
        Matrix.rotateM(mRotationMatrix, 0, -angle, 0, 0, 0.1f);
        Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);
    }
}

sentences: How to find asset by it's number? Don't know what this number means I need to find the asset that is displayed by this number inside my project. I guess this number means "GUID" but it's hard for me to understand what is it. Can you help me guys?

sentences:
SFML Texture issue removing from memory I am currently working on loading tmx levels into my game, all is going well and i have layers being loaded textures being loaded and all the data being loaded such as level name, tile sizes etc.

The issue

Loading 1 texture for tiles is perfectly ok, but loading more than 1 the texture seems to get removed from memory (only white squares are displayed) I'm not going to include all my code as there's lot's of it but i will include a couple of snippets.

//code inside load function.
Texture texture;
texture.loadFromFile(src);
Texture *t = addTexture(texture);
loadTileSheet(twidth, theight, t);

Texture* Level::addTexture(Texture texture){
    Level::textures.push_back(texture);
    return & textures[textures.size() - 1];
}

I am then outputting all the information to the console of the tileset this is as follows:
mem adress 1 is the texture creation and mem adress 2 is the adress in the vector.

Tileset Information: nametileset2 | src G:/C++/Workspace/test/res/tileset2.png | tWidth: 32 | tHeight32 | MemAdress 1: 0x85d028 | MemAdress 2: 0xa81848

currently this works,  loading in a second texture outputs this and breaks all the first set of textures.

Tileset Information: nametileset2 | src G:/C++/Workspace/test/res/tileset2.png | tWidth: 32 | tHeight32 | MemAdress 1: 0x85d028 | MemAdress 2: 0x82522b0

I'm pretty sure this is something simple that i have over looked, and I'm pretty sure the first texture is somehow being removed from memory when the second one is created somehow.

Thanks in advance:

Jordan

sentences:
How to make image bigger than the screen to be slideable in the screen in monogame for windows phone 8? (Idk if my title is correct, because when I google it, there is no related result I guess)

I am not sure how to explain it correctly, but I am making a plain 2D, tile based, tactic game in windows phone 8 using monogame. I want to make my map is "slideable". With "slidable" I mean I can draw larger images (in total) than my screen and then slide it so I can view a certain area of the drawn images

Example : I have a screen which dimension is 1280x720. I have a 1500x1500px image, which consists of 15 tiles, which is 100x100px each, which each tiles is redrawn each times the "Draw" is called. If the image is larger than the screen, the displayed area will be trimmed and of course, making a 220x780px area that is unseenable. The only way to see all of it is through "sliding" the screen around, so I can see all the area.

My question is : How to make that happen? Because in default, the screen is unslideable and the image remains trimmed.

Sorry if my question and explanation is not clear enough. Clarify it as much as you like. Thank you.

sentences:
How to achieve uniform speed of movement on a bezier curve? I'm trying to move an image along Bezier curve. This is how I do it:

- (void)startFly
{
 [self runAction:[CCSequence actions:
             [CCBezierBy actionWithDuration:timeFlying bezier:[self getPathWithDirection:currentDirection]],
             [CCCallFuncN actionWithTarget:self selector:@selector(endFly)],
             nil]];

}

My issue is that the image moves not uniformly. In the beginning it's moving slowly and then it accelerates gradually and at the end it's moving really fast. What should I do to get rid of this acceleration?

sentences:
Game with changing logic I'm planing to develop a puzzle like mobile game (android/ios) with a different logic for each puzzle. Say, for example one puzzle could be a Rubik's cube and another one a ball maze. Many more new puzzles will appear during the life of the game, and I want the users to be able to play those new puzzles.

The standard way for managing this would be through application updates. Each time a new puzzle or bunch of puzzles appear, create a new update for the app that the user can download.
However, I would like to do it in a more transparent way. When a new puzzle appears, the basic info of the puzzle would be displayed in the app menu, and the user would be able to play it by just clicking it.

What comes to my mind is that the app would automatically download a .dll or .jar and inject it in the application at runtime.
Is that even possible? Are there any restrictions from the OS? Is there a better way for solving it?

Thanks alot

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 access a struct that resides within a struct in blueprints? I have a struct: "FOuterStruct"

This is defined in code such that it contains another struct type:

Struct OuterStruct
{
    UPROPERTY(...)
        FInnerStruct memberStruct;
}

Now.

When I break an FOuterStruct apart within blueprints, I do not get the FInnerStruct as a pin on the resultant node.

How am I to edit/access this FInnerStruct?

sentences:
How to draw a Voronoi Splitscreen view in GMS, where each player's screen area is a polygon shape? I'm trying to implement the Voronoi Splitscreen effect that Squirrel Eiserloh described at GDC 2016, and I'm having trouble figuring out how to 'clip' the rendered scene for one player along a diagonal line or polygonal shape.

So how can I draw the scene inside set of points or a shape other than rectangle?

sentences:
Resize font when screen resizes desktop Libgdx I create my font using the following code:

public BitmapFont createFont(FreeTypeFontGenerator ftfg, float dp)
{
    FreeTypeFontParameter f = new FreeTypeFontParameter();
    f.size = (int)(dp * Gdx.graphics.getDensity());
    f.color = Color.BLACK;
    f.minFilter = Texture.TextureFilter.Nearest;
    f.magFilter = Texture.TextureFilter.MipMapLinearNearest;
    ftfg.scaleForPixelHeight((int)(dp * Gdx.graphics.getDensity()));
    return ftfg.generateFont(f);
}

myFont = createFont(new FreeTypeFontGenerator(Gdx.files.internal("Fonts/Roboto-Black.ttf")), 16);

I have some labels to which I set the font using:

Label myLabel= new Label("Text", uiSkin);
        myLabel.setWrap(true);
        myLabel.getStyle().font = myFont;

How I create the stage:

Stage collectionStage = new Stage(new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getWidth()));

I also tried with no viewport or with other viewports.

In my resize method:

public void resize(int width, int height) {
    Viewport viewport = collectionStage.getViewport();
    viewport.update(width, height, false);
    viewport.apply();
}

The problem is that when I resize the window on Desktop the font gets distorted. Do I have to create another font in the resize method, and then for each label that I have, reassign the new font? Or should I do something else?

sentences:
XNA 3d model mesh.draw() throws TextureCoordinate0 is missing error I've downloaded a bunch of 3d models from turbosquid.com. The majority of the one's I've downloaded are simply .fbx files. When I load the model into my game and run it, the following error is thrown in mesh.draw():

An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.Graphics.dll

Additional information: The current vertex declaration does not include all the elements required by the current vertex shader. TextureCoordinate0 is missing.

All the answers I've found online seem to tell people to reexport the model, or change something in the shader. I don't have access to these, just the fbx file. What can I do?

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:
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: SharpDX Texture to Image in C# I currently have an image processing application that outputs processed images post pixel shaders have been applied. However, using the examples I've found on the internet, the colors are flip to BGRA when RGBA is expected. I currently work around this with by post export processing to get the desired RGBA format. I was hoping someone else has dealt with this and has a solution that does not require post processing to correct the format.

sentences:
Calculating projectile path when fired at an angle, forward I have a problem to code the path of a projectile from a gun as it moves forward and upward. This needs to be done in p5.js.

Although the Angry Birds method has been tried by me, I am looking for a more physics derived function involving the sine and cosine of angle of the gun.

sentences:
Unity keepy uppies game Hello guys I'm tryting to make a game in unity of keepy uppies but I can't make the ball bounce to different directions like keft and right only staright up.

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

public class physics : MonoBehaviour
{
    public Rigidbody rb;
    public float force = 10;

    void Start()
    {
        rb.velocity = new Vector3(0, 0, force);
    }

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 100.0f))
            {
                if (hit.transform != null)
                {
                    //PrintName(hit.transform.gameObject);
                    if (rb = hit.transform.GetComponent<Rigidbody>())
                    {
                        LaunchIntoAir(rb);
                    }
                }
            }
        }
    }

    private void PrintName(GameObject go)
    {
        print(go.name);
    }

    private void LaunchIntoAir(Rigidbody rb)
    {
        rb.velocity = new Vector2(rb.velocity.x, 3);
    }
}

This is what I have done until now.

sentences:
Multithreaded game fails on SwapBuffers in render thread at exit The render loop and windows message loop run on separate threads. The way the program exits is that after PostQuitMessage is called in WM_DESTROY the message loop thread signals the render loop thread to exit. As far as I can tell before the render loop thread can even process the signal it tries SwapBuffers and that fails.

My question, is there something about how Windows processes WM_DESTROY and WM_QUIT, in maybe DefWindowProc that causes various objects associated with rendering to go away even though I haven't explicitly deleted anything? And that would explain why the rendering thread is making bad calls at exit?

sentences:
C# (Unity) Use a method common to multiple classes with the same base class The Problem:

I'm building one of those empire/kingdom building games and so I am trying to create an efficient way of making a "ResourceManager" class handle the games resources (wood, food, iron, stone). I currently repeat a function 4 times to do the same thing.

Attempt 1:

I created a "Resource" class (abstract) and derived the four resources from it. In each resource there are multiple methods which are similar:

Example Food.CS:

    new public static void AddResources(int amount) {

    Player.currentFoodSupply += amount;
    foodText.text = Player.currentFoodSupply.ToString();
}

Compare to Iron.CS:

new public static void AddResources(int amount)
{
    Player.currentIronSupply += amount;
    ironText.text = Player.currentIronSupply.ToString();
}

The AddResource() function is static because I have other scripts (like buildings, when they get upgraded) needing to communicate with each resource. The base building class currently has a method like this:

public void DeductResources()
{
    Food.DeductResources(FoodCost);
    Wood.DeductResources(WoodCost);
    Iron.DeductResources(IronCost);
    Stone.DeductResources(StoneCost);
}

This seems like it's so repetitive that there needs to be a more efficient way to do this.

Attempt 2:

A "ResourceManager" class that anything to do with the 4 resources can go through this one script. I can update that one script instead of numerous scripts that does something with the resources.

Where I am undecided is this one:

public static void DeductResources(Resource resource, int amount)
{
    if(resource.GetType() == typeof(Food))
    {
        Player.currentFoodSupply -= amount;
        resource.resourceText.text = Player.currentFoodSupply.ToString();
    }
    else if (resource.GetType() == typeof(Wood))
    {
        Player.currentWoodSupply -= amount;
        resource.resourceText.text = Player.currentWoodSupply.ToString();
    }
    else if (resource.GetType() == typeof(Iron))
    {
        Player.currentIronSupply -= amount;
        resource.resourceText.text = Player.currentIronSupply.ToString();
    }
    else if (resource.GetType() == typeof(Stone))
    {
        Player.currentStoneSupply -= amount;
        resource.resourceText.text = Player.currentStoneSupply.ToString();
    }
}

It looks like it works and I can't see a way around calling the above method 4 times as I need to know how much food or wood to add or deduct.

Does anyone have any suggestions please on how to improve this code/call the method once?

I'm always willing to learn! Thank you

sentences: Is it worth it to encrypt data? I am using Java to write a moderately simple video game and I need to transfer some large files (edit: Live game data and possibly assets.) between the client and the server. I need to decide whether I want to encrypt the data even though no sensitive information is being transferred. If I were to encrypt the data what method would be the best? Also, does encrypting data make cheating harder?

sentences: What happens to allocated video memory when the program terminates? Using OpenGL it is possible to load textures, buffer arrays, compiled shaders and more to the video memory. When a C++ program exits, heap memory that was allocated by it is cleaned. What happens to the stuff allocated on the video memory? Will memory leak beyond program's scope?

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:
Are difficult code tests when applying for jobs the norm? I just did the online tech test for Lionhead and found it a bit defeating. There were questions that required you to work out the answers to recursive algorithms that accepted arrays as arguments and made multiple calls each run through, thus splitting off into exponentially more versions. This all had to be done on paper or in your head.

There were also questions that asked you to evaluate the efficiency of theoretical algorithms and say what Big O notation you think would best describe their scaling, something that I have never been taught or learned.

There were 27 such questions. Is this usual? Is this the standard of entry level games programming? I mean, I've written 3D games, but I found this really hard.

EDIT - I have actually done another tech test for another company now which was considerably easier. I had to write various different linked list algorithms and write a routine in sudo code for how I would mathematically calculate a bot's sight given a world up vector and a forward vector.

sentences:
Making the camera look at the player while keeping another object in view I'm working on a sorta football game where I need my player to always be at the center of the camera view while keeping the ball into view, without any vertical movement. The idea would be for the camera to act like the picture below.

What I came up with was the following code that I'm using in a LateUpdate. I'm computing a directional vector between the player and the ball and placing my camera behind the player using that data, and then I look at my player.

Vector3 ballPosition = ballTransform.position;
Vector3 playerPosition = playerTransform.position;

ballPosition.y = 0.0f;
playerPosition.y = 0.0f;

Vector3 directionVector = (ballPosition - playerPosition).normalized;
directionVector.y = 0.0f;

Vector3 newPosition = playerTransform.position - directionVector * 12.0f;
newPosition.y = 9.0f;

transform.position = newPosition;

transform.LookAt(playerTransform.position);

The code itself is working, but the camera movement is a bit nauseous, and when I'm trying to smooth it I end up with the ball leaving the camera field most of the time. Plus when I get too close from the ball I end up with some really quick camera movements which makes the whole thing kinda hard to follow. I tried to use a totally different technique by working with a Cinemachine Camera, but there doesn't seem to be an easy way to achieve such a view.

Does anyone have an idea of how to achieve such a thing?

sentences:
texture cordinate VBO not being updated OpenGL I'm making a minecraft style game and I decided to add a VBO with the texture atkas coordinates of the vertices but it is appearing all white. However I'm following the same process as another VBO for the block positions which works

the one that works

glBindBuffer(GL_ARRAY_BUFFER,chunk->posOffsetVBO);
glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec3)*65536,NULL,GL_DYNAMIC_DRAW);

glVertexAttribPointer(2,3,GL_FLOAT,GL_FALSE,3*sizeof(GLfloat),(GLvoid*)0);
glEnableVertexAttribArray(2);
glVertexAttribDivisor(2,1);

then I fill it with glm::vec3s like this

glBindBuffer(GL_ARRAY_BUFFER,adjacentChunks[1][1]->posOffsetVBO);

glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(posOffsets),&posOffsets[0]);

this is the one with the texture coordinates that doesn't work

glBindBuffer(GL_ARRAY_BUFFER,chunk->texCoordVBO);
glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec2)*36*1000,NULL,GL_DYNAMIC_DRAW);

glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,2*sizeof(GLfloat),(GLvoid*)0);
glEnableVertexAttribArray(1);

then  fill It with 36 glm::vec2s for each block so one per vertex

glBindBuffer(GL_ARRAY_BUFFER,adjacentChunks[1][1]->texCoordVBO);

glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(texCoords),&texCoords[0]);

Is there a reason why the texture one doesn't work?

sentences:
Why does player still leave map? I'm making a simple HTML5 RPG in pure JavaScript likened after Nox, Diablo or Titan Quest, with the character centered on the screen and the map moving around it.

TL;DR: My character, when colliding with the map edge, can still move outside the map in some cases. How do I quell this inconsistency?

Explanation: I have simple rectangles for the map, character, and one enemy, and I'm using bounding-box collision detection for them. When the character pushes against the map's edge, it stops moving, but the enemy box moves opposite of my character's trajectory of motion. When the enemy hits the wall, it stops, but the collision detection for my centered character fails and I'm flung into the void.

Here is a screenshot demonstrating this (map=white, character=blue, enemy=red):

Here are some bits of relevant code that might help:

Box object:

function Box() {
    this.x = 0;
    this.y = 0;
    this.width  = 50;
    this.height = 50;

    this.init = function(x, y, w, h, c) {
        ...
    };

    this.move = function(dir, amt, reverse) {
        ...
    };

    // stops 'obj' from leaving 'this'
    this.constrain = function(obj) {
        if(this.x > obj.x) {
            this.x = obj.x;}
        if(this.y > obj.y) {
            this.y = obj.y;}
        if(this.x + this.width  < obj.x + obj.width) {
            this.x = obj.x + obj.width  - this.width;}
        if(this.y + this.height < obj.y + obj.height) {
            this.y = obj.y + obj.height - this.height;}
    };
    this.draw = function() {...};
}

Main code:

var m = new Box();
var p = new Box();
var e = new Box();

function rand(a, b) {return ((Math.random()* (b - a)) + a);}

// monster moves away from player on player collision with map.
// player moves off map on monster collision with map.
function init() {
    p.init(cn.width/2 - p.width/2, cn.height/2 - p.height/2, 20, 20, "blue");
    m.init(p.x, p.y, 200, 200, "white");
    e.init(rand(m.x, m.x + m.width  - e.width), rand(m.y, m.y + m.height - e.height), 20, 20, "red");
}

function update() {
    if(key.left)  {
        m.move('left',  p.speed, true);
        e.move('left',  p.speed, true);
    }
    ...

    m.constrain(p);
    m.constrain(e);
}

function draw() {
    c.clearRect(0, 0, cn.width, cn.height);
    m.draw();
    p.draw();
    e.draw();
}

How would I make both the monster and the character consistently collide with the map?

I'm sorry in advance if the code/post is too long. I spent a good, long while shortening it up. I'll happily edit it, just ask. Thank you! :)

sentences:
Trying to understand the range of Improved Perlin noise I've been implementing Improved Perlin Noise for a small library I'm writing. Everything was hunky dory when it was just in the 3rd dimension, but I recently expanded to the 1st, 2nd, and 4th dimension, which is where things started get weird.

I originally thought that the range of Improved Perlin was +-1.0. When I implemented the 1st dimension version, I noticed that the unmodified range was +-0.5, ie, you had to multiply the result by 2, but figured nothing of it. 2nd dimension worked just like 3rd, with both working within the +-1.0 range. Then when I got to 4th, I ran a large number of samples and saw that I was getting results outside the -1.0 to +1.0 range.

I started Googling, and apparently the +-1.0 range is a common misconception? The solution I've read in a couple places, which is +-1/2(sqrt(N)), where N is the number of dimensions, implies the following ranges for dimensions 1 through 4:

0.5, ~0.71, ~0.87, 1, respectively

However, the only version I have which matches this is the 1st dimension, which as I said, works out to +-0.5 before multiplying by 2. For dimensions 2 and 3, I get +-1.0 without any need to modify the result, and for the 4th dimension, I believe my results are actually in the range of the 6th dimension according to that solution.

The following is my code:
https://pastebin.com/CpAi3PUF
And for those who aren't familiar, it's Cython, so yes, a weird Frankenstein of Python and C.

I use the following code to test the ranges of each dimension: https://pastebin.com/yUpw1Z00
Since my method involves just running tons of random inputs over and over, I did run this test a few times to make sure the results are consistent, which they are, and here is an example of the output:

DIM1 - Minimum: -0.999999999999943 | Maximum: 0.9999999999871175 | Average: 0.0003455999808678627
DIM2 - Minimum: -0.9999515602331069 | Maximum: 0.999900249691747 | Average: -0.00011840974404335401
DIM3 - Minimum: -0.9932063986908607 | Maximum: 0.9931959744642007 | Average: -0.00010701170753012655
DIM4 - Minimum: -1.0576886515898196 | Maximum: 1.123720946368049 | Average: 0.00022555631399532482

You can clearly see that as my code is written, dimensions 1 through 3 have a limit of +1.0, and then with the 4So clearly there is some contradiction between the alleged result ranges, and the code I'm implementing. The 3rd and 4th dimensions were implemented straight from Perlin's own example code.

3rd Dimension: https://mrl.nyu.edu/~perlin/noise/

4th dimension: https://mrl.nyu.edu/~perlin/noise/ImprovedNoise4D.java

The only major changes I've made to the implementation are in the grad functions, where I use what is essentially a switch case, rather than Perlin's fancy pants (but extremely expensive) bitshifting method. But afaik doing so is functionally equivalent.

Can anyone provide some insight as to what is going on? What is causing the difference between the supposed expected ranges, and my actual results? And what can I do to get the 4th dimension "in shape", like how modifying the 1st dimension is required?

Thanks so much for any help.

sentences:
Sprite won't change with direction I am making a top down Pacman game. I have two sprites: one for facing up and one for facing left.

When I press W, the sprite showing is still the one for when Pacman is moving left, but I want to see the up sprite instead.

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

public class pacman : MonoBehaviour
{
    public int speed;
    Vector2 dest;
    public Transform[] points;
    // Start is called before the first frame update
    void Start()
    {
        dest = transform.position;
        speed = 25;

    }

    // Update is called once per frame
    void FixedUpdate()
    {
        //Vector2 p = Vector2.MoveTowards(transform.position, dest, speed);
       // GetComponent<Rigidbody2D>().MovePosition(p);

        // Check for Input if not moving
        if (Input.GetKey("w"))
            transform.position = Vector3.MoveTowards(transform.position, points[0].position, speed * Time.deltaTime);

        gameObject.GetComponent<SpriteRenderer>().sprite = GameObject.Find("up").GetComponent<SpriteRenderer>().sprite;

        if (Input.GetKey("d"))
            transform.position = Vector3.MoveTowards(transform.position, points[2].position, speed * Time.deltaTime);

        if (Input.GetKey("s"))
            transform.position = Vector3.MoveTowards(transform.position, points[1].position, speed * Time.deltaTime);

        if (Input.GetKey("a"))
            transform.position = Vector3.MoveTowards(transform.position, points[3].position, speed * Time.deltaTime);

        gameObject.GetComponent<SpriteRenderer>().sprite = GameObject.Find("left").GetComponent<SpriteRenderer>().sprite;
    }
}

sentences:
Using XNA ContentPipeline to export a file in a machine without full XNA GS My game uses the Content Pipeline to load the spriteSheet at runtime. The artist for the game sends me the modified spritesheet and I do a build in my machine and send him an updated project. So I'm looking for a way to generate the xnb files in his machine (this is the output of the content pipeline) without him having to install the full XNA Game studio.

I don't want my artist to install VS + Xna (I know there is a free version of VS but this won't scale once we add more people to the team).
I'm not interested in running this editor/tool in Xbox so a Windows only solution works.
I'm aware of MSBuild options but they require full XNA

I researched Shawn's blog and found the option of using Msbuild Sample or a new option in XNA 4.0 that looked promising here but seems like it has the same restriction: Need to install full XNA GS because the ContentPipeline is not part of the XNA redist.
So has anyone found a workaround for this?

sentences:
Developing games in Go? Google's new Go language is still in its infancy, and it has yet to find widespread real-world use or support.  Even so, it seems like a promising experiment, and I wonder if it could have a future in game development.  I haven't been able to find much game-specific discussion of Go elsewhere, and figured a CW discussion may be appropriate.

Some thoughts:

According to golang.org, Go programs "run nearly as quickly as comparable C or C++ code"--quick enough?
Is Go's garbage collection well suited for games?
How much mental re-tooling is necessary to create games in the land of concurrent goroutines?
Go is frequently called a "systems"-level language, with server software given as an example.  It's hard not to think of multiplayer game servers when hearing this.

Your thoughts?

sentences:
Goalkeeper Jumping Algorithm? This may be a "best way to" question, so may be susceptible to opinion-based answers (which is ok for me). But I would also like if there are any tutorials , research papers , etc.

I'm trying to make a 3D free kick game, and I want to decide on the Goalkeeper algorithm.

Usually (and in my game) the shot is a function of direction , power and swerve. Maybe wind can be a factor too. So the shots trajectory is pre-deterministic, i.e., the point that intersects the goal (or out) plane is determined as soon as the shot fires.

So what could be a good approach for the goalkeeper to jump (or walk) ?

I have two approaches in mind :

1- determine the point, and jump to there.
2- when the ball is closer than a threshold distance, estimate the point by the ball's velocity vector, and jump to there.

The problem with the first approach is, goalkeeper will always save the shot, which I want to prevent. So there should be some kind of randomness, or the goalkeeper's ability to jump and walk will be restricted.

The problem with the second approach is, when there is a high amount of swerve, the goalkeeper will always fail to save the shot.

So how could these approaches be better?

Thanks for any help !

Edit:

if you want to play the game, click here

sentences:
Unity 2D play animation with flipX then enabling and disabling GameObject "locks" flipX I have a GameObject with an Animator that contains many different animations. In C# I switch between these animations with animator.Play("AnimName"). Some of the animations have the flipX property checked, so I can use the same sprite for two different directions.

This works well, but I have one animation where after it is done I call gameObject.SetEnabled (false) then re-enable it a short while later. I achieve this through an event at the end of the animation which calls a method in my script.

For some reason, if the last animation I played before disabling the object had the flipX property checked, then all the other sprite animations will be flipped after it is reenabled. I can fix this by adding the flipX property to the other animations then unchecking it, but I don't want to have to go through all my animations to add an unchecked property.

This seems like a bug to me, but if it's not, is there some way I can change the behavior?

sentences:
How can I make expanding bullet pattern shapes? I want to make a series of expanding bullet patterns that form shapes such as squares, triangles, etc. An example of what I'm after can be seen in the following video where when the stars are collected the bullets explode in the shape of an expanding star:

https://youtu.be/7JGcuTWYdvU?t=2m41s

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:
What is a fast way to darken the vertices I'm rendering? To make a lighting system for a voxel game, I need to specify a darkness value per vertex. I'm using GL_COLOR_MATERIAL and specifying a color per vertex, like this:

glEnable(GL_COLOR_MATERIAL);

glBegin(GL_QUADS);

glColor3f(0.6f, 0.6f, 0.6f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.3f, 0.3f, 0.3f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.7f, 0.7f, 0.7f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.9f, 0.9f, 0.9f);
glTexCoord2f(...);
glVertex3f(...);

glEnd();

This is working, but with many quads it is very slow.. I'm using display lists too. Any good ideas in how to make vertices darker?

sentences:
Game Maker - Selecting tiles in an isometric grid I have implemented an isometric grid with rotation in 2 directions in Game Maker. I did this by first calculating the points of the grid in 3D space and then converting them to 2D points through equations I derived from rotation matrices. I use a single object to draw the grid, and would like to be able to click on a tile to select it.

Here are the equations I use to convert the initial 3D points (x, y, z) to isometric 2D points (iso_x, iso_y), where b and a are the angles I'm rotating the grid by:

iso_x = cos_b * x - sin_b * y
iso_y = cos_a * sin_b * x + cos_a * cos_b * y + sin_a * z

I attempted to rework the equations to calculate the tile from mouse coordinates, but I've run into the problem where I have 2 knowns (mouse_x, mouse_y) and 3 unknowns (x, y, z), which will make implementing height difficult.

So I guess I'm looking for suggestions on how to do tile picking better, especially when it comes to choosing tiles with height. If you need extra information, I will try to provide it.

I want to keep the rotations, so moving to sprite-based tiles probably won't work because the shape of the tiles will change as the grid rotates.

sentences:
Quaternion rotations & transforms from global to local space I am trying to solve this problem and getting no where,
could really use some assistance.
Rotation is defined as X (rotate left/right), Y(rotate up/down), Z(roll)
Coordinates are X: Forward/backward, Y: Left/right, Z: up/down

I have two objects in simulated space, both have galactic coordinates (XYZ)
and a quaternion representing their rotation.

ObjectA
  Coordinates: 0.593 0 0 (directly ahead of ObjB)
 RotationQuat: w: 0, x: 1, y: 0, z:0 (Rotated 180 yaw, facing backwards)

ObjectB
 Coordinates: 0 0 0
 RotationQuat: w: 1, x: 0, y: 0, z: 0 (No rotation, facing towards ObjA)

Given the above information, how do I translate ObjA's location into ObjB's
 local space?

If ObjA fires at ObjB (or vise versa), I need to calculate which side will be
 hit. Forward, Aft, Port, Starboard, Ventral or Dorsal.

My project is written entirely in C. Actually this is an old project, created
by someone else that I am converting to using quaternions due to gimbal lock.

Any advice?

sentences:
Can sprite sheet width and height affect performance? Is there any performance difference in the way the images are placed inside a sprite sheet image (for the same total area)?

For example, should I place 50 sprites (50x50 each) in a linear way creating a sheet of dimensions 50x2500px? Or is it better to split into multiple rows, say 10 sprites per row, and get a sheet of dimensions 500x250?

Assume that the graphics are hardware accelerated.

sentences:
ReorderableList in Unity with Enums I'm trying to setup a simple ReorderableList in Unity 2017.3 for a list of enums. Adding items workes fine but selecting, dragging and deleting items from the list does not (see gif).

Here is my code:

[Serializable]
public enum RoofType { HIP, GABLE, FLAT, NONE }

UnityEditorInternal.ReorderableList roofTypeList = new UnityEditorInternal.ReorderableList(roofTypes, typeof(RoofType), true, true, true, true);
roofTypeList.drawHeaderCallback = (Rect rect) =>
{
   EditorGUI.LabelField(rect, "Roof types");
};
roofTypeList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
{
   roofTypes[index] = (RoofType)EditorGUI.EnumPopup(rect, roofTypes[index]);
};
roofTypeList.DoLayoutList();

Any ideas why this does not work? My guess it is because I use enums and not classes but it is not documented anywhere.

sentences:
Using GLFW and GLUT together I'm new to OpenGL

Lets say I create an OpenGL window using glfw and I need the UI feature from glut (such as popup menu). Is it possible to use glfw and glut in one program?

Thank you

sentences:
Creating valid virtual creature with 3d Boxes I'm creating this project in unity.Karl Sims, the creator of the project, published the paper describing the project. In order to create the 3d creature like in the video, I'm using 3d boxes and BoxColliders. The boxes are connected to each other with a ConfigurableJoint that limits their rotation limit on some axes. The creatures are then trained to learn different behaviors.

In order to create a new creature a tree is defined. A node in the tree includes data about itself like size or rotation limits, and connections to its children. Each connection includes the rotational limit of its children.

Collision is enabled between the nodes.

This system results in many different looking creatures. Some of them can't actually exist. For example, a creature with two nodes that are long boxes connected side to side really closely, but their connection also says one of them needs to be rotated by 90 degrees.
This creature will cause colliders to be in one another, which results in a fight between the Colliders pushing the boxes away, and the ConfigurableJoints pulling the boxes to each other. This results in the boxes moving around in an unnatural way. These creatures need to be eliminated.

I'm looking for a way to have as many valid creatures as fast as possible. Currently, I'm still using the same random creature generation method. After that, I add a Validator which that instantiates the creature's body and performs some checks.
The validation checks I tried are:
1. See if the creature is not moving
2. See if the colliders overlap with Physics.OverlapBox (I think this didn't work because regular creatures are also colliding and so it eliminated valid creatures)
3. See if there is an unreasonable force acting on the joint, which would indicate an overlap. This seems like the most promising, and I'm still testing it. The thing is that the creature learned to cheat this, during validation they didn't overlap, and when I added their control system (The brain of the creature) they push themselves to overlap.
4. Check for extreme accelerations out of nowhere. Had some success but the creatures adapted to the limit I set.

Currently, I'm leaning towards making the creature will a very small mass, so they don't need to apply a lot of force to move. I think this can help make detecting unreasonable forces easier.

Hopefully, I explained the problem in a manner that enables you to think about solutions. This is less of a code problem, but more of a unity collider and joints problem. I chose to not add code because it's just too much.

Edit:
Since I'm using an evolutionary algorithm, at each point in time, there is more than one creature. A regular evolution process is slow, but when a creature breaks the physics, it gains a big lead. Deleting creatures like that helped slow down the takeover of cheating creatures, but did not prevent it.

Many thanks.

sentences:
Animating two characters (like a fighting game) whose animations are tied together? So, say one character grabs another and throws him against a wall. Are these two separate animations that get attached to each character? Or is this really one animation that somehow involves each character model to itself?
I'm using the Unity game engine.

sentences:
Pixel Shader stage did not run I can't figure out why the pixel shader won't run. I'm using the Blinn-Phong per-pixel shader from here. Only change I've made is that I pass an aditional color per vertex which gets multiplied by the light-color in the pixel shader.

So far the Graphics Analyzer shows me a valid IA-result and the same (okay looking) result in the VS-stage. I disabled depth-stencil for testing and though everything looks rather fine I always see "Stage did not run. No output." when I inspect the captured frame.

This is my Projection-matrix:

_projection = Matrix.PerspectiveFovLH((float) Math.PI / 4.0f, viewports[0].Width / viewports[0].Height,
            0.1f, 100f);

Values are Width: 1346, Height: 800

My View is calculated like this:

_rotation = Quaternion.RotationYawPitchRoll(Yaw, Pitch, Roll);
Vector3.Transform(ref _target, ref _rotation, out _target);

Vector3 up = Vector3.UnitY;
Vector3.Transform(ref up, ref _rotation, out up);

_view = Matrix.LookAtLH(Position, _target, up);

Whereas Position: X:50, Y:50, Z:-300, Target: X:50, Y:50, Z:0 and Yaw, Pitch, Roll are all 0.

World-Matrix is currently Matrix.Identity.

The quad I try to render spans itself from X:0, Y:0 to X:100, Y:100 with 4 vertices and 6 indices.

I first thought that SV_POSITION must be a normalized value since it's obviously a SV-coordinate and someone posted in another thread that this solved his problem - but then the VS-stage does not show anything at all and PS still won't run.

It's been quite some years since I last worked with DirectX so I'm not sure anymore why this happens.

sentences:
Following a path in a smooth fashion I am currently making a 2d tower defense game with a static, predetermined lane that the enemies follow (i.e. towers cannot block the path and path finding is not the problem I am trying to solve).

I am trying to figure how exactly to make units follow this lane in a smooth way. I have two rough ideas about how to do this, but I would love some input on which is likely to be easier to implement/the more standard technique. Or of course if I there is some totally different way that I haven't considered I would love to learn about that as well.

Waypoints:
My first idea was to define the path as a series of hard coded waypoints. Units would then use a basic "seek" steering algorithm (such as this one) to move to each waypoint along the path in succession. However, I have wondered if it might be hard to keep the units from deviating to much from the lane I want them to follow. I wonder if inability to turn sharply enough might cause them to sort of "glide" out off of the desired lane. I suppose I might be able to prevent that though by allowing for a relatively strong steering force to be applied?

Bezier Curves:
The second solution I have considered is to define the path with a bezier curve and at each time step calculate the point along the curve with is (dt * speed) away from the unit's current location. I suspect that this technique would make it much easier to precisely define the path that units will follow, but I don't know know how exactly to go about implementing this. Any suggestions?

Also, I don't this will change anyone's answers, but units also must be able to travel at a constant speed along the path. Additionally, I am programming this game in python using the pyglet framework.

If anything about the question is unclear please let me know.

Edit:
Also for whatever its worth, I'm sort of trying to replicate the movement behavior of enemies in the Kingdom Rush.

sentences:
Fire at enemy script doesnt work I need my enemies to fire at me. I have a script and I think all is correct. I couldnt figure out why it doesnt work?

public class AntagonisticElCreator : MonoBehaviour {

public GameObject boom;
public float enemySpeed;

public bool move=false;
public bool shoot=false;
public Transform character;
Vector3 pos;
int boomnumber;

 public float bulletSpeed;
public float bulletDestroyTime;

public GameObject bulletPrefab;
public Transform bulletSpawn;

void Start () {
   bulletSpeed = 15f;
bulletDestroyTime = 8f;
    NumbarofBullet = 105;
}

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

    pos = new Vector3(character.position.x, transform.position.y, character.position.z);
    distance = Vector3.Distance(transform.position, character.position);
    if (distance < 20){
        move = true;
        shoot = false;
        transform.LookAt(pos);

    }
    if (distance < 10)
    {
        move = false;
        shoot = true;

    }

    if (move)
    {
        transform.position = Vector3.MoveTowards(transform.position, character.position, enemySpeed * Time.deltaTime);
        transform.LookAt(pos);
    }
    if (shoot)
    {
        shootAt();
    }

        void shootAt(){

        Instantiate(explsn, bulletSpawn.transform.position,
        bulletSpawn.transform.rotation);
      var bullet = Instantiate(bulletPrefab, bulletSpawn.position,
      bulletSpawn.rotation);
        bullet.GetComponent<Rigidbody>().velocity = bullet.transform.forward *
        bulletSpeed;

}

}

* */

sentences:
Custom extensible file format for 2d tiled maps I have implemented much of my game logic right now, but still create my maps with nasty for-loops on-the-fly to be able to work with something. Now I wanted to move on and to do some research on how to (un)serialize this data. (I do not search for a map editor - I am speaking of the map file itself)

For now I am looking for suggestions and resources, how to implement a custom file format for my maps which should provide the following functionality (based on MoSCoW method):

Must have

Extensibility and backward compatibility
Handling of different layers
Metadata on whether a tile is solid or can be passed through
Special serialization of entities/triggers with associated properties/metadata

Could have

Some kind of inclusion of the tileset to prevent having scattered files/tilesets

I am developing with C++ (using SDL) and targetting only Windows. Any useful help, tips, suggestions, ... would be appreciated!

Result of the discussion below

I have been designing my map file format the last few hours and came up with a skeleton (contains only layers for now - I'll leave the rest to everyone designing his/her own format) which I wanted to share with everyone interested - if you have the same intentions you can get some kind of inspiration. The full-size screenshot can be downloaded at Imgur.

sentences: Do I really have to write my own optimized model format? So I'm a brand new noob to the world of game dev and I'm starting off by trying to write my own game using C++ and openGL. I'm getting into loading models etc and while searching around for "the best format" I'm finding that most of the common formats are intended for porting between modelling applications and not necessarily for final representation of data when loading into a game environment. I'm being told through various sources that ultimately you want to use formats like collada etc and convert them into a custom binary format optimized for your game. Is this absolutely necessary? I understand the idea, that parsing a large XML or some other ASCII format is going to be slower than reading a binary file type but is it really going to be THAT big of a performance hit if I don't? I can't see it, but before I go and fill the assets directory of my game with dae or fbx files I thought I'd ask.

sentences: First Mobile Indie Game - Monetization Model. Ad based or in app purchases? We are a team of 3 (1 graphics designer, 2 developers). We're almost done with our first Android based indie game. Which monetization model will be suitable for us? We don't want to disturb users with a lot of ads (at this point we're thinking to put only banner ads) also, if we go with in app purchases, can we also keep ads as well? or is it a better practice to follow one model at a time? How much will it affect the user experience?

sentences:
How to 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:
Should we always prefer OpenGL ES version 2 over version 1.x OpengGL ES version 2 goes a long way into changing the development paradigm that was established with OpenGL ES 1.x. You have shaders which you can chain together to apply varios effects/transforms to your elements, the projection and transformation matrices work completly different etc. I've seen a lot of online tutorials and blogs that simply say "ditch version 1.x, use version 2, that's the way to go". Even on Android's documentation it sais to "use version 2 as it may prove faster than 1.x".

Now, I've also read a book on OpenGL ES (which was rather good, but I'm not gonna mention here because I don't want to give the impression that I'm trying to make hidden publicity). The guy there treated only OpenGL ES 1.x for 80% of the book, and then at the end only listed the differences in version 2 and said something like "if OpenGL ES 1 does what you need, there's no need to switch to version 2, as it's only gonna over complicate your code. Version 2 was changed a lot to facillitate newer, fancier stuff, but if you don't need it, version 1.x is fine".

My question is then, is the last statement right? Should I always use Open GL ES version 1.x if I don't need version 2 only stuff? I'd sure like to do that, because I find coding in version 1.x A LOT simpler than version 2 but I'm afraid that my apps might get obsolete faster for using an older version.

sentences:
Avoiding memory allocation in Android game development For obvious reasons, allocating memory on the fly in Android game development is not recommended.  For example:

http://developer.android.com/training/articles/perf-tips.html:

  There are two basic rules for writing efficient code:

  Don't do work that you don't need to do.
  Don't allocate memory if you can avoid it.

I'm following this advice and am avoiding any memory allocation whilst the game is in progress; however, it's limiting my approach to certain tasks.  Whilst I could change my code to see what happens, there's a fair amount of it, and it's not going to tell me about the resulting performance on anything other than the limited range of hardware I have available to test it on.

I was wondering if there are any general rules of thumb which can provide an insight into this problem, such as how much allocation/deallocation you can get away with; whether it's the individual size of the allocation or the overall amount that's most important; things you can do to mitigate against the problem (I'm assuming the problem is chiefly having the garbage collector kick in and damage performance, and/or insufficient memory being available if it doesn't fire frequently enough); does it affect some versions of Android more than others, etc.

sentences:
Is flowchart correct way to visualize gameplay? I made the following flowchart in draw.io. it's just a simple arcade shooter. cardboard zombie pops up, bang, or not. I don't have any official education in game production.

So, are there other chart styles, or UML diagrams that would be better suited for drafting this type of simple game play?

sentences:
Sharpdx 2D Camera not moving I am trying to move a camera to the right, but it isn't moving.

i use this code to move:

Camera.Position.X = gameobject.transform.Position.X;

This is the camera code that i use to create Matrix3x2

        public Vector2 Position = new Vector2();

    float Rotation = 0;

    public float Zoom = 1;

    public Vector2 ViewportCenter { get { return new Vector2(ViewportWidth * 0.5f, ViewportHeight * 0.5f); } }

    public Matrix3x2 GetTransform3x2()
    {
        return Translation;
    }

    private Matrix3x2 Translation
    {
        get
        {
            return Matrix3x2.Translation(Position) *
                   Matrix3x2.Rotation(Rotation) *
                   Matrix3x2.Scaling(Zoom, Zoom) *
                   Matrix3x2.Translation(ViewportCenter);
        }
    }

This is the code that i use to render

        public void DrawGameobjects(Gameobject[] gameObjects)
    {
        RawMatrix3x2 CameraPosition = new RawMatrix3x2();

        foreach (Gameobject Gameobject in gameObjects)
        {
            if (Gameobject.Enabeld == true)
            {
                foreach (object Component in Gameobject.Components)
                {
                    //render 2D
                    if (Component is Sprite)
                    {
                        RawMatrix3x2 CurrentTransform = renderTarget.Transform;
                        Sprite NewSprite = Component as Sprite;
                            Bitmap Texture = Game.bitmapManager.GetTexture(NewSprite.texture.TexturePath);
                            RawRectangleF PositionRectangle = new Rectangle(new Point(0, 0), new Size(NewSprite.texture.TextureSize * Zoom)).ToRawRectangleF();
                            float Transparency = NewSprite.Transparency;
                            RawRectangleF ImageRectangle = new Rectangle(new Point(0, 0), new Size(NewSprite.texture.TextureSize * Zoom)).ToRawRectangleF();
                            Vector2 NewScale = (Vector2)Gameobject.transform.Scale;
                            Matrix3x2 Translation = Matrix3x2.Translation((Vector2)Gameobject.transform.Position);
                            Matrix3x2 Rotation = Matrix3x2.Rotation(Gameobject.transform.Rotation.X);
                            Matrix3x2 Scale = Matrix3x2.Scaling((Vector2)Gameobject.transform.Scale);
                            renderTarget.Transform = (Translation * Rotation * Scale).ToRawMatrix3x2();
                            renderTarget.DrawBitmap(Texture, PositionRectangle, Transparency, BitmapInterpolationMode.NearestNeighbor, ImageRectangle);
                            //renderTarget.Transform = CurrentTransform;

                    }

                    if (Component is Camera2D)
                    {
                        CameraPosition = (Component as Camera2D).GetTransform3x2().ToRawMatrix3x2();
                    }
                }
            }
        }

        renderTarget.Transform = CameraPosition;

    }

Everything moves except the camera

sentences:
Löve2d: How can i select object with mouse if it's overlap? I have already some code but i can't solved this.
How can i select one object with mouse if the objects are overlap? It's looks like solitaire game.
I wish you can understand me...

For example my code;

function love.load()

    love.graphics.setBackgroundColor(245, 255, 255)
    --1
    carda = {}
    carda.x       = 110
    carda.y       = 5
    carda.width   = 100
    carda.height  = 150
    carda.dragged = false
    carda.dropped = false
    --3
    cardb = {}
    cardb.x       = 110
    cardb.y       = 20
    cardb.width   = 100
    cardb.height  = 150
    cardb.dragged = false
    cardb.dropped = false
end
function love.draw()
    love.graphics.setColor(255, 255, 255)
    love.graphics.rectangle("fill", carda.x, carda.y, carda.width, carda.height)
    love.graphics.setColor(255, 128, 128)
    love.graphics.rectangle("line", carda.x, carda.y, carda.width, carda.height)
    love.graphics.setColor(0, 0, 100)
    love.graphics.print("Card\nA", carda.x + 5, carda.y + 5)
    --2
    love.graphics.setColor(215, 255, 225)
    love.graphics.rectangle("fill", cardb.x, cardb.y, cardb.width, cardb.height)
    love.graphics.setColor(255, 128, 128)
    love.graphics.rectangle("line", cardb.x, cardb.y, cardb.width, cardb.height)
    love.graphics.setColor(0, 0, 100)
    love.graphics.print("Card\nB", cardb.x + 5, cardb.y + 5)
end
function love.keypressed(key)
    if key=="escape" then
        love.event.quit()
    end
end
function love.mousepressed(x, y, button)
    if button == 1 and x >= carda.x and x <= carda.x + carda.width and y >= carda.y and y <= carda.y + carda.height then
        carda.dragged = true
    end
    --2
    if button == 1 and x >= cardb.x and x <= cardb.x + cardb.width and y >= cardb.y and y <= cardb.y + cardb.height then
        cardb.dragged = true
    end
end
function love.mousemoved(x, y, dx, dy)
    if carda.dragged then
        carda.x = carda.x + dx
        carda.y = carda.y + dy
    end
    --2
    if cardb.dragged then
        cardb.x = cardb.x + dx
        cardb.y = cardb.y + dy
    end
end
function love.mousereleased(x, y)
    carda.dragged = false
    --2
    cardb.dragged = false
end

sentences:
Understanding DeviceContext and Shaders in Direct3D/SlimDX I've been working through this tutorial about drawing triangles with SlimDX, and while it works, I've been trying to structure my program differently than in the tutorial.

The tutorial just has everything in the main method, I'm trying to separate components into their own classes. But I'm not sure where certain components belong: namely, contexts and shaders.

The tutorial (as it's just rendering one triangle) has one device, one swapchain, one device context and one set of shaders. intuition says that there is only one device/swapchain for one game, but with contexts I don't know.

I made a Triangle class and put the vertex stuff in there. Should it also create a context? Should it load its own shaders? Or should I pass some global context and shaders to the triangle class when it is constructed? Or pass the shaders and construct a new context?

I'm just getting started with 3D programming, so in addition to answering this question, if anyone knows of a tutorial or article or something about the larger-scale structure of a game, I'd be interested in seeing that as well.

sentences:
Sea is higher than land when importing large real world terrain I am trying to import some real world terrain into Unity with the help of Global Mapper. The data I am using is download from CGIAR SRTM(http://srtm.csi.cgiar.org/,http://srtm.csi.cgiar.org/srtmdata/). The land part works well but I am having trouble with the sea part.

This is a larger view of that weird thing in the first image. This strange is actually the sea. This is happening because I am using the gradient shader. Lokks like:

The sea is represented with white, but when Unity reading the .raw file, the white means the highest part. Does anyone know how to deal with problems like this? Thanks very march.

sentences:
Does passing uniform constants from technique into shader cause branches? I am trying to find a way to organize my evergrowing number of shader techniques/functions (I am coding in sm_3.0). One way is to do this:

float4 PS_Crossroads(PS_INPUT input, uniform bool left_right) : COLOR0
{
    if (left_right)
        GoLeft();
    else
        GoRight();
    ...
}

technique LEFT
{
    pass Pass1
    {
        VertexShader = compile vs_3_0 VertSh();
        PixelShader = compile ps_3_0 PS_Crossroads(true);
    }
}

technique RIGHT
{
    pass Pass1
    {
        VertexShader = compile vs_3_0 VertSh();
        PixelShader = compile ps_3_0 PS_Crossroads(false);
    }
}

My question is will this cause a branch at runtime or will the compiler be smart enough to split it into two separate techniques?

Thanks.

P.S. Ok I won't post this as answer, because we already have an answer by someone much more experienced than me, but from my humble tests (on different PCs) and my humble Google research, this approach (using uniform constants) is efficient and indeed forces the compiler to create different shader versions for each branch, removing flow controll completely from the finall compiled shader. I tested the compiled shader codes with Nvidia NSight.

sentences:
How come these 2 lines of code are causing a memory leak? I'm confused, I commented these 2 lines out resulting in no memory leaks, and when I added them again it's leaking.

However I can't understand why it's actually leaking?

This is the 2 lines of code one of them or both are leaking :

m_surface = TTF_RenderText_Solid(m_font, m_text.c_str(), m_color_fg);
m_texture = SDL_CreateTextureFromSurface(renderer, m_surface);

And here is the declaration of the 2 variables :

SDL_Surface* m_surface = nullptr;
SDL_Texture* m_texture = nullptr;

 I'm not sure what else is needed to figure out why it's leaking.

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:
XNA Xbox, utilizing multiple cores Possible Duplicate:
  XNA: How does threading work?

It's my understanding that the Xbox has 3 cores that are available to use. I'm hoping to offload AI to another core, and possibly use another core to see if certain objects are on screen(if so they will be added to a list to be drawn).

How would I go about doing this? It needs to be compatible on the xbox360.

sentences:
Which network engine/library/system to use in a .NET turn-based game? I'm developing an abstract strategy turn-based game in C#.

Being so, high network load is not expected. The players don't even have to be connected all the time. The host could wait for the current player to connect and make his move. I know I could make a web site to run that, but I want anyone to be able to host their own games.

I need something reliable and that enables me to have good productivity.

I'm already underway with WCF. Was that a good choice? Which other network framework should I consider?

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

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

    }

which as you can imagine, slows things down considerably!

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

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

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

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

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

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

sentences:
Rewarded video ads for two different functions - Unity I'm implementing reward based video ads in my game. There are two functions that provide the reward. One is a ReceiveLife() function where once the player dies, if they click on the revive button the game restarts and the score is set to score before the player dies instead of 0. The other function is ReceivePoints(), where if the player clicks on the add points button, they are rewarded with 100 extra points. Here are the functions in the game manager script:
 public void ReceiveLife()
   {
     savedScore = (int)playerScore;
     SceneManager.LoadScene(1);
   }

 public void ReceivePoints()
   {
     playerScore+=100;
     gameOverPanel.gameOverScoreText.text = "Score: " + ((int)playerScore).ToString();
   }

Here is the unity ads manager script:
 public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
  {
    if (showResult == ShowResult.Finished)
    {
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        gameManager.ReceiveLife();
    }

    if (showResult == ShowResult.Finished)
    {
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        gameManager.ReceivePoints();
    }
 }

Once they watch the ad successfully, both the functions are being called. If the player clicks on the ReceiveLife(), he should only get one extra life and not the additional 100 points and vice-versa.
I'm not sure how to call each function separately. Do I have to create two separate admanagers in order to call these functions or is there a better method?

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:
Proper opengl learning curve + tools My first post here, so at first i would like to say HI to everyone!

Had a course of computer graphics at my uni and got interested with opengl. Unfortunatelly we used it with java + jogl + some funky frameworks from our lecturers which provided us with all texturing etc. Now i want to switch to c++, because as i noticed all the tutorials are written in it.

My question is about additional libraries. Google told me that "OpenGL SuperBible V Comprehensive Tutorial and Reference" by Richard S. Wright will be helpful for the learning process and in the book they use GLEW + GLtools. Are those proper tools or should i start with something else? Maybe some other books? [yes i used search for online courses and books here, but maybe you have some tested and up to date positions]

sentences:
Game software design I have been working on a simple implementation of a card game in object oriented Python/HTML/Javascript and building on the top of Django.

At this point the game is in its final stage of development but, while spotting a big issue about how I was keeping the application state (basically using a global variable), I reached the point that I'm stuck. The thing is that ignoring the design flaw, in a single-threaded environment such as under the Django development server, the game works perfectly.

While I tried to design classes cleanly and keep methods short I now have in front of me an issue that has been keeping me busy for the last 2 days and that countless print statements and visual debugging hasn't helped me spot. The reason I think has to do with some side-effects of functions and to solve it I've been wondering if maybe refactoring the code entirely with static classes that keep no state and just passing the state around might be a good option to keep side-effects under control. Or maybe trying to program it in a functional programming style (although I'm not sure Python allows for a purely functional style).

I feel that now there's already too many layers that the software (which I plan to make incredibly more complex by adding non trivial features) has already become unmanageable.

How would you suggest I re-take control of my code-base that (despite being still only at < 1000 LOC) seems to have taken a life of its own?

sentences:
Set Parent to Instantiated Objects in Unity i am having problem in attaching parent to the instantiated objects. I have attached the code below. please tell me where i am doing wrong. Thank you.

public GameObject brick;
public Transform BrickHolder;
//public GameObject Bricks;

void Start(){
    for (float y = 2.16f; y < 4.88f; y += 0.34f){
        for (float x = -2.125f; x <= 2.125f; x += 0.85f){

            GameObject Bricks = Instantiate(brick, new Vector3(x, y, 0), Quaternion.identity) as GameObject;

            if (Bricks != null) {
                Debug.Log("Hello");
                Bricks.transform.SetParent(BrickHolder);
            }

        }
    }
}

sentences:
Cocos-2D asteroids style movement (iOS) So I have a CCSprite subclass, well call this Spaceship. Spaceship needs to move on a loop, until I say othersise by calling a method. The method should look something like

- (void)moveForeverAtVelocity
{
  // method logic
}

The class Spaceship has two relevant iVars, resetPosition and targetPosition, the target is where we are headed, the reset is where we set to when we've hit our target. If they are both off-screen this creates a permanent looping effect.

So for the logic, I have tried several things, such as

CCMoveTo *move = [CCMoveTo actionWithDuration:2 position:ccp(100, 100)];
CCCallBlockN *repeat = [CCCallBlockN
  actionWithBlock: ^(CCNode *node) {
    [self moveForeverAtVelocity];
}];

[self runAction:[CCSequence actions: move, repeat, nil]];
self.position = self.resetPosition;

recursively calling the moveForeverAtVelocity method.

This is psuedo-code, so its not perfect. I have hard-coded some of the values for the sake of simplicity.

Enough garble: The problem I am having, how can I make a method that loops forever, but can be called and reset at will. I'm running into issues with creating multiple instances of this method. If you can offer any assistance with creating this effect, that would be appreciated.

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:
XNA - just a few more characters accepted in a SpriteFont I have a SpriteFont in XNA, which has the standard 126 characters that are usable.

However i would like to use the "ಠ" symbol in the game.

So is there anyway of adding just a few more symbols that the spritefont accepts?

Cheers,
Randomman159

sentences: How do I store game data with cookies? Im working on a game right now, but I was wondering how I would store the game data in cookies(in javascript) where you can load it up, and resume the last spot you were at. I was looking at some other websites like w3schools, but I didn't really understand it

sentences:
Should LOD models be used in mobile games? LOD models are widely used in PC and console games, to optimize performance by reducing the vertex count and texture size for distant objects. However, I'm having a harder time finding out if they are typically used to increase performance in mobile games.

I've seen a few people in forums suggest that the CPU overhead for LOD models might actually outweigh the GPU gains on mobile devices. Another consideration is the more limited storage space on mobile, and LOD models/textures necessarily increase the total size of a game. Other than that, I can't find much information on the subject. The Unity documentation on LOD models doesn't mention mobile, and the Unity documentation on optimizing for mobile doesn't mention LOD models.

I know the first answer to any performance question is usually "profile it and find out for yourself"; however, in this case, I am helping to optimize a game that doesn't currently have LOD models, so profiling it would first require commissioning the artists to create enough LOD models that we can realistically profile the performance change.

Does the usage of LOD models typically provide noteworthy performance gains in 3D mobile games, or does the overhead for LOD cancel out any gains?

The specific title in question is a racing game.

sentences:
given the position and velocity of an object how can I detect possible Collision? I'm trying to detect Collision between autonomous moving objects and steer direction if collision is detected. so far I've been following a tutorial and I'm having a hard time to fully understand how it works especially the role of the dot product

foreach (GameObject t in targets) //get me all moving agents
{
 Vector3 relativePos;
 Agent targetAgent = t.GetComponent<Agent>(); //access properties like velocity
 relativePos = t.transform.position - transform.position;
 Vector3 relativeVel = targetAgent.velocity - agent.velocity;
 float relativeSpeed = relativeVel.magnitude;

//can someone explain this part of code how did we calculate the time of collision?

 float timeToCollision = Vector3.Dot(relativePos, relativeVel);
 timeToCollision /= relativeSpeed * relativeSpeed * -1;
 float distance = relativePos.magnitude;
 float minSeparation = distance - relativeSpeed *
 timeToCollision;

sentences:
My hlsl shader cannot unroll a loop? I have this shader:

   texture tex;
   sampler2D s = sampler_state {
      texture = <tex>;
   };

   int tWidth = 1;
   int tHeight = 1;
   int blurLength = 3;

   float4 ps_main(VS_OUTPUT Input) : COLOR0
   {
      float weight = 1.0 / (blurLength * blurLength);
      float2 pxSz = float2(1.0 / tWidth,1.0 / tHeight);
      float4 color = Input.Color * tex2D(s, Input.TexCoord.xy);
      float4 outC = 0;
      int x = 0;
      int y = 0;
        int numSubtr = (blurLength - 1) / 2;
        x -= numSubtr;
        y -= numSubtr;
        int count = 0;
        for(int i = x; i < x + blurLength; ++i)
        {
            for(int j = y; j < y + blurLength; ++j)
            {
                outC += Input.Color * tex2D(s, Input.TexCoord.xy + float2(i * pxSz.x,j * pxSz.y)) * weight;
            }
        }
      return outC;
   }

When I load it I get:

What could be wrong? (using hlsl ps 2.0 I think)

Thanks

sentences:
Unity Ball moving inside the surface My ball is jumping on a 3d cylinder, and sometimes the ball gets stuck inside the cylinder. The ball has a rigid body and it's continuously dynamic. The circle also has a mesh collider.
Here is the code to make the ball jump:

void Update () {

    if(Mathf.Sign(rg.velocity.y)==-1){

        isforceApplied=true;
    }

}

void OnCollisionEnter(Collision collisionInfo)
{

    if(isforceApplied==true){

        isforceApplied=false;
        rg.AddForce(transform.up*forceAmount,ForceMode.Impulse);

    }

}

sentences:
simple adventure game mechanics stored in database I plan to code a little adventure-like game. To be able to build multiple episodes without deploying new code I want to store any information possible in the database.

This includes stuff like

  if player examines item [cell phone], the contact [xxx] is added into his phone book and the item [cell phone] is replaced by [old nokia phone with scratches]

So something like "SCUMM lite".

Of course, [cell phone], [xxx] and [old nokia phone with scratches] are objects that already exist in the database. But while [cell phone] is of type [inventory-item], [xxx] is of type [contact], so there can't just be no simple link between some database-tables

I got a very basic idea about how I could achieve this but wonder if anyone has done that before and can give me a hint or even best practice

sentences:
How do I get my scene view back to 0 or whatever it is by default? All my tiles/sprites have 0 as their position on the Z axis, except my main cam which has -10.

For some reason I suddenly couldn't zoom in without everything disappearing, I switched to 3D view to see where I was and it seemed like I was miles away from my tiles on the z axis. I placed a sprite into my level to check and it placed itself at -57,000 on the z axis.

How do I get my scene view back to 0 or whatever it is by default?

sentences:
Easy way to set face colors with indexed VBOs? I'm loading OBJs, which lend themselves well to setting up as indexed VBOs, since each vertex is only defined once and then a face definition will reference the same vertex more than once when they share an edge. I want to define face colors based on the materials loaded from the OBJ. This is quite easy in immediate mode, but I've realized that using VBOs will require me to duplicate each vertex in order to have two adjacent faces with different colors. What's the best way to go about solving this without duplicating vertices?

EDIT: Code (LWJGL)

//Get the VBO from the GPU
glBindBuffer(GL_ARRAY_BUFFER, vbo);
//Tell OpenGL what to expect from the VBO
glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex.SIZE * 4, 0); //Location
glVertexAttribPointer(1, 2, GL_FLOAT, false, Vertex.SIZE * 4, 4 * 3); //Texture Coord
glVertexAttribPointer(2, 3, GL_FLOAT, false, Vertex.SIZE * 4, 4 * 3 + 4 * 2); //Normal

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
glDrawElements(GL_TRIANGLES, size, GL_UNSIGNED_INT, 0);

sentences:
How to clear out a drawn texture from the screen in libGDX I am trying to clear out the drawn texture from the screen.

Lets take a classic game example - in many games when the character goes through the coins the coins clears out from the screen and displays a sweet animation like fade in and fade out the points collected from that coin(+10) and show the coin exploding animation on that position.

I want to do something similar to that.
I am using SpriteBatch to draw the texture region like below.

Setting texture Region:

(...)
 public Texture texture;
    public TextureRegion coin;
    texture = new Texture(Gdx.files.internal("data/texture.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    coin = new TextureRegion(texture, 0, 336, 65, 73);
 (...)

   Drawing the texture into screen :

 public SpriteBatch batcher;
 batcher = new SpriteBatch();
 batcher.setProjectionMatrix(cam.combined);
  batcher.begin();
    batcher.enableBlending();
    batcher.draw(coin, x, y, 65,73);
    (...)
    (...)
  batcher.end();

The game character is also drawn using the same logic shown above.
Now when the game character will collide with the coin that I have drawn,the coin must be cleared(vanished) and some animation or big font like +50 must fadein and fadeout in that position.I tried but didn't find anything that would do this.
So how to do that ?

sentences:
Interpolating between two networked states? I have many entities on the client side that are simulated (their velocities are added to their positions on a per frame basis) and I let them dead reckon themselves. They send updates about where they were last seen and their velocity changes. This works great and other players see this work find. However, after a while these players begin to desync after some time. This is because of latency.

I'd like to know how I can interpolate between states so they appear to be in the correct position. I know where the player was LAST seen and their current velocity but interpolating to the last seen state causes the player to actually move -backwards-. I could not use velocity at all for other clients and simply 'lerp' them towards the appropriate direction but I feel this would cause jaggy movement. What are the alternatives?

sentences:
Cannot draw around the screen after zooming out with LibGDX projection coordinate I've just started developing game in android using LibGDX.
I've follow some samples and now my simple game can draw path when user move their finger around the screen.

now problems appear when i add another feature to allow user to pinch zoom in and out.
after zooming OUT the orthographic camera user can still draw the path BUT
the path can no longer follow user finger to the edge of the screen, the user can only draw the path around the center of the screen. looks like the coordinate projection after zoom out not changed and still limited to the projection before zoom out!

how can i make my game to keep drawing line around the entire screen even after the user have zooming out the camera?

here's my code:

   1. in my Screen implemented class:

@Override
public void render(float arg0) {
    Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    renderer.render();
}

@Override
    public boolean touchDragged(int screenX, int screenY, int pointer) {
        // TODO Auto-generated method stub
        isDrawing = true;

        Vector2 v = new Vector2(screenX, Gdx.graphics.getHeight()-screenY);

        //add new point for drawing path
        inputPoints.insert(v);

        return true;
    }

   2. in my Renderer class:

cam = new OrthographicCamera();
    cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    this.cam.update();

public void setZoom(float zoom) {
     this.cam.zoom = zoom;
     this.cam.update();
 }

//the triangle strip renderer
    path = new PathClass();

public void render() {
    cam.update();
    batch.setProjectionMatrix(cam.combined);

    //generate the triangle strip from our path
    Array<Vector2> xox = screen.path();
    path.update(xox);

    //the vertex color for tinting, i.e. for opacity
    path.color = Color.WHITE;

    //render the triangles to the screen
    path.draw(cam);
}

   3. on my PathClass:

public void draw(Camera cam) {
    if (tristrip.size<=0)
        return;

    gl20.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
    for (int i=0; i<tristrip.size; i++) {
        if (i==batchSize) {
            gl20.end();
            gl20.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
        }
        Vector2 point = tristrip.get(i);
        gl20.color(color.r, color.g, color.b, color.a);
        gl20.vertex(point.x, point.y, 0f);
    }
    gl20.end();
}

sentences:
UPS and FPS - What should I limit and why? I'm currently writing a game using C++ and SDL2 and there's one thing that I'm wondering about - does it make sense to limit my frames per second (FPS) and/or my updates per second (UPS)?

I get the idea that if you limit the UPS, you essentially control the speed of the game - if the player moves 1px per update and you always update it 30 times per second, he'll move at a speed of 30px/s and you'll probably also relieve the CPU since the amount of calculations per second decreases. If you limit the FPS, the amount of drawcalls per second decreases, therefore you relieve your GPU. I hope I understood all of that correctly, if not, feel free to correct me.

My question is - what am I supposed to limit in my game? FPS? UPS? Both? Neither? Is there another, better approach to this? How is this done in most games and why?

Answers are greatly appreciated!

sentences:
How can I load 2D texture data without a GraphicsDevice instance? We have a client/server architecture for our game with the client being the XNA Game, and the game server is separate and only references XNA.  They both use a shared DLL for networking.  The game server is windows forms for just starting/restarting and some stats output, and does no drawing or anything.

The problem is I need to load Texture2D's on the game server, to get width/height information, and for the server to be able to do per pixel collision detection for its simulation.  However, it seems a Texture2D requires a GraphicsDevice to instantiate.  And it appears a GraphicsDevice requires an XNA Game?

Is there some way I can load a Texture2D into memory on the server without a graphics device, or some way to instantiate a GraphicsDevice to do this (even though nothing is going to be drawn)?

sentences:
Idle/Clicker games, supporting numbers many factors bigger than trillions in C# using Unity Apologies for sloppy work and probably a poor grasp of fundamentals.

I have a (likely primitive) way to convert the ever increasing number values of my enemy hp into a string format to display in game. (K for thousands, M for millions, B for billions etc)

 if (target_healthmax >= 1000)
     {
         if (target_healthmax >= 1000000000)
         {
             enemy_hp_text.text = "Health: " + (target_healthcur * 0.000000001f).ToString("#.00") + "/" + (target_healthmax * 0.000000001f).ToString("#.00") + "B";
         }
         else
         {

             if (target_healthmax >= 1000000)
             {
                 enemy_hp_text.text = "Health: " + (target_healthcur * 0.000001f).ToString("#.00") + "/" + (target_healthmax * 0.000001f).ToString("#.00") + "M";
             }
             else
             {
                 enemy_hp_text.text = "Health: " + (target_healthcur * 0.001f).ToString("#.00") + "/" + (target_healthmax * 0.001f).ToString("#.00") + "K";
             }
         }
     }
     else
     {
         enemy_hp_text.text = "Health: " + target_healthcur + "/" + target_healthmax;
     }

but I stopped here after I noticed that although I could convert long numbers I would eventually hit a number too large to handle such as "-2.147484e+09" in my editor, and it would stop working.

I am using floats currently, is there a different type of variable that handles this easily? if not, what is an efficient way of solving this?

Would it be efficient to convert every new factor of 100 to a new variable and only handle the highest valued variable?
eg

if num >= 1000, k += 1, num = 0;

 if k>= 1000, m += 1, k = 0;
 ...

(Please feel free to let me know anything about my post I may need to amend, I am new here)

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 to await async operations / coroutines? I'm looking for a generic / reusable way to wait for coroutines and asynchronous operations to finish in Unity 5, similiar to C#5's await keyword.

The simplest way I can think of is something like this:

 public class SomeUtility {
     public bool IsDoingSomething { get; private set; }

     public IEnumerator DoSomethingAsync() {
         IsDoingSomething = true;
         yield return new WaitForSeconds(2);
         IsDoingSomething = false;
     }
 }

and then in another coroutine:

 while(!someUtilityInstance.IsDoingSomething)
     yield return null;

However this is not very nice because it clutters the code with while statements, is not reusable (needs instances and dedicated classes even for simple utility functions!) and a lot of singleton or static stuff where it's not even needed.

The closest I found is using Unity's AsyncOperation. This here works very nicely:

public static IEnumerator Await(this AsyncOperation operation) {
    while(!operation.isDone)
        yield return operation;
}

yield return SceneManager.LoadLevelAsync("blaaaah").Await();

However.. the problem is: How to create an AsyncOperation? A few services, for examples SceneManager are using it, but the documentation completely lacks anything about creating custom operations or wrapping existing coroutines etc.

So, is there a way to create a simple, generic and resuable "await" for custom coroutines?

sentences:
Simple collision resolution in a platformer game I want to make a 2d platformer with moving, jumping and wall sliding. How can I make a simple pleasant collision resolution system that works for the following rectangles.
Player is red, platform is black, I want to detect if the player is sliding a wall, or hitting the ground, or doing both ( as in third example). Also take the appropriate response.
Also I have no idea what I am talking about so a little context might help.
These resources helped me:
How to resolve collision:
2D AABBs and resolving multiple collisions
How to detect overlap between aabb vs aabb:
http://noonat.github.io/intersect/

sentences: How do I zoom in using the App version of Twine? How do I zoom in using this program in Windows 10?

sentences:
DX11 How to guarantee rendering order using Deferred Context? What techniques are used to guarantee rendering order (back to front) when you have more than one deferred context?

My original idea was to manually remap the Command Lists, but it seems like this is not possible.

Do games just render all Alpha objects using the immediate context (to guarantee order)?

Thanks!

sentences: How to make a horizontal scrolling menu in Game Maker Studio 1.4? I know how to place the items you see in the picture, my problem is how do I move them? How do I know if the player is swiping right or left? I made the items with a ds_list in a script file and then have an object obj_MenuCreation run that script, so if I move the obj_MenuCreation, will it move the list with it?

sentences:
How to detect direction of rotation? I have a character with a camera behind him. The head of the character rotates with the LookAt function on the character's head rig.
The LookAt is done towards targets that may be to the right or left of the entire body of the transform character.
So I want to detect when the head rotates clockwise with respect to the controller body and when it rotates counterclockwise. How can I do this?

sentences: How do I make a natural-looking map from some Voronoi regions? I'm using Voronoi regions to create a map for my game, much like this. However, the lines are too straight and perfect. How do I make the borders more natural looking? As in, less like US state borders and more like international borders in Europe or Asia.

sentences:
multi user web game with scheduled processing? I have an idea for a game which I am in the process of designing, but I am struggling to establish if the way I plan to implement it is possible.

The game is a text based sports management simulation. This will require players to take certain actions through a web browser which will interact with a database - adding/updating and selecting. Most of the code required to be executed at this point will be fairly straightforward.

The main processing will take place by applications which are scheduled to run on the server at certain times. These apps will process transactions added by the players and also perform some automatic processing based on the game date.

My plan was to use an SQL server database (at last count I require about 20 tables) and VB.net for all the coding (coming from a mainframe programming background this language is the simplist for me to get to grips with). I will also need a scheduling tool on the server.

Can anyone tell me if what I am planning is feasible before I dive into the actual coding stage of my project?

sentences: Push Notification to start a scene I was wondering whether I can use APNs in iOS to trigger an event in my game, like start a scene without user clicking the notification. Is it possible to use remote push notifications for events like this?

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: How do I deal with scale of the universe when generating a simulated universe? I have a dataset of 100,000 actual stars. I wish to create a game where I can fly between the stars and fly up to them and click on them etc. How do I go about dealing with the problem of the scaling of the universe, even If I were to allow fast as light travel it would be too vast. Should I cluster my data and then implement a subtle sort of scaling to move around? Sorry for the broad question but I'm rather stuck at the moment.

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 to verify if the client files are the same as the server files? In a client-server game architecture, what are the possible ways to verify that the client has not modified things like gfx assets or client side scripts?

Obviously no solution is perfect, but I would love to hear some ideas.

I am thinking something like an hash on all the files in the resources directory. Does that sound feasible?

sentences:
How to switch between multiple cameras in a Unity Scene, Silent Hill-style I have 3 cameras in a practice scene that I want to switch between. Currently, I have a meshless cube acting as a trigger with the following script

public class CameraSwitch : MonoBehaviour
{
    [SerializeField]
    private GameObject startCamera;
    [SerializeField]
    private GameObject camera2;

    // Start is called before the first frame update

    private void OnTriggerEnter(Collider other)
    {
        if(other.tag == "Player")
        {
            startCamera.SetActive(false);
            camera2.SetActive(true);
        }
    }

}

It's switching from the first camera to the second no problem, but it won't switch back if I move my player through the trigger again.

Is there a way I can store multiple different cameras inside one object and just disable every camera besides the one being used so I don't have to keep making triggers?

Any advice is appreciated.

sentences:
Should the server calculate the time of a player's input, or trust sent data? I am curious about the details of lag compensation in games. I have read a lot of articles about it, for example:

Source Engine Multiplayer Networking
Fast-Paced Multiplayer - Gabriel Gambetta
How do Multiplayer Game[s] sync their state?

And I still have this question:

At the 1st link, the Valve developers give a formula to compute the time when the command should be executed:

Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation

But on the 3rd site, the author says that the client sends the Command Execution Time and the server does not need to use that complicated formula to calculate something that the client can give the server for free. I mean, the player will always send the correct info about Command Execution Time, so the server can believe him.

Which one is correct? Or are both suitable (for different situations)?

sentences: Why does Unity increase the size of image when I use the image in Unity? I try to make a game in Unity 2d. But when I drop the image in Unity the image size increases 3 or 4 times. Can I fix that or is this normal?

sentences:
Scene reset function not working I am entirely new to programming. Recently just watched this YouTube tutorial and follow the way the author wrote the code until (1:22:24). I'm not sure why the scene reset function for trasnform.position.y > 10 not working for me. The compiler does not detect any error and game run as normal but the scene does not reset when the bird position on y axis more than 10. I'm using another bird object anwyay since i can't find exactly the same bird picture as author did. Also is there a way to check what the value store in each variable?  Example I want to check what the value stored in "transform.position.y" to find out why it is not working.
using UnityEngine;
using UnityEngine.SceneManagement;

public class GreenBird : MonoBehaviour
{
    Vector3 _initialPosition;

    private void Awake()
    {
        _initialPosition = transform.position;
    }

    void update()
    {
        if (transform.position.y > 10)
        {
            string currentSceneName = SceneManager.GetActiveScene().name;
            SceneManager.LoadScene(currentSceneName);
        }
    }

    private void OnMouseDown()
    {
        GetComponent<SpriteRenderer>().color = Color.red;
    }

    private void OnMouseUp()
    {
        GetComponent<SpriteRenderer>().color = Color.white;
        Vector2 directionToInitialPosition = _initialPosition - transform.position;
        GetComponent<Rigidbody2D>().AddForce(directionToInitialPosition * 100);
    }

    private void OnMouseDrag()
    {
        Vector3 newPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        transform.position = new Vector3(newPosition.x, newPosition.y);
    }
}

sentences:
Gyroscope Parallax Effect In Unity I want to make a parallax effect in Unity 3D with gyroscope like the one on this site:
http://matthew.wagerfield.com/parallax/

I found an asset, but it is too expensive.

So I need a script which I can set to the GameObject, so it would move depending phone's gyroscope.

sentences: Consume input events in Unity 4.6 How do I consume the input events in the new 4.6 unity gui system? If I click on a button for instance I don't want anything else non GUI related that might be listening for mouse input to react to the event.

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:
Bodies do not stay sticked together by joint in retina display I'm rehearsing on Box2D revolute joints. Everything's going pretty well except for one thing. For some reason bodies joined together with revolute joints do not stay sticked, they start getting apart from each other from the app start when I run it on retina device or simulator. On non retina device it works just fine, as expected. Here's the screenshot of the non-retina version:

And here's the behavior when I run the same app on retina device/simulator:

I'm taking content scale factor into account.

sentences:
How to implement a multi-platform Java 2D game engine's graphics? I'm not sure whether this question should be posted here. I'm trying to make a basic generic game engine in Java. Here's what I have so far.

public abstract class Device {
    public abstract void startDevice();
    public abstract void closeDevice();
    public abstract int getWidth();
    public abstract int getHeight();
    public abstract void displayImage(Image im);
}
public class Game {
    public final Device device;
    public synchronized void gameStart() { ... }
}
public abstract class GameEntity implements Serializable {
    public abstract void create(Game g);
    public abstract void updateAndDraw(Game g, Graphics2D g2d);
    public abstract void destroy(Game g);
}

So far, I have implemented two concrete classes for Device, SwingDevice and J2meDevice, and it's working fine. Now the problem is I want to implement AndroidDevice. Everything will work just fine except for that I have enforced using java.awt.Image and java.awt.Graphics2D to paint Game's graphics offline. Then I forward this Image to the device for rendering.

Is there any way I can absolutely decouple the Device's graphics from the rest of the engine?

I have two solutions but I doubt they'll fully achieve what I need:

Stick with the java.awt.Image. Devices that support OpenGL will not fully utilize their hardware capabilities as drawing is done on CPU. And it might not work on platforms on which can't import java.awt (I doubt their existence).
Create my Graphics2D-like interface. This will make defining new devices harder and again it might hide some of the device's features.

sentences:
How could I implement collision resolution with MonoGame I'm building a game engine (for learning and self-development purpose), and I'm starting implementing collision resolution, I already have the collision detection part but I cant' find any good article or post about that and how to achieve it in details.

Here's my code for the collision detection:

That's the method called in the Update method, the Engine holds a list of BoxColliders called Colliders

private void CollisionDetection()
{
    foreach (BoxCollider boxCollider in Colliders)
    {
        if (!boxCollider.Collider.HasValue) continue;

        var collider1 = (Rectangle) boxCollider.Collider;
        foreach (BoxCollider boxCollider2 in Colliders.Where(x => !x.Guid.Equals(boxCollider.Guid)))
        {
            if (!boxCollider2.Collider.HasValue) continue;
            var collider2 = (Rectangle) boxCollider2.Collider;

            if (collider1.Intersects(collider2))
                boxCollider.OnCollision(boxCollider2);
        }
    }
}

And here's the OnCollision(BoxCollider other) method :

public void OnCollision(BoxCollider other)
{
    if (other.Collider == null || Collider == null) return;

    var rect = (Rectangle) other.Collider;
    var intersect = Rectangle.Intersect(Collider.Value, rect);

    // TODO : Resolve collision
}

I also have basic physic in the Engine so I would like a falling object to stop falling if it is against another collider.

In the case of a player walking on the ground, I guess the ground should apply an opposite force to the player if it collides ?

sentences:
How could I implement an ECS in C? I'm looking into how to do a game engine using only C and wanted to know how to implement ECS in C.

I didn't find any ECS implementation for C, it only seems to exist for C++.

So I'm wondering... Is it possible to implement such a feature?

And if so, how to implement such a pattern in C?

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:
C++ OpenGL: Object Components I've been trying to make a barebones engine/game in VS C++ with OpenGL.

So far it's worked well, I've managed to render two green triangles on the screen and can accelerate one using WASD input.

Both triangles have an "object" class from which I control their transform, could control mesh/shader, etc.

Today I tried to add an object reference to the transform component (so that I could get the Object from the Transform class, IE reference the parent from the child) and everything broke.

How are components of a "gameobject" class typically handled? Or what is a good suggestion to handle them? Is my current tactic of create object classes of the various components of my Object (gameobject) class wise? I also considered using derived class for the components, such as an abstract Component from which Transform/Mesh/Shader could inherit.

Thanks

sentences: How do you remove the default sky in Unreal? I'd rather texture/animate my own sky. How do I remove the default sky?

sentences:
Collision detection for an arc of a circle So how do I implement the collision detection for an arc of a circle? Will I have to use the Box 2D collision or can I do it some other way using Rectangle or stuff like that?

BTW I hate box2d because I don't understand most of the things in it, so if there is a solution that excludes the box2d, it will be very much appreciated.

The yellow arc keeps on rotating over the black circle. How do I implement collision detection in here?

sentences:
How to author custom objects in a tile map? I've been using Tiled for my game engine but for objects I have to use points on an object layer and give it a name and use that to create map items in-game. This is really inefficient as I don't want to have to copy paste every time I want to place down a ammo pack.

Is there a better workflow I can use to create custom objects and instantiate them?

Ideally I'd like to export to XML, but that's not a deal breaker.

sentences:
Double buffering on HTML5 Canvas game? My simple canvas game seems to work fine on Chrome and FF on Mac/Linux. I haven't had chance to test it on smart phones or Windows environments yet. It doesn't use double buffering but I have seen some JS Canvas examples using it.

When is the use of the double buffering recommended?
Does it make difference only for specific browsers?
Is there a significant performance hit?

Thanks!

sentences: Grid based collision - How many cells? The game I'm creating is a bullet hell game, so there can be quite a few objects on the screen at any given time. It probably maxes out at about 40 enemies and 200 or so bullets. That being said, I'm splitting up the playing field into a grid for my collision checking. Right now, it's only 8 cells. How many would be optimal? I'm worried that if I use too many, I'll be wasting CPU power. My main concern is processing power, to make the game run smoothly. RAM is not a big concern for me.

sentences:
Ensure house map maze with lifts can be solved? In my game we see the floors of a house from the side, and the hero can take lifts -- a lift either goes up (to the next lift upwards), or down (to the next lift downwards), depending on the arrow as shown, and there's always a pair of exactly two lifts connected. That's the only way the hero can move vertically, though he can freely move horizontally. The house map is a randomized 11x5 grid with different items, and unpassable walls to the far left, far right, and sometimes in one of the two middle positions:

My question: How can I ensure the map is always randomized yet always solvable and that the hero, starting at the left side of the bottom floor, can always leave it via any upwards-pointing lift at the top floor?

For what it's worth I'm using the Lua language for development. Thanks so much!

sentences:
Raycaster calculation question I am following this tutorial https://lodev.org/cgtutor/raycasting.html

  When deriving deltaDistX geometrically you get, with Pythagoras, the formula "sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX))", but this can be simplified to abs(1 / rayDirX). [thanks to Artem for spotting this simplification]
  Similarly, deltaDistY is "sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY))" which can be simplified to abs(1 / rayDirY).
  The variable perpWallDist will be used later to calculate the length of the ray.

In the calculation that involves Pythagoras, why is a "+1" involved? I thought the equation was a^2+b^2=c^2? I feel dense... Also, I do not understand how the simplification to abs(1/rayDirX) works.

sentences:
Switching between VR and Desktop (VR Controllers are not tracked in Unity Build) I am developing a VR App in Unity3D for HTC Vive Pro (Wireless) everything works well with VR in the usual way. (SteamVR Plugin 2.5.0 (SDK 1.8.19))

Except for some requirement reasons in the same Unity scene, I have to shutdown VR --> switch to Desktop mode and later at some point enable VR again. The moment, I enable it via script the VR display is ON, the HMD tracking works well but the Vive controllers are not tracked (position & rotation), I can see the controller model rendered though in the last position when the VR was shut down but I can't get the updated tracking. The issue is only happening in the Unity Build. In the editor, it is working fine now after this change.

To fix the issue in the Unity Editor: I tried changing the SteamVR_ActivateActionSetOnLoad method from Start() to OnEnable() as the error on re-enabling was related to controller actions missing, that is now fixed cause of this change.
e-g

 private void OnEnable()
        {
            if (actionSet != null && activateOnStart)
            {
                //Debug.Log(string.Format("[SteamVR] Activating {0} action set.", actionSet.fullPath));
                actionSet.Activate(forSources, 0, disableAllOtherActionSets);
            }
        }

I am looking for a solution, to fix the issue in the Unity build? Any suggestions are highly appreciated.

sentences:
Mesh complexity vs Texture Size (Performance) From a performance view, which is preferable:

A higher detailed meshes with small textures (like 32x32 pixels)
or
A less detailed mesh with a bigger texture (like 1024x1024 pixels)?

Additional info.
I'm making a low poly project. Since I'm only using big textures for "alpha FX" (simulating complex geometry just by erasing the alpha on faces), I wonder if this is a bad approach.
I could add like 50~150 triangles per model to avoid using a higher texture per asset and made those "FX" directly on geometry (since erasing on a texture very small would look very bad)

Which is the "trend"? Which has more impact on performance?

Thanks.

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:
Gradually rotate vector towards another vector For a game I'm making there is an AI bot in it. I want it to rotate so that it is facing it's opponent. The direction it is facing is determined by a vector (it will face the direction that the vector represents.) I can rotate it to face it's opponent like so:

 glm::vec3 opponentRefPos = opponentPos - position;      //for comparing AI's opponent's position to AI's position

glm::vec3 directionTarget = glm::normalize(opponentRefPos);
direction = directionTarget;

Where direction is the direction that the AI bot is facing (and it is a vec3) I want to gradually rotate it to face directionTarget. So let's say that I have a constant variable called SPEED (and deltaTime, which is the time between frames that SPEED will be multiplied by to keep the speed that it rotates at constant), which is the speed that I want the AI bot to rotate at. How can I rotate it towards this vector at that speed?

sentences: XNA with WPF or Winforms If you compare integration between WPF with XNA vs Winforms with XNA, what is the most suitable framework to integrate XNA framework with.

sentences:
How to get a smooth path for a vehicle in a 2D top down map? I am making a 2D tile based game which involves having AI that needs to traverse the map avoiding obstacles in a natural and smooth path (NOT NECESSARY THE SHORTEST)

The orientation of the vehicle is also important in the example above the initial orientation of the vehicle is to NORTH but the orientation of the vehicle at the destination doesn't matter.

All I could do now is to compute the path using A* or a BFS fill through the center of the tiles.

This is an example of a desired path:

sentences:
How to keep loading screen for minimum time? Making my first game and stuck at keeping the loading screen visible for some time. It shows for an instance and disappears. By using loadasync the previous scene runs in the background? Do i have to pause everything and then move to the next scene? Thank you! The code is as follows:

public void LoadNextLevel()
{
    StartCoroutine(LoadAsyncronously());
}
IEnumerator LoadAsyncronously()
{
    int nextSceneIndex = SceneManager.GetActiveScene().buildIndex + 1;
    loadingScreen.SetActive(true);
    AsyncOperation operation = SceneManager.LoadSceneAsync(nextSceneIndex);
    float progress = Mathf.Clamp01(operation.progress / 0.9f);
    slide.value = progress;
    yield return new WaitForSeconds(2);
    SceneManager.LoadSceneAsync(nextSceneIndex);
}

sentences:
How can I make 3D lighting smooth? I'm trying to view 3D objects in a terminal. Everything was looking good until I implemented lighting. I'm using shadow rays to determine where the object should be lit. Although it's working I don't know how to make it smooth, I haven't tried anything since I don't actually know what to do.
Here's how a sphere is looking (light is coming from above):

As you can see it's either really dark (.) or light (@) so it's hard to determine the object.

sentences:
Efficiently rendering lots of the same mesh in Unity3D, but with different colors? I'm working on a tile based game, where grass is spreading from tile to tile, so soon lots of grass appear on the board.

Instancing is on, so the FPS is kind of good, even with 300k triangles (1 grass leaf consists of 90 triangles).

BUT: Tiles can be wet and dry on floating scale, which makes the grass leaves turn from green to yellow.

Currently I implemented this simply as such:

var r = originalColor.r + 0.27f * (1f - (ground.Status / 100));
renderer.material.color = new Color(r, originalColor.g, originalColor.b);

Which creates a new material for every grass...

Obviously I can't change the sharedMaterial's color, because that would change all other grass' colors as well.

So how could I efficiently render grass on a big spectrum from yellow to green?

One thing I came up with is that I create only like 100 materials, with 1 percent steps.

= first material is 100% yellow, and the last one is 100% green.

And when a grass turns a bit more green, it doesn't have to create a whole new material with 3.47% green, but instead can use the already created 3% green material.

Any better ideas?

Thanks!

sentences:
Creating a Melee Weapon in Box2D (libGDX) I am struggling with how to implement a melee weapon that can swing when a key is pressed.

I am imagining two different attacks (stab and swing)

I have tried creating two fixtures (character + weapon), two different bodies, two different bodies + revolute joint, but I can not code it to behave the way I imagine it to look like.

STAB:

So with the press of a button, a body/fixture (sensor) would come out for ~1 second and then disappear (alternatively, the body/fixture could always be on the hero and just rotate 90 degrees around the vertices when pressed, and then rotate back to normal)

SWING:

Same thing, but now the weapon will start from the top and swing downwards. Weapon will also be a sensor.

What I have tried:

I created two dynamic bodies.

The weapon has to follow the hero, so I used a revolute joint to hold them together. When a key is pressed, I set the angular velocity of the weapon to a number. However, the weapon will continue to spin after I let go of the key. I tried implementing an if check (if angle is greater than ___, set angular velocity to zero). However, that just means the weapon will stop spinning when I press the key a second time.

sentences:
A controlled trapezoid transformation with perspective projecton I'm trying to implement a controlled trapezoid transformation in Adobe Flash's ActionScript using the built-in perspective projection facility. To give you an idea of how the effect looks like:

http://i.stack.imgur.com/Pa1T0.jpg

I've been searching for a solution for a few days now and, apart from the tessellation alternative which produces poor quality results, no one has tried to employ perspective projection to achieve this effect. It's maybe because it requires solving some math, which is something I hope you could help me with.

So Flash uses a simple frustum model with a viewpoint, projection plane, and focal length, which is the distance from the viewpoint to the projection plane.

http://i.stack.imgur.com/1WmGa.jpg

There is also fieldOfView but it should be of no importance as its meaning appears to be overridden by focalLength (at least it's value makes no difference in my ActionScript experiments as long as the focal length is specified).

The rectangular piece of graphics is located right on the projection plane so that the middle point of its top edge is located in the projection center. To achieve the effect, the rectangle is rotated by some angle.

(Sorry, the forum wouldn't let me post more links to the drawings. Could anyone please edit it to put the last 2 imaged referred at the end of the source right here.)

<>

The question is, what should be the values of focal length and angle so that new height and new bottom width satisfy some given values that are desired for the effect? Or speaking mathematically:

Given:

a frustum with focal length
a rectangle with its width and height, which is pinned to the projection plane (z=0) of so that the midpoint of the rectangle's top edge is located right in the projection center of the frustum
the needed new height and new bottom width of the rectangle after it's rotated and projected onto the projection plane

Unknowns to be found and applied to the perspective projection in order to get the desired new height and new bottom width:

the focal length of the frustum
the angle of rotation

If I missed out any other parameters or added any redundant ones, please correct me.

Also, is it possible to control the effect just by the angle with which the sides of the rectangle should be projected on the projection plane (the angle between the projected rectangle's side and its top edge) provided that the new height remains some constant value?

sentences:
Frustrum culling without per-mesh positions I am trying to implement frustrum culling in a C++ renderer im writing but I feel like I hit a brick wall.
The plan is to load the Sponza level and per mesh create a collision box using Bullet physics library, which also holds the mesh translation, scale and rotation, then get the camera planes and check if the collision box falls inside the planes. I'm loading the Sponza level using the Assimp library, it loads fine and displays correctly but every node's transformation is at 0,0,0  which leads me to believe all the vertices are pre-translated already (even without optimization flags). I checked it out in Blender and even there the translation gizmo is at 0,0,0 for every mesh. I tried a couple different sponza files, FBX too but they all lack per mesh positions. Should I just give up on this? Are there other ways to perform frustrum culling?

sentences:
Unable to stop navmeshagent for rotation before moving I'm trying to get the NavMeshAgent to rotate before calculating a path and proceed walking.

I stumbled upon a thread that said this can be done by manually rotating the object first.

However, I am still stumped as to how to do this as my unit either a)refuses to move or b)moves, but does not stop to rotate.

Below is the code I've attempted.

void Update() {

    RaycastHit hit;
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit) && hit.collider.tag == "Ground")
        {
            targetPosition = hit.point;
        }
    }

    if (transform.rotation != _lookRotation) //check if unit is in line with direction of hit.point
    {
        agent.Stop(); //stops the navmeshagent from moving.

        _direction = (targetPosition - transform.position).normalized;
        _lookRotation = Quaternion.LookRotation(_direction);

        transform.rotation = Quaternion.RotateTowards(transform.rotation, _lookRotation, Time.deltaTime * speed);

    } //perform rotation
    else //else, if already in line, set path and walk.
    {

        agent.SetDestination(targetPosition);

    }

sentences: Can I use jMonkeyEngine to make a closed source game? Can I just share the jMonkeyEngine code and keep my code closed or would I have to make my game open as well? Sorry if this is a noob question.

sentences:
Unity2D: Increase spawn object movement when player collects every 10 points I want to make my spawned objects (enemy prefabs) movement speed up every 10 points my player collects.
This is my movement script, attached to my enemy prefab (so that it can be spawned in my game and move):

public static int movespeed = 20;
public Vector3 userDirection = Vector3.right;

public void Update()
{
    transform.Translate(userDirection * movespeed * Time.deltaTime);
 }
}

And this is my score script attached to my player:

public Text ScoreText;
public AudioClip Coinsound;
public Text Highscoretext;
public GameObject enemy;
Movement movement;

private int Score;
public int highScore = 0;

void Start ()
{
    Score = 0;
    SetScoreText ();
    if (PlayerPrefs.HasKey ("Highscore"))
    {
        highScore = PlayerPrefs.GetInt("Highscore");
    }
}
void OnTriggerEnter2D(Collider2D other)
{
    if (other.gameObject.CompareTag ("Pick Up")) {
        other.gameObject.SetActive (false);
        Score = Score + 1;
        SetScoreText ();
        AudioSource.PlayClipAtPoint (Coinsound, transform.position);

    }
}

As mentioned before I want to make my spawned enemy prefabs to move faster when my player collects every ten points. Thank you :)

sentences:
What's the difference between Gameplay Programming and Graphic Programming? I know the answers are obvious, someone told me this:
Graphics Programming: DirectX(or Direct3d), OpenGL, Vulkan, Metal..

Gameplay Programming: Bringing everything together. From design, music, levels, etc.

But could you please explain me in depth the difference?
This way i can focus on a specific role in game programming!

sentences:
Trying to get an object to move in the mouse direction XNA C# Right, so in my Player class where I call the object I got an if statement which gets the coordinates for the mouse

        bool PickedCoords = true;
        MouseState mouseState = Mouse.GetState();
        if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released)
        {
            PickedCoords = true;
            int MouseX = mouseState.X;
            int MouseY = mouseState.Y;
        }
        else
        {
            PickedCoords = false;
        }
        oldState = newState; // this reassigns the old state so that it is ready for next time

Now how would I make MouseX and MouseY be used as the direction of the vector of my object moving in the specified X and Y coordinates? What I'm, almost trying to do is move the object in the direction of the mouse click and make it continue to move in that direction until it's stopped by whatever.

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:
Cardboard on iPhone 5 doesn't render on stereo Has anyone ran into this?

I'm on Unity 5.1.1p3, Cardboard Unity Integration v0.5 (5/28/2015) and an iPhone 5 running iOS 8.3 (12F70).

I made a game that uses Cardboard and on an iPhone 6 the screen renders as expected: two offset cameras. On an iPhone 5 however, while the screen does show the 2 viewport masking and the distortion correction, it's actually a single camera that is being rendered, defeating the purpose of Cardboard.

Here's what I mean. This is the iPhone 6, as expected:

And this is the iPhone 5, which is wrong:

Any ideas?

Some extra info:

The iPhone5 can only use GLES2. It doesn't support ES3 or Metal. But what I did notice is that if I make a build for GLES2 the first time the app runs on the device (be it iPhone 6 or 5), when the Cardboard camera gets enabled, the app crashes:

If then I quit the app and start it again from the phone without it being hooked up to Xcode, on the iPhone5 I get the wrong rendering I've shown while in the iPhone 6 the app just crashes again. And if instead I make my build with automatic graphics API detection, what happens is that on iPhone6 it goes to Metal mode and so it works fine and on the iPhone5 it goes to GLES2 mode which, as stated before, crashes if attached to Xcode but otherwise just runs only that with the wrong rendering.

sentences:
How to handle data for a competitive multiplayer games I am kinda new to Multiplayer Games and I am really wondering how I should handle my data

Should each player send and update their data to the database (server) everytime one of their essential variables changes (like health or ingame currencies), or should they save the data as long as the game is running and then update the data all at once at the end of, lets say, each round?

I was thinking about using Firebase and Unity and here's a scenario:

Let's say 2 players connect to a game. Then one of them gets damage and the other one gets gold. Does the data change get sent to the FireBase Database immediatly or should I just update everything when the round ends/they disconnect?

sentences: What are the "axes of a matrix" exactly? I am currently learning about game engines, and for the engine math, there are functions called GetXAxis, GetYAxis, and GetZAxis that returned the X, Y and Z axes for a matrix. These functions return the  x, y and z components of the first three rows of the 4x4 matrix as a normalized Vector3. The actual functions are simple enough, but I am having trouble conceptually understanding what exactly the axes of a matrix are. Are they the forward, left, and up vectors of a transformation?

sentences:
Score vs. Kills in a casual game I am making a simple phone game and having a conceptual argument with my partner. The argument might end up being inconsequential, but I would like to hear some opinions from actual devs who are making games.

This will be a pretty standard beat-em-up style game where you beat up lots of easy enemies and build up a huge kill count. There will be many different types of enemies. The question emerged when we had to put up some display on the UI.

Should the kill count be represented as a 1:1 number? For example, on your HUD, it will constantly show:

Kills: 15

--or--

Defeated: 31

Or, should it be represented by a score? For example: 1 enemy = 100 points and it will display something like this:

Score: 1200

This may be a matter of taste in the end. But, for the casual games market, what do you think a mainstream audience will enjoy more? I think people love big numbers, in general, what do you guys think?

sentences:
Box2d Body to follow mouse movement I am trying a box2d body to rotate following the mouse. Here's an image to clarify what I mean.

The red and blue circles are current point of the mouse and the body (of corresponding color) moving/rotating to follow it. Basically the rectangle should rotate with its one end pointed towards where the mouse pointer is.

Here's my code so far,

 World world;
    Body body, bullet;
    Box2DDebugRenderer debugRenderer;
    OrthographicCamera camera;

    @Override
    public void create() {

        world = new World(new Vector2(0, 0f), true);
        debugRenderer = new Box2DDebugRenderer();
        float w = Gdx.graphics.getWidth();
        float h = Gdx.graphics.getHeight();

        BodyDef bodyDef = new BodyDef();
        bodyDef.type = BodyDef.BodyType.DynamicBody;
        bodyDef.position.set(10, 10);
        body = world.createBody(bodyDef);

        PolygonShape shape = new PolygonShape();
        shape.setAsBox(2, 5);
        FixtureDef fixtureDef = new FixtureDef();
        fixtureDef.shape = shape;
        fixtureDef.density = 1f;
        Fixture fixture = body.createFixture(fixtureDef);

        shape.dispose();

        Gdx.input.setInputProcessor(this);

        camera = new OrthographicCamera(200, 100 * (h / w));
        camera.position.set(camera.viewportWidth / 2f, camera.viewportHeight / 2f, 0);
        camera.update();

    }
 @Override
    public void render() {

        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        world.step(Gdx.graphics.getDeltaTime(), 6, 2);
        camera.update();
        debugRenderer.render(world, camera.combined);
    }

  @Override
    public boolean mouseMoved(int screenX, int screenY) {
        int mouseX = screenX;
        int mouseY = Gdx.graphics.getHeight() - screenY;
        float rotateAngle = MathUtils.radiansToDegrees * MathUtils.atan2((float) mouseY - (float) body.getPosition().y, (float) mouseX - (float) body.getPosition().x);
        body.setTransform(body.getPosition(), rotateAngle / 57.2957795f);
        return true;
    }

And here's a gif of how it appears now.

as you can see the body gets skewed and also doesn't rotate properly. What am I missing?

sentences:
Unity 2d text not rendered properly in scene mode I am a beginner in Unity and trying to add a text box to my scene. I have done this before and was able to do it properly.

Problem

But recently I created a new project, added a text element to it, but text is not rendered properly in that text box. Anything I type in it is shown as boxes.

Here is the screenshot for it.

While text is shown properly in play mode. I also tried adding custom fonts in it but it didn't made any effect.

What can be the cause for this.

sentences:
String hashing design I'm in the process of developing a game engine and I would like to refer to game objects and assets by an integer id rather than by their string name.  This should avoid any string comparisons at runtime.  As a result I'm trying to implement the string hashing approach that Jason Gregory describes in Game Engine Architecture.
I've got the actual hashing working, using FNV-1a in my case, but there are some parts of the design from the book that I don't understand.
static StringId sid_foo = internString("foo");
static StringId sid_bar = internString("bar");
...
[stringid.h]

typedef U32 StringId;
extern StringId internString(const char* str);

[stringid.cpp]

static HashTable<StringId, const char*> gStringIdTable;

StringId internString(const char* str)
{
    StringId sid = hashCrc32(str);
    HashTable<StringId, const char*>::iterator it
        = gStringIdTable.find(sid);

    if (it == gStringTable.end())
    {
        // This string has not yet been added to the
        // table. Add it, being sure to copy it in case
        // the original was dynamically allocated and
        // might later be freed.
        gStringTable[sid] = strdup(str);
    }
    return sid;
}

Presumably HashTable is a custom hash table implementation as no such class exists in C++?  Is there any problem with my current setup of storing the hashed strings in a std::unordered_map<StringID, const char*>?
From my research, making the hash table static means that it is only accessible inside this translation unit.  a)  Why is it defined this way, and how would you then access the hash table in the rest of the game engine?  b) Or do you call internString for every string and store the returned hash in a header #included in every file that needs access?
What is the purpose of making externString extern?

Thanks.

sentences:
Can I add non-trees to terrain.terrainData.treeInstances on Unity 3D? I need to create a brush in which there will be stones, poles, bushes and other elements of the environment. I bought a Prefab Brush. Whether it is possible to add the objects that I draw on the Prefab Brush scene to terrainData.treeInstances, as regular trees add?

Is it possible to use a not prefab tree as an object for the TreeInstance class?

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:
Is it still possible to install Unity? When trying to install Unity I am getting the following error:

  The download of version ... was cancelled.

I checked that there are no spaces in the path.

Also I can not Sign in.
When I provide the correct email and password the Sign in window just closes with no result.

Also I tried to report a bug using the Report Bug feature, but it seems not to work.

Also I tried to post a question on Unity Forum. But the Sign In over there does not work as well.

What else may I try? Thank you.

sentences: Using non-copyrighted music for a paid game I'm making a game. It will be sold and not free. Am I allowed to use non-copyrighted music in it?

sentences:
Car physics - velocity and latheral force Im developing simple car racing game. To turn a car, I need to calculate slip angles for each tire and then use those angles to find lateral force (using Hans B. Pacejka magic formula). One thing I don't understand is relation between car`s speed and lateral forces.

Everywhere is written, that lateral force depends only on slip angle. But it means that lateral force will be the same for slow and very fast velocity. Is that true? How to use lateral forces to move a car? In my opinion lateral force should be small if velocity is small.

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 use MaterialPropertyBlocks to randomly change the color of multiple materials on an object? I have a character prefab for a civilian with 5 materials. Each one should be a random color but I don't want a new material for every civilian in the game. I asked a question earlier and had a good answer. However I was pointed towards this question with MaterialPropertyBlocks. This is the code I currently have:

void Start () {
    Color newShirtColor = shirtColor[Random.Range(0, shirtColor.Length)];

    MaterialPropertyBlock props = new MaterialPropertyBlock();
    props.AddColor("_Color", newShirtColor);
    GetComponent<SkinnedMeshRenderer>().SetPropertyBlock(props);
}

It works really well but the color is assigned to the whole mesh. How can I do this for each of the 5 materials on the object so that it only changed the color for the assigned parts of the mesh, with only one material for each section?

sentences:
How to render infinite universe? I'm curious what are the best practices in game development industry to render 3d universe?

To be more specific:

The data points are given and static. Each point has position, color and size;
The entire data set is much larger than available memory;
User should be able to "zoom out" to see bigger picture at once;

The most naive approach would be to split universe into cubes and render only what's visible. I'm not sure how in this scenario should I implement the "zoom out". Should I precompute cubes for each possible zoom level? Or maybe there are better approaches?

I'm looking for technology agnostic solution.

sentences: Using gametime.ElapsedGameTime to trigger an event I have a splashscreen object that waits for a user input before loading the next screen, but I would also like the next screen to load after a certain amount of time has passed. I tried adding a check to see if the elapsed game time is greater than or equal to a set amount of time in seconds. The user input still changes the screen, but the screen will not change after that time requirement has been met. What am I doing wrong?

sentences:
How do I implement tilt controls that work even when the device is not vertical? I'm using libGDX to develop an Android game. The main character can be moved freely in the 2d plane by tilting the phone. The relevant part of my current implementation looks somewhat like this:

Vector2 mainCharacter;
float speedX, speedY;

public void render(float delta) {
    speedX = 0.6f * speedX + 0.4f * -Gdx.input.getAccelerometerX();
    speedY = 0.6f * speedY + 0.4f * -Gdx.input.getAccelerometerY();
    mainCharacter.move(speedX, speedY);
}

This simple implementation works quite well as long as the player sits or stands upright. But there are two situations where this approach fails:

If the player holds his phone almost horizontally (e.g. if he lies in bed, see fig. 1). Neither the computation of speedY nor the computation of speedX works properly in that situation.
Inside a moving vehicle. When the vehicle speeds up or slows down, this has a strong impact on the values returned by Gdx.input.getAccelerometerX/Y.

So my question is: Is there anything that can be done to solve these two problems? How can I get satisfying results independent of whether the player is lying, standing or sitting? And is there a reasonable way to reduce the influence that the movement of a vehicle has on the output of the accelerometer?

fig. 1

sentences:
Computing uv coordinates on a sphere approximated from an octahedron Right now I'm texturing the octahedron with the formular from wikipedia(Finding UV on a sphere): UV Coordinates Wikipedia

That unfortunately leads to heavy distortion right at the beginning, which of course leads to a lot of distortion when splitting up the triangles when approximating it to a sphere.

The upper and lower triangles are okay, the left and right ones are distorted.
Now I'm looking for different formulars to calculate the uv's. Are there any other easy formulars? Or would another approach be much more complicated?

sentences:
XNA (BEPU) Physics Performance Im using XNA 4.0 with the BEPU physics engine v1.2 and I have encountered some performance problems on Xbox. Im not sure if the my mesurements are an expected result of the Xbox (with alot of dynamic physics objects). So I wonder if anyone else thinks the numbers are fair or not?

Here's my mesurement:

Im runing a simulation with 100 dynamic boxes and a static plane as my ground. Now this sim is multithreaded on hardware threads 1, 3, 4 and 5 (Xbox) and I see a significant perf boost because of that. However the performance of the simulation varies between 3-5.5 ms for resting objects on the 360.
Is that not way to much or is it fair? The PC version runs the sim at about 0.7-1 ms. However that version is multithreaded over 8 cores. But it's still a very big leap.

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:
Server-side physic simulations with hundreds of players I’m currently working on a singleplayer physics-orientated game where I would like the physics to be simulated server-side. This because the game will have leadersboards, persistant player progression, etcetera and I want to prevent any type of cheating – basically a pure client-server architecture, the client is “dumb” and only displays what the server wants you to display.

The problem however is that the game will most likely be played by hundreds (maybe thousands) of people at the same time. This concerns me, as it will most likely kill server-processing power if I have to do and maintain hundreds of states at the same time.

I would have no problems moving all of the physics simulations to the client-side, but then I would really need a way to validate if the result of a client simulation is valid. However, I can't figure out how.

I have thought about running the simulation server-side once in a while to validate if the client is still playing fair, but I really want the server to have as less strain as possible.

Physics will become about as complex as the GDC 2011 demo by Glenn Fiedler, maybe even simpler. However, a lot more always-colliding rigid-bodies will be in a single scene and they will all be visible at once.

I have a hard time getting an answer to this particular case, as most resources on the web - again, Glenn Fiedlers site being a great one - speak about small-scale networked physics (eg. a FPS with 30 players, like Halo).

Any advice, websites, papers or the like on the subject will be very appreciated.

A recap of the questions I would like an answer to:

How feasible is a client-server model? Is my server-processing power concern legit and grounded?
Is it possible to reliably validate a physic simulation run by the client on the server? If so, how?

sentences:
Why do I get an error "exit() redefinition" while using OpenGL? I am using Visual C++ 2010 and I get the following errors:

1>d:\visual c++\vc\include\stdlib.h(353): error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1>d:\glut-3.7.6-bin\include\gl\glut.h(146) : see declaration of 'exit'

In my project I have 3 files.  Here are the includes from each of them.

Main.cpp

#include<iostream>
#include "BmpLoader.h"
#include<glut.h>

BmpLoader.h

#include<stdio.h>
#include<glut.h>
#include<Windows.h>

BmpLoader.cpp

#include "BmpLoader.h"

As far as I know, I receive this error due to the include order.  I have tried so far several arrangements of the includes, but haven't figured out the proper arrangement.

What library combination causes this error and what include order should I use in order to prevent it?

sentences: Line strokes also adding borders to other shapes? When you run the project, you can see that the first circles have a black border around them. When I remove the Game.drawLines(), the circles don't have the border around them anymore. Any help is appreciated!

sentences:
How can I create a random deck of 7 cards every time they are all used? I'm trying to create a Tetris like game in C# (Unity) and I've run into quite a problem on how I can generate 7 cards (tetrominoes) of which none are the same and when I run out of cards, I regenerate more.

I can kind of see how I could do the regeneration part but I'm very unsure on getting 7 cards for which none are the same.

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:
glTranslate, how exactly does it work? I have some trouble understanding how does glTranslate work.
At first I thought it would just simply add values to axis to do the transformation.

However then I have created two objects that would load bitmaps, one has matrix set to GL_TEXTURE:

public class Background
{
    float[] vertices = new float[]
        { 0f, -1f, 0.0f,
          4f, -1f, 0.0f,
          0f, 1f, 0.0f,
          4f, 1f, 0.0f };

    ....
    private float backgroundScrolled = 0;
    public void scrollBackground(GL10 gl)
    {
        gl.glLoadIdentity();
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glTranslatef(0f, 0f, 0f);
        gl.glPushMatrix();

        gl.glLoadIdentity();
        gl.glMatrixMode(GL10.GL_TEXTURE);
        gl.glTranslatef(backgroundScrolled, 0.0f, 0.0f);
        gl.glPushMatrix();

        this.draw(gl);
        gl.glPopMatrix();

        backgroundScrolled += 0.01f;
        gl.glLoadIdentity();
    }
}

and another to GL_MODELVIEW:

public class Box
{
    float[] vertices = new float[]
        { 0.5f, 0f, 0.0f,
          1f, 0f, 0.0f,
          0.5f, 0.5f, 0.0f,
          1f, 0.5f, 0.0f };

    ....

    private float boxScrolled = 0;
    public void scrollBackground(GL10 gl)
    {
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glTranslatef(0f, 0f, 0f);
        gl.glPushMatrix();

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glTranslatef(boxScrolled, 0.0f, 0.0f);
        gl.glPushMatrix();

        this.draw(gl);
        gl.glPopMatrix();

        boxScrolled+= 0.01f;
        gl.glLoadIdentity();
    }
}

Now they are both drawn in Renderer.OnDraw. However background moves exactly 5 times faster. If I multiply boxScrolled by 5 they will be in sinc and will move together. If I modify backgrounds vertices to be

    float[] vertices = new float[]
        { 1f, -1f, 0.0f,
          0f, -1f, 0.0f,
          1f, 1f, 0.0f,
          0f, 1f, 0.0f };

It will also be in sinc with the box.
So, what is going under glTranslate?

sentences:
Tetris style game in java (for now) will I need to use threads? I'm looking at developing a puzzle game, it might be like tetris or something similar, perhaps more like bejewelled in that the player will select objects with the mouse to manipulate them.

I've been studying java part-time in college for the past year, really beginner stuff, but I've decided to build a game over the summer to keep the brain active :-D

So far I've animated some primitive shapes moving around the screen using the timer from the utilities package. This is all good, they're behaving the way I want.
So now I've decided to try manipulate the shapes with the mouse. Just some really simple stuff, maybe change the colour of an object when I click on it.

To test the mouse functions I've successfully completed the MouseEvent and MouseListener tutorials on The New Boston.
However, I can't get these events working in my code. I suspect I'm going to have to re-write my classes.

Will I need separate threads within the game, for example, one thread to animate the objects and another to listen for and handle mouse events.

My understanding is that I should implement runnable on my classes when using threads in Java games.
Am I thinking on the right lines?

sentences:
Balancing a game about gladiatorial robot combat Suppose a player can construct a robot built from various parts and each part costs money. How would you balance the cost of a weapon against its capabilities? What about balancing weapons against other parts?

The base case seems pretty easy: imagine the player can only buy weapons and everything else on the robot is the same. A machine gun that fires 1 bullet per second costs $100. A super machine gun that fires twice as fast could cost twice as much. But what about an ultra machine gun that has four times the range?

Now imagine the player can add other capabilities to the robot like better speed or armor. How do you relate the cost of a machine gun against the ability to move very quickly, or to be stealthed against radar?

I understand that there's a later stage of experimentation where costs and capabilities are adjusted, but where do you start from?

sentences:
Serverless Multiplayer I wanted to make a game with a "serverless" mobile multiplayer game.
The idea was to have devices connect to each other automatically when they are within range.
There would be no global game state but just the one created by the first one to start their game or be in one place. When others join the game state is forwarded to them and the themselves send it to devices that are connected to them.
This happens everytime there is a significant change.
The game itself would be kind of an rpg with a location based gameplay (mostly to have the players socialize)
The idea was to only have players who are close to each other play together.
Now: the actual question: How can I realize this idea? Things I found online were Android Wifi Direct or Bluetooth but both seem to have their problems for this project. Is there any way I can actually build my game?

Thanks in advance.

sentences:
Visually updating the position of a game object controlled by an animator controller I have a game object that is controlled by an animator controller. In order to activate the next animator state, the user is supposed to grab this game object, and then move it from Point A to Point B.

As a test, in said game object's Update() method, I added the following line:

this.transform.localPosition += Vector3.up;

When running the game, I can see that the y-coordinate of the game object's position increases every single frame, just as intended. However, visually, the game object's position is not changing at all -- it remains in the same place all the time.

What should I do to ensure that game object's position is also visually updated?

EDIT:

Here are the properties of the animator I am using:

EDIT:

If relevant, here is the skinned mesh renderer for said game object:

sentences: Compiling a Monogame Game into a single .exe Is it possible to compile a monogame game into a single .exe? I know if you go in the debug or release bin, there is in fact a .exe your game, except you move this .exe's file location or try to run in on another computer it crashes. I am also aware of the one-click application except this seems like a really messy way of redistributing a monogame game. How come when you build your game, the exe for it wont work anywhere but that file location and that computer. I am also aware that the computer probably needs the XNA framework downloaded to play the monogame game, so in short is it possible to redistribute a monogame game by creating a single .exe and assume that person who is using it doesnt have XNA or monogame installed?

sentences:
Updating the jump in game I am making a Java game and I want my game to run the same on any FPS so I'm using time delta between each update. This is the update method of the Player:

    public void update(long timeDelta) {

        //speed is the movement speed of a player on X axis
        //timeDelta is expressed in nano seconds so I'm dividing it with 1000000000 to express it in seconds

        if (Input.keyDown(37))
            this.velocityX -= speed * (timeDelta / 1000000000.0);

        if (Input.keyDown(39))
            this.velocityX += speed * (timeDelta / 1000000000.0);

        if(Input.keyPressed(38)) {
            this.velocityY -= 6;
        }

        velocityY += g * (timeDelta/1000000000.0); //applying gravity
        move(velocityX, velocityY); /*this is method which moves a player
                                        according to velocityX and velocityY,
                                        and checking the collision
                                    */

        this.velocityX = 0.0;
    }

The strange thing is that when I have unlimited FPS (and update number) my player is jumping about 10 blocks. It jumps even higher when the FPS is increasing. If I limit FPS it is jumping 4 blocks. (BLOCK: 32x32) I have just realized that the problem is this:

if(Input.keyPressed(38)) {
    this.velocityY -= 6;
}

I add -6 to velocityY which increases player's Y proportionally to the update number and not to the time.

But I don't know how to fix this.

sentences: Emit light from items In order to create a day/night cycle in my game, I decreased the r,g and b values of the Color variable after a certain amount of time has passed. This worked as expected. I am wondering in order to create light from an item, like a fire or lamp, could I create a circle around the item and set the color in that circle to be white? Or is there a better way for accomplishing this in 2d?

sentences:
Unity WWW: Post a request to an URL with custom headers I am using  C# to try retrieve a token and my code is based on this example:https://docs.unity3d.com/ScriptReference/WWWForm-headers.html

IEnumerator Start() {
  string urlToken = "myUrl";

  WWWForm form = new WWWForm ();
  form.AddField ("username", username);
  form.AddField ("password", password);

  Hashtable header = form.headers;//where I am getting my error*

  header.Add("content-type", "application/json"); //header I need send over

  WWW tokenRequest = new WWW (urlToken, form, header);

  yield return tokenRequest;
  print ("Anything back?" + tokenRequest.bytesDownloaded);
}

*Assets/WWWDemo.cs(46,19): error CS0029: Cannot implicitly convert type System.Collections.Generic.Dictionary to System.Collections.Hashtable

How would the header be assigned correctly? Does anyone have any ideas?

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:
How to implement color changing fragment shader? I have a background of a given size and filled with a given color. I want to change it with an animation effect, starting from the center and spread out until it extends the whole background. The new color should fade / blend smooth into the existing color from the background. Some kind of radial gradient that changes the color and then spreads out over the whole background.

I am working with SpriteKit on iOS and I am really sure that the best way to implement this is to do this with fragment shaders which are new to iOS 8 SpriteKit SDK. I have done some work with shaders and understand how they work but I am asking for help more on the mathematics behind this.

sentences:
Detect obstacles in path on a tile-based map I'm creating a 2d game with a tile-based map, but smooth movement. I currently use A* in combination with some other tricks for pathfinding, and one issue what I've been dealing with is getting the units to move smoothly despite tile-based pathfinding.

My solution at the moment is the use raycasting to determine if there is an obstacle between a unit and its target. If there is, it uses A*. Otherwise, it just sets its next move directly as the coordinates of its target. In the case that it uses A*, I also use raycasting to determine which point in the path the unit should move to next, by finding the nearest point in the path that is not obstructed from the units current location, and setting that as the next move. This is necessary so the unit doesn't have to move in a jerky fashion based on the tile-based path that the A* found.

Raycasting is faster than A* every time, but it still has some overhead with a large number of units since it checks every point on the line in small increments. (More so since I'm doing double raycasting each time to account for the size bounds of the unit)

My question is: Is there a better algorithm than raycasting to determine if there is an obstacle between two points (independent of the tiles structure) on a tile-based map? My thought is that there is some way to take advantage of the tiled nature of the map.

sentences:
How to determine vertex index using Shader Model 3 or lower? I need something like SV_VertexId (added in Shader Model 4) in HLSL shader to determine which vertex is currently handled. Unfortunatelly, I can compile only vs_3_0 or lower.

The objective is to change position of one specific vertex using HLSL. I can't edit the mesh and can't pass any data from game engine, my capabilities are limited by HLSL shader.

Shader is writing only for one mesh (humain face), I need to change it's shape a bit (for example, close an eye or make it smiling). I already tried to locate vertex by TEXCOORD, but had no idea how to separate it from other triangles verticles connected to it (placed at the same point where many triangles are met).

if ( VS.TC[0] > 0.8828125 && VS.TC[1] > 0.6328125  && VS.TC[1] < 0.671875 ) {
    // Upper lip center
    VS.Position += VS.Normal * uUpLip;
}

Could you, please, give me any advice how to identify / move only one specific verticle in HLSL? I need something like moving verticle in Blender's Edit Mode (wytn neighbour triangles are still connected in one point), but my attempt with TEXTCOORD makes them moving in different directions

Thanks

sentences:
How to choose a success and failure sound I create a math game where the user has to solve an equation. If the user is right, the application plays sound A. If he's wrong, it plays sound B.

What criteria should I use to choose sounds for A and B?

sentences:
Execute cloud build from script in Unity Want to make cloud build functionality in Unity.
How can I do it in Unity from script(in EditorWindow)?
Update: Found Pre- and post-export methods, but still can't find the way to execute cloud build...

sentences:
Gravity and collision detection interfering with player movement I am attempting to implement collision detection for a 2d sidescroller game and I'm having trouble keeping gravity from interfering with player movement.

Every frame I get and handle input, creating values for a point that represents the players movement vector. I then add gravity to the vector and check for collisions. This is the way AI will be handled as well.

The problem I'm having is when the player is on a floor tile, even if the input says to walk horizontally, after I add gravity to the move vector, collision detection returns a collision so the movement is completely negated.

I know i can test which a is is the problem, negate that and move the player but then if I change the players movement vector inside collision testing, wouldn't I have to cull for collisions again based off the new move vector?

I don't know if this has to do with input handling or collision testing. So how should I go about adding gravity to the players movement?

sentences:
AndEngine: edit elasticity on action I'm making a game for Android with AndEngine.

It's going quite well, but now I'm stuck on something.
My main character has a elasticity set in its fixturedef so it bounces around throughout the game.
Now i want the user to be able to not let the player bounce when he does a control.

So my question: how can I modify the elasticity of my character? Because I saw you can adjust the setDensity and setFriction, but I cant see the setElasticity....

Thanks in advance!

sentences:
Retractable object in unity I'm trying to get the physics of a retractable object in unity,
So I will be able to "launch" an elastic cable (similar to rope physics) out of an object (e.g. A gun),
And the cable will gradually/exponentially "roll back" into the object.
A good reference would be Batman's grapple gun.
I thought of utilizing it using a spring joint, but I can't really get the exact mechanics I'm trying to achieve.
Any ideas?
Thank you in advance.

sentences:
What do I need to do legally to protect my game with copyright? I am in the process of writing a game and I'm wondering what the copyright laws about publishing this game are.

I do not (for now) intend to make money from this. The beginning of my code contains a comment with # Copyright 2013, Collin Norwood, but is that legally valid? Do I have to apply with some government for a trademark or such?

sentences:
How to set X and Z axis to 0 after transform.rotation in c# Recently I start using C# instead of JAVA and I don't know how to set a value in a eulerangle only for one axis.

Maybe I don't need to do that, so better I explain what I'm doing:

I have a 3D object (player) that look at mouse pointer, but when the mouse pointer it's too close to the object, it's change his x and z axis, and I need to set it to 0 to keep standing the object.

In java I just write this after transform.rotation:

transform.eulerAngles.x = 0;
transform.eulerAngles.z = 0;

In C# I can't do that. Is there a simple way to do it? My code is:

Ray ray = Camera.main.GetComponent<Camera>().ScreenPointToRay (Input.mousePosition);
RaycastHit hit_A;
if (Physics.Raycast (ray, out hit_A, Mathf.Infinity, GroundMask)){
    Vector3 rotPoint = new Vector3 (hit_A.point.x - transform.position.x, transform.position.y, hit_A.point.z - transform.position.z);
    transform.rotation = Quaternion.LookRotation(rotPoint);
}

Maybe, as I said, there are an other way to fix this. I'm open to any solution. I searh it on google, but because at my english level I don't understand the results

Thanks you all.

sentences:
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:
faster compile and editor update in unity sometimes for some small changes, I need to recompile the code In the editor and it causes some time to be testable in the editor(sometimes more than 20, 30 seconds).
I know when loading shows on the bottom-right side of the editor in means that it's compiling the code and when it doesn't move it means that it's updating the editor or checking for possible updates.
I need to know is there any way to make it faster? I mean, is there any option to tell unity don't recompile unchanged classes or don't consider all editor classes for changing the editor? or any other technique that makes the process faster?
as I use unit tests in the editor, most of the time is consumed by updating the editor for any added function or changes on them.

sentences:
Moving entities above a tile entity Sorry if my code looks amateur I just started modding, although I have experience in Java.

I have a tile entity checking every frame if there are entities above it. It works, but then stops after 1 tick. Here is the code I am using.

import java.util.List;

import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;

public class TileEntityConveyor extends TileEntity implements ITickable {

    public static float speed = 1f;

    @Override
    public void update() {
        if (this.worldObj.isRemote)
            return;
        double x = this.pos.getX();
        double y = this.pos.getY();
        double z = this.pos.getZ();

        AxisAlignedBB collsion = new AxisAlignedBB(x, y, z, x + 1, y + 2, z + 1);

        List<Entity> list = this.worldObj.getEntitiesWithinAABB(Entity.class, collsion);

        for (Entity entity : list) {
            entity.motionX += speed;
            //          this.
        }
    }

}

sentences:
XNA: Regarding SpriteBatch.Draw() I was trying to develop a very simple ping pong game using XNA.

In my Draw() I am drawing the player paddles first then the ball as follows:

spriteBatch.Draw(myPlayer, myPlayer1Pos, null, Color.Aqua);
spriteBatch.Draw(myPlayer, myPlayer2Pos, null, Color.Aqua);
spriteBatch.Draw(myBall, myBallPos, Color.LawnGreen);

Now the problem is the ball is no longer displayed in the game window as shown below

If on the other hand I draw the ball before the player paddle

spriteBatch.Draw(myBall, myBallPos, Color.LawnGreen);
spriteBatch.Draw(myPlayer, myPlayer1Pos, Color.Aqua);
spriteBatch.Draw(myPlayer, myPlayer2Pos, Color.Aqua);

then the right hand side paddle is no longer visible as shown below:

Can anyone explain what is going wrong here?

edit: The complete Draw():

protected override void Draw(GameTime gameTime)
{
      GraphicsDevice.Clear(Color.CornflowerBlue);

      // TODO: Add your drawing code here
      spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

      spriteBatch.Draw(myBall, myBallPos, null, Color.LawnGreen);

      spriteBatch.Draw(myPlayer, myPlayer1Pos, null, Color.Aqua);
      spriteBatch.Draw(myPlayer, myPlayer2Pos, null, Color.Aqua);

      spriteBatch.Draw(myBkgTexture, graphics.GraphicsDevice.Viewport.Bounds, Color.Blue);

      spriteBatch.End();

      base.Draw(gameTime);
}

sentences:
What are these rendering artifacts and how can I fix them? Here is the artifact:

Here is some clarifying information:

This appears only at 480 units from the origin, and seems to get worse (to a point) as I move away.
All water should have sand rendered behind it, but the sand should be occluded (since I will eventually be rendering the water semi-transparently).

Here is my guess:

This looks like z-fighting, but my issue with this hypothesis is that none of these polygons are co-planar.

sentences:
Determining whether two fast moving objects should be submitted for a collision check I have a basic 2D physics engine running. It's pretty much a particle engine, just uses basic shapes like AABBs and circles, so no rotation is possible. I have CCD implemented that can give accurate TOI for two fast moving objects and everything is working smoothly.

My issue now is that i can't figure out how to determine whether two fast moving objects should even be checked against each other in the first place. I'm using a quad tree for spacial partitioning and for each fast moving object, i check it against objects in each cell that it passes. This works fine for determining collision with static geometry, but it means that any other fast moving object that could collide with it, but isn't in any of the cells that are checked, is never considered.

The only solution to this i can think of is to either have the cells large enough and cross fingers that this is enough, or to implement some sort of a brute force algorithm. Is there a proper way of dealing with this, maybe somebody solved this issue in an efficient manner. Or maybe there's a better way of partitioning space that accounts for this?

Here's a diagram:

Object A and B's "areas of effect" cross, they should be checked against each other. But with the way i'm currently checking for collisions does not account for this. Again, i can think of a few solutions to this like actually checking if objects' paths cross once their velocity is higher than x, or something, but that feels like a hack and it's a mess to try and implement.

sentences:
Unity Vector3 position inside collider I am trying to create a "wander" action that will make my NPC walk to a random position.

The catch is that the NPC should only go positions inside of a collider.

I have a huge Sphere that has a collider on it now I only want my NPC to go to positions that are inside that Sphere collider.

My question is how do i find a random position inside of a colider?

Update

So after testing i am unable to use colliders because the sphere is too big here is an image of my gameobject:

As you can see from the image I have a huge sphere that my NPC's will have to stay inside when wandering

In order to use the Collider.ClosestPoint() the collider has to be a Box, sphere or a mesh collider with a convex.

Sadly this is not feasible for me because the sphere should not collide with other objects.

So my question is how do I find a point inside this gameobject?

sentences:
Drawing particles with CPU instead of GPU (XNA) I'm trying out modifications to the following particle system. http://create.msdn.com/en-US/education/catalog/sample/particle_3d

I have a function such that when I press Space, all the particles have their positions and velocities set to 0.

for (int i = 0; i < particles.GetLength(0); i++)
{
    particles[i].Position = Vector3.Zero;
    particles[i].Velocity = Vector3.Zero;
}

However, when I press space, the particles are still moving. If I go to FireParticleSystem.cs I can turn settings.Gravity to 0 and the particles stop moving, but the particles are still not being shifted to (0,0,0).

As I understand it, the problem lies in the fact that the GPU is processing all the particle positions, and it's calculating where the particles should be based on their initial position, their initial velocity and multiplying by their age. Therefore, all I've been able to do is change the initial position and velocity of particles, but I'm unable to do it on the fly since the GPU is handling everything.

I want the CPU to calculate the positions of the particles individually. This is because I will be later implementing some sort of wind to push the particles around. How do I stop the GPU from taking over? I think it's something to do with VertexBuffers and the draw function, but I don't know how to modify it to make it work.

sentences:
portal cutoff effect I want a 3D Mesh to come out of a flat portal. Only the part of the mesh that's coming out of the portal should be rendered, so the mesh should be cut off or sliced until it's fully outside the portal.

I thought about using discards in a fragment shader, but since I work on iOS OpenGL ES 2.0 I'd like to avoid that for performance reasons. Is there a performant way to do this?

sentences:
Rolling on collision I'm having a small issue where if I collide with another object (let's use a simple cube) with my player (this player is just a sphere), the ball will infinitely roll in the opposite direction and WILL NOT STOP. my code is as follows:

using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Rigidbody rb;
    private float moveHorizontal;
    private float moveVertical;

    public float moveSpeed;

    // Start is called before the first frame update
    private void Awake()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");
    }

    private void FixedUpdate()
    {
        MovePlayer();
    }

    private void MovePlayer()
    {
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * moveSpeed);
    }

I even changed the ForceMode to ForceMode.Impulse so be able to see what it was doing a little easier, and it is in fact slowly rolling away infinitely with no way to stop it.

Both objects have a Rigidbody for them to be able to react to being hit. This is my first time messing with 3d. I tried to do something like this to make it not roll away on impact

private void OnCollisionExit(Collision collision)
    {
        if (collision.collider.gameObject.layer != LayerMask.NameToLayer("Ground"))
        {
            rb.velocity = Vector3.zero;
        }
    }

But then if I want to jump on the cube (lets say the cube is an enemy and I'm jumping on it to kill it), then it acts very wonky each time it touches the edge of the cube and I haven't made it on top (again, because the velocity is being set to zero).
I am all out of ideas and would love some input here!

EDIT: I now realize that the ball will slowly roll forever even without collision and just simply moving. I am very lost !

sentences:
2D Game dev and Java. Other possibilities than OpenGL? I recently started to program some basic OpenGL stuff in Java, but OpenGL and DirectX is too much to handle and to understand for me and I'm getting bored really fast.

Now I am wondering if there are other possibilities than OpenGL (or DirectX) to make simple 2D graphics and to get started in Game Development, even if its limited. I will probably use OpenGL anyway when I am more experienced.

sentences:
Vertical camera rotation has reduced speed & range when looking at the character from the left or right I completed a camera tutorial for Unity. I can rotate a camera around my figure around the Y axis (Vector3.up) and I wanted to extend that for a Fixed-Free 3rd Person camera (What are the types of 3rd-person camera called?) where I can tilt aswell but I am stuck with the wrong rotation.

I expect the camera to go up/down whenever I use the joystick up/down and always go left/right when I use the joystick left/right.

But instead of that I get always left/right movement as I wish but up/down is only working at the center. The further I go left or right (see images) the less I go up/down. This sounds super complicated, please see the images. I want the same behaviour as shown when the camera is behind the object and I want to avoid the behaviour at the right side like in the first image.

Bonus would be if I can limit the up and down movement to say 160° so the player can't look top down.

The Code looks like this (only RotateCamera() and UpdateCameraPosition() are relevant):

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

public class PlayerCamera : MonoBehaviour
{
    [System.Serializable]
    public class InputSettings : System.Object
    {
        public float inputThreshold = 0.1f;
        public string VERTICAL_AXIS = "CameraVertical";
        public string HORIZONTAL_AXIS = "CameraHorizontal";
        public string LOCK_TARGET_PYRAMID = "LockToPyramid";
        public string LOCK_TARGET_AREA = "LockToArea";
    }

    [SerializeField] private Transform target;
    [SerializeField] private float cameraSpeed = 2;
    [SerializeField] private Vector3 lookAtPlayerOffset = new Vector3(0f, 0.6f);

    private PlayerController playerController;
    private float cameraHorizontal, cameraVertical;
    private float lockPyramid, lockArea;
    private InputSettings inputSettings;
    private Vector3 cameraPlayerOffset;

    void Start()
    {
        SetCameraTarget(target);

        inputSettings = new InputSettings();
        cameraPlayerOffset = transform.position - playerController.transform.position;
    }

    private void Update()
    {
        GetInput();
    }

    private void LateUpdate()
    {
        RotateCamera();
        UpdateCameraPosition();
    }

    private void RotateCamera()
    {
        Quaternion cameraRotationXDelta = Quaternion.AngleAxis(cameraHorizontal * cameraSpeed, Vector3.up);
        Quaternion cameraRotationYDelta = Quaternion.AngleAxis(cameraVertical * cameraSpeed, Vector3.right);

        // this does not work how I wish it would after rotating around a bit
        cameraPlayerOffset = cameraRotationYDelta * cameraRotationXDelta * cameraPlayerOffset;

    }

    private void UpdateCameraPosition()
    {
        // prevent camera from clipping through floor
        Vector3 newPos = playerController.transform.position + cameraPlayerOffset;
        newPos.y = newPos.y < 0.2f ? newPos.y = 0.2f : newPos.y;
        transform.position = newPos;
        transform.LookAt(target.transform.position + lookAtPlayerOffset);
    }

    private void GetInput()
    {
        cameraHorizontal = Input.GetAxis(inputSettings.HORIZONTAL_AXIS); // interpolated
        cameraVertical = Input.GetAxis(inputSettings.VERTICAL_AXIS); // interpolated

        lockPyramid = Input.GetAxis(inputSettings.LOCK_TARGET_PYRAMID); // interpolated
        lockArea = Input.GetAxis(inputSettings.LOCK_TARGET_AREA); // interpolated
    }

    private void SetCameraTarget(Transform targetTransform)
    {
        target = targetTransform;

        if (target != null)
        {
            if (target.GetComponent<PlayerController>())
            {
                playerController = target.GetComponent<PlayerController>();
            }
            else
            {
                Debug.LogError("The camera's target needs a player character controller.");
            }
        }
        else
        {
            Debug.LogError("Your camera needs a target");
        }
    }
}

sentences: Why my Edit Collider in Unity2D has no point to adjust size? Why when I clicked to Edit Collider of Box Collider 2D component, is not showing points for me resize the collide box?

sentences:
Pixelated shadows in Unity I have tried everything I can think of and all the solutions I could find on forums, but I haven't been able to fix this problem. I have a point light that is shining on several spheres which are casting shadows. The shadows work fine, but they are quite obviously pixelated. How do I get them to be smoother?

These are the settings that I took this screenshot with. I've tried tweaking most of the them, but it's possible I wasn't using the right combination to get the smoother shadows.

sentences: How can I stop showing camera image in my Scene? Unity How can I stop showing camera image in my Scene in Unity? As you can see on the screenshot there is an image of a camera inside a player in the Scene view. How can I disable the image?

sentences:
jQuery - div border around map area Let's say I have this map:

<map name="diffmap1" id="diffmap1" class="myMap">
<area shape="poly" coords="152,347,253,292,264,307,167,358" class="diff diff1">
<area shape="poly" coords="93,244,164,215,171,233,97,264" class="diff diff2">
</map>

and javascript:

$('.diff').click(function(e){
//code here
});

How can I make when I click on one one 'diff' to make a div with border appear around that 'diff'?

It has to calculate the position automatically, like the margin-top, margin-left and size based on the coordonates.

Any thoughts?

sentences:
can't make my unity character move so I'm starting with Unity , I followed the john lemon tutorial , and I wanted to apply what I learn on a model on my own coming from blender.
Everythings works , animation , rotation , but not translation . For some reasons my character doesn't move at all .
It might have to do something with root motion since I have apply root motion in grey with written just after "handled by script" . Not sure what to do ..
I found something about character in place,  I think I'm in this case but I'm not sure how to use it in my script ..
https://docs.unity3d.com/Manual/ScriptingRootMotion.html

If you ask I'll give you my project .

EDIT :

ok so I made some advances :

 void OnAnimatorMove()
{
        m_Rigidbody.MovePosition(m_Rigidbody.position + m_Movement * m_Animator.deltaPosition.magnitude * 10000);
        m_Rigidbody.MoveRotation(m_Rotation);
        Debug.Log("m_Animator.deltaPosition.magnitude: " + m_Animator.deltaPosition.magnitude);

}

m_Animator.deltaPosition.magnitude is actually always equal to 0 , explaining why my charachter doesn't translate but why is it always equal to zero ?

sentences:
SharpDX Error 'The Parameter is Incorrect', how to debug from dx? I have written some code to handle a DX device. When the code is finished and makes it's call to DX the DX engine is complaining. What I'm looking to understand is how one goes about debugging on the DX end or at most what parameter passed is trowing an error.

For reference this is my code. This is not the complete class but gives an idea of the code I'm attempting. Happy to share more if needed.

public void doFFBAPI(Joystick joystick)
        {
            var allEffects = joystick.GetEffects( EffectType.All );

            foreach (var ei in allEffects)
            {
                if (Convert.ToString((int)ei.Type & 7, 2) == "101")
                {
                    EffectParameters ep = new EffectParameters();
                    int xAxisOffset = 0, yAxisOffset = 0;
                    int nextOffset = 0;
                    foreach (DeviceObjectInstance d in joystick.GetObjects())
                    {
                        if (d.ObjectType.Equals(DeviceObjectTypeFlags.ForceFeedbackActuator))
                        {
                            if (nextOffset == 0)
                                xAxisOffset = d.Offset;
                            else
                                yAxisOffset = d.Offset;
                            nextOffset++;
                        }
                    }

                    int[] offsets = new int[2];
                    offsets[0] = xAxisOffset;
                    offsets[1] = yAxisOffset;
                    int[] coords = { 0, 0 };

                    ep.Flags = EffectFlags.Cartesian | EffectFlags.ObjectOffsets;
                    ep.Directions= new int[1]{0};//MaxValue
                    ep.Gain = 10000;
                    ep.Duration = int.MaxValue;
                    ep.SetAxes(offsets, coords);
                    ep.SamplePeriod = joystick.Capabilities.ForceFeedbackSamplePeriod;
                    ep.TriggerButton = -1;
                    ep.TriggerRepeatInterval = int.MaxValue;
                    ep.Envelope = new Envelope();
                    ep.Axes = new int[1] { 0 };
                    ep.StartDelay = 0;
                    CustomForce CF = new CustomForce();
                    CF.ChannelCount = 2;
                    CF.SampleCount = 12;
                    CF.SamplePeriod = 1000;
                    int[]  forces;
                    forces = new int[24];
                    forces[0] = 79;
                    forces[1] = 0;
                    forces[2] = 0;
                    forces[3] = 0;
                    forces[4] = 0;
                    forces[5] = 0;
                    forces[6] = 0;
                    forces[7] = 0;
                    forces[8] = 0;
                    forces[9] = 0;
                    forces[10] = 0;
                    forces[11] = 0;
                    forces[12] = 0;
                    forces[13] = 0;
                    forces[14] = 0;
                    forces[15] = 0;
                    forces[16] = 0;
                    forces[17] = 0;
                    forces[18] = 0;
                    forces[19] = 0;
                    forces[20] = 0;
                    forces[21] = 0;
                    forces[22] = 0;
                    forces[23] = 0;
                    CF.ForceData = forces;
                    ep.Parameters = CF;

                    Effect e = new Effect(joystick, ei.Guid, ep);//<-- trows the DX error.
                    effect = e;
                    e.Start();
                }
            }
        }

Here is the error

An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll

Additional information: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

I marked the section of code where the error occurs. I recall doing some debugging in IE once where I could attach a processes, can that be done with some DX dll of sorts? There must be a way to get more detailed info here. I tried contacting sharpDX but they don't seem to frequent the forums much.

sentences:
How can I extract a list of Minecraft items and recipes? I'm designing a robust system for resolving item dependencies in Minecraft and to do so, I need to maintain a database of items and recipes.  Right now, this database has to be hand-crafted (no pun intended); I would like to know if it is possible to somehow query the Minecraft jars (or perhaps more realistically, grep through them) to extract this data automatically.

How can this be done?  The project is currently in Python, but it can still be ported to Java without much fuss at this stage.  (For the curious.)

sentences: Generating random Pools or lakes I have implemented functions that can draw any polygonal shape, however I have been unable to generate a smooth shape that mimics the rounded edges of a lake. I tried generating two circles and joining the edges but there is not enough variation or smoothness to it. Does  anyone have any pointers or ideas that could generate a shape like this?

sentences:
OpenGL 3.0+ framebuffer to texture/images I need a way to capture what is rendered on screen, i have read about glReadPixels but it looks really slow.

Can you suggest a more efficient or just an alternative way for just copying what is rendered by OpenGL 3.0+ to the local RAM and in general to output this in a image or in a data stream?

How i can achieve the same goal with OpenGL ES 2.0 ?

EDIT:

i just forgot: with this OpenGL functions how i can be sure that

I'm actually reading a complete frame, meaning that there is no overlapping between 2 frames or any nasty side effect
I'm actually reading the frame that comes right next to the previous one so i do not lose frames

sentences:
Problems when randomizing x and y position of a picturebox So, I'm making a simple game. It's like snake but the picturebox doesn't grow. In the game, you have to get fruits and other objects.
Look at berry's code:

public class Berry : PictureBox
{
    public bool ON_SCREEN;
    public Berry()
    {
        this.BackColor = Color.White;
        this.Size = new Size(20, 20);
    }
}

And then I randomize it on a form. Like this:

public void Generator_Berry()
    {
        Berry b = new Berry();
        Random randomY = new Random();
        int rY = randomY.Next(10, 270);
        Random randomX = new Random();
        int rX = randomX.Next(10, 270);
        this.Controls.Add(b);
        b.BringToFront();
        b.Location = new Point(rX, rY);
        b.ON_SCREEN = true;
    }

So the problem is that Berry's X position is the same as Y or vice-versa. I've never got a problem like this.(It look very simple, but I can't get the solution) What is wrong?!
Am I that very stupid?!

sentences:
How can I outline text in Unity? Since it generates more triangles and vertices, the official outline script isn't a good way to do text outlining in my project.

How can I outline my text, with better performance?

TextMesh Pro may be the solution, but it'll increase the usage of memory heavily and our game is aimed at mobile platforms, so we want to minimise use of memory.

sentences:
Spline type to achieve a specific result Is there a type of spline which can produce (approximately) the following result given the specified points indicated. I want to be able to specify how curved the corners are from the "centre points" so that I get "very square" corners to "very round" corners. Sorry about my shakey hand ! Points along a line should produce (roughly) a linear curve.

I found quite a few questions and answers online about this but they all seem to be B-spline related, and don't (I think) quite capture my constraints. If anybody knows what I'm looking for, direction to an online reference/article would be great.

My points always appear on an integer lattice (grid), and are always equally spaced.

I'm looking for something low complexity, but which I can pass a value, say t in [0,1] and returns the (x,y) position of the curve at that time. I realise I could probably build a function like this piece-wise, but wondered if there is a ready made spline solution (piece-wise equation) which could achieve the same result.

Maybe B-splines or NURBS are the answer, but maybe they are heavy on computation too...

Given Sirisian's answer below, I suddenly realised how Bezier curves work. Wow they really are a clever idea!

Everything seems centred around a single t value, e.g.

l1(t) = a+t(b-a)
l2(t) = b+t(c-b))
m(t)  = l1(t)+t(l2(t)-l1(t))

We can expand m to simplify if necessary.

I think B-Splines give a nice result, e.g. see below. It also has the advantage of not being restricted to a uniform grid. Not sure about speed of computation yet though...

sentences:
C# multi-player socket server (need clarification/suggestions) I've been working on an 2D-RPG for a while and I recently decided to make it into an MMO (not really massive, but multi-player). Anyways, I'm attempting to write a game server in C#. Yes, I know I could use a commercial solution like SmartFoxServer or Photon, but I want to make it a learning curve by going through the pain of doing it myself. It's pretty much going to be a simple zone-room architecture that handles events and sends position updates a few times in a second.

A lot of articles I read recommended using UDP but I'm limited to TCP because my client will be a browser based flash file. I've pretty much worked out in my head how I want everything to work, the binary protocol and etc, but I'm stuck at the beginning.

I'm not quite sure how to start. I've read about 3 different types of socket communication in C#:

Blocking - I know I can't use this because the main thread will be blocked when accepting connections and etc.
Non-Blocking
Asynchronous

I don't know which is the better, or the obvious choice for what I'm trying to do. I want the server to be scalable and handle a few hundred concurrent connections. I tried to study SFS and it seemed like it had multiple thread pools, for accepting connections, receiving data and sending data respectively. I had it in my mind that I would do it the same way and use the ThreadPool class, but I'm not sure of the difference between non-blocking and asynchronous.

Can someone clarify to me the difference between the two and which one is the better choice for me. I would appreciate any link you think might help as well.

sentences:
Why is everything lit by default? I am following the unity tutorial here and when i drag my environment into the Hierarchy everything i already lit up on my Game view, i noticed this was also the case in the Space Shooter tutorial that i followed before this but i ignored it. Does Unity5 automatically light up things for you if you don't have any lights? I tried setting the ambient Intensity to zero but it literally changes nothing. When i drag in the lighting prefab it also doesn't seem to do much because the scene was already lit up somewhat.

It is still dark but it isn't pitch black like it should be in the Game view.

sentences:
What kind of environment is expected in elevated, hot areas? I'm creating an "exploration" game where the overworld map will be randomly generated.
The biomes are generated using the data given by a "temperature map" , a "humidity map", and an elevation map for instance : cold + humidity = snow, hot + humidity = jungle, etc
The problem I'm left with is how to deal with elevated zones in hot climate. Right now it is set to the "bare" biome (the gray areas in the following pic), which I guess is supposed to mean "deserted dry land". On the other hand, elevated zones with colder temperatures is set to snow (in white), which is ok.
So, how should I deal with the elevated zones in cold climate? I have several ideas but I feel that none of them works:
1) set it to snow as well, but I think it would feel weird
2) set it to "bare" but I don't think it actually exists IRL or that i'd have any interesting gameplay perspectives

sentences:
What's the recommended way of doing a HUD for an android game? Basically the question is in the title.

I'm creating a RTS game and I will need buttons like attack move / attack ground, etc. I am not using any engine.

When people do games in OpenGL for android (my case), do they ever use android components to control the game or do they create their components in the game? What are the general recommended approach, if there's any?
How about more complex components like scrolling lists of items , etc?
I would also appreciate you to pair your answer with a brief comment about how was your experience using the approach(es) you describe.

Thanks :)

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:
How to assign an index to different node clusters? (for pathfinding) Hellow~
So for a bit of context: i'm currently working on a RTS (way above may league) which already has a level editor and a node grid which maps the terrain, i previously make a navigation system with A* as explainned by Sebastian Lague in his tutorial series about the topic, but then i run into a problem when running with multiple units (not the point here: but never manage to find each unit cluster within the selection), so i change it into a navmesh mapping which if made dynamic by assigning navmesh obstacles to the unwalkable nodes (the frame after the creation of the node grid)
Now i want to use the node grid basically to check if the target node and the start node share the same node cluster. But here is the thing: i can't assign the needed index to the nodes as i expected.
I've been trying adapting code from this post, but didn't quite make it.
Now i have this one, which i think could achieve something but still gets me a invalid operation exception:
public const int UNWALKABLE_ISLAND = 999;

public static void SetIslands(ref WorldGrid _worldGrid) {
    int width = _worldGrid.nodeGrid.GetLength(0);
    int height = _worldGrid.nodeGrid.GetLength(1);

    bool[,] visited = new bool[width, height];

    int clusterCount = 0;

    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++)
        {
            if (visited[x, y]) { continue; } else {
                List<Node> cluster = new List<Node>() {
                    _worldGrid.nodeGrid[x, y]
                };

                foreach (var node in cluster) {
                    if (node.isWalkable)
                    {
                        visited[node.X, node.Y] = true;
                        node.SetIslandIndex(clusterCount);
                        cluster.AddRange(_worldGrid.GetNeighbours8D(node));
                    }
                    else
                    {
                        cluster.Remove(node);
                    }
                }

                clusterCount++;
            }
        }
    }
}

The error:

InvalidOperationException: Collection was modified; enumeration operation may not execute.
System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) (at<437ba245d8404787b9fbab9b439ac908>:0)
System.Collections.Generic.List1+Enumerator[T].MoveNextRare() (at<437ba245d8404787b9fbab9b439ac908>:0) System.Collections.Generic.List1+Enumerator[T].MoveNext() (at<437ba245d8404787b9fbab9b439ac908>:0)
Pathfinding.SetIslands (WorldGrid& _worldGrid) (at Assets/Pathfinding.cs: 25)
WorldGrid.CreateNodeGrid() (at Assets/WorldGrid:80)
WorldGrid+d_12.MoveNext() (at Assets/WorldGrid.cs:42)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, Sustem.IntPtr returnValueAddress) (at<437ba245d8404787b9fbab9b439ac908>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

My node class contains an int that should hold the cluster index, which will be using for the request check. (the code its based from this youtube video)
Right now i'm trying to understand the spectral clustering stuff, i've been told it could help.
I hope you can help an animator in need with some pointers.
Cheers :3
*Oh!, I also tried reading the nav agent path end coordinate for comparison, but it ended up becoming a huge mess for me.

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: How do I make a custom tileset for Flixel that supports autotiling? I've been Googling this problem for a while now. I'm currently porting one of my Java games to Flixel, and I want to use the original 16x16 tileset I made. In the original game I implemented my own autotiling system, but I would prefer to use Flixel's autotiling system. However, I cannot determine how to lay out my tileset, or how to tell Flixel to use it. I have two different types of tiles, and I want both types to autotile to connect with tiles of the same type but not tiles of the other type, if possible.

sentences:
Unity Inspector Not Showing Serialized Variables Of Child So I'm new to using Serialaiziblewtfever(I just cannot remember the correct spelling). In the Unity editor it works fine if I have something like:

[System.Seriliabizblewtfever]
Public class BaseClass{
    public ChildClass showvariables;
}
[System.serializable]
Public class ChildClass{
    public float nipz;
}

With that I can see the variables "nipz" in the inspector when I click the drop-down arrow. However, I want ChildClass to be an actual child class so I can manipulate variables inherited from the parent. So if I change it to:

Public class ChildClass:BaseClass

It stops working. It doesn't matter what class the "BaseClass" is. In the inspector it shows me "showvariables", but then has the field like how you can drag objects, transforms, etc, but no drop down list of any variables. Is there something I'm missing?

sentences:
Navmesh bound in ue4 topdown and third person template The Topdown template has a navmesh volume to build walkable area, if remove that volume, the character will be unwalkable. However, the third person template has no such thing, but the character movement is OK.
What's the difference between them? Why third person template don't need a navmesh volume?

sentences:
How to define type-specific scripts when using a 'type object' programming pattern? I am in the process of creating a game engine written in C++, using the C/C++ SQLite interface to achieve a 'type object' pattern. The process is largely similar to what is outlined here (Thank you Bob Nystrom for the great resource!).

I have a generally defined Entity class that when a new object is created, data is taken from a SQLite database and then is pushed back into a pointer vector, which is then iterated through, calling update() for each object. All the ints, floats, strings are loaded in fine, but the script() member of Entity is proving an issue. It's not much fun having a bunch of stationary objects laying around my gameworld.

The only solutions I've come up with so far are:

Create a monolithic EntityScript class with member functions encompassing all game AI and then calling the corresponding script when iterating through the Entity vector. (Not ideal)
Create bindings between C++ and a scripting language.

This would seem to get the job done, but it feels like implementing this (given the potential memory overhead) and learning a new language is overkill for a small team (2-3 people) that know the entirety of the existing game engine.

Can you suggest any possible alternatives? My ideal situation would be that to add content to the game, one would simply add a script file to the appropriate directory and append the SQLite database with all the object data. All that is required is to have a variety of integers and floats passed between both the engine and the script file.

sentences:
Unity - Button still interactable even when interactable is set to false my button can still be pressed in-game even if I set it to button.interactable = false;

What I'm trying to achieve is when the Panel CropsPanel is opened, or active in Unity, I want the EquipmentButton to be disabled and to be not usable by the user. Here is the code I've written:

 public void Start ()
     {
         GetComponent<Button>().interactable = false;
         if (CropsPanel.activeInHierarchy == true)
         {
           EquipmentButton.interactable = false;
         }
     }

I have also set all buttons in the inspector, placed a Debug.Log("msg here"); to see if the particular code is working. But I can't seem to get it working. Am I missing something? Thanks guys!

sentences: custom SetInterval function in javascript i am trying to make an custom set interval function for my game but everytime i tried, i end up with a infinite loop. I can't use the default javascript's set interval because it can not take the random number. any idea?

sentences:
How to place an instance of Editor Window in screen center? I want to create an instance of Editor Window by using CreateInstance or GetWindow. And I want to place it in center of the screen (or center of Unity).

I didn't find any methods in Unity Engine that could help me. Do they exist?

How can I do it within the script?

Note: I mean: how can I find out what is the user's screen resolution? Which method can give me that?

P.S. Screen.width/Screen.height - is not what I need. Because it refers to the Game View's window, not Unity.exe Editor's size and not monitor Screen

sentences:
Export object or scene with textures Is there a way to export or publish some work to a folder so somebody else can open the .max file and does not have to reassign all the textures again?

My problem is that i used lots of textures straight from my texture folder in a completely different folder tree. So when i sent the file to someone else he needs to rebuild this tree exactly the same as i did or reassign every texture.

If there is no option like that do i have to change my workflow, in case others need to work with my files, and keep everything in the same folder? What is normal procedure to keep everything organized and compatible for each user?

sentences:
C++ Game Library for SVG Based Game I'm looking into building a cross-platform opensource 2D RPG style game engine for ChaiScript.

I want to be able to do all of the graphics with SVG and need joystick input. I also need the libraries I use to be opensource and compatible with the BSD license.

I'm familiar with allegro, ClanLib, and SDL. As far as I can tell, none of these libraries have built in or obvious integration for SVG. Also, I'm aware of the previous conversations on this site regarding Qt for SVG game development.

I'm hoping to avoid Qt because of the size and complexity of making it a requirement. Also, Qt does not seem to have joystick input support, which would require that SDL or some other library also be used.

So my question can be summed up as this:

What is the best way to get SVG and joystick support in a 2D C++ library while minimizing dependencies as much as possible (preferably avoiding Qt altogether)?

sentences:
Character stuck on box collider 2.5D I'm having trouble with my character on a 2.5D platformer. The character get stuck if it collides without reaching the platform's top. Here is a gif showing it: http://i.imgur.com/jmZ6O1K.gifv

Both colliders (platform and character) has a physics material with no friction (or minimum). So I don't know why is this happening.

Character Collider

Physic Material

sentences:
Consistency of DirectX models Is there a way to check the consistency of a DirectX model (.x) ?

Whilst compiling .x files with XNA GameStudio 3.1 compilation is aborted with the following error message:

Error  2   Could not read the X file. The file is corrupt or invalid. Error code: D3DXFERR_PARSEERROR. C:\WFP\Browser\Content\m.x  KiviBrowser

Some models compile correctly without any error/warning and some abort as described. The files of each model have several thousand lines.

I am creating the files in Googles SketchUp 8 where they all look fine and don't show any sign of corruption.

Suppose I have such a model my XNA compiler won't compile because their is an inconsistency somewhere in the file - how could I identify this in order to correct it ?

sentences: how should a server handle client actions? So I've just started trying to make a multiplayer pong game and  I have read a lot of different ways to code the connections.  However, I read somewhere that you should have the inputs sent to the server queue up and then the server just processes it at fixed intervals.  However, if this is done, how does the server know, process, and send accurate data based on the time the action was sent?  Because if the data is just queued up, if something happens like 100 ms after another but the server processes them at the same time, wouldn't that mess up the synchronization of the game?  Should the server instead be coded to handle the client actions immediately even if it costs a lot of cpu etc in larger games?

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:
Directx11 batching verticies to draw later I have several draw functions in my renderer to draw primitives e.g.:

Drawing a Quad:

void Renderer::DrawQuad2D(float left, float bottom, float right, float top, const Rgba& color /*= Rgba::WHITE*/, const Vector4& texCoords /*= Vector4::ZW_AXIS*/) noexcept {
    Vector3 v_lb = Vector3(left, bottom, 0.0f);
    Vector3 v_rt = Vector3(right, top, 0.0f);
    Vector3 v_lt = Vector3(left, top, 0.0f);
    Vector3 v_rb = Vector3(right, bottom, 0.0f);
    Vector2 uv_lt = Vector2(texCoords.x, texCoords.y);
    Vector2 uv_lb = Vector2(texCoords.x, texCoords.w);
    Vector2 uv_rt = Vector2(texCoords.z, texCoords.y);
    Vector2 uv_rb = Vector2(texCoords.z, texCoords.w);
    std::vector<Vertex3D> vbo = {
        Vertex3D(v_lb, color, uv_lb)
        ,Vertex3D(v_lt, color, uv_lt)
        ,Vertex3D(v_rt, color, uv_rt)
        ,Vertex3D(v_rb, color, uv_rb)
    };
    std::vector<unsigned int> ibo = {
        0, 1, 2
        , 0, 2, 3
    };
    DrawIndexed(PrimitiveType::Triangles, vbo, ibo);

}

Sending the verts and indexes to the GPU

void Renderer::DrawIndexed(const PrimitiveType& topology, const std::vector<Vertex3D>& vbo, const std::vector<unsigned int>& ibo) noexcept {
    UpdateVbo(vbo);
    UpdateIbo(ibo);
    DrawIndexed(topology, _temp_vbo.get(), _temp_ibo.get(), ibo.size());
}

Setup and call DrawIndex on immediate context.

void Renderer::DrawIndexed(const PrimitiveType& topology, VertexBuffer* vbo, IndexBuffer* ibo, std::size_t index_count, std::size_t startVertex /*= 0*/, std::size_t baseVertexLocation /*= 0*/) noexcept {
    GUARANTEE_OR_DIE(_current_material, "Attempting to call Draw function without a material set!\n");
    D3D11_PRIMITIVE_TOPOLOGY d3d_prim = PrimitiveTypeToD3dTopology(topology);
    _rhi_context->GetDxContext()->IASetPrimitiveTopology(d3d_prim);
    unsigned int stride = sizeof(VertexBuffer::arraybuffer_t);
    unsigned int offsets = 0;
    ID3D11Buffer* dx_vbo_buffer = vbo->GetDxBuffer();
    ID3D11Buffer* dx_ibo_buffer = ibo->GetDxBuffer();
    _rhi_context->GetDxContext()->IASetVertexBuffers(0, 1, &dx_vbo_buffer, &stride, &offsets);
    _rhi_context->GetDxContext()->IASetIndexBuffer(dx_ibo_buffer, DXGI_FORMAT_R32_UINT, offsets);
    _rhi_context->DrawIndexed(index_count, startVertex, baseVertexLocation);
}

The most noticeable problem is each function issues a draw call. Doing this enough per frame (about 100) causes massive lag. How would I implement a batching such that each of these functions, instead of emitting a draw call immediately, collects all the verts/indexes and doesn't draw until the end of the frame?

sentences: Indicate key options in a keyboard-only game I am creating a music-based app for one of the courses I teach at a high school, so it's not for sale in the app store, it's only for my students to use. I decided to make it keyboard only partially because I didn't want to have to create a whole bunch of buttons and then link them to code. What's a good way to indicate on the screen what certain keys do? For example, the escape key will exit the user from the settings menu scene, it is also used to bring up a list of options in-game. Is there a slick way to explain what certain keys do without having some sort of legend on screen in the various scenes? Screens = scenes (I'm using SpriteKit for OS X). Remember, using the mouse is not at all an option.

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:
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 to get the Javascript equivalent of GameMaker's `hspeed` and `vspeed` given only `direction` and `speed`? I'm using a NodeJS server to control NPC movement in a multiplayer game, and when they get too close to the edge of the room I need to reverse either the horizontal or vertical components of their velocities (how to decide which, is a bridge I'll cross when I get there).

The problem is I already have their direction and speed, and am able to convert it to hspeed and vspeed, but not back again.

I need the inverse of this function:

function velocityToSpeeds(direction, speed) {
  return {
    x: -speed*Math.sin(Math.toRad(direction - 90)),
    y: -speed*Math.cos(Math.toRad(direction - 90))
  };
}

sentences:
How can I create a lighting effect like this? This is the most beautiful 2d lighting I have ever seen, and I'd like to perform lighting like this too. How do I do it?

I don't care about the physics or how the particles are simulated - I only want to know about the lighting.

Here are some videos for reference:

http://www.youtube.com/watch?v=BIQRhOFkvQY
http://www.youtube.com/watch?v=tnTYXPuecMs
http://www.youtube.com/watch?v=rhC_jVM8IYU
http://www.youtube.com/watch?v=_Aw5BdjWqqU

Or you could download Polluted Planet 2 here.

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:
Export Blender 2.59 models with animations to XNA 4 Whats the best way to export from Blender 2.59 for XNA 4? I have heard you can use the DirectX to export to .x instead of .fbx which works better with animations?

Unfortunately all the tutorials out there are a bit dated and go on about the quirks with older versions..

sentences:
How do I export an XNA crossplateform project to Nintendo 3ds or Nintendo Switch? I would like to document my self a bit about 3ds and switch game creation. I know that modern game engine have builtin tools to export games to these platforms, but I could not find - in google research - an article or a website talking about this. Any time I searched "Xna Export to nintendo 3ds" I ended up with "getting 3ds max files into an XNA game" stuff.
I'll be highly grateful to anyone that could help me find a way to export my games to these,

sentences:
How hard is it to build for other platforms using the Unreal Engine 3? Quick question to those that have used the Unreal 3 Engine for development. (Not the UDK).

How much work would it take to take a game made on/for Windows and output a working build on another platform?

Is it as simple as "File -> Export -> PS3" (or similar) or is there much programming involved?

sentences: Python interpreter as in-game console Say I have a game which has lots objects (NPCs, monsters, etc.), I want a console so I can change the variables of the objects (like changing HP for example), how could I embed python into my program, so that I can change these variables and classes with a few keystrokes in the console? An example of a command would be: /monster 1 1 HP 100 (monster is the object name, 1 1 is the coordinates, and HP 100 is the variable to change, and to what amount)

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:
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:
Should my terrain be one big mesh or several medium ones? While creating a subterranean level with probuilder (irregularly shaped rooms and corridors), I was wondering if I should merge all "terrain" meshes into one or keep them as separate meshes? What are the good practices ?

I'm creating each room as I go and its not hard to create openings and align doors vertices (with progrids) but once I start moving them around (like with polybrush) I'm sure it will soon be a nightmare. I can see pros and cons for both. Separate meshes would be easier to edit, duplicate or replace, probably better performances but at the risk of overlaps or holes because it would get hard to keep connected cleanly. I guess with one mesh you take the risk of having it eat memory and computation time, or having it too big to edit easily.

I settled on each mesh consisting of a room and all half-corridors going out of it, to hide the stitching and keep it simple. Still I wonder if there's a consensus.

sentences: Is it better to create a scene in blender or in unity? First of all, I am really new to all of this. This is my first time so its really confusing me if it's better to create a scene and then import it into Unity or is it better to just create objects like chracters, chairs in blender and scenes in Unity? I just want to recreate a scene of my school and include it in my final project as a Unity game where it will have no function other than walking around and some jumping and fighting? Because my project is not based on the game, it will just help it.

sentences: Using Steering Wheel in Unity Is there any way to use a steering wheel in Unity? All I find online is people with the same problem. The numbering on the axis are not the same as with keyboard input. In some cases left is 1 and as you turn it more to the left it gradually goes down to 0 even though you are still turning left

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:
GLSL Shader compiles, but source is empty I'm trying to compile a GLSL shader, to which I use the following code.

Initialization

SDL_Window* boringInitStuff(){
    SDL_Init(SDL_INIT_VIDEO);
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );

    Uint32 windowFlags = SDL_WINDOW_OPENGL;
    SDL_Window* sdlWindow = SDL_CreateWindow("Boooring", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 400, 400, windowFlags);

    SDL_GL_CreateContext(sdlWindow);

    glewExperimental = GL_TRUE;
    glewInit();

    return sdlWindow;
}

File parser

void readFile(std::string path, std::string& data){
    std::ifstream f(path.c_str(), std::ios::binary);
    data.assign((std::istreambuf_iterator<char>(f)),
                (std::istreambuf_iterator<char>()));
}

Main

int main(int argv, char** args) {
    SDL_Window* sdlWindow = boringInitStuff();

    std::string buffer;
    readFile("./compile_test.vert", buffer);
    const char* cBuffer = buffer.c_str();

    GLuint shaderID = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(shaderID, 1, &cBuffer, nullptr);
    glCompileShader(shaderID);

    while(!SDL_QuitRequested()){
        SDL_GL_SwapWindow(sdlWindow);
    }

    return 0;
}

But when I try to inspect the source code in gDEBugger, the source code is gone. Linking of course doesn't work aswell. The weird thing is, that the compilation error checking works.
EDIT: When I copy & paste the main part into another opengl project, it works.

sentences:
Change parent object on instantiation I'm making a game in which I have different weapons. One of them is a hand grenade. Well, the question is:

I made an animation with mecanim (I don't know if is the correct way) with the grenade being is a child of the main character. Then, the animation is correct (the grenade goes to high scale and I have the false sensation that is going up, to the camera).

The problem is that this grenade is attached to the character, and when I move the character, the grenade moves with him. I need the grenade to not be linked to the character when it's launched. And when I instantiate a new grenade, I need this animation playing.

I don't know if I explained the situation well, but this is the idea, an animated grenade launching when the player press the shoot button... what is the best way to do this?

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:
Loading resources in a portable manner I've been looking at ways to load data into a game.  I even asked a question on stack overflow about reading binary data in a portable manner .  The gist of the answer seemed to be that you can use the int types header file to specify an particular integer byte amount, but there's nothing really useful for floats, etc.

I then thought that you could use fixed point, rather than floating point, but I wanted to see how other games did it.  Here is one example, a md2 loader: http://tfc.duke.free.fr/old/models/md2.htm .  However, it seemed to assume that the size of various types would just work, and that they would be the same on the platform that made the md2, and the one that read it.  This seemed to be fairly common in the code that I've seen so far.

So is it really common to just ignore possible different size issues, or have I just been looking at bad (or old) samples?  If it's not, could you also demonstrate a better way to do it, or at least link to one?

Thank you.

sentences:
When scene loaded up, Position player at a start point. (Unity2D) If pointName and player.startPoint are true, shown by the inspector, why doesn't the player's position go to the start point with a pointName of "ToNeighborhood". Note: The code runs if pointName == player.startPoint. It isn't running even when they both contain the same string shown by the inspector

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

public class PlayerStartPoint : MonoBehaviour {

    private PlayerController player;
    private CameraController theCamera;

    public string pointName;

    // Use this for initialization
    void Start () {
        player = FindObjectOfType<PlayerController>();
        theCamera = FindObjectOfType<CameraController>();
        if (pointName == player.startPoint)
        {
            Debug.Log("Changing");
            player.transform.position = gameObject.transform.position;
            theCamera.transform.position = new Vector3(transform.position.x, transform.position.y, theCamera.transform.position.z);
        }

     }

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

    }
}

sentences:
CCsprite.flipX not working! Here is my function, it makes random point on the ground and makes my sprite go there. If the x position of location is less then position of my sprite, I flip my sprite so it looked left (it looks right by default). But this is not working at all. I tried different flip methods but none work!
Please help what is wrong?

- (void) wander
{
    CGPoint rand = CGPointMake(CCRANDOM_0_1() * 270 , CCRANDOM_0_1() * 140 );

    float distance = ccpDistance([currentSprite position], rand);
    float speed = distance / 2;
    ccTime time = distance / speed;
    CCAction *move = [CCMoveTo actionWithDuration:time position:rand];

    if (currentSprite.position.x > rand.x)
    {

       currentSprite.flipX = YES;
    }
    else {
        currentSprite.flipX = NO;
    }

    [self runAction:move];
}

There is no problem with this code. Problem was that I was trying to flip sprite that was a child of my Pet object. When I tried flipping sprite everything worked just fine. If anybody could explain that, would be great.

sentences:
An efficient way for generating smooth circle I'm looking for creating smooth circle. OpenGL supports point, line, and triangle. To create other primitives like circle, we utilize the preceding shapes. In my case, I've utilized points as follows:

float radius(0.5f);
for ( float angle(0); angle < glm::radians(360.0f); angle += glm::radians(0.5f) ){
    Vertex vertices[] = { Vertex(glm::vec3( radius*cos(angle), radius*sin(angle), 0)) };
    meshes.push_back(   new Mesh(vertices, sizeof(vertices)/sizeof(vertices[0]), 'P')   );
}

In rendering loop,

while( Window.isOpen() ){
    Window.PollEvents();
    Window.clear();
    //================( Rendering )=========================
    Shader.Use();

    for ( int i(0); i < meshes.size(); ++i )
        meshes[i]->draw();

    //======================================================
    Window.SwapBuffers();
}

The result is

Now to create smooth circle, basically I just increase the number of points. I don't like this approach since I need to create a lot of points for single shape. My question is is there an alternative yet efficient approach for this issue?

sentences:
How should I store edge weights for my A* graph? I am working on A* pathfinding in Unity, using C#. I am implementing Dijkstra's shortest path algorithm. I have a Dictionary with nodes as keys and corresponding lists of adjacent neighbors as values, which I use for A*.

My pathfinding graph is a 2D grid of nodes, with 4 connected edges each. I want to give edges representing unobstructed paths a cost of 1, and increase it for obstacles.

Where should I store each edge's weight?

Currently I'm representing my grid of nodes as plain gameobjects in a 2D array. I thought of storing the weights in a dictionary with node-pairs as keys and weights as values. Would that work, and be efficient enough?

sentences:
Behaviour of containers in Phaser 3 framework I don't understand the behaviour of containers in this example:

Phaser example

The part I don't unerstand is line 41. Why is lastContainer assigned to newContainer? In line 40, newContainer is added as a child of lastContainer; my intuition would be that the effect of line 40 is so that the rotations can be performed on lastContainer (or, rather, on containerTails, which seems to contain four nested container structures, one for each arm), and propagated to its children.

It makes no sense to me that the variable containing the parent container should be assigned to its own child; how does that not overwrite the nested structure of containers, effectively removing the parent container from the picture?

sentences:
Level Design, Implying a path to the player I am looking for articles on level design and particularly for techniques to imply a direction the player to go in, instead of another.

Like which game mechanics can be used, how graphics, sound, etc. can influence the player to go where you want.

For example in Donkey Kong Country bananas were used to show other paths or hidden areas, in Alan Wake, there were orange markers to show weapons caches.

If anyone has ideas, I'd be grateful to hear them too!

Edit:
For anyone that is interested, I found a huge resource with thesis on this question, and others related to Level Design; happy reading!

http://guildhall.smu.edu/Level-Design.226.0.html

sentences:
Animation impulse system? I'm working on an animation system for an RTS game. Each unit has several animation states: Move, Idle, Engaging, etc.. Units also have a variety of "Animation Impulses" which are animations that get played on top of the animation state. They're for things like shooting or casting a spell. When the impulse finishes, the unit returns to its current animation state.

Using Unity Mecanim Animators, how can I make a system like this? Is there a way to PlayOneShot an impulse animation that reverts back to a base animation when the impulse finishes?

I.e. a unit is in the state of pointing his gun at the target. The unit fires its gun and acts out the recoil. After the recoil animation finishes, the unit returns to pointing its gun at the target.

sentences:
Networking to make a single player RPG into multiplayer I’ve written a few games in Xcode before and would like to turn one into the simplest possible 2D top-down RPG multiplayer game. Essentially just needing movements around a big tiled map (I love drawing), and chat.
Keen to just host my own server on the iMac I use, with python and twisted framework (new to this but happy to take the time to learn). I’m thinking TCP for chat and UDP for tracking movements but do they need to be on separate servers?
Also for games like this I know there isn’t much on the client side. All my map drawing and game logic is set up in Xcode, which I would prefer to keep working in because I’m familiar with the language and love the sprite kits and tile maps. Do I have to redo it all in python on the server side for scaling in the future? Or for cross platform?
I've done lots of research and found plenty of tutorials, just want to know I’m on the right track. I’m not looking to make a WoW killer just something simple I can gradually build on for fun

sentences:
Why / how does XNA's right-handed coordinate system effect anything if you can specify near/far Z values? I am told repeatedly that XNA Game Studio uses a right-handed coordinate system, and I understand the difference between a right-handed and left-handed coordinate system.  But given that you can use a method like Matrix.CreateOrthographicOffCenter to create your own custom projection matrix, specifying the left, right, top, bottom, zNear and zFar values, when does XNA's coordinate system come into play?

For example, I'm told that in a right-handed coordinate system, increasingly negative Z values go "into" the screen.  But I can easily create my projection matrix like this:

Matrix.CreateOrthographicOffCenter(left, right, bottom, top, 0.1f, 10000f);

I've now specified a lower value for the near Z than the far Z, which, as I understand it, means that positive Z now goes into the screen.  I can similarly tweak the values of left/right/top/bottom to achieve similar results.

If specifying a lower zNear than zFar value doesn't affect the Z direction of the coordinate system, what does it do?  And when is the right-handed coordinate system enforced?

The reason I ask is that I'm trying to implement a 2.5D camera that supports zooming and rotation, and I've spent two full days encountering one unexpected result after another.

sentences:
Suggestions on how to achieve circular "hole" in environment I'm working on a 2D Sidescroller and I'm wanting to achieve a object that when activated it creates a port-hole to the sprites underneath, giving the appearance of the object "cleansing" the area.

Edited image showing the desired effect

At this point I have no idea how to achieve this and am after suggestions, thanks!

sentences:
How can I make Diagonal movement? This is a follow-up question to my last one. I am developing a game which has an Icon on a JLabelwhich the user controls with WASD keys. Right now it can go up, down, left, and right, but I want to know how I can make it move diagonally if two keys are held. I have recreated a short example and posted it below along with a gif(sorry, it's not very smooth), and I am hoping you can help me out. Thanks!
public class Experiments extends JFrame {
    javax.swing.Timer movement;
    int x = 230;
    int y = 120;
    boolean wPressed, aPressed, sPressed, dPressed;

    public Experiments() {
        layoutGame();
        setTitle("Example");
        setSize(500, 350);
        setLocationRelativeTo(null);
        setVisible(true);
    }

    private void layoutGame() {
        JLabel bg = new JLabel();
        bg.setIcon(new ImageIcon(this.getClass().getClassLoader().getResource("space.png")));
        add(bg, BorderLayout.CENTER);

        JLabel you = new JLabel();
        you.setBounds(x, y, 50, 50);
        you.setIcon(new ImageIcon(this.getClass().getClassLoader().getResource("happy.png")));
        bg.add(you, JLabel.CENTER);

        JTextPane direction = new JTextPane();
        direction.setText("Direction");
        add(direction, BorderLayout.SOUTH);
        move(you);

        direction.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                movement.stop();
                if(e.getKeyChar() == 'w') {
                    wPressed = true;
                    move(you);
                } else if (e.getKeyChar() == 'a') {
                    aPressed = true;
                    move(you);
                } else if (e.getKeyChar() == 's') {
                    sPressed = true;
                    move(you);
                } else if (e.getKeyChar() == 'd') {
                    dPressed = true;
                    move(you);
                }
                direction.setText(null);
            }
            public void keyReleased(KeyEvent e) {
                wPressed = false;
                aPressed = false;
                sPressed = false;
                dPressed = false;
            }
        });
    }

    private void move(JLabel icon) {
        int delay = 10; //milliseconds
        ActionListener taskPerformer = new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                if(icon.getX() >= 0 && icon.getX() <= 450 && icon.getY() >= 0 && icon.getY() <= 250) {
                    if (wPressed) {
                        y = y - 4;
                    } else if(aPressed) {
                        x = x - 4;
                    } else if(sPressed) {
                        y = y + 4;
                    } else if(dPressed) {
                        x = x + 4;
                    }
                    icon.setBounds(x, y, 50, 50);
                    icon.repaint();
                }
            }
        };
        movement = new javax.swing.Timer(delay, taskPerformer);
        movement.start();
    }

    public static void main(String[] args) {
        new Experiments();
    }
}

The output is smooth, but I had to make a gif, so it looks bumpy(sorry again):

sentences:
Game AI move towards player while avoiding an obstacle I'm trying to move enemy towards player, while enemy also tries to avoid an obstacle if it's in its path. Here's a simple illustration of what I want to do:

What I've tried:

Making circular collision around the obstacle. It works but that
makes the enemy impossible to hit.
I think going with an A* pathfinding algorithm might be a bit overkill
especially since it's designed for multiple obstacles, where in my
case there is only the mouse and wall collision concerned.
Moving the enemy towards the player, while also moving away from the
obstacle at a slower speed. This works better because you can
actually hit the enemy, but also slows down enemy if obstacle if it's
in its path.

My questions:

Is there a better way to go about doing this?
Anything you would've done differently with my code to either improve or optimize?

Here's the code I have currently in my game logic and a fully-working example on jsFiddle.

// Calculate vector between player and target
var toPlayerX = playerPosX - enemyPosX;
var toPlayerY = playerPosY - enemyPosY;

// Calculate vector between mouse and target
var toMouseX = mousePosX - enemyPosX;
var toMouseY = mousePosY - enemyPosY;

// Calculate distance between player and enemy, mouse and enemy
var toPlayerLength = Math.sqrt(toPlayerX * toPlayerX + toPlayerY * toPlayerY);
var toMouseLength = Math.sqrt(toMouseX * toMouseX + toMouseY * toMouseY);

// Normalize vector player
toPlayerX = toPlayerX / toPlayerLength;
toPlayerY = toPlayerY / toPlayerLength;

// Normalize vector mouse
toMouseX = toMouseX / toMouseLength;
toMouseY = toMouseY / toMouseLength;

// Move enemy torwards player
enemyPosX += toPlayerX * speed;
enemyPosY += toPlayerY * speed;

// Move enemy away from obstacle (a bit slower than towards player)
enemyPosX -= toMouseX * (speed * 0.4);
enemyPosY -= toMouseY * (speed * 0.4);

sentences:
Is it bad practise to have an object for every tile? In the game I am working on, many of my tiles must have special attributes (such as triggers when the player steps on them). I was wondering if it would be bad practise to create an object for every tile, so that I can do map.getTile(5, 3).setWalkable(true); (psuedocode).

The only alternative I can think of to this would be to create one instance of every tile, then just look at the properties of that type of tile, which might be okay.

Is it okay to have an object per tile?

I am using C++ with SFML, but I doubt that matters.
I know there is a similar existing question, but it doesn't answer how to manage the tiles if they do unique things.

sentences:
Error rendering map android I'm trying to read this text file and render the corresponding tiles on the screen.

The code for reading the map is as follows:

private void loadMap(InputStream is) throws IOException {
    ArrayList<String> lines = new ArrayList<String>();
    int width = 0;
    int height = 0;

    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
    while (true) {
        String line = reader.readLine();
        if (line == null) {
            reader.close();
            break;
        }

        if (!line.startsWith("!")) {
            lines.add(line);
            width = Math.max(width, line.length());
        }
    }
    height = lines.size();

    for (int j=0; j < 18; j++) {
        String line = (String) lines.get(j);
        for (int i=0; i < width; i++) {

            if (i < line.length()) {
                char ch = line.charAt(i);
                Tile t = new Tile(i, j, Character.getNumericValue(ch));
                tiles.add(t);
            }
        }
    }

}

The first problem I have is with Character.getNumericValue(ch) as this does not seem to be doing anything, resulting in a NullPointerException. When I remove it and replace it with either a 1 or a 2 I'm able to render the tiles onto the screen but somehow the spaces in between the digits are interpreted as tiles, resulting in a continuous block of tiles eg in the second line with 1s results in tiles beginning from the left margin up until the last 1. How can I fix this?

sentences:
Which algorithm for controlling cars on a race track? I think A* is a good place to start, but since cars cannot move in all directions (they move like cars do, trying to move forward and steer), I was wondering if someone could point me at other approaches they've used.

Also, I was wondering about the "Racing Line". Should one just precompute the optimal paths, and then use the A* to select the path that isn't blocked by other cars ?

EDIT: My question is different from Driver AI in racing game because that question is about approaches.

I am interested in learning about specific tried and trusted algorithms like A*.

sentences:
How to rotate a sprite using multi-touch with AndEngine? I am new to Android game development. I am using AndEngine GLES-2. I have created a box with a sprite. This box is now draggable by using the code below. It works fine.

But I want multi-touch on this: I want to rotate the sprite with two fingers on that box, and to keep it draggable.

I've no idea how do do that, which way should I go?

final float centerX = (CAMERA_WIDTH - this.mBox.getWidth()) / 2;
final float centerY = (CAMERA_HEIGHT - this.mBox.getHeight()) / 2;

Box = new Sprite(centerX, centerY, this.mBox, this.getVertexBufferObjectManager()) {

    public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {

        this.setPosition(pSceneTouchEvent.getX() - this.getWidth()/ 2, pSceneTouchEvent.getY() - this.getHeight() / 2);

        float pValueX = pSceneTouchEvent.getX();
        float pValueY = CAMERA_HEIGHT-pSceneTouchEvent.getY();

        float  dx = pValueX -  gun.getX();
        float  dy = pValueY -  gun.getY();

        double  Radius = Math.atan2(dy,dx);
        double Angle = Radius * 360 ;

        Box.setRotation((float)Math.toDegrees(Angle));
        return true;
    }

sentences:
How do I fix this access violation when I exit my custom OpenGL game engine? I'm writing an game engine, where the engine is written in a project and exports a .dll file. In another project, in the same solution as the engine, there is a sandbox project which uses the engine. However, there is a bug.

I run the sandbox project in debug mode with the engine dll. When I spam my mouse and keyboard for a few seconds, and close the program via the exit button, the program crashes with an error:

  Exception thrown at 0x00000043 in phantom-sandbox.exe: 0xC0000005: Access violation executing location 0x00000043.If there is a handler for this exception, the program may be safely continued.

I found the source of the bug. Since I'm currently writing the engine for OpenGL, I have to initialize GLEW, and I need to create a HGLRC. If I don't initialize this HGLRC, everything works.

This is not the ideal solution, since I need to use OpenGL for my engine. I went forth without exporting the .dll from the engine, making the engine an application, instead. I made a main.cpp, and wrote it to use the engine, enabling OpenGL rendering. I tried to recreate the bug, but everything works!

I thought it might OpenGL, but then now I'm thinking it might be my engine. How do I fix this?

Here is my code, where it errors:

    int const main_result = invoke_main()

    __telemetry_main_return_trigger(nullptr);

    if(!__scrt_is_managed_app())
        exit(main_result)l

    if(!has_actor) // < this is the line being sent to the call stack
        _cexit();

    __scrt_unititialize_crt(true, false);
    return main_result;
}

__except (_seh_filter_exe(GetExceptionCode(), GetExceptionInformation()))
{
    int const main_result = GetExceptionCode();

    if(!__scrt_is_managed_app())
        _exit(main_result);

Here is the call stack:

sentences:
How to move dashes towards target? Would you know how to create a dash line that moves towards the direction of the target, and if it collides with a wall, goes to the opposite angle? I have seen atan2 but I am not sure what it does, and I am quite confused about the movement of the dashed line. A point can be found with cos() and sin() depending on a radius... should I change the radius to place each dash? Then how to move them with the same speed?

Example here :

Any advice would be much appreciated.

Thanks

sentences:
Questions to answer and heuristics to use when selecting a new project? Say I have a list of (in my case, indie) game ideas, from which I need to select a new project to work on.

What are the questions/heuristics that you would use - and ideally have already used successfully in the past - to narrow down such a list to a single idea to work on?

sentences:
Creating SurfaceView cause short screen blink When I create SurfaceView for first time since app launch, the app screen blinks black for small time (about 1/4 second). It blinks over UI, so its really visible and doesn't look nice at all.
I've tried to comment all of my code in surfaceCreated, but effect is same, so problem is not here. How do I remove or "hide" this screen blink?
In activity:
RelativeLayout layout = (RelativeLayout) findViewById(R.id.relative);
layout.addView(new Surface(getApplicationContext())); // causes short screen black blink

Surfaceview class:
public class Surface extends SurfaceView implements SurfaceHolder.Callback
{
        public Surface(Context context)
        {
            super(context);

            getHolder().addCallback(this);
            this.setZOrderOnTop(true);
            getHolder().setFormat(PixelFormat.TRANSPARENT);
            setFocusable(true);
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
        {
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder)
        {
        }

        @Override
        public void surfaceCreated(SurfaceHolder holder)
        {
              ... stuff
        }
}

sentences: Is it possible to convert vec4 to int in GLSL (using OpenGL ES) I need GPU to do some computations, and I pass shader an int array using glTexImage2D (internal format is GL_RGBA).  I use texture() to get the data, but it returns a vec4 value.  Is it possible to convert vec4 to int in GLSL?

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 does "internet connection required" protect from piracy on mobile phones? Sometimes I can't play a paid Android platform game because it requires an internet connection, and I'm in a place where 3G doesn't work.

Here is my understanding so far:

The game is a "good old platformer" which wouldn't normally require any network (no online features for the main solo story)
Because the publisher can't control the hardware (Android, iOS), they achieve anti-piracy by requiring an internet connection when launching the game and before each level.

My question is: how can they achieve to "obfuscate" the app enough to decrease the likelihood of piracy, where thousands of players would play the full game without purchasing? Is it extremely difficult for a hacker to record the successive states (memory snapshots) of the game when playing the full version, and recombine them in a pirate app that would skip the network traffic?

I understand that the anti-piracy internet requirement is part of a legit business model, and I'm still scratching my head about how this can be implemented and enforced in practice, and how I could do the same "from scratch".

sentences:
Why can a certain DirectX mode produce display lag? I have written two small test games using DirectX 9. One uses

presentParams.Windowed = false;

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;

and the other one uses

presentParams.Windowed = false; // same results with true

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

Both use exactly the same window position, size and style. Both are written to cover the screen completely, even when using "Windowed = true".

In the latter game, to vsync and avoid tearing, my code waits until a certain scan line is passed. My tests showed: On different PCs it has to wait for different scan lines to avoid tearing completely. This is a drawback, since it has to be tweaked individually by the user. Is this technique used in any games?

And, compared to this technique, why does DirectX produce a display lag when "Windowed = false" is used with D3DPRESENT_INTERVAL_ONE?

To clarify where the lag occurs:

Windowed = false + INTERVAL_ONE => LAG

Windowed = false + ...IMMEDIATE    => no lag

Not mentioned in the question but tested:

Windowed = true;  + INTERVAL_ONE  => no lag, tearing

Windowed = true; + ...IMMEDIATE     => no lag

sentences:
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:
Creating Entities from Identifiers (C#) I am writing a game in C#/XNA. Often, it's useful to have a function like this in a game engine:

   Entity CreateEntity(string id, Vector3 location)
   {
       ...
   }

So that, for instance, you can do something like this:

   List<string> entitiesToSpawn = { "Tree", "Bird", "Flower", ... }

   foreach (string entity in entitiesToSpawn)
   {
       CreateEntitiy(entity, location);
   }

Or else you can easily store the ids in data files, or populate generic GUI elements with them, for instance. What, in your opinion, is the best way to implement CreateEntity in such a way that is scalable and preserves this kind of interface? Right now, I have a gigantic static switch statement, which is obviously not sustainable. Perhaps I can create a big static map of strings to functions? Or is there an easier way to get this kind of functionality out of my engine?

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:
How can I launch the Unity Editor and open a specific project from C# code? I created a very simple console application:

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            // The project I want to open
            var arg = @"""-projectPath C:\Users\Administrator\Downloads\New Unity Project""";

            // Start Unity and open the project
            Process.Start(@"C:\Program Files\Unity\Editor\Unity.exe", arg);
        }
    }
}

But only the Unity Editor is launched; the specified project is not opened.

What do I need to modify to launch the project?

sentences:
Should I always prefer a Uniform Buffer Object to a uniform variable for per-model uniforms in OpenGL? I was looking for a way to update uniforms for all of my scene objects efficiently and I came across the following gamedev stackexchange question, where the top answer gives a bonus tip. It states:

  So long as all your shaders agree on the layout and binding point of each such buffer then updating becomes a breeze. Models have no need to know anything about shaders at all. They need only update the model-view matrix in their constant buffer and the rendering pipeline will use it automatically

emphasis mine.

On the face of it, this seems like a preferable option; I don't have to worry about the uniform's location in a specific program object, or whether a program is bound to the current OpenGL context. I'll just establish a convention in my application for uniform variable names, update some global uniform buffer and render. This would also be nice if I have to support GLSL 1.5 and earlier, where I can't explicitly have a layout location qualifier in my vertex shader.

However, I read in this thread that some users disagree, saying that using UBO's over plain old uniforms incured an undesirable performance penalty.

Should I always prefer using UBO's over uniform variables? What are the pros and cons of each option for per-model uniforms?

sentences:
Level loading works in Unity editor, but quits when deployed In my level selection screen, all but the first level start out locked.

When I click on a level, it loads perfectly in Unity editor. However, when I build the game on a real device, the game stops as though I had pressed the back button on my device instead of launching the level.

What happened? How can I debug this, given it works fine in the editor?

sentences:
Minimum Viable Product for RTS game? I'm in pre-production on a strategy game and am trying to determine if the core gameplay will be fun. A good technique to determine this is to strip the game down to its minimum viable product (MVP) and see if that is fun. If the MVP isn't fun, then no amount of extra content or features will make it fun.

I'm having difficulty determining the MVP for a strategy game as I'm a little too far into the weeds to see which of the many design features are core mechanics and which are unnecessary.

Purely as an example, lets just say StarCraft2 is the strategy game I want to make. What would be the MVP for SC2 to prove out that its core gameplay is fun?

sentences:
Best way to let the player know there are multiple solutions to a problem?(and force them to play again) I am going to work on a map for my game that is in first person mode. This is the story(planned).

He is on a sinking ship and he wants to escape before the ship sinks. He has a few ways of doing so, either with the on board seaplane or an emergency raft. Both methods will lead the player to different maps in the game. So here is the question:

How can I notify the player that there is another way of "winning" the map if he chooses one. I do not want to just pop out and say "hey you could have used the boat" or even include a progress map of some sorts, but I still want the player to visit the map again in the future to figure out the paths. Any suggestions would be awesome.

The lighting would be dimmer as the scene is set at night. There will be blood, grease and other dirty stuff on the player's screen. The ship itself is most probably going to wobble around.

edit
Sorry that I didn't clarify, but I want to know methods to lure players to play the map again. Methods of letting the player know that there are different methods works, but I think that should not be the only method. I'll change the title.

sentences:
How can efficiently I edit my 2D tile-based maps? I've been developing a very basic 2D tile-based game for my own experience.
I read what must be hundreds of tutorials on what I found on Google with "tile based maps".

Almost every tutorial I see is an engine that reads a text file and loads tiles based on the numbers in the file, such as:

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

But what if I were making a map that contained several 100 tiles?

surely there's an easier way to make a map than by writing a ton of numbers into a text file? How can this be done quicker?

An idea I had was making the world a single layered image: A layer for the objects/sprites/characters and another on top of that for tiles that should be under you like walls, trees, etc.

Is this possible/worthwhile?

sentences:
Using Java on mobile, should I avoid object construction to reduce GC overhead? I new to both Java and game development and working on my first LibGDX game targeting mobile systems.

How problematic is the garbage collector in a mobile environment? Should I try to reuse as many class instances as possible (e.g. with the object pool pattern), or only do it for the classes that I use most (like projectiles)?

How what instantiation rate warrants this optimisation? Or is the compiler “sufficiently smart” to effectively nullify this problem?

sentences: (Pygame) Sprite disappearing on collision I am making a game, and when the player runs into a certain block it changes the size of a circle on the top. The problem is, whenever the player runs into the block it disappears. How can I fix this?

sentences: Portable sound and music for XNA / MonoGame? What is the best (recommended) way to integrate audio (both sound effect and music) in a game project (using C#/XNA) targeting multiple desktop platforms (W7, W8 Metro, Linux, OSX, ...) via MonoGame. XACT was the usual way in XNA but it is deprecated in W8 and also cannot be used with MonoGame, I am looking for an alternaive. Is there one?

sentences:
What problems could occur if you make use of both the MonoGame API and the underlying graphics API? What kinds of problems could one run into if they were making a game with MonoGame and started making calls to the underlying graphics API as well?

For example, if I wanted to do something in a MonoGame project that MonoGame didn't necessarily support, or I just couldn't find the proper documentation / example for but I could find an example of how to do it in OpenTK, am I setting myself up for trouble if I implement it using OpenTK directly while using the MonoGame API everywhere else? Specifically I'm looking to find out if there are any big issues that are known that might result of this and not something obscure that will happen in very rare cases.

I tried doing a little research via Google and the GD.SE site itself and I couldn't find much. Maybe MonoGame has really covered most of its bases, but what if I manually wanted to work around one of it's outstanding issues or a feature that is not yet implemented?

If so what sort of problems might arise and are there any ways to help mitigate these issues?

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: Control the Transform component of an object while the animation is playing It seems the the animation controls the Transform component of the gameobject, hence making it not possible to control the transform properties while the animation is playing. Is there any way to control the Transform component of an object while the animation is playing, like rotating it for example?

sentences:
How to make a death screen without making it a new state? You must be confused by the question, let me explain. In some games, when you die, it shows a death screen but the background is sometimes transparent and shows the game play. how to do that. here are a few pictures to help out:
And sorry for advertising

sentences:
Diamond square algorithm I'm working on generating terrain on already generated landmass. The landmass and ocean around it consist of hexagons. Hexagons aren't really a concern for me, because I can always interpolate the values algorithms generates with the vertices on the grid. As you can see on the image below, blue is ocean, brown is land.

Problem is, I need the shore to have 0 height, can it even be done with diamond square algorithm?

sentences:
XNA texture overlay with offset Is it possible to overlay one texture over another and make them into a new texture? It should also work with an offset.

Here's an example:

This texture

and this texture

should make this texture

It should be possible to change the position of one texture.

sentences:
How do I fix this unintentional chromatic aberration on a lightmap? Some strange rainbow halos (front and left) appear after computation of a lightmap for direct light. The formula is
dot * dot2 / ( dist * dist ) * dl->intensity

with gamma correction, lightmap is computed as vec3_t and ultimately cropped to 3 bytes. However, brightness of the region in question fit into 255 nicely, and even calculating in byte instead of float beforehand - result in just a subtle "oil painting" effect and does not produce such artifact across entire image.
My best guess is how this artifact appear from base change in a floating point math, but I don't know for sure nor do I understand what exactly is happening.

sentences:
Textures occasionally rendering twice on a particular face I am learning how to render 3D objects using webgl (no third-party libraries).

I am currently facing a very confusing situation however, where my textures are rendering apparently twice over a particular triangle, but only on some of the triangles.

I have added a screenshot of the problem, and was rather hoping some gl-ninja in here would be able to point me in the direction of my mistake:

As you can see, most of the textures are rendering fine, the cobble stones and most of the triangles of the crates, I hope it is clear enough, in the top-right triangle of the bottom left crate the system is showing 2 textures (1 incorrect, quite strong, the other correct, quite weak).

I don't really expect you to wave a wand and fix this (though that would be nice!) I'm just hoping that you recognise the symptoms and can point me in the right direction, either terms to use in Google, or areas in my code that I should give some more thorough scrutiny.

UPDATE:
I'm so thankful for your help!

Somehow my object had set itself to render as a trianglestrip, instead of a triangle list. I realise there's no way you could have seen that, just leaving this here in case some fellow coder is stuck on the same strange issue!

Been looking into this for days now... live and learn!

sentences:
Sprite Kit - keeping character level with the terrain 2d endless runner I've been trying to figure this out exhaustively for the past few days and still haven't found an answer.  I have an endless runner built using swift where the character is fixed and the terrain moves to the left.  I have edge physics bodies on the terrain, and edge physics bodies that go up and down slopes.

The problem is, if I want my character to collide with the ground without being pushed back by it, since the only thing that can make contact with an edge is a dynamic volume.

My goal is to keep the character level with the terrain, (assuming they're not jumping).  Even on slopes.

I've tried ray casting using enumeratebodiesalongraystart, but can't seem to figure out how to get coordinates of where it intersects with the ground.  I've tried having an edge body that is vertical, that intersects with the ground(two edge bodies cannot make contact in sprite kit).  I've tried dynamic volumes.  I've tried Static volumes.  Nothing works.  I'm not posting code here since I'm really just looking for a general answer to sort of point me in the right direction, but I'm coding in swift.  Thanks in advance.  Also I have the character in a different bitmaskcatagory than the terrain catagory and they are set up to recognize each other, and do if one of them is a dynamic volume physics body.

sentences: How to draw a rotatable and zoomable sphere? My game is a sort of business simulation game of Earth, and I want the main interface to be just like a google earth view. Is there a way to do this with built in OpenGL features or do I have to implement the engine myself.

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:
How do you create an input layout for passing a uint4 to a vertex shader in D3D10? I am trying to pass in a uint4 into the shader but my input layout keeps failing when trying to load the shader.

shader.fx

uint4  values : UINT4_0;  // VertexInput

Input layout

{ "UINT4", 0, DXGI_FORMAT_R32G32B32A32_UINT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }

Does that seem right?

I am a bit confused why there is an error here.

sentences:
Advice for a table top rpg with rpg systems English isn't my first language so sorry in advanced for odd wording.

Idk if this is the right type of form but,I would like to make a game much Like D&D.
With that said basic attacks seem to work out just fine no matter lvl or stats I think that the numbers come out a fair.

mag= (100 + buffs + gear) = sum
res= (100 + res + buffs + gear) = sum
magic damage =(A.mag*mag.sum)/(res.sum)

This pushes out fairly low numbers that are then ran into a set of code that does the damage by number of its.

*1 for attacks that are 5 to 10 hits
*2 for 2 to 4 hits
*4 for single hit skills and spells. (had a problem that made single hits to weak for a time.)
*.5 for skills/spells that hit 11 to 15 times.

So here is where the problem comes in this is a Ip i made over years of thinking and putting things together. Spells are ranked from 1 to 5 however 5 is a insta win at the cost of the users life.

I do want to note as Dm I use my pc to run the above code. I would love to hear any form of tips or advice that might make things run a little better in the long run.

If we plug the numbers from the race above at level 1 those numbers being 40 magic and give the attacker a weapon buff of 20 and a attack buff of 10 it should come out to 130. Note that the magic attack will not be used in getting the sum of these buffs. Now lets make the defends gear a gear buff of 10 and a res buff of 15. the res stat is used in the code as shown below leading us to our sum of .155

attacker (100 + 20 + 10) =130
defender (100 + 30 + 10 + 15) = 155

These numbers would give us our sum. this is then plugged into another set of code as seen below

(Mag*attacker sum)/(defender sum)

so if we plug in the numbers it should look like this.

(40*130)/(155)= 33.54

This is then taken automatically by the system and * by the following numbers 2,4,.5 this displays the outcomes of the above number as the first hit in the combo.

(40*130)/(155)= 33.54 <this is then * by the number of hits a 5-10 hit>
(40*130)/(155)= 33.54*2 = 67 <*2-4>
(40*130)/(155)= 33.54*4 = 134 <single hit spells>
(40*130)/(155)= 33.54*.5 = 16 <*10 to 15>

So to explain the above numbers lets say I use a spell that cast 15 chances to hit in damage that spell would use the formula of 10 to 15 or .5 making each hit deal 16 damage if they all land that would be 240 damage taken. if unlucky however only 3 of those 15 could hit and you would still use the 16 as your base damage for said attack.

In theory this should be fine (i think) this makes some AoE's broken as a AoE without a chance to miss would deal massive damage every time. So maybe in the long run my question might really is their a way to make this more fair for pvp?

In case asked

Yes I am likely tying harder than I need to.

I can also Show what a a good player sheet and a broken player sheet look like if someone thinks it would help. I do hope that this is more clear than before or at most gives a better idea of what i'm tying to ask.

I have never made a game I have less than a year of html,c# and,c++ under my belt so i hope it kinda looks like it should work.

Thank you for all replies

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:
Shape collision checking I want to check in an shape, wether an point is in it or not.
The shape is descriped with one Array of float vectors.
The vectors are added in clock direction.
The first I can check very easy, the second too, but the third is more difficult.
How I can calculate this ? How this category is in math named, so that I can google ?

sentences:
How do I correctly use SDL_RegisterEvent to create SDL_UserEvents? I've been looking to use SDL's own event messaging system to pass events around to different parts of my game, since it supports user events.

However, the documentation isn't very clear. Here is the code snippet it gives:

Uint32 myEventType = SDL_RegisterEvents(1);
if (myEventType != ((Uint32)-1)) {
    SDL_Event event;
    SDL_memset(&event, 0, sizeof(event)); /* or SDL_zero(event) */
    event.type = myEventType;
    event.user.code = my_event_code;
    event.user.data1 = significant_data;
    event.user.data2 = 0;
    SDL_PushEvent(&event);
}

My questions:

Does every type returned by SDL_RegisterEvents get read as SDL_UserEvent? If so, why even bother registering more than one event when you can use the event.user.code field to differentiate between types?
Do I need to call SDL_RegisterEvents each time I want to push my own event onto the event queue? Does this mean once the event I queue up is read, it trashes the type given to me by SDL_RegisterEvent and recycles it for another call?

The wiki is fairly vague, and there is next to nothing out there about using the SDL_UserEvent event type, so I am not entirely sure how to take advantage of SDLs built-in event handling system.

sentences:
Vulkan best practices validation feature During instance creation, debug utils enabled with best practices feature, I get the following somewhat cryptic message from the debug utils callback:

[ UNASSIGNED-BestPractices-vkCreateInstance-specialuse-extension ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x2dc65ef4 | CreateInstance(): Attempting to enable extension VK_EXT_debug_utils, but this extension is intended to support the following uses: use by applications when debugging, and it is strongly recommended that they be otherwise avoided.

Further info: this is Debian Linux. I have installed the vulkan dev packages from the repositories, but not the lunarg things. I filled out VkDebugUtilsMessengerCreateInfoEXT and VkValidationFeaturesEXT, linked the former to the .pNext field of the latter and the latter to the .pNext of the VkInstanceCreateInfo struct. CreateInstance and CreateDebugMessenger return without error.
I am struggling with the deeper meaning of the message. I assume it means that best practices feature is not enabled (unassigned), but why does the validation layer tell me not to enable debugging other then for, well, debugging ? Sounds like too much information ... what does it mean ?

sentences:
OpenGL additive vertex color mode Surely OpenGL has a way to set the vertex color mode. By default it is multiplication.

When I have an existing texture on a quad to represent a player in my game, I want to add color to it. As of now, doing so only multiplies the color with the texels on the quad. So if I have a color that represents bright light say (128,128,128) what I want is additive behavior: take the color in the texel and add the channels together.

I have not found anything to do this automatically in OpenGL without the use of shaders or including a second draw step on one sprite with a different blend mode to simulate this.

sentences:
Creating a list of buttons dynamically in code I have a list of contacts. I need to create a scrollable list of buttons that are created dynamically so I can add each contact name as the button text. How would I do this all in code? My biggest concern is making sure the sizes stay consistent. I haven't had to do that in code before.

EDIT:

And here is the code to add the buttons to this:

for (int i = 0; i < count; i++)
{
    if (i > 0)
        crt.sizeDelta = new Vector2(crt.sizeDelta.x, crt.sizeDelta.y + initHeight);
    GameObject contactButton = Instantiate(Resources.Load("Contact Button")) as GameObject;
    contactButton.transform.parent = contactsList.transform;
    contactButton.GetComponentInChildren<Text>().text = names[i];
}

sentences:
How to generate portal zones? I'm developing a portal-based scene manager. Basically all it does is to check the portals against the camera frustum, and render their associated portal zones accordingly.
Is there any way my editor can generate portal zones automatically with the user having to set the portals themselves only? For example, the Max Payne 1/2 engine ("Max-FX") only required to set the portal quads, unlike the C4 engine where you also have to explicitly set the portal zones.

sentences:
How do I make "weaponsclash" = animations adapating to parameters Meaning: how do I build my animations/system so that I can have swords blocking each other?
I honestly believe this is the hardest part of a game: I need animations to interact with each other. If a monster uses attack 1 on hero 2, then both NPCs have to play a different animation based on,

A, How big these NPCs are. I need them to be able to be scaled (monsters can grow, but when it jumps on a small player, it still has to look just as fitting as with other sizes)
B, Speed of the monster when it runs up for the attack.
C, Countless other things I suppose.

How do I achieve this? KI, Pathfinding... all that is meaningless unless I can build a believable combat system.

sentences:
Chess engine stock fish process for mobile I am making the chess interface I designed for a game. I am using the process to get answers from a stock fish binary:

stockfish = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName = System.IO.Directory.GetCurrentDirectory () + "\\Assets\\Scripts\\Stockfish\\stockfish.exe",
                    Arguments = "",
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    RedirectStandardInput = true,
                    RedirectStandardError = true,
                    CreateNoWindow = true
                }

            };

The problem I face is it worked for my Windows build but for mobile package build it won't work with the executable. Is there a way around it?

sentences:
Control rig sequence is not in UE4 menu In the Unreal Engine docs, it is mentioned that, in order to create a Animation Sequence using the Control Rig, it is possible to create a ControlRig Sequence.
Now, why do I need that?
I need it to create Animation Sequences for my character and I do not want to create the Animation Sequence in other softwares, like Blender.
So why I can not find  ControlRig Sequence in UE4 menus?

sentences:
Section cut through (solid) geometry I'm looking for image based (screen space) technique to render section cuts through arbitrary (solid) geometry. I found and studied image based CSG (Kirsch 05 / OpenCSG) but I found it to be perhaps a bit of a overkill for my case, where all I need is a section plane cut.

Above is a naive implementation using a discard in the fragment shader, but that obviously is not even half-way there as I need to close the gaps. Does anyone know of a technique/hack I could use?

sentences:
how to calculate intersection time and place of multiple moving arcs I have rocks orbiting moons, moons orbiting planets, planets orbiting suns, and suns orbiting black holes, and the current system could have many many layers of orbitage.

the position of any object is a function of time and relative to the object it orbits.
(so far so good).

now I want to know for a given 2 objects(A,B), a start time and a speed, how can I work out the when and where to go. I can work out where A and B is given a time.
so i just need.

1: direction to travel in from A to B(remember B is moving(not in a straight line))
2: Time to get to b in a straight line.

travel must be in a straight line with the shortest possible distance.

as an extension to this question, how will i know if its better to wait, EG is it faster to stay on object A and wait for a hour when the objects may be closer, than to set off from A to B at the start.

Cheers, it hurt my brain.

sentences:
How to get chunks in a sphere rather than cuboid I have a chunk system to load stars around the player. It takes a given "real" loading range (aka Unity-units of range), calculates the necessary chunk loading range (as integer), creates star GameObjects within the loading range on screen, and stores stars in cache which are within chunk loading range but outside of real loading range.
Chunks are stored in a dictionary with the key being a struct consisting of x,y,z integer coordinates. Available data are:

Real position of the player
Current chunk of the player
Center point and size of each chunk (same size for all)
I know when the player steps into another chunk

A quick calculation revealed that if I'd be able to load chunks spherically instead of cubically, I would be able to load ~40% less chunks. The amount of chunks I have to grab (currently) can vary, ranging from a range of 3 to ~8 (meaning minimum of (2*3+1) 7*7*7=343 to (2*8+1) 17*17*17=4913). Current Code:

    public Chunk[,,] GetChunksInCuboid (Coordinate coords, int range)
    {
        return GetChunksInRectangle (new Coordinate (coords.x - range, coords.y - range, coords.z - range), new Coordinate (coords.x + range, coords.y + range, coords.z + range));
    }

    public Chunk[,,] GetChunksInCuboid (Coordinate min, Coordinate max)
    {
        int xLen = max.x - min.x + 1;
        int yLen = max.y - min.y + 1;
        int zLen = max.z - min.z + 1;

        Chunk[,,] A = new Chunk[xLen, yLen, zLen];

        for (int x = 0; x < xLen; x++)
        {
            for (int y = 0; y < yLen; y++)
            {
                for (int z = 0; z < zLen; z++)
                {
                    A[x, y, z] = GetChunk (x + min.x, y + min.y, z + min.z);
                }
            }
        }

        return A;
    }

My question is the following: Is it possible, and if yes, how can I performantly load chunks in a sphere?

sentences:
What is the difference between the two circles in the rotation tool in Unity? What is the difference between the two circles in the rotation tool in Unity?
In 2D rotation tool there are two circles which allow to rotate an object. And I can not conceive a difference between them. Could someone explain me what is the purpose of having both of them? It seems they both do the same.

sentences:
How can I implement scrolling endless road in XNA? I am developing XNA game like following screenshot.

I created my 3D objects and camera so I have models. But how can I implement scrolling road in XNA?

sentences:
How to set a specific face's texture color in Unity? First off, let me describe my situation...
So I'm building a voxel engine based on this tutorial. I'm using my own texture tilesheet. Most of the tiles have their own color except grass, leaves, and a few others. These specific ones are meant to be colored based on the temperature and humidity of the location.

AlexStv (the author of the tutorial linked above) said the mesh colors array could be set, but I tried that and nothing happened. I probably did it wrong though, not sure. But he also said "you may need a shader that render vertex colors, not sure if the standard shader does that anymore" so that could also be the issue.

So... Do I need a custom shader? If not how do set the face's colors?

EDIT, Note: I just tried a custom shader called UnityVC, it still didn't work so I guess I must be doing the color thing he suggested wrong.

sentences:
Workaround for reading and writing same texture? To apply post effects, it is often needed to read the preliminary image, perform computations on its pixels and store the result in the same texture again. For example, think of a tone mapping or desaturation effect. The input and output should be the same texture, but this isn't allowed by OpenGL.

Therefore, what is a good workaround?

One idea I came up with but which isn't very satisfying is to have two image textures and automatically use them alternating. Also keeping track of which is the newer one to finally display it on the screen.

sentences:
How can I position a sprite in the same spot across different screen sizes? Taking into account the multitude of screen sizes and resolutions, is there a way I can position a sprite so it's at roughly the same spot on every iOS device?

Doesn't matter if you are using SpriteKit or Cocos2D or just using UIKit. The principle for positioning a sprite is roughly the same.

sentences:
Legal issues around forming an international game dev team A friend and I have been wanting to collaborate on a mobile app game. It's a 'start small but dream big' kind of venture, where neither of us has much experience, but we're hoping that if we succeed, we could build on it and become a proper full-time game dev studio in the future.

The main issue here is that we're both from different countries, and neither of us wants to risk personal liability in releasing a game without having first formed a LLC. I know the odds of ACTUALLY being personally sued for damages are very low, but it's just not a risk that we want to take.

There seem to be a lot of problems with forming a LLC when both people are in different countries, though. There are multiple laws against having a co-founder, director, or even an employee being someone from a different country.

How do game dev teams or studios consisting of people all around the world get around this problem?

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:
How to aim bullets at a player in Vavio In Vavio, how do you make an enemy aim at the player then shoot a bullet? Here's the code I tried:

LevelSpawnData/spawnData-L0.json

{
"spawns": [
    {
      "time": 3.2,
      "leave": 12.8,
      "pattern": "Test/aim.lua",
      "movement": "Test/move.lua",
      "model": "circle",
      "material": "red",
      "x": 0.5
    }
  ]
}

Patterns/BulletSpawning/Test/aim.lua

bullet = pattern.NewBullet()
bullet.speed = 3
bullet.angle = ??? -- Want to set this to angle towards player
pattern.SpawnBullet(bullet)

sentences:
What is the best method to use to write and handle multiple levels? I have a level class that does all of the updating and drawing and everything pertaining to the level.  My question is, what would be the best approach to creating different levels?  Should I just write them all in this single class which just chooses what to load and do depending on the level, or should I write each level in its own class that inherits from a base level class?

My code handles switching levels through the game's state manager...

void Game::change(GAMESTATE changeTo) {
  state = changeTo;
  load(state);
}

void Game::load(GAMESTATE loadState) {
  while(!currentState.empty()) {
    delete currentState.back();
    currentState.pop_back();
  }
  if(state == TITLE) {
    currentState.push_back(new Title());
  }
  else if(state == LEVEL) {
    currentState.push_back(new Level(&levelNumber));
  }
  else if(state == CUTSCENE) {
    currentState.push_back(new Cutscene());
  }
  else if(state == GAMEOVER) {
    currentState.push_back(new GameOver());
  }
}

[edit] For this question, let's assume I want to hard code the levels and don't want to use external files.

sentences:
How do I use the dot product to get an angle between two vectors? I am learning to use normalized vectors in my games.

I've learned that in order to know the angle between two vectors, I can use the dot product. This gives me a value between -1 and 1, where

1 means the vectors are parallel and facing the same direction (the angle is 180 degrees).
-1 means they are parallel and facing opposite directions (still 180 degrees).
0 means the angle between them is 90 degrees.

I want to know how to convert the dot product of two vectors, to an actual angle in degrees. For example, if the dot product of two vectors is 0.28, what is the corresponding angle, between 0 and 360 degrees?

sentences:
Unity animator controller animations don't work I'm having problems animating a character pack I purchased from unity asset store.

I've placed the character in an environment and created an animator controller. After I drag the animation that to the animator tab, there aren't any motions. Even if I place triggers or booleans in my script as parameters in the animator it doesn't work.

It worked with other characters but the animations were somehow embedded in the 3d models. How is this supposed to work?

sentences: Get position of point on circumference of circle, given an angle? I would like to know how to get a specific point on the circumference of a circle, given an angle. The diameter of the circle is 1, and the center point of the circle is { X: 0.5, Y: 0.5 }.

sentences:
Checking for Weapon Collision in a 2D overhead RPG game I'm starting development on a 2D overhead RPG game, and am wondering what the best approach for handling weapon collision and dealing damage to enemies is.

I'm currently using a basic Entity/Component structure for my game objects.  I have a CharacterEntity, that has an EquipableEntity data member.  The CharacterEntity has a component that listens for input.  When a command to attack is received, the CharacterEntity is set into an attack mode where an attacking component gets the equipped entity and moves it in the attacking motion.  Any collisions detected with the moving equipped entity in the world are then registered as successful attacks.  Once the attacking component determines the attack is finished, the CharacterEntity leaves attack mode and returns to it's normal state.

Weapon collision is a basic LWJGL Rectangle that tests the .interesects() method, checking against all enemy rectangles.  Currently it's just a stabbing motion (it moves out to x length, then returns).

The reason I did it this way was:

1) I wanted enemies to receive and respond damage as the sword crosses their path, instead of just saying "attack occurred in this general area" and having all enemies update at once.  In the stabbing case, an enemy at the full length of the sword wouldn't take damage until the actual sword entity crosses it's path.
2) The weapons define their own appearance and boundary on the screen, making it easier to animate and sync with the game.

I'm entirely new to game development (if you haven't figured that out already).  Is this the appropriate way to achieve the result I'm looking for, or complete overkill?  How does a game like Terraria (where weapons move in a sweeping motion) or the Zelda series handle attacking and determining what enemies to hit and when?  Am I on the right path or totally off?

Any advice or suggestions would be greatly appreciated.

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:
Can custom maps in Starcraft 2 automatically enable certain unit upgrades? If I create a custom map with the Starcraft 2 map editor, how can I specify that some unit upgrades are already researched?

For example, if I want all the units to already have the weapons upgrade 1 at the beginning of the game, can I specify this in the editor?

I've looked through the menus but didn't find anything that looked like it would relate to unit upgrades.

sentences: Debug.Assert Behavior in Unity Is this normal behaviour that Unity continues to run after a condition in a Debug.Assert statement was NOT met when I launch the game within the Editor? I can see the assertion in the console output, but still would expect it to stop the game. Development build and Script Debugging are turned on in my player settings.

sentences:
Efficient Algorithm for the boundary of a set of tiles I have a grid of tiles of a known finite size that forms a map. Some of the tiles inside the map are put into a set known as a territory. This territory is connected, but nothing is known about its shape. Most of the time it would be a fairly regular blob, but it could be very elongated in one direction, and it could potentially even have holes. I am interested in finding the (outer) border of the territory.

That is, I want a list of all the tiles that touch one of the tiles in the territory without itself being in the territory. What is an efficient way of finding this?

For extra difficulty, it happens that my tiles are hexes, but I suspect this doesn't make too much difference, each tile is still labelled with an integer x and y coordinate and, given a tile, I can easily find its neighbors. Below are a few examples: The black is the territory, and the blue the border I want to find.

This in itself, is not a difficult problem, One simple algorithm for this, in pseudo-python, is:

def find_border_of_territory(territory):
    border = []
    for tile in territory:
        for neighbor in tile.neighbors():
            if neighbor not in territory and neighbor not in border:
                border.add(neighbor)

However this is slow and I would like something better. I have an O(n) loop over the territory, another loop (a short one, but still) over all the neighbors, and then I have to check membership over two lists, one of which is of size n. That gives an awful scaling of O(n^2). I can reduce that to O(n) by using sets instead of lists for border and territory so that membership is fast to check, but it still isn't great. I expect there to be many cases where the territory is large but the border is small due to a simple area vs line scaling. For example if the territory is a hex of radius 5, it is of size 91 but the border is only of size 36.

Can anyone propose something better?

Edit:

To answer some of the questions below. The territory can range in size, from about 20 to 100 or so. The set of tiles forming the territory is an attribute of an object, and it's this object that needs a set of all the border tiles.

Initially the territory is created as a block, and then mostly gains tiles one by one. In this case, it is true that the fastest way is just to keep a set of the border and only update it on the tile that is gained. Occasionally a big change to the territory might happen - so it will need to be recalculated fully then.

I'm now of the opinion that doing a simple border-finding algorithm is the best solution. The only additional complexity this raises is to ensure that the border is recalculated every single time it might need to be, but not more than that. I'm pretty confident that this can be done reliably in my current framework.

As for timing, in my current code I have some routines that need to check every tile of the territory . Not every turn, but on creation and occasionally afterwards. That takes over 50% of the running time of my suit of test code even though it is a very small part of the complete program. I was therefore keen to minimise any repeats. HOWEVER, the test code involves a lot more object creation than a normal running of the program (naturally), so I realise this might not be very relevant.

sentences:
"Painting" elements in html5 canvas I'm making a game in coffeescript (although for the sake of this problem that's probably not all that relevant) and html5's canvas. It's a game that involves a paint cannon, that fires circular particles of paint that can paint elements of the level and the player. The problem is I'm not sure how to accomplish the painting. The diagram below illustrates what I'm trying to accomplish:

Using canvas, the particles are drawn using context.arc(), the players using drawRect.arc() and the floor can be an arbitrary polygon with drawing code as follows:

    @drawingContext.beginPath();

    tV = b2Math.AddVV(pos, b2Math.MulMV(body.GetTransform().R, @vertices[0]))
    @drawingContext.moveTo(tV.x, tV.y)
    for i in [1..@vertices.length - 1]
        v = b2Math.AddVV(pos, b2Math.MulMV(body.GetTransform().R, @vertices[i]))

        @drawingContext.lineTo(v.x, v.y)
    @drawingContext.lineTo(tV.x, tV.y)

    @drawingContext.closePath()
    @drawingContext.stroke()
    @drawingContext.fill()

It would be too intensive to keep track of all the circles that should be painted on to objects and would soon bog down, with potentially 60 clipped circles per second being added to be drawn on top of objects.

The original thought was to stack two canvases on top of each other, so then we could draw the levels once and then when ever necessary just draw the paint splat over them once and forget about it (changing the composition mode to source-atop to get appropriate clipping), and since we're not redrawing it would stay there. However, this won't work on moving objects (like players) (that can also rotate and change size relative to the camera). I'm not sure how to do it, since all objects are made up of solid colour to start with there's no texture data or anything we can modify.

sentences:
What advantage do OpenGL, SFML and SDL have over software rendering? I started watching the Handmade Hero stream, where Casey Muratori creates a game engine without using frameworks or such.
Yesterday I got to the part where he showed how an image is drawn onto the screen. As far as I understood it he just allocated some memory as big as the size of the screen he wants to draw to. And then he created a bitmap which he passed to the buffer memory he allocated and drew it to the screen using a os specific function.

This seems quite straight forward. I used GameMaker, changed to Love2D, worked a little bit with Sprite Kit but I was always wondering what was really happening beneath this sometimes confusing layers.

Given that, why even bother using graphics libraries (OpenGL, SFML, SDL, …) when all you have to do is simply allocate some buffer, pass a bitmap and draw it to the screen?

If you then want to draw distinct things to you screen you just write them to your bitmap which then gets passed into the buffer. I'm quite new to programming, but this seems quite simple to me. Please correct me if I'm wrong.

sentences:
Unity procedural smooth normals I have a Unity project, which heavily relies on the marching cubes algorithm. Because this algorithm doesn't return the triangles in order, I can only index them in the order they are present in the vertices array.

For example:

vertices: {Vector3(0, 0, 0), Vector3(1, 0, 1), Vector3(1, 1, 0)...}
triangles: {0, 1, 2, 3...}

Because of this, Unity's RecalculateNormals method doesn't work properly and it gives me the following result:

Is there anyway I can make the normals smoother? Keep in mind, that I need to possibly recalculate these vertices everytime the values change, so I can't rely on very heavy methods.

sentences:
Screen point to world space conversion I have a 3D cube that can be rotated with the mouse to show any side of the sphere.I want to be able to click a point on the cube and draw a circle around that point at a fixed height(so i dont need depth information), however i run into a problem where i cant translate the screen coridiantes to the worldspace coordinates. What i have attempted:

get mouse click position(x,y)
normalise the screen position(-1 to 1)
create a vector with the z coordinate as 1
multiply the vector by (inverseProjection x inverseView)

However, this does not give me the world coordinates as i would have expected. Where am i going wrong?

The depth information is not needed form this, i only need to map the mouse click point (x,y) to the world point (x,y,z) where z is fixed.

DirectX::XMMATRIX projection = projectionmatrix();
DirectX::XMMATRIX view = viewmatrix();

DirectX::XMMATRIX invProjectionView = DirectX::XMMatrixInverse(&DirectX::XMMatrixDeterminant(view *  projection), (view *  projection));
//invViewProjection = invView * invProjection;

float x = (((2.0f * mouseX) / _viewport.Width) - 1);
float y = -(((2.0f * mouseY) / _viewport.Height) - 1);

DirectX::XMVECTOR mousePosition = DirectX::XMVectorSet(x, y, 1.0f, 0.0f);

mouseInWorldSpace = DirectX::XMVector3Transform(mousePosition, invProjectionView);

Edit: The fixed axis is the y-axis, the z and x axis are the changing axis

Edit: I have revised the question after realising my mistakes in the initial question.

The x, y, and z are positioned as shown above. I want to be able to click the cube surface and drwaw the shape at a point with a fixed y-offset from the click point.

I am not able to draw a plane on the surface of the cube due to the nature in which the cube is generated hence the need for the screen to world coords.

sentences: What is Ramp Shading or Lighting? What is ramp shading or lighting and how does it work? Is it different than toon shading or is it the same concept? How is specularity calculated differently for ramp shading versus blinn-phong or lambert?

sentences:
Vertex position problem for connected lines I’m trying to generate a mesh to display connected segments representing street lines in a mini map. I have problem with vertex orientation that my math knowledge has hard time to resolve.

Let’s consider 3 points p0, p1 and p2.

I use this code to create the vertices from the segment between p0 and p1 (the same code is then used for the segment from p1 to p2):

height = 2.0f; // desired line thickness
vertices[0] = new Vector3(p0.position.x, p0.position.y - height / 2.0f, 0);
vertices[1] = new Vector3(p1.position.x, p1.position.y - height / 2.0f, 0);
vertices[2] = new Vector3(p0.position.x, p0.position.y + height / 2.0f, 0);
vertices[3] = new Vector3(p1.position.x, p1.position.y + height / 2.0f, 0);

The result looks like this:

Not that bad, except that the "thickness" of the line is not constant. If you look closely to the segment left and right borders, they are aligned (going from bottom to top). The problem comes from the “height” variable that is added or subtracted too naively to the positions.

What I’d like to have is something like this, with oriented borders / vertex.

However I don’t know how to proceed.

Any help or comment would be appreciated.
Thanks for your time.

**** EDIT ****
Thanks to @wondra's solution I managed to do what I needed to. Here is how:

    // Returns point of intersection
    // TODO: check if lines are parallel
    public Vector3 LineIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4)
    {
        float ma = (p2.y - p1.y) / (p2.x - p1.x);
        float mb = (p4.y - p3.y) / (p4.x - p3.x);

        float ba = p1.y - (p1.x * ma);
        float bb = p3.y - (p3.x * mb);

        float x = -(ba - bb) / (ma - mb);
        float y = ma * x + ba;

        return new Vector3(x, y);
    }

/// --- LOOPING THROUGH POINTS ---

    // @wondra's solution
    Vector2 dir = (sec_node.position - prim_node.position).normalized;
    Vector2 perp = new Vector2(dir.y, -dir.x);

    vertices[vert_idx]      = prim_node.position + (perp * -height / 2.0f);
    vertices[vert_idx + 1]  = sec_node.position + (perp * -height / 2.0f);
    vertices[vert_idx + 2]  = prim_node.position + (perp * height / 2.0f);
    vertices[vert_idx + 3]  = sec_node.position + (perp * height / 2.0f);

    if ( vert_idx > 4 )
    {
        int vert_idx_bis = vert_idx - 4;
        vertices[vert_idx] = LineIntersection(vertices[vert_idx], vertices[vert_idx + 1], vertices[vert_idx_bis + 1], vertices[vert_idx_bis]);
        vertices[vert_idx_bis + 1] = vertices[vert_idx];

        vertices[vert_idx + 2] = LineIntersection(vertices[vert_idx + 2], vertices[vert_idx + 3], vertices[vert_idx_bis + 3], vertices[vert_idx_bis + 2]);
        vertices[vert_idx_bis + 3] = vertices[vert_idx + 2];
    }
/// --- END LOOP

sentences:
Response to form triggers creation of zero or more duplicate scenes I've got two scenes, one with room 1 and one with room 2.

In room 1 I've got one table with two 3D assets on top of it. This room also has a door that connects to room 2 through a door but it's closed.

Once going near the 3D assets a dialog pops up saying to click "E". This pops up a 2D form one needs to fill.

Only after filling both forms I'm able to go into room 2.

Now what I would like to do is, depending on the response in the form, one or more duplicate room 2 scenes should be created and dynamically added to the scene. If with scenes isn't possible, what's the way to do such thing?

Know about SceneManager.CreateScene but this creates an empty scene, not exactly what I want to.

sentences:
Running one action on multiple sprites simultaneously I have created a spiraling animation for a football. I want to be able to run it on 2 sprites simultaneously.

This is what I have done:

CCAnimation* footballAnim = [CCAnimation animationWithFrame:@"Football" frameCount:60 delay:0.005f];
spiral = [CCAnimate actionWithAnimation:footballAnim];
CCRepeatForever* repeat = [CCRepeatForever actionWithAction:spiral];
[Sprite1 runAction: repeat];
[Sprite2 runAction: repeat];

However, the action is only run on the first sprite. What am I doing wrong?

sentences:
Why does this simple if-statement that checks my main characters state never get called (Java/LibGDX)? Been working on this for a while - basically I want my player to perform a front flip when he jumps (screen tap -> player jumps). I wrote the animation class Animator (extends Player implements ApplicationListener and my plan is to initialise it in Player (main character class) whenever his state becomes JUMPING. I did a few tests using System.print and found that when the screen is tapped (i.e. whenever touchDown() is called) the Player's state IS modified (using stateModifier("jumping").

However, the code inside if(state == playerState.JUMPING) in update() for some reason is never called. I know this is the case because the System.print I wrote never gets outputted. I'll throw my code in here since you will probably need to see the big picture:

public class Player extends GameObject implements InputProcessor {
private Animator jumpAnimation; // the class where the animation takes place
private playerState state; // enum of player states
private float gravity;
private boolean allowJump;
private float accelerationJump;
private Texture img;
private Sprite sprite;

public Player(float xPos, float yPos) {
    super(xPos, yPos);
    img = new Texture(Gdx.files.internal("JUMP1.png"));
    sprite = new Sprite(img);
    setxPos(xPos);
    setyPos(yPos);
    setxSpeed(4.6f);
    setySpeed(0);
    sprite.setX(getxPos());
    sprite.setY(getyPos());
    setType("player");
    gravity = 0.34f;
    accelerationX = 0.02f;
    accelerationJump = 14f;
    allowJump = true;
    Gdx.input.setInputProcessor(this);
    state = playerState.NORMAL;
}

// change the player state
public void stateModifier(String modify) {
    if (modify.equalsIgnoreCase("jetpack")) {
        state = playerState.JETPACK_MODE;
    } else if(modify.equalsIgnoreCase("normal")) {
        state = playerState.NORMAL;
    } else if(modify.equalsIgnoreCase("jumping")) {
        state = playerState.JUMPING;
        System.out.println(state);
}
}

public void update() {

    // Player's speed in the y plane is affected by gravity
    setySpeed(getySpeed() - gravity);
    // Player constantly moving
    moveBy(getxSpeed(), getySpeed());
    // Don't allow Player to fall below the ground due to gravity
    if (belowGround()) {
        moveTo(getxPos(), groundY);
    }
    // If Player is on the ground then he can jump, so set allowJump to true
    if (onGround()) {
        allowJump = true;
        setySpeed(0);
    }
    // if the player is in a jumping state, run the jump animation
    if (state == playerState.JUMPING) {
        // this print statement should get called when a player jumps but never does
        System.out.println("should animate right now");
        jumpAnimation = new Animator(getxPos(), getyPos());
    }
}

public void jump() {
    setySpeed(getySpeed() + accelerationJump);
}

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    // if the player is in a normal state (i.e. not jumping) and he is allowed to jump
    if (state == playerState.NORMAL && allowJump) {
        // set player state to playerState.JUMPING
        stateModifier("jumping");
        jump();
                    // set player state to playerState.NORMAL after the jump
        stateModifier("normal");
        allowJump = false;
    }
    return true;
}

}

Any help is highly appreciated, thank you very much.

tl;dr when screen is tapped, touchDown() is called, which changes the Player's state to JUMPING. however when i write an if statement in update() to check for this, it never gets executed. why is this the case?

sentences: How to unpack game data files encrypted with AES key? In game development pak files are secured by some encryption and one of these are AES key. I want to know that for security purpose is the AES key is stored in the game files itself? I know that computer cannot store the AES key in his mind so it need some clues or files to extract these Ppak files, so where does these AES keys gets stored in a game file itself?

sentences:
How to map absolute Joystick position to object rotation? In my (Ogre) 3d scene I have an object that should be rotated locally based on Joystick input. I have a Joystick with min/max values of [-32767, 32767] on both X and Y axes. When the Joystick is in its origin position, the object should not be rotated. When the user moves the Joystick, the object in the 3d scene should follow this movement (or better: orientation) up to a max. of +/- 45 degrees on both axes.

Or in other words: when the user moves the Joystick e.g. fully to the left, the object's orientation in the 3d scene should be set to 45 degrees on the according axis.

Being new to 3d programming I searched on the Internet on how to achieve this. I think to understand that I want to use Quaternions for this task. I found some examples and tutorials on how to use Quaternions for rotating objects. What I don't understand though is how I can map from the Joystick's current absolute axes positions to the absolute, local rotation of an object.

I see that I could use the rotate() method of the object's node to set its rotation, but I understand that this rotates the object relatively to it's current position. But instead I want to map from the Joystick's absolute position to the absolute orientation/rotation of the object in the scene.

Any advice how I should approach this?

sentences: Best way to develop a level from Top down image using 3dmax I have to create a game level from a top down view of an area. I used a plane converted to an editable poly to do the job. I used edges to create the top view of roads, walkways and parks so that i can extrude/edit them later. My problem is the curves in the road look blocky I tried appying mesh smooth modifier on the final model but that interfered with material mapping. Again i tried it on the plane without the extrusions and still the modifier does not work(The roads loose their shape). I know one way to solve the problem is to add more vertices on the curve and transform their location to create a more natural curve but i have a lot of curves so before doing it manually i need to know if there is a tool that refines the curves. Also i need to know if there is a better or proper way of doing the task.

sentences:
(Unity) does NativeArray.Copy, or NativeArray.CopyTo, allocate any memory? Is there any memory allocation if there are two arrays of the same size and same type? If they are already of the same length, and the values are of struct, when there's the copy, is any more memory used? Like, is it the same as if I did a for loop setting values from one array to the other?

Are they the same?
https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeArray_1.CopyTo.html
https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeArray_1.Copy.html

[What should I write here? Is this enough for a question?]

sentences:
How do I draw a point sprite using OpenGL ES on Android? Edit: I'm using the GL enum, which is incorrect since it's not part of OpenGL ES (see my answer). I should have used GL10, GL11 or GL20 instead.

Here's a few snippets of what I have so far...

void create()
{
    renderer = new ImmediateModeRenderer();

    tiles = Gdx.graphics.newTexture(
        Gdx.files.getFileHandle("res/tiles2.png", FileType.Internal),
        TextureFilter.MipMap,
        TextureFilter.Linear,
        TextureWrap.ClampToEdge,
        TextureWrap.ClampToEdge);
}

void render()
{
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    Gdx.gl.glClearColor(0.6f, 0.7f, 0.9f, 1);
}

void renderSprite()
{
    int handle = tiles.getTextureObjectHandle();
    Gdx.gl.glBindTexture(GL.GL_TEXTURE_2D, handle);
    Gdx.gl.glEnable(GL.GL_POINT_SPRITE);
    Gdx.gl11.glTexEnvi(GL.GL_POINT_SPRITE, GL.GL_COORD_REPLACE, GL.GL_TRUE);

    renderer.begin(GL.GL_POINTS);
    renderer.vertex(pos.x, pos.y, pos.z);
    renderer.end();
}

create() is called once when the program starts, and renderSprites() is called for each sprite (so, pos is unique to each sprite) where the sprites are arranged in a sort-of 3D cube.

Unfortunately though, this just renders a few white dots...

I suppose that the texture isn't being bound which is why I'm getting white dots. Also, when I draw my sprites on anything other than 0 z-axis, they do not appear -- I read that I need to crease my zfar and znear, but I have no idea how to do this using libgdx (perhaps it's because I'm using ortho projection? What do I use instead?).

I know that the texture is usable, since I was able to render it using a SpriteBatch, but  I guess I'm not using it properly with OpenGL.

sentences:
Using brand names in game? Playing Game Dev Tycoon I noticed they rename all the console and company brands ever so slightly. Is something like this done in parody or to avoid copyright?

For example Nintendo is Ninvento and has the consoles name TES (Super TES, TES 64 etc.)

In many pokemon games (I know they are licensed by nintendo though) they make direct references to consoles.

My question is, can you make a game and directly reference Sony Playstation or SNES etc?

sentences:
How do I create a multiplayer server also suitable for local single-player? I've created a voxel game in C++, OpenGL and SFML, and I want to make it multiplayer.

I'd like to make it similar to Minecraft's client-server model: The single-player is just a client to the hidden server underneath; but can be configured to connect to multiplayer as well so that the single player and multiplayer code are one and the same.

Spitball-ideas:

Use a separate thread for the server logic and then share the data between a synchronized point in the code for the client.
Just send packets to local host from the server thread and collect them from the client thread.

How should I do this?

sentences:
How to compare different states of my game? (rpg) I'm working on a rpg, the battle system. I want to compare different scenario with each other.

For example, what if I play move A then move B ? or two times move A ? or ...?

I'm using a tree-structure to generate all possible scenario that can happen during the battle. There is no movement involved, I'm using a battle-system as in FF7, only skill choice matters. 4vs4 units

Trick is, the battle is turn based but not static. There is an Action Point bar for each unit (filling at different speed based on the unit's stats) and the unit with the most Ap (only if > 100) can play. If no unit is > 100, a "turn" will happend and all unit will gain some AP based on their speed. If no unit can play, a new turn will happen...until a unit is > 100 ap.

Each skills takes a different amount a AP to use. At turns 0 for example, we may have a unit with 140 AP that will play two times in a row for 2 actions of 20 AP each. Then other units at 100 AP may play.

It means that when I'm running a simulation of all possible outcome of a battle for my AI, I will have states (node in the tree), that will have a number a turns very different from other and from nodes at the same depth.

I dont know how to compare these nodes at all.

I was using Hp at first, but it is not enought. To prove it, consider the example: 1 vs 1 match. Unit A (opponent of AI) has only 1 move, a small attack that requieres 20 ap. Unit B (AI) has two moves : a small attack that takes 40 ap (and overall hit for very low damage compared to the opponent attack) and a second move that does nothing but consume 20 ap and that move can only be used during the 1st turn.

I will then have to compare two states :

•State 1 : AI use its attack . Opponent his attack. Units are at 60/80 ap respectively. 20 game turns passes and they are now at 80/100 ap. Opponent use his attack. 20 game turs passes and they are at 100/100 again and we are at turn 40.

•State 2 : AI use his move that does nothing. Opponent his attack. Units are at 80/80 ap. 20 games turns passes, they are now at 100/100 and we are at turns 20.

If I compare only HP, In state 1, AI will have an overall score a lower than in state 2 since it got attacked twice in state 1 and 1 times only in state 2.

If I only compare by Hp difference between AI & its opponenent, I would choose state 2 since AI lost less Hp than in state 1.

Running the simulation after state 1 and 2 will continue to show the same difference since after that point, both unit can only use one attack.

In the end, it makes my AI choose a stupid move because she thinks she is less likely to loose selecting it. Granted both move will eventually result in the defeat of the AI since its main attack is weak but I'd like my AI to nonetheless select as its first move, her attack skill and not a skill that does nothing.

I've tried weithing the overall gradient of score between the root state and the state I'm simulating by the number of turns but it does not work in all cases (it greatly depends on the number of turns and the difference between the root).

I was thinking of adding Ap ratio to my evaluation of states but in that example, we can see that in State 1 & 2, units are at the same AP anyway so it doesnt provide extra informations.

Anyone got ideas on how to compares my states from different turns ?

sentences:
How can I implement simple object orbits in Game Maker? I've seen a lot of tutorials for things like "fixed circular orbit" and "elliptical orbits" which end up never been what I actually want.

I have two objects: oPlayer, and oPlanet.

I am trying to allow the player to move around freely, but be able to be caught by the gravity of oPlanet, causing the player to go around in circles/elliptical orbit. I also need the player to be able to escape thate orbit, and end up on a trajectory. In fact, I want it to work for any oPlanet.

What I am looking for is something similar to the orbital gravity in Kerbal Space Program.

Is there any way I should go about this? If anyone can be of help, I would rather answers be in GML rather than the Drag and Drop, but any help is great!

sentences:
UI Text Won't Change Color in Unity 5 In Unity 5 on Windows 10, I try to change the text color from the Inspector and in scripts, but the color won't change. Here are some screenshots of my Text objects open in the inspector, with there colors set to red and white, but staying the default black in the Scene and Game windows:

Here are the lines of code I am using to change the color

var textColor = beatBestTime ? "#FF0" : "FFF";

scoreText.text = "Time " + FormatTime (timeElapsed) + "\n<color="+textColor+">Best " + FormatTime (bestTime)+"</color>";

which I can verify are being run, but the color remains the same!

sentences:
I have a game based on combining 2 ingredients to create a product. What is the best way to code this? (Unity) So to go a bit more in depth, in my game, you can combine a variety of ingredients to make a product. For example, you could combine water and dirt to make mud.

What I am currently doing to achieve this is by listing each combination possibility that a particular ingredient has. The one thing i managed to do to make it a little more efficient is that I managed to remove duplicates (So for example, if i have coded ingredientA + IngredientB = Cheese, there isn't another entry for IngredientB + Ingredient A = Cheese).

The problem I have with my method is that it is very annoying adding new ingredients. If i do so, I have to go back to every previous ingredient i have coded, and add it's interaction with the ingredient(s) i want to add.

The amount of ingredients I have means this is becoming increasingly time consuming.

Is there a better way to do this?

This is a Unity game, coded in C#. Let me know if you need any further info.

sentences:
Non-rectangular hitbox methods in XNA I'm creating a 2D top-down RPG, and many of my buildings/scenery have non-rectangular corners to the textures. Does anyone know a good way to create circular/triangular/polygonal hitboxes, or is too intensive too be worth it?

P.S. If it is too intensive, I can stick with rectangular hitboxes, no big deal.

sentences:
Unable to save player data in a binary file within Update() method I'm trying to save player life within a binary file in Application.persistenceDataPath. I've written a method to store the player life:

  public void SaveLife()
     {
         BinaryFormatter bf = new BinaryFormatter ();
         FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
         PlayerData data = new PlayerData ();
         data.savedLife = life;
         bf.Serialize (file, data);
         file.Close ();
     }

The problem is that when the SaveLife() is called OnApplicationQuit it works. Instead, if I call it within an Update() method of a class, it doesn't work.

The Update() method is called when a certain event is triggered:

void Update()
{
    if (life < 20)
    {
        if (//certain event is triggered)
        {
            SaveLife();
        }

        lifeTimer -= Time.deltaTime;
        if (lifeTimer <= 0)
        {
            ResetLife ();
        }
    }

}

The container class for the data is

[Serializable]
 class PlayerData
 {
     public int savedLife;
 }

What could be the problem?

sentences:
How to store 2D tile-map I want to create a 2D map composed of small tiles, that should look like voxels (eg. this just from side).

I think I can make a structure like Voxel2D, that have int X, Y and some Color, and every Voxel2D is going to be 5x5 pixels (so multiply X and Y by 5 when drawing).

But now how should I store the whole map? In a 2D array like classic Tile-map, or is there any faster way?

sentences:
Can Achievement systems be implemented later in development? I'm undecided if I want to implement this feature in my game at the time or not. I don't want the project to get to far out of control so I'm focusing on core mechanics first.

Is this a feature that is easy to implement later assuming I data drive everything and store everything?

sentences:
Player sprite moving slower on iPhone 4 I just finished getting movement/jump animation for a player sprite in Xcode using Cocos2D. The basic movement algorithm is a timer that updates every 0.01 sec, changing the sprite position to (sprite.position.x + xVel, sprite.position.y + yVel). Each time a movement button is tapped, the appropriate velocity (initialized to 0) is changed to whatever speed I choose, then a stop movement button returns the velocity to 0. It's not an ideal solution but I'm very new at this and stoked to at least have that working with little help from the internet.

So I may not have explained that perfectly, but it is in fact working to my satisfaction in Xcode's iPhone Simulator, however when I build it for my device and run it on my phone, the sprite's movement speed is noticeably slower than in Xcode. At first I thought it must have to do with the resolution of the iPhone 4, making the sprite's movement path twice as long, but I found that if I pull up the multitask bar, then return to the app the speed will sometimes jump back to normal. My second theory was that the code is just inefficient and is bogging the processes down, but I would see this reflected in the frame rate wouldn't I? It stays at 59-60 the whole time, and the spritesheet animation runs at the correct speed.

Has anyone experienced this? Is this a really obvious issue that I'm completely missing? Any help (or tips for optimizing my approach to movement) would be much appreciated!

sentences:
How do graphics evolve so much on the same console hardware? Is it only a matter of code optimization?

Do game developers plan to start small on a new hardware, to have space to evolve while creating a series of that game?

Are computer graphics breakthroughs common enough to happen in a console lifetime?

sentences: Dynamic Aspect Ratio in Unity (for Anti-Aliasing) I am using HDRP with 1920x1080 resolution. The anti-aliasing works very well if the screen resolution increases and it works really bad if the screen resolution is lower than 1920x1080. Why does this happen? Is there a way to overcome this?

sentences:
How to find path in graph without crossing the walls? I would like to know how to find path in a graph while having the edges "double-sided". Consider this scenario:

I have list of the line segments. These represents "walls" or rather impassable edges (in a game). I then plan in a next step to build a connected graphs (where possible). I'm trying to determine the feasibility at this point. If there's even a solution to this (it should in my opinion).

I don't need to know about A* or other algorithms per se, but rather how to not walk through the walls as seen in figure B. Any ideas?

I was wondering if I could turn segments to polygons (by adding width). Then make an union of these polygons and then treat them rather as polygons. But I would like to know whether there is a way to do it without this hassle. Also I'm not sure I want to add any width to the lines necessarily.

sentences:
Change text of bus destination sign at runtime I have rigged a bus in blender and imported it into Unreal.

Now I want to change the text of the destination sign at run time.

How can i do this?

sentences:
How do I use threads together with DirectX11? I have only found the documents on MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476884(v=vs.85).aspx Although it doesn't say anything about creating them, it mentions that device is thread-safe while device context is not.

Does the framework use threads by itself (if driver supports it) when it thinks it's more optimal? Or do we have to use some external library like BOOST to play around with threads?

sentences:
add random walls with an array in 3D xna 4 I'm trying to add walls to my 3D game. I created a wall entity and added model array

public Walls()
{
  modelArray = new Model[10];
}

public void Initialize(ContentManager contentManager)
{
  for (int i = 0; i < modelArray.Length; i++)
  {
    rnd = new Random();
    sidesWall = rnd.Next(-4, 4);
    forwardWall = rnd.Next(-8, 0);
    modelArray[i] = contentManager.Load<Model>("wall");
  }
}

Draw method:

public void Draw(Camera camera)
{
  foreach (Model m in modelArray)
  {
    foreach (ModelMesh mesh in m.Meshes)
    {
      foreach (BasicEffect effect in mesh.Effects)
      {
        effect.EnableDefaultLighting();
        effect.PreferPerPixelLighting = true;
        effect.World = GetWorldMatrix();
        effect.View = camera.ViewMatrix;
        effect.Projection = camera.ProjectionMatrix;
      }

      mesh.Draw();
    }
  }
}

It doesn't work and it shows only one wall.

How can I make it work?

sentences: How can I apply steering behaviors to a car controlled with turning and acceleration? I feel like I've got my head around steering behaviors,  but I've having trouble applying them to a car. The steering behaviors return forces that one could apply to an object that can move in any direction, but a car can essentially only move forward and turn. I'm having trouble determining how hard the car should turn or how much it should accelerate forward based on the steering force. How can I translate a steering force into the car's input?

sentences:
Single texture or one texture per light for shadow mapping The basic implementations of shadow mapping that I have seen create a depth texture for each light source affecting the scene. I'm just curious as to why this might be done rather than using and reusing a single texture for all of the lights in the scene so as to save on memory.

To clarify, is there any benefit in the following:

for light in lights
    render scene depth to light.shadowTexture // One texture object per light
end

for light in lights
    render scene with light (blended)
end

as opposed to:

new Texture shadowMap // One texture object, written to by all lights

for light in lights
    render scene depth to shadowMap
    render scene with light (blended)
end

sentences:
How can I compensate for camera rotation changing PCSS penumbras? I am implementing PCSS and I am using a directional light. The directional light volume is clamped to the camera frustum (as is typical with directional lights). So when the camera rotates, the directional light volume can find a tighter bound on the camera frustum in some cases, and then all of the depth values can increase/decrease.

This causes the blocker search to find different blocker distances from the light source, and so the penumbra sizes change based on the camera rotation.

Has anyone dealt with this problem before? How can I compensate for changes to the light depth map (aka shadow map) when the camera rotates?

Here are some images demonstrating two camera views, visualizing the penumbra values (brighter indicates where a larger penumbra should go) and the corresponding light depth maps (shadow maps):

sentences:
Nifty Design view does not refresh I am using Nifty in JME SDK to make different screens. I stuck in this problem that nifty doesn't refresh its design preview to reflect any changes in xml.

But this works:
If I close .xml and reopen it changes are refreshed.

Its impractical and annoying to close/open xml each time to view changes in design. So if anybody know any patches or method to reflect changes in design as soon as we make changes in xml, it would be great.

sentences:
What is road map for Windows 3D game development in C# I used WPF 3D to make a demo program a while ago. I'm now want to give some other things a shot but find working in WPF 3D ... confining. I have looked at Managed Direct3D but read that it's dead. I have looked at wrappers for OpenGL but they seem to be work in progress or documentation/tutorial sparse. XNA seems like a decent platform but I have a feeling there is something better.

Does anyone know of a road map for C# 3D game development on Windows platform?

sentences:
OpenGL Maximal amount of debug string reached I was trying to check my current openGL code in gDEBugger, everything works fine.
But, I get these messages

Debug String: >>>>>>>>> 1
Debug String: >>>>>>>>> 2
Debug String: >>>>>>>>> 3
...
Debug String: >>>>>>>>> 497
Debug String: Maximal amount of debug string reached (500 strings).
              Additional debug strings will be ignored

What are these messages, everything in my code runs fine. But its troubling to see these debug strings.

sentences: How do I get the current location when using slick 2D library? I'm developing a map kind of simple game using slick 2D library, and I want to get the current location of the user.  When the user runs into a special location (ex: hole) to indicate that is dangerous. How can I achieve this?  I'm a new comer to games.

sentences:
nodejs game server timer I'm new to game server develop.
I'm developing a card game server.
How could I make nodejs server wait for few seconds then push data to client after an event fired ?
Example : in poker game, one player have about 20 seconds to make a move, after 20 seconds server will auto fold and then push a message to another player. How could I make server wait for 20 seconds and then do next action ?

sentences:
Calculate resources real-time. Sockets or not? I'm currenly developing a game in Javascript. It's a Single Page Application so every change should be pulled from the server without page refresh. I'm currently wondering how I should handle the 'resources in stock' (like wood, food and gold).

I know there are more questions like this around here (regarding websockets and Ajax requests) but I'm currently looking for the best solution in my specific case.

Scenario

Resources are produced every second. So for example, every minute 100 resources are produced. This should be updated live. I know, in this case it's not necessary to really update them live. I mean, I can simply calculate how much resources are produced in the current time minus the last updated time.

So no problem here, but there are a lot of different factors regarding the production of resources:

If a player is attacked, the enemy could have robbed some of his resources. So after an attack, the resources should be updated too.
If a player is attacked, and one of his 'productionbuildings' are damaged, he, for example, doesn't produce 1000 resources a hour, but 800 resources instead. So after a building has been demolished, the application should know the new building level to calculate the right amount of new resources.

Possibilities

So, how should I update the resources for the user? These are the options I think could possibly work:

Ping a script on the server, which calculates and updates the resources, every 5 seconds.
Set up a websocket stream and trigger it after each activity (after an attack, demolished building, ...)

Are there any other options? What would be the best way?

sentences:
Skipping glReadPixels and reading iPhone's "VRAM" directly I'd like to rapidly capture "screenshots" of my OpenGL ES iPhone game and turn them into a video.  I've tried the following approach (it works but degrades the game play to an unacceptable level):

Use glReadPixels to copy the data from the framebuffer to a GLubyte array.  Create a CGImageRef from that data.  Then create a CVPixelBuffer from the CGImageRef.  Finally append the CVPixelBuffer to an AVAssetWriter.

I've done a fair amount of additional research.  Some people suggest copying the framebuffer and reading that piecewise with glReadPixels.  This could work... but I don't know how to copy a framebuffer. (any help is appreciated!)

I just learned that the iPhone's "VRAM" is really part of the main memory.  How can I read the contents of a framebuffer from "VRAM" without calling glReadPixels?

Hopefully this approach (or similar) will keep the frame rate of the game acceptable.

sentences:
How to store level data in a libgdx game if implementing ECS pattern I am writing a beat'em up like game in Libgdx while following the ECS pattern brought up by ashley. For setting up the stage, I am using TileMap and Tiled. An object layer for collisions, and a tile layer for the tiles. Usually, an entity -in this case, an enemy- has a lot of components so harcoding one class for each stage on start up is out of the box. I have already considered this options:

SQLite database. Seems rather complex for the task, somehow.
Json files. I'd have to overwrite and create my own serialization class
Using another object layer for spawning enemies by using the "Custom attributes" option in order to store extra data.

Have anyone come up with a similar problem or experience already? What would be the best approach?

sentences:
Screen boundaries seem randomly placed I have a strange issue in which the characters boundaries work fine, however are placed at four seemingly random edges outside of the game view as a result of (I'm assuming) my player boundaries script.  The player actually stopping at the edges is working fine, the issue is just with the placement of those boundaries.  I'm following a tutorial, and the code is pretty much just copy/pasted, so I'm not sure what's going wrong.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PSBoundariesOrthographic : MonoBehaviour {
    public Camera MainCamera;
    private Vector2 screenBounds;
    private float objectWidth;
    private float objectHeight;

    // Use this for initialization
    void Start () {
        screenBounds = MainCamera.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, MainCamera.transform.position.z));
        objectWidth = transform.GetComponent<SpriteRenderer>().bounds.extents.x; //extents = size of width / 2
        objectHeight = transform.GetComponent<SpriteRenderer>().bounds.extents.y; //extents = size of height / 2
    }

    // Update is called once per frame
    void LateUpdate(){
        Vector3 viewPos = transform.position;
        viewPos.x = Mathf.Clamp(viewPos.x, screenBounds.x * -1 + objectWidth, screenBounds.x - objectWidth);
        viewPos.y = Mathf.Clamp(viewPos.y, screenBounds.y * -1 + objectHeight, screenBounds.y - objectHeight);
        transform.position = viewPos;
    }
}

Above is my boundaries script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class controlPlayer : MonoBehaviour
{
    public GameObject player;
    public float speed = 1000f;
    public GameObject left;

    bool _isLeftHeld;
    bool _isRightHeld;

    public void Update()
    {
        var movement = Input.GetAxis("Horizontal");

        // Ignore cases where neither/both left and right are held at once.
        if (_isRightHeld ^ _isLeftHeld)
        {
            // Override the movement input from the keyboard/joypad.
            if (_isRightHeld) movement = 1f;
            else movement = -1f;
        }

        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
    }

    public void HoldRight(bool held)
    {
        _isRightHeld = held;
        _isLeftHeld = false;
    }

    public void HoldLeft(bool held)
    {
        _isLeftHeld = held;
        _isRightHeld = false;
    }
}

My player controller.  I should add that hold left and hold right are controlled by two buttons placed accordingly on the screen.

sentences:
Is there a problem with using a 2D square grid for your world map? I'm making a game with a 2D square grid for my world map. It wraps around, so when you reach all the way north you start out in the south again, and when you go all the way east you wind up in the west, etc.

Would this method have any flaws? I'm under the impression there might be flaws around e.g. fast travel.

sentences:
DontDestroyOnLoad() doesn't work in Unity I have a problem with DontDestroyOnLoad() in Unity. It does not work!

My code:

private static PlayerSpawningScript instance;

public void Awake()
{
    Debug.Log ("PlayerSpawningScript awake");
    Debug.Log ("Instance: " + instance);
    if (instance == null) {
        Debug.Log ("Initializing PlayerSpawningScript instance");
        instance = this;
        DontDestroyOnLoad (gameObject);
    }
    if (instance != this) {
        Debug.Log ("PlayerSpawningScript instance exists. Destroying new copy.");
        Destroy (gameObject);
    }
    Debug.Log ("PlayerSpawningScript instance: " + instance);
}

public void OnDestroy()
{
    Debug.Log ("Destroying PlayerSpawningSceript instance: " + instance.ToString ());
}

Basing on the console output, I successfully create an instance in scene1, but when I change the scene, it gets destroyed - I know this because I get "Destroying PlayerSpawningScript (...)" before the new scene is loaded, and the same script set up in scene2 does not find an existing instance (which held data saved in scene1) and sets up itself as the instance instead of getting Destroyed. What am I doing wrong?

sentences:
Assigning relative force to a projectile fired while orbiting a sphere Projectile Not Correctly Inheriting Parent Velocity (Unity3D)

So I am trying to incorporate the above person's changes into a script I am making although

I'm no great coder and
I'm not even sure their solution works best for what I am doing.

Essentially what I have right now is a high speed shooter where the player is being pushed around as a physics object on a sphere world rather than using translate for movement. I keep finding solutions that would work really well if I was just translating through xyz space. Using a physics object for my projectile has been working well (I can shoot in one direction and have the projectile hit my in the back after circling around) but once I get up to speed I'm in trouble.

I think I've successfully incorporated the projectile portion into my script but currently it keeps shooting on the positive z axis.

On top of that, I'm not even sure where to start incorporating the second half.

Emitter Script

using UnityEngine;
using System.Collections;

public class SpaceShoot : MonoBehaviour
{
public GameObject Bullet_Emitter;
public GameObject Bullet;
public GameObject target; // Player

public float Bullet_Forward_Force = 100;
public float Bullet_Life = 60;
public float fireInterval = 0.05f;

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
        InvokeRepeating("Fire", float.Epsilon, fireInterval);
    if (Input.GetKeyUp(KeyCode.Space))
        CancelInvoke("Fire");
}

void Fire()
{
    GameObject Temporary_Bullet_Handler;
    Temporary_Bullet_Handler = Instantiate(Bullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;

    Rigidbody Temporary_RigidBody;
    Temporary_RigidBody = Temporary_Bullet_Handler.GetComponent<Rigidbody>();

    Temporary_Bullet_Handler.transform.Rotate(Vector3.left * 90);

    Rigidbody target_rigidbody;
    target_rigidbody = target.GetComponent<Rigidbody>();

    Temporary_RigidBody.velocity = target_rigidbody.velocity;

    Temporary_RigidBody.AddForce(transform.forward * Bullet_Forward_Force);

    Destroy(Temporary_Bullet_Handler, Bullet_Life);
}
}

Edited script as it currently stands. It mostly does what I need although I'm trying to figure out a way to clamp the distance to the origin.

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:
How to have qt5 work on desktop like on mobile devices (es2, correct glsl version)? I am looking for help/information concerning this issue :

My work: I have an opengl es2 render engine that works on an iOS app. I almost managed to make it work by calling the same openGL rendering engine from a Qt(4.8 first, then 5.0 since today) app with a QGLWidget. To support es2 function set my widget also inherits QGLFunctions (QtOpenGLFunctions with qt 5.0.0).

However I still have issues with shaders : I could not compile them on qt with glCompileShader because of almost every keywords (lowp, vec4, vec2 …) were returning compilations errors. So I compiled it with QOpenGLShader program, but I had to specify “#version 120”, the closest to es2. But still, my sprites don’t show up the right size and the only potentially influencing different pieces of code with iOS are in shader compilation / version. I think the issue in the shader is that gl_PointSize is not taken into account.

Is there any better way for me to have shaders compiled on qt like they are on iOS ? ( I know glsl es2 version is coming from version 120 but I don’t know to what extent they differ ).
The hello-gl-es2 example did not help me because glsl version also returns 1.20.

I’ll happily receive any hints, thank you !

My shaders, working well on iOS but not on Qt:

const GLchar vShaderStr[] =
#ifdef  __BUILD_DESKTOP__
"#version 120\n" // necessary for Qt to compile shaders
#endif //__BUILD_DESKTOP__
"attribute lowp vec4 Position;\n"
"attribute mediump vec2 TextureCoord;\n"
"attribute lowp float Weight;\n"
"uniform mat4 MVP;\n"
"varying mediump vec2 TextureCoordOut;\n"
"void main(void)\n"
"{\n"
"  gl_Position = MVP * Position;\n"
"  TextureCoordOut = TextureCoord;\n"
"  gl_PointSize = Weight;\n"
"}\n";

const GLchar fShaderStr[] =
#ifdef  __BUILD_DESKTOP__
"#version 120\n" // necessary for Qt to compile shaders
#endif //__BUILD_DESKTOP__
"varying mediump vec2 TextureCoordOut;\n"
"uniform sampler2D Sampler;\n"
"uniform bool IsSprite;\n"
"uniform lowp vec3 TextureColor;\n"
"uniform lowp float Opacity;\n"
"void main(void)\n"
"{\n"
"   lowp vec4 textureColorResult;\n"
"   textureColorResult = texture2D(Sampler,  IsSprite ? gl_PointCoord : TextureCoordOut);\n"
"   gl_FragColor = IsSprite ? vec4(mix(textureColorResult.rgb,TextureColor, 1.0),\n"
"                    textureColorResult.a * Opacity) : textureColorResult;\n"
"}\n";

Edit : replaced preprocessor QT_OPENGL_LIB with custom BUILD_DESKTOP as the first is no more declared in qt5.

sentences:
How i can make hole in objects in unity I need to have a hole in my objects and I don't want to use terrain.

I'd like to use an object and cut them out of another object, so that there is a hole in which the player could fall into; a 'game over' would happen.

sentences:
Which is better practice in Unity? GetComponent() or making the variable public? There are two main ways I am aware of to modify an attached component.
Say, the component attached to an object is  of type Animator and the name is animator.

So, in the script, I can write

private Animator animator;

and then call the function

animator = GetComponent<Animator>();

Or, I can define the variable as public

public Animator animator

and then, drag&drop in the Unity UI.
Which one is the better practice?

sentences:
How does one model the sun in a ray tracer? How is sun modeled when doing ray-traced rendering? Is it part of the scene, like a sphere with a centre in some far location or it is just considered as a point?

Also regarding sending shadow rays to the sun, is it, again, sampling a sphere or just sending shadow rays to one point?

sentences:
Deferring royalties for assets until revenue is earned I am developing a game and I want to use some assets that are available online for a fixed price, I want to sell my game and actually make money off of it. I have contacted the owners and they will sell it to me for a fixed price to use commercially. However, I am on a very limited budget and don't really want to pay up front for the assets.

What I want to know is how to defer the costs contingent on whether I make any money. In other words, they give me the models, and then I promise to pay them back out of the first revenue. If the project dies, I'm  not out any money.

Other than my word as an honest guy, how could I convince them to agree to this? Would they charge me more because of risk involved?

sentences:
How to get character position in 2D map array by its position on canvas My arrayMap consists of 0, 1 and 2. 0 is water and character is allowed to be on. 1 and 2 are ground and the collision should happen.

To get and check what array number the character is standing on, I take the character position and divide it by my tileset size which is 36px and use Math.floor to round the number. I place it like this: console.log(mapArray[Math.floor(boatPosX / 36)][Math.floor(boatPosX / 36)]); and I know if its 0, 1 or 2 he is standing on. Which is great so far. But my collision still doesn't work the way it should. Actually it acts so weird I don't even know how to fix it properly. If I put some 1 in my player start position, I get collision, but if I place it at 0 in array and move onto 1 myself, it doesn't work.

So it's giving me different results every time. I feel like I'm almost here but some stupid bug is ruining it all.

var mapArray = [
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 1, 0, 0, 0],
  [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
];
function isPositionWall(ptX, ptY) {
  var gridX = Math.floor(ptX / 36);
  var gridY = Math.floor(ptY / 36);
  if(mapArray[gridX][gridY] == 1)
    return true;
}

var boatPosX = canvas.height/2 - 50;
var boatPosY = canvas.height/2 - 50;

function render(viewport) {
  context.save();
  context.translate(view.x, view.y);
  requestAnimationFrame(render);
  var oldPosX = boatPosX;
  var oldPosY = boatPosY;

  for (let i = 0; i < mapArray.length; i++) {
    for (let j = 0; j < mapArray[i].length; j++) {
      if (mapArray[j][i] == 0) {
        this.sprite.draw(
          background,
          190,
          230,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );
      }
      if (mapArray[j][i] == 1) {
        this.sprite.draw(
          background,
          30,
          30,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );

      }
      if (mapArray[j][i] == 2) {
        this.sprite.draw(
          background,
          200,
          20,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );
      }
    }
  }
  this.ship.drawimage(boat, boatPosX, boatPosY, 50, 50);

  if(isPositionWall(boatPosX, boatPosY)) {
    //boatPosX = oldPosY;
    console.log("collision");
  }
  console.log(mapArray[Math.floor(boatPosX / 36)][Math.floor(boatPosX / 36)]);
  context.restore();

};

function move(e) {
  if (e.keyCode == 39) {
    boatPosX += 5;
    view.x -= 5
    moveCount++;
    console.log(moveCount);
    console.log("right");
  }

That's parts of the code that are related to the question. If you need need more code, let me know. I'm looking for some directions what I'm doing wrong. Thanks.

Codepen: https://codepen.io/Limpuls/pen/deEGXX

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: Implementing powerups for my Breakout clone I'm making a simple Breakout clone in Python that will have very many powerups/powerdowns (so far I came up with 26). Some will affect the paddle (paddle missile, two paddles, short paddle, etc.), some will affect the ball (slow ball, destructo-ball, invisible ball, etc.), some will affect the bricks (brick scramble, move up, bricks indestructible, etc.), and some will affect other game aspects (extra life, more points, less points, etc.). I'm pretty sure I have the code to draw the falling powerups and test for collisions with the paddle down, but I'm confused about how to code the effects of the powerups. Since there are very many powerups, it seemed inefficient to add specific methods to each component as done in this tutorial. However, I can't think of an other ways to implement the powerups. I found a page that hints at some way to design powerup behavior using classes, but I'm at a loss for how to do that. (A short example would help.) Please give me a short code example of another way to implement the effects of the powerups.

sentences:
OcclusionQuery: how to ignore some objects? I'm trying to make a LensFlare effect when the player watch the sun in my XNA 4.0 Game.

To do this, I use OcclusionQuery, here's my code:

http://pastebin.com/meAkdwmD

I also have some models, a terrain and a skybox.

Here's my main Draw code:

terrain.Draw();
model1.Draw();
model2.Draw();
skybox.Draw();
lensFlare.UpdateOcclusion();
lensFlare.Draw();

The problem is that the occlusion considers the sun to be behind the skybox, and the lensFlare wasn't showing up.

So I moved lensFlare.UpdateOcclusion() before the drawing of the Skybox, and now the lensFlare appears, but my skybox is blinking (it's like it disappear and reappear at each frames...)

How do I ignore the skybox in the occlusion?

sentences:
HTML5 or Javascript game engine to develop a browser game I would like to start developing a MMO browser game, like Travian or Ogame, probably involving also a bit of more sophisticated graphical features such as players interacting in real time with a 2d map or something like that.

My main doubt is what kind of development tools I should use: I've a good experience with PHP and MySQL for the server side and Javascript (and jQuery) regarding the client side. Coding everything from scratch would be of course really painful so I was wondering if I should use a javascript game engine or not. Are there (possibly free) game engine you would recommend? Are they good enough to develop a big game?

Also, I saw a lot of HTML5 games popping up lately but I'm now sure if using HTML5 is a good idea or not. Would you recommend it? What are the pro and cons about using HTML5? If you'd recommend it, do you have any good links regarding game development with HTML5?

(PS: I know that HTML5 and a Javascript engine are not mutually exclusive, I just didn't know how to formulate a proper title since English is not my main language. So, please, answer addressing HTML5 and a game engine pro and cons separately)

sentences:
How can I remove Magic Pink from an image at runtime using GraphicsDevice? In XNA 4.0, I want to load all my textures at runtime, which means I will not be able to take advantage of the content processor. (This is fine because it would allow people to change graphics and other elements without having to have XNA installed to compile them into .xnb)

Suppose that I can't (or don't want to) use premultiplied alpha on my images, and instead rely on the classic magic pink (255, 0, 255) method:

How can I turn it into a Texture2D object and convert the pink to be transparent using GraphicsDevice? It is trivial to iterate the data with GetData() and SetData(), but this uses the processor, rather than the graphics card.

sentences:
Kinematic equations script fail I added the kinematic equations to my code and now none of it works.   I get the error rigidbody.torque assign attempt for 'Enemy' is not valid. Input torque is { 0.000000, NaN, 0.000000 }.
UnityEngine.Rigidbody:AddTorque(Vector3)
EnemyBehavour:FixedUpdate() (at Assets/_Scripts/Baddies/EnemyBehavour.cs:61)

it should be fine as far as I can tell, please help.

//speed of enemy
public float speed = .5f;
//base distance enemy will attack player
public float range = 3f;
//how far back enemy will stand
public float stopDistance;
//what the enemy will pursue
private GameObject target;
//targetable Enemies
private GameObject[] targetable;
//itself
private Rigidbody self;
//distance to check against
private float saveDistance;
//get the mass for physics stuff
float mass;
//gets drag for physics
float drag;
//gets angular drag for physics
float adrag;
//checks distance
float distance;
//the player
GameObject player;
GameObject[] turrets;
//the base
GameObject playerBase;
EnemyShoot Shoot;

void Start () {
    //get own rigidbody
    self = GetComponent<Rigidbody> ();
    //playerbase should be obviouse
    playerBase = GameObject.FindGameObjectWithTag ("Base");
    target = playerBase;

    Shoot = GetComponentInChildren<EnemyShoot> ();

    mass = self.mass;
    drag = self.drag;
    adrag = self.angularDrag;
}

void FixedUpdate () {
    target = FindFoe ();

    //checks range and
    if (Vector3.Distance (transform.position, target.transform.position) > range || target == playerBase) {
        target = playerBase;
    }
    Vector3 acceleration = AnglularAcceleration ();
    Vector3 torque = new Vector3 (0f, acceleration.y * mass,0f);
    print (torque.ToString ());

    //look at the pursueing target
    self.AddTorque (torque);
    //move towards the pursuing target
    self.AddForce (transform.forward * speed);

}

Vector3 AnglularAcceleration () {
    // the variables to figure out
    Vector3 AnglAcc;
    float radius;
    Vector3 theta;
    float time;

    //get the radius
    radius = Vector3.Distance (transform.position, target.transform.position);
    //get the dot product between the two points
    float dot = Vector3.Dot (new Vector3 (transform.position.x, 0f, transform.position.z),new Vector3 (target.transform.position.x, 0f, target.transform.position.z));
    //get the arccosine of the angle and convert that to radians
    theta = new Vector3 (0,(Mathf.Acos(dot))*180,0);
    print (theta.ToString ());

    //now find the time
    time = (2f * theta.y) / speed;
    AnglAcc = new Vector3(0f,(speed * speed) / (2f * theta.y),0f);

    return AnglAcc;

}

//checks if turrets or player is within range
GameObject FindFoe() {
    distance = range;
    targetable = GameObject.FindGameObjectsWithTag ("ETarget");

    //sets player base as default target

    foreach (GameObject test in targetable) {
        GameObject testing = test.transform.parent.gameObject;
        print (testing.ToString());
        saveDistance = Vector3.Distance (transform.position, testing.transform.position);
        if (saveDistance < distance) {
            distance = saveDistance;
            print (saveDistance.ToString());
            target = testing;
        }

    }
    return target;

}

}

sentences:
Create Full Tile Map Zone in an Art Software, then generate corresponding tile name list? I'm completely new to tile map creation. I'm a programmer and I'd like to make life easier for myself. It's a bit long to explain the problem I think I have, but bear with me.

The Scenario:
From what I understand, in my code I need an array which holds my tile information for a zone/area in my game. Lets say for simplicity this zone was a 10x10 grid, so 100 indexes in the array. Now, lets say each index holds a number that corresponds to a specific tile. ex) Number 1 means grass tile. Number 4 means rock tile. etc.

So far so good. From this array (and additional coding), my tile map will be generated on my game screen.

The problem:
As it stands I have to individually type each tile identifier for each index in the array. Now let's say that I have already fully designed the visual tile grid map for my zone in a particular art software. Simply put, I am staring at my fully completed zone in my art software screen and it is my visual aid for creating my array. My strategy now is to look at each grid cell, see what tile I put in there, and type its identifying number into my array. Rinse and repeat hundreds of times, looking at each individual tile until I manually complete the array. This is an extremely tedious and long process.

What I want:
So my full tile map is already in my art software. What I want is for the software to more or less generate the array for me! I press a button, and It will see what tile is in each grid square, and accordingly generate a list in a text document with each tile's identifying number that I give it. That's literally all I need. I can then copy and paste the list into my array in my code. It shaves off tons of time.

The Question:
Notice that I have used the generic term "art software". Is there any art software that can do what I described? Is there any art software (e.g. adobe illustrator, photoshop, gimp, etc.) which upon having a fully completed tile map, will be able to generate a text file list of each tile's identifying name?

sentences:
Generate screen space distance field from depth buffer I've been wanting to try out raymarching on real 3D scenes to implement effects like AO, soft-shadows and such.

I pretty much know how to use signed distance functions (as described by Inigo Quilez) to approximate a model and raymarch it, but I want to have way more precision and have the distance field of my scene.

How would you go about generating a (un)signed distance field from the depth buffer in screen space ? Or would the usual depth buffer be usable as a distance field (I don't think so) ? Or there might be better ways that don't use the depth buffer ?

sentences:
per-pixel collisions using Libgdx Java (is there existing class for this??)? I am making a simple side scrolling space shooter game using Libgdx and everything is going nicely. However until now I haven't been testing collisions for my players ship with other ships. I have lasers colliding with baddie ships using simple rectangle overlap method that exists already in libgdx.

But the "white/transparent" space around the edge of many of my sprites is quite a lot and when i am now applying the code to check collision with my player it is happening from a long way off from actual collision.
In the past I used XNA Framework C# and there was quite a simple way to do a box collision and then within that test if both pixels in question where transparent and ONLY WHEN both pixels were NOT transparent would it return true as a collision.

I'm really struggling to find this method or how to implement this using LibGDX , can anyone help me out here??

Here is the code snippet in question, if you need the full games code please let me know:

        if (ship.getBoundingRectangle().overlaps(baddiePurple.getBoundingRectangle())){
        purpleDyingSound.play();
        KillPurpleSoloEnemy();
        game.setScreen(new MenuScreen(game));
    }

Of course I'm aware that I could just trim down all the images to have almost zero transparent edges but the problem with doing that is they are animated sprites in sprite-sheets and i can't get them into the right position if I try that. (Also, I plan on having LOTS of different enemies etc and trimming would be a major ballache)

THANKS IN ADVANCE FOR ANY HELP! peace out!

sentences:
UNITY : passing metalic map from Blender to Unity automatically? I have .blend file contains very basic material shader structure (no fancy nodes), just add some textures (diffuse, normal, roughness, metallic etc) . When i imported the .blend file as prefab in unity (and copy all necessary texture/map to unity asset folder ) , the blender shader can pass albedo and normal maps (automatically) without problem. But it never be able to carry metallic map (or any other maps)
Right now i have to rebuild the metallic map within unity manually.
I'm just curious if unity can only recognize albedo and normal map from blender shader ? How about the other map ? How about metallic or smoothness/roughness etc ?

sentences:
Monogame project runs in VS but hangs when run via .exe I've been working on a monogame project for a little over a week and had no problems. Today I went to test out the project outside of Visual Studio, by running directly from the .exe in the release folder. When I click on the .exe I get the cursor icon indicating something is loading, but nothing ever does. No window shows up, even though I see processes related to my game in the task manager. Also when I try to end mygame.exe in the taskmanager it doesn't work and the process still sits there.

I've tried both a Windows and Windows OpenGL monogame project and both hang once I click the exe. Does anyone have any idea why this may be or any steps I might take to track down the issue?

I'm using Windows 7, Visual Studio Community 2015 and the latest Monogame Build. My project references Farseer Physics, Lidgren, Json .Net, and my own Utility class library.

Edit: I tried creating a brand new Monogame project and run it without debugging in VS and it hangs the same way running from the .exe does. Also the project runs when placed on my laptop which also has monogame installed so it's nothing wrong with the project.

sentences:
How do I calculate UV space from world space in the fragment shader? In my vertex shader I have calculated the world space

o.worldSpacePosition = mul(unity_ObjectToWorld, vertIn.vertex);

How do I convert that world space into uv space coordinates in my fragment shader?

        float4 frag(VertexShaderOutput i) : COLOR //SV_Target0
        {
            // float2 uv = i.worldSpacePosition ???

        }

I have tried

float4 mvp = UNITY_MATRIX_MVP[3];
float2 uv = mvp.xy /= p.w;

but that does not appear to work as the uv is always (0, 0)

EDIT:

I am drawing a mesh on the screen in world space coordinates which needs to lookup into a screen space texture:

The way I am currently solving this is by calculating the uvs for each vertex of the mesh using the following calculation:

camera.WorldToViewportPoint(vertices[i]);

Unity uses normalised coordinates for the viewport [0,1] rather than [-1,1].

This works fine but I wasn't sure of the behaviour if part of the polygon is off the screen.  I presume I should clamp the uv?

Screen space might not be the correct term for the uv coordinates.  Perhaps texture space is a more appropriate term?

sentences:
Vector3.Angle() Never Reaching 0 I'm having trouble understanding why with this script, Vector3.Angle() sometimes will never reach 0.

This question comes from me trying to make a "turret" that rotates to face a target position. It was not quite working (the angle between the turret and target would get very close to 0 and start flipping between + and - values, and never actually 0).

So to debug it I stripped the script down, and used transform.LookAt(), trying to isolate the problem. However, even using LookAt(), the Vector3.Angle() method still -sometimes- refuses to report the angle as 0, and I'm not sure why.

                //Turret does not care about any Y position differences...
                Vector3 currCustom = currentTargetPosition;
                currCustom.y = transform.position.y; //ignore Y differences...
                Debug.Log("currCustom is: " + currCustom);

                Vector3 directionVector = currCustom - transform.position;
                Debug.Log("directionVector is: " + directionVector);

                float angle = Vector3.Angle(transform.forward, directionVector);
                Debug.Log("angle is: " + angle);

                transform.LookAt (currCustom);

The attached image should also help demonstrate what is going on (note that the object doing the checking is an empty GameObject located roughly where the orange square is).

Any ideas as to what I'm doing wrong are appreciated, thank you for reading.

sentences:
Using Delta for a stopwatch, delta too fast than real time seconds I search for methods to create a stopwatch on libgdx and came across with this:

public void trigger(float delta){

    playTime += delta;
    playTimeRounded = ((double)Math.round(playTime * 100) / 100);
    Gdx.app.log("deltaTime", delta + "");
}

But its not accurate and its much faster. How can i create an accurate stopwatch?

sentences:
Is computing depth in a pixel shader bad? Can I reduce fillrate by moving depth calc to vertex shader? I have a DX10 game that is fillrate bound. One of the things I've been realizing may be contributing to this is that I compute depth in the pixel shader (the game uses a logarithmic depth buffer to get extreme precision from 1cm to millions of meters away).

It occurred to me that writing the depth in the pixel shader is ruining the ability to to Early Z testing.

Can this be fixed by outputting this computed depth value in the vertex shader instead?

sentences:
OpenGL camera translate and rotate on cameras local axis How can I make rotation and translation on a local camera axis in OpenGL?
I want to make camera like "aeroplane" camera with a pitch yaw and roll.
I want to have good explanation on everything!

Can the solution be with gluLookAt maybe and be without gimbal lock?

sentences:
C++ turning towards mouse I'm creating an attack boat game in c++ and I have an issue with my boat following the mouse around the screen. My plan is to have the boat follow the mouse more like a boat (slow rotations, instead of instantaneous whilst taking about 4 seconds to do a 360 turn) and for the most part it does what it should.

The bug happens when the mouse is on the left side of the screen (as soon as my mouse crosses the -x axis),  as the boat follows the mouse, the boat turns in the wrong direction and does a 360, instead of following the mouse.

This is the code i'm using to do my boat turning.

        angle = atan2(delta_y, delta_x) * 180.0 / PI;

        //Rotate the boat towards the mouse and
        //make the boat turn more realistically
        if (angle - rotate > 0) {
            rotate += 1.0f; // turns left
        } else if (angle - rotate < 0) {
            rotate -= 1.0f; // turns right
        }
        if (angle - rotate >= 360.0f) {
            rotate = 0.0f;
        }`

sentences:
Canvas/Paint Mechanic I'm currently working on an idea for a Unity game app with a canvas mechanic. I understand I may have to use particles for the brush/paint f/x however I can not think of a way to add collision detection let alone the paint itself...onto a canvas...
Any suggestions are much appreciated!

sentences:
Running Unreal Build Tool with CreateProcess vs command line I'm working on a tool that generates some files for Unreal Projects. The only thing is if I try to get it to compile the project through CreateProcess the command doesn't run the same as the command line. I just get an error message from UBT about rule files not existing.

Command being run from CreateProcess:

STARTUPINFO si;
PROCESS_INFORMATION pi;

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));

CreateProcess("C:/path/to/UnrealBuildTool.exe",
       "ProjectEditor Win64 Development C:/path/to/project.uproject -waitmutex -Deploy",
            NULL,
            NULL,
            FALSE,
            0,
            NULL,
            NULL,
            &si,
            &pi
        );
WaitForSingleObject(pi.hProcess, INFINITE);

CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);

In the command line C:\path\to\UnrealBuildTool.exe ProjectEditor Win64 Development C:\path\to\project.uproject -waitmutext -Deploy successfully compiles the project from any directory. Is there any other variables I need to pass into CreateProcess to get this command to run?

EDIT: Adding space to the start of the argument string fixed the issue. Is there any reason why Windows would need that space?

sentences:
svg spaceship game movement 2d I've been searching for a way to make an svg box move to all directions using js. I have seen many tutorials on how to do it grid like, but I want it so have a square that can turn, move forward, backwards and sideways. In terms of movement, I want to be like https://www.chromeexperiments.com/experiment/arena5 except there will be a square instead of a triangle and there will be no enemies.

My problem is that I don't know how to make an svg square move fluidly and without a grid, but the movement will only use keyboard, no mouse. Please be patient I'm new to js gaming.

Here is the most reason version of what I've trying, this is svg, right now I'm trying to make it in canvas.http://codepen.io/julian-a-avar/pen/PqZvxp

sentences: How can I edit a float that is in another script? (In C#) So basically, I have one script for the UI, which holds the float, score. Then I also have another script on my coin that detects when the player collides with it. What I want it to do is change the value of score, but I don't know how to change it, as it is in the UI script. How can I do this?

sentences:
Loading FBX Files into a DirectX 9 Application I'm having an extremely difficult time trying to convert an FBX file into a format that can be used with DirectX. I've read a lot of articles on forums all over the internet and have followed instructions carefully but have not yet been successful in loading a skinned mesh from an FBX file.

As I understand it, I am required to set the 'Bone Offset' field of a DirectX skinned mesh frame to the inverse bind pose of the bone which I can get using FBX SDK like so:

            // iterate deformers( TODO: ACCOUNT FOR MULTIPLE DEFORMERS )
            for(int i = 0; i < ncDeformers && i < 1; ++i)
            {
                // skin
                FbxSkin *pSkin = (FbxSkin*)pMesh->GetDeformer(i, FbxDeformer::eSkin);
                if(pSkin == NULL)
                    continue;

            // bone count
            int ncBones = pSkin->GetClusterCount();

            // print
            printf("\n\t::Skin Found::");
            printf("\n\t\tBone Count: %i", ncBones);

            // iterate bones
            for (int boneIndex = 0; boneIndex < ncBones; ++boneIndex)
            {
                // cluster
                FbxCluster* cluster = pSkin->GetCluster(boneIndex);

                // bone ref
                FbxNode* pBone = cluster->GetLink();
                FbxNode* pParentBone = pBone->GetParent();

                // Get the bind pose
                FbxAMatrix bindPose,
                    inverseBindPose,
                    transform;
                cluster->GetTransformMatrix(transform);
                cluster->GetTransformLinkMatrix(bindPose);

                // inverted global transform * transform
                inverseBindPose = bindPose.Inverse();

                // set bone offset
                pSkinnedMeshContext->SetBoneOffset(boneIndex, inverseBindPose);
    ...
}

Then I get animation like this:

// for each key
for (int keyIndex = 0; keyIndex < ncKeys; keyIndex++)
{
    // get time object
    FbxTime curtime = std::min(stop.Get(), start.Get() + (interval * keyIndex));

    // node transform at time T
    FbxAMatrix mKeyValue = pAnimEvaluator->GetNodeGlobalTransform(pNode, curtime);
}

Then in my renderer I have this:

Matrix[] maPalette = new Matrix[8];
for(int iBone = 0; iBone < boneCombination->BoneCount; ++iBone)
{
    Matrix mBoneTransformAtTimeT = maPalette[iBone] = meshContainer.BoneOffsets[iBone] * meshContainer.Palette[iBone].CombinedTransform;
}

effect.SetBoneTransforms(maPalette);

The model, however, is disfigured...
skinned mesh:

standard mesh:

What is the proper way to evaluate the transforms for a skinned mesh when converting from FBX to DirectX 9?

sentences:
What is closing and separating velocity in Ian Millington's game physics book? I'm working on a physics engine in C++ and chose Ian Millington's Physics Engine Development book as a guide and reference to help me out understand physics concepts and how to implement them.
Yesterday I was reading through the Hard Constraints chapter, particularly the simple collision resolution section and came across an explanation of a physics formula that I couldn't fully comprehend. Millington says "The closing velocity is the total speed at which two objects are moving together" and it is calculated with the following formula:
$$V_c= \dot{P}_a\cdot(\widehat{P_b-P_a})+\dot{P}_b\cdot(\widehat{P_a-P_b})$$
Where \$V_c\$ is the closing velocity, \$P_a\$ and \$P_b\$ are object \$a\$ and \$b\$ respectively. Also he further discusses another formula called the separating velocity which is written as follows:
$$V_s=(\dot{P}_a-\dot{P}_b)\cdot(\widehat{P_a-P_b})$$
Where \$V_s\$ is the separating velocity. Now I don't really understand what these formulas actually are or what they represent in the physics world. I also have trouble wrapping my head around why we need these formulas to perform collision resolution since he used the separating velocity formula to resolve the velocity upon collision and why we need the dot product. It would be really helpful if someone can provide visual explanation that would significantly help me understand what's going on.

sentences:
Is it possible to get object rotation in a shader for dynamically batched objects? All the batched objects have the same rotation. To simulate the effect of directional light I need to determine the object sides actual (world) directions. Normally I would use unity_ObjectToWorld & unity_ObjectToWorld for that, which is not possible when the objects are batched.
Is it possible to pass the object rotation to the shader in one action (since it's the same for all of them) without breaking the batching?

This is a simplified shader example (here I use colors instead of light/shadow effect and only 2 sides instead of 4):
Shader "Test/UnlitTest"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _TopColor ("TopColor", Color) = (1, 0, 0, 1)
        _BottomColor ("_BottomColor", Color) = (0, 0, 1, 1)
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        ZTest Off
        ZWrite Off
        Lighting Off
        Cull Off
        Fog { Mode Off }

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

            sampler2D _MainTex;
            float4 _MainTex_ST;
            float4 _MainTex_TexelSize;
            fixed4 _TopColor, _BottomColor;

            struct vertData
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct fragData
            {
                float2 uv : TEXCOORD0;
                float2 uvW : TEXCOORD1;
                float4 vertex : SV_POSITION;
            };

            fragData vert (vertData v)
            {
                fragData f;
                f.vertex = UnityObjectToClipPos(v.vertex);
                f.uv = TRANSFORM_TEX(v.uv, _MainTex);
                f.uvW = mul(unity_ObjectToWorld, f.uv);
                return f;
            }

            fixed isTransparentPixel(fixed2 uv)
            {
                return step(tex2D(_MainTex, uv).a, 0.0);
            }

            fixed isEdgePixel(fixed2 uv)
            {
                uv = mul(unity_WorldToObject, uv); // back to object space
                return isTransparentPixel(uv);
            }

            fixed4 frag (fragData f) : SV_Target
            {
                fixed isTransparent = isTransparentPixel(f.uv);
                clip(-isTransparent);

                fixed4 c = tex2D(_MainTex, f.uv);
                float2 borderSize = float2(3, 3); // border size in tex pixels
                float dy = borderSize.y * _MainTex_TexelSize.y;
                fixed3 borderColor = fixed3(0, 0, 0);
                float borderColorsCount = 0;
                float2 uvW = f.uvW; // UV in the world space

                // Top edge:
                fixed isEdge = isEdgePixel(uvW + float2(0, dy));
                borderColor += isEdge * _TopColor.rgb;
                borderColorsCount += isEdge;

                // Bottom edge:
                isEdge = isEdgePixel(uvW + float2(0, -dy));
                borderColor += isEdge * _BottomColor.rgb;
                borderColorsCount += isEdge;

                fixed noBorderColor = step(length(borderColor), 0);
                fixed hasBorderColor = 1 - noBorderColor;
                c.rgb = c.rgb * noBorderColor + hasBorderColor * borderColor / max(borderColorsCount, 1);
                return c;
            }
            ENDCG
        }
    }
}

It gets a semi-transparent image as a texture. The image is completely transparent at the edges and contains an opaque shape in the center.

The shader colors the top edges of the non-transparent shape in red and the bottom ones in yellow. It uses unity_WorldToObject & unity_ObjectToWorld to check the edges facing directions in the world space.

sentences:
Box2d: High screen resolution / frequency causes high friction? I'm using Cocos Creator with (built-in) box2d for physics.
Recently our game behaves weirdly on our new device Galaxy S20 Ultra 5G - which has screen size = 1440 x 3200 - frequency = 120Hz.
After stop pushing, all our physical bodies almost stop immediately like they has very high friction. No other device react that way.
Anyone experienced this issue can give me an advice?

sentences: Show Camera Inside Object Bounds I'm making a mobile game, and I want have secondary camera that shows another part of the scene within a box. I'm able to do this easily enough by setting the camera's viewport settings, but the issue I'm having is when you change the screen size, the camera size changes with the screen no longer looking like it shows in the box (The box doesn't expand/contract with the device's screen size). Is there a way to set the camera's size an position relative to a game object? This is what I'm trying to do:

sentences:
How to get plane geometry associated with primitive 3d plane in unity3d I assume there should be a plane (struct) associated with a primitive 3d plane in unity3d, how to get that?
Or if not associated, can we build plane struct object somehow using corner vertices of 3d plane. Can somebody help me how to get cornor vertices of 3d plane mesh.

Update:
What I am trying to achieve is to use Plane.Raycast on a 3d Plane, but I am not certain whether there is any plane geometry component associated with it, or Is there any way to build a plane geometry which should be going through all the corners of the 3d plane, so that I'll be able to use Plane.Raycast from the normal direction of 3d plane towards itself.

sentences:
How can I places objects to specific facial landmarks ? like ears and hats I'm currently trying multiple AR plugins in unity and I'm stuck in how to place certain objects in specific landmark positions.
I used the landmark positions to spawn certain objects but they are way off from the intended areas I wanted.

Here is the code sample I'm using the get the facial landmarks of the ears, mouth, nose and eyes :

MatOfPoint2f imagePoints;
imagePoints = new MatOfPoint2f ();
Mat rgbaMat = webCamTextureToMatHelper.GetMat();
Rect detectionResult = faceLandmarkDetector.Detect();
List<Vector2> points;
if(detectionResult != null && detectionsResult > 0)
    points = faceLandmarkDetector.DetectLandmark(detectionResult[0]);
if(points != null)
{
imagePoints.fromArray(
new Point((points[38].x + points[41].x) / 2, (points[38].y + points[41].y) / 2), //Left Eye Facial LandMark Position
new Point((points[43].x + points[46].x) / 2, (points[43].y + points[46].y) / 2),// Right Eye
new Point(points[30].x, points[30].y), //Nose
new Point(points[0].x, points[0].y),Left Ear
new Point(points[16].x, points[16].y) Right Ear

);
}

sentences: What is a good tool for producing animated sprites? Has anyone come across a software package that allows you to build animations in a similar way to how you can in Flash (i.e. using techniques such as tweens & bones & easings, etc) and then have the result exported as a sprite sheet?

sentences: What is "ROAM" related to terrain rendering? I saw it mentioned on this question, but no one explained what it is.

sentences:
What formula does this projectile velocity code derive from? //Calculate the velocity needed to throw the object to the target at specified angle.
float projectile_Velocity =
            target_Distance / (Mathf.Sin(2 * firingAngle * Mathf.Deg2Rad) / gravity);

Which formula is used to derive this projectile code?

sentences:
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:
Tactics for moving the render logic out of the GameObject class When making games you often create the following game object from which all entities inherit:

public class GameObject{
    abstract void Update(...);
    abstract void Draw(...);
}

So in you update loop you iterate over all the game objects and give them a chance to change state, then in the next draw loop you iterate again over all the game objects and give them a chance to draw themselves.

Although this works fairly well in a simple game with a simple forward renderer it often leads to a few gigantic game objects that need to store their models, multiple textures and worst of all a fat draw method that creates a tight coupling between the game object, the current render strategy and any rendering related classes.

If I were to change the render strategy from forward to deferred I would have to update a lot of game objects. And the game objects I make are not as reusable as they could be. Of course inheritance and/or composition can help me fight code duplication and make it a bit easier to change implementation but it still feels lacking.

A better way, perhaps, would be to remove the Draw method from the GameObject class altogether and create a Renderer class. The GameObject would still need to contain some data about it's visuals, like what model to represent it with and what textures should be painted on the model, but how this is done would be left to the renderer. However there are often a lot of border cases in rendering so although this would remove the tight-coupling from the GameObject to the Renderer, the Renderer would still have to be all knowing about all the game objects which would make it fat, all knowing and tightly-coupled. This would violate quite a few good practices. Maybe Data-Oriented-Design could do the trick. Game objects would certainly be data, but how would the renderer be driven by this? I'm not sure.

So I'm at a loss and can't think of a good solution. I've tried to use the principles of MVC and in the past I had some ideas about how to use that in games, but recently it doesn't seem as applicable as I thought. I would love to know how you all tackle this problem.

Anyway let's recap, I'm interested in how the following design goals can be achieved.

No rendering logic in the game object
Loose coupling between game objects and render engine
No all knowing renderer
Preferably runtime switching between render engines

The ideal project setup would be a separate 'game logic' and render logic project that don't need to reference each other.

This thought train all started when I heard John Carmack say on twitter that he has a system so flexible he can swap out render engines at run time and can even tell his system to use both renderers (a software renderer and a hardware-accelerated renderer) at the same time so he can inspect differences. The systems I've programmed so far aren't even near that flexible

sentences:
Not repeating background in platformer I need to make not repeating background for platformer. I can't find any description of implementation and I developed algorithm but I'm not sure that it's right.

I can't load one big texture per level, because many devices don't support textures more than 2048x2048 pixels and my levels require 4096 pixels at least on the one side. Therefore I have to cut big texture into smalls(512x512, 1024x1024), load them using separate thread and render. Picture shows it:

Green rectangle is screen(for example Nexus S with display 800x480)

Problems:

In case 2 layers I have to keep in memory 4 big textures.
I have to constantly load and unload big textures.
Additional thread.

If it's not problems then ok :) But it seems that I'm doing something wrong.

sentences:
Graphics, drawing triangles I'm very new to the world of Computer Graphics, and I'm struggling to find resources to help me understand how to draw my mesh (I have loaded everything into vertex and index buffers), I am not using a 3D API, instead I am just using C# and a 2D Graphics canvas to draw my mesh.

Everything is currently loading, but I have suspicions that I am reading my faces in as quads instead of triangles, could somebody A) Clarify whether I am draw a quad instead of a triangle B) If I am drawing quads, how do I draw a triangle? This has been a headache for me for a few hours...

for (int i = 0; i < m_numFaces; i++)
{
     Face face = m_meshData[i];

     // Draw the face
     for (int j = 0; j < 3; j++)
     {
                m_graphicsContext.DrawLine(m_pen,
                     // Get the X,Y points of this face
                     (int)face.GetPointAtIndex(j).points[0],
                     (int)face.GetPointAtIndex(j).points[1],
                     (int)face.GetPointAtIndex(j + 1).points[0],
                     (int)face.GetPointAtIndex(j + 1).points[1]);
     }
                // Draw from first point back to last line
                m_graphicsContext.DrawLine(m_pen,
                     (int)face.GetPointAtIndex(2).points[0],
                     (int)face.GetPointAtIndex(2).points[1],
                     (int)face.GetPointAtIndex(0).points[0],
                     (int)face.GetPointAtIndex(0).points[1]);
}

sentences:
How do I compute the point of a triangle-ray intersection? I have a line (the direction vector of the player) and a triangle representing the face of a model (so composed of 3 points).

I can't find the mathematical operation to check if that vector is intersecting with this triangle, and how far from the player...

sentences:
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:
How should I handle MMO Enemies I have some NPCS protecting a treasure room in a friendly building. But if the player comes close they turn hostile. I don't know if the NPCS should attack everyone when triggered or only attack the player that triggered them. The latter seems good but if another player could sneak behind the guards whilst they attack someone else and succeed in an easy victory. How should I tackle this issue. If I use the former a random person who didn't do anything but is peacefully looking at the situation could get attacked which isn't RP-Friendly.

By adding more NPCS it kills a main attacker faster however doesn't solve the latter.

By adding more NPCS in the room would cause problems as it is smaller than a cubicle because of the design of the room being centred on the middle but making it larger it loses it's attention.

By simply removing the guards but adding another room before the treasure room, where the guards are. This is ok to stop the first issue because not many players will enter but it will lose the curiosity of guards guarding a door but rather another door.

sentences:
LookRotation() make X axis face the target instead of Z I use LookRotation() in order for an object to look at another, but since I'm using 2D I would like to make the axis looking/facing the target to be X instead of Z. I have the code below currently:

Vector3 dif = targetPos - obj.position;
Quaternion angle= Quaternion.LookRotation(dif, obj.up);
obj.rotation = Quaternion.Lerp(obj.localRotation, angle, Time.deltaTime);

Now->

What I'm trying to achieve->

Thanks!

sentences:
JBox2D simple example for Android? I'm starting to develop an Android game. I've already installed jBox2D but I can't find complete code to develop a simple application from scratch using this framework.
Thanks in advance!

sentences: Is it legit to use Custom Controller Buttons for PC Games in Unity? Not sure if this is off topic, but I have a problem. I'm making buttons for my own controller in my Game. For example, the attached images will appear to indicate the player to press the A or B Buttons. The image resembles Xbox Controller Buttons. So, is it legit to use them as Buttons of my own Custom Controller?

sentences:
Unity UI issue trying to make a button work while held down Pretty simple, have a rotate up button and I want it to rotate while held down.

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

public class cannonController : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
public Vector3  force;
Rigidbody2D rg;
Vector3 up;
public bool pointerDown = true;
Vector3 down;
// Use this for initialization
void Start () {
    rg = GetComponent<Rigidbody2D>();
    up = new Vector3(0f, 0f, 20f);
    down = new Vector3(0f, 0f, -3f);
}

/// <summary>
///  all of the rotation stuff
/// </summary>
    public void RotateSTOP()
    {
        rg.transform.Rotate(Vector3.zero);
    }
    public void RotateDown()
    {
    rg.transform.Rotate(down);
    }
    public void RotateUp()
    {
    while(pointerDown == true)
    {
        rg.transform.Rotate(up, Time.deltaTime);
    }

    }
/// <summary>
/// sets pointerDown to check if button is held down
/// </summary>
/// <param name="eventData">Event data.</param>
public void OnPointerDown(PointerEventData eventData)
{
    pointerDown = true;
}

public void OnPointerUp(PointerEventData eventData)
{
    pointerDown = false;
}

}

sentences:
Using GetTickCount (to shoot missiles) I have some difficulties to understand how to correctly use GetTickCount() as I have
some problems in my little game. I have to place on a case a space ship. This one will shoot
with a certain frequence some missiles.

Edit: It works good now, I edit the code below. However there is an other problem, I don't know why there is only one shooting space ship.

I hope someone has an explanation for that.

MyGameEngine::MyGameEngine(...) : tickTime(0) {}     // for the constructor...

DWORD prev_frame_tick;
DWORD curr_frame_tick = GetTickCount();

// function called everytime (loop)
void MyGameEngine::idle() {

    prev_frame_tick = curr_frame_tick;
    curr_frame_tick = GetTickCount();
    tickTime += curr_frame_tick - prev_frame_tick;
    int i;

    // SPACE SHIP
    for (i = 0; i < ship->size(); i++)
    {
        // verify if tickTime > freqShoot : if true return new missile with correct positions
        Missile* m = ship->at(i)->tick(tickTime);

        if (m != NULL) {
            missiles->push_back(m);
            std::cout << "new miss" << std::endl;    // I have to put this, however nothing on screen
            tickTime = 0;
        }
    }

    // MISSILES ANIMATION
    for (i = 0; i < missiles->size(); i++)
    {
        missiles->at(i)->tick();

        if (missiles->at(i)->getBordDroitX() > 1.0f) {
            missiles->erase(missiles->begin() + i);
        }
    }
}

Missile* Ship::tick(DWORD t) {
    Missile* m = NULL;
    if (t > freqTir) {
        m = new Missile(posX, posY, width, height, numCase);
    }
    return m;
}

sentences:
SDL & Image quality on iOS We are just finishing a mobile game for Android and iOS.
The image quality on iOS is subpar, and we are trying to understand why.
We are currently having two problems: the background, which is a gradient, is shown using few colors and the grandient's steps are very visible, and the fonts are pixelated.
I think both issues are clearly visible in this screenshot from the simulator (zoom in if needed):

The simulator is running an iPhone Xs with Graphics Quality Override set to High Quality.
I have disabled “Compressing PNG files”, but the result is the same. This issue is not always so visible, or, at least, not on all devices. On a smaller iPhone (e.g., 7, so 4.7"), there are no noticeable issues with the image quality and the font pixelation is minimal.
We are probably going to disable support for iPad because of this.
Do you have any hints on what we can do?
Thanks!

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:
How can I add a delay for each moving object? The waypoints script :
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class Waypoints : MonoBehaviour
{
    public Transform objectToMovePrefab;
    public int numberOfObjectsToMove = 1;
    //with this approach, you use GameObjects to represent your waypoints
    //(they can be empty if you want the waypoint to be invisible)
    [SerializeField] private List<Transform> waypoints;

    private void Start()
    {
        for (int i = 0; i < numberOfObjectsToMove; i++)
        {
            var parent = GameObject.Find("Moving Object Parent");
            var objectToMove = Instantiate(objectToMovePrefab, parent.transform);
            objectToMove.name = "Platfrom";
        }
    }

    public int Count => waypoints.Count;
    public Vector3 GetWaypoint(int index)
    {
        return waypoints[index].position;
    }
}

Then in the editor I added this script to the prefab :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WaypointsFollower : MonoBehaviour
{
    [SerializeField] private Waypoints waypoints;
    [SerializeField] private float speed = 5f;
    [SerializeField] private bool goBack = false;
    [SerializeField] private float delay;

    private float startTime;
    private int waypointIndex = 0;

    private void Start()
    {
        startTime = Time.time + delay;

        waypoints = GameObject.Find("Waypoints").GetComponent<Waypoints>();
    }

    void Update()
    {
        if (Time.time < startTime) return;

        Vector3 waypoint = waypoints.GetWaypoint(waypointIndex);
        //movement
        float distance = speed * Time.deltaTime;
        transform.position = Vector3.MoveTowards(transform.position, waypoint, distance);

        //check if we've reached the waypoint
        float threshold = .1f; //how close is considered having reached the waypoint
        if (Vector3.Distance(transform.position, waypoint) < threshold)
        {
            //wraps back to 0 when we reach last waypoint
            if (goBack)
            {
                waypointIndex = (waypointIndex + 1) % waypoints.Count;
            }
            else
            {
                if (waypointIndex != waypoints.Count - 1)
                    waypointIndex = waypointIndex + 1;
            }
        }
    }
}

The delay is working but it's delaying all the WaypointsFollower's so they move at the same time after the delay.
I want that even if all the Followers have the same delay value for example 3 so the first one will start moving after 3 seconds then the next follower will start moving after another 3 seconds and so on and not that they all delay for 3 seconds and move together but to make delay so there will be spaces between the followers when they are moving.

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:
Need help starting with a game in Flash/AS3 I am kinda new to flash/AS3. I have written some stuff and now I now the basics of AS. I want to develop a game in which my character moves. exactly like the way Super Mario moves(the background changes and new obstacles come in the way like and animation with which you can interact by climbing and shooting etc.) There is one big thing that I don't understand is that how to make my  background moving and introduce new obstacles when my character moves forward. Currently my scene is static which means the background is the same and obstacles are also stationary. Can some point me to a tutorial or give me an answer that solves my confusion?
thanks

sentences: 3D game special effects, fire, lightning, water, and ice I'm working on a 3d game using OpenGL and would like to take it in a fantasy direction.  Specifically I'm thinking of having magic with effects for fire, water, ice, and lightning.  My problem is I have no idea how to create these effects.  Are there any resources for me on how to learn something like this?

sentences:
2D map/plane with nodes overlayed that supports panning, scaling and clicking on nodes I'm trying my hand at Android development and seem to be running into an invisible ceiling in trying to get what I want accomplished. Basically I'm trying to create an app that renders a 2D surface map that I can (pinch) zoom and pan. I'll have to place nodes on the surface of the map that will scale/zoom and pan in relation to the surface.

I started out with a 2D ImageView approach and got as far as pinch zoom, pan and laying nodes as relative ImageViews, but all the methods I tried to get X,Y,W,H for the 2D surface were always off for some reason. Additionally, I was never able to scale the node ImageViews correctly, and as a result never got far enough to try and work out their X,Y scaled offset.

So I decided to get back to 3D rendering. Conceptually pan/zoom is camera manipulation, so I don't have to mess with how to scale the 2D map or the nodes. But I need a starting point or sample to get me going that's close to what I'm trying to achieve. A sample on a translucent spinning cube isn't helping as much as I need it to.

Any tips? Links, insults and sympathy are all welcome!

sentences:
How do I achieve one touch one shot for WP7 game? I want to be able to have a sprite shoot in a game for WP7.
What I have at the moment is that as long as the shoot button is held down the sprite constantly shoots.
How do I sort it that only one bullet is shot from touching the button and not a stream of bullets is released? I want for the player to be able to shoot another bullet, they must tap the button again. This was taken from a DreamInCode tutorial on how to make an asteroids clone for PC.

foreach (TouchLocation location in TouchPanel.GetState())
        {

            if (shootKeyBounds.Contains((int)location.Position.X,
                                         (int)location.Position.Y))
            {
                FireBullet();

            }

        }

The fire bullet method

private void FireBullet()
    {
        Sprite newBullet = new Sprite(bullet.Texture);

        Vector2 velocity = new Vector2(
            (float)Math.Cos(ship.Rotation - (float)MathHelper.PiOver2),
            (float)Math.Sin(ship.Rotation - (float)MathHelper.PiOver2));

        velocity.Normalize();
        velocity *= 6.0f;

        newBullet.Velocity = velocity;

        newBullet.Position = ship.Position + newBullet.Velocity;
        newBullet.Create();

        bullets.Add(newBullet);
    }

sentences:
Some practical issues with component-based game object systems I am creating my own game engine just for fun and brain development. I have chosen various free and open-source libraries to integrate and now I have come to the engine architecture.

I intend to use server-client architecture and I prefer to be more "data-driven" so I can organize my game state in MySQL database. I recently read about a component based design which plays nicely with data-driven systems. The idea is that game object components are bare properties and the behavior is implemented in so-called subsystems. Each subsystem (like Physics, Render, Animation, Sound) "knows" only about related components and also is able to tie itself to other systems if needed. Those subsystems are singletons (single instances).

I can use the observer pattern so each subsystem can subscribe to property changes which are important for the particular subsystem. The subsystems subscribe to prop change events in some particular order thus creating subscription chains. But this can create one problem: SystemA detected change in propA and needed to change some propB, but SystemX is listening to propB changes and affects propA .. and we have an infinite loop. Is this a common weakness of such systems or I have wrong implementation ideas?

The last system in the subscription chain could be the NetworkSystem, which sends out a small package on every subscribed property change ... or it is a bad idea and I should pack more changes together?.

I guess, rendering and physics will be separate threads where RenderSystem (client-side only) is polling the entities for their properties which have changed since last frame and PhysicsSystem is modyfing properties on each iteration; InputSystem (client-side only) and NetworkSystem also are modifying properties and WorldClockSystem could modify some properties on timer events.

But the major problem is when I think how to implement custom scripting in such systems. Let's say, users are allowed to upload their custom logic and animation script called Respect which has one property called goodDeeds with a rule "if a person with goodDeeds>100 passes by, I run some RespectAnimation". So I would install a global RespectSystem which subscribes to position changes of every character and checks for the Respect component and goodDeeds property and then somehow tells to Animation system to run Respect animation on this object. Is this the way it is supposed to work, isn't it dangerous that the behavior now is a global object and not a property of the entity which uses it? If I think again about the problem of neverending loops of observed/modified properties, it means that one wrong xxxSystem script could stall the entire server (but from the other hand, the admin of the server should have enough sanity to see such problems before allowing the user to upload that script).

Anyway, it would be great to find some book or article which better describes how to use component-based systems where components are properties and behavior are singletons, but somehow all articles I have read, explain only the idea itself but not how to attach it to a real game engine with scripting and networking.

sentences:
Character ability power balance I'm making a game where the player controls a character. This character starts off bland & weak. But over the course of playing the game, picks up abilities which the character uses as attacks/magic/damage dealers during battles. There are many different types of abilities/powers. I want to allow the player to level up these abilities through whatever means I come up with (haven't done that yet).

How do I balance ability ATTACK power (damage dealt) for instance? I'm sure there's some kind of abstract way of approaching this but it's eluding me. I want to make sure that if I make a super overpowered ability that there is another ability out there that can at least counter act it.

So the question: how do I approach ability power upgrade balancing when designing my game? Is it an algorithm? Can it be done linearly? So that there is always an awesome new strong ability waiting around the corner for the player character?

sentences:
Mute/Unmute Sound For All Game Scenes by pressing Button My Question is simple i just want to Mute/Pause All Sound of the Game having different scenes.

From Scene 1 Which is a Main Menu I Have Two Button On/Off .
When i press On Button it stops or mute full game sound or music like Car sound etc in all Scenes.
When i press off button then Sound become active again in all scenes ..

I'm new in this field so please give me some help My Game is almost Complete But i can not Control or Mute All scene Sound at the same time..Waiting

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: Match-3 game level generator I made match-3 game and now i trying to add level generator. Now I generate level by filling random cells with random blocks, but I want to create generator which for given number of moves and number of block kinds generate level. What algorithms I can use if they exists?

sentences:
How to voxelize a height map? Lets say I make a height map and I want to make it out of CUBES to use in my game. I dont want to generate anything procedualy, I just want to cubify a height map. So I just want a static mesh.
I also want to LOD it, so I have a 1024 version, a 512 version, and a 256 version.
Btw I am using Blender and UE4.

sentences:
Unity 2d coordinates I'm trying to get a 2d tilemap rendering but somethings not clicking with me about the 2d coordinates...

Here's my basic tilemap class -

public class Map : MonoBehaviour {
public Transform tilePrefab;

public int mapWidth;
public int mapHeight;
public Transform[,] map;

// Use this for initialization
void Start () {
    map = new Transform[mapWidth, mapHeight];

    for (int y = 0; y < mapHeight; y++)
    {
        for (int x = 0; x < mapWidth; x++)
        {
            Transform tile = Instantiate(tilePrefab, new Vector3 (x, y, 0), Quaternion.identity) as Transform;
            tile.parent = transform;
            map[x, y] = tile;
        }
    }
}

But this is rendering the tilemap from the origin -

I want that tilemap to be dynamically centered on the camera like -

What I can't seem to work out is how to dynamically work out the coordinates to move that tilemap so that it's centered in the camera after it has been created?

Any additional help, or pointers to some decent resources would be much appreciated, cheers.

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:
Modifying depth values in PixelShader (SharpDX) I'm relatively new to DirectX, and am currently converting some WPF 2D graphics code that displays geo-located sonar returns. I am using SharpDX, and rendering via a D3DImage.

I've got the basics working nicely, with very good performance, rendering segments of sonar as a set of quads textured via a texture array of chunks of sonar data.

I am now trying to modify the pixel shader so that it shows the highest "quality" signal return in the case where I have an overlap. Consider that the sonar return spreads from a central point, and (generally) gets worse the further away it is. When we have an overlap, a starting point to showing only the best data is to simply show the pixels that are nearest to the centre of the track, and a simple way I thought to do this would be to modify the depth values in the pixel shader so that the depth varies with the signal distance.

I have added a PS_OUT struct as so:

struct PS_OUT
{
    float4 Colour   : SV_Color;
    float Depth     : SV_Depth;
};

and a simplified version of the PixelShader:

    float quality = 1 - input.domain_uv.x;
    result.Colour = float4(quality, quality, quality, 1);
    result.Depth = quality;
    return result;

where the quality value varies from 0-1, and in this example I am also colouring the output with this quality value:

..which gives the expected colour output, but not the depth output. What I expect (want!) is that the higher quality (lighter coloured) output is preferred over the dark on a per-pixel basis.

I can confirm that depth testing is enabled, as I can vary the z coordinates of my quads and see the results. What seems to be my sticking point is that the depth value I calculate in the pixel shader is simply ignored, and my best guess is that I am missing something obvious - like I need to tell Directx to use it, and not its own calculated values. I can't find any documentation that suggests anything other than modifying the shader semantics is required.

The depth buffer/stencil is set up like this - this is taken from a WPF/SharpDX integration package:

 Set(ref m_depthStencil, DXUtils.CreateTexture2D(this.m_device, w, h,    BindFlags.DepthStencil, Format.D24_UNorm_S8_UInt));
  //Set(ref m_depthStencil, DXUtils.CreateTexture2D(this.m_device, w, h, BindFlags.DepthStencil, Format.D32_Float));
 Set(ref m_depthStencilView, new DepthStencilView(this.m_device, m_depthStencil));

 m_device.ImmediateContext.Rasterizer.SetViewports(new ViewportF[] { new ViewportF(0, 0, w, h, 0.0f, 1.0f) }, 1);
 m_device.ImmediateContext.OutputMerger.SetTargets(m_depthStencilView, m_renderTargetView);

I did try varying the texture format (see commented line), to no avail.

Subsequent to this, I also want to blend the very edges of the joins - but I'll leave that question for another day.

thanks,
Matt

edit: I can simulate the final effect that I am after by adjusting the depths of my quad vertices such that the middle is lower than the outer. Depths are then "real" depths, and the correct pixels are drawn. I don't think, however, that this is going to work as a solution for me because I want to be able to implement a slightly more complicated "quality" metric in the pixel shader. SO the question remains: why are my depth values calculated in the PS being ignored?

Here's an image of overlapping tracks where the "closest" pixel is rendered at all times:

sentences:
android: How to apply pinch zoom and pan to 2D GLSurfaceView I want to apply pinch zoom and panning effect on GLSurfaceView. It is Image editor, so It would not be 3D object. I tried to implement using these following links:
https://groups.google.com/forum/#!topic/android-developers/EVNRDNInVRU

Want to apply pinch and zoom to GLSurfaceView(3d Object)
http://www.learnopengles.com/android-lesson-one-getting-started/

These all are links for 3D object rendering. I can not use ImageView as I need to work out with OpenGL so, had to implement it on GLSurfaceView.

Suggest me or any reference links are there for such implementation.
**I need it for 2D only.

I am able to do both now, but where I am getting problem is to set the pivot point while panning can any one help me to set the translation respective to pivot point?

Matrix.setIdentityM(mScaleMatrix, 0);
        Matrix.scaleM(mScaleMatrix, 0, scaleX, scaleY, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mScaleMatrix, 0);
Matrix.setIdentityM(mTranslateMatrix, 0);
        Matrix.translateM(mTranslateMatrix, 0, deltaX, deltaY, 0);
Matrix.multiplyMM(mProjectionMatrix, 0, mProjectionMatrix, 0,
                    mTranslateMatrix, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

sentences:
Is there a gl*TexStorage* equivalent to glCompressedTexImage* I have been using glTexImage functions to create textures and then heard of glTexStorage* that is supposed to be better and is introduced in the latest standards.

But the problem is that I can't seem to find an equivalent to glCompressedTexImage2D(...) in terms of gl*TexStorage.

I've only found 2 references on an IRC chat to these supposedly equivalent functions while searching. (here and here)

Do these equivalent functions even exist ? And if they don't, why don't they exist ?

Thanks for any help

sentences:
Iris-wipe shader not properly working I'm working on creating an iris wipe transition, like the ones you see in old cartoons - a fully transparent circle closes on a certain point, leaving a full screen of a solid color. Additionally, the background around the circle fades in from full transparency as well. I decided that shaders would be easier than creating vertices to build the iris effect. I may have been wrong.

EDIT: I've made some progress since asking this question - there is now an iris effect, but it opens and closes around a blank CornflowerBlue screen before displaying the screen, and the background around the circle is always full transparency.

Shader:

sampler TextureSampler : register(s0);
float2 irisCenter;
float radius;
float4 backColor;

float4 PixelShaderFunction(float4 pos : SV_POSITION, float4 color1 : COLOR0, float2 coords: TEXCOORD0) : COLOR0
{
    float4 p = pos;
    float2 c = irisCenter;
    float r = radius;

    float alpha = abs(1 - step(pow(p.x - c.x, 2) + pow(p.y - c.y, 2), r * r));
    return float4(backColor.r, backColor.g, backColor.b, alpha * backColor.a);
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}

The alpha variable should be deciding if a pixel is inside the circle and should be transparent, or if the pixel is outside the circle and shouldn't be. irisCenter, radius, and backColor are all set on each frame by:

public void Draw()
{
    if (isInitialized && (isRunning || dir == EffectDirection.Backward))
    {
        float r = color.R; // / 255f;
        float g = color.G; // / 255f;
        float b = color.B; // / 255f;
        float a = (color.A * currentFadeLevel); // / 255f;

        var irisEffect = GameServices.Effects["IrisEffect"];
        irisEffect.Parameters["irisCenter"].SetValue(irisCenter);
        irisEffect.Parameters["radius"].SetValue(irisRadius);
        irisEffect.Parameters["backColor"].SetValue(new Vector4(r, g, b, a));

        quadRenderer.Render(irisEffect);
    }
}

IrisEffect.cs

QuadRenderer.cs

Instead of behaving as an iris wipe, it first draws a full-screen rectangle for half the effect, and then a full-screen Color.CornflowerBlue rectangle (I guess the quad from QuadRenderer isn't drawing with transparency). I'm not sure what's wrong as I'm new to HLSL.

Question 1: How can I get the coordinates of the current pixel being processed by the shader?

Question 2: What am I doing wrong?

Question 3: How do I draw the rest of the quad transparently?

sentences:
Create 3D line instead of a thin line in Unity in runtime with mouse drag I know how to use line renderer to drag and drop to create line in runtime, but the line appears to be thin when looking from the end of the line, I want to create a real line that has a thickness(think of it as a tube or pipe shape), no mater where the look direction is, they should has a thinkness. How would you achieve this effect, I've got two ideas,
1.Create a rectangle shape, then extrude this shape to create mesh during runtime, but the manipulation of mesh during runtime is too complicated for me.
or
2.Create prefabs, and spawn new prefabs and connect them along the cursor routing to make them looked as they were a continous line.
Would you suggest me of some new ideas or existing package to achieve this effect, or is the first option is the way to go? What I want to do is to make a shader editor like appearence in 3D space, what I need to create is the edges, and the edges should look 3D instead of 2D line.

sentences: Unreal Engine custom camera I was looking at game engines and found Unreal Engine. I want to make a game where the player has to create a camera by crafting it and can customize how many pixels the camera detects and what the camera detects (Ex: Sound, light, energy, etc). How could I do this?

sentences:
Collision detection - formula for getting intersection point I need help with collision detection algorithm from this paper: http://www.peroxide.dk/papers/collision/collision.pdf

I assume I am colliding with sphere of radius 1, just to make everything not important easier...I am concerned with formula, which finds intersection point with plane (page 14):

planeIntersectionPoint = basePoint - planeNormal + t0 * velocity

where:
basePoint = center of Sphere

planeNormal = normalized normal vector to colliding plane

t0 = number from [0,1] interval, first moment from this interval during which collision happens, assuming we are moving with velocity vector

velocity = velocity vector

I think that this formula doesn't work... Assuming that I am already intersecting with plane at t0 = 0, I just get:

planeIntersectionPoint = basePoint - planeNormal

What gives me point which doesn't even belong to plane, what fails further parts of the algorithm, when I check if intersection point is in triangle...

I will be grateful for every answer... Is the algorithm wrong, or that's me misunderstanding something?...

sentences:
XNA : Character walking on tiles and getting stuck I develop games for my own pleasure and also to share experiences with my kids learning coding.

Lately I have been working on a classic retro platform game using XNA and Farseer.

One issue I am having is that my characters sometimes get stuck while walking on tiles.
These tiles are blocks put next to each other.
It seems that sometimes when reaching the edge of the next tile, character get stuck.

I have read several solutions over the internet:

Make a weldjoint - did not fix my issue
Use an edgeshape - haven't found out how to do this yet
Make one big shape out of my several tiles (the background floor for example) - haven't found out how to do this yet

A video can be seen here. You'll see that I have sometime to jump in order to be able to move on, otherwise I simply get stuck. I also commented and shared my sources here.

For now, as a nasty trick, I create circle bodies rather than rectangles. It does reduce the issue but not completely and I feel this is an ugly workaround anyway.

Would any one be so kind as to point me in the right direction or provide me an example? I write in VB.NET but can adapt a C# example if needed.

sentences:
error X4016: SV_InstanceID semantic cannot be used with 10Level9 targets I'm using a variant of the D3D12 UWP template that comes with VS2017 Community Edition and I have two related questions:

When I add this italicized and bolded code to the vertex shader signature, I get an X4016 error:

PixelShaderInput main(VertexShaderInput input, uint instanceID : SV_InstanceID)

The full text of the error is:
error X4016: SV_InstanceID semantic cannot be used with 10Level9 targets

I don't understand what this means because when the template calls D3D12CreateDevice, it sets D3D_FEATURE_LEVEL_11_0.

Per this post, I'm thinking SV_InstanceID is supported in DX11 and above:
https://stackoverflow.com/questions/21241207/dx11-c-shader-cant-receive-instance-buffer-content

If I'm using a D3D12 template that is setting D3D_FEATURE_LEVEL_11_0 in the D3D12CreateDeveice call, why does the template think I have 10Level9 target?

Where can I go to change the template so that it uses a target that is compatible with the SV_InstanceID semantic in the vertex shader?

NOTE: I'm trying to loosely follow the example on Page 561 of Frank Luna's "3D Game Programming with DirectX 12" Text where he passes instanceID into the vertex shader.

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

Here is my code:

public class InputBuffer : MonoBehaviour {

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

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

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

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

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

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

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

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

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

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

sentences:
Collision Resolution I know quite well how to check for collisions, but I don't know how to handle the collision in a good way.

Simplified, if two objects collide I use some calculations to change the velocity direction. If I don't move the two objects they will still overlap and if the velocity is not big enough they will still collide after next update. This can cause objects to get stuck in each other.

But what if I try to move the two objects so they do not overlap. This sounds like a good idea but I have realised that if there is more than two objects this becomes very complicated. What if I move the two objects and one of them collides with other objects so I have to move them too and they may collide with walls etc.

I have a top down 2D game in mind but I don't think that has much to do with it. How are collisions usually handled?

This question is asked on behalf of Wooh

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:
Changing the rendering resolution while maintaining the design layout I would like to increase the FPS of my project.

Currently I would like to try reducing the resolution at which the scenes are rendered.

Let's say I never want to draw more than 1280*720. What ever the real resolution is. How should I proceed?

I tried pEGLView->setFrameSize(1280, 720); but only reduces the displayed size of the frame on screen (boxing).

In my activity I tried setting the size of the "surface" but this seems to completely break the layout (as defined by setDesignResolutionSize).

@Override
public Cocos2dxGLSurfaceView onCreateView() {
    Cocos2dxGLSurfaceView surfaceView = new Cocos2dxGLSurfaceView(this);
    surfaceView.getHolder().setFixedSize(1280, 720);
    return surfaceView;
}

Is there a way to simply set the scene resolution and display the result full screen?

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 do you make specific collisions in Unity? So I have created a "game" where you are automatically running across platforms and you can jump and land on the top of them.
 I want to set it where if you collide with the the left and right side of the platform a death function executes.
How can I implement a collision mechanic to achieve this?What I want the collision to be like

sentences:
How to check if a line casted from one point to another point passes through a mesh? Let's say we have two vectors A and B. Is there a way to use Three.js' Ray or Raycaster classes to cast a line between vector A and vector B and check is it passes through a mesh in the scene? I know from the documentation that both the Ray and Raycaster classes accept origin and direction vectors but I specifically need two points.
Thanks in advance.

sentences:
Boolean checks with a single quadtree, or multiple quadtrees? I'm currently developing a 2D sidescrolling shooter game for PC (think metroidvania but with a lot more happening at once). Using XNA.

I'm utilising quadtrees for my spatial partitioning system.

All objects will be encompassed by standard bounding geometry (box or sphere) with possible pixel-perfect collision detection implemented after geometry collision (depends on how optimised I can get it).

These are my collision scenarios, with <> representing object overlap (multiplayer co-op is the reason for the player<>player scenario):

Collision scenarios (true = collision occurs):
Player              <>      Player          =   false
Enemy               <>      Enemy           =   false
Player              <>      Enemy           =   true
PlayerBullet        <>      Enemy           =   true
PlayerBullet        <>      Player          =   false
PlayerBullet        <>      EnemyBullet     =   true
PlayerBullet        <>      PlayerBullet    =   false
EnemyBullet         <>      Player          =   true
EnemyBullet         <>      Enemy           =   false
EnemyBullet         <>      EnemyBullet     =   false
Player              <>      Environment     =   true
Enemy               <>      Environment     =   true
PlayerBullet        <>      Environment     =   true
EnemyBullet         <>      Environment     =   true

Going off this information and the fact that were will likely be several hundred objects rendering on-screen at any given time, my question is as follows:

Which method is likely to be the most efficient/optimised and why:

Using a single quadtree with boolean checks for collision between
the different types of objects.
Using three quadtrees at once (player, enemy, environment), only testing the player and enemy trees against each other while testing both the player and enemy trees against the environment tree.

sentences:
Euler angle and Quaternion conversion become weird when yaw is bigger than 90 degrees I'm writing a camera which needs to change a quaternion to Euler angles than change them back, it only works when the yaw is less than 90 degrees, I wrote a example to check:
glm::vec3 euler_angler = {0, 0, 0};
  for (int i = 0; i < 91; i++) {

    std::cout << "before: " << euler_angler.x << ", " << euler_angler.y << ", " << euler_angler.z << std::endl;

    euler_angler.y += 1;

    glm::quat quat({glm::radians(euler_angler.x), glm::radians(euler_angler.y), glm::radians(euler_angler.z)});

    glm::vec3 new_euler_angler = glm::eulerAngles(quat);

    std::cout << "after: " << glm::degrees(new_euler_angler.x) << ", " << glm::degrees(new_euler_angler.y) << ", "

              << glm::degrees(new_euler_angler.z) << std::endl;

  }

and when the Euler angles is {0, 89, 0}, then the Euler angles changed back to quat is the same, which is {0, 89, 0}, but when the origin changes to {0, 90, 0}, the new_euler_angler suddenly becomes to {180, 89.0001, 180}, and makes my camera rotation a mess.
Can someone help why this happened and what should I do?
the code of my camera:
glm::vec3 euler_angler = glm::eulerAngles(transform_data.rotation);
euler_angler.x = euler_angler.x + glm::radians(delta_y);
euler_angler.y += glm::radians(delta_x);
euler_angler.z = 0;
transform_data.rotation = glm::quat(euler_angler);

and here's my calculation of view matrix(which is a suspect because all other tutorials are using lookat matrix, I'm not sure my way is right or not):
// the position and rotation of the camera
auto transform_data = actor_.GetTransform().GetData();
glm::mat4 view = glm::mat4(1.0f);
view = glm::translate(view, -transform_data.position);
view = glm::toMat4(glm::quat(transform_data.rotation.w,
                               -transform_data.rotation.x,
                               -transform_data.rotation.y,
                               -transform_data.rotation.z)) * view;
render_camera_.SetViewMatrix(view);
glm::mat4 projection;
projection = glm::perspective(glm::radians(fov_), (float) aspect_, 0.1f, 100.0f);
render_camera_.SetProjectionMatrix(projection);

sentences:
Initializing Variables, Difference between Awake and in-class initialization public class ExampleClass: MonoBehaviour
{
   int exampleVariable = 0;
   int exampleVariableForAwake;
   void Awake()
   {
      exampleVariableForAwake = 0;
   }
}

What is the difference between initializing a variable at declaration vs. initilize in Awake?
Which I understand is to be used in place of constructors in Unity C#, welcome to correct me if I'm wrong.

Which usage is considered a proper convention by the community, if any?

Same question might also be in order for Properties, so I'll leave that open ended.

sentences:
Unity Tilemaps Best practices I'm pretty new to Unity and I just finished some courses and tutorial found in the official documentation. I'm now in the process to apply what I learned so far using different assets from the ones provided with the tutorial, to see if I understood all the material.
I'm trying to build a simple top-down game with some free asset I found online.
My tile palette is composed, among others, of tiles like these:

Now, in order to create something like this:
[sorry for the quality, I recreated it in gimp since I'm not on the computer where I have Unity now]

I had to create three Tilemaps under the same Grid. The botton tilemap contains the grass (sort order -2), the middle one contains the fence (sort order -1) and the top one contains the house (sort order 0).
My first question is: given the tileset I have, is this the most efficient way to obtain what I needed?
After having solved this problem I wanted to add a collider to the fence and to the house, but since they are on two different tilemaps I cannot use a composite collider to optimize the collider's layout. Is there another way to do this in a more efficient way?
Instead of using tiles for "interactable objects", should I use "proper" game objects instead?

sentences:
Quaternion LookAt for camera I am using the following code to rotate entities to look at points.

glm::vec3 forwardVector = glm::normalize(point - position);
float dot = glm::dot(glm::vec3(0.0f, 0.0f, 1.0f), forwardVector);

float rotationAngle = (float)acos(dot);
glm::vec3 rotationAxis = glm::normalize(glm::cross(glm::vec3(0.0f, 0.0f, 1.0f), forwardVector));
rotation = glm::normalize(glm::quat(rotationAxis * rotationAngle));

This works fine for my usual entities. However, when I use this on my Camera entity, I get a black screen. If I flip the subtraction in the first line, so that I take the forward vector to be the direction from the point to my camera's position, then my camera works but naturally my entities rotate to look in the opposite direction of the point.

I compute the transformation matrix for the camera and then take the inverse to be the View Matrix, which I pass to my OpenGL shaders:

glm::mat4 viewMatrix = glm::inverse(
    cameraTransform->GetTransformationMatrix()
);

The orthographic projection matrix is created using glm::ortho.

What's going wrong?

sentences:
Problem with Ogmo Editor (is Tiled Editor a solution?) I made a level editor for a puzzle game with Ogmo Editor and gave it to our designer/level designer. When he downloaded and started Ogmo, his CPU went to 100%. I looked at my CPU usage while Ogmo is running, and it goes from 20% to 30% (which is also high for an application alike Ogmo). He has a Windows 7 VM running on his Mac and I have a normal Windows PC, can this be a problem?

I found a thread on FlashFunk forum that confirms that Ogmo has CPU usage issues. Has anybody maybe solved this issue?

The solution seems to use Tiled Editor, but I never used it before. Is it difficult to change a level editor from Ogmo to Tiled? Can they export in the same format (XML with CSV elements for my puzzle game)?

EDIT

I ended up re-making the level editor with Tiled. It wasn't difficult and the only problem was that the exported XML is slightly different. In Ogmo the layers names are exported as XML element names, and in Tiled all layers are exported as  elements with the layer name as the name attribute of the layer element.

My first question still remains: has anybody managed to solve the high CPU usage of the new version of Ogmo?

sentences:
How to setup a public github unity repo with paid assets? From what I gathered (like in this thread or here) I am allowed to push my own game code on github and choose a license, as long as I avoid putting assets I do not own. I want to make it public to be able to show it (to potential employers for instance) but I cannot make it open source as I plan to use paid assets (like DoozyUI).

I can avoid pushing  the asset itself on the repo (with .gitignore for instance). Should I prevent gameobjects created with this package to be pushed as well ? That would make the game unusable, even with the rights to use the package...

Once that is settled, Is it ok to push it to github without license ?

Specifically, I do not know if objects generated by a paid asset are still considered that asset or not...

Edit: I asked the question directly to DoozyUI support, which quickly responded :

  You can upload your project, without the Doozy folder. Thus excluding our source code from being shared. Also, unsert a disclaimer letting anyone know that DoozyUI is required to be installed (before getting your files) for the project to work.
  You can share any GameObject (or prefabs) you create, but they will not work if DoozyUI is not installed due to missing references (scripts). Once Doozy is installed, they will work as expected. Thus anyone who has the system will be able to see/use your project.

sentences: How to make game scene bigger in 2d platformer? Hi i am current making a 2D platformer game but after i reach an end of screen then it doesn't move forward how to increase the game play screen area so that i will be able to go in vertical direction i am pasting an image of the problem i am new to unity please help me!]1

sentences:
Adding 2d hud/gui to a 3d game engine which has no 2d features I have been following the 3d game engine tutorial series made by theBennyBox for a few months now, and have finally decided to create a game with it. My problem is that it is a 3d only engine which does not have an easy way to draw in 2d.

The code for it is here (github)

I've figured that I need to change the camera class to take in a generic matrix, so The old camera class was this:

    public class Camera extends GameComponent
    {
    private Matrix4f projection;

    public Camera(float fov, float aspect, float zNear, float zFar)
{
    this.projection = new Matrix4f().initPerspective(fov, aspect, zNear, zFar);
}

public Matrix4f getViewProjection()
{
    Matrix4f cameraRotation = getTransform().getTransformedRot().conjugate().toRotationMatrix();
    Vector3f cameraPos = getTransform().getTransformedPos().mul(-1);

    Matrix4f cameraTranslation = new Matrix4f().initTranslation(cameraPos.getX(), cameraPos.getY(), cameraPos.getZ());

    return projection.mul(cameraRotation.mul(cameraTranslation));
}

@Override
public void addToEngine(CoreEngine engine)
{
    engine.getRenderingEngine().addCamera(this);
}

}

To this:

public class Camera extends GameComponent
{
    private Matrix4f projection;

public Camera(Matrix4f projection)
{
    this.projection = projection;
}

public Matrix4f getViewProjection()
{
    Matrix4f cameraRotation = getTransform().getTransformedRot().conjugate().toRotationMatrix();
    Vector3f cameraPos = getTransform().getTransformedPos().mul(-1);

    Matrix4f cameraTranslation = new Matrix4f().initTranslation(cameraPos.getX(), cameraPos.getY(), cameraPos.getZ());

    System.out.println("Location: " + cameraPos.getX() + " " + cameraPos.getY() + " " + cameraPos.getZ());
    return projection.mul(cameraRotation.mul(cameraTranslation));
}

@Override
public void addToEngine(CoreEngine engine)
{
    engine.getRenderingEngine().setMainCamera(this);
}

}

But now I don't know what to do. I can't work out how to switch between 2 cameras and draw in 2d.

How would I achieve this?
Thanks!!

sentences:
How do I split a texture into differently shaped pieces with libgdx? I want to split a texture into variously shaped pieces with libgdx, like the pieces of a puzzle game. TextureRegion.split() is not an option, as it splits into equally sized rectangular texture regions.

The "Similar Questions" section here is helpful (particularly this question How do I break an image into 6 or 8 pieces of different shapes?), but I'm not sure yet if it's possible to implement the solution with libgdx.

Any pointers?

sentences:
How can I reuse objects going off left side of screen, by putting them offscreen on the right side? I have an array of roughly 10,000 tiles over a 2d grid. When a tile goes off screen, I'd like to recycle it by disabling the renderer, repositioning it just before it comes on screen again, then turn the renderer back on. For example, if the camera is moving right on a platformer, the tiles on the left going off screen would be recycled and repositioned on the right side just before the camera. The player could be moving in any 2d direction, up, up right, right, down right, down, down left, left, up left, thus I need to account for all directions.

    0,0--------------->100, 0
    | Move Direction--> |
    |                   |
   x|xxxxxxxxxxxxxxxxxxx|xxx  <-  Recycled objects taken
   x|xxxxxxxxxxxxxxxxxxx|xxx  <-  from left and repositioned on right
    0,-100<----------->100,-100

I've tried two approaches, one is using a wider camera view (maybe 1.3x) and using the edges with ViewportToWorldPoint and getting the player horizontal and vertical movement direction. If the camera is moving horizontally one way, my tilemanager script runs down the other side and repositions the objects on the opposite just before coming on screen. The problem here is if one is ever missed, it could go astray and then over time this leads to further problems if over time multiple are missed. I am using a tilemanager and not putting a script in each tile as it seems wasteful to have a script running in 10k+ tiles.

The other approach is literally to just scan every item in the array to see if any are outside the viewport bounding box, which seems like a huge waste of resources and not the right way to go. I have a 2d array that has just the positions saved, nonetheless scanning through any array of 10k+ each frame seems like it isn't the right way to go in terms of efficiency.

All of this work is being done as a coroutine but what is frustrating is that unity doesn't support threading as this would make this task faster as I could divide up the work more.

Is there another way anyone has used or created something that will efficiently find all objects off screen, in order to reuse them?

sentences:
Most Efficient Way To Get Objects In A Rectagular Area - Unity2D First of all, if you know a better way to do what I want to achieve please don't hesitate to suggest your own method.

What I want to do is the classic area selection in RTS games, which player drags his mouse to draw a rectangle and units inside rectangle become selected.

At this point, I have two ideas:

A dedicated gameObject with a trigger BoxCollider2D.
Detecting overlaps with Physics2D.OverlapArea method.

In the first method, the gameObject will get resized on the fly while the user drags and by using collision control the objects get selected.

In the second method starting point and end point of the area is being recorded and script draws an OverlapArea using these two coordinates.

Which one would be more effective in terms of performance?

Thanks in advance.

sentences:
Optimizing texture fetches with higher mip levels Let's say I have some shader program in DirectX or OpenGL rendering a full screen quad. And in a pixel/fragment shader I sample some huge textures at random texture coordinates. That is one same texture coordinate for all texture samplings in one shader invocation, but it is various among different shader invocations. These fetch operations produce performance drop, I even think that due to the size of the textures the GPU texture cache is not big enough and is used not efficiently.

Now I have a theoretical question: can I optimize the performance by using some low-resolution like 32x32 mask textures, which are built by mipmapping the large textures, and if a value in a mask texture at given texture coordinate at some higher mip level is not appropriate, then I don't need to perform texture fetches at full-size level 0? Something like this in HLSL (GLSL code is pretty similar, but there is no [branch] attribute):

float2 tc = calculateTexCoordinates();
bool performHeavyComputations = testValue(largeMipmappedTexture.SampleLevel(sampler, tc, 5));

float result = 0;

[branch]
if (performHeavyComputations)
{
    result += largeMipmappedTexture.SampleLevel(sampler, tc, 0);
}

About 50% of texels at mip level 5 will not pass the test. And so a lot of shader invocations should not sample the full-size textures.

But I am introducing branching in the code. May this branching hurt the performance even worse than sampling the full-size texture even if that is not needed? Different GPUs may behave differently, some may not even support branching, will they perform two fetches instead of one?

I can test this code on some machines, but my question is theoretical.

And can you suggest another optimizations, if this won't work properly ?

sentences:
How to display Render Target live to HUD widget in UE4 I'm making a security camera system in Unreal Engine 4. It allows the player to 'activate' the monitor, which should display the Render Target texture or the material made from it on the HUD. However, that just doesn't work. There's just no image when I try to play it. Nothing appears on the screen. I'm using blueprints btw, not C++. And yes, I did check and make sure that it's not the part that displays the HUD that's going wrong, it's the displaying of the render target to the UI widget. To display it, i've tried using the image component in the UI widget.

Can anyone help?

sentences:
What can I do to ensure that everyone can run my OpenGL game? I am currently learning OpenGL from here. That website teaches OpenGl 3.3 with GLSL 3.3 and says that it is best to learn those because they are well supported and that older versions work in a less efficient way.

So far, this has been going well, but, when I tried to get my OpenGl programs to run on my laptop with Intel HD Graphics 3000, I ran into issues with the lack of GLSL 3.3 support (glGetShaderiv() and such claim that GLSL 3.3 is unavailable. When I ignore these errors, anything beyond the background color isn't rendered).

I am learning OpenGl in order to create a video game for which my target market will contain many older non-gaming computers (in addition to users with brand-new GTX 1080s). It wouldn't surprise me if a few users were still on Windows XP. It is essential that I make sure that everyone can run my game without buying extra hardware. It is equally essential that it looks good on hardware that can support it. What single, non-deprecated graphics API is available on all hardware (using software emulation if needed) along with Windows, Mac, and Linux?

If no single such API is available, what can I do to ensure that my game will work properly everywhere while also taking advantage of new features when available without learning multiple APIs? I would strongly prefer to stay close to the hardware by avoiding higher level APIs such as Ogre3D. If to do this I need to learn multiple APIs, then, what are those and why hasn't the industry standardized this by creating an API then releasing drivers for old hardware?

Some possible solutions are:

A well-enough-performing software implementation of OpenGL 3.3 along with GLSL 3.3
A OpenGL 3.3 implementation that uses OpenGL 1.0 in the background that can be easily swapped out automatically at runtime if newer versions aren't directly available.
A simple to use older version of GLSL that allows me to load separate shaders as needed.

sentences:
Mapping a 3D texture to a standard hollow-hull 3D model I have 3D models which are typical hollow hulls. If such a model also had a 3D volumetric/voxel texture map then given a point P inside such a model, I'd like to be able to find its uvw coordinates within the 3D texture.

Is this possible by simply setting 3D texcoords on my existing mesh or does it have to be broken up into polyhedra? Is there a way to map a 3D texture onto a mesh without doing this?

sentences:
is there a formula to know how many enemies i can place before jumping character? My game is very similar to the hidden game in chromes web browser. I have a character that needs to jump over incoming enemies. Is there any way i can know when to send an incoming enemy? Some of the factors to take in to account i guess are the speed of enemies, height of jump, speed of jump, and dimensions of bitmaps (that represent character, and enemies).

Thanks

sentences:
Cannot overlay text? I'm trying to make text have a fixed position in world space and be overlayed in screen space at the same time.

I have text in canvas with "Screen Space - Overlay" which covers my text located in canvas (world space).

What should I do? Is this a dead end? Please comment if you didn't understand (I know it's hard to get)

sentences:
How can change some text above a character upon collision in Unreal? I've just started using Unreal Engine, and I was trying to do a super simple game where there is a character that has text above his head that says 'Bag 'o' fries.'

My plan was to have it so if something touches the bag 'o' fries, the text changes to 'Mission Complete.' I currently have one blueprint that just says onGameStart --> BoxOverlapActors --> set variable 'text' to 'Mission Complete'. The variable 'text' I made isn't actually connected to the text, so this is where I have the problem.

How can I do this?

sentences:
top down game - checking, drawing enemy's line of sight area with obstacles Examples of what i'm going to need:

I'm using cocos2d to draw a CCTMXTiledMap, on those tiles i'll have to draw the LOS cone.

How would i test if the player is within that cone, taking obstacles into account?
How would i draw the line of sight area on the map tiles, again taking obstacles into account, like in the examples above?

This is a re-post of a question i've put on stackoverflow.

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:
How can I adjust the UVs of my quad so my texture isn't flipped? My sprite geometry is reversed using matrix so that it is in the XZ plane. This results in the image used for the sprite to also be reversed, which I don't want:

(source : http://www.badlogicgames.com/wordpress/?p=2032 )

The image is then upside-down (note the 2 and 4):

Would you know how to switch the UVs, or apply a matrix on the image only?

Here is my code to draw the new image (the broken one):

curPix.drawPixmap(modelPix, newX, newY, modelX, modelY, tileResolution, tileResolution);

This is how the plane is modified in "render:"

batch.setProjectionMatrix(cam.combined);
batch.setTransformMatrix(matrix);
batch.begin();
getMap(0).draw(batch);
batch.end();

sentences:
Moving Object on One Axis Hi Im trying to move some 3D text on one axis, but for some reason it moves on 2 with this code. Can someone explain why this is/ how to fix it? Maybe this is a simple solution but i cant find it.

using UnityEngine;
using System.Collections;

public class MoveTitle : MonoBehaviour {

    public bool ScrollDown = false;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKeyDown("up") && ScrollDown == false)
        {
            transform.Translate(0.0f, -1.2f, 0.0f);
            ScrollDown = true;
        }
        if (Input.GetKeyUp ("up"))
        {
            ScrollDown = false;
        }
        if (Input.GetKeyDown("down") && ScrollDown == false)
        {
            transform.Translate(0.0f, 1.2f, 0.0f);
            ScrollDown = true;
        }
        if (Input.GetKeyUp ("down"))
        {
            ScrollDown = false;
        }
    }
}

sentences:
Improving the monster tamer battle mechanics: 2 choices I'm developing a new monster taming/hunting game and I wanted to make some changes to the battle mechanics.  Which would you find more fun and can you offer any suggestions to improve on what I've done.  I'm leaning more to just option 2 although it will be a bit more difficult to deal with the AI.

Current base for the mechanics:

2 monsters face off head to head
They use different moves to damage
each other trying to kill the other.
Various non damaging moves can
be used to (increase/decrease stats, cause poison, paralyzing
effects)
There are different types of attacks that can be resisted or
more effective against certain types of monsters (eg. Holy attacks do
extra damage to Demons).

Basically, I'm starting with the simple Pokemon style battle.  I would like to add either one or both of these changes:

Option 1: Add in a recovery stat for moves so that the "turns" are based on how much the monster has to recover.  When a monster uses a move, the move's recovery stat is added to the monster's. When a monster's recovery stat reaches 0 it can perform a move.
     Explode - A high damaging move requires 50 recovery after being used.
     Poke - A smaller damaging move requires 20 recovery after being used.
     (Both start at 0 recovery, A goes first just because)

Monster A uses Explode (its recovery is at 50)
Monster B uses Poke (its recovery is at 20)
a check is done to see which has lower recovery and they go next
   (20 "time units" goes by and A now has 30 recovery, B is down to 0 and can perform a move again.
Monster B uses Poke again (recovery at 20) (A is still at 30)
Another 20 "time units" goes by and A is at 10 and B is at 0 again.
Monster B can attack again

This adds a timing element to the battle.  Instead of each monster being able to attack once a turn, you can use smaller attacks or status changing moves quickly before your opponent recovers from their attack.  Status effects may cause a monster to require more recovery each turn (like a slowing effect) or a hasting effect could be applied.

Option 2:  Use 2 monsters in the same battle with a forward and rear position.  Moves have a range value that determines if you can hit the forward, rear, or both monsters.

I think generally, melee style attacks would be higher damage but only affect the forward monster.  You would often want a tank (high defense) monster to take these hits with a ranged attacker in the rear position like an archer or mage.  Certain moves could damage both positions and you could have the option of having the monsters switch positions.

I think the strategy wouldn't be limited to a melee tank in the front with ranged in the back, as a melee tank may be susceptible to special attacks and certain monsters would do more damage in the front while being vulnerable to attack.

Example moves that take advantage of this mechanic:

Intercept - forward monster takes the next attack aimed at the rear position.
Force switch - forces the opponent monsters to switch positions
Pierce - 1/2 damage is done to the rear position if an attack on the front is successful.
Dragon's breath - all monsters (including your forward position if you are the rear) in front of you are hit with fire damage. (this would be a good move to switch your positions prior to using)
Goblin Mortar - fires 3 spaces away (requires the attacker to be in the rear to hit the rear opponent)

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:
Could executing OpenGL shaders sent from a server be dangerous? I just came to the realization that since uncompiled shaders are just text, they can easily be sent over a network from a server and then compiled at runtime and executed on clients. I'm not actually planning on doing this (probably...), but I am curious as to whether or not it would result in any potential security vulnerabilities on the clients executing the shaders.

My gut feeling is that it would not, since even if a shader were to gain unauthorized access (eg by reading unallocated data from a video buffer), it would have no way of sending this data back to the attacker. On the other hand, allowing arbitrary code execution seems like an almost certain way to get hacked. My question is how this would be possible in this scenario (assuming that it is).

sentences:
2d mmo open world connection and reconnection I am trying to create an 2d html5  open word (the sprite does not have any fancy flare, just shapes around) with only maximum of 10 player at once.
My question is how to create a seamless join for new player join when 5 others have already started roaming in the world? in the other words, how to maintain synchronization for a new player for all updates that is happenning in new world.

I know pub sub can do the trick but it is very wasteful to catch up from start of the queue. How can a new player get a refresh of the current state and continue to stream from movement from other exisitng player?
Thanks.

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:
Repeat image on a fixed background, Cocos2D? I'm quite new to Cocos2d, does anyone know how to create a background that would be one fixed screen (no scrolling), with a small image just repeated to the whole size of the screen - depending on device?

The best way I can explain the look I'm after is something similar to repeating a small image for a website background.

Thank you in advance for any help :)

sentences:
How to emulate knob turning, based on x/y movement? I'm doing a game where one component is that you turn a knob.  I'm having trouble getting good "knob behavior".

I know the current touch/mouse X,Y location, and I keep track of the previous X,Y location, so I can determine if I'm going left or right and/or up or down.

It works, but it's crude.  I suspect I have to take an average of any given direction over a period of time (say, last quarter second) to eliminate jitter because people don't move uniformly in the same movement every moment.

I can't really use touchdown/release because you should be able to put the touch down, then move left/right up/down continuously without release, and the knob would turn, just as if you had a free-spinning audio control or video shuttle (say).

Any thoughts in this direction on how to even it out?

sentences:
Restoring projection matrix I am learning to use FBOs and one of the things that I need to do when rendering something onto user defined FBO, I have to setup the projection, modelview and viewport for it. Once I am done rendering to the FBO, I need to restore these matrices. I found:

glPushAttrib(GL_VIEWPORT_BIT);
glPopAttrib();

to restore the viewport to its old state. Is there a way to restore the projection and modelview matrix to whatever it was earlier ?

Tech: C++/OpenGL

Thanks!

sentences:
Skybox with deferred shading I've looked at this technique, but it strongly sounds like he has to do some ugly hacks involving branching in his lighting shaders just to correctly draw a skybox. This seem awfully wasteful.

How can I most efficiently implement a skybox with a renderer that uses deferred shading?

sentences:
Attached objects to public Text removed on play mode (Unity) As you can see when I play the game the 'touch anywhere to start' object goes away. How do I fix this?

I have added all the relevant code

sentences:
Where can I see example sell-sheets for a game? So my long term one-man indie project is turning into a two-man indie project, and I feel I need to take a step back and at least have a "sell-sheet" as a basis for the game design.

Does anyone have any good templates or tips?

sentences:
How to get position of CCSprite added to CCParallaxNode? I have a CCparallaxNodeExtras that scrolls infinite (following the space game tutorial). I added as a child a CCSprite made of other CCSprite, like this:

_backgroundNode = CCParallaxNodeExtras::node();
this->addChild(_backgroundNode,-2);

    float acum = 0.0;
    back1 = CCSprite::create();
    for(int i = 0; i < num_repeats; ++i) {
        CCSprite *back = CCSprite::createWithSpriteFrameName("rock.png");
        back->setPosition(ccp(acum, 0));
        back1->addChild(back);
        acum+= back->getContentSize().width+150.0;
    }

    _backgroundNode->addChild(back1,  1 , ccp(0.1,0.1), ccp(0, winSize.height * 0.64));

now in my update I have this:

CCPoint backgroundScrollVert = ccp(-1024, 0);
_backgroundNode->setPosition(ccpAdd(_backgroundNode->getPosition(), ccpMult(backgroundScrollVert, dt)));

perfect, the background moves and disappears (that is what I want for now) but I need to get the collision between the sprites on that background and a fixed sprite as a child of the main node.

The problem is that whenever I try to get the collision by the simple way (intersecting the bounding boxes) it doesn't work, so I tried to just get the position of the sprites and all I get is the position fixed in the CCSprite (back1) composed by the sprites (back).

Now, is there a possible way to get the position of any individual sprite located in that parallax node? If i try something like:

CCSprite *tempsprite = (CCSprite*)_backgroundNode->getChildren()->objectAtIndex(0);
printf("%f\n", tempsprite->getChildren()->objectAtIndex(0)->getPositionX());

it prints always the same value, it is like the position is not being affected by the transformation of the parent in the background node... so, how do I get it correctly? how do I get the position relative to screen and not to the parent?

sentences:
How to call StartCourotine in abstract class? Bellow is my code. I have an abstract class and a inheriting class. This keeps giving me an NullReferenceException, on the StartCoroutine(WaitForTime) when Activate() is called on a InheritedClass instance. I can't figure it out.

public abstract class AbstractClass : MonoBehaviour
{
abstract protected string iD { get; }
abstract protected int CooldownSeconds { get;  }

protected bool IsInCooldown { get; set; }

public void Activate()
{
    if (!IsInCooldown)
    {
        TurnOn();
        StartCooldown();
    }
}

protected abstract void TurnOn();

public void StartCooldown()
{
    IsInCooldown = true;
    StartCoroutine("WaitForTime");
}

protected IEnumerator WaitForTime()
{

    yield return new WaitForSeconds(CooldownSeconds);
    IsInCooldown = false;
}

}

public class InheretingClass : AbstractClass
{
    protected override int CooldownSeconds { get => 30;}

protected override string collD => "Cool";

protected override void TurnOn()
{
    Debug.Log( iD + " Activated");
}
}

sentences:
OpenGL not rendering textures i'm using OpenGL 2.1 with SDL2.0 and i'm trying to render a texture, using this steps:
load the image:

    Image* image = new Image();

image->image = SDL_LoadBMP(path.c_str());

if (!image->image)
    throw std::runtime_error(SDL_GetError());

return image;

and then generate a texture for it:

Texture2D* Texture2D::fromImage(const Image* image){
GLint format;
Texture2D* t2d = new Texture2D();

glGenTextures(1, &t2d->tid);
glBindTexture(GL_TEXTURE_2D, t2d->tid);
t2d->size.setWidth(image->getWidth());
t2d->size.setHeigth(image->getHeight());

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

switch (image->getBPP()){
case 24:
    format = GL_RGB;
    break;
case 32:
    format = GL_RGBA;
    break;
default:
    throw std::runtime_error("Unsurpoted pixel format!");
    break;
}

glTexImage2D(GL_TEXTURE_2D, 0, format, image->getWidth(), image->getHeight(), 0, format, GL_UNSIGNED_BYTE, image->getPixels());

return t2d;
}

and then i try to render it:

void Painter::drawTexture(Texture2D* texture, const SizeF& size, const PointF& position){
camera.set(camera.getWidth(), camera.getHeight());

texture->bind();//only call glBindTexture(GL_TEXTURE_2D, tid);

glBegin(GL_QUADS);
glColor4f(color.getR(), color.getG(), color.getB(), color.getA());
glTexCoord2f(0.0f, 1.0f);
glVertex2f(position.getX(), position.getY());
glTexCoord2f(1.0f, 1.0f);
glVertex2f(position.getX() + size.getWidth(), position.getY());
glTexCoord2f(1.0f, 0.0f);
glVertex2f(position.getX() + size.getWidth(), position.getY() + size.getHeight());
glTexCoord2f(0.0f, 0.0f);
glVertex2f(position.getX(), position.getY() + size.getHeight());
glEnd();
}

but all i got is box with the defined color, i don't understand why, i have already followed this steps before to render a texture, but this time it is not working, i'm not using glEnable(GL_TEXTURE_2D) because i read that this is not necessary, but when i do call it i got the error code 1282, but i got no errors on the textures creation, can someone give me some light here? thanks

sentences: Does anything need to be done to support variable refresh rate? Does anything have to be done in order for my game to take advantage of variable refresh rate technology supported by some displays, such as G-SYNC and FreeSync?

sentences:
What are the minimum requirements for UDK on iOS? Infinity Blade asks for 3GS or better devices, which I'm told is because it uses OpenGL ES 2.

Will every game made with the iOS version of the UDK only work with 3GS devices and up?

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:
Rotating objects in an random rotation around center point I almost have what I'm looking for. Still trying to understand rotation and spawning of objects.

I have a ground field with a number of spawn points (and they are placed randomly in a circle). It's working quite well.

I have the issue tho, that I'm spawning them in an angle I'm not intending to and I have troubles finding the issue and understanding the math to it.

This is what it looks like:

I want the rocks to be spawned around the circle on the ground, not 90° to it.

I have the following code:

Vector3 RandomCircle(Vector3 center, float diameter) {
    float r = diameter / 2;
    float ang = Random.value * 360;
    Vector3 pos;
    pos.y = center.y + r * Mathf.Sin(ang * Mathf.Deg2Rad);
    pos.x = center.x + r * Mathf.Cos(ang * Mathf.Deg2Rad);
    pos.z = center.z;
    return pos;
}

sentences:
Unity fade all UI elements which belong to one Canvas Like the question describes I want to fade out/in all UI-Elements belonging to a parent canvas.

So things I got are :

A World-Canvas which contains multiple UI-Items
A script which can fade one color depending how close my cursor comes to that item

Things I want :

A script which can fade my whole canvas without attaching each single Element with a color property to it

Thoughts :

This would most likely work with a script which searches all Text children and Image children of the canvas, but I think that would be rather poorly performing code

I'm totally fine if there is no better solution as the mentioned one, but I would be annoyed if I implement it that way and there is a simple trick I don't know about :)

sentences: How do I implement smooth movement in a Box2D platform game? I have implemented a character in JBox2D which moves with the help of a wheel rotating at the bottom of it. The movement is the best result I've had 'till now but it's a little glitchy when the character stands on the edge. So I am thinking should I use five smaller wheels instead of a big wheel. The wheel/wheels will not be visible in the finished product, now they are drawn for debugging. Here is a video. Is there a better way to do this using JBox2D?

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:
Where can I find/download a decent, free voice synthesizer? I've been looking all over the net, and I've found some voice synthesizers, but they either don't work, aren't free, or just have 5 or so voices to choose from... I need to get a synthesizer with which I'm able to edit the voice myself. This is needed for GLaDOS-like robotic character for my game.

I did some searching here on GDSE, and it seems that questions like this often get closed as "not constructive". I believe that this is not the case, as this could help many other people who happen to be searching for the same thing.

sentences:
How to make changes to Pawn.cpp Unreal? I am trying to figure out a problem related to CableComponents.

As part of my learning and problem identification I'm trying to place some UE_LOGs/Debug Messages within Pawn.cpp and CableComponent.cpp

These changes are not reflected when the c++ code is compiled within unreal. which is consistent with Unreal only building project code.

So My question is, how can I make these changes to the source code and have them be used?

Alternatively, is there a better way to do what I'm trying to do?

The reason i'm trying to do this

I'm trying to figure out how often the dynamic data of UCableComponent is recalculated compared to the rendering update of APawn.

sentences:
Why does my A* implementation overflow the stack? I'm fairly new to game dev and working on my first ever attempt at 2D pathfinding. I'm using the A* algorithm as detailed here.

For the most part, it seems to be working correctly and as intended. However upon attempting to wrap my path around a building in the map, a stack overflow is caused in ClosedList (the list storing coordinates of the path). It appears that at some point in the path, the algorithm is switching back and forth between two tiles, but I cannot work out why.

The code probably isn't the best way to do things but this is my first attempt. Apologies if it offends anyone. :P

void CheckSquare(Vector2 Start, Vector2 End)
{
    //Check for Invalid Start/End Points
    if (Start == End ||
        grid.PTileArray[(int)Start.x, (int)Start.y].CurrentType.Passable == 0 ||
        grid.PTileArray[(int)End.x, (int)End.y].CurrentType.Passable == 0)
    {
        return;
    }

    //Check which adjacent tiles are passable
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y)); //LEFT
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y + 1)); //TOP LEFT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x, Start.y + 1)); //TOP
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y + 1)); //TOP RIGHT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y)); //RIGHT
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y - 1)); //BOTTOM RIGHT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x, Start.y - 1)); //BOTTOM
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y - 1)); //BOTTOM LEFT
        gValues.Add(14);
    }

    //Remove the parent from the Possible choices
    for (int n = 0; n < OpenList.Count; n++)
    {
        if (OpenList[n] == ClosedList[ClosedList.Count - 1])
        {
            OpenList.RemoveAt(n);
        }
    }

        //Calculate H Values
        for (int n = 0; n < OpenList.Count; n++)
        {
            float x = Mathf.Abs(End.x - OpenList[n].x);
            float y = Mathf.Abs(End.y - OpenList[n].y);
            float final = 10 * (x + y);
            hValues.Add((int)final);
        }

    //Calculate F Values
    int lowest = 10000;
    int reference = 0;
    for (int n = 0; n < OpenList.Count; n++)
    {
        int g = gValues[n];
        int h = hValues[n];
        int final = g + h;
        fValues.Add(final);
        if (fValues[n] < lowest)
        {
            lowest = fValues[n];
            reference = n;
        }
    }

    //Add the square with the lowest F Value to the closed list as part of the path
    ClosedList.Add(OpenList[reference]);

    //Clear Lists
    OpenList.Clear();
    gValues.Clear();
    hValues.Clear();
    fValues.Clear();

    //If the final Location in ClosedList is not the end then continue
    if (ClosedList[ClosedList.Count - 1] != End)
        CheckSquare(ClosedList[ClosedList.Count - 1], End);
}

Help or nudges in the right direction would be greatly appreciated.

sentences:
DX11 application running on Windows XP using only DX9? I'm developing an application that utilizes DX11. I know that DX11 is only available on Windows 7 (and Vista with SP). I wonder if there is some way to run the application on Windows XP and use only the old DX9? I need to prevent the loading of DX11 dlls when on Windows XP. How can this be done?

I've got an old renderer, that runs entirely on DX9 and a new renderer that uses DX11. My idea is to run the old renderer underr Windows XP and load only DX9 dlls, and to run the new renderer on Windows Vista / 7 and load DX11 stuff as well.

I've heard about a LoadLibrary() function that loads libraries at runtime. So far I have my Visual Studio project with all that DX11 .lib files in Additional Dependecies. How should I change this to load it completely at runtime? Do I need to define all symbols in DX11 .dlls manually?

sentences:
How to properly interact with game objects in Unity3D? I am trying to make a game where player will be placed in the scene and the goal is to explore it. He can interact with game objects that player can find in the environment, like picking object, examining, dropping and putting back. Basically it is something like first person exploration...

So the problem is how to properly implement code regarding interaction. One way I see and saw it on the internet is Raycasting. So the idea would be to in Update() method place Raycast fire code and see what it hits. Also all game objects with which player can interact are placed on separate Layer and also limit length of Raycast (which is obvious thing to do as player cannot interact with objects that are like 10 meters from him)...

So as I understand, game objects should have at least some kind of collider (I know box and sphere colliders are simple, but sometimes I will need to use more complex one)...

That being said, I wonder is this right approach:

Separate layer for interactable objects
Raycast that checks objects in that layer
Raycast length limited to like 1 meter

This approach should not be that much CPU consuming or is there any other way?

I am also thinking to putting some invisible box area (trigger) where raycasting would make sense, but I am not sure will this be overhead or not....

So, at the end what would be the right approach to this?

sentences: Google Web Toolkit: Ever used for making games? I've recently come across GWT (Google Web Toolkit) and have been amazed by it. I was wondering if anyone has ever put it to use making a video game? And if they did, what their experience was, whether it was worth it and whether the game was any good.

sentences:
Why does a unit vector show direction? If I have two objects, Person A and Person B, and I want to know if Person B is facing the same direction as Person A; once I have the vectors, how do I use the normalized vector to show direction?

I've read the math on vectors, but I'm still learning, and I am not understanding how the unit vector shows direction.  I know it does, but I don't know why.

One person said they imagine it on the unit circle. I understand how that can show a direction, but what I don't understand is how the normalized vector shows me a direction.

I have seen "What is a direction vector and why should it be normalized?", but I am still missing it.

sentences: How to make a gaussian blur effect in UDK I want to make a plane shape (surface) that have a gaussian blur applied to it and this plane is transperant, so all objects behind it looks like they are having a gaussian blur effect.

sentences:
Branching quest system I've started working in a quest system for my game, but I stumble in a zone where I have to many, if/else conditions to handle a quest, whether you have X and Y item in your inventory, whether you have already talk with a NPC, or whether some other quest stage is a given value and so on.

This end ups making the code very unclean, hard to fix and extend.

I'm wondering what's a good way to handle this.

I've read that keeping your quest as XML file is a good practice, but I've never worked with XML before(I know what they are, but I'm unfamiliar with how to properly make one)

I made a template quest to handle fetch/talk quests in a CSV file. Which looks something like this:

But I'm not that I'll end-up shooting my own foot with this custom system.

The branches of a quest can depend on items, previous quests, npc status, player status... So, what's a good way to deal with this?

EDIT:

This is not a duplicate of this question since the answers for this question are either using XML (which I said I don't have the know-how) or use multiple if/else conditions, which is my start problem.

sentences:
What to do with unused vertices? Imagine yourself a vertex array in OpenGL representing blocks in a platform game.

But some vertices may be not used.

The environment is dynamic, so there always some vertex may suddenly become invisible.

What is the best way to make them not draw? Graphic cards are complicated and it's hard to predict what is best approach.

Few best ways I can think of:

delete and move all vertices after deleted one to fill freed space (sounds extremely inefficient)
set positions to 0
set transparency to maximum

I could of course benchmark, but what on my computer works faster doesn't have to on other.

sentences: Are there shaders or at least shader like things in Swing? Is there? Because I'm wondering if it supports GLSL, HLSL, or it's own shading language? I don't know much about Swing graphics. Does anyone know?

sentences:
C++ Freetype advance X problem I'm currently working on a font-rendering system for my OpenGL based engine.
I sure got something to work, but the only thing I still have problems with, is the horizontal advance!

This is what it spits out, obviously not correct. If I understood correct from the documentation and some other threads, this is the procedure to draw a string:

set current drawing position to (0, 0)
draw first character
move drawing position in the x for advance.x
draw second character
move drawing position in the x for next face->glyph->advance.x
... repeat

Is that correct? If not, what am I doing wrong?
I think its worth to say that I render every character as a texture!

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:
How do I create a closed beta on Google Play? As per suggestion I'm splitting How do I create a closed beta on the App Store? up.

Can I upload the game I'm developing to Google Play as a closed beta, so I could generate a couple of keys/tokens for my testers? I'm hoping to only publish the game for the public after I'm happy with the game as it's offered on Google Play, as a complete user experience which includes the installation process.

If this is not the usual workflow, how should I do it?

sentences:
Efficient way of training a chabot AI I am currently working on a chatbot game using Python 2.7.10.
I use the Chatterbot library.
This library seems to do all I need but the training data (or corpora) are very very limited.

I haven't quite decided what the game is going to be like.  I was thinking of doing something where the bot contacts you on behalf of a assassinated police inspector and asks you to help it solve the case.

But I am still at the stage where I am experimenting what can and can't be done using a chatbot.

An alternative to this game would be a simple "guess who" kind of game.

I had a look online expecting to find a lot of every day conversation chat logs especially made for training chat bots. But I could only find a few logs of quiet random conversion (mostly on programming). I thought of using plays and film scripts but that requires a lot of editing. What recommendations would you have.  I basically need strings lists in which each string is a response to the previous one. I can also train pairs of question answer.

sentences:
DirectX 11 Mouse Picking Problem I'm trying to do mouse picking and actually it works but when I scale the object and click that point on the image it picks wrong one, this happens only after scaling an object and I'm sure matrices are correct, any idea?

    DirectX::XMFLOAT4X4 projection;
    DirectX::XMStoreFloat4x4(&projection, Graphics::projectionMatrix);

    float viewX = ((2.0f * Input::GetMouseX()) / MainWindow::GetDisplayResolution().width - 1.0f) / projection(0,0);
    float viewY = (1.0f - (2.0f * Input::GetMouseY()) / MainWindow::GetDisplayResolution().height) / projection(1,1);

    DirectX::XMMATRIX inverseMV = DirectX::XMMatrixInverse(nullptr,DirectX::XMMatrixTranspose(entity->Renderer_->MV_Matrix)); //MV is column order

    DirectX::XMVECTOR rayOrigin = DirectX::XMVector3TransformCoord(DirectX::XMVectorSet(0.0f,0.0f,0.0f,1.0f), inverseMV);
    DirectX::XMVECTOR rayDirection = DirectX::XMVector3Normalize(DirectX::XMVector3TransformNormal(DirectX::XMVectorSet(viewX, viewY, 1.0f, 0.0f), inverseMV));

    for (const auto& subMesh : entity->Renderer_->mesh->GetSubMeshes())
    {
        float distance = 0.0f;
        if (subMesh.AABB.Intersects(rayOrigin, rayDirection, distance))
        {
            for (unsigned int i = 0; i < subMesh.GetIndexCount(); i += 3)
            {
                DirectX::XMVECTOR p1 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i]]);
                DirectX::XMVECTOR p2 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 1]]);
                DirectX::XMVECTOR p3 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 2]]);

                if (DirectX::TriangleTests::Intersects(rayOrigin, rayDirection, p1, p2, p3, distance) && distance < minDistance)
                {
                    minDistance = distance;
                    *pickedEntity = entity;
                }
            }
        }
    }

sentences:
Overcoming float limitations for planet-sized worlds in Unity As far as I know, going further than 1M units from the world origin in Unity is hardly possible due to floating point precision issues.

Making a world more than 1M units in radius would require either using double vars for coordinates or utilizing some space division technique to divide a massive scene into hierarchical chunks with the smallest of them being around 10 000 units, i.e. each world-space position would be expressed by the chunk hierarchy the object's in and a bunch of float vars representing its local position (and possibly rotation and scaling) inside the last chunk.

Either way, doing this would require implementing a completly new coordinate system, so I'd like to know whether or not that is possible in Unity, and if so, how may I make it work with existing Unity systems like physics and so on.

P.S I can't just move the world into origin as the player moves since I want to have things going on simultaneously around the planet.

Thanks!

sentences:
How can I process continuously-held keys with SDL? I have created a cube in opengl using SDL. Now I am trying to move the camera in X direction if user presses left or right arrow keys and Y direction if user presses up or down arrow keys. Right now the camera moves by a fixed amount in a particular direction if the key gets pressed once. It doesn't matter how long does a person hold the key down, it moves by that fixed amount only. I want the camera to move continuously as long as the key is pressed.

Below is the code for keyboard polling.

        while ( SDL_PollEvent( &event ) )
        {
            switch( event.type )
            {
            case SDL_ACTIVEEVENT:
                if ( event.active.gain == 0 )
                isActive = FALSE;
                else
                isActive = TRUE;
                break;
            case SDL_VIDEORESIZE:
                surface = SDL_SetVideoMode( event.resize.w,
                            event.resize.h,
                            16, videoFlags );
                if ( !surface )
                {
                    fprintf( stderr, "Could not get a surface after resize: %s\n", SDL_GetError( ) );
                    Quit( 1 );
                }
                resizeWindow( event.resize.w, event.resize.h );
                break;
            case SDL_KEYDOWN:
                handleKeyPress( &event.key.keysym );
                break;
            case SDL_QUIT:
                done = TRUE;
                break;
            default:
                break;
            }
        }

And below i have mentioned the keypress handler function

void handleKeyPress( SDL_keysym *keysym )
{
    switch( (keysym->sym) ){
        case SDLK_ESCAPE:
            Quit(0);
            break;
        case SDLK_LEFT:
              eye[0] -= 0.1;
              break;
            case SDLK_RIGHT:
              eye[0] += 0.1;
              break;
            case SDLK_UP:
              eye[1] -= 0.1;
              break;
            case SDLK_DOWN:
              eye[1] += 0.1;
              break;
            default:
              break;
      }

    return;
}

What changes should I make in my code to handle continuous keystroke detection?

Note:
The following code does the required job but I don't understand why

if ( ( SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL ) ) )
{
        fprintf( stderr, "Setting keyboard repeat failed: %s\n",
             SDL_GetError( ) );
        Quit( 1 );
}

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:
HLSL Pixel Shader Sematics I have a HLSl pixel shader that I'm using to create a deferred buffer, I have simplified the code to show you:

struct PS_INPUT
{
    float4 PosWVP                   : SV_POSITION;
    float4 NormalWorld              : NORMAL2;
};

struct PS_OUTPUT
{
    float4 PosWorld                 : POSITION;
    float4 NormalWorld              : NORMAL2;
};

PS_OUTPUT main(PS_INPUT input) : SV_Target
{
    PS_OUTPUT output = (PS_OUTPUT)0;

    output.PosWorld = input.PosWorld;
    output.NormalWorld = input.NormalWorld;

    return output;
}

When I compile this code, I get this warning warning X3576: semantics in type overridden by variable/function or enclosing type, what is this warning and how can I fix it?

sentences:
How to create 2D shadows I'd like to create lights and shadows in a 2D environment, like in the image below:

I did several searches but got no results. Do you have any hint?

sentences:
Multi threaded game - updating, rendering, and how to split them From the StackOverflow post (it was recommended I move this):

So, I'm working on a game engine, and I've made pretty good progress. However, my engine is single-threaded, and the advantages of splitting updating and rendering into separate threads sounds like a very good idea.

How should I do this? Single threaded game engines are (conceptually) very easy to make, you have a loop where you update -> render -> sleep -> repeat. However, I can't think of a good way to break updating and rendering apart, especially if I change their update rates (say I go through the update loop 25x a second, and have 60fps for rendering) - what if I begin updating halfway through a render loop, or vice versa?

sentences: Animate moving object I have a sphere shot out of a cannon which i need to get lined up with another sphere when and if the two spheres collide. Considering that both spheres are moving (one in X and the other is shot at the first one) how would i animate the cannon sphere to line up if the collision occurs? I can use a bool to check if collision but how do i animate the projectile in the animation tab so that the projectile takes into consideration the always changing position of the X moving sphere ?

sentences:
Need help thinking of a way to code a text parser Apologies if this has been asked before, or if it is a bit too simple for this forum.
I'm new to C++ and as one of my first projects I have decided to try a textual adventure. Step 1: the text parser.
Note that I am aware that there are libraries out there that will make this for you, but I want to code it from scratch to learn what is going on :)

So! I've gotten to the point where I add the user's input to a vector, so that I can handle each word individually. However, I cannot for the life of me figure out a "handler" that does not hard-code everything.
I want to create a map through which to associate the string, for example "Go", to the relative action handler.
Something like this:

map<string, ActionHandler> actionMap;

actionMap["Go", GoActionHandler];

GoActionHandler would be a struct of ActionHandler type, and I would put in ActionHandler or the general messages/actions/reactions, and then in GoActionHandler I'd elaborate on the possible "Go" actions.
But, one thing at a time... The code above does not compile, as ActionHandler is not a "type".
Considering that for now I am just focusing on having a (scalable!) program that reacts differently based on the word entered, could someone help me by showing me real code? I've found online people making examples in pseudocode, but I'm to big of a noob to then know how to execute what they are talking about, even though I understand the logic.

So could anyone dumb this down and point me in the right direction? How do I include in my main() a way to call a struct/function based on the a string contained in a vector? (eg. string "Go" in vector[0]?)

sentences:
How to import three.module.js I'm looking at this three.js cubemap example, and it runs fine in my browser when loaded from that page.
After much strain to find and download the files - it does not run?
What am I doing wrong, with this "module" stuff?
I got it to work by changing:

<script type="module">
import * as THREE from 'three.module.js';
...

Into:
<script src="three.js"></script>
<script>
...

Can anyone explain how to properly import three.module.js? Why is this change necessary when I run the project on my machine?

sentences:
switching from third person view to first person view I have done a scene in opengl where I'm using a third person camera (that I can control with the mouse). Then, inside it, it has the camera of the first view (that I called thirdpersonCamera, see the code above), drawing the camera, the frustum etc..

It looks like this picture:

and I've done with this code:

void GLView::drawSubThirdpersoncamera()
{
    // set perspective viewing frustum in the 3rd person camera
    thirdpersonCamera.setFrustum(FOV_Y, (float)(W)/(H), NEAR, FAR);

    // use 3rd person camera projection matrix (the frustum, the perspective etcetera)
    // as the opengl camera
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(thirdpersonCamera.projectionMatrix.getTranspose());
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glPushMatrix();
    {
        // First, transform the camera (viewing matrix) from world space to eye space
        glLoadMatrixf(thirdpersonCamera.viewMatrix.getTranspose());

        // translate and rotate the mouse control
        // (keeping the camera fixed because
        // we want only the scene to rotate/translate)
        // for thinking about modern opengl: should be a matrix..
        glTranslatef(mousePosition[0], mousePosition[1], mousePosition[2]);
        glRotatef(mouseAngle[0], 1, 0, 0); // pitch
        glRotatef(mouseAngle[1], 0, 1, 0); // heading
        glRotatef(mouseAngle[2], 0, 0, 1); // roll

        // now the draw the scene
        drawScene();

        // draw the first person camera
        glPushMatrix();
        {
            glMultMatrixf(physicalCamera.viewMatrix.getTranspose());

            drawAxis(4);
            drawCamera();
            drawFrustum(physicalCamera.fovy, physicalCamera.aspectRatio, physicalCamera.near, physicalCamera.far);
        }
        glPopMatrix();

    }
    glPopMatrix();
}

Now I want to switch to the eye of the camera I've drawn, with this code:

void GLView::drawSubPhysicalCamera()
{
    // use physical camera projection matrix (the frustum, the perspective etcetera)
    // as the opengl camera
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(physicalCamera.projectionMatrix.getTranspose());
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glPushMatrix();
    {
        // the view matrix: how the camera is positioned in the world space
        glLoadMatrixf(physicalCamera.viewMatrix.getTranspose());

        drawScene();
    }
    glPopMatrix();

}

I think it should go because I'm using the same matrix once for translate the object in the screen, once for translate the camera but.. in the second view I don't see anything.. I don't find any error because the transformation in the space is the same but.. it doen't work..

Where am I wrong?

sentences:
SharpDX / DirectX: How to render text to a transparent BitmapRenderTarget? I'm trying to render text to a BitmapRenderTarget, cleared with transparent color.

My TextBox is drawn on its own SharpDX.Direct2D1.BitmapRenderTarget, which I create in this way:

var bitmapRenderTarget = new SharpDX.Direct2D1.BitmapRenderTarget(renderTarget,
    SharpDX.Direct2D1.CompatibleRenderTargetOptions.None, null, null, null);

As you can see, I don't change the pixel format of BitmapRenderTarget. The pixel format of underlying SharpDX.Direct2D1.RenderTarget, on which I draw my TextBox through DrawBitmap method, is defined in the following code:

renderTargetProperties = new SharpDX.Direct2D1.RenderTargetProperties()
{
    PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown,
    SharpDX.Direct2D1.AlphaMode.Premultiplied)
};

Here is the code, that produces visual results:

// In the case 1: opaque white background
bitmapRenderTarget.Clear(SharpDX.Color.White);
...

// In the case 2: white background with 50% transparency
bitmapRenderTarget.Clear(new SharpDX.Color4(1f, 1f, 1f, 0.5f));
...

// In the case 3: fully transparent background
bitmapRenderTarget.Clear(SharpDX.Color.Transparent);
...

// The color of textBrush in all these cases is the same solid Black.
bitmapRenderTarget.DrawTextLayout(vector, textLayout, textBrush, ...);

The results:

As you can see, alpha value of the text color is somehow bound to the one in the clear color. The black line around the text is cursor, and it is drawn as it should.

How to fix this issue?

sentences:
Picking a specific point of a map in Direct 3D I'm trying to pick a specific point on a randomly generated terrain with bunch of tiny triangles. Right now, I'm just iterating through every triangle and picking a intersected triangle using D3DXIntersect function. It serves its function but the performance is just not tolerable.

Is there a way to pick a triangle without millions of iteration?

sentences:
Why should I forbid real-money trading in my MMO? I am soon going to go public with an MMO game, and I am currently in the progress of writing the terms of use I expect players to follow (no swearing, no spamming, no cheating... you get the point).

My game allows players to trade rare items with each other.

I noticed that almost all online games which have trading, usually have a clause in their terms of use which explicitly forbids players to trade ingame items or ingame money for real-world currency.

I was wondering about the reason for this rule. Why should you ban real-money trading in an MMO?

sentences:
How can I improve my Animation The first approaches in animation for my game relied mostly on sine and cosine functions with the time as parameter.

Here is an example of a very basic jump I implemented.

if(jumping)
{
    height = sin(time);
    if(height < 0) jumping = false; // player landed
    player.position.z = height;
}

if(keydown(SPACE) && !jumping)
{
    jumping = true;
    time = now(); // store the starting time
}

So my player jumped in a perfect sine function. That seems quite natural, because he slows down when he reached the top position, and in the fall he speeds up again. But patching every animation out of sine and cosine is stretched to its limits soon.

So can I improve my animation and provide a more abstract layer?

sentences:
how to make a seemingly endless backdrop in Unity Potential solution at the bottom.

I have a rocket which flies straight up, as it gets higher you can see the edge of the terrain. I want the rocket to eventually leave the atmosphere and then the landscape to disappear from view as the player would be so high up.

How do i make it appear that the landscape is endless?

image pre launch:

image post launch:

My solution to anyone who has the same type of question

firstly i made a mountain range using the terrain, a 3x3 tiled one worked for me. I then used the lighting settings to add fog to the scene, to slightly obscure the mountains. Lastly i rotated the camera upward by -5 when the rokcet reached a certain position to further hide the blankness behind the mountains. images shown below:

pre-camera rotation

post-camera rotation

sentences:
LWJGL Applet Security Exception I created small game in Java using LWJGL 2.9.3 and would like to add it to webpage as Java applet. I have followed this tutorial and have used this app loader. All the Java code works and I can tun the applet in my IDE. However, when I try to run the applet in a webpage I get the following error:

  SercurityException

  attempted to open sandboxed jar http:// 127.0.0.1/lwjgl_util_applet.jar as Trusted-Libary

Any idea what is wrong and how may I fix it?

sentences:
Where can I find code examples of different variations of Perlin noise? I have seen the PCG wiki, and it is a great resource. But a lot of the articles are very brief and it is hard to find good links on specific things.

I have been searching for ways to transform my Perlin noise height maps to make ridges, rivers, and other terrain features. I also can't find any articles on how to divide up the map into different areas for calculating texture coordinates or other values specific to the game. I have only been able to find websites detailing their software that can generate the different things, but no code or explanations. Are there any good sources of code examples/explanations on how to do the above mentioned with Perlin noise?

PS. This should probably be a community wiki. I don't know how to make it as one though.

sentences:
How do you create a perfect maze with walls that are as thick as the other tiles? http://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/

I read this article about dungeon and maze generation. The author uses a kind of specialized algorithm for generating 'perfect' mazes that have walls of non-zero thickness.

(Edit: I misunderstood the term 'perfect' here.  It actually means there are no loops in the maze)

As I understand, typical maze algorithms work for walls of zero thickness but this is not what I want.

He posted his code in the article, but after a cursory glance, I think I need someone to explain the procedure (or a similar one) in plain english.

My first two attempts looked like:

Which produces an effect with the diagonals that are unsightly.

and then:

Which is better but its not 'perfect' in the sense that it seems to waste some space.

If someone can give me simple english instructions I might post the python code after I get it working.

sentences:
How can I get the specific tile in a collision with a Tilemap? I am developing a simple platformer, I have three types of tiles right now:

Floor: does nothing on collision.
Bad: makes the player lose the game.
Good: makes the player beat the game.

I am trying to detect the collision with this code I found:

extends RigidBody2D

func _process(delta):
    var tile = get_parent().get_node("TileMap").get_cellv(get_parent().get_node("TileMap").world_to_map(position))
    print(tile)

The tile variable is supposed to contain the identifier of the type of tile the player is touching, but it doesn't, it always returns -1 (No exception or error, just -1).

I believe returning -1 means it isn't touching any tile, but it is.

This is using Godot 3.0 stable.

What am I missing?

Thank you for your patience.

sentences:
Should I use animation or simple object rotation in this case I'm making game where players control hover tanks using Unreal Engine 4.
Tank have a turret which rotates around for aiming. Turret pivot/center of mass is not exactly in joint with rest of tank so it rotates around point behind the turret.
You can see it here: https://www.youtube.com/watch?v=2k_d4u6Htzg

I asked my friend who made this mesh to create skeleton for it.
Now I'm not sure, which is the best way to implement correct rotation.

Should I make and use animation of tower rotating?
Keeping turret as child of rest of tank and simply rotating it was easier and more straightforward, so maybe I should just change pivot position?
Maybe, there is some easy way to rotate turrent around bone?

Which way is best in Your opinion and why?

sentences:
Alpha blending not rendering properly XNA 4.0 I'm trying to render a tree made out of 2 rectangles intersecting in the center at a 90degree angle. The texture has an alpha channel but which ever rectangle gets rendered second causes a weird problem with the transparency.

Here is my rendering code:

public override void render(GraphicsDevice gd, Camera camera)
{
    RasterizerState rs = new RasterizerState();
    rs.CullMode = CullMode.None;
    gd.RasterizerState = rs;
    gd.BlendState = BlendState.AlphaBlend;

    effect.CurrentTechnique = effect.Techniques["TexturedNoShading"];
    effect.Parameters["xWorld"].SetValue(Matrix.CreateTranslation(position));
    effect.Parameters["xView"].SetValue(camera.getViewMatrix());
    effect.Parameters["xProjection"].SetValue(camera.getProjectionMatrix());
    effect.Parameters["xTexture"].SetValue(m_texture);

    foreach (EffectPass pass in effect.CurrentTechnique.Passes)
    {
        pass.Apply();

        gd.Indices = m_indexBuffer;
        gd.SetVertexBuffer(m_vertexBuffer);
        gd.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, m_vertices.Length, 0, m_indices.Length / 3);
    }

    rs = new RasterizerState();
    rs.CullMode = CullMode.CullCounterClockwiseFace;
    gd.RasterizerState = rs;

    gd.BlendState = BlendState.Opaque;
}

sentences: What's the difference between UnityEvent and OnTriggerEnter() I'm new into game development and programming and I have a question that might sound silly or stupid, but I'm having issue understanding the difference between UnityEvent and OnTriggerEnter(). I would like to understand what I can do with UnityEvent that isn't possible with OnTriggerEnter().

sentences:
How to Draw texture between 2 Vector3 My scenario:
RTS combat style, 1 unit fires beam on another unit

My problem is i want to draw a flat texture between 2 Vector3 points. I have looked at various Billboarding styles but that doesn't give me a proper solution.

I looked at this:
http://msdn.microsoft.com/en-us/library/bb464051.aspx

is BasicEffect and DrawPrimitives the correct solution just stretch the texture to the distance between point of origin to target? I used the quad class they used but i found this it seemed to inflexible

So my question to you is how would i go about this sort of problem?

Regards

sentences:
Simple state pattern and circular dependancies I'm creating a game engine which utilizes a state machine following this GameDevGeek tutorial.  My concern is the use of circular dependency which I've heard is bad.  The game engine has the game state but the game state needs access to the game engine for a state to be able to transition to a new state.  Is this a proper way of doing it?  Namely my implementation, includes, and forward declarations.  On another note, why does syntax highlighting randomly turn off after two files have #included each other?  Here's my code:

// Game.h
#ifndef GAME_H
#define GAME_H

#include "GameState.h"
#include "SFML\Graphics.hpp"

class GameState;

class Game
{
public:
    Game();
    ~Game();

    void setState(GameState* state);
    void handleEvents();
    void update();
    void render();

private:
    sf::RenderWindow window_;
    GameState* state_;
};

#endif

// Game.cpp
#include "Game.h"

Game::Game()
    : window_(sf::VideoMode(500, 500), "Test Game", sf::Style::Default) ,
{
    window_.setKeyRepeatEnabled(false);
    state_ = nullptr;
}

Game::~Game()
{
    if (state_ != nullptr)
    {
        state_->destroy();
        delete state_;
    }
}

void Game::setState(GameState* state)
{
    if (state_ != nullptr)
    {
        state_->destroy();
        delete state_;
    }
    state_ = state;
    if (state_ != nullptr)
    {
        state_->init();
    }
}

// more code...

// GameState.h

#ifndef GAME_STATE_H
#define GAME_STATE_H

#include "Game.h"
#include "SFML\Graphics.hpp"

class Game;

class GameState
{
public:
    virtual void init() = 0;
    virtual void update(Game* game) = 0;
    virtual void render(sf::RenderWindow &window) = 0;
    virtual void destroy() = 0;

    void changeState(Game* game, GameState* state);
};

#endif GAME_STATE_H

// GameState.cpp
#include "GameState.h"

void GameState::changeState(Game* game, GameState* state)
{
    game->setState(state);
}

sentences:
Unity "static" references I have been researching this for 2 days now and I cannot seem to find a proper response. I am trying to figure out a good way to store constant variables within my game.

Basically, does it make more sense to create a singleton script that holds all my prefabs inside it so I can easily access them and instantiate through the game? Or does it make more sense to keep all my assets inside the Resources folder and then call Resources.Load throughout the game (or through a Static class that holds references to all the resource paths and loads the resources on start up)

I have the same question regarding variables used within runtime. Would it be better to run through the Static class that is holding all these prefabs through the Resources folder? Or would it make sense to also hold these values inside the singleton.

Thank you!

sentences:
Destroying cubes in combined mesh at runtime How could I destroy cubes from a mesh? Once i've combined my cube to a single mesh, would it be possible to be able to destroy one of these cube but to keep a mesh ?
Ive seen a video where te person show a script to cut square or triangle shapes into a plane, so I tought it might be possible in 3d (Holistic3d is the person).
Does anyone have a script to do that ? because I have no clue how it could be done.

sentences:
Custom rendering inside Awesomium Is there a way to render something custom inside some html element in Awesomium?

For example:
I have inventory screen (that can be moved around) that has 3D avatar playing some idle animation weilding all equipped items. The screen should be html but the avatar is rendered by the game (to some texture) and now i need to display it on html page.

sentences: What is a rim shader used for? What does a rim shader do and what is it used for? In what cases would it make sense to utilize a rim shader?

sentences:
game maker stop overlapping buildings I'm trying to make a game with real time strategy elements, where you can build several different buildings.

The problem is that I can't seem to make the buildings stop overlapping. That is too say, if try to build while my mouse is hovering over a building, it won't build, which is good.

But the moment that my mouse is no longer over a building, I can build again. And since the buildings have a centered origin, the building is build around the coordinates where the mouse is. This causes overlap between buildings, which is bad.

I have the following code in a step event of a control object:

if (mouse_check_button_pressed(mb_left)) {
  if (!position_meeting(mouse_x, mouse_y, all)) {
      instance_create(mouse_x, mouse_y, obj_shed);
      player_money -= 100;
  }
}

Any help would be greatly appreciated.

EDIT: The code now follows the suggestions of Despicable and looks as follows:

var object, width, height;
object = obj_shed; //Change to your desired object
w = object.sprite_width;
h = object.sprite_height;

if (mouse_check_button_pressed(mb_left)) {
  if (!collision_rectangle(mouse_x-w/2,mouse_x+w/2,mouse_y-h/2,mouse_y+h/2,all,0,1)){
    instance_create(mouse_x,mouse_y,obj_shed);
    player_money -= 100;
  }
}

However, w and h give an error, so now i need to find a way how to get the width and heigh of an object that is not the calling instance (because the calling instance is a control object, in which is code is situated)

EDIT: Solution

I was able to change the solution so that the buildings won't overlap, even if the buildings aren't circular:

In the control object, in the step event, write the following:

if (mouse_check_button_pressed(mb_left)) {
      instance_create(mouse_x, mouse_y, obj_shed);
}

And in the create event of your building (shed in my case):

if (!place_meeting(mouse_x, mouse_y, all)) {
      global.player_money -= 100;
}
else {
    instance_destroy();
}

So on creation of the building, it checks if there is a collision. If so, it destroys itself. If not, it stays there and deducts the cost of the building. This works with any shape of building.

sentences:
Should I code game logic separately from game engine scripts I'm developing a game in Unity3d, economic strategy.
I wonder if I should code logic inside unity scripts, or write it as an external module/library?

By game logic I mean game model, which describe game entities, they relation with each other, their methods. And this logic has nothing to do with and doesn't need to know anything about networking, rendering, representation etc.

If I do it inside unity scripts, then logic is tied to unity engine and I don't see a way to implement multiplayer(client-server) without rewriting whole logic for server-side, where unity cannot be used.

I would like to define logic outside of scripts, and later, reference it inside some "main" unity script. This way I could implement multiplayer easily.

Is this a common practice, or should I avoid it, or maybe there is some alternative patterns?

sentences:
How simulate a random distribution? I'm working on a battle algorithm for a text-based game and I stumble when it comes to randomly distributing attacks on a set of units.

E.G, 100 archers shoot 100 targets at the same time. I thought of doing like this :

The 100 targets are considered as a single block
The arrows are distributed inside
The units hit the same number of times are grouped together.
I manage the life of each new group
Repeat on each new group if necessary

I can distribute the arrows (step 2) and get the result (step 3) through a loop, but with many armies composed of millions archers, computing time & memory consumption becomes a problem.

// Step 2
const targets = new Array( 1000000000 );
targets.fill( 0, 0, 1000000000 );
const arrows = 1000000000;
for( let i = 0; i < arrows; i++ ){
    const index = Math.floor( ( Math.random() * arrows ) );
    targets[ index ] += 1
}
//Step 3
const result = []
targets.forEach( value => {
    if( value ){
        if( result[ value ] ) result[ value ] += 1
        else result[ value ] = 1
    }
} )

Is there another way to solve this problem ? I believe that with large numbers, directly calculating the most likely scenario may be a good option. Unfortunately, I do not know anything about probabilities.

sentences:
Deferred contexts and inheriting state from the immediate context I took my first stab at using deferred contexts in DirectX 11 today. Basically, I created my deferred context using CreateDeferredContext() and then drew a simple triangle strip with it.

Early on in my test application, I call OMSetRenderTargets() on the immediate context in order to render to the swap chain's back buffer. Now, after having read the documentation on MSDN about deferred contexts, I assumed that calling ExecuteCommandList() on the immediate context would execute all of the deferred commands as "an extension" to the commands that had already been executed on the immediate context, i.e. the triangle strip I rendered in the deferred context would be rendered to the swap chain's back buffer.

That didn't seem to be the case, however. Instead, I had to manually pull out the immediate context's render target (using OMGetRenderTargets()) and then set it on the deferred context with OMSetRenderTargets().

Am I doing something wrong or is that the way deferred contexts work?

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:
Unable to Set-Up unity remote? I have installed Android Studio and set the path in unity. And I am able to build apks with no problem. But when I try to test in unity remote unity gives an warning as

  Set-up Android SDK path to make Android remote work

I don't know what is happening. If Android SDK path is not set then how am I able build the apks.

I tried to solutions like enabling usb debugging mode , running unity editor first then opening Unity Remote , installing Google USB driver component of Android SDK but none of them worked for me.

sentences:
How to avoid entities flying far away when tabbing out and then tabbing back in? I'm developing a game which uses a standard Entity-Component-System.
Every frame, the PhysicsSystem runs, which, among other things, updates the position of entities based on their velocity. Something like this:
execute(delta: number, elapsed: number) {
  for (let entity of this.scene.query(CT.Transform, CT.Physics)) {
    let transform = entity.get(CT.Transform);
    let physics = entity.get(CT.Physics);

    let movementIncrement = physics.direction.multiply(delta * physics.friction * physics.speed);

    physics.velocity = physics.velocity.multiply(1 - delta * physics.friction).add(movementIncrement);
    transform.pos = transform.pos.add(physics.velocity.multiply(delta));
  }
}

This works fine, except there's an issue. When the user switches to another tab, waits some time (let's say 5 seconds), and then tabs back in, sometimes the entities instantly fly away so far that they fly off the map and out of bounds.
I'm not sure why this would happen, as it never happens during normal gameplay. Something to do with the tab becoming inactive for a time, and then active, seems to cause this issue.
I suppose a possible solution is to "pause" the game if the tab loses focus, but I rather the game keep running in the background unless the user manually pauses by hitting escape.
Does anyone know why this is happening? The rest of the game continues functioning normally, it's just the entity positions fly away for some reason.

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:
Disable/Remove Warning about a not bound Render Target View So to render into my shadow map depthstencil buffer i only bind a DepthStencilView to the Output Merger. Like this

    m_pContext->OMSetRenderTargets(0,0, m_pShadowMapDV);
    m_pContext->ClearDepthStencilView(m_pShadowMapDV, D3D11_CLEAR_DEPTH, 1.0f, 0);

Now this works fine and my shadow-map also produces the desired result. What bothers me though is the constant warnings in the debug-window. Is there a way or trick to disable that warning?

D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: The Pixel Shader expects a Render Target View bound to slot 0, but none is bound. This is OK, as writes of an unbound Render Target View are discarded. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Render Target View here. [ EXECUTION WARNING #3146081: DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET]

This might be a pretty dumb question, but after googling a lot i still came up empty. Only i a lot of people who are not doing this on purpose.

EDIT: Maybe the question can be asked in another way:

Is there a way to define an empty PixelShader? If i define the return value as void it notifies me, that i have to at least return the 4 pixel colors. If i don't give it any Semantics it does not work either.

sentences: Unity 5.3.4: Controlling multiple audio sources at once? Is there a way to control the max distance of a group of audio sources at once? I want to implement all my sounds, then be able to play with some of the audiosource settings of all of them..

sentences: Unity: Combine two UVs by alpha I'm currently creating a voxel game like Minecraft. To display the damage of blocks, I want to combine the alpha channel of one part of my texture map with the actual texture (like Minecraft does), how could I do that in Unity?

sentences:
Player disappears when it collides with a tagged object I am working on a simple game where the goal is to help a Player catch specific objects with a tag "Present".

After taking care of the models, animations I am now working on the collisions and counting UI.

For the collisions, on my Player Controller (I am using the ThridPersonUserController from the player Unity Standard Assets - which simplified the whole animation process), I added the following functions:

    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.tag == "Present")
        {
            Destroy(gameObject);
            count = count - 1;
            SetCountText();
        }
    }

    void SetCountText()
    {
        countText.text = "Count: " + count.ToString();
        if (count == 0)
        {
            winText.text = "Thanks to you the Christmas will be memorable!";
        }
    }

However, like this, when the Player hits an object with the tag "Present", even though the counting is working properly, the player disappears.

I have tried to change the OnCollisionEnter to an OnTriggerEnter, like this:

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Present"))
        {
            Destroy(gameObject);
            count = count - 1;
            SetCountText();
        }
    }

However when the Player hits the objects with the tag "Present", they don't disappear.

My Player has a Capsule Collider and a Rigidbody.

The objects with the tag "Present" have a Box Collider and a Rigidbody.

Any guidance on how to make my Player stay in scene while removing the other objetcs and reducing the count is appreciated.

sentences:
Explain the difference between extrapolation and interpolation http://www.unagames.com/blog/daniele/2010/06/fixed-time-step-implementation-box2d here there are two algorithms of smoothing in case of fixed time step physics simulation. I don't understand the formula of interpolation:

state = currentState * alpha + previousState * (1-alpha)

And also I don't understand the comparison figure. Please explaing what is the meaning of multiplying current state with alpha and summing with previous state with 1 - alpha.

sentences:
Why the points List and the agents List are empty in the WaypointsAI script? I created a class for the points and agents :

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

using System.Linq;
using System;
using UnityEngine.AI;

[Serializable]
public class WaypointsClass
{
    public List<Transform> points = new List<Transform>();
    public List<NavMeshAgent> agents = new List<NavMeshAgent>();
}

Then created a script that find waypoints and add them to the points list and agent/s to the agents list:

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

public class RedWaypoints : MonoBehaviour
{
    public GameObject[] redWaypoints;
    public NavMeshAgent redAgent;

    private void Awake()
    {
        redWaypoints = GameObject.FindGameObjectsWithTag("Red_Waypoint");

        WaypointsClass wpc = new WaypointsClass();

        foreach (GameObject point in redWaypoints)
        {
            wpc.points.Add(point.transform);
        }

        wpc.agents.Add(redAgent);
    }

    // Start is called before the first frame update
    void Start()
    {

    }

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

    }
}

In the end the WaypointsAI script :

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

public class WaypointsAI : MonoBehaviour
{
    public WaypointsClass waypoints;
    public float distanceToContinue;

    private float currentDistanceToPoint;
    private int lastPointIndex;
    private int goalPointIndex;

    void Start()
    {
        //Firstly check if the waypoints are set up correctly
        if (waypoints.points.Count < 1)
        {
            Debug.LogError("Set up the waypoints for this gameObject!");
        }
        else
        {
            //Now set up the path
            lastPointIndex = 0; //Start from the index 0
            waypoints.agents[0].transform.position = waypoints.points[0].position;
            if (waypoints.points.Count > 1)
            {
                goalPointIndex = 1; //Go to the [1] waypoint
            }
            else
            {
                goalPointIndex = 0;
            }
        }
    }

    void FixedUpdate()
    {
        for (int i = 0; i < waypoints.agents.Count; i++)
        {
            //Calculate the distance and check if it should move to the next waypoint.
            currentDistanceToPoint = Vector3.Distance(waypoints.agents[i].transform.position, waypoints.points[goalPointIndex].position);
            if (currentDistanceToPoint <= distanceToContinue)
            {
                //Save the old index, totally useless in this implementation though
                lastPointIndex = goalPointIndex;
                //Increase goal index to change the goal waypoint to the next, (Or maybe random one?)
                goalPointIndex++;
                if (goalPointIndex >= waypoints.points.Count)
                    goalPointIndex = 0;
            }

            //Now move towards the current waypoint, Change this to fit your code with navMesh anyway I think I did a lot for you anyway
            waypoints.agents[i].transform.LookAt(waypoints.points[goalPointIndex].position);
            waypoints.agents[i].transform.Translate(Vector3.forward * Time.deltaTime * 10);
        }
    }
}

The problem is that in the first line in the WaypointsAI script the points List is empty :

if (waypoints.points.Count < 1)

points is empty. How can I resolve it ?

sentences:
Kerning between glyphs using SDL2_ttf I'm loading a number of characters (using SDL2_ttf) into a texture atlas to improve performance.

The glyphs can be separately rendered correctly, however, how can you find the kerning distance between two characters that will sit next to each other?

As a follow up, are there any other variables that impact font rendering?

sentences:
Unreal Engine Niagara Write to Texture or Data Structure In the Niagara system, is there any way to write to a texture? I want to write the position of each particle into a texture. So the 2d grayscale texture has its intensity as the number of particles in the pixel.

Or, is there any data structure that I can use to store the particle positions? Something like 2d or 3d array?

sentences: How are the same items generated with slightly different attributes? Consider games like Destiny.  How do they generate weapons that have the same skins and names, but different attributes?  Two people can have the same weapon or armor piece, but have different attributes on these pieces based on luck or drop rate etc.  How is this accomplished programmatically?

sentences: Using libraries in libgdx This is the first time I'm using libgdx and I've got one problem. I am confused by the web of dependencies and the number of projects and I'm not sure how and mostly where to add a third party library I want to use. It should work both for desktop and android. How is this done?

sentences:
Just how expensive is it to bind textures in OpenGL? (LibGDX) I'm using LibGDX on top of OpenGL and currently my game engine does something along the lines of the following per frame

Bind a terrain texture sprite atlas and a set of transparency masks in another texture atlas
Render terrain tiles using the 2 bound textures to a FBO
Bind a character and item texture sprite atlas
Render characters over the terrain to the same FBO
Bind the same transparency mask atlas and a normal map texture for the terrain
Draw the same terrain tiles' normal map version to a different FBO
Bind the character and item normal map texture atlas
Render character normal maps over the terrain normal map FBO
Bind this normal map FBO as a texture
Render lighting information to a different FBO using the normal map texture information
Bind the diffuse and lighting FBOs as textures
Use these to render the combined final image to the main display

So in summary, each frame I'm binding a total of 9 different textures, one or two at a time.

Should I look into changing my code so all 9 textures are always bound, and the correct one is referenced at the right time? Or is this a reasonable amount of texture binds per frame that isn't going to impact overall performance to a noticable effect? Assume I'm aiming for 60fps and there's a fair amount of other calculations going on per frame.

sentences:
How to calculate acceleration distance(frictionless, massless) Object A is moving via. 2D rigidbody by velocity V and in script is defined breaking power P. Every frame of breaking (P * Time.deltaTime) is subtracted from velocity V (in other words, ignoring mass). How i can calculate distance D required to slow down to target velocity tV ?

I'm not actually using force/power but i setting velocity directly with this line of code :

Vector3 dir = transform.TransformDirection(Vector3.up);
ship.rb.velocity = Vector2.MoveTowards(ship.rb.velocity, (dir * maximalSpeed) * ship.massModifier, speedGain / ship.massModifier);

(Don't worry about ship.massModifier, Basically heavier ship hulls are slower)

I'm self-learning Indie developer and i need this for AI to my game. Enemy in space ship have nothing like space-breaks so only way how to slow down is to turn ship by 180 degrees and thrust forward in counter-direction.I need to know this to calculate distance from target required to slow down and prevent possible collision with target.

sentences:
Moai: Clipping an image to a polygon I'm using Moai SDK. I have an image and some random convex 2D polygons. I want to show only the parts of the image inside these polygons.

Here's an example image:

The same, shown only where the polygons are:

How can I achieve this?

sentences:
How do I change a LÖVE2D game executable's icon? I merged my game.love file and the love.exe with the command copy /b love.exe+app.love game.exe. But the resulting executable has the default LÖVE2D icon.

Is there a way to change that icon to another one?

sentences:
How does super.render() call this method? Today I was experimenting with adding different screens with Scene2d in libgdx and while doing so I became confused how super.render() in my render() method from my starter class (MyGdxGame) called render() in my PlayScreen() class. Basically I understand you use super to call methods, fields, invoke a super class constructor etc... however I don't see how my Main class witch extends Game is a subclass/derived class of my PlayScreen class witch simply implements Screen. In short I don't see how those two classes are related so that super.render() in MyGdxGame class can call render() in my PlayScreen class.

Also I looked at the API and Screen implements ScreenAdapter and Game implements ApplicationListener but I still don't see how that connects.

Starter class:

public class MyGdxGame extends Game {
    Game game;

    @Override
    public void create() {
        game = this;
        setScreen(new MainMenu(game));
    }

    @Override
    public void render() {
        super.render();
    }

    public void dispose() {
        super.dispose();
    }

    public void pause() {
        super.pause();
    }
}

PlayScreen class:

public class PlayScreen implements Screen {
    private static Player player;
    SpriteBatch batch;
    GameControls x;
    CollisionManager collisionManager;
    ArrayList<Tree> trees;
    Iterator itr;
    Enemy enemy;
    Animations animation;
    Game game;
    MainMenu mainMenu;

    public PlayScreen(Game game, MainMenu mainMenu) {
        this.game = game;
        this.mainMenu = mainMenu;
    }
// more code ...
}

sentences:
Resolution problems with global illumination in Unity I am pretty new to Unity and after hours of searching I have finally figured out how to set everything up for (baked) global illumination to work for my model.

However the model is an export from a CAD program and so the mesh is rather bad quality (it seems it is optimized by the CAD program for minimum number of triangles). At least I am implicitely assuming that this is a bad quality mesh because it would by standard of finite element meshes, which of course doesn't directly apply here.

So what I am observing is three resolution problems (see images):

1) the lighting in the scene is somewhat "cloudy" although the faces are evenly colored and there are no lights that could explain the patterns (see eg. area inside drawn red rectangle)

2) there are slight jumps in brightness visible at the edges of the triangles of the mesh (see red arrows and, for comparison image of mesh)

3) the shadows are pixelated (see red ellipse, yes I have already tried to change shadow quality to high in the project settings, but to no avail)

Because there are so many settings that affect lighting, I assume it will take me hours if not days with trial and error to figure that out.

Which settings are likely to be responsible for these three problems?

I found a display mode of the scene view, called: Baked Global Illumination->UV Charts that probably explains the first problem, but I don't know how to interpret it, see third image below:

sentences:
How to generate point based on a map I am making a multiplayer game in Unity, with a socket.io server in NodeJS.
I am using a globe, with a texture to represent the world in Unity.

Let's say something similar do this.

Now, there I am stuck with some algorithm.

I would like to generate equally distant point, on the lands, where user can build stuff.

Something similar to this :

I saw this post here post and I would like to generate the map in the server, create from the generate map a mongoDB collection of point. When a user connect, he get back a list of point (that are already generated and can interact with those).

I get stuck on the generation. How do I make the server generate point based on a map that I will show to client, but that the server do not have idea of ? How would I store the coordinate position, so that the server generate them, and the client no matter the scale of the map would be able to display them at the good point ?

Basically, I don't know where to start to make this algorithm. I just would like some idea on how you would achieve this, so I can inspire myself to find my solution.

sentences:
How to dynamically construct a reference to a game object by name I have game objects tagged MenuOption0, MenuOption1, MenuOption2, etc. I want to keep a currentIndex var, which gets incremented each time the user swipes on the controller. That swipe should increment the currentIndex var, and switch the reference to a new game object, whose text color will be changed.

This is what I'm trying as a test:

GameObject testText = GameObject.Find("MenuOption" + 4);
TextMeshProUGUI thisTextMesh = testText.GetComponent<TextMeshProUGUI>();
thisTextMesh.color = colorWhite;

How do I dynamically construct a reference to MenuOption1,2,3,4,etc? Or is there a better way to handle this without writing a big long conditional?

sentences:
Player appears in front of objects even if it's in the background I have a player in Z=0 and a fence object that I want it to be in from of the player so I set it to Z=1, it's a 2D game but in the 3D view I can see that the fence is actually in front of the player but in the 2D view the player is displayed in front.

Here are a couple of screenshots.

3D view, fence in front of player:

2D view, player in front of fence:

Any idea how to fix this?

sentences:
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:
Ability/Skill Data and Method Structure (C#, Unity3D) So I've come to design my game which players will be having a unique set of skill or ability to come with. I can store skill name, mana cost, cooldown, etc in database which each skill have in common, but as we gamer know, a skill is unique not just by its attributes, like the sequence of movement, the object will be instantiate in the world, it's just that very unique.

So the question is, where do I put this "unique", the skill sequences? Do I make skill1.cs, skill2.sc for every single skill? xml for sequence then make script to read and define myXml?

For example, in a game, the effect of each card is very unique for example card1 allow player to deal damage and draw card, card2 just deal damage, card3 deal damage to enemy and then draw a card, and so-on, where and how they store this sequences or method of each card effect?

sentences:
Creating a static 2D background at runtime I'm using unity for a 2D game.

We have a lot of props for grass, plants, flowers, etc that are static and always in the background. I'd like to optimize the background and reduce the drawcalls as much as possible by making a big image with the final result of the background.

The idea would be to draw on a texture all the elements in the background, and then use this texture as the background. This way a single element has to be drawn.

How can I create these background texture at runtime, so it is generated as soon as the scene is loaded?

sentences:
unity UI limitation for tutorial purpose i want to add a tutorial part to my game that i make by unity.i have some panels that for tutorial purpose i want to limit user to just click a button.most of games make a dark panel over all places except learning  UI.

i know there is lots of ways for making that but is there any standard way for that?

sentences:
Shaders and Performance I'm coding my first Shader in my little game engine, and I have some questions about it's performance and common approaches.

Is the Shader code processed by the video card instead of the PC processor? Just so I know if it's possible to share some calculations to save some processor power.
Generally, should I do the math calculations in my code or the Shader? I could calculate them all (lightning for example) and just send the final values to be multiplied/used to the Shader, but what's the best approach?
Shaders as far as I could understand are the main party responsible for visual effects, so for example, if I want to add a "blur" effect to only one object on screen, should I use an if/switch statement in the Shader or should I have different Shader/ProgramIDs and I just switch the call glUseProgram(programID)?

Sorry if some questions seems stupid, and thanks for your time!

sentences:
How should I actually enforce the effects of components? I asked a question about implementing components here:

Am I on the right track with this component architecture?

But I had more questions I'd like to ask.

What's the best way to actually enforce the effects of components?

For instance, I have an item object, and an optional HealingComponent. The HealingComponent allows the item to be used as a HealingItem (for restoring HP/MP/etc.). I compose the HealingComponent from up to 3 StatAffectorComponents (one for HP, MP and SP). That Affector dictates the target stat, the target amount of change, and the type of change (%, absolute, etc.). All the basic components are being implemented in C++, but I intend to make the basic components extendtable from my scripts (python)

Now my question is, how do I actually enforce this?

I had three ideas about how to do it.

Allow the HealingComponent to contain a Use function that takes in the appropriate parameters and applies the StatAffector components against them. This has the advantage of making it much easier to override/customize the behaviour if I extend it with scripts, but I'm also tightly coupling the mechanics of usage with the item.
Allow the game mechanics to enforce the components. When the item is used as a Healing Item, the mechanics will extract the stat affectors and apply them against the appropriate targets its self. This has the advantage of seperating the item/component from it's usage, but at the same time, I'll have to change the mechanics anytime I decide to add expanded functionality/components to healing items. Healing items may not change their effects too often in development, but certain item classes might
Allow the item itself to define it's Use function and make it responsible for checking against it's components. This is further specializing Item away from a base entity, but has the advantage of being overridable with scripts to allow custom components

In general, what is the best way to do this?

sentences:
What's the equivalent of UIBezierPath in Cocos2d-x? I'm beginner in Cocos2d-x , and i want to implement this tutorial with Cocos2d-x v.3 cpp, but the problem i dont know if there's UIBezierPath in cocos2d-x.

Could you help me to draw the Bezier Arrow please?

sentences:
Generate random vector relative to current vector within a certain degree in 3D space I'm creating a simple ray tracer and I think this would be the best place to ask. I've created my own engine in Go, and I've gotten pretty far. I am now implementing diffuse surfaces, so I'll need to generate a random direction to send scattered rays to fake diffuse.

I've looked at the other questions on here, and I found that was similar to my question, but it was for 2D space, and not 3D.

Let's say I have a direction a, and I want to generate a new direction that is random, and within 45 degrees of direction a. Since I'm working in 3D space, I can't simply find the perpendicular angle and lerp between them, so I'll need to do something different. For example, this is what I'd do in 2D:

dir = Vector2(1, 1).Normal()

perpDir = dir.Perp() // gets the perpendicular direction of `dir`

randDir = dir.Lerp(perpDir, rand() - 0.5) // rand is [0, 1)

I'm not very knowledgeable when it comes to math, so this needs to be pretty dumbed down for me to understand. Is there any simple way to find a random direction based on a current direction with a maximum rotation of a set maximum rotation like 90 degrees?

sentences:
How to always land a square box in 90 degree How can i Always Land a box in 90 degree

Here What i want

Here what i don't want

{
public Rigidbody2D boxRb;
public float jumpSpeed;
 public Vector3 rotation;
public float rotationSpeed;
public bool rotationEnabled;
public float gravityMultiplier;
void FixedUpdate()
{
    if (Input.GetMouseButtonDown(0))
    {
        boxRb.velocity = jumpSpeed * Vector2.up;
    }
    if (rotationEnabled = true)
    {
        transform.Rotate(rotation * rotationSpeed * Time.deltaTime);
    }
    if (Input.GetMouseButtonDown(1))
    {
        boxRb.velocity += Vector2.up * Physics2D.gravity.y * (gravityMultiplier - 1) * Time.deltaTime;
    }

}
void OnCollisionEnter2D(Collision2D collision)
{
    rotationEnabled = false;
    Debug.Log("Collided");
    rotationSpeed = 0f;
    boxRb.constraints = RigidbodyConstraints2D.FreezePositionX;
    transform.Rotate(0, 0, 90f);

}
void OnCollisionStay2D(Collision2D collision)
{
    rotationEnabled = false;
    Debug.Log("In collison");
    rotationSpeed = 0f;
    boxRb.constraints = RigidbodyConstraints2D.FreezePositionX;
}
void OnCollisionExit2D(Collision2D collision)
{
    rotationEnabled = true;
    Debug.Log("Free");
    rotationSpeed = 10f;
}

}

sentences:
Is a custom coordinate system possible in Unity Is it possible to create a custom coordinate system (i.e the one using double for coordinates or the one dividing the world into 'chunks' of safe size) not constrained by the floating point precision limitations in Unity, and make systems using the built-in coordinate system use that one instead somehow?

Thanks!

sentences:
How can I update a sprite sheet without affecting the sprites already being used? Every time I overwrite my sprite sheet with additional or updated sprites, I have to reattach the textures to all of my Animations and Sprite Renderers.  How can I update a sprite sheet without affecting the sprites on that sheet which are already being used?

During the development of even a small game, hundreds of textures are being used.  And new textures are being added and updated every day.  This results in many hours spent reattaching textures which could otherwise be used being productive.  What strategy can I use to prevent this?

This is an example of what I mean:

I have a sprite sheet with 40 textures. All of its sprites are attached to their relative GameObjects. I decide I want to change the color of one of my sprites' hat. I go into gimp and load the sprite sheet. I change the color of the hat. I overwrite the old sprite sheet.

Back in Unity, all of the textures are no longer attached to their respective GameObjects. I go in and splice the sprite sheet again and manually reattach all of the textures. Then I decide I like the old hat better. I go back into gimp, change the sprite sheet, and am then forced to reattach all of the textures...again. There has to be a better way! (Also would like to be capable off adding new sprites in addition to editing old ones.)

sentences:
Implement Bubble Shooter arrow rotation using LibGDX? I'm trying to implement an arrow at the bottom of the screen on an Android device. This arrow is placed in the center of the screen and is supposed to rotate by a given angle. The problem is that when using the SpriteBatch's draw function for a TextureRegion it rotates the whole image, so the y coordinate also moves up a bit.

I want the arrow to always be in the center of the screen with the x, y coordinates and not move up the y coordinate. I want the y coordinate to stick to the bottom of the screen, but I still need to rotate the arrow. So I don't know if this is possible in my approach to do this.

If you have an approach in LibGDX that is very different from mine. I still want to see it because I don't care how I get this to work, I just want to get it to work somehow.

This far I've found this
Rotation - libGDX that helped me get the rotation a little better, but I need an arrow like in the game called Bubble Shooter.
Image of Bubble Shooter Arrow

The arrow should be the radius inside of an invisible circle, I guess, is one way to see it. See images below.

Example:

sentences:
Combining meshes up to certain sizes I have the following spritesheet for types of terrain, with a transparent background.

To draw it on my map, I thought of doing one mesh per type, and then combine them. This is the code.

This gave me at first quite good results.

But then I started trying maps of bigger dimensions, and after a certain point (I think it was 49x49), I got suddenly different results.

As you can see, at this point only seems to render 2 kinds of terrain, and the others have disappeared completely. Size is the only factor that was changed. Materials, Sprites, settings... everything else is completely the same.

Why could this be happening?

sentences:
HLSL Multitexturing with more than 4 textures I've come up with an idea that should work in multitexturing a terrain with more than 4 textures, up to a 64 if a supported ShaderModel is used.

I'm trying to use the RGBA color values as both values for blending and identifying which textures should be used.

I'm currently using 16 per textures. Each color has 256 values (R, G, B, A) so by identifying:

Texture 1
Red = 0-16, Blend = (Value / (16 - (16 * 0))
Texture 2
Red = 17-32, Blend = (Value / (16 - (16 * 1))

and by changing from 16 to 32 the blend is better because more rgba values can be included.

...and the closer that value is to 16 the higher blend value it gets with that texture.

All I'm stuck at is this calculation because no matter what I do I can't seem to convert the values correctly or get the values in the right way.

// VS_OUTPUT contains Position, TextureCoordinates and Color

float4 MultiTexturing_Pixel(VS_OUTPUT input) : COLOR
{
    float4 color = float4(0,0,0,0);

    int scale = 16;

    float red = input.Color.r * 256;

    // gets an index between 0~16, add +16 for each color after this
    int redIndex = ceil(red / scale);
    int redValue = 0;

    if ( (red % scale) == 0)
    {
        redValue = 1.0;
    }
    else
    {
        redValue = (color % scale) / scale; // should give a value between 0.0 and 1.0
    }

    // function with alot of ifs that checks the index and returns the Texture Sampler
    color += GetColor(index, value, input.TexCoord);

    // and the same for blue, green, alpa
    // but add blueIndex + 16, greenIndex + 32, alphaIndex + 48

    return color;
}

The math is there, but converting values back and forth is really the problem and since HLSL is basic C it's weird that it doesn't support basic math calculations.

Since I'm not that good at how the calculations should work I hope someone can provide an answer on how to actually perform the calculations below.

I've tried every possible way, all day and I'm totally out of ideas.

UPDATE: Problems with the calculations:

As far as my math knowledge goes, this is how it should go.

A color value is 0~255 (256)
In HLSL this translates to a value of 0.0-1.0, which means 32 = (32 / 256) = 0.125

Step 1 I set the Vertex color to:

new Color(32, 0, 0, 0)

Step 2 In the pixel shader this value would translate to the second texture this way:

float each = 16.0;
float max = 256.0;

float redIndex = (input.Color.r * max) / each;

At this point redIndex should be "2.0" if Color value is (32,0,0,0)
But it's not. Why? This is the flow for me in any other programming language:

float each = 16.0;
float max = 256.0;

float redIndex = 0.125 * 256; // = 32
      redIndex /= 16.0; // = 2.0

int index = redIndex; // = 2
int index = ceil(redIndex); // = 2

If I try to use ceil(redIndex) nothing better happens, it still can't get that "index" value. And this is basic MATH. And ceil (available from SM v1.1) takes the value up to the nearest integer, so if it's 1.9 == 2, 0.1  = 1 and so on. But it cannot do this. Because the values are wrong and the calculation is wrong.

Step 3 To get a value between 0-1 for texture, the closer you are to 16, 32, 48, 64 the more color from texture 1, 2, 3, 4 you get. So: 16 = 1, 8 = 0.5 4 = 0.25

float redValue = 0.0;
float red = input.Color.r * max;

if ( fmod(red, each) == 0.0) // or (16.0 % 16.0), which basically is 0.0
{
    redValue = 1.0;
}
else
{
    redValue = fmod(red, each) / each;
            // or (8.0 % 16.0) / 16.0
            // which is (8 % 16.0) = 8 and 8 / 16 = 0.5
            // which means the texture should be blended 0.5 or 50%.
}

Step 4 And finally by using the function GetColor I collect colors for each texture.

color += GetColor(index, value, input.TexCoord);

// and then do the same for green, blue, alpha values only add + 16
// because colors at (0,16,0,0) would be 16 + 1
// and color (0,0,32,0) would be 32 + 2
// and color (0,0,0,64) would be 48 + 4

sentences:
Disable free look camera movement when touch detected on mobile joystick I'm using free joystick pack form asset store and in scene have two cameras (first person and third person). Switching cameras with toggle.
Game starts with first person camera. Moving with fixed joystick and rotating camera with swiping on right side of screen. Everything is ok for this step.
For third person camera I'm using cinemachine free look camera. Cinemachine camera is reacting to joystick touch inputs. I need to disable camera movement when interacting with joystick. Tested on Android device
Cinemachine settings:

Third Person movement script:
void Update()
{
        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            x = joystick.Horizontal;
            z = joystick.Vertical;
        }
        else
        {
            x = Input.GetAxis("Horizontal");
            z = Input.GetAxis("Vertical");
        }

        Vector3 direction = new Vector3(x, 0, z).normalized;

        if (direction.magnitude >= 0.1f)
        {
            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + camTps.transform.eulerAngles.y;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            Vector3 moveDirection = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
            characterController.Move(moveDirection.normalized * speedTps * Time.deltaTime);
        }
 }

Any ideas and suggestions is appreciated

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:
How to create plasma trail for spaceship I have seen a lot of great looking space games that all use similar effects. I am really interested in finding out how some of these effects are generally done.

In particular I want to know how some of the trails behind spaceships or missiles are accomplished without using all the available resources.

For examples of the effect I mean see the screenshots for Gimbal, and even the video at that same link. Also the missile trails in Ether Vapor.

Are these both the same techniques? I am mainly interested in 2D, but I can't imagine it would be too different.

So how would I go about creating this kind of effect? Are we talking pixel-shaders, blendmodes/filters, bitmap effects, particle systems, or what? Not really platform specific. I am just looking for the theory, but specific examples or links would be great. And more detail the better.

sentences:
Why are there no sophisticated construction animations in RTS games in general? I want to code a small demo to test what degree of detail regarding animations, is possible in modern RTS/building games and which of them have the largest impact on the playing experience. Similar to the first few minutes of a '0 A.D'/AoE game. (No music and art assets, no story, as simple as possible.)

All building animations in RTS and building games are made rather modest. They simply arise from the ground or jump from one state of completion to the next accompanied by some particle effects.
The Settler games are the only ones known to me, that model the transportation of goods to the building lot and make the area plane, before they build on it.

In the demo I mainly want to focus on the construction process, that should be continuous. The building material is to be represented by objects in the game world. Based on a predetermined pattern, workers shall combine these building materials piece by piece to a building.

Had one of you the same idea and experienced difficulties, that led them to the adoption to a simpler animation/building scheme? Are there computational problems, because this approach needs to many calculations (e.g. for collision detection of the building blocks)?

List of different ways construction has been done in RTS / building games before:

Positions of interest are stored in the links.

Sprite fades in:

Settlers 1

Completed building emerges at desired location:

Anno 1404, Anno 2070, (haven't checked the early ones)

Stronghold, Stronghold Crusader 2 (and 1)

Building arises from ground (without or with worker units bashing the ground)

0 A.D.

Godus

Dawn of War (with extra animation, while the building is ascending)

Incremental, stepping animation (without or with moving/non-moving worker units):

Age of Empires 2

Age of Empires 3

Incremental, continuous animation (without or with moving/non-moving worker units):

?

WarCraft 3 (a mixture of different animation types)

StarCraft 2 (similar to WarCraft)

sentences:
Use JS to grab values from a dynamic Lua Table ((BACKGROUND: I'm modding a game that runs using Lua and the Source2 Engine (Dota). Gameplay logic uses Lua and HUD uses JS))
I used Lua to create a global table. For instance:
global itemRollsManager[itemID] = {
  id = 19,
  buff1 = "modifier_bonus_range",
  ability = "tusk_ice_shards"
}

Now I need to grab that info and display it in the HUD using JS. I've successfully grabbed the itemID inside JS, but now I need to grab that table and those values while the game is running.
How do I do this? Is it even possible with just JS and Lua?

sentences:
Measure the length of the platform in Unity I created a platform in Unity. It consists of an empty parent object and child objects. Child object have attached components: Sprite renderer and Edge collider 2D.

How could I get the length and height of such a platform? By the length and height in the case I mean the respective measures in x and y axis.

sentences:
2D diagonal movement using Rigidbody2D I have a problem with 2d player movement, as I am unable to move on the Y-axis. Yet, the movement on the X-axis is working as intended.

Below, you can see my code:

public Sprite directionUp;
public Sprite directionDown;
public Sprite directionLeft;
public Sprite directionRight;

public float speed = 0.1f;
public byte direction = 0; //0 - up, 1 - right, 2 - down, 3 - left

private SpriteRenderer spriteRenderer;
private Rigidbody2D rb2D;
private Sprite[] directionArray;

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

    directionArray = new Sprite[]{ directionUp, directionDown, directionLeft, directionRight };
    if(directionArray[0] != null) spriteRenderer.sprite = directionArray[0];
}

// Update is called once per frame
void Update ()
{
    if (Input.GetKeyDown(KeyCode.Keypad7))
    {
        rb2D.MovePosition(rb2D.position + new Vector2(-1f, 1f));

        if (directionArray[0] != null) spriteRenderer.sprite = directionArray[2];
    }
    else if (Input.GetKeyDown(KeyCode.Keypad9))
    {
        rb2D.MovePosition(rb2D.position + new Vector2(1f, 1f));

        if (directionArray[0] != null) spriteRenderer.sprite = directionArray[3];
    }
    else if (Input.GetKeyDown(KeyCode.Keypad1))
    {
        rb2D.MovePosition(rb2D.position + new Vector2(-1f, -1f));

        if (directionArray[0] != null) spriteRenderer.sprite = directionArray[2];
    }
    else if (Input.GetKeyDown(KeyCode.Keypad3))
    {
        rb2D.MovePosition(rb2D.position + new Vector2(1f, -1f));

        if (directionArray[0] != null) spriteRenderer.sprite = directionArray[3];
    }
    else if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.Keypad8))
    {
        rb2D.MovePosition(rb2D.position + new Vector2(0f, 1f));

        if (directionArray[0] != null) spriteRenderer.sprite = directionArray[0];
    }
    else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.Keypad2))
    {
        rb2D.MovePosition(rb2D.position + new Vector2(0f, -1f));

        if (directionArray[0] != null) spriteRenderer.sprite = directionArray[1];
    }
    else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.Keypad4))
    {
        rb2D.MovePosition(rb2D.position + new Vector2(-1f, 0f));

        if (directionArray[0] != null) spriteRenderer.sprite = directionArray[2];
    }
    else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.Keypad6))
    {
        rb2D.MovePosition(rb2D.position + new Vector2(1f, 0f));

        if (directionArray[0] != null) spriteRenderer.sprite = directionArray[3];
    }
}

By the way, please keep in mind I am quite new to Unity.

EDIT 1///////////////////////

I have attached the entire script, some of the variables are unused right         now(was testing other methods of movement).

I tried to both Keypad - 1, 3, 6, 9, as well as the combinations which I didn't get to work yet (but this is off-topic and I will look into it once I will get the Y-axis to move).

Thanks, Zryw

sentences:
cocos2d-js displays only one type of tile from a tmx file I am using Tiled to produce a tmx which I use in my code using cocos2d-js.
The problem is that when I run it on the browser, a wrong tile gets displayed, the first one of the image (0,0) and repeats for the whole map.
The relevant js code is this:

this.farm = new cc.TMXTiledMap(res.farm_tmx);
this.addChild(this.farm);

where res.farm_tmx the path to the tmx file.

What could be the source of the problem? And how do I fix it? It seems to me that it is specific to my code. I do not find any other reports of the same problem.

sentences:
How to approach 360 degree snake without having it "slide" There's a great question here that helps me a little bit in what I want to do, and it explains it quite well:

How To Approach 360 Degree Snake

Basically, I want to have a smooth 360-degrees Snake game, where the snake follows along. I can easily do the same thing as described in the question above (video example), but as you can see that kind of "drags" or "slides" the snake along, which is not what I'm looking for.

I want the entire snake to follow the entire path that the head of the snake follows.

The only solution I can think of is to make some kind of "buffer" to store the rotations of the head, and then "lag" that behind on the other bodies.

Since I think that will end up way too complex, what's the correct way of implementing it?

Here's a screenshot of how my snake looks like right now, to get an idea of what exactly I want to move:

sentences: How to make platforms spawn without touching other platforms So I am making a doodle jump like game where there are platforms scrolling by but right now how I have platforms spawning is completely random. I would like the platforms to be spread apart so they weren't touching but don't have much of an idea to implement it. I was thinking of using the distance formula to check to make sure that they were apart but I was thinking that as I was creating those object I would have to check with all the previous objects before to see if they weren't colliding. Does anyone have any ideas on how to make this work efficiently?

sentences:
How can glass breaking effect from Smash Hit be achieved? I saw Smash Hit the other day and was amazed by the physics of the game, specially the shattered glass effect:

I've read other posts about this subject but I still feel that they don't share enough details to let me get started on implementing this on my own with OpenGL/GLSL.

Is it possible for somebody with an enhanced perception and graphics understanding to watch the gameplay and give some pointers on how this effect could be replicated?

I rather not use 3rd party physics engine and do the entire thing on my own for educational purposes, so could you mention some of the physics that goes behind this as well?

References to other documents and demos are highly appreciated.

sentences:
When creating an FPS style game, how should the iron sights be setup? I am working on creating an FPS style game for learning purposes. I previously was using self created animations for aiming down the iron sights of a gun. The animation would play when you zoom to iron sights and it would hold it there as long as you have the mouse held down. However, talking to a high rated designer, he told me usually it is done with a second camera that sits perfectly aligned with the guns iron sights. I would imagine you would still have to have an animation that then transitions you into that iron sight camera though. Now my animation works fine but I feel I may run into a problem later down the road if I am approaching it the wrong way from the start.

Can someone verify the right way to do this and explain why it is?

sentences:
How to create a color aura around actors in libGDX? Is there an easy mechanism to create a color aura around an actor in libGDX?

Thanks for all tips!

sentences:
How can I make Network.RPC call a method with params object[]? Why do I need to do this? The game I'm working on fully conforms to a component style design. Every component that a game object uses is placed on the object and is disabled/enabled based on it's state machine's current state. This means if I have two components that share a base class that has an RPC method, they won't work due to this:

"RPC function names should be unique accross the scene, if two RPC functions in different scripts have the same name only one of them is called when RPC is invoked"

http://docs.unity3d.com/ScriptReference/NetworkView.RPC.html

This means an arbitrary component will be the "this" of the RPC method that actually gets called. So, to fix this I've added a unique name to every component and have to do some relatively slow searching and reflection in order to have a safe RPC call. So, now every RPC call should go through my RPC method. This method simply serialises the parameters into a string and sends them to unity's RPC method.

This works great, except one tiny thing. Serialising the entire array results in Unity doing no serialisation in NetworkView.RPC. That's fine, except as far as I can tell, Unity's NetworkView.RPC method is the only thing in the universe that knows how to serialise a NetworkViewID properly.

So, serialising the whole array of objects isn't an option. So, I now I serialise them IF they're not a NetworkViewID, then send the entire object array to Unity, which it does interpret correctly:

protected void ComponentRPC( string methodName, RPCMode mode, params object[] args )
{
    object[]                serialisedObjects       = new object[args.Length + 2];

    serialisedObjects[0] = uniqueName;
    serialisedObjects[1] = methodName;
    for( int i = 2; i < serialisedObjects.Length; ++i )
    {
        if( args[i - 2].GetType() == typeof( NetworkViewID ) )
        {
            serialisedObjects[i] = args[i - 2];
            continue;
        }
        serialisedObjects[i] = base.Serializer.Serialize<object>( args[i - 2] );
    }

    // Serialise arguments and call our RPC method through Unity.
    networkView.RPC( "ComponentRPCNetwork", mode, serialisedObjects );
}

I also put the unique component name and method name in the array. The only problem now is, Unity won't put the objects it serialises into my params object[] parameter. The RPC method:

[RPC] private void ComponentRPCNetwork( params object[] args )
{
    // First we have to deserialise the method arguments.
    string              uniqueID                    = ( string )args[0];
    string              methodName                  = ( string )args[1];
    object[]            deserialisedArgs            = new object[args.Length - 2];
    for( int i = 0; i < deserialisedArgs.Length; ++i )
    {
        if( args[i + 2].GetType() == typeof( byte[] ) )
        {
            deserialisedArgs[i] = args[i + 2];
            continue;
        }
        deserialisedArgs[i] = base.Serializer.Deserialize<object>( ( string )args[i + 2] );
    }... // More stuff.

So, my question is, can I get Unity's NetworkView.RPC method to put it's serialised objects into this "args" parameter? If not, can anyone see anyway around this?

By the way I'm using Vexe's framework, so you might see unusual things like "base.Serializer" etc.

sentences:
Proper indoor lighting without directional light I would like to know how to properly handle indoor lighting without a directional light. My scene has a room( its some kind of shop), in which the player and ai-agents can move around. I can get good results by placing long area lights at the ceiling and baking the light, and placing light probes so the dynamic objects are also affected by the baked light.

The main problem is how can i get real-time shadows for the player and the ai-agents ?

You could position a few point lights roughly where the center of the area lights would be. But i don't know if i can or even should have so many shadow casting lights in one scene. I tried placing 6 or so and i think only 4 of them would actually cast shadows.

I would really appreciate some help. For this project, i've kind of given up on it but i really want to know. Thank you.

sentences:
Is there a simple way to group two or more sprites, so all of them will be dependent on each other? I think that this question is very similar to this one, but I'm not sure if the answers are universal.

So, my goal is:

Place two sprites in fixed position, for example player and his eyes
Make sure that whenever the player rotates, eyes sprite rotates too and gets to the same relative position from the body (so eyes aren't on player's back). So they'll be working as a group. - This step should be automated, that's my goal!

So, for example, I now want to place a gun in user's hands. So now I say, that player is in position Vector2(0, 0) and gun is in position Vector2(26, 16). Now I want to group them up, so whenever the player rotates, gun rotates too.

Currently in this example it's pretty okay but in case that I'd need to move my gun on axis y (only), I'm lost

sentences:
Best technique to create oldschool (fake 3D) racing game? What would be a good approach to develop the render system for an oldschool type racing game that uses a pseudo 3D scenery, like for example Outrun or Lotus Esprit Turbo Challenge? There's an endless scrolling road and scenery graphics are placed like billboard items, etc. I think you get the idea.

Are these developed in a similar way like Mode7 or is there a different technique behind it? Does the technique has a specific name I could search for on the web? I need to develop something like that in Flash.

sentences:
Creating a 2D perspective in 3D game I'm new to XNA and 3D game development in general.

I'm creating a puzzle game kind of similar to tetris, built with blocks. I decided to build the game in 3D since I can do some cool animations and transitions when using 3D blocks with physics etc.

However, I really do want the game to look "2D". My blocks are made up of 3D models, but I don't want that to be visible when they're not animating.

I have followed some XNA tutorials and set up my scene like this:

this.view = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
            this.aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
            this.projection = Matrix.CreatePerspectiveFieldOfView(
                        MathHelper.ToRadians(45.0f), aspectRatio,
                        1.0f, 10000.0f);

... and it gives me a very 3D-ish look. For example, the blocks in the center of the screen looks exactly how I want them, but closer to the edges of the screen I can see the rotation and sides of them.

My guess is that I'm not after a perspective field of view, but any help on which field of view/settings to use to get a "flat" look when the blocks aren't rotated would be great!

sentences:
Is there a way to drain durability from an item instead of a sword, for instance? I am modding Minecraft 1.8 using Eclipse with Forge, and I just wondered, is there a way to drain durability from a battery, for instance, instead of a piece of armor when hit.
I have tried things like getting an item from the player's inventory and attempting to reduce its durability, so that would be a possibility, however, I was unable to find a way to do so?

sentences:
ECS - Stats, damage-types & damage calculation Prologue
Im quite new to data oriented programming and my goal is to implement a runescape stats & damage mechanic.

This is quite a pretty complex topic : [Runescape-Mechanics][1] and i havent found any ECS related sources on that topic yet.

In the following example we see a bunch of items which modify the weares stats based on a few conditions.
This happens in two different variants, either for the damage calculation only, or as a buff.
Brine sabre and Brackish blade increase damage against crabs.
or
Silverlight and Darklight increase ability damage by a scaling of 25-124% against most demons. The exact damage bonus is based on your base Attack and Strength, and the monster's base Defence.

The problem
Such a RPG system is very complex. There different damage types, different resistences and other stats.
Having a strong OOP background and no real experience in DOP, i cant find a suitable architecture to fill those needs.
In my current approach every stat is a component. Items and Buffs are structs. A item "buffs" its owner and the buff modifies his stats. This works so far, but i have no idea how i could realise the damage calculation, while still keeping it that flexible as it is in runescape.
This little example would just be able to buff the stats... not deal, receive or modify the damage itself.

// The stats

public struct Health{
  float max;
  float value;
}

public struct MeeleDamage{
  float base;
  float value;
}

public struct MeeleResistence{
  float base;
  float value;
}

// Item & Buffs
public struct Item{
  string name;
  int amount;
  bool equipable;
  List<Buff> buffs;
}

public struct Buff{
  string name;
  float duration;
  Condition applyable;
  ToBuff stat;
  float value;
}

Its also important that an entity can also deal damage to multiple other entities in one frame.
How would you implement such an complex mechanic ? Any examples are appreciated !

sentences:
GPU usage below 90% = poorly optimized game Ok so not exactly a "development" question but highly related.

When I play games I often look at performance numbers, like CPU usage, GPU usage, memory usage and others. Let us talk about GPU usage on PC. Here is my observation: there are two kinds of games:

MAX GPU usage: these games produce either 60 FPS or 90%+ GPU usage.
POOR GPU usage: these games produce less than 60 FPS and less than 90% GPU usage at the same time

MAX GPU examples (trying to make sure my idea is understood ok):

50 FPS, 100% GPU
60 FPS, 90% GPU
60 FPS, 50% GPU (also legit)

POOR GPU examples:

30 FPS, 60% GPU (FPS limit is 60)
40 FPS, 50% GPU

It appears that MAX GPU games use GPU efficiently to provide best performance while POOR GPU games are bottlenecked for some reason. U get few FPS, low GPU load and none of CPU cores reach 100% load. I checked and re-checked my PC many times and I don't see any specific issue which could make some games perform poorly, besides other games reach 90%+ GPU usage with no problem. Also I am not the only person who observed such behaviour.

So the question is: POOR GPU games are poorly optimized, either on purpose or because of lack of effort. True or false?

Also, it appears that MAX GPU games are probably multithreaded? I suspect that poor-gpu games go like this: use main thread

loop
  update;
  draw;

while max-gpu games go like this: use two threads

loop
  start-update in another thread;
  start-draw;
  wait & synchronize

It is of course more complex than that but the general idea is basically that max-gpu games render stuff and update stuff at the same time; that is how higher GPU usage is achieved.

Ideas? Thoughts? Thanks

sentences:
How to set up and use a development environment for games with graphics on a public computer? We don't really have any IDEs or development environments with which we could develop games with graphics on school computers. We're on a network run by the school, and can't get technicians to install them, because they're a 'security nightmare' (even though quite a few students can easily circumvent them).

So, what could we do? We'd like to program games in c++ or Java.

sentences:
When I press play in my scene, the camera turns in the opposite direction? In my scene, I have my character facing a certain direction, with a camera attached. Now, when I press play, for some reason, the character immediately faces the other way. I've tried turning the model and camera to face the opposite way of that, to make up for it, but it still faces that same direction.

I've had a look at the script for the camera, but I'm not sure what could be causing this to happen. There's no target assigned that should cause that reaction, as the camera is a child of the player.

Below is a copy of my script:

public class FirstPersonCamera : MonoBehaviour
{
    Vector2 mouseLook;
    Vector2 smoothV;
    public float sensitivity = 5.0f;
    public float smoothing = 2.0f;

    GameObject character;

    void Start()
    {
        character = transform.parent.gameObject;

        Debug.Log("Camera is operating");
    }

    void Update()
    {
        var md = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));

        md = Vector2.Scale(md, new Vector2(sensitivity * smoothing, sensitivity * smoothing));
        smoothV.x = Mathf.Lerp(smoothV.x, md.x, 1f / smoothing);
        smoothV.y = Mathf.Lerp(smoothV.y, md.y, 1f / smoothing);
        mouseLook += smoothV;

        transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
        character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, character.transform.up);

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = true;

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

    }

}

Does anyone see what could be causing this issue? I've using Unity version 2019.2

I'm also including screenshots of the player's position, as well as the camera's.

Player:

Camera:

There's something in the script that is causing the character to turn around, as I placed the script on another model and it had the same effect P:

sentences:
Particle system on sphere surface I would like that particle system travels only on sphere surface.
I have set sphere and particle system as it's child.
How to constraint particle system ?

How to make trails follow along sphere surface?

On sphere it would look something like this

with trails:

without trails:

sentences:
iOS build size is too large in Unity I have finally completed my game and ready to upload my game to the App store, but my build size is too large.

I have checked log statement and it is roughly 13.3 mb but when i build my game and test on iOS device it is 80.0 mb.

Also

Scripting Backend is 'Mono2x'

Stripping Level is 'use micro mscorlib'

Script Call Optimisation is 'Fast but no Exception'

My Game size must be around 15 to 20 mb why it is too large?

What i am missing?

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:
How to handle player input with fixed rate variable fps time step? I've made a system which uses the ideas from "Fix your Time Step" in order update physics.  I'm having trouble finding standard methods for dealing with this when user input affects player movement outside of a time-step.

If we want to integrate player movement within the "fixed time step, variable fps" system, I guess I would have to queue up player actions somehow, when accumulation hasn't yet completed. But then how do I integrate several different player actions within said timestep?  IE lets say within timestep of N milliseconds, the player executes a move forward, move right and move backwards, where there is an infinite collidable wall in front.

I could always calculate the last input, but in this case, it wouldn't be correct to do so. The player actually should be blocked by the wall, and then moving right and back would move them to the right, and back, to the right of where only processing the last input would lead.
Similarly, if all movement was accounted for together, it might result in a player having an impossible vector for the final position, but if all moves were taken independently, there might have been a valid path (ie around a corner).
If I process all inputs then the player made during the time-step, it could conceivably be costly if they made a million tiny movements (collision check at each movement), though with exact physics (as far as a fixed time step simulation is concerned).
Even if we thought the last bullet wasn't that bad, as soon as you add multiple players to the equation, it starts looking really bad, especially with a server.

Are my only options to process all actions or only process a subset of them?

sentences:
How can I place prefabs into a world and what's the best way to get them? Hi all :) I'm making a 2D roguelike platformer and I want to make a load of hand crafted rooms and like spelunky place them around. When the player enters a room a script will go off. The script will know what exits the current room has and what entrance was used (Don't need to place anything where the player came from). I then have 2 options for choosing what rooms will work:

I can either have all the prefabs contain a script with a list of all the exits they have, then check that list for if the right one is there. I.E; Entered room from the left. Room has left, right and top exits. I can ignore the left as that's where I came from, I can ignore the bottom as there isn't an exit there but I need to check the arrays on the prefabs to see if they have right and top in them. After that I'd place the top one x units above and the bottom one x units below (I'd also check something wasn't there before placing over it).

The other option is to have 4 lists of prefabs. A list for top exits, bottom exits, left exits and right exits. Then look through those for what I need. Then I would place the blocks where they needed to be from there.

So, as the title says, what of those options would you use for picking and how can I then get the prefab I need and place it into the world. I'll use a "Centre" item for it and then place the centre of the prefab a certain amount to the side of the current rooms centre.

Thanks in advance for any help you can give :)

sentences:
how to use glm::rotate with a eulerangle? I have a vec3 to represent my object's orientation/rotation but the glm::rotate method expects a quaternion. If I just convert it to a quaternion like this:

glm::quat rot = rotation;

The W value will just be zero, right? And then there won't be any changes in rotation.

In my code I just want to be able to do rotation.x += 5.0f; in the update method of an object.

This is the method I'm using for my transformations:

glm::mat4 GameObject::Transform(glm::mat4 model, glm::vec3 position, glm::vec3 scale, glm::quat angleAxis)
{
    model = glm::translate(model, position);
    if (angleAxis.w > 360.0f)
    {
         angleAxis.w -= 360.0f;
    }
    else if (angleAxis.w < 0.0f)
    {
         angleAxis.w += 360.0f;
    }
    model = glm::rotate(model, angleAxis.w * toRadians, glm::vec3(angleAxis.x, angleAxis.y, angleAxis.z));
    model = glm::scale(model, scale);
    return model;
}

Currently I'm just passing on that rotation vec3 to that angleAxis quaternion parameter but that obviously doesn't work.

This is how i currently calculate my front, up, and right vectors:

void GameObject::calculateCameraView()
{
    front.x = cos(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
    front.y = sin(glm::radians(rotation.y));
    front.z = sin(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
    front = glm::normalize(front);

    right = glm::normalize(glm::cross(front, worldUp));
    up = glm::normalize(glm::cross(right, front));

    front.y = invertMouse ? front.y * -1 : front.y;
}

sentences:
Keyboard and Mouse callbacks in GLUT I'm using OpenGL via GLUT in Ubuntu.

While writing text in a text editor, the first keystroke is printed immediately.
But if we keep pressing the key, it waits for a moment and then prints a trail of that character.

This is to reduce the sensitivity while typing.

With GLUT, function callbacks for keyboard behave like that.

glutKeyboardFunc( keyboard );
glutKeyboardUpFunc( keyboard_up );

Now if we keep pressing a key, there is a considerable delay between the first and the second call of keyboard ( and keyboard_up) function. But in real gaming, this not should be the case.

Question 1: How to solve the problem?

Question 2: keyboard_up gets called even if I press and hold a key. Why so? I think it is supposed to get called only when I release it. Moreover, this also suffers from the above jerk problem.

Question 3: For glutMouseFunc( mouse ), the mouse function gets called whenever we press or release a mouse button. I want this too to get called repeatedly if I press and hold my mouse button, and that too without jerk. How to do so?

sentences:
Moving directional light cause huge fps drop: why? I've implemented a simple script to simulate Sun Rotation (day/night cycle).

In my "Update" i Rotate main Directional Light (the sun).
What i've noticed is that my FPS dropped from 60 to 20-25 fps.

I can understand why: recalculate all light each frame can be (euphemism) cpu-consuming.

So i switched approach using an InvokeRepeating with a repeating time of 0.25f seconds (4 "movement" per second).

Also with this approach my frame rate drop from 60 to 50 (unacceptable).

So my question is : is there a way to move/rotate a light (simulating a day/night cycle for instance) without meet a so big fps-dropping but mantaining realism ?

Thanks

sentences:
Social Network Gaming on Windows, Linux and OS X I'm working on mobile platforms as Android, IOS... Many users of Moblox ask us a windows and an OS X version.
There is no difficulties to provide these versions, because we are developing on OS X C++ code but we miss global scores and social network part (facebook, twitter). Is there any library to implement these functions on Desktops plaforms ?

On mobile platforms, we have many SDK to provide theses functions as OpenFeint, ScoreLoop, Plus+. We have used cocoslive and uploaded scores with libcurl but it's very limited.

sentences:
Registering a C++ callback with Lua API without additional libraries Basically, I'm trying to register a callback into a Lua state like this:

class MyClass
{
    public:
        int myLuaFunction(lua_State* L)
        {
            //do something
        }

};

I want to be able to call MyClass::myLuaFunction of a given instance (which could register itself).

I've spent a couple hours trying to do tricks with templates and lambdas in an attempt to get it to work, but I haven't got anything successful (mainly the fact that I couldn't pass a lamba function that uses parent scope variables to Lua's API).

Without having to download any other libraries (just Lua's standard interpreter implementation), how could I do this?

sentences:
what is the best way to add avoidance behaviour to an AI framework? I have a small AI framework for a shooting based game. Although this is rarely needed, as when agents are close to each other they are usually fighting, I would none the less like some way of implementing avoidance behaviour.

For example, if in the future I wanted to take away their weapons and have many of them wonder around in a crowd, how would I make them not hit / pass through each other, but instead avoid each other? while still following their calculated paths that is.

two ideas I had would be to add steering behaviour and allow that to deviate from their path, or to use a dynamic pathfinding technique. Are these valid solutions? If yes how, in theory, would I implement them? Are there better ways? What is the more respected practice?

sentences: Algorithms for Physically based shading models For real time interactive graphics, it seems to be practical now to use physically based shading models. I want to write some shaders to incorporate into an openGL based game engine that I'm writing and I wasn't sure of what algorithms to read up on. What algorithms and models seems to be practical and useful for real time graphics as of 2014?

sentences: How can I fix a GameObject along one axis only when it is part of another object in Unity? Hello I have an Object player and inside player, I have an object Boundary which is supposed to follow the player as he moves up or down only? (As the player moves right or left I don't want the boundary object to move. How can I do it?

sentences:
How can I min-max quaternions? What I'm doing

In my engine, I'm trying to implement a camera that will follow a target object, such as a player.

I wanted to avoid just simply using the inverse of the target's transformation, because the camera may end up "jerky", so instead I interpolate between the current and target orientation over time, this way the camera's rotation eases in on the desired rotation:

quat targetQuat   = target->getOrientation();
quat currentQuat  = getOrientation();

quat slerpQuat    = glm::slerp(currentQuat, targetQuat, 0.05f);

setOrientation(slerpQuat);

Where my problem begins:

Since I'm just interpolating between quaternions, it is possible that the target may spin faster than the camera can catch up, and may wind up falling behind.

I want to somehow impose a quaternion rotation cap, or somehow determine which of the two is larger so I can min/max 2 quaternions. For example:

quat targetQuat   = target->getOrientation();
quat currentQuat  = getOrientation();

quat slerpQuat    = glm::slerp(currentQuat, targetQuat, 0.05f);
quat maximumQuat  = targetQuat*quat(0.707, 0, -0.3535, 0);

quat desiredQuat  = min(slerpQuat, maximumQuat);

setOrientation(desiredQuat);

How can I determine which of two quaternions rotates/deviates the furthest? Are there any better alternatives methods? The general idea I had was just to min/max the quat such that it always falls within the bounds I need.

I know that I can calculate a delta quaternion, or rather multiply q0 by inverse q1, but even so I don't know what I would do with it or how it could inform me which of the two is the largest one.

sentences:
FPS : Hands+Weapon Animation I want to create multiplayer first person shooter . Now I want to create animation where the soldier is walking with rifle .

I have separated hands from the body of the model and I have dropped hands and rifle in the camera , but when I move the camera hands don`t move with camera but the rifle does .  Hands are controlled by the bone . How can I make the walk animation + camera movement together?

sentences:
Best way to go for simple online multi-player games? I want to create a trivia game for my website. The graphic design does not have to be too fancy, probably no more advanced than a typical flash game. It needs to be secure because I want users to be able to play for real money. It also needs to run fast so users don't spend their time frustrated with game freezing. Compatibility, as with almost all online products, is key because of the large target market.

I am most acquainted with Java programming, but I don't want to do it in Java if there is something much better. I am assuming I will have to utilize a variety of different languages in order for everything to come together.

If someone could point out the main structure of everything so I could get a good start that would be great!

Language choice for simple secure online multiplayer games?
Perhaps use a database like MySQL, stored on a secure server for the trivia questions?
Free educational resources and even simpler projects to practice?

Any ideas or suggestions would be helpful...

sentences:
neon effect to textures libgdx I am working on a live wallpaper with Libgdx .
I am wondering if I can give neon glow to my textures , at runtime .
Is this possible? If yes can anybody give me any pointers?

sentences:
How can i change the cube scale only on Y and only to up? This is the script I am working with:

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

public class Raise : MonoBehaviour
{
public GameObject Ladder;

float mfX;
float mfY;
float mfZ;
// Use this for initialization
void Start()
{
    mfX = Ladder.transform.position.x - Ladder.transform.localScale.x / 2.0f;
    mfY = Ladder.transform.position.y - Ladder.transform.localScale.y / 2.0f;
    mfZ = Ladder.transform.position.z - Ladder.transform.localScale.z / 2.0f;
}

// Update is called once per frame
void Update()
{
        Vector3 v3Scale = Ladder.transform.localScale;
        Ladder.transform.localScale = new Vector3(v3Scale.x + 0.1f, v3Scale.y + 0.1f, v3Scale.z + 0.1f);
        Ladder.transform.position = new Vector3(/*mfX + Ladder.transform.localScale.x / 2.0f*/0, mfY + Ladder.transform.localScale.y / 2.0f, mfZ + Ladder.transform.localScale.z / 2.0f);
}
}

The way it is now it's making the whole cube bigger and bigger.

But I want to make the cube grow only UP on Y. To keep the cube capacity/ extent
But to make the scale change only up.

If I'm doing:

Vector3 v3Scale = Ladder.transform.localScale;
Ladder.transform.localScale = new Vector3(0, v3Scale.y + 0.1f, 0);
Ladder.transform.position = new Vector3(0, mfY + Ladder.transform.localScale.y / 2.0f, 0);

I will see it go up in scene if I select the cube in the hierarchy but if not I will not see the cube at all.

Can't figure out how to make is grow up only up side.

sentences:
Maya and Game Engines (i.e. Environment Testing) What does it mean if I'm designing an environment and I want to test it in the game engine, to see what its like to "run" [or fly] around my environment? I heard an instructor say that exact thing in a Maya training video and I'd like to know more about "How Game Engines and Maya are related to each other." He stated this would be done to see how things look in "size" (e.g. I assume he meant: 'How big is the cathedral, bridge, wall, building, etc.').

I've tried to research such information but it's too complicated, and detailed. I just want a simplistic response to my query. Thanks to everyone willing to help and not criticize my question.

sentences:
How to check Early Z efficiency on AMD GPU with Windows 7 I have a game using DirectX 9, and a development station using Win 7 x64. I am still able to get access to another station with Vista x64 / dual booted with WinXP x86.

I wanted to check early Z efficiency in the game and to my sadness all tools I have tried seem to be unable to perform this task:

AMD PerfStudio

AMD GPUPerfStudio 2 does not support DirectX 9 at all
AMD GPUPerfStudio 1.2 does not install correctly on Windows 7. When I have tweaked the MSI package (a simple OS version check adjustment was needed), it complained the drivers I have do not provide needed instrumentation. The drivers old enough to support the GPUPerfStudio would most likely not be able to operate with my Radeon 5750 card (though this is something I am not 100 % sure, I did not attempt to try any older drivers, not knowing which I should look for)

PIX

PIX does not seem to contain any counters like this. It offers some ATI specific counters, but when I try to activate them, the PIX reports "PIX encountered a problem while attaching to the target program."

I do not want to upgrade to DX 10/11 just to be able to profile the game, but it seems without the step I am somewhat locked with a toolset which is no longer supported.

I see only one obvious options which would probably work, and that is using WinXP (or with a little bit of luck even Vista) station, perhaps with some older AMD card, to make sure GPUPerfStudio 1.2 works.

Other than that, can anyone recommend other options how to check GPU HW counters (HiZ / EarlyZ in particular, but if others would be enabled as well, it would be a nice bonus) for a DirectX 9 game on Windows 7, preferably on AMD GPU? (If that is not possible, I would definitely prefer switching GPU to switching the OS, but before I do so I would like to know if I will not hit the same problem with nVidia again)

sentences:
How can I compute which chunk a coordinate is in? I am working on a video game. Everything (terrain, entities, particles) is stored in 100 by 100 chunks. Here is the array structure for the chunks:

public static final int chunkSize = 100;
public static Chunk [][][] chunks;

The world is 20,000 by 20,000.

Given a random coordinate (such as (-1244, 1353)), how can I quickly and efficiently determine what chunk the coordinate is in?

Once I know what chunk a coordinate is in, I can determine which chunks to load around a player.

sentences:
Creating a player that can hold different items I am making a game using Java, LibGDX and Box2D. What would be the best way to create a player that can hold:

no item
one item from group A
one item from group B
one item from both groups

Items from group A can only be used to attack, and are held in the right hand.
Items from group B can only be used to defend, and are held in the left hand.

Should I add the item to the player class and render/update the item in the player class? Or is there any best way to this that I am not aware?

This is the best way I know how to do it:

I would also be interested in any design pattern that could be applied to this situation.

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 can I plug a Unity application into native Android and native iOS? There are a lot of questions about running native Android and iOS code in Unity.  I am trying to run Unity inside of native Android and native iOS apps.

My problem is that I have two native apps, and I don't want to write code twice when I add a feature.

I currently have two native apps - one in Android and one in iOS.  I am trying to write code once, and add it to both.  Can I write a Unity program, and put that into my native apps?

I am thinking something along the lines of writing a Unity Android app, building it as an Activity instead of an APK, and launching that Activity from the native android app.  Then also the equivalent in iOS, whatever that may be.

Does anyone know a solution to this problem?

sentences:
Multiplayer FPS Gameplay: How to encourage players to dispense ammo? In the Battlefield: Hardline beta, players can now obtain health and ammo directly from other players, without having to ask for it via the command rose.

Here's two examples of how asking for health and/or ammo differed between most Battlefield games and Battlefield: Hardline. We'll have two players in these scenarios: A and B. Player A, who is not a Support-class player, is running low on ammunition. Player B, being a Support-class player, has ammo that he can give to Player A.

Example 1 - up to Battlefield 4: Player A tells Player B, "I need some ammo!" Player B will either…

respond by dispensing ammo for Player A; or
not respond, for whatever reasons. Player A has to either keep telling Player B that he needs ammo, or get his attention first.

Example 2 - Battlefield: Hardline: instead of bothering to tell Player B that he needs ammo, Player A walks up to Player B and presses a button. Player A's ammo is replenished.

From looking at each scenario's differences, Example 2 is the most efficient choice. Compared to Example 1, there's no uncertainty about getting the ammo at all. On the other hand, Example 2 costs both players the benefit of team communication (at least with getting health and ammo).

Should there be some sort of penalty for Example 2-esque scenarios, that will encourage players to dispense ammo for their teammates? One possible route can be to take away from a player's EXP for letting other players take ammo from them, directly (and too often).

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:
Unity GL.Lines going over 3D models I'm drawing lines using GL.lines but they disregard the zbuffer and always appear over my model.

I found this thread: http://answers.unity3d.com/questions/434827/gllines-over-game-objects.html

and decided to give the answers a try, but it didn't seem to fix things. For now I'm using the shader found in that thread, here is the rest of the code:

void OnPostRender() {
GL.PushMatrix();
testMaterial.SetPass(0);
GL.Begin(GL.LINES);
   for (int i = 0; i < basicMesh.linePoints.Length; i++)
   {
     GL.Color(new Color(1,1,1,1));
     GL.Vertex(basicMesh.linePoints[i].point1);
     GL.Vertex(basicMesh.linePoints[i].point2);
   }
GL.End();
GL.PopMatrix();
 }

Any advise on how to make the lines not go over my 3D models?

sentences:
Collectible card game, cards and effects Based on Design of a turn-based game where actions have side-effects

I am building a card-game where cards can have side-effects be triggered under different circumstances.

I was given a good idea on how to handle different phases by having hooks (events) that different cards can be triggered to do something, like when a card is played, draw an additional card, etc.

I am not sure how I should compose all these things to work together, I have a GameState object which handles the state of the game (who's turn, player objects, timers) checking if a move is legal etc.

I am having a Card class that currently just has a type and a name getter/setters and properties. I believe the best way to store cards would be to use .JSON files, because that would let you simply write a new card.

To achieve side-effects I am thinking of having "components" that is configured through a cards JSON-file.

{
    "name": "Ocean Humans",
    "type": "Creature",
    "components": {
    }
}

However, I am not sure how I should compose these JSON-files to some actually working object. How do I call these components when I invoke a hook_event (draw a card, phase begin). And make sure right components are run?

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:
Procedural terrain generation is very slow I've been trying to create procedural generated 2d terrain (similar to a game like Terraria) using Simplex noise. I was able to get the noise function working, and I set up a grid of 16 by 16 tiles that uses the noise to generate the height of the terrain. The problem is that the grid generation is rather slow. I often need to wait 5 - 10 seconds for a somewhat small grid to generate.

My code looks like this:

var level; // height of the terrain
generate_simplex_octaves2D(__largestfeature, __persistance, seed); // generate octaves using __largestfeature

for (var gy = 0 ; gy < global.__gridheight ; gy++)
{
    for (var gx = 0 ; gx < global.__gridwidth ; gx++)
    {
        level = (global.__gridheight div 2) + (100*get_noise2D(gx/100, gy/100, __octaves, __frequencys, __amplitudes)); // get noise value at point (gx/100, gy/100)
        if (gy > level) // if below level
        {
            global.__testgrid[# gx,gy] = TILE_FULL; // set grid position to a full tile
        } else global.__testgrid[# gx,gy] = VOID; // set grid position to an empty tile

        if (global.__testgrid[# gx,gy] == TILE_FULL) tilemap_set(global.testmap, 1, gx, gy);
    }
}

This creates terrain that looks fine, it's just too slow. I want to be able to generate terrain in real-time to create an infinite landscape. After doing some research, I found that I could maybe use a compute shader to have the GPU help speed up the generation, but I am not sure how to implement a compute shader in my case. Would I calculate the noise in a shader, or generate a noise map using one? Or do something else to generate the terrain faster?

sentences:
In Slick2D, how can I generate a 2D platformer map from an image? I'm fairly new to game development. I've been messing around with Slick2D. My map consists of rectangular objects. I want to use an image to represent my map, similar to this:

How could I generate a level from that image? As I said, I'm new to game development and am not familiar with terminology or procedures.

Bonus question: How could I also generate non-rectangular game objects from it?

sentences: Good practices in data management in big projects? I am making a game using Unity ECS. All the data I have: Items, Defined Interactions, Monsters etc. are stored as .json. What are good practices to manage this data? For now I am storing all those objects in dictionary fashion where keys are "ModName.ObjectType.ObjectTag" for example "Core.Item.Sword1". All parts of the game has access to this data bank because it's static. I am not sure if what I am doing is right and if there could be problems that emerge. Overall, what are good practices for managing assets in game which should be moddable?

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

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

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

sentences:
Changing node's translation affects to sibling node I have a node which looks like this tree:

FPSController (Root node, and it's KinematicBody)

CollisionShape
Camera
GroundCheckRayCast

When I moved CollisionShape's location down, camera also going down together. There's no code that change Camera's translation, but why this kind of thing happens?

Another weird thing is that y position of Camera won't changed even it's clearly moved down.

Is this some kind of bug or something? Why Camera's y position was changed, also not updated it's own y position value?

Using Godot 3.1.1 and reproduced repo: https://github.com/rico345100/godot-glitch-reproduction

sentences:
What datastructure would you use for a collision-detection in a tilemap? Currently I save those blocks in my map that could be colliding with the player in a HashMap (Vector2, Block). So the Vector2 represents the coordinates of the blog.

Whenever the player moves I then iterate over all these Blocks (that are in a specific range around the player) and check if a collision happened.

This was my first rough idea on how to implement the collision-detection. Currently if the player moves I put more and more blocks in the HashMap until a specific "upper bound", then I clear it and start over.

I was fully aware that it was not the brightest solution for the problem, but as said, it was a rough first implementation (I'm still learning a lot about game-design and the data-structure).

What data-structure would you use to save the Blocks? I thought about a Queue or even a Stack, but I'm not sure, hence I ask.

sentences: Can I change shape of a rigid body after it created in Bullet3D? I'm beginning Bullet3D. Can I change collision shape of a rigid body after it created? A rigid body accepts a collision shape when it's creating, but it's hard to find options changes the collision shape of an instance.

sentences:
How do I wait until the player has reached the gameObject to perform the interaction? If the player clicks an object to move the player sprite to the object and interact with it, how do I wait until the player has reached the gameObject to perform the interaction?

I have the interaction hooked up okay, but it is executing as soon as the click occurs. I would like the order instead to be (player clicks on object) (player walks to object) (once player is close enough to object the interaction occurs). But if the player moves away before reaching the object then the interaction is cancelled.

I'm not sure if I should use the object's onTrigger? But my question is if I use onTriggerEnter for the gameObject, and then the player cancels the interaction before reaching it, how do I cancel the ontrigger? Is there a better way? Also, I cannot always use an onTriggerEnter because sometimes it is clicking on an empty tile and I want to wait until the player has reached the tile.

Thanks!

sentences:
How to do Marching Cubes Meshing in unity 3D I'm getting very peculiar results from my marching cubes based surface generator within unity and figured this must be a pretty common problem that has been solved already, so I thought I would extract this out as a tiny example project that only includes the broken generation code ...

http://ccoder.co.uk/files/mc.zip

... if you download and run the example you should get something like this ...

... so my question is:

How can I resolve the logic in the marching cubes meshing code to generate a complete mesh with consistent uv mappings all the way around?

  If someone can solve this I will edit the sample in this question with
  the solution so others can download this solution in the
  future.

UPDATE:

So I figured out what was causing the vertex generation issue, it looks like paul burkes lookup tables however result in some cases returning the vertex data in different orders to others which appears to be the cause of this uv issue (see image, updated)

I have updated the sample project too, anyone fancy debugging the marching cubes tri table?, something tells me this will be a long winded task!

sentences:
How to update the data in the source code to avoid cheats? I developed a multiplayer fps game in C++ and many peoples appreciated it, and today someone has created cheats for my game and he is trying to spoil my hard work which I spend developing the game. I am not expert to create an anti cheat system but I know by updating or releasing the new patch can avoid those cheats for a little time and then after some time I will need to update it again.
I want to know the quick and easy way to update all the files. This is a headache to search manually for all classes and strings and values to update them.
Data I want to update to avoid speed hack, aimbot, wall hack and flying hack.

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:
cocos2d-x Label Load Image like Sticker-Smile..(by html or …) hi and sorry for my english...

i am using cocos2d-x (c++)... can i load sticker (smile) in my Label(a text mixed by image)? i know that we can load bitmap fonts by:

Label::createWithBMFont

also i know many frameworks like flash can load html texts by textbox which can contains img tags... but what is the best way for adding smile image in the text of label in cocos2d-x?? can cocos2d Label load html text like :

"hello
How Are You"???

thanks...

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:
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: .png file to Sprite(2D and UI) - still not visible under source image I am trying to use an image as a UI Image but even after changing its texture type to Sprite(2D and UI), it isn't visible in the source image menu. The file was created in MS Paint and I'm accessing the source image menu via the "circle selector" next to Source Image in the Inspector. I'm pretty sure I've never had this issue before. I wish I could share more details but there's nothing much to say. What could be causing this issue?

sentences:
How to calculate a quaternion rotation between 2 vectors with a specific final up vector? I know you can calculate the quaternion rotation between 2 vectors with something like this after all the optimizations:

quat quat::fromtwovectors(vec3 u, vec3 v) {
    vec3 w = cross(u, v);
    quat q = quat(dot(u, v), w.x, w.y, w.z);
    q.w += q.magnitude();
    return normalize(q);
}

However, this returns the shortest quaternion rotation between vec u and vec v. Is there a way to calculate a quaternion rotation between orientation A (with a dir vector and up vector ) and orientation B?

something like

quat quat::from_two_orientations(vec3 u_dir, vec3 u_up, vec3 v_dir, vec3 v_up)

sentences:
What is the best way to limit player movement? I'm currently programming a 2d game where the player moves around on a rectangular playing field. The player has a direction and a velocity. What is the best way to limit the player's movement so he/she cannot move past the boundaries of the playing field?

Thanks,

DLiKS

sentences:
Unity 3D move kinematic rigidbody I'm trying to move a kinematic rigidbody (a spaceship) with this code:

float xSpeed = 0.0f;
float ySpeed = 0.0f;
float zSpeed = 30.0f;
Vector3 moveDirection = transform.right * xSpeed + transform.up * ySpeed + transform.forward * zSpeed;
ShipRigidBody.MovePosition(ShipRigidBody.transform.position + moveDirection * Time.deltaTime);

but moving the ship using ShipRigidBody.MovePosition makes it go through other objects with kinematic rigidbody. The collision detection of both objects is continuous dynamic and works for both other rigidbody objects and the object with the character controller.

I've tried not using a kinematic rigidbody for the ship but when it gets hitted by projectiles (with rigidbody) it moves and starts spinning around.

So my questions here would be:

Should I use a rigidbody for the NPC ship or use a character controller?
There is any way to prevent a rigidbody from move after collision of other rigidbody, besides making it kinematic?
How can I move a kinematic rigidbody so it doesen't go through other kinematic rigidbodies?

Thanks for your help!

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:
Unity PNG sequence animation changing position in animation We are making frame by frame animation and we have a canvas size for animation. Attack animation is changing position in canvas. In Unity after the attack animation is completed it teleports back to the initial position.
I tried setting animation event and updating parent position but it does not work. It teleports to nonsense locations like player is looking at +x but it teleports to -x. Anybody have solution for this? Since it is not rigged, root motion is not working.
I tried to put animation event at the last frame and put this script to the character controller which is a child object of empty parent object:
public void animationFinished(){
 animation_finished = true;
}

 void LateUpdate () {
 if(animation_finished ) {

     transform.parent.position = transform.position;
     transform.localPosition = Vector3.zero;
 }
}

I have 25 PNG as frames of animations. From idle animation I go to attack animation. Idle is stable as a position, but attack animation is changing position in canvas for example animation canvas is 1920x1080 canvas size and animation starts from the left size to right size. I can't move the character with a script because it has its own timing that I can't set up with script. So I am trying to get the last frame position and pass it to idle animation at that position but instead of that without code it teleports back to the initial position after attack is completed.
This is a similar topic, but the solution did not work.

sentences: Libgdx body passing through block then fall on it I'm using libgdx and its physic engine Box2d. My question is : how could I make my box2d body go through a block , ignore the first collison than make the block active so the ball can fall onto it. A good example is doodle jump.

sentences:
Libnoise producing completely random noise I am using libnoise in C++ taken and I have some problems with getting coherent noise. I mean, the noise produced now are completely random and it doesn't look like a noise.

Here's the image produced by my game.

I am dividing the map into several chunks, but I can't seem to find any problem doing that since libnoise supports tileable noise. The code can be found below.

Every chunk is 8x8 tiles large. Every tile is 64x64 pixels.

This is the code for generating a chunk

 Chunk *World::loadChunk(sf::Vector2i pPosition)
 {
     sf::Vector2i chunkPos = pPosition;
     pPosition.x *= mChunkTileSize.x;
     pPosition.y *= mChunkTileSize.y;
     sf::FloatRect bounds(static_cast<sf::Vector2f>(pPosition), sf::Vector2f(static_cast<float>(mChunkTileSize.x), static_cast<float>(mChunkTileSize.y)));

     utils::NoiseMap heightMap;
     utils::NoiseMapBuilderPlane heightMapBuilder;
     heightMapBuilder.SetSourceModule(mNoiseModule);
     heightMapBuilder.SetDestNoiseMap(heightMap);
     heightMapBuilder.SetDestSize(mChunkTileSize.x, mChunkTileSize.y);
     heightMapBuilder.SetBounds(bounds.left, bounds.left + bounds.width - 1, bounds.top, bounds.top + bounds.height - 1);
     heightMapBuilder.Build();

     Chunk *chunk = new Chunk(this);
     chunk->setPosition(chunkPos);
     chunk->buildChunk(&heightMap);
     chunk->setTexture(&mTileset);
     mChunks.push_back(chunk);
     return chunk;
 }

This is the code for building the chunk

void Chunk::buildChunk(utils::NoiseMap *pHeightMap)
{
    // Resize the tiles space
    mTiles.resize(pHeightMap->GetWidth());
    for (int x = 0; x < mTiles.size(); x++)
    {
        mTiles[x].resize(pHeightMap->GetHeight());
    }

    // Set vertices type and size
    mVertices.setPrimitiveType(sf::Quads);
    mVertices.resize(pHeightMap->GetWidth() * pHeightMap->GetWidth() * 4);

    // Get the offset position of all tiles position
    sf::Vector2i tileSize = mWorld->getTileSize();
    sf::Vector2i chunkSize = mWorld->getChunkSize();
    sf::Vector2f offsetPositon = sf::Vector2f(mPosition);
    offsetPositon.x *= chunkSize.x;
    offsetPositon.y *= chunkSize.y;

    // Build tiles
    for (int x = 0; x < mTiles.size(); x++)
    {
        for (int y = 0; y < mTiles[x].size(); y++)
        {
            // Sometimes libnoise can return a value over 1.0, better be sure to cap the top and bottom..
            float heightValue = pHeightMap->GetValue(x, y);
            if (heightValue > 1.f) heightValue = 1.f;
            if (heightValue < -1.f) heightValue = -1.f;

            // Instantiate a new Tile object with the noise value, this doesn't do anything yet..
            mTiles[x][y] = new Tile(this, pHeightMap->GetValue(x, y));

            // Get a pointer to the current tile's quad
            sf::Vertex *quad = &mVertices[(y + x * pHeightMap->GetWidth()) * 4];

            quad[0].position = sf::Vector2f(offsetPositon.x + x * tileSize.x, offsetPositon.y + y * tileSize.y);
            quad[1].position = sf::Vector2f(offsetPositon.x + (x + 1) * tileSize.x, offsetPositon.y + y * tileSize.y);
            quad[2].position = sf::Vector2f(offsetPositon.x + (x + 1) * tileSize.x, offsetPositon.y + (y + 1) * tileSize.y);
            quad[3].position = sf::Vector2f(offsetPositon.x + x * tileSize.x, offsetPositon.y + (y + 1) * tileSize.y);

            // find out which type of tile to render, atm only air or stone
            TileStop *tilestop = mWorld->getTileStopAt(heightValue);
            sf::Vector2i texturePos = tilestop->getTexturePosition();

            // define its 4 texture coordinates
            quad[0].texCoords = sf::Vector2f(texturePos.x, texturePos.y);
            quad[1].texCoords = sf::Vector2f(texturePos.x + 64, texturePos.y);
            quad[2].texCoords = sf::Vector2f(texturePos.x + 64, texturePos.y + 64);
            quad[3].texCoords = sf::Vector2f(texturePos.x, texturePos.y + 64);
        }
    }
}

sentences:
How can I improve the display of my png files? I develop a mini Android game available from my github (also the release apk file). The game is for kids and you are supposed to catch falling object and get points for that. Now I just created png files for the sprites and added alpha channel in gimp. It looks better, before alpha channel:

After:

But I'm not 100 % satisfied with the rough edges of the sprites. Am I correct that if I do the alpha channel more exact then the sprites will look even better (without the edges) or is there some other mistake that I make with the sprites?

Edit: With new background image, it looks like this.

Edit 2: I used jamie the monkey now of BSD license which renders better. It seems to be more exact work in GIMP that is needed.

Edit 3. Now I am satisfied. Thanks.

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:
Unity Editor extension to group scripts attached to an object Let us suppose we have a game object which has hundreds of scripts attached. Now out of those hundreds we can pick out groups responsible for a specific functionality. E.g. there are 15 scripts responsible for moving on the ladder, there 20 scripts which control shooting, 10 scripts which control jumping, etc.
Now it becomes hard to navigate all the scripts when you want to see only a specific feature related scripts.
So, what I want to do is to add some kind of grouping separators in my Inspector view, which would separate groups of scripts from each other.
Of course I know about the following improvements:

making the codebase structure reasonable by utilizing folders
placing the scripts close to each other by reordering them in the Inspector view

But still I feel that having the separators would make my life easier.
E.g. as the red lines on screenshot separate script groups, I would like to have something similar in the editor:

I found some documentation related to my question: https://docs.unity3d.com/Manual/editor-PropertyDrawers.html. But it seems that I can only customize the look of a specific script or property, but not the Inspector view. Is it so?

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:
How can I check if player is an operator in Forge? In Minecraft Forge, I would like to know if there is any way to find out if a player currently has vanilla "OP" / "Operator" status. I can't find a method that does this on the EntityPlayer Class.

I'd like something like:

EntityPlayer player = (EntityPlayer)sender;
if (player.getOpStatus) {
    [do some stuff]
}

sentences:
Should my platformer have collectibles? By collectibles, I mean objects that you collect mainly for the sake of collecting them, not to power up. Think coins in Super Mario or bandages in Super Meat Boy.

I've seen a few platformers that do not have any collectibles and it's the platforming itself which is challenging (my platformer itself is challenging), but I think adding collectibles will add extra challenge and re-playability, especially if some of the collectibles are really well hidden. Tradition would dictate that you should have collectibles, as it's a way for players to gain extra lives or even gain points, but that would not be the only reason to have collectibles.

I'm not interested in making features for feature sake. I'm purely wanting an opinion on whether collectibles should be included in a game and what should the collectibles do when you collect enough? Is a simple +1 life fine? Should there be some cool object you get? Possibly should collecting really change something hectic, like collect 100 coins and your character is invincible?

How do I decide if my platformer should have collectibles?

Closed. While I disagree with the closing as according to the FAQ What should be asked game design (level design, gameplay, mechanics, etc). I got some nice pros and cons from everyone. I have updated the question slightly to be more specific.

sentences:
Player Controller not working with rotation? I have created a player character controller. It rotates first time good but not after rotate to its original position before rotation. I am sharing code with you so any one can help me, How can I rotate character controller to 60 on Z-axis and again back to 0 degree on Z-axis?

void Update()
{
    var inputDirection = inputDetector.DetectInputDirection();

    if (Input.GetKeyDown (KeyCode.Space)) {
        moveDirection.y = JumpSpeed;
        anim.SetBool ("RunToJump", true);
    } else {
        anim.SetBool ("RunToJump", false);
    }

    if (Input.GetKey (KeyCode.S) && controller.isGrounded) {
        anim.SetBool ("RunToSlip", true);
        controller.transform.Rotate (0, 0, 60);
        Invoke ("StopSlidding", 0.1f);
     }
  }
   void StopSlidding(){
   anim.setbool("RunToSlip", false);
   controller.transform.Rotate(0,0,0);
}

First controller.transform.Rotate(0,0,60); works fine but second time I invoke StopSlidding method controller.transform.Rotate(0,0,60); It doesn't work. So my player character controller remains same on Z-axis 60 degree. I want to rotate it again to Z-axis 0 degree. So Any one can help me on this problem? My player starts moving with game scene start so there are no matter about moving player.
I am using Controller.Move(); to move my player.

sentences:
Do I need Texture Units when NOT using shaders? Does calling glActiveTexture() even make sense when not using shaders?

I only have to switch the textures before drawing a buffer with glBindTexture(), right?

sentences:
ECS - should everything be a system? I've just recently started working with LibGDX and Ashley, and I find it to be really useful and I like working with the whole entity/component/system workflow. But I've been starting to layout the GUI and other aspects of the interface that dont exactly, to me, seem like they should be entities.

When using an ECS should EVERYTHING in your game be an entity with components/a system to control them?

sentences:
How to get the MonoGame Templates working with Visual Studio C# 2013 Express? I've been looking around forever, and I can't seem to find a way to install the MonoGame C# Templates for Visual Studio 2013 Express. These include things like "SpriteFont", etc. that pop up in the templates menu when you click "Add New Item" in the solution menu. I've installed every last MonoGame related thing I can find on the internet and NOTHING has solved my problem.

To clarify, I have all the project templates that come with MonoGame:

but I'm missing all the item templates:

There should be templates in the list there labelled "SpriteFont" and other miscellaneous MonoGame related templates.

So how do I get the MonoGame templates?

EDIT: For the record, I have already tried following the advice given here, here, here, here, here and here. I also learnt from the 5th link that apparently I don't have the MonoGame template projects for things like "Empty Content Project" either.

EDIT 2: This didn't work either.

EDIT 3: I've also followed the advice here, yet again to no avail (what a surprise!).

sentences:
How to do FoV similiar to Nethack? I am currently writing a little roguelike and wondered how Nethack/other games do the FoV of the player. I had a look at Nethacks source code, but since it's C it's pretty hard to read.

For people who don't know how it looks in nethack:

I couldn't find good resources on how to achieve this result.
Of note is that my maps are a little more complex with regards to shape and objects that block sight.

So how would I actually implement that? Map is just an array of ints.

I figure I should have flags on each cell saying if it's been discovered or not, but how to I simulate the FoV?

sentences:
How to join two cubes? If I want to make a character (in Blender) made of cubes, to export it to unity later, should I leave these cubes and all the other body parts as separate objects, or join them all into one mesh?

And, If I should join them - is it a good idea to leave the cubes elements inside of each other?

Or I should remove them, add some loops and connect the vertexes?

In the last case it will be difficult to keep the cubes surfaces flat, because of the vertex shifting during joining.

sentences:
Which platform (server) use for turn based card game? My game will do next:

Dealing 4 cards to every player

Random player is turning over 1 card, after him another (which has
seen card of previous player) and etc.

On the end player with the highest card wins and dealing cards
starts again

I think it would be best that player could choose room in which he would play.
So my question is what type of comunication to use? Over Game center, my custom server or there is some spacialized server for that kind of thing?
UPDATE (added second question):
I have read on severral forums that Game Center has limit up to 4 or 16 players. My game will play over 16 people (for start I'm sure that there will be 30-40 players in same time in game). Or that means that there can be max 4/16 plaers in same match (room)?
UPDATE 2:
My game will have 4 players (exactly 4).
I will set max. timeout 10 seconds and after that if player has not turned card game is over for every player (this is that kind of game). Players can not leave the match and return again later. This is the flow of the game: player 1 plays his card, after that player 2, 3, 4 and than again player 1. Each player has to play and it's not possible to skip someone. And I need to do everything programaticaly; start the match, join the match (autom-match is only available except invite)..
If all of that i can do with Game center, that's great, I will do that then.

sentences:
Preload multiple scenes at the same time and activate them on demand in Unity. [Unity, async, simultaneous] Preload scene in unity - this question tells us about how we can pre-load a scene in Unity and load it on demand. What it doesn't tell us - how do we pre-load multiple scenes at the same time and also keep the other scenes in memory waiting to be activated when we load another scene?
Use case: pre-loading multiple scenes at the start of the application, so they are ready when required. Example:

You have a [Scene] Intro which takes 20s to complete where you start pre-reloading [Scene] Main Menu that takes 10s to load. When [Scene] Main Menu has finished pre-loading, you still have 10s to spare, those could be used to pre-load [Scene] Main Game.
You have a [Scene] Main Menu. Depending on user choice you load [Scene] Main Game or [Scene] Sandbox. You pre-load both scenes while user is still in [Scene] Main Menu. When user makes their choice, chosen pre-loaded scene is loaded.

sentences:
The animation state could not be played because it couldn't be found! If I try to use animation.Play() or have Play automatically ticked in the inspector on the animtion object, it gives me the follwing error:

The animation state could not be played because it couldn't be found!

I searched around the web and everywhere they say you need set the animation type to 'legacy', but I already changed type to legacy and it did NOT fix the problem.

Thanks in advance.

sentences:
Delaunay triangulation. Where to start? I'm trying to learn procedural generation technique's. Specifically for dungeons. I started off with a 2D array and I generate my rooms fine. Each room contains wall tiles as seen in the screenshot below.

Right now I use A* to link the rooms together. But this has some paths go straight through other rooms or around rooms. Having done some googling I found this demo which game me the idea of using Delaunay Triangulation to properly connect the rooms without going through already existing connections/rooms.

But how to apply it to my 2D array setup? My initial thinking is that I should think out side of the box (2d array haha) and grab my rooms and create a complete graph from this and then apply the Delaunay Triangulation.

I've never done anything with graphs before. So what I would to know is a) is my thinking correct in creating the graph with all the rooms linked and then to apply the triangulation and b) where should i start?

[small edit]after some more looking around stackoverflow i found this post explaining Graphs more in depth. https://stackoverflow.com/questions/15306040/generate-an-adjacency-matrix-for-a-weighted-graph

sentences:
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:
libgdx: how to manage entity classes Good day sirs, I know this is a newbie question but I really need to ask it. I've been reading a lot of sample codes on libgdx, and I have seen entities(player, enemy, boss,etc.).

my question is what should an entity class contain?as I have seen it contains states which i will use to animate my sprite, should I also put my inputs/controls, and animation in this entity class?

sentences: Creating a large amount of sprites and animations For my AP U.S. Government and Politics class, I am making a spinoff of Mortal Kombat. Because of time constraints, I'm using an open source version of the game and want to create new characters.  I have about two weeks to do the project and can invest about 1-4 hours most days. I want it to look as nice as it can with the limited knowledge, skill, and time that I have. What programs or techniques would be best for a beginner with my time constraint?

sentences:
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 do I draw my particles when an enemy is killed? I have enemies that move left and right.
I was wonder how I could make my particles show up when the enemy is killed?
Here is my particle class
    class explode:

        def __init__(self,x,y,height,width,color):
            self.x = x
            self.y = y
            self.height = height
            self.width = width
            self.explode = [
            pygame.image.load("spark_01.png"),
            pygame.image.load("spark_02.png"),
            pygame.image.load("spark_03.png"),
            pygame.image.load("spark_04.png"),
            pygame.image.load("spark_05.png"),
            pygame.image.load("spark_06.png"),
            pygame.image.load("spark_07.png")]

            self.explode = [pygame.transform.scale(image,(image.get_width()//7,image.get_height()//7)) for image in self.explode]

            self.rect = pygame.Rect(x,y,height,width)
            self.direction = "blobright"
            self.anim_index = 0
        def draw(self):

            self.rect.topleft = (self.x,self.y)
            if self.direction == "blobright":
                window.blit(self.explode[self.anim_index], self.rect)
                self.anim_index += 1
                if self.anim_index == len(self.explode):
                    self.anim_index = 0

    black = (0,0,0)
    explode1 = explode(400,450,50,50,black)
    explodes = [explode1]

This is where I delete my enemies when they are killed. How can I add my particles after it's deleted and remove the particles afterward?

        #--------------------------------------------------------------------------------------------------------- enemys

                # enemys 2
            for enemys in enemying:
                for bullet in bullets:
                    if bullet.rect.colliderect(enemys.hitbox):
                        if enemys.health > -4:
                            enemys.health -= 1
                            minusenemyhealthtext()
                            bullets.pop(bullets.index(bullet))
                        else:
                            enemyscore += 1
                            del enemying[one]
                            enemyors = font.render("" + str(enemyscore), True, (0,0,0))
                            enemydors.center = ((130,125))

sentences:
How frequently do my game server need to message the client? I am writing a game-server and a game-client. In the client there is a game loop that has a delay of ~16ms (because that would be nearly 60fps). All the logic is at the time handled at server side so I need to send the latest frame to the client every 16 ms. Is this a good solution? I know that I probably have to do some game logic at client side just to smooth things out but this is an early version.

Is it possible to make the server send frames to the client each 16ms? Each client is handled in different threads (or actors, as the server is written in Erlang).

sentences:
How do I pause an XNA game? I'm trying to implement pausing by following this tutorial. The tutorial recommends essentially this as the implementation:

if (!paused) {
    Simulate(gameTime);
}

How does this work? What does Simulate mean here?

sentences:
How important is c# for game programming? Possible Duplicate:
  Does C# have a future in games development?

Presently I'm learning c++ and in starting stage of opengl . My ultimate goal is to be game programmer. I want to stick with c++ but my doubt is how important is to learn c# or XNA? What's their future compared to c++ in game development? What about the career prospective?

sentences:
Handling collision with LWJGL rectangles I'm testing collision with other rectangles so I can implement it into my current project. The problem is the rectangle starts at the right x and y, but I'm not sure where exactly they are. I'm pretty sure they're starting from the x and y point and the height is going either up and down. My current ortho makes the y axis start from the bottom of the screen but I'm not sure how their rectangle calculates. How can I improve this class so for each side the bottom rectangle touches, it turns a certain color to identify collision.

public class a {

    static int playerX = 400;
    static int playerY = 400;

    static int enemyX = 100;
    static int enemyY = 100;

    public static void main(String[] args) {
        try {
            Display.setDisplayMode(new DisplayMode(640, 480));
            Display.setTitle("collision");
            Display.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
            Display.destroy();
            System.exit(1);
        }

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(0, 640, 0, 480, 1, -1);
        glMatrixMode(GL_MODELVIEW);

        Rectangle rl = new Rectangle(playerX, playerY, 10, 20);

        Rectangle r2 = new Rectangle(enemyX, enemyY, 200, 10);

        float c2 = 0;//color

        while (!Display.isCloseRequested()) {
            glClear(GL_COLOR_BUFFER_BIT);
            rl.setX(playerX);
            rl.setY(playerY);

            r2.setX(enemyX);
            r2.setY(enemyY);

            if(rl.intersects(r2))
            {
                c2 = 1f;
            } else if(!rl.intersects(r2))
            {
                c2 = 0f;
            }

            if(Keyboard.isKeyDown(Keyboard.KEY_A))
                playerX -= 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_D))
                playerX += 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_W))
                playerY += 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_S))
                playerY -= 1;

            System.out.println(playerY-100);

            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

            glColor3f(0, 1, 0);

            //PLAYER

            //l
            glBegin(GL_QUADS);
            glVertex2f(playerX, playerY     -10      );
            glVertex2f(playerX + 10, playerY    -10  );
            glVertex2f(playerX + 10, playerY - 100    );
            glVertex2f(playerX, playerY      - 100    );
            glEnd();
            //r
            glBegin(GL_QUADS);
            glVertex2f(playerX + 100, playerY   -10           );
            glVertex2f(playerX + 110, playerY        -10      );
            glVertex2f(playerX + 110, playerY - 100            );
            glVertex2f(playerX + 100, playerY      - 100       );
            glEnd();
            //top
            glBegin(GL_QUADS);
            glVertex2f(playerX + 10, playerY     -9               );
            glVertex2f(playerX + 100, playerY       -9       );
            glVertex2f(playerX + 100, playerY - 20          );
            glVertex2f(playerX + 10, playerY      - 20           );
            glEnd();
            //bot
            glBegin(GL_QUADS);
            glVertex2f(playerX + 10, playerY          -90          );
            glVertex2f(playerX + 100, playerY    -90          );
            glVertex2f(playerX + 100, playerY - 101        );
            glVertex2f(playerX + 10, playerY      - 101         );
            glEnd();

            glColor3f(c2, 1, 0);
            //ENEMY
            glBegin(GL_QUADS);
            glVertex2f(enemyX, enemyY);
            glVertex2f(enemyX + 200, enemyY);
            glVertex2f(enemyX + 200, enemyY - 10);
            glVertex2f(enemyX, enemyY - 10);
            glEnd();

            Display.update();
            Display.sync(60);
        }
        Display.destroy();
        System.exit(0);
    }

}

I just made it so OpenGL set its position to the rectangle instead of the rectangle to OpenGL.

sentences:
share assets beetween platforms What is the good way to share assets between platforms (android, desktop, etc) ?

by default there is an assets folder in each platform folder.

sentences:
Why do I see "<" and ">" in Unity C# code? I copied Unity code from a website and now it contains stuff like &amp;lt; T &amp;gt; which my IDE flags as an error.

It looks like the intended text has been corrupted somehow. What is this supposed to be, and how can I correct it?

public class Tree&lt;T&gt;
{
    public T Data { get; set; }
    public IEnumerable&lt;Tree&lt;T&gt;&gt; Childs { get; set; }
    public bool Opened { get; set; }

    public Tree()
    {
        Childs = Enumerable.Empty&lt;Tree&lt;T&gt;&gt;();
        Opened = true;
    }
}

sentences:
How to predict movement correctly when a player is invisible? I have a multiplayer game and I'm doing client-side prediction, but some players can drink a potion and become invisible...

The problem is that when they become invisible I don't share anything that the client could use to know he's there, so when a player tries to step into a tile occupied by a invisible player, he predicts that he succeeds, and then gets a ugly position correction sent by the server.

One solution would be to share something so the client can tell, but then hackers could use it to find out where invisible players are, cheating.

Btw I already solved regular movement prediction, it works perfectly.

sentences: Should I use Unity for a "non-game" mobile app? I have some experience with Unity but I always made games only. Right now I have an idea for an app but I don't think Unity is the most efficient way to do it. Probably Android SDK and OpenGL ES would be better but I have to learn them. So should I learn a new tool or should I stick with what I already know and get this thing done?

sentences:
How do I move a sprite by clicking other sprites in the stage? I am new to the LibGDX environment; how do I move a sprite by clicking other sprites in the stage?

As you can see, I have an object I wish to move by clicking on arrow keys. Here are my current scripts:

public class MyGdxGame extends ApplicationAdapter {

    Stage stage;

    @Override
    public void create () {
        ScreenViewport viewport = new ScreenViewport();

        stage = new Stage(viewport);
        Gdx.input.setInputProcessor(stage);

        Myactor actor = new Myactor();
        stage.addActor(actor);
    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(0.33f,0.66f,0.99f,1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

    @Override
    public void dispose () { }
}

public class Myactor extends Actor {

    Texture texture = new Texture(Gdx.files.internal("ball.png"));
    Sprite sprite = new Sprite(texture);

    Texture Tsol = new Texture(Gdx.files.internal("left.png"));
    Sprite Ssol = new Sprite(Tsol);

    Texture Tsag = new Texture(Gdx.files.internal("right.png"));
    Sprite Ssag = new Sprite(Tsag);

    @Override
    public void draw(Batch batch, float parentAlpha) {
        sprite.setPosition(Gdx.graphics.getWidth()
                - sprite.getWidth() - 50, Gdx.graphics.getHeight() / 2);
        sprite.draw(batch);

        Ssol.setPosition(Gdx.graphics.getWidth() - sprite.getWidth(), 0);
        Ssol.setRotation(90f);
        Ssol.draw(batch);

        Ssag.setPosition(Gdx.graphics.getWidth()
                - sprite.getWidth(), Gdx.graphics.getHeight()-sprite.getHeight());
        Ssag.setRotation(90f);
        Ssag.draw(batch);
    }
}

sentences:
Prototyping a puzzle game for solvability of levels I am in the prototyping phase of making a puzzle game for iOS. The basic premise of what the player has to do is get from point A to point B by navigating through a maze like setup, while moving blocks out of the way, and avoiding enemies. This is my first approach to a game like this so I am wondering how others have made sure that the levels they create are solvable.

For example take the classic Unblock game where you have to move the red block off the game board by moving the other non red block pieces out of the way. It gets difficult because they are all in a tight space with not much movement to be had.

Has does the creator know that the arrangement of puzzle pieces are placed in a way that makes it possible to solve the puzzle? Do they start with paper prototypes and work from a solvable end state backwards to make the initial game board layouts?

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:
Set up a basic D3DXQUATERNION I'm trying to set up a D3DXQUATERNION to operate a rotation of 90 degrees around the Y axis.

I tried in the following way:

D3DXQUATERNION tempRot1(0.0f, 1.0f, 0.0f, cos(XM_PIDIV2/2));

because in the documentation they write that the fourth component, w, is defined as:

q.w = cos(theta/2)

But I'm afraid I didn't understand correctly, since the rotation is not what I expected.

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:
LibGDX Json writes only part of class Hello I've been developing this game for awhile and now trying to implement save data via Json.
I've gotten to where when the app is first launched it will write the Json file with the variables I would like the game to save, but it only writes part of the class that I am passing.

Here is my implementation

@Override
    public void create()
    {

        batch = new SpriteBatch();
        file = Gdx.files.external("/bin/save.json");
        create.setFirstSpawn(true);
        create.setSpawnX(-7);
        create.setSpawnY(417);
        create.setTime(0);
        create.setMap("cabinMap");

        if(!file.exists()) {
            Json json = new Json();

            json.setOutputType(JsonWriter.OutputType.json);
            file.writeString(json.prettyPrint(create), false);

        }
        if (file.exists()) {
            JsonReader jread = new JsonReader();
            JsonValue base = jread.parse(file);
            SpawnX = base.getFloat("SpawnX", -7);
            SpawnY = base.getFloat("SpawnY", 417);
            map = base.getString("map", "cabinMap");
            time = base.getFloat("time", 0);
firstSpawn = base.getBoolean("firstSpawn", true);
        }
        if(map == "cabinMap") {
            this.setScreen(new cabinMap(this));
        }
        if(map == "tMap") {
            this.setScreen(new tMap(this));
        }
        if(map == "lowerTMap") {
            this.setScreen(new lowerTMap(this));
        }
        if(map == "rightTMap") {
            this.setScreen(new rightTMap(this));
        }
        else {
            this.setScreen(new cabinMap(this));
        }
    }

Here is the class that I am passing

public class create
{
    boolean firstSpawn;
    float SpawnX;
    float SpawnY;
    float time;
    String map;

    public void setFirstSpawn(boolean firstSpawn)
    {
        this.firstSpawn = firstSpawn;
    }

    public void setTime(float time)
    {
        this.time = time;
    }

    public float getTime()
    {
        return time;
    }

    public void setMap(String map)
    {
        this.map = map;
    }

    public String getMap()
    {
        return map;
    }

    public boolean isFirstSpawn()
    {
        return firstSpawn;
    }

    public void setSpawnX(float spawnX)
    {
        SpawnX = spawnX;
    }

    public float getSpawnX()
    {
        return SpawnX;
    }

    public void setSpawnY(float spawnY)
    {
        SpawnY = spawnY;
    }

    public float getSpawnY()
    {
        return SpawnY;
    }
}

And this is my result

{
"map": "cabinMap",
"SpawnX": -7,
"SpawnY": 417
}

As you can see from the output file I am missing 2 values.
float time and boolean firstSpawn are missing from the file. I've worked for hours trying to find out why. I have no clue why it omitted part of the code... If anyone knows why that would be very helpful to me.

sentences:
Making an enemy follow player (Unity) I'm working on coding enemy ai for a star fox-esqe shooter and I need the enemy to approach the player, stay a certain distance away and stay in front of them until destroyed. I can get the enemy to approach the player and I can get the enemy to stay a certain distance from the player but I'm not sure how to get the enemy to actually stay in front of the player. For a bit of extra information, the player makes a number of sharp turns and the like throughout the level. Also, as a stand in I tried simply causing the enemy to parent to the player within a certain radius but that causes clipping issues with buildings and the ground.

public class EnemyCar: MonoBehaviour
{
    public float safeDistance = 20f; // How close the enemy can get to the player

    // ...

    // Update is called once per frame
    void Update()
    {
        transform.LookAt(player.transform);

        Vector3 targertLocation = player.transform.position - transform.position;
        float distance = targertLocation.magnitude;

        // Decrease our speed as we get closer
        rb.AddRelativeForce(Vector3.forward * Mathf.Clamp((distance - 30) / 50, 0f, 1f) * thrust);
    }
}

sentences:
How do I make a transition between two states to be slowly? Now it's doing the first New State then it's jumping to New State 0
Instead I want it to slowly move between the two states. I want to see the animation transition slowly changing from state to state.

For example when you see a character sitting and then standing so to see the transition from sitting to standing slow.

sentences:
Creating transparent image with localGraphicsConfig not always working I'm trying to use GraphicsConfiguration.createCompatibleImage to create transparent images.
This creates an empty image which I'm filling with a mosaic pattern later on in the code.

This seems to work like a charm on my iMac using the latest OSX.
When i switch (bootcamp) to Windows 7, the transparency doesn't work (just opaque images).
Is there something i'm missing?

I'm using Java 1.7.0_03 on Windows 7 (64)

I'm actually not quite sure if it's necessary to render the image using the localGraphicsConfiguration since the image/layer with the mosaic will never change. How can I solve this?

sentences:
Animate multiple entities I'm trying to animate multiple(3) entities using one model(IQM format).

It's working but performance is really bad because I'm calling animate function for each entity in my game loop (I think problem is there).

What's the best way to animate multiple entities (with different animation ofc) in OpenGL? I think I can try build one VBO / entity for better performances but I don't think it's the best way to do it.

sentences:
unity: read from text file to instantiate objects I'm trying to use the following code to read a text file stored in the Resources folder or in a file on my computer, and instantiate objects in a Unity 3D scene accordingly. I'm having trouble getting it to work. I've tried attaching the script to either the main camera or an empty gameobject. Neither work so far...

I either end up with an error saying the path does not exist (when I put the text file into the project folder on my desktop), or a null exception, or that the path contains invalid characters.

Where am I going wrong?

I'm trying to use a jagged array because I'll need users to eventually be able to change the text file on-the-go to create a level.

The text file contains the following data:
 S 0 0 0 1
 0 0 1 0 2
 2 0 0 2 1

My script currently reads:

using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
using System.Linq;
using System.IO;
using UnityEngine.UI;

public class GenerateLevel : MonoBehaviour {

    public Transform player;
    public Transform ground;
   // public Transform floor_valid;
    public Transform floor_obstacle;
    //public Transform floor_checkpoint;

    //public const string sfloor_valid = "0";
    public const string sfloor_obstacle = "0";
   // public const string sfloor_checkpoint = "2";
    public const string sstart = "S";

    public string textFile = "maze";
     string textContents;

    // Use this for initialization
    void Start () {
        Instantiate(ground);

        TextAsset textAssets = (TextAsset)Resources.Load(textFile);
        textContents = textAssets.text;

        //string[] lines = System.IO.File.ReadAllLines("//maze.txt");

        //string textFile;
        //textFile = Resources.Load("assets/resources/maze").ToString();

        string[][] jagged = ReadFile(textContents);

        for (int y = 0; y < jagged.Length; y++)
        {
            for (int x = 0; x < jagged[0].Length; x++)
            {
                switch (jagged[y][x])
                {
                    case sstart:
                        //Instantiate(floor_valid, new Vector3(x, 0, -y), Quaternion.identity);
                        Instantiate(player, new Vector3(0, 0.5f, 0), Quaternion.identity);
                        break;
                    //case sfloor_valid:
                      //  Instantiate(floor_valid, new Vector3(x, 0, -y), Quaternion.identity);
                        //break;
                    case sfloor_obstacle:
                        Instantiate(floor_obstacle, new Vector3(x, 0, -y), Quaternion.identity);
                        break;
                    //case sfloor_checkpoint:
                      //  Instantiate(floor_checkpoint, new Vector3(x, 0, -y), Quaternion.identity);
                        //break;
                }
            }
        }
    }

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

    }

    string[][] ReadFile(string file)
    {
        string text = System.IO.File.ReadAllText(file);
        string[] lines = Regex.Split(text, "\r\n");
        int rows = lines.Length;

        string[][] levelBase = new string[rows][];
        for (int i = 0; i < lines.Length; i++)
        {
            string[] stringsOfLine = Regex.Split(lines[i], " ");
            levelBase[i] = stringsOfLine;
        }
        return levelBase;
    }
}

sentences: What is Java missing that might make it difficult to develop fully-featured 2D games? Without using any external libraries, does Java, including all officially supported APIs give you enough to develop fully-featured 2D games? The reason I ask is that I hear a lot of "bad-mouthing" about Java and game development, but I'm wondering if that is only in regard to intensive 3D games. Also reading up on some Java games there often appears to be external graphics or sound libraries involved that simply have a Java port. This makes me think it isn't possible.

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:
How to animate clouds in a plane? I'm building a top-down strategy 2D game, and i'm stuck animating clouds that will float above the arena, hiding other elements. The effect i want to achieve is something exactly like this:

How would i go about implementing it in Unity3D?

sentences:
Psychology of pixelated lighting The situation
The game I'm working on has a 16-bit inspired art theme. It's consistency is relatively relaxed. (i.e. pixels don't have to line up.)
Since it has a slightly dark theme, I decided to light up only the surrounding area of the player. Though I'm town because I'm not sure which of the three methods are most appealing.
Method 1: Smooth lighting
I.e. a smooth gradient between the player and the surrounding area.

I fear it's smooth nature might feel off compared to the rest of the game's art,
Method 2: Pixelated lighting (without pixel alignment)
I.e. a pixelated gradient that doesn't necessarily have to line up with background tiles.

This is more in tune with the game's art, but it's lack of alignment is noticeable.

yellow lines are tile borders while teal lines are lighting borders
Method 3: Pixelated lighting (with pixel alignment)
Essentially the same as the previous method, except without the lack of alignment. This fits the game's art style well, but almost too well. I mean that in a way that the lighting is almost too pixelated.
Conclusion
Perhaps a combination of these methods is the most psycologically pleasing or maybe something completely differn't will fit the bill.
What are your guys' thoughts? / What have other games done in this situation?

sentences:
How do you use your own tileset in Tiled? I'd like to create a 2d platformer and I understand that using tiles helps you a lot.

I think many use the map editor "Tiled" but I can't find anywhere how do you make your own tileset from a given image that you created.

I spent most of today searching a reference for this on Google, without much luck..
The only hint comes from a couple of python scripts, but I didn't manage to make them work
Am I missing something?

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:
Does the standard lighting equation ever allow objects to be brighter than their textures? It occurred to me that the standard lighting setup you see in all the tutorials doesn't allow lights to actually make an object appear brighter than its texture.  The light value is always clamped between 0 and 1.  Which means at maximum brightness, the resulting color will be exactly the same as the value from the texture.  Even if you didn't clamp it manually, in a deferred renderer, the graphics card/driver will end up clamping it for you.

This seems very unusual to me.  Do AAA games actually use lighting like this?  Or is there a solution?  My thought was maybe this is what HDR "fixes" but the only thing I've noticed HDR doing is that rather annoying light-transition effect.

sentences:
Finding direction of travel in a world with wrapped edges I need to find the shortest distance direction from one point in my 2D world to another point where the edges are wrapped (like asteroids etc). I know how to find the shortest distance but am struggling  to find which direction it's in.

The shortest distance is given by:

int rows = MapY;
int cols = MapX;

int d1 = abs(S.Y - T.Y);
int d2 = abs(S.X - T.X);
int dr = min(d1, rows-d1);
int dc = min(d2, cols-d2);

double dist = sqrt((double)(dr*dr + dc*dc));

Example of the world

                   :
                   :  T
                   :
    :--------------:---------
    :              :
    :           S  :
    :              :
    :              :
    :  T           :
    :              :
    :--------------:

In the diagram the edges are shown with : and -. I've shown a wrapped repeat of the world at the top right too. I want to find the direction in degrees from S to T. So the shortest distance is to the top right repeat of T. but how do I calculate the direction in degreed from S to the repeated T in the top right?

I know the positions of both S and T but I suppose I need to find the position of the repeated T however there more than 1.

The worlds coordinates system starts at 0,0 at the top left and 0 degrees for the direction could start at West.

It seems like this shouldn’t be too hard but I haven’t been able to work out a solution. I hope somone can help? Any websites would be appreciated.

sentences:
Chess Game WPF MouseDown Event I'm making a chess game with wpf and I have never used wpf before. I've used windows forms, so besides the xaml, it's pretty familiar. Usually when I want to create a mousedown event I look at what I have on window design screen->click the object->go to properties->events->MouseDown event->double click the event->it creates a method that executes when the mouse is pressed on that element. Looks like this...

private void Pawn_1__MouseDown(object sender, MouseButtonEventArgs e)
{

}

But for my chess game in my C# code in the mainwindow constructor I put some initialization code to place a bunch of rectangles all over the screen representing the grid I'd be using for my chess game. How can I create a MouseDown event for these rectangles since they aren't in the designer?

sentences:
What are the performance implications of multiple windows with indivdual OpenGL contexts? For an engine I'm developing I've decided to allow users to set up multiple windows showing differing views of the same "world."  This is being developed using OpenGL (hopefully aiming for 3.2 core eventually if that affects the ansmer) and SDL 1.3.  The basic structure I've got set up is:

class Window {
    SDL_Window *sdl_window;
    SDL_GLContext context;

    Window(...) {
        sdl_window = SDL_CreateWindow(...);

        // Rest of the setup of world etc.
    }

    gl_init() {
        context = SDL_GL_CreateContext(sdl_window);

        // Set up initial OpenGL settings.
    }

    render() {
        SDL_GL_MakeCurrent(sdl_window, context);

        // Rendering the world.

        SDL_GL_SwapWindow(sdl_window);
    }
}

This all compiles and runs fine with the rest of the demo code I've developed so far, simply showing a pair of slightly offset views.  However, there's no really performance heavy stuff implemented yet.

Is this the correct approach to use?
Are there any major performance implications with switching the context twice (or more) a frame? (other than the expected double (or more) rendering occurring).

For example, does switching contexts force a flush of the graphics memory to the system RAM or something equally frame-rate killing?

Is there an alternative method  that would allow setting up two different viewpoints and rendering them in one pass?
If this is the best way to do it is there a way of sharing data between contexts?  I'm thinking once I switch to VBO's over display lists, if the views overlap in some way they should be sharing VBO's for that portion.

sentences:
UI of a city-building game I'm completely new to gamedev and want to learn how to design good UI for a city-building game (like SimCity).

What books and other materials can I read in order to learn it?

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 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:
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:
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:
How to automatically scroll vertical text? I've a GUI, and a panel with a Text control.

I simply want to do an automatic vertical scroll effect (circular).

Problems I've to solve:
- How to identify if text on my textbox is "too much" and overflow vertical

How to move Text and not textbox transform Y

Can you help me find the correct solution ?

Thanks

sentences:
I want camera to be positioned on the player also x axis should move continuosly by .05f in unity 2d I am creating an 2d platformer and I am newbie to Unity; any help will be highly appreciated. I want the camera to be positioned on the player and also the X axis should move continuously by .05f. And if player is not moving or stuck somewhere and if player is behind camera player (because X axis is automatically moving by .05f)  then player should die.
Is it doable? I am using Cinemachine and any script logic will be appreciated.

sentences:
Why is this animation jerky? I am trying to create a simple game on android but I am unsure the best way to do the game loop.  Looking at the LunarLander sample the game loop just loops like a variable time step loop (elapsed = now-lastupdate).  I tried using this method to draw a circle that grows in size to a max radius then shrinks to a min radius and repeats.  However, when I run the program the growing stage is very choppy and slow (it takes longer than it should to get to max radius).

My Code:

    public void updateSize(double elapsed) {
        if (mGrowing == true && mRadius > mMaxRadius) {
            mGrowing = false;
        }
        if (mGrowing == false && mRadius < mMinRadius) {
            mGrowing = true;
        }

        if (mGrowing == true) {
            mRadius += mDRadius * elapsed;
        } else {
            mRadius -= mDRadius * elapsed;
        }
    }

mDRadius is the number of pixel the radius should change per second and elapsed is the number of seconds that has passed.

I tried putting in a sleep of 2ms and 5ms in my game loop and I get the same result.

I converted my loop to a fixed time step (only run physics update if now-lastupdate > TIME_STEP) and the animation was a lot smoother.

UPDATE: I change the sleep to 15ms and it's a lot smoother.  Every other example I've seen of an android game does not have a sleep in the main loop.  Is this because my sample is just so simple that it takes virtually no time to update and all other examples just have a longer update time or am I missing something?

sentences:
What's the best open source physics engine to use with JOGL? I have a past with jbullet but the existing jogl compatible sources and demos seems uncompleted. I have managed to implement it to an extent but still looking for a better documented engine with more demo applications.

My answer to this question is currently JBullet but wondering if there are any better and easier solutions.

Any ideas & suggestions?

sentences:
Tile Based Engine: Storing Tiles and Levels I've worked with tile-based engines before (a few years ago when I was pretty green).  Now that I know a bit more, I want to revisit tile-based engines but I want to approach it correctly.  I want to know two things: what is the best way to store the tiles, and what is the best way to store the levels?

For the first question: The tiles should be stored in sets, like a 10x10 grid of 40x40 tiles stored in a 400x400 image.  Right?  So when it's displayed, do you just place the entire image on the screen and only show the part of the image you want?  And in that case, wouldn't it create a significant amount of overhead for a bunch of unused image?  Or do multiple copies of the same image use the same cache?

For the second question: Should the levels be stored as two dimensional arrays?  Serialized in a database?  Or what?

sentences: How do they made Pokémon games so flawlessly balanced? I find it hard to believe how well balanced the Pokémon games are. Not just within the games, where you'll find amazing balance from the very beginning to the very end, but, surprisingly, even when things get more competitive. If you have ever played the simulators that are available, you'll know what I'm talking about www.smogon.com. There are thousands of unique Pokémon characters, moves, traits and items. Yet, if you try to find a single broken strategy, You can't. And if you do find something obscure that could give you a good advantage, you'll realize it's impossible. The emerging competitive scenario is one of the most amazing strategy games I've ever seem, and it's not even a feature of the Pokémon games!

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:
Queueing up character actions I'm developing a 2D platformer with action-fighter elements. Currently things are working relatively smoothly but I'm having difficulty sorting something out. For the time, keeping my character's states and actions separated and preventing them from stepping on each others' toes is working out well and properly, but I would like to add a feature to my character to get him to behave a little bit more fluidly for the player.

At the moment, he has numerous attacks and abilities that he can execute, all of them being executed with button presses. Here lies the problem: Being as everything is executed through button presses, while an action is in progress I flag the game to disregard further button presses until the action has completed. Therefore, consecutive actions cannot be performed until after the previous action has completed entirely. In runtime this behavior feels very icky, and very ungamelike.

In games that rest most memorably at the forefront of my mind the player is able to execute button commands during the process of actions, and at the end of the current action, the following action is executed (seems like some sort of a queue system or something)

Can anybody offer any guidance with this?

sentences:
Is index drawing faster than non-index drawing I need to draw a lot of polygons consisting of 6 vertices's (two triangles).

Without any texture coordinates, normals etc., both approaches result in 72 bytes. In the future I would definitely also need texture coordinates and normals, which would make index drawing consume less memory. Not a lot though.

So my question is: For VAOs with few vertex overlaps, which approach is faster? I don't care about the extra memory consumed by non-index drawing, only speed.

Edit: To make it clear.

Non-index approach:

float[18] vertices = {
//Triangle 1
1,1,0,
1,0,0,
0,0,0,

//Triangle 2
1,0,0,
0,1,0,
0,0,0,
};

Index approach:

float[12] vertices = {
1,1,0,
1,0,0,
0,0,0,
0,1,0,
};

int[6] indices = {
//Triangle 1
0,1,2,

//Triangle 2
0,3,2
};

sentences: How to work out given two coordinates should I use a vertical/horizontal/diagonal line to connect them I'm developing an android game and have essentially a grid. The user can drag a line between two points however the line will only ever be vertical, horizontal or diagonal (y=x). So I need to work out given two points which type of line is the best match.

sentences:
What's the difference between using hardware-accelerated APIs and the OS's drawing API? On Windows, I can do drawing with the OS API without OpenGL or D3D. The code I am writing will make calls to a device driver and tell the GPU what to do regardless, right?

How is using OpenGL different exactly? Do these libraries have code that will interact with the GPU differently than just the Windows API does?

sentences:
How to resize the child node fit inside SKSpriteNode when resizing? I am creating a virtual gamepad for my game, It has one main SKSpriteNode with circle image and four child node(up, down, left, right) with image. When I am using default size for all it looks perfect but it's big in size and when I tried to resize the main circle SKSpriteNode all it's child node are bigger then it's parent and I am unable to calculate size for child node that will fit for every condition(different size of Main node).

-(id)initWithJoystickImage:(NSString *)baseImage
                   upImage:(NSString *)upImage downImage:(NSString *)downImage leftImage:(NSString *)leftImage rightImage:(NSString *)rightImage
{
    if((self = [super initWithImageNamed:baseImage]))
    {
        SKSpriteNode *up = [[SKSpriteNode alloc] initWithImageNamed:upImage];
        up.position = CGPointMake(0, up.frame.size.height/2);
        [self addChild:up];

        SKSpriteNode *down = [[SKSpriteNode alloc] initWithImageNamed:downImage];
        down.position = CGPointMake(0, -down.frame.size.height/2);
        [self addChild:down];

        SKSpriteNode *right = [[SKSpriteNode alloc] initWithImageNamed:rightImage];
        right.position = CGPointMake(right.frame.size.width/2, 0);
self.size.height/2.5);
        [self addChild:right];

        SKSpriteNode *left = [[SKSpriteNode alloc] initWithImageNamed:leftImage];
        left.position = CGPointMake(-left.frame.size.width/2, 0);
 self.size.height/2.5);
        [self addChild:left];
    }
    return self;
}

sentences:
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:
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: Would it be possible to randomize LOD distance in unity like in BOTW grass I was studying the BOTW grass shader and noticed how the grass appears uniform at a distance but complex up close. From watching gameplay it appears the LOD is randomized to make the transition between the two types of grass smooth. I can't find any way to do something like this in unity and am wondering if anybody has advice, or can guess as to how they did it. Thanks!

sentences:
Is there any API that returns information about "all games"? I'm building a project about games and I need to make a "portfolio" of games.

Something like a catalog of Netflix, but about games, and I need some basic information about the game, like Publisher, Genre, Developer, Release Date and some more information.

Someone know a free API that returns the date that I need? I tried Steam API, but doesn't work for me.

Obs: Returns a JSON.

sentences:
LibGdx input data REQUIRED I am using the code below to ask users for their username.

MyTextInputListener listenerz = new MyTextInputListener();
Gdx.input.getTextInput(listenerz, "Create Username", "");

I have knowledge in PHP but beginner in Java LibGdx.
I know that in HTML there is a REQUIRED

<input name='username' required />

That's why I wanted to know the equivalent coding in LibGdx for the REQUIRED input.

sentences:
SpriteBatch.Begin() making my model not render correctly I was trying to output some debug information using DrawString when I noticed my model suddenly was being rendered like it was inside-out (like the culling had been disabled or something) and the texture maps weren't applied

I commented out the DrawString method until I only had SpriteBatch.Begin() and .End() and that was enough to cause the model rendering corruption - when I commented those calls out the model rendered correctly

What could this be a symptom of? I've stripped it down to the barest of code to isolate the problem and this is what I noticed.

Draw code below (as stripped down as possible)

        GraphicsDevice.Clear(Color.LightGray);
        foreach (ModelMesh mesh in TIEAdvanced.Meshes)
        {
            foreach (Effect effect in mesh.Effects)
            {
                if (effect is BasicEffect)
                    ((BasicEffect)effect).EnableDefaultLighting();
                effect.CurrentTechnique.Passes[0].Apply();
            }
        }

        spriteBatch.Begin();
        spriteBatch.DrawString(spriteFont, "Camera Position: " + cameraPosition.ToString(), new Vector2(10, 10), Color.Blue);
        spriteBatch.End();

        GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        TIEAdvanced.Draw(Matrix.CreateScale(0.025f), viewMatrix, projectionMatrix);

sentences:
Timer for pop up text in XNA I am making an xna game which contains turn-based RPG battle elements. Any good game that features turn-based battle has to have a good feedback to the user.

For example, When my guy attacks, there should be a text popup that says something like "HERO DOES 15 DMG!". And this text should disappear several seconds after.

I am currently able to put text on the screen via standard spritefont drawing. However, in order to make it disappear I am currently using bools and a timer. I have been doing research on timing related stuff but I seem to be very bad at it.

Using some of the suggestions I have received, I have made a messagesystem class. But I am still confused about the implementation. Here is the new code:

public class MessageSystem
    {

        public static readonly MessageSystem Instance = new MessageSystem();
        public float timenow;

        struct Message
        {
            public SpriteFont Font;
            public string Data;
            public Vector2 Position;
            public float Duration;
            public bool isActive { get; set; }

        }

        List<Message> Messages = new List<Message>();

        public MessageSystem()
        {

        }

        public void Show(string data, Vector2 pos, SpriteFont font, float duration)
        {
            Messages.Add(new Message() { Data = data, Font = font, Position = pos, Duration = duration });
        }
        public void Update(GameTime gameTime)
        {
            timenow += (float)gameTime.ElapsedGameTime.TotalSeconds;

            for (int i = 0; i < Messages.Count; )
            {
                if (Messages[i].Duration < timenow)
                {
                    Messages.RemoveAt(i);
                    continue;
                }
                i++;
            }
        }

        public void Draw(SpriteBatch batch)
        {

            foreach (Message msg in Messages)
            {
                batch.DrawString(msg.Font, msg.Data, msg.Position, Color.Lime);
            }

        }

    }

Here is the implementation part:

if (p1atktimer >= 10)
            {
                AttackMsg.Show(playerBattler.Name + " attacks furiously!", battlemsgs, battlefont, 2.0f);
                DealDmgFromLeft(gameTime);
                p1atktimer = 0;
                timenow = 0;
            }

In my update method I just have:

Attackmsg.Update(gameTime);

And similarly, in my Draw method I have:

Attackmsg.Draw(spriteBatch);

So, it goes away when it is supposed to, but it does not appear again when the p1atktimer condition becomes true again. I guess i have to surround the attackmsg.Draw(spriteBatch) command with conditionals instead of the show? But this brings me back to my previous question: Do I have to make bools for everytime I want to show this kind of text.

Let's continue with this example, I am going to make a bool atkmsgshowing = false. And make it true when someone's attackguage reaches 10. Because, if I do not do this, the msg works only once. So then, the attacker attacks, and I will make the bool true. When the attack ends, atkmsgshowing will go back to false. Doesn't this defeat the purpose of making a MessageSystem class?

sentences:
Should I move the world or move the player? I'm about to start developing a sidescrolling game where the player's goal is to travel as far as he can in the horizontal axis before touching down. Note that I do not need to ever travel back on the horizontal axis.

I'm developing this with the AndEngine for Android which uses OpenGL and Box2d.

Before starting, I need to decide on something important: should I use the world around the player to simulate movement or actually move the player and follow him with the camera features of the game engine?

Both approaches seems to have different strengths and fallbacks, so I don't know which one is considered best. For example, what would make it easier to add power ups along the way and have a nice animated background?

Thanks!

sentences:
only one tile being drawn xna c# I have been looking at tile engines for the past few days and decided to have a go at my own one for educational purposes. I want to use different textures for the tiles of my map, for example 1 = grass, 2 = sky, 3 = dirt etc.. I am having this problem where the tiles will draw using only one specific texture although I provide multiples. I have been following tutorials here and there and searching online to try and find this problem but to no avail.

In the example below in the LoadContent function I load three different textues into my TileMap object and Console.WriteLine states that there actually are 3 textures loaded into the list.

I was under the impression that the draw method in the TileMap would set the index to the tile ID corresponding to a tile texture and then that specific tile would be drawn on the map in game. for example, index 1 would equal the first texture in the list, index 2 would equal the second texture and so on.
Is this a correct assumption or am I way off?

Also, can you give me any help/pointers on ways to fix this issue of only one texture showing on the screen.

Thank you in advance.

Tile Map

 class TileMap
    {
        private MapCell[,] mapCell;
        public const int TILE_WIDTH = 64;
        public const int TILE_HEIGHT = 64;

    private List<Texture2D> tileList = new List<Texture2D>();

    public TileMap(int[,] exisitingMap)
    {
        //initialise this to a new multidimensional array;
        mapCell = new MapCell[exisitingMap.GetLength(0), exisitingMap.GetLength(1)];
        // x always starts on one
        for (int x = 0; x < mapCell.GetLength(1); x++)
        {
            for (int y = 0; y < mapCell.GetLength(0); y++)
            {
                mapCell[y, x] = new MapCell(exisitingMap[y, x]);
            }
        }
     }

    public void loadTextureFiles(ContentManager content, params string[] fileNames)
    {
        Texture2D tileTexture;
        foreach (string fileName in fileNames)
        {
            tileTexture = content.Load<Texture2D>(fileName);
            tileList.Add(tileTexture);
            Console.WriteLine(tileList.Count + " Tile texture count ");
        }
    }

    public void Draw(SpriteBatch spriteBatch)
    {

        for (int x = 0; x < mapCell.GetLength(1); x++)
        {
            for (int y = 0; y < mapCell.GetLength(0); y++)
            {
                // setting the index to the tile ID
                int index = mapCell[y,x].TileID;
                Texture2D texture = tileList[index];

                spriteBatch.Draw(texture, new Rectangle( x * TILE_WIDTH, y * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT), Color.White);

            }
        }
    }
}

Map Cell

class MapCell
{
    public int TileID { get; set; }

    public MapCell(int tileID)
    {
        tileID = TileID;
    }
}

Game1

TileMap tileMap = new TileMap(new int[,]
    {
        { 0,0,0,0,0,0,0 },
        { 1,1,1,1,1,1,1 },
        { 0,1,1,2,1,1,1 },
        { 0,2,1,3,1,3,0 },
        { 0,3,0,3,0,0,0 },
        { 0,0,0,2,0,0,0 },
        { 0,0,0,1,0,1,0 },
    });

 protected override void LoadContent()
    {
        new SpriteBatch(GraphicsDevice);
        tileMap.loadTextureFiles(Content, "Tiles/Tile1", "Tiles/sky", "Tiles/dirt" );
    }

protected override void Draw(GameTime gameTime)
    {
        spriteBatch.Begin();
        tileMap.Draw(spriteBatch);
        base.Draw(gameTime);

        spriteBatch.End();
    }

sentences:
Making XNA Play Nice With 3DS Max, Boundiing Spheres I'm using 3DS Max 2010 with the KW x-porter plugin, which outputs a .X file (just downloaded the very latest version).

Been getting some odd results:
http://www.picvalley.net/u/2930/2265240220441812321333990933PAStFeSONWQslOrMQC5q.PNG

Looks like the culling is screwed up.  Note, that models I make in Milkshape don't seem to be having these problems.

I've also tried to export an FBX file from 3DS Max 2010 and have been getting similar results.

What are your suggestions in terms of exporting *.3DS models to a workable XNA form?  What tools do you use?.

To be clear, the model in question has none of these defects when viewed from similar angles in 3DS Max 2010.

http://www.picvalley.net/u/2563/151728957814855401111333991302mSvEJ03Zv22GwHFgIhiV.PNG

Any ideas on this oddity would also be appreciated!

Edit 1 -- Add'l issue
Forgot to mention, that the model otherwise seems alright, but that rotation seems to double -- in other words, when I scroll my camera view left to right, the model (whose draw I give the camera for the view and perspective matrices w/ BasicEffect seems to rotate twice as much as models I draw natively in XNA

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:
Godot Animation only playing First Frame I have tried checking if it is already playing, stopping animations before and putting it in a separate function. Whenever I jump it should play 4 Frames of my animated sprite. But it only plays first.

const FLOOR = Vector2(0,-1)
const SPEED = 500
const GRAVITY = 20
const JUMP = -600

func _physics_process(delta):
    pos.y += GRAVITY
    if Input.is_action_pressed("ui_right"):
        pos.x = SPEED
        $Sprite.play("Run")
        $Sprite.flip_h = false
    elif Input.is_action_pressed("ui_left"):
        pos.x = -SPEED
        $Sprite.play("Run")
        $Sprite.flip_h = true
    else:
        pos.x = 0
        $Sprite.play("Idle")
    if is_on_floor():
        if Input.is_action_just_pressed("ui_up"):
            pos.y = JUMP
    else:
        if pos.y < 0:
            $Sprite.play("Jump")
        else:
            $Sprite.play("Fall")
    pos = move_and_slide(pos,FLOOR)
```

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:
Changing game object type: reinstantiating the object, or switching an object state I work on a strategy game, where the player occasionally has to transform ordinary citizens into the so called "leaders". Leaders are temporary units, which the player can control directly, in order to interact with the other citizens. After some time, the leader gets transformed back to a normal citizen.

My question is if I should stick to the classical OOP approach of keeping citizens and leaders in two separate classes, whereas the leader class extends the citizen class, and every time when I need a leader, I simply re-instantiate the current citizen instance.

I personally dislike this approach, however. I already have a state machine implemented, and am more likely to keep only the citizen class (or rather, human class). Rather, I'd like to keep the citizen/leader separation into two different states. When I need one or the other type, I simply switch the current state.

sentences:
How can I quantify a drawn line's straightness? I'm working on a game which requires players to draw a line from a point A(x1,y1) to the other point B(x2,y2) on the screen of an Android device.

I want to find how well that drawing fits to a straight line. For instance, a result of 90% would mean the drawing almost perfectly fits the line. If players draw a curved line from A to B, it should get a low score.

The end points are not known in advance. How can I do this?

sentences:
Subdivided Icosahedron Hex/Pent grid efficient rendering? How to performantly display a hex/pent grid on a subdivided icosahedron?

I have a subdivided icosahedron planet used as the "board" for a strategy game. It usually has anywhere between a few thousand and a hundred thousand tiles depending on the size the user inputs to the map generator.

Basically, I cannot brute force this and do a simple bounds and depth check, because of the sheer numbers of tiles.

I am storing the grid in a 2D array for simplicity. I understand that, on a 2D map, you simply do something like the following to draw a hex map:

for(int x = cameraX; x < viewportWidth; x++)
{
    for(int y = cameraY; y < viewportHeight; y++)
    {
        if(x % 2 == 0) //For the 2D array to work properly we have to offset every other row by +1 world coordinate (assuming each tile is 1*1 world coordinates)
           grid[x][y].render(x+tile_width, y);
        else
            grid[x][y].render(x, y);
    }
}

And that to draw a wrap-around world you would check the absolute distance from the camera's position.

Eg:

//This sets up the variable that tells the game what hex tiles to draw.
if(camera.x - viewportWidth < 0)
{
    camera_rX = camera.x - viewportWidth;
    cameraX = grid.length + camera_rX; //We will add this to the cameraX value because the result should be a negative value if the prerequisite if statement is met. The "cameraX" variable is used for viewing calculations, while the "camera.x" variable is used for camera positioning. Err... I think this makes sense.
}

sentences:
2D Unity: How to make a enemy jump from a navmesh platform to another? I'm currently working on a 2d platformer, however I came across an issue where the enemy moves within a certain range of the platform.

In this case I use a navmesh to limit the enemy's movement however I want the enemies to be able to jump within platforms.

I'm not sure how to achieve this effect, where the enemy moves in the platform a couple of times and the jumps into the next one until the player gets in range for it to attack the player.

How can I acheive this effect? Should i keep on using navmeshes or try another way around?

sentences:
LibGdx Table not firing touch events I can easily add listeners to the actors within a table, and they will fire events, but if I want an entire to table to have 1 listener and do not care to have differentiated effects depending on where it is touched, I want to be able to add the listener directly to the table. However, it is not firing, at all. I have turned on debug and tried pressing within the labels in the table or outside of them (still in the table, like on padding), but to no avail.

This is how I add the create the table:

il = new InfoListener();// extends ClickListener
info = new Table(skin);
info.setBackground("default-rect");
info.setVisible(false);
info.addListener(il);
info.setDebug(true);

// later on I have a method that adds things to the table
info.clear();
info.add(item.getDescription()).padRight(5);

info.setVisible(true);
info.setSize(info.getPrefWidth(), info.getPrefHeight());

It is a dynamic table (i.e. I change it's children when necessary), but that shouldn't make a difference. How do I have the table fire touch events?

sentences:
How UV channels work in Unity? So this Graph Shader is using UV0 channel:

As far as I know, UV layout in a 3d model file (e.g. fbx) is stored inside the model itself, is that right?

But the picture above implies that a model can contain multiple UV channels inside of itself. Is that true?

sentences: I am creating a Tetris clone on Khanacademy, will I get into trouble? For those don't know, Khanacademy is an education site that also has lessons on simple computer programming and allows you to publish your own games that are made on the website.

sentences:
Animating child objects via parent object animator in script I'm using unity 5

I'm trying to animate multiple child objects via a parent object. The animation worked in the animation view but would not work when I tried to preview the game. In the script I use the code:

ParentObject.GetComponent<Animator>().Play("intro");

to play the animation. A similar line of code worked when playing a singular object, not sure what's going wrong now, any sugestions?

sentences:
Game server position tracking How would you go about determining a players position server side based off player input?

The Setup:
Player sends packet to server containing the command and view angles. Server takes the direction and multiplies it by speed.

Say a player is going up a hill. How would the server make the players position reflect that the player is going up a hill.

The way i see doing is taking the ground height under the player and calculating if the height change in direction x is too high. However calculating that info for n players say 1000 would be very intense. So what is the proper way of determining a players position based on input with a client/server setup with the server being authorative. There is 10 updates per second.

sentences:
XNA GameServices vs. public static I am just starting learning XNA for developing Windows Phone games. I am stumbling accross different sample codes featuring different approaches on handling things.

A question for the experts... or at least for people who already have experiences with that topic:

Does it make more sense to inject instances of SpriteBatch via the constructor of game objects or adding the SpriteBatch object to the GameServices collection and retrieving it from the game objects' constructor like so:

spriteBatch = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;

sentences:
Unable to enable IK on someone else's rig I'm using someone else's character rig for reference but I'm not sure how I can enable IK solvers for the arms.  The hand controller has a NURBS control with an ikBlend attribute, but when I try to use the "Enable IK Solvers" tool, I get an error saying the attribute is locked or connected.

Clicking "Unlock Selected" on the attribute doesn't fix it.  Breaking the connections also breaks the ability for it to drive the enabled/disabled state of the IK handle.

The rigged character can be downloaded here if anyone wants to try to help me out: http://www.antcgi.com/2014/06/03/free-model-15-kila-lods-rig-dynamics/

sentences:
WebGL immediate mode I know that WebGL is based on OpenGL ES 2.0 and that glBegin and glEnd have been removed and replaced with vertex buffer objects. I understand that VBOs are faster and use less code but is there a library or add-on for JavaScript / WebGL that re-implements these functions?

After more research, I have discovered that this functionality is called immediate mode.

sentences: Best way to learn iphone game development? I know php and some python, but not much c. Where should I start to learn iphone game development? Is there some recommended books/tutorials for beginners? I'm looking at using cocos2d but I'm open to anything that isn't too limited.

sentences:
Creating and editing a .fnt file based on a PNG source I am currently making a game, (obviously), with the LIBGDX Java Library. I have already made a font, (It's a PNG file, not a TTF or RTF), that looks something like this:

(It's a mockup, by the way.)

I've tried programs like Shoebox to create my font automagically, but it doesn't recognize my font.

Can someone explain how I can just make my own .FNT config file?

Thanks in advance!

Plug

sentences:
Tiled Map Editor - Isometric View Problem I'm using the latest version of Tiled Map Editor (0.9.1) to create isometric maps. I have objects that are larger than my tile size (64 x 32), so I am breaking them up into two tiles of the correct size. Below I show that the blue blocks are made of a top and a bottom (both of which are 64 x 32).

You can also see that when I am placing these blocks side by side, there is some strange rendering overlap. Shouldn't the foreground be showing if it is rendered in the correct order?

In that picture you can see 4 blocks stacked side by side with the problem, 2 blocks side by side with the problem, 1 block by itself without the problem, and 1 dissected block in its two components.

Anyone know what's up?

Note: this is the view from within the Tiled Map Editor itself, not from within my game.

sentences: Gamemaker Key Press Duration I am looking for a way to track the duration of a key press in gamemaker. I was looking into alarm functions, but I figured there's a more elegant way. How can I track the duration of a keypress?

sentences:
Only StartCoroutine of Update on child prefab functions I have a script attached to a prefab.  That prefab attached to a child and I want it to rotate the root transform.

The Update of the script executes nothing but the Coroutine of a class I wrote.
Attached is the hierarchy of the outside and inside of playmode as well as the script on the prefab and the class.

From the Editor, Not on Playmode.

and in Plamode

uiTurnTileScropt.cs

//THIS SCRIPT IS CURRENTLY ON THE CCW PREFAB

using UnityEngine;
using System.Collections;

public class uiTurnTileScript : MonoBehaviour {
public float rotSpeed = 7.0f;
public float degree = 36.0f;
public float waitTime = .3f;
private bool rotate = false;
private Quaternion newRotation = Quaternion.identity;
BlockButton clickTapBlocked ;

void Start(){
    clickTapBlocked = gameObject.AddComponent<BlockButton>();
    clickTapBlocked.bttnName = "clickTap";
    clickTapBlocked.setFalse();
}
void Update () {
    Debug.Log (transform.name);
    if(Input.GetButtonDown (clickTapBlocked.bttnName) && (!clickTapBlocked.blocked)  ){
        Debug.Log("MouseDown");
        StartCoroutine(clickTapBlocked.forTime(waitTime));
        newRotation = Quaternion.AngleAxis (transform.root.rotation.eulerAngles.z - degree, Vector3.forward);
        rotate = true;
    }
    RotateSetAmount ();
}
void RotateSetAmount(){
    Debug.Log ("In Rotate function");
    if (rotate){
        this.transform.rotation = Quaternion.Lerp(transform.root.rotation, newRotation, Time.deltaTime * rotSpeed);
        if (transform.root.rotation.eulerAngles.z <  newRotation.eulerAngles.z){
            transform.root.rotation = newRotation;
            rotate = false;
        }
    }
}
}

and the referenced class BlockButton in uiTurnTileScript.cs

using UnityEngine;
using System.Collections;

/*  This class is more intuitive if you name thie instance created ("buttonValue" +     blocked)
 *  Example: for a button in the Input Project settings with a string of Fire1  I     would name the instance fire1Blocked
 *  Declare with your other variables

    BlockButton fire1Blocked

void Start(){
    //
    Fire1Blocked = gameObject.AddComponent<BlockButton>();
    Fire1Blocked.bttnName = "Fire1Blocked";
    Fire1Blocked.setFalse();
}
 */
public class BlockButton  : MonoBehaviour  {

public string bttnName;
public bool blocked = false;

public bool setFalse(){
    blocked = false;
    return blocked;
}

public bool setTrue(){
    blocked = true;
    return blocked;
}

public IEnumerator forTime(float duration){
    Debug.Log ("I was called");
    float dur = duration;
    blocked = true;
    yield return new WaitForSeconds(dur);
    blocked = false;
}
}

In my output,no matter what I click, I get nothing but the code from the BlockButton Instance.  No debug from the Update() happens but the coroutine happens.  I am not understanding how that happens and how to implement this properly.  Any help is appreciated.

sentences: What does the green arrow in Unitys MonoDevelop mean? What does the green arrow in Unitys MonoDevelop mean? It comes up while I am debugging my code:

sentences:
How to make a proper release build - Unity Android - x86, ARM32, ARM64 I'm trying to create a release on Google Play.

I currently have Build App Bundle checked in the build settings, and it helps decrease the build size.

In player settings I've IL2CPP set as the scripting backend, and  x86 + ARM32 + ARM64 checked as target architectures.

Once built it creates *-symbols.zip in addition to just
aab.

My questions are,

Do I need x86 + ARM32 + ARM64 all checked? (I want to comply with Google's new 64-bit requirement)
Can I build split aab's similar to 'split APKs by target architecture'? If so can I have the same version code for aab's which targets different architectures? Is there any advantage of doing so?

sentences:
How to calculate area to fill in this Snake/Qix game variant? I have a game which is a Snake/Qix variant.

The player controls a line which is moving on an island. Player has possibility to leave the island in order to connect that island to itself. Once the connection is made, the new area formed by the connection becomes part of the island (see picture: red line is the path the snake has made while outside the island, dark red pixels are the area/island).

I am trying to find a algorithm (even bruteforce) how to fill the new area (in other words how to do transition between first and second line on the picture).

What I have in mind is to run a path finding algorithm between the enter/exit points. If there is a path, it means the snake connect the island to itself. The path (in green) and red line together forms a closed polygon which can then be filled (how ?)

As it is now, the data is simply defined a 2D array of pixels (eg : 0 = empty, 1 = island, 2 = player snake)

sentences:
Unity adding objects through script to scrollview (SetParent): Objects overlap I need to add X objects to a scrollview. I do it like this:

GameObject statsObject = Instantiate(instance.statsObjectPrefab);
statsObject.transform.SetParent(statsParent.transform);

statsParent is the content container if the scrollview.

Scrollview
---- Viewport
-------- Content // This is statsParent

In the pause I see that then objects are added successfully, but they all overlap and no scrollbar is visible.

The content has a content size fitter and a vertical layout group, but I tried now all settings and the result is always the same.

I use Unity 2019.2

sentences:
Rendering Mode transparent is not applying in webgl build I am using this method to convert opaque rendering mode to transparent.
item.color = new Color(1, 1, 1, value);
item.SetFloat("_Mode",3);
item.SetOverrideTag("RenderType", "Transparent");
item.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
item.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
item.SetInt("_ZWrite", 0);
item.DisableKeyword("_ALPHATEST_ON");
item.DisableKeyword("_ALPHABLEND_ON");
item.EnableKeyword("_ALPHAPREMULTIPLY_ON");
item.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;

This is working fine but not working in my webgl build.

sentences:
Prefab with Sub-Elements Expansion Button Missing in Project Panel I have been following along with a course. In this course a GameObject called "Path (0)" is added, this GameObject then has three sub-GameObjects ("Waypoint (0/1/2)"). In the tutorial, the guy drags the parent GameObject "Path (0)" into a folder called Paths in the Project panel to create a prefab. This prefab is shown with a handle to expand it. He then expands this prefab to see the sub-elements which can be dragged into the Inspector, as shown below (expand button highlighted with red box)

When I perform these operations, the Project panel does not have an expand button on the "Path" prefab (see below)

Why does my prefab object in the Project panel not have these expansion buttons?

I can get around this, by using the prefab instance in the Hierarchy panel, but this is a much longer process than being able to access the object from the Project panel.

Any help would be greatly received.

sentences:
3D terrain generation: geological slices and noise function Everyone knows how to use Perlin noise to generate the surface of a 3D world. You may use one or several octaves to generate more detail.

It is also known how to use 3D Perlin noise to generate, to put it simply, a 3D world (including what's below the surface) with "holes" in it.

The advantage of Perlin noise is that you don't need to know the entire world to compute one specific point in the world. Since it's a function (or a sum of them), all you need to know is the input seed and the function, and it gives you the output wherever you want. Each point does not depend on its neighbour.

Now I'm wondering how to generate a world which terrain is a mix of different types of materials. You may call them geological layers, even though there's not necessarily slices.

I'm having a hard time picturing how Perlin noise (or any function suitable for this) would apply to this specific goal.

Generators commonly generate the world first and then add individual items (caves, deposits of precious rocks, etc.), but that's not what I want because it would lose the benefit of the function thing. Applying post-processing to the terrain makes it impossible to compute one specific point or range, with a pseudo-infinite level of detail, like a function does.

what's your take on this? (Stick to the mathematical idea, no need for implementation)

sentences:
How does Hierarchical Pathfinding deal with obstructions in the same chunk? Aigamedev.com provides this visualization of HPA*:

All the nodes within the same chunk connect to each other. What if there was an obstruction between nodes in the same chunk? For example:

What would the resulting visualization look like with an obstruction in the center bottom left chunk? How would this be detected?

sentences:
How to output to the Oculus and a 2D screen? We'd like to present an Oculus game to a large group of people. Not everyone will have an Oculus headset, so we'd like to output to both the Oculus and a second display. The problem is that the project uses an Oculus plugin to render its output, so all they output is two distorted circles, which doesn't display well when not wearing the Oculus headset.

I thought of making a second Unity client (the "audience" client, running on the same computer as the Oculus application) that receives the output texture of an "audience" camera from the client running the Oculus version.

My question is: Can I use the network to send the output of a camera to the "audience" client so I can set it up for the second display, bypassing the Oculus plugin? How would I get the input on the "audience" client to map it to the screen?

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:
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:
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:
game-state update structure and distribution in MMO? I'm developing an MMO, which has to maintain a global game-state.

Now I want to distribute the updates, which the players make to this state, to players which can see those updates (area of interest etc.)

Is there a common structure/format for these updates and for a global game-state?

Like, every action a player sends to the server has to include a type, the coordinates etc.

And are the updates, which gets distributed from the server to the players in the same format or are they different?

Also should I include timestamps or use the receive-time from the server to check which action came first and which sencond etc.?

And what should I send back to the player if he send an invalid action?

sentences:
How to use GdxAI with libgdx ashley ecs framework? I'm planning to use GdxAI Telegraph in GdxAshley ecs framework, my problem is how I'm gonna create a telegraph component if I wanted to dispatch a message? I have created AIComponent and AISystem.

class AIComponent implements Component{
    StateMachine<Entity, EntityState> fsm;
}

class AISystem extends IteratingSystem {

    public void processEntity(Entity entity, float deltaTime) {
         AIComponent ai = Mappers.ai.get(entity);

         ai.fsm.update();
    }

}

For example I wanted to dispatch a message using space input.

if(Gdx.input.isTouched()) {

     MessageManager.getInstance().dispatchMessage(
                0.0f, // no delay
                entitySender, entityReceiver,
                MessageType.SAYHELLO, null);

}

I'm thinking of creating a class that extends Entity and implement it to Telegraph. But the ashley ECS approach will be disregard here.

class EntityAI extends Entity implements Telegraph {

     StateManager fsm;

     public EntityAI (StateManager fsm) {
          this.fsm = fsm;
     }

     @Override
     public boolean handleMessage(Telegram telegram) {
         return fsm.handleMessage(telegram); // In this part, the logic exists. Im thinking of creating a System that will handle message? but how
     }

}

Question How do I properly convert the this EntityAI to entity-componentbased-system approach? In the below code is not tested but it was the idea entered my mind.

class Script implements Telegraph {

     StateManager fsm;

     public Script (StateManager fsm) {
          this.fsm = fsm;
     }

     @Override
     public boolean handleMessage(Telegram telegram) {
         return fsm.handleMessage(telegram);
     }
}

class ScriptComponent implements Component {
     Script script;
}

 ScriptComponent script
 AIComponent ai
 ai.fsm = new StateMachine();
 script.script = new Script(ai.fsm); // as you can see here the fsm is used twice in component

 // AIComponent has StateMachine
 // ScriptComponent need StatMachine
 // do you in the above code is a good idea?

MessageManager.getInstance().dispatchMessage(
                0.0f, // no delay
                scriptSendeer, scriptReceiver,
                MessageType.SAYHELLO, null);

sentences:
How can I recreate the camera used in Swordigo game? What sort of camera does the Android game (2.5D) Swordigo uses? Is it an orthogrpahic camera? I think it is an angled orthographic projection.

How can I recreate that sort of camera in Unity?

sentences:
Does collision detection data structures require a manifold mesh Is it possible to apply spatial split techniques (oct-trees bsp-trees, etc) when meshes are not necessary manifolds?

The mesh in question represents the "map". This means that it is static so spatial splits should be a good approach. Not requiring a manifold saves a lot of time when modeling, and also it may reduce the number of extra faces that has to be drawn, as forcing the mesh to be a manifold may require additional cuts.

sentences:
What is the physical interpretation of Input.GetAxis("Horizontal")? Actually I want to edit my previous question titled What is the geometrical interpretation of Input.GetAxis("Mouse X") and add a related question "What is the physical interpretation of Input.GetAxis("Horizontal")?" to it.

However, I was asked to create a new question about it.

The longer I press the key, the greater the value returned by Input.GetAxis("Horizontal"). If I don't press, it returns 0. The value seems to be a function of time interval the key is pressed. What is the empirical relationship between the relevant quantities?

sentences:
How can I export a model using the CAT bone system into XNA? Has anyone successfully used the CAT bone system in 3ds Max and exported the file into XNA? If so, what was your method of doing so?

There are a number of methods of doing this, apparently, but the ones I've tried have not worked.

I used the Panda Exporter which creates an .X file. This seems to be the latest way of going about this, but when it's loaded in XNA, there is an error saying something about the bone weights. This happens when I export with and without CAT bones.

sentences:
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:
SharpDX (DirectX) - possible to measure Frame time? I'm trying to benchmark various ways to draw 2D lines and have a snag. A D3D10Device that I draw with (and flush) doesn't appear to block, so I can't accurately measure frame rate (or time to render 1 frame).

Here's some code

    // Inside my custom render context - at end of setting up draw calls
    public void Dispose()
    {
        {
            _vertexBufferStream.Close();

            _direct3D10Image._d3d10Buffer.Unmap();

            // Vertex buffer contains LineList with 200k vertices
            _direct3D10Image._d3d10Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(_direct3D10Image._d3d10Buffer, 32, 0));

            int targetWidth = _direct3D10Image._renderTargetTexture2D.Description.Width;
            int targetHeight = _direct3D10Image._renderTargetTexture2D.Description.Height;
            _direct3D10Image._d3d10Device.OutputMerger.SetTargets(_direct3D10Image.DepthStencilView, _direct3D10Image.RenderTargetView);
            _direct3D10Image._d3d10Device.Rasterizer.SetViewports(new SharpDX.Direct3D10.Viewport(0, 0, targetWidth, targetHeight, 0.0f, 1.0f));
            _direct3D10Image._d3d10Device.ClearRenderTargetView(_direct3D10Image.RenderTargetView, _direct3D10Image.ClearColor);
            _direct3D10Image._d3d10Device.ClearDepthStencilView(_direct3D10Image.DepthStencilView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);

            // Shader is generating geometry based on line-list to render a 2D plot
            for (int i = 0; i < _direct3D10Image._technique.Description.PassCount; i++)
            {
                _direct3D10Image._pass.Apply();
                _direct3D10Image._d3d10Device.Draw(
                    (int)(_linesCount * 2),
                    0);
            }
        }

        // Flush doesn't appear to block - how to get meaningful time to draw out of SharpDX?
        _direct3D10Image._d3d10Device.Flush();
        _direct3D10Image._dx10ImageSource.InvalidateD3DImage();
    }

Now if I time the setup of draw calls and the Dispose method above, it reports 15ms to draw. However, there appears to be a significant lag between start of draw and the screen actually presenting.

How can I measure the time to present (or is it possible to make D3D10Device.Flush() blocking?)

sentences:
How can we test a section of a game? I'm making a clone of an old atari 2600 game, so it's simple, only slightly more complex than the original.

I'm realizing that even the simplest of games have different "parts", what is a good design method to be able to test those sections without having to "play through" to that part?

Specifically, (it's a "breakout" clone) if I'm modifying and testing code that runs when the game is beaten, I don't want to have to play through the whole game just to see if my code works. I can only imagine how complicated this kind of testing is for a game of substantial size.

How do real devs make their game such that they can test just a certain section, or test a section under certain possible in-game circumstances without having to play through to that part?

sentences:
Most efficient way to draw vertex with OpenGL I am writing an OpenGL 3D game.  There will be tons of triangles for terrain and objects in use.

I am studying from the OpenGL official guide and the first presented method is to call a function glVertex after the glBegin for each vertex you want to draw.

However this method sounds quite antique and inefficient when you have to draw thousands of triangles. I guess there are methods to store in the graphic card memory the information that does not change at every frame so that when you render each frame that information is already there. While for more "unstable" information probably you have to send new vertex data every frame and so a different tecnique might be more efficient.

Coming to my question: I would like a clear explanation of the most modern and efficient OpenGL functions and tecniques used to send vertex information to the hardware and to give instruction to render.

What are the best ways and OpenGL tools to send the order to render vertex data that seldom changes during the frames (i think of terrain and objects) and what it the best way to send vertex data that changes a lot during frames?

sentences:
glDrawArrays draws nothing I am trying to draw a triangle using shaders in LWJGL, but nothing is being drawn on the screen, and no error is being produces. I can't figure out what I'm doing wrong.
To create a vao, I use:
int buffer = glGenBuffers();
int vertexArray = glGenVertexArrays();

ByteBuffer data = ByteBuffer.allocateDirect(6 * 8).order(ByteOrder.nativeOrder());
data.putFloat(-0.5f);
data.putFloat(0.5f);

data.putFloat(-0.5f);
data.putFloat(-0.5f);

data.putFloat(0.5f);
data.putFloat(-0.5f);

glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, data, GL_STATIC_DRAW);

glBindVertexArray(vertexArray);
int positionAttributeLocation = glGetAttribLocation(program, "position");
glEnableVertexAttribArray(positionAttributeLocation);
glVertexAttribPointer(positionAttributeLocation, 2, GL_FLOAT, false, 8, 0);

and then I draw using:
glUseProgram(program);
glDrawArrays(GL_TRIANGLES, 0, 3);

Here's my vertex shader:
#version 110

in vec2 position;

void main(void) {
  gl_Position = vec4(position.xy, 1, 1.0);
}

and fragment shader:
#version 110

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

sentences:
What is the most efficient technique for range detection? I have a bunch of patrolling enemies that fire projectiles when the player is in projectile range - a specific radius. Which method is the most efficient and elegant?

overlapSphere
sphereCast
triggers
square magnitude
anything else?

I am using Unity.

sentences:
How does GL_INT_2_10_10_10_REV work for color data? Can anybody tell me how exactly to use GL_INT_2_10_10_10_REV as type parameter in glVertexAttribPointer()?

I am trying to pass color values using this type. What is the significance of "REV" suffix in this type? Does it require any special treatment in the shaders?

sentences:
Why use textures that are Power of Two? Possible Duplicate:
  Why are textures always square powers of two? What if they aren’t?

I am using C# and XNA (also MonoGame for other platforms than Windows) to create a game in 2D. Ususally for all textures I use the NVidia plugin for Photoshop to create DDS files with precomputed mip-maps (either full color, or DXT-5).

How important is it, nowadays, to stick to textures with extensions that are a power of two? What are the advantages and disadvantages of doing so?

The background of my question for that I use a number of quite large background images in with 1980 x 1080 pixels in size and storing them in textures of 2048 x 2048 pixels size seems like a tremendous waste of memory.

Let me stress that I am aware that having only power-of-two textures has been important in the past for certain specific optimizations BUT I would like to know whether this TODAY (GPUs of the last ~2 years, current consoles etc.) is still required?

sentences:
NDK opengl-es unknown error Projection matrix? Renderer? Where is the error?
I recently started studying NDK to create better performing android games ... but ... An error I didn't expect to deal with appeared a few weeks ago

The projection works perfectly on my device if I ignore some errors in the depth test
On my device:

On my device.gif because yes:

But...
You must ask yourself what is the impossible mistake of this noob, right?
Let's look at another device with similar specifications:

Only the cube has disappeared ... the text works and the only difference between them is the projection.

Is it possible for a matrix4 to work only on specific devices?

On some devices the cube appears after clicking on the screen even though it is not related to rendering "with many
depth glitch's"
Device 1

Device 2

My projection:
    auto fd =(float)( 1.0 / tan((fovy * (PI / 180.0))/2.0F));
    float a1 = (far+near)/(near-far);
    float a2 = (2* far * near)/(near-far);

    val[M00] = fd/aspectRatio;
    val[M01] = 0;
    val[M02] = 0;
    val[M03] = 0;

    val[M10] = 0;
    val[M11] = fd;
    val[M12] = 0;
    val[M13] = 0;

    val[M20] = 0;
    val[M21] = 0;
    val[M22] = a1;
    val[M23] = a2;

    val[M30] = 0;
    val[M31] = 0;
    val[M32] = -1;
    val[M33] = 0;

How I use it:
projection->setToProjection( 0.0f, 200.0f, 75.0f, 1.0f);

sentences: How to use rigitbody2d.AddTorque() in JavaScript? (unity2D) I just want to know how to use rigitbody2d.AddTorque() and an example script would be great :D. I am trying to rotate a cube forever using it as a test.

sentences:
Weird Error Building TMX Maps I'm getting an error while build a tmx map using MonoGame Extended (see picture). By the looks of it, the importer can't find the tileset, which is weird.

In my Map.tmx file the source for the tileset is ../Tilesets/Tileset.png. The tileset is placed in a Tilesets folder in the content pipeline, and the map lies in a Maps folder, so it should work, but it doesn't? I get the same error if I place the Tileset.png in the same folder as Map.tmx and change source to just Tileset.png.

Any ideas what's causing this and how to fix it?

sentences:
How should chat be transmitted and stored in an MMO? Players in MMO games can usually send messages over different channels (private, public, guilds, et cetera).

How would I transmit and store this data so as to prevent outside users from being able to access somebody's private chat messages? Should I store the data in a temporary game log, or a database?

sentences:
Problem with .hdr/.pic format So, everything was clear from the specification point of view, but when I moved to reading through some of the original implementations and reimplementations, I ran into this:

f = ldexp(1.0,rgbe[3]-(int)(128+8));

This piece calculates the signed exponent (<128 are, by specification, defined to be negative) and applies it to 2.0f. Why does he add 8 after the fact? And why doesn't he just write 136? That's biasing the encoded exponent information in favor of the smaller values, right? But why? All the values I load with this seem to be in a really cramped floating point space [I'm not even sure anything uses the space above 1.0f]. I understand the ratios remain consistent, but I kind of prefer to rely on original measured radiances.

http://www.graphics.cornell.edu/~bjw/rgbe.html — The code here states that is the standard way to decode "real pixels", which has no basis in the specification and no rationale offered.

sentences:
Java Game How to find the x and y for a tile? Hello I have a java game where you build houses I want to be able to dag my mouse form point a to point b and I want to fill that area with tiles when I release the mouse. What I cant do is get the first x and y coordinate of the selected area then put the tile there then move on to the next area I tried to do something like this:

    bx = Math.min((dragX / 20) * 20, (curX / 20) * 20);
    by = Math.min((dragY / 20) * 20, (curY / 20) * 20);
    w = Math.abs((curX / 20) * 20 - (dragX / 20) * 20);
    h = Math.abs((curY / 20) * 20 - (dragY / 20) * 20);

    if (dragging & w >= 20 && h >= 20) {
        g.setColor(new Color(26, 216, 26, 128));
        g.fillRect(bx, by, w, h);
        g.setColor(new Color(17, 142, 17, 255));
        g.drawRect(bx, by, w, h);

        int posx = play.bx * 20;
        int posy = play.by * 20;
        for (int i = 0; i <(play.w * play.h / 20) / 20 ; i++) {

            play.b.add(new wall((posx), (posy), play.selectedRot));
            posx +=20;
            posy+=20;
        }
    }

dragX and dragY is where it starts and curx and cury is where it is currently
the tiles are 20x20 pixels so I place them every 20 pixels on the screen so it is like a grid.
if I select an area that is 2 tile wide and 2 tiles high and each tile is 20 x 20 pixels that is 1600 pixels I divide that number by 20 and get 80 and then divide that by 20 again to find out how many tiles I need to place in total which in this case is four. what I don't know is how to find the x and y that I need to place that tile then I don't know how to move on to the next one. Please help me. Thx to everyone who reads this.

sentences:
Looking for a GUI library for OpenGL, or tips for my own (MetroUI) I am making an OpenGL graphics accelerated FPS, and I need to find a library to handle GUI correctly. My current GUI handler just wont do!

Yes, as in the title says, the UI of the game is Metro (ZuneHD, WP7, etc).

So the UI contains little to NO images, just fonts.

sentences:
Regarding Profile Pictures of Facebook Friends Background: I am creating a Leaderboard of Facebook friends in unity.
Question: Can we download and save the images of Facebook Friends on the device of the user for the purpose of reuse? I would like to store the images of the FBFriends on the user's device so that there is no need to download the same pictures everytime the game is restarted. Is it legal to do so?
I asked the same question in Facebook Developers forums but I did not get any response. Kindly guide me. How do devs build a leaderboard of Facebook friends normally?
Thankyou.

sentences:
Transition between two Views i want to animation the transition between game screens , in my game loop i have a function called getCurrentScreen() which returns a Screen object this Screen Class
has a function called present() this function draw on the framebuffer , when i want to change to another screen i call setCurrentScreen(Screen) , so it will draw the screen i set ,  What i want is to animation the transition between these screens  any suggestion , is the a book or an article that discusses this

sentences:
`Awake` with [ExecuteAlways] sometime is not called in edit-mode I'm trying to use the [ExecuteAlways]attribute to have a singleton both in edit- and -play modes. But the Awake() method sometimes is not called in the edit-mode. What could be the reason for this and how to fix it?

To make a short story long, I've got a not-so-new Unity project that I believe was developed before the age of ScriptableObjects, so they used MonoBehaviour to store game settings. And they used a kind of "Singleton" pattern that was not very stable and sometimes caused artefacts, such as creating an extra instance in edit mode which could often be saved with the scene accidentally and caused some other problems. The "Singleton" was written this way:

private static GlobalSettings instance = null;

public static GlobalSettings Instance
{
    get {
        if (instance == null)
        {
            instance = (GlobalSettings)FindObjectOfType(typeof(GlobalSettings));
            if (instance == null)
                instance = (new GameObject("GlobalSettings")).AddComponent<GlobalSettings>();
        }
        return instance;
    }
}

to fix it I've changed the code (and added the [ExecuteAlways] attribute):

[ExecuteAlways]
public class GlobalSettings : MonoBehaviour
{
    private static GlobalSettings _instance;
    public static GlobalSettings Instance => _instance;

    private void Awake()
    {
        if (_instance)
        {
            Destroy(this);
            throw new GameException($"The '{nameof(GlobalSettings)}' is a singleton!");
        }

        _instance = this;
    }
}

as I said Awake() is not called sometimes in edit-mode and the _instance remains null. Another problem is that even when Awake is called it happens after the first call of OnInspectorGUI() where the game settings are needed.

Any suggestions and considerations on how to make this code work stable are welcome!

sentences:
UDK/ UnrealScript class interaction? HUD advice? Beginner basics requested here, While i'm familiar with the basics of OOP programming i've just started looking as UnrealScript for a game i had made in the UDK editor up to now.

I have a class that extends UTHUD and another that extends UDKPAWN. I have the pawn destroyed when its been shot 3 times and some basic helloworld text displaying in my HUD but i'm completely lost as to how one would get some sort of feedback between the two classes going on?

What i would like to do to start off, is have some text that says something like "Amount of baddies killed: 0" Displayed on the HUD which would then increment each time the player destroyed one of my pawns.

I'm sorry if this is an inappropriate question but i've never really worked within a framework like this before and wasn't sure where to go for help to get my footing. All advice appreciated!

sentences:
How to reference a map position in code? I'm coding a digital version of the Macao board game which has a flat map similar to below. Players have a "ship" which starts in the blue box and can follow the dashed lines in any direction/orientation.  The larger rectangles represent city locations.

I'm stuck in the following issues.

How do I record the position of each ship?  I'm thinking co-ordinates like X,Y but that doesn't tell me the segment its on
How do I construct the route paths as objects?   Do I put them in an array?
Finally; in order to measure distance between 1 rectangle and another, it will need to count how many segments there are to ascertain the shortest distance.  I believe this can be resolved via a simple path algorithm.

I've not created a map like this before in a project but would welcome any help on how to move this forward.

sentences:
Are names of characters copyrighted? I am not developing a game or creating game characters. What I am trying to do is give a name to the software that I am creating in my spare time. It seems there is a game character by the same name (I am not a gamer but a google search to check the name revealed it). The software is intended to be free but might make money in the future, so I want to know this.

Are names of characters in games copyrighted and is it illegal to use them to name other unrelated software components and applications that might or might not  make money?

sentences: Color key or transparent images? Ive seen a lot of people make sprite sheets magenta instead of transparent and then they make the magenta transparent using code. What is best (Performance) to use transparent images or use a color (example : magenta) instead of transparency?

sentences:
Smooth terrain rendering I'm trying to render a smooth terrain with Direct3D. I've got a 50*50 grid with all y values = 0, and a set of 3D points that indicate the location on the grid and depth or height of the "valley" or "hill".
I need to make the y values of the grid vertices higher or lower depending on how close they are to each 3D point. Thus, in the end I should have a smooth terrain renderer.

I'm not sure at all what way I can do this. I've tried changing the height of the vertices based on the distance to each point just using this basic formula:

dist = sqrt(a² + b² + c²)

where a, b and c are the x, y, and z distance from a vertex to a 3D point.
The result I get with this is not smooth at all.

I'm thinking there is probably a better way.

Here is a screenshot of what I've got for the moment:
https://dl.dropbox.com/u/2562049/terrain.jpg

sentences: Unity: Is it possible to copy a rig from one model to another Lets say I have a model with a ready humanoid rig and a humanoid model with no rig. Can I somehow copy the bones from the rig to the model with no rig in unity?

sentences: How do 3d game engines draw this pattern? I am doing a small project, where there is a 3d engine, however I do not know how to draw something if it is like the image below. Usually I would draw from farthest back to closest. But here there is no order? How would modern 3d Engines draw this?

sentences:
How do I convert OnCollisionEnter2D to OnMouseDown? I created a simple animation.

I have a "Gamer" object, which I move and hit squares to destroy them.

Squares I have to destroy in the right order (1-2-3-4-5 etc.)

If I make a mistake, the animation comes to an end.

However, I would like to change this code now. I would like to change OnCollisionEnter2D() on OnMouseDown().

I would like to continue to delete the squares one by one, but instead of using a collision - simply click on the squares.

Could anyone help you convert this code?

This is my code posted to the "Gamer" object:

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

    public class Gamer : MonoBehaviour {

    int index =1;
    public GameObject gameOverText, restartButton ;

    public GameObject WinningText, ExitButton, NextLevelButton ;

    public GameObject Manager;

    void Start () {
        gameOverText.SetActive (false);
        restartButton.SetActive (false);
        Manager.SetActive (true);
        WinningText.SetActive (false);
        ExitButton.SetActive (false);
        NextLevelButton.SetActive (false);
    }
    public void OnCollisionEnter2D (Collision2D col)
    {
        Debug.Log("Player hit object: " + col.transform.name);
        //check if the object you hit is one of the "collisionObjects":
        if(col.transform.GetComponent<collisionObject>())
            GetComponent<AudioSource>().Play();
        {
            collisionObject colObj = col.transform.GetComponent<collisionObject>();
            if(!colObj) return;
            if(index == colObj.myIndexNumber) {
                if (colObj.isHighestNumber) {
                    Debug.Log ("Yay you correctly hit the last Square, You WIN!");
                    WinningText.SetActive (true);
                    NextLevelButton.SetActive (true);
                    ExitButton.SetActive (true);
                    gameObject.SetActive (false);
                    Manager.SetActive (false);
                }
                Destroy(col.gameObject);
                index++;

            }
            // here, we know it didn't match the number. :)
            else  {
                gameOverText.SetActive (true);
                restartButton.SetActive (true);
                gameObject.SetActive (false);
                Manager.SetActive (false);

            }
        }
    }
}

And this is my code placed in the "square" object:

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

        public class collisionObject : MonoBehaviour {
           public int myIndexNumber;
           public bool isHighestNumber;
           public void Start()
           {

        isHighestNumber = true;
        //find all other objects:
        foreach (collisionObject cObj in GameObject.FindObjectsOfType<collisionObject>()) {

            //check if any of the other objects has a larger number than mine, if yes, note to self that i am not the highest number.
            if (cObj.myIndexNumber > myIndexNumber) {
                isHighestNumber = false;
                break;
            }
        }
        Debug.Log("Object number " + myIndexNumber + " is here // is highest Number: " + isHighestNumber);
    }
}

sentences:
How to remap world space to screen space? I am noob to game development, and while using a simple graphics library in Python to make a 2D game, I noticed that the coordinate system of the library had its upper left corner as (0,0), whereas conventionally (at least in math) the lower left corner is set as (0,0).

I want to keep the world space in my physics calculations, but want to map the world space coordinates into the screen space. Furthermore, I want the world space sizes to be a scale of 10 larger than the screen space sizes.

In terms of programming methodology, how should I go about doing this in the most modular fashion?

sentences:
Combining skydome and fog I am developing a 3D game in DarkBASIC Professional, and I have a theoretical problem with the combination of skydomes and fog in general. My question is not specific to a programming language, so I am not refering to code.

What I want to achive

The player can see a night sky with stars
The sky should rotate slowly
Trees will block the light of the stars
Trees will be dark when far away and colorful when player is near (normal shader work).
A tree at the horizont should not "pop up" randomly when it enters the skydome. It should slowly fade, as the player comes near.

Techniques I use

Instead of a skybox, I have choosen a skydome with a night-sky-texture. This texture scrolls.
DarkBASIC has a "fog" feature. If enabled, I can choose a fog color and a fog distance. Things like trees will slowly fade and vanish into this fog color and will be completely faded when they reach the fog distance.
I am using black colored "fog" for the night scene, so that the trees far away will vanish in the dark night.
DarkBASIC's "fog" and "ambient light" features automatically shade the trees, so that far away trees are dark, and trees close to the camera, colorful.
The skydome will always enclosure the camera. It will automatically move when the camera moves.
(Note: Since the landscape is very big, I couldn't choose a giant skydome that covers the whole level, because the rendering of the texture on a giant skydome requires too much rendering time (at least for DarkBASIC's engine).)

I have tried several things now, and I am don't know what to do to fulfill all requirements.

Version 1

What I did:

I am using black fog with a fog distance of 1000.

Pro:

Trees are perfectly faded horizontally and vertically and no tree "pops up" at the horizont

Contra:

There is no skydome, so the sky is just 100% black, without any stars.

Version 2

What I did:

I am using a sky sphere with diameter 300
I am using black fog with fog distance 1000

Pro:

Since I am using the fog feature, trees will slowly fade to black when the camera diverges from them.
The sky can be seen completely (also at the horizont) because the sky sphere is smaller than the fog distance

Contra:

The trees are taller than 300, and therefore poke through the skydome! So I only see half trees...
(Note: I cannot increase the value "300", because otherwise the skydome will be shaded too much by the fog, which would result in a extremely low star light.)
Since the skydome is smaller than the fog distance, trees will "pop up" at the sky, once they come close (and pass the skydome)

Version 3

What I did:

I set black fog with a distance of 1000
The skydome is an ellipsis with height 300 and width 1200.

Pro:

The sky can be seen when the camera looks up (because the skydome does not exceed the fog distance)
Trees at the horizont are faded and do not "pop up"

Contra:

The trees are taller than 300, and therefore poke through the skydome! So I only see half trees...
(Note: I cannot increase the value "300", because otherwise the skydome will be shaded too much by the fog, which would result in a extremely low star light.)
The sky at the horizont is black and no stars can be seen. (But this is not a big deal in my opinion, since there will be always things at the horizont which block star light)

What I actually need

I think I need something like an "elliptic fog". A fog that will shade objects at the horizont stronger than objects above the player (sky). But such a thing does not exist in DarkBASIC.

So I am trying to find out a good solution using the standard techniques fog, ambient light and skydomes to achive my goal. Do you have a solution for me?

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:
Debug.DrawRay() does not draw rays in game view Here is the relevant code:

protected override void Update()
{
    base.Update();

    Debug.DrawRay(this.transform.position, this.transform.forward * 100f, Color.red, duration: 2f);
}

When running the game, I can see the ray being drawn in Scene View.

However, in Game View, no ray is displayed.

As you can see from the screenshot below, I have already enabled gizmos in Game View.

What should I do to ensure that rays are being drawn in Game View when debugging?

sentences:
Why don't games load assets while showing main menu? Most single player computer games have rather frustrating pattern of loading:

start game
Game shows you some logo videos
Game indicates it is loading (general assets are loading, that are always used)
Main menu shows
Select and load game
More loading
You can play now

Loading of general assets could be in theory done while already showing main menu, unless the main menu contains some elaborate graphics itself.

There must be some obstruction, since I am not aware of many modern games that show the menu immediately. What prevents creators to load assets asynchronously while player is selecting things in main menu?

Or other way to phrase the question: If I wanted to have my game show menuy while still loading assets, what problems do I need to solve?

sentences:
How can I make tiny sprites larger? I used a 16x16 sprite pack to make a 640x640 map in pygame:

The problem is that everything is extremely tiny. How could I go about making the expected "JRPG" look, like this for instance:

I have tried so far to double the size of the map tiles using pygame.transform.scale(tile,(32,32)) but that makes everything look terrible:

Here is how I am rendering the map:

import pygame
import pytmx
from pytmx.util_pygame import *

class tileRender:
    def __init__(self,filename):
        tm = pytmx.load_pygame(filename)
        self.width = tm.width * tm.tilewidth
        self.height = tm.height * tm.tileheight
        self.tmxdata = tm

    def render(self,surface):
        ti = self.tmxdata.get_tile_image_by_gid
        for layer in self.tmxdata.visible_layers:
            if isinstance(layer,pytmx.TiledTileLayer):
                for x,y,gid in layer:
                    tile = ti(gid)
                    tile = pygame.transform.scale(tile,(32,32))
                    if tile:
                        surface.blit(tile,(x * self.tmxdata.tilewidth, y * self.tmxdata.tileheight))

    def makemap(self):
        temp_surface = pygame.Surface((self.width,self.height))
        self.render(temp_surface)
        return temp_surface

Is there a way of "zooming in" on the sprites in order to get the expected look?

sentences:
Stat Multipliers: from Base Value or Iterative I'm aware similar questions have been asked before but this time I'm asking about a specific issue with the maths of stat modifiers.

I have a stat system that applies a list of modifiers to a stat, modifiers can either shift of scale a stat. Shifting is easy, you either add or remove a set value, scaling involves multiplying that value by a factor.

What I'm struggling to work out is the best way to multiply. The simple method is to let each scaling modifier simply stack, e.g. if we have 2 modifiers: x1.5 and x2 to a stat of 1 we get:

Stacked

(1 * 1.5) * 2 = 3

The alternative is to have each modifier apply to the base number and then be added, soas with the previous example we get a situation where we workout how much the base is multiplied by and then remove the base to get the new addition:

From Base

1 + ((1 * 1.5) - 1) + (1 * 2) - 1) = 2.5

In this way each modifier acts on the base value so that you can guaranty a 50% increase in a stat won't cause a ridiculous increase and that a modifier isn't affected by the order that it's applied in. Mainly it's this ordering I'm worried about, this becomes evident when you add shifting, e.g. we have 3 modifiers: +1, x1.5 and x2, with the first method:

Stacked

((1 + 1) * 1.5) * 2 = 6

Where as with the second method:

From Base

(1 + 1)  + ((1 * 1.5) - 1) + ((1 * 2) - 1) = 3.5

It doesn't take too much to see that in the stacked method if the shift/addition were applied after the multipliers it would not result in the same value.

How do other games approach this problem? What is the best decision to make here?

sentences: Unity editor, horizontal line in inspector How to draw a horizontal line in the inspector like on the reference image? Kind of separation line.

sentences:
Unity - Scaling down a GameObject containing a child Final IK (VRIK) rig I'm currently building a VR / AR hybrid in Unity, where I'm controlling an IK rig using VR, then sending the VR controllers positions to an iOS device using network transforms to mirror the IK rig's movement in ARKit. I'm having trouble implementing pinch to scale the scene locally on the iOS device.

I'm attempting to uniformly scale down a parent GameObject containing the IK rig which has its Head target connected to SteamVR Vive headset and its Hand targets set hand controllers positions. The vectors that describe the positions of the controllers are being sent over the network, so I'm applying the same scale factor to those, so that the targets match up to the scaled down character. However, the IK rig appears to break when scaling the character down, and in particular the legs appear to be too far apart, and the hand movements no longer look correct

Could the problem be to do with the internal relative transforms within the IK rig needing to be modified? And is there a better approach?

sentences:
How to jump in Box2D with LibGDX I am making a 2D platformer in LibGDX with both Ashley and Box2D.

I have it so, that the PlayerControllerSystem watches for the jump key being pressed:

// Jumping
if (Gdx.input.isKeyPressed(Keybindings.KEY_JUMP)) {
    entity.add(new JumpingComponent());
}

This works like a charm. Every time I press the jump key the PlayerJumpingSystem fires up:

/**
* System used for the player jumping mechanism
* @author Tim
*/
public class PlayerJumpingSystem extends IteratingSystem {

    @SuppressWarnings("unused")
    private final static String TAG = PlayerJumpingSystem.class.getName();

    // Variable declaration
    @SuppressWarnings("unchecked")
    private static final Family family = Family.all(
            PositionComponent.class,
            VelocityComponent.class,
            PhysicsComponent.class,
            PlayerComponent.class,
            JumpingComponent.class).get();

    public PlayerJumpingSystem () {
        super(family);
    }

    @Override
    protected void processEntity (Entity entity, float deltaTime) {
        PositionComponent position = Mappers.position.get(entity);
        VelocityComponent velocity = Mappers.velocity.get(entity);
        PhysicsComponent physics = Mappers.physics.get(entity);

        if (velocity.y > 0) {
            // We are ascending
            physics.body.applyLinearImpulse(0, -Constants.JUMP_FORCE, position.x, position.y, true);
        }

        if (velocity.y < 0) {
            // We are descending
            physics.body.applyLinearImpulse(0, Constants.JUMP_FORCE, position.x, position.y, true);
        }

        else if (velocity.y == 0) {
            entity.remove(JumpingComponent.class);
            Gdx.app.log(TAG, "JumpingComponent removed");
        }
    }

}

It gives very weird jumping behaviour. Does anyone know how to implement jumping with Box2D in a good way? Thanks in advance!

sentences:
Refractive blur in XNA? I'm writing a 2D hack-and-slash game using XNA. I really want to implement the blur-like, refractive effect of a sword or such moving really quickly, seen in such games as Dust: An Elysian Tail and Vampire Dishwasher. Anyone know the technical name for this effect? For those who aren't sure what I'm talking about:

shows exactly the effect I'm trying to achieve.

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:
P2P network hiding positions? I have been working on a P2P architecture for secure gaming and I have divided the problem into five sub-problems:

Unlawful modification of sent game state
Accurately drop cheaters
Agreeing on a game state
Avoiding "look ahead" cheat
Hiding sensitive information from opponents

The first four I have pretty much all solved but it is the last one which I am having trouble with.

Before I go into details I just want to ask if there's anything I've missed in my list of making a "cheat proof" p2p network. I am not interested in cheats such as using aimbots, I am only interested in making the p2p network as secure as a centralized server.

So in my effort so far on hiding sensitive information I've focused on the position of players in a game where the position of your opponent should not always be known. The problem then becomes how to determine if you should send you position to your opponent without knowing the position of your opponent.

I have ruled out methods such as the opponent sending multiple false positions for you to compare yours too since your opponent can easily abuse such a system since he will get your position if one of the false positions happened to be "visible" from your position.

The method I have been focusing on one in which you receive a "visual field" from your opponent and can thereby determine if you should send your position or not. This is however a problem in games such as League of Legends where the visual field of your opponent is also highly sensitive information. I have tried to solve this by transforming the visual field using a singular matrix meaning you cannot go from the transformed version of the visual field back to the original version, but since it is a linear transformation you can still figure out if your position is inside the visual field or not.

This does not however work perfectly, the exact visual field cannot be restored after transformation, but information about the "slopes" in the visual field (the visual field is constructed by several lines, and the slope of each line can be determined) can be restored and this can be used to relatively inexpensively  reconstruct the original visual field.

In essence, what I need is a function which can determine if a position is "visible" or not, and reconstructing this function/visual field has to be so computationally demanding that once you are done reconstructing the visual field it is no longer relevant for the game in action. Is there any super smart person out there who happens to know of such a method?

Edit
People seam kind of confused about the whole "vision field" so I aim to give a more detailed explanation here. The vision field consists groups of a set of lines, you can easily check if a position is inside one of these groups by just checking which side of the line your position is, if it's on the same side for all lines in that group you know it's inside that group and thus inside the vision field.

The information being sent however is not this line, but a transformation of the line and the transformation (2 by 2 singular a matrix), you can still check which side of the line your position is on by first transforming it using the transformation you received and comparing that value to the transformed line. The key here is that the transformation is singular, meaning it is impossible to find an inverse to go back to the original line. However it is possible to determine the slope of the line which makes reconstructing the line by just checking on which side of the transformed line a lot of points lie until you have pinpointed the origin of the line a lot computationally cheaper than if you did not know the slope of the line.

What I am looking for is a method for determining if a point is inside of an area, where reconstructing the area from the method is either impossible (which I doubt exists since you can always brute force it) or very computationally heavy.

sentences:
How do I implement a Bullet Physics CollisionObject that represents my cube like terrain? I've successfully integrated the Bullet Physics library into my entity/component system. Entities can collide with each other. Now I need to enable them to collide with the terrain, which is finite and cube-like (think InfiniMiner or it's clone Minecraft). I only started using the Bullet Physics library yesterday, so perhaps I'm missing something obvious.

So far I've extended the RigidBody class to override the checkCollisionWith(CollisionObject co) function. At the moment it's just a simple check of the origin, not using the other shape. I'll iterate on that later. For now it looks like this:

@Override
public boolean checkCollideWith(CollisionObject co) {
    Transform t = new Transform();
    co.getWorldTransform(t);
    if(COLONY.SolidAtPoint(t.origin.x, t.origin.y,t.origin.z)){
        return true;
    }
    return false;
}

This works great, as far as detecting when collisions happen. However, this doesn't handle the collision response. It seems that the default collision response is to move the colliding objects outside of each others shapes, possibly their AABBs.

At the moment the shape of the terrain is just a box the size of the world. This means the entities that collide with the terrain just shoot away to outside that world size box. So it's clear that I either need to modify the collision response or I need to create a shape that conforms directly to the shape of the terrain. So which option is best and how do I go about implementing it? Perhaps there's an option I'm not thinking of?

It should be noted that the terrain is dynamic and frequently modified by the player.

sentences:
How can i keep the spawned cubes to be inside the given area? In this case the 4 walls and objects I spawn inside the 'wall area' are all cubes. This situation could change to where the walls will be spheres and the other objects can be cylinders or cubes (its not limited to cubes only).

What I'm trying to do is to spawn the objects in random positions but within the 'wall area'. The problem is when some cubes (objects) are spawning too close to the walls, part of the cubes will inside the area and some will be outside.

In the screenshot example on the right, a cube is going out of the wall area.
In this case the walls area is sized according to the terrain (500x500) but it could be any size like 45x23 or 100x100.

In the script below I'm getting the 4 walls objects in array.

walls = GameObject.FindGameObjectsWithTag("Wall");

Now I wonder how can I use a ray cast to detect if each cube is spawning too close to one of the walls and if so then re-position the cube randomly, over and over again until it's inside the walls area. I'm not sure if using ray cast is the best way but that's what I had in mind.

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

public class SpawnObjects : MonoBehaviour
{
    public int numberOfObjects;
    public GameObject objectToPlace;
    public Vector3 newObjectsSize;
    public float spawnSpeed = 0.1f;

    private int wallsLengthX;
    private int wallsLengthZ;
    private int wallsPosX;
    private int wallsPosZ;
    private int currentObjects;
    private GameObject[] walls;
    private List<GameObject> objects = new List<GameObject>();
    private GameObject spawnedObjects;

    void Start()
    {
        var wi = GetComponent<Walls>();
        wallsLengthX = (int)wi.lengthX;
        wallsLengthZ = (int)wi.lengthZ;
        wallsPosX = (int)wi.wallsStartPosition.x;
        wallsPosZ = (int)wi.wallsStartPosition.z;

        walls = GameObject.FindGameObjectsWithTag("Wall");
        spawnedObjects = GameObject.Find("Spawned Objects");

        StartCoroutine(Spawn());
    }

    IEnumerator Spawn()
    {
        for (int i = 0; i < numberOfObjects; i++)
        {
            GameObject newObject = (GameObject)Instantiate(objectToPlace);
            newObject.transform.localScale = GenerateRandomScale(newObject);
            newObject.transform.localPosition = new Vector3(GenerateRandomPositions(newObject).x , GenerateRandomPositions(newObject).y + newObject.transform.localScale.y / 2.0f, GenerateRandomPositions(newObject).z);
            newObject.name = "Spawned Object";
            newObject.tag = "Spawned Object";
            newObject.transform.parent = spawnedObjects.transform;

            objects.Add(newObject);
            yield return new WaitForSeconds(spawnSpeed);
            currentObjects += 1;
        }

        var wp = GetComponent<WayPoints>();
        wp.FindMyObjects();
    }

    private Vector3 GenerateRandomScale(GameObject newObject)
    {
        Vector3 newScale = new Vector3(UnityEngine.Random.Range(5, 100), UnityEngine.Random.Range(5, 100), UnityEngine.Random.Range(5, 10));

        return newScale;
    }

    private Vector3 GenerateRandomPositions(GameObject newObject)
    {
        float paddingX = Mathf.Clamp(newObject.transform.localScale.x, 0, wallsLengthX) / 2f;
        float paddingZ = Mathf.Clamp(newObject.transform.localScale.z, 0, wallsLengthZ) / 2f;
        float originX = wallsPosX + paddingX - wallsLengthX / 2f;
        float originZ = wallsPosZ + paddingZ - wallsLengthZ / 2f;
        float posx = UnityEngine.Random.Range(originX, originX + wallsLengthX - paddingX);
        float posz = UnityEngine.Random.Range(originZ, originZ + wallsLengthZ - paddingZ);
        float posy = Terrain.activeTerrain.SampleHeight(new Vector3(posx, 0, posz));

        return new Vector3(posx, posy, posz);
    }
}

sentences:
OpenGL: glGetError() returns invalid enum after call to glewInit() I use GLEW and freeglut. For some reason, after a call to glewInit(), glGetError() returns error code 1280. Reinstalling the drivers didn't help. I tried to disable glewExperimental, it had no effect. Code worked before, but I am not aware of any changes I could possibly make.

Here's my code:

int main(int argc, char* argv[])
{
    GLenum GlewInitResult, res;

    InitWindow(argc, argv);

    res = glGetError(); // res = 0

    glewExperimental = GL_TRUE;
    GlewInitResult = glewInit();

    res = glGetError(); // res = 1280

    glutMainLoop();

    exit(EXIT_SUCCESS);
}

void InitWindow(int argc, char* argv[])
{
    glutInit(&argc, argv);

    glutInitContextVersion(4, 0);
    glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
    glutInitContextProfile(GLUT_CORE_PROFILE);

    glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,
    GLUT_ACTION_GLUTMAINLOOP_RETURNS);

    glutInitWindowPosition(0, 0);
    glutInitWindowSize(CurrentWidth, CurrentHeight);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);

    WindowHandle = glutCreateWindow(WINDOW_TITLE);

    GLenum errorCheckValue = glGetError();

    if (WindowHandle < 1)
    {
        fprintf(stderr, "ERROR: Could not create new rendering window.\n");
        exit(EXIT_FAILURE);
    }

    glutReshapeFunc(ResizeFunction);
    glutDisplayFunc(RenderFunction);
    glutIdleFunc(IdleFunction);
    glutTimerFunc(0, TimerFunction, 0);
    glutCloseFunc(Cleanup);
    glutKeyboardFunc(KeyboardFunction);
}

Could someone tell me what I am doing wrong? Thanks.

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:
How can I clean this if Statement up? I am busy working on a full solo project with no assistance from tutorials or guides. But I have created a monstrosity of an If statement. How could I clean this up and save on memory since I'm calling this in my Update() method and the game is for android?

the hp1 to hp5 are images used as health bars on the hud, I need to deactivate the ones that are not in use when the hp value decreases.

if(hp >= 81)
    {
        hp1.enabled = true;
        hp2.enabled = true;
        hp3.enabled = true;
        hp4.enabled = true;
        hp5.enabled = true;
    }
    else if(hp >= 61)
    {
        hp1.enabled = true;
        hp2.enabled = true;
        hp3.enabled = true;
        hp4.enabled = true;
        hp5.enabled = false;
    }
    else if(hp >= 41)
    {
        hp1.enabled = true;
        hp2.enabled = true;
        hp3.enabled = true;
        hp4.enabled = false;
        hp5.enabled = false;
    }
    else if (hp >= 21)
    {
        hp1.enabled = true;
        hp2.enabled = true;
        hp3.enabled = false;
        hp4.enabled = false;
        hp5.enabled = false;
    }
    else if (hp >= 1)
    {
        hp1.enabled = true;
        hp2.enabled = false;
        hp3.enabled = false;
        hp4.enabled = false;
        hp5.enabled = false;
    }
    else if(hp < 1)
    {
        hp1.enabled = false;
        hp2.enabled = false;
        hp3.enabled = false;
        hp4.enabled = false;
        hp5.enabled = false;
    }

sentences:
How to know if a model is composed of a group of models? I've downloaded a model, and try to ungroup the model and learn how this model was made. However, the big model in the image below can not be ungrouped anymore.

I feel that this model is composed of a group of models, but I cannot ungroup this model and unlink it. Is there other methods to test if this model is a model or a group of models?

Thanks in advance.

  Full Size: http://i.stack.imgur.com/VF2SM.png

sentences:
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 to change texture from pvr.ccz in Cocos2d? I'm using .pvr.ccz file that texturePacker application created for me , I created a Sprite that it's image choosed from this file(.pvr.ccz) like below:

  CCSprite *mySprite = CCSprite::createWithSpriteFrameName("first.png");

But how can I change it's texture using .pvr.ccz file?

I knew below solution for changing texture of a sprite, but it works when second.png file is normal PNG file and is not compressed in a.pvr.ccz file.

mySprite->setTexture(CCTextureCache::sharedTextureCache()->addImage("second.png"));

sentences:
2D game with 3D models and terrains I am approaching OpenGL and general gaming-development. I want to start by coding a simple 2D game in Java (lwjgl) but, since I can create models with Blender, I don't want to use 2D sprites, but a semi-flat environment. My target is to remake a classic game but with some cool stuff like particle emitters, bump mapping, lighting and so on... The basic idea is to make something that looks like Super Mario Bros Wii (or Kirby's Adventures Wii, or Super Smash Bros. etc...).

Do you think I have to use JavaMonkeyEngine?
Some hints,code snippets, tutorials, links?
Do I have to handle a "z-fixed" camera or set-up OpenGL to render in 2D mode?
What about the HUD?
Sorry if my question is too generic, but I would like to have a clear idea of what I have to do before starting writing code. As always, thanks for your help!

sentences:
How can I tell if an object in a tile grid is surrounded? I'm making a game which uses a 10x20 matrix to store the position of the objects.

I have a castle object, represented by a number in a matrix. It is randomly deployed in some cell of the matrix. I also have a wall object, represented by a different number, which the user will deploy into the matrix by clicking on cells. The idea is to surround the castle.

Basically it'll look like this:

0 0 0 0 0 0 0
0 1 1 1 1 1 0
0 1 0 0 2 1 0
0 1 1 0 0 1 0
0 0 1 0 0 1 0
0 1 1 1 1 1 0
0 0 0 0 0 0 0

(2 is the castle, and 1 is the wall.)

How can I tell if the castle is surrounded by walls?

sentences:
Why is my cursor not working if I add a scaling matrix? After moving the camera to any direction, my cursor isn't getting drawn on the correct position. For example: I move my camera to the right, after that I click on the screen, but the cursor isn't getting drawn on the place I clicked. It's drawn somewhere else on the screen.
Why is the cursor not getting drawn on the place I clicked?

I need to scale the screen because I want to support different resolutions in a MonoGame project(see my other question): How can I use a camera matrix with different resolutions?

I scale like this:

UPDATE:
I added the code that I'm using to get the cursor position, and the code that I'm using to draw the cursor. In addition, I use now Matrix.Invert(scaleMatrix * camera.GetMatrix())), but it doesn't work. The cursor is still drawn on the wrong position.

//In my Player class, I get the position of the click(Tap)
//The Playerposition is the center of the camera

public void Update(GameTime gameTime)
{
  while (TouchPanel.IsGestureAvailable)
  {
    GestureSample gs = TouchPanel.ReadGesture();
    switch (gs.GestureType)
    {
        case GestureType.HorizontalDrag:
          Playerposition += new Vector2(gs.Delta.X / game1.scaleX, gs.Delta.Y / game1.scaleY);
        break;
        case GestureType.VerticalDrag:
          Playerposition += new Vector2(gs.Delta.X / game1.scaleX, gs.Delta.Y / game1.scaleY);
        break;
        case GestureType.Tap:
          game1.CursorPosition = new Rectangle((int)(gs.Position.X / game1.scaleX), (int)(gs.Position.Y / game1.scaleY), 10, 10);
          game1.Clicked = true;
        break;
    }
  }
}

  //In Game1:
  public const int VirtualScreenWidth = 800;
  public const int VirtualScreenHeight = 480;
  public float scaleX, scaleY;
  private Vector3 _screenScale;

  protected override void LoadContent()
  {
    scaleX = (float)GraphicsDevice.Viewport.Width / (float)VirtualScreenWidth;
    scaleY = (float)GraphicsDevice.Viewport.Height / (float)VirtualScreenHeight;
    _screenScale = new Vector3(scaleX, scaleY, 1.0f);
  }

  protected override void Update(GameTime gameTime)
  {
   player.Update(gameTime);
   //Updating the camera position:
   Newcameraposition = new Vector2(player.Playerposition.X - (float)VirtualScreenWidth / 2, player.Playerposition.Y - (float)VirtualScreenHeight / 2);

   camera.Update(gameTime, Newcameraposition);

   InvertCursorPos = Vector2.Transform(new Vector2(CursorPosition.X, CursorPosition.Y), Matrix.Invert(scaleMatrix * camera.GetMatrix()));

   //Calculate the cursor position
   if (Clicked == true)
   {
     CursorPosition = new Rectangle((int)(InvertCursorPos.X + Newcameraposition.X), (int)(InvertCursorPos.Y + Newcameraposition.Y), 10, 10);
     Clicked = false;
   }

   base.Update(gameTime);
  }

  // Drawing
  protected override void Draw(GameTime gameTime)
  {
  GraphicsDevice.Clear(Color.CornflowerBlue);
  var scaleMatrix = Matrix.CreateScale(_screenScale);
  spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.None, RasterizerState.CullNone, null, scaleMatrix * camera.GetMatrix());
    //Drawing the cursor
    spriteBatch.Draw(CursorSprite, CursorPosition, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 1);
  spriteBatch.End();

sentences:
Make gameObject “stick” to another gameObject after it has collided with it? Currently, I am using the following code to make objects stick to other gameObjects.

rb = GetComponent<Rigidbody>();
rb.isKinematic = true;
gameObject.transform.SetParent (col.gameObject.transform);

It works perfectly, but it causes many other problems... For example, after colliding, it can no longer detect collisions... Is there an alternative to this code (which makes a gameObject stick to another one after collision)?

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: Why shouldn't templates be used on video game consoles? I have overhead, several times, that templates should not be used on video game consoles; however, I never heard why, or understood why. Why shouldn't templates be used on video game consoles, and if they are to be used, what are some ways to avoid the negativity?

sentences:
Problem with diagonal collision response using PyGame So I have been having this problem for the last few days and it has me really frustrated. What I am trying to do is resolve collisions with custom hitboxes in PyGame and it looks something like this:

Everything works fine until I collide with something diagonaly, then I get a weird bug where the character suddenly teleports to the opposite axis side of what I am colliding with, like this:

https://gyazo.com/62c53cc4f3a944c317a951c0f8ae14ea

I have read a lot about this the last day and from what I have gathered this has to do with the fact that I don't resolve the x and y axis independently? maybe?

If I have a print("x") and print("y") statement in their respective code I get this when colliding with something on the "y" axis:

The bug seems to come from that somewhat random "x" in the middle there. The code resolves a collision as if the character was colliding with something on the "x" axis when in fact it was the "y" axis. It is worth nothing that this ONLY happens when diagonaly colliding with the last axis I check (y in this case). So I suppose that is my question really, why does this happen?

Here is my collision handling code:

def collide(self, direction):

    hits = pg.sprite.spritecollide(self, all_sprites_wall, False, rectconverter)
    if direction == "x":
        if hits:
            print("x")
            if self.vx > 0:
                hits[0].update()
                self.x = hits[0].hitboxrect.left - self.rect.width - camera.camera.x
                self.hitboxrect.right = hits[0].hitboxrect.left
            if self.vx < 0:
                self.x = hits[0].hitboxrect.right - self.rect.width + self.hitboxrect.width - camera.camera.x
                self.hitboxrect.left = hits[0].hitboxrect.right
            self.rect.x = self.x

    if direction == "y":
        if hits:
            print("y")
            if self.vy > 0:
                self.y = hits[0].hitboxrect.top - self.rect.height - camera.camera.y
                self.hitboxrect.bottom = hits[0].hitboxrect.top
            if self.vy < 0:
                self.y = hits[0].hitboxrect.bottom - self.rect.height + self.hitboxrect.height - camera.camera.y
                self.hitboxrect.top = hits[0].hitboxrect.bottom
            self.rect.y = self.y

And here is the players update function:

def update(self):
    self.move()

    self.hitboxrect.y = self.y + camera.camera.y + self.rect.height - self.hitboxrect.height
    self.rect.y = self.y
    self.collide("y")
    self.hitboxrect.x = self.x + camera.camera.x
    self.rect.x = self.x
    self.collide("x")

I think the problem lies somewhere in this code, but if you think otherwise feel free to say so and I would happily add more code!

sentences:
Flatten transform hierarchy at build time Nested hierarchies cause a performance overhead when they include moving objects.

  Every time a GameObject moves, altering its transform, we need to let every game system that might care about this know. Rendering, physics, and every parent and child of the GameObject needs to be informed of this movement in order to match. As the scope of a game increases, and the number of game objects skyrockets, just the overhead of sending out all these messages can become a performance problem.

However, nested hierarchies are useful in organising a scene and keeping logical groups of gameobjects separate.

What options exist to save performance whilst keeping the hierarchy?  Is there any pre-existing solution to flatten a hierarchy when building only?

sentences: Changing rendering in UE4 Is it possible to have Ue4 render the graphics with a black line around everything similar to a cell shaded style, or would that require models specifically prepared for that purpose?

sentences:
What forms of non-interactive RPG battle systems exist? I am interested in systems that allow players to develop a battle plan or setup strategy for the party or characters prior to entering battle. During the battle the player either cannot input commands or can choose not to.

Rule Based
In this system the player can setup a list of rules in the form of [Condition -> Action] that are then ordered by priority.

Gambits in Final Fantasy XII
Tactics in Dragon Age Origin & II

sentences:
"ui is not declared in current scope" error I just started development for a game I have to design for school. When using gd in the script to make the character move right I get an error:

extends KinematicBody2D

var motion = Vector2()

func _physics_process(delta):

    if input.is_action_pressed(ui.right):
        motion.x = 100

    move_and_slide(motion)

This is the line that is giving me problems

if input.is_action_pressed(ui.right):

and it keeps saying that ui is not declared in the current scope

sentences:
How can I make the "Strength" attribute more attractive to Wizard/Caster classes in a RPG game? I have a game where, among many attributes, is Strength and Constitution.
In Ultima Online, Strength was used for hit points. However, I would like to avoid this- as Hit Points are so incredibly important, every class will want to have a lot of them in any game you play. In almost all MMORPG's and in many RPG's, players stack constitution almost as much as their primary attribute.

I have a plethora of ways in which INTELLIGENCE helps a WARRIOR type. It is the problem of the attribute STRENGTH helping a WIZARD type that is giving me so much difficulty.

Strength can more easily be an important statistic for Warrior and Rogue types, as they are both melee damage- and players tend to love stacking high damage. However, Strength is all but useless to a Wizard who casts spells from afar, and relies on Intelligence as their damage attribute.

What can I do to strength, to make it more appealing to wizard types, or any class that does not perform any melee combat?

Correct me if I am wrong, but I do not feel as though Spells/Magic should be more powerful because someone has more physical muscles and capacity to lift more. It makes sense to give Magic more power if the caster had a lot of fortitude or a overall healthy body, but that is already defined as Constitution.

I want to make Strength as attractive as Intelligence, to Wizard types than in stereotypical RPG's.

I was able to find balance between a "Dumb Brute Warrior" vs "Intelligent Warrior".
How can I find a balance between a "Buff Conan Wizard" vs "Intelligent but Frail Wizard" without introducing melee combat?

Adding unique gameplay features or altering the traditional RPG style of play is more than welcome.

sentences:
How to make a 3d beam effect with XNA 4.0? Do you know any demo or tutorial to learn to make a 3D Beam effect?

I have learn to make a 2D laser by simply using a texture and moving it thru screen.
But I am a little bit lost while trying to do it in 3D.

After googling I've found several examples, but they are old, not working or made for an older version of XNA.

As a visual hint, what I want to achieve is some 3d beam effect similar to this photo:

sentences:
Authentication for LAN Multiplayer Games I'm working on the authentication scheme for a multiplayer game using only C++ and SLD2.

It's an RPG with a kind of complicated character-group/permadeath scheme, and world-instances are intended to be hosted by the players. So it matters that players have exclusive access to controlling their characters. I want players to be allowed to save the current state of a multiplayer world instance, close it, and come back to it later, or set up their own dedicated world instance for them and their friends to join/quit/rejoin at will. Absent player characters will simply not be present in the world until their creator returns

Servers will be hosted by player-computers. I'm not planning to set this up with a dedicated hole-punching or identity server, so players will just be playing with people who they intentionally connect to. I don't want to deal with encryption, so I'm not planning to require passwords to log in. I figure since there's no formal identity server and no encryption, passwords might do more harm than good. Player character names will change over the course of the game, and I don't necessarily mind if two players have the same username.

Here's my current authentication strategy:

When a player creates an account on his/her game instance, the account will just consist of a username and an automatically generated (random) UUID. The username and UUID will be stored in a SQLite file that the user can copy onto any computer with this game installed, and access their unique account. The username and a naively hashed UUID will be stored in a connection log on every server that the player connects to (so the server can assign them to the right character when they log back in). I recognize this means that programmers who know what they're doing will be able to hack each other's accounts, but I'm not convinced that I should really be concerned about that in the case of this particular game.

Here are my questions:

Is copying the file too much to expect from users who want to switch computers?
Can you guys think of any potential issues with this, other than what I've already pointed out?
Is there a better (common) way to achieve what I'm trying to do?

Thanks!

sentences:
How do I set a single pixel of an image in Slick2D? I would like to set an individual pixel in Slick (i.e Image.setPixel(x, y, r, b, g)) but I can't figure out how.

There is an Image.setPixel function but it doesn't take x and y coordinates. Any ideas?

sentences:
How to reduce the total time spent checking against my world bounds? I'm making a game engine and currently I use a function for checking a new position after movement to prevent game objects from escaping the world:

const boundary = function (min, max) {
    return Math.min( Math.max(this, min), max );
};

I've noticed that it consumes around 9-10% of my game loop (testing with 4500 objects). Is there a better way to handle this? Do I generally need to make my world finite?

To clear this up, this is not an object-object collision detection question. For that I have a grid, and this grid is based on the size of the world, which is why I check that objects don't escape the world size limits.

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:
Vehicle: Boat accelerating and turning in Unity I'm trying to make a player-controllable boat in Unity and I'm running into problems with my code.

1) I want to make the boat to accelerate and decelerate steadily instead of simply moving the speed I'm telling it to right away.

2) I want to make the player unable to steer the boat unless it is moving.

3) If possible, I want to simulate the vertical floating of a boat during its movement (it going up and down)

My current code (C#) is this:

using UnityEngine;
using System.Collections;

public class VehicleScript : MonoBehaviour {
public float speed=10;
public float rotationspeed=50;

// Use this for initialization
// Update is called once per frame
void Update () {

    // Forward movement
    if(Input.GetKey(KeyCode.I))
    speed =
    transform.Translate (Vector3.left*speed*Time.deltaTime);

    // Backward movement
    if(Input.GetKey(KeyCode.K))
        transform.Translate (Vector3.right*speed*Time.deltaTime);

    // Left movement
    if(Input.GetKey(KeyCode.J))
        transform.Rotate (Vector3.down*rotationspeed*Time.deltaTime);

    // Right movement
    if(Input.GetKey(KeyCode.L))
        transform.Rotate (Vector3.up*rotationspeed*Time.deltaTime);

}
}

In the current state of my code, when I press the specified keys, the boat simply moves 10 units/sec instantly, and also stops instantly. I'm not really sure how to make the things stated above, so any help would be appreciated. Just to clarify, I don't necessarily need the full code to implement those features, I just want to know what functions to use in order to achieve the desired effects.

Thank you very much.

sentences:
When should I use a physics engine? Since I found out Box2D, I'm using it for kind of any game-like application I try to write, from very small prototypes or small programs to test something, to actual projects.

Thanks to it it's so terribly easy to handle anything from collisions, to the actual physics.

Sometimes, though, I have some doubts about it: if I only have to handle circles or AABB, and don't need advanced physics tools (joints or stuff like that), I think that a physics engine could add a sort of big, unneeded overhead.

To reassume my question: would you use Box2D (or other physics engines) in a game where physics is really simple (like Super Mario, let's say)? And, if not, why?

sentences:
Saving predesigned tilemap "rooms" and access them in script in Unity3D? I'm working on a top-down rogue-like in Unity3D, and I already have some kind of dungeon generation.

The next feature I'd like to implement, is to predesign some kind of "event rooms" (i.e. boss fight rooms), so my algorithm could place them at random locations.

Is there some kind of Unity feature for this, or I have to implement an editor script which could save and load tilemaps into and from scriptable objects?

sentences:
2D collision of thrown objects in Unity I am currently working on a game inspired by traditional 2D Zelda games ("Link To The Past", etc.) in Unity using the 2D settings.

I am looking for the best way to handle objects that the character throws and how to handle the collisions correctly given the perspective of the camera. A thrown object is rendered further up the screen to create the illusion it is in the air however due to this it will collide with enemies and objects that are not on it's current plane.

Below is a screenshot of "Link To A Past" for those who aren't familiar with the perspective of the game.

I have thought about two ways to potentially implement this system but both don't feel like good the solutions.

Turn off collision during the throw until near the end of the throw. I feel for this solution that different colliders would be required to ensure the correct object is experiences the collision. The issue I see with this solution is that it doesn't account for taller objects. If I throw an object directly at a wall the object should detect that.
A system where using Unity's physics layers I turn layers off during the flight and based off the location of the thrown object. For example turning off the physics layers of objects that are above the object but shouldn't be hit due to the perspective. This method seems like a lot of work but could be a solution to the problem.

Any thoughts for better solutions or refinements would be much appreciated.

sentences:
OnRoomConnected always fail (Google play service unity3d) OnRoomConnected always return false, Im stuck...(Authenticate is success).
Thank you for attention.

private List<Participant> participants;

public void Authenticate()
{
    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        .Build();

    PlayGamesPlatform.InitializeInstance(config);
    // recommended for debugging:
    // PlayGamesPlatform.DebugLogEnabled = true;
    // Activate the Google Play Games platform
    PlayGamesPlatform.Activate();

    Social.localUser.Authenticate((bool success) =>
    {
        if (success)
        {
            Debug.Log("Authentication succeeded");
            //CreateQuickGame();
        }
        else
        {
            Debug.Log("Authentication failed");
        }
    });
}

public void CreateQuickGame()
{
    const int MinOpponents = 2, MaxOpponents = 2;
    const int GameVariant = 0;
    PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen(MinOpponents, MaxOpponents, GameVariant, this);
}

#region RealTimeMultiplayerListener implementation

public void OnLeftRoom()
{
    SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);
}

public void OnParticipantLeft(Participant participant)
{
    SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);
}

public void OnPeersConnected(string[] participantIds)
{
    Debug.Log("OnPeersConnected");
    byte[] message = Encoding.ASCII.GetBytes("Test"); // build your message
    bool reliable = true;
    PlayGamesPlatform.Instance.RealTime.SendMessageToAll(reliable, message);
}

public void OnPeersDisconnected(string[] participantIds)
{
    //SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);
}

public void OnRealTimeMessageReceived(bool isReliable, string senderId, byte[] data)
{
}

public void OnRoomConnected(bool success)
{
    if (success)
    {
        Debug.Log("Room Connected success");

        MainScene ms = new MainScene();
        ms.Waithing_sprite.SetActive(true);
        // Successfully connected to room!
        // ...start playing game...
        //PlayersNames[0] = participants[0].DisplayName;
        //PlayersNames[1] = participants[1].DisplayName;
        //PlayersNames[2] = participants[2].DisplayName;
        //GenerateBoard();
        //bool reliability = true;
        //string data = "Instantiate:0:1:2";
        //byte[] bytedata = System.Text.ASCIIEncoding.Default.GetBytes(data);
        //PlayGamesPlatform.Instance.RealTime.SendMessageToAll(reliability, bytedata);
    }
    else
    {
        Debug.Log("Room Connected FAIL");
        PlayGamesPlatform.Instance.RealTime.LeaveRoom();
        //Loading.text = "Error!";
        //Back.SetActive(true);
        // Error!
        // ...show error message to user...
    }
}

public void OnInvitation(Invitation invitation, bool shouldAutoAccept)
{
    // handle the invitation
    if (shouldAutoAccept)
    {
        PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitation.InvitationId, this);
    }
    else
    {
        // do some other stuff.
    }
}

public void OnRoomSetupProgress(float progress)
{
    Debug.Log("Room Progress Waithing players");
    List<Participant> participants = PlayGamesPlatform.Instance.RealTime.GetConnectedParticipants();
    // show the default waiting room.
    if (participants.Count != 3)
    {
        PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI();
        Debug.Log("Room Progress Waithing players");
    }
    else
    {
        Debug.Log("Room Progress 100");

        MainScene ms = new MainScene();
        ms.MoveToGame();
        PlayersNames[0] = participants[0].DisplayName;
        PlayersNames[1] = participants[1].DisplayName;
        PlayersNames[2] = participants[2].DisplayName;
    }
}

sentences:
Blender 2.6: How to Undo 3D Cursor Movement I sometimes place the 3D cursor at the wrong location by a undesigned click on the left mouse button.

But when I'm trying to click Control + Z in order to undo the accidental 3D cursor movement, it doesn't revert.

So my question is: Is there an easy way to get Blender's (2.6) 3D cursor back to it's previous location? Thanks.

sentences:
How to make 3D snake with procedural mesh in Unity Im currently learning Unity3D and I would like to recreate the old Nokia game "Snakes" (example video: https://www.youtube.com/watch?v=FXg3jVG-tXs&ab_channel=aantv, play it at 1:30 and notice the movement and even the animations when the snake is turning to the sides).
The game movement is grid based as you can see, so the snake can turn only, when the head is in the center of each floor slab. I have done this by using Coroutine and I am interpolating the position of the head between the distance of each 2 slabs. (example video: https://www.youtube.com/watch?v=_LWYQE1UC68&ab_channel=Chlebikpastika).
My question is, how to design and implement the solution using procedural mesh? My idea is to update the vertices of corresponding snake body part with the values of vertices of previous snake body part. I could have Body class, which could have the buffer of vertex positions of previous body, and after each update, the vertices would be updated with currently poped values from buffer. I dont know if this is good design, do you have any ideas how I could achieve the movement of vertices of the snake?

sentences:
How can I avoid a stack overflow when recursively checking adjacent game objects? I am building a simple game on Unity to learn the system. I am using C#.

The game is a basic "blocks" game, whereby when the player clicks on a block, the block and its neighbours of the same colour all disappear (get destroyed).

My process is this:

To keep a track of which blocks are neighbours of the same colour, on each refresh each block checks their details on the event OnCollisionEnter and adds these collision neighbours to a List of valid neighbouring gameobjects.
When a block is clicked, this list is checked and each neighbour has its own neighbours list checked, after list checking each block is distroyed.

Somehow, this process is causing a StackOverflowException

  StackOverflowException
  UnityEngine.GameObject.GetComponent[setupscript] () (at
  C:/buildslave/unity/build/artifacts/generated/common/runtime/GameObjectBindings.gen.cs:35)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:86)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  ....

Here is my script, first my List establishment:

 private List<GameObject> neighbours = new List<GameObject>();

Next, here is how the neighbours list is populated:

void OnCollisionEnter (Collision other)
{
    Rigidbody other_rb = other.rigidbody;
    if(rb.velocity.magnitude < 1f && other_rb.velocity.magnitude < 1f
        && other.gameObject.tag == tagName && !neighbours.Contains(other.gameObject)) {
    /***
     * Same tag so add to list of valid neighbours
     ***/
        neighbours.Add(other.gameObject);
    }
}

Now, there are four conditions [above] to check when adding to the list:

Is the current block stationary.
Is the "other" colliding block stationary (so they're at rest next to each other).
do these blocks have the same tag (so they're the same type/colour)
does this block not already exist in this list.

So once all four conditions are met, the block GameObject is added to the List.

( On conditions of OnCollisionExit blocks are removed from the List in a  similar fashion.  )

Now, my CheckNeighbours() script:

public void checkNeighbours(){
    if (neighbours.Count > 0) {
        foreach (GameObject othercube in neighbours) {
            setupscript otherCubeScript = othercube.GetComponent<setupscript>();
            otherCubeScript.checkNeighbours();
        }
    }

    Destroy (gameObject);
}

This should, as far as I understand it, run once through each List element and check that element for any neighbours who match.

As I write this question out I think I'm realising that the issue is that we're in a loop as block 1 references neighbour block 2, which references neighbour block 3, which references neighbour block 1, etc. etc.

But my StackOverflow exception occurs when there are only two blocks, so one refers to the other, refers to the first, etc. But as they should destroy after running the reference, this shouldn't (ideally) be an issue? Do I need to make the checkNeighbour() a Corountine to allow it to not hold up destroying the GameObject?

If this [repetition cycling] is indeed what's going on, what would be the best way of getting each neighbour to be checked only once? Or checking that the GameObject referenced in the List still exists in the game itself?

I have a quick edit here:

foreach (GameObject othercube in neighbours) {
    if (othercube != null){
        setupscript otherCubeScript = othercube.GetComponent<setupscript>();
        otherCubeScript.checkNeighbours();
    }
}

But I'm not sure this will work as I feel this List will purely be a reference rather than the actual GameObject in the level?

sentences:
Black Area in skybox in opengl Hi I am using opengl and I am having a problem if I go further from the skybox with the camera I get black areas, a smaller radius of the skybox will make the camera too close to the object to stay inside the skybox and increasing it obviously doesn't help.
:

Here is the code for the skybox:

  glEnable(GL_TEXTURE_2D);
    glPushMatrix();
    qobj = gluNewQuadric();
    glTranslated(50,0,0);
    glBindTexture(GL_TEXTURE_2D, underwater);
    gluQuadricTexture(qobj,true);
    gluQuadricNormals(qobj,GL_SMOOTH);
    gluSphere(qobj,100,100,100);
    glPopMatrix();

sentences:
Creating the “game space” for a 2D game How does one setup the game space for a game so that obstacles can be spawned?

Examples would be ice climber or the iphone doodle jump. Tile maps are limited in size and would need to change often if the user jumps a lot.

How would this be done in another way than tile maps.

How or what is used to create the notion of a game world where these spawned ledges/obstacles are placed as the user progresses through the stage?

What is actually moving if the user jumps from ledge to ledge, what are the ledges based on in terms of the game world/space. What data structure or representation could the game use to reference and manage the spawning of these obstacles/ledges?

How is a continuous environment created which creates collision objects as the user progresses?

sentences:
How to detect collisions in AS3? I'm trying to make a simple game, when the ball falls into certain block, you win.

Mechanics: The ball falls through several obstacles, in the end there are two blocks, if the ball touches the left block you win, the next level will contain more blocks and less space between them.

Test the movie (click on the screen to drop the ball):
http://gabrielmeono.com/downloads/Lucky_Hit_Alpha.swf

These are the main variables:

    var winBox:QuickObject;//You win
    var looseBox:QuickObject;//You loose
    var gameBall:QuickObject;//Ball dropped

Question:

How do I trigger a collision function if the ball hits the winBox? (Win message/Next level)

Thanks, here is the full code:

    package  {

    import flash.display.MovieClip;
    import com.actionsnippet.qbox.*;
    import flash.events.MouseEvent;

    [SWF(width = 600, height = 600, frameRate = 60)]

    public class LuckyHit extends MovieClip {

        public var sim:QuickBox2D;
        var winBox:QuickObject;
        var looseBox:QuickObject;
        var gameBall:QuickObject;

        /**
         * Constructor
         */
        public function LuckyHit()
        {
            sim = new QuickBox2D(this);
            //sim.createStageWalls();
            winBox = sim.addBox({x:5,y:600/30, width:300/30, height:10/30, density:0});
            looseBox = sim.addBox({x:15,y:600/30, width:300/30, height:10/30, density:0});

            // make obstacles
            for (var i:int = 0; i<(stage.stageWidth/50); i++){
            //End
                 sim.addCircle({x:1 + i * 1.5, y:16, radius:0.1, density:0});
                 sim.addCircle({x:2 + i * 1.5, y:15, radius:0.1, density:0});

            //Mid End

                  sim.addCircle({x:0 + i * 2, y:14, radius:0.1, density:0});
                  sim.addCircle({x:0 + i * 2, y:13, radius:0.1, density:0});
                  sim.addCircle({x:0 + i * 2, y:12, radius:0.1, density:0});
                  sim.addCircle({x:0 + i * 2, y:11, radius:0.1, density:0});
                  sim.addCircle({x:0 + i * 2, y:10, radius:0.1, density:0});

            //Middle Start
                 sim.addCircle({x:0 + i * 1.5, y:09, radius:0.1, density:0});
                 sim.addCircle({x:1 + i * 1.5, y:08, radius:0.1, density:0});
                 sim.addCircle({x:0 + i * 1.5, y:07, radius:0.1, density:0});
                 sim.addCircle({x:1 + i * 1.5, y:06, radius:0.1, density:0});

            }

            sim.start();

            stage.addEventListener(MouseEvent.CLICK, _clicked);
        }

        /**
         * ..
         * @param e MouseEvent.CLICK
         */

        private function _clicked(e:MouseEvent)
        {
            gameBall = sim.addCircle({x:(mouseX/30), y:(1), radius:0.25, density:5});

        }
    }

}

sentences:
What platform is best for Android and iPhone development? I've been developing non-mobile apps for linux; mainly stuff like interpreters, compilers, database engines and business apps.

I've been told that if I wanted to learn how to develop iPhone/iPad applications, I should buy a Mac since Apple has all it's development tools for iPhone/iPad on Mac.

Now, what about Android phones / tablets?  Are the development tools better on Mac or PC?

I need to buy a new laptop, and I would like to factor in mobile development in my choice of PC or Mac.

sentences:
Animating object, setting isKinematic=false, and then letting physics take over I'm trying to create a "tree felling" effect, where the tree trunk falls over after being cut down by the player. I've used one prefab which contains my tree stump and tree trunk as children.

In its default state, my tree trunk as a rigidbody with isKinematic=true. When the player cuts down the tree, I begin an animation on the trunk which "tips it over". On the last frame, it sets isKinematic=false - at this point it should "fall over" because physicals/gravity is in control and the center of mass is definitely over its base.

However, the animation seems to be preventing it, like it's still "controlling" the transform.

Adding a transition from the "fell" state to an "exit" state just resets the position/rotation.
Setting the animator to "animate physics" kind of works, but the tree just flies away, probably colliding with the stump or something.
Disabling the animator after the animation kind of works, but this also causes the tree to go flying with some crazy physics.
When left alone, OnCollisionEnter is called on the tree for colliding with my ground, yet the gameobject appears to still be stuck at 45 degrees and never touched the ground. It seems like the rigibody/collider is not where the mesh/transform is?

Animating the object and then turning off isKinematic should work, it's been recommended to me on reddit and is the accepted answer on this question, so I'm not sure what could be wrong.

Edit: I can ease the physics problems by telling the trunk to ignore it's own stump (Physics.IgnoreCollision(Trunk.transform, Stump.transform);), but the base of the tree still "jumps" away from the stump, rather than "continue tipping over". I'm not sure what else could be at play.

sentences:
Following waypoints, condition is never fulfilled Given a 2D-grid which is defined like below and is used to draw a grid consisting of cells:

int[,] grid; //filled with 0 (blocked) and 1 (walkable);

I also have a A*-algorithm implemented which returns a List<Vector2> with the grid cell positions of the waypoints of the path. The actual screen-positions of the cells can be calculated using the cell width. So for example a Vector2 waypoint = new Vector2(0,2); is a Cell in the first row and third column.

I also have a Player class which holds and displays a texture. When I let the Player follow the path, the texture is moving towards the top waypoint in the List. Once the waypoint is reached with position == currentgoal //comparing Vector2 here I delete it from the list and set the next waypoint as the current goal.

Here is how I update the Player position, in this case it is moving down as the direction Vector2 is set to Vector2(0,1);

float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

position += new Vector2(0,1) * speed * elapsedTime; //direction * float * float

First I was using an integer as speed and omiting the elapsedTime in the calculation. As this is not how it is supposed to be implemented I changed the speed to float and added elapsedTime. Also with an speed value of int speed = 1; the texture was moving too fast already.

Unfortunately with the float values the Vector2 comparison of position and waypoint vectors is almost never exactly reached and therefore the condition never fulfilled. This is because the goal values although being floats always hold values with a 0 after the point.

What I tried is to check for a (+/-)1 value so if the position is somewhere between currentgoal +/- 1. This does lead to a inaccuracy and other side effects.

Is my position calculation a common and right way to do it? If so, how could I modify my code which is checking whether the goal is reached or not?

sentences:
Visual Studio 2010 C++ & OpenGL project cannot detect .lib files So I'm trying to start a C++, OpenGL project on Visual Studio 2010, and I have put glut.h and glut32.dll in the project directory, along with the glut.dll and glut32.lib files in a folder named "glut" in the project directory.

I have also gone to "Porject Properties -> Linker -> Input -> Additional dependencies" and I have typed in "glut32.lib" at the end, and made sure I am not missing a semicolon.

when I try doing

#include "glut.h"

in the Main.cpp file, it complains

error LNK1104: cannot open file 'glut32.libkernel32.lib'

Am I missing any files? What am I doing wrong here?

sentences:
FB.Init() is not accepting in my c# Script I am trying to connect fb with my game. its first time i am connecting fb with game. i downloaded fb SDk  7.3.0 and i am using unity 5.2.1f1. i imported the sdk in my game asset. then i created a new c# script "FBholder". in Awake() i tried to use FB.Init(). but its not accepting. all other scripts used inside the game are calling correctly, only the scripts came with fb sdk is not working.

 using UnityEngine;
 using System.Collections;

public class Fbholder : MonoBehaviour {

// Use this for initialization
void Awake() {
    FB.Init (SetInit, OnHideUnity);// This line is not accepting
}
}

i Used this Video for my referance

sentences:
Dragging and dropping sword in unreal engine 4 I am developing a 2d game using unreal engine 4 in which the user drags and drops a sword.I want the sword to follow the position of my finger.At the moment, when I drag the sword, it moves at an offset from my finger.The game has been packaged to an pad and I have set up the functionality using blueprints.

Pseudo code:

On Drag (){

finger position = sword position on screen

on drop = finger position on release from screen = position of sword

}

How do I make the sword follow the position of my finger as I drag it?

sentences:
How do you increase the spacing on text within LibGDX labels So I'm following along with some tutorials for creating an application with LibGDX, and when I go to print parts of the UI to the screen, the text is all bunched up. How do I increase the spacing, or is it due to something else I've done?

....
    game = gam;
    stage = new Stage(new StretchViewport(800, 400));
    Gdx.input.setInputProcessor(stage);
    uiSkin = new Skin(Gdx.files.internal("uiskin.json"), new TextureAtlas(Gdx.files.internal("uiskin.atlas")));
    Label nameLabel = new Label("Name:", uiSkin);
    TextField nameText = new TextField("", uiSkin);
    Label addressLabel = new Label("Address:", uiSkin);
    TextField addressText = new TextField("", uiSkin);

    table = new Table();
    table.add(nameLabel).expandX();
    table.add(nameText).width(200);
    table.row();
    table.add(addressLabel);
    table.add(addressText).width(200);
    table.setFillParent(true);
    stage.addActor(table);
    table.setDebug(true);

sentences:
How do you implement 2D collision detection? I would like to know the best or most efficient way to test for 2D collision.

I am currently using AABBs, but the problem with this, is that your objects will be hitting things when they shouldn't. On top of this, AABBs cannot be rotated.

I was considering using per pixel collision, but I feel that it would lag on large bitmaps, since there would be a lot of pixels to check.

What I would like to know, is how I can allow my bounding boxes to be rotated, and use any polygon instead of just rectangles for collision. Also, is there a way of creating circular collision bounds that aren't just approximations of circles?

sentences:
Tube model imported from Blender getting stretched vertically when rendering I'm actually working on a 3D game engine with OpenGL 4 and C++. The problem is that, I don't know why, my geometry isn't well renderered except for primitives.

At the right you can see a cube, it is rendered as intended.
At the center you can see a mesh that I've made in blender, it is not rendered as intended, at the left you can see my mesh rendered as intended BUT I did tweak the Z-Scale (and I should not do that)

So to be short : My mesh are not rendered well proportionned.

I verified coordinates of each vertices in blender and my project : they're same.

I don't know if there is a problem with my matrices, the only thing I know is that problem appears only on the Z-Axis (Z is up).

Everything let me think that somewhere a number is rounded but I can't see where

I leave here some code, which might be helpful :

Mesh Rendering Code :

void RD_Mesh::render(RenderMode rndrMode) {
    if (rndrMode == RenderMode::Filled) {
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    }
    else {
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    }

    //m_shader->useShader();
    m_mat->BindMaterial();

    glm::mat4 mdl = glm::mat4(1.0f); //Declaring Model Matrix

    glm::mat4 translate = glm::mat4(1.0f);
    glm::mat4 scale = glm::mat4(1.0f);
    glm::mat4 rotation = glm::mat4(1.0f);

    //Position
    translate = glm::translate(translate, glm::vec3(m_position.getX(), m_position.getY(), m_position.getZ()));

    //Scale
    scale = glm::scale(scale, glm::vec3(m_scale.getX(), m_scale.getY(), m_scale.getZ()));

    //Rotation
    rotation = glm::rotate(rotation, glm::radians(m_rotation.getX()), glm::vec3(1.0f, 0.0f, 0.0f));
    rotation = glm::rotate(rotation, glm::radians(m_rotation.getY()), glm::vec3(0.0f, 1.0f, 0.0f));
    rotation = glm::rotate(rotation, glm::radians(m_rotation.getZ()), glm::vec3(0.0f, 0.0f, 1.0f));

    mdl = translate * rotation * scale;

    m_shader->SetMatrix("model", mdl);

    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLES, RAWindices.size(), GL_UNSIGNED_INT, 0);
    glBindVertexArray(0);
}

Camera code :

void RD_Camera::SetupCamera() {
    projection = glm::perspective(glm::radians(FOV), (float)m_rndr->getWindowWidth() / m_rndr->getWindowHeigh(), m_near, m_far); //Projection matrix

    view = glm::lookAt(glm::vec3(m_pos.getX(), m_pos.getY(), m_pos.getZ()), glm::vec3(m_subject.getX(), m_subject.getY(), m_subject.getZ()), glm::vec3(0.0f, 0.0f, 1.0f)); //View matrix

    m_rndr->GetCurrentShader()->SetMatrix("projection", projection);
    m_rndr->GetCurrentShader()->SetMatrix("view", view);
    m_rndr->GetCurrentShader()->SetVec3("CamPos", m_pos);
}

My Vertex Shader:

#version 450 core

layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;

out vec3 Normal;
out vec3 FragPos;

uniform mat4 projection;
uniform mat4 view;
uniform mat4 model;

void main()
{
    gl_Position = projection * view * model * vec4(aPos, 1.0);

    Normal = normalize(mat3(transpose(inverse(model))) * aNormal);
    FragPos = vec3(model * vec4(aPos, 1.0));
}

sentences:
Mesh-level acceleration structures for collision detection when mesh instances can be rotated, scaled and/or resized Short version: in the mid-phase or narrow-phase of collision-detection, does any acceleration structure organizing the mesh's vertices (e.g. AABB-trees, Octrees, Quadtrees) work for the mesh's instances that are re-scaled, re-sizes and/or rotated?

Long version: suppose a concave mesh composed of a very high number of triangles (e.g. 200k) and for which I cannot use convex decomposition in order to perform collision detection. The most efficient solution usually employed would be to organize the vertices of the mesh using acceleration structures to quickly prune which parts of the mesh are likely to have been collided with.

However, that mesh is used for generating instantiated copies - and each of these can have different size, rotation and/or scale at any of the X,Y,Z axis. Would any acceleration-structures work since the instances can be re-scaled, rotated and resized? Suggestions, tips, academic references, are all appreciated.

sentences:
Is TIN a 2D or 3D mesh? I have a TIN (Triangle Irregular Network) that was created in CAD software packages from something called DTM (essentially each point represents the height of the ground for that specific point).

The result looks like a 'blanket' of triangle, so not closed in any way. I think that's a non-boundary manifold triangle mesh but not sure. More unclear is if it is a 2D mesh (like a polygon is a 2D surface in a 3D Cartesian space even if not all vertexes are the same z). Can someone please explain what kind of geometry is a TIN?

Example (the blue triangles are the TIN):

sentences:
How to set orthgraphic matrix for a 2d camera with zooming? I'm using ID3DXSprite to draw my sprites and haven't set any kind of camera projection matrix. How to setup an orthographic projection matrix for camera in DirectX which it would be able to support zoom functionality?

    D3DXMATRIX orthographicMatrix;
    D3DXMATRIX identityMatrix;

    D3DXMatrixOrthoLH(&orthographicMatrix, nScreenWidth, nScreenHeight, 0.0f, 1.0f);
    D3DXMatrixIdentity(&identityMatrix);

    device->SetTransform(D3DTS_PROJECTION, &orthographicMatrix);
    device->SetTransform(D3DTS_WORLD, &identityMatrix);
    device->SetTransform(D3DTS_VIEW, &identityMatrix);

This code is for initial setup. Then, for zooming I multiply zoom factor in nScreenWidth and nScreenHeight.

UPDATE

This is going to work:

    D3DXMATRIX orthographicMatrix;
    D3DXMATRIX identityMatrix;
    D3DXMATRIX viewMatrix = D3DXMATRIX(
        1,      0,      0,      0,
        0,      1,      0,      0,
        0,      0,      1,      0,
        (FLOAT)(-(this->nScreenWidth / 2)), (FLOAT)(-(this->nScreenHeight / 2)),        0,      1
    );

    D3DXMatrixOrthoLH(&orthographicMatrix, (FLOAT)this->nScreenWidth, (FLOAT)-this->nScreenHeight, 0.0f, 1.0f);
    D3DXMatrixIdentity(&identityMatrix);

    this->p_device->SetTransform(D3DTS_PROJECTION, &orthographicMatrix);
    this->p_device->SetTransform(D3DTS_WORLD, &identityMatrix);
    this->p_device->SetTransform(D3DTS_VIEW, &viewMatrix);

And put D3DXSPRITE_OBJECTSPACE flag next to other flags when you use ID3DXSprite::Begin():

if(this->p_sprite->Begin(D3DXSPRITE_ALPHABLEND | ... | D3DXSPRITE_OBJECTSPACE) != D3D_OK) return 0;

For zoom functionality you can produce this matrix:

D3DXMatrixOrthoLH(&orthographicMatrix, this->nScreenWidth * this->dZoom, -this->nScreenHeight * this->dZoom, 0.0f, 1.0f);

sentences:
How to achieve game server redundancy? The game I'm developing has a simple game server which stores inventory and hero data for each user, as well as deciding the outcome of some random events. The server interacts with PostgreSQL and responds to HTTP queries. It runs on EC2 and Microsoft Azure, but these hosts sometimes become unreachable for a few minutes, and one week the EC2 server froze every day. What are the strategies to make sure a server is always available?

Non-solution: Multiple servers with their own databases, and the client will try to connect to a different server after a timeout. Of course, their data will be absent if it's a different server.

Solution 1: As above, except whenever player data changes, that change is stored, and each player's data is replicated to the other servers (bidirectionally). The disadvantage is that this solution is "home grown" and prone to mistakes.

Solution 2: One primary server (let's leave sharding for later), and one or more backup servers, with the database being replicated. When the primary server becomes unreachable, a backup server is made into the primary server.
Problems: this needs additional technology for directing queries to the right server, and also to decide when a backup server needs to be promoted to primary. Can this "manager" also hang? It sure can if it's on AWS! That would bring the whole system down.

Solution 3: We could pay for database hosting with some guarantee of reliability, and have multiple servers but just one database. We would assume the database is reliable (but still back it up). The user could connect to any reachable server, and the servers would not need to worry about having stale data, since there will be only one database. (Again, sharding is a separate problem, and we could just multiply the whole setup without fundamentally changing its architecture.)

So how is reliability achieved when individual servers aren't reliable? I like solution 3 for its simplicity, if a 3rd party database can be relied upon.

sentences:
GL.BlendFuncSeparate(ArbDrawBuffersBlend) Enum has no members? I want to use the function GL.BlendFuncSeparate but it seems that one of the enums used has no members.

    public enum ArbDrawBuffersBlend
    {

    }

Is there another function to call or is this a bug?

sentences:
How to create temp folder to store a file from external directory and use it in a game I would like to copy a 3D model from external library and save it in temp/Resources/StreamingAssets folder to instantiate an object in unity scene.
`

public class FBXOBJLoader : MonoBehaviour {

    string src;
    // Use this for initialization
    void Start () {
        src = EditorUtility.OpenFilePanel("Select Model", "", "fbx");
        //Output the Game data path to the console
        Debug.Log("Path : " + src);
        StartCoroutine("CopySomething");
    }

    IEnumerator CopySomething()
    {
        print("Start");
        string path;
        path = Application.temporaryCachePath;
        FileUtil.CopyFileOrDirectory(src,path);
        yield return null;
    }
}

It's creating some unknown file format in the asset folder. can anybody please help me to complete this task.

Thanks in advance

sentences:
how do I set an int to the scroll wheel data in unity i need to set an int to data from the scroll wheel so I can have the script use this int to display an item attached to a number from that int. i'm using c#

i set up my scroll wheel input, what am i doing wrong?

here is the script;

  counter = Mathf.RoundToInt(Input.GetAxis("ScrollWheel"));

    Items.text = counter.ToString();

sentences:
C# Top down movement limitation I'm using C# and Visual Studios 2010 with XNA 4.0+lua, and my teacher has asked us to make a 2D RPG game similar to zelda(top down). I was aiming to use just one image for each map region, instead of using the tile approach, however i'm stuck on the aspect of movement limitation.

My teacher mentioned being able to mask another image on top of the map's current image, using only back and white colors and using those to be able control where the avatar can move(move where black is and restrict movement where white is). He did not, however, instruct us on how to do this, and I have been unable to find any tutorials anywhere.

I'm fairly new to C# in general, so if anyone can point me in the direction of a tutorial that could help me accomplish this, or add their own advice I would really, greatly appreciate it.

sentences:
What tools should I consider if my aim is to make a game available to as many platforms as possible? We're planning on developing a 2D, grid-based puzzle game, and although it's still very early in the planning stages, we'd like to make our decisions well from the beginning.

Our strategy will be to make the game available to as many platforms as possible, for example PCs (Windows, Mac and/or Linux), mobile phones (iPhone and/or Android based phones), game consoles (XBLA and/or PSN)
PC will have an emphasis, but I believe that's the most flexible platform so that shouldn't be a problem.

So, what programming language, game engine, frameworks and all around tools would be best suited for our goal?

P.S.: I'm betting a set of tools won't cover ALL of them, and that there will still be some kind of "translating" effort for some platforms, but we'd like to know what the most far reaching are.

sentences:
How are buttons made to be clicked? I just want to ask a general question. According to that answer, I'll continue thinking.

You know in games there are lots of clickable items. Play button, exit, combo-boxes, etc.

My question is: Are those buttons drawn in same canvas with background and all other things, or for every different thing there is another canvas object?

My question is a general sense. I'm not asking about a specific game, I'm asking how they are made generally.

I'm planning to start a game on Android, and I'm confused actually how to design buttons, and other object. Probably I'm going to use View/SurfaceView for now. I don't have much experience with OpenGL yet.

Thanks in advance.

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:
3D Graphics Engine for Ruby on Rails I've had a good few months of experience with Ruby on Rails, creating my own CMS system, a social network and even a VOIP enabled answering phone machine. I'm also an established 3D modeller, and what I really, really want to do is create a 3D game that's executed in the browser.

I'm not talking Crysis: Online or CoD: Online, or even Doom. Nothing too graphically/RAM intensive. Not a shooter. I simply want to create a simple puzzle solving, hidden object game that can be accessed in the browser.

Maybe something along the lines of the Myst  III+ games.

http://www.youtube.com/watch?v=turE_nFwXhM

Technically, they're very simple games, but by placing the camera inside a 3D sphere with its inner surface textured with an appropriately-distorted 2D rendering, they pull the player into thinking they're exploring a 'fully' 3D world.

They're not realtime, and I genuinely think this could be done online. Maybe some bandwidth issues with these high-res images, but by hiding loading screens behind doors that take a while to open, I think a seamless experience could be achieved.

So, is there a simple 3D engine for ruby? Open source, with a great community?

Apologies if you think I'm rambling, I've rambled in the hope that it'll give you a good feel for my technical requirements :)

sentences:
Why can't I expose a Plane variable in my unity script? I've got a script which creates raycasts. I wanted to use the (presumably less expensive) Plane.Raycast rather than the GameObject.Collider.Raycast (because the gameobject one has a distance parameter so that's one more check)

I can expose the plane gameobject in my scene easily by simply making a public gameobject variable like this:

public GameObject floor;

however when I turn it into this:

public Plane floor;

It doesn't expose in the scene. Why is this?

sentences:
Collision resolution moving Point to AABB with raycasting This is probably trivial, but I'm having trouble making it work.

I have a 3-coordinate world of particles simulated with Verlet Velocity. I only care for collision between their centers and a few static AABBs.

Essentially, I can't get a clean way of resolving a collision.

For example, say I have a box with coordinates:

min = (0, -1, -384)
max = (512, 1, 0)

Any particle colliding with it should stop moving in the relevant direction, but continue moving in the others - not bounce off.

I have one particle at pos that in a single timestep wants to go to newpos (it's being pushed both downward and eastward):

pos = (-0.068037, 0.000000, -58.516845)
newpos = (0.014446, 0.000000, -58.555490)

Clearly, on the X axis there is a collision. My ray collider detects it and pops back the point where the ray intersects the AABB:

intersection = (0.000000, 0.000000, -58.548722)

Now, if I just set the position to that point, at the next time step there will be a collision because the position will be exactly on the border of the AABB.

This makes every particle "stick" to whatever box they collide with. In the previous example, I'd like to have the particle slide down the AABB wall according to its current velocity.

How can I do that?

sentences:
How can I implement dynamic button size? I'm on the process of planing a sort of a 2D/2.5D, pixel-art multilingual game, while I learn about game development. I have a pretty solid background at programming, but when it comes to game design, I don't know too much. My particular question is about how is the proper/better way of creating and implementing a game text button, but I suppose it can be applied to other GUI elements. What I have found so far, while "googleing"/looking for this specific question, is how to deal with engines or frameworks which have their own way of doing it, but I would like to do it by my own. So to make things clearer, let me expose my vision of potential approaches.

Fixed text in a fixed-size texture

This is an easy way of implementing a text button, as all I have to do is loading and positioning a texture. However, it could be painful to change my .psd files all the time, as I'm working with a multilingual game.

Variable text and fixed-size texture

I could use a texture as a button model and overlap it with all kinds of text of different languages, reading the texts from .xml files. The problem is that a word in a language can exceed its equivalent of another language. A workaround for this could be switching between different font sizes, i.e., a text in a language would be smaller or larger than in another, but this would look ugly.

Variable text and splitted texture

This approach would divide a button texture into 3 different parts: left, middle and right. Then, I would read a text from a .xml file, measure its length in pixels and increase ("multiply") the "middle" part of the texture so that the text could fit on it. This looks fine when working with a pixel-art game GUI, but sounds not fine when working with vectorized images.

Dynamically-generated GUI

I could use OpenGL to render rectangles and use them as buttons, but this would produce quite basic shapes. At most, I would have shaded rectangles with a basic border and some text rendered on it; it would look like a HTML/CSS GUI, which is a way far from a game GUI.

These approaches are just my guesses, as I've never worked in the game industry; I assume that someone experienced can correct me if I deduced something wrong. Another thing is that I think these approaches can work diffently depending of the texture type (e.g. pixel-art and vectorized textures), so you'll be welcome for answering why an approach is better for a texture type or another. There's also a possibility of me being a bad thinker and all of this being a "bullshit", and if it is the case, I hope you share your technique with me.

Moreover, as I said before, this question is specific for a text button, but I think with some adjustments it could cover more GUI elements which have related properties (such as window, text input and the like), so if you include it as part of your answer, it'll be helpful.

sentences: How legal would it be to use some elements of the Half Life universe in my non comercial, indie game? I'm planning to make a simple, HTML5 game, that would use some elements of the Half Life universe. Basically, it would be a 2D Portal clone, but it would have it's own story, and portals would be different, along with the mechanics of making and using them. Also, how far can I go with this? If possible, I'd like to have Gman, a character from Half Life, walk by a few times, and maybe even use some of the sounds from Half Life or Portal. It's also important to note that I wouldn't be making any kind of profit.

sentences:
What's a pre-multiplied 4x4 matrix? I'm using a 3d game engine, that uses a 4x4 matrix to modify the camera projection.

The matrix is in the regular 4x4 format:

 r r r  x
 r r r  y
 r r r  z
 - - -  zoom

The description for the matrix class says:

  A transformation matrix. Matrices are pre-multiplication, as in: x' =
  M*x.

What does this mean?

sentences:
When setting Stage as inputProcessor, Shaperenderer shapes are drawn stretched I am working on making a falling sand simulation using libgdx. For drawing the individual elements I am using a ShapeRenderer and drawing rectangles.

I have begun to implement a dropdown menu to allow selection of elements to place. The functionality of the dropdown menu is working. I am able to set the inputProcessor as the stage and upon selecting the element type set the inputProcessor back to CreatorInputProcessor and I am able to successfully place elements again. The functionality is all working as expected.

However, when I set the stage with the dropdown as inputProcessor, the element rectangles become stretched. The resolution and pixel width of the window stays the same. It is not zooming in or anything. When the inputProcessor is set back to the CreatorInputProcessor the rectangles stay stretched.

Here are the things I have tried to fix this issue:

Use every kind of ViewPort passing in both a new OrthographicCamera and also the same camera used for the game view
Disposing of the stage after input processor is set back to CreatorInputProcessor
Setting the projection matrix on the camera every frame just before drawing or after drawing.

I found this stack exchange question which is similar to my issue but the marked answer does not solve my problem (setting the projection matrix every frame): LibGDX - why are the shapes from my ShapeRenderer resizing with my viewport?

I am looking for some advice on how I can resolve this issue. Thanks!

Here is the relevant code snippet: https://github.com/DavidMcLaughlin208/FallingSandJava/blob/master/core/src/com/gdx/cellular/InputManager.java#L357-L399

sentences:
Multiple errors on brand new C++ project I've just started a brand new project and created a created a new C++ Character class. However Visual Studio 2017 shows 140 errors. The project still builds fine, however the syntax highlighting and errors are very intrusive.

Here are some examples of the errors:

on the BaseCharacter.cpp class I just created:
class "UObject" has no member "BeginPlay"
class "UObject" has no member "Tick"
class "UObject" has no member "SetUpPlayerInputComponent"

on multiple '.h' files:
this declaration has no storage class or type specifier

for all '*.generated.h' files:
cannot open source file "[ClassName].generated.h"

Is this a problem with my intellisence or the project itself? I haven't changed any of the code that was generated by Unreal.

sentences:
What AI for a resource management + combat? I have a very simple game: 2 players (one human and a computer) and both have 1000 tokens. They must build an army. Depending on the type of soldier, it cost from 10 to 100 token to train one. Eventually I want them to attack the each other.

What would be the AI to use in that case? Is there any example around that I could learn from?

Thanks!

sentences:
Huge slowdown when running Lua as statically linked lib versus stand alone interpreter I'm developing some algorithms in Lua which are run mostly in Lua (few calls to C++) and I'm noticing a huge slowdown when I'm running them from my app rather than the default Lua interpreter.
The script returns in about 11 seconds with the interpreter, and about 5+ minutes with my program.

I don't think it is a problem with calling the C++ function, overruling that function with an empty function in the script has no noticeable effect for time.

Both Lua and the program are compiled with Visual Studio 2010 (I created a new solution for Lua, with projects for both the interpreter and static library)

I've run a profiler on the code (the Very Sleepy profiler, can't get a Lua profiler working but haven't tried to much) and found that in my application around 50% of the time is spend on malloc.. and 40% on free, both called from the Lua garbage collector (tried disabling that to check, but that crashes with using to much memory (understandably), the Lua interpreter peeks at about 4mb ram usage).

I'm new at Lua, so its very possible I've done something wrong somewhere, anyone got a few hints to try?

sentences:
Resolution Independence in libGDX How do I make my libGDX game resolution/density independent? Is there a way to specify image sizes as "absolute" regardless of the underlying density?

I'm making a very simple kids game; just a bunch of sprites displayed on-screen, and some text for menus (options menu primarily). What I want to know is: how do I make my sprites/fonts resolution independent? (I have wrapped them in my own classes to make things easier.)

Since it's a simple kids game, I don't need to worry about the "playable area" of the game; I want to use as much of the screen space as possible.

What I'm doing right now, which seems super incorrect, is to simply create images suitable for large resolutions, and then scale down (or rarely, up) to fit the screen size. This seems to work okay (in the desktop version), even with linear mapping on my textures, but the smaller resolutions look ugly.

Also, this seems to fly in the face of Android's "device independent pixels" (DPs). Or maybe I'm missing something and libGDX already takes care of this somehow?

What's the best way to tackle this? I found this link; is this a good way of solving the problem?: http://www.dandeliongamestudio.com/2011/09/12/android-fragmentation-density-independent-pixel-dip/

It mentions how to control the images, but it doesn't mention how to specify font/image sizes regardless of density.

sentences:
Error once unity got updated to 2017.1 I am working on a 2D platformer and I decided to update unity to the lastest version. Everything went well but once I got the project updated I got 2 error that I am not sure how to fix. Some help would be greatly appreciated!!!

Here is what the console is saying

Assets/Scripts/GameMaster.cs(148,112): error CS0039: Cannot convert type UnityEngine.Transform' to UnityEngine.GameObject' via a built-in conversion

Assets/Scripts/GameMaster.cs(111,96): error CS0039: Cannot convert type UnityEngine.Transform' to UnityEngine.GameObject' via a built-in conversion

Here are the lines that it is pointing to

GameObject clone = Instantiate (spawnPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject;

GameObject _clone = Instantiate(_enemy.deathParticles, _enemy.transform.position, Quaternion.identity) as GameObject;

Thanks!!!!

sentences:
Play videos with LibGDX Is there a way to play videos with LibGDX?

I want to put a video as my splash screen in Android, but I dont want to use the Android SDK, because I am using LibGDX and I am almost finished :/

sentences:
Fully decentralized matchmaking? Most games that I know use a master server to connect players in multiplayer. If it ever gets shut down, without third-party software or master server, the game is effectively unplayable in multiplayer, sometimes not even in LAN. Temporary shutdowns can arguably be worse than permanent, because in the latter case you will likely have a community solution soon, in the former you have to wait for an unknown amount of time.

Assuming good intentions of the game developer, how can such a game be constructed so it remains playable? Can matchmaking be made fully decentralized? Do such solutions already exist?

sentences:
Local player always at same position I am trying out UNET ( Unity Multiplayer Service ) and I am building a space invaders like game but with two players at each side of the screen shooting at each other.

I want the local player to always be at the bottom of the screen and see the enemy at the top.

I tried checking isLocalPlayer and isServer and only if both are false -> this means it's the enemy player and change his transform and rotation to be facing downwards and be at the top. But this brings unexpected behavior like spawning the bullets on the original position.

sentences:
2d Tiled Map with images in Javascript I'm trying to create a tile map with simple 2d images (30x30). I restarted the project from my previous post, and instead of using someone else's code, i though I would learn more to start from scratch. It was going well, but I ran into a bump when attempting to use images for tiles. My previous project used to following to create simple cubes. Now I'm trying to use images, and was wondering if there is a way to make the images wihtout having to follow the exact same steps as below:

function renderLevel(){
// clear the canvas
context.clearRect(0, 0, canvas.width, canvas.height);
// walls = red boxes
context.fillStyle = "#ff0000";
for(i=0;i<levelRows;i++){
    for(j=0;j<levelCols;j++){
        if(level[i][j]==1){
            blockrow.push(i);
            blockcol.push(j);
            context.fillRect(j*tileSize,i*tileSize,tileSize,tileSize);
            console.log("add");
            //collision[i] = new Array ([i],[j]);
        }
    }
}
// player = green box
context.fillStyle = "#00ff00";
context.fillRect(playerXPos,playerYPos,tileSize,tileSize);

}

Currently, I'm trying to simply drop the images, and manually declare the sizes when calling them.

    function setmapimages(){
    for (i=0;i<mapArray.length; i++){
        for (k=0; k<mapArray[i].length; k++){
            //image for player
            if (k==positionX && i==positionY){
                ctx.drawImage(img, 30, 30);
            }
            //image for road
            if (mapArray[i][k] == 0){
                ctx.drawImage(img2, 30, 30);
            }
            //image for collision
            if (mapArray[i][k] == 1){
                ctx.drawImage(img3, 30, 30);
            }
            //image for Store
            if (mapArray[i][k] == 2){
                ctx.drawImage(img4, 30, 30);
            }
        }
    }
};

I set the canvas size similarly to the previous project:

var canvas = document.getElementById('canvas');
var ctx = canvas.getContext("2d");
canvas.width =img.width*11;
canvas.height =img.height*9;

Although I set the variables a bit different. Since I'm using images now.

var img = new Image();
img.src= "image.png";
var img2 = new Image();
img.src= "image2.png";
var img3 = new Image();
img.src= "image3.png";
var img4 = new Image();
img.src= "image3.png";

Am I calling the images correctly? I looked up "drawimage" and think I went the wrong way with this, but I'm unsure what could call the images correctly.

sentences:
How to setup animation based events without depending on an animation? How can I have events based off animations without relying on them? Take for example reloading in a FPS game. You'd hit a button to reload your weapon, the animation will play, then animation will hit a certain frame, then the weapon will be reloaded. There's a dependency on the animation eventually hitting that key frame before the weapon can reload and the character can go into another state. Without the animation, the weapon would never reload, and without some arbitrary timeout, the character would be stuck in that state forever.

Checking for the existence of an animation is an option. However, this requires us to still know about some sort of animation, and what it's playing. Am I over engineering this? Would it be okay for the logic of some object to have some information about it's animations?

sentences:
Why might a body suddenly stop while moving on continue platform? I have a 32x32 sprite and I make some to be platform like this

for (int i = 0; i < 15; i++) {
    attachChild(new Ground(32 * i, 200, regPlatform, vertexBufferObjectManager, physicsWorld));
}

And I have another sprite (32x32 also) moving over those platforms (A player object)

attachChild(new Player(10, 10, regPlayer, vertexBufferObjectManager, physicsWorld));

And the physicsWorld connects the player like this (Where move=1 when user click right button, and move=2 when user click left button)

physicsWorld.registerPhysicsConnector(new PhysicsConnector(this, body, true, false) {
    if (move == 1) {
        body.setLinearVelocity(new Vector2(8, body.getLinearVelocity().y));
    } else if (move == 2) {
        body.setLinearVelocity(new Vector2(-8, body.getLinearVelocity().y));
    }
}

The Player moves smoothly form left to right and reverse. But sometimes, it is blocked.
If the player move back a bit, and back again where it is blocked, it isn't blocked any more at the same place.

Anyone has any idea to fix this? Maybe it is a bug of andengine and box2d and I need some trick here? Please help me. (The two sprites above are just normal png with 32x32px)

Player image:

Platform image:

sentences:
Creating proper jump mechanics in LibGDX with Box2D? I'm trying to create a proper jumping system for a 2D platformer with box2D, however, I'm not exactly sure how to make a good jumping system. Right now, I'm just doing

public void jump(float delta) {
    body.applyLinearImpulse(new Vector2(0, 7), body.getWorldCenter(), true);
}

What I want to do, is have a system like Mario's or Sonic's, where the height jumped is determined by how long the player held the jump button. How do I do something like that? Also, what's better, a rectangular box2D fixture, or an oval one? I'm sorry for such a newb question, and thank you for the help!

sentences:
3d transformation of game world keeping gameplay 2d - COCOS2D 2.0 I want to rotate the game world, may be loading another .tmx file for another dimensions when user want to switch dimension.

The effect what I am looking for is something like the 'side' transition in Fez.

What I have thought of till now:

rotating CCCamera will be mandatory.
Question: How will I have the other part of the level in place while the camera rotates/rotating?
I can load a CCSprite and rotate it accordingly to the 3rd dimension. phew..!!
Question: When the camera and world is rotated, will the player controls work properly.. I think not...?
I think a better option would be to checkout with COCOS3D... there I could implement 3d world... right?
Question: Not sure how well 2d dynamics will work there as I want to user Box2d as physics engine..

Could anyone provide suggestions?

sentences:
Texture coordinates do not map correctly in Direct3D11 game engine I beg your pardon if this question has been already answered elsewhere or if this is the wrong site, but I have a serious issue with rendering textures with Direct3D 11.

Using Cinema 4D R17, I created a simple cube, triangulated all polygons, and UV mapped a texture, as you can see here:

and it renders correctly.

Next, I exported the file to .x because I created a simpler mesh format and .x is ideal for getting vertices, indices, normals, texture coordinates, etc. This conversion is perfect as all data from the source file is successfully transferred to my file (I checked and double checked it).

However, when I upload the file in my game engine, I get the following result:
The cube is being rendered incorrectly where that strange pattern forms.

This is the original .x file (I included only relevant parts):

Mesh CINEMA4D_Mesh {
  8;
  // Cube. These are vertices.
  -0.01;-0.01;-0.01;,
  -0.01;0.01;-0.01;,
  0.01;-0.01;-0.01;,
  0.01;0.01;-0.01;,
  0.01;-0.01;0.01;,
  0.01;0.01;0.01;,
  -0.01;-0.01;0.01;,
  -0.01;0.01;0.01;;

  12;
  // Cube. These are indices.
  3;0,1,3;, // '3;' means that this face contains 3 vertices.
  3;2,3,5;,
  3;4,5,7;,
  3;6,7,1;,
  3;1,7,5;,
  3;6,0,2;,
  3;0,3,2;,
  3;2,5,4;,
  3;4,7,6;,
  3;6,1,0;,
  3;1,5,3;,
  3;6,2,4;;

  MeshNormals {
    8;
    // Cube
    -0.408;-0.408;-0.816;,
    -0.667;0.667;-0.333;,
    0.667;-0.667;-0.333;,
    0.408;0.408;-0.816;,
    0.408;-0.408;0.816;,
    0.667;0.667;0.333;,
    -0.667;-0.667;0.333;,
    -0.408;0.408;0.816;;

    12;
    // Cube
    3;0,1,3;,
    3;2,3,5;,
    3;4,5,7;,
    3;6,7,1;,
    3;1,7,5;,
    3;6,0,2;,
    3;0,3,2;,
    3;2,5,4;,
    3;4,7,6;,
    3;6,1,0;,
    3;1,5,3;,
    3;6,2,4;;

  }
  MeshTextureCoords {
    8;
    // Cube
    1.0;1.0;,
    0.0;1.0;,
    1.0;0.0;,
    1.0;1.0;,
    1.0;1.0;,
    1.0;0.0;,
    0.0;1.0;,
    1.0;0.0;;
  }
  MeshMaterialList {
    2;
    12;
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1;

    Material C4DMAT_NONE {
      1.0;1.0;1.0;1.0;;
      1.0;
      0.0;0.0;0.0;;
      0.0;0.0;0.0;;
    }
    Material C4DMAT_Mat {
      1.0;1.0;1.0;1.0;;
      1.0;
      0.0;0.0;0.0;;
      0.0;0.0;0.0;;
      TextureFilename {
        "tex.bmp";
      }
    }

    {C4DMAT_Mat}
  }
}

I also invert the vtexture coordinate (v = 1 -v). This is the vertex data I extract:

8 // Number of vertices.
-0.01 -0.01 -0.01 -0.01 0.01 -0.01 0.01 -0.01 -0.01 0.01 0.01 -0.01 0.01 -0.01 0.01 0.01 0.01 0.01 -0.01 -0.01 0.01 -0.01 0.01 0.01 // Vertices stored in X, Y, Z.
1 0 0 0 1 1 1 0 1 0 1 1 0 0 1 1  // Texture coordinates stored in U, V.
36 // Indices count.
0 1 3 2 3 5 4 5 7 6 7 1 1 7 5 6 0 2 0 3 2 2 5 4 4 7 6 6 1 0 1 5 3 6 2 4 // Indices.
tex.bmp // Texture file name.

I read that there might be a conflict between texture coordinates of vertices that are shared among different faces and that resolving this would imply not using index buffers.

EDIT: I did what @wondra said (replaced texture coordinates with 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 and it looks better indeed:

I am not sure what is wrong here. Could anybody help me? Thank you.

UPDATE: The Cinema 4D .obj is broken. Use Blender or anything else.

sentences:
Can not play a disabled audio source? I have 5 cubes and all 5 cubes have an audiosource. When my player jumps into those cubes, the audiosource is playing just once. It was working. But then, I decided to re-organize my hierarchy and audiosource didn’t work well.
When I jump to first cube, the audio plays but then if I try to jump to the other cubes, the audio does not play. I have a prefab cube and all 5 cubes are the created from that prefab. It gives Can not play a disabled audio source and I don’t know why?  I haven’t changed about coding part.
This is my first cube component :
The other 4 cubes (actually they all the same as with the first cube):

Coding Part :
//Eğer karakter ses efekti tamamlanmadan diğer paddle'a atlarsa paddle ses çıkarmıyor. Bunu düzelt

[SerializeField] AudioSource clickSound;

bool landedorNot = false;

void Start()
{
}

private void OnCollisionEnter(Collision collision)
{
    if (collision.gameObject.name == "Ship New Pos" && landedorNot == false )
    {
        landedorNot = true;

        if (!clickSound.isPlaying)
        {
            clickSound.Play(); // this is where the error occurs according to Unity
        }
    }
}

sentences:
SpriteBatch.Draw() rectangle is different from destinationRectangle passed in When I ask SpriteBatch to draw a rectangle as within the following method :

    public static void DrawSolidRectangle(Rectangle rectangle, Color color)
    {
        // the output from this is shown in the screenshot
        System.Console.WriteLine(rectangle.ToString());
        spriteBatch.Draw(pixel, rectangle, color);
    }

I am getting different sized rectangles to the rectangles I am providing. This is an issue I am having after resizing the window. As you can see in the screenshots, the difference in width of the two rectangles is only 2 pixels and there is an offset of 1 pixel, while the two gray rectangular draw results clearly have greater than a 3 pixel difference in width.

screen shot of issue http://users.tpg.com.au/gavinw77//SpriteBatchIssue.jpg

Does anyone know what's going on ? Is this a known issue with SpriteBatch or the BackBuffer after resizing or what ?

sentences:
Tilting towards turn direction (for a motorbike) I have a motorbike which moves along based on a direction vector, I set its forward direction to the direction it's moving.

What I'd like to also do with it is have the motorcycle tilt in the direction it's turning, I haven't had much luck figuring this out though, any ideas?

sentences:
Reducing APK File Size by using JPG instead of PNG for game background images I've just finished my (openGL ES 2.0 Android) game and it's almost ready for Alpha-testing.

When I export the application to an APK File, the file is taking up 16MB and I would like to reduce this as much as I can.

Here are some points about what the project contains and what I've tried to reduce the size already:

222kb of Ogg Vorbis files used for Sound Effects
1 x MP3 file at 5.59MB (128kbps Bitrate)
4 x sets of PNG files used for textures (XHDPI, HDPI, MDPI & LDPI - I'm not using XXHDPI)
Just over 1MB of code

What I've tried thus far to get where I am:

I've optimised the PNG files using Optiping
I've applied ProGuard to my code before exporting, this didn't really help by much as 99% of my app is resources.

So my question is, is there really much else I can do to reduce the size of the APK?  I was thinking about maybe using JPG format source files for my Background OpenGL textures instead of PNG - anyone have any experience with this?  Does it hurt performance at all?  I can see that it would make quite a difference - my atlas of backgrounds in PNG format for XHDPI is 1.7MB - and a 90% compressed JPG comes in at around 650KB.  I'm just not sure if it's a good idea as everyone always advocates PNG > JPG.

Any pointers from personal experience would be helpful & also if I've overlooked anything other than using JPG's.

sentences:
How can I make my players interested in the game lore of my MMORPG? In WoW (World of Warcraft), players skip all quest descriptions, and mindlessly spam "auto attack button", ignore the environment, lore, NPCs as they never existed. I.e., they enter a brain dead "mode". If you ask someone of them what he saw, he won't be able to remember a thing. Except the "Lvl 60" number.

I noticed that in my game, if I include lot of mobs i.e. 1 pack for every 10 seconds of distance traveled, the same effect happens. Players ignore all lore and are inflicted with amnesia.

I also noticed that if my dungeon starts empty e.g. the first 30 meters completely barren of mobs, the players go Lore heavy mode and spend every inch and cranny to find everything.

Question: How can I make a player switch to Normal Brain mode (craves for lore) after a group of enemies have been killed?

sentences:
Full-screen window hangs when debug break or crash (Windows/GLFW/Cocos2D) I run into an issue if my game application becomes unresponsive when running in fullscreen on Windows. This mostly applies when I want to use breakpoints in Visual Studio, however if the application crashes, such as from a memory error, the window doesn't close.

I don't think this is strictly a WGL/GLFW/Cocos2D problem, since I have seen this problem in other Windows games, including ones that use Direct3D.

I searched around, but I can't find a definitive answer as to what causes this problem or how to fix it. From what I have read, this issue is only supposed to be caused by using HWND_TOPMOST (or maybe HWND_TOP); however, even changing all uses of that in GLFW to HWND_NOTOPMOST doesn't seem to fix the problem.

I imagine that registering a custom signal handler using std::signal might work, but I am not sure which parts of the Windows API, if any, I should call in an exit handler, that would solve this problem.

sentences: Google Play Game Services (Unity Plugin) Turn Based Multiplayer List of Open Matches I took a closer look at Google Play games services Turn based multiplayer, and I cannot find out if I am somehow able to just get a list of all open matches, so that I can implement my own GUI. It seems really weird to me that they would not let you do such a simple task. Is this just a problem with the Unity implementation or is it a general problem? Using the Google UI would make a clunky feel which I would like to avoid.

sentences:
Am I hurting myself by not knowing C++ for game design? Right now, I feel I am strong in both Java a C#. (Not much of a leap from one to the other really).

While I don't expect a game designer/programmer is an attainable goal early on in my career, This is a goal I will reach later on in my career.

With this in mind, I feel that ignoring C++ and game design tools associated with it are eventually going to hurt me or slow me down in my ability to reach my goal.

Is this the case? Or can I continue to hone my C# skills using XNA and WPF for personal projects that can elevate me into such a career?

sentences: How do I convert from Cartesian to spherical coordinates? This seems like a fairly basic and common problem. Is there a builtin way to achieve it or do I have to write the algorithm on my own? If I do, how should it work?

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:
How to bind std::map to Lua with LuaBind Is this possible in lua to achieve?

player.scripts["movement"].properties["stat"] = "stand"
print (player.scripts["movement"].properties["stat"])

I've done getter method in c++ with this approach:

luabind::object FakeScript::getProp()
{
    luabind::object obj = luabind::newtable(L);

    for(auto i = this->properties.begin(); i != this->properties.end(); i++)
    {
        obj[i->first] = i->second;
    }

    return obj;
}

But I'm stuck with setter. The first line in lua code which I'm trying to set value "stand" for key "stat" is not going to work and it keep redirecting me to the getter method. Setter method only works when I drop ["stat"] from properties.

I can do something like this for setter in my script:

player.scripts["movement"].properties = {stat = "stand"}

But this isn't what I want because I have to go through my real keys in c++ to determine which key is placed in setter argument table value.

This is my map in class:

std::map<std::string, std::string> properties;

sentences:
Transparent image changing color to very light when used on light background in Unity I'm trying to use this transparent image (transparent brown, with a transparent white shadow):

over this background:

in Unity UI.
But the end result is not similar to what I see in photoshop at all.
What I expect and what I have inPhotoshop:

What I get in Unity:

How can I fix this?

sentences: Generate random number in Unity without class ambiguity I have a problem in Unity (C#) where I would like to create a random number. I wanted to use System.Random (reference: using System) but Unity complains that it's ambiguous to their own UnityEngine.Random. I can not specify the reference (using System.Random) as random is not a namespace. How do I specify that I want to use the system random and not the Unity one?

sentences:
Objects aren't rotating in sync This is a follow-up question to How to reapply force applied to one object to another object

  I want to make two objects move, react to collisions and other stuff as if they were one.
  For example, Objects A and B are entangled.
  When Object C rams into Object A and starts moving with it, Object B should start moving with it. When Object B hits a wall, Object A should act like it also hit a wall.
  I tried changing position/speed every frame, but this only works when done in one direction.
  Now, I want all forces applied to any of the objects to also apply to the other objects entangled to it.

Edit: This is the new code which only fails when multiple collisions happen at once

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

[RequireComponent(typeof(Rigidbody))]
public class EEScript : MonoBehaviour
{
    public List<EEScript> activeObjects;
    public new Rigidbody rigidbody;
    public Vector3 lastPosition;
    // Start is called before the first frame update
    void Start()
    {
        rigidbody = gameObject.GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        lastPosition = transform.position;
    }

    private void OnCollisionEnter(Collision collision)
    {
        foreach (EEScript entangled in activeObjects)
        {
            if (entangled == this) continue;
            Rigidbody rb = entangled.rigidbody;
            if (rb is null) continue;
            rb.velocity = rigidbody.velocity;
            rb.angularVelocity = rigidbody.angularVelocity;
            entangled.transform.position = entangled.lastPosition + transform.position - lastPosition;
        }
    }
}

sentences:
How to move a player (with camera) towards a target object until camera fill target object? I'm trying to solve this 'algorithm' problem.
I have a player and a camera on it. I want to automatically move this player towards a target object and stop it when target object completely "fit" my camera.
So my question is : how can I find target Vector3 player position, and camera rotation (up/down) to perfectly "view" an object ?
Consider that my target objects are simple Box.
Thanks
Edit:
X is the "right" transform.position to "full" see target object

sentences:
How to set the z axis bound of the collider of child of an instantiated object to zero I have attached a script to an empty GameObject to instantiate a prefab and the script is:
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using UnityEngine;

public class Circles : MonoBehaviour
{
    [SerializeField] float Xmax;
    [SerializeField] float Xmin;
    [SerializeField] float Ymax;
    [SerializeField] float Ymin;

    [SerializeField] float outsideMaxsize;
    [SerializeField] float outsideMinsize;
    float insideMaxsize;
    float insideMinsize;

    public GameObject[] enemy;
    GameObject enemyObject;

    int enemyNo;

    float Xpos;
    float Ypos;
    float outsideSize;
    float insideSize;

    // Start is called before the first frame update
    void Start()
    {
        enemyNo = Random.Range(0, 4);

      instantiator();
    }

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

    }
    public void instantiator()
    {
        Xpos = Random.Range(Xmin, Xmax);
        Ypos = Random.Range(Ymin, Ymax);

        outsideSize = Random.Range(outsideMinsize, outsideMaxsize);

        Vector2 circlePos = new Vector2(Xpos, Ypos);
        transform.position = circlePos;

        enemyObject = GameObject.Instantiate(enemy[enemyNo], transform.position, transform.rotation,transform.parent) as GameObject;

        var enemies = enemyObject.transform;
        var outsideComponent = enemies.GetChild(0);
        var insideComponent = enemies.GetChild(1);
        outsideComponent.transform.localScale=new Vector2(outsideSize, outsideSize);
        insideMaxsize = outsideSize * 0.5f;
        insideMinsize = 0.15f;
        insideSize = Random.Range(insideMinsize, insideMaxsize);
        insideComponent.transform.localScale = new Vector2(insideSize, insideSize);

        enemyNo = Random.Range(0, 4);
    }
}

And I have attached a script to the prefab which is being instantiated and that script is:
 using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class destroyer : MonoBehaviour
{

    Circles circles;

    CircleCollider2D collider1;
    Collider2D collider2;

    private void Start()
    {

        circles = FindObjectOfType<Circles>();

        print("1 max"+collider1.bounds.max);
        print("1 min" + collider1.bounds.min);
        print("2 max" + collider2.bounds.max);
        print("2 min" + collider2.bounds.min);

    }

    private void OnEnable()
    {
        collider1 = gameObject.transform.GetChild(0).GetComponent<CircleCollider2D>();
        collider2 = gameObject.transform.GetChild(1).GetComponent<Collider2D>();
    }

    void OnTriggerStay2D(Collider2D other)
    {
        print("star max"+other.bounds.max);
        print("star min" + other.bounds.min);

        if (collider1.bounds.Contains(other.bounds.max) && collider1.bounds.Contains(other.bounds.min))
       {

            if (other.bounds.Contains(collider2.bounds.max) && other.bounds.Contains(collider2.bounds.min))
            {

                    Destroy(other.gameObject);
                    Destroy(gameObject);
                    circles.instantiator();

            }

        }
    }
}

the problem is that the z axis bounds of the colliders are coming out to be 15.8
when the prefab is instantiated and when I drag the prefab to scene then the z axis bounds of the collider is 0. I want the z axis bounds of the colliders to be 0 when the prefab is instantiated

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:
What component should hold the bool attack and vector target? I am having trouble thinking of what component should hold the attack and target data. In the below code components are holding a redundant data which I want to eliminate.

public class PlayerComponent implements Component {
    public boolean attack = false;
    public Vector2 target = new Vector2();
}

public class PoliceComponent implements Component {
    public boolean attack = false;
    public Vector2 target = new Vector2();
}

public class CriminalComponent implements Component {
    public boolean attack = false;
    public Vector2 target = new Vector2();
}

I ended up creating an CombatComponent that holds the both attack and target, but I doubt there is more better way. The purpose is to have a weapon system the check if the player or enemy trigger attack and get its target.

private void processWeapon() {
    for (Entity weapon: weaponEntities) {
        AttachmentComponent attachment = Mapper.attachment.get(weapon);
        if(playerFamily.matches(attachment.owner)) {
            PlayerComponent player = Mapper.player.get(attachment.owner);
            CombatComponent combat = Mapper.combat.get(attachment.owner);
            if( combat.attack ) {
                WeaponComponent weaponComponent = Mapper.weapon.get(weapon);
                weaponComponent.use = true;
                weaponComponent.target.set(player.target);
            }
        }
    }
}

or the another way calling the WeaponSystem to use the owner weapon.

getEngine().getSystem(WeaponSystem.class).useWeapon(ownerEntity, targetPosition);

sentences:
When I start running, it won't stop when I let go of shift. Why? Following is my code, and after I let go of shift the image speed goes back to normal but not the variable I created called movespeed. What should I add or change to fix it?

//Run with left shift
if (keyboard_check(vk_lshift))
{
     movespeed = 5;
     image_speed = 0.14;
}

sentences:
Inverse kinematics behaving weirdly/ I have been trying to figure out why my player character crouches like this when I use inverse kinematics on it. I followed this tutorial:

https://docs.unity3d.com/Manual/InverseKinematics.html?_ga=2.157285243.1916573353.1569208906-694809292.1561053348

but then the weirdness in the picture above happens. What is going on?

In case It helps, I used makehuman to make the player model, and used its "Game Engine" rigging option.

EDIT: Here are some additional pictures after I remade the project:

I left look obj blank because all it does is makes the player's head look a certain direction.

sentences:
Is there any specific reasons to include clearly inferior options in a game? Games contain inferior options
A lot of games that I have played contain some optimal options and some clearly inferior ones. Sometimes, like in Heroes of Might&Magic IV, it could happen due to the limited time the developers had to balance it (e.g. Academy benefits so much more from choosing Gold Golems and then Genies rather than Magi and Naga that there is no reason to go the second way).
Sometimes it happens for no apparent reason
However, it often happens that the developers clearly had enough time to polish the game, didn't go bankrupt after its release etc., but it is still full of "trap" options that sound cool, but are actually inferior to something always available in the same situation, or almost always available in similar situations.
There are just so many examples of such, almost every game has something like that. For example, Age of Wonders I began a successful series thga, but a lot of abilities to be chosen for the heroes are clearly underperforming, and a lot of units have clearly better alternatives on the same levels in the same factions.
It is important that while some very overpowered stuff often gets nerfed (like it also happened in AoW I), the obviously underpowered choices often stay as they are (as it also happened there).
So, I ask: Why do game developers create clearly inferior options in their games and don't rebalance them? Is it intentional? If it can be avoided -- how?

sentences:
DirectX post-processing pipeline I'm trying to make a simple post processing pipeline, depicted as follows with 3 effects in this case:

        |------|    |------|    |------|
   I -->|Shader|-O->|Shader|-I->|Shader|-O->
        |------|    |------|    |------|

I and O stand for a pair of 2 ShaderResourceViews/RenderTargetViews.

My plan was to do the following:

Create a shader resource and render target for each the input and the output
Apply the shader
Swap input and output to be used for the next shader
Goto 2.

This sounds somewhat confusing, but basically the same 2 ShaderResourceViews /RenderTargetViews should be reused for each stage of the post processing pipeline.

Is this possible, or do I have to create separate input and output ShaderResourceViews /RenderTargetViews for each stage of the postprocessing pipeline?

sentences:
Tiled - move all tiles I'm making a map in Tiled.

I quickly ran out of room in the north of my map and would like to "shift" the tiles down. I'd prefer not to have to redo each of the tile layers.

Is this possible?

This is a picture of my minimap. I'd like to move them down around the red square.

sentences:
Game Institute Math Courses I'm 21 years old and I suck at math, I mean really bad. I don't have the necessary logic to apply it towards programming. I would like to learn the math and logic of applying it. I found Game Institute (http://www.gameinstitute.com) awhile back and heard a lot of praise about them. Are there Math courses any good?

Thank you.

Edit: My high school was terrible and did not prepare me for any math. I am fairly decent at programming, I just don't have the logic to apply any mathematics to programming, as an example I don't understand the algorithm of finding the size of a user's screen.

Yes I have heard of KhanAcademy (http://www.khanacademy.org/) and I have completed a lot of maths on his website but I still don't have the logic to apply any of it to programming.

sentences:
Implement a Vision cone in 3D I'm looking at how to implement a vision cone for my AI. Everything I look at talks about a forward vector, but in my situation, and I'm not that great with math, I have a vector but it doesn't give any orientation just the 3D point of where the entity is. The entity does have a separate rotation value. When people talk about forward vector are they talking about the rotation vector?

So if I just have a rotation vector and a location vector how can I make a vision cone in 3D from those values with say a variable degree of vision in both "left/right" and "up/down"?

I have some math functions available like ATan2()/Tan(). Not 100% sure how those play into this though.

sentences:
creating levelup stats based on curves I'm creating a simple level-up system and I'm looking to base the stats gain on curves so I can tweak them easier, I know it's a math function, but I have no idea what to search for.

I need to create this curve and get the value every x increment.

the engine I'm using is Ren'py and the language python. if you can tell me the terms to search for, I might be able to find something on the topic.

sentences:
Gldraw call asynchronous or not When i call gldrawarrays with a large set of data will the function return only after drawing all the vertices or will it happen asynchronously b/w cpu and gpu?

Also how does vsync work. Aren't they related?

sentences:
Continuous world and camera problem I have this problem where I split my big world into chunks and I don't know how to draw it into my game camera's view. Each world chunk has its own coordinate system, so when object reaches border of one chunk and steps into another - coordinate system resets to zero. For example from world_x = 1440 into world_x = 0.

To draw only those objects that are in the camera's view, I use code:

int screenX, screenY; //screen position of the object being drawn

screenX = object.x-camera.x;
screenY = object.y-camera.y;

The problem appears when camera sees two different chunks. Lets say camera's coordinates are:

screenX = 567
screenY = 0

My drawable object is at

world_x = 1266
world_y = 0

In this case object's screen coordinates are (x)699, because screenX = object.x-camera.x. But what if camera stays in the same place and object finally reaches different chunk. Object's coordinates are reset to zero. That means that its screen coordinates becomes (x)-567.

That screen coordinates conversion would work if I would be doing non partitioned game world, but now it don't. Any ideas?

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:
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:
How do I move Space Invaders like enemies in groups efficiently? So like the title says I want my Enemies to move on a Grid like in Space Invaders. Say I have 8 rows and 12 columns. Now there are 10 Enemies in each row and there are 5 rows filled. In total I have 50 Enemies. Since I am using OOP I got 50 Objects. Now I want to shift all Enemies from left to right as far as possible. So if all Enemies are alive I can shift them 2 to the right and 2 to the left. If I destroy all Enemies in a column the Enemies can shift 3 to the left and to the right.

How do I check efficiently how many times I can shift over / check if a column is empty. How should I initialize the grid and shift all Enemies by one? For me this looks like it could get pretty laggy if I don't make it efficiently. Note: All Objects are dynamically allocated and I am using C++.

I hope I could make it clear. If you guys don't understand it, I could try to explain it a bit better.

sentences:
Checkers games with computer random movement Im studying Java OOP, and I have to make first assignment about making checkers board game. I have to get input from user if he plays, and than when his turn is over the computer will play. Computer's movement is random but if he has the opportunity to "eat" his rival, he has to do this and if not than making random move.
Can someone help me with the coding?

sentences:
Movement on Multiplayer Games I'm developing a JavaScript Multiplayer Game (Using NodeJS and Socket.IO). The problem I'm having is, on a Player's movement, the Event with the X and Y positions is sent to the server and then to all the other Players on that Server. Now, on a 60 FPS Machine, the event is sent to the server 60 times a second, resulting on smooth movement on all other Machines with 60 FPS. However, on a 30 FPS Machine, it's only sent 30 times a second, resulting on jumpy movement on higher FPS Machines (E.g. 60 FPS).

Is there any way to resolve this problem?

Thanks!

sentences:
c++/openGL 3D Bouncing Cube I'm trying to write a little program with a bouncing cube but I can't find the right values for it.
I have these lines:
modelMatrix = glm::mat4(1)

modelMatrix *= Translate(x, y, z)

modelMatrix *= RotateOZ(angle)

RenderMesh(mesh["cube"], shaders["V"], modelMatrix)

I add/sub the y in a interval and the angle too.I have a problem because I don't really know with which values to increment/sub these values.

I want the same effect as in the image but at all angles [0 - 180].
EDIT++
So I want my cube to bounce while it's rotating like in the image. First the cube will have the arrow down to show what's his position first at y0 and x0. Then he will rotate in the [0 - 90] range. I want the cube to have the arrow up meaning that the cube will be rotated at 90 angle when he will hit y1 and x1/2. Then he will start to descend at an angle [90 - 180] so he will be at y0 but with at x1.
I tried incrementing the x, y and the angle with a small value like 0.1 and then decreasing the y when it hit a point. The result is close but I can see that it's not perfect.
I hope that made sense.
Thank you for your time!

sentences:
Should the world transformation matrix be stored in a constant buffer when rendering? Generally when rendering objects you would:

Apply world transformation to go from object space to world space
Apply view transformation to go from world space to camera space
Apply perspective projection transform to go from camera space to canonical view volume

In a normal situation, you only have a single camera and screen to work with so you only have one each of view transform matrix and projection transform matrix to render a frame. So, before the rendering begins, you need to put all this info in a constant buffer. So that the vertex shader can transform the vertices per objects into a world matrix.

Considering you need a (probably unique) world transform matrix for each object, how is this process actually done in practical situations?

The easiest and obvious solution I can think of is to put world matrices in a constant buffer but if I am not mistaken from the architecture of video card memory, you are not able to dynamically allocate constant buffers. I can think of this being a big problem because in real situations, the number of objects to be rendered would vary each frame.

A tutorial I came across handles this situation in a rather concerning way. If object A, B, C exists, instead of passing all objects to the vertex shader, it would go through the following process:

Add world matrix of object A into a constant buffer then draw the object A
Add world matrix of object B into a constant buffer then draw the object B.
Add world matrix of object C into a constant buffer then draw the object C.

This works, but this seems really counter-intuitive from a performance perspective as you have to do a lot of synchronization for a simple rendering process. Not to mention drawing operation becomes O(n) for the number of objects. It also doesn't fit too well with the philosophy of shader process where parallel processing is heavily favored.

So I had a random thought for a potential solution: you would first dynamically allocate memory size of (XMMatrix) * (Object Count) on the GPU, and when transforming from vertex from vertex shader, you would select which matrix to use from list of world matrices. This seems very doable in CUDA but not too sure about HLSL . Is this idea even legit to begin with?

I guess you could also somehow send the vertices of the object located in world space directly to the vertex shader.

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

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

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

sentences:
2D Per Pixel Collision Detection using Animated Sprite I am using MonoGame 3.6 and Visual Studio 2017.

I have been trying to find a solution online to do per pixel collision detection using an animated sprite that I am drawing from a sprite sheet.

Using the following code which is not working:

The BoundingRectangle and Position on the AnimatedSprite.cs

public Vector2 Position
    {
        get { return position; }
        set
        {
            position = value;
        }
    }

public virtual Rectangle BoundingRectangle
    {
        get
        {
            return new Rectangle(
                (int)Position.X,
                (int)Position.Y,
                Width,
                Height);
        }

    }

public static bool CheckForPixelCollision(AnimatedSprite a, AnimatedSprite b)
    {
        // Get Color data of each Texture
        Color[] dataA = new Color[a.Width * a.Height];
        Color[] dataB = new Color[b.Width * b.Height];

        a.Texture.GetData(0, a.Animations[a.CurrentAnimation].CurrentFrameRect, dataA, 0, a.Width * a.Height);
        b.Texture.GetData(0, b.Animations[b.CurrentAnimation].CurrentFrameRect, dataB, 0, b.Width * b.Height);

        int top = Math.Max(a.BoundingRectangle.Top, b.BoundingRectangle.Top);
        int bottom = Math.Min(a.BoundingRectangle.Bottom, b.BoundingRectangle.Bottom);
        int right = Math.Max(a.BoundingRectangle.Right, b.BoundingRectangle.Right);
        int left = Math.Min(a.BoundingRectangle.Left, b.BoundingRectangle.Left);

        for (var y = top; y < bottom; y++)
        {
            for (var x = left; x < right; x++)
            {
                Color color1 = dataA[(x - a.BoundingRectangle.Left) + (y - a.BoundingRectangle.Top) * a.Width];
                Color color2 = dataB[(x - b.BoundingRectangle.Left) + (y - b.BoundingRectangle.Top) * b.Width];

                if (color1.A != 0 && color2.A != 0)
                    return true;
            }
        }

        return false;
    }

When I run this code, I get OutOfRangeException when it tries to get the color out of the array. I am trying to achieve the following steps:

1) Extract the colors from both AnimatedSprites from their SpriteSheet only for the current frame that is drawing from the Animation

2) Check if any of the pixels in the intersecting rectangle are not transparent and return a collision.

An example of how the code will be called when checking Player movement capabilities:

                var nextPosition = (Sprite.Position + (motion * PlayerSpeedAmplifier));
                var playerTempRectangle = new Rectangle((int)nextPosition.X, (int)nextPosition.Y, PlayerCurrentRectangle.Width, PlayerCurrentRectangle.Height);
foreach (var enemy in listOfEnemies)
                {
                    if (playerTempRectangle.Intersects(enemy.EnemyCurrentRectangle))
                    {
                        if (Helper.CheckForPixelCollision(Sprite, enemy.Sprite))
                        {
                            canMove = false;
                            break;
                        }
                    }
                }

I hope someone can please help. Let me know if you need any additional information.

sentences:
Unity ad does not show I have imported the advertisement package from the package manager, turned the ads service on, and added a script:
string gameId = "correctGameId";
bool testAds = true;
void Start(){
    Advertisement.Initialize(gameId, testAds);
}

void Click (){
    if(Advertisement.isInitialised){
          Advertisement.Show();
    }
}

This Click function is called from a button's OnClick event.
Every time I play in the editor and click the button, nothing happens.
How can I make my advertisement show?

sentences:
DX11 Camera not working properly I'm currently trying to implement a ArcBall Camera which should fly around a given XMFLOAT3 position stored in a cb with a spezified distance to the position. I used the code from Allen Sherrod for this but the constant buffer that should pass the viewmatrix and the second one for the position to the shaders doesn't update. Any ideas?

This should return the view mat:

    XMMATRIX ArcCamera::GetViewMatrix()
{
    XMVECTOR zoom = XMVectorSet(0.0f, 0.0f, distance_, 1.0f);
    XMMATRIX rotation = XMMatrixRotationRollPitchYaw(xRotation_, -yRotation_, 0.0f);

    zoom = XMVector3Transform(zoom, rotation);

    XMVECTOR pos = XMLoadFloat3(&position_);
    XMVECTOR lookAt = XMLoadFloat3(&target_);

    pos = lookAt + zoom;
    XMStoreFloat3(&position_, pos);

    XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 1.0f);
    up = XMVector3Transform(up, rotation);

    XMMATRIX viewMat = XMMatrixLookAtLH(pos, lookAt, up);

    return viewMat;
}

The rotation (xRotation, yRotation) increases every frame.

The shaders:

Texture2D colorMap : register( t0 );
SamplerState colorSampler : register( s0 );

cbuffer cbChangesEveryFrame : register( b0 )
{
    matrix worldMatrix;
};

cbuffer cbNeverChanges : register( b1 )
{
    matrix viewMatrix;
};

cbuffer cbChangeOnResize : register( b2 )
{
    matrix projMatrix;
};

cbuffer cbCameraData : register( b3 )
{
    float3 cameraPos;
};

struct VS_Input
{
    float4 pos  : POSITION;
    float2 tex0 : TEXCOORD0;
    float3 norm : NORMAL;
};

struct PS_Input
{
    float4 pos  : SV_POSITION;
    float2 tex0 : TEXCOORD0;
    float3 norm : NORMAL;
    float3 lightVec : TEXCOORD1;
    float3 viewVec : TEXCOORD2;
};

PS_Input VS_Main( VS_Input vertex )
{
    PS_Input vsOut = ( PS_Input )0;
    float4 worldPos = mul( vertex.pos, worldMatrix );
    vsOut.pos = mul( worldPos, viewMatrix );
    vsOut.pos = mul( vsOut.pos, projMatrix );

    vsOut.tex0 = vertex.tex0;
    vsOut.norm = mul( vertex.norm, (float3x3)worldMatrix );
    vsOut.norm = normalize( vsOut.norm );

    float3 lightPos = float3( 0.0f, 500.0f, 50.0f );
    vsOut.lightVec = normalize( lightPos - worldPos );

    vsOut.viewVec = normalize( cameraPos - worldPos );

    return vsOut;
}

float4 PS_Main( PS_Input frag ) : SV_TARGET
{
    float3 ambientColor = float3( 0.2f, 0.2f, 0.2f );
    float3 lightColor = float3( 0.7f, 0.7f, 0.7f );

    float3 lightVec = normalize( frag.lightVec );
    float3 normal = normalize( frag.norm );

    float diffuseTerm = clamp( dot( normal, lightVec ), 0.0f, 1.0f );
    float specularTerm = 0;

    if( diffuseTerm > 0.0f )
    {
        float3 viewVec = normalize( frag.viewVec );
        float3 halfVec = normalize( lightVec + viewVec );

        specularTerm = pow( saturate( dot( normal, halfVec ) ), 25 );
    }

    float3 finalColor = ambientColor + lightColor * diffuseTerm + lightColor * specularTerm;

    return float4( finalColor, 1.0f );
}

Must I update all subresources and stuff before every time I call the context's draw method to render every my objects by the way?

sentences:
How can I adjust the origin for 2D UI in OpenGL? As I am quite used to screen geometry, where 0,0 is at the top left corner or the screen (as it is for just about every desktop app and Web app in the world), but I find it very hard to actually implement a UI in OpenGL since it's coordinate system is vertically inverted from what I have always worked with.

I'm trying to implement a GUI for a plugin for the game Rising World, and this is driving me crazy.

The added restriction that I have is that I do not have access to the actual screen resolution, but can only achieve full screen width and height using relative positioning and size (from 0 to 1). Sure, I can use pixels to position shapes and controls, but I cannot say, for example : place this at 50% - 20 pixels; it is either one or the other per shape.

I am Googling for things I can read about UI design with "inverted" Y coordinates (i.e. since we read from top to bottom, it is inverted to me), but I can't find anything relevant. And since I cannot use any third party GUI library but what the game is offering, I am restricted to basic shapes and positioning (i.e. doing things 100% manually).

Is there a way in this context that I can author my UI in a coordinate system where the origin is the top-left?

sentences: So, I need to create varied animal textures for my game. How would I go about doing that? For example, one of the creatures planned is an isopod like animal. Would I need to get pictures of real animals and adjust them to my needs?

sentences:
Brief pause after keypress After i press and hold the key it goes forward once then pauses for a second or less then goes forward on forever. My problem is the brief pause I cant locate the issue. Thanks for your help.

    while(game){
        while (SDL_PollEvent(&e)){
            mainChar.manageEvents(e);
        }
        background.renderChar();
        mainChar.renderChar();
        SDL_RenderPresent(ren);

    }
void Character::manageEvents(SDL_Event event)
{
    switch(event.type){
        case SDL_KEYDOWN:
            KEYS[event.key.keysym.sym] = true;
            printf("true");
            handleInput();
            break;
        case SDL_KEYUP:
            KEYS[event.key.keysym.sym] = false;
            printf("false");
            break;
        default:
            break;
    }
}
void Character::handleInput()
{
    if(KEYS[SDLK_a]) {
        dst.x--;
    }
    if(KEYS[SDLK_d]) {
        dst.x++;
    }
    if(KEYS[SDLK_w]) {
        dst.y++;
    }
    if(KEYS[SDLK_s]) {
        dst.y--;
    }
}

sentences:
Explicit difficulty selection without breaking the game flow According to the flow theory, in short, if the challenge is too hard, from flow state the player will go into an anxiety state, and if the challenge is too easy, he will go into a boredom state. This is fixed with dynamic difficulty, where a system tracks the player's performance and adjusts the difficulty.

But what about explicit difficulty selection which is often seen in shooters (Easy, Medium, Hard)? With such predefined difficulties, the challenge will always be either too easy or too hard, won't it? Therefore we cannot achieve a flow state, and following that, an immersion into the game is less likely. How do we fix this?

sentences:
How to implement custom texture formats in Android? What I know:
Android can load PNG, BMP, WEBP,... via BitmapFactory.

What I want to achive:
Load my own 2D file format (e.g. 1-bit texture with a 1-bit alpha channel) and output a RGBA8888 texture.

Question:
Is there any interface to achieve this?(or any other way)

The resulting image is used as a texture for a 3D model.

Why would you do that?
Saving phone memory and download bandwidth while expanding the texture at runtime to RAM seems reasonable for very simple textures.

sentences:
Changing contents of level depending on which character was selected I'm trying to create a character selection menu in Unity, where each character has their own version of the level that follows.

There are about 10 characters. Each character has a different location where they spawn in the level, and each enemy has a different spawn position as well, depending on which character was selected.

What I have been doing is to create separate levels (scene files) for each character. Then in the character selection menu, I load the level depending on the level selected by the user.

This seems to be a lot of code and data repetition, as the scene is the same in all levels; it's just that the spawn positions and enemies are different.

Is there any way have only one level scene, and get the spawn position and enemy spawns based on the character?

This is the code I have so far in GameManager.cs:

public GameObject enemy;
public Transform enemySpawnPoint;

public GameObject player;
public Transform playerSpawnPoint;

public static GameManager instance;

private void Awake()
{
    if (instance == null)
    {
        instance = this;
    }
}

void Start()
{
    StartCoroutine("SpawnEnemies");
    SpawnPlayer();
}

IEnumerator SpawnEnemies()
{
    while (true)
    {
        yield return new WaitForSeconds(1.0f);
        SpawnEnemy();
    }
}

public void SpawnEnemy()
{
    Vector3 enemySpawnPos = enemySpawnPoint.position;

    Instantiate(enemy, enemySpawnPos, Quaternion.identity);

}

public void SpawnPlayer()
{
    Vector3 playerSpawnPos = playerSpawnPoint.position;

    Instantiate(player, playerSpawnPos, Quaternion.identity);

}

...and the character selection script:

public void Level1()
{
    SceneManager.LoadScene(1);
}

public void Level2()
{
    SceneManager.LoadScene(2);
}

// ...

public void Level10()
{
    SceneManager.LoadScene(10);
}

Now the issue is, if I want to make any changes in one scene, like the skybox or background color, I will have to open all the other level scenes and make the changes.

Another thing is that if I want to add new levels, I will have to do the same thing, which seems like a lot of repetition.

Is there some way to set the enemy prefab, enemy spawn positions, player prefab and player spawn position once the character has been selected?

For example, if the user clicks on level1, all the preceding variables are set automatically and so on.....

sentences:
Why the transform never rotate between the range angle of 70 and -70? When running the game the rotationRange is always 0.

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

public class Rotateturret : MonoBehaviour
{
    public enum RotateOnAxis { rotateOnX, rotateOnY, rotateOnZ };
    public bool randomRotation = false;
    [Range(0, 360)]
    public int rotationRange = 70;

    private void Start()
    {

    }

    private void Update()
    {
        if (randomRotation == true)
        {
            rotationRange = Random.Range(rotationRange, -rotationRange);
            transform.Rotate(Vector3.right, rotationRange);
        }
    }
}

I want it to rotate on the x axis between 70 and -70

sentences:
Kinematic rigidbodies push each other in unet https://youtu.be/j3f44E-ExLc
I have a bunch of rigidbodies on each player, ALL set to kinematic. And this stuff happens. All the sword swinging is animation state driven, and basic back and forth and sideways motion is using Rigidbody.MovePosition. There is not supposed to be any rotation on the players' local x axis. This only seems to happen using Unet networking . Any ideas how to fix this?? Thanks!

sentences:
How do you prepare for out of memory conditions? This can be easy for games with well defined scope, but the question is about sandbox games, where the player is allowed to create and build anything.

Possible techniques:

Use memory pools with upper limit.
Delete objects that are no longer needed periodically.
Allocate extra amount of memory at the beginning so it can be freed
later as a recovery mechanism. I would say around 2-4 MBs.

This is more likely to happen in mobile/console platforms where memory is usually limited unlike your 16 GB PC. I am assuming you have full control over memory allocation/deallocation and no garbage collection involved. That's why am tagging this as C++.

Please note that I am not talking about Effective C++ Item 7 "Be prepared for out-of-memory conditions", even though it's relevant, I would like to see an answer more related to game development, where you usually have more control over what's happening.

To summarize the question , how do you prepare for out of memory conditions for sandbox games, when you are targeting a platform with limited memory console/mobile ?

sentences:
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:
Poor image quality on Android through Unity Remote I have started to work on the company's latest project using Unity3D and the workflow is just awesome.

The problem is when running the game on a real Android device (using Unity Remote) the image quality is very poor in comparison to how it looks in the editor:

(Click for a full view. Look at those sprite edges.)

Is this...

caused by the phone's limited graphics capabilities
or have I configured the project improperly
or is it Unity Remote and actually building it for Android will fix the quality? (Based on Unity Answers site, Unity Remote is the cause : http://answers.unity3d.com/questions/408896/android-image-quality-is-poor-compared-to-the-qual.html#comment-408945)

sentences:
Scaling bodies in box2d and libgdx Is there a way to scale the bodies made from vertexes (like a guitar), i was trying to multiply each vertex point by the scale value but c++ mark an assertion failed, is there a mehtod to do this?

I have done it, but i want to make a mirror body, but i cant do it :/ just multplying it by -1 or 1 it doesnt run :/

sentences:
SlimDX: Error while loading Effect Im trying to load a effect in SlimDX, but I get a error when I try to get the ShaderSignature.
The error-code:

E_FAIL: An undetermined error occurred (-2147467259)

This is my code:

   EffectTechnique tech = this.effects.GetTechniqueByIndex(0);
   EffectPass pass = tech.GetPassByIndex(0);
   ShaderSignature shaderSignature = pass.Description.Signature;

Any idea?

sentences:
Call touchUp() programattically for sprite in LibGDX I'm trying to call touchUp() for a sprite i've created in my app.

i'm getting success but the co-ordinates do not match while i call it manually.

final int x = (int)mySprite.getX() + 10;
final int y = (int)(Gdx.graphics.getHeight() - (mySprite.getY() - 5));

touchDown(x, y, 0, 0);

this code calls method perfectly but positions do not match. x and y values that i get in touchUp() method is different. it call touch up event of another sprite.

sentences:
Low CPU/Memory/Memory-bandwith Pathfinding (maybe like in Warcraft 1) Dijkstra and A* are all nice and popular but what kind of algorithm was used in Warcraft 1 for pathfinding?

I remember that the enemy could get trapped in bowl-like caverns which means there were (most probably) no full-path calculations from "start to end".
If I recall correctly, the algorithm could be something like this:

A) Move towards enemy until success or hitting a wall

B) If blocked by a wall, follow the wall until you can move towards the enemy without being blocked and then do A)

But I'd like to know, if someone knows :-)

[edit] As explained to Byte56, I'm searching for a low cpu/mem/mem-bandwidth algo and wanted to know if Warcraft had some special secrets to deliver (never seen that kind of pathfinding elsewhere), I hope that that is more concordant with the stackexchange rules.

sentences:
Can I add extra widgets to a child widget in UMG-UE4? I have a widget base class and I would like to reuse (logic and wigdets as well) it.
I created an empty widget and set the parent class to the base class I would like to inherit from in the class settings.
Works fine.
But when I am trying to add any widget on top the pre-existing ones just disappear, they get overridden by the children, I guess.
I found this post for a feature request, but it is quite old.
Just wondering if it is possible to add extra widgets without getting rid of the parent ones?

sentences:
Issues with importing bezier curve animation (curve does not distort?) Hi guys i'm pretty new to unity and having a frustrating issue; I've created a spear gun with an animation using a bezier curve grouped to the main gun shaft and distorted using a bone (bone relative) in blender. It works fine in blender, however when I export it into unity 5, the bezier curve does not distort and simple moves forward and back. I imported the blender model as a blender file.

I have tried pairing the model components in all the ways i can think of to see if that was the problem? I have attached the blender views and animations and what it looks like in Unity.

Is it an issue with unity being unable to animate bezier curve animations or the type of bone pairing i used??

unity animation, see the besiel curve simple moves forward and back instead of bending/distorting to look like a rubber fitted on a real gun!

sentences:
Getting an images rgb value at click I'm not sure if this is at all possible, but maybe it will spark up an interesting conversation. (Sidenote: working on a small game in Löve).

I'm making an archery shooting kind of game, and I was thinking it might be cool to have critical and regular hits based on where the user shoot the arrow at the enemy. Example, if I have a troll image, and the user clicks the head of the troll, it will count as a critical hit.

Checking to see if the user clicked on the top part of the image vs the bottom, isn't the tricky part. The hard bit will be to check if the user clicked on apart of the image, instead of blank space in the png...

So, main question: Is it possible to get the rgb value of where an image has been clicked, to determine if they hit or missed the target.

Also, if this is at all possible, is there anyone familiar with Löve that can confirm it is doable?

Edit: I'm realizing now it's not the rgb value I want to look for, it is whether or not the clicked pixel has transparency. If it is 100% transparent that means the user missed the image.

sentences:
Rotate player to face direction it's moving in 3D space I'm making a 3D game in XNA4.0. How do I rotate a model to face the direction that the user is pressing. I assume I need to set its look at to the direction being pressed, but can't figure out how to do that.

Cheers.

sentences:
Follow Camera to Two objects at different time I am developing simple 2D game in unity. I am locked with the camera movement for last two days. I've camera script that is working as follows:

Follow the player to X and Y direction
If player stops moving, Camera must find the nearest enemy and should move to that direction

Both of the above function works fine, but separately.

Camera finds and follows the enemy, when there is no input from player for last 10 seconds.

But after few seconds (When stops following enemy), Camera retains the player's position. That creates unlikely effect in the scene. I want the camera to have a last position and started following player from there.

For your reference I'm writing my Camera Script.

public class MultipleTargetCamera : MonoBehaviour {   public List<Transform> targets;
[ReadOnly]
public GameObject closestEnemy = null;

public EnemyController closestEnemyController = null;

public Vector3 offset;
public float smoothTime = 0.5f;

private Vector3 velocity;

Vector3 camPosition;

// Update is called once per frame
void LateUpdate()
{
    /* if (targets.Count == 0)
         return;*/
    if (!TheGlobals.instance.movingTowardsEnemy)
    {
        MoveCamera();
    }
    else
    {
        MoveAsEnemy();
    }
}

void MoveAsEnemy()
{
    camPosition = new Vector3(transform.position.x + closestEnemyController.xDiff,
            transform.position.x + closestEnemyController.yDiff,
            transform.position.z);
    transform.position = Vector3.SmoothDamp(transform.position, camPosition, ref velocity, smoothTime);
}

void MoveCamera()
{
    Vector3 centerPoint = GetCenterPoint();

    Vector3 newPosition = centerPoint + offset;

    transform.position = Vector3.SmoothDamp(transform.position, newPosition, ref velocity, smoothTime);
}

Vector3 GetCenterPoint()
{
    Vector3 targetPos= new Vector3(targets[0].position.x,
        targets[0].position.y,
        transform.position.z);

    if(targets.Count==1)
    {
        return targetPos;
    }

    var bounds = new Bounds(new Vector3(targets[0].position.x,
        targets[0].position.y,
        transform.position.z), Vector3.zero);

    for(int i=0;i<targets.Count;i++)
    {
        bounds.Encapsulate(new Vector3(targets[i].position.x,
        targets[i].position.y,
        transform.position.z));
    }

    return bounds.center;
}

public void FindNearestEnemy()
{
    GameObject[] gos;
    gos = GameObject.FindGameObjectsWithTag("Enemy");

    float distance = Mathf.Infinity;
    Vector3 position = transform.position;
    foreach (GameObject go in gos)
    {
        Vector3 diff = go.transform.position - position;
        float curDistance = diff.sqrMagnitude;
        if (curDistance < distance)
        {
            closestEnemy = go;
            distance = curDistance;
        }
    }
    closestEnemyController = closestEnemy.GetComponent<EnemyController>();
    targets[0].parent = this.transform;
    StartCoroutine(StopMovingTowardsEnemy());
}

IEnumerator StopMovingTowardsEnemy()
{
    yield return new WaitForSeconds(0.01f);
    TheGlobals.instance.movingTowardsEnemy = false;
}

}

I hope I did explain well. Looking for the answer. Thank you in advance!

sentences:
Why does the code still working? I was reading an Arduino code regarding counter http://www.toddholoubek.com/classes/pcomp/?page_id=58 . Since I do not own a Arduino microcontroller and would like to know the result, I test the concept of the code by using a game object in unity, the void loop() in Arduino function like the void Update in unity. The scale of game object function as if a counter and I tried generate the state 1 or 0 depend on the value of transform.position.y so I can check is it the increment of object scale happen one time only for each transition from state 0 to state 1. For the code below, it worked as intended but when if I transfer this line "PreviousState = CurrentState;" into the if statement " if (_birdWasLaunched &&
GetComponent().velocity.magnitude > 0.1 && transform.position.y > 1 && CurrentState != PreviousState)" , it still working? Been thinking for sometime couldn't see the sense why it still working. As
Initially value of previous state = current state = 0 when transform.position.y < 1 since the object is launch from a position.y < 1 upward. After y>1 ,value of current state switch from 0 to 1, which made the equality CurrentState!=PreviousState become true, then the scale gain 1 increment to its original value. Which is followed by the command line PreviousState=CurrentState to made the equality of CurrentState!=PreviousState become false in next frame update otherwise object scale increase according to fps. After the object drop to position. y<1 due to gravity, the value of CurrentState =0 and PreviousState=1 , I then launch it again upward in y axis direction until position.y>1 which the current state become 1 at this time the equality of PreviousState == CurrentState at this moment but the scale still get one increment? This is the part where I don't understand.
  using UnityEngine;
  using UnityEngine.Assertions.Must;
  using UnityEngine.SceneManagement;

  public class Bird : MonoBehaviour

{
int CurrentState = 0 ;
int PreviousState = 0;
Vector3 OldPosition;
Vector3 DistanceDifference;
float TotalDistance = 0;
Vector3 _initialPosition;
private bool _birdWasLaunched;
[SerializeField] private float _launchPower = 500;

void start()
{
    OldPosition = transform.position;

}

private void Awake()
{
    _initialPosition = transform.position;

}

void Update()
{

    if (_birdWasLaunched &&
             GetComponent<Rigidbody2D>().velocity.magnitude > 0.1 && transform.position.y > 1 && CurrentState != PreviousState)
    {

        transform.localScale = new Vector3(transform.localScale.x + 1, transform.localScale.y + 1, transform.localScale.z + 1);

    }

    PreviousState = CurrentState;

    if (_birdWasLaunched &&
  GetComponent<Rigidbody2D>().velocity.magnitude > 0.1 && transform.position.y > 1)
    {
        CurrentState = 1;
    }

    if (_birdWasLaunched &&
            GetComponent<Rigidbody2D>().velocity.magnitude > 0.1 && transform.position.y < 1)
    {
        CurrentState = 0;
    }

sentences:
2D: Scaling a character with multiple RigidBody2Ds? So, this example is in the Godot Engine, but other engines porbably have this kind of problem, too:

I have a character with multiple RigidBody2Ds, that also has a bone skeleton for animation over them. Now, the problem is, that Godot's physics engine handles the transforms of the bodies, so they won't scale properly. If you scale the children (CollisionShape2Ds and Sprites) the positions will be off. Is anybody aware of a proper way to work around this? Being able to scale these kind of characters would be awesome.

Thanks for all your answers.
Greetings, Footurist

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:
How to pathfind over an obstacle? How to represent the following situation best - agent (@) needs to get to the goal($). The path is blocked by a moat(~~~). A rake (or some other device, like waterwalking boots) is available that will make it possible to cross the obstacle.

.....~~~...   . ground
...=.~~~...   = rake
.....~~~.$.   ~ water
.@...~~~...   @ agent
.....~~~...   $ goal

How to properly pathfind from @ to $ provided there is no immediately available path? Should my path have not only cost but also prerequisites?

UPD: The problem is the goal is not accessible and rake is just one of many possible objects on the map. Question then is "how to make the agent understand that it needs the rake?"

sentences:
Do professional 3D modelers use human bases? I tried to find an answer on google and didn't get much.
I wanna know, do professional 3D modelers (Specifically in the video game industry) work off generic base human models to make their own? Or do they make their entire body and face models from scratch?

Bases like these for example:

sentences:
How to properly delete unwanted models I am implementing bullets into my game, and each bullet has a lifetime. Whenever the bullet has existed for a set amount of time or collides with an object, the bullet should be deleted. I implemented the timer properly and whenever the bullet reaches the end of its life, it gets deleted. The problem occurs whenever I shoot another bullet. This instantly causes a crash with the code:
Exception thrown at 0x044765D7 (nvoglv32.dll) in gravityGame.exe: 0xC0000005: Access violation reading location 0x00000000.
After some research, I've found that this usually means that I am trying to render something that is a nullptr. My thinking is that I am not deleting the previous bullet properly and this affects the new one. A single bullet object is created on startup, and every new bullet is copied using the following line of code:
std::shared_ptr<Bullet> bullet = std::make_shared<Bullet>(*std::dynamic_pointer_cast<Bullet>(modelsLoaded.at(i)));
The reason for the dynamic pointer cast is because it is in a vector of its base class that it inherits from. Whenever the bullet needs to get deleted, it is erased from the bullets vector using bullets.erase(bullets.begin()+index); and the object it is pointing to should go out of scope, there is nothing else pointing to it. I feel like somehow having that object getting deleted has an adverse effect on the other bullets in the vector, but I do not know how. A new object is created and all the data from the original bullet gets copied over. How could deleting a copy of an object mess with the other copied objects? The functions to create, and render the models are below.
Generate Model Function
    //binds id
    glGenBuffers(1, &VBO);
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &EBO);
    glGenTextures(1, &texture);
    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, verticesSizeTexture * 8 * sizeof(float), verticesTexture, GL_STATIC_DRAW);
    // position attribute
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    // color attribute
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indicesSizeTexture * 4, indicesTexture, GL_STATIC_DRAW);
    //texture
    glBindTexture(GL_TEXTURE_2D, texture);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
    glEnableVertexAttribArray(2);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindVertexArray(0);

Rendering Function
    unsigned int transformLoc = glGetUniformLocation(shader->ID, "location");
    glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(trans));

    glBindTexture(GL_TEXTURE_2D, texture);
    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLES, indicesSizeTexture, GL_UNSIGNED_INT, 0);
    glBindVertexArray(0);

Destructor
glDeleteVertexArrays(1, &VAO);
glDeleteBuffers(1, &VBO);
glDeleteBuffers(1, &EBO);

Update
After removing the contents of the destructor, the problem goes away. However, I would like to have some sort of destructor to allow for the proper freeing of memory.

sentences:
How do I avoid big switches in my message system? I've been implementing a message system for my small engine, and I have started to think about optimizing and maintaining it. Right now, my message class looks like this (at its simplest - only member variables):

typedef unsigned int MessageID;

class Message
{
    std::string message;
    MessageID messageID;
    MessageData* data;
};

At first I was only using std::string to recognize each event, and handling was done in cascade-if style:

void GUI_system::handleMessage(Message* message)
{
    if (message->message == "DELETE_HP")
    {
        deleteHearth(static_cast<AttInfo*>(message->data));

    }
    else if (message->message == "PAUSE_GAME")
    {
        showPauseIcon();
    }
}

However, I felt it is uncomfortable to work with, and for a switch I needed a numeric variable. This is why is MessageID is generated from unordered_map each time a message is created; each message has its own ID, and if not, a new one is created. So now it looks like this:

void GUI_system::handleMessage(Message* message)
{
    switch(message->messageID)
    {
        case 1 :
        {
            deleteHearth(static_cast<AttInfo*>(message->data));
            break;
        }
        case 2 :
        {
            showPauseIcon();
            break;
        }
    }
}

However, this was more confusing than the cascade-if style, where I at least had a little knowledge of what is going on, internally, apart from a plain int. I know enumerations are easier to use and implement, but this was the first method I tried, and I also wanted to try it the other way.

This brings me to my question; how do I avoid big switches in my message system? Should I just use enums?

My first suggestion was to create an unordered map of function pointers that define the behavior for a message, where the MessageIDs would act as keys, so the initialisation function would be defined in some init function, like this:

typedef void* func(Message*) messageF;

std::unordered_map<MessageID,messageF> _messageMap;

void GUI_system::InitBehaviorFunctions()
{
    _messageMap[MessageIDMapper::findID("DELETE_HP")] = deleteHearth;
    _messageMap[MessageIDMapper::findID("PAUSE_GAME")] = showPauseIcon;
}

void GUI_system::handleMessage(Message* message)
{
    //Or the right way as this is just a sketch
    _messageMap[message->messageID](message);
}

sentences:
How to Create a Game? I'm a newbie. I like to play games, but I'd also like to program them too. I know it's difficult to create a game, but please share the basic info I need to get started creating my first game. What do I need to study to become a game developer? What is
game AI? What is a Game Engine? What are the different types of game engine?

sentences:
Cellbased maps explanation? I've been trying to understand cellbased maps and how they work, i have googled alot but can't seem to find any explanation for it.

With cell based maps i mean the ones where you do height and everything like walls roof floor in each cell.
If possible i would appreciate an explanation from a Javascript perspective, but only a theoretical explanation can do.

So why do we use them? how do they work?
Is it just like a normal array with more information?

sentences:
Building Irregular terrain in tile-based approach I'm starting to build a 2D game, metroidvania-like, tile-based and all. I've had some prior experience in it, and one of the major letdowns of those prior games was that worlds seemed too "blockish", kinda inorganic, when they shouldn't (underground caverns aren't squarish at all). So, for this time, I'm trying to come up with a way to build a world just like Cave Story's:

It has some nice angles and feels way better than a purely tiled world.

As far as I know, SP built this world using AS2 back in 2002, when computers hadn't all the processing power they have today, so I think he haven't used any kind of heavy mask to do it. Talking with one of my teachers, he suggested the guy used raycasts to search for non-transparent pixels in rectangular tiles. Dunno if it's true, but I decided to get further help through here. I'd like some suggestions for a nice and soft approach to this kind of work, if possible.

sentences:
The import aurelienribon cannot be resolved I've been having problems with using the Tween Engine by aurelien ribon for a Splash Screen for my 2d game. I'm using Eclipse and libgdx.

I've tried rebuilding, clean...-ing, and refreshing.

I've closely followed the import directions from here:
https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine

I'd be more than happy to provide anyone with more information/code if they need it.

The import file/lines of code (Game Renderer class):

package com.companyname.gameWorld;

import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenEquations;
import aurelienribon.tweenengine.TweenManager;

build.gradle:

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"

        compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"

        compile fileTree(dir: '../libs', include: '*.jar')
    }
}

...(other project(":...")s)...

project(":core") {
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"

        compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"

        compile fileTree(dir: '../libs', include: '*.jar')
    }
}

The /libs folder:

sentences:
How do I rotate a sprite around a pivot point using SDL_gfx's rotozoomSurface? Using SDL_gfx's rotozoomSurface function to rotate a 38x58 sprite....naturally when it rotates it creates a new surface with a new size, and the rotation isn't going around the center point.  I am actually having issues trying to figure out how to make it seem like its spinning around an axis...

Here is the image that I am using:

And here is the code that I have thus far:

  #define ANGLE_STEPS 32
  #define ANGLE_STEP  (360 / ANGLE_STEPS)
  ...
  int angle = 0;
  SDL_Rect cpos;
  cpos.x = cpos.y = 100;
  ...
  // create chopper angled surfaces
  for (int i = 0; i < ANGLE_STEPS; i++)
  {
    choppers[i] = rotozoomSurface(chopper, i * ANGLE_STEP, 1, 0);
  }
  ...

  // blit the currently requested angle
  SDL_BlitSurface(choppers[angle], NULL, screen, &cpos);
  ...

  // handle rotating the chopper
  if (keystate[keys[LEFTKEY]])
  {
    angle = (angle + 1) & (ANGLE_STEPS - 1);
    cpos.x = ?
    cpos.y = ?
  }
  if (keystate[keys[RIGHTKEY]])
  {
    angle = (angle - 1) & (ANGLE_STEPS - 1);
    cpos.x = ?
    cpos.y = ?
  }

sentences:
Blending 2d images to subtract alpha I'm looking into doing a 2d lighting system with a result similar to this: http://forums.tigsource.com/index.php?topic=15619.0 This thread I believe disregards color, as well as doesn't really list a clear final solution, which is something we could provide here.

What I'd like to do is start with a solid black texture, and render colored lights to it. When I render a colored light onto the texture, I'd like it to subtract the alpha away from the solid black texture but also add in the color of the light. In the end, my goal would be to have a texture that I can blend normally on top of my scene, using glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), which would let the background show through in the "lighted" areas in addition to adding some of that lights color to the area.

To start I fill the texture with black:

glColor4f( 0.0f, 0.0f, 0.0f, 1.0 )

Then I set the blend function to subtract and draw the lights:

glBlendEquation( GL_FUNC_SUBTRACT );
glBlendFunc( ??? , ??? ); // Not quite sure what to put here

// Draw a triangle fan for the circle of light.
glColor4f( 0.0f, 0.0f, 0.0f, 0.8f );
glBegin(GL_TRIANGLE_FAN);
glVertex2f(0, 0);
glColor4f( 0.0f, 0.0f, 0.0f, 0.0f );
for (float angle = 0; angle <= 6.28; angle+=0.1) {
    glVertex2f(sin(angle) * sizeOfLight, cos(angle) * sizeOfLight);
}
glVertex2f(sin(3.14159*2) * sizeOfLight, cos(3.14159*2) * sizeOfLight);
glEnd();

// Reset this back to normal
glBlendEquation(GL_FUNC_ADD);

The guts of my question is what type of blending would I need here, on the second line of this code block.

sentences:
Is libgdx fit for 2D game development on Android or are there simpler alternatives? I'm looking for a Java framework to develop 2D games on desktop and Android. I've looked at Slick and I really like the API, however the developer himself says if you want a framework for Android and desktop best go with libgdx atm.

Now I'm reading up on libgdx, but I'm wondering if there are simpler alternatives for just doing 2D sprite stuff on Android and desktop. I'm only interested in creating NES like graphics, nothing too fancy. Something like this.

Because on the wiki of libgdx it says you can't use the OrtographicCamera with OpenGL ES 2.0 (http://code.google.com/p/libgdx/wiki/OrthographicCamera), but I read (http://www.badlogicgames.com/wordpress/?p=504) when your device supports OpenGL ES 2.0 it doesn't support 1.0, so you can't effectively use OrtographicCamera on OpenGL ES 2.0 devices?

I'm confused, should I go with libgdx? Are there simpler alternatives?

sentences:
Calculate gravity between two intersecting bodies I've been working on a 2D gravity simulator for some time and I'd like to add some surrealism to it by creating planets that can't collide with other planets (passing right through them).

The problem is, as distance between two bodies approaches zero, gravity goes to infinity - causing planets to slingshot when they're intersecting. Stopping gravity from being applied for a pair of bodies as soon as they touch looks odd as their velocity will suddenly go from accelerating to constant until they get to the other side.

Is there a function that gives me the best of both worlds or should I just leave the planets not being affected by gravity while intersecting other bodies?

sentences:
Smooth anmiation with LibGDX I want to move a enemy from its current position toward the mouse position in LibGDX.
x, y - enemy position   saveX, saveY - position where my enemy need to go(or mouse position saved at specific time) xSize, ySize - enemy size.

protected Vector2 makeVec(float saveX, float saveY){
    Vector2 v = new Vector2(saveX - x, saveY - y);
    return v.nor();
}

public void update(float dt){
    test += dt;
    dtTime += dt;
    if(cont){
        vec = makeVec(saveX, saveY);
        x += vec.x * speed
        y += vec.y * speed;
        cont = cont();
    }
}

But for some reasons my enemy movement animation is not smooth. What's wrong?

sentences:
In XNA, how do I access a model's dimensions with code? I'm trying to rotate a model around some axes, but this rotates it around the world origin. I understand that I need to translate the object relative to its own size before rotating it, but I don't know by how much.

I've done it by trial and error until now. How can I automatically read a model's width, height and position?

sentences:
Line of sight on a 2d grid I've been looking for similar questions here and on google, but none have worked for me yet.
I have a game, where I have a 2d array of square tiles (they're objects with accessible x and y pixel coords, side length in pixels, and whether are they see-through).

In there, there are enemies and the player. They can move independently from the grid (as in, pardon the example, Minecraft), and I have got access to their coords. What I want is a function that will tell me if a given enemy can see the player or not (just returning bool).
Can you help me?

EDIT: I used Bresenham. If anyone there is from Poland, a great description of Bresanham's jest tutaj :http://edu.i-lo.tarnow.pl/inf/utils/002_roz/2008_06.php :)

sentences:
Why use random numbers when it comes to rewards and stats? Many games use random numbers for things like attack damage, gold loot, or monster type being spawned. It is obvious that random numbers allow you to generate content to make games more re-playable, but I am talking about specific things. For example: In DOTA, when you kill a monster you get a random amount of gold in between x and y where x and y never change. When you attack anything you have a chance to do damage within a range such as 52-60. How would making the gold drops static change the game?

I feel like the random numbers enhance the game-play, but I am having trouble understanding why. Does anyone know any reasons why random numbers can make game-play better when used with things like damage or loot? I'm hoping for answers that don't attribute it to luck being a good thing.

sentences:
When is the Z coordinate normalized in GLSL? I thought that whenever you transform an object to world space, then view space and finally screen space, the last matrix you apply(the projection matrix) normalizes the z values between 0 and 1.

However, I'm getting big z coordinates, which implies that the projection matrix didn't normalize it. Am I doing something wrong? I mean, all I do is:

gl_Position = projection * view * world * gl_Vertex;

sentences:
Creating a movable camera using glm::lookAt() I came across this tutorial on how to create a movable camera in OpenGL using glm::lookAt(glm::vec3 position, glm::vec3 target, glm::vec3 up). In the tutorial, in order to keep the camera always facing in one direction while moving, the view matrix is created as such: view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);, where cameraPos, cameraFront, and cameraUp are all glm::vec3 type.

What I would like to ask is why does the second argument have to be cameraPos + cameraFront? If the camera position moved to the right without changing cameraFront, wouldn't cameraPos + cameraFront have an effect of rotating to the right as opposed to staying in the same direction (which I think is what should be needed)?

sentences: Launching projectile from a "canon" I'm working on "Scorched earth"-like game just for learning purpose. I can't figure out how to launch the projectile from my tank's position, with a power of X ([0,100]),at an angle of Y ([-180,180]).

sentences:
Rasterizing euclidean planes I'd like to visualize a BSP tree. To do this, I need to project an arbitrary euclidean plane onto a projection plane. I was thinking about calculating the intersections of the plane with the viewing frustum (in world space), then triangulating the resulting quadrangle and projecting the 2 triangles.

Is there a better way? For example, I thought about transforming the plane into the viewing space first, creating an ONB (from the transformed plane normal). Then I would simply stretch the quadrangle, until it is outside of the frustum and transform the quadrangle back into world space and send it into the rendering queue.

How should I got about shading the plane approximation (quadrangle)?

sentences:
Whats the best way to make my Unity game moddable? Basically the title. I'm building a game with several NPCs and complex systems, and I want it to be nice and modular for modders right from the beginning. So far, I have looked into:

Asset Bundles, I don't completely understand these, probably will have to write some custom loading code? I don't know how/if this will let the modders write code.

Lua-Based Modding, I don't particularly like Lua, but I will fall back to it if I absolutely have to (The Unity-Lua Plugin makes this a seemingly very fast way.)

Exposed C# (original idea from this Question). But again, as stated in the question raw c# has a lot of disadvantages, not to mention the security risks and compatibility issues.

Minecraft-Style? Completely custom? Basically a lot of events and registries? I'm not sure about this option.
To give you an example, there are several Tribes in the game. Ideally, if a modder wanted to make a new tribe they would need to extend from some Tribe base class and then register/add their custom tribe to my AvailableTribes list. Not to mention the models, animations, and sounds for the Tribe NPCs and such.

Any help is appreciated!

sentences:
How to properly rotate a Turret? I'm having problems understanding how to properly rotate a Turret.
Using Unity Editor, I've simulate turret movement, so I take note that turret can move with this clamp factor (for instance):

( value expressed in euler angles )

X = 1-4

Y = 0-0

Z = 98-100

I've write this code but it not works properly:

float rotX = Random.Range (Cannon1MinX, Cannon1MaxX);
float rotY = Random.Range (Cannon1MinY, Cannon1MaxY);
float rotZ = Random.Range (Cannon1MinZ, Cannon1MaxZ);

Cannon1.transform.Rotate (new Vector3 (rotX, rotY, rotZ),Space.World);

Every time I've to work with rotation i become mad :(

What is wrong ?
Thanks

sentences:
OnTriggerExit2D called multiple times when two triggers touch I have two GameObjects tagged "Point", each with a Collider 2D set to Is Trigger.

I have another GameObject, "pencil", which also has a Collider2D set to Is Trigger

I want to move the pencil the first point to the start drawing a line, and then stop drawing when it hits the second point.

My problem is that when the pencil hits a point, it calls OnTriggerExit2D multiple times. How can I only detect first contact with the point?

Pencil script:

private void OnTriggerExit2D(Collider2D collision)
{
    if (!collision.isTrigger)
    {
        if (collision.gameObject.tag == "Point")
        {
            writing = !writing;
        }
    }
}

sentences:
How do I listen for an Admob interstitial ad load event? I can show interstitial AdMob ads with the following code:

    if (GUI.Button(new Rect(10, 300, 150, 50), "Load Interstitials"))
    {
        interstitial.LoadAd(interstitialsRequest);
    }

    if (GUI.Button(new Rect(10, 400, 150, 50), "Show Interstitials"))
    {
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
        }
    }

That's all working well.

Now I want to attach a listener for when the interstitial ad has loaded. I checked all the available source files, but can't find the right listener method.

void onAdLoaded()
{
    print("Interstitial Ad Loaded");
}

public void HandleAdLoaded(object sender)
{
    print("HandleAdLoaded event received.");
    // Handle the ad loaded event.
}

I use googleads-mobile-plugins for Admob ads.

What listener should I be using?

sentences:
How do I make function on user clicked on close button Ads reward? So I'm here want to make function when the user closed the Ads before video ads end, the function is stopping or revert, in this case, I'm using ienumerator methods, but I don't know how to add the handler on Ads, because I already using HandleRewardClosed method not like I want but because its same with user watch the vid till end not closed the videos before ended .
    public void loadRewardVideo()
    {
        rewardedAd.LoadAd(new AdRequest.Builder().Build(), rewarded_Ad_ID);

        rewardedAd.OnAdLoaded += HandleRewardedAdLoaded;
        rewardedAd.OnAdClosed += HandleRewardedAdClosed;
        rewardedAd.OnAdOpening += HandleRewardedAdOpening;
        rewardedAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad;
        rewardedAd.OnAdRewarded += HandleUserEarnedReward;
        rewardedAd.OnAdLeavingApplication += HandleOnRewardAdleavingApp;

    }

    /// rewarded video events //////////////////////////////////////////////

    public event EventHandler<EventArgs> OnAdLoaded;

    public event EventHandler<AdFailedToLoadEventArgs> OnAdFailedToLoad;

    public event EventHandler<EventArgs> OnAdOpening;

    public event EventHandler<EventArgs> OnAdStarted;

    public event EventHandler<EventArgs> OnAdClosed;

    public event EventHandler<Reward> OnAdRewarded;

    public event EventHandler<EventArgs> OnAdLeavingApplication;

    public event EventHandler<EventArgs> OnAdCompleted;

    /// Rewared events //////////////////////////

    public void HandleRewardedAdLoaded(object sender, EventArgs args)
    {
        Debug.Log("Video Loaded");
    }

    public void HandleRewardedAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        Debug.Log("Video not loaded");
    }

    public void HandleRewardedAdOpening(object sender, EventArgs args)
    {
        Debug.Log("Video Loading");
    }

    public void HandleRewardedAdFailedToShow(object sender, AdErrorEventArgs args)
    {
        Debug.Log("Video Loading failed");
    }

    public void HandleRewardedAdClosed(object sender, EventArgs args)
    {
        Debug.Log("Video Loading failed");

        StartCoroutine(ClosedAds());
    }

    IEnumerator ClosedAds()
    {
        _GameManager.instance.isGameOver = true;
        yield return new WaitForSeconds(.05f);
        _GameManager.instance.isStarted = false;

        Time.timeScale = 0;

        _FirebaseRemoteConfig.instance.DisplayAds();

        _GameManager.instance.ShowingGameOverPanel();

        _GameManager.instance.pauseBtn.SetActive(false);
    }
```

sentences: Making a button that spawn objects in the world? I want to make a button that can spawn an object that I've already created. Though I have no clue how to actually do this / where to start. Has anyone ever done something similar?

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:
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: Atmospheric Scattering I want to add some nice atmospheric scattering to my 3D game engine but I am very concerned with conserving resources. I am not very familiar with how its done but can someone please give me some suggestions how to achieve this effect without using too many resources? For example, should I use precomputed or real time atmospheric scattering. Also is the effect worth it without HDR or is it practically needed.

sentences: What language was used to write Starcraft II? Total newbie question , but what language was used by blizzard to crate the Starcraft II game play? I've been playing it for the last couple of days , and I'm constantly astonished by the complexity and the performance of the game. Is it an in-house language , or do they use some flavor of a know language?

sentences:
Can't run Nvidia PracticalPSM sample in debug mode I want to add PSM (Prespective shadow map) to my engine but I have problems with that.
I think the problem is somewhere in my math code so I want debug Nvidia PracticalPSM sample and compare the math result in the sample and in my engine so maybe I could find the bug

When I want to compile the sample with VS2005 I get some linker error with DXUT functions maybe it is due to that the static lib DXUT.lib that included is compiled with VS2003 and dose not work probably with VS2005 then I added DXUT source codes from SDK 9.5 to the solution and the sample compiles this time.

When I hit F5 to run the sample it complains about nv_nvb.dll but only release version of nv_nvb.dll is included in the sample and I copied that to debug folder when the program starts it crashes in NVBscene9.cpp line 283.

I don't know why it crashes here.

you can download the sample code from here

sentences:
Image splitting / tiling software for Mac I have been programming for a bit and for 2D games and other applications I frequently make large images for the levels / the maps. Before I place these into the games I split the large images down into smaller equally sized squares, but I do this manually in 'the Gimp' and it takes ages sometimes! Is there some software which can do this much quicker for me, where I can select how I want  the image split down etc? And for Mac as well?

Thanks

sentences:
How shader program still works even after detaching shader object? In the following process of shader creation, shader object is detached after linking program (glLinkProgram), how does the shader program still works after detaching and deleting shader objects?

glCreateShader -> glShaderSource -> glCompileShader -> glCreateProgram -> glAttachShader -> glLinkProgram -> glDetachShader -> glDeleteShader -> Use shader.

sentences:
How to store renderer vertex / index data in scene graph objects? I have a SceneNode class which contains a Mesh instance. The Mesh class stores client side information such as vertex and index arrays (before they're uploaded to the GPU). I also have an abstracted Renderer class, for GL and D3D, which render the SceneNodes. However, I'm not sure where I should store the API specific variables, e.g. GLuint via glGenBuffers for GL, and an ID3D11Buffer for D3D.

The few options I've considered are:

Create a derived Mesh class for each API, e.g. GLMesh / D3DMesh
Create a derived MeshData class for each API, which is stored in the main Mesh class
Store a map of Mesh to API variables in each renderer, e.g. perform a lookup of Mesh to GLuint / ID3D11Buffer for each object that is rendered (variables would have to be generated after the scene had been updated, but before rendering).
Separate the logic of rendering from scenes, by visiting the SceneGraph after update, and generating a RenderGraph of all renderable nodes in the scene.

What's the recommended way of doing this?

sentences:
How to apply steering to a physics body correctly when using a physics engine? I have a top down 2d game that uses a physics engine (Farseer).

I'm using the standard steering behaviors to make the AI move around but I'm not sure the correct way to take the so called "steering force" calculated by the steering behavior and apply it to the physics bodies.

For example:

The steering behavior SEEK returns

return desiredVelocity - currentVelocity;

So it is returning a difference of two velocities (in meters per second).

I need to convert this into the force (in Newtons) that I need to apply to my physics body, taking into account its mass and acceleration etc.

I know it should be simply but I'm getting confused! :)

sentences:
Working around the current sad state of mobile GPU drivers I'm working on a OpenGL ES3 app for Android: for various reasons, I decided to roll my own mini-OpenGL rendering engine. So far so good.

Problem is, the GPU drivers in the mobile industry are such sad things, that dire bugs keep appearing with the most innocent actions.

For example: yesterday I added a point to my scene (you know: the kind with 3 coordinates, plus a mat4 for the projection matrix) and I got the following results:

everything fine on a Samsung S4
black screen with ANR on my Nexus 5
hard freeze and reboot on my Nexus 7 (way to go, Qualcomm!)

I admit I use a number of not so common stuff in my rendering engine (the tougher probably being MRT), but we are still talking about features in the OpenGL ES 3 specification.

So the question is: how do you deal with this state of affair? Are there techniques that will minimise the risk of incompatibilities? Does the OpenGL ES 3 (and 2 since we are at it...) specification contains features better not using?

Mind that this is not the first time I stumble on problems like this (earlier during development I had a bug triggered by the GL_TEXTURE_EXTERNAL_OES OpenGL ES2 extension that actually forced me to do a pre-rendering pass, just to avoid getting a purple screen...), and this is turning the whole development into a quite anxiety-provoking experience.

Thank you for any advice!

sentences:
How do I calculate the motion of 2 massive bodies in space? I'm writing code simulating the 2-dimensional motion of two massive bodies with gravitational fields.

The bodies' masses are known and I have a gravitational force equation.
I know from that force I can get a differential equation for coordinates.
I know that I once I solve this equation I will get the coordinates.
I will need to make up some initial position and some initial velocity.

I'd like to end up with a numeric solver for the ordinal differential equation for coordinates to get the formulas that I can write in code. Could someone break down how from laws and initial conditions we get to the formulas that calculate x and y at time t?

sentences:
What single word could be used to describe city adventures? I am developing an urban racing simulator in a very "underground" stylized setting. It's name is The Underground King and you have the ability to either:

A) Race in a 2d side view.
B) Do something in the city.

Doing either of A or B will pass the day since it's assumed it takes all day to perform that action.
My issue is that while racing levels are caled Racing, the city action/adventure is called Event which is both too generic, and conflicts with my game engine's internal event systems.

I have tried to find a relevant replacement that is descriptive enough on what it is, whithout relying to medieval fantasy type tropes such as "Adventure" or cyberpunk's very own "Run".

What I could think of / narrow down are: Buisness or Biz, Happening, Venture, Risk, Encounter.
Here are some examples of the kind of things you can find:

You accidentally bump into a drunk thug who wants to start a fight.
A dog has something shiny and valuble looking in its bouth and wants to run away to bury it.
A suspicious-looking woman dropped a package in a trash can.
You get a tip about an abandoned but heavily locked garrage.
A rich businessman wants to put a bet on your next race but wants a guarantee.
While driving with your crew, you smell something burning (with random consequences):

Somebody is playing with matches.
The engine is burning.
Somebody tried to sabotage your car for the next race but it shortcircuited.
A rusted part finally started spinning again. The car has higher stats now.

I am looking for a single word term that can apply to any sort of event as written above which is generic enough to encompass anything you can potentially gain from, but specific enough to represent its something you can pursue or happen to you while you are present in the city.

Thanks!

sentences:
Cocos2D-JS Windows App in fullscreen mode (Win32) I've been looking for a way to make my Cocos2D-JS app go into fullscreen mode, but there doesn't seem to be much documentation on Cocos2D-JS (or Cocos2D-x-js as some seem to call it.)
This app is to be exported into a Windows Desktop platform (Win32), and so fullscreen mode should work there as well.

I checked the Cocos2D-JS Online API and found cc.screen, which has a method called requestFullScreen, so I tried this:

cc.screen.requestFullScreen(document.documentElement, function() { cc.log('Requesting full screen...'); } );

However, this didn't work on either of the platforms I tested it on (web browser and win32). Since document does not exist when you export the app into win32, I then tried changing it for cc._canvas:

cc.screen.requestFullScreen(cc._canvas, function() { cc.log('Requesting full screen...'); } );

But this did not work either. Is there a way to make the app run in fullscreen mode?

PD: My apologies for any wrong tags I may have included to this question. I added the ones I thought were related to this problem.

sentences:
How can I modify my procedural shadows to also show some of the walls? I'm rendering shadows in Libgdx with the method from this tutorial. I think it's a nice and easy method.
I render all my shadows in a framebuffer, then invert it.

Before invert:

After Invert:

#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif

varying vec2 vTexCoord0;
varying LOWP vec4 vColor;

uniform sampler2D u_texture;

void main(void) {
    vec4 diffuseColor = texture2D(u_texture, vTexCoord0);
    gl_FragColor = vec4(diffuseColor.rgb + vColor.rgb, vColor.a - diffuseColor.a);
}

That's all working fine.

Now I want to show a bit of the walls. But I'm not sure how. I tried using the
framebuffer with the lights, scale it a bit, and then draw the walls with blending.
But it's looking not very good:

Is there a better way?

sentences:
Find mouse pos in 3D space? I have a game where there is a set of tiles rotated 45° away from the camera. I want to work out what tile is being hovered over by the mouse, and for that I need to translate the mouse pos on the screen into the position on the plane rotated 45° away. How can I do this? Is there an easy way of doing this without using (expensive) 3D transformation?

Thanks in advance.

sentences:
Custom Rule-Based System for Action Recognition in a Game I want to make objects in a side project interatible with each other. For this, I want to be able to create rules so "Collisions" (Interactions) can be recognised by testing the rules. The rules should be able to reference what object does the player is trying use, in what state the object is, with which object does he try to interact with (could be nothing) and the state of this object. Maybe the rules will need to consider the state of the game as well.

With this in mind, here is my question. How could I create a rule-based system that I could use ? What design patterns could I use to create something scalable and that will allow me to add, remove and modify rules without having to regenerate the project ?

sentences:
8 ball pool scratch card effect logic how to replicate this type of scratch card effect in Unity3D considering its for mobile.

https://youtu.be/6wLWu1BefXs

Two cases
1. Clear part of screen where user touches.
2. How to trigger rewards after certain amount of image get reveal?

sentences: Is it better to load all of the scene at once or load small parts of it as the player moves? I want to create a lot of detail in my game but I don’t want to kill the frame rate tracking all the models and movements (like all the grass). Will loading them in pieces save the frame rate or will constantly loading and unloading models with every step negate any benefits of loading in pieces? I want to only load what the player will see at that moment and nothing else until the player either moves the camera or walks. I also want to know if loading a scene on Unity uses the gpu or the cpu?

sentences:
How do I get the id of an object that created a point in a path? I'm making a rollercoaster tycoon type game. As the title says, I need to get the id of an object that created a path point. These points are currently greated by the rail pieces. I need this because each rail type (down, up, corners, etc) decides how fast the cart is going to go. The cart follows a path, with points created when a new rail is created. Normally, I would just use instance_place, but since the coaster has multiple levels (defined by z), I can't use this because some rails will overlap other. If you have any suggestions, I will be very grateful! For more information just ask and I will respond. Thank you for your time.

Here's a screenshot of the game for reference (the blue thing is the cart, the white numbers are the added or subtracted speed for that particular rail type):

sentences:
Looping OpenAL sounds with one buffer - or how to do it correctly? I require to implement a statically played sound class which supports looping of the audio data - and requires this to be changed at runtime (e.g., turning off looping).

Maybe I understand something horribly wrong, but this is how I understood how to implement looping at all, and came to the following solution:

I have exactly one buffer containing all the audio data.
If looping is enabled, ensure that the source playing the sound has this buffer queued twice, so it replays the sound when the end of the current buffer has been reached:

if (Loop && _source.BuffersQueued == 1)
{
    _source.QueueBuffers(_buffer);
}

If a buffer has been processed (e.g. right after the sound audibly loops), it is unqueued and dismissed.

if (_source.BuffersProcessed > 0)
{
    _source.UnqueueBuffers(_source.BuffersProcessed); // Unqueue outdated buffers
}

Here I ran into the first problem: If the user sets the sound to not loop anymore, I cannot unqueue the upcoming buffer (to make it not loop over another time while looping has already been turned off).

This is because I only found methods to unqueue by the handle of the buffer, but since I queue the same buffer twice, the handle is always the same to the one currently playing. OpenAL tries to unqueue the currently played buffer then, which obviously fails.

Unqueuing by the number of processed buffers also doesn't help, as no buffer has been marked as processed yet.

Do I really need to completely duplicate the buffer with all the audio data, keep it stored twice in memory, just to have two different buffer handles to unqueue the second buffer if looping gets disabled?

sentences:
Implementing skeletal animation and GPU skinning (DOOM MD5) DISCLAIMER
This question has been completely rewritten to narrow the scope of the question in light of previous suggestions and answers, but the same problem still persists.

Currently I'm trying to implement skeletal animation (GPU skinning) in my project.

So far I have achieved single joint translation and rotation, and multi-jointed translation. The problem arises when I try to rotate a multi-jointed skeleton.

At the moment I'm following quite a few sources in trying to implement skeletal animation. The MD5 spec, a blog post with source code and I've also seen many other tutorials.

Currently when I try and load the popular "Bob Lamp" model, I get this result.

Some information about my implementation:

My maths is ordered with "vector to the left"
The vectors and rotations of animation frames are being converted into matrices
I pre-multiply the inverse bind pose and pose matrices

Here is my shader code.

#version 330 core

smooth out vec2 vVaryingTexCoords;
smooth out vec3 vVaryingNormals;
smooth out vec4 vWeightColor;

uniform mat4 MV;
uniform mat4 MVP;
uniform mat4 Pallete[55];

layout(location = 0) in vec3 vPos;
layout(location = 1) in vec2 vTexCoords;
layout(location = 2) in vec3 vNormals;
layout(location = 3) in int vSkeleton[4];
layout(location = 4) in vec3 vWeight;

void main()
{
    vec4 wpos2 = vec4(0.0);
    vec4 norm2 = vec4(0.0);
    vec4 wpos = vec4(vPos, 1.0);
    vec4 norm = vec4(vNormals, 0.0);
    vec4 weight = vec4(vWeight, (1.0f-(vWeight[0] + vWeight[1] + vWeight[2])));

    mat4 BoneTransform = mat4(0.0);
    for(int i = 0; i < 4; i++) {
        float fW = weight[i];

        if(fW > 0) {
            int jI = vSkeleton[i];
            vec4 tmpPos = wpos * (Pallete[jI]);
            wpos2 += fW * tmpPos;
        }
    }

    wpos2 /= wpos2.w;

    vWeightColor = weight;
    vVaryingTexCoords = vTexCoords;
    vVaryingNormals = normalize(vec3(vec4(vNormals, 0.0) * MV));
    gl_Position = wpos2 * MVP;
}

Another peculiar thing to mention is that multi-jointed animation works when the vertices are inline with the bones. As soon as the vertices move away from the bones, they deform incorrectly.

UPDATE
In response to @MickLH

My shader code now has wpos2 /= wpos2.w after the for loop. This is the result.

sentences:
How to add global variables to a global list and then call the elements in a second scene in Unity, c# I have the following problem with my app. I have a scene where the player is adding products with prices, by using strings. They are added to a Global Control file, which saves the data. Then, in this GlobalControl file, I want to add each of this strings in a list, so this way in the next scene I can call them and add them to a ScrollView, similar to order preview. Unfortunately, I can't manage to make it the right way and to add more than one item to the Order Preview.

My code is the following:
Scene one:

public void addToOrder()
{

    if (m_currentSelectedModel <= 33)

    {
       GlobalControl.orderContent =
       menuItemNamesString[m_currentSelectedModel];
       GlobalControl.priceContent =
       menuItemPriceString[m_currentSelectedModel];
    }

}

My GlobalControl is the following:

public class GlobalControl : MonoBehaviour
{
    public static GlobalControl control;

    //the global variables

    static public string orderContent;
    static public string priceContent;

    //global lists
    static public List<string> orderItemsList = new List <string>();
    static public List<string> orderPricesList = new List <string>();

    void Awake()
    {
        if (control == null)
        {
            DontDestroyOnLoad(gameObject);
            control = this;
        }

        else if (control != null)

        {
            Destroy(gameObject);
        }

    }

    private void Start()
    {

        //adding the current selection to the respective list
        if (orderContent != null)
        {
            orderItemsList.Add(orderContent);
        }

        if (priceContent != null)
        {
            orderPricesList.Add(priceContent);
        }

    }

And last my OrderPreviewManager, which is in scene 2, is:

void Start ()
{
    //my current solution, which does not retrieve a variable from a list

    curOrderContent = GlobalControl.orderContent;
    curPricetContent = GlobalControl.priceContent;

    AddSelectedItemToOrder();
    AddSelectedItemPriceToOrder();
}

//the two methods for adding the string to text components into a scroll
  view

void AddSelectedItemToOrder()
{
    GameObject gameObject = new GameObject("Child");
    gameObject.transform.SetParent(orderContentView.transform);

    gameObject.AddComponent<Text>().text = curOrderContent;
    gameObject.GetComponent<Text>().font =
    Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
    gameObject.GetComponent<Text>().color = Color.black;
    gameObject.GetComponent<Text>().fontSize = 20;
}

  //similar to the previous method but for the prices

void AddSelectedItemPriceToOrder()
{
    GameObject gameObject = new GameObject("Child");
    gameObject.transform.SetParent(pricetContentView.transform);

    gameObject.AddComponent<Text>().text = curPricetContent;
    gameObject.GetComponent<Text>().font =
    Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
    gameObject.GetComponent<Text>().color = Color.black;
    gameObject.GetComponent<Text>().fontSize = 20;
}

My question is: why does this only insert one item in scene 2?

sentences:
Languages for creating 3d / 2.5d enviroments I want to pick up a language that will allow me to create 2d/3d game environments. I come from web development using PHP, JS, XML and ideally I want to be able to integrate with those languages. I want to deploy to the web and to PC / Mac.

I'm considering Java, Actionscript 3, or some variant of C.

I'm pretty good at picking new languages up so that isn't a consideration.

I have briefly tried Java and ActionScript 3 and the problem is that I'm having difficulty seeing what the strengths of each language are (that is without learning the entire language anyway).

So if a few people could champion their tool of choice, what strengths/weaknesses it offers for game development (feel free to include commercial advantages!), that would certainly help me, it may help others too.

sentences: No intellisense with with Unity 5.5, Visual Studio Code integration, OSX 10.12.1 I get this with the listed software. It doesn't recognize object types and I can't use reference-finding. I have the Omnisharp plugin installed and updated. Just wondering if this is supposed to work properly yet. I'm opening it with Assets->Open Project In Code.

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

I built my view and projection matrices like this

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

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

However, when using them in the vertex shader

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

I cannot see my geometry unless I swap the transformation to

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

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

sentences:
Fast Serialization for Multiplayer Gaming I wish to make a Java based multiplayer game. I am learning all about sockets and so forth. I have built a very basic UDP system that serializes an object with all the information about the game state and then sends that to the client. The client sends input which changes the game state.

My question is, is serializing an entire object an acceptable way to send game info over the internet.

It's super simple but my placeholder images are lagging quite a bit across the screen on a localhost. This could be for several reasons but I was wondering if serializing and then sending and then de-serializing was just too slow a method? This game will be fast paced and reflex oriented.

sentences:
Have a particle system's particles obey transparency sort mode individually Background

In a top-down game, I have particles that spawn animated textures. I have my 2D renderer settings set-up so that it orders sprites based on their position on th Y-axis via "Transparency Sort Mode > Custom Axis > Y".

The Problem

But instead of sorting for each particle spawned, what happens is the particle system obeys the setting as a whole so that the sort order is only based on the particle's system's center.

Is there a way to have each particle obey Transparency Sort Mode individually?

What I want for each particle:

What actually happens:

Other Solutions

Other people seem to have an old workaround to use GetParticles and setting their "order in layer" individually. See this thread from 2015:

https://forum.unity.com/threads/particle-systems-with-sprites-order-in-layer.464533/

But I'm trying to find if there's a cleaner solution for Unity 2019 without having to fudge with "order in layer".

sentences:
How would you define this mechanic in narrative based games? I'm a researching a certain game mechanic that seems very commonplace in modern narrative-based games. The mechanic is defined (by me) as a user action that the player can take while in a dialogue or a cutscene, which affects the course of the narrative (and sometimes has a long lasting impact on the game progression in general).

The interaction can be of several types - press a button\click a character\hit a sequence of keys\button mashing.

Here's an example from Game of Thrones

https://www.youtube.com/watch?v=ykq213pPD6Q&feature=youtu.be&t=181

In Mass Effect it is referred to as an interrupt

https://www.youtube.com/watch?v=9TgTLJXoD_o

Here's one from King's Quest:

https://www.youtube.com/watch?v=KhOkqn6qE2g

I'm looking for more info on this type of mechanic. Specifically -

Is there an accepted name for it?
What other games have this mechanic, and use it in an interesting way? (I would appreciate links to videos demonstrating it)
What types of interactions (such as the ones I've described) have you seen implemented in this mechanic?

Thanks :)

(BTW if you think this game-design related question is more suitable for StackExchange's Arqade do let me know and I'll ask to move it there)

sentences:
Need help with making number system for idle game So, I want to create a new game. I have problems with how to store large numbers in the game and how to output them. I have written a small pseudo code that contains everything I need to play the game (Did I forget anything?).

# represent  our number
struct BigNumber {
    double base; # (or mantissa)
    double exponent;
}

# create new number
function NewBigNumber(double b, double exp) {
    return BigNumber{
        base = b;
        exponent = exp;
    }
}

# now if we have to BigNumbers we want add operation (+)
# and other operations (-), (*), (/)
# +
function adding(BigNumber n, BigNumber m){
    # if numbers have same exponent part
    if (n.exponent = m.exponent) {
        # adding base here
        double new_base = n.base + m.base;

        #create new BigNumber with new base
        return NewBigNumber(new_base, n.exponent);

    } else {
        #?????????
    }
}

# -
function subtraction(BigNumber n, BigNumber m){

}

# *
function multiplication(BigNumber n, BigNumber m){

}

# /
function division(BigNumber n, BigNumber m){

}

As you can see, I will use Scientific notation

I have a problem with the addition operation (and other), what if the exponent part of numbers are different?

Next I have this code.

# If we have achievement systems
# we need function equals of two numbers
function equals(BigNumber n, BigNumber m){
    if (n.base = m.base && n.exponent = m.exponent){
        return True;
    } else {
         return false;
    }
}

And finally, I need the function to output numbers nicely.

suffices = [
    'K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp', 'Oc', 'No', 'Dc', 'Ud',
    'Dd', 'Td', 'Qad', 'Qid', 'Sxd', 'Spd', 'Od', 'Nd', 'V', 'Uv', 'Dv',
    'Tv', 'Qav', 'Qiv', 'Sxv', 'Spv', 'Ov', 'Nv', 'Tt'
];
# now we need "good view numbers" function
# for exapmle
# 1000 - 1000
# 1000000 - 1Million
function(BigNumber n) {
    #????????
}

sentences:
Switch UNet From LocalHost to IP I have set my game up so that I can run one instance as host and one instance as client and I see two people in the room. How do I get from that setup to another computer (as client) connecting to mine (as host) without matchmaking.

I understand I will need a static IP, and have set my router up for port forwarding (I tested it with an FTP server application I made). I am specifically asking for what options you select in the Unity NetworkManager to do this.

Here is my current NetworkManager (I erased the last number in my IP so I dont get DDos):

sentences:
3D models and hit detection I'm currently trying to create a game that involves the inside of a cube, which i will make in Maya. My question is what is the best way to create a model with hit detection in mind?

For example my model will be a cube that you can walk inside of, so should i make the cube as a one model or make one wall and put it together inside XNA?

The reason I ask this is because I'm sure that if I create a whole cube and then use XNA's bounding rectangle method, hit detection will always be true because the bounding rectangle will encompass the whole cube, making collision detection inside the cube non existent without the use of hard values.

Whereas separate walls would make the process easier because i will checking against separate walls instead of the whole thing.

To add to the problem, I also have doors in the walls so hit detection for the walls in that area need to be turned off.

What is the best way to do this?

sentences: Send a Push Notification from a device to another device (Unity, Firebase) I have setup Firebase authentication in my game for Android. I need to implement a feature in my Android game, where a user can challenge another player. I need to implement it this way: The user is shown the list of all users registered on Firebase on the Game. To any user, he can tap on a button for respective user to send a challenge. When, he taps, a push notification is to be recieved by that user. When he taps on the notification, he is redirected to a specific part of the game. Maybe a specifc scene for now and he is shown there the Challenger's name. I have explored the Firebase documentation, but it does not provide information for client-client push notifications. Maybe there are other options available like GameSparks and OneSignal. But I don't know if there is a requirement of own Server for implementing it.

sentences:
How can I play a particle system only when it's visible? I am making a game and it has a lot of particle systems in it as special effects, and all of them are supposed to be playing at the same time, but doing that will be heavy on the game's performance, then I thought:
Is it possible to play a particle system only when it is visible to the camera and stop playing it when it is out of range or hidden from the camera, maybe with physics raycasting? If it is, can someone help me to write codes that will do so.

sentences:
Calculate the starting position of a turning aircraft with inertial force to make it stop at desired position and heading Continued from the answer here, I have some problem when the aircraft in my game has inertial forces after going forward and turning itself. To illustrate, from the following image (https://imgur.com/a/Xvqu2A7) the aircraft is moving from the point A -> B -> C'-> D. I planned to maneuver the aircraft from the point C' which is the point that would make the aircraft stop at the point D after turning with its full performance (using minimum turning radius).

The question is how do I calculate the position of the point C' to make the aircraft roughly stop at the point D with the desired position and heading (It is roughly since there is also an inertial force after stopping the aircraft's engine.)?
Any suggestions and answers would be appreciated.

sentences:
Simple 3D OBB-Collision (DirectX9, C++) I'm trying to implement a simple OBB vs. OBB collision detection! I don't need to know where the collision occures, I only want to know whether a collision occures.

The problem is, that after lot of research in the internet I only found comments like "It's very simple, just use SAT in 3D" or some complex math. No examples anywhere!

In the best case, the algorithm should use the max/min Vectors of the boxes.

I know, that similar questions where asked before, but (I think) none of them had examples.

Apologise my bad english, I'm German and still in school! Also a reason why I want simple mathes. I hope you can help me and maybe supply me with some code.

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:
Shadow map artifacts I want to try adding shadows to a 3D XNA game. I've set up some testing environment with one light and one camera. However, I'm running into artifacts with my approach.

I'm using the shader code from http://pastebin.com/zXi0hmsU to render the final result and http://pastebin.com/rY4Gcj9N to create the shadow maps. The code is pretty straight forward and involves production of the depthmap from the light point of view, then projecting it into the camera space and checking for occlusions.

However, from most angles I am getting pretty ugly results

The scene consists of some simple cubes (constructed by hand, facing outside, backface is culled), one light (shadow map shown in top left corner - looks okay) and one camera.

My RenderTarget for the shadow maps is initialized by

int shadowMapSize = 512;
RenderTarget2D shadowMap = new RenderTarget2D(GraphicsDevice, shadowMapSize,
    shadowMapSize, true, GraphicsDevice.PresentationParameters.BackBufferFormat,
    DepthFormat.Depth24Stencil8);
GraphicsDevice.SetRenderTarget(shadowMap);
GraphicsDevice.Clear(Color.White);
GraphicsDevice.DepthStencilState = DepthStencilState.Default;

Afterwards, the CreateShadowMap effect is applied, followed by the LambertWithShadows effect. Finally, the shadow map is drawn using a SpriteBatch.

Rest of the code consists of simply providing the correct values to the shaders. If necessary, I can provide it at well.

sentences:
Writing to a structured buffer with a compute shader (D3D11) I have some problems writing to a structured buffer. First I create a structured buffer that is filled with float values beginning from 0 to 99. Afterwards a copy the structured buffer to a CPU accessible buffer is made to print the content of the structured buffer to the console. The output is as expected (Numbers 0 to 99 appear on the console). Afterwards I use a compute shader that should change the contents of the structured buffer:

RWStructuredBuffer<float>   Result : register( u0 );

[numthreads(1, 1, 1)]
void CS_main( uint3 GroupId : SV_GroupID )
{
    Result[GroupId.x] = GroupId.x * 10;
}

But the compute shader does not change the contents of the structured buffer.

The source code can be found here (main.cpp):
https://bitbucket.org/Vertexwahn/cmakedemos/src/4abb067afd5781b87a553c4c720956668adca22a/D3D11ComputeShader/src/main.cpp?at=default

FillCS.hlsl:
https://bitbucket.org/Vertexwahn/cmakedemos/src/4abb067afd5781b87a553c4c720956668adca22a/D3D11ComputeShader/src/FillCS.hlsl?at=default

sentences:
Lerp velocity in specific time How to lerp velocity to 0 in specific time? For example in two seconds? I need this for jumping.

velocity.Y = MathHelper.Lerp(velocity.Y, 0, [time]);

sentences:
Box2D meters and pixels I am confused about pixels and meters in Box2D. I know that Box2D work only in mters so I need SCALING FACTOR. How big I need it? For example I want that from my mouse coordinates position X and Y for example(1527, 30) throw an Box2D object how I need to do that?
if my scaling factor is private final static float PPM = 1/100f; so my

  x = 152,7,
  y = 3meters

Here is my code

private void setBox2DFigures(){
        world = new World(new Vector2(0,-9.81f), true);
        rend = new Box2DDebugRenderer();
        cam = new OrthographicCamera(); // Camera
        body = new BodyDef();
        bodyPhysics = new FixtureDef();

        CircleShape c = new CircleShape();
        body.type = BodyType.DynamicBody;
        c = new CircleShape();
        c.setRadius(20*PPM);
        c.setPosition(new Vector2(Gdx.input.getX()*PPM, Gdx.input.getY()*PPM));
        bodyPhysics.shape = c;
        world.createBody(body).createFixture(bodyPhysics);
}

and here in a draw method I want to coin position set to my mouse position

public void draw(){
    c.setPosition(new Vector2(Gdx.input.getX()*PPM, Gdx.input.getY()*PPM)); // mouse coordinates * PPM
    rend.render(world, cam.combined);

}

But I don't see anything in my screen. Whats wrong? How I need to choose My scaling factor(PPM)?

here's my main

public class DesktopLauncher {
    public static void main (String[] arg) {
        LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();

        cfg.title = "Catch Me!";
        cfg.width = 1800; //1800
        cfg.height = 900; //900

        new LwjglApplication(new Game(), cfg);
    }
}

sentences:
Batching dynamic sprites in OpenGL I'm trying to wrap my head around how batching is done in a 2D sprite-based game.  My understanding is I'd get the vertices that represent each sprite I want to draw and stuff them all into a single mesh.  That way I'd only need a single draw call to render everything.

Does this apply when the sprites I render are different between frames, or when some sprites are moving?  Because it sounds like I'd then have to recreate my batch mesh each frame, using either glDrawArrays/glDrawElements or a streaming VBO I assume.  Does this sound correct?

sentences:
How to reference a GameObject from the Scene Hierarchy in C#? I am a novice in Unity. I have a Game Object named 'courtsuit'; you can see it in my Scene Hierarchy panel here:

I added that object instance to my scene by dragging an OBJ file from my Project Assets folder into the Scene Hierarchy panel.

Now I want apply a material man to the game object at runtime. That is, when I click a button, that game object needs to change its material.

I tried and succeed by attaching a script to game object itself:

Material SphereMaterial;

// Use this for initialization
void Start()
{
    SphereMaterial = Resources.Load<Material>("Materials/man");
    if (SphereMaterial == null) Debug.Log("mat null");
    else Debug.Log("mat not null");
    Debug.Log("new Material: " + SphereMaterial.name);
    MeshRenderer meshRenderer = GetComponent<MeshRenderer>();

    // Get the current material applied on the GameObject
    Material oldMaterial = meshRenderer.material;
    Debug.Log("Applied Material: " + oldMaterial.name);
    // Set the new material on the GameObject
    meshRenderer.material = SphereMaterial;
}

But I don't know how to do this from an OnClick script on a different object, because I don't know how to locate the object in my Scene Hierarchy using C# script.

I want to do something like this:

public class ButtonHandler : MonoBehaviour {

    public void ButtonInteract()
    {
        Debug.Log("changing matriel ");
        // Change the material of the game object here

    }
}

How can I change the Game Object courtsuit's material to a material named 'man' from my Resources/Material folder using C#?

sentences:
Simulating Physics - dt vs formula I was just wondering, when simulating physics is it usually a good idea to get the time delta from the last frame and apply the relevant motion equations?

Something like:

void simulate(float dt)
{
    vel += (force / m) * dt;
}

In this case wouldn't there be an accumulated error over time due to precision? For example when trying to simulate a circular motion?

Or would it be better to get the entire elapsed time from the beginning, and then apply the motion:

void simulate(float elapsedTime)
{
    vel = vel0 + (force/m)*elapsedTime;
}

And since this doesn't depend on the previous simulate() steps, it's less likely to cause precision errors?

Thanks!

sentences:
Mapping a Touchinput-device in a 3D World for VR I have a Touch-Input device which is linked to my Unity Program and a VR Device.
The Touch-Input device which is bolted somewhere BUT the position can be changed.

I can get the "2D Coordinates"  X / Y from the touch input device (from 0 to 1)

For each of those 2D coordinates I also have a 3D-VR Coordinate , grabbed by a LEAP or gloves.
(Those coordinates are not always the corner ones.)

Here the problem on a wonderful paint art:

So what I have is the 2d and 3d positions of my fingertip (on the touch and inside the 3d world

And what I need is the a 3d Object (for example Cube) with correct rotation and position.

Bonus points for Scale!

sentences:
VBO interleaving dillema I'm trying to write a map editor for a unity game using openGL. In order to do that, I need to unpack it's resource files to get meshes, textures and other good stuff.

In doing so, I've discovered that unity mesh asset stores vertices, normals, texture data, and any other per-vertex type data in one interleaved array.

I have two choices here. First is to leave the data as is and push it into a single VBO and then use attrib pointer to adjust strides and whatnots to make it work. When I read data from file into memory, I can just read whole array with a single ifstream::read method call.

Second choice is to unravel all data into it's separate channels and have a separate VBO for each data type. I personally prefer it this way, but this means that I need to deinterleave that array. I'm unsure how to do this efficiently. The most obvious way (and very inefficient) is to read it char by char and store each char in appropriate array, depending on channel structure. I could maybe mess with it a bit and set it up to read it channel per channel (meaning 2-4 chars at once) instead of char by char. This still seems very slow to me.

Maybe I could load the whole array into memory and then deinterleave it there, but I'm still unsure of method that would be fast.

The priority is for the program to be fast while drawing, and deinterleaved multiple VBO setup is said to be faster due to lesser amount of cache misses.

To give you a sense of numbers, the game I'm looking at contains about 2630 different mesh assets, with each containing an estimated average of 500 vertices.

How do I deal with this? I will be loading all this data just once on program startup anyway, so it doesn't have to be super fast, but I don't want to force the user to wait for too long even then. Maybe number of vertices altogether is small enough for it to be very fast regardless, but I don't want to commit to either way before I have some idea of what I'm doing.

Bottom line is, should I just leave it interleaved, or is there some efficient way to deinterleave it? Am I jumping the train here, being scared of leaving it interlaved? I know I should probably benchmark both cases, but both cases are drastically different in my case and would require huge code changes, not to mention I'm nowhere close to actually drawing the scene I need to.

sentences:
Ledge climb animation and movement (2d platformer) Struggling to make a decision on the implementation of a ledge climb mechanic for a physics driven 2d platformer. What is the best way to go about this without it getting overly complex?

So far I understand (hobbyist here not a pro) there a few options including:

Apply controlled force to the rigid body on the y axis until the root position is just above the hand position then apply enough force on the x axis so as the character is standing on the platform. At the same time somehow sync this with the climb animation(s).

Remarks: movement is easy here and can even be controlled by a prismatic sliding joint but I'm unsure of how I would keep the animations (spine) in sync with the movement.
Root motion animation that drives the root position of the character. Teleport the rigid body when complete and hope box2d can still properly respond in time to any collision if any objects happen to fall from the sky.

Remarks: sounds easier to actually animate but not sure if I'll run into any problems with the spine runtime, box2d or later down the line moving platforms and varied height platforms.
Apply IK constraint programmatically on the hands to lock them in place and proceed to rotate the bones manually or apply small preset (few keys/frames) animations whilst applying the needed force to the rigid body at the same time.

Remarks: seems like this would give maximum control to the player but it sounds way to complicated for me to implement at my level, not exactly sure where I would start.

Thanks in advance for any input!

FYI: This is an ECS (libgdx + ashley) based engine with box2d. The ledge grab is already implemented as a separate system so we can assume here that the character is already capable of hanging from a ledge of any height.

sentences:
Hexagon grid gets cut off when generated outside of the JFrame I'm programming a hex-grid based game where you click on adjacent tiles to the player and when the player moves the map/grid moves in the opposite direction (using setLocation() on the jpanel inside the main jframe) so that, relative to the screen, the player is still centered.

When I pass in a big enough number of hexagons some of the grid generates outside of the jframe. When this happens, I can still make the player move around and open the menu and change player skins, but when moving north on the grid (when the top of the grid is what got generated outside the jframe) the grid just gets cut off and ends before the whole hexagon gets repainted.

I was wondering if there was a way to fix this that maybe I've simply just overlooked. My first thought was to delete and then regenerate the grid with new x,y coordinates each time the player moves and not use setLocation() at all, but I feel like that would be very inefficient and more of a brute force solution (last resort). I just feel like there has to be a more elegant or efficient way. I've tried using setSize(), setMinimumSize(), and setPreferredSize() methods to try and make the jpanel or the jframe's content pane bigger.

Picture to help:

sentences:
How do I clear a specific render target when more than one are set?  Or how do I keep the depth but clear the color? Let's say I set two render targets

GraphicsDevice.SetRenderTargets(rt0, rt1);

If I call

GraphicsDevice.Clear(Color.Transparent);

both render targets will be cleared.

Therefore, how can I clear a render target at a specific index?  For example just 'rt1' and not 'rt0'.

I would like to avoid texture baking the contents of 'rt0' to another render target and copying them back to 'rt0'.  This is because PreserveContents on the XBOX 360 can only hold one render target in memory.

EDIT:

Is there any way just clear the color for a render target?  I would like to keep the depth for depth reading.

sentences:
Why can't I use the operator '>=' with Vector3s? I am trying to get a rectangle to move between two positions which I refer to as _positionA and _positionB. Both are of type Vector3. The rectangle moves just fine. However, when it reaches _positionB it does not move in the opposite direction, like it should.

I went back into the code to take a look. I came to the conclusion that as the object moved, the if statements in the code missed the frame in which the rects position was equal to _positionB. I decided to modify the code to reverse direction if the rects position is greater than or equal to _positionB. My code is not too long, so I will display it below:

using UnityEngine;
using System.Collections;

public class Rectangle : MonoBehaviour
{
    private Vector3 _positionA = new Vector3(-0.97f, -4.28f); //Start position
    private Vector3 _positionB = new Vector3(11.87f, -4.28f); //End position
    private Transform _rect_tfm;
    private bool _atPosA = false, _atPosB = false;

    public Vector2 speed = new Vector2(1f, 0f);

    private void Start()
    {
        _rect_tfm = gameObject.GetComponent<Transform>();
        _rect_tfm.position = _positionA;
        _atPosA = true;
    }

    private void Update()
    {
        /*NOTE: Infinite loops can cause Unity to crash*/
        Move();
    }

    private void Move()
    {
        if (_atPosA)
        {
            _rect_tfm.Translate(speed * Time.deltaTime);

            if (_rect_tfm.position == _positionB)
            {
                _atPosA = false;
                _atPosB = true;
            }
        }

        if (_atPosB)
        {
            _rect_tfm.Translate(-speed * Time.deltaTime);

            if (_rect_tfm.position == _positionA)
            {
                _atPosA = true;
                _atPosB = false;
            }
        }
    }
}

When I changed it, however, it warned me of the following error message:

  Operator >= cannot be applied to operands of type Vector3 and Vector3.

This confuses me for two reasons; first, both values are of the same data type. Second, using the comparison operator(==) on the two values works without error. Why can't I use the operator >= with Vector3s?

sentences:
How to make a string[] from the words of a file in Unity? I have .txt file containing all the English words separated by line breaks.

I want to turn them to a string[] so I can easily pick a random one from them.

The way I would do that in normal C# is the File.ReadAllLines(path) function in the System.IO namespace.

But, I don't think that I can use System.IO with Unity so the alternative that I could come up with is the TextAsset class which I can use to reference an imported text asset and get its text property as a string.

But, if I have a giant string how can I simply split it up into individual words and store them as a string[]?

sentences:
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:
Is a separate thread for game loop compulsory for simple games? I am new to game development. In order to learn I am recreating this game on android platform. You can observe the game-play video at the above link. It is a simple game.

I have read a lot of articles on getting started with game development.Almost all of them recommended using a game loop on separate thread, which makes sense for other games. However, for this particular game do I need to start a separate thread ?

sentences:
Will unlocking the framerate in XNA/MonoGame tell me how efficient my code is? I have been unlocking the framerate in MonoGame via:

this.graphics.SynchronizeWithVerticalRetrace = false;
base.IsFixedTimeStep = false;

And using it as a basis for how efficient I am updating and drawing in the game.

At a resolution of 240 x 160 with nothing being drawn or updated except a frame counter I get an FPS value of 9,000 to 11,000 FPS.

If I add all my code back in it drops down to about 1,100 FPS.

Is this a good indication that my code is significantly slowing the GPU down (10x), and should I be concerned? The game is going to run at 60 FPS so I'm still pretty far away from that, but at what point in the unlocked frame rate should I be concerned?

GPU: AMD FirePro W5000 (FireGL V)

sentences:
How to set sprite source coordinates? I am creating own sprite drawer with DX11 on C++. Works fine but I dont know how to apply source rectangle to texture coordinates of rendering surface(for animation sprite sheets)

            //source = (0,0,32,64); //RECT

            D3DXVECTOR2 t0 = D3DXVECTOR2( 1.0f, 0.0f);
    D3DXVECTOR2 t1 = D3DXVECTOR2( 1.0f, 1.0f);
    D3DXVECTOR2 t2 = D3DXVECTOR2( 0.0f, 1.0f);
    D3DXVECTOR2 t3 = D3DXVECTOR2( 0.0f, 1.0f);
    D3DXVECTOR2 t4 = D3DXVECTOR2( 0.0f, 0.0f);
    D3DXVECTOR2 t5 = D3DXVECTOR2( 1.0f, 0.0f);

    VertexPositionColorTexture vertices[] =
    {
        { D3DXVECTOR3( dest.left+dest.right,  dest.top,              z),D3DXVECTOR4(1,1,1,1), t0},
        { D3DXVECTOR3( dest.left+dest.right,  dest.top+dest.bottom,  z),D3DXVECTOR4(1,1,1,1), t1},
        { D3DXVECTOR3( dest.left,             dest.top+dest.bottom,  z),D3DXVECTOR4(1,1,1,1), t2},
        { D3DXVECTOR3( dest.left,             dest.top+dest.bottom,  z),D3DXVECTOR4(1,1,1,1), t3},
        { D3DXVECTOR3( dest.left ,            dest.top,              z),D3DXVECTOR4(1,1,1,1), t4},
        { D3DXVECTOR3( dest.left+dest.right,  dest.top,              z),D3DXVECTOR4(1,1,1,1), t5},
    };

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:
Not able to connect to Photon(PUN).photon unity networking error I'm new to photon Networking. My game was working great suddenly this is appearing

Cannot send messages when not connected. Either connect to Photon OR use offline mode! UnityEngine.Debug:LogError(Object)

sentences:
Player movement behind objects I was playing around on RPG JS and Browser Quest, and the player, when moving, can give the effect of walking behind the trees or houses etc, so the player effectively disappears while it is "behind" the object.

How is this effect created?

I am building and RPG using javascript and canvas at the moment, and would love to try and implement this into the game. I am working on A* movement for my character.

sentences:
cocos2d mask rotation I've been experimenting with Ray Wenderlich's tutorial about masking sprite using shaders with cocos2D 2.0.

It works pretty well but now I'd like to rotate the mask independently of the masked texture.

Does anyone have any idea about how to achieve it ?

sentences:
Overlap transparent particles without blending? (Unity) I'm trying to create a continuous output of light from an object (like the exhaust of a space ship), and I thought I'd use particles to achieve this. But I'm running into a problem with alpha blending.

I'd like to decrease the particle system's alpha over time, but because there's such a high density of particles, they end up evaluating to a solid color for most of the system's duration.

This blog post basically shows what I'm trying to achieve: https://mispy.me/unity-alpha-blending-overlap/

The idea is to use a stencil test to make sure pixels in a sprite/particle aren't gone if they're overlapping another sprite/particle.

Pass
{
    Stencil
    {
        Ref 2
        Comp NotEqual
        Pass Replace
    }
}

Then the author adds an alpha cutoff to make sure transparent pixels on an underlying sprite don't prevent new pixels from being written.

half4 frag (v2f i) : COLOR
{
    half4 color = tex2D(_MainTex, i.uv);
    if (color.a < 0.3)
        discard;
    return color;
}

But this solution requires you to eliminate soft edges, so I'm thinking it wouldn't look good in a particle system. The author also hinted at an alternate solution involving ZTest, but I can't visualize what that would be.

sentences:
How to pass array of dozens of floats to OpenGL 3.0 vertex shader? I use PyOpengl and Python 3.

I have 50 thousand vertices. Position of each vertex could be calculated in vertex shader as

#version 300 es

uniform v_coefficients_weights[COEFFICIENTS_AMOUNT];
in vec3 v_coefficients[COEFFICIENTS_AMOUNT];
in vec3 v_initial_position;
out vec3 v_position;

void main() {
    v_position = v_initial_position + v_coefficients * coefficients_weights;
}

Amount of coefficients varies between 0 and 199 — it's not a problem  for me to generate 200 vertex shaders to cover each situation.
I need to change position of vertices tens of thousands times per application calls as fast as it's possible, so I cannot calculate them once on start.

Though, I cannot provide arrays for each vertex because documentation says:

  Attribute variables cannot be declared as arrays or structures.

I see following solutions of this issue:

(will not work) hardcode suffices of variables names to emulate arrays:

use vectors with names like coefficients_000, coefficients_001, ..., coefficients_199;
use matrices to have 4 vectors in each of variable — will it be better than previous solution with vectors (maybe performance of matrices product is faster than 4 products of vectors)?

calculate vertices positions by myself using C/NumPy;
calculate vertices positions by myself in parallel using OpenCL;
(will not work) store all coefficients in uniform int v_coefficients[COEFFICIENTS_AMOUNT*VERTICES_AMOUNT] and access needed ones according to vertex number, which will be stored in in int vertex_id;
store coefficients in textures (proposed by @HolyBlackCat).

Are there any other solutions of my issue? Is there optimal solution in proposed above?
Will I go out of memory if I will use 200 float 3-vectors for each vertex?

I imagine the solution with hardcoded indices as:

#version 300 es

uniform v_coefficients_weights[COEFFICIENTS_AMOUNT];

in vec3 v_coefficients_000;
in vec3 v_coefficients_001;
...
in vec3 v_coefficients_199;

in vec3 v_initial_position;
out vec3 v_position;

void main() {
    v_position = v_initial_position
        + v_coefficients[0] * coefficients_weights_000
        + v_coefficients[1] * coefficients_weights_001
        + ...
        + v_coefficients[199] * coefficients_weights_199;
}

sentences:
Can I create realtime textures with text? I have a large number of items in my game, that will eventually have a texture associated with them. The problem is, for right now, I have nothing. I would really like to do something with, say, the first 2 letters of the object's name. As my main system will be pure textures, I really don't want to add a text object to the texture, I would really like to just create a texture with the object's first two letters.

Is there a way I can create a texture, realtime, with font rendered on that texture? Preferably without a camera/ render texture, unless I can create them once. I really want to create a unique default texture for each item at runtime, preferably with some kind of font. Can I do this?

sentences:
Point system that is not competitive or has a clear goal I'm making a game in which the goal is to reach as much entries as possible and I want the player to see that he is making progress somehow. However the game shouldn't be of competitive nature (it co-operative), so I feel that points might not be the right measure. I thought instead of a progress bar, so you work towards a goal of entries. However the problem with this is that there isn't a specific number of entries the user should aim for; The more, the better.

Is there a way of showing progress without assuming there is an end and without it getting competitive?

sentences:
How do I calculate player retention (and other industry accepted stats) for a single-player RTS game? Suppose there is a typical desktop RTS game without online multiplayer on a Windows platform, like the original Warcraft: Orcs & Humans. It still connects to a server to log basic anonymous info about the player's sessions. Now it would be interesting to see customer (player) retention (and other stats) in an industry-accepted way.

What are some typical retention (and other stats) available to game developers, relevant to offline desktop games in general?

Unlike other games, RTS implies longer gameplay sessions (40min+). How does it affect retention calculation? What are some useful retention metrics (and other stats) in this case?

How to calculate above retention parameters, what statistics values are needed to do it?

sentences: What is the purpose of mesh optimization functions? I remember there is a specific function in Direct3D which optimizes a mesh or a 3D object in some way. What is the purpose of this function? How does it reorganize vertices to make it better?

sentences:
Marching cubes and LoD I have and octree based world constructed (on the start) via marching cubes with certain density function to make a terrain (variations on noises). The terrain is rater smooth, it is not like minecraft blocky terrain at all. The deepest level of LoD is 12 and on this level (let's say) player is moving. The player have an ability to place blocks (just like in minecraft) and dig holes (block-like) in terrain. The blocks are stored as an overrides to density function so that the rendering algorithm looks if there's an override for each point of the certain marching cube block, and if there is, it constructs solid block, or hole there. Pretty simple.

The question is, what technique of LoD do you recommend, when I move away from the certain place where I have put my blocks to sustain details on lower LoD levels as much as possible?

I can see two ways there:

Render the terrain separately on each LoD and custom geometry (blocks) leave as they are. What this means is that my terrain will contain all blocks I placed rendered on LoD 12 while the terrain will be on appropriate LoD. This will lead to resource drain because all my custom blocks need to be rendered with maximum detail not depending how close I am to them, but on the other hand my house I built will look as house from the distance.
Just interpolate weights when switching to lower LoD level. This will be fast, but it will change how my blocks look (or should I say it will change a lot how looks whole my construction) drammatically - if I make a house from blocks and move away, my house won't look as house anymore.

sentences:
Check if a point is touching a user drawn curve in HTML5 canvas I am having trouble detecting whether a ball is colliding with a red curve. The curve below is an example of what a user may draw on to the canvas. I can't think of any fast ways to detect collision between a green ball and the red line here.

I have thought of checking the color of the pixel every tick at the location of the ball, but this is very slow and the round ball will fill more than just the centre pixel. I have also thought about logging every single X, Z point that the curve drawer has inserted and then checking if the ball is near to the point, but this also seems like a bad method.

From a red curve drawn on to the screen by a user, what is the best way to detect whether a point is colliding with the red line? Shall I store every single point of the red curve or check the color of the pixel at the point to see if it is red or not?

sentences:
Background generation with sprites in 2D dimension in Unity I am making 2D game with Unity. I want to create a procedurally generated background with a bunch of sprites (space background, I have sprites of nebulas and stars). I want some area around the player to be filled with sprites to some extent.

How to make background filling with sprites inside area around player but outside camera visible area?

How to control generation according to players movement for generating in player moving direction only?

How to control the amount of filling sprites while generating?

sentences:
Does texture splatting always sample 4 x N textures per fragment (regardless of the weights)? Texture splatting - usually - is done by vertex painting, where each channel R-G-B-A is assigned as a different texture weight.

Due to the way shaders are executed, doesn't it mean that the fragment shaders will ALWAYS sample 4+ textures even if the weights are (1,0,0,0) or (0,1,0,0)?

Lets say some parts of the terrain are almost exclusively grass and the other part of the terrain is exclusively dirt, which means the times when more than one texture sample is necessary is very, very rare - on the transitions, but regardless 4 textures are sampled?

Or do GPUs perform some sort of optimization to minimize the impact of this?

sentences:
Is it possible to use a spherical collision component in UDK? I have an object in UDK, which has a SkeletalMesh. At certain times in the game, I want this object to continue rendering the SkeletalMesh, but I'd like it to use spherical collision temporarily.

After reading a bunch about PrimitiveComponents, my understanding is that UDK supports cylindrical and box-like collision, but not spherical without using a static mesh.

EDIT:
What I have now is a StaticMesh with a material that makes it invisible. I've added a StaticMeshComponent to my Pawns. I can shut off the Pawn's collision, and turn on the StaticMesh collision. But it doesn't respond to impulses. I figure I'm missing something in how you turn on the RigidBody thingy.

CylinderComponent.SetActorCollision(false, false);
SetPhysics(PHYS_RigidBody);
RBCollisionComponent.SetStaticMesh(RBCollisionMesh);
RBCollisionComponent.AddImpulse(InImpulse);
RBCollisionComponent.WakeRigidBody();

sentences:
Online board game engines I would like to create an online implementation of a board game. What engines could I use to write the game and make it easily accessible to as many people as possible?

I would like it to be as widely accessible as possible, so it would be best if the user interface would run in a browser, not in a separately downloaded app. Likewise, it should be cross platform, not limited to a single platform; pure JavaScript/HTML would be best, as that would allow it to be usable on the iPad as well, though Flash or Java may be acceptable. Silverlight doesn't have the market penetration (I don't have it installed, for instance) and XNA is far too limited.

Other features that would be nice would be good chat and social features (or integration with other chat or social network systems), leaderderboard or tournament systems, and easy integration of bots to provide AI opponents in case there aren't enough human players around. Game timers, to keep people moving at a reasonable rate, would also be good. Saving game records, and allowing people to replay and review records for study, would be nice too, though I'm not expecting much as those types of features tend to only show up in purpose-built engines for games like chess or Go.

Being free/open-source software would be a big plus, so I could extend it myself, though closed or hosted solutions might be acceptable if they provide enough of the above features or provide some means for extending them.

Are there any such systems that meet my needs? Or any that are close even if not exactly matching?

Some similar systems, that don't quite meet my needs, would include:

Yahoo Games, which is web based, but I can't write my own games for it (or any of many similar servers in that category).
Volity, which is built on SVG and XMPP. It's open source, designed to be an open standard, has support for bots, etc, but it requires a separate client download, and seems not to be actively developed or used any more.
SuperDuperGames, which is an open source, online system for doing turn-based (play-by-mail style) games. That is, it's not live or real time, but instead you submit your moves, and wait for someone to submit theirs, within the next day or so. It's an active community, but I want something where I can play games live, not over the course of weeks or months.

sentences:
How many BasicEffects do you have in a Game? What is the best way to render multiple objects/shapes at once? I'm trying to understand 3D rendering and it seems that everytime you render a new object (A 3D Cube or something) you need to have a new BasicEffect for each Box you render unless you want the exact same texture?

...so if I have over a hundred boxes with each different textures, I need at least as many BasicEffects? Will that not be "too much" for the CPU/GPU in the end or result in lagging? Is there any good way to render multiple objects (cubes or other shapes) at the same time?

I've tried changing the BasicEffect.Texture with each cube drawn, but it resulting in changing the first Cube's texture too.

Any suggestions would be really appreciated, I'm really new to 3D in XNA so I'm trying to wrap my head around the best methods for example render a Map with objects (of shapes).

Example:
I create some Cube3D (by providing location and size) and it creates a list of Vertices.

I have to render it this way:

            gameEffect.TextureEnabled = true;
            gameEffect.Texture = gameTexture;
            gameEffect.EnableDefaultLighting();

            foreach (EffectPass pass in gameEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                foreach (Cube3D cube in gameCubes)
                {
                    cube.Render(GraphicsDevice);
                }
            }

...thereby having the same Texture on each Cube. Are there any other ways?

sentences:
How to animate a model in WebGL? I created a human model in Blender, exported the vertices and indices into a JSON file and render the model in a browser using WebGL. Now I created a walk and jump animation in Blender and would like to do the same with WebGL.

I saw examples that use a list of vertices for every frame of the animation. Is this the way to go? Do I need to export the vertices for every frame for every animation?

sentences:
2D TileMap smooth lighting I want to implement (a smooth) lighting into my 2D Maps.
I want to have the basic idea. What I thought of is 2 components.

The Scene's Ambient light:
The Tiles and Sprites are tinted into this colour first.
For example if it's nighttime, the ambient color is very dark so you can barely see anything.

The Scene's Light sources:
The Light Sources have a Radius, intensity and a falloff. The more a tile or sprite is near a light source, the more it gets illuminated by it.

What I thought about the soft lights is that a tile/ sprite has a bounding. Since Tiles are always quadratic, I assume I can interpolate between all four edges of the bounding.The Edges of two neighbouring tiles have the same illumination,similar to vertex lighting in 3D. Does someone have an approach how to start this?

sentences:
Ray Caster - How do I fix fish eye effect on side walls? I've come here because I can't seem to find out what's wrong with my ray tracer.

I fixed the fish eye effect when looking straight on at walls, but the effect remains when the player is looking at walls to the side.

I think it's because most of the rays hit the surface close to the player, while fewer and fewer rays hit more distant walls, resulting in a curve. The only problem is I don't know how to make it appear linear.

    float dist = distance*cos(angle); //fix distorted distance
    float rat = (depth-(dis))/depth; //calculate ratio for wall height
    float h = 64*rat; //calculate height
    PImage slice = sprites[0].get((int)(inter/2),0,1,16); //get image slice
    image(slice,i*4,768-h/2,4,h); //display image slice

In this example, the top screen is the raw data while the bottom screen it the ray traced 2.5D image. I've made the rays visible.

Edit: I changes "rat" to be 192/dis. This seems to look a bit better, but is still slightly curved...

sentences:
Creating a basic character skeleton from code I'd like to have a procedural system that uses a string of data to create a 3d creature. The way I've thought to do this is to use the code to generate a simple creature skeleton (I'll get to the skin generation when I have time) so I can test different source data's effect on the structure produced.

How can i use a set of data to generate the simple 3d skeleton?

The code would have information used to show what type of bone it was(hierarchy), the bone length, and how the bone was positioned and use this to make the model. (At least in planning, I don't know how to implement it)

Edit: The goal is to create creatures of different forms and skeletons. The creation will be mirrored down the spine so both sides are the same.

I'd like it to be highly adaptable but I'd like to specify a max of 4 legs and 4 arms (8 limb max only 4 on ground for walking). Being able to create a basic structure for humanoids, quadrupeds, and mixes (like a centaur or biped with no arms) is the goal.

I've looked for how to create a model off of the code procedurally, looking at stuff like FRep isosurfaces and metaballs, but I'm stumped on how to make it happen. I decided any progress is better that none, so I'd like to get a generator for something like an animators skeleton example to make sure I can get working structures (and later have something to work with to begin working on the animation algorithm).

Sorry for the lack of information at first, I was trying to keep the question simple. If you have an idea for the creation of the structure(skeleton) or maybe even the form itself I'd appreciate the help. Thanks

sentences:
What's a simple way of sending game data between phones? Using windows phones I need to send small amounts of data between phones in a turn based game. It's only a few bytes of data and does not need to be real time, something like in wordfeud or similar. There could be 2-4 players in one game and one players actions need to be sent to the other ones.

What would be the simplest way to manage this?

If it would be possible to easily extend to other platforms with monogame that would be nice but not a requirement right now (guess I'll cross that bridge when I come to it).

My initial hope was that this would be possible using some online service like scoreloop or openXlive that could handle all the online stuff (leaderboards, communications, social etc) but I haven't found one that can do it all.

sentences:
Mythbuster: Mirror Operation with Quaternion Mirror operation : all vertex positions must be reflected by a specific plane (here YZ).Synonyms: FlipHorizontal, SymmetryX, MirrorX,

What implementations I already know that work:
1) Multiplying by -1 scale.
Unfortunately that is not allowed in unity because it messes with physics and lighting.
2) Vertex Manipulation. Yes, it works!!!

And now here comes the "Myth" from mr. evil person...
Mirror operation can be implemented if you get a "lucky" quaternion rotation. He says that:
a) if "euler rotation" suffers from Gimbal Lock, and Quaternion doesnt.
b) Then If quaternion (Matrix 4x4) cannot represent mirror operation, then increasing the #dimensions to Pentaternion (Matrix 5x5), Or Hexaternion (Matrix 6x6) is sure to solve the problem.

Note: I am not looking for "Reverse" operation (15 degree rotation converted to (360-15) degree rotation at that axis). I am looking for a way to "free" my model from those rotation limiting axes... I tried everything but couldn't achieve "Red" projection with a quaternion, maybe I miss something...

Is he right ? Or a quaternion cannot implement reflection and that myth is Busted?

Unity allows me to use all transform operations (Translation, Rotation, Instancing) but not scaling (messes up physics and lighting).

sentences:
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:
Typical Method Of Building Puzzle Levels I am designing a puzzle game for the iphone and was wondering as most puzzle games consist of the player progressing through multiple levels. You see for example Angry Birds has over 100 levels.

Once the basis of the game is made, how do developers typically go about building their levels?

Do they generally build them from scratch each one more or less, or work of their own template or have some other method which they use to tailor these levels?

I imagine building so many levels is a long process, certainly if building each one individually. Do they do this, or have a method which speeds it up once they have their basis?

sentences:
Unity dictionaries having duplicate keys EDIT: Restarting Unity solved the problem! ;)

I don't know if Unity and GameObjects have anything to do with this, but I am getting a strange duplicate Key error while scripting in Unity.

static void LoadPartyDataIntoBattle()
{
    foreach (PartyMemberData partyMemberData in ins.TheParty)
    {
        PartyMember partyMemberToAdd = new PartyMember(partyMemberData);
        BattleManager.BattleParticipants.Add(partyMemberToAdd);
        GameObject PartyMemberUI = Instantiate(ins.PMBattlePrefab, ins.PartyFrontRow.transform);

        PartyMemberUIDisplay display = PartyMemberUI.GetComponent<PartyMemberUIDisplay>();
        display.Name.GetComponent<Text>().text = partyMemberData.Name;
        display.Level.GetComponent<Text>().text = partyMemberData.Level.ToString();
        display.HPValue.GetComponent<Text>().text = partyMemberData.HP.ToString();
        display.TPValue.GetComponent<Text>().text = partyMemberData.TP.ToString();

        BattleManager.PMLinkDict.Add(partyMemberToAdd, display);
    }
}

In the line PartyMember partyMemberToAdd = new PartyMember(partyMemberData);, the new keyword should create a different PartyMember on the heap, correct? Yet when I run the debugger, attach it to Unity and play, the second time the foreach loop runs I get a duplicate Key error. For reference, I set the values of ins.TheParty (my list of party members) in the Inspector; there are three partyMembers in TheParty as of now. They have different names, attack, defense, etc. But that doesn't matter, does it? Isn't it the memory location that matters?

I made a test file to mimic the problem I had. It worked fine, no surprises here.

using System;
using System.Collections.Generic;

class Cow { }

class MainClass
{
    static void Main()
    {
        Dictionary<Cow, object> meDict = new Dictionary<Cow, object>();

        List<Cow> myCows = new List<Cow>()
        {
            new Cow(),
            new Cow()
        };

        foreach (Cow c in myCows)
            meDict.Add(c, new object());

        Console.WriteLine("Yay nothing broke"); // this prints just fine
    }
}

I feel like I'm overlooking something obvious, but I can't for the life of me figure out what the problem is. Help appreciated!

sentences:
How are potentially visible sets (PVS) determined in state of the art games? As I understand it,  potentially visible sets (PVS) are used to determine 2 things;
1. which objects are inside the camera's view volume
2. which objects are not occluded (hidden) from the camera's point of view.

I understand that things like octtrees & BSP trees have been used for PVS calculation in the past, but how are PVSs calculated in today's AAA titles?

sentences:
What should I consider when evaluating libraries, engines and frameworks for making a game? I'm going to make a game.  I've noticed that there are a lot of game engines, libraries, and frameworks available out there, and I'm having a little trouble deciding which one to use.

I'm already pretty good with some programming languages, but there are others which I don't know at all.  I'm not against learning new programming languages, if that'll help, but my real goal is just to make my game.

What criteria should I use to compare engines, libraries, and frameworks against each other, so that I can decide which one will allow me to be the most productive to finish my game?

sentences:
Would I need to delete unused assets from my Unity packaged build? I'm going to make a release for my Unity game.

Does Unity include unused assets in build output? Would removing unused assets from a project reduce build size/Time?

I want to know if Unity packages all the assets to my build (which I would need to delete), or if Unity packages only the assets that are actually used in the game.

sentences:
Why the canvas text is gray and not really white? This script change the text color to white:

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

public class DisplayInfo : MonoBehaviour
{
    public string myString;
    public Text myText;
    public float fadeTime;
    public bool displayInfo = false;

    // Use this for initialization
    void Start()
    {
        if (myText == null)
        {
            Debug.LogError(myText + " Is null please add Text component !");
        }

        if (myString == "")
        {
            Debug.LogWarning(myString + " Is empty, No text will be display.");
        }

        myText.color = Color.clear;
    }

    // Update is called once per frame
    void Update()
    {
        FadeText();
    }

    void FadeText()

    {
        if (displayInfo)
        {
            myText.text = myString;
            myText.color = Color.Lerp(myText.color, Color.white, fadeTime * Time.deltaTime);
        }

        else
        {
            myText.color = Color.Lerp(myText.color, Color.clear, fadeTime * Time.deltaTime);
        }
    }
}

This is the script i'm using with the DisplayInfo:

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 DisplayInfo displayInfo;
    public Canvas canvas;

    private RaycastHit whatObjectHit;

    private void Update()
    {
        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);

        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;
                displayInfo = whatObjectHit.collider.gameObject.GetComponent<DisplayInfo>();
                displayInfo.displayInfo = true;
            }
            else
            {
                image.color = Color.white;

                if (displayInfo != null)
                    displayInfo.displayInfo = false;
            }
        }
        else
        {
            image.color = Color.white;

            if (displayInfo != null)
                displayInfo.displayInfo = false;
        }
    }
}

When it's "Interactable" then i display the info about this object.

The DetectInteractable is attached to the Player (FPSController) in the hierarchy:

And on each "Interactable" item i attach the script DisplayInfo:
For example the door:

And this is the editor screenshot before running the game:
Display Infomration is Canvas. The Text i set it's color to white in the inspector.

But when running the game the text i see on objects is gray and i see that on the inspector the white is becoming gray: On the game view window there is a text Security Door in fray it's hard to see it. It should be in white and bright enough to see it clear:

sentences:
Black lines on sprites I am having the issue as seen below while using a textureAtlas with libgdx. I haven't found anyone else with the issue so I decided to ask here.

Here is an image of the textures in the game screen:

And to prove it's not a texture related issue, here is the spritesheet with the same background color as the game screen has applied:

Any suggestions? sorry for the sloppy write-up I am very preoccupied.

sentences:
Getting entity type object I have a custom entity class and what it does is create a SQUARE object.

public class Entity {
    Rectangle rect;

public Entity() {
    this.rect = new Rectangle(20,20);
    rect.relocate(200,200);
}

// I want it to be public Entity getEntity() {return this.rect;}
public Rectangle getEntity() {
    return this.rect;
  }
}

The problem is that I can't get my class to return an Entity object, instead of a Rectangle one.

How do I go about doing that?

sentences:
making Circle button in phaser im trying to make a circle button with tap event i used hitArea property from sprite class and using pixi Circle class i did that

this.sprite = game.add.sprite(50,50,"cursors");

        this.sprite.anchor.set(0.5,0.5);

        this.sprite.hitArea = new PIXI.Circle(50,50,84);

        this.sprite.inputEnabled = true;

        this.sprite.events.onInputDown.add(function(){

            console.log("clicked");
        });

    };

it is not working at all
so i tried removing  this.sprite.anchor.set(0.5,0.5);

input is work fine when there is no hit Area so what should i do

note :
phaser version is 2.2.2

sentences:
Raycast does not detect child layer if parent layer is set to ignore I have a LineRenderer that ignores certain Layers based on a Raycast using LayerMask.
I have a cube with a collider on a Layer which is ignored because of the LayerMask.
I have a smaller object inside the cube that is a child object of the cube and is on a layer that is not set to be ignored. I need the Raycast to hit the smaller object.

When this smaller object is un-parented from the larger cube, the LineRenderer behaves like I want it to: the hit data informs me it is being hit by the Raycast, but this does not hold true if the smaller object is a child of the cube.

Is there a way of having this behaviour without having to un-parent the smaller object? It's like the smaller object is inheriting the parent's Layer, despite being on it's own Layer - does this sound like what is happening?

sentences:
How to properly calculate y position when drawing from .fnt bitmap font? I want to render text to bitmap to use it later as a decal texture. I've read through libGDX fonts drawing code and came up with this:

private void writeTextToPixmap(Pixmap destPixmap, Pixmap fontPixmap, BitmapFont.BitmapFontData fontData, int startX, int startY, String text) {
    int cursor = startX;

    char[] chars = text.toCharArray();
    for(int i = 0; i < chars.length; i++) {
        BitmapFont.Glyph glyph = fontData.getGlyph(chars[i]);
        destPixmap.drawPixmap(fontPixmap, glyph.srcX, glyph.srcY, glyph.width, glyph.height, cursor + glyph.xoffset, startY + glyph.yoffset, glyph.width, glyph.height);
        cursor += glyph.xadvance;
    }
}

The font was generated with Hiero using default settings.

But the result does not look as expected:
http://i.imgur.com/T7Isg2R.png

Usage:

    Pixmap pixmap = new Pixmap(1024, 1024, Pixmap.Format.RGBA8888);
    BitmapFont.BitmapFontData fontData = new BitmapFont.BitmapFontData(Gdx.files.internal("data/couriernew.fnt"), false);
    Pixmap fontPixmap = new Pixmap(Gdx.files.internal("data/couriernew.png"));
    writeTextToPixmap(pixmap, fontPixmap, fontData, 300, 400, "ga");

sentences:
Generate levels in real-time with the Procedural CityEngine Has anyone used the Procedural CityEngine to generate levels in real-time?

It seems to get used in production or pre-production due to its sizable overhead, but has anyone tweaked it to run in real-time either in a test or in a game?

Edit: Please include the person or group who did this, the game or test it was used in and a brief description of how it was done.

sentences:
Ericsson compression for normal and bump maps how does ETC2 fares when compressing normal maps and bump/height maps?

Since we are talking about using an algorithm created for visual fidelity, applied to vector and numerical data ⃰ I'm quite sure that the answer is "horribly" and "quite bad" respectively, but since I didn't found much about the topic online, I would like to hear about your experience on the matter.

Thank you!

⃰ compressing a matrix using jpeg is the best comparison I might think of at the moment

sentences:
How to render animated models via instanced rendering? I have an animated model with a maximum of 60 bones. That means i have an array of 60 matrices when i want to render the model. Previously i would just create a uniform with the fixed size (mat4[60]), but now i want to render the model via instanced rendering, which means i need to write 60 matrices per instance into the VAO of the model.

This would mean i have to create 240 vertex attributes each containing 4 floats because thats the maximum number of floats an attribute can have. This is obviously a ridiculous solution, besides the fact that i think it exceeds the maximum number of attributes a VAO can have.

So how do i render animated models via instance rendering?

sentences:
OpenGL FBO to OpenCV image I am trying to figure out the best way to share an image between OpenGL and OpenCV libraries. I perform a render to texture on OpenGL, so I have and FBO/texture that then I want to pass it OpenCV, where (ideally) I will be some GPU stuff with it.

I know a naive way would be using glReadPixels, but this is obviously way to slow. It requires to copy the data from GPU memory to memory and then load it through cvLoadImage or similar in OpenCV.

I am pretty sure there must be a way to bind or map the memory from OpenCV, so I can "load" an image by just accessing to its FBO pointer or something like that... but I cannot figure out how.

I have goggled a lot about it, and so far I could just find this answer that I don't quite understand. What do they mean by glbuffer.bind();?

Any guess? Thanks.

sentences:
Handling Event for multiple Sprite with one Event Listener in Andengine In my app i need to add multiple sprite and add event to them. What i am doing now is using individual event listener for each and every sprite which is a kind of mess.

buttonS[0] = new Sprite(x_pos += 0, y_pos, orangeNumImage[0], this.getVertexBufferObjectManager()) {
        @Override
        public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
            if(pSceneTouchEvent.isActionDown()) {
                //Perform Some task
                }
                return true;
            } else {
                //Perform Some task
                return false;
            }
        }
    };

    buttonS[1] = new Sprite(x_pos += 115, y_pos, orangeNumImage[1], this.getVertexBufferObjectManager()) {
        @Override
        public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
            if(pSceneTouchEvent.isActionDown()) {
                //Perform Some task
                }
                return true;
            } else {
                return false;
            }
        }
    };

I was searching to handle this event with just one event listener and make the code shorter.

In normal android (without andengine) we could use something like this (by using android:onclick to areaTouched in button):-

public void areaTouched(View view) {
    Button nextclick = (Button) findViewById(R.id.button_nextClick);
    Button b = (Button)view;
    int check = Integer.parseInt(b.getText().toString());
    if (check == i){
          ........
    }
}

sentences: getting direction of x and y... north,south,east,west I have a player in the center of the screen, where I also have my mouse position origin. (0,0)  I would like to know the direction of the mouse, imagine splitting the screen with a  X, so the top quadrant would be north, the bottom would be south... and so on. So if my mouse was at 5,-100 it should log ("North")  as that is just a bit to the left and up 100 pixels.

sentences:
What's wrong with my planar reflection? At some angle my mirror with planar reflection shows this result. Looks like it mix with the sphere reflection capture.
How to fix it?

sentences:
Conditional Defines and HLSL Is it possible to use project level conditional defines in hlsl code?

I'm trying to conditionaly compile a shader using MonoGame Content Procesor. Depending on project type (ie. Windows, Windows8...) different shader models should be used.
Pragma directives are supported. The code:

#if WINDOWS
   PixelShader = compile ps_3_0 PixelShaderFunction();
#else
   ...

... doesn't work as WINDOWS is interpreted as false. Judging from the article on Gamasutra this should work. This answer on Gamedev lists constants which should be defined when using MonoGame.

I've also tried adding constants into csproj manually (in content project, then in dummy content compiler csproj).

Is there something I'm missing?

My sln structure is as follows:

MonoGameContentProject - holds .fx file
MonoGameDummyProject - has
content reference to content project, builds .fx file
WindowsProject - has a link to dummy project xnb file in the windows build directory

sentences:
Creating a 3D mushroom cloud Hi I am trying to create a mushroom cloud animation for my strategy game. Something like this. I have been looking at info for creating explosions in general, and the way to go seems to be using 2D sprites and billboarding. However, I don't think this will work in my case as mushroom clouds have a specific orientation, and I am using an arcball camera as my game takes place on a globe.

I've thought about using some kind of particle system, but it seems pretty complicated to make as opposed to using a sprite sheet.

What would be the best way to create a nice looking mushroom cloud?

sentences:
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:
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:
Unity Pixel Perfect Camera - Adjusting the Viewport Rect? I am trying to make a pixel perfect Tetris style game.
I have the pixel perfect component attached and have tried playing with settings such as Crop Frame and Stretch Fill. It seems to override any setting made to the 'Viewport Rect'.
The problem here is I want to control where the play-area is shown on the screen. For example I want the single player game to be somewhere near centre (although preferrably slightly off to the left). But when they play 2-Player mode I want the P1 playarea to be near left, and P2 area at the right.
The screens below shows some of the settings I tried. The 3rd screen shot shows the play area approaching what I want, but I am unable to move it left to right for example (Im unable to move it at all).
(Also note, if I try leaving CropFrame and StretchFill unchecked my Camera Size value is also overridden).
I even tried to 'extend' the Pixel Perfect Camera class but haven't been able to do that, I'm starting to wonder if this is just a limitation of using this component and perhaps I would need to write my own implementation of the pixel perfect camera to achieve the full control I need.
UPDATE: Actually I am able to extend the Pixel Perfect Camera class by 'using UnityEngine.U2D'. So far this is what I am trying whilst I wait in hope of further help (It seems like a lost cause extending the class, because I am not sure I can override much from it and cannot see the code. I can't find a way to set the Viewport X or similar). All the best everyone!
Thanks for any help.

sentences:
Help finding coordinate for left of screen in this frustum I have a frustum with l=-2, r=2, n=0.5, f=10, corresponding to left, right, near, far respectively. I also define top and bottom too.

I've set the camera eye up at (0, 0, -2.5), looking directly at (0, 0, 0) with up (0, 1, 0).

Suppose I want to position an object centred at z=-1. I want to find the x coordinate so that under this frustum it appears exactly centred on the left edge of the screen.

I set up the following diagram to help me:

                       +z
                       |
            \          |          /
     -x<_____\_________|_________/______>x
              \____x___|-1      /
               \       |       /
                \      |      /
                 \_|l|_|     /
                  \    |    /     |near dist=n=0.5
                   \   |   /      |
                    \  |  /       |
                     \a| /        |
                      \|/         |
                       |-2.5
                       |
                       -z

So to find x I can use simple trig. Since tan a = |l|/n and tan a=x/1.5 then the formula for x is x=|l|/n*1.5=2/0.5*1.5=6, where |.| is the absolute value.

But when I use this x value to draw an object left of the centre, it does not appear centred at the edge of the screen. I can see the object but it's not on the edge. Moreover, if I increase n then the gap between the object and the left edge increases. What am I doing wrong?

UPDATE

Empirically I have discovered that if I compute x=|l|/n*2.5 then my object is correctly centred on the left edge of the device screen, and works for any n value I choose. Not sure why 2.5 works...

SOLUTION

Not really worthy of an answer, but I found in some legacy code that the renderer was set up to transalte the z forward by 1 unit, so this was undoing my -1 z value, hence why multiplying by 2.5 worked and not 1.5.

Despite this annoying fact, I'm now confident I fully understand how the frustum fits into OpenGL.

sentences:
How to make the bullet stop accurately when destination is reached? In the below code, is the method I use to move a bullet to its destination and stop when bullet is near to destination. But the problem is the bullet is stopping not accurately, sometimes there's a small offset or span or sometimes is accurate depends on the angle.

public Vector2 getVelocity(Vector2 currentPosition, Vector2 targetPosition) {
    Vector2 targetDirection = targetPosition.cpy().sub(currentPosition);
    return targetDirection
            .nor();
}

final float SPEED = 6;
float pos = bulletPosition.len();
float des = bullet.destination.len();
float tol = Constants.TIME_STEP * SPEED;

if(MathUtils.isEqual(pos,des, tol)) {
    body.setLinearVelocity(0,0);
} else {
    body.setLinearVelocity(getVelocity(bulletPosition, destination).scl(SPEED));
}

[SOLVED]

if(MathUtils.isEqual(pos, des, tol)) {
     // quick & dirty way
     body.setTransform(destination, angle);
     // better way
     ...
}

sentences:
Display Rich Text in a TextMeshProUGUI component I am rading a text to be displayed in a Text UI from an asset using the standard commands

Resources.Load<TextAsset>("nameOfMyTextAsset");

The text is a .txt.

The text contains richtext tags to format the text in bold or italics.
The richtext tags are displayed as such.

I am using TextMesh Pro and insert the text via the following cmd

public TextAsset MainText;
MainText = Resources.Load<TextAsset>("nameOfMyTextAsset");
this.GetComponentInChildren<TextMeshProUGUI>().text = MainText.text;

The text is displayed like this

How can I read text with richtext tags from a text asset?

sentences:
Multiple texture coordinates per mesh? So far I've used the same texture coordinate for both the normal and diffuse textures on a mesh, yet when reading the Assimp documentation (http://assimp.sourceforge.net/lib_html/structai_mesh.html#details) on a Mesh, it implies that there can be more than one texture coordinate sets per mesh.

My question is, in general what scenario would these be present and what is their purpose?

sentences:
Should the objective of a game be obvious to the player? Watching game dev talks and reading articles about 'good' game design, it seems consesus a game should always make the objective obvious to the player, making clear what 'skill check' is being made and what to do to advance in the game.

Thinking about this, I don't agree. Figuring out what the game wants you to do was an important aspect of older games like e.g. Silent Hill or Castlevania: Symphony of the Night.

In Silent Hill you have a map with marker notes on it, which add up progressing the story. These notes are more a 'log' of what happened, than a 'to do list'.
Newer games, instead of kindly pointing the player to another part of the level, tend to be too helpfull, providing specific instructions on where to go and what to do there.

Is this type of challenge deprecated? In order to increase the market penetration of games? Or are there objective reasons to abandon this approach to game design? What are alternatives to this kind of challenge?

sentences:
Unity | How to create C# classes with different properties like Objects in javascript and put them in an array? I just started my gamedev journey on unity this week and while I have a background with coding, I'm still somewhat of a beginner. Last year I made a text/UI based game on the web browser with javascript and have been trying to make the same game on Unity.

One of the main features of my game is that you press a button to "go hunting" and I had an array filled with enemies that were objects with different properties such as health, mana, attack, etc...

Then I'd randomly pick one of those objects from the array to be chosen as my enemy that I'd fight. I've been trying to figure out the best way to do this with C# and I might just be overthinking this.

As a bonus, I'd also like to be able to see the individual enemy objects in the array in my inspector if possible so I could tweak the stats within unity.

I've looked at scriptableObjects and different things but I am having a hard time putting it all together in an array from within unity.

[System.Serializable]
public class playerClass
{
    public string playerName;
    public int lvl;
    public int maxHealth;
    public int health;
    public int maxEnergy;
    public int energy;
    public int exp;
}

public class playerScript : MonoBehaviour
{
    public playerClass player;

}

This is how I created an object for the player, I want to do something similar for the enemies but put them in an array so I could randomly pick from them.

If there is a better way to do this I'd also welcome some advice :) thank you

sentences:
Rotating an object to point towards the mouse I'm using slick2d for this process and trying to rotate a minigun to face the mouse. My problem is that the minigun in my game is actually rotating but no towards the mouse at all! Also, the minigun goes as far as 180 degrees and stops there.

Here is my minigun class that I have put inside another core class to be updated and rendered.

public class Minigun {

    private Animation Shoot;
    private SpriteSheet sheet;
    private int x = 200, y = 150;
    private double angleToTurn;
    private Input input;

    public Minigun(){
        try {
            sheet = new SpriteSheet(new Image("res/minigun.png"), 130, 34);
            Shoot= new Animation(sheet, 1, 0, 2, 0, true, 1, true);
            Shoot.setLooping(true);
            input = new Input(1);
        } catch (SlickException e) {
            e.printStackTrace();
        }

    }
    public void render(Graphics g){
        g.pushTransform();
        g.rotate(x + Shoot.getWidth() / 2 , y + Shoot.getHeight() /2,   (int) angleToTurn);
        Shoot.draw(x, y);
        g.popTransform();
    }
    public void update(){
        double mX = input.getMouseX();
        double mY = input.getMouseY();
        angleToTurn = Math.toDegrees(Math.atan2(mY - y, mX - x));
        System.out.println(angleToTurn);
    }
}

sentences:
Getting invalid argument error on R32G32B32_FLOAT texture creation D3D11_TEXTURE2D_DESC texDesc;
    texDesc.ArraySize = 1;
    texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
    texDesc.CPUAccessFlags = 0;
    texDesc.Format = DXGI_FORMAT_R32G32B32_FLOAT;
    texDesc.Width = width;
    texDesc.Height = height;
    texDesc.MipLevels = 0;
    texDesc.MiscFlags = 0;
    texDesc.SampleDesc.Count = 1;
    texDesc.SampleDesc.Quality = 0;
    texDesc.Usage = D3D11_USAGE_DEFAULT;

    D3D11_SUBRESOURCE_DATA data;
    data.pSysMem = finalData.data();
    data.SysMemPitch = width * 3 * sizeof(float);
    data.SysMemSlicePitch = finalData.size() * sizeof(float);

    HRESULT hr = device->CreateTexture2D(&texDesc, &data, &texture);

I just can't see what's wrong. I am absolutely certain that the vector is properly initialized, that there is three floats per pixel and that the width is the given width. What's wrong? And the vector is of type float.

I've tried zeroing out the subresource data and just setting pSysMem, but no go.

Please help.

sentences:
How can I improve the performance of texture switching without resorting to atlasing? I'd like to use texture images that are not a sprite sheet or other form of texture atlas, mainly because I'll be consistently adding and swapping textures while I figure out the direction my game takes.

In Java, I'm using slick2d's TextureLoader to load a texture, and then I bind it with an unique id. However, when not using a spritesheet I have many more images to bind, which causes a potential performance problem. I've noticed that calling glBindTexture for every block I'm drawing is bad, it drops my FPS to 1.

I'm already rendering blocks with glCallList so I've found a middle-ground. I bind a single block texture and then render all blocks of that type in the chunk, and repeat for each unique block type. However, that's still less than preferable.

Is there a better way to efficiently use multiple textures without an atlas or sprite sheet?

sentences:
Change color of selected polygons I have a "low poly" surface, where the color palette for polygons is low (e.g. 20 distinct colors). Is there a way to change the color (with a smooth transition) for all polygons painted with a certain color?

Maybe an analogy would be to smoothly make all polygons of a certain color transparent..

Background:

I have managed to get a 2D variant working: load a bitmap on a canvas and use a shader to change the color.

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

Are they compatible with Android 2.2+ ?

Which program creates mipmaps?

How do you actually use in code?

sentences:
MMO sending player position to other players When it comes to sending data to a player in MMOs, is this what the server is basically doing? (pseudo code)

every gametick:
    for each player connected:
        compile `string` of positions of all other players in range
        if `string` different `lastString`:
            send data to player
            set `lastString` to `string`

sentences:
Particle System is not Playing I made a simple spaceship that has a particlesystem. When I press "space" button, spaceship should fly and particle system should instantiate and play. But it's not playing. It seems in hierarchy as clone but not playing.
As you see, particle effect is instantiating but not playing. It should play at bottom of spaceship
Those are codes
void FlyShip()
{

    if (Input.GetKey(KeyCode.Space))
    {

        rb.AddForce(Vector3.up * jumpForce);

        if (!takeoffSound.isPlaying)
        {

            // _rocketJetParticle is gameobject.
            _rocketJetParticle = Instantiate(rocketJetParticle, new Vector3(transform.position.x, transform.position.y - 4, transform.position.z), transform.rotation);
            takeoffSound.Play();

        }

    }

    else
    {
        //Destroy(_rocketJetParticle);
        takeoffSound.Stop();

    }

}

sentences:
Libgdx Box2d createfixture crashes vm intermittently I have a hard to debug problem.  I have a Box2D game which creates a wheeled vehicle.  I want the vehicle body to reflect when it goes from moving left to moving right.  to do this i set a flag in a changelistener on a button and then in update method i destroy and recreate the body facing the other way.  it works fine most of the time but if i flip the vehicle several times quickly JVM crashes.  no errors nothing in log.

i added system.out.prints and the errors occur in the routine that instantiates the new body and before anything gets deleted/removed so i don't think the UI is trying to access null pointers.  and if it was it should throw an error.
 M
the crash seems to be at createFixture statements.  but the work most of the first time. I tried debugging but the error doesn't happen much when the flips are slow.  in any case createFixture drops fairly quickly into jni.

Is this a Box2D bug?  Is GC the issue?  From Mission Control I see the GC is collecting on a period of ooh maybe 5s and flipping slower than that mostly works.

how do i debug this?

i am win7 64bit with 64bit at and jdk7 64bit.  libgdx-0.9.9 and sometimes libgdx-nightly-20140215.

sentences:
Procedural star field generator Is anyone aware of any code to procedurally generate star fields?

Ideally I'd like it to be physics-based so I can have realistic planets and moons.
Best would be in C++, open source, and workable with Ogre3d.

I'm not afraid of coding something from a university paper if there's nothing available.

sentences:
How would I go about using FXAA in XNA? This isn't so much a "give me teh codez" as it is a request for the "right" steps to go through.

I want to implement FXAA in XNA, but I'm a relative newb to the graphics side of game dev, so I'm not sure what the most efficient way to do this would be.

My first hunch is to render the scene into a texture, and then render that texture on a rectangle, with the FXAA code in a pixel shader.

However, I would actually be surprised if there was no more efficient way to do it.

sentences:
2D lighting causes black rings to appear A year ago I implemented 2d lighting in XNA using sprites.
The sprites I used were created by placing a soft white photoshop brush on a transparant background.

The result was this: (lights only)

And this seemed right to me.

I returned to the subject this week to try replacing the sprites with a texture created with code and a formula:

As you can see, there is a black ring around every light.

This is the code I used for creating the textures:

int diameter = 250;
int radius = diameter / 2;

Color[] colors = new Color[diameter * diameter];

for (int y = 0; y < diameter; y++)
{
    for (int x = 0; x < diameter; x++)
    {
        Vector2 l = new Vector2(radius, radius) - new Vector2(x, y);
        float attenuation = MathHelper.Clamp(1 - Vector2.Dot(l / radius, l / radius), 0, 1);

        colors[x + y * diameter] = Color.White;
        colors[x + y * diameter].A = (byte)(attenuation * 255);
    }
}

Texture2D texture = new Texture2D(device, diameter, diameter);
texture.SetData(colors);

I got the attenuation formula from here.

Aside from that I now create the textures using code, the rest of the code has remained the same.

Where do the black rings come from, and how do I prevent them from appearing?

sentences:
Print string letter by letter in UI Text i'm trying to print a string letter by letter for UI Text of Unity.
With each click of a button, the Stampa function, must print a letter. Up to this point everything is working perfectly.
But if I try to print a newline "\n" the function ignores him and continues to print on the same line.
This is my code:

using UnityEngine;
using UnityEngine.UI;

public class Click : MonoBehaviour {

    public static Text txt;
    public static int indice = 0;
    public string asd = "String1 \nStriga2";

    void Awake() {
        txt = GameObject.Find("Cmd").GetComponentInChildren<Text>();
    }

    public void Clicked() {
        Stampa(asd ,indice);
        indice++;
    }

    void Stampa(string stringa, int i) {
        txt.text += stringa[i];
    }

}

That produces this result(unwanted):

I also tried to print the entire string at the same time (not a letter at a time) as follows:

txt.text = "String1 \nStriga2";

That produces this result(wanted):
How can I get this second result by printing letter by letter?

sentences:
Array Out Of Range Exception I have been working on my this aspect of my project since last night and have finally got this code to work exactly as I want it to.

However if the first target is removed before the second one, I get an out of range exception. I would like to know if there is a better way to fix my problem.

void LateUpdate()
{
    if (targets.Count == 0)
        return;
    Move();
    Zoom();
}

void Move()
{
    GetBoundsData();
    Vector3 newPosition = new Vector3(centerPoint.x + offset.x, transform.position.y, centerPoint.z + offset.z);
    transform.position = Vector3.SmoothDamp(transform.position, newPosition, ref velocity, smoothTime);
}

[SerializeField] Bounds bounds;
[SerializeField] Vector3 centerPoint;
public Vector3 maxBoundsPoints;

void GetBoundsData()
{
    if (targets[0] == null)
    {
        targets.RemoveAt(0);
    }
    if (targets.Count == 1)
        centerPoint = targets[0].position;
    SetUpBounds();
    centerPoint = bounds.center;
    maxBoundsPoints = bounds.max;

}

void SetUpBounds()
{
    bounds = new Bounds(targets[0].position, Vector3.zero);
    for (int i = 0; i < targets.Count; i++)
    {
        if (targets[i] == null)
        {
            targets.RemoveAt(i);
        }
        bounds.Encapsulate(targets[i].position);
    }
}

sentences:
Unity3D GUILayout Window Wont Show Components I am fairly new to Unity, but picking things up quick. This is actually one of the first problems I have come across that has me stumped.

I am trying to print a good amount of components onto my GUI on top of my window.

Although, I can only see half of only one component at the upper left hand side of my window, in which the label says "Name". I can actually only see Na and half of the m.

(If I do NOT use the window, and just paint my components out on my OnGUI everything will paint just fine and looks exactly how I want)

To me, this sounded like some sort of Rect(); issue or something along the lines of the width and height not being set properly...Although they are.

Ill provide all the code that has any relation to the GUI. (There is only one object this script is attached to and it inherits from MonoBehavior)

You will notice that the Rects() or any Width/Hieght will be set to some high number, it was just to make sure it wasnt that line of code screwing up my window.

public GUISkin mySkin;
public Rect windowRect = new Rect();

void OnGUI() {
    GUI.skin = mySkin;
    DisplayBox();
}

private void DisplayBox() {
     windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "", GUILayout.Width(800));
}
void DoMyWindow(int windowID) {
    DisplayName();
    DisplayPointsLeft();
    DisplayAttributes();
    DisplayVitals();
    DisplaySkills();
    DisplayCreateButton();
    DisplayResetButton();
}

These functions in the DoMyWindow just call GUI.Component statements to paint the gui.

Like I said above, if I dont use the window everything works perfect.

Also, you'll notice that the windowRect has no params. Its public and they are altered to extremely high numbers in the inspector. Still no result

What am I doing wrong?

sentences:
Overriding all object inspectors in Unity How can this be done? I want to add a single label to every component( including non-misbehavior ones ) in the inspector. I've tried:

[CustomEditor( typeof( Object ) )]

And:

[CustomEditor( typeof( Component ) )]

This seems to work for all components that don't seem to have a custom editor already( like BoxCollider, and Transform ). It seems if a component has a custom editor already, it ignores the one I've defined. Even if I change the attribute to this:

[CustomEditor( typeof( Transform ) )]

There is still no change to the Transform inspector. How can I define my own custom editor for these components?

sentences:
Align SpriteText position i have this function which aligns text.

static function AlignTxt(obj : GameObject, txtAnchor : SpriteText.Anchor_Pos,
txtAlign : SpriteText.Alignment_Type)
{
obj.GetComponent(SpriteText).SetAnchor(txtAnchor);
obj.GetComponent(SpriteText).SetAlignment(txtAlign);
}

The above function is called from this function..

txtlib.AlignTxt(powerTxt, SpriteText.Anchor_Pos.Middle_Left, SpriteText.Alignment_Type.Center);

But i get this error on AlignTxt Function :

The name 'SpriteText.Anchor_Pos' does not denote a valid type ('not found').
The name 'SpriteText.Alignment_Type' does not denote a valid type ('not found').

Can you please help me to solve the error..Thanks..

sentences:
Get the XZ to the right of a rotated point? I need to do this entirely with math, take a look at this picture:

What I'm doing is building a path finder algorithm that basically looks 30 units ahead, raycasts a few times perpendicular to the future point, finds the midpoint between the min/max vectors that found the dirt road, and puts a green cube in the middle.

I thought this would be rather simple, yet here I am trying to figure out how to plot the exact geometry of a rotated left/right projection.

I hope I explained this well enough!  I'm also open to suggestions on how to do this if my approach is silly.  Eventually this path will split and the algorithm has to detect the split and have the user decide which direction to go.

EDIT: After applying the math below (I opted to use the trig version) I go this result on my algorithm.  THANK YOU!!!

sentences:
Calculating Directional Shadow Map using Camera Frustum I'm trying to calculate the 8 corners of the view frustum so that I can use them to calculate the ortho projection and view matrix needed to calculate shadows based on the camera's position. Currently, I'm not sure how to convert the frustum corners from local space into world space. Currently, I have calculated the frustum corners in local space as follows (correct me if I'm wrong):

float tan = 2.0 * std::tan(m_Camera->FOV * 0.5);
float nearHeight = tan * m_Camera->Near;
float nearWidth = nearHeight * m_Camera->Aspect;
float farHeight = tan * m_Camera->Far;
float farWidth = farHeight * m_Camera->Aspect;

Vec3 nearCenter = m_Camera->Position + m_Camera->Forward * m_Camera->Near;
Vec3 farCenter = m_Camera->Position + m_Camera->Forward * m_Camera->Far;

Vec3 frustumCorners[8] = {
    nearCenter - m_Camera->Up * nearHeight - m_Camera->Right * nearWidth, // Near bottom left
    nearCenter + m_Camera->Up * nearHeight - m_Camera->Right * nearWidth, // Near top left
    nearCenter + m_Camera->Up * nearHeight + m_Camera->Right * nearWidth, // Near top right
    nearCenter - m_Camera->Up * nearHeight + m_Camera->Right * nearWidth, // Near bottom right

    farCenter - m_Camera->Up * farHeight - m_Camera->Right * nearWidth, // Far bottom left
    farCenter + m_Camera->Up * farHeight - m_Camera->Right * nearWidth, // Far top left
    farCenter + m_Camera->Up * farHeight + m_Camera->Right * nearWidth, // Far top right
    farCenter - m_Camera->Up * farHeight + m_Camera->Right * nearWidth, // Far bottom right
};

How do I move these corners into world space?

Update:

I'm still not sure if what I'm doing is right. I've also attempted to build the ortho projection by looping through the frustum corners and getting the min and max x,y,z coordinates. Then simply setting the values of the projection as:

left = minX
right = maxX
top = maxY
botton = minY
near = - maxZ
far = -minZ

I've searched on the internet but all the tutorials use hard coded values so the shadow maps aren't applicable to an open world but a restricted portion of the scene. Any help? Pseudocode is preferred as my linear algebra skills (and reading skills) aren't that great

sentences:
Monogame + Render Target + antialiasing doesn't work Is there any proper way to use antialiasing, while rendering to a RenderTarget2D and using Monogame?

I do this:

renderTarget = new RenderTarget2D(GameData.GraphicsDevice,
    pp.BackBufferWidth, pp.BackBufferHeight, false,
    GameData.GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24,
    4, RenderTargetUsage.DiscardContents);

but AA is disabled despite setting multiSampleCount to 4. The hardware supports it and it works if rendering directly to the back buffer.

I googled around and it seems it used to work for XNA, but for Monogame I found this: https://github.com/mono/MonoGame/issues/1162

This link suggests it's an open issue and is from 2013. This is hard to believe for me, because it would effectively make using Monogame render targets unusable for most applications..

sentences:
Top down four directional movement snap to tiles, not feel like crap I want to make a topdown rpg movement, I need to update these parameters based on user input:
User input four directions: ⬆⬇⬅➡ .
Update parameters

Position: x, y,
Flip sprite: flipx, flipy,
Sprite number: s, eg: 1 for horizontal sprite, 17 for vertical sprite
Sprite Animation: si, eg: 1 to 4 for walking animation

This is my crappy implementation:
function _init()

p = {
   t=0,
   x=0,
   y=0,
   dx=0,
   dy=0,
   mtimer=0,
   s=1,
   si=0,
   flipx=false,
   flipy=false
}
end

function _update()

   local input_x = 0
   local input_y = 0

   if btnp(⬆) then
      input_y = -1
   elseif btnp(⬇) then
      input_y = 1
   end

   if btnp(⬅) then
      input_x = -1
   elseif btnp(➡) then
      input_x = 1
   end

   if p.dx == 0 and p.dy == 0 then
      if input_x != 0 then
         p.dx = input_x
         p.mtimer=4
      elseif input_y != 0 then
         p.dy = input_y
         p.mtimer=4
      end
   end

   if p.mtimer > 0 then
      p.mtimer -= 1
      p.t += 2
      p.x += p.dx * 2
      p.y += p.dy * 2
      if p.mtimer == 0 then
         p.dx = 0
         p.dy = 0
      end
   end
 p.t += 0.5

   if p.dx != 0 then
      p.s = 1
   elseif p.dy != 0 then
      p.s = 17
   end

   p.flipx = p.dx == 0 and p.flipx or p.dx < 0
   p.flipy = p.dy == 0 and p.flipy or p.dy < 0

   p.si = flr(p.t % 30 / 30 * 4)

end

function _draw()
   spr(p.s + p.si, p.x, p.y, 1,1, p.flipx, p.flipy)
end

This is the end result:

As you can see it's so bad looking, I want you to implement this movement so it's fun and juicy. Or what can I do to improve the looks and feel of this.

sentences:
Basic Monster Movement I'm new to game development. Specifically server side. Currently I am trying to implement movement of monsters. From point A to point B.

I have used an a* pathfinding library to calculate the path to be taken but I do not know the logic on how to update the movement where the monster moves in 30 frames.

I am using javascript/node.js and currently I am doing something like:

// in game.update()
if (!monster.isMoving) {
  var steps = char.getPathTo(83, 213);
  steps.forEach(function (cell) {
    char.move(cell[0], cell[1]);
  });
}

Which of course is very wrong because it will evaluate all the movements first. So what are the possible approaches for this?

I followed this game loop:

var gameLoop = function () {
  var now = Date.now()

  actualTicks++
  if (previousTick + tickLengthMs <= now) {
    var delta = (now - previousTick) / 1000
    previousTick = now

    game.update(delta)

    actualTicks = 0
  }

  if (Date.now() - previousTick < tickLengthMs - 16) {
    setTimeout(gameLoop)
  } else {
    setImmediate(gameLoop)
  }

sentences:
How to prevent a cube from falling through a plane in Unity I am trying to prevent a player cube from falling through the plane (Battleground) in Unity, but after adding Mesh collider to both the cube and plane, as well as adding a rigidbody, nothing seems to work. The only way I can prevent this from happening is by locking the y axis of the cube, but this is a problem because I am adding in a jumping ability, and the player needs to be able to fall of the map. Is this something I can do within the Unity editor, or do I need to make a script that does that.

To verify, all 3 colliders have "Is Trigger" Enabled, the platform is not designed to be moved, so the X, Y and Z of both the plan's rotation and position are locked, and the material for the colliders are all default. Each of the cubes and the plane's material are custom (Not the collider's material). The X, Y and Z of the cube's rotation are locked. Both cubes have the tag 'player'

The code for player movement is:

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

public class PlayerMove : MonoBehaviour {
    private Rigidbody rb;
    // Use this for initialization
    void Start() {
        rb = GetComponent<Rigidbody>();
    }

    //Update is called once per frame
    void FixedUpdate() {
        float h = Input.GetAxis("Horizontal") * 5;
        float v = Input.GetAxis("Vertical") * 5;

        Vector3 vel = rb.velocity;
        vel.x = h;
        vel.z = v;
        rb.velocity = vel;
    }

}
```

sentences:
What's a good way to store a series of interconnected pipe and tank objects? I am working on a puzzle game with a 6 by 6 grid of storage tanks that are connected to up to 4 tanks adjacent to them via pipes. The gameplay is concerned with combining what's in a tank with an adjacent tank via the pipe than interconnects them.

Right now I store the tanks in a 6x6 array, vertical pipes in a 5x6 array, and horizontal pipes in a 6x5 array. Each tank has a reference to the object that contains both tanks and pipes and when a pipe needs to be animated filling with liquid, the selected tank just calls a method on the container object telling it to animate the pipes it is connected to (subtract 1 from row or column to find connected pipes).

This feels like the wrong way of doing it, as I've also considered just giving each tank references to the pipes connected to it to access directly.

sentences:
How to check distance between two different vectors? So I have a very basic racing game, where I would like the car to stop once it hits the finish line. Respectively when the distance between the car and the finish line hits or goes under 0 the car stops, but instead of stopping it continues to go on. How can I fix this?

Here's my code:

    public float speed = 0f;
    public float gravity = 0f;
    public Transform finishline;
    public Transform car;
    public Transform finish;

    void CarMove ()
    {
        if (Vector2.Distance (finishline.position, car.position) != 0)
        {
            if ( Input.GetKey(KeyCode.RightArrow))
            {
                transform.Translate(Vector2.right * speed * Time.deltaTime);
            }

            else
            {
                return;
            }
        }
    }

    // Update is called once per frame
    void Update ()
    {
        CarMove();
    }
}

sentences:
Experienced coder/designer moving into game development - what's involved? I am interested in moving into game development once my current project is done, as it's nearly at a point where it will pay my bills and allow me to hire someone else to take the driver's seat, meaning that, for the first time in my working life, I'll be in a position to devote a proper amount of energy to getting into game development, which has been something I've wanted to do for a long time but forced myself to wait on, as there are only so many hours in the day to devote to projects.

I am an experienced web developer (12 years) with most of my experience programming in C# and .Net (8 years). I am also a capable graphic designer. I have a surface knowledge of C++, though it's been 10 years since I wrote any C++ code. I also played with the DirectX 5 API back then as well.

I am happy to outsource graphics and sound, leaving me with coding, game design, level design and so forth.

Do I need to learn C++ properly, or can I rely on my C# and .Net knowledge?
If I'm going to leave C++ out of the equation, am I seriously limiting myself with regards to platform agnosticism?
Given that my memory of mathematics (high school level) is hazy at best, how much time I do I need to devote to pure maths self-education, or can I pretty much figure it out as I go?

In a nutshell, I'd love to get some idea of what the best approach for me would be, including DO's and DON'T's that might slow me down. I know that baby steps will be required at first, but it would be nice to get some advice as to what path I should follow to get myself up to speed quickly so that I am able to create decent indie games with nice looking 3D graphics, AI, particle effects and so forth.

sentences:
Unable to list target platforms. Please make sure the android sdk path is correct For some reason, I am unable to test my android program because of this error.
Here are some pictures of the errors. This error is not allowing me to test my app on my test Android device, I have tried uninstalling and reinstalling, checking if it is acatually the root folder, everything, PLEASE HELP!

1st error

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
C:/Users/jayso/AppData/Local/Android/sdk\tools\bin\avdmanager.bat list target -c

stderr[

]
stdout[

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

2nd Error

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
C:/Users/jayso/AppData/Local/Android/sdk\tools\bin\avdmanager.bat list target -c

stderr[

]
stdout[

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
]
exit code: 1

sentences:
Player stats include additional attribute I am currently running a role-playing game called DNDBBS and would like to know: If there is stats for Strength, Intelligence, Wisdom, Dexterity, Constitution, Piety, should there be one for Charisma? Is this standard DND?

Edited: 07/31/2018 11:00:00 CST:

The DNDBBS is a Modem (POTS) oriented multi-node text based Adventure game. It can be found on google or http://www.filegate.net/pdnbasic/

Edited: 08/03/2018 21:25:00 CST:

I decided to also add Beauty and Glamour for Lady class.

sentences: 2D Magnet-like repelling behavior If somebody wanted to develop a system between two intersecting rectangles so that the rectangles would, in a gradual process, push eachother away from one another until no longer intersecting, with the repelling force being stronger depending upon how deep the intersection is... what would the math look like?

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:
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:
How do i make enemy tank to follow and face player tank? I'm creating tank game demo , in game i want enemy tank to always face toward the player tank.

I already check look_at() function but it will face immediately, i don't want that. I want enemy tank to slowly rotate toward player.

What i'hv done so fare is :

MainWindow.gd

extends Node2D

func _ready():
    $Tank2.loadPlayer1($Tank1)
pass

EnemyTank.gd

extends KinematicBody2D

var rotSpeed = 0.3

var player1

var speed = 30
var velocity = Vector2()

func _ready():
pass

func loadPlayer1(obj):
    player1 = obj

func _process(delta):
    if player1 != null:
        velocity = Vector2()
        var rot_dir = (player1.position - position).angle()
        rotation += rotSpeed*rot_dir * delta
        velocity = Vector2(0,0).rotated(rotation)
        move_and_slide(velocity)
pass

My Result is  : Enemy Tank (red) keep rotating

Does anyone know how do i fix this?

Thank you

sentences:
How do I show a small sprite being dragged by touch? In my mobile game, users drag shapes across the screen. Think of it as a classic Lines game, where you drag a dot on the field, or a chess game where you drag and drop pieces.

The problem is that the player's finger totally covers the sprite, making dragging confusing.

Is there a common practice to solve this?

My best try so far was to move the sprite to be offset from the finger when the dragging starts, then move along with the finger in the offset position until dropped.

The problem with this approach is that users might be left- or right-handed. If I offset the sprite to the top-left of the finger, dragging with the left hand covers the sprite again.

sentences:
Cross platform data format I've got a best/common practice question about cross platform development. We're developing a Unity game and we've got a custom data format (a modified jpeg) that a C# tool we developed pumps out and gets loaded into unity using a dll. We use some nice gdi+ tricks on Windows with this file format, however when we move this to the Mac, we're running into issues that we think is the mono implementation of gdi+ is missing something.

That aside we're not sure what the best practice moving forward is. Should we develop a new file format that works cross platform and is loaded the same on both systems, or should we use a platform specific data format that allows for the use of the C# tricks on Windows and maybe a different trick on Mac?

sentences:
My background stopped looping and is mushy and weird looking My looping bacground texture looped perfectly, but maybe after building the project as an android project broke it? How can I fix it?

using UnityEngine;
using System.Collections;

public class ScrollScript : MonoBehaviour {

public float speed = 0.01f;

void Start () {

}

void Update () {
    Vector2 offset = new Vector2 (Time.time * speed, 0);

    GetComponent<Renderer>().material.mainTextureOffset = offset;
}
}

sentences:
How to make a really high performance like factorio in SDL2? i tried to make a 2D game engine for my game, used SDL2 as framework, C++ as language, and MSVC as compiler, using the graphics api and accelarated renderer. However, this still not enough. The game, at 300 objects. (Object being a simple struct holding position and SDL_Texture, and also SDL_Rect) runs smoothly at 60FPS. While suddenly goes down to around 30 at 700 objects. Each object runs SDL_RenderCopy individually, using their pointer to the texture, and individual SDL_Rect for srcrect and another one for their position in the world. I've been searching for a while and couldn't find anything useful about sprite batching in SDL2. But I heard liballegro has this feature.
My goal is to reach the performance of Factorio, rendering a huge, animated tilemap, with thousands of objects(a.k.a items, or alliens). Hence this is why I chose C++ as the language. I've been using engine like Unity and GameMaker, the game i want to port is here.
I drew every objects in a for loop like this:
for (GameObject* obj : objects) {
        obj->render();
}

Is there even any kind of sprite batching in SDL2? Should I switch to Allegro? Or is there any better frameworks for my kind of problems and needs? Thanks in advance.

sentences:
How can I create random noise that is seamless across modular game assets? Does anyone know how I can create a texture for a modular tile, such that when the tiles are arranged, random weathering effects such as scratches will be continuous across seams?

An example photo below shows the ideal result. The scratches are continuous between different tiles. Is creating weathering effects like this possible using any procedural software?

sentences:
LibGdx - How can I correctly handle tile transitions / connected textures? So I am making a tiled game and I need to connect textures correctly based on whats next to it.

With tiles that had connection really close to the edge of the tile I could just use the 4 bit meathod ie:

x 1 x
8 x 2
x 4 x

But for tiles with more detail I need to have corners too. I have seen people use the 8 bit meathod ie:

1   2  4
128 x  8
64  32 16

But really I can only see 48 different tile combos.

Is there a way I can separate corners and u d l r. Something like this:

x 1 x  8 x 1
8 x 2  x x x
x 4 x  4 x 2

Or is there a better way all together to do this.

This is what I have tried so far but this only uses 32/48 tiles and doesn't work for special corner cases.

public class RockTile extends Tile {

int y;

public RockTile(int id) {
    super(id);
    y = 7;
}

public TextureRegion getTexture(Level level, int xLoc, int yLoc){

    int u = (level.getTile(xLoc, yLoc + 1) != this) ? 1 : 0;
    int r = (level.getTile(xLoc + 1, yLoc) != this) ? 2 : 0;
    int d = (level.getTile(xLoc, yLoc - 1) != this) ? 4 : 0;
    int l = (level.getTile(xLoc - 1, yLoc) != this) ? 8 : 0;

    int bit = u + r + d + l;

    int ur = (level.getTile(xLoc + 1, yLoc + 1) != this) ? 1 : 0;
    int dr = (level.getTile(xLoc + 1, yLoc - 1) != this) ? 2 : 0;
    int dl = (level.getTile(xLoc - 1, yLoc - 1) != this) ? 4 : 0;
    int ul = (level.getTile(xLoc - 1, yLoc + 1) != this) ? 8 : 0;
    int corner = ul + ur + dl + dr;

    if (bit == 0) {
        if (corner != 0)
            return Game.splitTiles[y + 1][corner];
        else
            return Game.splitTiles[y][bit];

    } else {
        if (corner != 0)
            if (dl > 0 && l == 0 && d == 0)
                return Game.splitTiles[y + 2][bit];
            else
                return Game.splitTiles[y][bit];

        else
            return Game.splitTiles[y + 2][bit];
    }

}

}

If you need anything else let me know.

EDIT: Side question because I've seemed to have stumped you guys. If I decided to use the 8 bit method what would be the best and fastest way to make a lookup table for that.

sentences:
Designing interface for interacting with game objects I'm making a roguelike (-like) game, somewhat like Project Zomboid or Don't Starve. In my game, there are many different object in the world that the player can interact with; there are also many items, some of which may be required for a particular interaction.

Physically, all I have to trigger the interaction is the mouse click: when player clicks on an object, something happens (adding right-click is an option too, but staying with just one button is preferable).

There are several problems here:

For a given object, there might be several interactions possible. I might want do drive the car, or access its truk, or refuel it etc.
Some interactions may require an item: I need an axe to chop down trees or a fuel source to refuel a car.
Some interactions may be non-obvious, so I need to have some sort of discovery mechanism. Some way to say to the player: "You could chop down this tree if you had an axe".
Some interactions should be very quick. Whacking an enemy with a bat should NOT require clicking and then choosing an action from menu; just clicking should work.
Added The list of objects, items and interactions is pretty open-ended. I'm still developing the game, and in the future players might make mods. This means that the interface must be generic enough to adapt to new interactions automatically.

Given these constraints, I'm really struggling to devise a good interface for interactions. I can't show a menu of all possible actions on click, because that would break (4). I can't just leave one single on-click action, because that would break (3) and probably (1).

How can I present all options to the player in a usable and preferably obvious way?

sentences:
Build includes sprite packer atlas and its original textures I use Unity's Sprite Packer, it's working great. However, when I looked at the build report (in the Editor.log) it turns out that the build often includes the generated atlas texture and its original textures too. It wastes too much space. I checked the size of the unzipped APK and the build report was correct. I tried several configurations (adding and removing textures) but I could not find any regularities.

Some observations: - I could reproduce this only if I use 25+ textures in an atlas with variable sizes. - Texture compression settings did not matter. Packer policy could modify the result but did not solve the problem.

Has anybody had similar experience? I can upload my test project if necessary.

sentences: Alternative Font loaders in Monogame Framework While working on projects of mine, I have been finding that it is a huge pain to switch operating systems just to create a simple spritefont when using Monogame. I saw that the Nuclex Framework can load fonts which are clearer/sharper, and they can be used in a Monogame project as well. They load fonts using the FreeType library, which is very multiplatform and is used widely. Is there a fairly simple way to use the FreeType library or another library to render text suitable for use in a Monogame project, as an xnb file?

sentences:
Is it possible to measure Used vs Unused time in a 60hz frame in Unity? In custom engines I've often made a frame rate meter that shows how much of the each frame was actually used. In other words if the game is locked to 60fps using vblank I show a graph of how much of each frame was used for processing and how much was just waiting for the next vblank. This gives a visual indication of how much more can be added to a scene without hitting my frame rate budget.

Is this possible to do in Unity?

What I tried:

I made a script that creates a System.Diagnostics.StopWatch and starts it. I set that script's Script Execution Order to be the very first script.

In the script's Update I record the ElapsedTicks from the stopwatch as startTicks. In the scripts's OnGUI I compute a deltaTicks as in

long deltaTicks = m_stopWatch.ElapsedTicks - startTicks;

I can then compute how much of a 60fps frame was taken with

long ticksPerFrame = System.Diagnostics.Stopwatch.Frequency / 60;
float amountOfFrameUsed = (float)((double)deltaTicks / ticksPerFrame);

Note: I get that OnGUI is called multiple times per frame but the way I end up storing amountOfFrameUsed I only end up recording the time from the last time OnGUI is called that frame.

Anyway, this does give me a graph to look at but I have no idea if what it's slowing me is correct for Unity.

In my own engine I'd record the time at VBlank and then in my code, when all processing was done I'd compute the elapsed time since vblank.

Is what I'm doing correct? Is there a better or another way I should be doing this? (note: I have not used the profiler because I wanted to see this FPS meter in a production app, not in the Editor where there is tons of overhead).

sentences:
How to create a simple side scroller game Possible Duplicate:
  How to create games with scrolling?

I'm still pretty new to game programming and any tutorial that I have worked with stuck to only games with the initial screen. I want to start creating my own games but there are a few things that I still need to learn. One of them is how to create a game that side-scrolls. For example; Mario... Or ANY type of game like that...

Can anyone give me a small example to create something like that. I'm not asking for any specific language because currently in school I am learning javascript but I know some c++/java/processing/objective-c as well. So any of those languages would be fine and I could probably implement it in any of the others...

I have been searching for some help with this for a while now but could never actually get any help on it.

Thanks in advance!

sentences:
How To Smoothly Animate From One Camera Position To Another The Question is basically self explanatory. I have a scene with many cameras and I'd like to smoothly switch from one to another. I am not looking for a cross fade effect but more to a camera moving and rotating the view in order to reach the next camera point of view and so on. To this end I have tried the following code:

    firstCamera.transform.position.x = Mathf.Lerp(firstCamera.transform.position.x, nextCamer.transform.position.x,Time.deltaTime*smooth);
    firstCamera.transform.position.y = Mathf.Lerp(firstCamera.transform.position.y, nextCamera.transform.position.y,Time.deltaTime*smooth);
    firstCamera.transform.position.z = Mathf.Lerp(firstCamera.transform.position.z, nextCamera.transform.position.z,Time.deltaTime*smooth);

    firstCamera.transform.rotation.x = Mathf.Lerp(firstCamera.transform.rotation.x, nextCamera.transform.rotation.x,Time.deltaTime*smooth);
    firstCamera.transform.rotation.z = Mathf.Lerp(firstCamera.transform.rotation.z, nextCamera.transform.rotation.z,Time.deltaTime*smooth);
    firstCamera.transform.rotation.y = Mathf.Lerp(firstCamera.transform.rotation.y, nextCamera.transform.rotation.y,Time.deltaTime*smooth);

But the result is actually not that good.

Thank you all, I fixed it this way

 var pos:Vector3 = firstCamera.transform.position;
    var rot:Quaternion = firstCamera.transform.rotation;
    firstCamera.transform.position = Vector3.Lerp(pos, nextCamera.transform.position,Time.deltaTime*smooth);
    firstCamera.transform.rotation = Quaternion.Lerp(rot, nextCamera.transform.rotation,Time.deltaTime*smooth);

sentences:
How can I debug live multiplayer servers effectively? I have a multiplayer server made by a small team of developers and we have bugs that crop up on our live server occasionally that we simply can't reproduce while playing with our small team on a live server.

It clearly isn't feasible to attach a debugger and halt the world on a live shard... so what are some effective strategies in debugging multiplayer games while they are still running?

Attaching a debugger is fine on a developer server, but perhaps not always feasible to reproduce the bug or always effective.

sentences: FBX Importer - Vertex Color I imported vertex positions, indices and normals successfully in OpenGL using fbx sdk, but I just can't figure out how to import vertex colors. I tried to fetch the pointer to array of colors trough mesh layer but it returns null. Can anyone help me with this one please?

sentences:
Attaching a Body to another, without the new body impacting the physics of the first in ANY WAY Basically I want to add a vision / sight cone to an enemy body,

So I have the sight cone body, and enemy body, but every joint or weld I have tried so far has caused the sight cone to severely affect and disrupt the physics and movement of my enemy, most of the time causing the poor guy to go into tailspins.

I only want the sight cone as a sensor, a sensor that has NO physics impact whatsoever on its parent body (the enemy) except simply to stay stuck to it as it moves, matching its position and rotation. but all I can seem to find is weighted attachments, that set up new anchors and whole new physics properties to me new joined body.

I hope you can help.

sentences:
My collision detection is not working when I rotate my mesh in three.js I am trying to move a ball mesh through a maze. The maze belongs to a parent object3d. My issue is that when I move the ball I can't detect collision right well because in the rotation, the axis relative to the ball are changing and for some reason I can't control the collisions with the wall. Here is my code:

//This function detects collisions
function collisionControl() {
  var colision = false;

  //Checking collisions with the ball
  var originPoint = bola.position.clone();

  //I get the position of the ball relative to the maze(=puzzle)
  var globalPositionPoint = originPoint.applyMatrix4(puzzle.matrix);

  for (var vertexIndex = 0; vertexIndex < bola.geometry.vertices.length; vertexIndex++) {
    var localVertex = bola.geometry.vertices[vertexIndex].clone();
    var globalVertex = localVertex.applyMatrix4(bola.matrix);
    var directionVector = globalVertex.sub(bola.position);

    var ray = new THREE.Raycaster(globalPositionPoint, directionVector.clone().normalize());
    var collisionResults = ray.intersectObjects(collidableMeshList);

    if (collisionResults.length > 0 && collisionResults[0].distance < directionVector.length()) {
      if (collisionResults[0].object.name == "fin") {
        location.reload();
      }

      // Si encontramos una colision, la bola vuelve a su lugar origen
      colision = true;
      break;
    }
  }

  return colision;
}

The function RotacionEje

// Function to rotate the ball
function RotacionEje(object, axis, radians) {
  var rotWorldMatrix = new THREE.Matrix4();
  rotWorldMatrix.makeRotationAxis(axis.normalize(), radians);
  rotWorldMatrix.multiply(object.matrix);
  object.matrix = rotWorldMatrix;
  object.rotation.setFromRotationMatrix(object.matrix);
}

So when I press the Up arrow for example it executes, the following function:

function moveUp() {
  bola.position.z -= 0.5;
  RotacionEje(bola, ejeX, -0.1);
  camera.translateY(0.5);
  if (collisionControl()) {
    bola.position.set(47.5, 0, 50);
    camera.position.x = 47.5;
    camera.position.y = 0;
    camera.position.z = 100;
    camera.lookAt(bola.position);
  }
}

I have to say that collisions works fine if I don't use the function RotacionEje.

What am I doing wrong?

sentences:
Change entity's size based on health [ECS] I'm making a kind of entity component system framework and I have a doubt:

I have two components 'health_damage', 'physic' (which contains position, weight,...) and 'sprite' (position, dimensions...).

When this entity takes damage I want to reduce its dimensions based on health percentage (50% life -> 50% original size) and I thought that I need to create a new system 'change_dimensions_on_hit', register the entity and on hit send a message to it which will update the dimensions (and weight) based on health. And that's, in my opinion, it's fine.

The problem is: imagine I create an item which increases the dimensions of the entity when it's picked up. It would increase the size of a fixed amount without knowing it's original or not (maybe it's at 10%) and when the entity regains health it will become huge
Ex.
Health = 10; MaxHealth = 100
ActiveDimensions = 10 (original is 100);
I take a +20 size object and then a full heal item:
ActiveDimensions would be (10 + 20)/0.1*1.0f = 300 (and not 120)

These are the solutions I found (but I don't really like anyone of them):

storing for each 'mutable variable' its current and max value like for health, so I can always calculate the current percentage and change correctly the original size. I think that's not a good idea because really few entities would have this behaviour and so I would waste a lot of memory.
make the physic component aware of the existence of the health component and (if a flag is set) look for che percentage when it is modified. I think it similar to the first and it also forces a tied relationship which I think it's even worse.
(the one that I think it's the best) I'm using a message system to handle things such as damage on collision, creation of entities... I still need to figure if it's the best way but I'm pretty sure of this. I can use it to handle everything possible and so also the changing of sizes: the item picked up sends a message to the entity 'grow up/shrink'; the entity spreads it to all the systems which is registered to and they can modify the message data before it's handled by the 'base components' (physic, dimensions,...). So it will be received at first by the change_dimensions_on_hit which would adjust the amount of growing based on current health. At the moment I handle messages in a very specific way:
1) it's handled by the systems which will modify them directly (ex.'double_growing_items')
2) by the ones which need to read other components to perform the change (ex. 'Change_dimensions_on_hit')
3) by the base components such as dimensions.
This solution seems the best to me, even if has its own limitation (I have a specific path for each message and I'll face problems such as 'I need that this message, in this case, is handled first by this system and then from that, and not the opposite') and relies entirely on a message system which isn't the best solution performance wise (but I don't think that's a real problem).

Any advice and suggestion is welcomed. Do you think message system is the right way? Or maybe the firsts methods with slightly changes? Something totally new? (I can't change too much because I need to finish this project in one two month for the high school's final exam)

sentences:
First object jumps on re-entry of second colliding object The scenario is that I have two objects - Object A and Object B. The Object A is lying on the ground and when Object B enters the collider of Object A, the Object A moves (only X and Z axis) with Object B. The movement works well with the script shown below.
The issue is that most of the time, the Object A's initially position shifts by few meters whenever Object B enters its collider. I feel it is related to offset position. What should happen is that, Object A should be the same position when Object B enters the collider and move along with Object B only when Object B moves.
So how do I fix this?
private Vector3 offsetPosition;

public Transform ObjectB;

public bool ObjectB_Collision = false;

void Start () {
        offsetPosition = ObjectB.transform.position - this.transform.position;
    }

    void ObjectB_HasEntered() {
        offsetPosition = ObjectB.transform.position - this.transform.position;
    }

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

        if (ObjectB_Collision == true) {
            this.transform.position = new Vector3 (ObjectB.transform.position.x, this.transform.position.y, ObjectB.transform.position.z) - new Vector3 (offsetPosition.x, 0, offsetPosition.z);
        }

    }

public void OnTriggerEnter (Collider col) {
        if (!enabled) return;

        if (col.gameObject.name == "Object_B") {
            ObjectB_HasEntered();
            ObjectB_Collision = true;
        }
    }

public void OnTriggerExit (Collider col) {
        if (!enabled) return;

       if (col.gameObject.name == "Object_B") {
            ObjectB_Collision = false;

        }
    }
```

sentences:
Why is my stage input processor working on the desktop but not on an Android device? In my project, I have a button in my stage with a listener.

The problem is that the listener method changed is fired when running the game in desktop but it is not fired when running the game on an Android device.

Any suggestions?

sentences:
Android local multiplayer I am working on a FPS game for Android and I want to make a support for local multiplayer with no additional devices or server required. One of the player's devices would serve as a server, getting and distributing all the messages, OR every device broadcasts messages to everyone inside the group.
First I was thinking bluetooth or wifi direct, but I am running into many problems with both. The plan was to support up to 10 players,  so I am not sure bluetooth can handle that (broadcast messages and similar). If it is possible, let me know.
Also, I heard of an option to make a wifi hotspot on one device, and connect all other devices to it that way, but I have no idea how that would work.
Does anyone have any real experience with this, or any advice on how to implement it?
Thanks in advance.

PS. yes, I've ran through everything on android developers site, but their wifi direct example is kinda bad and only supports 1-way data transfer.

sentences:
Child parent rendering (flash) in XNA i am currently in the process of implementing a render engine that works like flash's. Where a sprite is drawn inside another sprite and reflects all transformation (rotation, scale, etc) on the parent.

I have my transformation setup like so.

    public Matrix transform
    {
        get
        {
            Matrix m_transform =
                Matrix.CreateTranslation(new Vector3(x, y, z)) *
                Matrix.CreateRotationZ(rotation) *
                Matrix.CreateScale(scale)
                ;
            return m_transform;
        }

    }

But i cannot use spritebatch to render the sprite with a matrix. Is there a way to properly do this ?

Thanks alot ;)

sentences:
How to decorate the floor with a grid? I got this photo from mixamo.com — I want to draw grid lines similar to this on my floor.

I'm sure this is easy by using textures, but I'm trying to avoid using textures as much as possible. Is there a way to implement these floor patterns in OpenGL 3.3?

sentences: Android sidecroller template I want to create a sidescroller game for Android but it seems stupid to reinvent the wheel and since there are a lot of android sidescroller games already out I though that there must be some sort of template or something so I can get started quicker, so I can keep developing from there.

sentences:
Best way to find line segment intersection I need to find the point of intersection between two line segments in 2D space. I receive them in terms of both coordinates of both lines. Because they are line segments I would also need to know if they actually intersect in the first place.

I can find many ways to do this but I would like to know what method would have the best performance in GLSL.

sentences:
How do I change a value gradually over time? I'm using Unity3D 5-point-something, and I'm planning on making a game where the player travels through a hot, dry desert, and so the heat causes the player's energy to deplete.  The object of the game is to reach a certain point before the player's stamina runs out.

What I was planning on doing is having different landmarks in the game world that the player can visit, and these will help replenish their Health or Stamina.

sentences:
How does the camera/UI know who the player is? I'm in a bit of a dilemma regarding how certain engine components — like camera and UI — know who to follow, whose health and other attributes to represent on the screen.

How do you architect a system where does communication between those components and the entities take place? I could have a separate entity that represents the player, but that seems a bit 'hard-coded'. What if I want to pan the camera? What if the player starts controlling another entity?

In other words, how do I abstract away the data sources for components like the camera and UI, such that they don't care what entity they represent?

An event system will do for a lot of cases, but that is more suited for propagating information that changes or is generated 'rarely' (like the death of the player). For something like entity health and position — which need to be known every frame — an event system isn't well suited.

sentences:
Scene2d Stage Actor setup issues I am creating a game using libgdx.

In the same each level has a class. I have stage as a member variable of the class. To this stage, I add actors.

Inside the levels class, I have attaced the input processor to the stage like below.

stage = new Stage();
sviewPort = new StretchViewport(OSR_Constants.VIEWPORT_WIDTH, OSR_Constants.VIEWPORT_HEIGHT);
OrthographicCamera camera = new OrthographicCamera(OSR_Constants.VIEWPORT_WIDTH, OSR_Constants.VIEWPORT_HEIGHT);
camera.position.set(0, 0, 0);
camera.update();
sviewPort.setCamera(camera);
stage.setViewport(sviewPort);

Gdx.input.setInputProcessor(stage);

The level object is instantiated in another class known as GameScreen. GameScreen implements the Screen interface.

I am unable to detect touch events on my actors in the stage. Each actor has also been given bounds as per the world coordinates. I have added the following code on each actor to detect touch

this.addListener(new InputListener(){
     public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
          System.out.println("touchdown at " + x + " " + y);
          return true;
      }
  });

sentences:
Height and Width of Player Depth View using Kinect SDK This code shows that how we can find the player from the depth Image:

this.depthData = new short[frame.PixelDataLength];

frame.CopyPixelDataTo(this.depthData);

    for (int depthIndex = 0; depthIndex < depthData.Length; depthIndex++)
    {
            player = depthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask;
    }

I wanna ask about how can I find Width and Height of Depth View of the player ?
Thanks

sentences:
Best way to network the movement of 2D tanks? I'm working on a multiplayer Flash game with a Python server and I have a quick question regarding how I should send positional updates for tanks for other players.

Should I choose

Option A:

When the player presses the move key, send the new velocity to the server and let the server calculate the new position per tick?

or

Option B:

When the player presses the move key, send the new position to the server and calculate the velocity clientside?

Which is the best option, in your opinion? What is most common? What will have less issues?

Other suggestions are welcome, I don't really know what I'm doing here. ;)

sentences:
Using a vector to store multiple instances of a class To warm up with SMFL, I am creating a simple Block Breaker game. For the blocks and balls, I would like to store them as "instances" in a vector so that they can be added/removed with ease.

However, the compiler spits out an error when attempting to access the vector.

block.h

class Block {
private:
    bool dead;

public:
    Block();
    bool isDead();
    static std::vector<Block*> blockList;

    float x;
    float y;
};

main.h

#include "Block.h"

Block playerBlock;

main.cpp

#include "main.h"

int main()
{
    playerBlock.x = 50;
    playerBlock.y = 20;
    Block::blockList.push_back(&playerBlock);
    return 0;
}

When compiling, Xcode spits out the following error:
Undefined symbols for architecture i386:
  "Block::blockList", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help is welcome. This is not all of my src but it is all of the src related to the problem at hand.

sentences:
Implementing moving animation I faced the problem of attaching animation to the enemy. In the Animator window I added a "moveSpeed" (float) condition, so moving animation should turn on when moveSpeed is greater than 0.001. But after prescribing a reference to an Animator in the code, whatever I write further, a message pops up about the presence of compiler errors.
Here's my script:

public int health;
public GameObject explosion;

public float playerRange;

public Rigidbody2D theRB;
public float moveSpeed;

public Animator anim;

// Use this for initialization
void Start () {

}

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

    if(Vector3.Distance(transform.position, PlayerController.instance.transform.position) < playerRange)
    {
        Vector3 playerDirection = PlayerController.instance.transform.position - transform.position;

        theRB.velocity = playerDirection.normalized * moveSpeed;

    }
    anim.SetFloat("moveSpeed") = theRB.velocity;
}

public void TakeDamage()
{
    health--;
    if(health <= 0)
    {
        Destroy(gameObject);
        Instantiate(explosion, transform.position, transform.rotation);
    }
}

What exactly do I need to write for the condition to work and the animation to play?
Thanks for any help!

sentences:
How to find if an object is facing another object given position and direction as separate vectors I found a very helpful post about exactly what I need here. It uses dot products to which is what I'm specifically looking for.

It talks about players facing monsters basically. They give a helpful picture here,

My question though, is what if you have a function with 3 arguments: the position of object 1, the position of object 2, and the direction object 1 is facing given as a unit vector. So the picture would look as so:

How would you find whether A is facing B?

sentences:
How can I save and load an adventure game? I'm using cocos2dx and sqlite to store datum. The table looks like this: x INT, y INT, className TEXT, properties TEXT. I use json to serialize terrains and sprites. But I don't know how to synchronise it. Below is how I'm doing:

//1: create a interface takes an range and returns data in it.
Data getData(Rect range);

//both are global objects.
cachedRange = [];
cachedData = [];

//2: while reading from sqlite, I scale the range and cached other data.
Data getData(Rect range){
    //if it has been cached.
    if(cachedRect.contains(range)){
        return retrieveDataFromCached(cachedData, range);
    }

    var scaledRange = scale(range, 10);
    var data = retrieveFromSqlite(scaledRange);
    var inRange = [];
    for(var d : data){
        if(range.contains(d)){
            inRange.append(d);
        }else{
            cached.append(d);
        }
    }
    cachedRange.append(range);
    return inRange;
}

However, these data will change. For example, some mobs are instantiated and then killed, and some are moved. When should I delete original records of the table.

sentences:
Eager or lazy loading synchronization Imagine joining a room with 100 (moving) players and a lot of items and being assigned a random position in the room (read: agar.io).

At the moment I'm eager loading the other players and items and sending it to the player when he joined the room (and notifying other players about the new player) but I'm not sure if this is the best way to do this.

I was thinking about implementing lazy loading and only show players and items near the spawned player.

How is such problem most commonly solved?

I was thinking about using a quadtree in order to find surrounding objects (or would a simple distance formula work)?

sentences:
What debugging info should I put in the "About" box I'm developing an Android game with the idea of publishing it, and I wonder what info should I put in the "About" dialog that many main menus have.

The idea is to make bug report and debugging easier. Users can click in the "About" box and read the details of their device, and include them in any bug report they send me - I know Google sends relevant device data to the developer when there's a crash, but I'm thinking in bugs that not necessarily end with an abnormal program termination.

So far, I've added API number of device, screen size, screen density, and number of processors.

My current "About" screen is something like this:

  Game titleGame iconAPI versionScreen sizeScreen densityNumber of
  processors (just in case, because game uses threading)Game version numberDeveloper e-mailCopyright information

If anyone has experience publishing and maintaining an app, specially in Android, I want to know what can I add there to make user reporting and debugging easier.

sentences:
How do I efficiently render the tiles of a tile map? I've been working on a game, and I've been using Python with Pyglet to create it. I had an issue on how I could do effective tile based rendering. I tried cocos2d, however the API is very efficient and doesn't support maps which are larger than 1000x1000 tiles. I did some further research, and found you could make it so when you triggered an update, only sprites on the edge of the screen would update, however it is still buggy (it's not fully working).

Here is my code, and here's some relevant rendering code:

self.camera[0]-=amount
for a in range(self.window.height//self.block_size):
    self.sprites[(self.camera[0]//self.block_size)-1][a+(self.camera[1]//self.block_size)].batch = render
    self.sprites[self.window.width//self.block_size+(self.camera[0]//self.block_size)+1][a+(self.camera[1]//self.block_size)].batch = None

What approach should I use to render maps larger than 1000x1000 tiles?

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:
Unity GIT - managing `.meta` files / Working with multiple repositories in Unity (Original Question) → ScriptableObject has empty inspector after cloning from git

After cloning repository from git the data from the ScriptableObject asset isn't there.

An example of the problem:

A working example:

I assume the problem is in .gitignore because there is *.meta, so the data of ScriptableObject is lost. Is there a way to configure .gitignore to leave the *.meta files in some subdirectory?

sentences:
OpenGL 3+ Range Picking How do I perform range picking in the latest OpenGL version? By range picking I mean selecting all objects which are picked using a selection rectangle, like in an RTS game.

For single object picking I'm using the ray picking method, which I guess can be used in this case as well, but I'm not sure how I should go about doing that.

Could you give me any pointers?

Thank you.

sentences:
How to generate a star onto a render texture with spherical warping How would one proceduraly generate a star in a compute shader that looks like one of thes two at any size needed. Also any way transfer this into a spherical map, would be appreciated.
Goal is to create a spherical skybox of stars, (stars a pre generated, and not just decoration).
Also I have searched about everywhere for such equations, and or tutorials but have not found anything so far.
So far got accurate positioning of the stars on the spherical skybox but lack the equations to get it looking like I want.
Preferably the one on the right.

This below is what I currently have, ~~5 to 15ms processing time,    little over 30k stars

Using Unity2019.3.1f1, needs to be compute shader compatible. (if not I will convert it somehow)
Render Texture output.

sentences:
OnTriggerExit() called when game object with collider component gets re-parented I have an object Hand, with a rigid body attached to it. In every Update() call, the user's hand controller rotation and position are tracked.

In my scene, there is an object Pin, with a mesh collider attached to it.

In OnTriggerEnter() (inside the Hand class), Pin becomes re-parented to Hand. (Pin's original parent is something else.)

My scene also contains other objects with colliders. However, these other objects do not get re-parented -- only Pin does.

Once this re-parenting takes place, OnTriggerExit() (in the Hand class) is called immediately. This is surprising to me -- I had expected OnTriggerStay() (in the Hand class) to be invoked instead, since Hand is still in contact with Pin.

Is such behaviour by design? Is there an elegant way of working around such behaviour?

UPDATE:

In response to this comment:

  Does the pin object have a parent before it becomes a part of the
  hand?

Yes. As mentioned in my post, Pin's original parent is something else.

  Or is it placed inside another collider? And does the pin leave any of
  these collider areas when the parenting takes place?

As mentioned in my post, Pin itself has a mesh collider component attached to it. Perhaps I am not understanding the question correctly...

  You can prevent the hand's script from getting this OnTriggerExit by
  adding a seperate rigidbody to the pin.

I added a separate rigid body to the pin (setting isKinematic to true), but OnTriggerExit() inside the Hand class is still called immediately after Pin gets re-parented.

MORE INFORMATION:

Pin's original parent (before it gets re-parented to Hand) does not itself have a collider component.
When OnTriggerExit(Collider collider) gets called immediately after the re-parenting takes place, the collider argument passed to the method is the Pin itself.

sentences:
Is Update() called on the very first frame in Unity? I'm calling Time.frameCount inside Update() and then immediately Debug.Break() to pause the simulation before Update() is finished. This of course happens (supposedly) on the very first frame, and yet Time.frameCount returns 1, as if one frame had already been rendered by at that point. Also, I'm calling Time.deltaTime the same way, on the first frame inside Update(), and it returns a value too, as if a previous frame had been rendered and took X milliseconds.

Considering Time.deltaTime returns the value of the "time it took to complete the last frame", and I'm calling it on the first frame and it's returning a value, is there an "invisible" first frame that Update() doesn't run on?

I couldn't find any reference to this specific issue on the Unity docs.

sentences:
What is the proper, legal way to make a derivative video game? I want to make a game derived from an existing game. That game is owned by a live company.

How do I go about contacting the rights owners correctly and negotiating for the rights to the content?

sentences:
Unity 2D Game: Camera following target and looping stage I'm with a problem and I need some help, because I'm on early learning of gaming and Unity, and i want to learn doing it, so, i need all the help, you developers know how each little help, helps a lot!!

I found the answers of these questions in here, but they don't work properly together or i don't understand it how it works to put it on my code;

I'm building a mobile game and i need the camera to follow the character, i found how to do it, but the thing is: the stage is a 4:3 kinda stage, that repeats again and again and again(well, that's the idea, i still don't know how i do this), but, when the player goes to the groud, the camera is still centered on the character, so it continues following it, but there's no more stage, then nothing appear in there, but i want the camera to doesn't follow the character when it's already on the Y border of the stage. Can someone light me with the google searching with this?

Exactly like this:
https://www.youtube.com/watch?v=ETxoUDWCBvE

And how i can do the stage repeat in a looping? I though in make the scenario move instead of the character then make it loop with a technique i saw in some Flappy bird clone video, but i don't know how the camera would work.

I want to know how i can start doing these.

Thanks.

Ps: Unity 5 ;-;

That's what happen with the camera:

sentences:
XNA move from start position to target position exactly in 3D If I have a list of positions that map out a path a character should follow. What would be the best way to move at a constant speed to each position making sure the character lands exactly at each position before moving onto the next?

For example the character is at position A, we then queue up position B and position C. The character cannot move towards position C until it reaches position B exactly.

It would be great if the solution worked at slower frame rates/update speeds as well.

sentences:
Smooth Camera Rotation around 90 degrees I'm developing a third person 3D platformer in XNA. My problem is when I try to rotate the camera around the player.
I would like to rotate (and animate) the camera 90 degrees around the player. So the camera should rotate until it has reached 90 degrees from the starting position.
I cannot figure out how to keep track of the rotation, and when the rotation has made the full 90 degrees.

Currently my cameras update:

public void Update(Vector3 playerPosition) {
    if (rotateCamera) {
        position = Vector3.Transform(position - playerPosition, Matrix.CreateRotationY(0.1f)) + playerPosition;
    }
    this.viewMatrix = Matrix.CreateLookAt(position, playerPosition, Vector3.Up);
}

The initial position of the camera is set in the constructor.
The "rotateCamera" bool is set on keypress.

Thanks for the help in advance.

Cheers.

sentences:
AndEngine GLES 2 Animate Character I want to animate my character in game. My graphic animator prepare for me three options.

Frame-by-frame by this is over 9MB for one animation. With TextureSpriter 4-5MB.
Spriter but I can't find how to handle scml in GLES 2.
FLA/SWF and this is my best promissing option because size of swf with animation is 1,8 MB. But so far I google that flash is no longer supported in android and it's big issue to use it with AndEngine.

What's more I found this question maybe something is changed since '13.

So I guess I got only option 1. Am I wrong? What do you use to animate?

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:
As an indie game developer, how can I have (quality) music/sound done? Besides the story itself, a game needs code, graphics and music/sound effect. I can program and I knew a few graphics designers in the web app era. However, I don't know whether to find music and sound freelancers/professionals/partners.

So how's music/sound typically done? Do you finish a game and hand it to some musicians? Seek help via Facebook? Call the secondary school music teacher? .. Please advise. Thanks!

EDIT:

I'd like to rephrase the question a bit to clarify the objective. Let's start with example. Say, there is designer which have finish a great UI concept design, and ask: "how can I find programmers to transform this design into an app?"

It won't help him much by telling where github is and how much great codes can be learned from... He needs the judgement of what are good code, in addition to how to use the code, and most importantly, the ability to modify/enhance the code to fit his need.

As a programmer, all I know a game needs some good music. The question is not about where to find music. The question is how to find musician who knows music, the music which fits my game. It's similar to the design is looking for a programmer who can turn Photoshop into .app rather and programming books and code samples.

Simply put, where did you find your game's musician? ;-)

p.s. I found my graphics designer on deviantart.com Where is the deviant music.com? XD

sentences:
Effect Replacement System I'm working on a turn based rpg and have an action/queue system setup that I'm happy with. However, I am having trouble implementing a feature and I am here for some advice. I want to have effects/abilities that alter other outcomes of actions/effects and am not sure how to structure things to allow for this.

I'll provide an example to illustrate what I am trying to achieve.

Say we have two characters in combat. The attacker needs to roll 1d20 and add the result to their current strength to see if they make a hit. If that value is equal to or greater than the defender's toughness the attack is successful and the defender takes damage.

def Attack(attacker, defender):
    roll = Dice.roll()
    roll += attacker.strength

    if roll >= defender.toughness:
        defender.damage(attacker.weapon.power)

Now lets say the attacker has a piece of gear on that says if they get a critical hit (a roll of 20) they hit the monster no matter what and deal one point of damage. How do I inject this code into the attack function and have it ignore the portion of the function after the dice is rolled (the armor's effect is replacing the rest of the attack)?

I've thought of breaking the code into chunks

def Critical_Hit_Buff(roll, defender):
    if roll == 20:
        defender.damage(1)
        return False
    return True

def Attack(attacker, defender):
    do_continue = True
    roll = Dice.roll()

    #check if any buffs from armor/etc. activate
    for buff in attacker.buffs('attack'):
        do_continue = buff(roll, defender)

    if do_continue:
        roll += attacker.strength

        if roll >= defender.toughness:
             defender.damage(attacker.weapon.power)

But I really don't like having to carry around the continue variable everywhere and further I don't know if an action is not continuing because the action failed (some buff/debuff prevents the attack from being successful) or if it was because some effect replaced the attack event (this might be relevant if I give the player notifications that about if the action was successful or not).

Any advice?

sentences:
How do I draw 2D sprites from a sprite sheet in DirectX 11 without ghosting/artifacts I'm new to DirectX and I am trying to get my feet wet by making a simple 2D game. I chose DirectX 11 and am using the DirectX ToolKit helper library which recommended I start with DX11 and not DX12.

The guide I am following to create an animating sprite is working great except for when attempting to draw a single sprite from the sprite sheet I am seeing "ghosting" of other sprites behind it. I created the sprite sheet and saved it as a PNG and also as a BMP and it seems to happen either way.

Here is the sprite sheet I am using:

It is 336px width, 48px height, in 48px x 48px square sprites. If I render the entire sprite sheet, or if I render the first sprite (0,0,48,48), it looks fine, but if I attempt to render the 2nd, 3rd, 4th, etc. this is how it renders:

Here is the code I am using to load the PNG file as a texture:

ComPtr<ID3D11Resource> ponyIdleResource;

DX::ThrowIfFailed(
    CreateWICTextureFromFile(_D3dDevice.Get(), L"assets/pony_idle.png",
        ponyIdleResource.GetAddressOf(),
        _Texture.ReleaseAndGetAddressOf())
);

ComPtr<ID3D11Texture2D> ponyIdleTexture;
DX::ThrowIfFailed(ponyIdleResource.As(&ponyIdleTexture));

CD3D11_TEXTURE2D_DESC ponyIdleDesc;
ponyIdleTexture->GetDesc(&ponyIdleDesc);

and here is the code I am using to draw:

_SpriteBatch->Begin();

RECT sourceRect;
sourceRect.left = 48;
sourceRect.top = 0;
sourceRect.right = 96;
sourceRect.bottom = 48;

_SpriteBatch->Draw(_Texture.Get(), _ScreenPos, &sourceRect, Colors::White, 0, _Origin);

_SpriteBatch->End();

If I pass the RECT in as 0,0,48,48, it looks fine. Is there some special way I need to format my image? I've tried it as both PNG and BMP.

sentences:
Ray Tracing concers: Efficient Data Structure and Photon Mapping I'm trying to build a simple ray tracer for specific target scenes. An example of such scene can be seen below.

I'm concerned as to what accelerating data structure would be most efficient in this case since all objects are touching but on the other hand, the scene is uniform.

The objects in my ray tracer are stored as a collection of triangles, thus I also have access to individual triangles.

Also, when trying to find the bounding box of the scene, how should infinite planes be handled? Should one instead use the viewing frustum to calculate the bounding box?

A few other questions I have are about photon mapping. I've read the original paper by Jensen and many more material. In the compact data structure for the photon they introduce, they store photon power as 4 chars, which from my understanding is 3 chars for color and 1 for flux. But I don't understand how 1 char is enough to store a flux of the order of 1/n, where n is the number of photons (I'm also a bit confused about flux vs power).

The other question about photon mapping is, if it would be more efficient in my case to store photons per object (or even per Object's triangle) instead of using a balanced kd-tree.

Also, same question about bounding box of the scene but for photon mapping. How should one find a bounding box from the pov of the light when infinite planes are involved?

EDIT: I would like to add one more question. I've seen in some source codes, that are using russian roulette, scaling the photon's power by the material's diffusivity and dividing by the average color. Is this correct? I thought that the point of the russian roulette was to not have to do this and end up with photons with varying and small powers.

sentences:
What game systems exist which uses camera input? The group and I is in the middle of a semester project where we are currently researching on which game systems are using camera as input or as an interactive medium?
We would like some help listing some of the game systems which uses camera input, as it seems hard to find other examples.
Currently we know that webcam browser games uses camera input (Newgrounds webcam games), as well as the xbox kinect.
I know this questions seems rather vague, though I still hope some people is capable of helping.

sentences:
How to increase the number of available chapters for an HL2: EP2 mod? I created a mod for Half-Life 2: Episode 2 that has 39 chapters (or maps, here it is the same). The problem is that the game seems to see only 32: when clicking "new game", and clicking next, I count only 32/39.
Then, I went to the mod/cfg folder, I removed some of the chapter.cfg and whatever the number of the chapter, it is the sum of chapters that can't be above 32.
I tried to search on the Internet, but it seems that the only guy having a "quite" similar issue is here: Fix broken Portal 2 chapter handling in my mod (and he never had an answer).
As he did, I tried to modify the sv_unlockedchapters variable in config_default.cfg by putting it to 99, so every chapter is unlocked.
So here is my question: where is the parameter or the variable that fix the maximum number of maps?
I guess it would be in a .cpp file, and I tried to find it, but I do not have any knowledge in C++ programming, nor on how Valve organize their files.

sentences:
Call Unity3D coroutines from a scripting language I created a simple scripting language to use on a Unity3D game. My parser generates an AST with nodes for every type of operation, and to run the script all I need to do is call Execute() on the root of the tree, which propagates recursively to every node in it.

To run functions from my script, I first create a dictionary linking function names to delegates, and the function node simply needs to look it up run it.

But I have ran into a problem now... Some of the functions I need to call from the script are coroutines that take time to execute, such as WalkTo or WaitNSeconds, and for those coroutines I need to halt the script execution until they are done.

I'm stuck on figuring a way to halt the script execution, as once I call Execute() on the root node, the script gets executed recursively all the way.

Just to provide some more context, here are some examples of a few possible types of nodes and how they operate (not the actual nodes from my language, but close enough). Some nodes simply call Execute() on their children and return nothing. Some nodes simply return values directly. Other nodes get values from their children and modify it in some way.

abstract class Node
{
    object Execute();
}

class RootNode: Node {
    List<Node> Children;
    object Execute() {
        foreach(Node node in Children)
            node.Execute();
        return null;
    }
}

class NumberNode : Node {
    int Value;
    object Execute() { return Value; }
}

class SumNode : Node {
    Node Left;
    Node right;
    object Execute() {
        return (int)Left.Execute() + (int)Right.Execute();
    }
}

class PrintNode : Node {
    Node Expression;
    object Execute() {
        Console.WriteLine(Expression.Execute().ToString();
        return null;
    }
}

class FunctionNode: Node {
    string Name;
    object Execute() {
        return SymbolTable.FindFunction(Name)();
    }
}

sentences:
Is there a name for this kind of composited sprite animation technique? Character avatars composed of different sprites for each component (arms, legs, head) connected together through a series of joints seem to be trending lately. For example,  Scrolls, Candy Crush (in the cutscenes) and the iOS Agricola game.

This system allows the characters to have movements without having to author each frame on a sprite and can look much smoother.

For example, see how the characters seem to breathe in this video? I've checked the game files, they are indeed composed of static parts, linked together through some kind of skeleton.

What is this technique called?

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:
OpenGL ES 2 jittery camera movement First of all, I am aware that there's no camera in OpenGL (ES 2), but from my understanding proper manipulation of the projection matrix can simulate the concept of a camera.

What I'm trying to do is make my camera follow my character. My game is 2D, btw. I think the principle is the following (take Super Mario Bros or Doodle Jump as reference - actually I'm trying to replicate the mechanics of the latter): when the caracter goes beyond the center of the screen (in the positive axis/direction), update the camera to be centred on the character. Else keep the camera still. I did accomplish that, however the camera movement is noticeably jittery and I ran out of ideas how to make it smoother.

First of all, my game loop (following this article):

private int TICKS_PER_SECOND = 30;
private int SKIP_TICKS = 1000 / TICKS_PER_SECOND;
private int MAX_FRAMESKIP = 5;

@Override
public void run() {
    loops = 0;

    if(firstLoop) {
        nextGameTick = SystemClock.elapsedRealtime();
        firstLoop = false;
    }

    while(SystemClock.elapsedRealtime() > nextGameTick && loops < MAX_FRAMESKIP) {
        step();
        nextGameTick += SKIP_TICKS;
        loops++;
    }

    interpolation = ( SystemClock.elapsedRealtime() + SKIP_TICKS - nextGameTick ) / (float)SKIP_TICKS;

    draw();
}

And the following code deals with moving the camera. I was unsure whether to place it in step() or draw(), but it doesn't make a difference to my problem at the moment, as I tried both and neither seemed to fix it. center just represents the y coordinate of the centre of the screen at any time. Initially it is 0. The camera object is my own custom "camera" which basically is a class that just manipulates the view and projection matrices.

if(character.getVerticalSpeed() >= 0) { //only update camera if going up
        float[] projectionMatrix = camera.getProjectionMatrix();

        if( character.getY() > center) {

            center += character.getVerticalSpeed();

            cameraBottom = center + camera.getBottom();
            cameraTop = center + camera.getTop();

            Matrix.orthoM(projectionMatrix, 0, camera.getLeft(), camera.getRight(), center + camera.getBottom(), center + camera.getTop(), camera.getNear(), camera.getFar());
        }
    }

Any thought about what I should try or what I am doing wrong?

Update 1: I think I updated every value you can see on screen to check whether the jittery movement is affected by that, but nothing changed, so something must be fundamentally flawed with my approach/calculations.

sentences:
How can I obtain the file size of a Unity build at runtime? I'm wondering if it is possible to obtain the filesize of a game's build at runtime.
Searching this topic only yields results for reducing the build size, which is not at all what I'm looking for.

sentences: Physics-based dynamic audio generation in games I wonder if it is possible to generate audio dynamically without any (!) audio assets, using pure mathematics/physics and some input values like material properties and spatial distribution of content in scene space. What I have in mind is something like a scene, with concrete floor, wooden table and glass on it. Now let's assume force pushes the glass towards the edge of table and then the glass falls onto the floor and shatters. The near-realistic glass destruction itself would be possible using voxels and good physics engine, but what about the sound the glass makes while shattering? I believe there is a way to generate that sound, because physics of sound is fairly known these days, but how computationaly costy that would be? Consumer hardware or supercomputers? Do any of you know some good resources/videos of such an experiment?

sentences:
Extrude only vertices where the assigned texture is transparent? I am looking at implementing a water surface on my spherical object and have created a texture with transparent pixels where the water should be. However, I am currently confused on how I can extrude only vertices where the texture is transparent. Do I have to test the texture at the appropriate position prior to assigning the vertex and just assign a Color.Transparent value to that vertex or am I thinking about this all wrong?

Special thanks to @Bram for helping me to answer some questions that could help clarify my specific situation.

What geometry do you extrude?

Individual vertices with a geometry, fragment, or hull shader.

What is the extrusion for?

To make waves in the water.

When I mention testing texels and then assigning colors to a vertex, I mean doing so beforehand when creating the Vertex[] object. This would be easy enough to do I suppose; I'd have to look into some samples of how to test the texture on the C# side, which is why I'd love to do it in a shader that has a similar flow as below:

Vertex Shader

Create the sphere.

Pixel Shader

Grab only vertices that have transparent pixels via TEXCOORD0.

Geometry/Fragment/Hull Shader

Extrude those vertices.

sentences:
Multiple pixel shader passes I currently have a pixel shader that calculates the texture and I have another that calculates the light. I want another shader that does both. What I would ideally like to do is instead of creating a third shader that does that, I would like to have my object run through the first shader, then run through the second and then combine the final colors. Is this possible in DirectX11?

If this is possible, is it also possible that I run through the same shader multiple times? For example, could I load a texture and then run my texture shader then load another texture and then run the same texture shader again. Also same with lights, where I load light information to the cbuffer, run light shader, load another light informationm ,run light shader and rinse and repeat until I have run all lights.

sentences: Manual per-glyph rendering with SDL_TTF I'm trying to create a font atlas with SDL_TTF. My idea was to create an SDL_Surface for every character using TTF_RenderGlyph_Blended() and use TTF_GlyphMetrics() to get glyph metrics so that I can position the surface relative to a baseline. I'm struggling with a correct positioning of a glyph. It looks like SDL_TTF creates a surface with height which is at least the height of the font and width which is at least advance of a glyph, so the surface is bigger than just the glyph. How do I extract glyph's rectangle from the created surface? How do I position the glyph correctly relative to the base line on the screen? I thought y position of the glyph it should be baselineY - maxy (where maxy is from TTF_GlyphMetrics), but that places glyph too high above the base line.

sentences:
Attributes for calculating a hit in a turn based game or Roguelikes I'm trying to figure out a good formula for determining a hit when the player attacks an enemy in a Roguelike. I'd like to come up with something simplistic but, still true to the way it's done in D&D or popular Roguelikes like AngBand or NetHack.

What I have so far is adding the differences between player and enemy attributes, along with a random integer:

if ((player.dex - enemy.dex) + (player.speed - enemy.speed) +
    (player.luck - enemy.luck) + random_integer_below_6()) >= 10) {
    hit(enemy);
}

This makes for unnatural gameplay: the player never misses weak enemies and vice versa for strong ones. Does anyone know of a guide to attribute based combat used in turn based games etc? Should I (and can I) copy the D&D rules verbatim?

sentences:
Using gl3w and Win32 api, without glut I'm still a beginner, the example on skaslev's site require us to use glut as an interface to create a window.

For some reason, I'm required to create a window purely with Win32 api, but I am not sure of how to integrate it together with gl3w.c

Is there a guide or tutorial on how to do that? I've been searching for hours, seems out of luck :(

sentences: OpenGL/GLSL/LWJGL return value from shader I'm trying to do some bone animation. I don't want the whole skeleton to be loaded to the GLSL shader every time, even tough it's not needed, because one vertex is parented to one bone, not more. My question is simple: (How) can i return some value from the vertex shader back to my code? I'm using LWJGL/Java

sentences:
OpenGL - Debug version runs faster than Release version My Visual Studio 2019, 64-bit version of Tetris using OpenGL runs significantly faster, 3X, in Debug mode than in Release mode.
The image above shows the board.  Each cycle of the rendering or game loop redraws everything, viz., the light blue background, the grid, the individual game pieces (one shown) with the latest one added moving every 300 ms, and the text score display.  I have moved all the repetitive code out of the loop, e.g., that which sets the location in shaders for uniform constants.
The Release mode loop cycle time ranges from 0.05 to 1390.0 ms while that of the Debug mode ranges from 0.05 to 350.0 ms.
Any thoughts on what I might investigate?
Thanks.

sentences: 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:
I can't clear the paint image in my Canvas I'm trying to make the Mario move, but somehow it leaves traces behind, can anybody help???

var canvas = document.getElementById("screen");
var ctx = canvas.getContext("2d");
var mario;
var marioSprite;
var tiles;
var speedX = 1;

//marioSprite Specification
mario = {
    //target picture specification X & Y, Width & Height
    px:276,
    py: 44,
    pwidth: 16,
    pheight: 16,
    //drawing on Canvas specification X & Y, Width & Height
    cx: 16,
    cy: 116,
    cwidth:16,
    cheight:16,
}

//draw Mario in Canvas
function drawMarioSprite(){
    marioSprite = new Image();
    marioSprite.src = 'file:///C:/Users/MASTONO ALI/Desktop/img/characters.gif';
    marioSprite.addEventListener('load', e => {
    ctx.drawImage(marioSprite,
        mario.px, mario.py, mario.pwidth, mario.pheight,
        mario.cx, mario.cy, mario.cwidth, mario.cheight);
    });
    this.position = function() {
        this.mario.cx += speedX;
    }
    position();
}//drawMarioSprite() end

//drawTiles and tilesLoop
function drawTiles() {
    tiles = new Image();
    tiles.src = 'file:///C:/Users/MASTONO ALI/Desktop/img/tiles.png';
    tiles.addEventListener('load', e => {
        tilesLoop();
    });
}
function tilesLoop(){
    for (let x = 0; x < 25; x++){
        for (let y = 11; y < 13; y++){
            ctx.drawImage(tiles,
                0, 0, 26, 26,
                x*12, y*12, 20, 20);
        }
    }
}//drawTiles() end

function draw(){

    drawMarioSprite();
    drawTiles();
    window.requestAnimationFrame(draw);
}

window.requestAnimationFrame(draw);

thank you

sentences:
Comparing performance I wanted to create a portal.
This portal looks like a semi-transparent texture rotating on a cylinder:

At first I created such a portal using a Particle System.

Then I realized that this might be an overkill and built another portal the following way:

I put a cylinder in the scene, put the texture on it and added a script that would rotate the cylinder.

The visual result of the 2 approaches (Particle System vs. Mesh approach) is perfectly the same.

Now I wanted to test which one performs better.

Am I right to assume that I should write a script which creates 10.000 portals of type A or B in the scene and have a look at some statistics (not sure yet which / where to find them), or is there anything more convinient to test performance?

Thank you!

sentences:
How to prevent game client version spoofing Basically I have a c++ server that will use a binary protocol to talk to my client (unity game). As part of the login process I want to send the client version to the server. The server then responds saying (assuming login credentials are correct) they are okay to connect, or if the client version is outdated it returns a client version outdated.

My question is, how can I prevent people using old client versions and spoofing as the latest version. As this could potentially lead to server bugs as it is handling an outdated client thinking it is up to date...

Thank you :)

sentences:
Game Physics With RK4 Implementation For A 2D Platformer I been reading about RK4 for physics implementation in a game, so I read in some pages and all people recommend me this page:

http://gafferongames.com/game-physics/fix-your-timestep/

This page shows clearly how this one works, but I can't figure out how to implement in my game, maybe I don't understand that good but I find some things that are not really clearly to me.

In my game, the player decides when change direction in the X-Axis but I can't figure out how with this RK4 implementation change the direction of the object, in the example the point goes side to side but I don't understand how I can control when he goes right or left.

So if anyone can give a little bit of clarity in this implementation and my problem which I do not understand I will be really grateful.

Thanks beforehand

sentences:
Unlock levels using coins - Unity I'm creating a game that has multiple levels. The first three levels are free but the others can be unlocked either using coins (collected during the game) or through IAP. For the coins, I'm using a binary formatter to store the number of coins. The reason I'm using BF is because it persits through all levels(so far this seems to work as the coin score is carried through to other levels). Here is code I have so far in the coinSystem:
public class CoinSystem : MonoBehaviour
{
  public TextMeshProUGUI coinScoreText;
  public int coinScore;

  void Start()
  {
    LoadScore();
  }

  public void Save()
  {
    coinScore++;
    coinScoreText.text = coinScore.ToString();

    BinaryFormatter bf = new BinaryFormatter();
    FileStream file = File.Open(Application.persistentDataPath + "/TotalCoinScore.dat", FileMode.Create);

    CoinContainer coinContainer = new CoinContainer();
    coinContainer.coinScore = coinScore;

    bf.Serialize(file, coinContainer);
    file.Close();
   }

  public void LoadScore()
  {
    if (File.Exists(Application.persistentDataPath + "/TotalCoinScore.dat"))
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/TotalCoinScore.dat", FileMode.Open);
        CoinContainer coinContainer = (CoinContainer)bf.Deserialize(file);
        file.Close();
        coinScore = coinContainer.coinScore;
        coinScoreText.text = coinScore.ToString();

     }
   }
 }

  [Serializable]
  public class CoinContainer
  {
     public int coinScore;
  }

This is code that I use to add to the coinScore.
public class Player : MonoBehaviour
{
  Rigidbody rb;
  public CoinSystem cs;
  public bool dead = true;

  void Start()
  {
    rb = GetComponent<Rigidbody>();
  }

  .
  .
  .
  .

  void OnTriggerEnter(Collider col)
  {
    if (!dead && col.gameObject.tag == "Enemy")
    {
        die();
    }
    if (!dead && col.gameObject.tag == "Coin")
    {
        cs.Save();
    }
  }

So now in the level select menu, I want to add a button that once clicked should enable the user to unlock a particluar level if he has enough coins. For example, if a level requires 500 coins and the user has 600, then on clicking this button the level is unlocked and the total coins now available are 100. And if the number of coins are less than what is required to unlock a level then the user should not be able to unlock that level. I'm not sure how to implement this.

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:
What is the efficient way to sync TextureProgress with a Timer not in the UI? I want to use a TextureProgress which reflects the state of a Timer.
I have tried to emit signals:

FROM: the Node2D._process() which owns the Timer with emit_signal("time_left_changed", timer.time_left)
TO: the UI

but it seems to make huge impact on performance.

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:
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:
How to make a iOS plugin for Unity3d I've passed last 2 days reading articles and book for understand how can i make a plugin for iOS in Unity. Basically i need just a demo for understand how it work. For now i've tried to make this process (with really poor luck):

I've started a new project in Unity and writed a simple script

using UnityEngine;

using System.Collections;

using System;

using System.Runtime.InteropServices;

public class CallPlugin : MonoBehaviour {

    [DllImport ("__Internal")]

    private static extern int test();

    void Start ()

    {

        Debug.Log(test());

    }

}

Then i've created a project in Xcode with this simple script:

extern "C"{

    int test()

    {

       int che = 5;

        return che;

    }

}

Then i've tried:

to put the .mm and .h in the Assets/Plugins/iOS = nothing

to build the unity project and than add the .h and .mm in the Xcode project = nothing

In Unity i will always get the EntryPointNotFoundException, so unity see the file but is unable to reach the method. The problem is... how?! :)

Maybe i miss something or i've done something wrong?
Thanks a lot for every help that you can give me :)

sentences:
How to import a NET .dll newer than 2.0 into Unity? I'm trying to build one of the simple EventBus libraries from Github and import them into Unity. Here are the libs:

TinyMessenger and
RedBus

It's that simple - I take the source code, build it through the VS2015 and place the .dll into the Assets/Plugins folder.

Then, I have no way to use the lib's namespace (Unity doesn't read the file).

Both of these libraries are written in NET 3 or 4 and this is the failure's reason.
I've recompiled the second one (removed the System.Linq code, changed the project's version) to NET 2.0 and it worked, but that's not the point. I need the first library and it ain't easy to rewrite the entire 4.0 code to 2.0 without Linq.

As I remember, you can use System.Linq in Unity (at least, I did it once). This means that Unity uses some kind of trickery/magic, as always.

What's the problem here? Is there any way to get this working?

sentences:
How can I efficiently update only the entities that matter in a given frame? I'm making a RTS, which can potentially have lots of units in one map (think Age of Empires).

I'm looking for a way to update my units. I want to avoid calling a virtual Update() method every frame on every entity. On the other hand, units that are not in view should still be updated and behave "normally."

I'm assuming this is a fairly standard question; what would be a way to handle this situation?

sentences:
3D Camera raytracing (PSM SDK) I am currently creating a 3D Camera on the Playstation Mobile SDK (which is basically openGL with just a little bit of abstraction).

The game I am trying to make is a 3D Tactical. That means my world is composed of 3D cubes, all of the same size (unit size) and placed at integer position.

I'd like to be able to detect on which block the player clicks. That means, some sort of raytracing from the camera to detect the nearest block. My problem is that I am new to all this maths/physics/3d stuff.
How could I implement this easily (and in a efficient enough way) ?

My camera currently have a position, and two modes : Target mode (it uses a LookAt on a point) and direction mode (it uses a lookAt on its position + the direction). That means I have access to the direction of the camera.

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:
LibGDX Shader does not work with FBO texture I have a shader and I want to run the shader on the whole rendered image at the end instead of each individual sprite that I render on screen. For this purpose I created an FBO, I render the all my images to the FBO and then I render to colorBufferTexture generated by the FBO. There is just one problem, the shader does not work when I render the FBO texture. The withoutFbo() method render the image with the shader working just fine, but the withFbo() method only renders the image without the shader. Also I know that the shader in withFbo() is working because if I try to render something other then the colorBufferTexture from the FBO the shader will work. So why isn't the shader working with the texture generated by the FBO?

public class Application3 extends ApplicationAdapter
{
    float time;
    Sprite sprite;
    FrameBuffer fbo;
    SpriteBatch batch;
    Texture noiseTexture;
    TextureRegion fboTexture;
    ShaderProgram shaderProgram;

    @Override public void create()
    {
        ShaderProgram.pedantic = false;
        batch = new SpriteBatch();

        sprite = new Sprite(new Texture("game.png"));
        sprite.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

        shaderProgram = new ShaderProgram(Gdx.files.internal(Shader.GLITCH2.getVertex()), Gdx.files.internal(Shader.GLITCH2.getFragment()));

        noiseTexture = new Texture(Gdx.files.internal(Shader.GLITCH2.getPath() + "noise.png"));
        noiseTexture.bind(0);

        fbo = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
        fboTexture = new TextureRegion(fbo.getColorBufferTexture());
        fboTexture.flip(false, true);
    }

    @Override public void render()
    {
        //withFbo();
        withoutFbo();
    }

    void withoutFbo()
    {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        time += Gdx.graphics.getDeltaTime();

        shaderProgram.setUniformi("u_noise", 0);
        shaderProgram.setUniformf("u_time", time);
        batch.setShader(shaderProgram);
        batch.begin();

        batch.draw(sprite, sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight());

        batch.setShader(null);
        batch.end();
    }

    void withFbo()
    {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        time += Gdx.graphics.getDeltaTime();

        fbo.begin();
        batch.begin();

        batch.draw(sprite, sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight());

        batch.end();
        fbo.end();

        shaderProgram.setUniformi("u_noise", 0);
        shaderProgram.setUniformf("u_time", time);
        batch.setShader(shaderProgram);
        batch.begin();

        batch.draw(fboTexture, sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight());

        batch.setShader(null);
        batch.end();
    }
}

sentences:
What is the most efficient way to access resources? I have a resource manager that loads and returns resources. Currently, I just return shared_ptrs for the resources I create, but I'm thinking about going over to using something like simple handles, whereby you get an ID you use to access the resource. The reasons are more explicit ownership, and also less overhead, rather than using smart_ptrs.

Are resource handles the most efficient way to access resources, should I stick with shared_ptrs or are there other alternatives?

The reason I am asking is that I was reading this article, which made me wonder if I should implement something like that, instead.

sentences:
How to decrease velocity constantly? I am developing a golf game using the GameSalad framework for iPhone. I have one attribute named speed of type integer with value 5000. I also have one boolean attribute named speedControl which is initially false.

When the ball is pressed and its sppedControl is true, I accelerate it with game.speed i.e. 5000.

Now I want to decrease the speed of the ball every 0.5 seconds, so i added a timer behavior and set it to every 0.5 seconds. Every tick of the timer, I set the CHANGE ATTRIBUTE game.speed to game.speed-300. but it's not working.

Sorry, I have no reputation, therefore I can't send you screenshots.

Please help me. I am very new to GameSalad and this is my first project.

sentences:
Orthographic camera and z-axis in 3D isometric view game I'm working  on a game in Away3d. I'm using an orthographic camera and I'm attempting to simulate an isometric view (the camera has a 37° angle and the y-axis is up/down, x-axis is left/right, and z-axis is orthographic).

I hit a snag in understanding how to handle the z-axis of the NPC's relative to the player so that, for example, when the player is below an NPC in Y coordinates, it doesn't appear to be "under" the NPC, but "besides/in front" the NPC, as currently all the 3D models in this scene are Z-axis coordinate 0.

My common sense says that there should be a relation in the sense that if the Y axis coordinates of the NPC is lower than the Y axis coordinates of the player, then the z-axis coordinates should update following an allegory is so that the apparent view of the NPC relative to the player is that the NPC is "behind" the player. But as I said, because all the z-axis are zero for all the models, the players' apparent position is "under" the NPC, as opposed to "in front" of the NPC.

sentences:
online game, NPC monster death and hit detection to gain experience points I'm doing a simple idle game, HTML5 client and Node.js server, but I'm making it online, where the client talks to the server (websockets) and all the logic is in the server (I want to prevent cheating as much as possible, because I want to have leaderboards).

My idea is, when the player X attacks the mob Y and it hits for 10 (should gain 10xp), so I send that via websocket, "playerX|10". How do I validate the input, so that a cheater can't just send "playerX|100000000".

Also how do I handle mob deaths? Do I send a "playerX,mobY" and the server replies with a drop?

Am I worrying too much about security? The golden rule is never trust the client, but how?

I'm thinking maybe all the client does is send actions?

message: attack|mobY, and the server calculates everything, xp gains, hit values, but I still don't know how to handle mob death, without having to keep state for the current "fight" with that mobY.

Sorry if I'm not clear enough. If you can share some thoughts or articles about this stuff, I'll be very glad!

sentences:
Batch/Combine multiple Graphics.DrawProcedural-Calls in Unity I have multiple calls to Graphics.DrawProcedural in my Unity-project.
E.g. I'm drawing 1000 procedural geometries that share the same material and get their positions/meshes from a ComputeBuffer.

At some place in my code I'm doing something like this

foreach(ProceduralGeometry pG in proceduralGeometries)
{
    pG.Draw();
}

Where draw sets the Materials buffer accordingly and calls Graphics.DrawProcedural.

Is there anything I can do to batch all these geometries together? Currently I perform over 1000 DrawCalls (seen in the frame inspector) which happen to be very expensive performancewise.

Thanks in advance!

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:
Help to understand directions of sprites in XNA If I want to move a sprite to the right and upwards in a 45 degree angle I use

 Vector2 direction = new Vector2(1,-1);

And if the sprite should move straight to right

 Vector2 direction = new Vector2(1,0);

But how would I do if I want another directions, lets say somewhere between this values? I have tested with some other values, but then the sprite either moves to fast and or in another direction than I expected!? I suspect it's about normalize!? Another thing I have problem with to understand.

I'm doing a simple asteroids game as a task in a class in C# and XNA. When the asteroids hit the window borders, I want them to bounce back in a random direction, but I can't do this before I understand how directions and Vector2 works. Help is preciated! Thanks!

sentences:
How can I make the main game loop frame-rate independant? I am trying to create a frame independent game loop.

I am currently using the following code

 private class MainGameThread extends Thread {
        public static final int PAUSE_SLEEP_TIME = 10;
        long previous = getCurrentTimeInMillis();
        long totalElapsed = 0;
        long gameTimeStart = 0;
        long currentTime = getCurrentTimeInMillis();
        long accumulatorTime = 0;

        @Override
        public void run() {
            gameTimeStart = getCurrentTimeInMillis();
            while (mIsRunning) {
                // Pause game
                while (mIsPaused) {
                    try {
                        Thread.sleep(PAUSE_SLEEP_TIME);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                long current = getCurrentTimeInMillis();
                long elapsed = current - previous;
                previous = current;
                processGameInput();
                updateGameState(elapsed);
                totalElapsed += elapsed;
                if (totalElapsed > MainGame.MS_PER_FRAME) {
                    drawGame();
                    totalElapsed -= MainGame.MS_PER_FRAME;
                    if (totalElapsed > MainGame.MS_PER_FRAME) {
                        Log.e("GAME", "Performance warning, rendering or update took too long");
                    }
                }
                checkIfGameShouldStop(gameTimeStart);
            }
            shutdownGracefully();
        }

        private void shutdownGracefully() {
        }
    }

It works, however it performs differently on different devices.

In my game models update method I am performing the following actions

  mCenterX += (mVelocityVector.x * timeElapsed);
  mCenterY += (mVelocityVector.y * timeElapsed + gameSpeed.getValue())

I have read this article, but I can't understand the final example:

double t = 0.0;
double dt = 0.01;

double currentTime = hires_time_in_seconds();
double accumulator = 0.0;

State previous;
State current;

while ( !quit )
{
    double newTime = time();
    double frameTime = newTime - currentTime;
    if ( frameTime > 0.25 )
        frameTime = 0.25;
    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 );
}

What does the State class object mean in this case?

Could someone please help to adapt this example to my case or explain the example from the article and how I could update my loop to be frame independent?

sentences: Unity create water issue I use daylight water in my project but by the default it has not got any waves or light tracing effects. But in some tutorials I see how the user add standard water asset and it has got beautiful world reflection on the surface and beautiful waves. Is this issue because that I am using not a PRO version?

sentences:
Creating a top-down spaceship I'm creating a top-down 2D space game in LIBGDX for android.

When spaceship is going forward it will look like this:

when it goes upward I want to change it's direction with a nice animation so it seems like a real spaceship. A between frame would be like this:

I have rendered the spaceship in different Z axis degrees from ship0 to ship90. Calculating rotation on XY plane wouldn't be so hard, but I don't know how to calculate the rotation on Z axis so I can choose the right sprite to use.

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:
Why are radians preferred over degrees in game development? I've been looking up the definition of radians and found out that mathematicians prefer them because they are derived from pi instead of being completely arbitrary like degrees.

However, I have not found a compelling reason to use them in game development, possibly due to my complete lack of related mathematical understanding. I know that most sin/cos/tan functions in languages what radians, but someone could just as well create library functions in degrees (and avoid the inherent rounding errors when using pi).

I don't want this to be an opinionated poll, I would just like to hear from people that have done game development (and the associated math research) where radians offer a superior experience over degrees, as opposed to "We're using radians because we always used them", just for the sake of helping me (and possibly others) to understand what they are good for.

sentences:
Transform.LookingAt() does nothing To get used to how Godot transforms work, I am attempting to write an orbit control. The goal is for it to behave similarly to the Godot viewport.

So far I have the positioning of my camera working. However, when I try to point it at the center of orbit (0,0,0), the LookingAt() function doesn't seem to work. I have printed the values to the console and just proves beyond a doubt that there isn't any change.

I've tried moving the camera around and using different values for the up-axis, but it still doesn't work.

Here are the pertinent functions from my Camera node's script:

private Vector2 rotateStart;
private Vector2 rotateEnd;
private Spherical spherical = new Spherical();
private Vector3 target = new Vector3();

public void HandleRotation(float delta)
{
    var transform = GetGlobalTransform();
    var viewportSize = GetViewport().GetVisibleRect().Size;

    rotateEnd = GetViewport().GetMousePosition();
    Vector2 RotateDelta = rotateEnd - rotateStart; //Change in rotation
    spherical.SetFromVector(transform.origin); //Spherical = current location

    //Calculate changes to equatorial and vertical rotations.
    spherical.theta += 2 * (float)Math.PI * RotateDelta.x / viewportSize.x;
    spherical.phi += 2 * (float)Math.PI * RotateDelta.y / viewportSize.y;
    var final_transform = new Vector3();

    spherical.CopyToVector3(ref final_transform);
    transform.Translated(final_transform - transform.origin); //Apply position change
    GD.Print(transform);

    //Point at origin (point of orbit)
    transform.LookingAt(target, new Vector3(0, 1, 0));
    GD.Print(transform);
    SetGlobalTransform(transform);

    rotateStart = rotateEnd;
}

public override void _Process(float delta)
{
    if (Input.IsMouseButtonPressed((int)ButtonList.Middle))
    {
        HandleRotation(delta);
    }
    else
    {
        rotateStart = GetViewport().GetMousePosition();
    }
}

sentences:
How to check if a test ad is ready I was going through UnityAds for Unity3D, and came across this setting:

AD TEST MODE
Force all

So as I understood it states that I will be able to see real ads, in test mode, without monetizations on my testing tool, which in my case is Unity3D IDE, but I am still getting that blue sample ad screen "Here would be your ad screen". Is there anything that I can do to check if any ad is placed for my app, and check this via code before Advertisement.Show(); statement? Or am I missing something?

sentences:
std::map inserts a NULL pointer I ran into an access violation reading error and when I debugged it, I saw that the insert function of std::map is inserting a NULL pointer into the map.

Though I've fixed the error by first inserting a NULL value into the map and then changing that value to the corresponding object I wanted to insert in the map. But I want to know the reason the error occurs and why it got fixed.
My code looks like this:

void CTextureBank::AddTexture(int ID)
{
    // Create a CTexture object, load texture into it and insert it into the Texture List
    CTexture* texture = new CTexture();
    texture->LoadTextureFromFile(mRenderer, ID);
    mTextureList.insert(std::make_pair<int, CTexture*>(ID, texture));
}

In the AddTexture function, I'm first creating a texture object, loading a texture into it and putting that texture into the map.
But, this one gives me an access violation reading error.

And doing this doesn't:

void CTextureBank::AddTexture(int ID)
{
    // Create a CTexture object, load texture into it and insert it into the Texture List
    CTexture* texture = new CTexture();
    texture->LoadTextureFromFile(mRenderer, ID);
    mTextureList.insert(std::make_pair<int, CTexture*>(ID, NULL));
    mTextureList[ID] = texture;
}

So it would be great if someone can tell me why this occurs.
Thanks :)

sentences: How can I my homing missile avoid walls (2D)? Okay, I have the homing missile implemented. It will follow the player, but I want it to avoid the walls. I tried out A* but I want to make my own. I need some help plzz.

sentences:
How to line up rigidbody velocity with speed of moving floor So,  I have a player who remains in the same X position. the floor moves from right to left underneath the player, and I am using tiles of 1 unit.

Here's my jumping stuff:

if (RB.velocity.y < 0)
{
    RB.velocity += Vector2.up * Physics2D.gravity.y * (FallMultiplier - 1) * Time.deltaTime;
}
else if (RB.velocity.y > 0)
{
    RB.velocity += -Vector2.up * -Physics2D.gravity.y * (JumpMultiplier - 1) * Time.deltaTime;
}
if (/*Input.GetKey(KeyCode.Space) &&*/ IsGrounded && JumpDelay < 0)
{
    RB.velocity = Vector2.up * JumpVelocity;
    JumpDelay = 0.1f;
    Debug.Log("Jumping");
}

And here is what moves the floor:

Vector2 NewPosition = TF.position;
NewPosition.x -= Time.deltaTime * Speed;

TF.position = NewPosition;

So, what I want to happen, is I have a movement speed for the floor, and I want to make it line up such that if I jump where the player is directly in the middle of one floor tile, they will land (say 4 tiles later) directly in the middle of another tile.

I can get close by tweaking the velocities... but this feels the wrong way. I want to know what values I might be able to use, and how to calculate what velocities they should be.

Speed of floor right now is at 5, Jump Multiplier at 1.75 and Fall Multiplier at 7. There of course do not line up as I hope, but it gives example values in case that helps. How would I solve this to say, for example, with the given multipliers, what should the floor speed be to line up perfectly?

sentences:
How to create a projectile motion of a cannonball in top down view? Objective

To move the bullet with projectile motion to specific destination by touch point.

In the below image is an example of a bullet which has a projectile motion. On my observation, the bullet speed and angle is calculated base on distance.

(source: pixwerk.net)

Where I'm at? (How do I move the bullet to its destination?)

In the below code, is the method I use to move a bullet to its destination. But the problem is I want to create a cannonball bullet which it has a projectile motion. How do I create these tricks to make a cannon ball projectile motion like the image below.

public Vector2 getVelocity(Vector2 currentPosition, Vector2 targetPosition) {
    Vector2 targetDirection = targetPosition.cpy().sub(currentPosition);
    return targetDirection
            .nor();
}

What I have done? (Currently I could move the bullet straight to its destination.)

Bullet is moving straight (It's not problem).

[EDIT]

Drawing a projected trajectory

To get the trajectory point, base on iforced example. I've already have the libgdx box2d version of this.

b2Vec2 getTrajectoryPoint( b2Vec2& startingPosition, b2Vec2& startingVelocity, float n )
  {
      //velocity and gravity are given per second but we want time step values here
      float t = 1 / 60.0f; // seconds per time step (at 60fps)
      b2Vec2 stepVelocity = t * startingVelocity; // m/s
      b2Vec2 stepGravity = t * t * m_world->GetGravity(); // m/s/s

      return startingPosition + n * stepVelocity + 0.5f * (n*n+n) * stepGravity;
  }

Rendering the trajectory point

glColor3f(1,1,0);
  glBegin(GL_LINES);
  for (int i = 0; i < 180; i++) { // three seconds at 60fps
      b2Vec2 trajectoryPosition = getTrajectoryPoint( startingPosition, startingVelocity, i );
      glVertex2f(trajectoryPosition.x, trajectoryPosition.y );
  }
  glEnd();

[Solve]

The answer is to find the angle and speed by the distance by s.tarik.cetin

Another issue encountered (this must be move to another question)

This is the problem, I don't know how do I set the starting velocity. Currently in the below code, to set the startingVelocity and startingPosition where the underlined code is the part that I'm not sure.

    touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0);
    camera.unproject(touchPoint);

    Vector2 touch = new Vector2(touchPoint.x, touchPoint.y);
    Vector2 touchDirection = touch.cpy().sub(bulletPosition).nor(); // get the the direction from bullet position to touch point and normalize the value.

    float distance = touchDirection.dst(startingPosition);
    float angle = touch.angle();
    float speed = 6.0f; // currently the speed is fixed. I need to know the speed base on distance

    startingPosition.set(bulletPosition); // current position of the bullet
    startingVelocity.set(touchDirection.scl(speed)); // where the bullet should be

sentences:
How to control a spaceship near a planet in Unity3D? Right now I have spaceship orbiting a small planet. I'm trying to make an effective control system for that spaceship, but it always end up spinning out of control. After spinning the ship to change direction, the thrusters thrust the wrong way.

Normal airplane controls don't work, since the ship is able to leave the atmosphere and go to other planets, in the journey going "upside-down". Could someone please enlighten me on how to get thrusters to work the way they are supposed to?

sentences:
Basic equation for pure metallic reflectance I'm working on a live wallpaper that shows a pure metallic object. Since it's a live wallpaper, I can make a ton of approximations...this isn't a full blown scene in a game world. My shader only has to support this one material. People won't expect extreme detail, etc. So, for example, I don't even bother with diffuse since a pure conductive material barely has any.

So I'm trying to implement a reflective conductive surface that pulls the reflection from a cubemap representing the lighting environment. On a very basic level it looks like this:

vec3 fresnelSchlick (vec3 f0, float cosTheta)
{
    return mix(f0, vec3(1.0), pow(1.0 - cosTheta, 5.0));
}

//...
float NdV = dot(normal, viewDir);
vec2 brdf = texture2D(u_brdf, vec2(u_roughness, NdV)).rg; // from a LUT

vec3 reflection = textureCube(u_cubemap, reflect(viewDir, normal));
gl_FragColor = reflection * (fresnelSchlick(materialColor, NdV) * brdf.x + brdf.y);

The problem with my simple math here is that the range of possible final pixel colors does not produce a proper-looking range of hues. Suppose my material color is #0050ff and the environment is monochrome white. Then all of the possible colors that could be seen are:

This doesn't allow for bright looking reflections at the light sources in the envmap. I found this example material render for comparison. The cubemap in the example here is close to monochrome white. But at the bright areas of the reflection, there is a lot of red component in the color.

With my limited range of colors, my object looks dull and lifeless. Can anyone point out what I'm missing in my equation?

sentences:
How do you map a texture to a sphere in Unity using script? I am looking to map a texture to a sphere inside of Unity using c# (not in the visual editor)?

dragging a jpg or other image resource onto the sphere is the effect I am looking for -- but I would like to do it at runtime.

sentences:
How to create a split screen display with one frame and canvas I am creating a 2D Java game, which looks like this:

My question is what should I do to my display to create two 'separate' displays.
I plan on doubling the height of the program, and have a second display which is able to render completely separately to the top display. I'd like it to look like this:

I would like to not have to click between the two displays to be able for them to recognize input. I think this could be done by just keeping one canvas and just commanding the canvas to draw in certain areas? I also am not planning on using any external libraries.

Game class: (Some irrelevant code removed)

public class Game implements Runnable {

private Display display;
private int width, height;
public String title;

private Thread thread;
private boolean running = false;

private BufferStrategy bs;
private Graphics g;

public State gameState;
public State menuState;

private Handler handler;

public Game(String title, int width, int height) {
    this.width = width;
    this.height = height;
    this.title = title;
}

private void tick() {
    // Ticks the current game state
    if(StateManager.getState() != null) {
        StateManager.getState().tick();
    }
}

private void render() {
    bs = display.getCanvas().getBufferStrategy();
    if(bs == null) {
        display.getCanvas().createBufferStrategy(3);
        return;
    }
    g = bs.getDrawGraphics();

    //Clear screen
    g.clearRect(0, 0, width, height);

    // Gets the current game state and runs its render method
    if(StateManager.getState() != null) {
        StateManager.getState().render(g);
    }

    // End drawing
    bs.show();
    g.dispose();
}

// Initialize the display, assets, and game states
public void init() {
    display = new Display(title, width, height);
    display.getFrame().addKeyListener(keyManager);
    display.getFrame().addMouseListener(mouseManager);
    display.getFrame().addMouseMotionListener(mouseManager);
    display.getCanvas().addMouseListener(mouseManager);
    display.getCanvas().addMouseMotionListener(mouseManager);

    Assets.init();

    handler = new Handler(this);

    gameState = new GameState(handler);
    menuState = new MenuState(handler);

    StateManager.setState(gameState);
}

public void run() {
    init();

    // Some unimportant code is removed for sake of space
    while (running) {
        tick();
        render();
    }

    stop();
}

}

Display class:

public class Display {

private JFrame frame;
private Canvas canvas;

private String title;
private int width, height;

public Display(String title, int width, int height) {
    this.title = title;
    this.width = width;
    this.height = height;

    createDisplay();
}

private void createDisplay() {
    frame = new JFrame(title);
    frame.setSize(width, height);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setResizable(false);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    canvas = new Canvas();
    canvas.setPreferredSize(new Dimension(width, height));
    canvas.setMaximumSize(new Dimension(width, height));
    canvas.setMinimumSize(new Dimension(width, height));
    canvas.setFocusable(false);

    frame.add(canvas);
    frame.pack();
}

public Canvas getCanvas() {
    return canvas;
}

public JFrame getFrame() {
    return frame;
}

}

Launcher class:

public class Launcher {

private final static String TITLE = "Game";
private final static int WIDTH = 256;
private final static int HEIGHT = 192;

public static void main(String[] args) {
    Game game = new Game(TITLE, WIDTH, HEIGHT);
    game.start();
}

}

sentences:
How to constrain a ball and chain like object? Following up  on this question, I have created a snakelike enemy which consists of a head followed by segments. I get the segments to follow the head by constraining each segment's position relative to the segment in front of it. I get the difference between the actual distances between the segments and the desired distance, and correct that error 30% per frame.

The GDScript code looks like this:

for segment in [segment1, segment2, segment3, segment4, segment5, segment6]:
    # get actual distance between segment and its target
    var distance = segment.global_position.distance_to(segment.target.global_position)
    # find difference with desired distance
    var error = distance - desired_distance
    # move segment a percentage of the error toward its target segment
    var vector_to_target = (segment.target.global_position - segment.global_position).normalized()
    segment.global_position += vector_to_target * error * 0.30

I am happy with the result.

Now I want to create a similar enemy also composed of segments, but whose final segment is a kind of base, rooted to one position. Similar to the Chain Chomp from Mario.

I then want to code movement of the head, but for everything to be constrained. I'm guessing all intermediate segments would be doubly constrained by both of their neighbor segments, and the head itself would also have to be constrained by its neighbor segment, even though I'd be coding movement for it.

I'm not sure how to set up constraints like these which have to look in both directions, and would appreciate any advice?

Although I work in Godot, an engine-neutral explanation of the technique would suffice.

sentences: How to make Canvas Unit/ Unity Units consistent size. I'm making an application within unity that leans heavily on UI but whenever I create new UI Elements they appear huge and I have to make a lot of logical concessions to get it to look normal. is there a way to change the Canvas pixels/unit value in the editor? A lot of the people with similar problems I see just are told "That's just how unity works, don't worry about it." but there has to be a better solution.

sentences:
What does the max texture unit mean? My graphics card is a UHD 620 from intel and it says that it has 24 texture units (as far as I know).
Using SDL2 creating and loading 25+ texture works fine, so am I not understanding what the max texture unit actually means? If I were to launch a program that uses more than 24 texture units would it crash if I tried to draw them all at the same time or would it just be really slow having to cycle between then in the shader program?

sentences:
Should scripts interact with an abstraction of the engine? I'm using Java and Jython, and after some research I discovered giving scripts direct access to the engine interface could be a mistake, as it would tightly couple the two.

It looks like most scripting that allows mods to create and manage entities does so through some sort of abstraction. Are these abstractions there for this reason, or is it just to provide a more intuitive way for non-programmers to mod the game?

sentences:
Storing 2D animation frames and sharing them between objects I store 2D animation frames in some class.
But the problem is that when I want to create multiple objects for example I want to spawn explosion or enemy
void ExampleScene::update()
{
    if (needToSpawnEnemy())
    {
        this->objects.add(Enemy());
    }
}

It means that everytime I want to spawn object I will need to access TextureHolder, pass string, get texture and load or compute animation frames and any other calculations that derivered object wants. It's not problem for example with player beacuse I load it on Scene::onCreate only once during entire game but with enemy I would do this during some update function.
My likewise simplifed implementation
struct Animation
{
public:
    void addFrame(Rect rect);
    //The rest of implementation
private:
    std::vector<Rect> frames;
}

class AnimatedSprite
{
public:
    void addAnimation(Animation& animation);
    //The rest of implementation
private:
    std::vector<Animation> m_animations;
}

How do I represent objects (this is gonna be very small project which will evolve later to ECS architecture but I think my problem will not change anyway so I want to solve it already)
struct Context
{
    TextureHolder textureHolder;
    //The rest of stuff...
}

class Object
{
public:
    //The rest of implementation
private:
    Context* context;
    AnimatedSprite sprite;
}

class Player : public Object { //implementation }
class Enemy : public Object { //implementation }

And how I add animation frames
void Enemy::onCreate()
{
    this->sprite.setTexture(this->context->textureHolder.getTexture("assets//graphics//enemy.jpg"));

    Animation walkAnimation;
    walkAnimation.addFrame({0, 0, 64, 64});
    walkAnimation.addFrame({64, 64, 64, 64}); //etc...
    //Surely it can be changed so frames will be loaded from file on disk

    this->sprite.addAnimation(walkAnimation)
}

Maybe NOW it's not very big problem unless I would get animation frames from file (which I want in future). So is there any gamedev standard / pattern / another aproach for this? I was thinking to store frames in dynamic memory and somehow share that data between objects of same class but I'm getting headache of thinking how I could manage that memory. (I don't see how smart pointers would help me beacuse there could not exist any Enemy objects for some time)
class AnimatedSprite
{
public:
    void setAnimation(Animation* animation)
    //The rest of implementation
private:
    AnimationState* animationState;
    AnimationFrames* animationFrames;
}

Should first object load everything but how do I delete it? I don't know if x enemy will be last one.
Or maybe should I add some methods to Object class
virtual void Object::loadDataFromDisk();
virtual void Object::unloadDataFromDisk();

But it seems to be bit clumsy.
I was also thinking to use my Context class to create somewhat AnimationHolder and use it like this->context->animationHolder.getAnimation("ENEMY_WALK"); but I'm not sure about this.
Or maybe some prefab system?
TLDR;
To be precise my shorter question is how to avoid loading same 2D frames data (not textures) while spawning new objects.
So any help and ideas?

sentences:
OpenGL strange depth test behavior I have a simple OpenGL program that renders terrain with a texture. It exhibits some strange behaviors (see video) that look similar to depth test issues. However, I have already enabled depth test. Where else can I look to solve this problem?

https://www.youtube.com/watch?v=WHTFa3tMSyQ

This is the relevant setup code

glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

... VBO and texture setup ..

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

projectionMatrix = glm::frustum(-2.0, 2.0, -2.0, 2.0, 1.0, 10000.0);

... rendering stuff ...

glFlush();
swapEGLBuffers();

sentences:
Changing the 3D model of the Unity ARkit face tracking demo I was able to get the Unity ARkit face tracking demo working with an iPhone X to animate a face model in realtime:

I then tried to get it to work with my own 3D model, and imported the FBX file with the same blendshapes (though each blendshape has a different name from the original sloth model).  By using the hierarchy, ARFaceAnchorManager, and changing the Anchor Prefab I was able to select the model to use:

The problem is:

the rendered model is flipped along the z axis (it faces away from the camera, as shown below).  I've tried to apply a 180 degree rotation to the model in Unity's transform window, but it doesn't seem to do anything.
I'm unsure how to map the blendshapes coming from the iPhone app to the blendshapes in the FBX model - where is that done?  I couldn't find code that references these blendshapes.

sentences:
Different bounding volumes for culling and collision detection Should an object in a 3D-engine use different bounding volumes for collision-detection (broad-phase) and culling?

Basically class renderBounds and class physBounds versus class boundingVolume?

Each of this classes then could either contain the same type of volumes (AABB's, kDOP's,  sphere's etc.) or a special fitting one for the particular object.

(note: without considering of using an external physics engine)

sentences:
Position GUI Text in 2D game I am working on a 2D game, and my camera is a orthographic with a size of 320.

I want to display some text, but not with OnGUI(). Rather, with a GUI Text game object.

I couldn't help but notice that positioning my GUI Text object is a real pain: apparently, the onscreen coordinates where the text appears range from 0 to 1. That is, 0.5 is the center of the screen.

If I wanted to put my label at exactly (100,50) regardless of the screen size, I would have to calculate something like

(100f / Screen.width, 50f / Screen.height)

Is there a way to tell the GUI Text to appear at the actual transform position as it appears on the scene editor? Currently, if you move the GUI Text game object's transform slightly to the right, the rendered text will be displaced a LOT to the right instead...

sentences:
Should I use Coroutines to change variables in inspector smoothly? I want to change the aperture of the depth of field in the camera smoothly by using Mathf.SmoothDamp and a Coroutine, however, since I'm new to game development, I don't know if this is the right way to do it. Any suggestions?

Code:

using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityStandardAssets.ImageEffects;

public class GameStartController : MonoBehaviour {
    public Button startButton;
    public GameObject cubeSpawner;

    // Use this for initialization
    private void Start() {
        startButton = startButton.GetComponent<Button>();
    }

    public void StartGame() {
        EnableCubeSpawner();
        SpawnStartingCubes();
        HideStartMenu();
        StartCoroutine("FocusCamera");
        PlayBackgroundMusic();
    }

    // Enables the cube spawner, so it can start spawning cubes
    private void EnableCubeSpawner() {
        cubeSpawner.SetActive(true);
    }

    private void SpawnStartingCubes() {
        cubeSpawner.GetComponent<CubeSpawner>().GenerateStartingCubes();
    }

    private void PlayBackgroundMusic() {
        var audio = GameObject.FindWithTag("Audio").GetComponent<AudioController>();
        audio.PlayBackgroundMusic();
    }

    private void HideStartMenu() {
        startButton.transform.parent.GetComponent<CanvasGroup>().interactable = false;
        startButton.transform.parent.GetComponent<CanvasGroup>().alpha = 0f;
    }

    private IEnumerator FocusCamera() {
        var camera = GameObject.FindWithTag("MainCamera").GetComponent<Camera>();
        var velocity = 0f;

        while (Mathf.Abs(camera.GetComponent<DepthOfField>().aperture) > 0.001f) {
            Debug.Log(Mathf.Abs(camera.GetComponent<DepthOfField>().aperture));

            camera.GetComponent<DepthOfField>().aperture = Mathf.SmoothDamp(camera.GetComponent<DepthOfField>().aperture, 0f, ref velocity, 0.3f);
            yield return null;
        }

        camera.GetComponent<DepthOfField>().aperture = 0f;
    }
}

sentences:
Unity my game starts in windowed mode, but the fullscreen box is checked When I open my game the fullscreen box is checked, but the game is windowed. If I uncheck and check the box it will go into fullscreen. What is the fix?

public class Settings : MonoBehaviour
{

   public void SetFullscreen (bool isFullscreen)
{
    Screen.fullScreen = isFullscreen;
}
}

I save the current display resolution when the player hits the quit button

    public void Quit()
{
#if UNITY_EDITOR
    UnityEditor.EditorApplication.isPlaying = false;
#else
    Application.Quit();
#endif
}

sentences:
apk is fine, but when building aab for google play submission google play services dont start when i download it So I have a game on app store, I added Google play services

Now when I do an apk build and test it works great really happy with it.

But when I then tick the box for aab ( this is what Google store want uploaded ) it builds it,  I upload it, it rolls out but the Google play stuff fails to work, leaderboard and sign in.

When I extract the apk on my Mac from the aab and install that it works great again.

What am I doing wrong? Is there a way to check logs of running app? On a device

I have tried

7 different versions of unity (currently on 2019.2.9f1)
Changing the min version of Android API to 21
I exported it as a Gradle project and tried building it like that, again test great on device but play services fail when downloading it from the google play store.

It's using the IL2CPP scripting backend.

Any ideas at this stage are welcome

sentences:
How do I ensure my skybox is always in the background, with OpenGL? I created a skybox in OpenGL (through LWJGL), but the only way I found to render it behind all objects was to make it very big. This leads to ugly edges between the 6 skybox planes.

Optimally, I would draw a small skybox and disable DepthTesting on all other objects, but since I want those to display in the right depth order, that isn't possible.

How can I do this?

sentences: How can I create a game in RMVX without battle scenes? I want to create a story-like game which depends on situations based on your decisions. I don't want to have "battle scenes" in my game; can I disregard the EXP/HP stuffs to create my own game?

sentences:
writing problems with MonoDevelop of Unity 3D MonoDevelop was automatically installed by UnityHub.
The text editor poses a lot of problems because you can not insert a specific character
(I position myself, the positioning is not famous and when I insert, it erases the following characters!)

Is there any way to fix this editing problem?
Or
should I install another version of MonoDevelop? If yes, I downloaded his msi file but after I do not know how to install it on my installed Unity

Thank you for your help

sentences:
Raycasting with a selection rectangle box I'm currently making a level editor for my game and want to implement a selection tool to make it easier to select multiple voxels at once.
My question is what the most efficient way is to get all the selected objects?
Do I just unproject the starting position and end position of the selection rectangle and create a bounding box that I then can use for intersection checking or is there a better way?

EDIT: Since I can't rotate a bounding box I need to find another way. I just need a way to find out if the bounding box of a voxel is inside the box that is formed by the four points of the selection.

sentences:
Avoiding GC Allocation in Unity UNet API I'm trying to profile the game using Unity Profiler, I can see in the Hierarchy tab that there's an 18.3 KB correlated to NetworkIdentiry.UNetStaticUpdate().

I guess this has happened inside the Unity UNet API, is there a workaround to avoid that to happen? and why an internal Unity calls can cause GC?

sentences:
Calculate the leaning angle I have an object moving around, let's say it's a cycle. In cycle dynamics, when the object takes a turn, it often leans into the direction of the turn. I would like to simulate this.

I'm using the equation: atan(v^2 / r * g), where v is the current velocity, r is the radius of the turning circle and g is the gravitational force. I get r with v^2 / a, where a is the current acceleration.

However it doesn't seem to work right. In some cases it leans to the right direction, in others, it leans to the opposite, meanwhile the leaning should always be inwards.

I've determined the direction where the acceleration force pulls the object with sign(velocity.y * acceleration.x - acceleration.y - velocity.x) and multiplied the leaning with the result, but it has no effect.

What am I missing?

sentences:
Algorithm for determining random events I'm struggling with coming up with an elegant solution to generating random events in the game that I'm working on.

Say there are 4 classes of events that can happen, with varying events in those classes that may occur.

So something along the lines of

main_events = {"common event", "not so common event", "somewhat rare event", "rare event"}
sub_events[0] = {"common event 1", "common event 2",..}
...

I have a somewhat kludgey solution in place that first just has a random number generated between 0 and 100, and if the number falls within a given range then a main event will be triggered.  Then I'll do another random roll to see which sub event occurs.

Is there a better solution than something along these lines?  Like I mention, it doesn't feel very elegant, and I'd like to make it easily expandable for the addition of future events.

sentences:
How do I make a time lapse in my code so it updates slower? I have made some collision if statements, but they didn't work.

            birdbox3.X += 5;
            birdbox3.Y -= 5;

            if (birdbox3.Intersects(Banner1)) {

                birdbox3.Y += 10;

            }
            else if (birdbox3.Intersects(Banner2)) {

                birdbox3.Y = -birdbox3.Y; }

So if we take the first statement, the box is initially on the left down corner.
According to my code, it would ideally be going right+up in my game, once it hits the banner on the extreme top, it should go down+right, thus both the X and the Y positions will increase. But what happens is that is starts bouncing really fast, after debugging I realised it was forever stuck in the first if, it's almost as if it collides 2 times, reverting Y to its initial movement, colliding a 3rd time, and doing the process over and over.

Which brings us to the question, how can I make the Update code run a tad bit slower, or after half a second or such passes, so when it runs, it doesn't misinterpret collisions?

sentences:
Pygame Bounding Box at Player Feet I'm new to python and pygame and am trying to build a very simple "game" (it's more of a test for me to figure things out) in which you move a character around the screen and he can collide with walls and things. Everything is broken up into 32x32 tiles and the player is 32x64. This means that when his head hits a wall his feet are 2 tiles away and I've been trying to get it so that he's only 1 away, ie. I'm after a 32x32 hitbox starting at x=0, y=32 on the player image.

Do I need to create a separate rect to deal with this and if so how would I go about implementing it? Any help would be greatly appreciated.

Here's the code for my player class so far, hopefully it's not too messy:

class Player(pygame.sprite.Sprite):
'''The Main Player Class'''
def __init__(self, x, y):
    pygame.sprite.Sprite.__init__(self) #Call sprite initialiser
    self.image, self.rect = load_image("char.png")
    screen = pygame.display.get_surface()
    self.area = screen.get_rect()
    self.rect.x, self.rect.y = x, y
    self.x, self.y = x, y
    self.vx, self.vy = 0, 0
    self.movespeed = 2

def update(self):
    self._walk()

def _walk(self):
    if self.vx != 0:
        self._walk_single_axis(self.vx, 0)
    if self.vy != 0:
        self._walk_single_axis(0, self.vy)

def _walk_single_axis(self, vx, vy):
    "normalise for diagonal movement if necessary"
    if self.vx != 0 and self.vy !=0:
        norm = 1/(2**0.5)
    else:
        norm = 1
    "set new x and y positions"
    self.x += vx * self.movespeed * norm
    self.y += vy * self.movespeed * norm
    self.rect.x, self.rect.y = self.x, self.y

    "check for collisions with any walls"
    for wall in walls:
        if self.rect.colliderect(wall.rect):
            if vx > 0: #collide with the left side of the wall
                self.rect.right = wall.rect.left
                self.x = self.rect.x
            if vx < 0:
                self.rect.left = wall.rect.right
                self.x = self.rect.x
            if vy > 0:
                self.rect.bottom = wall.rect.top
                self.y = self.rect.y
            if vy < 0:
                self.rect.top = wall.rect.bottom
                self.y = self.rect.y

    "bound the player within the screen edges"
    if self.rect.x < self.area.left:
        self.rect.x = 0
    if self.rect.x > self.area.right-32:
        self.rect.x = self.area.right-32
    if self.rect.y < self.area.top:
        self.rect.y = 0
    if self.rect.y > self.area.bottom-64:
        self.rect.y = self.area.bottom-64

self.x and self.y are there because applying the movement directly to self.rect.x and self.rect.y caused the character to move at different speeds depending on which diagonal direction he was travelling in. self.vx and self.vy just return either +1 or -1 depending on the direction of travel.

sentences:
tunnel effect cocos2d I am looking to create a similar tunnel effect in COCOS2D (iOS). Could anyone suggest any pointers?

ref Video 1

ref Video 2

Till now I have tried with several ring shape sprites with decreasing scale and positioned center to a same point and keeping Z decreasing as well for each smaller sprite.

With that, animating it with CCScaleTo and changing the size to 2.0 with animation duration but it does not come anyway near to the tunnel effect shown in the reference.

Thanks,
sam

sentences:
Is there an efficient, available online, algorithm for converting a matrix of squares into a triangle strip? Imagine having a 4x4 square, with 16 smaller squares inside of it, with associated data on what the squares should look like (ie., opacity, colour, etc...).

Is there an existing, efficient, algorithm, for converting this set of squares into an open-gl compatible triangle strip?

sentences:
How do I find the name of the current audio clip being played? I have a title scene and a credits scene that use the same music. When I start my game the title scene music plays, and I have my game set up so the audio manager is not destroyed on load. When I enter my credits scene I do not instruct any new music to play, but each time I reload my title scene the title music restarts because a script in the scene tells it do so.

How can I get the name of the current audio track so that I will only play audio if it differs from what's currently being played?

This is my "LevelMaster" script which is responsible for handling the audio in each scene.

public class LevelMaster : MonoBehaviour
{
private AudioManager AudioManager;

[SerializeField]
private string trackName;

private void Start()
{
    AudioManager = GameObject.Find("AudioManager").GetComponent<AudioManager>();
    AudioManager.Play(trackName);
}

public void PlaySound(string soundName)
{
    AudioManager.Play(soundName);
}

public void StopSound(string soundName)
{
    AudioManager.Stop(soundName);
}

sentences:
How do AI agents access information about their environment? This might be kind of a trivial question, but I am having trouble understanding this. Would very much appreciate your help.

In game development using object oriented design, I want to understand how AI-agents access the information they need from the game world in order to perform their actions.

As we all know, in games very often AI agents need to 'perceive their environment' and act according to what is happening around them. For example, an agent might be programmed to chase the player if he/she gets close enough, avoid obstacles while moving (using the Obstacle Avoidance steering behavior), etc.

My problem is I'm not sure how to do that. How can an AI agent access the information it needs about the game world?

One possible approach is that the agents simply request the information they need directly from the game world.

There's a class called GameWorld. It handles important game logic (game loop, collision detection, etc), and also holds references to all of the entities in the game.

I could make this class a Singleton. When an agent needs information from the game world, it simply gets it directly from the GameWorld instance.

For example, an agent might be programmed to Seek the player when he/she is close. In order to do this the agent has to get the player's position. So it can simply request it directly: GameWorld.instance().getPlayerPosition().

An agent could also just get the list of all the entities in the game, and analyze it for it's needs (to figure out what entities are close by , or anything else): GameWorld.instance().getEntityList()

This is the simplest approach: agents contact the GameWorld class directly and get the information they need. However, this is the only approach I know. is there a better one?

How would an experienced game developer design this? Is the "get a list of all the entities and look for whatever you need" approach naive? What approaches and mechanisms are there to allow AI agents to access the information they need in order to perform their actions?

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:
How can I load multiple scenes in background? I want to queue the loading of multiple scenes in background and show all of them at the same time when all complete their loading.
The only idea I have by reading the docs is to root all objects in every scene I want to load this way in a single GameObject that is disabled by default and when all my LoadSceneAsync finishes its work, I can them activate each scene root GameObject.
Without doing that, I have all related scenes being loaded and being showed in the screen at different times and this is just not acceptable.
I'm creating this question because I believe there must be a better way to accomplish that rather than rooting all the scene into a single game object.

sentences:
EnemyAI rotating on Y-axis in opposite direction After a battle flag has gone off and the player has entered an enemy's battle zone I want to keep track of the player when it moves and make sure the enemy's Z-axis is always pointing towards the player.

Upon the player entering the battle zone, the enemy automatically marks the player as its target However there is a chance that the Z-axis may not be pointing towards the enemy's target when the battle is first initiated. I decided to shoot a ray cast from the Z-axis of the enemy when the battle flag goes off and rotate the enemy until the ray and the player intersect thus telling me that enemy's Z-Axis is lined up correctly.

the enemy always has a reference to its current target. My idea was that as once the enemy spots its target initially, it can save the position of the most recent spotting and then take the delta of the CurrentTargetPosition.x and the LastSpottingPosition.x If the delta is positive rotate right and if the delta is negative rotate left.

THE ISSUE:
my math or logic must be flawed somewhere because although it works sometimes, other times the enemy will randomly rotate itself in the opposite direction and the ray cast will essentially take the long route to hit the player instead of the shortest route as intended. Also the Local Origin of the enemy and the player are at different height respectively but I dont think that should matter in my case Code Below.

//create ray from enemy position orgin and point it on the Z-Axis
        Ray ray = new Ray(CurrentEnemyTransform.position, CurrentEnemyTransform.forward);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 50f))
        {
            Debug.DrawLine(ray.origin, hit.point);

            //ray hits current enemy target
            if (hit.transform == CurrentTargetTransform)
            {
                //check if enemy has seen its target before while in this battle
                //or is it the first time
                if (enemy.hasTargetLastPosition)
                    //replace old last seen position with most recent spotting
                    enemy.ReplaceTargetLastPosition(hit.transform.position);
                //or add the first spotting of target while in this battle
                else enemy.AddTargetLastPosition(hit.transform.position);
            }
            //ray is not intersectiing with the enemy's current target so rotate to look for it
            if (hit.transform != CurrentTargetTransform)
            {
                //check if enemy has seen its target once before in battle
                if (enemy.hasTargetLastPosition)
                {
                    //since last spotting has my target moved more to the left or right?
                    if (enemy.targetLastPosition.value.x > CurrentTargetTransform.position.x)
                    {
                        //rotate right
                        CurrentEnemyTransform.Rotate(-Vector3.up, 5f, Space.Self);
                    }
                            //rotate left
                    else CurrentEnemyTransform.Rotate(Vector3.up, 5f, Space.Self);
                }
                //never seen target yet during this battle so default rotation to right till you found it
                else CurrentEnemyTransform.Rotate(-Vector3.up, 5f, Space.Self);
            }

sentences:
UI looks different between editor and in game I am very confused about Unity's UI system.

This is how my inventory menu looks in the Editor:

And this is the view in game:

Settings

Can someone please explain why this happens?

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:
One InputProcessor for two controllers On my screen I want to display two controllers, one to turn around the character (We'll call itLook) and one to move the character (We'll call it Move).
I have a line registering a ControllerListener Which implements InputProccessor.
My question is if I can use the ControllerListener to receive input from both Move and Look at the same time.
In case that wasn't clear, I mean I want the player to maneuver the map using both controllers, not just one.

sentences:
Algorithm to modify a color to make it less similar than background I'm creating a demo of 20 balls bouncing each other, with a background filled with a solid color. Color for each ball is chosen randomly with randint(0, 255) for each R, G, B tuple component.

Problem is some balls end up with a color that is very similar to background, making them hard to see. I would like to avoid that, either by rolling another color if the chosen one is too similar (within a given threshold), or by moving it away from the background color.

How to calculate a similarity index to use as a threshold? Or how to transform a color to make it, say, less blue-ish?

Obvious disclaimer: I know nothing about color theory, so I don't know if the above concepts even exists!

I'm coding in python, but I'm looking for concepts and strategies, so pseudo-code is fine (or just the theory).

EDIT:

To clarify a few points:

Each ball have its own random color. I'd like them to remain as random as possible, and to explore as much as possible of the color space (be it RGB or HSV, pygame accepts both formats for defining color)
I'd just like to avoid each color of being "too close" to background. Problem is not just about hue: I'm perfectly OK with a light-blue ball against a dark-blue background (or a "full-blue" against a "white-ish" blue, etc)
For now, I don't care if a ball ends up with a color similar (or even identical) to another ball. Avoiding that is a bonus, but it's a minor issue.
Background color is a constant, single RGB color. For now I'm using "basic" blue (0, 0, 255), but I'm not settled with that. So consider the background to be of an arbitrary color (with arbitrary hue, brightness, saturation, etc).

EDIT2:

TL,DR version: Just give a way to create X random colors so that none "fades in too much" against a background of arbitrary (but single and constant) color

sentences:
ways to program glitch style effects Most tutorials for generating glitch art usually has to do with some form of manipulation of the compression of files. Should my goal instead to replicate the look of these glitches in shaders or is it somehow possible to authentically generate the compression artifacts in real time?

Example:

This effect which I'm particularly interested is referred to as datamoshing. It does "things" using the p-frames of a video (frames that I think store just the change in pixels). I feel like I need a better understanding of both graphics programming and data-compression.

sentences:
Projecting onto different size screens by cropping I am building a phone application which will display a shape on screen. The shape should look the same on different screen sizes. I Decided the best way to do this is to show more of the background on larger screen keeping the shapes proportion the same on all screens.

My problem is I am not sure how to achieve this, I can query the screen size at runtime and calculate how different it is from the six is designed for but I am not sure what to do with this value.
What kind of projection should I use for my orthographic matrix an hour will I display more on larger screens and not loose information on smaller screens?

sentences:
Terrain Generation - Diamond Square Algorithm I'm trying to implement a Map Generator in Java. Since it´s said to be simple I wanted to use the Diamond Square Algorithm [2D] for that purpose.

However, I can´t find any complete understandable description of the algorithm, so I am using ~4 different sites (eg. this one from grubz) to build it, and on some sites things are described differently than on others.

As far as I understand it, the algorithm works as follows:

generate a map with random values (just setting every x,y of the map)
make square step
make diamond step
begin with square again

The map size is defined by a "step". That step will be

step =Math.pow(2,step)+1

which denotes the width and height of the map. This means if I want a map with ~300 tiles I will have to provide step = 9 - but on other sites it´s written that the step is only changing the "smoothness". What is it?

-square step
I begin at halfStep (x/y), take the surrounding "square" Points and average those.

-diamond step: Same as above but I begin halfStep earlier.

Here is what I did so far. Not working due to an ArrayError.

Question:

How do I control how big the map is gonna be? (I assume step?).

How do I control here what the output map looks like? eg.: to generate island/continents/deserts/half-islands/ how would I get one big Continent at the center/thick jungles etc. (I have seen something like scale, scaleMod, etc)

Is my Code correct according to the algorithm? I just don´t get it exactly.

sentences:
How can I make 2D fog like in Graveyard Keeper? I really like Graveyard Keeper's fog effect but I can't work out how to make it.

It's 2D, and made in Unity. The characters all seem to be 'under' the fog, but the tops of tall trees and buildings poke out. It looks like this:

The developer has given a bit of information about how it's made on Gamasutra:

http://www.gamasutra.com/blogs/SvyatoslavCherkasov/20181023/329151/Graveyard_Keeper_How_the_graphics_effects_are_made.php

  "As you see, the tops of houses and trees are seen from the fog. In fact, this effect is really easy to make. The fog consists of a great deal of horizontal clouds spread across all the picture. As a result the upper part of all the sprites is covered with a fewer amount of fog sprites:"

I used the information from this article, and one of the developer's tweets that included this picture:

I attempted to recreate it this fog effect. When the character moves up or down the screen, it flickers as it crosses each fog sprite:

What have I missed?

All of the sprites are on the default sorting layer and have sorting order 0.

The project, in Graphics Settings -> Camera Settings has the custom axis and sort axis (0,1,0). The tree and character are on the same z position, and the fog is spread out over several z positions:

sentences: Why am I getting a down arrow in my Unity scene when using Oculus Rift and how do I get rid of it? In Unity, I have set up a scene to try out in Oculus Rift. When I hit play in Unity, everything works fine until about 5 seconds later when I get an arrow (Assets>OVR>Textures>out.png) that appears in the center of my screen and won't go away. What does this arrow mean and how can I get rid of it? It is obstructing my view of the level that I am trying to view.

sentences:
How do I extend Irrlichts scene manager? If I want to extend the scene manager, and add a function; do I extend my class from CSceneManager or ISceneManager?

I'm trying this in MySceneManager.h:

#include <CSceneManager.h>

class RTSSceneManager : public CSceneManager
{
    virtual ICameraSceneNode* addCameraSceneNodeRTS(ISceneNode* parent = 0,
            const core::vector3df& position = core::vector3df(0,0,0),
            const core::vector3df& lookat = core::vector3df(0,0,100),
            s32 id=-1, bool makeActive=true) = 0;
};

But it's giving me this error:

fatal error C1083: Cannot open include file: 'CSceneManager.h': No such file or directory

It works if I use ISceneManager instead of CSceneManager, but then won't I have to re implement CSceneManager over again?

sentences:
Need to count a number of programmatically created objects in separate script I have a game that creates and places a random number of "pickups" on a plane at random places.

I then have a script on the "Player" game object that uses OnTriggerEnter to tell when an item has been "picked up" and compares a count (the score) to the number of objects that are created:

void OnTriggerEnter(Collider other)
{

    // Get all game objects with the Tag "Pickup"

    if (other.gameObject.CompareTag ("Pickup")) {

        // Deactivate objects that are touched/collected
        other.gameObject.SetActive (false);

        // add to count
        count++;

        scoreText.text = "Score: " + count;

        //TODO: fix this statement; pickupCount is always 0 here, why?

        if(count >= pickupCount){
            winText.text = "You Win!";
        }

    }

}

The problem I am facing is that during building this worked fine, I built the project and it outputted "You Win!" after picking up 1 "pickup", I found out this is because for some reason the value of pickupCount is now always 0.

pickupCount =  GameObject.FindGameObjectsWithTag("Pickup").Length;

My guess is that because the Playerscript checks at Start() and the SpawnScript creates at Start() that the reason the number is always 0 is because at the time of checking there are in fact no "pickups" created. My question is then, how do I check for the total number of these pickups without doing it in an update function?

SIDE NOTE

I know I could just change the OnTriggerEnter() function to be something like this:

void OnTriggerEnter(Collider other)
{

    // Get all game objects with the Tag "Pickup"

    if (other.gameObject.CompareTag ("Pickup")) {

        // Deactivate objects that are touched/collected
        other.gameObject.SetActive (false);

        // check number of pickups left
        pickupCount =  GameObject.FindGameObjectsWithTag("Pickup").Length;

        // add to count to show the score
        count++;

        scoreText.text = "Score: " + count;

        if(pickupCount <= 0){
            winText.text = "You Win!";
        }

    }
}

But it is more a case of curiosity now more than anything. Is what I am asking even possible?

sentences:
How to store "chunks" of tiles or How to make my implementation work I asked a previous question about the loading and unload of chunk data and people noted that my way of storing chunks is weird and I was wondering how I would go about doing it properly. @Byte56 suggested using a linked list or adjacency list but i have no clue how to do those even after searching google/stackoverflow. Any advice to a person new to xna programming?

Source

Previous Question

sentences:
How can I implement the traffic(+drawing) functionality in the game? I am a beginner game developer. Games such as "Cities: Skyline", "Simcity", "Citybounds", and "Traffic lanes 3" directly build roads and show simulations of cars moving over them. I have no knowledge to make these things. I can use Unity, construct2. How can I express things like roads, lanes, intersections, snapping, traffic simulations, path finding, driver AI,  traffic lights, even wheels on the road?

Road drawing

Traffic simulating

sentences:
Procedurally generating terrain in dead time before buffer swap I'm using OpenGL/C++ in Windows, and my main loop looks like this:
    GLboolean done = GL_FALSE;
    auto_ptr l_world(new World);
    l_world->Init();

while (!done) {
    if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
        if (msg.message==WM_QUIT) {
            done = GL_TRUE;
        } else {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    } else {
        if (!world->Iteration() || keys[VK_ESCAPE]) {
            done = GL_TRUE;
        } else {
            LocalContext.SwapBuff();
        }
    }
}

where Iteration() is:

GLboolean World::Iteration() {
    DrawAll();
    MoveAll();
    CheckForCollisions();

    return GL_TRUE;
}

I've implemented the diamond-square algorithm to procedurally generate terrain, which I'm currently doing in World::Init(). Vertices, indices and textures are stored in buffers to be drawn every frame.

That's fine for a small area, but I want to make it much bigger if possible. To do that I'd like to generate on-the-fly as the camera moves, which would be done at the end of the iteration, after the drawing, moving and collision detection but before the buffer swap. It could be split over several frames, but I'd like to get as much done in a single frame as possible.

As I understand it, with vsync enabled SwapBuffers will block until the end of frame, so any time between the SwapBuffers call and the end of frame will be wasted. So that's my question: is there a way to tell how much time remains until the end of the frame, so I can keep generating terrain until the last possible instant but still maintain a consistent frame rate?

I've not found anything too helpful on the OpenGL Synchronisation page. I wondered if Triple Buffering might be the answer - if the other back buffer contains a completed frame, keep generating; if it's empty then SwapBuffers. It's not a great solution as it would make triple buffering mandatory, and how would you detect if one of the back buffers was free? Any better suggestions?

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:
What should I use (controls, methods) to make a 2D tile based map editor? I'm making a 2d game where each tile is a square and it's viewed at straight angle, no skewing, no rotation, it's pretty simple.

Two weeks ago I tried using DataGridView, but as the number of rows and columns increased, it became frustratingly slow, then I read how it should've happened to me earlier, because this control is not supposed to work with large number of cells, and I have at least 7500 cells in my smallest level, which made it unbearable to use.

This is what I expect from my new editor:
Most importantly, tile type. Tile images or their color codes are fine (seeing map as it is in-game is cool, but the faster, the better).

Secondly, all tile parameters (in text, preferrably editable in a popup or sidebar).

I'm using my own format, so I'm most probably not going to use third party product. Besides, I'm trying to learn how to do it myself.

sentences:
Libgdx: more efficient way of using Vector 3? I currently use

if(cam.frustum.pointInFrustum(new Vector3((float)posX, (float)posY, 0)))

To check if my sprite is in the camera's view. I have to make a new Vector3 every frame wich is very inefficient.

Is there a better way to do this?

sentences:
What to replicate in a PvP online action game? We're developing a 2D PvP online action game. You can think of it like Super Smash Bros. We have a function call tree for characters like below:

CharacterInput.Update()
|-- CharacterController.StartJump()
    |-- CharacterMovement.TranslateState( "Jump" )
        |-- CharacterJumpState.OnEnter()
            |-- CustomRigidbody2D.Move( delta )

I think the pseudo-code above is kinda straight forward. It's a typical Controller-Movement structure where the Movement part is made using several character states. Also, the Movement part is responsible for animations, physics, visual effects and sound effects.

So, to make this networked, we need to replicate some values over the network.

To make it clear, we're using Photon Bolt for Unity, which provide a ExecuteCommand way to deal with server authority and client prediction. You can check it out here.

So in terms of replication, we realized that according to the structure, we should decide which part to replicate. According to the call tree above, we can split our character logic into these layers:

Input Layer: LeftStick, RightStick, A, B, X, Y, ...
Controller Layer: MovementDirection, ShootDirection, IsJump, IsShoot, IsMelee, ...
Movement Layer: CurrentState and all of its member variables
Rigidbody, Animation Layer: Velocity, GravityScale, CurrentAnimationState

Theoretically, replicate any of these layers can make it work because the process of higher layer to lower layer is deterministic. Once the higher layer is replicated, lower layers should be the same across the network.

Sadly, this is just theory. In reality, you must deal with lag, and unreliable packet delivery.

For example, if you only replicate the inputs, an unstable network may make it out of sync because state A may transit itself to state B if animation ends, but actually it should be transitted to state C if player presses some button.

However, if you only replicate rigidbody and animation, all the visual effect or audio effect triggered by CharacterState can't work, because CharacterMovement
doesn't even know which state it is in...

So, my question is, how do other games replicate their character? Especially in a PvP game?

sentences:
Game Engine Class and Subsystem Architecture I have a quick question for those who have experience coding their game engine and such. I was wondering what a better approach would be when designing my own game engine. Right now I plan on having different "subsystems" for example a event system and a graphics system (I plan on including more later on and they may or may not contain their own hierarchy). My question is should my engine class inherit these systems or should I make each system a member of the engine class or is there another proper way of structuring my engine? Whatever approach I wish to choose, I want it to be modular yet efficient.

tl;dr: What is the proper architecture for a game engine with subsystems in C++?

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:
What's the name of the rendering problem I describe here? I don't remember how is it called that rendering problem that you have when you get fast movements (a sprite moves fast for example from right to left) and you have half of the image in a position and half in another for a given frame (for example the top left of the sprite moves correctly but the bottom half of the same sprite is lagging back).

In particular I'm using SFML2 but this is kinda a Library-Agnostic question.

And what are the most common methods to fix it?

sentences:
Clamp camera view angles relative to moving object I have a camera attached to an entity that moves in a circular pattern around a fixed center position. I am attempting to clamp the rotation of the camera such that it can only look inward toward the center of the circle.

I have tried for some time to accomplish this but haven't had much luck.

Simply clamping the angles like this will not work:

rotation = Vector3.Clamp(rotation, new Vector3(-50.0f, rotationY, 40.0f), new Vector3(-20.0f, rotationY, 100.0f));

(the rotation angles are relative to world space, and not the local rotation of the entity)

I need to get a clamp value that is relative to the direction the entity is facing.

Is there any way I can accomplish this?

Update-

Adding the rotation of the entity to the camera rotation like in the following seems to work intermittently, but now it seems the camera starts stuttering at certain points around the circle.

Still stuck.

Vector3 clampMin = new Vector3(-50.0f, 0, 40.0f);
Vector3 clampMax = new Vector3(-20.0f, 0, 100.0f);

public void Update()
{
       // adding the users input
       rotation = camera.Rotation + (new Vector3(GetInputY(), 0, GetInputX()) * 4.0f);

       float clampX = ClampAngle(rotation.X, clampMin.X, clampMax.X);

       float clampZ = ClampAngle(rotation.Z,
                entity.Rotation.Z + clampMin.Z,
                entity.Rotation.Z + clampMax.Z);

       camera.Rotation = new Vector3(clampX, 0, clampZ);

}

sentences: What is required for casting shadows in JavaFX 8 3D? In a scene with an added point light the shapes are not casting shadows on each other. Is anything required to cause them to cast shadows?

sentences: Game logic on the server! Good or bad? I'm currently planning a simple online multiplayer game. And here is the question. Does it make sense to make the whole game logic on the server and just send the input from the client to the server? Which are the pros and the cons or are there any reasons why I shouldn't do that?

sentences:
Texturing an asteroid I'm trying to texture this asteroid so it looks reasonable.  I'm missing something though.

Following this tutorial, I got this so far.

Now I don't understand the next step: how do you resolve the seam problems?  This icosahedral sphere has a seam running through it that cannot be avoided.  Ok.  How do I paint the texture so it looks seamless when applied to the object?  How do I know which edge connects to what side?  I guess it will just be symmetrical?

This seems awfully hard to texture a simple sphere.  Am I missing some technique here?

sentences:
Can I linear interpolate color along both the X and Y axis of a circle instead of using the distance formula on each individual point? I've been unable to make it work and I'm not sure whether it's a problem with my code or if this can even be done. I'm sure there is a way to prove whether it is possible mathematically but I don't know how to approach that either.

I'm trying to do a gradient fill on a circle where the center pixel is BLUE and all points on the edge are RED. Each point within the circle will be a blend of those two colors based on their distance from the center.

Consider this example:

I already have every point along the edge of the circle which I can draw across to fill it. To do a gradient in the southwest quadrant, I thought that I could linear interpolate between A->B to form a gradient and then draw a line C->D starting with RED to the color interpolated between A->B.

Would this be equivalent to using the distance between each point and the origin to linear interpolate the color?

UPDATE

For those interested in seeing what this approximation looks like, I did manage to get it working.

WHITE -> BLACK

RED -> BLUE

The grayscale image is misleading because there are 256 shades of brightness between pure black and pure white and only 127 between any R, G, and B primary colors in 24-bit RGB.

Here is the red/blue image desaturated and adjusted to emphasize how this approximation is drawing the gradient:

sentences:
How to speed up script compilation? Is there a way to speed up script compile time when I change something in VS then click on Unity?

It takes 15 seconds. Is this normal?

sentences:
Vertex Buffer Sharing between DirectX11 and Directx9 In my d3d9 engine i want to take benifit of compute shader of d3d11. So firstly I created a   vertex buffer in d3d11 with D3D11_BIND_UNORDERED_ACCESS and then tried to create the d3d9 vertex buffer with the Handle.
like

D3D11_BUFFER_DESC bd;
ZeroMemory(&bd, sizeof(bd));
bd.ByteWidth = sizeof(stVertex) * 100;
bd.BindFlags =   D3D11_BIND_UNORDERED_ACCESS  | D3D11_BIND_VERTEX_BUFFER   ;
bd.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS | D3D11_RESOURCE_MISC_SHARED;
hr = dev->CreateBuffer(&bd, NULL, &pVBuffer);       // create the buffer
hr = CreateBufferUAV( dev, pVBuffer, &m_pBufOutUAV );

....
HANDLE sharedHandle = NULL;
IDXGIResource* pDXGIResource = NULL;
pVBuffer->QueryInterface(__uuidof(IDXGIResource), (LPVOID*) &pDXGIResource);
pDXGIResource->GetSharedHandle(&sharedHandle);

hr = g_pd3dDevice9->CreateVertexBuffer( 100*sizeof(stVertex), NULL ,
                                  VERTEX::FVF_Flags, D3DPOOL_DEFAULT,
                                  &g_pVertexBuffer9, &sharedHandle ); //ERROR :

which gives error :

  Direct3D9: (ERROR) :Opened and created resources don't match, unable
  to open the shared resource. Direct3D9: (ERROR) :Cannot create Vidmem
  or Driver managed vertex buffer. Will NOT failover to Sysmem.
  Direct3D9: (ERROR) :Failure trying to create Vertex Buffer

After that i tried to create vertex buffer in directx9 first and tries to share that in direct11 but still it gave error.

HANDLE sharedHandle9 = NULL;
    hr = g_pd3dDevice9->CreateVertexBuffer( 100*sizeof(VERTEX), NULL ,
                                      VERTEX::FVF_Flags, D3DPOOL_DEFAULT,
                                      &g_pVertexBuffer9, &sharedHandle9 );
ID3D11Resource*  pTempResource11 = NULL;
    hr = dev->OpenSharedResource( sharedHandle9 , __uuidof(ID3D11Buffer) ,(LPVOID*) &pTempResource11 ); //Error

  D3D11: ERROR: ID3D11Device::OpenSharedResource: Returning
  E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION
  ERROR #381: DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN ]

I am able to share textures but not buffers.please help me here.
thanks.

sentences:
Single or Multiple Behavior Trees? I just finished coding a generic Behavior Tree structure for my games.  My question is, when creating behaviors for enemy AI's, do I create one large behavior tree with every possible configuration as a node or do I create many multiple Behavior Trees and simply swap them in and out as I need them?

To better understand my question here are some examples:

One large Behavior Tree might look something like this:

Multiple smaller Behavior Trees might look like this:

In the second tree I would simply swap out different trees depending on when I need them.  This is more apparent for things like evading and backing away from obstacles, I feel like that would need to be done alongside many other behaviors like chasing and evading.

I hope that made sense.

sentences:
How can I use the animation transitions? So I want to make my animation transitions smooth, thats why I made transitions on the animator, but how can I activate them if I use trigger paramaters???
Heres the code:

public float speed = 0.3f;
public float sprintSpeed = 2.5f;
private Rigidbody rigidB;
private float midJump = 1f;
public float rotSpeed = 2;
Animator anim;

void Start()
{
    rigidB = GetComponent<Rigidbody>();
    anim = GetComponent<Animator>();
}
void Update()
{

    //Character rotation with A and D

    var z = Input.GetAxis("Horizontal") * rotSpeed;

    //Character movement with W and S

    var y = Input.GetAxis("Vertical") * speed;

    //Character animations

    if (Input.GetKey(KeyCode.RightShift))
        y = y * sprintSpeed;

    if (Input.GetKey(KeyCode.RightShift) && y > 0.31)
        anim.Play("Sprint");

    if (y < 0.001)
        anim.Play("Idle");

    if (y > 0.001 && y < 0.31)
        anim.Play("Run");

    transform.Translate(0, -y, 0);
    transform.Rotate(0, 0, -z);

    //Character Jump

    if (midJump == 1 && Input.GetKeyDown(KeyCode.Space))
    {
        rigidB.velocity = new Vector3(0, 45, 0);
        midJump = 2;

    }
    else if (rigidB.velocity.y == 0)
        midJump = 1;

}

sentences:
Drawing Shape in DebugView As the title says, I need to draw a shape/polygon in Farseer using debugview.
I have this piece of code which converts a Texture to polygon:

//load texture that will represent the tray
        trayTexture = Content.Load<Texture2D>("tray");

        //Create an array to hold the data from the texture
        uint[] data = new uint[trayTexture.Width * trayTexture.Height];

        //Transfer the texture data to the array
        trayTexture.GetData(data);

        //Find the vertices that makes up the outline of the shape in the texture
        Vertices verts = PolygonTools.CreatePolygon(data, trayTexture.Width, false);

        //Since it is a concave polygon, we need to partition it into several smaller convex polygons
        _list = BayazitDecomposer.ConvexPartition(verts);
        Vector2 vertScale = new Vector2(ConvertUnits.ToSimUnits(1));
        foreach (Vertices verti in _list)
        {
            verti.Scale(ref vertScale);
        }

        tray = BodyFactory.CreateCompoundPolygon(MyWorld, _list, 10);

Now in DebugView I guess I have to use "DrawShape" method which requires:

DrawShape(Fixture fixture, Transform xf, Color color)

My question is how can I get the variables needed for this method, namely Fixture and Transform?

sentences:
What is the geometrical interpretation of Input.GetAxis("Mouse X")? According to the documentation, Input.GetAxis("Mouse X") produces a range of values from -1 to 1. However it will produce another range if it is setup to be  delta mouse movement.

  Returns the value of the virtual axis identified by axisName.

  The value will be in the range -1...1 for keyboard and joystick input. If the axis is setup to be delta mouse movement, the mouse delta is multiplied by the axis sensitivity and the range is not -1...1.

Question

I don't understand what the value means geometrically. Is it a displacement between two points each in  consecutive frame updates? If so what is its unit? Pixels, points, centimeters, etc?

sentences:
Find normal based on rotation? Given the XYZ rotation of an object, e.g. (90,0,0), how can I find the object's normal assuming the object is pointing along it's local Z axis?

In the above example the desired result is (0,1,0).

I'm using blender, but this seemed like more of a general math question so I decided to ask here..

sentences:
Setting object-specific uniforms in a render queue I am currently trying to write a (very simple) queued renderer using OpenGL. My current idea looks like this:

struct RenderCommand {
    GLUint  vao;
    GLUint  texture;
    GLUint  shader;
    GLInt   zOrder;
};

void Renderer::addCommand(const RenderCommand& cmd) { /* add to queue */}

void Renderer::render() {
    /* sort the command queue to try and z-sort, batch textures, etc. */

    for(const auto& cmd: queue_) {
        // Bind shader/vao/texture when necessary, issue draw calls
    }
}

Now my problem is this: for sprites for example, I only have one set of quad vertices on the GPU, and I send the sprite vertex shader the sprite size using a uniform. Same goes for the model transform matrix for literally any object. That's okay when render calls issued when iterating over scene objects, but becomes a problem when everything is queued: since most sprites will use the same shader, how do I set the uniform?

I've had a few ideas for solutions, but none of them feels right:

Add data in RenderCommand for size, model matrix, etc. The big problem with that is flexibility: it supports the engine's default sprite (or 3D model or text) shader, but custom shaders with other uniforms won't work.
Add a custom data pointer to RenderCommand to point to uniform data to send before rendering. This is probably the most flexible option.
Add a UniformCommand type, which only uploads a uniform to the currently bound shader. It'll have to be handled carefully when the queue is sorted, to ensure it stays contiguous with whatever shader and model it corresponds to, but that sounds feasible.

sentences:
How to define a proper protocol for a turn-based combat system? I'm working on the server side of a turn-based strategy game. The game has a really complex combat system, like:

  When you are hit, you summon a phoenix to attack the enemy that deals X damage, and the phoenix fly back to heal Y of your health.

Well, such skill does sounds interesting, but requires a great amount of work on the skill and combat system.

We did not use script on the server. We just split one skill into several skill effects. For instance, we have DamageEffect, AddBuffEffect and so on. However, we have a lot of skills like the phoenix stuff above, they can be triggered at a specific moment. And some of them even replace the main attack skill. So we designed several SkillConditions for that. It worked, although not very well.

However, the question is: For such a complex combat system, how to define the protocol between client and server?

For example:

  A attacks B using skill X for 30 damage points. B uses the phoenix skill Y when he is hit that damage A for 20 points, and heals himself 10 points.

How can we express this to the client? We currently use a structure like this:

useSkillAction:
    skill: id_of_X
    source: id_of_A
    target: id_of_B
    subActions:
        damageAction:
            timing: onHit  // Timing means the the damageAction will trigger when the skill animation triggers a 'hit' event.
            character: id_of_B
            damage: 30
            subActions:
                propertyChangedAction:
                    timing: onFinished
                    character: id_of_B
                    property: health
                    value: health_of_B
                useSkillAction:
                    timing: onFinished
                    skill: id_of_Y
                    source: id_of_B
                    target: id_of_A
                    subActions:
                        damageAction:
                            timing: onHit
                            character: id_of_A
                            damage: 20
                            subActions:
                                propertyChangedAction:
                                    timing: onFinished
                                    character: id_of_A
                                    property: health
                                    value: health_of_A
                        healAction:
                            timing: onFlyBack??
                            character: id_of_B
                            damage: 10
                            subActions:
                                propertyChangedAction:
                                    timing: onFinished
                                    character: id_of_B
                                    property: health
                                    value: health_of_B

Well, I think you got the idea. For now, this structure can handle only simple skills. The solution currently have three problems:

For complex skills, like above, it's hard to describe the timing of phoenix fly back.
For the onHit timing in damageAction, that means the server even knows that there's an animation trigger called 'hit'.
It's hard to maintain.

Is there a better way to do this? Thanks anyway, for my broken English...

EDIT: As Petr suggested, I reduced the question to a simpler one:

Is there a way to define the protocol so that server does not care about animation trigger stuffs like 'onHit'? Because, generally speaking, server should only care about the logic.

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:
How can I implement a revealing light beam? In SEARCHLIGHT, you control a ray of light that illuminates incoming enemies that are otherwise invisible in the night sky. Here is an illustration:

How would I go about doing this, preferably in Unity? I imagine this is less about lighting and more about shaders, but I'm not sure on details. The fact that I know very little about coding shaders makes it worse.

If it is about shaders, what are the specifics? Is there a stretched quad that moves with said shader applied to it, or perhaps is using the Line Renderer a better option?

As a beginner, may I try to achieve a similar effect, or should I leave it for when I'm better?

(P.S.: The game was made in Unity. Here is its itch.io page.)

sentences:
Local shape color blending I am trying to implement this in Unity 4 Pro.

But I am stuck in the blending part. I don't understand how you could blend multiples textures/colors using multiples volumes on an object. How could you access those volumes in the shader and check for "collision"?

It's seems to be very similar to vertex/pixel lighting. But maybe I am wrong.

Here is the simple effect I am trying to create.

sentences:
Rogue Door Connection logic I'm having a bit of trouble developing code to figure out which doors connect in Rogue which is written in c. Not the actual path making. I just dont understand how they link to each other.

If rooms have 2 doors each then, while not the cleanest solution, I can connect the first rooms door1 to the second rooms door2 and continue that pattern, finally going around in a loop.

However, say there are 3 doors for one room, then that would break because one door wouldnt connect to anything. The same thing goes for a one door room.

Any help would be appreciated and links to examples would help too.

Thanks

EDIT

I'm not really generating paths right now, its more of the player teleporting to another door. If it were paths then of course it could intersect which takes care of the paths.

sentences:
RPG Factions - Friendly/Hostile check I'm having some trouble checking if one faction is hostile to another faction in my RPG. I'm using enums for my factions and relations but I feel like there's a better way to approach this.
Currently this is my code for the factions (copy+paste ruined format...)

public enum Faction {
/*
 * Position 1 = Humans
 * Position 2 = Elves
 * Position 3 = Dwarves
 * Position 4 = Orcs
 * Position 5 = Undead
 * Position 6 = Trolls
 * ....
 */

Human(Relations.Friendly/*Humans*/, Relations.Neutral/*Elves*/, Relations.Neutral/*Dwarves*/, Relations.Neutral/*Orcs*/, Relations.Hostile/*Undead*/, Relations.Hostile/*Trolls*/),
Elf(Relations.Neutral, Relations.Friendly, Relations.Neutral, Relations.Neutral, Relations.Hostile, Relations.Hostile),
Dwarf(Relations.Neutral, Relations.Neutral, Relations.Friendly, Relations.Neutral, Relations.Hostile, Relations.Hostile),
Orc(Relations.Neutral, Relations.Neutral, Relations.Neutral, Relations.Friendly, Relations.Hostile, Relations.Friendly),
Undead(Relations.Hostile, Relations.Hostile, Relations.Hostile, Relations.Hostile, Relations.Friendly, Relations.Hostile),
Troll(Relations.Hostile, Relations.Hostile, Relations.Hostile,Relations.Friendly, Relations.Hostile, Relations.Friendly);

    Faction(Relations... relation) {

    }

}

enum Relations {
    Hostile(),
    Neutral(),
    Friendly();
}

class FactionHandler {
    public boolean checkIfHostile(Faction faction1, Faction faction2) {
        //How do I check?
    }
}

The lazy way to do this would be to do lots of if/else statements but I want a more clean way to check.

Basically I want it to check faction1's relation with faction2, and return true if they are enemies, and false if they are friends. Feel free to entirely scrap my code if there's a better solution to this problem as this code is mainly just me experimenting.

sentences:
Why are my Unity procedural animations jerky? I'm working in Unity and getting some crazy weird motion behavior. I have a plane and I'm moving it. It's ever so slightly getting about 1 pixel bigger and smaller. It looks like the it's kind of getting squeezed sideways by a pixel. I'm moving a plane by cos and sin so it will spin on the x and z axes. If the planes are moving at Time.time, everything is fine. However, if I put in slower speed multiplier, I get an amazingly weird jerk in my animation. I get it with or without the lerp. How do I fix it? I want it to move very slowly. Is there some sort of invisible grid in unity? Some sort of minimum motion per frame?

I put a visual sample of the behavior here.

Here's the relevant code:

public void spin()
{

         for (int i = 0; i < numPlanes; i++ )
    {
        GameObject g = planes[i] as GameObject;

        //alt method
        //currentRotation += speed * Time.deltaTime * 100;
        //rotation.eulerAngles = new Vector3(0, currentRotation, 0);
        //g.transform.position = rotation * rotationRadius;

        //sine method
        g.GetComponent<PlaneSetup>().pos.x = g.GetComponent<PlaneSetup>().radiusX * (Mathf.Cos((Time.time*speed) + g.GetComponent<PlaneSetup>().startAngle));
        g.GetComponent<PlaneSetup>().pos.z = g.GetComponent<PlaneSetup>().radius * Mathf.Sin((Time.time*speed) + g.GetComponent<PlaneSetup>().startAngle);
        g.GetComponent<PlaneSetup>().pos.y = g.GetComponent<Transform>().position.y;
        ////offset
        g.GetComponent<PlaneSetup>().pos.z += 20;

        g.GetComponent<PlaneSetup>().posLerp.x = Mathf.Lerp(g.transform.position.x,g.GetComponent<PlaneSetup>().pos.x, .5f);

        g.GetComponent<PlaneSetup>().posLerp.z = Mathf.Lerp(g.transform.position.z, g.GetComponent<PlaneSetup>().pos.z, .5f);
        g.GetComponent<PlaneSetup>().posLerp.y = g.GetComponent<Transform>().position.y;
        g.transform.position = g.GetComponent<PlaneSetup>().posLerp;

    }

    Invoke("spin",0.0f);
}

The full code is on github.

There is literally nothing else going on. I've turned off all other game objects so it's only the 40 planes with a texture2D shader.

I removed it from Invoke and tried it in Update -- still happens. With a set frame rate or not, the same problem occurs.
Tested it in Fixed Update. Same issue.

The script on the individual plane doesn't even have an update function in it. The data on it could functionally live in a struct.

I'm getting between 90 and 123 fps. Going to investigate and test further. I put this in an invoke function to see if I could get around it just occurring in update. There are no physics on these shapes. It's a straight procedural animation.

Limited it to 1 plane - still happens.
Thoughts?

Removed the shader - still happening.

sentences:
Mix of Procedural and Manual level design / creation in UE4 I'm trying to design a maze using a mix of procedural and manual generation. I have the maze already generated and would like to place other objects in the maze manually in the editor. The issue is the maze object is created on BeginPlay and so I'm unable to view it in the Editor itself while dragging the object to the Outliner. Any suggestions?

I'm thinking of doing something in the Construction Script or the object Constructor but not not sure if that would be the way to go.

I'm still getting familiar with the Engine code base and only have a little experience in Maya or Blender since I'm a programmer.

sentences:
Handling strange physics behaviour while sliding between coplanar surfaces We've got a character setup based around manually resolving collisions, and we're using bullet to do so. Our characters have a kinematic rigidbody to push things around, but their movement and positioning is done using a separate (pair caching) ghost object. Every physics tick we iterate over all contacts for that ghost and resolve collision either by depenetrating 100% when it's ground, or by depenetrating gradually/not at all with walls or other characters. We then apply our ghost's new position to the kinematic rigidbody so that can interact with other physics objects.

Unfortunately, when moving around a flat world made up of a bunch of coplanar blocks, when the characters moves from one block to another it will often do one of two things;

Fall through the cracks
Get bumped upward a significant distance (we're talking up to half a unit/meter with a character that is 2 units/meters tall)

Debugging this tells me sometimes these contact points are unexpected, and not something I want to resolve by depenetrating 100%. Gravity moving the character downward can result in a contact point that is closer to the side of the terrain block than the top, and it will give you a normal/distance accordingly (blue arrow). Resolving that with 100% depenetration will just push you in between the blocks, while not counteracting the gravity forces. This would explain the falling through the cracks. But I don't know why I sometimes get contact points with normals pointing straight up, but with a distance that would place the collider far above the ground (purple arrow).

I've come to the point where I feel like my only option to handle character movement like this is by not colliding with the ground at all, and just spherecast downwards at the character's position on the horizontal plane just to place it down on the ground properly.

Now obviously I want to get rid of this behaviour. And seeing how you don't see this happen in many games, I'm lead to believe others have solved this issue somehow. Has anyone here encountered similar issues, and how did you go about fixing them?

sentences:
Knowing the size of a framebuffer when rendering transformed meshes to a texture I have a couple of 2D meshes that make a hierarchical animated model.
I want to do some post-processing on it, so I decided to render this model to a texture, so that I could do the post-processing with a fragment shader while rendering it as a textured quad.
But I don't suppose that it would be very smart to have the render texture's size as large as the entire screen for every layer that I'd like to compose – it would be nicer if I could use a smaller render texture, just big enough to fit every element of my hierarchical model, right?
But how am I supposed to know the size of the render target before I actually render it?
Is there any way to figure out the bounding rectangle of a transformed mesh?
(Keep in mind that the model is hierarchical, so there might be multiple meshes translated/rotated/scaled to their proper positions during rendering to make the final result.)
I mean, sure, I could transform all the vertices of my meshes myself to get their world space / screen space coordinates and then take their minima / maxima in both directions to get the size of the image required. But isn't that what vertex shaders were supposed to to so that I wouldn't have to calculate that myself on the CPU? (I mean, if I have to transform everything myself anyway, what's the point of having a vertex shader in the first place? :q )
It would be nice if I could just pass those meshes through the vertex shader first somehow without rasterizing it yet, just to let the vertex shader transform those vertices for me, then get their min/max extents and create a render texture of that particular size, and only after that let the fragment shader rasterize those vertices into that texture. Is such thing possible to do though? If it isn't, then what would be a better way to do that? Is rendering the entire screen for each composition layer my only option?

sentences:
How to set the runtime of an animation based on attack speed? Based on an answer I received on this question:

How to make an action perform only after an animation has run?

I am using notifications in animations to perform certain commands/actions.

See in the documentation:

https://docs.unrealengine.com/en-US/Engine/Animation/Sequences/Notifies/index.html

Before resorting to this site, I researched elsewhere for something about modifying the animation speed and the closest question I found was this:

https://answers.unrealengine.com/questions/509654/how-do-you-change-the-ratespeed-of-animation.html

Simply changing the speed of the animation, I know how to do it, but I want to control its runtime. Sort of determining how much time the animation has to play.

In the image below I show more or less the scenario I have:

Note that the notification happens at the end of the animation (where I apply the damage).

So based on the speed I set for animation to perform, every time it's finished the notification happens, applying the damage.

It turns out that the animation doesn't necessarily have the exact duration of an attack starting when the other one ends (the image below will make it easier to understand):

There is one more scenario I imagined.

In the latter case, assuming the animation is (usually) 1 second long, and the character has the maximum attack speed (I set the maximum to 2 attacks per second). So the animation would be running 2 times faster:

But the attack speed will not always be a "simple" number, I would like to know how to calculate/set it time so I have no problems when the attack speed is any number.

I want to know how to set the animation runtime and a time interval between the animation running.

sentences:
Passing Input to Compute Shader I am using D3D11 on D3D10 hardware, trying to get a very simple compute shader to run (my hardware supports cs_4_0).

What is the best way to pass data to the compute shader?

I've seen some samples use a constant buffer (cbuffer), but it seems very restrictive to me (in the hlsl cbuffer declaration I'd have to specify the amount of input (e.g. if a want to process an array of floats, I'd have to declare in my hlsl cbuffer an array of floats with a specific number of elements).

Other examples pass the input in the structured input the comp. shader will store the results in. Besides the fact that this might not suit my particular algorithm (maybe a thread needs access to more that just one element) I can't declare my structured input as dynamic, so to update it from the cpu (i.e. to add new values for the GPU to process) I'd have to use UpdateSubresource, which is not as efficient as Map, Unmap.

So, there must be a better way to send input to the Compute Shader. Any suggestions?

sentences:
Loading Bitmap by name in Android Currently, I'm loading images as follows:

sampleimage= BitmapFactory.decodeResource(context.getResources(), R.drawable.sampleimage);

This automatically chooses the correct image from the drawable-hdpi, drawable-mdpi or drawable-ldpi folders.

How can I load the bitmap using the image name as the string "sampleimage.png"?

sentences:
How can I calculate the U,V texture coordinates on a disk at infinity given only a view vector and a vector pointing to the disk's center? I'm using an approach similar to Bruneton's paper on atmospheric scattering for rendering my sky and am trying to extend it to add a textured moon.

Long story short, the paper works by essentially inverting a screen pixel to a world-space vector, then effectively raytracing the sky. To draw the sun, the paper checks the dot product between the sun-vector and pixel view-vector, and gives a "yes hit" or "no not hit" 1 or 0 based on a step function and the angular size of the sun. All of these vectors are unit.

Similarly, I'm doing the same thing to determine if there's a hit on the moon, however unlike the sun, I also now need to determine a texture coordinate. At first I simply subtracted the view vector from the moon vector, normalized the result, then scaled it by the angle between the view and moon vectors. This gives me the correct world-space point, but I'm having a hard time converting this 3-D world space point to a U,V texture coordinate on the intersected moon-disk.

A graphic to illustrate my problem:

My question is this:
Given two unit vectors, how can I calculate a texture coordinate of a point formed by the angle between them?

sentences: How forward rendering done using OpenGL? Recently I come across the term forward rendering. I'm kind of curious how this could be done in OpenGL. I have done a lot of search on this, majority of the result I get are on theory but not code implementation. May I know is there any code implementation on OpenGL for this rendering technique?

sentences:
Unity - Calculating a rotation based on game time I have a simple script to make an object spin:

Spin Speed is the speed to rotate the object on each axis (preferably in degrees per second). Local is whether the rotation should be done based on world axes or object axes. Starting Rotation is the initial rotation of the object.

Normally I would use Transform.Rotate to do the rotation, but in this case I have to make the rotation a function of time, so you can pass in any time value and it will return what the rotation should be at that time.

Here is an example (this doesn't work properly for either world or object axis rotation):

private Quaternion getRotation(float time)
{
    return Quaternion.Euler(InitialRotation + SpinSpeed * time);
}

I just need some help figuring out the math behind calculating rotations for both world and object axes. I think that matrices can be used but I honestly don't remember anything about how to use them.

Here's an example of using world axes with a SpinSpeed of 180 on the y axis and an initial rotation of 45 on the x axis:
https://i.gyazo.com/d7f41b6a88425b5d8b8237cd7ac40878.gif

An example of using local axes with the same parameters as above:
https://i.gyazo.com/d453b3dd239c9f77b86ce372c499d068.gif

sentences:
Why is RK4 better than Euler integration? At the end of these great slides, the author compares all the different integrators presented. One way or another, they all fall short except for Improved Euler Integration and Runge Kutta 4 Integration, which both pass all tests.

I suppose I should mention that I am working on a 2D game that isn't very physics intensive. I'm just curious as to where Improved Euler Integration would fall short and RK4 would have to be used instead.

My game consists mostly of simple gravity (jumping and falling), movement along the X and Y axes, and bounding box collision. Is it worthwhile to implement RK4 or would Improved Euler be sufficient? I see many discussions where Euler Integration's users are chastised, but from what I can see, Improved Euler is quivalent in simple 2D matters. I imagine it'd also be faster.

sentences:
how to make my character jump I want my player to jump and i tried my best to do it and i couldn't. Basicaly my class are splitted(i have speparate player class and keyboard class) which i thought would make my life easier but didnt.

I made it so that if i press space bar, then i would fly(this is for temporarily and i wanted it to jump) and also i added gravity.

It would be great if you guys posted what to add on what class and explain what it does cause im a noob at java.

Thnx

My Player Class

package com.vescorspel.game.MyFirstGame.entities.creatures;

import java.awt.Graphics;
import java.awt.image.BufferedImage;

import com.vescorspel.game.MyFirstGame.Handler;
import com.vescorspel.game.MyFirstGame.gfx.Animation;
import com.vescorspel.game.MyFirstGame.gfx.Assets;

public class Player extends Creatures{

//Animations
private Animation animRight, animLeft;

public Player(Handler handler, float x, float y) {
    super(handler, x, y, Creatures.DEFAULT_CREATURE_WIDTH, Creatures.DEFAULT_CREATURE_HEIGHT);

    bounds.x = 32;
    bounds.y = 32;
    bounds.width = 92;
    bounds.height = 96;

    //Animations
    animRight = new Animation(100, Assets.DerpDino_right);
    animLeft  = new Animation(100, Assets.DerpDino_left);
}

@Override
public void tick() {

    //Animations
    animRight.tick();
    animLeft.tick();
    //Movement
    getInput();
    move();
    handler.getGameCamera().centerOnEntity(this);
}

private void getInput(){
    xMove = 0;
    //Gravity
    yMove = 5;

    if(handler.getKeyManager().left)
        xMove = -speed;
    if(handler.getKeyManager().right)
        xMove = speed;
    if(handler.getKeyManager().jumping)
        //this makes my player fly
        yMove = -speed;
}

@Override
public void render(Graphics g) {
    g.drawImage(getCurrentAnimationFrame(), (int) (x - handler.getGameCamera().getxOffset()), (int) (y - handler.getGameCamera().getyOffset()), width, height, null);

private BufferedImage getCurrentAnimationFrame(){
    if(xMove < 0){
        return animLeft.getCurrentFrame();
    }else{
        return animRight.getCurrentFrame();
    }
}

}

My KeyManager Class

package com.vescorspel.game.MyFirstGame.input;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class KeyManager implements KeyListener{

private boolean[] keys;
public boolean left, right, jumping;

public KeyManager(){
    keys = new boolean[256];
}

public void tick(){
    left = keys[KeyEvent.VK_A];
    right = keys[KeyEvent.VK_D];
    jumping = keys[KeyEvent.VK_SPACE];
}

@Override
public void keyPressed(KeyEvent e) {
    keys[e.getKeyCode()] = true;
    System.out.println("Pressed!");
}

@Override
public void keyReleased(KeyEvent e) {
    keys[e.getKeyCode()] = false;
}

@Override
public void keyTyped(KeyEvent arg0) {
}

}

sentences:
Alpha Blending performance on IOS I've got few questions without responses about my game development, can you help me? Here is the questions:

In my game when a large object appear on the screen, the GPU go to his limits, my framerate become very slow. How can I handle that? (I'm working on mobile). (
Currently, I'm sorting object from back to front)
I've read some stuff about batching (How to draw efficiently large number of objects with alpha blending?), how can I handle batching when my game need to draw my scene from back to front with alpha blending?
What is faster: Add a condition to test pixel transparency in fragment shader or enable Alpha blending? (I've got colors around my sprites without alpha blending or condition)

Thanks!

sentences:
How to Bring the Scene View Camera Controls into Game View I've got a scene with a big sphere in the centre (the Earth) and a lot of smaller spheres around (the stars).

Above is a screengrab in Scene View with the camera in the Front View position.

I really like the controls in Unity's Scene View when moving around the viewport and I was wondering whether it can be brought into the Game View.

How can I do this?

sentences:
Do GLSL 4.x subroutine variables cause any performance overhead? There's not too much deep information about them on the web.

How are they implemented and how they work under the hood? I'd like to know that they cause any performance overhead or not, especially in the case of multiple subroutines to decide what's the best practice to create different versions of shaders: subroutines or separate shaders.

Any info or advice?

sentences: How to resize a surface in Pygame? How can I resize a Surface object in Pygame? Is there a way to bind a surface object into a Rect object, so that resizing the rect would also resize the surface (with Rect.inflate_ip method for an example)?

sentences:
Preventing item duplication? For my game, there's two types of items - stackable, and nonstackable.

Nonstackable items get assigned a unique ID that stays with it forever. A character ID is assosicated with the item, as is a state (CHANGED, UNCHANGED, NEW, REMOVED). The character ID and state is used for item saving purposes.

Stackable items have one unique ID, as in the entire stack has one unique ID. For example: 5 Potions (stacked ontop of each other) has one unique ID.

When dropping a nonstackable item, the state gets set to REMOVED, and the unique ID and state don't change. If picked up by another player, the state gets set to NEW, and the character ID gets changed to the new character's ID.

When dropping all items in a stack of stackable items (for example, 5 potions out of 5) - it behaves just like a nonstackable item.

When dropping some of a stack of stackable items (for example, 3 potions out of 5)... I really have no clue what to do. The 3 dropped potions have the state of REMOVED, but the same unique ID and character ID. If another player picks it up, it has no choice but to obtain a new unique ID, and its state gets changed to NEW and its character ID to the new one. If the dropping player picks it back up, they'd just be readded to the stack.

There's two issues with that though. 1. If the player who dropped the 3 potions picks it back up, there's no way to tell if they legitimately dropped the items, or if they're duped items. 2. If another player picks up the 3 potions (assuming they're duped), there's no way to know if they're duped or not.

My question is: How can I create a system that detects duplicated items for both nonstackable and stackable items?

sentences:
How can I stop the player from drifting due to local input prediction when they stop? I'm working on a 2D server-client multiplayer game engine (which you can try here). It uses WebRTC DataChannels. (The connections are peer-to-peer, but the host peer still acts as a server.)

The biggest problem (apart from connectivity) is the local input prediction. We do the usual: On key press, players move instantly, tell the host what keys are pressed, receive data back from the host and compare it to the historical position. The position is corrected over time if there is a difference. This works well with low packet loss or PDV, even if the ping is high.

If there is loss or PDV, the deviation can be larger. I think this is because if the first packet indicating a change of input is delayed or dropped, the host finds out later, and starts changing that player later than their local input prediciton shows.

If the player is moving, we crank up the amount of applied correction, since it's less noticable. This seems to cover up gaps when starting to move and while moving. However, any correction is more noticable if they come to an abrupt stop. Then if the PDV or loss means the host thinks they stopped later, the host overshoots, sends back data saying they're a bit further ahead, and the correction makes the player drift a little. On flaky connections, players often noticably drift after coming to a stop.

I've not noticed this in other games. How can this be mitigated?

sentences:
Blend Modes in Cocos2D with glBlendFunc We've been trying to replicate the most common blending modes that are available in Photoshop and Quartz 2D, but we've only come up with 3 and that's after some long searching online.

For anyone interested, here they are:

  Multiply = GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA
  Screen = GL_MINUS_DST_COLOR, GL_ONE
  Linear Dodge = GL_ONE, GL_ONE

You can try these and other such modes in action online, at this very useful website: http://www.andersriggelsen.dk/glblendfunc.php

Now, we would appreciate it if anyone could provide us with additional blending modes that we can recreate inside Cocos2D, since our Open GL experience is really, really limited.

Thank you in advance!

Argiris

sentences:
Simplifying Camera Strafing I have a camera that follows the position and direction of the player. These are updated using spin and velocity. The velocity is updated like so:

auto velocity = get_velocity();
velocity += get_acceleration().x * get_right();
velocity += get_acceleration().y * get_up();
velocity -= get_acceleration().z * get_forward();

set_velocity(velocity);

... where acceleration is relative to the object, not the world. This is the first time I have used OpenGL and I am not sure if this is the best solution, but it does what I want. I was wondering if there is a better way to do this using OpenGL Mathematics (GLM).

Additionally, this method works like a rocket, which is good for what I am trying to do, but if I want something more like a human, I have to change it to:

auto velocity = get_velocity();
auto const y = velocity.y + get_acceleration().y;
velocity += get_acceleration().x * get_right();
velocity -= get_acceleration().z * get_forward();
velocity.y = y;

set_velocity(velocity);

... to prevent the player from being able to fly by looking up. Is there a way of simplifying this case, too?

Acceleration is defined as:

switch (dir) {
    case left:  return glm::vec3(-1,  0,  0);
    case right: return glm::vec3( 1,  0,  0);
    case front: return glm::vec3( 0,  0, -1);
    case back:  return glm::vec3( 0,  0,  1);
    case up:    return glm::vec3( 0,  1,  0);
    case down:  return glm::vec3( 0, -1,  0);
    default: assert(false);
}

sentences:
How can I use a coroutine and GetAxis to rotate a game object? For the sake of learning about coroutine, I want to convert the following to a cleaner Update that just calls a coroutine. How would I do that?

using UnityEngine;

public class Controller : MonoBehaviour
{
    public float speed = 5f;
    private float deltaX;

    void Start()
    {
        deltaX = transform.localEulerAngles.x;
    }
    void Update()
    {
        deltaX += Input.GetAxis("Vertical") * speed;
        deltaX = Mathf.Clamp(deltaX, -90f, 90f);
        transform.localEulerAngles = new Vector3(deltaX, transform.localEulerAngles.y, transform.localEulerAngles.z);
    }
}

sentences:
Can HTTPS webserver host an HTML page that uses JS to connect with secured web socket protocol multiplayer game just like node js? Can HTTPS webserver host an HTML page that uses JS to connect with secured web socket protocol multiplayer game just like node js?
If so point me in the correct direction to read more.

sentences:
How viable ogre3d is for a commercial project? Well, I don't really what else to add to the question, since I don't really know what competitors have that OGRE doesn't.

Of course I'm talking game rendering quality here, I don't really think there are very complicated programming stuff left, maybe AI...

Since torchlight is the best game done with OGRE (I think), is it still a good solution for future games, whatever the 3D graphics technologies will be ?

What prevents OGRE3D from not being the best engine ? (consoles excluded, since they used some specific graphic library, except the xbox360 maybe...)

sentences:
how to move a 2d shape in opengl 4.6 (glfw) Class Button
So  from my understanding in order to move a 2d shape you need manipulate the vertices and then update????
If i do need to update the buffer how i would go by doing that?
float xpos = 150 //Cords relative to the window application so let say the window size 480 by 260
float ypos = 60 Where would I plug in position in the vertices array?
  float vertices[] = {
 -.5f,-.5f,0,
.5f,-.5f,0,
-.5f,.5f,0,
.5f,.5f,0
 };

shader.setup("Resources/Shaders/shape.vertex", "Resources/Shaders/shape.frag");

glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
// bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).
glBindVertexArray(VAO);

glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_DYNAMIC_DRAW);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);

// note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind
glBindBuffer(GL_ARRAY_BUFFER, 0);

// You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other
// VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.
glBindVertexArray(0);

sentences:
Play Audio After Countdown In JavaScript Is there a way I can have an audio sample play after a certain amount of time, like 3 seconds in JavaScript? I've looked everywhere and can't seem to find what I'm looking for! I'm very new to this type of stuff, so apologies for the kind of daft question...

Thanks

sentences:
GLSL: sampler2D fallback to constant color? So I have the following situation: I'm sharing a blinn shader accross many meshes. Some meshes have specular & normal maps, others do not.

I'd like to, without making the shader code too complicated, be able to specify a constant color instead of a texture, for the normal or specular maps. This is for example if a given mesh doesn't need one of those maps.

The way I imagine it, I would just pass a flat "grey" as the specular map, for instance, and the shader could just act as if a texture was passed in. Is this possible?

Ideally, I don't want to have an extra uniform for each mesh specifying whether or not the texture should be used.

Another alternative would be to actually create a grey texture on the fly, if this is the better way, please advise on the simplest way to do this.

sentences:
Math / game design for non-linear armor degradation? I have a game that is about starships shooting each other.
Starships have a values that represent initial Health, Armour and Damage degradation

Example
1000, 800, 80% // 1000 HP, 800 Armour, 80 % mitigation
300, 250, 60% // 300 HP, 250 Armour, 60 % mitigation

Note Armour and mitigation are in relation to each other and armour will be lowered on damage, lowering the associated mitigation in the process.

Resolving damage start with a pure damage value, something like 50.
I then check the targeted ship for existing damage entries.
Depending on that, i reduce the "armour", translate it to a modified mitigation value and mitigate the damage by x%, reducing the armour in the process, so the next hit will encounter less armour, hence less mitigation etc.

example

A virgin ship has 1000/800/60% - hp/armour/% and is hit for an initial 50 damage.

Check the ship, see it has no damage received yet.

Take the damage (50), apply the armour modifier (800 of 800 remains, so 60% mitigation applies).

Split the damage into 40%/60% (hp, armour damage), so 20 of the 50 damage damage the hull, while 30 damage are eaten up by armour - lowering armour, and effective mitigation, for the next hits.

Next hit, 50 damage

Ship has 980/1000 Health, 770/800 armour.

With 800 armour giving 60% mitigation, 760 armour will give 57 % mitigation

50 damage are split into 43%/57% Hull/Armour damage -> 21/29 points.

this continues until a ship has no hull left.

How can i modify this so it becomes more of progressive curve, i.e. initial hits take bigger chunks of armour/mitigation relative to later hits (currently the the first few hits obviously eat more mitigation than later hits, but i want it to be more even more effective at the beginning.

How do i modify my math ? Do i need to add a square/root somewhere ?

sentences:
Is It Okay To Use Real Designs In My 2D Game? [Cars and Weapons] I am making a 2D mobile game that includes cars and weapons (like GTA let's say). I am using real car and weapons designs to make 2D images, however, I use made-up names for the both cars and the weapons. Is it still copyrighted?

For example; Traffic Racer and Traffic Rider. In the games, the car models are exactly the same as the real ones, but there is no logo nor name in Traffic Racer. In Traffic Rider, you can clearly see BMW in the game (both the design and the logo). Because of these examples, I think, my situation should be okay since the game is not even 3D.

sentences: What AI modding is possible in Civ 5? I'm interested in tinkering with the AI in Civ 5.  I know there are XML files that can adjust the AI's strategies, but are there other easily moddable AI components?  The XML files contain comments that reference some CPP files, are those available to end users or are those comments just aimed at internals?

sentences:
Unity - unable to play audio clips simultaneously from within a coroutine I am using Unity 2017.3.1f1. I have created a co-routine for a car engine controller which would play a car start sound once, and while it is fading, it would start a looping sound that would gradually increase its volume while the start sound is still playing. Here is what I have written:

     public virtual IEnumerator PlayEngineSounds()
     {
         float playtimeStarted = Time.unscaledTime, startSoundLength = startSound.clip.length;
         startSound.Play();
         if (loopSound == null)
         {
             yield return new WaitUntil(() => startSound.isPlaying);
         }
         else
         {
             while (startSound.isPlaying)
             {
                 var percent = (Time.unscaledTime - playtimeStarted) / startSoundLength;
                 loopSound.volume = percent*_loopSoundMaxVolume;
                 Debug.Log("Loopsound % = " + percent, this);
                 yield return null;
             }
             loopSound.volume = _loopSoundMaxVolume;
             yield return null;
         }
     }

Basically I am taking the percentage of the start sound and I use that for the level of the loop sound. The more completely the start sound is played, the louder the loop sound should get.

What I observe, is that my logged messages appear correctly in time, but the volume level of the loop sound is not affected. Then, when the start sound completes, the loop level gradually increases its volume. It behaves as if the volume updates are "delayed" and executed after the start sound is finished, instead of playing both simultaneously.

The startSound and loopSound are separate AudioSource components, that reside in different game objects within the hierarchy of my vehicle. I am invoking the PlayEngineSounds corouine from my Start method like this:

internal void Start()
{
    StartCoroutine(PlayEngineSounds());
    // other code ...
}

sentences:
How is a gimbal connected with Euler rotation angles? When I see any video that explains how gimbal lock occurs, they explain it using a gimbal machine and I totally understand the effect on that machine. What I don't understand is how Euler angles are related to the idea how gimbal machine works.

And my #1 confusion comes from the following:

Euler angles rotate the coordinate frame but the axes stay orthogonal.
Gimbal circles rotate so that two rotation axes become collinear.

Hence I don't understand how gimbal mechanism can show how Euler angles work.

sentences: Phone for Android game development I've been developing casual iPhone/iPod Touch games touch for about two years.  I'd like to port some games to the Android platform.  Since I'm stuck w/ a two year iPhone contract I don't want to get an Android phone that requires a service plan.  What is the best phone to get for development in this situation?

sentences:
What are the pros and cons to building an audience with a small, simple, free game first as opposed to focusing efforts on a commercial release There are two projects we can work on. One would be a small free game to try and get our name out/build an audience. The second is our main idea for a first product.

What are the pros and cons of building the small, simple, free game first instead of focusing that time/effort into the main money making project.

sentences:
How do I smooth out latency jitter in my netcode? I'm developing a multiplayer game and I'm following some articles I've found online to create an authoritative client-server model.

Reading this article, Valve says that every time a message is received, the client assumes the "current" time is the time in the latest packet, in the article they state it:

  It is assumed in this paper that the client clock is directly synchronized to the server clock modulo the latency of the connection. In other words, the server sends the client, in each update, the value of the server's clock and the client adopts that value as its clock. Thus, the server and client clocks will always be matched, with the client running the same timing somewhat in the past (the amount in the past is equal to the client's current latency). Smoothing out discrepancies in the client clock can be solved in various ways.

And interpolation of remote entities:

  Each update contains the server time stamp for when it was generated
  From the current client time, the client computes a target time by subtracting the interpolation time delta (100 ms)
  If the target time is in between the timestamp of the last update and the one before that, then those timestamps determine what fraction of the time gap has passed.
  This fraction is used to interpolate any values (e.g., position and angles).

Now obviously due to jitter, my interpolation looks terrible as I will receive time + latency jitter. So my question is, is on this part: "Smoothing out discrepancies in the client clock can be solved in various ways."

What would be a good way to smooth out any discrepancies?

sentences:
Changing scene while joining room and RPC buffer problem I have a button on my main menu that creates and has the player join a random room. After the client joins this room, I change the scene to the game (main) scene in the OnJoinedRoom method. This works well, until I use the RPC call with buffers.

There are 5 spawn points in the game scene, and every time a player joins the room, they occupy a spawn point, so no-one else can spawn at that point.
So, I have list of spawn points in my code, and every time a player joins, it randomly picks a point from that list and "removes" it from the list. It does this via RPC call, so if a player joins the game late, it removes that point, too.

There is a problem with that RPC's buffer because of the "scene change". After OnJoinedRoom, the RPC buffers are called only when the player joins the room, and before the scene change. Because the scene hasn't changed yet, it has trouble finding the buffered photonview, and it throw outs an error. It doesn't update the list.

Can I delay the buffer calls, is there a better way to change my scene while joining a room?

sentences:
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:
What should I use as units for my 2D game? I'm trying to create my first C++ 2D fighting game from scratch, using SDL, and so far I got things to where I am able to move a couple sprites around using some keyboard keys. Right now, I have it so 1 unit of measurement equals 1 pixel; setting my player position to 900.0f 100.0f (my pixel units are of type float) will place him 900 pixels in the x direction and 100 pixels in the y direction.

At first, I thought that using pixels units for a sprite based 2D fighting game would make sense, but after thinking about it, I realized that I might have issues with differing screen resolutions. Someone with a higher screen resolution of 2560 x 1600 would move slower than someone with a lower screen resolution of 1920 x 1080.

Now I'm sure there would be ways to correct this specific issue, but it got me wondering if there would be better basic units of measurement I should be using for a 2D game. What should I use as units for my 2D game?

sentences:
Do I need to initialize a public List variable in Unity? I want to create a list of horses and print the name of the Horses that are stored in the list. Although I got the answer correct as I desired, there's one thing that is puzzling me when I declare a list variable.

I declared it as:

public List<string> myFavouriteHorses;

and in an example I have seen it's declared like this:

public List<string> myFavouriteHorses = new List<string> ();

Despite this difference, both of them worked. What's the difference between these two approaches? Does it matter which one I use?

Here's the entire code which i tried:

using UnityEngine;
using System.Collections.Generic;

public class LearningScript : MonoBehaviour {

    public List<string> myFavouriteHorses = new List<string> ();

    void Start(){
        myHorses ();
        }

    void Update(){
        if (Input.GetKeyDown (KeyCode.Return)) {
            Print ();

        }

    }

    void myHorses(){

        myFavouriteHorses.Add ("Grey Horse");
        myFavouriteHorses.Add ("Black Horse");
        myFavouriteHorses.Add ("Rudolph Horse");
        myFavouriteHorses.Add ("Biting Horse");
    }

    void Print(){
        Debug.Log ("This list has " + myFavouriteHorses.Count + " horses");

        Debug.Log ("The horse at index 1 is " + myFavouriteHorses [1]);
        Debug.Log ("The horse at index 2 is " + myFavouriteHorses [2]);
        Debug.Log ("The horse at index 3 is" + myFavouriteHorses [3]);

    }

}

Here's the output

Why doesn't it make a difference whether or not I initialize the List with new before using it?

sentences:
Any clue to create natural shadow like this? I only use skylight with hdri map for overcast lighting. The corner isn't dark enough compare to other's work. Any clue to achieve this natural falloff soft shadow?
What I want

What I get

My world settings

sentences:
Creating a random lottery system I would like the game to give all 16 characters (15 NPC + 1 player) a number: 1-16. This number stays the same no matter what and is unique only to that character so two characters cannot have the same number. At a point in the game, the character presses a button.

I need this button to generate a random number and load a scene based on the number. Example: Player's pre-determined number is "8", if the number generator generates an "8" as well, it would load the next scene (where the player has to run away from a mob) If the generator generates anything else other than "8" It will load a different scene (where the player chases an NPC)

Just to clear it up if the number generator generates 1-7 or 9-16 it will load the same scene no matter what. (Getting "9" from the generator would load the same scene as "2" would. Only when "8" is generated, would there be a separate scene)

I'm still incredibly new to Unity and coding in general, so a brief summary of what each line of code is doing would be majorly appreciated! (but not at all demanded!)

I'm most comfortable with C# so if you could have the code in that would be great!

sentences:
libGDX using Stage and Actor produces different camera angles on desktop and Android Phone libGDX using Stage and Actor produces different camera angles on desktop and Android Phone.

Here are pictures demonstrating the problem: http://brandonyuh.minus.com/mFpdTSgN17VUq

On the desktop version, the image takes up most all the screen. On the Android phone it only takes up a bit of the screen.

Here's the code (not my actual project but I isolated the problem):

package com.me.mygdxgame2;
import com.badlogic.gdx.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.scenes.scene2d.*;
public class MyGdxGame2 implements ApplicationListener {
    private Stage stage;
    public void create() {
        stage = new Stage();
        stage.addActor(new ActorHi());
    }
    public void render() {
        Gdx.gl.glClearColor(0, 1, 0, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        stage.draw();
    }
    public void dispose() {}
    public void resize(int width, int height) {}
    public void pause() {}
    public void resume() {}
    public class ActorHi extends Actor {
        private Sprite sprite;
        public ActorHi() {
            Texture texture = new Texture(Gdx.files.internal("data/hi.png"));
            texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
            sprite = new Sprite(new TextureRegion(texture, 0, 0, 128, 128));
            sprite.setBounds(0, 0, 300.0f, 300.0f);
        }
        public void draw(SpriteBatch batch, float parentAlpha) {
            sprite.draw(batch);
        }
    }
}

Why does this happen?

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:
Matrix multiplication - Scene Graphs I wrote a MatrixStack class in C# to use in a SceneGraph. So, to get the world matrix for an object I am suposed to use:

WorldMatrix = ParentWorld * LocalTransform

But, in fact, it only works as expected when I do the other way:

WorldMatrix = LocalTransform * ParentWorld

Mi code is:

public class MatrixStack
{
    Stack<Matrix> stack = new Stack<Matrix>();
    Matrix result = Matrix.Identity;

    public void PushMatrix(Matrix matrix)
    {
        stack.Push(matrix);
        result = matrix * result;
    }

    public Matrix PopMatrix()
    {
        result = Matrix.Invert(stack.Peek()) * result;
        return stack.Pop();
    }

    public Matrix Result
    {
        get { return result; }
    }

    public void Clear()
    {
        stack.Clear();
        result = Matrix.Identity;
    }
}

Why it works this way and not the other? Thanks!

sentences:
How can I get multiple players play my multiplayer game at launch? Lets take a example of Apex Legends, it was release in February 4, 2019 and got 25 millions users in after a week (Source: The Verge). I know EA is the publisher so its easy for them to market and have huge user base but what if Im new in the industry and have been funded or invested to make huge game like that but could not get million of user in such short period of time?

How could I achieve something like this? How can I get a lot of players to play my game when I launch it? I thought of adding AI/bots to keep the real players in until my player mass is good enough, but is that just it? Are there other options?

sentences:
How can I add Y-axis/Pitch/Vertical to LineTraceByChannel Raycast with Unreal Blueprints? I am using LineTraceByChannel to cast a ray and return the name of the object it hits in my game world. It works but I am having trouble working out how to add the Y-axis (Up/Down) value. At the moment the ray is only cast horizontal to the ground, regardless of whether the player is looking up or down.

I tried adding a Pitch variable and getting the y-axis value but haven't worked out how exactly to use this. I followed a tutorial to get this far so any further advice is much appreciated.

This is my blueprint currently

The 'Selection Beam' component is attached to the character mesh, facing forwards:

This is where I get the input from the Mouse Y axis, if that helps:

sentences:
Does projection take place before clipping in the rendering pipeline? At first I thought clipping happens before projection since new vertices may be added and the output of projection is in NDC which is 2D.
However after a lot of googling, I found that some articles/presentations/images indicate that projection takes place before clipping which contradicting with other articles I've read and my initial thoughts.

Could anyone tell me which one is correct and why?

sentences:
What are "local" and "global" rotations? Each node in jME3 has local and global rotations, which can be expressed in quaternions.

What are they?

Documentation has no clues, about in which state rotations are zero?

sentences:
DirectX 9.0c and C++ GUI Well, I'm trying to code a gui for my engine, but I've got some problems.
I know how to make a UI overlay but buttons are still black magic for me. Anything I tried was to compilcated ( if it goes big ). To Example I tried to look if the mouse position is the same as the Pixel that is showing the button. But If I use some bigger areas it's getting to complicated. Now I'm searching for a Tutorial how to implement your own gui.
I'm really confused about it.
Well I hope you have/ know some good tutorials.

By the way, I took a look at the DXUTSample, but it's to big to get overview.

sentences: IOS/Android Game programming I am somewhat new to the whole game programming thing. I was wondering if I could develop a game for IOS and Android with using openGLES. if so how can I run the code on the devices and what are some good resources to continue learning from. I am only targeting mobile devices so information for PC/Mac is irrelevant to me. Thank you for your help :)

sentences:
Any tips for aligning existing sprite sheets to a grid? I've been dabbling with sprites, and I've found most sprite sheets that have been posted for existing games (for example, Sonic & Knuckles) are not aligned to a grid.

I've found this frustrating when trying to use these sheets to set up animations in Unity. I managed to align the spritesheet above manually, but it took a while and I'm wondering if anyone has tips on how to make this process easier/faster?

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:
Can I generate collision boxes from a model file with BepuPhysics and XNA? I am currently developing a game using BepuPhysics in XNA 4.0, and I am trying to reasonably match the in game collision Entities with the Model they are associated with.

My current workflow involves guessing what size the various segments of the model are, guessing a size and position of a box to match each segment, and throwing stuff at it to see if I'm right.

This is not an efficient process.

Is there a way to automatically generate the Entity from the Model?
If not, is there some other way to speed up my workflow?

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:
How should a circuit or power system (like redstone in Minecraft) be implemented I want to implement a power-system like the redstone system in minecraft.

I have n power sources and m cables. If I disconnect the power source or a cable the circuit should turn off.

How do I avoid circles?
If each cable with the status "on" powers the nearby cables I can create infinite circles where there is no power source involved (see image). Plus site is that it runs in T=m

I could send power burst through the graph starting at every power source and in each update call I turn every cable off. Problem is it runs in T=n*m.

Is there a best practice? In Minecraft the redstone system was very slow so I think I overlooked something.

EDIT: The system should work without a distance based decay.

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:
Using multiple shaders in OpenGL3.3 guys, I got a question on how to use multiple shaders in my app. The app is simple: I have a 3D scene, say, simple game and I want to show some 2D GUI in the scene. I was following this tutorial on how to add font rendering to my scene. One difference is that I am using Java and lwjgl, but everything is implemented as in the tutorial.

So I have 2 sets of shaders (2 programs). 1st that handles the 3D models and scene at all. I added the second set of shaders, I just copied them from the tutorial. Here are they:

vertex:

#version 330
in vec2 position;
in vec2 texcoord;
out vec2 TexCoords;
uniform mat4 projection;

void main() {
    gl_Position = projection * vec4(position, 0.0, 1.0);
    TexCoords = texcoord;
}

and fragment:

#version 330
in vec2 TexCoords;
out vec4 color;

uniform sampler2D text;
uniform vec3 textColor;

void main() {
    vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r);
    color = vec4(textColor, 1.0) * sampled;
}

I compile shaders, link them into a separate programs. (so I have modelProgram and fontProgram). However, when I run my application, I see errors in the console (however, the application runs fine):

WARNING: Output of vertex shader 'TexCoords' not read by fragment shader
ERROR: Input of fragment shader 'vNormal' not written by vertex shader
ERROR: Input of fragment shader 'vTexCoord' not written by vertex shader
ERROR: Input of fragment shader 'vPosition' not written by vertex shader

As you can see TexCoords is an out variable in font.vs.glsl and the other 3 are in variables in model.fs.glsl. So they belong to the other set of shaders, other program.

My question is why this happen? It looks like the pipeline tries to combine one program with another, although the application runs smoothly.

The other problem I have is that I do not see any text rendered. I don't know whether this is caused by this or it happens because something else. Any help will be appreciated!

Thank you

sentences:
How do you deal with loot in an RPG where all mosters drop their full inventory? I currently have a system where both players and monsters in an RPG use equipment. This means that when an enemy is killed, I can technically drop everything they have. These are armor and weapons that players may choose to equip. This is fun for the first 5 times this happens(when the player is missing some equipment), then the inventory gets crowded with junk, and it's hard to figure out what's valuable and what's not. Most of the NPCs will lag behind player in terms of gear with the exception of bosses, who will have very good gear.

I've seen suggestions of using a "junk bag", where looted white/ gray equipment goes. Junk bag can be sold with one click.

I can think of two old school MMORPGs that had near full loot: Shadowbane and ultima Online. Both of these used disposable equipment that was easy to craft or "farm" from NPCs.

Recently the age of decadence, a PC RPG had a good full looting system where equipment could be broken down to get iron ingots and such and used in crafting. However, that game only has less than 100 enemies to kill and loot during the entire game, and had weight limit.

In my game there would be hundreds of enemies to kill in rapid succession, maybe 2-3 kills per minute. Another option is to abandon the full looting idea and only "drop greens, blue and purple items if the enemy had them.

In other words, how do you use or get rid of unwanted items when there is a lot of junk loot?

sentences: libgdx - Should I use OOP in ECS framework? For example I have OOP class of Bullet and I have created the pool and factory. Should I convert it to componet based? Like BulletComponent, then handle by BulletSystem? by the way I'm using Ashley ECS framework.

sentences:
Is there a simple 2D Android barebones starter project? I'm looking at creating a tower-defence-style game on Android, developed in Java. I'm spending a lot of time trying to just get a background image (drawn onto a canvas) that pans/zooms within the bounds of the screen etc. that I will eventually draw my game onto.

It seems to be a lot of work just to get theses basics working correctly. Is there a simple barebones project that has this stuff taken care of that I can build my game on top of?

sentences:
How are components properly instantiated and used in XNA 4.0? I am creating a simple input component to hold on to actions and key states, and a short history of the last ten or so states. The idea is that everything that is interested in input will ask this component for the latest input, and I am wondering where I should create it.

I am also wondering how I should create components that are specific to my game objects - I envision them as variables, but then how do their Update/Draw methods get called?

What I'm trying to ask is, what are the best practices for adding components to the proper collections? Right now I've added my input component in the main Game class that XNA creates when everything is first initialized, saying something along the lines of this.Components.Add(new InputComponent(this)), which looks a little odd to me, and I'd still want to hang onto that reference so I can ask it things.

An answer to my input component's dilemma is great, but also I'm guessing there is a right way to do this in general in XNA.

sentences:
UE 4.25 - Can't create EQS assets Like the title says I am unable to create EQS assets. I am running 4.25 and there is no option in the BT details panel, nor under "Add assets -> AI". AND there is no option to activate it. Neither under settings or under plugin. Nothing.
What am I doing wrong? See screenshots and thanks in advance

sentences:
Generating a mesh from a set of generatively produced co-ordinates Using Unity I've been producing sculptural forms that look like this. It's made of patterns of cubes that twist around each other using a flocking algorithm. I'm trying to get it into a 3D printable format.

From unity I export a PLY that is a list of the co-ords of each cube that looks like:
ply
format ascii 1.0
element vertex 17500
property float x
property float y
property float z
end_header
35 2.521441 0
34.72401 -2.06799 4.386663
33.90041 3.202552 8.704146
...

Then I've imported that into meshlab and run Filters > Remeshing, Simplification and Reconstruction > Surface Reconstruction: Ball Pivoting with the default parameters.

This is the result (different iteration so doesn't match top image but similar) which is ok, but obviously not 3d printable.
Is there a better way of doing this in Unity to create a single mesh? I'd be happy with either a single mesh with individual lines or a mesh that makes a single shape as if it were shrink wrapped.

sentences:
How can I duplicate a GameObject with the correct number of copies? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FormationsManager : MonoBehaviour
{
    public GameObject squadMemeberPrefab;
    public int numberOfSquadMembers = 20;
    public int numberOfSquads = 1;
    public int columns = 4;
    public int gaps = 10;
    public Formations formations;

    private int numofmembers;
    private int numofsquads;
    private GameObject squadToClone;
    private List<GameObject> SquadMembers = new List<GameObject>();

    // Use this for initialization
    void Start()
    {
        squadToClone = GameObject.Find("Squad");
        numofmembers = numberOfSquadMembers;
        numofsquads = numberOfSquads;
        formations.Init(numberOfSquadMembers, columns, gaps);
        GenerateSquad();
    }

    // Update is called once per frame
    void Update()
    {
        if (numofmembers != numberOfSquadMembers)
        {
            numofmembers = numberOfSquadMembers;
            formations.Init(numberOfSquadMembers, columns, gaps);
            GenerateSquad();
        }

        if (numofsquads != numberOfSquads)
        {
            numofsquads = numberOfSquads;
            for (int i = 0; i < numberOfSquads; i++)
            {
                Instantiate(squadToClone);
            }
        }
    }

    private void GenerateSquad()
    {
        GameObject go = squadMemeberPrefab;
        List<GameObject> newSquadMembers = new List<GameObject>();

        int i = 0;
        for (; i < formations.newpositions.Count; i++)
        {
            if (i < SquadMembers.Count)
                go = SquadMembers[i];
            else
                go = Instantiate(squadMemeberPrefab);
            go.transform.position = formations.newpositions[i];
            go.tag = "Squad Member";
            go.transform.parent = gameObject.transform;
            newSquadMembers.Add(go);
        }

        for (; i < SquadMembers.Count; i++)
            Destroy(SquadMembers[i]);

        SquadMembers = newSquadMembers;
    }
}

In the Update I duplicate the squad:

if (numofsquads != numberOfSquads)
            {
                numofsquads = numberOfSquads;
                for (int i = 0; i < numberOfSquads; i++)
                {
                    Instantiate(squadToClone);
                }
            }

The problem is that if for example when running the game there is 1 squad and then I'm changing the value of numberOfSquads to 3 then instead duplicating more 2 squads it will duplicate more 3. And then if I will change the value of numberOfSquads from 3 to 4 it will add more 4 squads instead only 1.

And I also want to make that if I change the value of numberOfSquads to be lower then destroy the last squad/s.

sentences: Destroy the enemy only if the animation is played and touch the enemy I am using Unity. I want to attack an enemy with a knife. So I created an object (the knife) and put an attacking animation to it. Now I want to destroy the enemy only if the attacking animation is played and the knife touches the enemy. And if the animation is not played and the knife touches the enemy it should show a game over screen.

sentences:
2D Sidescroller camera I'm using OpenGL. For my tiles, I'm using a display list and I'm just using immediate more for my player (for now). When I move the player, I want to center him in the center of the window, but allow him to jump around on the y axis and not have the camera follow him. But the problem is, is that I can't figure out how to center the player in the viewport! Here is the player update method:

public void update() {
    if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
        World.scrollx -= Constants.scrollSpeed;
        setCurrentSprite(Sprite.PLAYER_RIGHT);
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
        World.scrollx += Constants.scrollSpeed;
        setCurrentSprite(Sprite.PLAYER_LEFT);
    }
    move((Constants.WIDTH) / 2  + -World.scrollx, getY());
}

World.scrollx and World.scrolly are variables that I increase/decrease to move the tiles. move() is just a method that sets the player position, nothing else. I render the player at his current coordinates like this:

public void render() {
    glBegin(GL_QUADS);
    Shape.renderSprite(getX(), getY(), getCurrentSprite());
    glEnd();
}

Shape.renderSprite is this:

public static void renderSprite(float x, float y, Sprite sprite){
    glTexCoord2f(sprite.x, sprite.y + Spritesheet.tiles.uniformSize());
    glVertex2f(x, y);
    glTexCoord2f(sprite.x + Spritesheet.tiles.uniformSize() , sprite.y + Spritesheet.tiles.uniformSize());
    glVertex2f(x + Constants.PLAYER_WIDTH, y);
    glTexCoord2f(sprite.x + Spritesheet.tiles.uniformSize(), sprite.y);
    glVertex2f(x + Constants.PLAYER_WIDTH, y + Constants.PLAYER_HEIGHT);
    glTexCoord2f(sprite.x, sprite.y);
    glVertex2f(x, y + Constants.PLAYER_HEIGHT);
}

Pretty simple, I just render the quad at the current player's position. This is how I actually render everything:

public void render(float scrollx, float scrolly) {
    Spritesheet.tiles.bind();
    glPushMatrix();
    glTranslatef(scrollx, scrolly, 0);
    glCallList(tileID);
    glPopMatrix();
    player.render();
}

This is the part I'm confused on. I translate the tiles according to the scrollx and scrolly variables, and then I render the player at his current position. But the player moves faster than the tiles scroll, and he can escape out the side of the screen! How do I center the player with moving tiles?

Thanks for any help!

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:
Finding the correct speed for AI to turn to reach goal I have a ship that travels at max speed maxSpeed and can turn rotationSpeed degrees per second. The ship always moves in the direction it is facing which means that the faster the ship is travelling the larger its turning radius is.

I know my position, and rotation and the target's position.

What I would like to figure out is whether a target is inside my turning radius at this speed, or better, what is the maximum speed I can travel at is in order to make the turn to the target without continually circling around it.

Is there an efficient(ish) way to do this?

Here is what I am thinking so far: because I know how far I am travelling per step and how much I am rotating per step, I can figure out where I will be in the next two frames. My current position is p1, my next position is p2 then p3. I can take the perpendicular bisectors of  (p1, p2) and (p2, p3). Their intersection point will give me the center of a circle. I can then test if the target is in that circle.

I'm unsure if this will work in 3D (I'm unsure how to calculate a sphere with my inputs). This solution also doesn't help too much with finding the right speed at which to travel, I would have to try a few times with different speeds to find a reasonable one.

Can anyone shed some light on a better solution?

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:
Help me to fine tune my diamond-square algorithm Check this map i generated:

I seeded a sine wave to act as a mountain range. The lower portion of the sine wave looks fine, but the upper side is thin, the algorithm did not do its magic there (expanding with some noise the seeded values to generate wider mountain ranges and then some hills (brown and light brown)).

Also, the whole continent shape is not affected by the sine wave. Ideally, it should be like a "S" as the mountain range pretends to be.

I bet this is how the diamond square algorithm takes the values it uses to make the average.

If not seed the center point of the map,  i can not generate a continent, it just makes a pelinesque noise of random hills.

Basically, i'm having some hard time trying to control the noise with seeds and toying with amplitude and randomness reduction values.

I need some experienced people in world generation and noise to help me out!

Thanks!

(PS: red dots are rivers).

sentences:
How do I prevent memory-modification cheats? There are many memory-altering programs out there nowadays (Cheat Engine & co).  Is there an efficient way to keep a constant variable actually constant?

I had two ideas:

Make a separate thread updating the constant variable to a constant value, e.g. 200 every minute. Problem: One can also alter the second value.
Store the value on the server. Problem: I want to keep the network traffic as low as possible.

I need this mechanism for both constants and variables only allowed to contain a certain range of values.

Are there better ways to do this?

sentences:
How can I create an outline shader for a plane? All these toon shaders I have been seeing render an duplicated mesh behind it and extrude the normals of the vectors to make it look like it has a border, but it feels a bit hacky to me.

Basically I am trying to create an outline shader for a plane so these toon shaders do not really work.

It's probably due to my lack of deep knowledge about shaders in particular but I am really confused and would like someone to explain. I'm also a bit worried that rendering an object twice would hit the performance.

Edit: Added picture for reference. (Thanks for the edit Alexandre!)

sentences:
Using large textures on limited hardware I've run into a problem where some of the models that I'm loading can have very large textures (2000x2000 for example). While my desktop computer can load them just fine, my laptop gets a segfault at the glTexImage call. I've thought of a couple of things I can do in this situation:

Before giving the image to OpenGL, I could downscale it so it's below the max texture size, but I'm not sure how to then stretch the image to its original width and height
I could also outright refuse to load the texture, and replace it with a generic repeating texture, like Valve's black and purple grid, but this isn't at all reliable or desired

Are these two options viable? How is it done with game engines like Unity or Source? Are there any other options that are better than my ideas?

sentences:
Sprite changing position on its own? I have a simple 2d scene, where I'm trying to have a sprite at x = -8 which I can move up and down. The problem is, when playing the scene, the sprite "jumps" by itself to the middle, x = 0, for no apparent reason. It then only goes back to x = -8 when there is input to move it. How do I get it to stop "jumping" to the middle at the start of every play?

using UnityEngine;
public class player1 : MonoBehaviour
{
     Vector2 targetPos;
     public float speed;
     public float step;
     void Start()
     {
         transform.position = new Vector2(-8,0);
     }
     void Update()
     {
         if (Input.GetKey("w") && transform.position.y < 3.8)
         {
             targetPos = new Vector2(-8, transform.position.y + step);
         }
         if (Input.GetKey("s") && transform.position.y > -3.8)
         {
             targetPos = new Vector2(-8, transform.position.y - step);
         }
         transform.position = Vector2.MoveTowards(transform.position, targetPos, speed);
     }
}

sentences:
Trouble referencing a bone transform in Unity. (Using MakeHuman armature / configured in Avatar ok / Anim mocaps working ok)) I've seen that the bones are Transforms. And i've tried copying many examples. The armature is the standard MakeHuman one and is unchanged. It imported to Unity fine and the mocap animations work perfectly. What I need to do is make the hand a parent of my gun .

Here is what I have currently (I have tried many similar permutations):

    Transform handR;
public GameObject gunPrefab;
GameObject gun;

private void Start()
{
    rb = GetComponent<Rigidbody>();
    playerAnims = GetComponentInChildren<PlayerAnimations>();
    absoluteGround = rb.transform.position.y;
    distToGround = GetComponent<Collider>().bounds.extents.y;
    handR = transform.Find("hand_r");
    Debug.Log("handR really is: " + handR);

    gun = GameObject.Instantiate(gunPrefab);
    gun.transform.SetParent(handR);
    //gun.transform.position = handR.position;
    gun.transform.rotation = Quaternion.identity;
}

The end result of this: The gun will spawn but isnt parented to anything. And if I try to set its position using handR.position then i get null exception. Pic above shows the image where I see its called "hand_r"

One more thing of note: The bones shown in the image above , do NOT appear in the hierarchy. I have on occasion imported models with the bones included whose bone names all appear in the hierarchy - could this be the reason Unity is finding "hand_r"??? and if so whats the best way to fix that (Please done say remove the armature and make my own in Blender !! :O )

PS: I have since tried it with a new model, made in Blender with a Rigify rig. The code part "handR = transform.Find("hand_R"); -yes the rigify rig names it with capital "R". Still doesnt work, BUT THERE IS A WORKAROUND I FOUND... if I make the Transform handR public and drag it into the Inspector it all works fine! (And yes the Rigify skeleton also shows up in hierarchy!) (So if you are reading this and struggling too, DONT use the MakeHuman skeleton, use one from Blender Rigify.)

But I'm still very confused why the "Find" command doesnt find the bone

sentences:
Turning a Java single player game into a multiplayer game I recently built a game with libgdx for my desktop. I would like now to make it a multiplayer game.

How could I do this? I was thinking about using node.js but there are some problems: I use Box2D and other Java libraries to help me making the game simulation and this would be hard to write all over again in Javascript.

The other option would be to write a Java server. Honestly I never used sockets or anything related to networks in Java (I have always been a C++ guy). So, what would you guys recommend? What would be the best option?

Also I would like to consider the performance since Box2D simulations are a bit heavy and with Java I am able to use multi-threading while node.js doesn´t allow me to do that. (I also think Java itself is a bit faster than Javascript).

Just one more note. As I said before I never done anything network related with Java, so if you think Java is the best option could you also recommend some technologies and/or java libraries and/or articles about networking or server creation in Java?

Thanks for your time!

sentences:
How can I make a sprite slow down to the speed of another sprite while following it? I'm making a SpriteKit game where two SpriteNodes are in a maze. That maze is represented as a grid. One sprite (A) travels faster than the other (B). Items randomly pop up, and the sprites have to collect them.

Pathfinding is easy (GKGridGraph is simple to use).

Here's the problem: At any given time, A and B could be on the same stretch of the maze. If A is behind B, I want A to be forced to go the same speed as B (cannot pass through or around). How can I accomplish this?

Thank you for your time!

sentences:
Updating object positions after screen moves. Is there a better way? I am making a top down 2D shooter using SDL2 for fun and I ran into a problem. I have a whole list of enemies each with their position on the screen stored in an array. Now you only see a portion of the map on your screen, because the whole map is too large. I want to have the player be able to move around the map, in which case I have to update the position of all the enemies. The same goes for projectiles and buildings. So I would have to loop over each of these every time the screen moves. I thought that a smarter way may be possible where you keep track of the entire map for each frame and when you render it you zoom in on only the part you need. That way you only have to keep track of one position vector, for instance the point on the map at which you want your screen to be centered. How is this problem normally tackled?

I realize that both methods will take some time, but seeing as the map is not THAT large, maybe 6x the screen, I thought it might be worthwhile. The problem is then that I am rendering the textures using  SDL_RenderCopyEx and then displaying them with SDL_RenderPresent, and I don't think you can zoom in like that.

sentences:
Adding Animation to Object—Unexpected Behavior I've been following the Unity 2D roguelike tutorial and I'm a bit confused about something. When he drags a series of sprites to his player object, a dialog box appears that prompts him to name and choose a location for his animation. I have seen this behavior in a couple video tutorials now.

When I do this, it simply creates the animation and animation controller in the sprite folder and nothing more. This becomes a bit tedious after a while and I'm not sure these animations are being associated with the object correctly.

What am I doing wrong?

sentences:
Weird white outline around model I'm working on a game in XNA 4 and I recently switched to a deferred shading implementation following this guide.  A strange white outline is showing up on my models now and I'm not sure whats causing this.  I thought maybe it was a lack of precision on the normal render target or the depth render target but increasing them to 64 bits (Rgba64) instead of 32 (Color) didn't help.  I also thought it might be some problem with the specular calculation so I tried setting the specular to 0 but that didn't help either.  Debugging the pixel in PIX shows the diffuse value is being calculated as nearly white for that pixel.  Any ideas?  I included a picture of the problem below, it's easier to see it at full size.

Pixel Shader:

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    input.ScreenPosition.xy /= input.ScreenPosition.w;

    float2 texCoord = 0.5f * (float2(input.ScreenPosition.x, -input.ScreenPosition.y) + 1) - halfPixel;

    float4 normalData = tex2D(normalSampler, texCoord);

    //Transform normal back into [-1, 1] range
    float3 normal = normalize(2.0f * normalData.xyz - 1.0f);

    float specularPower = normalData.a;
    float specularHardness = tex2D(colorSampler, texCoord).a * 255;
    float depthVal = tex2D(depthSampler, texCoord).r;

    //Compute screen-space position
    float4 position = float4(input.ScreenPosition.xy, depthVal, 1.0f);

    //Transform to world space
    position = mul(position, InvertViewProjection);
    position /= position.w;

    //Surface-to-light vector
    float3 lightVector = lightPosition - position;

    float3 projectedTexCoords = position - lightPosition;
    projectedTexCoords = mul(projectedTexCoords, float3x3(
                            float3(-1, 0, 0),
                            float3(0, 1, 0),
                            float3(0, 0, 1)));

    float distanceToLight = length(lightVector) / lightRadius;
    float shadow = ShadowContribution(projectedTexCoords, distanceToLight);

    float attenuation = saturate(1.0f - distanceToLight);

    lightVector = normalize(lightVector);

    //Compute diffuse light
    float normalDotLight = max(0, dot(normal, lightVector));
    float3 diffuseLight = normalDotLight * Color.rgb;

    float3 reflectionVector = normalize(reflect(-lightVector, normal));
    float3 directionToCamera = normalize(cameraPosition - position);
    float specularLight = specularPower * pow(saturate(dot(reflectionVector, directionToCamera)), specularHardness);

    return shadow * attenuation * lightIntensity * float4(diffuseLight.rgb, specularLight);
}

Edit: Sorry about the JPG, stackexchange's uploader did that on its own.  Roy T:  I did actually reference your XNA4 conversion of the tutorial for the parts that changed from XNA3.  Since I didn't make any big changes to the code I thought maybe this bug existed in the original but was just impossible to see with so many lights all moving around, so I removed all but one light and the bug showed up again (look near the lizard's elbow)

Here are the GBuffer contents for my scene:

Color Buffer:

Depth Buffer:

Normal Buffer:

Final Render:

Edit2:

I'm starting to suspect the problem is CombineFinal.fx when it samples the color map.  This is the computation for a properly colored pixel right next to a white pixel:

diffuseColor        : (0.435, 0.447, 0.412)
diffuseLight        : (1.000, 1.000, 0.902)
light               : (1.000, 1.000, 0.902, 0.000)
PixelShaderFunction : (0.435, 0.447, 0.371, 1.000)
specularLight       : 0.000

And this is the output from an improperly colored white pixel directly next to it:

diffuseColor        : (0.824, 0.792, 0.741)
diffuseLight        : (1.000, 1.000, 0.902)
light               : (1.000, 1.000, 0.902, 0.000)
PixelShaderFunction : (0.824, 0.792, 0.669, 1.000)
specularLight       : 0.000

The diffuseColor is the only difference, and this color is taken directly from the color map.  Perhaps there is a slight error in the computation of the texture coordinate to sample from?

Lighting Pass:

sentences:
Refresh UI after changing source code I was trying following things.
GameManager :
bool gameHasEnded = false;
public GameObject completeLevelUI;

public void CompleteLevel(){
    completeLevelUI.SetActive(true);
}

public void EndGame(){
    if(gameHasEnded == false){
        gameHasEnded = true;
        Invoke("Restart",2f);
    }
}

void Restart(){
    SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

EndTrigger :
public GameManager gameManager;

void OnTriggerEnter(){
    gameManager.CompleteLevel();
}

I get a log in the console "END". Earlier I was using Console.Log("END"); on CompleteLevel(), but I changed that source code. The old code seems to be working and not the new one. It's like Unity couldn't refresh that source code. (And I am sure that I have successfully saved the C# file.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerCollision : MonoBehaviour
{

    public PlayerMovement movement;

    void OnCollisionEnter(Collision collisionInfo)
    {
        Debug.Log(collisionInfo.collider.name);
        if (collisionInfo.collider.tag == "obstacle")
        {
            movement.enabled = false;
            FindObjectOfType<GameManager>().EndGame();
        }
    }

}
```

sentences:
What are effective strategies for a small game development team? What are language/platform-agnostic best practices for a small game development team of intermediate to advanced developers?

High-level strategies (as well as suggestions in terms of frameworks, engines or IDEs which might offer a good ROI) are welcome.

sentences:
Online leaderboard systems for (small/indie) PC games? Are there any free/affordable systems/libraries out there for adding online features to a small PC game? (most likely, for a small primarily-Windows-based indie game)

I'm not concerned about matchmaking or online multiplayer - but I'm interested in leaderboards, and maybe slightly more advanced features, such as the upload/download of user-created-content (e.g. replays or player-created levels). Maybe even automatic updates or downloadable content?

Whilst it probably shouldn't be too hard to implement at least the very basics from scratch, it seems like a big wheel to reinvent, and a tried-and-tested system would be preferable, to reduce development time, and reduce the chance of gaping security holes. Is there anything in reach of low/no-budget indie developers?

sentences:
How to know if one game idea is more worth pursuing than another? Right now I'm stuck between multiple projects (I don't have shiny object syndrome) I have several game ideas and I'm trying to figure out how to pick between them. I was thinking maybe hearing someones else's idea on how to handle a situation like this would help me.

How can I pick between game project ideas?

sentences:
With a Texture Atlas that has 128x128 tiles, how can I use that in Unity3D? So I've got a working texture atlas that has tiles fitting 128x128. However, I can't quite figure out how to use them. I know it's probably got something to do with

    TileRenderer.material.SetTextureScale("_MainTex", new Vector2(0.25f, 0.25f));
    TileRenderer.material.SetTextureOffset("_MainTex", new Vector2(0 * 0.25f,0));

but I'm not sure where to take it from there. Can anyone offer some advice? The size of the image is 1024x128 if that helps, which I think it might.

sentences:
Change in force on objects after collision i am implementing a billiard simulation game and i have a question about collision response.

As integrator, i am using Semi-Implicit Euler,

ball.setVelocity(ball.getVelocity().add(ball.getAcceleration().multiply(dt)));
ball.setPosition(ball.getPosition().add(ball.getVelocity().multiply(dt)));

Before integrating, i am calculating acceleration :

this.setAcceleration(this.getForce().multiply(1 / this.getMass()));

dt is time frame here, and acceleration, velocity, force and position are Vector class. (operations as add, multiply... are standard vector operations).

My question is - when i initially hit ball with cue, i am giving force -k*x (Hooke's law) to ball. But when it collides with other ball, i can only find formulas that calculate new position and new velocity, but my force will stay same. But how to change force here in both balls (it will change velocity and position later in SE Euler).

I appreciate any answer!

sentences: Which data structure to use to render a large isometric game world? I'm starting development of a 2d isometric (tiled, roguelike) game and I'm brainstorming which kind of data structure I would use to store runtime data like tiles and entities, but I don't want to use a 2D array (as the world will be huge). How could I handle the rendering in such a case?

sentences:
How do I get a delay in motion to happen? (Unity) I want the cockpits rotation to lag behind that of the cameras, so I wrote this code:

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

public class Delay : MonoBehaviour {
    public Transform BodyRot;
    public Transform CurrentRot;
    public Vector3 changeInRot;
    public float divideRot;
    Vector3 BodyTarget;
    Vector3 CurrentInitialRot;

    // Update is called once per frame
    void Update () {
        Vector3 BodyTarget = BodyRot.rotation.eulerAngles;

        Vector3 CurrentInitialRot = CurrentRot.rotation.eulerAngles;

        changeInRot = BodyTarget -= CurrentInitialRot;

        if(CurrentInitialRot != BodyTarget)
        {
            RotateFinal();
        }

    }

    void RotateFinal()
    {
        CurrentInitialRot += changeInRot / divideRot;
        transform.rotation = Quaternion.Euler(CurrentInitialRot);
    }
}

But it glitches out frequently. (DivideRot is how many times to divide the distance between the target and current position, so that it takes time to rotate)

sentences:
Continous horizontal animation of objects We have to continously animate objects from right to left in a panel. The player has to pop the first object.

If the first object could not be destroyed by the player and it reaches the left border of the panel, the game is over:

We have experimented by implementing this using Android widgets.

The panel is a HorizontalScrollView and the objects are ImageViews placed in a LinearLayout. The HSV is continously scrolled using ObjectAnimators and when the first object is popped by the player, a new object is added to the LinerLayout. This solution has some problems: the LinearLayout gets infinitely big, adding new objects to our model and layouting them causes small hiccups and the animator speed is changable through the Android developer options which makes implementing high score pointless.

What would be a "standard" solution for games with an infinite animation where constant animation speed and good performance are critical? Is using native widgets possible with these requirements or should we throw everything away and use a Canvas?

sentences:
Showing keyboard on SKScene and performing action on a sprite node based on key tapped I am trying to learn SpriteKit and play with some simple sample apps.

Currently I am trying to achieve below things:

Show keyboard over SKScene
If user taps 'A', perform some action on a sprite node, if user taps 'B' perform some other action on other sprite nodes

I tried to google 'Showing keyboard over SKScene' but could not get any suitable answer :(

Any clues or suggestions?

sentences:
Limitation on irandom() of game maker? I have three objects. All of them in the create event contain an action each (execute a piece of code):

obj_r01 => r01=0;

obj_r02 => r02=0;

obj_r03 => r03=0;

Image (to clarify what I have tried to explain):

So far so good, but I have one more object that modifies the variables of these other three: obj_control

The obj_control contains two events: create and draw.

crete event (obj_control):

obj_r01.r01=irandom(9);
obj_r02.r02=irandom(9);
obj_r03.r03=irandom(9);

draw event (obj_control):

This event contains three actions, precisely three "execute a piece of code":

piece one:

draw_text(x,y,obj_r01.r01); => applies to obj_r01

piece two:

draw_text(x,y,obj_r02.r02); => applies to obj_r02

piece three:

draw_text(x,y,obj_r03.r03); => applies to obj_r03

The objects are arranged as follows in the room:

In execution this is what happens:

The value of r01 is randomized, but that of r02 and r03 is not. I also tried to modify the obj_control creation event code to:

randomize();
obj_r01.r01=irandom(9);
randomize();
obj_r02.r02=irandom(9);
randomize();
obj_r03.r03=irandom(9);

However the result does not change. With this I could only suspect that the irandom () function can only create a storable random value, would it solve such a problem?

EDIT 1:

I tried putting randomize() only at the beginning of the code as suggested to me by @Philipp and @DH.:

randomize();
obj_r01.r01=irandom(9);
obj_r02.r02=irandom(9);
obj_r03.r03=irandom(9);

But there was no change in the result.

I also did a test to be sure if the value was not even being randomized or if the values of r02 and r03 were being randomized to 0 and for that I modified their values in the creation of each object:

In obj_r02:

r02=10

In obj_r03:

r03=100

The result:

The first value (not surprisingly) was randomized, but the second and third values were not. Thus it is clear that the randomization is not being made or that the draw event is occurring before the radomization of r02 and r03.

sentences:
How to build list of items available in World of Warcraft? There are a number of non-Blizzard sites that show a complete list of available items in World of Warcraft (such as wowhead, etc). I would like to know the best (easiest) way to compile a similar list.

I believe some sites are based on user-entered input, which I would like to avoid. Looking at the lua API, it seems that there are functions to get a list of items, but it's not clear if I can just download everything (I remember a reference to throttling somewhere, can't find it now). Does anyone have code samples that would do this, or links to source?

Also, Eve Online has made a database of items available (and I do mean SQL database file for download, not the Armory) - is there anything similar for Wow?

I'm just looking for the names and stats, not the graphic icons.

sentences:
What's the best control scheme for an arena shooter on a touchscreen phone? I am developing Android an game. It's going to be a top-down shooter with stealth features. I am now thinking about how to the make controls. Most top-down games are now twin stick (joystick on the left and right sides) but I need more buttons (for choosing weapons, commanding your squad, and using skills).

So here are my ideas:

Two (virtual) sticks like in other games, when you tap somewhere on the display, a circle with buttons appears, where you can choose abilities or weapons.
One stick on the left side for walking, shoot where the second finger is pressed, weapons and skills on the right side.

What do you think is the best? Or do you have any other idea? I want to choose the most intuitive and simplest.

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:
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:
OpenGL ES - render to texture - how to preserve original depth buffer I render to texture and attach my own depth buffer that has texture target. However, after I finish rendering I would like to set original depth buffer back.
To start rendering to texture I do:
glGetIntegerv(GL_RENDERBUFFER_BINDING, &bindedDepthBuffer); //returns 0
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &bindedFrameBuffer);  //returns 0

glBindFramebuffer(GL_FRAMEBUFFER, rttFboId);
glBindRenderbuffer(GL_RENDERBUFFER, rttDepthId);
glViewport(0, 0, rttViewPortWidth, rttViewPortHeight);

... render scene

glViewport(0, 0, origWidth, origHeight);
glBindFramebuffer(GL_FRAMEBUFFER, bindedFrameBuffer);

Now after I do:
glBindRenderbuffer(GL_RENDERBUFFER, bindedDepthBuffer);

the original depth buffer stops working and it seems as its content is empty (everything that is rendered after this point behave like the depth buffer has been cleared). This problem occurs only on some OpenGL ES devices with Android and I dont know what can cause this.

sentences: Unity DirectoryInfo not working in OSX standalone build So I'm building an application in unity which I hope to use at a market day coming up soon at my school (it's not a game, it's basically like a checkout app, kind of...) Anyway, I'd like to be able to import images from the app and to have the option to change them while the app is running. Currently I have the images in a folder and I'm using DirectoryInfo to get the contents of that folder and load the images. Works like a dream inside the editor but as soon as I build the app (on OSX), everything is blank. Other people seem to have similar issues but I'm a little unsure as to how they fixed it. Could someone please help me, this is kind of urgent!

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:
Can not connect HTC Vive headset - Steam VR plugin error Failed to load IVRRenderModels When I add SteamVR plugin I receive error
Failed to load IVRRenderModels interface version IVRRenderModels_005.
The plugin works for my other projects, camera and controllers are detected and work fine.

sentences:
Handling player logoff and logon in a persistent world without breaking immersion One problem I've never seen fixed in any persistent online game is how to handle player logon and logoff without the characters just popping in and out of the world.  My first thought is to simply make a player's offline state as their character being asleep, but that doesn't make sense in the event of a disconnect and not an intentional logoff.

How would you fix this, if you would even bother fixing it at all?

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:
Blinking color shader Currently i'm using Unity3D, and i want to make one variable blink along time in a fragment shader. Now i have code like this:

    half4 frag(v2f i) : COLOR{
        float4 r = _OutlineColor;
        r.a = r.a * _SinTime ;
        return r;
        }

But this blinking is too slow and not suit me, any ideas ?

sentences:
How can I load 24-bit audio as SoundEffect? When I try to load .wav file I get an error:

  Audio file *.wav contains 24-bit audio. Only 8-bit and 16-bit audio
  data is supported.

Here is my code:

SoundEffect menuSelectionChange = content.Load<SoundEffect>("Sound/Menu Selection Click");
SoundEffectInstance menuSelectionChangeInstance = menuSelectionChange.CreateInstance();

Even if I delete this code I'm still getting this error.

sentences: Callback on Derived Class? How does Unity3D implement their system where if a class is derived from MonoBehaviour and has certain methods like Awake() or Update(), they are called accordingly? I want to do a similar system for classes inheriting from the class 'Ability' to store the classes in an array and call the callback method Execute() when they are being executed.

sentences: Game assets are images or 3D models I am new to game development and I have created simple games with javascript and SFML. Those games are 2D and there I used images as my gaming assets. I was trying to be familiar with OpenGL like 3D modeling APIs. In 3D gaming is all the assets are 3D models or there can be some images like in 2D?

sentences:
Creating 3D gravity in zero-G tied to mass in unity with c# As a total beginner,
I've been working on a patch-job script for a gravity mechanic in an open space sim, I want to derive all my objects from this "Block ALPHA" object and its' set of variable attributes, so it's important that I get it right before moving on.

The idea is simple enough, call an array of all interactive objects' coordinates and apply a basic equation to simulate gravitational pull.

After some tinkering I have a piece of code that ticks all the boxes AFAIK, but I can't for the life of me figure out the syntax error I've made... I've been up all night massaging the script to fit my needs, but in the best cases it only raises one error:
"expected '}'"

Maybe I'm just tired, maybe I broke the code, but trying to place parentheses only seems to bring more errors :/

Here's the code as it is so far complete with the compiler error and suggested fix (in red), which does no good whatsoever:

using UnityEngine;
using System.Collections;

public class DynamicWeightAnalysis : MonoBehaviour
{

//Strength of attraction from your game-object, ideally this will be derived from a calculation involving the objects volume and density eventually
public float RelativeWeight;

//Here, we name our target objects
GameObject[] blockALPHA;

//Initialise code:
void Start ()
{
    //here, we define our target objects further by searching for the predefined tag
    blockALPHA = GameObject.FindGameObjectsWithTag("Block ALPHA");
}

//Use FixedUpdate because we are controlling the orbit with physics
void FixedUpdate ()
{ "} EXPECTED"

    //this is where we define the graverage coordinates
Vector3 graverage (Vector3[] blockALPHA)
    {
        if (blockALPHA.Length == 0)
            return Vector3.zero;
        float x = 0f;
        float y = 0f;
        float z = 0f;
        foreach (Vector3 pos in blockALPHA)
        {
            x += pos.x;
            y += pos.y;
            z += pos.z;
        }
        return new Vector3(x / blockALPHA.Length, y / blockALPHA.Length, z / blockALPHA.Length);

        Vector3 offset;

    //here we get the offset between the object and the average position of all objects
    offset = graverage - transform.position;

    //This is the variable for square magnitude calc
    float magsqr;

    //Offset Squared:
    magsqr = graverage.sqrMagnitude;

    //Check distance is more than 1 to prevent division by 0 (because my blocks are all 1x1x1, any closer and they'd be intersecting)
    if (magsqr > 1f)
        {
        //Create the gravity- make it realistic through division by the "magsqr" variable

            GetComponent<Rigidbody>().AddForce((RelativeWeight * graverage.normalized / magsqr) * GetComponent<Rigidbody>().mass);
        }
    }
}

I don't doubt that I've overlooked something stupid, but it's my first stab at proper coding, so, no shame in asking

Thanks :D

sentences:
Pathfinding with portals? I'm not making a game with portals in it (one way or bidirectional). These portals instantly teleport characters from one location to another. How would I implement pathfinding?

Here's an animation showing the portals in action, and different paths taken: http://www.makeitshareit.com/animation/86137

How do I perform pathfinding whilst taking in the possibility of using the portals as shortcuts? If I just use A*, the portals may wreak havoc with the admissibility requirement. How can I also make it reasonably efficient, such as avoiding quadratic complexity with respect to the number of portals?

sentences:
Handling multiple agents in astar pathing When working with grid based path finding in how do you normally handle different agent types? In the game I am working on I have a regular agent, and one that occupies 2 cells on the grid, and one that can fly. The idea I have now is to use a separate AStar map to store the grid for each type. The height is max 4 units so I can use AStar for flying as well.

This keeps it possible to add new actor types as well but is it waste of memory? Also how to deal with avoiding nodes occupied by other agents? The game is turn based so I don’t want to do any object avoiding type thing. Is there a simple way to mark a node in the AStar as temporarily unwalkable?

I am using the Godot Engine and would like to use the in built astar implementation but I can create my own if really needed.

sentences:
smallest distance randomly generated objects For a project in gamemaker, I'm making a galaxy with several planets in it (about 30), which have random placements (there is a minimum distance between them).
After the planet generating, i'm trying to figure out how to calculate the two closest planets for each individual planet, so I can make trade routes between them.
So, each planet has two planets that are closest to it, and I'm trying to make an array in which the coordinates of that planet and the two closest planets are.

I'm using the following code:

///trade route making
var a1;
var a2;
var R1;
var dist;

//what each kolom is
global.traderoutes[0,0]="x1";
global.traderoutes[1,0]="y1";
global.traderoutes[2,0]="x2";
global.traderoutes[3,0]="y2";

//global.traderoutes coordinates length, +1 everytime a set is added
global.R1=1;

for (i=1;i=global.TT;i+=1){

  global.a1=100000000; //a1 and a2 are values to check against, larger than any distance could possibly be.
  global.a2=100000000;
for (j=1+i;j=global.TT;j+=1){
    dist=point_distance(global.planetinfo[1,i],global.planetinfo[2,i],global.planetinfo[1,j],global.planetinfo[2,j]);
    if (dist<=global.a1){
       global.traderoutes[0,R1]=global.planetinfo[1,i];
       global.traderoutes[1,R1]=global.planetinfo[2,i];
       global.traderoutes[2,R1]=global.planetinfo[1,j];
       global.traderoutes[3,R1]=global.planetinfo[2,j];

       global.a1=dist;
       global.R1+=1;
    }
    else if (dist<=global.a2){
       global.traderoutes[0,R1]=global.planetinfo[1,i];
       global.traderoutes[1,R1]=global.planetinfo[2,i];
       global.traderoutes[2,R1]=global.planetinfo[1,j];
       global.traderoutes[3,R1]=global.planetinfo[2,j];

       global.a2=dist;
       global.R1+=1;
    }
}
}

global.TT is the length of the planetinfo array, where all the coordinates for each planet are stored in the first (xcoordinate) and second(ycoordinate) column.

However, it doesn't work. global.traderoutes always comes out empty, it doesn't create any new rows beside the 0th one, where "x1, y1,x2,y2" are written above each kolomn.
Can anyone see a mistake I made in the code? Any help would be greatly appreciated.

sentences:
Why is H (blinn) used instead of R (phong) in specular shading? I can't find a good reason for this anywhere. The reflection vector used in phong has a simple basis in physics. But the half vector used in blinn seemingly has no rational basis, and does not constitute a proper reflection. And yet it is used in every so-called "physically based" shading function. If there is a good physical basis for it, I'd like to know.

What I've been able to find are a few reasons:

It's faster - there's mixed information on this, but even so it would have been a great reason... in the year 1998.

It handles angles higher than 90 degrees better - as far as I can tell the only reason for this is because the phong term has been used improperly. The dot product of the reflection and the view gives an angle between -1 and +1. Usually this angle is clamped to 0 to 1, this is the direct cause of the 90 degree problem. Re-normalize the angle instead of clamping it and you get the full 180 degree coverage. I refuse to believe a simple x * 0.5 + 0.5 operation has eluded the graphics world for 40 years.

it handles edges better - The edge "problem" also exists in the blinn solution, just to a lesser degree. The main cause is improper simulation of area lighting at the terminator, which should be essential for any "physically based" shader. But even in simpler situations a sigmoid function can approximate a soft terminator line correctly. Multiplying into a lambert term is incorrect as it attenuates the specular term improperly, this could cancel out a fresnel term and lead to further errors.

It has long reflections at the edge - It seems to me that while anisotropic reflections may be realistic, blinn is not the correct way to implement them, as they only appear at the edge. It is merely a happy coincidence that an error in the H term happens to look realistic.

None of these reasons are satisfactory, I want to sort out this madness.

I want to clarify that I am not talking about blinn and phong specifically, but instead about the vector components H and R, which are used as the basis for these shaders as well as others.

sentences:
Implementing a score system similar to Moon Patrol I am working on an Android game scenario inspired by Moon Patrol.

My beta version is available for beta test from https://play.google.com/store/apps/details?id=dev.android.buggy

In my case, I got the elapsed time in seconds for reaching a checkpoint, and I could reward either a fixed bonus or a bonus based on the time, perhaps the difference between the time and the average time, or another bonus if it is a high score. My specific implementation for completing a checkpoint looks as follows at the moment:

if (checkpointComplete) {
    ((Activity) this.getContext()).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            //
        }
    });
    canvas.drawColor(Color.BLACK);
    ((ParallaxActivity) getContext()).stopWatch.stop();
    paint.setTextSize(60);
    String s2 = "TIME TO REACH POINT \"" + Background.checkpoint + "\"\n";
    if (runOnce) {
        for (int q = 0; q < s2.length(); q++) {
            final String s2f = s2;
            final int r = q;
            ((Activity) this.getContext()).runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    checkpointtextview.setTextColor(Color.RED);
                    checkpointtextview.append(Character.toString(s2f.charAt(r)));
                }
            });
            try {
                Thread.sleep(50);
            } catch (InterruptedException ie) {
            }
        }
    }
    String str = String.format("%03d", ((ParallaxActivity) this.getContext()).countUp);
    String s3 = "YOUR TIME                :   " + str;
    if (runOnce) {
        for (int q = 0; q < s3.length(); q++) {
            final String s3f = s3;
            final int r = q;
            ((Activity) this.getContext()).runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    checkpointtextview2.setTextColor(Color.parseColor("#ADD8E6"));
                    checkpointtextview2.append(Character.toString(s3f.charAt(r)));

                }
            });
            try {
                Thread.sleep(50);
            } catch (InterruptedException ie) {
            }
        }
    }
    runOnce = false;
    // canvas.drawText("CHECKPOINT COMPLETE", (float) (screenWidth * 0.35), (float) (screenHeight * 0.45), paint);
    ((Activity) this.getContext()).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ((ParallaxActivity) getContext()).startTime = SystemClock.elapsedRealtime();
                    ((ParallaxActivity) getContext()).stopWatch.setBase(((ParallaxActivity) getContext()).startTime);
                    ((ParallaxActivity) getContext()).stopWatch.start();
                    checkpointtextview.setText("");
                    checkpointtextview2.setText("");
                    checkpointtextview3.setText("");
                    checkpointtextview4.setText("");
                    checkpointtextview5.setText("");
                    checkpointtextview6.setText("");
                    String str = "Player 1  " + String.format("%06d", score);
                    tvId.setText(str);
                    scoring = false;
                    buggyXDistance = 0;
                    distanceDelta = 0;
                    retardation = 0;
                    checkpointComplete = false;
                    runOnce = true;

                }
            }, 3000);
        }
    });
}

I want to calculate bonus for completing a checkpoint but how is it calculated? If we look at the original it looks like below.

Is it possible to deduce the formula for calculating the bonus? My bonus screen looks the same. So if your time is x and the average time is y and the record is z, what is the formula?

sentences:
How to debug fatal signal 11 code 2 in UnityMain? i have searched for the

  fatal signal caused by Render or GxDriver, FlashMuller in unity forum
  says it's google play

the error:

08-03 14:59:47.503 32020-32092/? A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0xcbe8dffc in tid 32092 (UnityMain), pid 32020 (com.tuo3.alive)
08-03 14:59:47.533 32121-32121/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'OnePlus/OnePlus5T/OnePlus5T:8.1.0/OPM1.171019.011/1807181208:user/release-keys'
    Revision: '0'
    ABI: 'arm'
    pid: 32020, tid: 32092, name: UnityMain  >>> com.tuo3.alive <<<
08-03 14:59:47.544 32121-32121/? A/DEBUG: backtrace:
        #00 pc 000575d0  /system/lib/libc.so (je_arena_tcache_fill_small+71)
        #01 pc 00077919  /system/lib/libc.so (je_tcache_alloc_small_hard+16)
        #02 pc 00058fc7  /system/lib/libc.so (je_arena_palloc+1650)
        #03 pc 00069bd1  /system/lib/libc.so (imemalign+1164)
        #04 pc 0006d373  /system/lib/libc.so (je_memalign+26)
        #05 pc 001d6f18  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (UnityDefaultAllocator<LowLevelAllocator>::Allocate(unsigned int, int)+24)
        #06 pc 001da888  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (MemoryManager::Allocate(unsigned int, unsigned int, MemLabelId const&, AllocateOptions, char const*, int)+852)
        #07 pc 001da254  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (malloc_internal(unsigned int, unsigned int, MemLabelId const&, AllocateOptions, char const*, int)+128)
        #08 pc 00193bc8  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (core::StringStorageDefault<char>::assign(char const*, unsigned int)+180)
        #09 pc 00a350bc  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (__gnu_cxx::hashtable<std::pair<core::basic_string<char, core::StringStorageDefault<char>> const, ZipCentralDirectory::PathDescriptor>, core::basic_string<char, core::StringStorageDefault<char>>, __gnu_cxx::hash<core::basic_string<char, core::StringStorageDefault<char>>>, std::_Select1st<__gnu_cxx::hash>, std::equal_to<core::basic_string<char, core::StringStorageDefault<char>>>, std::allocator, <ZipCentralDirectory::
        #10 pc 00a34adc  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (_ZZN19ZipCentralDirectory20readCentralDirectoryEvEN3$_08__invokeERK15FileSystemEntryR12FileAccessorPKcRKN3zip4CDFDEPv+508)
        #11 pc 00a38160  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (zip::CentralDirectory::Enumerate(bool (*)(FileSystemEntry const&, FileAccessor&, char const*, zip::CDFD const&, void*), void*)+804)
        #12 pc 00a348d0  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (ZipCentralDirectory::readCentralDirectory()+20)
        #13 pc 00a26630  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (apkAddCentralDirectory+84)
        #14 pc 00a19074  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (Mount(char const*)+84)
        #15 pc 00a090dc  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (UnityInitApplication()+216)
        #16 pc 00a0a660  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (UnityPlayerLoop()+264)
        #17 pc 00a0cc68  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/lib/arm/libunity.so (nativeRender(_JNIEnv*, _jobject*)+228)
        #18 pc 000114cb  /data/app/com.tuo3.alive-VZWALBY70nH_dSDIQa_rKA==/oat/arm/base.odex (offset 0x10000)

[More discussion][2]

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:
What are the capabilities of Panda3D? Can Panda3D game be served from cloud such as AWS ?
Can Panda3D be used for mobile game development (iOS, Android) ? I'm aware Unity can be used but what about Panda3D ?

sentences:
How to implement different shapes for an area of affect spell? Let W = wizard

Let 0 = Cast range of spell, or AOE

Here is the problem:

I have a 2D tile map of squares. Let's say I want to have a wizard cast a spell that surrounds his body equally. For this, it would be as simple as using a flood fill or Dijkstra's algorithm, and it would look like this:

===0===
=00000=
000W000
=00000=
===0===

No problem! However, how will I implement a spell, that, for whatever reason, looks like a plus sign?

===0===
===0===
000W000
===0===
===0===

Or the spell goes longer in the direction the wizard is facing?

=00000=
=00000=
==0W0==
==000==
=======

Or two different locations?

=======
=00====
===W===
====00=
=======

Or, even more awkward, its a ranged splash spell where the player can choose where they want to cast it?

=======
=======
===W===
======0
=====00

One way would be to have a list of all the locations relative to the wizard beforehand, and add them to the wizards location later. (E.g, for the affect to be 2 tiles north of the wizard, it would store (x+0, y+2), and later add them to the wizard's position, which could be at x=30, y=19, so the affect would be at x=30, y=21.)

A limitation to this, unfortunately, is that it doesn't take into account where the wizard is facing, and it feels inelegant to manually typing in all the locations that the AOE will affect.

Bottom line: How should I approach this problem and create a good, easily adjustable AOE system for a tile based map, that takes into account different AOE shapes and cast positions?

sentences: What is the purpose of glScissor? I know that it is more efficient than stencil test, but am I right assuming that the same functionality could be achieved using projection transformations with viewport?

sentences:
Unity IAP through Google Play is forgotten after a day without internet connection I am trying to make a NonConsumable IAP purchase persist without internet connection.

I have implemented the IAP system from Unity 5.6 through Google Play for a NonConsumable item and it is working. From a previous question I learned how to avoid using Unity's PlayerPrefs to remember purchases in favor of checking the receipt from the Unity storeController that initializes with Unity's API code below.

   public void OnInitialized (IStoreController controller, IExtensionProvider extensions)
        {
            this.controller = controller;
            this.extensions = extensions;
        }

What I have observed is that the OnInitialized will run without internet connection as long as it has recently been initialized. This seems to be cached somewhere within Android because clearing the cache on my app will not force the purchase to be forgotten. The problem is after about half a day without internet connection the controller cannot initialize. Therefore I cannot check the item receipt in the controller with the code below.

Product product = storeController.products.WithID(productId);
 if (product != null && product.hasReceipt)
 {
     // Owned Non Consumables and Subscriptions should always have receipts.
     // So here the Non Consumable product has already been bought.
     itemBought = true;
 }

What strategy or method should I use to persist a NonConsumable purchase during times without internet connection as it is recommended to not use Playerprefs on numerous guides.

sentences:
Unity Extending Game Object best practice What is best practice when wanting to add to GameObject class?

I would like all GameObject to be able to change color IF they have a renderer.
Ive tried using a helper class that takes a GameObject and lerps the color value but if i want it to have an update method it must inherit MonoBehaviour, and if it does inherit it then i cant instanciate that helper class.

Now im thinking about creating a new class that manages a GameObject and inherits from Monobehavoiur. It would have one GameObject as a member that it can manipulate. But then i would have to instanciate it from somewhere.

Hmmm unity has its logic but i havent found it yet. Is it clear what i am having problems with? Otherwise please ask.

sentences:
How do I generate a level randomly? I am currently hard coding 10 different instances like the code below, but but I'd like to create many more. Instead of having the same layout for the new level, I was wondering if there is anyway to generate a random X value for each block (this will be how far into the level it is). A level 100,000 pixels wide would be good enough but if anyone knows a system to make the level go on and on, I'd like to know that too. This is basically how I define a block now (with irrelevant code removed):

block = new Block(R.drawable.block, 400, platformheight);
block2 = new Block(R.drawable.block, 600, platformheight);
block3 = new Block(R.drawable.block, 750, platformheight);

The 400 is the X position, which I'd like to place randomly through the level, the platformheight variable defines the Y position which I don't want to change.

sentences:
Rotate camera keeping player not in the middle Here I have a 2D top down game. Currently the camera is set on the player position.
The player constantly points to mouse position.

I want to modify this setup having the camera to be set slightly forward in the player.transform.up direction but when I try it as the mouse gets closer to the character it starts looping because as the mouse approache, the camera turns but also change the mouse position so the camera needs to turn again, and so on.

this is the camera update

transform.position = new Vector3 (player.transform.position.x, player.transform.position.y, -10) + player.transform.up * camDistance;

and this is how the mouse position gets updated

mousePos = Camera.main.ScreenToWorldPoint (new Vector3(Input.mousePosition.x, Input.mousePosition.y, -5)) - transform.position;

any clue?

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:
Instanced based game with multiple node instances I have a nginx load balancer with 4 nodejs instances behind it, and one Redis server to share certain memory.

My game is an instance game, similar to Diablo 2. Players can create "games" if you will and other players can join them.

The game data is stored locally on the players node of which who created the game (I was going to store the game data in Redis, but have the following dilemma):

When a game is made from a user that is on node instance #1; and a user that is on node instance #2 wants to join that game. This is where I get confused. I want the players to communicate to each other locally (but they cannot because they are not on the same instance). How exactly can I counter this?

These are some solutions I found:

Use ZeroMQ or Nanomsg to send the data locally between processes
Use the native nodejs IPC protocol to send the data locally
between processes

Now, this worries me more. Because I have a feeling I am doing it wrong.  When a player is moving around in the map, he needs to send data to all other 5 players in that game. (simple positional packet).  This now has to be sent through ZeroMQ (pub subbed) -- or through local sockets (IPC). Isn't this going to be a lot of overhead? Are there other ways to scale an instanced based game with multiple node instances? Or maybe, this is the right way, and I'm underestimating how fast local sockets are (or ZeroMQ's speed)?

sentences:
What is the bare minimum I need to set up the Android SDK for Unity development? I want to import my Unity project to Android, and I need to download the Android SDK, but I do not want to download any unnecessary components.

Do I need to download all platforms, or just the latest one? I am worried about the size of Android 7.1.1 (API Level 25); the SDK Manager reports this as the latest version, but I am not sure.

I only want to import my project for Android smartphones, with no plan of publishing it. I do not want to build to Android TV or Android Wear, for example. Do I need to download all of the contents under the specific platform? I ask because there are Android TV and Android Wear system images, and the files can get quite large.

sentences:
Basic procedural generated content works, but how could I do the same in reverse? My 2D world is made up of blocks. At the moment, I create a block and assign it a number between 1 and 4. The number assigned to the nth block is always the same (i.e if the player walks backwards or restarts the game.) and is generated in the function below.
(Image shows a small portion of the game, in practice there are much more blocks)

As shown here by this animation, the colours represent the number.

function generate_data(n)
    math.randomseed(n) -- resets the random so that the 'random' number for n is always the same
    math.random() -- fixes lua random bug
    local no = math.random(4)
    --print(no, n)
  return no
end

Now I want to limit the next block's number - a block of 1 will always have a block 2 after it, while block 2 will either have a block 1,2 or 3 after it, etc.
The next block's number is taken at random from the next table:

{
   [1] = {next = {2}},
   [2] = {next = {1,2,3}},
   [3] = {next = {4}},
   [4] = {next = {1,3,4}},
}

Before, all the blocks data was randomly generated, initially, and then saved. This data was then loaded and used instead of being randomly called. While working this way, I could specify what the next block would be easily and it would be saved for consistency.
I have now removed this saving/loading in favour of procedural generation as I realised that save whiles would get very big after travelling.

Back to the present. While travelling forward (to the right), it is easy to limit what the next blocks number will be. I can generate it at the same time as the other data.

The problem is when travelling backwards (to the left) I can not think of a way to load the previous block so that it is always the same.

Does anyone have any ideas on how I could sort this out?

sentences:
Domain-specific languages for scripting As most of you know, embedded interpreters for languages like Lua and Python are widely used for scripting game logic, but I haven't seen much information on people going with domain-specific languages for their scripts, e.g. building a little logic scripting 'dialect' on top of the language used for the rest of the game, using macros or fluent programming or whatnot.

So my questions are as follows:

What examples of such DSLs have you seen in real-world games?
What problems were run into?
Would you recommend this route for other game developers, and in what circumstances?
Do you see this becoming more common as game development moves toward more metaprogramming-friendly languages, e.g. Boo?

sentences: Using ColorFill on a depth buffer I'm trying to implement a render abstraction over Direct3D9, and one of the functions I'm implementing is clearing a render target, which includes a depth buffer. However, the IDirect3DDevice9::ColorFill method I've been using doesn't seem to be able to clear depth buffers. Is the only means to clear depth buffers to use Clear() to clear depth buffers which have been bound to the rendering pipeline?

sentences:
What type of Collider should I add to a LineRenderer? I am currently building a game where I need to generate some wires (as Bézier curves) using LineRenderer. After changing the width of each line

lineRenderer.SetWidth (0.15f, 0.15f);

I am attaching an EdgeCollider2D to the same game object (specifying the same points used in generating the Bézier curve). This seems to work. However, I would like to be able to know if the Mouse Pointer is at any time over the EdgeCollider2D (something similar to the popular Fruit Ninja game). I'm using Raycast as follows:

void CastRay() {
    Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction, Mathf.Infinity);

    if (hit) {
        Debug.Log (hit.collider.gameObject.name);
    }
}

I'm calling the CastRay method inside the Update method. Because EdgeCollider2D does not have width (as expected), the log message is never produced.

Do I need to use a different type of Collider? Do I need to call CastRay somewhere else?

sentences:
Issues accessing arrays in Unity I'm trying to make a mini quiz game, but I'm stuck. I'm showing questions, randomly, but the first question never comes up. Furthermore, when I set the size of the questionsNumberChoosen array to 10 and run the game, it crashes.

public struct Question
{
    public string questionText;
    public string[] answers;
    public int correctAnswerIndex;

    // .. we also construct the Question, directly providing all values.
}

public Text questionText;
public Button[] answerButtons;

private Question currentQuestion;
private Question[] questions = new Question[10];
private int[] questionNumbersChoosen = new int[9];
private int questionsFinished;

void Start ()
{
    questions [0] = new Question("1", new string[]{"A", "A", "A", "A", "A" }, 2);
    questions [1] = new Question("2", new string[]{"A", "A", "A", "A", "A" }, 0);
    questions [2] = new Question("3", new string[]{"A", "A", "A", "A", "A" }, 4);
    questions [3] = new Question("4", new string[]{"A", "A", "A", "A", "A" }, 0);
    questions [4] = new Question("5", new string[]{"A", "A", "A", "A", "A" }, 0);
    questions [5] = new Question("6", new string[]{"A", "A", "A", "A", "A" }, 2);
    questions [6] = new Question("7", new string[]{"A", "A", "A", "A", "A" }, 0);
    questions [7] = new Question("8", new string[]{"A", "A", "A", "A", "A" }, 4);
    questions [8] = new Question("9", new string[]{"A", "A", "A", "A", "A" }, 0);
    questions [9] = new Question("10", new string[]{"A", "A", "A", "A", "A" }, 0);

    setQuestionIndex ();
    assignQuestion (questionNumbersChoosen[0]);
}

void assignQuestion(int questionNum)
{
    currentQuestion = questions [questionNum];
    questionText.text = currentQuestion.questionText;
    for (int i=0; i < answerButtons.Length; i++)
        answerButtons[i].GetComponentInChildren<Text>().text
            = currentQuestion.answers [i];
}

public void checkAnswer(int buttonNum)
{
    if (buttonNum == currentQuestion.correctAnswerIndex)
        print ("Correct!");
    else
        print ("Incorrect!");

    if (questionsFinished < (questionNumbersChoosen.Length - 1))
        moveToNextQuestion ();
}

void setQuestionIndex()
{
    for (int i = 0; i < questionNumbersChoosen.Length; i++)
    {
        int questionNum = Random.Range (0, questions.Length);

        if (!isContain (questionNumbersChoosen, questionNum))
            questionNumbersChoosen [i] = questionNum;
        else
            i--;
    }

}

bool isContain (int[] num, int numbers)
{
    for (int i=0; i < num.Length; i++)
    {
        if (numbers == num [i])
            return true;
    }

    return false;
}

public void moveToNextQuestion()
{
    assignQuestion (questionNumbersChoosen
        [questionNumbersChoosen.Length -1 - questionsFinished++]);
}

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:
OpenGL strange rendering problem when buffers have different sizes I have encountered a very odd error in my program, "odd" in the sense that everything the API says suggests that the error should not occur.

I have a bunch of 2D un-indexed vertex data, and I want to render it as lines. So far, so good. Then, I wanted to make each vertex have its own (RGB) color, so I generate a color for each vertex. For simplicity, I chose red. Works fine, except now only 2/3 of the points are being rendered! The problem arises from the fact that each vertex's position data consists of only 2 numbers, whereas the color data consists of 3 numbers. So, the "position" buffer has 2 elements per vertex while the "color" one has 3 elements per vertex. I thought that using glVertexAttribPointer to tell this information to OpenGL would be enough, but turns out it's not. In fact, if I say that the color data has only 2 elements per vertex, using

glVertexAttribPointer(vertexColorID2,2,GL_DOUBLE,GL_FALSE,0,(void*)0);

(as opposed to 3), it renders all the points - except now I can only specify two numbers for the RGB color, so I can't get the right color. The full code of the issue is below:

    glUseProgram(programID2); //draw the graph
    graph_data = graphData();
    std::vector<double> graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graph_data.size(); i += 3) graphcolordata[i] = 1;
    glEnableVertexAttribArray(vertexPosition_modelspaceID2);
    glBindBuffer(GL_ARRAY_BUFFER, graphbuffer);
    glBufferData(GL_ARRAY_BUFFER, graph_data.size()*sizeof(GLdouble), &graph_data[0], GL_STREAM_DRAW);
    glVertexAttribPointer(vertexPosition_modelspaceID2,2,GL_DOUBLE,GL_FALSE,0,(void*)0);
    glEnableVertexAttribArray(vertexColorID2);
    glBindBuffer(GL_ARRAY_BUFFER, colorbuffer2);
    glBufferData(GL_ARRAY_BUFFER, graphcolordata.size()*sizeof(GLdouble), &graphcolordata[0], GL_STREAM_DRAW);
    glVertexAttribPointer(vertexColorID2,3,GL_DOUBLE,GL_FALSE,0,(void*)0);
    glDrawArrays(GL_LINES, 0, graph_data.size()/2);
    glDisableVertexAttribArray(vertexPosition_modelspaceID2);
    glDisableVertexAttribArray(vertexColorID2);

Note: programID2 is my basic shader program, and the following variable definitions were previously used:

GLuint vertexPosition_modelspaceID2 = glGetAttribLocation(programID2, "vertexPosition_modelspace");
GLuint vertexColorID2 = glGetAttribLocation(programID2, "vertexColor");

Edit: Incredibly stupid error, figured it out immediately after posting when it had previously stumped me for half an hour.

    std::vector<double> graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graph_data.size(); i += 3) graphcolordata[i] = 1;

should be
        std::vector graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graphcolordata.size(); i += 3) graphcolordata[i] = 1;

When this initialization is fixed, it works fine. I would delete this, but I do not see how.

sentences:
How to best utilize depth buffer precision Are there strategies to minimize depth buffer precision problems with hyperbolic depth buffers, such as the ones resulting from perspective projection matrices, or depth buffers in general?

For example, graphics APIs usually give an option to change the depth range, which might influence precision. It's possible to linearize non-linear depth buffers, for whatever reason. There's the option of floating point depth buffers, and non-floating point depth buffers. It's possible that changing the information in projection matrices has a result on the resulting range & precision of the depth buffer.

How do all of these things interact with the resulting range & precision, or with each other, and how do I get the maximum out of my depth buffer? Are there general good practices one should adopt, regardless of project specifics?

sentences:
Effect culling on uneven terrain I'm trying to integrate a "ground particle" effect (like a fire-circle or similar) in Unity3d, however since i'm using uneven terrain as my terrain mesh, the effect gets culled behind terrain parts that above it.

To better ilustrate it I created an image as attachment :
I want for the effect to always be displayed regardless of it's "depth".
How can this undesired effect be avoided/resolved properly ?

sentences:
Bouncing ball loses its forward momentum after the first bounce I've created a bouncing ball in Unity, and I want to bounce the ball across the field, but the results I get seem very unrealistic.
The ball should bounce in the direction it was launched 2 or 3 more times, but after the first launch the next bounce is bouncing at the same place, going straight into the air. I also didn't see any spin effect on the ball. How can solve this problem?

And here's my physics settings

sentences:
How can I manage an animated UI from ActionScript? I'm trying to code a game of Poker in AS3, using Flash Professional CS5 (although I try to keep as little code as possible in the .fla).

When a player bets, for example, I need to be able to show an animation of some chips sliding into the center of the screen. After that happens, the AI decides what to do, and another animation of their chips occurs. Then a menu pops up so the player can choose their own next action. And so on.

I started writing a UIBet interface with bet(amount) and raise(amount) methods and so on, that you would implement with a class extending MovieClip and fill in the methods with gotoAndPlays to various animations. But if I just have code that calls these graphics object like so:

playerUIBet.bet()
aiUIBet.bet()
menu.prompt()

Then, if I understand Flash correctly, what'll happen is that the code will finish executing, and then all of those animations will happen simultaneously.

How can I get these animations to happen sequentially? What if I want to insert pauses between them? Some kind of solution like this? What's the best way to do this in AS3?

sentences:
Unity3d and Windows 8 run game in frame How do I set Unity3D to run my game on Windows 8 in a fixed size frame (with a border around it) and not in fullscreen?

I tried setting this in the Unity script and in the final C# project, but nothings seems to work.

I have set the players resolution to 1366x786 (the desired size) and while this works fine with the webplayer the windows 8 solution seems really unimpressed by it. I also tinkered with the 'Default Is Full Screen' option

sentences:
How to change chance of spawn based on distance? I am trying to make a cellular automate cave but want to keep the middle empty.

How should I change the chance based on the distance from the middle?

I don't want to completely deny it just want a small enough chance to keep it almost empty.

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:
Disable global fog from camera Does anyone know how to disable global fog from a particular camera?

I have two cameras in my scene; one is a mini map camera, where I need to disable global fog.

I have checked this answer and the wiki, but have found nothing that works.

sentences:
Configuration management in XNA I come from a .net web background so I am accustomed to using xml .config files.  What is the XNA equivalent?  It seems to me that using the same practice of a xml config leaves your game open to easy modification (which can be good, I know). In my day-life web development the configs live on servers where users can't access.  XNA games live purely on the client (most of the time).

Say I have some values I want in a config, can the config be obfuscated or is there a different configuration management system for XNA?  Is the only solution to hardcode the values back in before release so they are not accessible?

sentences:
Generating objects in Open Worlds using Unity I have an open world (infinite) which is proceduraly generated in chunks.
In this world I want to proceduraly load objects/trees/grass by raycasting them around the player position and unload them when the player is far.

My questions are :

What is the most optimized way of loading/unloading large quantities of objects around a player ?
Since I'd like players to be able to interact/come back to objects, I'm thinking of using a blue noise seed to load objects, and unloading them by replacing them with an empty. Is that common practice ?

I've looked in a lot of places for ressources but couldn't find much, I'd really appreciate any kind of link to tutorials, videos, pseudo-code ideas and common practices for open worlds as I am not very experienced in video game design, but mildly familiar with code.

Thanks !

sentences:
Better way to do AI Behavior in AS3/Flixel I'm making a game in Flixel and I need to program an NPC. It's rapidly turning more complex than I expected. I was wondering if there are any best practices, tutorials or examples that you can refer me to, to see how this is done.

I can probably hack it together, which is what I always do, but it would be nice if I can make it maintanable and can add stuff later on.

Here's screenshot to give you an idea: The butler will be an NPC that will follow you, or guide you, and talk to you the whole time.

EDIT:
More specifically: What I have now is a long list of IF statements in the update loop of the butler (about 8 different cases), and all I have covered is his walking behavior. I want him to comment on things and sometimes switch his main behavior to be more aggresive or distant,... Is there any way to keep track of this, or is complex code with many many nested if statements the way to go?

sentences:
Playing a simple camera animation with Animator I haven't worked with the animation system in Unity before and am getting overwhelmed trying to figure out how to start playback of a simple animation. Yes, this is a "stupid question", but I've spent more than an hour researching this and can't find an answer on how to do something this simple:

I've created an animation called CameraZoom for the scene's camera. The CameraZoom animation is supposed to play when a specific event occurs, so I want to trigger it from script. I've created the animation on the camera, it has the Animator component attached to it, and by default the animation plays as soon as the scene starts. I can stop the animation from code, but when I try to start it, nothing happens. Here's my code:

private Animator myAnimation;
void Start () {
    myAnimation = gameObject.GetComponent<Animator>();
    myAnimation.Stop();
}
public void ZoomOut() {
    Debug.Log("Zoom out!");
    myAnimation.Play("CameraZoom");
}

This script successfully stops the animation when the scene starts, but when I call ZoomOut, the animation doesn't play.

Here are the states:

It may be I'm not understanding how to utilize the state machine and I'm trying to play the animation incorrectly. Tutorials I can find on the Animator are either too vague or discuss other features such as triggers and parameters that I don't know how to apply to such a simple task.

I know I could whip up a Coroutine to zoom the camera out in about 30 seconds, but I'm trying to learn how to utilize the Animator for basic keyframe animations.

sentences:
Scene2d scrollbar not showing even though it exists in uiskin.json/atlas Using uiskin.json, uiskin.png, uiskin.atlas, default.fnt from libgdx tests  I'm trying to make a console window, however the scroll bar is not shown. uiskin atlas contains a two relevat fragments:

default-scroll
  rotate: false
  xy: 78, 29
  size: 20, 20
  split: 2, 2, 2, 2
  orig: 20, 20
  offset: 0, 0
  index: -1
default-round-large
  rotate: false
  xy: 57, 29
  size: 20, 20
  split: 5, 5, 5, 4
  orig: 20, 20
  offset: 0, 0
  index: -1

Which are referenced in uiskin.json

com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: {
    default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-rect, hScroll: default-scroll, vScrollKnob: default-round-large }
}

And this is my console window:

//Skin is above mentioned uiskin.json, png, atlas
Window window = new Window("CONSOLE", skin);
window.padTop(20f);
window.setWidth(500f);
window.setHeight(250f);
window.setMovable(true);
window.setModal(true);
window.setResizable(true);
window.defaults().expand().fill();

Label consoleLog = new Label("TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT" +
                             "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT", skin)

consoleLog.setWrap(true);
ScrollPane scrollPane = new ScrollPane(consoleLog);
window.add(scrollPane);
window.row();
window.add(new TextField("", skin));

When I run this, I get a window with a label and a textfield, and I can scroll the label using mouse scroll or by dragging the text, but the scrollbar is not visible.

what am I doing wrong?

sentences:
OpenGL Depth Buffer/Coordinate issue with SFML For some reason, my coordinate system in OpenGL is getting all messed up with depth.  When I put something more than 1 unit away from zero (in terms of the Z coordinate), I can't see the object.  Furthermore, it seems as if the GL coordinate (-1, -1, 0) is in the lower left corner no matter what I do (and (1, 1, 0) is upper right).  I've used OpenGL in Java and in C++ with GLUT before and am now trying out SFML, and haven't had these issues before, so maybe someone can tell me what I'm doing wrong?

A minimal example as best I can do:

#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>

#include <iostream>

int main()
{
    sf::ContextSettings settings;
    sf::RenderWindow window(sf::VideoMode(800, 600), "OpenGL Test", sf::Style::Default, sf::ContextSettings(24));

    settings = window.getSettings();

    std::cout << "depth bits:" << settings.depthBits << std::endl;
    std::cout << "stencil bits:" << settings.stencilBits << std::endl;
    std::cout << "antialiasing level:" << settings.antialiasingLevel << std::endl;
    std::cout << "version:" << settings.majorVersion << "." << settings.minorVersion << std::endl;

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);    // Black Background
    glDepthRange(-1, 1000);

    // run the main loop
    bool running = true;
    while (running)
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                // end the program
                running = false;
            }
            else if (event.type == sf::Event::Resized)
            {
                // adjust the viewport when the window is resized
                glViewport(0, 0, event.size.width, event.size.height);
            }
        }
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glLoadIdentity();

        // Comment this line to fix it!!?
        glTranslatef(-1.5f,0.0f,-6.0f);

        glBegin(GL_TRIANGLES);                      // Drawing Using Triangles
            glVertex3f( 0.0f, 1.0f, 0.0f);              // Top
            glVertex3f(-1.0f,-1.0f, 0.0f);              // Bottom Left
            glVertex3f( 1.0f,-1.0f, 0.0f);              // Bottom Right
        glEnd();                            // Finished Drawing The Triangle

        window.display();
    }

    return 0;
}

Update:
The glDepthRange() call was to make sure that wasn't the source of the problem.  Also I added the following code to the initialization, and I haven't seen any change in behavior:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, 800, 600);

glMatrixMode(GL_MODELVIEW);
...

Also, I'm using the 2.0RC version of SFML, and my OpenGL version is 4.3 (running on an ATI card).

sentences:
Side scroll game with 8000xScreen_Height, which technique is best I got one new requirement for iOS side scroll game with screen size : 8000xScreen_Height

For this, tileMap is best or normal texture based is best? I need to use parallax background too.

Help me to find right technique.

Thanks in advance.

sentences:
Why does my ship look like it's going backwards instead of fowards? I'm making an Asteroids-clone based on this tutorial. I'm stuck on the 5th part of the tutorial.

For some reason my ship is going backwards instead of forward or it looks like its going forward, but in the tutorial the ship gos toward the asteroid.
In the debug log, the z axis increments in a positive value. so I assume it is going forward but for some reason the ship it self doesnt go towards the asteroid like it does in the tutorial. The ship itself is an fbx export from Maya 2014.

Here's an annotated screenshot:

Full size version

It's probably something really stupid, but I just can't figure out why this is happening.

sentences:
Steering evaluate fitness I've made a simple game with a steering model that manage a crowd of agents. I use an genetic algorithm to find the best parameters to use in my system but I need to determine a fitness for each simulation.
I know it's something like that:

number of collisions * time to reach goal * effort

But I don't know how to calculate the effort, is there a special way to do that ?

Here is what I've done so far:

// Evaluate the distance from agents to goal
Real totalDistance(0.0);
for (unsigned i=0; i<_agents.size(); i++)
{
    totalDistance += _agents[i]->position().distance(_agents[i]->_goal->position());
}

Real totalWallsCollision(0.0);
for (unsigned i=0; i<_agents.size(); i++)
{
    for (unsigned j=0; j<walls.size(); j++)
    {
        if ( walls[j]->inside(_agents[i]->position()) )
        {
            totalCollision += 1.0;
        }
    }
}

return totalDistance + totalWallsCollision;

Thanks for your help.

sentences:
libgdx custom shape overlap detecting I'm writing my game on libgdx w/o any of those extensions like box2d and whatsoever. But right now I'm forcing problem with overlapping detection. I need to detect if bullet (which is always in different degree) overlapped my rocket. At first I was using Rectangle, but it sometimes is giving me false overlap.

I have visualized it.

How it is now:

My goal:

as you see I also want to make bullets rectangle rotated so it was more accurate. And as I said earlier I need to detect collision/overlapping between these polygons. Do I need to use that box2d extension??? Because right now I've written working prototype entirely w/o it.

sentences:
How does one make games playable before they are fully downloaded? Diablo 3 and StarCraft 2 have a nice feature: I can start playing before the full game or update has finished downloading.

I guess Diablo 3 downloads mandatory files like like UI assets and some meshes and textures that are used across several levels first. However, when starting a game, I can choose any level I want, assuming I have appropriate saves. I never experienced any lag from such when playing—starting is always very smooth.

How does this work? How could I implement a similar feature?

sentences:
How to properly activate trigger objects? I have made a flying cat that follows the player, but I want the cat to be a separate object. Cat is following the player and as soon as it sees a collectible it grabs it for the player and then returns following our player. I have it working, but I need the cat to be a different object, it only triggers properly when it's a child of the player object. I have made two scripts for the cat, one for detection, following, flying and the other for destruction of collectibles.

AI script

void OnTriggerStay2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {
        //Destroy(col.gameObject, 1F);
        if(positionList.Count <= 0){
        positionList.Add(col.transform.position);
        timerDelay = 1F;
        mustReturn = false;
        }
    }
}

void OnTriggerEnter2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {
        positionList.Add(col.transform.position);
        timerDelay = 1F;
        mustReturn = false;
    }

}
void Update () {

    if (mustReturn) {
    //  positionList.RemoveAt(0);
        transform.position = Vector3.MoveTowards (
            transform.position, player.transform.position, Time.deltaTime * speed);

    }

    if (timerDelay > 0) {
        timerDelay-= Time.deltaTime;
        idleDelay = 0;

        if(positionList.Count > 0) {
        foreach (Vector3 nextPos in positionList)
        {
            transform.position = Vector3.MoveTowards (
            transform.position, nextPos, Time.deltaTime * speed);

        }
    }

}

    if (timerDelay <= 0) {

        if(positionList.Count > 0) {
            positionList.Clear();
            timerDelay = 1F;
        }

        if(positionList.Count <= 0)
        mustReturn = true;
    }

    if (idleDelay >= 3F) {
        idleAnimation();
    }

    /*Debug.Log ("pos count is " + positionList.Count);

    if(timerDelay > 0)
        Debug.Log ("delay is " + timerDelay);*/

    idleDelay += Time.deltaTime;

}

void idleAnimation(){

}

void OnTriggerExit2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {
        mustReturn = true;
    }
}

Destruction class

void OnTriggerStay2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {
        Destroy (col.gameObject, 0.5F);
    }
}

void OnTriggerEnter2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {

    }

}
void OnTriggerExit2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {

    }
}

Question: Why won't the cat function on it's own???

Collectibles DO have that tag, and they DO have a Box Collider 2D along with a 'Trigger: true'

Cat:

sentences:
References about Game Engine Architecture in AAA Games Last weeks I focused on game engine architecture and learned a lot about different approaches like component based, data driven, and so on. I used them in test applications and understand their intention but none of them looks like the holy grail.

So I wonder how major games in the industry ("AAA Games") solve different architecture problems. But I noticed that there are barely references about game engine architecture out there.

Do you know any resources of game engine architecture of major game titles like Battlefield, Call of Duty, Crysis, Skyrim, and so on? Doesn't matter if it is an article of a game developer or a wiki page or an entire book.

I read this related popular question: Good resources for learning about game architecture? But it is focused on learning books rather than approaches in the industry.

Hopefully the breadth of our community can carry together certain useful informations! Thanks a lot!

Edit: This question is focused but not restricted to first person games.

sentences:
Can you move items made in the Skyrim Creation Kit on PC to the Xbox version? I'm a pretty technically illiterate gamer but after several annoying glitches I finally went out and got the PC version of Skyrim. After a little bit of practice I got the hang of transferring my Xbox 360 saves to the PC and vice versa. I've really been enjoying using the console commands and lately after fixing the crashes associated with the DLC have begun to explore the Creation Kit.

I've created several items with custom weight, value, armor rating and multiple custom enchantments. I'd really like to use them on the Xbox, and I know some people will just say to play it on the PC but I just don't enjoy using the keyboard compared to my controller and flat screen TV.

I haven't changed the mesh, design or texture of any of the items just their names and enchantments. Considering Bethesda said they used the Creation Kit to make the game I don't think my custom items are anything the Xbox can't handle. To me it seems like just a matter of getting them over there... Can I do that?

If you know of a video that will show how, that would be awesome. It should be mentioned I'm not willing to do anything to void my Xbox's warranty.

sentences:
What's wrong with this OpenGL model picking code? I am making simple model viewer using OpenGL. When I want to pick an object OpenGL returns nothing or an object that is in another place.

This is my code:

GLuint buff[1024] = {0};
GLint hits,view[4];

glSelectBuffer(1024,buff);
glGetIntegerv(GL_VIEWPORT, view);

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(x,y,1.0,1.0,view);
gluPerspective(45,(float)view[2]/(float)view[4],1.0,1500.0);

glMatrixMode(GL_MODELVIEW);
glRenderMode(GL_SELECT);

glLoadIdentity();
//I make the same transformations for normal render
glTranslatef(0, 0, -zoom);
glMultMatrixf(transform.M);
glInitNames();
glPushName(-1);
for(int j=0;j<allNodes.size();j++)
{
    glLoadName(allNodes.at(j)->id);
    allNodes.at(j)->Draw(textures);
}
glPopName();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
hits = glRenderMode(GL_RENDER);

sentences:
Unity: Implementing Fall with Animation I have a character controller.  I am primarily using FSM with the animations and blends.  However, I am running into some trouble with the fall.

I walk up to a ledge and walk off...sometimes I will make it off the edge and the falling animation will play...but sometimes I get stuck halfway off the edge.

Also, the falling animation completely disregards any motion vectors I had prior to transferring to the falling state.

Is there a way to transition to fall, retaining the current x-y velocities?

In an effort to fix this, I tried giving the attached rigidbody a force vector slightly up and in the direction of travel so that the character gets a little hop over the edge...but again, no luck.

sentences:
fish tank water distortion Shader for unity I am working on unity and trying to make a fish tank water distortion Shader effect with the following requirement:

1.its a 2D top down prospective.

2.every object under/in the fish tank has to be distorted, game objects might pass trough/under the fish tank (distortion) and game object might pass over the fish tank (no distortion) as well.

3.the fish tank does not follow the main camera.

I try to search online and most of the solution I get is to apply the shader to an object or to the main camera which will not meet requirement 3 or 2, can someone give me an ideal on what is the best way to deal with this ? I am working on a mobile game so the solution has to be light weighted on processing power. Many thanks !

sentences:
Assimp renders a partial amount of vertices I'm building a 3D game, and i'm trying to load some assets with the nice Assimp library. The model should look like the one in the first picture, but instead, it takes the form of some kind of avant-garde sculpture, as the second picture shows.

At least i'm proud that i get to see something, but hey, i can do better.

It's not a problem with shaders (it simply isn't, i pass no normals and no textures, just the vertex coordinate, since i set a static colour). Here is my code:

MODEL LOADING (only vertex coordinates)

void Mesh::open(const std::string file)
{
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(file, aiProcess_Triangulate);
if(!scene)
    throw STREAM("Could open mesh '" << file << "'!");

std::vector<float> g_vp;
count = 0;

for(uint m_i = 0; m_i < scene->mNumMeshes; m_i++)
{
    const aiMesh* mesh = scene->mMeshes[0];
    g_vp.reserve(3 * mesh->mNumVertices);
    count += mesh->mNumVertices;

    for(uint v_i = 0; v_i < mesh->mNumVertices; v_i++)
    {
        if(mesh->HasPositions())
        {
            const aiVector3D* vp = &(mesh->mVertices[v_i]);
            g_vp.push_back(vp->x);
            g_vp.push_back(vp->y);
            g_vp.push_back(vp->z);
        }
    }
}

glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, count * 3 * sizeof(float), &g_vp[0], GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (GLubyte*)NULL);
}

SCENE RENDERING

void renderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

program.use();
program.setUniform("transformMat", modelMat);
glBindBuffer(GL_ARRAY_BUFFER, m.vbo);
glDrawArrays(GL_TRIANGLES, 0, m.count);

SDL_GL_SwapWindow(window->mWin);
}

Depth testing is enabled, and i'm using OpenGL 4.0 with v400 shaders too.

The error will possibly be stupid, but i can't find it, and my head is all boiling at this very moment.

Thanks for your help!

sentences:
How do you get main camera move along a specific route? I've got a scene in the starting  of my project, and what I want to do is to get my main camera move along a specific direction and route.
Let's imagine I've got a 3-Dimensional array which contains The Positions of The points thereon. This is what I want to do :

1-Set the camera position on The first point and then go along with The other points, delay X milliseconds in each point and then go with the rest of it.

2-Whenever I will be able to change any of these parameters inside the script and programmatically:X,Y,Z components of The Position and Rotation of The Transform hierarchical property.

I'm sure enough trying to write an algorithm on my own would be a relatively difficult job, so please give me some tips and if possible a pseudo-code.
And finally I want this script to be launched at the beginning of the scene.

sentences:
Transformed Vertices have wrong Z Axis For quite some time I've been working on my open 3D game engine, to learn how this stuff works. You can see the full codebase relating to my problem here on GitHub.

I'm using an OpenGL 3.3 Core Profile Context on Mac OS X 10.10.3 and a GeForce GTX 760, if this matters.

Everything seems to work fine when submitting my vertices and MVP matrix to the Pipeline. But at two different points I try to transform vertices on my CPU, which leads to problems.

To simplify rendering the debug bounding boxes in a single frame, I transform the vertices by their MVP matrix and later submit them all to OpenGL with an identity matrix as transformation matrix:

for (auto& c : corner) {
    glm::vec4 t = VP * glm::vec4(c, 1.0f);
    vertices.emplace_back(glm::vec3(t) / t.w);
}
// ...
Shader::drawGL(vertices, colorsLine, indicesLine, glm::mat4(1.0f), gl::GL_LINES);

Most of the time, this seems to work fine. But when some vertices of a bounding box lie behind the camera, they will be "mirrored" and extend into empty space, as you can see in this screenshot:

Something similar happens with my portal based rendering approach, as described in Portals and Mirrors: Simple, Fast Evaluation of Potentially Visible Sets. Basically, I'm looking for a visible portal, and then for more portals that are visible through the already found portal. The relevant code:

for (int c = 0; c < 4; c++) {
    glm::vec3 port = portal.getVertex(c);
    glm::vec4 result = VP * glm::vec4(port, 1.0f);
    glm::vec3 vert = glm::vec3(result) / result.w;
    // ...
}

This basically works as expected, as you can see in the following screenshot:

However, as before, there is a problem with vertices behind the camera. I would expect the transformed vertices Z axis to be in the range [0;1] and vertices behind the camera should be outside of that range. What I'm really seeing, however, is that the Z part is always 1, as you can see in this screenshot (the first line is the world vector, the second is the vector multiplied with the matrix, the third is the multiplied vector divided by w):

To give you the full picture, this is how I create my projection matrix:

projection = glm::perspective(45.0f, size.x / size.y, 0.1f, 75000.0f);

And my view matrix is created using the quaternion of my camera:

glm::mat4 translate = glm::translate(glm::mat4(1.0f), pos);
glm::mat4 rotate = glm::toMat4(quaternion);
view = glm::inverse(translate * rotate);

According to every description I've read of the OpenGL transformation pipeline, I've done everything to have my world coordinates now in clipping space. But, looking at the Z axis, this seems to be false. I'm sure I'm missing something obvious with my math here.

Please help me out :)

Best Regards,
Thomas

PS: English is not my native language, please excuse any mistakes.

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:
Using SurfaceFormat.Single and HLSL for GPGPU with XNA I'm trying to implement a so-called ping-pong technique in XNA; you basically have two RenderTarget2D A and B and at each iteration you use one as texture and the other as target - and vice versa - for a quad rendered through an HLSL pixel shader.

step1: A--PS-->B
step2: B--PS-->A
step3: A--PS-->B

...

In my setup, both RenderTargets are SurfaceFormat.Single.

In my .fx file, I have a tachnique to do the update, and another to render the "current buffer" to the screen.

Before starting the "ping-pong", buffer A is filled with test data with SetData<float>(float[]) function: this seems to work properly, because if I render a quad on the screen through the "Draw" pixel shader, i do see the test data being correctly rendered.

However, if i do update buffer B, something does not function proerly and the next rendering to screen will be all black.

For debug purposes, i replaced the "Update" HLSL pixel shader with one that should simply copy buffer A into B (or B into A depending on which among "ping" and "pong" phases we are...).
From some examples i found on the net, i see that in order to correctly fetch a float value from a texture sampler from HLSL code, i should only need to care for the red channel.

So, basically the debug "Update" HLSL function is:

float4 ComputePS(float2 inPos  : TEXCOORD0) : COLOR0
{
  float v1 = tex2D(bufSampler, inPos.xy).r;
  return float4(v1,0,0,1);
}

which still doesn't work and results in a all-zeroes ouput.
Here's the "Draw" function that seems to properly display initial data:

float4 DrawPS(float2 inPos  : TEXCOORD0) : COLOR0
{
  float v1 = tex2D(bufSampler, inPos.xy).r;
  return float4(v1,v1,v1,1);
}

Now: playing around with HLSL doesn't change anything, so maybe I'm missing something on the c# side of this, so here's the infamous Update() function:

_effect.Parameters["bufTexture"].SetValue(buf[_currentBuf]);
_graphicsDevice.SetRenderTarget(buf[1 - _currentBuf]);
_graphicsDevice.Clear(Color.Black); // probably not needed since RenderTargetUsage is DiscardContents
_effect.CurrentTechnique = _computeTechnique;
_computeTechnique.Passes[0].Apply();
_quadRender.Render();
_graphicsDevice.SetRenderTarget(null);
_currentBuf = 1 - _currentBuf;

Any clue?

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:
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:
Why don't we use octogonal maps instead of hexagonal maps? I understand the advantage of hexagonal tiles over square ones. But why aren't octagons used instead? I would think they would provide better, more natural movement in eight directions.

I was thinking about using that kind of map in some game, but I haven't seen any games using it, so I wonder if I missed something obviously flawed about using it?

sentences:
OpenGL GL_TRIANGLE_STRIP creating grid with degenerate triangles / for one draw call I need to create a grid ready for GL_TRIANGLE_STRIP rendering with One drawcall - so i need to degenerate the triangles.

I am almost there but missing last row/column and can't figure out why.

My grid is just a :

Position ( self explanatory )
Size ( the x,y size )
Resolution ( the spacing between each vertex in x,y )

Here is the method used to create verts/indices and return them:

int iCols = vSize.x / vResolution.x;
int iRows = vSize.y / vResolution.y;

// Create Vertices
for(int y = 0; y <= iRows; y ++)
{
    for(int x = 0; x <= iCols; x ++)
    {
        float startu  = (float)x / (float)vSize.x;
        float startv  = (float)y / (float)vSize.y;

        tControlVertex.Color    = vColor;
        tControlVertex.Position = CVector3(x * vResolution.x,y * vResolution.y,0);
        tControlVertex.TexCoord = CVector2(startu, startv - 1.0 );

        vMeshVertices.push_back(tControlVertex);
    }
}

// Create Indices
rIndices.clear();

for (int r = 0; r < iRows - 1; r++)
{
    rIndices.push_back(r*iCols);

    for (int c = 0; c < iCols; c++)
    {
        rIndices.push_back(r*iCols+c);
        rIndices.push_back((r+1)*iCols+c);
    }
    rIndices.push_back((r + 1) * iCols + (iCols - 1));
}

And to visualise that, few examples first.

1) Size 512x512 Resolution 64x64, so it should be made of 8 x 8 quads, but i get 7x7 only

2) Size 512x512 Resolution 128x128, so it should be made of 4 x 4 quads, but i get 3x3 only

3) Size 128x128 Resolution 8x8 so it should be made of 16 x 16 quads but i get 15x15 only

So as you can see, i am missing the Last Row and Last Column somewhere.  Where am I going wrong?

sentences:
Why would somebody want to turn off v-sync? From this recent article about technical limitations of UWP, I've found inability to turn off v-sync listed as a negative point.

I understand lowering graphics settings like texture quality, various effects and changing resolution, which very noticeably affect framerate and resource consumption, but vertical synchronization doesn't seem to do any harm.

From what I know, it only removes image tearing, and as a side-effect may result in displayed framerate change from 60 to 59 (or max_fps-1) in some games due to faulty framerate counting algorithm, which some users may see as literally unplayable. From my experience, in game streams with low framerate, disabled v-sync shows as a lot of tearing frames and disgruntled viewers.

Are there any advantages to disabling v-sync? Does it cost anything performance-wise to worry about?

sentences:
Dynamic game configuration I am not sure how that systems type called, so I try to describe what we want and it will be great if someone can advise…

We have online game with client/server architecture. The game has some configs and this configs must be available for change. Simple example is that we have monster_id 10 with attack_power 15 and our game designers while trying to improve balance, changed attack_power value to 14, so next time, when clients load game, they also load Monster config and monster with id 10 have attack_power 14.

For now, we use Google Sheets as configs “frontend”. We add some custom scripts that allow load this sheet as json on our backend that will compress it, update revision and store in our DB. And when game client booted, backend sends this compressed configs from DB. But the problem is that architecture lack off functionality… I mean, that is hard to ever add simple validation for some rows of sheets, because we need to use google macros and they (as I know) even don`t allow to load external js libraries…

Ofc we can write our backend&frontend for this, but I think that it is as making a bicycle… So, my question is there any system that work with “dynamic configuration” as described above and allow users to customize it, write extension etc.?

sentences:
Does each game asset always require a prefix such as 'spr' or 'obj' in their name? Having started only recently with using GameMaker for game development (keep in mind that this is the first time in a long while that I'm doing something like this, so I'm technically at beginner level), I've lately been thinking about something that seems to be common place throughout creating a game with the software.

Through all the tutorials I've been through so far in GameMaker:Studio, I've noticed that the tutorials seem to want the names of game assets to always have a prefix in their names depending on what the game asset is, usually something like spr_ for sprites or obj_ for objects.

I've never exactly liked this sort of naming method, but I don't know whether or not to keep doing this or to just avoid using the prefix entirely. Does the engine require these prefixes for a game to compile or something?

Are these prefixes necessary?

sentences:
XNA, SpriteBatch: Slow when rendering lots of sprites? I've just now tested rendering a lot of sprites using XNA's SpriteBatch class. What I basically do is this:

Somewhere in the code, I have a list which contains all sprites that have to be rendered. I prefilled this list with 2500 Sprites, all of which have the same rotational angle, texture, position etc.

I then draw them like this:

    spriteBatch.Begin();
    foreach (Sprite spr in sprites)
        spriteBatch.Draw(spr.Texture, spr.Position+spr.Center, spr.SourceRect, spr.Color,MathHelper.ToRadians( spr.Rotation ), spr.Center, spr.Scale, SpriteEffects.None, spr.Depth);

    spriteBatch.End();

and I'm getting really poor performance. I only average about 15FPS with my Radeon HD 6850 graphics card and i5 2500k CPU.

This is very surprising to me, since I average about 70 FPS doing exactly the same thing with my own custom OpenGL engine, which uses old OpenGL rendering (meaning one draw call for every single sprite). I actually expected XNAs rendering to be a ton faster, since it draws everything in one draw call.

Am I rendering this the wrong way? Playing around with SpriteSortMode settings has made almost no difference, some of them just make it a tiny bit slower (depth sorting etc.).

sentences:
How do I fix these touch events? Events respond if there are 2 fingers but not 1 I am making a simple game of mine mobile-friendly.

The goal is to:

Make character walk if a touchstart event is sensed on right half of screen.
Stop character if a touchend event is sensed on the right half.
Jump the character if a touchend event happens on the left half of the screen.

I have the logic working perfectly for mouse up and down events so I'm pretty sure it's something to do inside the touchstart and end functions.

If two fingers are used as one press it seems to work fine.

If only one finger is used it doesn't work properly: touching anywhere starts the movement but nothing will stop it.

Here is the code for the touch inputs and associated function:

CheckWhichScreenHalf = function(e) {

    loc = WindowToCanvas(e.pageX, e.pageY);
    onScreenY = loc.y >= 0 && loc.y <= gameCanvas.height;
    leftSideX = loc.x >= 0 && loc.x < gameCanvas.width/2;
    rightSideX = loc.x > gameCanvas.width/2 && loc.x <= gameCanvas.width;
    if (onScreenY && leftSideX){
        return 'left';
    }
    else if (onScreenY && rightSideX){
        return 'right';
    }
    else return 'neither';
};

TouchMove = false;
TouchJump = false;

gameCanvas.ontouchstart = function(e){

    if (imagesHaveBeenLoaded) {
        e.preventDefault();
        for (var i = 0; i < e.touches.length; i++){
            var side = CheckWhichScreenHalf(e.touches.item(i));
            if (side === 'right'){
                TouchMove = true;
            }
        }
    }
}
gameCanvas.ontouchend = function(e){

    if (imagesHaveBeenLoaded) {
        e.preventDefault();
        for (var i = 0; i < e.touches.length; i++){
            var side = CheckWhichScreenHalf(e.touches.item(i));
            if (side === 'right'){
                TouchMove = false;
            }
            else if (side === 'left'){
                playerJumping = true;
            }
        }
    }
}

The game can be played here: http://webstudentwork.com/jgossling/MMWD/mp2/mp2.html

sentences:
Can't parent the standard FPSController during gameplay I'm parenting the standard assets FPS controller during play with a simple script. The controller get's parented but also instantly inherits the rotation of the parent. This doesn't happen in Editor mode. This incorrect behavior happens regardless if I move the player with a script or by parenting him with my mouse cursor.

I suspect the error comes from the way the character controller script is set up.

In the FPS controller script the player rotates via mouse movement in the Update function in the following way:

private void Update()
{
    RotateView();
}

private void RotateView()
{
    m_MouseLook.LookRotation (transform, m_Camera.transform);
}

m_MouseLook get's its rotation from m_Camera.transform. It in turn uses transform.localPosition.

I think it's the use of localposition that causes the strange behavior.

How do I fix it?

I added the script that I used to re-parent the fps controller below:

    public Transform ParentTarget;
    public GameObject player;

     void OnTriggerEnter(Collider other)
    {
        player.transform.SetParent(ParentTarget, true);
    }

     void OnTriggerExit(Collider other)
    {
        player.transform.parent = null;
    }

As I said the script is fairly simple and the same error happens when I re-parent the controller by dragging it with my mouse during play.

If I set worldPositionStays to false then the player is offset and doesn't inherit the parent rotations at all. This isn't what I want.

Here is my scene before the player steps unto the trigger. The red box is the trigger. The blue box is the new parent (the parent is rotated 45 degrees)

Here is the original incorrect behavior. The player is instantly rotated 45 degrees as he steps unto the trigger. This is wrong

Here is the behavior when worldPositionStays is set to false. Rotating the parent has no effect. This is wrong.

The desired behavior is to keep the player rotation, and then change it as the parent is rotating after the re-parenting event. This is what would happen if I re-parented any ordinary GameObject.

It is the character controller mouse look part that is most likely causing all the trouble.

I suspect I have to abandon the re-parenting solution and simply add the transforms to the camera mouse look part of the character controller script.

I would be very grateful is someone more knowledgeable would help me out with achieving this. Hopefully by getting re-parenting to work, since it is simpler, and simplicity is always king. I would settle for help with writing a script to add rotations and positions correctly to the controller.

sentences:
Exclude a certain folder from Unity? I work with a small team of three people, and we use the collaborate service within Unity to share our progress. One of the folders we have inside our Unity project is an "OffGame" folder, which includes a tool I created specifically to help with the creation of certain assets. It's not actually supposed to be part of the game, but since I'm often making changes to it, I figured I'd include it in the Unity project. The Unity project temporarily makes use of certain files inside said OffGame folder, however, once the game is done, those files will be moved outside of that folder and integrated into the game proper.

Since that OffGame folder is not supposed to be part of the game and I only included it there to share it to my teammates over the collaborate service, I don't want it to be treated like a normal folder for the game. Specifically, I don't want Unity to create a bunch of useless meta files for each file in that folder, or to act like a stray .js file in there is part of the project. I actually got compile errors because Unity kept thinking it had to include all the .js files in that folder.

How can I make Unity ignore that folder?

sentences:
Make LibGDX game responsive to different phone screen sizes? I've been experimenting with small games to learn design concepts, LibGDX, and Box2D. I am wondering how you would implement "responsiveness," so to say. For example, this is the rendering part of my game and its just drawing to coordinates. https://github.com/Elsealabs/Stacker/blob/master/com/elsealabs/stacker/ScreenGame.java

For example I'd like it to look good on Android phones of different resolutions or if the user resizes it on desktop. I am asking about design patterns or practices that would make this possible. Any solutions I can think of seem like they wouldn't scale or would over-complicate the game.

If you know of any articles or design practices that cover this topic, or have any of your own knowledge, or example LibGDX/Java games, I'd love to see them.

sentences:
How can I test if the mouse draw on the active tiles? I want to draw some sprites in a tiledmap where the tiles are active.
I want to draw with the mouse, so how could I compare the position of the mouse, the sprite position and the position of active tiles?
I tried to compare:
sprite.getX, screenX and cell.getTile (). getProperties (). containsKey ("active")
but I can not get the position of the active tiles.

sentences:
How would one approach developing an AI for a trading card game How would one approach developing an AI for a trading card game(e.g. Magic The Gathering, YuGiOh, etc.)?

I'm not sure where to even begin. How would "Easy", "Normal", and "Hard" AI difficulties differ under the hood?

sentences:
I love game development books but they're so expensive! What means do you use to get your game dev book fix? Do you pony up the big bucks for the thick books, or do you budget yourself and buy one at a time, or do you rent or limit yourself only to your library? Do you prefer to read them on your eBook reader?

How do you obtain your game development books?

sentences:
How do I draw text using DirectX 12? I'm currently tasked with porting a control from Direct 11 to DirectX 12.

How do I draw text on the screen?

How do I draw any 2D on a DirectX 12 device?

Current Text rendering code is below:

using (var textFormat = new TextFormat(device2DManager.DirectWriteFactory, string.IsNullOrEmpty(text.FontName) ? FontName : text.FontName, text.FontSize == 0 ? FontSize : text.FontSize))
                {
renderTarget.DrawText(text.Text, textFormat,
                            new RawRectangleF(autoPosition.HasValue ? autoPoint.X : text.Location.X, autoPosition.HasValue ? autoPoint.Y : text.Location.Y,
                                renderTarget.Size.Width, renderTarget.Size.Height),
                            foreColor);
}

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:
What are some alternative options for saving level data for a game like Hurtworld? For a multiplayer building/crafting game like Hurtworld (where the player can build structures on the map), what are some alternative options or example data structures for saving the world data on the server?

Level data including:

Grid of squares that foundations can be built on, with a flag to indicate whether the square is empty or already has a foundation
Walls etc which have been built on the foundations, and multiple floors above
Windows/doors which can be built on window frames/door frames
Furniture/machines which can be placed on foundations/floors
Other dynamic world data such as trees, animals, chests with items, etc

I feel like it's too much data to store in a database. Am I wrong?

If it can be stored in a database, how can I get my head around the data structure I would need to set up? Is there some simplified example?

Can each square in the world grid be represented by 1 row in the database? And should there be a new row for each structure built on a square, with that row referencing the square/structure that it was built on?

sentences:
How to calculate the magnitude of the drag in Corona-sdk? I'm making a game on Corona that launches a ball.

The force is based on the magnitude of the drag: the larger is the drag -> the higher is the force.

I'm having some trouble to do this, because I can't calculate the magnitude of the drag.

I tried a simple (finalX - initialX) but that's not a good idea.

local function onTouch(event)

    if "began" == event.phase then

    end
    if "ended" == event.phase then
        local finalX = event.x
        local finalY = event.y

        forceX = event.x - event.xStart
        forceY = event.y - event.yStart

        print(forceX, forceY)

    end
end

local function gameComponents()
    local crate = display.newImageRect( "images/sonic.png", 90, 90 )
    crate.x, crate.y = 60, 360
    crate.rotation = 0
    --physics.addBody( crate, "static", { friction=0.3} )

    Runtime:addEventListener( "touch", onTouch )
    return crate

end

local Game = {}
Game.new = gameComponents
return Game

sentences:
Avoiding overlapping UI Images When an enemy dies in my game, it drops an item on the ground. Enemies may drop multiple items. Currently, the item will always drop a set distance directly below the origin of the enemy when it dies. Therefore, if multiple items are dropped, I only see the most recently dropped item on the ground. Moreover, each item has a UI label clamped to some offset distance above the item. As such, I only see the UI label of the "most recently" dropped item. Because every item dropped by an enemy drops at the same physical location, and because I haven't added code to deal with this kind of thing, the physical game objects overlap with each other and the UI labels of those items overlap with each other.

My question is pretty general. What are the best ways to modify my code such that

1) If multiple items are dropped, there will appear to be multiple game objects on the ground (Close enough to the origin)?

2) The UI labels attached to each item will appear as close as possible to that item without overlapping with the other items' UI labels?

I would appreciate direct assistance or references that deal with this kind of thing. Thanks.

sentences:
MVC-like compartmentalization in games? I was contemplating the design of a game (translating a boardgame to the computer, specifically, which I suppose is relevant in this case) and it occurred to me that it might make sense to build the 'game' separate from the 'display.'

It would allow me to prototype something quickly with a simple text interface, and then go pretty it up later. It would also let me port the game to other media more easily.

Is this sort of compartmentalization common in games? Should I try to break things down further? Are there complications I might be missing?

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: How Do Objects Not Clip Out the Back of Thin Walls When Put Through a Portal? In Portal or Portal 2, let's say you pick up a cube and put it most of the way through a portal on a very thin wall. The cube should clip outside the backside of the wall. How does Portal do this, or how can this be done in general?

sentences: 2D character movement My character moves right and left correctly, I want to know if it is possible to move character forward and backward to collect hearts   (I know that in 2d no z axis I want to know if it is possible or not? )

sentences:
Fade into scene in Unity / SteamVR I am using this code below for a gradual fade into a scene/next level in Steam VR (HTC Vive)
The whole idea is to cover up the scene loading icon which is viewable for 3-4 seconds, and the default Steam landscape scene. The fade (to red) works fine…BUT it comes in after the loading icon so this defeats the whole purpose of it. Is there any simple way to fix this? thanks

public class NewFade : MonoBehaviour {

private float _fadeDuration = 4f;

private void Start()
{
    FadeFromWhite();
}

private void FadeFromWhite()
{
    //set start color
    SteamVR_Fade.View(Color.red, 0f);
    //set and start fade to
    SteamVR_Fade.View(Color.clear, _fadeDuration);
}

}

sentences:
Retreive 3d World Map coordinates from touch/click input with LIBGDX? Problem: I am trying to create an RTS style interaction. I want to be able to click on the map and have characters move to the click location. I haven't been able to figure this out, even after reveiwing tutorials from the one and only xoppa and several other's inqueries on the same concept. Other's seem to be happy utilizing collision with a near or far plane or a basic collision shape. However, I have a map with variations in height. I can't tell if I'm not creating my complex collision shape correctly or I'm just making things more complicated than need be. The code I think is relevelvant is as follows.

A model is loaded from a G3DB scene in the exact same manner of xoppa loading a 3d scene tutorial. After loading, I call the following method in my ModelInstance class.

private Array<Mesh> modMesh = new Array<~>();
public void createShape() {
    modMesh = model.meshes;
}

When a user clicks the mouse or taps the touch screen, I call this method to check collision of the ray from the camera to presumably the part of the map we were trying to touch.

public Vector3 checkSelection(Ray ray) {
    Vector3 intersection = new Vector3();
    for(int i = 0; i < modMesh.size; i++) {
        mesh = modMesh.get(i);
        float[] v = new float[mesh.getNumIndices() * mesh.getNumVertices() * mesh.getVertexSize()];
        short[] ind = new short[(mesh.getNumIndices() * 6 - 6) * (mesh.getNumVertices() - 1)];
        Intersector.intersectRayTriangles(ray, mesh.getVertices(v), ind, mesh.getVertexSize(), intersection);
    }
    return intersection;
}

So, when I run this code, it returns Vector3 values. They seem to be off though. For instance, my camera is looking at point (0,0,0). If I click where (0,0,0) appears on the screen, it will return a value like (-14.56, -18, -85). I imagine I am not creating a proper collision shape for the map. Which again leads to my question. How do I obtain the collision coordinate on a 3D map with variations in height in LibGDX?

Side Note: My intersecting collisions with normal collision shapes work perfectly. This is the reason I'm assuming I am completely wrong in the way I create a collision shape for the map itself. Thank you in advance for any input and assistance offered.

sentences:
Why do we use scripts in development? In my current project, Lua scripts are called by the C++ functions on the server side.
After that, the scripts again call the C++ functions still in that solution.
Why should we do such things and not call the C++ function directly?
What are the situations in which scripts are needed?

sentences:
How do I get the correct values from glReadPixels in OpenGL 3.0? I'm currently trying to Implement mouse selection into my game editor and I ran into a little problem when I look at the values stored in &pixel[0],&pixel[1],&pixel[2],&pixel[3]; I get

r: 0
g: 0
b: 0
a: 0

As you can see I'm not able to get the correct values from glReadPixels();

My 3D models are red colored using glColor3f(255,0,0);

I was hoping someone could help me figure this out.

Here is the source code:

  case WM_LBUTTONDOWN:

  {

    GetCursorPos(&pos);
    ScreenToClient(hwnd, &pos);

     GLenum err = glGetError();

     while (glGetError() != GL_NO_ERROR) {cerr << err << endl;}

     glReadPixels(pos.x, SCREEN_HEIGHT - 1 - pos.y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixel[0] );

    cerr << "r: "<< (int)pixel[0] << endl;
    cerr << "g: "<< (int)pixel[1] << endl;
    cerr << "b: "<< (int)pixel[2] << endl;
    cerr << "a: "<< (int)pixel[3] << endl;

    cout << pos.x << endl;
    cout << pos.y << endl;

  }

break;

I use :

WIN32 API
OPENGL 3.0
C++

sentences:
Is it possible to get a Vector3 from a single Input Action in Unity's Input System? I'm trying to implement moving up/down (R/F), left/right (A/D), forwards/backwards (W/S) all at the same time using Unity's new Input System. There is an Action type for Vector3, but there doesn't seem to be a corresponding type for it.

The way movement works right now means that it would be a lot better to get the whole vector at the same time for it to work smoothly. Is there a way to do this with a single Input Action, or will I just need multiple?

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:
Tools for level (wireframe) design We are currently working on a 2D platform game, all lot of the game elements have been created and designed. But now it is time to design all the levels.

What I am wondering is: Are there any tools which simplify level design, we prefer designing in basic wireframes, so no actual graphics yet. It would also be neat if the tool would allow layering specific groups;

Background
Platforms
Enemies

I have thought of tools like Visio or Omnigraffle but these aren't specifically meant for game design.

sentences:
Simple 2D Platformer Collision Detection? I'm relatively new to programming and I am attempting to write a 2d platformer in C++ using the SFML library.

The structure of my code is that I have a Stage class which contains a vector of sf::RectangleShape 's (the stage platforms).  I have a method in the stage class to check for the collision between a player's hitbox and the stage as follows:

bool Stage::checkForStageCollisions(sf::RectangleShape player)
{
    for (unsigned int i = 0; i < collidableObjects.size(); i++)
    {
        if (player.getGlobalBounds().intersects(collidableObjects[i].getGlobalBounds()))
        {
            return true;
        }
    }
    return false;
}

Then in my player class I can perform logic based on whether there was a collision.  The problem is that I need to know which object the player collided with to move them to the appropriate spot.  Am i going about this the wrong way?  Any help would be appreciated.  Thank you!

sentences:
Triggers are not detecting colliders from other game objects in Unity version 5.2.2f1? I was working on a basic slots game, and I came across a hiccup with the 2D Physics engine. Currently I'm letting the reels spin for three seconds. Once it has finished spinning, it will go to the reel stop that the RGN picked out. Also, when it has reached the end of the reel I had it so that reel would "wrap around" to the firs reel stop continuing displaying the stops as it before.

I'm using a edge collider as a trigger on each reel (I'll call it a symbol trigger for short). The symbol trigger is a child of the reel but the actual symbols (which are game objects in screen space) are procedural generated and attached to the actual reel. All the symbols have a rigidbody2D and are kinematic. For some reason the triggers do no respond with on enter, on stay, or on exit, and that is with putting debug logs.

Now I have taken the reels and triggers to and out of world space and screen space, switched from rigidbody2D to 3D along with, messed with the sleep options, and switched it from discreet to continuous and still have get no response from the collider. If anyone knows why this is happening, your insight would be highly  appreciated!

Thanks for reading about my issue and have a good day.

sentences:
OpenGL shader program per shape or model I have a program which imports models from .obj files and then draws them with OpenGL. I have a model which contains many shapes (meshes?). Not every shape has texcoords defined inside .obj file (it looks like 1//1 instead of 1/1/1) and I try to use one shader program which depends on texcoords.

What would be the best solution for that problem? Should I use separate programs for shapes that have texcoords and another for shape without texcoords defined?

Maybe there is a way to check if some attributes were passed to shader program?

This is the gist with .obj, .mtl and shader files, maybe that will help you to understand my problem.

sentences:
Card Masking in Phaser Good Day,
I'm new to Phaser and still learning about it to.
I am challenging my self to create a simple animation of a card flip somewhat realistic
rather that making use of a scale.

This is something that I already started, But having trouble to attain what i need.

See this link http://sopronioli713.github.io/card_masking.

Here is my source code

    <title>Card Masking Flipping Card</title>

sentences:
What is Ogre::String? I was working with the OGRE .NET bindings (MOGRE) for quite a long time. To improve my (not that good) C++ skills, I am switching from C# to C++.

After implementing a basic OGRE application, I was curious why Ogre has it's own String class Ogre::String?
Why is it used and not std:string?

Can/shall I mix these String types and what shall I use in my OGRE application for non-OGRE tasks/methods?

sentences:
Unity3D - Mesh appears black in parts that it shouldn't I have a procedurally-generated mesh that I am generating to use as a terrain. It looks something like this (from above, and it changes slightly every time):

It also looks fine when I view from the z-axis side.

The issue is that when I view it facing the x-axis, it has a black part kind of going through it.

I wouldn't really care about that, but when the player goes into the valley, it seems as if they fall under the black part. They can only see the ground and above them it is all black.

The mesh does have a mesh collider attached, and so the player doesn't fall the way through the mesh - just the "black line". The height of the mesh (on the y-axis) is generated using perlin noise that I multiply by 800 (to increase the waviness), and that is set when I set the vertices. I suspect that this issue has to do with the normals or the uvs not adjusting to the y-axis, but I've messed around with it a lot and nothing seems to help. I currently generate the normals with RecalculateNormals() after I generate the vertices, triangles, and uvs, and calculate the uvs in a for-loop where I take each vertex's x and z axis and divide it by the number of vertices on that axis time the distance between them (to make it between 0 and 1).

sentences:
What is the best way to create a square grid in Unity? So I need to create a square grid like the one below. And be able to click on a square, the square you chose then is filled with a different color as well as all the squares right and below the square you have chose.
My question is what will be the most efficient way to create this grid either in 3D or 2D in Unity.

sentences:
How does Unity Static batch handle submeshes I have the following 2 meshes:

Mesh 1
    Submesh 1 - Mat 1
    Submesh 2 - Mat 2

Mesh 2
    Submesh 3 - Mat 1 (same as mat1 from submesh 1)

Since submesh 1 and 3 have the same material and they are all static, I'd like to render submesh 1 and 3 in a single drawcall. However, Unity is failing to batch those submeshes together.

Is there a way to achieve this?

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:
Determine height on Bresenham line algorithm path I have path from Bresenham line algorithm, example for A->B vector:

Path is [(0,5), (0,4), (1,4), (1,3), (1,2), (1,1), (2,1), (2,0)]. Considering A height is 10 meters, B height is 5 meters and a tree at position 1,1 is 5,5 meters:

How to know if point B is visible from point A ? My real question is: How to know the A->B vector height when it is "above" specific position, so here 1,1 ?

sentences:
Copyright notices on a web game portal I notice that for several games on Kongregate, the copyright notice either uses the author's handle name (login name), the name of the group that produce it or a domain name.

Are all those valid copyright notices?

sentences:
Create cylinder using OpenGL-ES I want to draw cone using OpenGL ES  I have gone through many links to draw cylinder but I don't have any idea or approach to draw the cylinder. I've seen the gluCylinder function for OpenGL, but no equivalent function in OpenGL-ES.

i tried the below code

float radius, halfLength;
int slices;
for(int i=0; i<slices; i++) {
    float theta = ((float)i)*2.0*M_PI;
    float nextTheta = ((float)i+1)*2.0*M_PI;
    glBegin(GL_TRIANGLE_STRIP);
    /*vertex at middle of end */ glVertex3f(0.0, halfLength, 0.0);
    /*vertices at edges of circle*/ glVertex3f(radius*cos(theta),
    halfLength, radius*sin(theta));
    glVertex3f (radius*cos(nextTheta), halfLength, radius*sin(nextTheta));
    /* the same vertices at the bottom of the cylinder*/
    glVertex3f (radius*cos(nextTheta), -halfLength, radius*sin(nextTheta));
    glVertex3f(radius*cos(theta), -halfLength, radius*sin(theta));
    glVertex3f(0.0, -halfLength, 0.0);
    glEnd();
}

sentences:
Where does game logic belong? I've always had a hard time wrapping my head around the 'high levels' of game logic and where/how large components, such as collision detection/physics, rendering, and user input, interact with one another. What I'm asking is how you deal with these higher level interactions.

Here is what I am doing:

interface Stage() { //or a "scene" as many call it. Manages the logic for Actors
   init()
   update() //update this stage
   render() //render this stage
}

StageManager() implements Stage { //a stage that manages stages :)
   var stages = array<Stage>
   init() //create a MainStage & other stages that may be used in this specific game
   update() //logic for checking which stage should be active
   render() //tell the active stage to render
   getActiveStage()
}

MainStage() implements Stage {
   var mainCharacter
   var actors = array<GameObject>
   var ...
   init()   //create the player, game world, other initialization stuff
   update() //collision detection, check mainCharacter state, etc
   render() //render all the Actors on this stage
   handleMouseClick()
   handleKeyBoardEvent()
}

Main() { //created on game start
   var manager = new StageManager()
   updateGameState() {
      manager.update()
      loop
   }

   renderState() {
      manager.render()
      loop
   }

My main gripe with this is that the StageManager and all other Stages will become enormous and unwieldy as the game scales over time. Off the top of my head, some components can be delegated out such as a Stage uses a PhysicsManager, but there would still be all the keyboard events and what not.

I was thinking of making individual Actors listen to events and giving them an update() method, thus encapsulating what an Actor should do at any given point. However, I would run into complications when an Actor needed game-state information (game time, a "power-up" Actor needing the player's speed) and I would no longer have Stages as Actors are now managing themselves.

sentences:
Error binding indices to device context [ STATE_SETTING ERROR #241: IASETINDEXBUFFER_INVALIDBUFFER] This is how i initialized the D3D11_BUFFER_DESC for my indices. When i go to bound it to the deviceContext i get this error.

D3D11 ERROR: ID3D11DeviceContext::IASetIndexBuffer: The Buffer trying to be bound as an IndexBuffer did not have the appropriate bind flag set at creation time to allow the Buffer to be bound as an IndexBuffer. [ STATE_SETTING ERROR #241: IASETINDEXBUFFER_INVALIDBUFFER]

And is kinda of strange becouse i setted the bindFlags to "D3D11_BIND_INDEX_BUFFER"

   D3D11_BUFFER_DESC buffDescIndices;

    ZeroMemory(&buffDescIndices, sizeof(D3D11_BUFFER_DESC));
    buffDescIndices.MiscFlags = 0;
    bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
    buffDescIndices.Usage = D3D11_USAGE_DEFAULT;
    buffDescIndices.ByteWidth = sizeof(UINT) * ARRAYSIZE(indices);
    buffDescIndices.StructureByteStride = 0;
    buffDescIndices.CPUAccessFlags = 0;

    D3D11_SUBRESOURCE_DATA subResData2;
    subResData2.pSysMem = indices;
    HRESULT hr=device->CreateBuffer(&buffDescIndices, &subResData2, &mBoxIB);

And this is the deviceContext call

    deviceContext->IASetIndexBuffer(mBoxIB, DXGI_FORMAT_R32_UINT, 0);

sentences: Why aren't game bullets implemented as if they were real bullets? Let's say I'm working on a 3D first-person shooter and the boss is a stickler for realism, and orders me to implement the bullets as tiny projectiles that travel, say, 1000 meters per second. What might be some implementation difficulties, gameplay experience changes, etc. that would result from that decision?

sentences:
Flicker when drawing multiple shapes over image based texture I'm rendering video frames with multiple color filled shapes over it using SharpDx and D3D11.

Rendering seems to be fine when just rendering the video frame and is as expected.

Now if i draw a single color filled shape it is drawn and rendered as expected.

Hoever, the problem occurs when I'm trying to render more than one color filled shapes over a video frame texture.

Apart from first  colored shape , all other shapes drawn flicker when rendered thus showing the pixels under neath which are the pixels for the rendered video frame.

Any ideas as to why does this occur ?

If any more information is required then do let me know.

P.S. Using ShaprDx and Directx11

Thanks.

Edit:
It seemed to be due to rendering the color filled shapes with the same z order as the underlying texture.

This was resolved with recommendation from another forum available here as long i'm just drawing a shape filled with color but when i'm filling the quad/shapes with textures the problem is still there.

I have also tried to set the ZOrder for the each of the shapes to be different yet the problem is still there.

sentences:
changing body type without change of center of mass I have an box2d project with some bodies in it, which move around without any user interaction. But if the user selects one of the bodies, he should be able to move it around just like he wants to.

To keep it short, I want to change the type of the body to "kinematic" while the user controls it and back to "dynamic" afterwards. If I do so the rotation center of the body changes with the change of the type. How can I reset this?

The body's fixture is created of a single b2PolygonShape, with its vertices set via SetAsArray().

Greetings philipp

EDIT::

So I looked around about setting the local center of bodies. what brought me to this solution:

var md = new b2MassData();
this.body.GetMassData( md );
this.body.SetType( b2body.b2_kinematicBody );
this.body.SetMassData( md );

that did not work, so I had a look at the source and found that SetMassData() always returns if the body is not "dynamic".

So I tried this:

var md = new b2MassData();
this._body.GetMassData( md );
this._body.SetType( b2Body.b2_kinematicBody );
this._body.m_sweep.localCenter.Set( md.center.x, md.center.y );

what actually is modifying the private data of the body. But it works and no errors appear, but can I really do this without the risk of breaking the application, or in other words, under which circumstances could this solution might cause errors?

n.b.:
I am using box2dweb of the latest release.

Greetings philipp

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:
Hexagonal tilemap is being distorted So I made a hexagonal tilemap of ocean tiles and then picked a few tiles to be land. When I pick all adjacent tiles to the hexagon it usually works, but for tiles that are on certain columns it does not. Also, on these columns the tops and bottoms of tiles are missing.

It's hard to explain but here's a screenshot that should clear it up:

As you can see, on every other column the top and bottom of hexagons are missing, when all adjacent tiles are filled in to the centre tile it works fine for those columns without a bottom and top on hex, but when it's on the other column one of the adjacent tiles is displaced.

Any suggestions?

Code:

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x + 1, (int)islands[currentTile].y + 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x + 1, (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y - 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x - 1, (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y + 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x - 1, (int)islands[currentTile].y + 1, landCell);

sentences:
Dynamic rigidbody and kinetic with simplectic integration for trajectories [2d] Okay, I have the following situation:

I want to launch a GameObject into orbit of a planet and using the dynamic rigidbody everything is working as I want. I simulate gravity and as it hits the surface again it bounces around nicely using the Box2D system.

However, I want to calculate the trajectory and visualise it on screen. I thought about it and came up with two solutions, but I run into some problems:

1 Simplectic integration for the trajectory

I simulate the trajectory using simplectic integration. However, as can be expected, the results are different for the dynamic rigidbody movement and the simplectic integration. This became very obvious when I launched two identical objects and simulated one dynamically and the other one simplectic. The code is as follows (all in FixedUpdate):

if (rb.isKinematic)
{
    velocity += forces / mass * Time.fixedDeltaTime;
    Vector2 newPosition = (Vector2)transform.position + velocity * Time.fixedDeltaTime;
    rb.MovePosition(newPosition);
}
else
{
    rb.AddForce(forces);
}

The simplectic / kinematic one is slower than the dynamic one. Weird.

2 Use Physics2D.simulate

According to https://docs.unity3d.com/ScriptReference/Physics2D.Simulate.html I can simulate it via code. However, this means that I have to set everything that is not to be simulated as disabled and simulate it for a given amount of time to calculate the trajectory. Not really what I was looking for, because I want to have a live trajectory update

3 Full simplectic
That seems to be easy, but I want to have realistic collisions and bounces. Don't want to reinvent the wheel when Box2D should be sufficient.

4 Simplectic for simple movement, dynamic at collision
This seems to be the logical candidate, but don't know if it is clever. Had no time to implement this yet, but should not be that difficult. Feels a bit icky...

So, question?

My questions are:

Can I reduce or eliminate the offset from solution 1?
If not, what whould be the most logical solution and / or am I missing one?

EDIT
It was asked how I calculate the forces. This is simply Newton's law with squared distance:

public Vector2 CalculateForce(GameObject a, GameObject b) {
    // AUComponent is an interface type I have... not very special in itself.
    float mA = a.GetComponent<AUComponent>().Mass;
    float mB = b.GetComponent<AUComponent>().Mass;

    Vector2 r = b.transform.position - a.transform.position;
    return gravityConstant * mA * mB / r.sqrMagnitude * r.normalized;
}

However, the ever increasing offset is also happening with a constant force applied in a direction.

The masses of the AUComponent are equal to those of the RigidBody.

sentences: What is differential scrolling? I have seen the term a few times (e.g. here). I tried looking it up but did not find much information. I thought it would be something like parallax-scrolling, but I have seen suggestions otherwise (e.g. here). What is the difference?

sentences:
How to draw a polygon with picture in libgdx? I'm working around a simple rectangle game, It just split the rectangle in to a lot of polygon debris. I use Pixmap and Texture to draw the edges of each polygon.

...
 for (GraphEdge e: _edges) {
    pixmap.drawLine((int) e.x1, (int) e.y1, (int) e.x2, (int) e.y2);
 }
...
@Override//In an actor class
public void draw(Batch batch, float parentAlpha) {
    region = new TextureRegion(new Texture(pixmap));
    region.setRegionWidth((int)width+1);
    region.setRegionHeight((int)height+1);
    batch.draw(region, this.getX(), this.getY());
}

it works well,but I want to add some pictures to adjust those polygons to make it looks better than some tedious lines, how should I implement it?

sentences:
rendering transparent meshes in LibGDX Building open this tutorial - https://code.google.com/p/libgdx/wiki/ProjectionViewportCamera
I have constructed a class for generating polygon meshes. But i cannot figure out how to render semi transparency, even though the mesh in the tutorial takes a color object with an alpha channel.

I am rendering with squareMesh.render(GL10.GL_TRIANGLE_STRIP, 0, 4);
This is the code used for initializing the mesh

if (squareMesh == null) {
    squareMesh = new Mesh(true, 4, 4,
                 new VertexAttribute(Usage.Position,    3, "a_position"),
                 new VertexAttribute(Usage.ColorPacked, 4, "a_color"));

    squareMesh.setVertices(new float[] {
        -0.5f, -0.5f, 0, Color.toFloatBits(128, 0, 0, 255),
         0.5f, -0.5f, 0, Color.toFloatBits(192, 0, 0, 255),
        -0.5f,  0.5f, 0, Color.toFloatBits(192, 0, 0, 255),
         0.5f,  0.5f, 0, Color.toFloatBits(255, 0, 0, 255) });
    squareMesh.setIndices(new short[] { 0, 1, 2, 3});
}

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:
Implementing camera for 2d side scroller game? I'm implementing a 2D side scroller for iOS (using C/C++ with OpenGL) (beat'em up style like double dragon/final fight ).

My scenes are composed of one cyclical background image ( the end of the image connects perfectly with the beginning ). This is to produce a cyclical scroll effect.

I was wondering how could I implement a camera that follows my player movement ?

( Resources / Links are greatly appreciated with explanations :) )

sentences:
Skin Editing/Overlaying bullet holes You see, especially in FPS games, when a bullet hits a wall or a character, etc. You end up with the bullet hole.

Is this usually done with the actual skin temporarily changing, or just an overlay of another image (or something totally different)?

Could anyone give me pointers on how to go about this? I'm using XNA (C#)

sentences:
Removing drawn Allegro texts and primitives I'm working on a game with Allegro 5 that has a loop. I'd like to make the program write onto the screen, how much time the loop has ended. These are the rounds of a turn-based game, obviously. I use the al_draw_textf function for it, which works perfectly, but I put it into the loop. Its consequence is obviously that the number is written on the same place all the time.

To prevent it, I should delete it at the beginning of every loop. Sadly, I couldn't find any functions in Allegro Manual that does it. How can I do that then?

sentences:
Water reflection xna I'm actually trying to do the reflection map for my water component, but even following the riemer's tutorial about reflection map the formulas provided doens't work. http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series4/Reflection_map.php

I've read somewhere on the Internet that riemer uses Z-axis as UpVector, and I'm using the Y-axis instead.

So my system for now is somethink like this:

private void DrawReflectionMap()
{
        this.GraphicsDevice.SetRenderTarget(this.reflectionMap);
        this.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1.0f, 0);

        if (this.CameraPosition.Y > this.Options.Height)
        {
            Matrix reflectionMatrix = Matrix.Identity;

            // Camera position
            Vector3 reflectionCameraPosition = this.camera.Position;
            reflectionCameraPosition.Y = -this.camera.Position.Y + this.Options.Height * 2;

            // Camera target
            Vector3 reflectionCameraTarget = this.camera.TargetPosition;
            reflectionCameraTarget.Y = -this.camera.TargetPosition.Y + this.Options.Height * 2;

            Vector3 cameraRight = Vector3.Transform(new Vector3(1, 0, 0), this.camera.Rotation);
            Vector3 invUpVector = Vector3.Cross(new Vector3(1, 0, 0), reflectionCameraTarget - reflectionCameraPosition);

            reflectionMatrix = Matrix.CreateLookAt(reflectionCameraPosition, reflectionCameraTarget, invUpVector);

            Plane _reflectionPlane = this.CreatePlane(this.Options.Height - 0.5f, new Vector3(0, -1, 0), reflectionMatrix, true);

            if (this.Options.Draw != null)
                this.Options.Draw(reflectionMatrix, true, _reflectionPlane);
        }

        this.GraphicsDevice.SetRenderTarget(null);
}

and there is my camera: http://pastebin.com/hK9fi5DV

When I run all of this, I got this:

As you can see, it seems the reflection map is not in the right side and when I move my camera, the reflection map also moves thru the edges of the texture...

Do you have an idea from where this problem could come?

Thanks.

sentences:
smooth look at only on x and y i'm using the script down below to make my camera look at mouse x and y position, and it has a limitation for my camera rotation.the problem is the way my camera rotates is not smooth at all.is there any way to make it smoothly look at position on x and y?

    rotationX += Input.GetAxis("Mouse X") * sensitivityX;

    rotationX = Mathf.Clamp(rotationX, minimumX, maximumX);

    rotationY += Input.GetAxis("Mouse Y") * sensitivityY ;

    rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);

    transform.localEulerAngles = new Vector3(-rotationY , rotationX, 0);

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:
Issue picking the closest vector in a unique circumstance I have a list of targets that can be picked depending on the magnitude from the vector created using:

  for(int i = 0; i < targetQueue.Count; i++) //2 loops to cycle through targets
            {
                for(int j = 0; j < targetQueue.Count; j++)
                {   //if two targets are the same, then skip them
                    if(targetQueue[i] != targetQueue [j])
                    {
                        //getting the direction using the source and destination vectors
                        Vector3 iDir = targetQueue[i].transform.position - transform.position;
                        Vector3 jDir = targetQueue[j].transform.position - transform.position;

                        //comparing i with j, if i is less than target at j then match found
                        if(iDir.magnitude < jDir.magnitude)
                        { //LockedTarget is a gameobject to show what target the turret is locked on to
                            LockedTarget = targetQueue[i]; //if match found then set locked target to target at i
                            break;
                        }
                    }
                 }
             }

This code compares every target to each other, however it does this twice, once on each side( target[i] becomes target[j]). When the magnitude is compared, if the target[i] is smaller, then this is now the locked target as this target is closer to the turret.

This works every time except for one instance and I can't figure out why its happening here:

When both targets are inside the collider, the target on the right should still be highlighted, yet I get the target that is farther away being selected, this also occurs with more than two targets, with even stranger results. These being that the original target chosen for 'DEADLOCK' what i'm calling it, stays locked. Even when I move the other targets above, below, left and to the right of it.

This only occurs with this target, i've tried with 2 other targets (south of the turret) and it works as intended by properly switching based on size of magnitude of the direction vector between the target and the source.

I have ruled out the possibility being that it is an issue to do with adding target's to the gameobject list as it works everywhere else. When measuring the lengths of the magnitudes, the wrong target is chosen as the locked target. It does show that the closest target on the images does actually have the smallest vector magnitude.

UPDATE: the magnitudes of the vectors are increasing and decreasing by tiny amounts, 1 to 2 for a major movement. this makes sense as its worldPos.
What doesn't make sense is the target on the right having a magnitude of 49 and the target above having a magnitude of 82, when according to world space they are pretty close to eachother.

Can anyone help me with this issue? its been driving me nuts for days.

It must be to do with the magnitudes of the direction vectors not being calculated properly.

sentences:
Faster way to draw dynamic meshes in OpenGL ES I'm writing a 3D game which is going to inlcude some dynamic meshes.

For now, my code looks like this :

private float[] mVertices;
private FloatBuffer mVertexBuffer;

public void onDrawFrame(GL10 gl) {
    // first clear the screen of any previous drawing
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    // initialize the matrix
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();

    // update the vertex data
    for (int vtx = 0; vtx < mVtxCount; ++vtx){
        // fill in the x, y and z components of the vertex position
        mVertices[vtx * 3] = x;
        mVertices[(vtx * 3) + 1] = y;
        mVertices[(vtx * 3) + 2] = z;
    }

    // update the vertex buffer
    mVertexBuffer.clear();
    mVertexBuffer.put(mVertices);
    mVertexBuffer.position(0);

    // render the vertex buffer
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
    gl.glDrawElements(GL10.GL_LINES, mIndices.length,
                GL10.GL_UNSIGNED_BYTE, mIndexBuffer);
}

Here is an easy sample as the index buffer does not change so I only update the vertex position, normal and texture coordinates.

Of course I understand dynamic mesh will always be slower to render than static mesh, but I wonder if the method I use is good or if there is a faster / better way to do this .

sentences:
How to create JSON file in notepad that will hold my positional vector3 data for one type of object I'm trying to get my head around using JSON files to store level data . Specifically in this example is to make my walls. (its a top-down game like pacman). Each wall prefab is a 1x1x1 cube. I just want the JSON to hold the x,y,z. I have seen tutorials about how best to deserialise the data into Unity and I think im fine doing that, but I am unsure of how exactly to word the JSON file.

I see the example on Unity docs says the format is like this:

{"level":1,"timeElapsed":47.5,"playerName":"Dr Charles Francis"}

so, I could just do something like:

{"index":0,"x":5,"y":1,"z":0}

but I know that there needs to be a bit above, similar to XML and of this im clueless of what it needs to contain.

I looked on Json.org but i didnt really understand it still. This is one example:

{
"glossary": {
    "title": "example glossary",
    "GlossDiv": {
        "title": "S",
        "GlossList": {
            "GlossEntry": {
                "ID": "SGML",
                "SortAs": "SGML",
                "GlossTerm": "Standard Generalized Markup Language",
                "Acronym": "SGML",
                "Abbrev": "ISO 8879:1986",
                "GlossDef": {
                    "para": "A meta-markup language, used to create markup languages such as DocBook.",
                    "GlossSeeAlso": ["GML", "XML"]
                },
                "GlossSee": "markup"
            }
        }
    }
}

}

But what is 'Glossary' and 'title' in the context of my game? All I currently have is a cube called Wall, with a script attached called Wall.cs that currently does nothing, but I will be making an array of Wall and plan on using the deserialised data from the json file to lay the Walls[] out using my GameController.cs

Once  I know what to put above and below to open and close the JSON file off, im pretty sure I can get it working how I need it to. I hope that made some sense.

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:
How well do functional languages perform on Android? This is a special case of this question that I feel is particularly pertinent.

I'm working on a game for Android, and I'm planning on using Scala with libgdx.  I'm planning on making a performant game, but not necessarily hyper-performant game.  I saw libgdx's documentation on Garbage Collection, and this makes me think:

Functional programming implies lots of immutable objects.
Therefore, mutating an object requires making a new object.
Thus, lots of objects get garbage collected, which degrades performance.

Is this an insurmountable problem?  Are there any other significant problems with functional style on Android?

sentences:
Qt based C++ game structure : which class types to use here, and how to correctly structure the relationship between these objects I am writing a C++ game using Qt. As this is the first time, I am trying to understand how the structure should be.

I have two objects derived from the type QGraphicsRectItem which appear as boxes on the screen, which will each represent a player. I want to make them move independently in response to key presses, with a different set of keys assigned to the motion of each object. These are added to a QGraphicsScene object, which is set by a QGraphicsView inherited object.

As only one of these can be focused at any given point of time, and thus respond to key press events, I have defined a function in a class which inherits from QGraphicsView (and is used as a view for viewing the scene) that receives all the key press events. Its constructor receives pointers to the two box objects, and sends the required information (by setting a variable) to the appropriate object through the pointer based on the key press.

I have a few questions regarding this:

Is QGraphicsRectItem (or QGraphicsItem) the correct class for creating such "objects"? I see that there is a QObject class, but I could not understand where it is meant to be used.
Sending pointers of the box objects to the constructor of the view during initialization doesn't seem right. What would be a more appropriate way to design this? The idea is that based on the key pressed, the corresponding box should respond. The problem is, how does this class access the object, unless it is declared inside it or passed as an argument?
Is there a better or more commonly used way to handle the requirement of different objects responding to different key presses, even if done simultaneously? I have seen suggestions for using Event filters, which would pass the event using postEvent. However, event filters send messages to objects of type QObject, which is not what I am currently using. Additionally, the question again arises - who would receive the key press events? How would it know about the existence of the box objects?

I have been reading about design patterns. Is there any particular pattern that would be suitable for this?

Thank you.

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:
Card displacement in Unity Following a tutorial on Youtube, https://www.youtube.com/watch?v=P66SSOzCqFU, I'm  trying to make a card game that uses dragged cards. When I drag a card it's supposed to stay centered with the mouse, but it's showing up on the edge of the screen when I start to drag it. How do I make it so the card drags with my mouse instead? Currently I'm using two scripts, one for a drop zone and one for "draggable". When I tried to debug the draggable section it kept referring me back to a line in my drop zone script that just had a '{'. I'm working in Unity 5.6.0f3 and Visual Studio 2017.
My drop zone code looks like this:

public class DropZone : MonoBehaviour, IDropHandler, IPointerEnterHandler, IPointerExitHandler {

public void OnPointerEnter(PointerEventData eventData)
{
    //Debug.Log("OnPointerEnter");
    if (eventData.pointerDrag == null)
        return;
        Draggable d = eventData.pointerDrag.GetComponent<Draggable>();
    if (d != null)
    {
        d.placeholderParent = this.transform;
    }
}

public void OnPointerExit(PointerEventData eventData)
{
    //Debug.Log("OnPointerExit");
    if (eventData.pointerDrag == null)
        return;
    Draggable d = eventData.pointerDrag.GetComponent<Draggable>();
    if (d != null && d.placeholderParent==this.transform)
    {
        d.placeholderParent = d.parentToReturnTo;
    }
}

public void OnDrop(PointerEventData eventData)
{
    Debug.Log(eventData.pointerDrag.name + "was dropped on" + gameObject.name);

    Draggable d = eventData.pointerDrag.GetComponent<Draggable>();
    if(d != null)
    {
        d.parentToReturnTo = this.transform;
    }
}
}

And my Draggable code looks like this:

public class Draggable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler {

public Transform parentToReturnTo = null;
public Transform placeholderParent = null;

GameObject placeholder = null;

public void OnBeginDrag(PointerEventData eventData)
{
    Debug.Log("OnBeginDrag");

    placeholder = new GameObject();
    placeholder.transform.SetParent(this.transform.parent);
    LayoutElement le = placeholder.AddComponent<LayoutElement>();
    le.preferredWidth = this.GetComponent<LayoutElement>().preferredWidth;
    le.preferredHeight = this.GetComponent<LayoutElement>().preferredHeight;
    le.flexibleWidth = 0;
    le.flexibleHeight = 0;

    placeholder.transform.SetSiblingIndex(this.transform.GetSiblingIndex());

    parentToReturnTo = this.transform.parent;
    placeholderParent = parentToReturnTo;
    this.transform.SetParent(this.transform.parent.parent);

    GetComponent<CanvasGroup>().blocksRaycasts = false;
}

public void OnDrag(PointerEventData eventData)
{
    //Debug.Log("OnDrag");

    this.transform.position = eventData.position;

    //if(placeholder.transform.parent != placeholderParent)
    //    placeholder.transform.SetParent()

    int newSiblingIndex = placeholderParent.childCount;

    for(int i=0; i<placeholderParent.childCount; i++)
    {
        if(this.transform.position.x < placeholderParent.GetChild(i).position.x)
        {
            newSiblingIndex = i;

            if(placeholderParent.transform.GetSiblingIndex() < newSiblingIndex);
            newSiblingIndex--;
            break;
        }
    }

    placeholder.transform.SetSiblingIndex(newSiblingIndex);

}

public void OnEndDrag(PointerEventData eventData)
{
    Debug.Log("OnEndDrag");
    this.transform.SetParent(parentToReturnTo);
    this.transform.SetSiblingIndex(placeholder.transform.GetSiblingIndex());
    GetComponent<CanvasGroup>().blocksRaycasts = true;

    Destroy(placeholder);
}

In the draggable code,
if(placeholder.transform.parent != placeholderParent)
    placeholder.transform.SetParent()
is commented out because that's where I stopped in the tutorial in order to go back and fix my displacement issue.

sentences:
What do you do with "Player Start" and "Pawn" objects when setting up the default VR game in Unreal? I followed the setup tutorial provided by Unreal from here but after setting up the pawn and the VR_GameMode you don't do anything with them. They are never added to the scene or anything and the default game comes with a "Player Start."

Is the "Player Start" object supposed to be removed? If you remove that then running the VR Preview shows the game from wherever your camera is in the viewport and there is no game location. Adding the pawn to the scene doesn't seem to do anything. The final image they show doesn't have the "Player Start" object in the scene at all and they never mention it so I'm unclear about how to complete this process.

Adding the pawn to the scene seems to have no noticeable affect on how the game is run in VR Preview. What's the proper last step?

After following the instructions exactly as-is the floor is way below the current start point and modifying the Z values as instructed has no affect on the floor. Moving the "Player Start" does, but this could have been done from the very beginning without doing any of the setup with the pawn or the GameMode.

sentences:
What is "Avatar" in the "Animation Controller" used for? I'm using animation layers for a model of type "Generic".
The "Base" layer contains an "Idle" animation.
The "Shooting Layer" contains a pistol shooting animation.
I want the shooting layer animation to only affect the upper body.
To do that, I need to use an Avatar Mask, I think.
In the avatar mask, I have to select if I want it to be of type "Humanoid" or of type "Generic".
I will not use a "Humanoid" avatar mask because my animations are perfectly tailored for my model, and I don't need any retargetting.
Instead, I wanted to use the "Transform" avatar mask type.
However, it seems to expect an avatar:

However, I haven't had the need to create one yet.
Do I really need to create an avatar?
I don't want any "Humanoid", I want to have full control over my animations and over what's going on. I have tried "Humanoid" before, and for me, it's a total loss of control as I can no longer tell what is a bug / mis-use by me and what is automatic retargetting done by Unity, so I want to avoid it by any means.
Why do I have to create an "avatar"? What is it actually?
Unity already has my generic model to work with, so it knows the transform.
Why does it want an "avatar"?
Edit:
The strange thing is: I can create an avatar the usual way -> "Rig -> Create Avatar" -> "From this model".
Then I have an avatar.
In the avatar mask, I need to feed an avatar. I do this, then it shows my transform. Now I can delete the avatar, and it still remembers my transform.
Strange... not sure why Unity can't simply use the transform.

sentences:
Double jump, without allowing two jumps after falling down a cliff I created a script that allows the player to double jump, which works like a charm.

The problem is if the player walks off a cliff, they will still be able to jump twice. But that isn't how double jump works, right?

Can someone tell me how to make it so that if the player falls down a cliff, they will be able to jump only once?

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

public class PlayerController : MonoBehaviour
{
    private Rigidbody2D rb;
    private Animator anim;

    private float movementInputDirection;

    public float movementSpeed = 10f;
    public float jumpForce = 16f;

    public int amountOfJumps = 1;
    private int amountOfJumpsLeft;

    private bool isFacingRight = true;
    private bool isWalking;
    private bool isGrounded;
    private bool canJump;

    public float groundCheckRadius;
    public LayerMask whatIsGround;

    public Transform groundCheck;

    void Awake()
    {
        rb = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
    }

    void Start()
    {
        amountOfJumpsLeft = amountOfJumps;
    }

    void Update()
    {
        CheckInput();
        CheckMovementDirection();
        UpdateAnimations();
        CheckIfCanJump();
    }

    private void FixedUpdate()
    {
        ApplyMovement();
        CheckSurroundings();
    }

    private void CheckMovementDirection() //flips sprite
    {
        if (isFacingRight && movementInputDirection < 0)
        {
            Flip();
        }
        else if (!isFacingRight && movementInputDirection > 0)
        {
            Flip();
        }

        if(rb.velocity.x != 0)
        {
            isWalking = true;
        }
        else
        {
            isWalking = false;
        }
    }

    private void UpdateAnimations()
    {
        anim.SetBool("IsWalking", isWalking);
    }

    private void CheckInput()
    {
        movementInputDirection = Input.GetAxisRaw("Horizontal");

        if (Input.GetButtonDown("Jump"))
        {
            Jump();
        }
    }

    private void ApplyMovement() //player movement
    {
        rb.velocity = new Vector2(movementSpeed * movementInputDirection, rb.velocity.y);
    }

    private void Flip()
    {
        isFacingRight = !isFacingRight;
        transform.Rotate(0f, 180f, 0f);
    }

    private void Jump()
    {
        if (canJump)
        {
            rb.velocity = new Vector2(rb.velocity.x, jumpForce);
            amountOfJumpsLeft--;
        }
    }

    private void CheckSurroundings()
    {
        isGrounded = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, whatIsGround);
    }

    private void CheckIfCanJump()
    {
        if (isGrounded && rb.velocity.y < 0.01)
        {
            amountOfJumpsLeft = amountOfJumps;
        }

        if (amountOfJumpsLeft <= 0)
        {
            canJump = false;
        }
        else
        {
            canJump = true;
        }
    }

    private void OnDrawGizmos()
    {
        Gizmos.DrawWireSphere(groundCheck.position, groundCheckRadius);
    }
}

sentences:
How to create UI for 2D games? I'm working on a game using Haxe + Flambe but I'm having a hard time making the UI part of it (main screen, level selection, etc).

And I began to think... is there another way?

I would love to have something like Flash, I mean, WYSIWYG like to make the UI. Just because I don't want to spend my time coding the screens until they look like what's on my mind.

So the questions are:

How do people work?

Is there something visual to make the UI for games that'll be programmed on Haxe (it doesn't matter if using OpenFL, Flambe or other)?

sentences:
Getting contour without the background I have a texture and vertex which are needed to create a set of closed polygons. For this purpose I use these functions:

Code for create texture:

CCSprite* spr = CCSprite::spriteWithTexture(mShape->getTexture());

spr->setPosition(ccp(spr->getTextureRect().size.width/2, spr->getTextureRect().size.height/2));
spr->setFlipY(true);

CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(mShape->getTextureRect().size.width, mShape->getTextureRect().size.height);

texture->beginWithClear(1, 1, 1, 0);
spr->visit();

glColor4f(0, 0, 0, 1);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);

for(int i=0; i < innerBorders.size(); i++) {
    std::vector<Vector2d> sitePoints = innerBorders.at(i);

    for(int n=1; n < sitePoints.size(); n++ ) {
        Vector2d origin = sitePoints.at(n-1);
        Vector2d destination = sitePoints.at(n);

        drawSmoothLine(ccp(origin.GetX(), origin.GetY()), ccp(destination.GetX(), destination.GetY()), 0.25f);
    }
}

glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glColor4f(1.0, 1.0, 1.0, 1.0);

texture->end();

drawSmoothLine method:

drawSmoothLine(CCPoint pos1, CCPoint pos2, float width){
GLfloat lineVertices[12], curc[4];
GLint   ir, ig, ib, ia;
CCPoint dir, tan;

width = width*8;
dir.x = pos2.x - pos1.x;
dir.y = pos2.y - pos1.y;
float len = sqrtf(dir.x*dir.x+dir.y*dir.y);
if(len<0.00001)
    return;
dir.x = dir.x/len;
dir.y = dir.y/len;
tan.x = -width*dir.y;
tan.y = width*dir.x;

lineVertices[0] = pos1.x + tan.x;
lineVertices[1] = pos1.y + tan.y;
lineVertices[2] = pos2.x + tan.x;
lineVertices[3] = pos2.y + tan.y;
lineVertices[4] = pos1.x;
lineVertices[5] = pos1.y;
lineVertices[6] = pos2.x;
lineVertices[7] = pos2.y;
lineVertices[8] = pos1.x - tan.x;
lineVertices[9] = pos1.y - tan.y;
lineVertices[10] = pos2.x - tan.x;
lineVertices[11] = pos2.y - tan.y;

glGetFloatv(GL_CURRENT_COLOR,curc);
ir = 255.0*curc[0];
ig = 255.0*curc[1];
ib = 255.0*curc[2];
ia = 255.0*curc[3];

const GLubyte lineColors[] = {
    ir, ig, ib, 0,
    ir, ig, ib, 0,
    ir, ig, ib, ia,
    ir, ig, ib, ia,
    ir, ig, ib, 0,
    ir, ig, ib, 0,
};

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, lineVertices);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, lineColors);
glDisable(GL_TEXTURE_2D);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 6);
glEnable(GL_TEXTURE_2D);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);}

I need to get the texture of the contour (without the main texture on the background.) How can it be done using openGL ES 1.1?

sentences:
Cross-platform builds with OGRE3D via CMake. Any tips? I've been trying to compile a simple project for both OSX and Windows platforms, using OGRE3D, but I've got some problems on the way.

I'm using CMake to create my platform specific project files (VS solution & Xcode project). Some problems I found are:

OGRE3D source is distributed in 2 flavors, Windows sources and UNIX/OSX sources.
In OSX, compiling dependencies (freetype, FreeImage and specially OIS) is such a pain.
I don't know how to handle precompiled dependencies (they exist for both Win & Mac).

May sound like a noob question, but I would appreciate some tips on this. Resources, forum posts, anything. There exists any "cross-platform base project for OGRE3D" on the net?
Would be really helpful if someone who already managed to do this can bring some light.

Btw, I'm not basing the project on OGRE3D, it's just that is the biggest library I'm probably using, so I depend a lot on it.

sentences: Make CharacterControllers in Unity not collide with each other I'm trying to spawn a number of CharacterControllers and have them move around an area, but they keep getting stuck on each other. Is there a way to make them pass through each other while still respecting the terrain's obstructions?

sentences:
Pass a single boolean from an Android App to a libgdx game I'm writing an Android application that needs to pass a single boolean into an Android game that I am also writing.  The idea is that the user does something in the App which will affect how the game operates.

This is tricky with LIBGDX since I need to get the bool value into the Java files of the game, but of course, you can't call Android specific things from within LIBGDX's main Java files.  I tried using an intent but of course the same problem persists.  I can get the boolean into the MainActivity.Java of the android output of the game, but can't pass it along any further since the android output and the main java files don't know about each other.  I have seen a few tutorials that explain how to use set up an interface in the LIBGDX java files that can call android things.  This seems like wild overkill for what I want to do.

I've been trying to use Android's Shared Preferences with LIBGDX's Gdx.app.getPreferences, but I can't make it work.

Anyhelp would be MUCH appreciated.

I've set up two hello world applications.  One is a standard Android app, with a single button that is supposed to write "true" into the shared preferences.  The other is a standard LIBGDX hello world that is supposed to do nothing but check that bool when launched and if true display one image to the screen, if false, display a different one.

Here's the relevant bit of the Android code:

import android.preference.PreferenceManager;

 public void onClick(View view) {
    if (view == this.boolButton){

        final String PREF_FILE_NAME = "myBool";
        SharedPreferences preferences = getSharedPreferences(PREF_FILE_NAME, MODE_WORLD_WRITEABLE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("myBool", true);
        editor.commit();
    }
}

And here's the relevant bit of the code from the LIBGDX main file:

Preferences prefs = Gdx.app.getPreferences("myBool");
    boolean switcher = prefs.getBoolean("myBool");

    if(switcher == true){
        texture = new Texture(Gdx.files.internal("data/worked512.png"));
        prefs.putBoolean("myBool", false);
        }
        else
        {
        texture = new Texture(Gdx.files.internal("data/libgdx.png"));
        }

Everything compiles fine, it just doesn't work.  I've spent HOURS googling trying to find a way to pass this single boolean from android into a LIBGDX main and I'm totally stumped.

Thanks for your help.

sentences:
Duplicating and adding sprites at runtime in Unity I am trying to create a 2D game in Unity in which objects keep falling from top and the player has to dodge them. Suppose I have created a sprite which serves as a single enemy that the player has to dodge.Now I have to create multiple such sprites at runtime so that they can keep on spawning from random positions.Despite searching on the net for quite some time i could not find a clear answer.

I am just a newbie and I am just starting to learn game development in Unity so answers in detail will be very helpful.

Thanks in Advance.

sentences:
TF2 plugin signature (Source SDK) I am working on the server plugin for TF2. I need it for getting some stats from game (no hacking and cheating). My problem: I got message "No valid signature found..." while testing my plugin. But I want to make my plugin public in future (maybe).

Please tell me about signing procedure. How can I get valid signature for my plugin? What I must to do (send my plugin to Valve or what else)?

sentences: How can i draw a curve in modern Opengl? OpenGl is capable of rendering points, lines, triangles and quads;  but what if i want to draw a bezier curve? I read online you should use something called GL_STRIP, but the solutions were using either legacy Opengl, or they were not explaining well the process. The question is: How can i render bezier curves in Modern Opengl? I'm using C++.

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:
Why are my water tiles not animating? My game can display tiles such as Grass tile, Dirt tile and Rock tile with no problems. Now I am trying to display water tile and animate it but for some reason it is not animating and only displaying single frame of water tile. What am I doing wrong?

Below are the appropriate classes that I am using to animate my water tiles. Please let me know if you require any more info to help me solve the problem. Thanks!

Tile class:

public abstract class Tile {

public static Tile[] tiles = new Tile[256];
public static Tile grassTile = new GrassTile(0);
public static Tile dirtTile = new DirtTile(1);
public static Tile rockTile = new RockTile(2);
public static Tile waterTile = new WaterTile(3);
public static Tile waterfallTile = new WaterfallTile(4);
public static Tile wateSplashTile = new WaterSplashTile(5);
public static final int TILE_WIDTH = 64, TILE_HEIGHT = 64;

protected BufferedImage texture;
protected final int id;

public Tile(BufferedImage texture, int id){
    this.texture = texture;
    this.id = id;
    tiles[id] = this;
}

public abstract void update();
public abstract void render(Graphics g, int x, int y);

public Boolean isSolid(){
    return false;
}

WaterTile class:

public class WaterTile extends Tile {
private Animation waterAnim;
private int speedAnim = 150;

public WaterTile(int id) {
    super(Assets.water[0], id);
    waterAnim = new Animation(speedAnim, Assets.water);
}

public void update(){
    waterAnim.update();
}

@Override
public void render(Graphics g, int x, int y) {
    g.drawImage(getAnimationFrame(), x, y, Tile.TILE_WIDTH, Tile.TILE_HEIGHT, null);
}

private BufferedImage getAnimationFrame() {

    return waterAnim.getFrames();

}

public Boolean isSolid(){
    return true;
}

Animation class:

public class Animation {

private int speed, index;
private long lastTime, timer;
private BufferedImage[] frames;

public Animation(int speed, BufferedImage[] frames){
    this.speed = speed;
    this.frames = frames;
    index = 0;
    timer = 0;
    lastTime = System.currentTimeMillis();
}

public void update(){
    timer+=System.currentTimeMillis() - lastTime;
    lastTime = System.currentTimeMillis();

    if (timer > speed){
        index++;
        timer = 0;
        if (index >= frames.length){
            index = 0;
        }
    }
}

public BufferedImage getFrames() {
    return frames[index];
}

sentences:
Fresnel shader excluding one axis I'm trying to get an outline like effect shown on the right in this video. Using fresnel seems to make the whole thing go white at certain angles. How do I prevent that?
I'm using amplify to make this. Here's my current setup

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

I am thinking of it like this:

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

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

Toughts?

sentences:
Best way to structure SDL2/C++ game? I was reading some SDL2 tutorials and I noticed that you need to pass your window surface handle to any drawRect calls. Should I create a global surface handle or pass the handle by reference into draw functions?

Also for dealing with characters sprites, code structure-wise, which method would be more maintainable: each character object encapsulate its own set of sprites, or have a Sprites class hold all sprite information, and retrieve from there?

Edit: By Jon's advice, I'll probably look at generating one big texture sheet and reading off of that to reduce texturing binding overhead. As for the surface handle, I've created it as a private member variable in my Game class, and will pass it to any Draw calls that need it.

sentences:
Sketchup model renders wrong in XNA My XNA model renders wrong.

It should render like that:

But it renders like that:

The background doesn't matter. It's just the model that renders wrong.

Here is the drawing code:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);

    DrawModel(model);

    base.Draw(gameTime);
}

private void DrawModel(Model m)
{
    GraphicsDevice.RasterizerState = RasterizerState.CullNone;

    Matrix worldMatrix = Matrix.CreateRotationY(MathHelper.ToRadians(rot))
        * Matrix.CreateTranslation(new Vector3(0,0,0));

    foreach (ModelMesh mesh in m.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = worldMatrix;
            effect.View = viewMatrix;
            effect.Projection = projectionMatrix;
        }

        mesh.Draw();
    }
}

sentences:
How can I detect collision between two objects I have some code that when I click on an object with my mouse it will change it to another object. I'm using this code to change an object into a shattered version I made of it for destruction purposes. How could I change the mouse down function into a function that would activate when the object is touched by another object ?

using UnityEngine;
using System.Collections;

public class Destruction : MonoBehaviour
{
    public GameObject destructionPiece;

    void OnMouseDown()
    {
        Instantiate (destructionPiece, transform.position, transform.rotation);
        Destroy(gameObject);
    }
}

sentences:
How to Interpolate between two game states? What is the best pattern to create a system that all the objects positions to be interpolated between two update states?

The update will always run at the same frequency, but I want to be able to render at any FPS. So the rendering will be as smooth as possible no matter the frames per second, whether its lower, or higher than the update frequency.

I would want to update 1 frame into the future interpolate from the current frame to the future frame. This answer has a link that talks about doing this:

Semi-fixed or Fully-fixed timestep?

Edit: How could I also use the last and current speed in the interpolation? For example with just linear interpolation, it will move at the same speed between positions. I need a way to have it interpolate the position between the two points, but take into consideration the speed at each points for the interpolation. It would be helpful for low rate simulations like particle effects.

sentences:
Depth Buffer not working in XNA? I'm stumped.  I have been fighting this for about 2 hours now.

Here are the interesting parts of my code:

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    var time = gameTime.TotalGameTime.TotalSeconds;
    this.position = new Vector3(
        2.0f * (float)Math.Sin(time),
        2.0f * (float)Math.Cos(time),
        2.0f * (float)Math.Cos(time / 4));

    effect.World = Matrix.Identity;
    effect.View = Matrix.CreateLookAt(this.position, Vector3.Zero, Up);
    effect.Projection = Matrix.CreatePerspectiveFieldOfView(1.5708f, (float)this.Window.ClientBounds.Width / this.Window.ClientBounds.Height, float.Epsilon, 500.0f);

    base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
    var count = this.SetUpVertices() / 3;

    this.GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.CornflowerBlue, 1.0f, 0);

    this.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
    this.GraphicsDevice.BlendState = BlendState.Opaque;
    this.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

    foreach (var pass in this.effect.CurrentTechnique.Passes)
    {
        pass.Apply();
        this.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, count, VertexPositionTexture.VertexDeclaration);
    }

    base.Draw(gameTime);
}

sentences:
How can I have cutouts in a texture? I want to be able to have a gameobject that's basically just a black box on top of everything else. Then I want to be able to place other gameobjects which are just gradients on top of that and they should "cut out" of the black texture like this:

How can I achieve this sort of effect?

Please keep in mind that I have pretty much no experience with shaders :)

Here's a video that might help explain what I'm trying to achieve
https://www.youtube.com/watch?v=L1dd4fkVSAM

sentences:
What is the fastest way of drawing simple, textured geomtries and keeping the depth test? I'm looking for a fast way to draw simple 3D geometries - that will consist of up to 10 vertices. Each of them will have a texture (though varying between geometries). I also want to store the fragment depth for depth testing.

There will be no lighting and only very simple transformations (this actually is for isometric game).

So far what I did was trying to achieve top performance using OpenGL for drawing simple quads (what the problem actually boils down to). For my machine (from around 2008), I had the following results:

Using immediate mode 4800 quads took 120ms
Using vertex arrays and VBOs this took around 40 ms

What I see as a problem is the bottleneck of glDraw* calls. I want to somehow get below 4-5 ms , as there will be really a lot of objects on the screen. Any ideas about how could (or perhaps couldn't) achieve that?

sentences:
Drawing a level in SFML (C++) So in an attempt to move out of the console environment I have set up an SFML poject in Visual Studio. I am currently trying to draw a stage from a vector within a vector (Matrix?), and the results are not exactly what I was hoping for.

First i tried mapping out everything as '0's representing empty space, changing the top and bottom vector to '1's, representing objects, thus drawing what essentially would be a rectangle covering the bottom and a rectangle covering the top, everything inbetween ignored.

bool stage::load()
{
 vector<int> tempvec;
 for (int i = 0; i != 30; i++)
 {
    for (int j = 0; j != 40; j++)
    {
        tempvec.push_back(0);
    }
    hitbox.push_back(tempvec);
    tempvec.clear();
 }

 for (int i = 40 - 1; i != -1; i--)
 {
    hitbox[29][i] = 1;
 }
 for (int i = 30 - 1; i != -1; i--)
 {
    hitbox[i][0] = 1;
 }
 return true;    //Will use this more efficently once I get the function to work
}

So this is how I set up the stage variable-wise, hitbox being defined as:

vector <vector<int>> stage::hitbox;

I then try to map out the individual blocks, so every time it finds a '1' in the vector, it should print out a square (quad).

vector<VertexArray> tilesetrender;
VertexArray tmp(Quads, 4);
tmp.resize(4);

level.load();
for (int y = level.hitbox.size() - 1; y >= 0; y--)
{
    for (int x = level.hitbox.at(y).size() - 1; x >= 0; x--)
    {
        switch(level.hitbox[y][x])   //Switch case allows me to expand on this function in the future
            {
            case 1:
                tmp[0].position = Vector2f(y * 20 - 10, x * 20 - 10);
                tmp[1].position = Vector2f(y * 20 - 10, x * 20 + 10);
                tmp[2].position = Vector2f(y * 20 + 10, x * 20 + 10);
                tmp[3].position = Vector2f(y * 20 + 10, x * 20 - 10);
                tilesetrender.push_back(tmp);
            }
    }
}

With all the variables created, I proceed to draw the level.

for (int count = tilesetrender.size() - 1; count >= 0; count--)
{
    renderWindow.draw(tilesetrender.at(count));
}

And what I get is this...

The vertices being white, and the background being red. As I have said, I hoped for drawing two rectangles, one at the top and one at the bottom. I have no real idea regarding what part of my code is causing the error, but I've played around with the position commands the most, to no avail.

Thanks in advance.

EDIT: Code partially corrected (Thanks Alayric), thus rendering this image instead:

White being the vertices, red the background and blue the player (previously not visible).
Although it is a whole lot better, something is still incorrect, as the upper rectangle does not reach all the way, and the lower rectangle does not mirror the upper. I do belive the main problem has been solved, and thus I am able to continue on my own.

sentences:
Labeling Areas on a map I've been wondering how you would go about labeling an area on a 2D tile map. What I'd like to do is associate tiles with an area i.e Forest Area, Desert Area, etc.

Keep in mind this is an idea, so far I've been thinking that one way to go about this is to have each area store tile positions as the pivot points and you need at least four of these pivot points before it is a valid area. This way would allow for some of the granularity I would like as my first idea was to just associate every tile with an area id, which is pretty inefficient time-wise, though the task would have been alleviated somewhat with a map editor that I am going to build (i.e. just paint a tile with an area color/number).

What are your ideas on this?

Also, the map, areas, and etc will be stored in an sql database FYI.

sentences: How can I import a Google Sketchup model with textures? I'm using Unity 4 and trying to import a SketchUp Model into Unity and other Engines - but I can't get it to import correctly. Can anyone help me out?

sentences:
In a JRPG Battle system. Who executes the selected action? Throughout the JRPG history, we've seen the introduction of many a battle system type. Like the classic turn-based. The ATB. The action battle system  (Most Notable is Kingdom Hearts)

In these systems, there's a variety of skill handlers like a queue or gauge to determine turn. My question put simply is who handles the executing of skills? Is it the Battle system? The Players? The Skill queue if there is one?

Right now I'm working on an ATB styled Final Fantasy in Unity. I'm leaning towards either the player or the battle system executing the commands. I have my players with each a separate state machine (WAIT, COMMAND, ACTION) And a command queue that holds the queued up actions. I can either have the player in the ACTION state and the battle system process the logic(Execute whatever queued up action). Or the player handle that.

Outside of that. I'm curious how it works for the other types of battle systems since I hope others in the future with a similar question can see this.

sentences:
Handling 3D perspective for different aspect ratio I have problem for supporting different aspect ratio in developing Mobile Game.

I was developing on 2:3 screen which is iPhone 4 (Retina).

When I use width and height for screen size and use fixed FOV, then most of cases

look ok, but in 3:4 (which is iPad), the user can "See More" horizontally.

If I force the aspect ratio to 2:3, then looks "squeezed".

I am lost adjusting other values like moving camera, or changing FOV.

Is there any proper way or tips??

Or, What is good FOV for portrait mobile device screen which can cover most of aspect ratio look ok? - I am currently using 45 - and force aspect ratio to 2:3

sentences:
How can I separate entities from their actions or behaviours? I'm having a go at creating a very simple text based game and I'm wondering how I can design the entities (characters, sentient scenery) with regards to the actions those entities can perform.

As an example, I have an entity that is a 'person' with various properties such as age, gender, height, etc. This 'person' can also perform some actions such as speaking, walking, jumping, flying, etc etc.

How would you separate out the entity from the actions it can perform?

sentences: XNA / WP7 accelerometer sample / example ball rolling Does anyone know of a good WP7 accelerometer sample of a ball rolling around on a screen?

sentences:
Is there a (family of) monotonically non-decreasing noise function(s)? I'd like a function to animate an object moving from point A to point B over time, such that it reaches B at some fixed time, but its position at any time is randomly perturbed in a continuous fashion, but never goes backwards. The objects move along straight lines, so I only need one dimension.

Mathematically, that means I'm looking for some continuous f(x), x ∈ [0,1], such that:

f(0) = 0
f(1) = 1
x < y → f(x) ≤ f(y)
At "most" points f(x + d) - f(x) bears no obvious relation to d. (The function is not uniformly increasing or otherwise predictable; I think that's also equivalent to saying no degree of derivative is a constant.)

Ideally, I would actually like some way to have a family of these functions, providing some seed state. I'd need at least 4 bits of seed (16 possible functions), for my current use, but since that's not much feel free to provide even more.

To avoid various issues with accumulation errors, I'd prefer the function not require any kind of internal state. That is, I want it to be a real function, not a programming "function".

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:
How to change the mesh of the character in UE4? I made a Bellsprout mesh in Blender, exported it as an FBX file, and imported it into UE4.

I can insert it in the stage without problem, but I would like to use this Bellsprout mesh to replace the mesh of the built-in character.

Even clicking and dragging will not replace the mesh:

I've looked into importing between blender/UE4: https://wiki.unrealengine.com/Static_Mesh_from_Blender

And also about mesh editing: https://docs.unrealengine.com/en-us/Engine/Content/Types/StaticMeshes/Editor

I also looked at some questions in this forum: Changing rendering in UE4 and Making only parts of a mesh destroy in UE4

To see if the question had not already been asked.

sentences:
How to resolse collision between moving and static AABB? What I have is a map represented as list of Rectangles and player's rectangle. Also I have function to determine depth of the collision:
    Point TestAABBAABB(Rectangle a, Rectangle b) {
        Point mt = new Point();

    double rcx = Math.abs(a.getCenterX() - b.getCenterX());
    double rx = (a.width / 2 + b.width / 2);
    if (rcx > rx) {
        return new Point();
    }
    double rcy = Math.abs(a.getCenterY() - b.getCenterY());
    double ry = (a.height / 2 + b.height / 2);
    if (rcy > ry) {
        return new Point();
    }
    double overlap_x = rx - rcx;
    double overlap_y = ry - rcy;

    mt.x = 0;
    mt.y = 0;
    //this is the line
    if (overlap_x < overlap_y) {
        mt.x = (int) overlap_x;
        if (a.getCenterX() < b.getCenterX()) {
            mt.x = -mt.x;
        }
    } else {
        mt.y = (int) overlap_y;
        if (a.getCenterY() < b.getCenterY()) {
            mt.y = -mt.y;
        }
    }
    return mt;
}

It works fine if a player jumps "inside" the width of the wall, far from edges. //tail representation

But if player tries to jump near an edge, he moves through the wall and to the side as a result of non-zero X penetration depth of collision.

How do I avoid this situation so player slides under platform instead of getting pushed left or right and without having to set vx or vy to zero?

sentences:
How can I simulate the effects of network latency to test my lag compensation? I am trying to observe the effects of lag compensation in my game by increasing my ping to 200+, adding loss, and by the limiting bandwidth to simulate wide area network delays using Network Emulator for Windows Toolkit.

It seems no matter the degree of latency that is applied I never see any visual changes to my character position on the server, as the lag compensation / interpolation method is always able to predict my exact position.

But in real-world situations, players connected from a far distance away do have poor synchronization. How can I produce the same poor synchronization that I witness in players connected from a far distance so that I can choose the ideal lag compensation technique for my game.

For reference, I'm making this game using Unity 3D and it's a fast-paced, twitch shooter game.

sentences:
How do online games deal with lerp overshooting? From what I understand, when you lerp in an online game, you travel from point a to b based on the elapsed time since the last update. The problem is when you have a higher latency, and you start receiving updates at inconsistent rates. So lets say I have variable t, variable t tracks the time since the last update and is only reset when a new update is received. The variable t is also responsible for moving the lerp like so:

lerp(a, b, t)

But when we receive updates at an inconsistent rate, t is reset inconsistently, so if there is any lag between the updates, t will keep incrementing, thus, the lerp will overshoot. How do online games deal with this?

sentences:
How can I do a Metroid like transition between two tilemaps with Monogame Extended? I want to do a transition like those in the Metroid games. Here is an example of what i mean: https://www.youtube.com/watch?v=RKJ3MAi0ZI0.
You enter the door, the screen fades to black and the camera scrolls to the next room where the screen fades in again.

I'm using Monogame Extended and i have a TiledMap. I use them like described in the documentation. I have a camera with a view matrix and a projection matrix

   Camera2D camera;

   ...

   public void DrawGame(GameTime gameTime, SpriteBatch spriteBatch)
   {
        var viewMatrix = camera.GetViewMatrix();
        var projectionMatrix = Matrix.CreateOrthographicOffCenter(0, gDevice.Viewport.Width, gDevice.Viewport.Height, 0, 0f, -1f);

        tiledMap.Draw(viewMatrix, projectionMatrix);
   }

My idea is now to create a second tiledMap to placing them directly next to the first one where the transition occurs. Then i just have to move the camera from one map to the next one. My problem now is that i have no clue how to put them next to each other. From my understanding i somehow have to use the view and projection matrix to draw the tiledMap but i can't figure out how it should work with two tiledMaps.

sentences:
What is the future of XNA in Windows 8 or how will managed games be developed in Windows 8? I know this is a potential dupe of this question, but the last answer there was 18 months ago and a lot has happened since.

There seems to be some uncertainty about XNA in Windows 8. Specifically, Windows 8 by default uses the Metro interface, which is not supported by XNA. Also the Windows 8 store will not stock non-metro apps, so it will not stock XNA apps.

Should we stick with XNA or does Microsoft want us to move to a different framework for managed game development in Windows 8?

Edit: As pointed out in one of the comments, Windows 8 will be able to run XNA games in a backward compatibility mode. But that smells of deprecation.

sentences:
How to install java 3d in ubuntu I'd recently asked a question for getting started in game development from where I was suggested for the book "Killer Game Programming-Java".

On the page there is a java 3d program which needs to be installed. I'd downloaded and installed java3d file from here and also from the sun/oracle's site. But the program given there is not working.

I would like to know how to install that java3d package in Ubuntu 10.10, and also is there any need to set environmental variable $PATH or classpath for java, and if so, how to do that?

The downloaded version of java3d is 1.5 and it is a .bin file.

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:
Why should I choose to design a health bar rather than heart containers? When designing any hero-based game, be it adventure, RPG, brawler, or similar, you eventually need to decide on your health system. Barring any regenerative systems with zero UI (like Call of Duty), should you use a discrete set of heart containers, Zelda-style, or a continuous health bar, like Street Fighter?

Here are some points of contention that I've been thinking about:

Hearts are easier to understand (very clear how many hits you can take)
Hearts give a better sense of accomplishment when expanding (A whole extra heart! Rather than just a slightly longer bar (or worse, no change))
Hearts grow to take up a lot of screen real-estate, while health bars can stay compact
Health bars allow for really fine control over health/damage balancing (using float rather than int)

Since I haven't been able to find any relevant game design articles on the subject, I'd really appreciate if everyone with some knowledge on the matter, or even just some insightful links would contribute, thanks!

sentences:
Is Unity NGUI still that usable after Unity has add support for 2D? I am tempted to refactor out the existing component which uses NGUI ("Next-Gen UI kit") given that what I needed is only the sprite and texture atlas.

Since in the newer versions of Unity those parts are natively supported, is there any reason I should still keep NGUI?

sentences: is ECS a kind of (or vs) OOP? Is Entity Component System (ECS) considered a part of OOP or is it a completely different concept?

sentences: How do I make a 2D sprite flash green when tapped? I have a sprite that is based on an image of a gray circle. When the user touches the sprite, I want the sprite to flash green, as in I want the circle to appear to turn green for 0.2 seconds. I tried setting the color of the sprite via SpriteRenderer's function SetColor, and it blended the color with the initial gray color of the sprite, so I got a very dark green even though I'm really sure I didn't mess up the values when I created the color. Now I'm trying to get my flashing effect by using separate images. I have the images I need, and I have a message getting logged when I tap the circle, I just need to setup a non-looping animation and trigger that animation in my code.

sentences: Will reseting a scene instead of reloading it improve performance? I made a 2D infinite runner. My game was approved for iOS and now pending release. However, on Android, performance is a nightmare. So I'm tweaking to optimize performance. As it stands now, there is game scene and game over scene. On game over scene, there is "Play Again" button that reloads the game scene. Now, if instead of having separate scene, if i handle the play again in same scene, will it be better than reloading the scene? What i could do is, have initial speed, position etc stored in array for example and when play again is clicked, set all gameobjects to the initial values. Will the performance be better with this? since gameobjects are now not getting destroyed and reloaded?

sentences:
How do I tile a specific region of a sprite? I have a sprite that I use as a sprite sheet, where regions of the image represent various UI elements (window corner, border, background, etc.).

I want to use a certain region of that sprite as a texture that I can tile over a larger destination rectangle.

Setting the SamplerState to LinearWrap and then calling SpriteBatch.Draw with destination rect and source rect ends up stretching that region of the image, not tiling it.

All the examples I've seen that implement tiling use the entire sprite - I only want to use a region of it, and tile that region.

Is there any way to do this?

Edit for clarity:

Here's an example spritesheet

where I want that colored region. I have a rectangle that represents a window border, that is larger than the region in the source image.

Here's what I want to end up with

Here's the code I've been using.

spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null);
spriteBatch.Draw(sourceTexture, windowTopBorderRect, sourceTextureRegionRect, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);

And what I get is the image stretched across the window border rectangle, instead of tiling the source region within that rectangle.

sentences:
Understanding Fixed time step From what I understand about time based Euler Integration is that you will set a number of pixels you want your object to move in the space of second and then the value will be regulated based on the frame-rate of the machine your running the game on.

What I'm having issue with is this

 You will set your acceleration

 acceleration = 30;

Then that acceleration will be added to the velocity and multiplied by the time
   which would be say  0.0166667 if the frame-rate is 60fps which will cut down the
   velocity to the appropriate number for that frame which would be 0.50001

velocity += acceleration * dt;

but then when you add the velocity to the position it yet again multiplies the result by 0.0166667 which leaves you with 0.0833366667

position += velocity * dt;

What I'm trying to get is that instead of the 30 pixels per second I initially intended for the character to move I will need to put in an acceleration value of 1800.

I was wondering why this is done instead of simply multiplying the acceleration by the dt and leaving it at that ?

sentences:
In a casual top-down racing game, should collisions affect the car's engine? Is there a way to deter players from colliding with obstacles in a top-down casual racer which keeping the game fun and lighthearted and yet make player's skill matter?

Should collisions affect car engine performance in a casual racing game? If so, in what way could it be done that keeps it fun?

Please use references (to other games) and examples in your answers.

sentences:
Change the alpha blending color of scaled textures It looks like semitransparent pixels are blended with while color when textures are drawn scaled. It is very noticeable and looks ugly when textures are drawn on dark background.

public class SomeScreen implements Screen {
    private TextureRegion textureRegion;

    @Override
    public void show() {
        // Loading texture
        Texture texture = new Texture(Gdx.files.internal("texture.png"), true);
        // Setting filter to "linear"
        texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
        // Getting the region
        textureRegion = new TextureRegion(texture, 0, 0, 64, 64);
    }

    @Override
    public void render(float delta) {
        // Clearing screen
        Gdx.gl.glClearColor(0.09f, 0.09f, 0.09f, 1f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // Drawing textureRegion
        Game.instance.batch.begin();
        Game.instance.batch.draw(textureRegion, 100f, 100f, 256f, 256f); // Actual texture region size is 64x64px
        Game.instance.batch.end();
    }
}

I need to get rid of that white noise around the shape, bud don't know how.

Source image:

Draw results:

sentences:
Control sprite animation speed using Create JS How can I control the animation speed of a sprite using create JS?

When you press right and left, the sprite will run through the frames... I'd like to leave the fps at 60, but alter how fast the frames are looped through without altering the main game FPS rate.

See a demo here. Press right and left arrow to see.

I thought changing the bmp animation frequency property would do the trick...

bmpAnimation.frequency = 2;

But it did  not work...

Or should I be using the jQuery animation?

Also, I noticed that each time I hit a random key, the animation plays 1 frame then goes back to first frame. Why is that?

Thanks!

sentences:
Scaling an SDL Surface I want to create a button for a game's UI. The background uses a gradient and then I blit a surface on top of the gradient and use SDL_SetColorKey to delete the unwanted pixels. The surfaces are not the same size: the clipping mask is 200 x 50 and the gradient 1 x 50, so I need to stretch the gradient to the same width of the cliping mask, I can't use a wider image because the purpose of doing this is to save memory and storage and using the same gradient image on multiple clipping_masks of different widths.

I found I can use SDL_BlitScaled but I need to blit the surface to itself and it appears to be useless because the surface remains the same size, am I doing something wrong?
Is there a way to do it without blitting the surface to itself?

SDL_Rect final_size;
final_size.w = 200;
final_size.h = 50;
final_size.x = 0;
final_size.y = 0;
SDL_BlitScaled(gradient_surface, NULL, gradient_surface, &final_size);
//do some stuff with those textures
SDL_CreateTextureFromSurface(renderer, final_button_surface);

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:
Turn-based Client-Server Card Game - Unicast (TCP) or Multicast (UDP) I am currently planning to make a card game project where the clients will communicate with the server in a turn-based and synchronous manner using messages sent over sockets. The problem I have is how to handle the following scenario:

(Client takes it turn and sends its action to server)

Client sends a message telling the server its move for the turn (e.g. plays the card 5 from its hand which needs to placed onto the table)
Server receives messages and updates game state (server will hold all game state).
Server iterates through a list of connected clients and sends a message to tell of them change in state
Clients all refresh to display the state

This is all based on using TCP, and looking at it now it seems a bit like the Observer pattern. The reason this seems to be an issue to me is this message doesn't seem to be point-to-point like the others as I want to send it to all the clients, and doesn't seem very efficient sending the same message in that way.

I was thinking about using multicasting with UDP as then I could send the message to all the clients, however wouldn't this mean that the clients would in theory be able to message each other? There is of course the synchronous aspect as well, though this could be put on top of the UDP I guess.

Basically, I would like to know what would be good practice as this project is really all about learning, and even though it won't be big enough to encounter performance issues from this I would like to consider them anyway.

However, please note I am not interested in using message oriented middleware as a solution (I have experience with using MOM and I'm interested in considering other options excluding MOM if TCP sockets is a bad idea!).

sentences: Unity Editor - Adding Object Fields on button click So I am trying to make a button that will spawn an object field and a float field when clicked. Each object field being unique, so I can add gameobjects to it. I can’t think of a way to do this. This is purely Editor Scripting. Also, if there is an option to delete a row (the object field and the FloatField) that would be amazing

sentences:
Is it possible to make calculations in a Quake 3/Live hud? I would like to add a new field to a Quake 3/Quake Live HUD that shows the following number:

min(health + armour, health * 3) * (1.5 if guard_rune else 1)

This is the amount of damage you can take before getting killed, btw.

Is this even possible?

sentences:
Complex collisions in pygame I've seen many tutorials for simple rectangle or circle-based collision detection with pygame.

But how can I do more complex collisions with arbitrary polygons?

Is the only option pixel-based collision detection?

sentences:
IDE & Debugging of Official SDK for wii and ps3? I remember hearing that wii and the ds uses CodeWarrior as their IDE. I know xbox uses visual studios but i have no idea what ps3 uses.

What IDE do ps3 developers use and how do they debug? How do wii programmers debug? I always heard they use GDB but is that built into CodeWarrior or is that a separate application?

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: Clickable Text Render Actor So I couldn't find anything online for this, but I want to make my text render actor clickable for my main menu. For example, when "New Game" is clicked it starts a new game. If you have any answers, please leave them for me! Tysm! :>

sentences:
Disable and re-enable image tracking ARKit Is there a way to disable and re-enable tracking for images in ARKit? From the older versions, this was the solution. But the newer versions have removed the UnityARSessionNativeInterface script.
void Start ()
{
    m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
}

void AddImageAnchor(ARImageAnchor arImageAnchor)
{
    //at the bottom of this function
    StartCoroutine(RemoveAnchorCoroutine(arImageAnchor));
}

IEnumerator RemoveAnchorCoroutine(ARImageAnchor anchor)
{
    yield return new WaitForSeconds(3.0f);
    //doesn't have to be in a coroutine, but for my uses it is
    m_session.RemoveUserAnchor(anchor.identifier);
}

sentences:
How to set my game to load low-level drivers from a different System32 folder path The title says it all
I'm doing a test with my game
and I need to know how to set it up
where my game loads low-level drivers from a System32 Folder that is
in another path instead of this

example: C:\Windows\System32

a new path I want to have my game load drivers from:
D:\Windows\System32

and can I make my game load low-level drivers from this path
with some c++ coding in visual studio?

sentences:
For my first 3D engine, should I go for one that is already made, or minimalistic? I've been meaning to transition from 2D games to 3D games for some time, now. I have the most experience with RTS games, so I will be doing that.

On one hand, there's a lightweight renderer; Irrlicht. However, considering it's a renderer and not a game engine (only basic collision, etc..) , I would have to write most of the things, myself.

On the other hand, there's a full blown engine like CryEngine 3, for example. Although it is mostly complete, I would first need to understand the various parts of the engine and it's implementation enough to be able to try and transform it into an RTS engine.

My question is, which would be easier for me to transition to?

sentences:
Calculating distance by force I am trying to predict a ball(sphere) movement. The formula of force which I know is

Force=Mass*Accelaration

What I want is how can I get distance or displacement by giving particular force? I want to consider drag, angular drag and friction also included in the equation. Or if it can be vice-versa, calculating force needed by providing distance.

The equation I could find doesn't include drag and friction, thus they are not as accurate as I needed. Any help in generating the exact formula would be appreciated.

sentences:
How can I generate roads such as those in the game Twisty Road? Here is a link to see the gameplay: https://www.youtube.com/watch?v=03PzsgO-uAM
How could I procedurally generate the path upon which the ball rolls in Unity/C#?
I know I could model distinct pieces of the road in Blender and import them into Unity as prefabs. My problem is, I genuinely have no idea where to start when it comes to programmatically generating the whole road out of those prefab sections in a cohesive manner, such that the road is built seamlessly and randomly with twists and turns in three-dimensional space.
I would appreciate any insight you could provide. Thank you.

sentences:
Why are pyglet.image and texture so heavy? Envrionment:

python: 3.6.6
pyglet: 1.3.2

Here is my code and results:

import pyglet

images = []
textures = []

with_textures = True
count = 10
for x in range(count):
    image = pyglet.image.load("big.png")  # 2.1 Mb source 2400*2400px
    images.append(image)
    if with_textures:
        texture_grid = pyglet.image.ImageGrid(image, 10, 10).get_texture_sequence()
        textures.append(texture_grid)

# RES in htop result without textures
# count = 10 - 300Mb
# count = 20 - 553Mb
# count = 30 - 753Mb
# count = 40 - 973Mb
# ~23Mb just for each Image

# RES in htop result with textures
# count = 10 - 996Mb
# count = 20 - 1878Mb
# count = 30 - 2716Mb
# count = 40 - 3597Mb
# ~86Mb for Image and prepared grid

input("Press enter to exit")

Questions:

Why each 2.1Mb file leads to 23Mb of memory usage with pyglet.image.AbstractImage?

If ImageGrid is used for creating sprite sheet -> it leads to additional ~60Mb

How to deal with it? Because if game contains 50+ big sprites it would be not real to dedicate such many memory only for textures.
Maybe there is some other approach in creating games which is used sprites? Or I should change my stack technology(pyglet as main library, also was trying with pygame) for client side?

PS: First time I've rewritten my application from pygame to pyglet, because I didn't consider some aspects of event loop in pygame, and now I hadn't test resource usage of pyglet library for my use-cases.

Update/clarification:

I'm using ImageGrid as for 3d part in vertices as for 2d part in pyglet.sprite.Sprite

Example of using in 3D part:

# texture_group is created once for each sprite sheet, same as texture_grid
texture_group = pyglet.graphics.TextureGroup(texture_grid, order_group)
...

tex_map = texture_grid[self.texture_grid_index].texture.tex_coords
tex_coords = ('t3f', tex_map)
self.entity = self.batch.add(
    4, pyglet.gl.GL_QUADS,
    texture_group,
    ('v3f', (x, y, z,
             x_, y, z,
             x_, y_, z,
             x, y_, z)
     ),
    tex_coords)

Example of using in 2D part:

pyglet.sprite.Sprite(img=texture_grid[self.texture_grid_index], x=0, y=0,
                     batch=self.batch, group=some_order_group)

Update #2:

As I figure out, allowed sizes for using pyglet.image.CompressedImageData is:

1 True
2 True
4 True
8 True
16 True
32 True
64 True
128 True
256 True
512 True
1024 True
2048 True
4096 True

But can't get texture from CompressedImageData:

big = pyglet.image.load("big.png")  # 2048*2048
compressed_format = pyglet.graphics.GL_COMPRESSED_ALPHA
compressed_image = pyglet.image.CompressedImageData(
    big.width, big.height, compressed_format, big.data)
compressed_image.texture  # exception GLException: b'invalid enumerant'

Tried with all possible GL_COMPRESS in pyglet:

allowed_formats = [x for x in dir(pyglet.graphics) if "GL_COMPRESSED_" in x]
big = pyglet.image.load("big.png")  # 2048*2048
for form in allowed_formats:
    compressed_image = pyglet.image.CompressedImageData(
        big.width, big.height, form, big.data)
    try:
        compressed_image.texture
        print("positive:", form)  # 0 positive prints
    except Exception:
        pass

sentences:
Algorithm to fill a shape defined by 4 pixel points? I'm developing an application in Unity3D where a user can define 4 pixel points on screen, and what I would like to do is fill this shape with pixels using Unity's SetPixel.

While I can do this easily for square or rectangular shapes, I was wondering if there is any efficient code or algorithm to do this for more irregular four-sided shapes, such as trapezoids etc.

Note : Filling the shape with a mesh is not an option.

So far the best option I can think of is to draw the outline, then draw a line from each pixel point of every outline, to every other outline point, but I'm not sure that's very efficient.

sentences:
What is the most efficient way to work with lip sync/facial expressions in XNA? I've been searching for an answer forever, but I haven't found one. What options are there for lip sync/facial expressions in video games made with XNA? I have a few models for a game I'm building, and I would like to know if it would be better to set up an animation for every dialogue, but that would be very time-consuming and the whole collection of files would result in a massive-sized program.

I was thinking about an automated lip-sync system, but I wouldn't know where to start! Any thoughts?

sentences:
One index buffer with multiple vertex buffers? I noticed that there's IASetVertexBuffers() to set multiple vertex buffers at once but there's only IASetIndexBuffer() to set one index buffer. So I assume that I can simultaneously only have one index buffer set but I can have multiple vertex buffers set at the same time.

Is that correct?
How do I use index buffer with multiple vertex buffers? I.e. what indices do I provide to use more than one vertex buffer and how do I know what buffer conrete indices refer to?

Or is this used only in the case when instead of interleaved vertex data: (Pos, Normal, Pos, Normal, Pos, Normal) I provide the data in multiple buffers: (Pos, Pos, Pos) (Normal, Normal, Normal) and conrete indices refer to the same vertices in each buffer?

sentences:
What's the best way to handle slopes for a platfomer game using Box2D I would like to know if there is any known solution for handling the player's movement on slopes using Box2D engine.

I tried to do it using a circle as the player. Everything was fine until I tried to walk on slopes, the main problem is that due to gravity, the circle does not stop on the slope.

Please if somebody has tried this before I'll appreciate it. If you have a better solution without the physics engine would be fine for me too.

Thank you.

sentences:
Models keep turning white - Unity 5.3.5p1 I'm using Unit 5.3.5p1 but for some reason my models randomly turn white after I build an exe to run outside the editor.

The textures work perfectly fine within the editor, but as soon as I build and run outside - they sometimes show with appropriate colour, but many times do not and end up blank white.

Does anyone know what might be causing this in general? I've downloaded the latest unity shaders and replaced all current shaders. Currently I'm using the Standard shader only, and it is 100% unmodified.

sentences:
Why does exporting to FBX in 3dmax loses simulated animation I made a cloth simulation (wind blowing a cloth). When I export it to FXB and the animation box is ticked on export menu it seems ok (no error in longs). When I reload it to Unity. or 3DMAX again. The wind animation is lost. How can I fix that?

Thanks

sentences:
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:
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:
How can make an object orbit a sphere in a random direction? How can I move an object on a random orbital path around a sphere?

I've created some objects at an initial position that is essentially a random point on the sphere offset by some distance (say, 10.0).

Now I want to choose a random direction and have the object orbit the sphere in that direction. How can I accomplish that?

sentences:
How to run my game outside of visual c++ I am having trouble running my game. It works fine when I run it from Visual C++, but when I try to open the .exe, it complains that it can't find SDL.dll.

What should I do in order to play the game?

sentences:
Freeglut vs SDL vs GLFW I need to port my game project from Android (written in C, OpenGL ES 2.0, thanks to NDK) to Windows and Linux platforms. Of course I will need to rewrite some platform dependent code, but for now I'm stuck with the question of which library to use for creating OpenGL context and handling input.

Just a quick googling gives me 3 candidates:

FreeGLUT - rewritten and free good old GLUT.
SDL - most well know one lib, used in many games.
GLFW - some kind of newer library, but simple and functional.

I'm quite new to PC development and don't see any significant differences between them.
Can you help me with the choice? I need only core mouse/keyboard input and creation of OpenGL context. I'll be using GLEW to load OpenGL functions.

sentences:
How can I manually construct a right-handed orthographic projection matrix? I need the formula to create a orthographic projection matrix. I am using GLM math libary and DirectX11. The reason I cannot use GLM to create it is because the NDC spaces are different between DX11 and OpenGL, thus I need to manually create one.

I am however using right-handed coordinate system and column-major matrices, just like GLM.

This is my attempt, but I get wrongly images when rendering with it, so it is probably wrong. I am using it for cascading shadow maps, and from the graphics debugger, I probably need to mirror it, but it is just a guess. Any ideas?

Mat4 OrthographicMatrix(const float left, const float right, const float top, const float bottom, const float zNear, const float zFar)
{
    Mat4 ret(1.0f);

    ret[0][0] = 2.0f / (right - left);
    ret[1][1] = 2.0f / (top - bottom);
    ret[2][2] = 1.0f / (zNear - zFar);
    ret[3][0] = (left + right) / (left - right);
    ret[3][1] = (top + bottom) / (bottom - top);
    ret[3][2] = (zNear) / (zNear - zFar);

    return ret;
}

sentences:
Unity generates bad mipmap, making voxel terrains look bad It's just a dirt terrain with grass blocks on the top. (which are just dirt blocks with green tops.)

I sampled a Unity terrain's heightmap, and constructed a voxel terrain based on it, and divided it into chunks, whose meshes then were combined.

Sadly the generated mipmaps are bad, the mipmap change is easily noticeable: first the shade of green changes, then it fully becomes dirt colored.

sentences:
OpenGL Texture Loading I've been using OpenGL for a bit so I have a general idea of what I'm doing. Recently, I've been working on a framework to let me test stuff more easily. As part of the framework, I split up loading images into OpenGL into two parts, one where I load the data (ie from a file) and another part where I actually send the data to OpenGL. However, when I use the system I designed, only a black triangle is displayed. When I bypass the system I created and load the texture directly into OpenGL using SOIL's SOIL_load_OGL_texture function, everything works with no other changes. Here's the relevant sections of code:

Main.cpp

// Section commented out to test loading a texture using SOIL instead
/*
Texture::Texture2DSource texData;
texData.loadTextureFromFile("Background.png", Filesystem::FOLDER_TEXTURES);
auto texture = Texture::Interface::getSingleton().loadTexture(texData);
// Debugging function I added to access the texture ID directly
GLuint textureID = texture->getTextureID();
*/

// Load the texture using SOIL as opposed to my texture loading classes
GLuint textureID = SOIL_load_OGL_texture(
    "C:\\Users\\Username\\AppData\\Roaming\\Test\\Textures\\Background.png",
    SOIL_LOAD_RGBA, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);

glActiveTexture(GL_TEXTURE0);
// This line is used when the SOIL texture loading is used
glBindTexture(GL_TEXTURE_2D, textureID);
// I hardcoded in 0 as the uniform ID just for testing; normally I query the
// uniform ID and use that
glUniform1i(uniformID, 0);

Vertex Shader:

#version 440

layout(location = 0) in vec2 vertex;
layout(location = 1) in vec2 uvData;
out vec2 uv;

void main()
{
    gl_Position = vec4(vertex, 0.0f, 1.0f);
    uv = uvData;
}

Fragment Shader:

#version 440

in vec2 uv;
out vec4 color;
uniform sampler2D textureSampler;

void main()
{
    color = texture(textureSampler, uv);
}

C++ code for loading a texture into memory:

// Create variables to store the image dimensions and properties
int width = 0;
int height = 0;
int channels = 0;

// Load the image
auto data = SOIL_load_image(fileLocation.c_str(), &width, &height, &channels,
    SOIL_LOAD_RGBA);

// Resize the texture's vector to the same size as the array returned from SOIL
m_data.resize(width * height);
// Copy the data from SOIL's array to the vector
const uint32_t BYTES_PER_PIXEL = 4;
memcpy(&m_data[0], data, width * height * BYTES_PER_PIXEL);
// Set the dimensions
m_x = width;
m_y = height;

// Flip the image
// Code omitted as irrelevant

C++ code for loading the texture data into OpenGL:

// Set up the texture storage
GLuint textureID = -1;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
// Load the texture data
glTexImage2D(
    GL_TEXTURE_2D,      // Texture Target
    0,                  // Level of Detail level
    GL_RGBA,            // Internal Format
    data.m_x,           // Width
    data.m_y,           // Height
    0,                  // Border (must be 0)
    GL_RGBA,            // Pixel Data Format
    GL_UNSIGNED_BYTE,   // Data Type
    &data.m_data[0]     // Texture Data
    );

// Set texture filtering options
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_MIPMAP_NEAREST);

// Create a Texture object and load the texture ID into it, then return it
Texture<GL_TEXTURE_2D> texture;
texture.m_textureID = textureID;
return texture;

Here's some more images:

This is what the window shows when using my texture loading process.

This is what Nvidia NSight shows for the Fragment shader.

This is what the window shows when bypassing my texture loading process.

This is what Nvidia NSight shows when bypassing my texture loading process.

NSight shows the texture as loaded properly for both texture loading processes, and everything else seems to be the same. Any ideas on what's causing the issue?

sentences:
How do I create a playing field of collapsing bubbles, as in Tsum Tsum? Tsum Tsum App is a pretty interesting game and I am wondering how the main play area's data structure is, erm, structured?

Characters are stacked, disappear as the player swipes over matching ones, causing the ones above to fall down and replace them.

Tsum Tsum ⓒ Disney, via games.disney.com

Initially, it seems that it is a 2D hex grid?  But I see a lot of physics going on (Tsum Tsum bounce and roll off of each other).  In fact, it seems that even as you try to connect them that the chain can be interrupted while the Tsum Tsum are falling away from its closest neighbor.  Also, if you connect enough Tsum Tsum, a power-up bubble appears in the chain, which  pushes the Tsum Tsum out of the way.  So I'm doubting that this hex grid is constantly updating with the position of the Tsum Tsum given that the Tsum Tsum rarely stops moving.

sentences:
How to clamp a direction vector within a direction pyramid? In 2D you can specific an angle range such as [-45 to +45] and clamp a 2D direction vector within that angle range. I want to have something similar for 3D. I want to specify the allowed directional range as a center directional axis with a local y-axis range and a local x-axis range and clamp an arbitrary 3D directional vector within that range. How do I do that?

For example, I want to specify a angle range as axis (1,0,0) with [-30 to 30] as the local y-axis angle angle and [-10 to 10] as the local x-axis range. So that something like (0.95,0.1,0.1).normalized() would not be changed but (-1,0,0) would be clamped to an appropriate vector.

sentences:
Moving camera in 3D - directX12 I begin to learn graphic programming on directx12. I try to make a camera wich can move dans rotate around the world.

I take this code as a basis:
https://www.braynzarsoft.net/viewtutorial/q16390-transformations-and-world-view-projection-space-matrices

I try lot of method, but every time I finish on the same problem, my camera move and can rotate (on Y only for the moment). But when I move after the control still relative to my basis orientation than my new one.

I dunno if it come from how I handle movement (During waiting answer I will try to make my movement base on a target vector) Or how I multiply martix.

This is the actual point of my code. I use this source to not use LookAtLH():
https://www.3dgep.com/understanding-the-view-matrix/

void UpdateCamera() {

    XMVECTOR cUp = XMLoadFloat4(&cameraUp);

    if (GetAsyncKeyState('Z')) {

        cameraPosition.y += 0.001f;

    }
    else if (GetAsyncKeyState('S')) {
        cameraPosition.y -= 0.001f;
    }

    if (GetAsyncKeyState('Q')) {
        cameraPosition.x -= 0.001f;
    }
    else if (GetAsyncKeyState('D')) {
        cameraPosition.x += 0.001f;
    }
    if (GetAsyncKeyState('A')) {
        rotation += 0.0001f;

    }
    else if (GetAsyncKeyState('E')) {
        rotation -= 0.0001f;
    }

   if (GetAsyncKeyState('P')) {
        cameraPosition.z += 0.001f;

   }
    else if (GetAsyncKeyState('M')) {
        cameraPosition.z -= 0.001f;

    }
    XMMATRIX translationMat =     XMMatrixTranslationFromVector(XMLoadFloat4(&cameraPosition));
    /* XMMATRIX rotYMat = XMMatrixRotationAxis(cUp, rotation);*/

    float cosPitch = cos(0.0f);
    float sinPitch = sin(0.0f);
    float cosYaw = cos(rotation);
    float sinYaw = sin(rotation);

    XMFLOAT3 xaxis = { cosYaw, 0, -sinYaw };
    XMFLOAT3 yaxis = { sinYaw * sinPitch, cosPitch, cosYaw * sinPitch };
    XMFLOAT3 zaxis = { sinYaw * cosPitch, -sinPitch, cosPitch * cosYaw };

    XMVECTOR eye = XMLoadFloat4(&cameraPosition);

// Create a 4x4 view matrix from the right, up, forward and eye position vectors
    XMMATRIX viewMatrix = {
        xaxis.x,yaxis.x,zaxis.x,0.0f,
        xaxis.y,yaxis.y,zaxis.y,0.0f,
        xaxis.z,yaxis.z,zaxis.z,00.0f,
        -XMVectorGetX(XMVector3Dot(XMLoadFloat3(&xaxis), eye)), -XMVectorGetX(XMVector3Dot(XMLoadFloat3(&yaxis), eye)), -XMVectorGetX(XMVector3Dot(XMLoadFloat3(&zaxis), eye)), 1.0f
    };

    XMStoreFloat4x4(&cameraViewMat, viewMatrix);// XMMatrixInverse(nullptr, translationMat * rotXMat));

}

void Update()
{

    UpdateCamera();
     ///....

}

sentences:
How can I make A* finish faster when the destination is impassable? I am making a simple tile-based 2D game, which uses the A* ("A star") pathfinding algorithm. I've got all working right, but I have a  performance problem with the search. Simply put, when I click an impassable tile, the algorithm apparently goes through the entire map to find a route to the impassable tile—even if I'm standing next to it.

How can I circumvent this? I guess I could reduce the pathfinding to the screen area, but maybe I am missing something obvious here?

sentences:
How to insert animation into table? I'm having trouble inserting animation into my libGDX table cell.
I have a class which holds 2 tables, one on the left and one on the right. First table is for labels/buttons/other stuff. Second table is for animation, which should change if user clicks a button.

I've created Animation class which holds up different animations. The problem is that when I try to add an animation class into the table cell, I get an error because my Animation does not extend nor implement Actor class, thus I can't insert it into the cell. What should I do? How do you insert class of type animation into table cell?

sentences:
Returning a List of coords for a sphere in order of inside to outside I'm looking for any algorithm that can return a list of Vector3 coordinates that form a sphere. If you read the list from the beginning it would appear the sphere was expanding.

The only algorithms I've found are for circles, the algorithm doesn't have to make a sphere of a particular radius, just a number of coordinates would be fine.

If anyone could point me in the right direction for such an algorithm that would be great. Any language or even just sudo code for a basic algorithm would be appreciated.

sentences:
A class for all levels or for each level an own class? My Game become more complex with each new Level or Map that I design.
The game is an basic rpg game like Pokemon.

For now I have one class that organize all Maps but different maps have special features and different Monsters.

Better use for each Map an own Class and have duplicated code
or is there a specific pattern for this?

Edit:
My Problem: I can load the new map and play but all maps have different monsters and different events. I can't put all of them in the Game class and check all the time everything.

my class diagram in simple:

sentences:
Getting choppy, jumpy animation Hey I'm trying to get a smooth animation for my player movement. Earlier I changed my frames to render at fixed time(1/60 sec). Well that makes my player now run at a constant speed but the animation now appear to be choppy and it seems like the player jumps from one point to another instead of smoothly transitioning between them.
Below is my code and an gif animation of player movement. How do I make the animation appear smooth?

float deltaTime = 0;
float oldTime = 0;

//The direction in which the player will move
int playerX = 0;
int playerY = 0;

//callback method for keyboard events
void keyboard_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
    if (key == GLFW_KEY_W && action == GLFW_REPEAT) {
        playerX = 0; playerY = 1;
    }
    if (key == GLFW_KEY_S && action == GLFW_REPEAT) {
        playerX = 0; playerY = -1;
    }
    if (key == GLFW_KEY_D && action == GLFW_REPEAT) {
        playerX = 1; playerY = 0;
    }
    if (key == GLFW_KEY_A && action == GLFW_REPEAT)
    {
        playerX = -1; playerY = 0;
    }
}

//update player's position
void update() {
    player->move(playerX, playerY, TIME_PER_FRAME);
}

//set up glfw keyboard callback function and other stuff
void init() {
    glClearColor(0, 0, 0, 0);
    player->bindVertexAttributes(shader.getAttributeLocation("position"));
    glfwSetKeyCallback(window->getGLFWWindow(), keyboard_callback);
}

//wait logic
float expected_frame_end = glfwGetTime() + TIME_PER_FRAME;
void wait() {
    while (glfwGetTime() < expected_frame_end) {

    }
    expected_frame_end += TIME_PER_FRAME;
    playerX = playerY = 0;
}

//rendering function
void render() {
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    player->setUniformMatrixLocation(shader.getUniformLocation("projectionMatrix"), shader.getUniformLocation("transformationMatrix"));
    shader.useProgram();
    update();
    player->render();
    wait();
    shader.stopProgram();
}

//main function
int main(int argc, char** argv) {
    init();
//main loop
    while (!glfwWindowShouldClose(window->getGLFWWindow())) {
        render();
        window->swapBuffers();
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

sentences:
Why do I get 3 lines of log at Monitor.exe when using Debug.Log in Unity? I'm debugging a real device.
In a GUILayer.Button I've put a single Debug.Log() message, like in this code

Code:

if( GUILayout.Button( "Click to Test." ) )
{
    Debug.Log( "XAVI Clicked!" );
}

But in monitor.exe I get 3 lines, like the following ones:

To filter out messy messages from other applications, my filter is "tag:unity".
The APK is compiled with Development Build unchecked.

Problem:

I expected to see only one log line, with the text XAVI Clicked! but I also got a blank line and a line referencing a filename that I don't know what is it.

Those 2 lines are a consequence of "logging", not a consequence of "clicking the button", as if I remove my log sentence, then I do not receive my log but also I don't receive those phantom two lines (zero log lines then).

Questions:

Is there any way I get rid of those lines I don't want to see?
Is there any way I can create my own filtering tag inside the Unity?
How do you handle if you want to see exclusively your logs but not "extra logs" placed by the system?
Is there any reason that I should keep watching those lines? Are they carrying meaningful intormation? What do they tell to me that is relevant to me?

Thanks.

sentences:
How to render apart blocks of a cone in OpenGL I want to render a cone in parts like on the image. My problem is to calculate the arc of each block in 3D space.

has someone an idea how to handle this?

sentences:
ETC1 texture opacity I'm using the cocos2d-x engine and want to support etc1 on android devices for my game.
For ETC1 i'm using the mali compression tool, and GLSL.

Everything is working, but I can't change the opacity of my sprites anymore.

my alpha blending is GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA .
can anyone help?

Here are one of my Textures with rgb tex + alpha tex

Vertex Shader:

attribute vec4 a_position;
attribute vec2 a_texCoord;
attribute vec4 a_color;

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoord2;

uniform sampler2D tex1;

void main()
{
    gl_Position = CC_PMatrix * a_position; //CC_PMatrix comes from engine
    v_fragmentColor = a_color;
    v_texCoord = a_texCoord;
    v_texCoord2 = v_texCoord;
}

Fragment Shader:

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoord2;

uniform sampler2D u_texture1; //alpha texture

void main()
{
    //CC_Texture0 comes from cocos2d-x engine and represents the rgb
    vec3 tex = texture2D(CC_Texture0, v_texCoord).rgb;
    float alpha = texture2D(u_texture1, v_texCoord).r;

    gl_FragColor = vec4(tex,alpha);
}

sentences: Reasonable amount of garbage collection for mobiles games? I'm making a 2D game for mobile and I noticed that my GC seemed to spike during attack. My normal GC is 40b but during attack it could spike to 2.2kb. I think this is really high specially when I saw a 3D game with only 8b GC. I would love to hear your thoughts about what's a reasonable amount of GC for mobile(e.g device with 512ram). I know I'm supposed to keep the GC as low as possible however I want to have a value I could compare to.

sentences:
Do Gradle 'implementation' replace Unity Jar Resolver dependencies? I have a project with several *Dependencies.xml files which the Unity Jar Resolver resolves fetching the .aar files and storing them on Plugins/Android.

When installing Ironsource, I saw in the documentation that it says to add the dependencies to the mainTemplate.gradle file:

dependencies {
    // Your other dependencies //
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-ads-identifier:16.0.0'
    compile 'com.android.support:support-v4:27.1.1'
    **DEPS**
     // Your other dependencies //
     // ... //
     // AdMob's dependency //
    compile 'com.google.android.gms:play-services-ads:17.1.1'
}

Because one of my dependencies that the jar resolver imports is an older version of support-v4 my build fails.

Seeing this new alternative, can I move all the dependencies files to the gradle file and let Gradle auto resolve this problem on the post build process?

Is there any pros/cons that the jar resolver has that Gradle doesn't? For what I know the Jar Resolver uses gradle.

sentences:
How can I implement a game locator or proxy server? I have a turn-based strategy game which already has a multiplayer server/client layer that works fine on local network (where one server is set up and players connect to it).

I would like to extend this architecture to allow players to play via Internet, but I don't want to have a dedicated game server for that, especially due to performance issues. The game's AI is runs on the game server of course, and multiple games with computer players would "kill" the machine.

I would like to have some kind of "central connection point" server that does not run the game logic, state or AI but can be used by players to find servers hosted by other players. How can I implement this?

sentences:
Memory dataflow for uniform variables? When a texture (2D) is supplied to a shader as a 'uniform' input, it is first uploaded to OpenGL using glTexImage2D() and then using glUniform1i() it is associated to shader uniform.

eg code :

Texture data

glTexImage2D(): is used to transfer texture data to the server side

glGetUniformLocation(): is used to access shader uniform handle

glUniform1i(): associates the data pointed by texture unit to the shader 'uniform'

but when we pass matrix (eg matrix4x4) to a shader as a 'uniform' input, when don't use any specific function to upload it to OpenGL.

(we just used to glUniform..() to associate the data with the shader input which we also used in the case of texture data)

Matrix data

glGetUniformLocation(): to access shader uniform handle

glUniformMatrix4fv(): to associate matrix data to the shader uniform input.

Where does the matrix data live in each step in the process of passing it to a shader as a uniform input?

Does matrix data always live on client side/ CPU accessible memory and fetched every frame by server side?
If it is uploaded to OpenGL:

which step/function call uploads the data?
where does the data live in OpenGL memory?
how its memory location is pointed?

sentences:
Where to show user shot's power on touch screen? I want to show user shot power in standart way
(the more user holds finger on the screen the stronger is shot)

Where is the best place to show this icon on touch screen(when I use mouse it's better to show it at the mouse position):

static at screen side or top
at finger position (how to handle clicking at screen bounds? what offset to use to avoid hiding behind finger?)

Will be glad to see any good examples you liked.

sentences: how to prevent call on OnValidate() when running game I need OnValidate() to be called only when I am designing my level (placing game objects at their respective positions and setting properties before running the project). But I don't want it to be called when I run the project. I can manually comment it out, but that will take a lot of time, since I have several OnValidate() calls. How can this be done, if it is possible?

sentences:
Random world Points in GLSL for tree placement I'm doing tree placement in the geometry shader in GLSL. I've made a seeded random vec3 function based on gold noise that looks like this:

vec3 randomVec3(vec2 xy, int seed)
{
  return vec3(gold_noise(xy, seed * 3), gold_noise(xy, seed * 3 +1), gold_noise(xy, seed *3 +2));
}

This works, but generates strange patterns in the trees. I can't find anything on making random numbers that isn't based on the fragment coord and unseeded - each run of the geo shader needs to generate 15~ random vec3s for trees based on a seed (area on the planet combined with an index for each tree). Here is my results so far:

You can see the diagonal patterns going through the tree clusters. This is what I want to reduce.

Thanks!

Edit: Here is my code that places trees in full

float gold_noise(in vec2 xy, in float seed)
{
    return fract(tan(distance(xy*PHI, xy)*seed)*xy.x);
}

void drawInstanceOnSphere(vec4 worldPos, vec2 sphericalCoords)
{
  //...Draws an instance at the correct height and rotation based on the
world position and spherical coords of the desired instance
}

//Generates a psuedo random vec3 based on a coord and a seed
vec3 randomVec3(vec2 xy, int seed)
{
return vec3(gold_noise(xy, seed * 3), gold_noise(xy, seed * 3 +2), gold_noise(xy, seed *3 +4));
}

//Places a set of trees
void placeTrees()
{
  //All following code assumes planet positon of 0,0,0, and no planet rotation
  //Find the point on the planet closest to the camera
  vec4 closestPoint = normalize(cameraPos) * radius;

  // if the surface is close enough
  if(distance(closestPoint, cameraPos) < 3000)
  {
    //Tree placement is based off this mechaninsim - a geo shader can draw 15
 trees per run before it becomes inefficient. Divide the spherical coords by 1000
 to generate a 1000x1000 grid across the planet. Each point becomes a new seed -
all trees will look the same in this "quadrant". This mean each shader run can
increase their own seed offset by 1 for each tree. I can then run 9 instances on
this shader, choosing the 9 closest "quadrants" to the player.

    //What are we dividing the spherical coords from ?
    float quadrantDiff = 1000;

    //Quadrant.xy is fed from the C++ code. Centre of the world map would be 0.5, 0.5
    vec2 quadrantCoord = quadrant.xy;

    //Get our world point from this coord. Centre of the world map with radius 3150 and origin 0,0,0 would be 0,0,-3150
    vec4 quadrantWorldPoint = (vec4(getWorldPoint(quadrantCoord),0));

    //Draw 15 trees
    for (int treeCount = 0; treeCount < 15; treeCount++)
    {
      //Range number - is fudge, looks okay
      float range = 8000 / quadrantDiff;

      //Position of the tree is the quadrantCentre point plus a random vec3,
 then normalized and multiplied by the radius to place it on the sphere.
Additional height to match terrain is added in the "draw on sphere" method

      vec4 treePos = normalize(quadrantWorldPoint + range *  (vec4(2.0 * randomVec3(quadrantCoord, int( treeCount + 15 * seedOffset)) - vec3(1),1))) * radius;

      //Get the tree's spherical coord for heightmap lookup
      vec2 treeCoord = getAdjustedTexCoord(getTexCoordFromPos(treePos));
      //Draw this tree
      drawInstanceOnSphere(treePos, treeCoord);
    }
  }

}

Here is another image showing the diagonal lines being worse. The centre quad seed for this image is (0.532, 0.532).

sentences:
Application is crashing with Ogre::ItemIdentityException I am new to OGRE and i am trying to create a 3D line using following tutorial: http://www.ogre3d.org/tikiwiki/Line+3D
and application is crashing with following exception Ogre::ItemIdentityException.

sentences:
Unable to move GameObject? This simulates a GameObject swinging between two positions.

I am unable to manually move a GameObject on the Y axis using the Unity editor (in scene view) when the following script is attached and running, it's like a solid animation:

Vector3 min, max;

void Update()
{
    min = wall1.position + new Vector3(4,0,0);
    max = wall2.position - new Vector3(4,0,0);

    transform.position = Vector3.Lerp (min, max, (Mathf.Sin(2 * Time.time) + 1.0f) / 2.0f);
}

sentences:
Finding the scale of pixels in map with given dimensions For the game I am making, I have textures for planets. Each texture has a size of 2048 x 1024 pixels. I also know the size, thus the diameter, of each planet. Not every planet is the same size, you know.

What is the size in kilometers of one pixel?

I know it has to do with the circumference - but I'm not sure this translates into a scale.

For example, let's say a planet is 18,872 km in size, so it's a circumference of about 59258,08 km (diameter * PI).

Can anyone provide pointers in the right direction?

sentences:
Can I use one set of images to represent multiple sprites in Java? I've got a game that has 3 basic sprites, at the moment I'm loading 8 images into each sprite for animating.
Each character class has a sprite object.
if I've got 10 characters on screen at once then that's 80 images loaded in to memory.
Can I make a central sprite class that only holds 8 images for each of the 3 sprites, then get the character objects to request the relevant images from the central sprite class, thereby massively reducing the memory required for the images?

sentences:
How to handle animations for a turn based deterministic game? I have a turn based combat system where all monsters act one turn, then all players, etc. The combat mechanics are completely deterministic - I can pre-calculate the outcome of a turn.

I'm interested if I should do all calculations ahead of time (monster A will be at X, monster B will be at Y), and then just play a bunch of animations based on these calculations:

(Calculate for A)
(Calculate for B)
(Animate A move to X)
(Animate B move to Y)

OR do one animation per calculation?

(Calculate for A)
(Animate A move to X)
(Calculate for B)
(Animate B move to Y)

sentences:
Blitting in AS3 with anti-aliasing? What would be the fastest method for doing anti-aliasing for a flash game that is drawn via blitting to a BitmapObject?

A method I thought of would be to make games stage smaller than the BitmapObject that the game is drawn to, and then somehow shrink it to the size of the stage.

Would that method work? If so what would be the fastest and highest quality to shrink the bitmap? Or would there be a completely different way to do it?

sentences: What is the game design lingo for the computer's ability to render shiny water? What is the game design lingo for the computer's ability to render shiny water? I am new to game design and I'm trying to write a formal paper to a colleague.

sentences:
Counting down a number of coins in the same total time duration, no matter the amount Math has never been my strong suit and so I'm having trouble figuring out how to write this formula.

When you buy something in my game, the amount it costs to purchase that item will be taken off from your total coin amount one by one. It's a loop that repeats itself till the amount that needs to be taken off is 0.
I have that system set in place, but I need to figure out a way to calculate the speed of decrease, or the time between each coin, making sure that each purchase will last the same amount of time, regardless of how much it costs.

What I figured out is that I need to come up with a formula in which the time it takes between each coins should become smaller/shorter the more coins it costs.

e.g. 10 coins taken from your total coin amount should take as long 200 coins.
10 coins  -> 0.1   seconds between coins -> 1 second total
200 coins -> 0.005 seconds between coins -> 1 second total
500 coins -> 0.002 seconds between coins -> 1 second total
And etc.

It would be greatly appreciated if anyone could push me in the right direction and/or give a little explanation to whether this is possible or not.

Thank you

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:
Inertia in flight simulation using box2d I'm trying to simulate flight using box2d and libgdx.

The main problem I am currently experiencing is with inertia: since there is no air, the plane looks like it were drifting.

I wasn't able how to turn off inertia.

I have two ideas:

Imitate air resistance by applying force
Imitate flight using linear velocity without using any box2d physics

Are any of these two ways correct? Or maybe there is way to turn off inertia?

sentences:
Convert 2d generated level to graph or analyze Do you have any idea how to extract graph data from this type of procedurally generated level?

Well, actually we need to analyze only top level (gray). Background (black) does not matter. What I am looking for is a way to statistically analyze such type of generated maps. For example how much isolated areas I have (it's not hard, I know), how much branches in each area I have and which areas has exit.

Do you remember any algorithm or math instrument to do that? Memory does not matter, algorithm complexity does not matter too. It's not runtime task.

P.S. A desired result can look like this:

sentences: Does fixed time step deltaTime get higher if the computer can't handle it? If you use fixed time step and set it to for example 0.0166667 does it ever go up if the computer can't handle 60 updates/ticks per second?

sentences:
Are there any hex tile sizes where both width and height are integers? I'm trying to figure out the optimal width and height (in pixels) to start building hex tiles for game development. My preference is for "flat topped" hex grids, but the math is similar for both.

I am looking for an "optimal" tile size that allows both the width and the height of the tile to be a rounded pixel number, based on the fact that height = sqrt(3)/2 * width.

My math skills being virtually nonexistent, I just ran a brute force script that ran through widths from 1 to 1024 and did not come up with a single value for w where h was an integer. Is this really the case? How does anyone create pixel-perfect hex tiles if there's no even width & height size that can accommodate a perfect hex aspect ratio?

sentences:
Is Time.deltaTime framerate dependent? I have a game that calculates your score via Time.deltaTime (the more time the more score). On my PC I get about 1200 points if I just idle the game while on my phone I only get about 400 points.

I believe my code must be FPS dependant and that's why my phone is getting a lower score for the same time.

Here's the code:

void Update ()
{
    time += Time.deltaTime;

    score += (int)time;

    timerLabel.text = score.ToString();
}

Sorry if it's something very obvious. I'm quite new at c#.

Can't seem to get the solution to work. It just stays at 0:

Full Code:

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

public class EndGame : MonoBehaviour {

    public Text textWin;
    public Text timerLabel;
    public GameObject retryButton;
    public GameObject points;

    private Vector3 offset;
    private float time;
    private float score;

    void OnTriggerEnter (Collider col) {
        if (col.gameObject.name == "Player") {
            setWinText ();
            retryButton.SetActive (true);
            points.SetActive (false);
        }
    }

    void setWinText () {
        textWin.text = "Final score: " + score.ToString();
    }

    void Update ()
    {
        time += Time.deltaTime;
        if (time >= 1.0f) {
            ++score;
            score -= 1.0f;
        }

        timerLabel.text = score.ToString();
    }

}

sentences:
How to manipulate PostProcessing effects settings during execution with c#? I need to change the intensity value of my current Vignette effect depending in specific conditions.
So far I haven't been able to achieve this. Please help!

Image of what I want to achieve:

My setup:

Unity 2019.3.5f1 with URP implemented
Post Processing Package (v2) installed
Scene with a GameObject + Volume component with Vignette and Bloom effect overrides added
A monobehaviour component script in the very same GameObject from above

My monobehaviour script:

using UnityEngine;
 using UnityEngine.Rendering.PostProcessing;

 public class PostProcessingHandler : MonoBehaviour
 {
   private PostProcessVolume _ppv;
   private Vignette _vignette;

   // Vignette intensity values
   [SerializeField, Range(0f, 1f)]
   private float _lowIntensity = 0.25f;
   [SerializeField, Range(0f, 1f)]
   private float _highIntensity = 0.5f;

   private void Start()
   {
     _ppv = GetComponent<PostProcessVolume>();
     Debug.Log(_ppv);
   }
 }

When I try to retrieve PostProcessingVolume component to get it's profile (and further layer manipulation) I always get "null".

Image of my setup:

I've seen several guides/posts and even Unity documentation but I cannot get past that starting point of getting the PostProcessingVolume component, what am i missing?

sentences: Two game object efficient and fast on-off switch I have two game-object, on GUI button click i am toggle between them but the problem is one game-object which is small contains less vertx etc., is loading fast while the other which heavy taking time. How do i efficiently and quickly load it ? I don't want to show loading window i want to load that game-object quickly?

sentences: OpenGL 4.4 LWJGL - How can i render text to the screen I have been told that you need to create a texture atlas for the font, and individually assign each character to a texture and add them up to create the string you want to produce. This seems a little more difficult than it should be. Is there another way? If not there must be documentation or a library someone wrote to do this. Can someone help me out?

sentences:
Instancing mirrored geometry I'm rendering mirrored geometry by flipping it's world matrix. Before rendering mirrored geometry I set CULL_FRONT rasterizer state (for normal geometry it's CULL_BACK). This works perfectly.

However, I've started implementing instancing and would like to instance mirrored and not mirrored geometry together. What's optimal way to do it?

So far I've considered:

CULL_NONE, but it has huge impact on shading performance
Geometry shader to flip triangles, but GS is generally slow

Is there any other option? I've found SV_IsFrontFace, but there's not much documentation about it. I would like to tell GPU in VS: Hey, this triangle should be flipped.

sentences:
Blur gets displaced compared to original image I have implemented a SSAO and I'm using a blur step to smooth it out. The problem is that the blurred texture is slightly displaced compared to the original. I'm blurring using a 4x4 kernel since that was my noise kernel in SSAO. The following is the blurring shader:

float result = 0.0;
for(int i = 0; i &lt 4; i++){
    for(int j = 0; j &lt 4; j++){
        vec2 offset = vec2(TEXEL_SIZE.x * i, TEXEL_SIZE.y * j);
        result += texture(aoSampler, TexCoord + offset).r;
    }
}

out_AO = vec4(vec3(0.0), result * 0.0625);

Where TEXEL_SIZE is one over my window resolution.

I was thinking that this is was an error based on how OpenGL counts the Texel center, so I tried displacing the texture coordinate I was using by 0.5 * TEXEL_SIZE, but there was still a slight displacement.

The texture input to my blur shader, has wrap parameters:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

When I tell the blur shader to just output the the value of the pixel, the result is not displaced, so it must have something to do with how neighboring pixels are sampled.

Any thoughts?

sentences:
How does one achieve a 'shimmering' effect similiar to the ones from the Pokemon games? I have an assignment to make a game in C++ using Winapi. As such I've decided to recreate pieces of the Pokemon games. I'm pretty well underway with the project, but there's one effect I would like to achieve that I don't really know how to achieve.

It can first be seen just before the game's title screen. (Pictured below)

As you can see, the logo sort of 'shimmers' from left to right a few times.

A similiar effect can be seen inside of combat when a pokemon's stats are altered. (Pictured below)

The effects I am talking about are the reddish shimmer appearing on the wolf (Poochyena), and the blue 'waves' appearing on the beaver (Bibarel).

I would like to know if there is a generalized method of applying such effects, as I aspire to have more than one Pokemon in the project, and I would therefore want a method that works on all cases. If the effect cannot be effectively achieved using winapi, then I am open to suggestions of other libraries, etc, to use.

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:
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:
Creating Unity Handles without any visible game objects at given regions I am trying to create handles without any visible game objects. The image below from a sample scene shows rects (top left rect is at position (-2, 4), size is (1, 1)) of the handles I want to appear when the mouse is hovered over the rectangular areas. So basically in a scene with no game objects I want to be able to hover over with the mouse to show the squares below as handles.

I believe the issue is most likely with the Raycast in UpdateHandlePosition(). The handles only appear when there are objects on the screen and they appear at the wrong places. Please see the relevant code below.

static void UpdateHandlePosition()
{
    if( Event.current == null )
    {
        return;
    }

    Vector2 mousePosition = new Vector2( Event.current.mousePosition.x, Event.current.mousePosition.y );

    Ray ray = HandleUtility.GUIPointToWorldRay( mousePosition );
    RaycastHit hit;

    if( Physics.Raycast( ray, out hit, Mathf.Infinity, 1 << LayerMask.NameToLayer( "Default" ) ) == true )
    {
        Vector3 offset = Vector3.zero;

        if( EditorPrefs.GetBool( "SelectBlockNextToMousePosition", true ) == true )
        {
            offset = hit.normal;
        }

        CurrentHandlePosition.x = Mathf.Floor( hit.point.x - hit.normal.x * 0.001f + offset.x );
        CurrentHandlePosition.y = Mathf.Floor( hit.point.y - hit.normal.y * 0.001f + offset.y );
        CurrentHandlePosition.z = Mathf.Floor( hit.point.z - hit.normal.z * 0.001f + offset.z );

        //CurrentHandlePosition += new Vector3( 0.5f, 0.5f, 0.5f );
    }
}

    static void DrawHandlesCube( Vector3 center )
{

    Vector3 p1 = center + Vector3.up * 0.5f + Vector3.right * 0.5f + Vector3.forward * 0.5f;
    Vector3 p2 = center + Vector3.up * 0.5f + Vector3.right * 0.5f - Vector3.forward * 0.5f;
    Vector3 p3 = center + Vector3.up * 0.5f - Vector3.right * 0.5f - Vector3.forward * 0.5f;
    Vector3 p4 = center + Vector3.up * 0.5f - Vector3.right * 0.5f + Vector3.forward * 0.5f;

    Vector3 p5 = center - Vector3.up * 0.5f + Vector3.right * 0.5f + Vector3.forward * 0.5f;
    Vector3 p6 = center - Vector3.up * 0.5f + Vector3.right * 0.5f - Vector3.forward * 0.5f;
    Vector3 p7 = center - Vector3.up * 0.5f - Vector3.right * 0.5f - Vector3.forward * 0.5f;
    Vector3 p8 = center - Vector3.up * 0.5f - Vector3.right * 0.5f + Vector3.forward * 0.5f;

    //You can use Handles to draw 3d objects into the SceneView. If defined properly the
    //user can even interact with the handles. For example Unitys move tool is implemented using Handles
    //However here we simply draw a cube that the 3D position the mouse is pointing to
    Handles.DrawLine( p1, p2 );
    Handles.DrawLine( p2, p3 );
    Handles.DrawLine( p3, p4 );
    Handles.DrawLine( p4, p1 );

    Handles.DrawLine( p5, p6 );
    Handles.DrawLine( p6, p7 );
    Handles.DrawLine( p7, p8 );
    Handles.DrawLine( p8, p5 );

    Handles.DrawLine( p1, p5 );
    Handles.DrawLine( p2, p6 );
    Handles.DrawLine( p3, p7 );
    Handles.DrawLine( p4, p8 );

}
}

sentences:
Flip the whole Directx output horizontally (mirror the output) I would like to flip the whole fullscreen directX output horizontally so that the final output is presented mirror inverted.

Is there a way to create a IDirect3DDevice9 instance which produces mirrored output? Or even better: is there a way I can mirror the output just before the final call to the  Present(...) method of the IDirect3DDevice9?

Update/Clarification:
The underlying objective is to be able to use a projector which needs vertically flipped input.
The software I am currently using allows to register callbacks and hands over a handle to the IDirect3DDevice9 instance.
After my method is called and returns, the directx output is presented. This repeats after each frame.

I would like to flip the presented output horizontally.

I tried the following:

Use settings of the projector to flip the image (not supported)
Find a setting in the Operating System (windows7 doesn't support flipping of the image)
Find a setting in the graphics driver (AMD Catalyst) but only rotation is supported, not horizontal flipping

I have only little experience with directx so please bear with me (this is also why I would appreciate sample code or at least pointers to the right direction).

Update2:
I found out that I should be able to call SetTransform on the Direct3DDevice9 handle to change the D3DTS_PROJECTION with a proper Matrix. However this does not work in my example application.

sentences:
Smoothly fitting texture tiles using alpha gradient on edges I'm trying to draw a background texture with tiles that I'll rotate and mirror to create a maze. Here is a sample tile:

As you can see, I use an alpha gradient on the borders. If I'd use a sharp border instead, you'd notice the border between a tile and another because these shadows and glows are not perfectly symmetrical.

So far it works OK, but I've noticed there is a slightly darker spot where two tiles connect:

I used Photoshop to create these gradients, and was very careful to make sure these gradients are linear and start exactly where the next gradient ends, so that the total alpha of every pixel add up to exactly one.

I'm using a SpriteBatch to draw these textures and use the default blending mode (I don't set any blend function at all). Apparently I'd need some blending function whose output will be the sum of both image's alphas and the average of their colors. Is this the default mode (if so, I guess my picture's alpha gradients are not perfectly linear)? And if not, what should I set my SpriteBatch's blend function to?

Edit: So I tried batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_DST_ALPHA) and it fixed the dark spot, but now the textures I draw on top look messed up, even if I revert it back to the old blending mode right after drawing my tiles.

sentences:
Why is my client's body drifting even after using data from the server, and how do I fix it? I am trying to use Box2d on nodejs server with libGDX client. What I am trying to apply is authoritative server model so clients are just sending input data to server, server is running simulation and returning data to clients.

Client sends right key pressed input data to server, server calculates applyForce vector, applies force to server side body.

Server is sending world's body data to clients such as linearVelocity, position angular velocity etc with sendWorldData() function. After geting data, clients equalize this data to client side bodies.

Right now I just equalize linear velocity data, if I use setTransform on body for same position, it breaks the simulation and game crashes. I guess just linear velocity is way to go for now.

The problem is: even though I return the same linearvelocity from server to client, bodies end up on slightly different x,y positions.

client is
(6.8612046,7.3647866)
server is
(7.260152142360204,7.807573379341183)

I read a lot about this problem and started by trying to fix timestep on server and client.
Client timestep:

private var fixedTimestepAccumulator = 0f
    private var MAX_ACCUMULATED_TIME = 1.0f
    val TIMESTEP = 1 / 60f
  fun update(delta:Float){
        fixedTimestepAccumulator += delta;
        if(fixedTimestepAccumulator > MAX_ACCUMULATED_TIME)
            fixedTimestepAccumulator = MAX_ACCUMULATED_TIME;

        while (fixedTimestepAccumulator >= TIMESTEP) {

            world.step(TIMESTEP, 6, 2);

            fixedTimestepAccumulator -= TIMESTEP;
        }

        inputUpdate(delta)
        cameraUpdate(delta)
        tmr.setView(camera)
        batch.projectionMatrix.set(camera.combined)

    }

Server update method:

var lastUpdate = Date.now()/1000;
var fixedTimestepAccumulator = 0;
var MAX_ACCUMULATED_TIME = 1;
var TIMESTEP = 1/60;

function physics_hanlder() {

    var now = Date.now() / 1000;
    var delta = now - lastUpdate;
    lastUpdate = now;
    fixedTimestepAccumulator = fixedTimestepAccumulator+delta;
    if(fixedTimestepAccumulator > MAX_ACCUMULATED_TIME)
        fixedTimestepAccumulator = MAX_ACCUMULATED_TIME;

    while (fixedTimestepAccumulator >= TIMESTEP) {
        world.step(TIMESTEP,6,2);
        sendWorldData() // sends servers body data to clients
        fixedTimestepAccumulator -= TIMESTEP;
    }

}

setInterval(physics_hanlder, 1000/60);

sentences:
Efficient vertex buffer memory management? I am building a voxel engine with a similar mechanism to minecraft(yes, I know...).
It works by loading and unloading individual chunks of 16*64*16 cubes each in a square grid around the player. This works fine for small render distances - like a 9x9 square grid of chunks. However, since updating a single vertex buffer entirely with a new mesh of millions of blocks each time a chunk is loaded/unloaded is inefficient, I have designed it so that each chunk has its own VB of fixed size, and rendering the entire world is basically looping through all the buffers, using d3dDeviceContext->IASetVertexBuffers(...).

When I increase the render distance, say to a square grid of 11x11 (around minecraft's large render distance), creating the vertex buffers simply cannot proceed beyond a certain point, and d3dDevice->CreateBuffer() returns E_OUTOFMEMORY.

So my question is: How do i manage the memory usage of the vertices, to both maintain good FPS (not using a single buffer for the entire terrain) and to have decent memory usage?

Additional Details:
My vertex datatype is a struct composed of x,y,z coords, u,v texture coords and 3 normal coords. I know it can be improved in ways like a single byte for normals, since in voxels there are only 6 possible directions, however this will come later.

The fixed size of each chunk's vertex buffer is 16*16*64*18 vertices (16*16*64 blocks with a maximum of half of the sides showing, or 36/2 vertices max per block). This could also use some work, as each of these buffers is around 10MB.

How do games like minecraft handle this amount of data at once? (not to say i am using 64 blocks high chunks, where minecraft has 256)
I have briefly considered using points as vertex shader inputs and expanding them to cubes in the geometry shader, to save 87.5% of the space, but this seems rather intense on the GPU.

sentences: OpenGL - texture releasing If I call glDeleteTextures, will it release memory immediately? And what is the performance? I know that glGenTexture is quite cheap, because it only alocated id, but I have nor found anything about deleting.

sentences:
LWJGL exception in JME3-JFX! Video playback in jMonkeyEngine 3.0 seemed to be in limbo for quite a while until I chanced upon this thread about playing videos by integrating JavaFX 2 into the JME3 framework. This coupled with the recent announcement of MP4 playback support in JavaFX made JME3 a real contender for a project I'm currently working on.

I followed the prescribed method as mentioned in the former thread, got the sources from the JME3-JFX project page and setup the project in eclipse. When I ran the example [TestMovie.java] with the given URL from Oracle, it ran smoothly with no issues. However when I attempted to play an MP4 file, it played for a brief period with messed up colours and then exited with a java.lang.IllegalArgumentException exception.

Here is the eclipse console output :

INFO: Audio effect extension version: 1.0
Nov 27, 2014 6:33:13 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio max auxilary sends: 4
Nov 27, 2014 6:33:34 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Number of remaining buffer elements is 6627840, must    be at least 14745600. Because at most 14745600 elements can be returned, a buffer with at least 14745600 elements is required, regardless of actual returned element count
at org.lwjgl.BufferChecks.throwBufferSizeException(BufferChecks.java:162)
at org.lwjgl.BufferChecks.checkBufferSize(BufferChecks.java:189)
at org.lwjgl.BufferChecks.checkBuffer(BufferChecks.java:230)
at org.lwjgl.opengl.GL11.glTexImage2D(GL11.java:2845)
at com.jme3.renderer.lwjgl.TextureUtil.uploadTexture(TextureUtil.java:352)
at com.jme3.renderer.lwjgl.LwjglRenderer.updateTexImageData(LwjglRenderer.java:1913)
at com.jme3.renderer.lwjgl.LwjglRenderer.setTexture(LwjglRenderer.java:1936)
at com.jme3.material.MatParamTexture.apply(MatParamTexture.java:86)
at com.jme3.material.Material.render(Material.java:1088)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:523)
at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:322)
at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:374)
at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:763)
at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:719)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:983)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:745)

Now I'd like to clarify that the same MP4 file played flawlessly in a vanilla JavaFX project. Also, one of the developers has confirmed in the first mentioned thread on the jMonkeyEngine forums that he was able to play MP4 videos flawlessly and three of them simultaneously nonetheless. I'm testing these samples on Java 1.8 u25 on Windows 8.1 Pro [x86-64] running an Intel Core i5 [Haswell] with Intel HD 5000 graphics.

I'm a beginner to graphics development and am aware that the jMonkeyEngine forums are the best place to ask my question but their forum's Q/A section seems to be broken and I'm unable to post there. Any and all help will be appreciated.

sentences:
How can I get the Selector dialog to include my prefabs When setting a variable for an object in Unity, for built-in types there is an option on the right-hand side to bring up a dialog that lists the possible values that can be chosen for that variable, for example when selecting a Sprite for a Sprite Renderer:

Is it possible, and if so what do I need to do, to have that list populated with the prefabs within my project?

In this example, there are a number of Item prefabs (both inside and outside the Resources folder if that makes a difference), however they do not appear in that dialog. Is there an attribute I am missing that needs to be specified on the Item class, or something else to enable this?

using UnityEngine;
using System.Collections.Generic;

public class Item : MonoBehaviour, IIdentifiable, IFilterable
{
    [SerializeField]
    private int IdField;
    [SerializeField]
    private bool ActiveField;

    public int Id => IdField;
    public bool Active => ActiveField;
}

public class ItemRandomiser : MonoBehaviour, IWeightedObject
{
    [SerializeField]
    private List<string> NamesField;
    [SerializeField]
    private List<Item> ItemTemplatesField;
}

sentences:
Isometric coordinate maths not quite right I have written two functions, screenToCoords and coordsToScreen.

Screen being the coordinates on screen.

Coords being isometric coordinates.

So here are my functions:

Screen to isometric:

Vector2 TileMap::screenToCoords(Vector2 coords){
    coords.x -= offset.x;
    coords.y -= offset.y;
    Vector2 newCoords;
    newCoords.x = (coords.x / (TILE_WIDTH/2) + coords.y / (TILE_HEIGHT/2)) /2;
    newCoords.y = (coords.y / (TILE_HEIGHT/2) - (coords.x / (TILE_WIDTH/2))) /2;
    return newCoords;
}

Isometric to screen:

Vector2 TileMap::coordsToScreen(Vector2 coords){
    Vector2 newCoords;
    newCoords.x = (coords.x - coords.y) * (TILE_WIDTH/2) + offset.x;
    newCoords.y = (coords.x + coords.y) * (TILE_HEIGHT/2) + offset.y;
    return newCoords;
}

And these seem to work totally fine, except when dealing with mouse coordinates, as you can see here:

I can't figure out what the issue is.

Basically what's happening in this image is that I'm converting mouse coordinates into isometric coordinates, then back into screen coordinates so that I can render that highlight box.

sentences:
transform.Rotate needs to change axis of rotation So I'm making a game in Unity. After many failed attemps from either being bored of the idea, or something going wrong and me giving up I think (hope) that will be the good one.

I have made a simple racing game with a track and a car. I am using transform.Translate to move it, but when I use transform.Rotate to turn it goes around the x axis. How do I change the axis it goes around? I cant find anything online.

            if (Input.GetAxisRaw("Horizontal") > 0.5f)
    {
        transform.Rotate(Vector3.right * Time.deltaTime * handling);
    }
    if (Input.GetAxisRaw("Horizontal") < -0.5f)
    {
        transform.Rotate(Vector3.left * Time.deltaTime * handling);
    }
    if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f)
    {
        transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
    }

Thanks for any help you can give me.

sentences:
AI of Turn Based game using Entity System approach I just recently learned about Entity Systems and want to try it out on a real example (I was developing a game recently and want to try to port it over Entity Systems). But I got problem right away. Actually that is two questions in one.

First would be:

In traditional OOP approach I had game loop which was picking action to do for idling units every 100ms (so-called 'turn'). But rendering obviously was run at every game loop iteration. How should I do that? Maybe I need something like individual interval for systems to run? Like RenderingSystem running every Update while AI Systems are running each 100ms. Or maybe there is some better approach which I should use?

Second question would be about about these AI Systems

I understand how to make AI which will manage every unit completely individually. However I have somewhat simultaneous pathfinding for all units which will do:

Mark units that should start moving as 'moving'.
Find path for every 'moving' unit to it's target (basically closest enemy). All 'moving' units aren't considered as obstacles for path but all not-'moving' units considered as obstacles.
Try to move every unit one step at it's path. If can't make step (someone is already standing there) then mark path as invalid (to recalculate at next AI iteration) and move one step in direction of target (if there is free nodes).
Mark all 'moving' units as not-'moving'

Besides there is addition:
3. Before making step we will check if we have enemy around us and instead of moving we will attack that enemy.

So, one AI iteration required to give action to each unit which will be run until it finishes. Then AI should give next action.

How I can make that in Entity System approach? Because in ES all systems are run one-after-another where I need to "jump" beetween them freely. Or maybe I'm overcomplicating things and should do something different instead of "jumping" between systems?

sentences:
Preventing character's movement if it won't fit(Unity2D) I'm creating a pacman game copy and I set up my movement. But there's a problem. My character can try to go up whenever I press but in the original you cannot go if there's a wall above you or your character won't fit.

For example in this situation you can still go up but you'll bounce off wall. So my question is how to prevent character from movement if there's a wall or it won't fit there.

sentences:
Unity AI issue with recalculating NavMesh at runtime I am using Unity NavMesh to control my units.
I am running into an Issue when updating Navmesh at runtime, It seems agents re-calculate their path whenever it is modified, which makes sense, but it causes this line (check if unit is on last corner) to return an IndexOutOfBounds error:
agent.steeringTarget == agent.path.corners[agent.path.corners.Length - 1]

I guess something is happening while re-calculating path that might mess with this for 1 frame. I solved this by putting a try/catch around it, but is there some better way I can manage this so I don't get the error at all?

sentences:
Regarding BGE (Blender Game Engine), is it possible to generate a single .exe file from multiple files linked together? Would any of you guys or gals know the answer, please?

I know one can generate a .exe (windows executable) file from a single blend file. My question is very simple: Can anyone generate a single .exe file from multiple blender files of a same project?

For instance, say I have a project folder with several subfolders and files from my project game. Each folder has specific elements like scenes, models, textures, etc. They are all linked together to form the final game. Now I want to generate a single .exe file for my game. Is this possible?

Or, rather, should I make an entire game inside a single .blend file? (It seems like a very unlikely arrangement, maybe even impossible, but I rather ask). Or maybe even create a master .blend file from where to link all data and when project is finished pack everything before generating the executable (.exe)?

sentences:
Trying to implement forward rendering in OpenGL I'm working on implementing forward rendering in my 2D engine, as far as I'm aware everything should be set up correctly, I've ran into some issues earlier but I'm sure I've fixed those at this point.

So what I'm doing to achieve this (May or may not be the correct way of going about this) is that I'm rendering the object first with ambient light (Which works), and then for each light affecting the object, I render it once again using a different shader for point lights. I've set that shader to only output the color red atm, but nothing shows up apart from the first render of the object (The one with the ambient light).

Here are some pieces of my code.

Rendering of the object

        shader.Use();

        shader.SetUniform("_Model", transform.Model);
        shader.SetUniform("_Color", color.Normalized.ToVector3());
        shader.SetUniform("_Diffuse", texture.ArrayPos);

        VertexAttributePointer.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 5, (System.IntPtr)0);
        VertexAttributePointer.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, 5, (System.IntPtr)(3 * sizeof(float)));

        //Render sprite
        quad.VAO.Bind();

        GL.Enable(EnableCap.Blend);

        //Transparency
        GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);

        //Draw object
        GL.DrawElements(PrimitiveType.Quads, 4, DrawElementsType.UnsignedInt, 0);

        //Forward rendering
        GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);

        GL.DepthFunc(DepthFunction.Equal);
        GL.DepthMask(false);

        Shader pointLightShader = Shader.GetShader("Forward-Point");
        if (pointLightShader != null)
        {
            pointLightShader.Use();
            shader.SetUniform("_Model", transform.Model);
            shader.SetUniform("_Color", color.Normalized.ToVector3());
            shader.SetUniform("_Diffuse", texture.ArrayPos);

            foreach (Light l in Light.lights)
            {
                pointLightShader.SetUniform("_PointLight.position", new Vector3(l.position.X, l.position.Y, 0));
                pointLightShader.SetUniform("_PointLight.color", l.color.Normalized.ToVector3());

                GL.DrawElements(PrimitiveType.Quads, 4, DrawElementsType.UnsignedInt, 0);
            }
        }

        GL.DepthFunc(DepthFunction.Lequal);
        GL.DepthMask(true);
        GL.Disable(EnableCap.Blend);

        quad.VAO.Unbind();

        texture.Unbind();

Forward-Point fragment shader

Note that it is temporarily set to only output red, which should globally tint all objects if it works.

#version 330 core

struct Light {
    vec3 position;
    vec3 color;
};

uniform vec3 _CameraPos;
uniform vec3 _Color;
uniform sampler2D _Diffuse;
uniform Light _PointLight;

out vec4 color;
in vec2 TexCoords;
in vec3 FragPos;

void main()
{
    vec4 diffuse = texture(_Diffuse, TexCoords);

    float distance = length(_PointLight.position - FragPos);
    float attenuation = 1.0;

    vec3 finalLight = _PointLight.color * attenuation;

    color = vec4(1.0, 0.0, 0.0, 1.0);
}

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: Lightmapping & runtime combine children Is it possible to have lightmapping on runtime generated combine children in Unity? It is possible to bake combined meshes when they are done in the editor, but the .apk/.ipa size increases too much.

sentences:
Hand cards auto arrangement I'm making a card game with libgdx scene2d and what I'm trying to achieve is auto arrange the cards in a way the all fit the screen. This is what it looks now when the hand is full:

I have done that using a horizontalGroup and puting a -1/3 cardWidth space between the cards. I want the cards to spread evenly when some are removed.
I think I have to change the space between the cards whenever a card is removed or added but I don't know how much.

This is my code:

    CardActor[] cards = new CardActor[14];
    HorizontalGroup hand = new HorizontalGroup();
    int width = Gdx.graphics.getWidth()/10;
    int height = width * 2;
    hand.setBounds(width/2, -height/4, stage.getWidth()-width, height);
    hand.space(width / -3f);
    hand.align(Align.bottom | Align.center);
    for (int i = 0; i < cards.length; i++) {
        cards[i] = new CardActor(new Card(MathUtils.random(3), MathUtils.random(3, 10)));
        hand.addActor(cards[i]);
    }
    stage.addActor(hand);`

And this is the CardActor:

public class CardActor extends ImageButton {

public CardActor(Card card) {
    super(new TextureRegionDrawable(CardTextures
            .getTexture(card.getType(), card.getRank())));

    int width = Gdx.graphics.getWidth()/10;
    int height = width*2;
    getImageCell().prefSize(width, height);
    setBounds(getX(), getY(), getWidth(), getHeight());
    addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            onSelected();
        }
    });
}

sentences:
Targeting logic for 100.000 units army I am making an army fight for my website armyfight. There can be fights of hundreds of thousands units. I am looking for better unit targeting. in jsfiddle is an example.

var enemy = {
    2: {
        3: {}  // object inside with unit data
    },
      5: {
        6: {}
    }
}

var ally = {
    4: {
        3: {}
    }
}

function unit_searches_for_target(y, x) {
    var closest_y   = iterate_Y(y);
    var unit_target = iterate_X(closest_y, x);
  return unit_target;
}

// Searches for closest target at Y axis
function iterate_Y(y) {
    if (_.has(target, y)) {
        return y;
    } else {
      var y = parseInt(y);
        for (var i = 1; i < 300; i++) {
            // If y == 4, it checks 4+1=5 (positive side)
            if (_.has(target, String(y + i))) {
                return (y+i);
            // Else if y == 4, it checks 4-1=3 (negative side)
            } else if (_.has(target, String(y - i))) {
                return (y-i);
            }
        }
    }
    // if didn't find anything, just returns same y as given
    return y;
};

// Searches for closest target at X axis
function iterate_X(y, x) {
    if (_.has(target[y], x)) {
        return {y: y, x: x};
    } else {
      var x = parseInt(x);
        for (var i = 1; i < 300; i++) {
            // If x == 4, it checks 4+1=5 (positive side)
            if (_.has(target[y], String(x + i))) {
            return {y: y, x: x + i};
            // Else if x == 4, it checks 4-1=3 (negative side)
            } else if (_.has(target[y], String(x - i))) {
              return {y: y, x: x - i};
            }
        }
    }
    // if didn't find anything, just returns same x as given
    return {y: y, x: x};
};

Here first i iterate on Y axis, later on X axis. But on different army positions it gives wrong results.

In this example, units are looking for targets by simply iterating. It is not very good for a huge army fight of hundred thousands units.
Best would be to iterate like here, when iteration process is much faster leading to first-hit success:

function iterate_X(y, x) {
  return _.find(enemy[y], function (value, key) { return parseInt(key) >= x });
}

But this iteration works only 0..100, or 99..100, but not 100..0, so i can't iterate objects in reverse mode. So if ally is {5: {10: {}, 99: {}} and enemy is at {5: {100: {}}}, enemy unit would find closest ally as [5, 10] instead of [5, 99]. If it would be an array iterating backwards from 100 to 0, so it would be first-hit success. But can asotiative array be reverse-iterated?
Any suggestions please on structure? Maybe change units structure from objects to arrays or mix?  But then I have problems with associative arrays. I am looking for an explanation or example about the structure and for a faster iteration for units targeting.
And i am also looking for websites, where i could ask these heavy logic questions? I have more of them.

sentences:
Collision Detection in a big map? So I've been wondering lately... on games like pokemon (on ds and gba), How did they handle the collision of all those tiles in the map? Should all those collision checks running in the background slow down the game? Do they have it where the collision activates from a certain distance? Do they have a player event where the player is next to a tile that is not able to be walked on? If it is not possible to know the answer, could you give me a solution to that problem?

I guess what I am really asking is how to handle collision of almost every tile in a big map.

sentences:
Emission on part of the mesh I would like to port this mesh in Unity but in a way that smaller face, which is selected, has emission material and rest of the mesh has albedo material.

I know how to apply material in Blender on different faces but I don't know how to port it in Unity this way.

Updated post: emission texture

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:
How to compress repetitive information when uploading mesh data? I want to avoid sending repetitive information when drawing a mesh.

If I use a single point for each face and two vectors as additional attributes that represent the travel of each vertex, I can use that information in a Geometry Shader to produce the normal and the two points followed by any additional attributes for that face.

Is the computation cost worth the saved data needing to be transferred? Or is there a better way to optimize the pipeline for sending over a mesh to draw?

Edit:
In particular this is a case where the mesh has attributes unique to the face and not the vertex, so if it were done the regular way each vertex would be multiplied by the number of faces used by it.

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:
How do I achieve this glowing edge shader? I came across this example, and wanted to know how to achieve a shader that will give me similar results, i.e. the glowing edges.

How do I achieve this sort of shader?

sentences:
Gameobject not destroyed OnCollisionEnter I have this GameObject with the tag coin I am trying to destroy when the player collides with it using this code located in a player script attached to the player

    public void OnCollisionEnter(Collision col){
        var hit = col.gameObject;
        if(hit.tag == "Coin"){
            Destroy(hit.gameObject);
        }
    }

However upon collision nothing is happening

sentences:
Problem of activities My game consists of a player that hopes between ropes.
For now, I created the player and the rope classes.
 Each one contains details about the object and its movement patterns.
What is the next step in orfer to link between them?
  Iwant the player to stick on a rope once they have the same x.
Should i create an activitt Game that implements this attach method?
Thank you.

sentences:
Can I use popular classical music as my game's soundtrack? Can I use popular classical music in my game as a soundtrack? I'm concerned about copyright protection. I don't plan to make money off of my game.

Will I break some law if I do that?

sentences:
Opengl textures change color of everything Whenever I render textures, all shapes get the color of the texture. I'm not sure why, but I think it's something to do with the way I render textures. Here's what I use to draw textures:

public void drawTex(Texture t, int x, int y, int width, int height)
    {
        t.bind();
        glBegin(GL_QUADS);
        glTexCoord2f(0,0);
        glVertex2f(x,y);
        glTexCoord2f(1,0);
        glVertex2f(x+t.getTextureWidth(),y);
        glTexCoord2f(1,1);
        glVertex2f(x+t.getTextureWidth(),y+t.getTextureHeight());
        glTexCoord2f(0,1);
        glVertex2f(x,y+t.getTextureHeight());
        glEnd();
    }

Now I draw shapes like this:

public void drawQuad(int x, int y, int width, int height, float r, float g, float b)
    {

        glBegin(GL_QUADS);
    //  glColor3f (r, g, b);
        glVertex2f(x, y);
        glVertex2f(x + width, y);
        glVertex2f(x + width, y + height);
        glVertex2f(x, y + height);
        glEnd();
    }

sentences:
Constant size geometries for glDrawArraysInstanced calls In my application I can keep the objects constant sized
            const Graphics::VectorDouble diffVec(dTranslateX - m_CameraTransformOffset.x,
                                                 dTranslateY - m_CameraTransformOffset.y,
                                                 dTranslateZ - m_CameraTransformOffset.z);

            camScaleInv = Graphics::Lenght(diffVec) * 2.0f * tan(fov * 0.5f * PI / 180.0f);

Than I scale my view matrix with  camScaleInv and I think that is very common to do but ,
I have some objects which I draw with glDrawArraysInstanced. I pass the parent surface only once and another array for duplicating the parent surface in different positions.
That causes my "diffVec" to be different and causes me to not being able to use keep same distance logic in CPU side.
Is there any way for me to keep the objects which are being drawn with glDrawArraysInstanced same size either in CPU or GPU(glsl) side.

sentences:
How to set emission level through C# I am willing to change emission level through code without affecting its color.
(i.e., changing the brightness number shown in the box at the right side of the inspector, while keeping the emission color unchanged)
I have tried this so far, but I don't know how to use my value variable to update the material:
public class EmissionColourChange : MonoBehaviour {

    Material thisMat;
    Color c;
    public float value;

    void Start () {
        thisMat = GetComponent<Renderer>().material;
        c = GetComponent<Renderer>().material.color;
        thisMat.EnableKeyword("_EMISSION");
        value = c.r;
    }

    void Update () {
        thisMat.SetColor("_EmissionColor", new Color(c.r,c.g,c.b));
    }
}

sentences:
How can the player select his weapon among many? I'm working on the prototype of my game, I want one of the options to have a very large amount of weapons. I have searched for tutorials, but I have only found weapons changes where the weapons have already been loaded in the scene from the inspector, like this https://youtu.be/Dn_BUIVdAPg where they are only activated and deactivated.
But I want a game like dofus where there are hundreds of weapons, I think I have a data file of the weapons and so, I can load the correct model of the weapon.
How can I get the model loaded?

I have read other tutorials regarding the AssetBundle, but I think that is when you need to download the models from a server for example, but I just want to load them from the same project.

sorry for the bad english

sentences:
"Failed to fetch the following dependencies: com.google.games:gpgs-plugin-support:0.9.50 " when force resolve GooglePlayGamesPlugin-0.9.50 Ive been stuck with this problem for the last few days and really need some assistance.

Iv created an android app and im trying to set up google play services as i want to use the leader board etc..

I downloaded and imported the latest plugin "GooglePlayGamesPlugin-0.9.50 " no errors during the import.

I then go to assests/ play service resolver/android/force resolve and run that.

After running I end up with the following error:

Resolution failed

Failed to fetch the following dependencies:

com.google.games:gpgs-plugin-support:0.9.50

UnityEngine.Debug:LogError(Object)

Google.Logger:Log(String, LogLevel)

GooglePlayServices.PlayServicesResolver:Log(String, LogLevel)

GooglePlayServices.ResolverVer1_1:LogMissingDependenciesError(List`1)

GooglePlayServices.c_AnonStorey18:<>m_26(List`1)

GooglePlayServices.c_AnonStorey14:<>m_1F(Result)

GooglePlayServices.c_AnonStorey15:<>m_28()

GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()

UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

If i ignore the error and complie the app it works fine but does not connect to the google service. I can publish and use the app without crashes etc but i cant log on to google or view leaderboards.

Can any one assist me as im really desperate to get this up and running.

Im using :
unity 2017.1.1f1 personal 64bit

Windows 10 64 bit

jdk1.8.0_162

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:
How to use GetViewProjMatrix().TransformVector(LineDirection) in UE4? I try to project a 3D vector (a direction, not a position) in screen space, but it does not return satisfying results:

 FVector LineDirectionOnScreen =
   EdMode->ViewMatrices.GetViewProjMatrix().TransformVector(LineDirection);
 FVector2D LineDirectionOnScreen2D(
   LineDirectionOnScreen.X * 0.5f * (float)EdMode->ViewRect.Width(),
   LineDirectionOnScreen.Y * 0.5f * (float)EdMode->ViewRect.Height());

When LineDirection is (0,0,1) it always returns a something like (0,Y) (Y can be anything), no matter how the camera is rotated.

What is wrong with my code?

sentences:
Need help transforming DirectX 9 skybox hlsl shader to DirectX 11 I am in the middle of implementing a skybox to my game. I have been following this tutorial http://rbwhitaker.wikidot.com/skyboxes-2. I am using MonoGame as a framework and in order to support both Windows and Windows 8 metro I need to compile the shader with pixel and vertex shader 4.

compile vs_4_0_level_9_1
compile ps_4_0_level_9_1

However some of the hlsl syntax has been updated with DX10 and DX11.

I need to update this hlsl code:

float4x4 World;
float4x4 View;
float4x4 Projection;

float3 CameraPosition;

Texture SkyBoxTexture;
samplerCUBE SkyBoxSampler = sampler_state
{
   texture = <SkyBoxTexture>;
   magfilter = LINEAR;
   minfilter = LINEAR;
   mipfilter = LINEAR;
   AddressU = Mirror;
   AddressV = Mirror;
};

struct VertexShaderInput
{
    float4 Position : POSITION0;
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float3 TextureCoordinate : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    float4 VertexPosition = mul(input.Position, World);
    output.TextureCoordinate = VertexPosition - CameraPosition;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return texCUBE(SkyBoxSampler, normalize(input.TextureCoordinate));
}

technique Skybox
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

I quess I need to change Texture into TextureCube, change sampler, swap texCUBE() with TextureCube.Sample() and change PixelShader return semantic to SV_Target0.

I'm very new in shader languages and any help is appreciated!

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:
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:
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:
Using cutText with RemoteExec I created a mission in Arma 3 with Eden. I wish to run the mission on a dedicated server.
I want to create a function to fade to black, skip time, and then fade back to normal again.
Everything works except for the fading.
I have the following code in fSkipTime.sqf
params ["_targetTime", "_displayText"];
_fadeOutText = format ["Waiting until %1", _displayText];
systemChat format ["Waiting until %1...", _displayText];
[_fadeOutText, "BLACK OUT", 2] remoteExec ["cutText"];
sleep 2;
_targetTime = (_targetTime - daytime + 24 ) % 24;
[_targetTime] remoteExecCall ["skipTime", 2];
sleep 1;
[_displayText, "BLACK IN", 2] remoteExec ["cutText"];

I have the following code in the object I wish to use for fading.
init:
fSkipTime = compile preprocessFile "fSkipTime.sqf";

this addAction["Wait till Morning", {
  [6.5, "06:30"] call fSkipTime;
}];
this addAction["Wait till Noon", {
  [12, "12:00"] call fSkipTime;
}];
this addAction["Wait till Evening", {
  [18.5, "18:30"] call fSkipTime;
}];
this addAction["Wait till Midnight", {
  [0, "00:00"] call fSkipTime;
}];

When I run cutText [_fadeOutText, "BLACK OUT", 2], it runs fine.
However with remoteExec or remoteExecCall nothing happens.
How do I make it fade for everybody in multiplayer?

sentences:
how to order entities by their distance from 0 on the x axis I'm creating an infinite runner game in which you control several characters at once.  Right now when you press the spacebar, they all jump at once but, I want them to jump at separately, one after the other from right to left(largest x to smallest x) so I need to order them in some way to represent that.
I tried using bubble sort to do this with no success so I tried my own approach where I scan the screen for the x position of the characters and assign their order to the number of passes the loop has gone through:
public void SetJumpOrder()
    {
        int pass = 0;

        foreach (Alien a in handler.aliens)
        {
            for (int i = 1000; i > 0; i--)
            {
                if (i == a.position.X) a.jumpOrder = pass;
            }
            pass++;
        }
    }

The code above didn't work because it just gave the order of the aliens list instead.  Any suggestions?

sentences:
Make a bullet shape around model in libgdx How do I make a btBoxShape around a Model or ModelInstance in Libgdx?
This is my code:

modelInstance.calculateBoundingBox(boundingBox);
collisionShape = new btBoxShape(boundingBox.getDimensions(tempVector3).scl(.5f));

This works and creates a box of the right size but it is offset from the model. I cant figure out how to make it around the model and not offset.

sentences:
A field initializer cannot reference the non-static field, method, or property 'CinemachineFreeLook.Variable' engine: unity
coding language: c#
I am trying to control CinemachineFreeLook maxSpeed from another script in the struct AxisStat: public AxisState(float minValue, float maxValue, bool wrap, bool rangeLocked, float maxSpeed, float accelTime, float decelTime, string name, bool invert) It only accepts to type a number, but not a variable.
Whenever I create a public float variable and place it in maxSpeed, it keeps sending the error: error CS0236: A field initializer cannot reference the non-static field, method, or property 'CinemachineFreeLook.rSpeed'
Here is the default unity CinemachineFreeLook script code + the added code which I declare a float variable "rSpeed" at the beginning and added my variable in the AxisStat maxSpeed:
public class CinemachineFreeLook : CinemachineVirtualCameraBase
{
    public float rSpeed = 300f;

    /// Object for the camera children to look at (the aim target)
    [Tooltip("Object for the camera children to look at (the aim target).")]
    [NoSaveDuringPlay]
    public Transform m_LookAt = null;

    /// Object for the camera children wants to move with (the body target)
    [Tooltip("Object for the camera children wants to move with (the body target).")]
    [NoSaveDuringPlay]
    public Transform m_Follow = null;

    /// If enabled, this lens setting will apply to all three child rigs, otherwise the child rig lens settings will be used
    [Tooltip("If enabled, this lens setting will apply to all three child rigs, otherwise the child rig lens settings will be used")]
    [FormerlySerializedAs("m_UseCommonLensSetting")]
    public bool m_CommonLens = true;

    /// Specifies the lens properties of this Virtual Camera.
    /// This generally mirrors the Unity Camera's lens settings, and will be used to drive
    /// the Unity camera when the vcam is active
    [FormerlySerializedAs("m_LensAttributes")]
    [Tooltip("Specifies the lens properties of this Virtual Camera.  This generally mirrors the Unity Camera's lens settings, and will be used to drive the Unity camera when the vcam is active")]
    [LensSettingsProperty]
    public LensSettings m_Lens = LensSettings.Default;

    ///  Collection of parameters that influence how this virtual camera transitions from
    /// other virtual cameras
    public TransitionParams m_Transitions;

    /// Legacy support
    [SerializeField] [HideInInspector]
    [FormerlySerializedAs("m_BlendHint")]
    [FormerlySerializedAs("m_PositionBlending")] private BlendHint m_LegacyBlendHint;

    /// The Vertical axis.  Value is 0..1.  Chooses how to blend the child rigs
    [Header("Axis Control")]
    [Tooltip("The Vertical axis.  Value is 0..1.  Chooses how to blend the child rigs")]
    [AxisStateProperty]
    public AxisState m_YAxis = new AxisState(0, 1, false, true, 2f, 0.2f, 0.1f, "Mouse Y", false);

    /// Controls how automatic recentering of the Y axis is accomplished
    [Tooltip("Controls how automatic recentering of the Y axis is accomplished")]
    public AxisState.Recentering m_YAxisRecentering = new AxisState.Recentering(false, 1, 2);

    /// The Horizontal axis.  Value is -180...180.  This is passed on to the rigs' OrbitalTransposer component
    [Tooltip("The Horizontal axis.  Value is -180...180.  This is passed on to the rigs' OrbitalTransposer component")]
    [AxisStateProperty]
    public AxisState m_XAxis = new AxisState(-180, 180, true, false, rSpeed, 0.1f, 0.1f, "Mouse X", true);

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:
Collisions and Colliders Does anyone know how to prevent a gameobject from colliding with another gameobject but can still register collisions?
Like a ball that can bounce off of the wall or ground and can pass through the player himself.
What I have tried:
Creating two Colliders on the ball(which has a rigidbody component) and making one of them bigger than the other (and turn on "Is Trigger" on the bigger collider). Then write code in the OnTriggerEnter and the OnTriggerExit functions to disable/enable the smaller collider so that the ball could fly right through the player. But that is completely useless when the ball is not in motion and the player walks over it(because it'll fall straight down through the ground).

sentences:
Component-based Rendering I have component Renderer, that Draws Texture2D (or sprite)
Then I have method OnUpdate, and there should be my rendering code, something like

spriteBatch.Draw(Texture, Vector2.Zero, Color.White)

But first I need to do spriteBatch.Begin();. Where should i call it? And how can I make sure it's called before any Renderer components OnUpdate method?

(i need to do more stuff then just Begin() i also need to set right rendertarget for camera etc.)

sentences:
How to access a variable from another script in Unity c# I need to access a variable from another script in Unity, but I can't figure it out.
Script:

public class move : MonoBehaviour {
public float speed;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    transform.position += Vector3.left * Time.deltaTime * speed;
}

}

I want to access the variable speed in another script, but I can't. Any help will be appreciated :)

sentences:
How to apply force to rigid bodys at a specific point? I am trying to write a physics engine from scratch to get a better understanding of them. It worked pretty good so far, but there is one thing, i can't get my head around:

If i have a rigid body ( for example circles or rectangles) and i am applying a force F at a point P to it. Now my problem is to figure out, how this force will affect translation speed and rotation speed of the rigid body. So far i have figured out, that it might has to do with the center of mass and the moment of inertia.

sentences:
Forward Shading with multiple shadow-casting lights I am currently thinking about how to organize shadowing and lighting.
We use forward rendering and currently, our algorithm looks like this:

collect all items that are visible in the view
for each item, collect a list of lights where the item is in the attenuation radius (each item keeps a list of lights)
determine the shadow light by the distance of the main character (only one light can currently cast shadow)
render the scene by using a constant buffer of the currently processed item to shade it (each item is rendered with a constant buffer which contains light properties. the number of lights per item is predefined so we have a Light[16] and numLights in the constant buffer)

How would I do multiple shadow-casting lights in an organisatory way?
We do not want to go the deferred way, since we dont want to limit us to GBuffers.

sentences:
Rotate arrow on canvas I need to draw a flow dynamically based on some user choices. In that flow I want to draw the choices (blue circles with number) and the directions of that choices (line and arrow). For example: node 1 to node 2.

JSFiddle Example

To draw the direction I draw a arrow in the end of the line but I can't make the arrow rotate around itself.

JS code

$(document).ready(function () {
    drawOnCanvas();
});

function drawOnCanvas() {
    var canvas = document.getElementById('myCanvas');

    if (canvas.getContext) {
        var ctx = canvas.getContext("2d");

        var circle1 = {
            x: 75,
            y: 75,
            r: 15
        };

        var circle2 = {
            x: 225,
            y: 50,
            r: 15
        };

        var arrow =
            {
                h: 5,
                w: 10
            };

        drawCircle(ctx, circle1, "1");
        drawCircle(ctx, circle2, "2");

        var ptCircle1 = getPointOnCircle(circle1.r, circle1, circle2);
        var ptCircle2 = getPointOnCircle(circle2.r, circle2, circle1);
        var ptArrow = getPointOnCircle(circle2.r + arrow.w, circle2, circle1);

        drawLine(ctx, ptCircle1, ptCircle2);
        drawArrow(ctx, arrow, ptArrow, ptCircle2);
    }
}

function drawArrow(canvasContext, arrow, ptArrow, endPt) {

    var angleInDegrees = getAngleBetweenPoints(ptArrow, endPt);

    canvasContext.beginPath();
    // first save the untranslated/unrotated context
    canvasContext.save();

    // move the rotation point to the center of the rect
    canvasContext.translate(ptArrow.x, ptArrow.y);
    // rotate the rect
    canvasContext.rotate(angleInDegrees);

    canvasContext.moveTo(endPt.x, endPt.y);
    canvasContext.lineTo(endPt.x - arrow.w, endPt.y + arrow.h);
    canvasContext.lineTo(endPt.x - arrow.w, endPt.y - arrow.h);
    canvasContext.closePath();
    canvasContext.fillStyle = "rgb(72,72,72)";
    canvasContext.stroke();
    canvasContext.fill();

    // restore the context to its untranslated/unrotated state
    canvasContext.restore();
}

function drawCircle(canvasContext, circle, text) {
    canvasContext.beginPath(); //começa ou reinicia o desenho de algo
    canvasContext.fillStyle = "rgb(43,166,203)";
    canvasContext.arc(circle.x, circle.y, circle.r, 0, 2 * Math.PI, false); //cria arcos
    canvasContext.fill(); //atribui estilos

    drawText(canvasContext, circle, text);
}

function drawText(canvasContext, circle, text) {
    canvasContext.font = '8pt Calibri';
    canvasContext.fillStyle = 'white';
    canvasContext.textAlign = 'center';
    canvasContext.fillText(text, circle.x, circle.y + 3);
}

function drawLine(canvasContext, startPt, endPt) {
    canvasContext.moveTo(startPt.x, startPt.y);
    canvasContext.lineTo(endPt.x, endPt.y);
    canvasContext.stroke();
}

function getPointOnCircle(radius, originPt, endPt) {
    var angleInDegrees = getAngleBetweenPoints(originPt, endPt);

    // Convert from degrees to radians via multiplication by PI/180
    var x = radius * Math.cos(angleInDegrees * Math.PI / 180) + originPt.x;
    var y = radius * Math.sin(angleInDegrees * Math.PI / 180) + originPt.y;

    return { x: x, y: y };
}

function getAngleBetweenPoints(originPt, endPt) {
    var interPt = { x: endPt.x - originPt.x,
        y: endPt.y - originPt.y
    };

    return Math.atan2(interPt.y, interPt.x) * 180 / Math.PI;
}

I think the problem is in drawArrow() method in the lines

canvasContext.translate(ptArrow.x, ptArrow.y);

canvasContext.rotate(angleInDegrees);

I already tried every possible values for the rotation and the translation but arrow still don't rotate properly around itself. Can anyone help me?

sentences:
C# Events in Unity to separate GameObject features into Components Broadly speaking, this is a question about how to separate my game object's code into distinct feature components that can be added and removed as needed.
More specifically, I am trying to achieve this using C# events in Unity. But I am open to other solutions.
Scenario: We have enemies that have health. When their health reaches zero, they die. Some enemies (think asteroids) may spawn a number of child enemies (think smaller astroid pieces) when they die. Others however, just die.
I want to have two scripts:

EnemyHealth: Tracks the enemy's health and kills the enemy when its health reaches zero.
EnemyChildrenSpawner: Spawns child enemies after the enemy's death

This way, all enemies will have the EnemyHealth script, and some enemies will have the EnemyChildrenSpawner script in addition.

My idea is to have the EnemyHealth script raise an event when the enemy dies, and have EnemyChildrenSpawner subscribe to said event to spawn the children.
What would be the best way of achieving this?
Here's my attempt. It works. Just not sure if this is good practice, especially using the GetComponent in the second script?
EnemyHealth.cs
public class EnemyHealth : MonoBehaviour
{
    // The event to invoke when this enemy died
    public event EventHandler OnDied;

    // Gets called when this enemy's health reached zero
    private void Die()
    {
        // Invoke the died event
        OnDied?.Invoke(this, EventArgs.Empty);

        // Destroy this enemy
    }
}

EnemyChildrenSpawner.cs
public class EnemyChildrenSpawner : MonoBehaviour
{
    private void OnEnable()
    {
        GetComponent<EnemyHealth>().OnDied += SpawnChildren;
    }

    private void OnDisable()
    {
        GetComponent<EnemyHealth>().OnDied -= SpawnChildren;
    }

    private void SpawnChildren(object sender, EventArgs e)
    {
        // Spawn children
    }
}

```

sentences:
RTS camera acceleration I have an RTS game with a camera that can be controlled by either edge-pan, gamepad analog stick or keyboard buttons (WASD). The speed and snappiness are good for the general case, but sometimes feels to slow when going to far-away places on the map.
What's a good algorithm to implement some form of acceleration on the camera without making it feel less snappy? Preferably, this algorithm should work best for the analog stick, since mouse+keyboard can easily use the minimap to navigate as well.

sentences:
How can I procedurally render irregularly shaped health bars? The issue of the traditional rectangular or heart-based health bar is something well-understood and easily solved. But what is the accepted solution for more "creatively-shaped" health bars, like the mockup I've made below?

The obvious way to do this would be to have "in-between" sprites, so the third image would be its own sprite, along with many other transitions for different levels of health. But that seems really inelegant and the number of in-betweens needed to create a smooth transition between health states would be large.

The only other idea I can come up with is to overlay the "full health" sprite on top of the "empty health" sprite and pre-bake sets of pixel coordinates to represent each tick of health and then make them opaque or transparent as health goes up or down.

I intend this question to be language and platform agnostic but feel free to provide a concrete sample in any language/library/framework if it helps the answer.

sentences:
Combining 2D and 3D in game engine I've implemented basic 3D functionality and made little "2.5D" demo in orthographic projection using OpenGL ES 2 and Box2D.

Now I want to make completely two-dimensional game (using sprites) and consider 2 variants:

Implement 2D graphics separately from 3D in separate layer, leave 3D stuff in background, draw 2D using various simplified algorithms (disable depth testing, simplified culling etc.)
Leave everything as is and use billboards for sprites

Currently I use hierarchical system of entities with matrix transformations. I know about computational complexity of 3D and 2D graphics and believe first method should result in faster code, though it's my first engine and my google-fu fails me this time, so I'm not sure about it.

Engine is Desktop/Mobile.

What method would you recommend? Does implementing first method worth it (in performance aspect)?

sentences:
Unity fails to effectively split spritesheet I'm very new to game development and I find it very difficult to split the spritesheets available at opengameart.org. All of them are kind of jumbled together without any fixed grid.
The resource I learned from always used neatly assembled sprite sheets and Unity would have no trouble in automatically splitting them. But almost all are randomly placed and Unity cannot split them.
For example:

And below is the automatic splitting in unity:

How do you guys get the sprites from such spritesheets in unity? Some guidance would be appreciated.
Thank you

sentences:
In HLSL pixel shader , why is SV_POSITION different to other semantics? In my HLSL pixel shader, SV_POSITION seems to have different values to any other semantic I use. I don't understand why this is. Can you please explain it?

For example, I am using a triangle with the following coordinates:

(0.0f, 0.5f)
(0.5f, -0.5f)
(-0.5f, -0.5f)

The w and z values are 0 and 1, respectively.

This is the pixel shader.

struct VS_IN
{
    float4 pos : POSITION;
};

struct PS_IN
{
    float4 pos : SV_POSITION;
    float4 k : LOLIMASEMANTIC;
};

PS_IN VS( VS_IN input )
{
    PS_IN output = (PS_IN)0;
    output.pos = input.pos;
    output.k = input.pos;
    return output;
}

float4 PS( PS_IN input ) : SV_Target
{
    // screenshot 1
    return input.pos;

    // screenshot 2
    return input.k;
}

technique10 Render
{
    pass P0
    {
        SetGeometryShader( 0 );
        SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetPixelShader( CompileShader( ps_4_0, PS() ) );
    }
}

When I use the first statement (result is first screenshot), the one that uses the SV_POSITION semantic, the result is completely unexpected and is yellow, whereas using any other semantic will produce the expected result. Why is this?

sentences:
Does ContentManager.Load() re-read an asset if I have loaded it before? Or is it smart enough to know I have asked for it before and return an in memory copy created from the first call?

For example if I have a projectile's texture:

Texture2D projectile;

If then I call:

projectile = ContentManager.Load<Texture2D>("bullet");

every time I want fire a new projectile - am I mallocing this on the heap or am I referencing the same copy in memory? If I am mallocing new memory each time I could keep it in memory myself by making the Texture2D variable static and not calling new each time one is fired! (I was just wondering about the ConentManger). The documentation (as with all the XNA documentation is skint on details: http://msdn.microsoft.com/en-us/library/bb197848.aspx).

sentences: how to play a video with Android or AndEngine I don't know if it's possible to show a video like the videos in Angry Birds (Something in Flash or another format) in middle of a game with Android or AndEngine or are they animations what they are made with Sprites and a more programming process?? How do they show those videos?

sentences:
Scale aware adaptive camera zooming I would like to implement an interactive zoom on a 3d object with mouse wheel.A naive approach is simple where you just scale camera marix Z poistion or modify FOV.But I would like the zoom scaling to be aware to the scale of the object and adapt its speed to it accordingly.It is standard behavior of CAD programs like Maya and 3d max.In this demo  the zoom scaling is performed by exponential grow of the value but it would still be the same for models with radius of 10 units and 100000 units.I am sure eventually I will probably roll my own solution but I am interested to know if there are some industry standard techniques for this kind of interactivity.

Also I am sorry if this is not an appropriate place to ask.I thought game devs should have some experience in this area.

sentences:
2D Sprite batching in OpenGL: How to send transformation data to GPU OpenGL newbie here.

So I'm trying to implement sprite batching to draw ~100 sprites per draw call. I've created a VBO that contains texture coordinates, vertex coordinates, color data (for tinting), and a mat4 matrix for transforms.

So far, so good, right? Well, everything is working but the transform portion of my VBO. My theory is that I could push a mat4 with all of the rotation, scaling, flipping, and world location data applied to it, so that it gets multiplied in with viewports (see glsl code below).

#version 130

//Vertex position attribute
in vec2 vertexPos;

//Texture coordinate attribute
in vec2 texCoordIn;
out vec2 texCoord;

// Vertex color
in vec4 textureColorIn;
out vec4 textureColor;

// Matrix transformations for the sprite
in mat4 transformation;

void main()
{
    //Process texCoord
    texCoord = texCoordIn;

    // Process texture color
    textureColor = textureColorIn;

    //Process vertex
    gl_Position =  gl_ProjectionMatrix * gl_ModelViewMatrix * vec4( vertexPos.x, vertexPos.y, 0.0, 1.0 ) * transformation;
}

So here's my question, if you were to send transform data to the GPU, how would you do it? Sending a mat4 over the wire per vertex seems like overkill.

sentences:
Help on my glow shader! I'm trying to create a glow shader for a neon style game but I'm having a little trouble with rendertargets. Right now all I want is something VERY simple where I change the rendertarget, draw to it and then pass it into the shader. A lot of the examples I've looked at do the first part but don't include how to pass it all through a shader. Right now I'm not really concerned about the glow part, I just want to get it passing through a shader so I can work on the glow part.

edit - new code:

graphicsDevice.SetRenderTarget(renderTarget);

..
..
..

graphicsDevice.SetRenderTarget(null);

renderTargetTexture = (Texture2D)renderTarget;
loader.GlowShader.Parameters["glowTexture"].SetValue(renderTargetTexture);

for (int l = 0; l < loader.GlowShader.CurrentTechnique.Passes.Count; l++)
{
    loader.GlowShader.CurrentTechnique.Passes[l].Apply();
}

renderQuad.Draw();

And the glow shader (this is probaly really messy but I'm not really fuzzed about that right now, I just want the basic thing to work):

float4x4 World;
float4x4 View;
float4x4 Projection;

Texture glowTexture;

sampler glowSampler = sampler_state
{
texture = <glowTexture>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = clamp;
AddressV = clamp;
};

struct VertexShaderInput
{
float4 Position : POSITION0;
};

struct VertexShaderOutput
{
float4 Position : POSITION0;
};

VertexShaderOutput VSOutline(VertexShaderInput input)
{
VertexShaderOutput output;

float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);

output.Position = mul(viewPosition, Projection);

return output;
}

float4 PSOutline(VertexShaderOutput input, float2 pixel:VPOS) : COLOR0
{
float2 uvPixel = (pixel + 0.5) * float2(1.0 / 1600, 1.0 / 900);
    return tex2D(glowSampler, uvPixel);
}

technique Outline
{
pass Pass1
{
    AlphaBlendEnable = TRUE;
    DestBlend = INVSRCALPHA;
    SrcBlend = SRCALPHA;

    VertexShader = compile vs_3_0 VSOutline();
    PixelShader = compile ps_3_0 PSOutline();
}
}

On a side note, if I try running this and drawing it using sprite batches it works so I think up until "rendertargetTexture = (Texture2D)renderTarget" everything is correct. It's just when I try to use the quads that nothing appears still.

        graphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
        using (SpriteBatch sprite = new SpriteBatch(graphicsDevice))
        {
            sprite.Begin();
            sprite.Draw(renderTargetTexture, new Vector2(0, 0), null, Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 1);
            sprite.End();
        }

sentences:
Why am I seeing unbounded memory usage in my WP8 game? I recently upgraded to VS2012 and tried my game out on the new WP8 emulators. I was dismayed to find out the emulator now crashes and throws an out of memory exception during my sprite loading procedure (it still works in WP7 emulators and on my WP7).

Regardless of whether the problem is the emulator or not, I want to get a clear understanding of how I should be managing memory in the game.

My game consists of a character that has 4+ different animations. Each animation consists of about 4 to 7 frames. On top of that, the character has up to 8 stackable visualization modifications (eye type, nose type, hair type, clothes type, et cetera). Prior to my memory issue, I preloaded all textures for each animation frame and customization  and created animate action out of them. The game then plays animations using the customizations applied to that current character.

I revisited this implementation when I received the out of memory exceptions and have started playing with RenderTexture instead, so instead of pre-loading all possible textures, it on loads textures needed for the character, renders them onto a single texture, from which the animation is built. This means the animations use 1/8th of the sprites they were before. I thought this would solve my issue, but it hasn't.

Here's a snippet of my code:

var characterTexture = CCRenderTexture.Create((int)width, (int)height);

characterTexture.BeginWithClear(0, 0, 0, 0);
// stamp a body onto my texture
var bodySprite = MethodToCreateSpecificSprite();
bodySprite.Position = centerPoint;
bodySprite.Visit();
bodySprite.Cleanup();
bodySprite = null;
// stamp eyes, nose, mouth, clothes, etc...

characterTexture.End();

As you can see, I'm calling CleanUp and setting the sprite to null in the hope of releasing the memory, though I don't believe this is the right way, nor does it seem to work.

I also tried using SharedTextureCache to load textures before stamping my texture out, and then clearing the SharedTextureCache with:

CCTextureCache.SharedTextureCache.RemoveAllTextures();

But this didn't have an effect either.

I used VS to do a memory profile of the emulation causing the crash. Both WP7.1 and WP8 emulators peak at about 150mb of usage. WP8 crashes and throws an out of memory exception.

Each customisation/frame is 15kb at the most. Lets say there are 8 layers of customization (120kb) but I render then onto one texture which I would assume is only 15kb again. Each animation is 8 frames at the most. That's 15kb for 1 texture, or 960kb for 8 textures of customization. There are 4 animation sets. That's 60Kb for 4 sets of 1 texture, or 3.75MB for 4 sets of 8 textures of customisation.

So even if its storing every layer, its 3.75MB. That's nowhere near the 150mb breaking point my profiler seems to suggest.

WP 7.1 Memory Profile (max 150MB)

WP8 Memory Profile (max 150MB and crashes)

Why might I be seeing this behavior?

sentences:
Lightning Effect PyGame I want to create a Lightning Effect Like http://www.youtube.com/watch?feature=player_embedded&v=mmU2GAYGVSU for my game.

The following blog explains it briefly but I am not able to understand the following line:

midPoint += Perpendicular(Normalize(endPoint-startPoint))*RandomFloat(-offsetAmount,offsetAmount);

UPD: I went through older question posted at gamedev.stackexchange and found following explanation:

Normalize(endPoint-startPoint):

That line gets a unit vector (vector of length 1) from startPoint to endPoint

Perpendicular(Normalize(endPoint-startPoint))

then gets a vector perpendicular to that (i.e. at right angles to the line)

I want to know  whether python has inbuilt function for

Getting a unit vector (vector of length 1) from startPoint to endPoint
Getting a vector perpendicular to that (i.e. at right angles to the line)

sentences:
Detecting extremely fast joystick button presses? Is it usually possible for the player to press and release a button within a single frame, so that the game engine doesn't have time to detect it?

How do programmers usually handle this situation?  Is it even necessary to handle it?

While testing, I was able to press and release a button within about 14 or 15 milliseconds (over 1 click/frame).  I was not, however, able to do this while holding the joystick normally, and the press-release cycle would have to start at almost the exact time the frame starts.

Specifically, I am asking about GLFW's joystick input capabilities.

I am currently using GLFW to make a game, and I've noticed that keyboard and mouse have callback functions, while joysticks do not.  Also, it does not appear to be possible to enable "sticky keys" for a joystick.  (I have only recently started using GLFW, so please correct me if I am wrong, as having either of those would solve the problem.)

Although I am asking about GLFW, answers related to any library/engine/language are welcome.

sentences:
UDP client code throwing a very nonspecific exception so I'm writing a UDP server and client on a couple of the machines in my virtual reality environment to allow (in this case) data from the location in the environment to trigger some air nozzles. The air nozzles I can control from the computer I have them plugged into, but I need to be able to control them from my machine running Unity. As far as I know, my server is functioning correctly, but I wrote a secondary listener script just to test it on the same machine and the error I'm getting is

Exception: System.Net.Sockets.SocketException: An invalid argument was supplied.

not 100% what this means, as I'm fairly new to Unity and software coding. my Client code is as follows:

public class udplistener : MonoBehaviour {
  public IPEndPoint ipep;
  public UdpClient udpListener;
  public int port = 13722;
  Thread udpThread;
  private Process process;

  // Use this for initialization
  void Start () {
    ipep = new IPEndPoint (IPAddress.Any, port);
    udpListener = new UdpClient();
    udpThread = new Thread (new ThreadStart(startProcess));
    udpThread.IsBackground = true;
    udpThread.Start ();
  }

  // Update is called once per frame
  void Update () {
    try {
      while(true)
      {
        byte[] recBytes = udpListener.Receive (ref ipep);
        string data = System.Text.Encoding.ASCII.GetString (recBytes);
        UnityEngine.Debug.Log ("Recieved data: " + data);
      }
    }
    catch (Exception e){
      UnityEngine.Debug.Log("Exception: " + e.ToString());
    }
  }

  void startProcess(){
    process = new Process();

    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.RedirectStandardError = true;
    process.StartInfo.RedirectStandardInput = false;

    process.StartInfo.CreateNoWindow = false;

    //process.StartInfo.WorkingDirectory = WorkingDirectory;
    //process.StartInfo.WorkingDirectory = "";
    UnityEngine.Debug.Log("Starting client. Stand by...");

    //process.St
    process.Start();

    UnityEngine.Debug.Log("Started client");
    // //Commented out for thread closing. Not used any more because of UDP client/server
    // while(true)
    // {
    //   ReadStdOut();
    //
    //   if (programStopped)
    //   {
    //     return;
    //   }
    // }
  }

I'm really confused, because I lifted this code out of another portion of our software to create a "backdoor" into the dSPACE (the physical controller portion) machine so I wouldn't have to change a lot of serial communication that is already in place. What is the Exception referencing and what do I need to change?

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:
Passing by pointer-reference in blueprints with C++ definitions MyFunction( Class *& foo )

Inside a derivative BP of the above C++ class:

foo shows up as an output rather than an input.

Why?

sentences:
java Game: Rendering issue! Hi I am making a java game in were you can build land. At the moment you can build but not destroy. So I want to be able to destroy. I have an array of the tiles. I think I might need to do something like remove the tile that the mouse is hovering on form he arraylist so how can I do this? I don't think you need my code to explain to me because I only want to know how to remove the Tile that the mouse is hovering over. Please help me.

EDIT** MY array is a arraylist kind of arraylist and I have an arraylist for each block.

sentences:
Drag an object in unity3d I want to drag an object to a perticular place.In case I release that dragged object before I reach that particular area ,the object should come to its initial place where i start to drag.  How it possible? Is there any specific motion for this?

void OnMouseDown()
{

    drag = true;
    //Debug.Log("haii ");
}
  void OnMouseDrag()
{
    if(drag)
    {
        var pos =Input.mousePosition;
        pos.x =Mathf.Clamp(pos.x,0,Screen.width);
        pos.y =Mathf.Clamp(pos.y,0,Screen.height);
        if(zdist>0)
        {
     zdist=Vector3.Distance(Camera.main.transform.position,transform.position);
            pos.z=zdist;
            pos = Camera.main.ScreenToWorldPoint(pos);
            transform.position =pos;

        }
    }
}

sentences:
Unity Build Failed - Duplicate Class I'm here struggling for hours to build my game (android) and 'Execution failed for task : checkReleaseDuplicateClasses'

Duplicate class androidx.annotation.AnimatorRes found in modules androidx.annotation.annotation-1.0.0.jar (androidx.annotation.annotation-1.0.0.jar) and androidx.annotation.annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar)
Duplicate class com.google.android.gms.auth.api.signin.zaa found in modules classes.jar (:com.google.android.gms.play-services-base-17.0.0:) and classes.jar (:com.google.android.gms.play-services-base-17.1.0:)

... are just two examples of the 486 warnings I'm getting.
Can anyone help a noob out?
Thanks so much for your time!

sentences:
How do I change a sprite's color? In my rhythm game, I have a note object which can be of a different color depending on the note chart. I could use a sprite sheet with all the different color variations I use, but I would prefer to parametrize this.
(Each note sprite is made of different shades of a hue. For example a red note has only red, light red and dark red.)

How can I colourise a sprite anew?

I'm working with OpenGL, but any algorithm or math explanation will do. :)

sentences:
AABB test does not consistently detect edge-to-edge contact when bounds are very different in size My function compares two AABBs for collision detection, and when they are around the same size it works fine, but I noticed that if I greatly decreased the size of one of them (or augmented the size of the other), then the collision wouldn't be detected correctly; I would have to have them intersect for a collision to be registered, rather than having it register when they are at least in direct contact, which is the intended behavior.

Below is my code:

local function DetectCollision(a, b) -- AABB to AABB
  local collisionX = (a.Position.X + a.Size.X) >= b.Position.X and (b.Position.X + b.Size.X) >= a.Position.X
  local collisionY = (a.Position.Y + a.Size.Y) >= b.Position.Y and (b.Position.Y + b.Size.Y) >= a.Position.Y
  local collisionZ = (a.Position.Z + a.Size.Z) >= b.Position.Z and (b.Position.Z + b.Size.Z) >= a.Position.Z
  return collisionX and collisionY and collisionZ
end

To be more specific, the issues start to occur when I cut the size of one of the AABBs in half. For instance, if I had two cubes where one's size is 12 on all axes and the other is 6 on all axes, then the collision will not register. Upon debugging, I noticed that only one of the collision bools will become false. This seems to depend on what axis the smaller bounding box moves from in relation to the bigger one, so if I moved the smaller AABB away from the bigger one on the y-axis, then collisionY will be false.

sentences:
Is creating a separate thread for each game session a bad idea? I'm currently working on iocp game server. My game is just like diablo3 basically. 1~4 players join a separate session.

I did basic iocp preparations and now I'm working on game session class. The reason why I'm stuck right now is that I'm not sure if I should create a separate thread for each game session. This concept is the first idea that I came up with but I can't come up with other ideas to avoid creating so many threads for sessions when there are so many game sessions.

So here's my question.

Should I create a separate game logic loop(thread) for each game session? Because that sounds so inefficient when it comes to the situation where only one player joins each session.
If there are some other ways to design the server, please let me know what I should look for to study.

Thanks for your help in advance and sorry for my bad English.

sentences:
Best way to prevent UIPanGestureRecognizer from firing when moving sprites in cocos2d Im using UIPanGestureRecognizer in my cocos2d game to do drag and drop of sprites. I have a row of sprites and when I drag a sprite on top of another one, the sprite underneath it and any other sprites between should shift left or right out of the way to allow space to drop the currently selected sprite.

This is working ok, however, if I am too quick at dragging the sprite around the screen, this triggers another round of the UIPanGestureRecognizer's callback method, and screws up the logic, as the sprites are in-between shifting.

I need a way to freeze the callback from firing, whilst the other sprites are shifting, then once they have finished moving, re-enable the callback to fire.

Whats the best way to do this?

sentences:
Why are 2D game tiles often lit from the top left? I have been in to game programming for some time now, and recently ventured out in to trying to create my own pixel art. So I have learned the basics of lighting and shading etc. and noticed that several games will light their tiles from the top left. Such as Super Metroid and Axiom Verge highlighted in red here:

I assume because there is no distinct light source, one was chosen and consistently applied everywhere where possible?

Why does it tend to be the top left, is it to do with westerners reading left to right, top to bottom perhaps?

And bonus question, what is the reason behind the opposite side shading shown in the blue circle in Axiom Verge?

sentences:
Tick() method error when I run it. HELP! Okay so I get this error:

Exception in thread "Thread-2" java.lang.NullPointerException
at basic.game.here.Game.tick(Game.java:71)
at basic.game.here.Game.run(Game.java:54)
at java.lang.Thread.run(Unknown Source)

Here is the code it says the error relates to:

package basic.game.here;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

import basic.game.here.tiles.Ground;

public class Game extends Canvas implements Runnable {

private static final long serialVersionUID = 1L;

public static final int WIDTH = 960, HEIGHT = WIDTH / 12 * 9;

private Thread thread;

private boolean running = false;

private int FPS = 0;

private World world;
private Player player;

public Game(){
    new Window(WIDTH, HEIGHT, "BASIC", this);

    world = new World();

    player = new Player(500, 200);

}

public synchronized void start(){
    thread = new Thread(this);
    running = true;
    thread.start();
}

public synchronized void stop(){
    try{
        thread.join();
        running = false;
    }catch(Exception e){
        e.printStackTrace();
    }
}

public void run() {
    long lastTimeChecked = System.nanoTime();
    int frames = 0;
    while(running){
        tick();
        render();
        try {
            Thread.sleep(6);
        } catch (InterruptedException e){
            e.printStackTrace();
        }
        frames++;
        if(System.nanoTime() - lastTimeChecked >= 1000000000){
            FPS = frames;
            frames = 0;
            lastTimeChecked = System.nanoTime();
    }
}
}

private void tick() {
    player.tick();
}

private void render(){
    BufferStrategy bs = this.getBufferStrategy();
    if(bs == null){
        this.createBufferStrategy(3);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    g.setColor(Color.BLUE);
    g.fillRect(0, 0, WIDTH, HEIGHT);

    g.setColor(Color.YELLOW);
    g.setFont(new Font("Dialog", Font.BOLD, 18));
    g.drawString("" + FPS, 5, 20);

    //g.drawString("(" + player.x + ", " + player.y + ")", 5, 40);

    world.render(g);
    player.render(g);

    g.dispose();
    bs.show();
}

public static void main(String[] args){
    new Game();
}

}

Here is the player class because I think it is related to this:

package basic.game.here;

import java.awt.Color;
import java.awt.Graphics;

public class Player {

private int x, y;

public Player(int x, int y){
    this.x = x;
    this.y = y;
}

public void tick(){

}

public void render(Graphics g){
    g.setColor(Color.CYAN);
    g.fillRect(x, y, 16, 16);
}

}

Thanks in advance!

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:
How to hide Game Progress Files saved in Application.persistentDataPath in Unity Android I am developing a game that saves its state in a text file. I am writing that file in Application.persistentDataPath but my issue is that the game progress file is available to user in Data/PACKAGE NAME/files/*.

How can I hide the game progress file so that user can't access the files ?

sentences:
New textblock after click on button I have made a box where you can type in your name in unity. After typing your name you can click on the button. Clicking on the button it will copy the string that you typed in within a sentence. so like: "The name" + stringToEdit + "is the name that your parents gave you!" . Now I used debug.log so that the text will show up in the debug. Is there a way to make the button add a text in a specific position in the scene that copies the string plus the sentences after being clicked???

I Used JS script by the way.

sentences:
How are 2D transformation matrices applied to their targets? I understand mathematically how transformation matrices work, in that a transformation matrix multiplied by a vector results in a new vector, and we use the matrices for rotation, translation, etc. I also understand that in 3D, the transformation matrices are applied to every vertex of each model in order to transform them, although that's basically the extent of my understanding vis-a-vis 3D transforms, and maybe even that understanding is a little wrong/simplistic.

However, many game engines/graphics rending libraries are designed with the intention of rendering 2D graphics (ex: Flash, XNA, SDL, Allegro), although I know at least some of them are really 3D under the hood. These engines allow the programmer to use transformation matrices to manipulate 2D entities, to do something like implementing a camera, for example. But I don't understand what the transformation matrices I'm plugging in to the engine are being multiplied by in order to perform the transformation. For a while I assumed it was applying the transformation matrix to each pixel of the original image, but that doesn't seem right to me.

So what vectors are the transformation matrices being multiplied by in the 2D transformations? Was I right, and it's really a per-pixel operation? Or does it do some kind of 3D magic under the hood?

sentences:
Unity 3D - Materials are Stretching and Tiling doesn't Help I am a programming student working with Unity 3D, version 2018.4.6f1 for this class. I wanted to add some materials to my wall, however, this results in a rather ugly result, because my walls are of different sizes.

This also happens with actual textures.

However, editing their "tiling" as suggested does not result in something pretty, because the sizes of the objects. (In the shown example, both tilings are x: 3 and y:4.) I can't seem to edit the individual tiling on each object, either.

How can I fix this, and make everything look nice? I obviously don't want to create a gazillion of the same texture/material just so I can tile it differently for each object.

sentences:
Pressing the jump button also makes my character fire their weapon In my game I want my player jump without firing their weapon, but when I press the button it jumps and also fires too in same moment.

In this Update method, I used Input.GetButton so my player will fire continuously while holding the button.

void Start () {
    isJumped = true;
}

// Update is called once per frame
void Update(){
    if (!transform.GetChild (0).gameObject.GetComponent<PlayerHealth> ().hasDied) {

        if (Input.GetButton ("Fire1") && Time.time > firespeed && isJumped == true) {
                nextFire = myTime + firespeed;
                newProjectile = Instantiate (projectile, transform.position, transform.rotation) as GameObject;
                nextFire = nextFire - myTime;
                myTime = 0.0F;
                //  EnergyCharging ();
            }
        }
    }

void JumpButton(){
if(!transform.GetChild(0).gameObject.GetComponent<PlayerHealth>().hasDied){
        if (grounded) {
            grounded = true;
            myRigidBody.AddForce (new Vector2 (0, jumpPower), ForceMode2D.Impulse);
            if(myRigidBody.velocity.y > jumpPower){
                myRigidBody.velocity = new Vector2 (0, jumpPower);
            }
            animator.SetBool ("isGrounded", grounded);
        }
    }
}

sentences: how to check if a gameserver can handle clients before game release? we are developing an iOS-based game with multiplayer support. so far everything seems real good but now we want to make sure if server could handle 10000 clients or not. any idea how can I make sure server will survive that much traffic?

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:
Gamestate management without evil Singletons I wanted to use a game state management system similiar to this approach: Managing Game States in C++

But from what I've heard singletons are evil and should not be used in 99.9%.

Can you tell me how I could modify the method of the above article to work without singletons?

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 do C++ games handle memory allocation failure? I am aware of several games which are written in C++ but do not use exceptions. Since handling of memory allocation failure in C++ is generally built around the std::bad_alloc exception, how do these games handle such a failure?

Do they simply crash, or is there another way to handle and recover from an out-of-memory error?

sentences:
Is my social game technical solution viable? I'm currently working on a board social game using HTML5 (canvas) & Asp.net MVC 4, Azure, Sql server, EF.
I'd like to do a server side realtime validation (using Ajax) of a player moves (not more than one every 2 seconds).
The problem is that I can't allow a communication to be longer than 200 ms (time of the client side animation).  On the server side I have to go to the database to do the validation.
I'm not sure that it is possible to keep a good communication speed over time with a growing community.

What would be a better scenario ?

Edit:
An other possibility would be to load the grid answers on the grid load but then every player with a bit of firebug background could get the answers with no pain..
Then I'm forced to go server side.
Maybe the best would be to load in the web role memory all the grids to not have to go to the database.

Another scenario could be:
1 ajax request to check in the server memory the grid solution
1 ajax request to confirm the player move in database
but  it's not cheater safe neither..

Thank for your help

David

sentences:
Game states affecting each other's objects If I had given this question any other title it would have immediately looked like a dupe of this one. Although that has some nice ideas none of the answers actually address what I need.

I'm refactoring my game state system a bit. I already have a stack system, not to share data, but so you can leave a pause menu and return to gameplay as it was. There is also a transition type that clears the stack completely, so you can go from the title, to a menu, to in game, and those aren't stacked on each other.

I have three big state types (handlers) right now: gameplay, menus, and cutscenes. The latter two have a lot in common so they share a base class. I'm stuck right now because of how they handle entities (gameplay objects), which all three can use.

Many games have cutscenes that don't leave gameplay, they just take control and start puppeteering the characters currently on the screen. My handlers currently have their entities separate from each other, and there's no data sharing. The only affect they can have on each other is deciding whether the previous one should keep updating / drawing or not. I need to refactor things so that I can support that kind of cutscene when it's pushed on top of the gameplay state.

How should I organize my states so that they can share entities?
I'm considering splitting my handlers in half, one side to hold objects, the other for logic to manipulate those. Then I could mix and match them, or just swap one logic for another without changing out the data. Will this work? Maybe another approach is better.

Again, I know this sounds a lot like the other question but those answers were either things I'm already doing or didn't match my situation.

sentences:
DirectX11 CreateWICTextureFromMemory Using PNG I've currently got textures loading using CreateWICTextureFromFile however I'd like a little more control over it, and I'd like to store images in their byte form in a resource loader. Below is just two sets of test code that return two separate results and I'm looking for any insight into a possible solution.

ID3D11ShaderResourceView* srv;

std::basic_ifstream<unsigned char> file("image.png", std::ios::binary);

file.seekg(0,std::ios::end);
int length = file.tellg();
file.seekg(0,std::ios::beg);

unsigned char* buffer = new unsigned char[length];
file.read(&buffer[0],length);

file.close();

HRESULT hr;
hr = DirectX::CreateWICTextureFromMemory(_D3D->GetDevice(), _D3D->GetDeviceContext(), &buffer[0], sizeof(buffer), nullptr, &srv, NULL);

As a return for the above code I get Component not found.

std::ifstream file;
ID3D11ShaderResourceView* srv;

file.open("image.png", std::ios::binary);

file.seekg(0,std::ios::end);
int length = file.tellg();
file.seekg(0,std::ios::beg);

std::vector<char> buffer(length);
file.read(&buffer[0],length);

file.close();

HRESULT hr;
hr = DirectX::CreateWICTextureFromMemory(_D3D->GetDevice(), _D3D->GetDeviceContext(), (const uint8_t*)&buffer[0], sizeof(buffer), nullptr, &srv, NULL);

The above code returns that the image format is unknown.

I'm clearly doing something wrong here, any help is greatly appreciated. Tried finding anything even similar on stackoverflow, and google to no avail.

sentences:
Understanding pixel art in Unity 2d I am struggling to understand the basics behind pixel art in Unity.

I understand what a unit is, and that if I draw my sprite with 16x16 pixels, I should set PPU to 16.

Take stardew valley for example, in the image below you can clearly see that the player is not square. The creator of the game said he made everything in 16x16, but then how is there so much detail in the characters? Surely you do not patch several 16x16 squares together to make a character (as you would with a tilemap)?

What is the "common" way of dealing with things that are not square, like the characters in the image. Do you just make  16x32 sprite and set PPU to 16? Wont that make it look a bit weird next to 16x16 sprites?
Do you generally pick one size (i.e 16, 32, 64) And then stick to that for everything in the game?

The visual Issue I've seen is this, where a 32x32 sprite looks very out of place (too sharp) next to a 16x16 sprite.

So I am wondering, how do you mix sizes wihout getting this effect where one image looks much sharper than the other. If I for example wanted a character to be 16x32, or any non-square value, when my tiles are 16x16

sentences:
Indicating low vs high card wins in trick taking card game I have a trick taking card game in which case there are occasions when the high card wins and occasions when the low card wins. Usually this is based on who lead the trick but some cards can change this mid hand.

I had an arrow icon to indicate this with it pointing up while a high card will win and low while a low card would win and a sound when this was changed mid-round.

This does not appear to be consistently conveying the desired message. What would be a better non-textual way to do so? I don't want to just put a bunch of text on screen because people would skip it and then get confused anyway or get annoyed by being made to read a bunch of text before playing.

sentences:
How to improve my maxscript random blood generation code? The idea was simple. Draw basic blood drop meshes. Shuffle them with random generator to get final drop's. Export and render them in game as other meshes.

The problem is that it's not looks like a blood drop, but a rocks.

What is the best way to improve this? Redraw basic drops? Apply some modifier to final drop mesh? But what modifier? How to smooth borders in final drop mesh? I am totally stuck with this. The improvment must be codeable in MAXSCRIPT, not a manual correction of mesh, because I am a programmer not 3D modeller.

The generator final result screenshot.

Final blood drop:

P.S. For those who would like to test generator manually here it goes the prooflink. Works nice at 2010 version.

sentences:
Is the Microsoft recommendation to use C# properties applicable to game development? I get that sometimes you need properties, like:

public int[] Transitions { get; set; }

or:

[SerializeField] private int[] m_Transitions;
public int[] Transitions { get { return m_Transitions; } set { m_Transitions = value; } }

But my impression is that in game development, unless you have a reason to do otherwise, everything should be nearly as fast as possible. My impression from things I've read is that Unity 3D is not sure to inline access via properties, so using a property will result in an extra function call.

Am I right to constantly ignore Visual Studio's suggestions to not use public fields? (Note that we do use int Foo { get; private set; } where there is an advantage in showing the intended usage.)

I'm aware that premature optimization is bad, but as I said, in game development you don't make something slow when a similar effort could make it fast.

sentences:
Sending a players mouse movement to the server in an FPS So I have a server-client model FPS set up. It uses udp to send data between the two with the server having a constant tick rate of 100 ticks per second (It updates movement 100 times a second) on the server with the client doing update of its key states etc 30 times a second and for keys the system works well. But now my question is how would I send the mouse movement to the server as this in not an on/off system is is constantly changing.

So my question is how do you send the movement of the mouse to the server. Do you send the direction and speed that the mouse is moving each update and interpolate it or something else. The problem I can see with interpolating something like a mouse is that in an FPS it is required to be very accurate and interpolating is literally guessing. Any advice would be appreciated.

The other problem that I see is that to get a direction vector of a mouse you would have to wait for enough movement to get the vector.

Another idea has come to me and that is just sending the direction that the client thinks its looking when it shoots.

Any advice would be much appreciated.

sentences:
How can I properly display the distance with the unit in a string on the UI? I wrote a script for distance of car and I don`t know how to make distance like this Distance: 156Km. I wrote this code:

distanceText.text = ((int)distance).ToString() + "Km";

It works only from 1 to 9; when it goes to 10 Km, it disappears but if I write it like this:

distanceText.text = ((int)distance).ToString() + " Km";

It show like this: from 1 to 9 -> "5 Km" and from 10 to 99 -> "99Km" but when it goes to 100 Km and above, it disappears. What code should I write for this to show always Km after the distance.

And I have one more question. I have a gameover canvas and I'd like in gameover canvas to show the final distance I make with PlayerPrefs but it doesn't work.

Here it shows how it does not work:

sentences:
Slick & LWJGL Flickering Problem I have an flickering problem with rendering tiles.
    Rendering Method.

int tileSize = TileManager.tileSize;

    for(int y = 0 ; y < mapHeight ; y++){
        for(int x = 0 ; x < mapWidth ; x++){
            TileManager.tiles[tileIDs[y][x]].render(x * tileSize + xOffset, y * tileSize + yOffset, g);
        }
    }

TileManager

public static Tile[] tiles = new Tile[256];

public static final int tileSize = 32;

public static void loadTiles(String path){

    Image tileSet = GeneralUtils.getImage(path);

    int row = (int)Math.floor(tileSet.getWidth() / tileSize);
    int col = (int)Math.floor(tileSet.getHeight() / tileSize);

    for(int y = 0 ; y < col ; y++){
        for(int x = 0 ; x < row ; x++){
            tiles[x + y * row] = new Tile(tileSet.getSubImage(x * tileSize, y * tileSize, tileSize, tileSize));
        }
    }

}

Finally Tile

private Image tileImage;

public Tile(Image tileImage){
    this.tileImage = tileImage;
}

public void render(int xPix, int yPix, Graphics g){
    g.drawImage(tileImage, xPix, yPix);
}

If i render like this there is no flickering. I couldnt understand why ?

img = new Image("Res/blabla.png");
----------------------------------------------------
int tileSize = TileManager.tileSize;

    for(int y = 0 ; y < mapHeight ; y++){
        for(int x = 0 ; x < mapWidth ; x++){
            g.drawImage(img, x * tileSize + xOffset, y * tileSize + yOffset);
        }
    }

sentences:
Should I use attack effect collision to detect when damage is dealt? I am wondering what a common way for actually dealing damage to different units is. Imagine a game like starcraft for example, should damage be done like this:

  1) zealot attacks zergling, deal damage to zergling

or

  2) zealot attacks zergling, create an attack effect on zergling. When
  this effect collides with the zergling deal damage to said zergling.

The advantage of 2 is for projectiles (like a dragoon attack) will deal damage when the attack collides with the target unit.

What are your thoughts about this in general? Are there other ways of doing this?

sentences: Can I remove the "powered by COCOS creator" message from my game? Is it legal to remove powered by COCOS creator in the page where the html is exported and also in the splash screen?

sentences:
Unity3d - zooming with orthogonal camera like in Google maps I am implementing 2d orthogonal zoom.

As far as I know - in Unity3d there are no translations like in OpenGL.
Taking this into consideration, I work with :

camera size
camera position (center)
real world mouse position

I have no issues implementing simple zoom in/ zoom out operations, combined with camera position changes ( drag'n'drop )

But I have some issues calculating camera zoom shift in this case :

camera size = (4,4)
camera position = (0,0)
real world mouse position = (1,0)

A double zoom in (2x) is applied, as a result -

camera size = (2,2)
camera position = (0.5,0)
real world mouse position = (1,0)

User shifts real mouse position to (1.5,0) and applies a double zoom out ( 0.5 ). In this case :

camera size is again (4,4)
camera position = ???????
real world mouse position = (1.5,0)

What should be the camera shift so the mouse doesn't visually move ?
What is the formula for calculation in this case ?

Thank you in advance.

P.S. Any suggestion regarding current method of handling zoom are welcome

Update

So - I resolved this issue with Blue's help. The basic idea about shifting is right. The main reason it didn't work was incorrect zoom factor.

Example :

Initial camera size is 5. User zooms in by 1, camera size is now 4 ( it displays less content on the same 'screen'). User changes mouse position and zooms out by 1. Camera size is 5 again, but the amount of zoom is actually different :

initially the change was 20% ( 1/5 )
in the second time, the change was 25% ( 1/4 )

My fault was that, when zooming out, I tried to restore position by 20%, not 25%.

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:
Persistent Data for Multiplayer, Browser-Based Games What is generally used to store persistent data in online games - browser games/facebook apps, in particular?

I have used MySQL in web development before - but I've read that it's not very scalable, especially if many transactions are happening constantly (which is what will happen inside of a game).

I'm writing the back end in Node.js using Heroku, so it would be really nice if there were a Node package to go with it.

Any insight would be much appreciated.

sentences:
Rotation going wrong I'm calculating matrices by hand. Translations are fine:

 void Translate (float x, float y, float z, float[4][4] m) {
     Identity (m);
     m[3][0] = x;
     m[3][1] = y;
     m[3][2] = z;
 }

If I multiply a vector with this matrix, I get the correct transformation. My problem now is Rotations. I copied the definition from the OpenGL reference on glRotation, but I can't get it right. Can you spot my mistake?

void Rotate (float angle, float x, float y, float z, float[4][4] m) {
    float c = cos (angle);
    float s = sin (angle);
    m[0][0] = x*x*(1-c)+c;
    m[0][1] = y*x*(1-c)+z*s;
    m[0][2] = x*z*(1-c)-y*s;
    m[0][3] = 0;
    m[1][0] = x*y*(1-c)-z*s;
    m[1][1] = y*y*(1-c)+c;
    m[1][2] = y*z*(1-c)+x*s;
    m[1][3] = 0;
    m[2][0] = x*z*(1-c)+y*s;
    m[2][1] = y*z*(1-c)-x*s;
    m[2][2] = z*z*(1-c)+c;
    m[2][3] = 0;
    m[3][0] = 0;
    m[3][1] = 0;
    m[3][2] = 0;
    m[3][3] = 1;
}

I don't know what else is relevant, so, if you're kind enough to lend me a hand on this and if I just don't present enough info, just say it.

Thank you for taking the time to read this question.

EDIT
The trouble I'm having is the following: If I do Rotate (180,0,0,0), the vertexes are inverted as intended but the resulting triangle (in this case) is smaller.

Screenshot:

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:
Is there any reason to use a "canvas" based approach to GUI in isometric games? When designing game engine GUI systems, I know a lot of game engines (notably Unity and Unreal) use a sort of "canvas" system. However, in an isometric game where the camera is already orthographic, this seems like it might be overkill. Everything is already dictated in terms of pixels, as is the case in an isometric game; I feel that there would be little need for such a "canvas", which seems to be the bridge between world space coordinates and screen space coordinates.

With the orthographic view, world space is more seamlessly joined with screen space, so wouldn't it be simpler to get the position of the camera, define a set of points (i.e. top-left, top-right, center, etc.) on a plane that is directly in front of the camera and render controls directly in front of the camera? Would there be any downsides to this method, or am I missing the point entirely?

sentences:
Weird behavior with XNA SpriteBatch.Draw origin I have a texture with 256x256 pixels.

Consider this piece of code:

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();
        spriteBatch.Draw(texture, new Rectangle(0, 0, 100, 100), null, Color.White);
        spriteBatch.End();

        base.Draw(gameTime);
    }

If I run this, the texture appears (predictably) at the top-left corner of the window with the correct size (100x100).

If I do this instead (XNA 4.0-only):

spriteBatch.Draw(texture, new Rectangle(0, 0, 100, 100), null, Color.White, 0, new Vector2(0, 0), SpriteEffects.None, 0);

Everything is still as expected. However, as soon as I change the origin parameter, the position gets weird.

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();
        spriteBatch.Draw(texture, new Rectangle(0, 0, 100, 100), null, Color.White, 0, new Vector2(128, 128), SpriteEffects.None, 0);
        spriteBatch.End();

        base.Draw(gameTime);
    }

In this last example, only 1/4 of the texture is visible.

In other words, the origin parameter not only changes the origin of the rotation, but also the destination rectangle. In other words, the Top/Left coordinates of the rectangle are not the Top/Left coordinates of the drawn sprite, but rather the coordinates of the Origin.X/Origin.Y texture pixel.

If the target position was just a Vector2, I'd understand (and fully support) this behavior, but with a destination rectangle it just seems odd, especially since the documentation does not seem to mention this fact (although to be honest, the documentation barely says anything at all).

A StackOverflow answer even suggests that a destination rectangle with rotation doesn't make much sense, but XNA offers it anyway.

What is the reason for this behavior?

sentences:
Rotation in animation not working I have a model of an SMG with arms exported from Blender and set to generic rig in unity import settings. I was creating an animation for this model in Unity Animation tab, it included changes in position and rotation of the individual parts like magazine and left arm and gun itself. Then when I was satisfied with how the animation worked (I saw it by pressing the play button IN THE ANIMATION TAB). My problem is that when I click play IN THE GAME TAB there is no rotation and some movement, only some parts move (but not rotate). Does anyone know what could be my problem? I am not sure what screenshots to post so tell me what you need to see and I'll add some.
Thanks in advance.

sentences:
Is any data structure more efficient than quad-tree for storing and querying points that lay within an OBB? Is there any method more effective than quad-trees for storing and searching sets of points that are not spread uniformly on the plane?

I need to be able to add, remove and search for points that are within a specified range.

I am currently testing with quad-tree but it seems the results are less than optimal when the points are not spread uniformly enough.

The points are mostly clustered in specific areas:

sentences:
Implementing the "earn resource every N seconds" mechanism common to F2P games In many free-to-play games, play will be rate limited in some manner by a resource that you naturally earn on a timed interval, but can opt to increase artificially through buy-ins.

A current example of this is the popular game Candy Crush, which refills 1 life (retry) on some set interval.

Key requirements:

The client should be able to accurately predict the time to the next resource, such that it might display a countdown, etc.
Resource gain is not regular.  It can be offset by, at least, resource buy-ins, or perhaps varying intervals between users.
Resource gain is capped, and thus not continual.  E.g. maximum "lives" might be 5.
The server is the resource authority, obviously.  The client might predict resource generation without actual notification as to such, but the resource count is determined server side.

Naively, one might simply implement this as a database update across the collection on the interval (if the interval is constant), but this would surely not scale.  It would become more and more out of sync with the client timers as the dataset scales and the operation takes more time.  Not to mention, it would be wasteful, as it's likely that only the percentage of your membership currently online needs to see realtime updates.

It seems like it would be possible to calculate the resource as a function of time since creation, time spent uncapped, resources earned, and resources spent.  Would this be a viable option?

The question is, what is the best way to implement this mechanism to scale?

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:
OpenGL assets and new OpenGL context So I have a bunch of meshes, materials, etc and then all of a sudden the window needs to be torn down and then recreated (such as switching on fullscreen with GLFW) which means I will get a new OpenGL context and my old OpenGL data is invalid.

What is the best way to reload all my OpenGL assets - do I save all the mesh and material data in system RAM (which is quite a waste isn't it? if you do not recreate the window during the game, it does absolutely nothing for alot of RAM) -OR- do you map the filepaths to all assets, and then re-read from disk when you reload them? (could lead to alot of file i/o)

Or is there a better alternative? What is the best-practice here?

sentences:
How to rotate and move an object in precise time frame My task is to rotate and move an object into a new position and rotation in a given time. Say I have to move a cube from (0,0,0)|(0,0,0) to (1,1,1)|(0,90,0) in 5 seconds. Could anyone explain to me please how to achieve that?
My experiment is:
private IEnumerator DoMove(/*float time, Vector3 targetPosition*/)
{
    foreach(WayPoints wp in tposes)
    {
        float counter = 0;
        float duration = wp.timeStamp;
        while (counter < duration)
        {
            counter += Time.deltaTime;
            Vector3 curpos = cube.transform.position;
            Quaternion crot = cube.transform.rotation;
            float time = Vector3.Distance(curpos, wp.position.position) / (duration - counter) * Time.deltaTime;
            cube.transform.position = Vector3.MoveTowards(curpos, wp.position.position, time);
            cube.transform.rotation = Quaternion.Lerp(crot, wp.position.rotation, time);
            yield return null;
        }
        Debug.Log("Reached position: " + wp.position.position + " in time: " + Time.time);
    }
}

The cube gets to its position in time, but rotation is late. The end position of the cube should be (2,2,2)|(0,120,0), but it stops moving at (2,2,2)|(0,~110,0).
There are two positions I want the cube to be in:

(1,1,1)|(0,90,0) in 5 seconds
(2,2,2)|(0,120,0) in next 4 seconds

sentences:
Why can changing a camera's position prevent it from rotating? I am going through the official introductory series "Roll a Ball" by the Unity team, and am on part 3 (youtube link.

There is a ball with mouse controls attached, and a Camera set as a descendant of the ball so that it follows it around. As the tutorial mentions, the Camera at this stage "rolls" along with the ball and is unusable.

The fix, as shown in the video, is the following added to Camera:

public GameObject player; # added through GUI
private Vector3 offset;
void Start () {
  offset = transform.position - player.transform.position;
}
void Update () {
  transform.position = player.transform.position + offset;
}

I understand in terms of C# syntax what this does, but I don't understand why it stops the camera from rotating. Isn't position controlled separately from rotation?

sentences:
How are Tile Collision Slopes done in Game Maker Studio 2 / GML or in general? I have been trying to get my slopes to function for almost a month now, doing nothing else with the project.
Rewrote it 6-7 times in different collision styles, sometimes coming close to success while still being stuck with absolutely no help I could find during this month.
Here are the methods that I tried and what happened:
First I followed a video tutorial specific to game maker 2's tile collisions.
It fills an array with how many pixels are filled on the y axis for every pixel on the x.
Then it calculates how deep the player's (bounding box) bottom-center is in the slope tile and pushes him above the corresponding pixel count from the array.
Worked great for my floor slopes, didn't for my ceiling slopes.
So I tried to reverse the way the pixels are counted and got a proper array, however fiddling with this system for 2 weeks alone, I still got stuck, presumably due to a math error.
If you are interested about this system, I basically posted everything there is to it on the yoyogames forums:
Here
I definitely need ceiling slopes to work, since the game is a Metroidvania like game, where there might be a lot more vertical movement going on.
But then I figured, I could simplify this whole procedure, since my pixel art aesthetic currently uses one type of slope (where I potentially would like to keep the system to work with any slope that is a straight line for future additions)
Currently my only slope is 2 tiles wide and 1 tile high.
I tried around with setting the player's y coordinate according to the linear function
y = m*x + b
I tested this by putting in y = -0.5 * current player position + the y coordinate of the slope tile in the room.
However this function sets my player a fair bit above the slope, in the air.
I know this is a lot to ask and maybe I'm totally stupid about this problem but I really tried HARD on this one, with my current knowledge and the one that is readily available I can't solve my issue.

sentences:
What is the process for getting a dev-kit for Xbox 360 to allow native coding I'm curious about the process of getting a Xbox 360 dev-kit.

What are the requirements? Do you have to have a track record in game development. Can indie gamers get one. How much does it cost? Is there special hardware?

sentences:
Compensate for animation time in multiplayer network game I'm developing a multiplayer turn-based card game. In certain scenarios, the clients are required to perform an animation before moving on with the game. For example, the server informs the clients to animate dealing cards to all players. This animation takes around 5 seconds. Afterwards, the server informs a client to make a move, with a timer showing how long they have to play.

How can the server wait for the animation to finish before moving on and starting a timer and informing a client to play? The timer obviously needs to start after the animations are complete.

I've thought of the following:

1) Hardcode the animation durations on the server side and delay sending out the next message to the clients until after the duration of the animation.

2) Have the clients inform the server when an animation is complete.

..but I feel that there should be a better way.

Is there any other way to do this?

sentences:
Creating custom types that extend certain objects Really new to C# scripting. I'm trying to extend a TileBase type object to be able to hold custom methods and variables.

I want to create a pathfinding script and I need to store certain information for each tile. Something like this:

TileBase startPoint = tilemap.GetTile (tilemap.WorldToCell (transform.position));

startPoint.customVariable = 5;

Is there a way to extend TileBase into a new type and create custom methods inside it? How can I achieve this in Unity?

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:
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:
Moving CCNode with constant speed in cocos2d I want to move the object (CCNODE) with constant speed in any direction , what i have did till now is applied a force to object at start to get it moving and set elasticity as 1 and friction as 0 to every object which it will collide .

After some time speed goes on increasing , is there any way so i can check if speed increased so that i can control it or to apply velocity instead of force .  Thanks !

sentences:
how to re-use a sprite in cocos2d-x some times it takes time to create the sprite structures in the scene, I might need to setup structures inside this sprite to meet requirement, thus I would hope to reuse such structures with the game again and again.

I tried that, remove the child from parent, detach it from parent , clean parent with the sprite. but when I try to add the sprite to another scene, it's just wont pass the assertion that the sprite already have parent

did I miss some step ?

add an example:

I have a sprite A which involves of quite a few steps to construct, so I used it in scene A layer A, and then I want to use it in scene A layer B, scene B layer A1  etc..... generally speaking I don't want to reconstruct the sprte again.

sentences:
android game performance regarding timers Im new to the game-dev world and I have a tendancy to over-simplify my code, and sometimes this costs me alot fo memory.

Im using a custom TimerTask that looks like this:

    public class Task extends TimerTask {

    private MainGamePanel panel;
    public Task(MainGamePanel panel) {
    this.panel=panel;
    }

    /**
    * When the timer executes, this code is run.
    */
    public void run() {
    panel.createEnemies();
    }
    }

this task calls this method from my view:

    public void createEnemies() {
    Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.female);
    if(enemyCounter < 24){
        enemies.add(new Enemy(bmp, this));
    }
    enemyCounter++;
      }

Since I call this in the onCreate-method instead of in my views contructor (because My enemies need to get width and height of view). Im wondering if this will work when I have multiple levels in game (start a new intent). And if this kind of timer really is the best way to add a delay between the spawning-time of my enemies performance-wise.

adding code for my timer if any1 came here cus they dont understand timers:

    private Timer timer1 = new Timer();
    private long delay1 = 5*1000; // 5 sec delay

    public void surfaceCreated(SurfaceHolder holder) {
    timer1.schedule(new Task(this), 0, delay1); //I call my timer and add the delay
    thread.setRunning(true);
    thread.start();
}

sentences:
How should I animate sprites with separate body parts? I am not an artist. I have a 2D Sprite broken up into different body parts that I want to animate. I know how to do it in Unity, but every artist I know would prefer to use Flash. I am trying to figure out if I should do it in Unity, or learn how to do it in Flash.

My understanding is that in Unity, I'd have to animate directly, or Flash would output sprite sheets.

Is there anything Flash offers for animating sprites that Unity does not? Is there a benefit to using sprite sheets over animating directly? Is there an option I should consider over Flash and Unity?

sentences:
In Unity - displaying long lists of information to screen? Tables? Hello folks I'm making a little game for fun in unity, Its a boxing management sim. I've got the code done to create boxers and give them many properties such as names, weights, stats, etc.
I've made another screen , lets call it 'office screen' for now. In that I want to open a panel which will show all the boxers in the game (ideally I'd like to be able to make the player be able to filter these results by which company he's signed to etc - but I think that might be out of my skill range so maybe i will just make a separate screen for Owned Boxers)

But I cannot seem to find a way to display all these infos in a table with columns such as Name ; Age ; Company ; etc;

I have had a go just using the UI Text components and panels. But thing is, there will be approx 100 boxers or more and this number will always change also.

Any ideas for this in Unity specifically?

EDIT: I am storing all the data just as variables (i think fields) in a class called Boxer which is assigned as a component of a new GameObject i instantiate at the time each boxer is created. So each boxer has its own gameobject.

EDIT 2 :D i've found this: https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/models-data/displaying-a-table-of-database-data-cs
would this be the sort of thing I can add to Unity (assuming I can follow along with the guide)?

Thanks for any help

sentences:
RTS: Unit sight in fog of war I am making an RTS game, and like most RTSs, you can see what's going on in a part of a map only if you have a unit over there.

I have few ideas how to accomplish this, but there are problems with them.

Problems are:

Algorithm must be efficient.
I need to notify players (over network), when an enemy comes into sight.
How do I account for obstacles obstructing sight (such as cliffs).

Naïve approach would be like this:

// pseudocode
func calculate_visibility:
   vector<Bitfield> visible;

   for all units on map:
        let unit = enumerated unit

        for all human players:
             let player = enumerated player

             for all units of player:
                  let player_unit = enumerated unit

                  if player_unit sees unit
                       visible[unit.id][player.id] = true
                       process next player

And then run this calculation each frame, compare results with previous frame and send out events, like “enemy unit detected”.

I did some benchmarking, and using approach like this may take up to 2/3 of a frame, which is unacceptable.

I figured out a better way to calculate which units are visible. This approach is to use a visibility map.

Subdivide the map into N×M cells.
Each cell is marked by IDs of players that can see the cell.
To determine which players can see an unit, I need only to check cells that contain given unit.

However, I don't know how to fill the map in the first place. I could iterate through all units and use a circle-drawing algorithm.

But I'll have to redraw the visibility map every frame, so this doesn't look much more efficient than the first approach. Unless I update it at a lower rate, but then there's a problem with fast-moving units.

And how do I detect when unit comes in player's sight, except than iterating through every unit and comparing with previous frame?

How is this done in modern RTS, such as StarCraft 2?

sentences:
libgdx images go out of proportion on some devices I'm trying to develop a simple game using libgdx. The game works perfectly on emulator ( Nexus 5x API 26 x86 ). But when I generated its apk and tested on my phone(Samsung J7), the images somehow seem to go out of proportion.

I dont know if the problem is libgdx-specific or something else is causing the problem. I suspect that the issue is about the different screen sizes or resolution.

This is how I want it to be.

This is how it appears. The images appear to be enlarged.

The app seems to work as expected on larger mobile screens but the images do not scale well to smaller screens.

Does libGdx or the android not automatically resize images according to the hardware being run on ?

Any help would be highly appreciated.

Edit :

boy = new Texture("boyfinal.png");
batch.draw(boy, Gdx.graphics.getWidth()/4 - boy.getWidth()/2, boyY  );

sentences:
How can I edit the components of an instantiated prefab? Is it possible to edit one or more components of an instantiated prefab ?

For example if you instantiated five cube prefabs. Is it possible to reference each of the cube prefab and change a value individually ? Such as changing its position or even its scale.

If possible how can it be done ? Another request is, if this can be done. Could it be in the Update() function so when the game is running values can be experimented with.

sentences: How to do directional per fragment lighting in world space? I am attempting to create a GLSL shader for simple, per-fragment directional light.  So far, after following many tutorials, I have continually ran into the issue: my light is specified in world coordinates, however, the shader treats the light's position as being in eye space, thus, the light direction changes when I move the camera.  My question is, how to I transform a directional light position such as (50, 50, 50, 0) into eye space, or, would doing things this way be the incorrect approach to the problem?

sentences: How to calculate the distance from the camera to make a GameObject fill the screen? How do you calculate the distance from the camera so that a GameObject fills the screen? I.e. Without reaching out of the view and regardless of screen orientation.

sentences:
Percentages for different platform generation I have a level manager, which creates levels and levels create platforms.

Levels can contain a variety of platforms.

I dont really understand how I can say:

  I want a 10% of one platform being made, 30% chance of another, and 70% chance for anotgher and so on...

At the moment I have a method that looks like this:

   private void creationManager(float moveChance, float breakableChance, float superJumpChance)

I'm not sure how I can use these values and probabaility to determine which type of paltform is created.

Any ideas?

sentences:
Stencil based mask with alpha I'm trying to create a fog effect like civ 5:

I tried creating a StencilSet shader that receives a mask and sets the stencil buffer to 1. I would render the following on every unexplored tile using this shader. White is full alpha, black is 0 alpha, gray is in between.

Then I created a StencilUse shader that would display the cloud as one big texture, but will test that stencil value is 1. This way the cloud will only be shown on top of the unexplored tiles (+ a bit of overlap outside the tile, per the mask sprite).

This is what I got:

The problem is that I can't produce the fading effects towards the end of the cloud. It's either fully visible or not visible at all. How would I be able to use the grey areas when determining the alpha value of the cloud?

Any ideas?
(I'm using Unity)

sentences:
How to calculate a direction that will turn a parent so that a locally-rotated child is faced in a given direction? Imagine an old sailing ship with cannons: they're pointed out at 90° angles from the ship's hull, so in order to fire them, you have to turn the whole ship so that the cannons are pointed at the target. I'm hoping to figure how to calculate "where to point the ship so that the cannons are aimed correctly," but for any possible cannon-angle (not just 90°) in 3D space.
I'm an experienced dev but a total 3D newb, so this vector stuff is wrinkling my brain. This is what I have right now, calculated from the child's (cannon's) gameObject:
Vector3 directionToAim = (transform.localRotation * (transform.position - target.position)).normalized;
It's working for side-facing weapons (like the sailing ship), but for forward-facing weapons it turns the parent in the opposite direction, directly away from the target.  If I invert it to (target.position - transform.position) the forward-facing weapons work fine, but the side-facing weapons face the opposite way.
Also, my vague understanding is that it's better to use Quaternions for this, rather than Vector3, is that right? Can someone help me grasp how these parent/child rotations can be calculated?

sentences: moving from Glut to SDL2 I'm using Glut with OpenGL for drawing. Glut is very simple and straightforward but I have to give up Glut and move on toward SDL2. I'm reading SDL for Game Development, good book. I need to speed up a bit, so I'm looking for a list of comparisons between Glut and SDL2. At least with common similarities between the two. For example, in Glut we need for drawing Display() to be passed to glutDisplayFunc(). My understanding so far for SDL2 is that SDL_Renderer is like Display() in Glut. Is this correct? Also, what do exactly SDL_Surface and SDL_RenderPresent mean?

sentences:
Collision for mobile game I'm writing a little game in as3 using Starling, and I need to check collision between 2 boats that can rotate. I don't need the pixel perfect collision, but bounds collision is not enough too. The boat look more or less like this:

I was thinking about create one square on the back of the boat and a triangle on the front, than for each boat, check if the square collide with the other boat square or triangle, and the same for the triangle.

I just don't know how to do that, I don't know if it's possible with the Shape.hitTest, or if it's the best way to do that.

What can I do?

sentences:
How can I consistently map mouse movements to camera rotation? I am writing a OpenGL game engine and also an editor for the engine. In my editor, I can import 3D models from FBX/Collada as a scene graph. Now I want to implement the option for the user to rotate and the camera in the viewport using mouse.

I found many links to rotate the camera by some angle based on the delta x and delta y of the mouse. This is fine. But my problem is selecting the axis for rotation.

For example, if the user moves the mouse in the x axis, I am changing the camera's local rotation angle along y axis (the up axis). But this is not always working. In case if the camera node's parent node is rotated 90 degree in the x axis, when I change the camera's local y axis rotation angle, the scene is rotating in wrong direction. So in this case I have to rotate the camera's z axis angle.

This is my problem. So how can I ensure the camera always finally rotate left and right (whatever the parent nodes' angles are rotated) when the user moves the mouse horizontally?

Also I want to mention that when the user moves mouse up and down, I want the camera to rotate up and down always.

sentences:
One to one aiming in 2D platformer Hello all I have been having an issue with a 2D platformer I'm working on in Unity. It has an aiming style similar to Shadow Complex where the aiming will rotate around the character in direction to wherever the right joystick (360 controller) will be facing. Here's some expert drawings to visualize the issue.

What I have currently working involves raycasts and getting it to rotate which works and is fun but I would really prefer to have the cursor "snap" to the correct position. I'm not sure if I'm on to the correct way to do this or if my "snapping" method is the best possible way to do this.

sentences:
What category would this asynchronous production economy game fall under? I'm thinking of getting into game development and my friend and I have this idea for a game. We want to do some research on similar games, and I have noticed that games seem to fall under certain categories like "platformer", "shooter", "racing games" or similar.

Our idea is a multiplayer, mobile game where you and around 4-5 other players are placed in a session.

Every player is given a different role in a market (like a farmer to grow crops, miller to make flour out of crops, baker to bake bread, etc.). The players are supposed to sell goods to each other in order to earn money (or similar). The resources are produced/generated over time, so it's like Travian and other city building games when it comes to stuff happening over time.

You own a production facility (like a farm, mill, etc.) and if you have enough resources/money it produces some good every 10 min (arbitrary time for the example).

This happens even when the user is not playing. Then once in a while, you can check in, put some of your goods up for sale that others can purchase.

So it's a passive loop that simply generates resources every x minutes, and in addition, the players can put up their goods for sale when they feel like it.

But the game is not "infinite". When one of the players reaches a certain goal, the game session ends and the players are ranked (or something, it's still a rough idea).

So in this regard, it's more like Wordfeud or Chess where your next move depends on what the other players do and there is a way to win the game (be it a winning condition or time running out).

So the question is, does this kind of game fall under a specific category that we can research?

sentences:
Would a Python game run on multiple platforms? I have plans to write a game in Python and probably some SQL.
I'm concerned about how versatile my program will be when I finish it, ideally I'd like it to run on Windows, Mac, Android, and iPhone... however I have a feeling the phones would be off-limits for this sort of thing.
How would I go about writing a program that runs on multiple platforms?
Is this even feasible for a beginner programmer?

sentences:
Confused about Content Pipeline I'm attempting to get my head around the XNA content pipeline, and how I can use it to simplify my game code. Specifically, I want to define sprites, sprite sheets, and animations as assets and have them automatically available to me in game code.

At the end of the day, this is what I want to be able to do:

add a new file with .sprite extension to my content project
call contentManager.Load<Sprite>("NameOfSprite"); and get back a Sprite instance

My Sprite class looks like this:

public class Sprite
{
    public Texture2D Texture
    {
        get { ... }
    }

    public Rectangle? SourceRectangle
    {
        get { ... }
    }

    public Vector2 Origin
    {
        get { ... }
    }
}

The purpose of the Origin property is not important - it's specific to my game. The point is, I want it to be "packaged up" alongside the texture information.

I've defined a SpriteData class as:

public sealed class SpriteData
{
    public string TextureFilename
    {
        get;
        set;
    }

    public Rectangle? SourceRectangle
    {
        get;
        set;
    }

    public Vector2 Origin
    {
        get;
        set;
    }
}

And I've added a test.sprite file to my content project as:

<?xml version="1.0" encoding="utf-8" ?>

<XnaContent xmlns:data="MyNamespace">
  <Asset Type="data:SpriteData">
    <TextureFilename>Sprites\Test.jpg</TextureFilename>
    <SourceRectangle>0 5 20 25</SourceRectangle>
    <Origin>30 2</Origin>
  </Asset>
</XnaContent>

I have defined a SpriteImporter as:

[ContentImporter(".sprite", DisplayName = "Sprite Importer", DefaultProcessor = "SpriteProcessor")]
public class SpriteImporter : ContentImporter<SpriteData>
{
    public override SpriteData Import(string filename, ContentImporterContext context)
    {
        using (var xmlReader = XmlReader.Create(filename))
        {
            return IntermediateSerializer.Deserialize<SpriteData>(xmlReader, filename);
        }
    }
}

And a SpriteProcessor as:

[ContentProcessor(DisplayName = "Sprite Processor")]
public class SpriteProcessor : ContentProcessor<SpriteData, SpriteData>
{
    public override SpriteData Process(SpriteData input, ContentProcessorContext context)
    {
        var spritePath = Path.GetDirectoryName(context.OutputFilename);
        var textureReference = new ExternalReference<Texture2DContent>(input.TextureFilename);

        // make sure the texture is built (not sure what else to do here)
        context.BuildAsset<Texture2DContent, Texture2DContent>(textureReference, string.Empty);

        return input;
    }
}

Now I'm stuck. If I don't implement a content writer+reader combination then I won't get a Sprite out of the content manager - I'll get a SpriteData instead, which is not what I want. But my attempt to implement a SpriteWriter came up short. I have no idea how to get the texture information from the processor to the writer. Do I need to change the type from SpriteData to something else? Is there a sample anywhere that demonstrates how to do this end-to-end?

sentences:
separate fixed-size animation sheet into texture atlas I'd like to separate a 64px x 512px spritesheet into eight 64px 64px images in Adobe photoshop cs 5 so I can use a Texture Packer image atlas rather than a fixed spritesheet.

Is this possible? If so, how?

sentences:
Procedural sidescroller world gen algorithm by seed I'm trying to recreate a procedural side-scroller world gen algorithm by using a seed and I find my self stuck trying to solve a particular problem.

Seed generation applies very well with voxel-like games, but it seems slightly less suitable to generate randomly placed sprites with differing widths for sidescrollers

Here's a picture explaining the problem:

Assuming I load the game at screen-2, I'd be e.g. between coordinates 100 and 0, and the seed function would tell me that between coordinates 100 and 0 there's the sprite of a big block of mountains to render, whose center lies in the coordinate interval [0, 100] ( the center of the sprite is the pink dot in the picture)

assuming I'm loading the game from coordinate 300, as is the case in screen-1, a seed function wouldn't be able to recognize the presence of a mountain sprite there, even though part of it is still visible in the interval between e.g. [250, 350]

A straightforward solution would be to sample from the seed function the interval including the biggest-sized object in the game, which is of course highly inefficient given many objects only cover a fraction of the screen.

How is this type of problem generally solved? Are algorithms based on seeds unsuitable for this particular project? If this is the case, what could be a reasonable alternative?

sentences:
With this MMOG architecture, how can I avoid losing games when the server goes down? I am fairly new to game designing and am trying to design game engine architecture for MMOG poker game. My major problem is scalability. Old Legacy code written in python runs everything on single process. Clients and server talks using xml based protocols. Following is old architecture.

admin -> DB (mysql) <-> backend <-> game-engine + login-server <-> client

I came across old reddit post and particular comment. What I feel, I need similar kind of architecture. So I am planning to implement following architecture along with admin and db.

backend cluster ( to interact with db)
Player Server cluster (handles player authentication and events from clients)
gamelogic server cluster (executes game logic)
redis-cluster (for caching states of ongoing tables)
directory-service + routing server(all clusters will talk with it and all communication will be done through it. initially planning to go with single such server and later make it distributed. Something like this. please see section 'Distributed Directory Service' and 'Distributed broker')

I need to build it using Twisted because of client constrains and legacy codebase.

In this architecture I am confused at one point particularly. Suppose I have multiple tables on one game-logic server and it goes down. How can I address this situation without losing game?

sentences:
How do character/object interaction animations work in isometric games? I am planning an isometric business simulation game where the player sees an office with the usual furniture such as desks, whiteboards etc.

Characters (Staff/NPC's) within the game should interact with these objects by performing some pre-defined tasks such as typing on the keyboard at the desk or writing on the whiteboard etc.

What I am interested in, specifically, is the following scenario:

Character moves across the office (1) to his desk (2) and sits down and starts to type (3).

From what I understand I would have a sprite sheet for the character movement (1) and a static sprite for the desk (2) but I don't quite understand how the third step would be handled?

Is there a combined sprite that contains both desk and character? I assume not, otherwise I would need to have a sprite sheet for every desk and character combination.

How is this normally handled?

EDIT:

Here is a specific example animation from the game Theme Hospital. You can see the video here.

As far as I can see the animation is split into several steps.

Step 1 - Character moves between desk and chair.

This suggests that chair and desk are in fact separate sprites.

Step 2 - Character sits down animation

Notice how in the very last frame the chair is closer to the desk.

Step 3 - Desk animations

Step 4 - Stand up animation

Is the same as sit down but played in reverse.

Step 5 - Move away

Use normal move animation to move away.

The questions I have is how are these animations best separated and how would a graphic artist usually provide these animations?

Is the character sitting and typing on the desk actually three different sprites (desk, character and chair)? Does anyone know any example sprites of similar animations?

EDIT 2:

I guess my biggest concern is that I have the right expectations on how the sprites will actually look like. I can't draw them myself so I will have to pay someone to do it and I assume there is some kind of best practice way to do these kind of animations?

sentences: Do I need to add an anti-piracy system to my game if I publish on Itch.io? Do I need to add an anti-piracy system to my game if I decide to publish it on itch.io or a similar marketplace? The investment to add that system is small, because it's a simple serial code generator.

sentences: How would I write a shader that supports 2 different texture coordinates? Hi I am not very good with writing shaders. How would I make a shader that simply supports 2 texture coordinates so I can load up 2 different textures to be used at the same time but on different parts of my world? Right now I have 1 texturecoord variable setup and I load a texture through it using GraphicsDevice->SetTexture(0, &Texture); and making sure my VertexDeclaration and FVF both support that, but how can I add a second texture to this? Would I make it so that I make separate coordinates and link the coordinates to a texture? How would I write that?

sentences:
Why doesn't the y Axis work with SuperBible frame reference or GluLookAt I'm currently trying to understand how to use the GLFrame Class in the superbible book, and acording to the 4th edition of the book, the camera matrix derived from the Frame of reference class should work the same as GluLookAt

When I add these lines

cameraFrame.SetForwardVector(-0.5f, 0.0f,-0.5f);
cameraFrame.Normalize();

The camera looks in the correct direction, yaw at 45 Degrees (Am I doing that right!)

However when I add this

cameraFrame.SetForwardVector(0.0f, 0.5f,-0.5f);

The camera just looks as if it was set to (0.0f, 0.0f, 1.0f)

Why is this! It's been driving me mad for three days. Maybe I'm not passing in the vectors correctly, but I'm not sure how to pass in x,y 360 degrees for the look at (forward) location/vector. Do the vectors have to be normalized before passing them in?

Eventually I hope to do full mouse look (FPS style) , but for now just understanding why I can't make the camera simply pitch up would be a good start.

Thansk!

Here is the code in situ.

// Called to draw scene
void RenderScene(void)
{
// Color values
static GLfloat vFloorColor[] = { 0.0f, 1.0f, 0.0f, 1.0f};
static GLfloat vTorusColor[] = { 1.0f, 0.0f, 0.0f, 1.0f };
static GLfloat vSphereColor[] = { 0.0f, 0.0f, 1.0f, 1.0f };

// Time Based animation
static CStopWatch   rotTimer;
float yRot = rotTimer.GetElapsedSeconds() * 60.0f;

// Clear the color and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// Save the current modelview matrix (the identity matrix)
modelViewMatrix.PushMatrix();

M3DMatrix44f mCamera;

/////////
///////// My Code

cameraFrame.SetForwardVector(-0.5f,-0.5f,-0.5f);
cameraFrame.Normalize();

///////// End of my code
cameraFrame.GetCameraMatrix(mCamera);
modelViewMatrix.PushMatrix(mCamera);

// Transform the light position into eye coordinates
M3DVector4f vLightPos = { 0.0f, 10.0f, 5.0f, 1.0f };
M3DVector4f vLightEyePos;
m3dTransformVector4(vLightEyePos, vLightPos, mCamera);

// Draw the ground
shaderManager.UseStockShader(GLT_SHADER_FLAT,
                             transformPipeline.GetModelViewProjectionMatrix(),
                             vFloorColor);
floorBatch.Draw();

for(int i = 0; i < NUM_SPHERES; i++) {
    modelViewMatrix.PushMatrix();
    modelViewMatrix.MultMatrix(spheres[i]);
    shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF,     transformPipeline.GetModelViewMatrix(),
                            transformPipeline.GetProjectionMatrix(), vLightEyePos, vSphereColor);
    sphereBatch.Draw();
    modelViewMatrix.PopMatrix();
    }

// Draw the spinning Torus
modelViewMatrix.Translate(0.0f, 0.0f, -2.5f);

// Save the Translation
modelViewMatrix.PushMatrix();

    // Apply a rotation and draw the torus
    modelViewMatrix.Rotate(yRot, 0.0f, 1.0f, 0.0f);
    shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF, transformPipeline.GetModelViewMatrix(),
                                 transformPipeline.GetProjectionMatrix(), vLightEyePos, vTorusColor);
    torusBatch.Draw();
modelViewMatrix.PopMatrix(); // "Erase" the Rotation from before

// Apply another rotation, followed by a translation, then draw the sphere
modelViewMatrix.Rotate(yRot * -2.0f, 0.0f, 1.0f, 0.0f);
modelViewMatrix.Translate(0.8f, 0.0f, 0.0f);
shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF, transformPipeline.GetModelViewMatrix(),
                            transformPipeline.GetProjectionMatrix(), vLightEyePos, vSphereColor);
sphereBatch.Draw();

// Restore the previous modleview matrix (the identity matrix)
modelViewMatrix.PopMatrix();
modelViewMatrix.PopMatrix();
// Do the buffer Swap
glutSwapBuffers();

// Tell GLUT to do it again
glutPostRedisplay();

}

sentences:
NoSQL (CouchDB) database design for MMORPGs Are there any pratical examples of database implementation for an MMORPG in CouchDB? Even a detailed thesis? I've looked but found very little on practical examples and not even find any good UML examples and plus I see a little bit of an issue with the lack of schema and design by UML. Maybe It's more of a paradigm change but I'm ideally looking for something that has things like:

Users
Quests (multipart states)
Characters
NPC states
Items

Just to get started...regards

sentences:
How to make sure Sun Shafts are emitted only from background elements? Currently I have a game scene entirely made of standard sprites using the default material.

I use the Unity standard effect named Sun Shafts.

I have tried many combinations of shaders and other settings. I get the sun shafts to shine properly from the whiter areas in the far background which is fine.

But I noticed they also are emitted from white areas on the characters and foreground which completely defeats the purpose of the sun shafts.

Is there a way to get the sun shafts to be emitted only from elements which are far away of from objects defined in advance?

sentences:
displaying image on modelmesh with transparency i have a modelmesh that has a image on it. When i draw the modelmesh i get the image but i also get a black bacground. The image is png and transparent and is added in 3ds max(i don't give it coordinates to be drawn, it sits on the modelmesh). How can i make the black background transparent?

Here is my drawing code:

 foreach (BasicEffect effect2 in modelMesh)
 {
     effect2.DiffuseColor = Color.White.ToVector3();
     effect2.LightingEnabled = true;
     effect2.AmbientLightColor = new Vector3(1, 1, 1);
     effect2.Projection = camera.projectionMatrix;
     effect2.View = camera.viewMatrix;
     effect2.World = transforms[modelMesh.ParentBone.Index] * gameobject.orientation;
     effect2.Alpha = 1;

  }
  modelMesh.Draw();

sentences:
Runtime Issues on 144Hz Monitors I've recently finished my first ever Unity game. The game runs okay in my end but two of my friends had issues with the game. They both have 144hz monitors and the issues are solved when they lower the refresh rate to 60Hz. The problems are that any object who has a velocity depending on Time.deltatime, it gets halved. Is there a way to fix this on code so that nobody has to reduce their refresh rate when playing?
Here is an example code of a snowball projectile's behaviour. The snowball usually stays alive for 3f seconds and that allows him to go across the whole screen but in 144hz runtime, the snowball goes really slow and it does not last enough to even get across the half of the screen.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Snowball : MonoBehaviour
{
    [SerializeField] private float speed = 20f;
    [SerializeField] private Rigidbody2D rb;
    [SerializeField] private GameObject impactEffect;

    // Start is called before the first frame update
    void Start()
    {

        Destroy(gameObject, 3f);
    }

    void Update()
    {
        rb.velocity = transform.right * speed * Time.deltaTime * 75;
    }

    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        if(hitInfo.CompareTag("Player") || hitInfo.CompareTag("Enemy"))
        {
        Destroy(gameObject);
        Instantiate(impactEffect, transform.position, transform.rotation);
        }
    }
}

Here is my game if anyone is interested in further examination: itch.io link

sentences:
How to make low poly ground look better I'm working in Unity and have created some low poly meshes using blender. Currently, the meshes look good, but the ground seems very lacking. I am not sure how to make it feel natural or even look good in general.

Here is a current image

The ground needs to remain mostly flat due to the game placing flat objects on the top of the plane and the image shows the exact camera angle we are using. But, as you can see in the image, the ground is extremely lacking and it doesn't look like a ground but instead just a flat background color. I've tried textures but it does not look good with the trees and low poly design.

How can I make the ground look better?

sentences:
How to stream a game inside an app I would like to build an app like the onw downloadable from here https://playhatch.com/.
How is it possible, technically speaking, to achive such result? Need I to implement some instant app feature? Need I to instantiate a kind of android runtime like a "mini docker image"? What's the technical concept which allows to implement such a feature?

Many thanks

sentences:
Make bones in blender work corectly in XNA So, I am trying to connect bones with vertex groups in blender, but I keep failing. if I move a bone in XNA, it doesnt also move those vertecis that are connected to this bone(vertex groups). What I have done is following:

-I made a model made up of four cuboids(seperate meshes).

-then I have created vertex groups for each of the mesh and assign vertecis to those groups.

-now I have added two bones(armatures).

-I renamed some of the vertex groups to the name of the first bone(not armature): "Bone".

-for the second bone "Bone2" I have made a vertex groups in all of the meshes, this vertex group contains all of the  vertecis of that mesh.(because, if not all the vertecis are connected to at least one bone, XNA throws an error)

-then I exported if to .fbx format, checking: XNA Strict Options, XNA Rotation Animation Hack.

Thank you in advance!

EDIT:
Ok, I have fixed the boneWeightCollection problem by unchecking Apply Modifiers in export menu. In blender now everything works great, if I move the bones in their POSE mode they deform the mesh. But they do not work in xna(if I move them, they do not deform the mesh)

sentences:
Is there a way to force a resolution on Android when using Monogame? I think I looked everywhere but I couldn't find a way.
My phone has a native resolution of 1920x1080 and I would like to run my game at 1280x720.

I tried by changing PreferredBackBufferWidth and PreferredBackBufferHeight but it doesn't seem to have any effect.

Is this possible?

sentences:
Sprite transparency not effected libGDX I am making a game using libGDX and Tween Universal Engine.
My problem is as follows:
I have 2 screens so fars, a splash screen with the logo, and a second one which is the main menu.
In the splash screen I use a SpriteBatch and a Sprite with the Texture of the image I want (which goes through some scaling.)
Now I use the Tween engine, along with a created SpriteAccessor to control the alpha of the sprite. I fade the picture in, then fade it out, then change it to the next screen.
In the next screen I have a single sprite, and a single, 3 slot, sprite array. In this screen I also use the tween engine, I fade the single sprite into the screen (it's the background image) then I try to, using the same method, (Tween.to) to change the alpah of the sprite array (each sprite by itself.),  I first set it to 0 using Tween.set, then using the method I change it.
This didn't work, after some tests I tried setting the alpha of a single sprite from the array to 0, and that didn't work.
It's like the program is ignoring the alpha value, I even printed out the alpha value, it saying 0, but the sprite is visible.
How can I fix this, or why might it be caused?

sentences:
Why do we move the world instead of the camera? I heard that in an OpenGL game what we do to let the player move is not to move the camera but to move the whole world around.

For example here is an extract of this tutorial: OpenGL View matrix

  In real life you're used to moving the camera to alter the view of a certain scene, in OpenGL it's the other way around. The camera in OpenGL cannot move and is defined to be located at (0,0,0) facing the negative Z direction. That means that instead of moving and rotating the camera, the world is moved and rotated around the camera to construct the appropriate view.

Why do we do that?

sentences:
Import Material from blender into unity Export FBX There have been several questions like this but nothing that is quite the same.  I've noticed when Mixamo can create models with materials attached in their FBX.
I'm trying to do the same in blender, several people say that this cannot be done.

When I export an FBX from unity how can I get the material in with it, whether, that be importing the material through a separate process, or some how baking them in with the FBX?

sentences:
Set alpha cutoff value Unity3d I am continuing my previous question( link ). Now its working as per this demo.

and the coding written to set cutoff is here :

function Update () {

    renderer.material.SetFloat("_Cutoff", Mathf.InverseLerp(0, Screen.width, Input.mousePosition.x));

}

But i want to set cutoff value , depending up on distance between two object.

one object position will be static. and i am moving another object and if my object gets far distance then cutoff should be 0. and if the object gets closer then depending up on the distance between these two object , i want to set cutoff value.

so how do i set cutoff value?

Please help me guys?

Thanks in advance for your support and help in advance.

sentences:
Example/Tutorial of passing structured data over network C++ This is very general question, about strategies how to pack same information about state of my game-world on server ( e.g. position/orientation of players, projectiles, etc. ) into data stream so that I can sent them over network and unpack them on the client side to draw on screen.

I know it's called serialization. But still I have many doubts.

My game already has some structure of objects. I do not want to re-design it ( too much ) in order to use some automatic serialization. I also do not want to make dependency on an other library (such as boost::serialize ) if not necessary
My classes/objects e.g.(class Airplane) contain some properties which should be passed over network to the client ( e.g. position and orientation ) but also some which should not ( e.g. some temporary variables relevant just for computations on server; pointers to nearest neighbor objects; array of Lift and Drag coefficient for set of angles-of-attack )
If I pack more objects into one message/packet I will probably need some protocol and parser to unpack the objects properly on the other side. The client should know of which Class type data are and to which instance it should be assigned.

Probably by trial and error I can figure it by myself, but it would take some time, and it would be helpful to have some example solution of similar problem to start with.

background - I have some skill with physics and graphics programming (Java,C++,Frotran,GLSL,OpenCL...), but I know absolutely nothing about networking. I have done some games into which I would like multiplayer. Just simple games with only few players and moving objects (projectiles). For reference consider something like LIERO

sentences:
Dynamic model scaling Imagine a (3D) game like Railroad Tycoon 3. Player selects a rail track, clicks LMB and drags the mouse to the end position. During this drag, the rail track model scales and adopts to the landscape, so user sees the resulting track in dynamic.

The question: how this can be done? A brief idea/links/sketches will be enough. I just don't know how to start (I'm novice game developer). If it is matter, I use Unity as a game engine.

Thanks in advance.

sentences:
Unity3d Pause RigidBody object, don't stop time Time.timeScale = 0 obviously works to stop physics but it's also stoping my Invoke calls. How can I get around this to pause ONLY the game physics?

EDIT

Temporarily I'm using isKinematic = true on all of my rigid body objects via event trigger.

sentences:
How do I convert distance covered from meters to kilometers, in Unity? I am developing a game in Unity where I have to find a distance in kilometers, to find a passenger's fare based on  the covered distance.

This is what I have tried:

private Vector3 previousPosition;
public float cumulatedDistance;

void Awake()
{
    // initialize to the current position
    previousPosition = transform.position;
}

// Update is called once per frame
void Update () {
    cumulatedDistance += (transform.position - previousPosition).magnitude;
    previousPosition = transform.position;
}

How can I determine the distance covered, and convert it to kilometers?

sentences:
How do I make the camera aware of the position of the object it is tracking? I'm making a 2D game with a Camera that tracks GameObjects (usually the player). At the moment, a GameObject holds a RenderingComponent.

struct GameObject {
  std::shared_ptr<RenderingComponent> renderingComp;
};

The RenderingComponent holds a CameraMotionTarget. The CameraMotionTarget is a rectangle represented by a center and half size.

using CameraMotionTarget = Math::RectCS<float, Math::Dir::RIGHT, Math::Dir::UP>;

struct RenderingComponent {
  virtual void update() = 0;
  virtual const CameraMotionTarget *getMotionTarget() const = 0;
};

struct RenderingComponentImpl final : RenderingComponent {
  void update() override {
    //modify target and do other stuff
  }

  const CameraMotionTarget *getMotionTarget() const override {
    return &target;
  }

  CameraMotionTarget target;
};

The CameraMotionTracker stores a const CameraMotionTarget * to the object in the RenderingComponent and moves the Camera according to the CameraMotionTarget.

struct CameraMotionTracker {
  glm::vec2 getMotionTargetPos(CameraProps) {
    //calculate the target position of the camera to keep the target
    //well within the window
  }

  const CameraMotionTarget *target;
};

struct Camera {
  void update() {
    const glm::vec2 targetPos = motionTracker.getMotionTargetPos(properties);
    const glm::vec2 newPos = mover.getPos(properties, targetPos);
    properties.pos = newPos;
  }

  CameraProps properties;
  CameraMotionTracker motionTracker;
  CameraMover mover;
};

This gets the job done. When the player moves, the camera moves smoothly to keep the player on the screen. If I wanted this to be safer, I could use an std::shared_ptr and an std::weak_ptr but that's not why I'm here. The reads and writes to the CameraMotionTarget need to be synchronized. This is easy in my single threaded game but what if I wanted more threads? I'd like the RenderingComponent to somehow call a function on the CameraMotionTracker but I don't know how.

Ideally, the CameraMotionTracker should only be aware of a rectangle and the RenderingComponent should only need to know that it can be tracked and unaware that it is being tracked. My current design is decoupled but unsafe. So my question is:

How do I architect a safe, decoupled, system where a camera tracks a rectangle?

sentences: Polygon trigger colliders for 2D platformer I'm creating a 2D platformer in MonoGame and I'm thinking of using AABB as physical colliders for characters and then have a trigger polygon collider on each character for checking for example if an enemy's weapon is touching the player, making it more precise. The polygon collider is animated so every frame in every animation has its own points. That's a lot of work. Is that precision needed? What is usually done in this situation?

sentences:
What is the proper way to convert meters to pixels when using Box2D? I'm working on a platformer and I've chosen to use Box2D for physics but I'm having trouble converting meters to pixels. I have a static object and a dynamic object. The dynamic object falls onto the static object but when the dynamic object hits the static object, they don't touch, they're about a meter apart when they're supposed to be touching.

As you can see from the screenshot, the dynamic object (rat) is hovering above the static object (blue rectangle) when they're supposed to be touching. I assumed it was a problem with my meters-to-pixels code so I fiddled with it and inspected variables in the debugger and still can't figure out what I'm doing wrong.

Rendering is done in pixels (via SDL2) and the origin is in the top-left corner of the window. +x is right and +y is down.

Physics is done in meters (via Box2D) and the origin is in the bottom-right corner of the window. +x is right and +y is up.

Heres the code to create the dynamic object.

b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.fixedRotation = true;

b2Body *body = world.CreateBody(&bodyDef);

b2PolygonShape shape;
shape.SetAsBox(1.0f, 1.0f);

b2FixtureDef fixtureDef;
fixtureDef.shape = &shape;
fixtureDef.density = 10.0f;

body->CreateFixture(&fixtureDef);
body->SetTransform({0.0f, 10.0f}, 0.0f);

And here's the code to create the static body

b2BodyDef bodyDef;
bodyDef.type = b2_staticBody;

b2Body *body = world.CreateBody(&bodyDef);

b2PolygonShape shape;
shape.SetAsBox(WINDOW_METER_SIZE.x, 2.0f);

b2FixtureDef fixture;
fixture.shape = &shape;
fixture.friction = 0.0f;

body->CreateFixture(&fixture);
body->SetTransform({0.0f, 0.0f}, 0.0f);

The Rect and RectPx classes represent a rectangle as a top-left point p and a size s.

To get the Rect of the b2Body used for drawing.

b2Body *body;
const Rect rect = {body->GetPosition(), {1.0f, 1.0f}};

Heres the code to transform a rectangle in meters to a rectangle in pixels

RectPx transform(const Rect rect) {
  return {
    {
      rect.p.x * PIXELS_PER_METER,
      (-rect.p.y + WINDOW_METER_SIZE.y - rect.s.y) * PIXELS_PER_METER
    },
    rect.s * PIXELS_PER_METER
  };
}

I later use the RectPx to call SDL_RenderFillRect and SDL_RenderCopy which both expect a rectangle in the described format.

I really hope there's an obvious mistake in my code somewhere that a Box2D guru can spot.

Thank you in advance for reading this very long question.

sentences:
Resources to learn XNA for a professional c# developer I'm a .net consultant (mainly c#) for my job, but for a while now, I've been interested in making a game in XNA (as a hobby project).

I've had a "beginner" course in XNA when I was still a student, but I've lost most of the information (plus, it was VERY beginner, not enough to get you really started).

So my question, which resources would be useful for me to learn XNA (books, blogs, websites, tutorials, resource websites - like textures, audio files, etc..)?

I know this is a very open question, but I'm thankful for any information.

sentences:
Implementing Spine animations in Libgdx I've been searching a lot for a guide on how to implement 2D animations exported from Spine to Libgdx, but all I could find was outdated tutorials and source codes. I can handle basic Libgdx but Spine seems to be completely different.
I was there, [there](https://esotericsoftware.com/spine-using-runtimes"esoterics software") and also on lots of other sites (low rep level won't let me post more links) but still I've got no idea how to do it.
Does anyone know how to add those animations properly? (doesn't matter if it's json or binary)
Preferably paste some code showing how to display something like spineboy so that I can see exactly what needs to be done. Any other suggestions appreciated..

sentences:
Removing ads but maintaining opt-in video ads I have a game for iOS that will show advertisements.
One form of advertisement offered is a rewarded video (a video that the user can watch by choice). This is actually an important aspect of the game because watching these videos allows the user to continue playing after running out of a certain resource (balls, in this case).
Now, the user can remove the advertisements via In App Purchase.
Question: Is there anything wrong with keeping the rewarded videos as an option for the user, even though they paid to remove ads? If I disallow the rewarded videos, the user will lose a really useful feature of the game, but I'm worried about initializing the advertisement SDK and therefore tracking users who probably think they've disabled any tracking for advertisements.
Thank you for your thoughts!

sentences:
How Does Ultima 7 manage different floors in 2d In U7, you can move among floors without the function "tranport" the player to another place, as for example the first ff ones.

How can it tell whenever the character is moving from floor z to floor z+1? (of course, it uses stairs, but what is the logic behind this?) How does pathfinding in those cases work?

sentences:
Ray Tracing in One Weekend, how to add depth of field to view matrix? I'm working through the infamous Ray Tracing in One Weekend book as I implement it on a OpenGL compute shader, the only thing I have left to do is add depth of field. I have this function that generates rays from a view and projection matrix, so its slightly different from the book where he does his own camera setup, here is my function:
Ray Camera_getRay(inout uvec4 useed) {
    float aperture = 0.1;
    float lens_radius = aperture / 2;
    vec3 rd = lens_radius * sampleUnitDisk(useed);

    vec3 rayNDC = vec3(
        ((2.0f * fragCoord.x) / iResolution.x - 1.0f),
        (1.0f - (2.0f * fragCoord.y) / iResolution.y),
        1.0f
    );

    vec4 rayClip = vec4( rayNDC.x, rayNDC.y * -1, -1.0f, 1.0f );

    vec4 rayCamera = inverse(projection) * rayClip;
    rayCamera.z = -1.0f, rayCamera.w = 0.0f;

    vec3 direction = normalize((inverse(view) * rayCamera).xyz);

    return Ray(position, direction);
}

I am trying to add the randomized offset as described in the Defocus Blur chapter.
I have gotten this far:
float aperture = 0.1;
float lens_radius = aperture / 2;
vec3 rd = lens_radius * sampleUnitDisk(useed);

But I am not sure what to do with rd next, do I simply add it to the ray's position? do I also need to add it to the ray direction? Do I alter the view matrix? Any help is appreciated.

sentences:
Trying to get the fragment shader to output a list I am trying to figure out a way to get the Fragment Shader to output a list of gl_VertexID-s.

I want to use the GPU to get a list of vertices in the viewing frustum.

Is there any way I can get a per fragment shader invocation variable or something else that is possible to use as a pointer to a texture? If it is not possible, is there a possibility to use a sparse texture to render to, using gl_VertexID-s as a pointer?.

I will be rendering about a million or two vertices at a time (using GL_POINTS), and the list should be tightly packed to be of use. Some work may be offloaded to the CPU, but this is part of a real-time render engine so the execution times need to be under 10ms.

I am using OpenGL 4.4.

sentences:
How to avoid the GameManager god object? I just read an answer to a question about structuring game code. It made me wonder about the ubiquitous GameManager class, and how it often becomes an issue in a production environment. Let me describe this.

First, there's prototyping. Nobody cares about writing great code, we just try to get something running to see if the gameplay adds up.

Then there's a greenlight, and in an effort to clean things up, somebody writes a GameManager. Probably to hold a bunch of GameStates, maybe to store a few GameObjects, nothing big, really. A cute, little, manager.

In the peaceful realm of pre-production, the game is shaping up nicely. Coders have proper nights of sleep and plenty of ideas to architecture the thing with Great Design Patterns.

Then production starts and soon, of course, there is crunch time. Balanced diet is long gone, the bug tracker is cracking with issues, people are stressed and the game has to be released yesterday.

At that point, usually, the GameManager is a real big mess (to stay polite).

The reason for that is simple. After all, when writing a game, well... all the source code is actually here to manage the game. It's easy to just add this little extra feature or bugfix in the GameManager, where everything else is already stored anyway. When time becomes an issue, no way to write a separate class, or to split this giant manager into sub-managers.

Of course this is a classical anti-pattern: the god object. It's a bad thing, a pain to merge, a pain to maintain, a pain to understand, a pain to transform.

What would you suggest to prevent this from happening?

EDIT

I know it's tempting to blame the naming. Of course creating a GameManager class ain't such a great idea. But the same thing can happen to a clean GameApplication or GameStateMachine or GameSystem that ends up being the duct-tape-favorite by the end of a project. No matter the naming, you have that class somewhere in your game code, it's just an embryo for now: you just don't know yet what monster it will become. So I'm not expecting "blame the naming" answers. I want a way to prevent this from happening, a coding architure and/or a process a team can follow knowing that this will happen at some point in production. It's just too bad to throw away say, one month of bugfixes and last-minute features, just because all of them are now in one huge unmaintainable manager.

sentences:
How do I create indoor scene lighting? I'm building the inside of a space ship in Unity as POC. I need info on scene lighting.
Rooms, corridors or just in general how to make an enclosed scene look great with lights.

Keep in mind this is indoors and I can't really use the Directional Light and have to
rely on realistic light sources.

Thanks!

sentences:
Calculate ticks for animation delay Hi guys I am trying to calculate the correct elapsedTime for each frame in my animation.

Example I have a sprite called stance that has 20 frames I want to give each frame a tick delay property that determines how long that frame will last until next frame.

the question is how do I use the gameTime.elapsedTime to calculate the current elapsedTicks say for example the first frame has 20 ticks then

currentElapsedTicks += gameTime.ElapsedTime.Ticks?

sentences:
To sell or give for free I am currently making a game that I was originally planning to sell. It is a simple 2D arcade style game for the PC. I've seen many indie games become popular and generate revenue from advertisements, but the game itself remains free. I need some advice on whether or not I should sell my game, release it for free with advertisements, or ask for donations and keep the game free.

I feel that my game is fun, but of course the graphics aren't tip top because I am a programmer, not an artist. I just take screenshots of 3D models I get from Turbosquid and crop around it to make a sprite. Also, and I could be very wrong about this, it seems that there are more legal issues surrounding selling a game than making it free and generating revenue from advertisement, or asking for donations. If I am wrong, someone please correct me.

Also, I am very interested in generating some revenue for my work, but that isn't at the very top of my list. I am in my last year of high school, soon to be going to college, and I am going to major in computer science/software engineering. So I am trying to gain some preliminary experience at home by coding stuff every day. One way of getting this experience is by making this game.

So what do you think? What route should I take? What has worked well with other indie games?

Thanks in advance.

sentences:
unable to send or update data into my mysql database using unity I am trying to save user scores into my data base so i have deveoped backend on php and mysql datbase. All the things are complete but having issues to send or receive data through my unity WWW class.

Here is my C# code to get and send data to php and then DB:

using UnityEngine;
using System.Collections;

public class Scripts : MonoBehaviour {
    string dataSubmitURL = "http://localhost/HighScore/AddScore.php?";
    string dataGetURL = "http://localhost/HighScore/GetScore.php";
    // Use this for initialization
    void Start () {
        StartCoroutine(GetScores());
        //StartCoroutine(PostScores("faizan",100));
    }

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

    }

    IEnumerator PostScores(string playerName, int score) {
        string submitURL = dataSubmitURL + "name="+ playerName + "&score=" + score;
        print(submitURL);
        WWW submitData = new WWW(submitURL);
        yield return submitData;
        if (submitData.error != null)
        {
            Debug.LogError("Error occur when Submitting data : " + submitData.error);
            Debug.LogError("Error occur when Submitting data : " + submitData.text);
            Debug.LogError("Error occur when Submitting data : " + submitData.responseHeaders);
            //submitData.text
        }
        else {
            print(" Submitted");
        }
    }

    IEnumerator GetScores() {
        WWW getData = new WWW(dataGetURL);
        yield return getData;
        if (getData.error != null)
        {
            Debug.LogError("There was an error getting the high score: " + getData.error);
        }
        else {
            print(getData.text);
        }
    }
}

If i directly run my urls into browser

string dataGetURL = "http://localhost/HighScore/GetScore.php";

then it is working perfectly and giving me data but same thing when i trying through my c# www(above code) then it reply.

There was an error getting the high score: Empty reply from server

sentences:
The SFML equivalent of polling to see if a key has been released? I'm testing out SFML by trying to make a square move with lerp velocity. The desired result was that when, let's say, D was pushed, the square would accelerate smoothly from velocity.x = 0 to velocity.x = maxVel (20). When
the D key is let go, it decelerates back to 0. The problem is, I can't get it to decelerate! When I let go of D, it keeps on going!

Player.cpp (only relevant code shown):

#include "Player.h"

void Player::input() {
    using Key = sf::Keyboard::Key;
    auto keyDown = [](sf::Keyboard::Key k) {
        return sf::Keyboard::isKeyPressed(k);
        };

    if (keyDown(Key::A)) {

        velocityGoal.x -= 3;
    }
    else if (keyDown(Key::D)) {
        velocityGoal.x += 3;
    }
    if(keyDown(Key::A) != true){
        velocity.x = 0;
    }
    else if (keyDown(Key::D) != true) {
        velocity.x = 0;
    }
    if (keyDown(Key::F)) {
        velocity = velocity; //just a breakpoint cue. Move along.
    }
}
void Player::update(float dt) {

    //interpolating velocity
    velocity.x = Math::interpolate(velocityGoal.x, velocity.x, dt);
    velocity.y = Math::interpolate(velocityGoal.y, velocity.y, dt);

        //capping out speeeeed
    if (velocityGoal.x > maxVel) {
        velocityGoal.x = maxVel;
    }
    if (velocityGoal.x < -maxVel) {
        velocityGoal.x = -maxVel;
    }

    //adding velocity to the player's position
    newPos += velocity;
    rect.setPosition(newPos);
}

void Player::draw(sf::RenderTarget& target) {
    target.draw(rect);
}

My interpolation function:

float Math::interpolate(float goal, float current, float deltaTime){
float diff = goal - current;
if (diff > deltaTime) {
    return current + deltaTime;
}
else if (diff < -deltaTime) {
    return current - deltaTime;
}

return goal;
}

It appears to be a problem with the if statements that set velocity.x to 0. SFML doesn't have anything like keyJustPressed or keyUp, so I just polled to see if keyDown(D) was not true. This evidently is not the right thing to do in this situation.

Does anyone know the right way to do this, or if there is some way I can track a key being released?

sentences:
Black Rectangle instead of texture I am trying to draw a textured ractangle like in this example. But instead of a texture the rectangle is just black.

Draw method:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);

    effect.EnableDefaultLighting();
    effect.World = world;
    effect.Projection = camera.Projection;
    effect.View = camera.View;
    effect.TextureEnabled = true;
    effect.Texture = grass;
    effect.LightingEnabled = true;

    foreach (var pass in effect.CurrentTechnique.Passes)
    {
        pass.Apply();

        GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, quad[0].Vertices, 0, 4, AlignedQuad.Indexes, 0, 2);
    }

    base.Draw(gameTime);
}

The effect is like a in the example a BasicEffect. The texture is existing and is  not a black rectangle.

What am I missing or doing wrong? Thank you for your help.

sentences:
Simplified aerodynamics for 2d (top-down) airplane I am writing a top-down 2d game, in which the player can control an airplane via the WASD keys. The W key should move the plane upwards (north), the A key to the west, and so on.

Now I need a simplified aerodynamics model to control the flight direction and speed of the plane. Pressing W should accelearte the plane a bit to reach full speed, then while the player continues to press W the plane should continue to move upwards on the screen (remember, top-down view).

When the player releases the W key and presses the D key now, the plane should behave similar to the real world. That is, it must not immediately move to the right (east), instead it should continue to fly to the north, but gradually start to move to the east. Then if the player continues to press the D key, the plane eventually has to fly solely to the east. So all in all in this example the airplane has to fly a curve from north to east.

In general the plane must not change its direction immediately and directly when the player presses another key, but instead fly using a simplified inertia (?) model. This should of course also work correctly if the player presses two keys at the same time, for example W (north) and A (west).

How would I achive this general in a 2d top-down game?

sentences:
Java Slick2d lighting using Raycasting I am trying to make a top down view game in java using the Slick2d library, for lighting I wanted to do something like this : http://www.redblobgames.com/articles/visibility/.
I was wondering if there was a way to tint or light places on the screen in Slick. I would have my map rendering in the background and a lightmap in front.

Solution :
https://github.com/ariejan/slick2d/blob/master/src/org/newdawn/slick/tests/AlphaMapTest.java

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:
3D Coulomb Friction - Use Collision Impulse To Calculate Friction Force? I've been using this document to learn how to implement a very basic physics engine. The section on Coulomb Friction on page 55-56 (marked as pages 43-44) confuses me.

It observes that the friction force can be calculated using the collision impulse (jr). This seems strange. Envision an object falling very quickly onto a plane with a slight incline. The object is rotating in the opposite direction it would if it were rolling down the incline. When the object makes contact, it will have a small velocity along the tangent, but a huge normal impulse (jr). This will result a very large change in velocity along the tangent (t hat) opposite to the direction of motion. This will push the object up along the surface (bad!) with a notable amount force. My implementation confirms this.

Can someone explain to me how this all fits together? I'm very confused.

P.S. I don't think trying to provide an example of my implementation here is relevant, either the effect I'm explaining cannot occur (in which case there is a bug, which I can find myself), or I'm misunderstanding the equations, in which case the implementation is inherently broken

sentences:
Unity: how to apply programmatical changes to the Terrain SplatPrototype? I have a script to which I add a Terrain object (I drag and drop the terrain in the public Terrain field).

The Terrain is already setup in Unity to have 2 PaintTextures: 1 is a Square (set up with a tile size so that it forms a checkered pattern) and the 2nd one is a grass image:

Also the Target Strength of the first PaintTexture is lowered so that the checkered pattern also reveals some of the grass underneath.

Now I want, at run time, to change the Tile Size of the first PaintTexture, i.e. have more or less checkers depending on various run time conditions. I've looked through Unity's documentation and I've seen you have the Terrain.terrainData.SplatPrototype array which allows you to change this. Also there's a RefreshPrototypes() method on the terrainData object and a Flush() method on the Terrain object. So I made a script like this:

public class AStarTerrain : MonoBehaviour {

    public int aStarCellColumns, aStarCellRows;

    public GameObject aStarCellHighlightPrefab;
    public GameObject aStarPathMarkerPrefab;
    public GameObject utilityRobotPrefab;
    public Terrain aStarTerrain;

    void Start () {
            //I've also tried NOT drag and dropping the Terrain on the public field
            //and instead just using the commented line below, but I get the same results
        //aStarTerrain = this.GetComponents<Terrain>()[0];
        Debug.Log ("Got terrain "+aStarTerrain.name);

        SplatPrototype[] splatPrototypes = aStarTerrain.terrainData.splatPrototypes;
        Debug.Log("Terrain has "+splatPrototypes.Length+" splat prototypes");
        SplatPrototype aStarCellSplat = splatPrototypes[0];
        Debug.Log("Re-tyling splat prototype "+aStarCellSplat.texture.name);
        aStarCellSplat.tileSize = new Vector2(2000,2000);
        Debug.Log("Tyling is now "+aStarCellSplat.tileSize.x+"/"+aStarCellSplat.tileSize.y);
        aStarTerrain.terrainData.RefreshPrototypes();
        aStarTerrain.Flush();
    }

//...

Problem is, nothing gets changed, the checker map is not re-tiled. The console outputs correctly tell me that I've got the Terrain object with the right name, that it has the right number of splat prototypes and that I'm modifying the tileSize on the SplatPrototype object corresponding to the right texture. It also tells me the value has changed. But nothing gets updated in the actual graphical view.

So please, what am I missing?

sentences:
Sprite animation in openGL - Some frames are being skipped Earlier, I was facing problems on implementing sprite animation in openGL ES.

Now its being sorted up. But the problem that i am facing now is that some of my frames are being skipped when a bullet(a circle) strikes on it.

What I need : A sprite animation should stop at the last frame without skipping any frame.

What I did : Collision Detection function and working properly.

PS : Everything is working fine but i want to implement the animation in OPENGL ONLY. Canvas won't work in my case.

------------------------ EDIT-----------------------

My sprite sheet. Consider the animation from Left to right and then from top to bottom

Here is an image for a better understanding.

My spritesheet ...

class FragileSquare{

FloatBuffer fVertexBuffer, mTextureBuffer;
ByteBuffer mColorBuff;
ByteBuffer mIndexBuff;
int[] textures = new int[1];
public boolean beingHitFromBall = false;
int numberSprites = 20;
int columnInt = 4;      //number of columns as int
float columnFloat = 4.0f; //number of columns as float
float rowFloat = 5.0f;
int oldIdx;

public FragileSquare() {
    // TODO Auto-generated constructor stub

    float vertices [] = {-1.0f,1.0f,            //byte index 0
                         1.0f, 1.0f,            //byte index 1
                                    //byte index 2
                         -1.0f, -1.0f,
                         1.0f,-1.0f};           //byte index 3

    float textureCoord[] = {
                            0.0f,0.0f,
                            0.25f,0.0f,
                            0.0f,0.20f,
                            0.25f,0.20f

    };

    byte indices[] = {0, 1, 2,
            1, 2, 3 };

    ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4*2 * 4); // 4 vertices, 2 co-ordinates(x,y) 4 for converting in float
    byteBuffer.order(ByteOrder.nativeOrder());
    fVertexBuffer = byteBuffer.asFloatBuffer();
    fVertexBuffer.put(vertices);
    fVertexBuffer.position(0);

    ByteBuffer byteBuffer2 = ByteBuffer.allocateDirect(textureCoord.length * 4);
    byteBuffer2.order(ByteOrder.nativeOrder());
    mTextureBuffer =  byteBuffer2.asFloatBuffer();
    mTextureBuffer.put(textureCoord);
    mTextureBuffer.position(0);

}

public void draw(GL10 gl){

    gl.glFrontFace(GL11.GL_CW);

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(1,GL10.GL_FLOAT, 0, fVertexBuffer);

    gl.glEnable(GL10.GL_TEXTURE_2D);
       if(MyRender.flag2==1){ /** Collision has taken place*/
    int idx = oldIdx==(numberSprites-1) ? (numberSprites-1) : (int)((System.currentTimeMillis()%(200*numberSprites))/200);
    gl.glMatrixMode(GL10.GL_TEXTURE);
    gl.glTranslatef((idx%columnInt)/columnFloat, (idx/columnInt)/rowFloat, 0);
    gl.glMatrixMode(GL10.GL_MODELVIEW);
    oldIdx = idx;
    }

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //4
    gl.glTexCoordPointer(2, GL10.GL_FLOAT,0, mTextureBuffer); //5
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); //7

    gl.glFrontFace(GL11.GL_CCW);

    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    gl.glMatrixMode(GL10.GL_TEXTURE);
    gl.glLoadIdentity();
    gl.glMatrixMode(GL10.GL_MODELVIEW);

}

public void loadFragileTexture(GL10 gl, Context context, int resource)
{
    Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resource);
    gl.glGenTextures(1, textures, 0);
    gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);

    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);

    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);

    GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

    bitmap.recycle();
}

sentences:
Combining rotation (using Quaternion* Quaternion) doesn't work as expected I have fragment of code that has to rotate the camera to the direction where my cursor is as below:

float yaw = mouseSensitivity.x * Input.GetAxis("Mouse X");
float pitch = mouseSensitivity.y * -Input.GetAxis("Mouse Y");

Vector3 camRotDir = new Vector3(pitch, yaw, 0);

// this works
Vector3 camRot = mPlayerCamera.transform.rotation.eulerAngles + camRotDir;
mPlayerCamera.transform.rotation = Quaternion.Euler(camRot);

// this doesn't work
//var rotation = Quaternion.Euler(camRotDir);
//mPlayerCamera.transform.rotation =  mPlayerCamera.transform.rotation * rotation;

WithmouseSensitivity being an arbitrary Vector2 value representing mouse's sensitivity respectively on axis X and Y.

The problem is when I convert the current camera's rotation in Quaternion to Euler angle, add the camRotDir to it and then convert the result back to Quaternion, it works properly, the z component in camera's rotation remains unchanged during this process. But when I first convert the camRotDir to Quaternion and add it to camera's current rotation by multiplying them together, I get unexpected behaviour, the z component was somehow changed.

I have no idea why this happens, should Quaterion of (euler_a + euler_b) == (Quaternion of euler_a) * (Quaternion of euler_b) ?

Code run in Unity 2018.3.12f1.

sentences:
Adding Score to score canvas after collision Simply a player has to move through pipes falling down, once the player moves through the gap it should add a score and increase the scoring after each pipe the player goes through, pretty basic.

I have made a prefab object and it is a block with a collider on it and another collider that acts as a trigger behind it stretched out so it can be accessed on both sides. I then added to the main scene canvas >> textmeshpro>>> added a script with the following code however, when the player hits the collider the score does not increase in the scene. But if I remove the GetComponent then it increases by increments of 4 in the inspector.

using System.Collections.Generic;
using UnityEngine;

public class Game : MonoBehaviour
{
    public int Score = 0;

    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        GetComponent<UnityEngine.UI.Text>().text = Score.ToString();
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        AddScore();
    }

    void AddScore()
    {
        Score++;
    }
}

sentences:
Entity system and rendering types I would like to implement entity system in my game and I've got some question about entity system and rendering.

Currently, my renderer got two types of elements:

Current design

Mesh   : A default renderable with a Material, a Geometry and a Transformable
Sprite : A type of mesh with some methods like "flip" and "setRect" methods and a rect member (With an imposed geometry, a quad)

This objects inherit from "Spacial" class.

Questions:

How can I handle this two types in an entity system?
I'm thinking about using "MeshComponent" and "SpriteComponent", but if I do that, an entity could have a Mesh and a Sprite at the same type, it's look stupid, right?

I thought the idea to have a parent "rendering" component : "RenderableComponent" for "MeshComponent" and "SpriteComponent" but it will be difficult to handle "cast" in the game (ex: did I need to ask entity->getComponent or SpineComponent, …)

Thanks a lot for reading me!

My entity system work like that:

---------------------------------------------------------------------------
Entity* entity = world->createEntity();

MeshComponent* mesh = entity->addComponent<MeshComponent>(material);
mesh->loadFromFile("monkey.obj");

PhysicComponent* physic = entity->addComponent<PhysicComponent>();
physic->setMass(5.4f);
physic->setVelocity( 0.5f, 2.f );
---------------------------------------------------------------------------
class RenderingSystem
{
    private:
        Scene scene;
    public:
        void onEntityAdded( Entity* entity )
        {
            scene.addMesh( entity->getComponent<MeshComponent>() );
        }
}

class PhysicSystem
{
    private:
        World world;
    public:
        void onEntityAdded( Entity* entity )
        {
            world.addBody( entity->getComponent<PhysicComponent>()->getBody() );
        }

        void process( Entity* entity )
        {
            PhysicComponent* physic = entity->getComponent<PhysicComponent>();
        }
}

---------------------------------------------------------------------------

sentences:
Make timer for game to run for 2min I'm trying to make a game using C++ (in Visual Studio 2015).
I want to make the game run for X minutes and then end.
I have a function play() that calls all other functions required and I need to make play() run for 2min.
I've tried putting play() in loops that run for some time, but none of them work. I am not able to find any other question that addresses the problem I'm facing and so any help would be appreciated.

sentences:
AddForce results in stuttering movement I'm currently developing a simple breakout/arkanoid mobile game. Now, I noticed that my ball movement is noticably stuttering. I've read various approaches about how to make the ball move and decided to go for AddForce so I don't have to do any physics calculations myself.
The only thing im currently doing is using AddForce on my ball's rigidbody2D and have it collide with the walls and blocks. There's nothing done manually in Update or FixedUpdate and there are no other scripts running while the ball is moving. The scene is pretty empty actually.

Things I have tried so far without success:

Disable V-Synch
Increase the velocity iterations (I tried values 15-500)
Set the RigidBody2D's interpolation mode to: Interpolate/Extrapolate
Using different mass values and force values in AddForce
Checking, whether it's just an optical illusion (it seems to run more smoothly in editor and other breakout/arkanoid games don't have that problem on my Galaxy S7)

RigidBody settings of the ball:

Body Type: Dynamic
Material: Friction: 0 | Bounciness: 1
Mass: 0.025
Linear Drag: 0
Angular Drag: 0
Gravity Scale: 0
Collision Detection: Continous
Sleeping Mode: Start Awake
Interpolate: Interpolate

The walls and blocks are simple BoxCollider2D components. And I'm calling AddForce(new Vector2(0f, GameConstants.DESIRED_BALL_SPEED)) on the ball's RigidBody2D.

Edit:

public void OnPointerUp(PointerEventData eventData) {
    if(!_ballStarted) {
        PaddleController.ShootStickingBalls();
        _ballStarted = true;
    }
}

public void ShootStickingBalls() {
    int stickyBallsAmount = _stickingBallsRigidBody2D.Count;
    for (int i = 0; i < stickyBallsAmount; i++) {
        _stickingBallsRigidBody2D[i].AddForce(new Vector2(0f, GameConstants.DESIRED_BALL_SPEED));
        _stickingBallsRigidBody2D[i].transform.SetParent(_nonStickyBallsTransform);
    }
    Sticky = false;
}

sentences:
What are Hull, Domain and Geometry shaders used for? I've done my fair share of 3D game programming for my (former) employer, and also in my own custom engines for my own indie games.

Initially, I started with Direct3D 9, and D3DX9, which pretty much did everything for me, and didn't require me to think in terms of shaders at all.

After that, I wrote my first Direct3D 9 shaders, but mostly used one very simple shader for everything I did.

In the most recent iteration of my game engine, I moved to Direct3D 11, and with that I created lots of shaders. I did GPU skinning, GPU calculated particles, lots of lighting and post processing effects, all in the GPU. Really cool stuff.

So far I have only used vertex and pixel/fragment shaders. Even though there are still lots of things I still haven't done, I believe I have a solid knowledge of what the vertex and pixel/fragment shaders do, and how that all fits into the entire 3D pipeline.

Catching up with more recent developments, I've become very interested with the newer shader stages. That is, the Geometry Shader, and even newer, the Hull and Domain shaders.

I have never used these stages, but from what I know, the Geometry shader, if enabled, is run after the vertex shader, once for each transformed vertex (or once per primitive?) and allows you to discard vertices (and primitives?), and create new ones (which I guess go back to the beginning of the pipeline?).

My guess is that the main use of the geometry shader would be to programatically generate geometry in the GPU. A common usage would be to create billboard quads based on a single vertex, but I don't really visualize many other common scenarios apart from generating fractals and other stuff you can generate 100% programatically.

As for the Hull and Domain shaders, it seems like they're related to tessellation (creating smoother surfaces out of rough surfaces?), and must be used together or not at all. The term "patch" also seems to be common in here.

Would anybody care to explain to me, in practical terms, what these new-ish shader stages are for, how they fit into the 3D pipeline, and in which cases should I consider using them?

sentences:
Is it efficient to use colliders on UI canvas in Unity? Basically I have a task where the player will be able to drag an object (as UI Image), and place it inside a bag (another UI image).

What's the best optimized way to do so? As I researched, I do not think that using colliders for images is the "best" way to do it.
Additionally, I was thinking about  checking if the position of the image while dragging overlaps an element; however, I do think that would be performant as that would require checking the position on each frame instead of "OnTriggerEnter".

What would be the best way to implement such function?

Thanks & Regards,
HurpaDerpa

sentences:
Why does my Unity/Android game get a small amount of lag when not being touched for some time? I have made a 3d version of space invaders. I made all the assets myself in Blender. I feel that it's a very basic game and my Galaxy Note 3 test device should handle it no problem. (Although it's a few years old now so perhaps some kind of shader issue or something that my phone not updated enough for ?)

There are 55 enemies all with one mesh each. There's the flying saucer model and the player model.

Then there's a plane for a background, and 4 defensive meshes (although I've tested without these and the result is the same).

Basically, it all runs superbly (I have turned down much of the lighting and graphics quality etc, but have left basic shadows in). However I notice that if the player just lets the phone sit there in game without touching it, there is very slight (but noticeable) frame lag.

All the enemies have a very short animation which moves its arms a small amount.

I could post the code but its massively unorganized and really quite an embarrassment (HAHA!). Also I'm not sure what parts are relevant so it would be a huge post.

Is there any known issues that can cause the lag only when not being touched? As I feel like some of my old projects might have had this happening too but they've been deleted now unfortunately so I can't really dabble with it.

It works smooth as silk in the Unity Editor Android 'emulator' and as I say, if I actually play the game on my phone it's smooth too.

sentences:
Soft-restart tampers with physics determinism, resulting in different results Updated question
I have a Spawner entity that spawns my Rollables:
// Spawner.cs
public abstract class Spawner : MonoBehaviour
{
    public abstract T Spawn<T>(T prefab) where T : Component;
}

// PositionSpawner.cs
public abstract class PositionSpawner : Spawner
{
    public override T Spawn<T>(T entity)
    {
        T spawnedEntity = Instantiate(entity);
        spawnedEntity.transform.position = transform.position;
        spawnedEntity.transform.rotation = transform.rotation;

        return spawnedEntity;
    }
}

// RollableSpawner.cs
public sealed class RollableSpawner : PositionSpawner
{
    public Rollable Spawn(Rollable entity)
    {
        Rollable rollable = base.Spawn<Rollable>(entity);

        Restore(rollable);

        return rollable;
    }

    public void Restore(Rollable entity)
    {
        Quaternion r = transform.rotation;
        Vector3 p = transform.position + transform.up * (entity.Radius + 0.05f);

        entity.transform.rotation = r;
        entity.transform.position = p;

        entity.Rigidbody.rotation = r;
        entity.Rigidbody.position = p;

        entity.Restore();
    }
}

The Rollable though, is quite a big one and somewhat coupled with RollableCollider - found, fully, here.
The Restore method:
public void Restore()
{
    rigidbody.velocity = Vector3.zero;
    rigidbody.angularVelocity = Vector3.zero;
    rigidbody.Sleep();

    inAir = Drowning = false;

    Speed = 0f;
    Altitude = 0f;
    UnShift();

    UpdateDirectionality();
    UpdateOrientedTransform();

    ClearGateEventRegistry(gateEntryEvents);
    ClearGateEventRegistry(gateExitEvents);
    ResetSoakedParts();

    StopCoroutine(sleepingRoutine);
    StopCoroutine(gateRoutine);

    rigidbody.WakeUp();

    UpdateInAir();

    sleepingRoutine = StartCoroutine(SleepingRoutine());
    gateRoutine = StartCoroutine(GateRoutine());

    previouslyBackwards = false; Backwards = false;
}

And, to reset, I am calling RollableSpawner.Restore() with a push of a button.
The problem here is that even if after reset all of the values are as expected - position/rotation are correct, velocities and everything else - the Rollable still ends up taking a slightly different trajectory each time.
Though, that's only noticeable with soft-reset.
If I am to play/stop/replay the scene - the Rollable always takes the same trajectory.
Why is it that upon soft-reset the Rollable - while having the same properties - ends up in different trajectories, yet, hard-reset doesn't?
And... how do I fix it?
P.S. As for what have I tried.. Switching Sleep()/WakeUp() to isKinematic. But to be honest, I don't even have a clue what to attempt.

sentences:
Can you show rng code running in real time in a game? First off, I know almost nothing about game development/rng but I will learn. So apologies for sounding uninformed.
I want to make a sandbox ios game with several activities to do within, one of which is poker, but I want the poker to be infallibly transparent unlike online poker. They wouldn't dare.
So I want to show the rng code to be viewable by players as the hand plays out, so players will know its legit, and can verify after the hand etc if they have concerns, is this possible, can you "show" rng?

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:
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:
A Finite state machine where some states shouldn't be transitioned to even if initial conditions satisfy I've built a Finite State Machine for my player. Currently I have only one, locomotion, but I plan on adding more state machines. At the moment state relationship looks something like this:

The blue colored states are ability states. I don't want those states to trigger even if the condition input.JumpActivated is satisfied.
As there's only two such states at the moment, having the condition be abilityManager.isActive(abilityId) && input.JumpActivated instead of just input.JumpActivated is fine, but it seems... manual. As the game grows and more abilities are added, there is bound to be a case where I'll forget to add the condition and then the ability would be active even if it's not supposed to be. I would like to disallow transitioning to those states, but so far none of the solutions I've come up with have looked elegant to me.
This is what I've tried:

Instead of transitions having one condition, they allow multiple conditions, and base state sets a condition that if the next state is of AbilityState type that it must be active.
Implemented state enabling/disabling and had AbilityManager - a component external to the FSM, enable/disable states. Disabled states are not transitioned to.
Implemented state interceptors, which can be subscribed to and if any of them return true the state is not transitioned to

All of those solutions work, but something feels off. I think that all these solutions hide that the states have special logic tied to them in some obscure class/method away from the actual class they belong to.
How do you, experienced game developers, handle such cases?
EDIT: For more context this is a small slice of how my FSM functions now. This is how a typical state might look:
public abstract class OnGroundState : State<IMotor>
{

    protected override void OnInit()
    {
        base.OnInit();
        RegisterTransition(TransitionScope.UPDATE,
            TransitionType.Change(StateId.JUMP),
            ctx => ctx.Entity.Input.IsJumpJustActivated());

        RegisterTransition(TransitionScope.FIXED_UPDATE,
            TransitionType.Change(StateId.IN_AIR),
            MotorConditions.InAirDefaultCondition);
    }

    protected override void OnFixedUpdate()
    {
       // do some logic on fixed update call
    }

}

As you can see, states generally register transitions which are lambdas evaluated immediately (Update) or in fixed timestep (FixedUpdate), and then if the evaluation is true, state is changed to the next state. The problem with this is that while I can define a default predicate such as
ctx => ctx.NextState is AbilityState abilityState && Entity.AbilityManager.IsActive(abilityState.AbilityId)

and then apply it to whatever transition I am checking, like for example
RegisterTransition(TransitionScope.UPDATE,
            TransitionType.Change(StateId.JUMP),
            ctx => ctx.Entity.Input.IsJumpJustActivated() && AbilityCondition(ctx))

this feels prone to errors. I might forget adding the condition to some state transition and then I'll transition to that state even though I don't have that ability unlocked.

sentences:
Upload vertex data for particles I am kind of beginner with opengl.

I am using point sprites (currently without any texturing) for my particles. I seem to fail to get them uploaded to the GPU memory correctly. I have readed lots of tutorials on VBOs and VAOs and I can not locate the reason why the particles seems to be wrong.

The problem is, that some of the particles are behaving correctly, but others dont. They have random colors even if every one of them should be white and they are not in correct point in space. Also when a particle dies and the size of the array gets decreased, all particles warp in another location.

Here is my particle GPU data struct:

[StructLayout(LayoutKind.Sequential)]
public struct GPUParticle
{
    public Vector4 Position;
    public Vector4 Color;

    public static int SizeInBytes = Vector4.SizeInBytes * 2;
}

Here is the VAO, VBO and EBO initialization:

GL.GenBuffers(1, out Vbo);
GL.GenBuffers(1, out Ebo);
GL.GenVertexArrays(1, out Vao);

// Bind the VAO as current
GL.BindVertexArray(Vao);

// Bind the VBO to the VAO
GL.BindBuffer(BufferTarget.ArrayBuffer, Vbo);

// Describe the VAO data

GL.EnableVertexAttribArray(0);
GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0);

GL.EnableVertexAttribArray(1);
GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, 0, Vector4.SizeInBytes);

// Bind the EBO to the VAO
GL.BindBuffer(BufferTarget.ElementArrayBuffer, Ebo);

// Unbind the VAO
GL.BindVertexArray(0);

And here is the uploading which I do on every frame:

// Bind the buffer and send the data to the GPU
GL.BindBuffer(BufferTarget.ArrayBuffer, Vbo);

// Invalidate old data
GL.BufferData (BufferTarget.ArrayBuffer, new IntPtr(Count * GPUParticle.SizeInBytes), IntPtr.Zero, BufferUsageHint.StreamDraw);

// Upload new data
GL.BufferData (BufferTarget.ArrayBuffer, new IntPtr(buffer.Length * GPUParticle.SizeInBytes), buffer, BufferUsageHint.StreamDraw);

// Unbind
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

//Console.WriteLine ("Uploaded array buffer. Count: {0}", buffer.Length);

// Update index buffer only if there are more elements in the buffer than there has ever been
// Generate index buffer for EBO
indices = new uint[buffer.Length];

// This is really stupid. Perhaps we really do not need any indices?
for(ushort i=0; i < buffer.Length; i++)
{
    indices [i] = i;
}

// Bind the EBO for uploading
GL.BindBuffer(BufferTarget.ElementArrayBuffer, Ebo);

// Invalidate old data
GL.BufferData (BufferTarget.ElementArrayBuffer, new IntPtr(Count * sizeof(uint)), IntPtr.Zero, BufferUsageHint.DynamicDraw);

// Upload new data
GL.BufferData (BufferTarget.ElementArrayBuffer, new IntPtr(buffer.Length * sizeof(uint)), indices, BufferUsageHint.DynamicDraw);

// Unbind EBO
GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0);

// Save the particle count for drawing and zeroing the buffer
Count = buffer.Length;

Here are the shaders:

#version 330 core
// VERTEX SHADER
layout(location = 0) in vec4 vertex;
layout(location = 1) in vec4 color;

uniform mat4 mP;
uniform mat4 mV;

out vec4 fragColor;
out vec4 pos; // For debugging

void main(){
    fragColor = color;
    pos = vertex;
    gl_Position = mP * mV * vec4(vertex.xyz, 1.0);
}

#version 330 core
// FRAGMENT SHADER
in vec4 fragColor;
in vec4 pos;

layout(location = 0) out vec4 color;

void main(){
    color = fragColor;
    //color = vec4(1,1,1,1);
    //color = pos;
}

I  have simplified the code a bit, but this is basically what I do. I am unable to spot what I am doing wrong.

The most weird thing is, that when in vertex shader I swap the color to be used as vertex and vertex to be used as color, the motion of the particles gets corrected, but the colors are still going haywire.

Any suggestions? I am out of ideas myself. Is the VAO initialization / uploading code correct?

sentences:
Check if all gameobjects are destroyed I am making a shooting game, where I have a countdown as I destroy enemies. I want to implement logic when all the game objects are destroyed within the given time, and the countdown reaches zero.

How do I do that?

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:
Keeping sprites nice and pixelated How do I keep the sprites in my game nicely pixelated on screens of all sizes and resolutions? I use nearest-neighbor texture filtering when resizing pixels, but this works well only at really high magnifications, otherwise the pixels get distorted and uneven.

I understand the limits of nearest-neighbor scaling and I wouldn't be asking this except there are so many games that use pixel art without this problem, so I figure there is some trick I don't know about.

sentences:
UNET start game with friend by finding their name, Android There is a game at the google play store called Fun Run 2- Multiplayer Race. I loved its feature to find friends by writing their names, and then to play with them. Is it possible to achieve that with UNET? How?

Another one is called Virtual Table Tennis. There I have a lobby full of people from whom I can choose. Can I achieve that with UNET? How?

sentences:
Texture being rendered to main frame buffer? I'm using Ogre 1.10.12 (openglES2 as render system) to create a manual texture like this:

    rtt_texture = Ogre::TextureManager::getSingleton().createManual("RttTex",
                                                                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                                                                Ogre::TEX_TYPE_2D,
                                                                m_size.width(),
                                                                m_size.height(),
                                                                0,
                                                                Ogre::PF_A1R5G5B5,
                                                                Ogre::TU_RENDERTARGET);

m_renderTexture = static_cast<Ogre::GLES2FBORenderTexture *>(rtt_texture->getBuffer()->getRenderTarget());

m_renderTexture->addViewport(m_camera);
m_renderTexture->getViewport(0)->setClearEveryFrame(true);
m_renderTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Red);
m_renderTexture->getViewport(0)->setOverlaysEnabled(false);

then, I bind the texture to the FBO and retrieve the FBO's ID like:

Ogre::GLES2FrameBufferObject *ogreFbo = 0;
m_renderTexture->getCustomAttribute("FBO", &ogreFbo);
Ogre::GLES2FBOManager *manager = ogreFbo->getManager();
manager->bind(m_renderTexture);

GLint id;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &id);

My concern is that id is 0 so I cannot render this texture outside my display, it's getting visible which I don't want it to be.

Shouldn't be ogre creating an unused frame buffer object when creating a manual texture with the TU_RENDERTARGET parameter?

sentences:
What is involved for a simple UDP game? I once tried to write a simple game with UDP in a week as a throwaway test. It went horribly.

I threw it away early. The main problem i had was restoring the game state of all players/enemies/objects to an old state and fast forward the game to the point of time the player is playing (ie half a second before a jump. A little early or late can make the player miss the jump)

Maybe this method is not the easiest way? i suspect it to be but i designed it wrong from the beginning and realized at the end of 2nd day. (so i didnt learn too much or wasted that much time)

For myself and others, What is involved for a simple UDP game and how do i write one? Or how do i solve the prediction problem restoring to state properly.

I'll mark this as CW bc i know there will be lots of helpful answers.

sentences:
How can I make text-based combat more engaging? I'm making a text based adventure in Java, and currently I have a fairly limited combat system where you can do one of 3 things:

attack with your sword
attack with magic(if its unlocked)
drink a health potion

This system works but is fairly boring and uninspired. I want to make the combat enjoyable yet given the limitations of a text based game, but I don't know how to accomplish this. If anyone knows how to make this system more engaging/fun,  it would be greatly appreciated.

sentences:
Implementation details of Command Pattern in conjunction with Entity Component System I have implemented an ECS where more or less an Entity is just an ID, a Component is just a wrapper for data, and a System holds the logic on operating over different components.
There is an Engine that has a list of the entities, a table of the components and a list of the different types of systems (update and draw systems).

I was working on handling input when I reached a conflict: how I would resolve opposing inputs (for example, pressing left and right at the same time). So I decided to try and implement the Command Pattern to work with the ECS.

But I'm stumped. I'm not sure how to create a command, let's say moveLeftCommand, without knowing the intimate details about each entity that would effect.
Also, since all my logic is in the systems, (if I understand the Command Pattern) it should have an execute function which will carry out the command. How do I populate the execute command if there isn't any logic that "belongs" to an entity?

Thanks for any help!

sentences:
Is there any advantage in using  DX10/11 for a 2D game? I'm not entirely familiar with the feature set introduced by DX10/11 class hardware. I'm vaguely familiar with the new stages added to the programmable graphics pipeline, such as the geometry shader, the compute shader, and the new tessellation stages. I don't see how any of these make much of a difference for a 2D game though.

Is there any compelling reason to make the switch to DX10/11 (or the OpenGL equivalents) for a 2D game, or would it be wiser to stick with DX9 considering that that a significant share of the market still runs on older technologies (e.g. the February 2012 Steam surveys lists around 17% of users as still using Windows XP)?

sentences:
Instantiation of multiple objects with varying velocities I am looking to multiple objects of the same prefab at the same time with varying velocities.

public GameObject prefab;
public float xDirection;
public float yDirection;
void Update () {
        GameObject prefab1 = Instantiate
        (prefab,transform.position,quaternarion.identity) as GameObject;
        GetComponent<RigidBody2D>().velocity = new Vector2 (xDirection,yDirection);
}

I want to create three instances at once, but have the x/y direction be different. I am looking at creating an instance at three separate velocities. I know I can do something like this using

void Update () {
if (Input.GetKey(KeyCode.space)){
    xDirection = 1f;
    yDirection = 1f;
    shootObject();
    xDirection = 2f;
    yDirection = 2f;
    shootObject();
    xDirection = 2f;
    yDirection = 2f;
    shootObject();
    }
}
void shootObject () {
    GameObject prefab1 = Instantiate
        (prefab,transform.position,quaternarion.identity) as GameObject;
        GetComponent<RigidBody2D>().velocity = new Vector2 (xDirection,yDirection);
}

but I feel like there is something else that I should be able to do to simplify this even further since this seems to be very messy code.

(I apologize if something seems a little odd. Have only been coding for around a few weeks.)

Thank you for the help!

sentences:
CCUserDefault, iOS/Android and game updates My game uses cocos2d-x and will be published on iOS platform first, later on Android. I save a lot of things with CCUserDefault (scores, which level was completed, number of coins taken, etc...). But now I have a big doubt.

What will happen when the game will receive its first update?

CCUserDefault uses an XML file stored somewhere in the app storage space. This file is created and retained until one uninstalls the app. I am wondering what happens when the app is updated. Will the old XML file be maintained?

Because if not, how should I handle app updates (updates in the sense that 2, 3 or more new level packages will be added, but the informations about the old ones, like scores, which level was finished and which not, number of coins, etc., need absolutely not to be lost)?

sentences:
How do I get roblox studio on a Chromebook? I have seen Youtube videos of people having roblox studio on their chromebook, but I have tried to install it and it didn't work.
How can I get it to work?

sentences:
Pygame freezing on QUIT I'm having problems with quitting a Pygame application (6502 based computer emulator).

The part regarding exit looks like this:

while True:
  do_something_200_times()

  for event in pygame.event.get()
    if event.type == pygame.QUIT:
      pygame.quit()
      sys.exit()

I'm also using pygame.mixer to play sounds as they appear, but I'm not sure that's related. I'm also using pygame.time.set_timer to update screen in regular intervals and play sound if buffer has filled enough. Is it possible the event queue overfills? How would I determine if this is the case?

It simply freezes in 40-50% cases, and attaching strace -p to the python interpreter gives:

Process 21326 attached
futex(0x7f5a32f839d0, FUTEX_WAIT, 21329, NULL

Also, I'm getting occasional pulseaudio related crashes, is this combination known to be buggy?

Any ideas and suggestions are more than welcome! Thanks!

EDIT: it freezes when I click the window's close button (x)

sentences:
Techniques for (literally) cutting corners on square grid maps My game involves a level with deformable terrain and units that can travel in any direction but are slowed down by uneven terrain. Normal A-star should work fine in most cases, except on flat land where no matter how the general purpose pathfinder worked it would not send units on a direct path. Theta-star would work if the entire level was fairly flat, but would be much slower if it initially had to take uneven terrain into account.

I think a Manhattan-distance base A-star algorithm would be fast and give a good enough hint to allow other path finding or steering algorithms to take over, but I'm not sure what type of algorithm to use to look ahead and decide when to abandon the path, take a more direct route, and where to jump back on the path later.

(Theta-star seems like it would be too inefficient if it was adjusted to take things like slopes, obstacles, or roads into account. See the solution proposed to the comment about avoiding minefields at: http://aigamedev.com/open/tutorials/theta-star-any-angle-paths/ )

Edit: I did not mention that I already implemented and tested A-star on a similar grid. (I think I accidentally deleted something in this question.) Some of the more obvious cost/heuristic functions I considered just don't result in realistic paths on a grid when an obstacle blocks the most direct path (basically when path-finding is useful) (example pictures). The change to the cost function used by the Theta-star algorithm seems like an ideal solution (considering the constraint of using a grid), but it makes the assumption that tiles have the same travel costs (and it takes much longer).

My original reasoning behind using Manhattan distance was to outsource the "corner cutting" algorithm from the path-finding algorithm, since it was more important to have a fast path-finding algorithm in case the obstacle layout or terrain changed. It makes more sense to do the "corner cutting" algorithm once when the unit arrives than on every permutation of every search of path-finding algorithm (the results of which may end up being scrapped anyway.) A four-neighbor search with Manhattan distance is also interesting because you can see boxes of alternate paths and identify right triangles formed by the original path and the shortest path.

A better question would have been "What is a fast way to identify shortcuts in a path with 90 degree turns?"

sentences:
How do I efficiently send RTS unit selections over the network? I have a multiplayer RTS game with every unit assigned an ID.

How can I efficiently send across a network the units selected by a player? For example, Starcraft 2 has upwards of 200 units per player and each player can select a maximum of 255 units at a time. How can I implement such a system with reasonably low response time and bandwidth?

Should I bother sending IDs? Should I perhaps send a bitmask with each bit defining whether each unit is selected?

sentences:
How do I determine distance of a point within a ProBuilder mesh? As in the title, I have an effect prepped for my game which applies certain derived parameters to a post-processing effect after the player enters a boundary I created with ProBuilder. Finding how far inside the bound the player is; that is, how far the player would have to travel, at minimum, to leave it; would help me scale this effect. It is not an axis-aligned boundary, and its sloped shape is fairly important. Having the effect go full-on on crossing the boundary would be jarring to the player.

I'm tempted to resort to traditional edge testing with this, but I would like to highlight that it will be done at least once per frame on multiple objects, so I would like to keep it as simple, and non-home-rolled, as possible.

The other possibility would be to keep track of time exposed and scale it by that; but this isn't ideal and I'm seriously curious as to whether a penetration-depth-testing method exists out-of-box.

A requested image of my setup:

It is laterally symmetric, and that is unlikely to ever need to change. However, future volumes are likely to have varying angles and heights. Depth is more-or-less irrelevant, as while I'm using 3D, this game has the physics of a 2D platformer; so you can consider it to have infinite depth if you need to. As you can see on the right, I've added almost nothing to it, other than the MagneticField.cs custom script (which does not even reference the mesh, only whether it's been crossed) and a debug class, TriangleReport.cs, that I'm working on right now.

One thought I had was to get triangles for the top, bottom, left, and right edges, use them to define planes, and then determine the distance from those planes; but if you've got something better I am all ears!

sentences:
How to pack the game files into one without using any file compressor? Well, one example is this file of the game The Sims 2 for PS2: quickdat.arc.
The file contains this .arc extension, but it's no one an archive file and it contains some data of the game inside. How can I do this? Put so many files in one?

How to do something like this? All the game files inside one without using a file compressor?

sentences:
Manipulating a free camera I have a camera class in my code which stores two 4x4 matrices. One for the view matrix and one for the projection matrix. Originally, I had two floats in the class for pitch and yaw and these were updated based on keyboard and mouse input. Then on update I would do something like this to set the view matrix:

Matrix33 xRot = Matrix33::CreateRotationX(m_pitch);
Matrix33 yRot = Matrix33::CreateRotationY(m_yaw);

Matrix33 rot = xRot * yRot;

const Vector3& rUp = rot.GetColumn1();
const Vector3& rForward = rot.GetColumn2();

m_viewMatrix = Matrix44::CreateLookAt(m_position, m_position + rForward, rUp);

However, I'm now wanting to add roll to the equation but I know that if I carry on using this method I'm going to run into gimbal lock. I do have a function in my maths library to rotate about an arbitrary axis. The function definition is:

static Matrix33 CreateRotation(const Vector3 &rAxis, const float rad);

But I'm not sure, based on pitch/yaw/roll how to create the arbitrary axis to rotate around. This got me thinking that perhaps pitch/yaw/roll isn't the best way to be doing it so I thought I'd ask on here about what might be the best way? I don't even have to use CreateLookAt(), it just seemed easier at the time :)

I don't have a quaternion class yet but I could add one if that would be the best way. I think ideally I'd rather do it with just matrices for now, though.

Any help would be much appreciated.

sentences:
Unity Items not being removed from list So I finally perfected my RTS multiple movement. The situation is that the game objects are added into a list in a script bound to the camera called UnitController they are added from a unit client script MultiselectClient, this client accesses the UnitController class and adds itself the gameObject into the list. Each time I do the drag select I want it to clear the list first before adding any more. But for some reason, it doesn't work?

This is in my UnitController (below):

void MultiSelect(RaycastHit hit)
{
    Debug.Log(SelectedUnits);
    if (SelectedUnits.Count > 0)
    {
        Debug.Log("Moving group to: " + hit.point);
        foreach(GameObject gameObject in SelectedUnits)
        {
            gameObject.GetComponent<NavMeshAgent>().SetDestination(hit.point);
        }
    }
}

This is in my client (below):

public bool Selected = false;
void Update()
{
    if (Input.GetMouseButton(0))
    {
        Vector3 camPos = Camera.main.WorldToScreenPoint(transform.position);
        camPos.y = Screen.height - camPos.y;

        //if inside the cameras drag selection area then mark player as selected
        Selected = UnitController.selection.Contains(camPos);

        Debug.Log("Selected");
        if(selected){
           addTo();
        }
    }

}

void addTo()
{

    UnitController.SelectedUnits.Remove(gameObject); //I have also tried .clear() which also hasnt worked.

    if (!UnitController.SelectedUnits.Contains(gameObject))
    {
        UnitController.SelectedUnits.Add(gameObject);
        Debug.Log("Added to list: " + UnitController.SelectedUnits);
    }
    else
    {
        Debug.Log("Im already in that list.");
    }
}

sentences:
How to use Unity3D Social for OSX? I can't seem to find any documentation using the Social APIs with OSX. I can successfully use the iOS Social Libraries, but when I translate it over to OSX, it doesn't do anything. Also please refrain from suggesting Prime31, as I know that option exists, but the functionality for OSX leaderboards/game center is natively built into Social API in Unity 4.1+ yet there is no documentation to be found!?

I want to know how to use Social.ReportScore, and the ShowLeaderboard UI Methods for OSX games. I would also like to know how to report achievement progress.

I've tried using the EXACT methods from the Unity.Social Library that works for my other iOS/iPhone/iPad games.  I've attempted the code in both C# and UnityScript (JScript) to no avail.

Please help.

sentences:
Continuous / speed affected sound effects. What is the industries de-facto solution? There are various types of audio material we require in games.
For instance, footsteps - these are very straight forward.
We take some boinking sounds over metal, plastic, concrete and add to our asset library.
Now, in a good game, based on player models locomotion, once foot collides with surface, we play the sound - just from start to end, let it complete. We might lower the volume, and/or fade it out in case we need it to be more silent (like, when we didn't make a full step).
In a little lesser game, we could simply play the sound once every n ticks of walk.
The result in both cases add the depth to the game that is required to make the impression that the player is really walking.
Now, what I have problems with, is, grasping the idea behind continuous and speed affected sounds.
Continuous
With continuous sounds I think of Rocket Launcher's rocket propulsion, Dash abilities sound feedback and such.
You might ask, what's so different for those vs. footsteps? Well, I see two possible solutions:

A very long, continuous sound that is faded out / cut off whenever the rocket explodes, or the dash ends.
A very short, precisely cut out sound fragment, that can be looped for as long as you wish (this could possibly be enhanced, by once in a while nipping in or overlaying another short with different tone or what not).

And I think some of you might have something else up your sleeve.
Speed affected
With speed affected effects I think of engine sounds, like those we hear in Need for Speed franchise and such.
With this, the only solution I have in mind is smart overlay of multiple set of sounds with different lengths.

For both, the continuous and speed affected I have left out real-time software intervention, which I think is rarely applied due to more consumed CPU cycles, though, I may be wrong.
And so, the question is:
What is the industries de-facto solution to create and manipulate such effects?

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:
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 does professional audio fit into game design? Do game designers typically seek the help of specialized music/audio specialists for soundtracks and sound design?  Is there a general need for professional audio work in game design, or is that something that only big budget game studios have a need for?

How would an audio engineer/musician/sound design type get involved with making game design projects?

I'm talking about someone who can record dialogue, create and record custom music and sound effects, and create a mix to fit all these elements together in a polished way.

sentences:
How can I make sure my OpenCL code works correctly on different graphic cards? I'm testing on adding some OpenCL code in my game, but I only have a single Nvidia card & I'm not sure the code will run normally on other platforms.

Is there any way to make sure my code runs as expected on different graphic cards without having direct access to the hardware myself?

sentences:
Trouble with Collada bones I have a Collada file with a rigged mesh.  I've read the node tags in the library_visual_scenes tag and extracted the matrix for each node and stored everything in a hierarchical bone structure.  My Matrix container is "row major", so I'd store the first float of a matrix tag in the 1st row, 1st column, the second in the 1st row, 2nd column, etc.  From what I gather this is the Bind Pose Matrix.  After that I went through the  tag and extracted the float array in the source tag of the skin tag of the controller for the mesh.  I stored each matrix from this float array in their corresponding Bone as the Inverse Bind Matrix.  I also extracted the bind-shape-matrix and stored it.

Now I'd like to draw the skeleton with OpenGL to see if everything is working correctly before I go about skinning.  I iterate once over my bones and multiply a bone's Bind Pose Matrix by it's parents and store that.  After that I iterate again over the bones and multiply the result of the previous matrix multiplication by the Inverse Bind Matrix and then by the Bind Shape Matrix.  The results look something like this:

[0.2,    9.2,  5.8,   1.2 ]
[4.6,   -3.3, -0.2,  -0.1 ]
[-1.8,   0.2, -4.2,  -3.9 ]
[0,      0,     0,     1   ]

I've had to go to various sources to get the little understanding of Collada I have and books about 3d transform matricies can get pretty intense. I've hit a brick wall and if you could please read through this and see if there is something I'm doing wrong, and how I'd go about getting an X,Y,Z to draw a point for each of these joints once I've calculated the final transform, I'd really appreciate it.

sentences:
How to make leg bones children of torso bone in Blender? I'm a complete Blender novice and I'm trying to create a humanoid skeleton. I'm having problems figuring out how to make my leg bones children of the torso bone. Here's how my skeleton looks like:

As you can see from the bone hierarchy, the legs are not children of the torso. This is because I extruded them from the lower part of the torso bone. Is there any way I can fix this?

Also, on another note, would this be a good skeleton for 2D animations?

sentences:
FBO rendering different result between Galaxy S2 and S3 I'm working on a pong game and have recently set up FBO rendering so that I can apply some post-processing shaders. This proceeds as so:

Bind texture A to framebuffer
Draw balls
Bind texture B to framebuffer
Draw texture A using fade shader on fullscreen quad
Bind screen to framebuffer
Draw texture B using normal textured quad shader

Neither texture A or B are cleared at any point, this way the balls leave trails on screen, see below for the fade shader.

Fade Shader

private final String fragmentShaderCode =
        "precision highp float;" +
        "uniform sampler2D u_Texture;" +
        "varying vec2 v_TexCoordinate;" +
        "vec4 color;" +
        "void main(void)" +
        "{" +
        "   color = texture2D(u_Texture, v_TexCoordinate);" +
        "   color.a *= 0.8;" +
        "   gl_FragColor = color;" +
        "}";

This works fine with the Samsung Galaxy S3/ Note2, but cause a strange effect doesnt work on Galaxy S2 or Note1. See pictures:

Galaxy S3/Note2

Galaxy S2/Note

Can anyone explain the difference?

edit

Folowing VinceFR's comment, we've tried adding the following. When the renderbuffers are initialised they are briefly bound to the framebuffer and set the background to a uniform buffer with:

    GLES20.glClearColor(backgroundColor[0],backgroundColor[1],backgroundColor[2],backgroundColor[3]);
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

The result is unchanged on the S3, on the S2 it has improved a certain amount, but problems still exist:

note the 20 in the bottom right corner is supposed to be there.

sentences:
How to skip comparing if one of the value is null? I am using libGDX - Ashley as entity-system framework. My problem is I don't know how do I avoid having a java.lang.NullPointerException when using Comparator<Entity> entity comparison. There is a situation where Entity is removed from the engine, but the Comparator is still continuing. Now how do I skip the comparing if one of the nearby is null?

@Override
public int compare(Entity nearby1, Entity nearby2) {
    Vector2 ownerPos = Mapper.transform.get(owner).position;
    Vector2 nearbyPos1 = Mapper.transform.get(nearby1).position; // possible null
    Vector2 nearbyPos2 = Mapper.transform.get(nearby2).position; // possible null
    return ...
}

When I sort the Array<Entity> for example, using my custom comparator, it returns an error because one of the entity is null or one of the component entity is null. I don't know what to return to make the comparison skip.

boolean skip = ownerPos == null || nearbyPos1 == null || nearbyPos2 == null;

if(skip) {
   return ???
}

I'm thinking of using try-catch statement to skip the sorting. But is this performance safe?

try {
   array.sort(comparator);
} catch(Exception e) {

}

sentences: D3DXCreateEffect Performance Current performance analysis shows that D3DXCreateEffect is called many times with different shaders. Between each call, the D3DCompile DLL is being loaded and unloaded. Is there an easy way to keep that DLL loaded, i.e. by holding a CComPtr to some resource or something similar?

sentences:
How to get current Microphone Frequency in Godot Let us say I want to create a singing game similar to SingStar, and for this purpose I want to get the audio pitch the microphone is getting, in real time, or as close as possible.
I know I can get audio input in Godot. Even record the microphone to a file, there is an official demo project that does that (mic_record). I also know there are libraries that can analyze the audio.
How can I get the microphone pitch in real time?

Yes, I'm answering my own question. This question is inspired on a similar one on StackOverflow, which asked for a library to do this, which lead to the question getting closed, and the asker deleted it instead of editing the question… Before I noticed. As it turns out, you don't need libraries to do this. This is a means to answer the question I believe that person should have asked.

sentences:
LibGDX: Scrollpane won't scroll to bottom after adding children to contained table To my game I want to add a gui element that displays text and textButtons whenever something is happening or it wants you to make a decission (an answer while talking to a person for example). To keep track of your actions you shall be able to scroll it. Similar to text adverntures or dialog boxes in rpgs.

I use Scene2Dui for my GUI, so I put a scrollPane in my GUIs root table. I have methods for adding stuff to the contained table and tell the scrollPane to scroll to the bottom.

In general the idea works, but the thing doesn't scroll to the bottom but only to the bottom of the element I added before the current one. I'm puzzled.

Here's the code, leaving out the skins and styles part:

public class TextBox {

ScrollPane box;
Table table;
Label.LabelStyle lStyle;
Skin skin;

TextBox() {

    table.setFillParent(false);

    box = new ScrollPane(table, scrollStyle);

    box.setScrollingDisabled(true, false);
    box.setOverscroll(false, false);
    box.setFillParent(false);

    table.align(Align.topLeft);
    table.row();
}

void writeDecissions(GameEvent[] events) {

    Table tableD = new Table();
    tableD.setFillParent(false);

    if (events != null) {

        for (int i = 1; i < events.length; i++) {

            if (events[i] != null) {

                String s = Character.forDigit(i, 10) + " - "
                        + events[i].getDecision();

                TextButton button = new TextButton(s, style);
                button.getLabel().setWrap(true);
                button.getLabel().setAlignment(Align.left);

                tableD.add(button).width(box.getWidth() - 40).spaceBottom(20).spaceTop(20);

                tableD.row();

            }
        }
    }

    table.add(tableD).align(Align.left).pad(20);
    table.row();

    box.setScrollY(table.getHeight());
}

This is the way I test it:

public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 0);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act();
    stage.draw();

    if (Gdx.input.justTouched()) {
        gui.textBox.writeDecissions(events);
    }

I tried box.setScrollY(box.getMaxY) as well as setting overscroll to true (don't really know what that is tough). With the same result.

Finally a screenshot:

Help appreciated.

sentences:
What image format supports transparency in Android? I want to show an apple on screen but the image has a white background and it doesn't blend with the background of a tree.

Is there any image format in which only the red apple is displayed?

sentences:
How can I run two CCActions in parallel and another one afterwards with Cocos2D? With Cocos2D I can run two actions in parallel by simply using runAction and I can use a CCSequence two run several actions after each other.
However what I could not find is:

Run two actions simultaneously
When both actions are done, trigger a third CCAction

It must be really easy but I seem to use the wrong search keywords on Google. :-)

The only possible solution I have found so far is to use a delayed action as the first element of a CCSequence and then start the third action. But it "feels" wrong.

sentences:
How do you account for zoom in a top down viewport? I've been stumped on this for days so please forgive me if this question is in bad-form. I have a generic top-down RPG structure, and I want to create a zoomable Canvas viewport for it. I've read several tutorials and I guess I keep messing it up somewhere.

Current Codepen project here.

Relevant code from the project:

Camera:

function Camera(PARENT, CANVAS, SUBJECT, ZOOM)
{
  this.draw = function()
  {
    var refs = [];

    Rect.call(this, SUBJECT.x, SUBJECT.y, CANVAS.width*ZOOM, CANVAS.height*ZOOM, "cen");

    for(o in PARENT.objects)
    {
      if(this.overlapping(PARENT.objects[o]))
        refs.push(o);
    }

    while(refs.length>=1)
    {
      var obj = PARENT.objects[refs.shift()];

      if(obj.draw)
        obj.draw(
          this.context, //Drawing ctx
          this.left, //Offset left
          this.top, //Offset top
          ZOOM //Scale factor
        );
    }
  };
}

Drawing function called by the Camera:

this.draw = function(context, offsetX, offsetY, scale)
{
  context.fillStyle = this.color;
  context.fillRect((this.left-offsetX)*scale, (this.top-offsetY)*scale, this.width*scale, this.height*scale);
};

How can I resolve the math here so that the zoom is correctly figured in to the drawing offsets?

sentences:
Unity3D - leaving and then returning to a scene Effectively, I need to know how to run a mini game and then return to a scene. I know about

DontDestroyOnLoad (this);

but that works for game objects only and doesn’t do what I need - also because it carries the objects over into the next scene. In my game you play as a computer. When you hack into a computer remotely, you have to go into a sort of mini game where you must traverse the computer for data, experience and end up ‘owning’ the computer, having destroyed its security systems. My problem is that this requires being in a different scene, where the hacking 'minigame' is played out, then return. So I could just make a new scene, fine. But when I have to return to the old scene, it has to kick off from the exact point where I left to hack the computer, as if no time had past and with nothing being different. I am stuck on how to do this, because as far as I know there is no way to write a scenes data to a binary file and the read from it when loading the scene again - and persistent data was the only solution I could think of. Any help is appreciated.

Summary

How to play the scene, load a different scene, finish that minigame and then continue from where you were in the original scene

sentences:
Generating Arrow Maze puzzles I have picked this puzzle shown here as training in programming games.

  In these mazes you follow the arrows. From each arrow you can move to
  any of the arrows it's pointing to, in the same row, column, or
  diagonal.

More explanation can be found here.

As you can see the Arrow on a yellow background in the top-left corner marks the beginning of the maze. Since this arrow is pointing to the right, the player can move from here to either of the two spaces to the right. The player then chooses which arrow to should move to. If they choose the Down arrow in the top-middle, then for their next move they can travel to any of the spaces in the column below it. If they choose the diagonal arrow, then they can move diagonally.

In short, the arrow direction indicates the path direction the player can move. The player continues making these moves until they arrive at the bulls-eye which marks the end of the maze. Here is a solution to this maze:

What I want is to generate a brand new puzzle each time the player starts the game, so they will have to find a different solution path. The player then makes their choices of moves to solve the puzzle. Then they can generate a new puzzle to solve.

Unfortunately, I'm stuck on this step. How can I generate this kind of puzzle? Do I need some path finding methods and which one will help me to achieve this goal?

I'm using the C# language.

Thanks!

sentences:
Are all games made by drawing each frame? I am a beginner learning about computer animation(for games). So far, the only method that I have come across is drawing each frame, every frame update. So at the start of every frame, the entire frame is erased, and then the things for that are needed that frame are redrawn.

My question is whether or not this method is the only one that is used for making animations and games. It seems like it is a bit inefficient. I also don't quite understand how this method would work for 3d games. Could someone please explain this in more detail?

sentences:
JFrame pack() method I'm quite new to java.

I was developing a game using java and I realized that the position of pack() method can influence rendering. For instance:

Frame Class

public class Frame {
    public Frame(int width, int height, Game game) {
        JFrame frame = new JFrame("Practice Game");

        frame.setPreferredSize(new Dimension(width, height));
        frame.setMaximumSize(new Dimension(width, height));
        frame.setMinimumSize(new Dimension(width, height));

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);

        frame.pack();  // pack method is used before adding game component to frame
        frame.add(game);
    }
}

Game Class (I skipped few methods for simplicity)

public class Game extends Canvas implements Runnable {
    // Dimension
    public static final int WIDTH = 320;
    public static final int HEIGHT = 320;

    public Game() {
        new Frame(WIDTH, HEIGHT, this);

        menu = new Menu(WIDTH, HEIGHT);

        start();
    }

    public void render() {
        BufferStrategy bs = this.getBufferStrategy();

        if (bs == null) {
            this.createBufferStrategy(3);
            return;
        }

        Graphics2D g = (Graphics2D) bs.getDrawGraphics();

        menu.render(g);

        g.dispose();
        bs.show();
    }

    public static void main(String[] args) {
        new Game();
    }

This set of code results in making an empty frame without any component displayed.

However, when I tried putting pack method after I added game component to the JFrame, it successfully displayed what I intended to display.

I heard that pack() method is used to pack the components within the JFrame based on the component’s preferred sizes. However, I don't understand how the position of pack() method could influence the entire rendering (only displaying an empty frame).

Also, the actual size of frame doesn't match the dimension that I assigned to the frame. To illustrate this:

Menu Class

public class Menu {
    public Menu(int width, int height) {
        this.width = width;
        this.height = height;

        squareSize = 64;

        squareRowNum = height / squareSize;
        squareColNum = width / squareSize;
    }

    public void render(Graphics2D g) {
        drawBackground(g);
    }

    public void drawBackground(Graphics2D g) {
        for (int i = 0; i < squareRowNum; i++) {
            for (int j = 0; j < squareColNum; j++) {
                g.setColor(Color.black);
                g.setStroke(new BasicStroke(3));
                g.drawRect(j * squareSize, i * squareSize, squareSize, squareSize);
                g.setColor(Color.white);
                g.fillRect(j * squareSize, i * squareSize, squareSize, squareSize);
            }
        }
    }

When running these 3 classes together, it display:

The rectangle box at the bottom are cut off instead of fully displaying 5 * 5 rectangles (each rectangles has dimension of 64, 64 and the frame size is supposedly 320, 320). I assumed that it's because I'm using mac. I think this can also be fixed using pack() method but I don't know how.

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:
What to think about when designing a simple GUI for a quiz game I am coming close to finish my first iPhone game ever, as a matter of fact also my first programming experience ever, which is a quiz game. I have all the functionality i want and is currently polishing it both from a code point of view as well as looking at the GUI.

My initial idea was not to use any specific graphics but rather focus on the game experience and simplicity and by that only using background color, orange, and white text as well as buttons. The design is based on that all ages, from learning to read, should be able to host and play this game.

However, as i am now getting close to the finish line i am starting to think what is needed from a GUI point of view.

I would like to ask for some advice what to think about when designing a GUI. Is it considered OK without any 'fancy' graphics, what is the risk without it etc.?

Also, what colors goes well together if i choose to use a simple GUI. I am thinking about color blindness etc.

In other words how do i design a good and effective GUI for a simple game as mine?

Thanks

sentences:
game story event programming I have developed a game engine in c/c++ and DirectX.

I have a tile engine for the maps, animated player/npc sprites, talking to the npc, menus, and level changing but there is no game, it just feels empty.

I have looked around and keep hearing buzzword answers but I want to know how to implement a story in my game.

Some people have said a save file that holds flags governing every possible action/state available in the game but this sounds ludicrous.

It is a bit ambitious but I am aiming to get a game like the older Pokemon/Final Fantasy games.

Does any one know how these games work or the theory used?

I have been looking for a while and would really appreciate any input people have.

sentences:
Create bullet physics rigid body along the vertices of a blender model I am working on my first 3D game, for iphone, and I am using Blender to create models, Cocos3D game engine and Bullet for physics simulation. I am trying to learn the use of physics engine.

What I have done

I have created a small model in blender which contains a Cube (default blender cube) at the origin and a UVSphere hovering exactly on top of this cube (without touching the cube)

I saved the file to get MyModel.blend. Then I used

File -> Export -> PVRGeoPOD (.pod/.h/.cpp)

in Blender to export the model to .pod format to use along with Cocos3D.

In the coding side, I added necessary bullet files to my Cocos3D template project in XCode.

I am also using a bullet objective C wrapper.

-(void) initializeScene {
    _physicsWorld = [[CC3PhysicsWorld alloc] init];
    [_physicsWorld setGravity:0 y:-9.8 z:0];

    /*Setup camera, lamp etc.*/
    ..........
    ...........

    /*Add models created in blender to scene*/
    [self addContentFromPODFile: @"MyModel.pod"];

    /*Create OpenGL ES buffers*/
    [self createGLBuffers];

    /*get models*/
    CC3MeshNode* cubeNode    = (CC3MeshNode*)[self getNodeNamed:@"Cube"];
    CC3MeshNode* sphereNode  = (CC3MeshNode*)[self getNodeNamed:@"Sphere"];

    /*Those boring grey colors..*/
    [cubeNode setColor:ccc3(255, 255, 0)];
    [sphereNode setColor:ccc3(255, 0, 0)];

    float *cVertexData  = (float*)((CC3VertexArrayMesh*)cubeNode.mesh).vertexLocations.vertices;
    int cVertexCount    = (CC3VertexArrayMesh*)cubeNode.mesh).vertexLocations.vertexCount;

    btTriangleMesh* cTriangleMesh  = new btTriangleMesh();

//    for (int i = 0; i < cVertexCount * 3; i+=3) {
//        printf("\n%f", cVertexData[i]);
//        printf("\n%f", cVertexData[i+1]);
//        printf("\n%f", cVertexData[i+2]);
//    }

    /*Trying to create a triangle mesh that curresponds the cube in 3D space.*/
    int offset = 0;
    for (int i = 0; i < (cVertexCount / 3); i++){
        unsigned int index1 = offset;
    unsigned int index2 = offset+6;
    unsigned int index3 = offset+12;
    cTriangleMesh->addTriangle(
           btVector3(cVertexData[index1], cVertexData[index1+1], cVertexData[index1+2] ),
           btVector3(cVertexData[index2], cVertexData[index2+1], cVertexData[index2+2] ),
           btVector3(cVertexData[index3], cVertexData[index3+1], cVertexData[index3+2]
        ));
        offset += 18;
    }

    [self releaseRedundantData];

    /*Create a collision shape from triangle mesh*/
    btBvhTriangleMeshShape* cTriMeshShape   =   new btBvhTriangleMeshShape(cTriangleMesh,true);
    btCollisionShape *sphereShape =   new btSphereShape(1);

    /*Create physics objects*/
    gTriMeshObject  = [_physicsWorld createPhysicsObjectTrimesh:cubeNode shape:cTriMeshShape mass:0 restitution:1.0 position:cubeNode.location];
    sphereObject    = [_physicsWorld createPhysicsObject:sphereNode shape:sphereShape mass:1 restitution:0.1 position:sphereNode.location];
    sphereObject.rigidBody->setDamping(0.1,0.8);
}

When I run the sphere and cube shows up fine. I expect the sphere object to fall directly on top of the cube, since I have given it a mass of 1 and the physics world gravity is given as -9.8 in y direction. But What is happening the spere rotates around cube three or times and then just jumps out of the scene. Then I know I have some basic misunderstanding about the whole process.

So my question is, how can I create a physics collision shape which corresponds to the shape of a particular mesh model. I may need complex shapes than cube and sphere, but before going into them I want to understand the concepts.

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: 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/UNet without a lobby: How do you get an ordered list of participants (network players)? Please imagine a turn based multiplayer game. Right now there's no lobby in place and connections are established using Unity's Network Manager HUD.

Now on the server, how can you get a list of all the match participants? Preferably ordered - something like the player on the host should be player 1, the first player who joined the match should be player two, the second player who joined should be player three....

Any advise is welcome,
thank you.

sentences:
Unity 2d_ Constant Player movement along the x axis The movement of my player depends on swipes,

swipe left-> character moves to the left

swipe right-> character moves to the right

right now i am only getting a small movement, meaning that the player moves along the X axis but it stops inmediatelly. This is the code i have to check the swipes direction:

PLayer.cs:

public Vector2 desiredPosition;

void Update()
{
    if (MobileInput.Instance.SwipeIzquierda)
    {
        desiredPosition += Vector2.left;
    }
    if (MobileInput.Instance.SwipeDerecha)
    {
        desiredPosition += Vector2.right;
    }

    transform.position. = Vector2.MoveTowards(transform.position, desiredPosition, moveSpeed * Time.deltaTime);

In the MobileInput script i control the swipes:

private const float DEADZONE = 100.0f;
public static MobileInput Instance { set; get; }
private bool swipeIzquierda, swipeDerecha, swipeAbajo, swipeArriba;
private Vector2 swipePuntoAhora, touchComienzo;

public bool SwipeIzquierda { get { return swipeIzquierda; } }
public bool SwipeDerecha { get { return swipeDerecha; } }
public bool SwipeArriba { get { return swipeArriba; } }
public bool SwipeAbajo { get { return swipeAbajo; } }

private void Awake()
{
    Instance = this;
}

// Use this for initialization
void Start () {

}

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

    Debug.Log(SwipeIzquierda);

    swipeDerecha = swipeIzquierda = false;

    #region Input Pc
    if (Input.GetMouseButtonDown(0))
    {
        touchComienzo = Input.mousePosition;
    }
    else if(Input.GetMouseButtonDown(0))
    {
        touchComienzo = swipePuntoAhora = Vector2.zero;
    }
    #endregion

    #region Mobile Input
    if (Input.touches.Length != 0)
    {
        Debug.Log("hola");
        if (Input.touches[0].phase == TouchPhase.Began)
        {
            touchComienzo = Input.mousePosition;
        }

        else if (Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled)
        {
            touchComienzo = swipePuntoAhora = Vector2.zero;
        }
    }
    #endregion

    #region Calcular distancia

    swipePuntoAhora = Vector2.zero;
    if (touchComienzo != Vector2.zero)
    {
        //Mobile
        if (Input.touches.Length != 0)
        {
            swipePuntoAhora = Input.touches[0].position - touchComienzo;
        }
        //PC
        else if (Input.GetMouseButton(0))
        {
            swipePuntoAhora = (Vector2)Input.mousePosition - touchComienzo;
        }
    }

    #endregion

    #region Calcular DEadzone del swipe

    if (swipePuntoAhora.magnitude > DEADZONE)
    {
        float x = swipePuntoAhora.x;
        float y = swipePuntoAhora.y;

        if (Mathf.Abs(x) > Mathf.Abs(y))
        {
            //Izquierda o Derecha
            if (x < 0)
            {
                swipeIzquierda = true;
            }
            else
            {
                swipeDerecha = true;
            }
        }
        else
        {
            //Arriba o Abajo
            if (y < 0)
            {
                swipeAbajo = true;
            }
            else
            {
                swipeArriba = true;
            }

        }

        touchComienzo = swipePuntoAhora = Vector2.zero;
    }

    #endregion
}

The goal of all of this is to:

If i swipe to te right, the player starts to walk to the right AND continues doing so unless i swipe to the left, only then the player starts to move to the left. I want the movement to be constant in one direction until the other swipe changes it

Any help with this will be really appreciated

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:
Looking for literature about graphics pipeline optimization I am looking for some books, articles or tutorials about graphics architecture and graphics pipeline optimizations. It shouldn't be too old (2008 or newer) - the newer, the better.

I have found something in [Optimising the Graphics Pipeline, NVIDIA, Koji Ashida] - too old, [Real-time rendering, Akenine Moller], [OpenGL Bindless Extensions, NVIDIA, Jeff Bolz], [Efficient multifragment effects on graphics processing units, Louis Frederic Bavoil] and some internet discussions. But there is not too much information and I want to read more.

It should contain something about application, driver, memory and shader units communication and data transfers. About vertices and attributes. Also pre and post T&L cache (if they still exist in nowadays architectures) etc. I don't need anything about textures, frame buffers and rasterization.

It can also be about OpenGL (not about DirecX) and optimizing extensions (not old extensions like VBOs, but newer like vertex_buffer_unified_memory).

sentences:
Calculating orbital elements from Cartesian Vectors I'm having serious troubles with getting my calculations to work. I'm calculating the orbital elements from a position vector, and a velocity vector. (I also know the distance and mass of the bodies around)

The equation for angular momentum is as follows: h=r*v

The equation for eccentricity is: e=((v^2−μ/|r|)r-(r⋅|v|)v/µ

I plug in the position and velocity to get h, and I plug them into the other equation to get the eccentricity. These SHOULD be constants, and not change unless another force is put on them... yet they are not constant. In fact they change as the orbit goes around.

In the diagram I have just left a trail to show the orbital path. I should be able to calculate the required information... however they rely on the constants, which are not at all constant. I reference the rigidbody's position and velocity in them, and I've entered the equations in correctly. My code for applying force between planets is as follows:

void CalculateForce(Transform body) {
    float m1 = rbody.mass;
    float m2 = body.GetComponent<Rigidbody> ().mass;
    float distance = Vector3.Distance (transform.position, body.position);
    float f = (m1 * m2) / Mathf.Pow (distance, 2);
    Vector3 direction = rbody.position - body.GetComponent<Rigidbody> ().position;
    rbody.AddForce (-direction.normalized * f);
    body.GetComponent<Rigidbody> ().AddForce (direction.normalized * f);
}

The calculations are coming back incorrect. The eccentricity varies between 0.9 and 1.1. Anything over a 1 is not actually in orbit, and anything less is in orbit. However this remains in orbit as it travels around.

Can anybody help? (I've already posted to the space stack exchange and had no luck)

Thanks in advance.

Update:

Code used to calculate eccentricity (1001f is the combined weight of both objects):

    Vector3 pos = GetComponent <Rigidbody2D> ().position;
    Vector3 vel = GetComponent <Rigidbody2D> ().velocity;
    Vector3 eccentricity = (Mathf.Pow (vel.magnitude, 2.0f) - (1001f / pos.magnitude)) * pos;
    eccentricity -= Vector3.Dot (pos, vel) * vel;
    eccentricity /= 1001f;

sentences:
Unity: objects behaving different when NetworkTransform is used to sync movement I am experimenting with some simple multiplayer/networking in unity. Currently I have a plane object as the ground, and a cube prefab as the player object. I have a network manager with round-robin spawn and the built-in HUD. The cube has simple movement control (up/down is forward/backward, left/right turns the cube).

I can successfully start a game, build it, and add a client from the built app. However, when movement gets sent over the wire, the non-local player cubes in the game appear to "tilt forward," seemingly from the drag that the cube creates against the plane while moving. Strangely, when moving the local cube, no such tilt is experienced.

Here is a gif which illustrates:

In the above gif, the cube being moved is in the foreground window. Notice how the cube is only tilting in the other window.

Here is Update function of the Cube controller script:

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

        // Change translation
        float moveAmount = CrossPlatformInputManager.GetAxis("Vertical");
        Vector3 deltaTranslation = transform.position + transform.forward * movementSpeed * moveAmount * Time.deltaTime;
        localRigidBody.MovePosition (deltaTranslation);

        // Change rotation
        float turnAmount = CrossPlatformInputManager.GetAxis("Horizontal");
        Quaternion deltaRotation = Quaternion.Euler (turnSpeed * new Vector3 (0, turnAmount, 0) * Time.deltaTime);
        localRigidBody.MoveRotation (deltaRotation * localRigidBody.rotation);

        MoveCamera();

    }

The ground is a plane with a rigid body and doesn't have a network identity or transform.

How do I stop the dragging from occurring and have the behavior be consistent across both instances of the game?

The full code to this project as it is right now is here: https://github.com/andyperlitch/blocks-multiplayer

Thanks!

sentences:
How to add a bolt into my unity project In my game, one of the character you pick as a special ability called the dash. It allows the player to quickly move forward. Included below is the code. It just throws up a bunch of errors. This is a 3d scene

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

public class PlayerJump : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
        {
            if (Input.GetKeyDown("q"))
            {
                transform.Translate(Vector3.KeyDirection * 260 * Time.deltaTime, Space.World);
            }

        }
    }
```

sentences:
Can you do a stencil glow with native GM:S commands? I am looking to a stencil glow on GM:S with d3d_* functions.

I could not find anything how to access the stencil buffer though.

Is it even possible to access the stencil buffer without using an external .dll?

sentences:
How to prevent Dynamic Rigidbody2d with large mass pushing another Rigidbody2d into BoxCollider2D I'm making a prototype for a game idea but hitting a problem :(
Quite new to Unity and feel like this should be relatively easy to solve, but keep going around in circles, and hoping to get some help :)
Video: https://gfycat.com/candidplushemeraldtreeskink
GameObjects:

Red box: has BoxCollider2D
Duck: has BoxCollider2D, Rigidbody2D (dynamic), some scripts
Wall: has BoxCollider2D, Rigidbody2D (dynamic), some scripts

Rules:

Red box: doesn't move, everything should stop when colliding with it
Duck: moveable by player, can't push "Wall"
Wall: moveable by player, can push "Duck"

To get "Wall can push Duck, but Duck can't push Wall" working, I set the Mass for Wall to be Infinity. However, this seems to have a side effect where Wall can now push Duck through Red box. Note: even increasing mass to something like 500 has this side effect too
If the mass for Wall is smaller, then it won't push Duck through Red box. However, with the smaller mass, Duck can then push Wall (which I don't want).
The script for moving Wall is:
private void FixedUpdate()
{
    // https://learn.unity.com/tutorial/world-interactions-blocking-movement?uv=2019.2&projectId=5c6166dbedbc2a0021b1bc7c#5ce3cdabedbc2a3ce61754e8
    Vector2 position = rigidbody2d.position;
    position.x += speed * horizontal * Time.deltaTime;
    position.y += speed * vertical * Time.deltaTime;
    rigidbody2d.MovePosition(position);
}

Question:

What should I do so "Wall can push Duck, but Duck can't push Wall" holds true, without Duck being pushed into the Red box.
Should I be using Dynamic Rigidbody (sort of physics with collisions and pushing), or Kinematic Rigidbody (and handle collisions and pushing manually)?

Thanks in advance!

sentences: Unsure how to decide ray intersection interval I'm coding an intersection algorithm with AABB, as found here. However, I'm absolutely unsure what to pass in as t0 and t1. The paper states that it's a ray intersection interval, but the only material I've been able to find on this is that it's some kind of guess or bound as to the final values. Any suggestions as to how to define t0 and t1?

sentences:
Why is my Slick2D spritesheet animation cut off when it loops? I am loading a SpriteSheet with Slick2D and using the Animation function in the render method to display it.
The spritesheet loads perfectly, but when the animation loops, it does so moved down a few pixels and cut in half.

It should always look like this:

But instead does this:

Here's my code. It's smalle because it's only a test.

package finalProject;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Dialogue extends BasicGameState {

    private SpriteSheet SSTommy;
    private Animation ATommy;
    Music playMusic;

    public void enter(GameContainer gc, StateBasedGame sbg) throws SlickException {
        playMusic = new Music("C:/OOP Resources/Bill Blaster.ogg");
        playMusic.play();
        playMusic.loop();
    }

    public Dialogue(int state) {
    }

    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
        SSTommy = new SpriteSheet("C:/Users/Usuario/Documents/Etc/Tommy_SS.png", 41, 87);
        ATommy = new Animation(SSTommy, 150);
        ATommy.setPingPong(true);
    }

    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
        g.drawString("This is the Play State", 100, 100);
        ATommy.draw(200, 200);
    }

    public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
        ATommy.update(delta);
    }

    public void leave(GameContainer gc, StateBasedGame sbg) {
        playMusic.stop();
    }

    public int getID() {
        return 1;
    }
}

I tried other SpriteSheets but it keeps doing the same. I think this is releated to the render method, but I don't know what's doing it.

sentences:
Workflow for authoring Pokémon-like game database content I'm programming on a game that relies on a database for a lot of the creatures and items in the game (think Pokémon).
Currently, we have a Google Sheet that the designers are making. They will be using it to populate all of the items necessary for the game, so it acts as a 'source of truth'. However, to translate this into the database (SQLite) we'll need to write some code to pull the data, format it and put it into the database. The maintenance of this will also be pretty annoying, as we already need to maintain the database schema and the code representation (Unity C#). DB tables are can be static or dynamic, and the implementation on the Unity side for the DB is not an issue.
Before writing this code I'm exploring other options. I've looked into Microsoft Access (and similar programs) but they seem to be geared towards making applications now and don't have much in the way of SQLite integration.
I'm leaning towards using a visualizer tool like DB Browser for SQLite or SQLiteStudio, but the lack of cloud syncing might mean a janky solution with Google Drive or AWS.
I'm looking for a workflow that:

will be accessible for game designers (who have little to no SQL experience, but willing to learn)
will keep changes between designers synced
will be easy to manage and maintain for the codebase and SQLite database.

How can we solve this problem?

sentences:
Shading a 2D visibility mesh to act like a light? I have a visibility mesh made by raycasting:

https://my.mixtape.moe/omjlgr.webm

Right now, I'm using a shader to color the mesh white and fall off with distance and radius (the texCoord in this case is the same as the current vertex position):

uniform vec2 lightPosition;
uniform vec4 lightColor;
uniform float lightRadius;

void main()
{
    float distance = gl_TexCoord[0].xy - lightPosition;

    float lightPower = 1 - length(distance) / lightRadius;

    gl_FragColor = lightColor * lightPower;
}

However, as you can see, this light is all white. What I want to happen, is to shade the sprites themselves fullbright. Right now, to apply an ambient light color, I set the color of every tile to the color.

So if I have an ambient color of (70, 70, 70), and a light of (255, 255, 255), I want the center of the light to have a fullbright sprite (as if you set the color if it to white), and the tiles at the very edge of the light and further to be the ambient color. To explain further, if my map is fullbright (e.g. ambient color pure white), white lights wouldn't be visible.

How would I change my shader / add another shader to accomplish this effect?

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:
Should the interaction between the player and world objects be handled from the player class or as an event from the object classes? Suppose you're making a 3D platformer like Super Mario, if you jump on a Goomba, does Mario (the class) know that it just landed on a Goomba and then tell that Goomba to die, or does the Goomba realize that he is being smashed and dies ?
I want to go with the first approach but it will end up with a huge If/then (or Switch/Case) script, also the reason why this is "problematic" is that many objects will make the player have a "reaction", for example if you land on a Goomba, you don't just kill it, but it forces you to jump, that jump event, what's the best way to handle it ?
Thanks

sentences: Box2d How to connect distance joint to the ground? I have a rectangular fixed size world. I want to connect a body inside it to any place(near that body) in the world with a b2DistanceJoint. Do I need to create a large static body with the size of the world that can't collide with anything? Or is there a better method? Will it slow down simulation speed if I have around 300 bodies moving on the surface of this static body?

sentences:
Unable to destroy collider Unity3d So I was making an android game in unity3d. I wrote a script to draw straight lines with touch what I do is I first create a gameobject named temp and add line renderer to it and give the line renderer properties. Then I create a collider gameobject , parent it to the line and change its dimensions to the dimension of the line. What I am trying to do is add two colliders one while the line is being moved i.e "touch.phase == TouchPhase.Moved" and delete this collider and add another collider when "touch.phase == TouchPhase.Ended". For some weird reasons I am not able to delete the first collider.

Here is my code

void Update()
{

    foreach (Touch touch in Input.touches)
    {

        if (touch.phase == TouchPhase.Began)
        {
            temp = new GameObject();
            temp.AddComponent<LineRenderer>();
            temp.layer = LayerMask.NameToLayer("lines");

            lr = temp.GetComponent<LineRenderer>();
            lr.positionCount = 2;
            lr.SetWidth(0.2f, 0.2f);
            lr.material = new Material(Shader.Find("Sprites/Default"));
            lr.SetColors(Color.black, Color.black);

            temp.transform.position = camera.ScreenToWorldPoint(touch.position) + camOffset;
            fingerUp = camera.ScreenToWorldPoint(touch.position)+camOffset;

            lr.useWorldSpace = true;
            spawnCollider = false;

        }

        //Detects Swipe while finger is still moving
        if (touch.phase == TouchPhase.Moved)
        {
            lr.SetPosition(0, fingerUp);
            fingerDown = camera.ScreenToWorldPoint(touch.position)+camOffset;
              lr.SetPosition(1,fingerDown);
            spawnCollider = true;

            lastLine = temp;

            // The first collider temporary one

            BoxCollider2D col1 = new GameObject().AddComponent<BoxCollider2D>();
            col1.transform.parent = temp.transform;
            float lineLength = Vector2.Distance(fingerUp, fingerDown);
            col1.size = new Vector2(lineLength, 0.2f);
            Vector2 midPoint = (fingerUp + fingerDown) / 2;
            col1.transform.position = midPoint;
            float angle = (Mathf.Abs(fingerDown.y - fingerUp.y) / Mathf.Abs(fingerDown.x - fingerUp.x));
            if ((fingerUp.y < fingerDown.y && fingerUp.x > fingerDown.x) || (fingerDown.y < fingerUp.y && fingerDown.x > fingerUp.x))
            {
                angle *= -1;
            }
            angle = Mathf.Rad2Deg * Mathf.Atan(angle);
            col1.transform.Rotate(0, 0, angle);

        }

        if (touch.phase == TouchPhase.Ended)
        {
            if (spawnCollider == true)
            {
                Destroy(col1);  // Deleting the first collider

                // Adding the final collider
                BoxCollider2D col = new GameObject("Collider").AddComponent<BoxCollider2D>();
                col.transform.parent = temp.transform;
                float lineLength = Vector2.Distance(fingerUp, fingerDown);
                col.size = new Vector2(lineLength, 0.2f);
                Vector2 midPoint = (fingerUp + fingerDown) / 2;
                col.transform.position = midPoint;
                float angle = (Mathf.Abs(fingerDown.y - fingerUp.y) / Mathf.Abs(fingerDown.x - fingerUp.x));
                if ((fingerUp.y < fingerDown.y && fingerUp.x > fingerDown.x) || (fingerDown.y < fingerUp.y && fingerDown.x > fingerUp.x))
                {
                    angle *= -1;
                }
                angle = Mathf.Rad2Deg * Mathf.Atan(angle);
                col.transform.Rotate(0, 0, angle);
            }
        }

    }

}

I have added comments where I am doing what.

sentences:
Unity move Vector3 position with transform How can I move a new Vector3 position with a Transform? Like the transform is the parent the vector.

Example if I want to push the x position for example by 10 value and I rotate the transform its push in world coordinate but I want to push by the rotation too.

    void Update () {
    temp = transform.Find("Transform").position;
    temp = new Vector3(temp.x + 10.0f, temp.y, temp.z);

    Debug.DrawLine(transform.Find("Transform").position, temp);
}

sentences:
Circular lighting mask stretches to ellipse in Monogame using Pixel Shader I am trying to implement a very simple pixel shader for some basic lighting using this tutorial http://www.xnahub.com/simple-2d-lighting-system-in-c-and-monogame/

My problem is that when the effect is applied the circular gradient ends up looking like an ellipse(left) instead of its circular shape(right).

The technique I use is to have two render targets in monogame and blend them together. The first one is all of the light masks textures, and the second is the render target I want to add the lighting effect to.

I believe the problem is related to the shader itself because when I use this code I get the ellipse(left picture)

//Blend both render targets together onto the backbuffer
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
effect1.Parameters["lightMask"].SetValue(lightsTarget);
effect1.CurrentTechnique.Passes[0].Apply();
spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White);
//spriteBatch.Draw(lightsTarget, Vector2.Zero, Color.White);
spriteBatch.End();

However, when I comment out the effect and just draw the light render target. I get a nice circle(right picture)

//Blend both render targets together onto the backbuffer
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
//effect1.Parameters["lightMask"].SetValue(lightsTarget);
//effect1.CurrentTechnique.Passes[0].Apply();
//spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White);
spriteBatch.Draw(lightsTarget, Vector2.Zero, Color.White);
spriteBatch.End();

This is my effect file

sampler s0;

texture lightMask;
sampler lightSampler : register(s1) = sampler_state {Texture = <lightMask>;};

float4 PixelShaderFunction(float4 pos : SV_Position, float4 color1 : COLOR0, float2 coords: TEXCOORD0) : COLOR0
{
    float4 color = tex2D(s0, coords);
    float4 lightColor = tex2D(lightSampler, coords);
    return color * lightColor;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

Thanks.

sentences:
Lightweight lua objects vs. inheritance Although I did this a couple of times from scratch, still no solution really fits.

I'm using lua for scripting in my games. Lua holds the "prototypes" of the game elements, that are copied to each entity on it's creation. A prototype represents a class of objects ("Soldier with shotgun"). Also, each prototype may hold event hooks (OnDie, OnSpotEnemy, etc). Clearly it's a prototype, not the object that will be handled.

So, each time a hook is executed, I need to create an object to represent the calling entity (and any entities it interacts with) only for the lifetime of a single script execution. What it means is that a instance of the object lives in lua only for the time needed to run this script.

Simple execution of this idea wasn't much work -- I used lightuserdata to hold the C++ pointer to the entity encapsuled in a being class. To access the fields of the C++ object, I overloaded the metatable of being. However, the fact that the fields of the object are handled by a metatable practically breaks any reasonable implementation of inheritance.

I pondered with the usage of normal userdata, but I'm afraid that the dynamic allocation needed to run each script (some of them being ran each tick in the game loop) are going to ruin performance.

Any suggestions? Or maybe a better solution altogether?

sentences:
How do Axis-Aligned Bounding Boxes update with rotations? I have a bounding box class with a min (x,y,z) and max point (x,y,z). The object that is being rotated has a rotation matrix (3x3 matrix), but I don't know how to update the bounding box with rotations.

I'm also a little confused if I should be using Oriented Bounding Boxes instead. For example, if the 3D object is a cube then the bounding box would rotate with it so they share the same 8 vertices at whatever rotation the cube is in.

What's the best way to represent the bounding box for rotations and test for collisions?

sentences:
Unity installed version higher than game project version - can't open the game project anymore Long story short - I had to uninstall Unity and Unity Hub and reinstall them again.
I ended up installing Unity version 2020.2.1f1.
Some of my game projects were made using version 2020.1.6f1
Now I cannot open them - there is a yellow warning triangle next to those games in Unity Hub.
I am installing version 2020.1.17f1 as I type these.
So my questions:

Is there no backwards compatibility between newer versions of Unity and older games?
How do people deal with this?
I've heard people transition their games during development into newer versions of Unity but I wasn't even able to open the games made with older version.
How would I go around this if I had spent 2 years or more of development time and was suddenly locked out from my game project - how do I prevent situations like these?

Here are my Unity versions installed:

And here are my games (tutorials mostly):

I may have answered my own question, but still need your input guys. I just noticed that there is a 'Select Version' dropdown on the right that allows me to open a game project in Unity version I have installed on my system. Is this how you deal with those issues?

sentences:
Speed seems random with constant impulse I'm shooting an object from the top vertex of a triangle using Box2dWeb. The issue I'm having is that the projectile speed seems to be fairly random, even with applyimpulse set to a constant. The gravity is set to zero.

I thought it could be the physics step, changing these settings hasn't made a difference. The projectile will shoot out at very very fast speeds, then it will shoot out at its defined speed.

bodyman[0].GetBody().ApplyForce(
    bodyman[0].GetBody().GetWorldVector(new b2Vec2(0,-50)),
    bodyman[0].GetBody().GetWorldCenter());

sentences:
MVC How To Handle Animations? I am working on a turn based game that utilizes the model, view, controller design pattern to separate logic from input from rendering. I am still a little new to the pattern, but from my understanding I have laid out the following MVC system.

The model(s) comprise a set of pawns with game flow and interaction logic. Pawns/models know how to interact with each other and the model world, but only when signaled to do so via function calls. (i.e. pawn.move(startLocation, endLocation) or pawn.attack(enemyPawn))

The view(s) make up everything that is viewable by the player. This includes menus, visual representations of the pawns/models, and any user interface components like cursors and buttons. The view(s) query the model for data to draw visual representations of pawns. The view(s) also can dispatch user interface events to any observers interested in these events.

The controller(s) handle all transition and input logic. When an interesting user interface or input events occur, the controller decides what the model should do and signals the model to do it. The controller also handles swapping out of views when necessary.

I know there are many ways to implement MVC and I am open to suggestions if something seems off with this design, but the real problem I am having is how to handle animations in the view. Say the user commands a pawn to move 5 spaces North and 1 space West. I want an animation to show this over several seconds. How would I handle something like that?

sentences:
E_FAIL: An undetermined error occurred (-2147467259) when loading a cube texture I'm trying to implement a skybox into my engine, and I'm having some trouble loading the image as a cube map.  Everything works (but it doesn't look right) if I don't load using an ImageLoadInformation struct in the ShaderResourceView.FromFile() method, but it breaks if I do.

I need to, of course, because I need to tell SlimDX to load it as a cubemap.  How can I fix this?

Here is my new loading code after the "fix":

public static void LoadCubeTexture(string filename)
{
    ImageLoadInformation loadInfo = new ImageLoadInformation()
    {
        BindFlags = BindFlags.ShaderResource,
        CpuAccessFlags = CpuAccessFlags.None,
        Depth = 32,
        FilterFlags = FilterFlags.None,
        FirstMipLevel = 0,
        Format = SlimDX.DXGI.Format.B8G8R8A8_UNorm,
        Height = 512,
        MipFilterFlags = FilterFlags.Linear,
        MipLevels = 1,
        OptionFlags = ResourceOptionFlags.TextureCube,
        Usage = ResourceUsage.Default,
        Width = 512
    };
    textures.Add(filename, ShaderResourceView.FromFile(Graphics.device, "Resources/" + filename, loadInfo));
}

Each of the faces of my cube texture are 512x512.

sentences:
How to enable/ disable GameObject I have child object with ParticleSystem component.
I want to have particles disabled until I press button.

I unchecked child object to make it disabled but when I press play it enables automatically(with no scripts attached). Then I made this script below (with .SetActive(false) part only) and it worked.

But then I needed to activate it somehow, which I did, but now when I press play, object is automatically enabled/ activated again.

Is there another way of doing this because I need it haha.

var particle1: GameObject;
var particle2: GameObject;
var particle3: GameObject;

public var triggered : boolean = false;

function OnTriggerEnter() { triggered= true; }
function OnTriggerExit()  { triggered= false;}

function Start()
{
    particle1.SetActive(false);
    particle2.SetActive(false);
    particle3.SetActive(false);
}

function Update()
{
    if (triggered && Input.GetKeyDown(KeyCode.JoystickButton1))
        particle1.SetActive(true);
        particle2.SetActive(true);
        particle3.SetActive(true);
}

sentences:
Java game: jumping glitch on multiple collisions I need help with checking for intersections in a game I'm creating. When a character collides with a single obstacle on the screen everything works as intended, but when multiple obstacles are added to the screen the character can only jump off of the last obstacle that is being checked for collision. The character still collides properly with the other obstacles (doesn't fall through, cant walk through) but can't jump off of them.

My intersection checking code follow, obs is an ArrayList of obstacles, ground is the boolean that determines if the character is allowed to jump. The obstacle and character have a hitbox created by 4 rectangles.

public void checkIntersect(ArrayList<Obstacle> obs){

    for(Obstacle a: obs){

        if(a.getLeft().intersects(this.getRight())){
            if(getDx()>0){
                sidecollision=true;
                setDx(0);
                this.x-=1.5f;
            }
        } if (a.getRight().intersects(this.getLeft())){
                sidecollision = true;
                setDx(0);
                this.x+=1.5f;
        } if((a.getTop()).intersects(this.getBottom())){
            ground=true;
            setDy(0);
            this.y-=.10f;
        } else if(!(a.getTop()).intersects(this.getBottom())){
                ground = false;

                //return ground;
        } if(a.getBottom().intersects(this.getTop())){
            ground=false;
            setDy(0);

            this.y+=.1f;
        }

    }
}

And this is how collision is being checked on the game component:

bg.update(quote);
win.fill(clear);
bg.drawBG(win);
for(Obstacle o: obs){
    o.draw(win);
    o.update(bg);
}
if(quote.isVisible()){
    quote.movedrawProtag(win, keys);
    quote.checkIntersect(obs);
}

sentences:
How to implement constant velocity and collisions without gravity I am learning game development and i am trying to implement the AndEngineBox2D Extension such that my character is always moving at a constant velocity, when it collides with a body sprite, the character automatically changes direction (is deflected) and moves in the new direction until another collision has happened and the same is done repeatedly.

My Question:
Is it possible to implement the changes in trajectory  with AndEngineBox2D's physics world or i have to to handle it manually is java code.

sentences:
How to load models with possibility to change textures in Three.js I'm working on a game in Three.js where I have a few variations of the same model in blender.

What I want to achieve is that I'll load the model once with all the material settings, but then I'll just change the texture dynamically. Is there a way to do that? and in what format should I export it from blender in order to do this effeciently (json, obj)?

Thank you so much in advance.

sentences:
2D pathfinding - finding smooth paths I was trying to implement a simple pathfinding, but the outcome is less satisfactory than what I intended to achieve. The thing is units in games like Starcraft 2 move in all directions whereas units in my case only move in at most 8 directions (Warcraft 1 style) as these 8 directions direct to next available nodes (they move from a tile to next neighboring tile). What should I do in order to achieve the result as in Starcraft 2? Shrink the tile size?

On the picture you can see a horizontal line of rock tiles being obstacles, and the found path marked as green tiles. The red line is the path I want to achieve.

sentences:
How can I generate a TileSet from an existing image of a level? Let say I have this level from Zelda: ALTTP.
I know that each tiles are 16x16. How can I generate a tileset and map from part of the original image?

(Image source)

sentences:
Benefit of using Vector2 data type over separate x & y variables I'm really curious about why a lot of people and game engines use Vector2 as its coordinate system instead of the traditional x and y value.

Is there any benefit to this?

I feel like it's just slow me down and barely has any benefit other than organizing your code.

sentences:
What units does Sprite Kit use for physics? I'm developing a simple ball game in Sprite Kit. I need to predict the ball's trajectory, so I went back to my physics book for the equations for acceleration, time, speed and space.

The problem is that Sprite Kit documentation does not declare the units of measurement of the properties of physics bodies, so it's hard to calculate the needed values.

Based on my experiments/research I suppose that:

gravity is expressed in m/s/s  (m/s^2)
since gravity is a CGVector, all CGVectors are expressed in m/s/s (m/s^2)
velocity (instant speed) is m/s

Then I realized a simple scene where a ball is falling:

Gravity: CGVector(0,1.2);
Height: 218.009499 pixels
Time: 0.302499747
Then acceleration should be:   2*Height / Time^2 = 1441.3863 pixels/s/s
And gravity of 1.2m/s/s corresponds to 1441.3863 in a world measured in pixels

Someone says the internal PTM (pixel to meter ratio) is 150.

Any hints?

sentences:
LibGDX destroy object when not used I am developing a game where objects move in the screen. My object is instantiated in Y = 0 and I want to destroy this object when it goes under the screen Height.
So if (positionY >= ScreenHeight) I have to destroy this object to clean my game and prevent "lag".

How to do this? I have a dispose method (this.dispose) but it cause the dispose of the app and I want destroy only the object.

Thanks in advance

sentences:
Pan camera within bounds of large image I have a camera that I pan around a large image which works fine, however when I reach the end of the image I can keep panning on and on, forver. I have looked everywhere for an answer on how to prevent this but the only one I found did not use panning and I could not get it to work.

My code atm is very simple:

map.setPosition(-map.getWidth()/2, -map.getHeight()/2);

public boolean pan(float x, float y, float deltaX, float deltaY) {
        cam.translate(-deltaX * PAN_SPEED, deltaY * PAN_SPEED);
        cam.update();
        return true;
    }

My Image is very large, 4096x4096, and my camera is 480x800. My problem is I have no idea how to get the distance I have panned, and even if I did I dont know how to stop a pan from moving past a certain point, just setting camera position won't work because then there will be a "bounce" back.

Basically I have a rectangle inside another rectangle, and the inner rectangle should not be allowed to move outside the larger. But as I said I don't really know where to start since I can't get the panning distance.

Ex of something I've tried:

@Override
public boolean touchDown(float x, float y, int pointer, int button) {
    startX = x * PAN_SPEED;
    return false;
}

@Override
public boolean pan(float x, float y, float deltaX, float deltaY) {
    if(-totalX > map.getX() + cam.viewportWidth/2){
        cam.translate(-deltaX * PAN_SPEED, deltaY * PAN_SPEED);
        cam.update();
    }
    return true;
}

@Override
public boolean panStop(float x, float y, int pointer, int button) {
    endX = x* PAN_SPEED;
    totalX += endX - startX;
    System.out.println("pan: " + totalX + ", map: " + map.getX());
    return true;
}

This is just a test, basically I can't move anymore after I hit the left border of the image, but totalX still keeps adding up so this will not work.

EDIT: Got it to work, code below:

@Override

public boolean pan(float x, float y, float deltaX, float deltaY) {
        cam.translate(-deltaX, deltaY);
        keepCameraInBounds();
        cam.update();
    return true;
}

private void keepCameraInBounds () {
    OrthographicCamera c = this.cam;
    Vector3 camPos = c.position;
    float HW = c.viewportWidth / 2, HH = c.viewportHeight / 2;
    camPos.x = MathUtils.clamp(camPos.x, map.getWidth()/2 - map.getWidth() + HW, map.getWidth() - map.getWidth()/2 - HW);
    camPos.y = MathUtils.clamp(camPos.y, map.getHeight()/2 - map.getWidth() + HH, map.getHeight() - map.getHeight()/2 - HH);
}

sentences:
How to: Duplicating and updating component data in systems I am new to game development. Coming across the ECS (entity-component system) pattern I generally quite liked the idea. I have implemented the current version of my engine using the OOP style approach. In other words, Components are objects that have both state and behaviour and methods that can be polymorphic. My entity manager also means that when a SpriteRenderComponent has been added to an entity, entity.GetComponent<RenderComponent>() will return a reference to the SpriteRenderComponent. Of course, the problem with this is that components have to communicate with each other. E.g. the draw method will access the TransformComponent's transform data.
Now I have dug a bit deeper and found that most sources recommend the pure ECS approach where the entities are an id or a list of components, components are just structs with public data and the systems are where all the magic happens ie where all the functions are. Of course, components don't depend on each other and the same is ideally true for systems as well.
So now when I want to draw a sprite I create a SpriteRenderSystem which knows how to draw a sprite. The problem is that drawing concerns all kinds of drawable things e.g. to sort them depending on a zOrder and layer. This is what lead me to the idea of nodes as objects that are local to the system. So now the SpriteRenderSystem would add a 'SpriteRenderNode' to the RenderManager. The SpriteRenderNode could inherit from an abstract RenderNode and implement the virtual draw method. The SpriteComponent would only hold the data specific to the sprite such as colour. The vertex array and all the other stuff that is purely related to rendering is kept encapsulated in the derived RenderNodes.
Problem #1
In order to be drawn by the RenderManager, the SpriteRenderNode would need to know and therefore store its transform data. The only way to keep this data up to date would be to copy the entity's transform component's transform data to the SpriteRenderNode every frame. I am not so much concerned about performance here but about the practice of duplicating the data in the systems. It feels like this is a violation of general good programming practices though I can't see any immediate reasons why it may prove harmful.
Problem #2
Taking the data out of the components.
From what I understand, the data should live in the components. However, taking the above-presented idea a step further, there may be cases where storing data in components isn't necessary at all. Such an example may be an animation system which may simply store and update animation nodes for each entity and then change their components such as texture, position... The problem with this is that it would take away the ability to save the game by simply serialising all the components.
As you see I am quite confused about how a good pure ECS should look like. Any help would be much appreciated.

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:
Adding SpriteFont in Monogame My question is probably something you guys have heard before - "How do you add SpriteFont's in Monogame's content manager?" The simple answer to this is, right click the 'Content' folder, go on 'Add New Item' and then you'll find it there. In my case however, there is no SpriteFont.

As far as my development environment goes, I am using Windows 7 and Visual Studio 2012. Upon getting Visual Studio, I installed MonoGame 3.2. My project is a MonoGame Windows Project (C#). As far as I can see, there are absolutely no options to add SpriteFont's to the MonoGame content manager. Right clicking the Content folder and going on Add New Item simply gets me this:

No sign of SpriteFont anywhere, whether I look under Visual C# Items or Online. What am I doing wrong?

The above is my content manager. If I go on Edit, New Item and then add my SpriteFont this way it will add, however the moment I go on Build, it will say 'MGCP has stopped responding'. This makes me think something is missing... A certain something called XNA Game Studio 4.0. I did some research and found a couple tutorials that tell you to install this, which makes me wonder if it is indeed needed. A friend of mine however is adamant that XNA Game Studio is not needed and that the only thing I need is VS 2012 and MonoGame.

Am I doing something wrong? Am I missing something? And is the answer to all my problems XNA Game Studio 4.0?

sentences:
Java Swing KeyBindings do not recognize input in a weird way I am new to programming, so forgive me if I make silly mistakes.

I want to make a game, and I started by making the player, and that's where I'm stuck at. I'm trying to use Keybindings (InputMap and ActionMap of a JComponent) to make the player move, but something really odd is happening. When I hold "A" to make the player move to the left, that's what he does. But if I then press "D" to make him move right, he just stands still. Then, if I release and press "D" again, it does move. This happens with all of my keyboards, and I had a similar problem when using a KeyListener.

This seems like a problem with another class, like the Player class, but it isn't: When the situation i described occurs, the AbstractActions I created aren't being called! And that was the same with the KeyPressed() method when I was using a KeyListener.

This is my class for managing keyboard-input:

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JLabel;
import javax.swing.KeyStroke;

public class KeyManager {

private JLabel keyManager;

private Action leftTrue, leftFalse, rightTrue, rightFalse;

public boolean left = false, right = false, up = false, down = false;

public KeyManager() {
    initActions();

    keyManager = new JLabel();
    System.out.println("called");

    keyManager.getInputMap(JLabel.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("D"), "pressed_D");
    keyManager.getInputMap(JLabel.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("released D"), "released_D");
    keyManager.getInputMap(JLabel.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("A"), "pressed_A");
    keyManager.getInputMap(JLabel.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("released A"), "released_A");

    keyManager.getActionMap().put("pressed_D", rightTrue);
    keyManager.getActionMap().put("pressed_A", leftTrue);
    keyManager.getActionMap().put("released_D", rightFalse);
    keyManager.getActionMap().put("released_A", leftFalse);
}

public JLabel getKeyManager() {
    return keyManager;
}

private void initActions() {

    leftTrue = new AbstractAction() {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("pressed a");
            left = true;

        }

    };
    leftFalse = new AbstractAction() {

        private static final long serialVersionUID = 2L;

        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("released a");
            left = false;

        }

    };
    rightTrue = new AbstractAction() {

        private static final long serialVersionUID = 3L;

        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("pressed d");
            right = true;

        }

    };
    rightFalse = new AbstractAction() {

        private static final long serialVersionUID = 4L;

        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("released d");
            right = false;

        }

    };

}

}

The JLabel object is added to my JFrame in another class

I don't feel like my explanation of the problem made much sense, so here's a video of what's happening:

https://www.dropbox.com/s/7bs6r1kt6z489rf/JavaHelp.mov?dl=0

Does someone know how to fix this? :(

sentences:
Questions about scaling in a 2d game in unity Okay, so:

I am making an android game. I want everything to scale to the size of the screen I'm using. Further, my static background needs to scale (as well as every other object), but if the aspect ratio is less than the AR of the background image I want the image to be cut off at the edges.

Further, I have a game object I need to always be at the corner of the screen. I'm guessing I should use a script to determine the width of the screen and place it a few coordinates up and right of that on start?

The game is only in landscape mode if that matters. How do I go about this? I previously had the background as a plane with an image on it but it didn't take up the whole screen and I think it might not be the right thing to do? Maybe use a quad?

How do I test to make sure that this works? I only have my one android phone to test it on.

sentences: An ECS rendering system I'm planning to implement an ecs system for my game but i have foreseen a problem.  How will a rendering system be able to render entities in the correct order based on their depth component?  What are some of the ways that this can be accomplished?  One way i can think of is sorting the components array by depth of but this can be tricky especially if using a mega array of components for all entities.  I'm using python but i might want to make the ecs in rust.

sentences:
glReadPixels with GL_DEPTH_COMPONENT into PBO is slow I need to read depth buffer back to cpu memory. It may be few frames old, so I use glReadPixels with a buffer bound to GL_PIXEL_PACK_BUFFER. I use several buffers and ping-pong them. Finally, I read from the PBO with glGetBufferSubData. I have tried creating the buffers with GL_STATIC_READ, GL_DYNAMIC_READ and GL_STREAM_READ all with same results. Unfortunately, all this is still horribly slow.

class DepthBuffer
{
private:
    static const uint32 PboCount = 2;
    Buffer buffer;
    uint32 index;
    uint32 pbo[PboCount];
    uint32 w[PboCount], h[PboCount];

public:
    DepthBuffer();
    ~DepthBuffer();

    void performCopy(uint32 fbo, uint32 w, uint32 h);

    // returns 0..1 in logarithmic depth
    float valuePix(uint32 x, uint32 y); // pix in 0..(cw/ch-1)
    float valueNdc(float x, float y); // ndc in -1..1
};

DepthBuffer::DepthBuffer()
    : index(0), pbo{ 0, 0 }, w{ 0, 0 }, h{ 0, 0 }
{
    glGenBuffers(PboCount, pbo);

}

DepthBuffer::~DepthBuffer()
{
    glDeleteBuffers(PboCount, pbo);

}

void DepthBuffer::performCopy(uint32 fbo, uint32 paramW, uint32 paramH)
{
    // copy framebuffer to pbo

    glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo[index]);
    if (w[index] != paramW || h[index] != paramH)
    {
        glBufferData(GL_PIXEL_PACK_BUFFER,
            paramW * paramH * sizeof(float),
            nullptr, GL_STREAM_READ);
        w[index] = paramW;
        h[index] = paramH;
    }

    glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
    CHECK_GL_FRAMEBUFFER(GL_READ_FRAMEBUFFER);
    glReadPixels(0, 0, w[index], h[index],
        GL_DEPTH_COMPONENT, GL_FLOAT, 0);

    CHECK_GL("read the depth (framebuffer to pbo)");

    // copy gpu pbo to cpu buffer
    index = (index + 1) % PboCount;

    float *depths = nullptr;
    {
        uint32 reqsiz = w[index] * h[index] * sizeof(float);
        if (buffer.size() < reqsiz)
            buffer.allocate(reqsiz);
        depths = (float*)buffer.data();
    }

    glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo[index]);
    glGetBufferSubData(GL_PIXEL_PACK_BUFFER, 0,
        w[index] * h[index] * sizeof(float), depths);

    glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);

    CHECK_GL("read the depth (pbo to cpu)");
}

float DepthBuffer::valuePix(uint32 x, uint32 y)
{
    if (w[index] * h[index] == 0)
        return nan1();
    assert(x < w[index] && y < h[index]);
    return ((float*)buffer.data())[x + y * w[index]];
}

float DepthBuffer::valueNdc(float x, float y)
{
    assert(x >= -1 && x <= 1 && y >= -1 && y <= 1);
    return valuePix((x * 0.5 + 0.5) * (w[index] - 1),
        (y * 0.5 + 0.5) * (h[index] - 1));
}

The glReadPixels is taking all the time (on cpu). Am I doing something wrong? I thought that reading into the PBO should be asynchronous.
Thanks.

sentences:
How can I change the script so it will not be with a while loop inside Update or using coroutine instead? The script is working fine as it is and I don't fell any performance problems and yet I wonder if it's a good idea to run a while loop inside the Update function ?
The idea is to be able to move an object over a curved lines with a lot of positions in any speed.
So I'm calculating how much positions there is next each time and it's working fine I just wonder about the while in the update.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.AI;

public class MoveOnCurvedLines : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public float speed;
    public bool go = false;
    public bool moveToFirstPositionOnStart = false;

    private Vector3[] positions;
    private Vector3[] pos;
    private int index = 0;
    private bool goForward = true;
    private List<GameObject> objectsToMoveCopy = new List<GameObject>();

    // Start is called before the first frame update
    void Start()
    {
        pos = GetLinePointsInWorldSpace();

        if (moveToFirstPositionOnStart == true)
        {
            transform.position = pos[index];
        }
    }

    Vector3[] GetLinePointsInWorldSpace()
    {
        positions = new Vector3[lineRenderer.positionCount];
        //Get the positions which are shown in the inspector
        lineRenderer.GetPositions(positions);

        //the points returned are in world space
        return positions;
    }

    // Update is called once per frame
    void Update()
    {
        if (go == true)
        {
            Move();
        }
    }

    void Move()
    {
        Vector3 newPos = transform.position;
        float distanceToTravel = speed * Time.deltaTime;

        bool stillTraveling = true;
        while (stillTraveling)
        {
            Vector3 oldPos = newPos;
            newPos = Vector3.MoveTowards(oldPos, pos[index], distanceToTravel);
            distanceToTravel -= Vector3.Distance(newPos, oldPos);
            if (newPos == pos[index]) // Vector3 comparison is approximate so this is ok
            {
                // when you hit a waypoint:
                if (goForward)
                {
                    bool atLastOne = index >= pos.Length - 1;
                    if (!atLastOne) index++;
                    else { index--; goForward = false; }
                }
                else
                { // going backwards:
                    bool atFirstOne = index <= 0;
                    if (!atFirstOne) index--;
                    else { index++; goForward = true; }
                }
            }
            else
            {
                stillTraveling = false;
            }
        }

        transform.position = newPos;
    }
}

sentences:
Events vs direct reference in Unity3D? I'm developing a simple NPC controller that the player can talk with.

At the moment a NPCController script on the NPC gameobject manages several "high level" feature of the NPC such as intelligence.

Every time the player talks with the NPC, the latter will respond with "Bzz", "Hello" or "Heya" depending on his intelligence level.

The talking part is implemented in a TalkController script. I did this way in order to have multiple behaviours depending on the player/npc interaction without creating a giant NPCController class. Plus some NPC may not speak at all (in this case I'd simply remove the TalkController).

I have a small dilemma on how to change the NPC response in TalkController based on the intelligence level in NPCController.

I could use Events:

// NPCController.cs

public delegate void OnIntelligenceLevelHandler(int level);
public static event OnIntelligenceLevelHandler OnIntelligenceLevelChanged;

// When intelligence increases
OnIntelligenceLevelChanged(2);

and:

// TalkController.cs

// Store _intelligence = 1;
// Subscribe to OnIntelligenceLevelChanged
// Upgrade _intelligence when the event fires
// Switch word on _intelligence when talking

I could use a direct reference:

// TalkController.cs

// Store _npccontroller = GetComponent<NPCController>();
// Switch word on _npccontroller.Intelligence when talking

What would be the best approach?

sentences:
Why does Avatar Mask not work as expected? I have 2 layers: The base layer, and an upper body layer.
On the upper body layer, I have an avatar mask because I only want to affect the upper body.
However, this mask doesn't work as expected.
Here is what it looks like:

This is what is looks like when the upper body layer has a weight of 0:

And this is with the upper body layer with a weight of 1 and with the Avatar Mask:

As one can see, the lower body is affected. The avatar mask doesn't seem to have an effect.
Is that a bug in Unity, or is there anything I could still check?
Thank you!

sentences:
2D Outline shader in GLSL I have a simple prototype with 2D worms-like destructible terrain.
I use a trivial shader to discard pixels based on a mask.

varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_mask;

void main()
{
    vec4 colour = texture2D(u_texture, v_texCoords);
    vec4 mask = texture2D(u_mask, v_texCoords);

    if (mask.a > 0)
        discard;
    else {
        gl_FragColor = colour;
    }
}

What would be a good and simple way to add few pixels thick black outlines to the terrain to make the carved parts look better?

I've researched something about edge detection algorithms, but my hunch says that such a fullblown thing would be kind of an overkill for this task?

I'm not after quality or high performance, but simplicity.

Thanks for any ideas.

sentences:
Distance Cost for 3D A* Algorithm I'm currently implementing an A* Algorithm for my Unity project. I found this entry on stackoverflow, but its not telling me how to solve my problem.
https://stackoverflow.com/questions/32205891/a-star-algorithm-in-a-3d-configuration-space
I'm not sure about the math required to calculate the distance cost correctly. How to properly implement this in 3-dimensional space?
In 2D space it is clear how to implement:
public static int CalculateDistanceCost(int3 a, int3 b)
{
    int xDistance = math.abs(a.x - b.x);
    int yDistance = math.abs(a.y - b.y);
    int remaining = math.abs(xDistance - yDistance);

    return 14 * math.min(xDistance, yDistance) + 10 * remaining;
}

However in 3d space it is unclear to me how to calculate it:
public struct AStarMath
{
    public static int CalculateDistanceCost(int3 a, int3 b)
    {
        int xDistance = math.abs(a.x - b.x);
        int yDistance = math.abs(a.y - b.y);
        int zDistance = math.abs(a.z - b.z);
        int remaining = math.abs(xDistance - yDistance - zDistance);

        return 14 * math.min(math.min(xDistance, yDistance), zDistance) + 10 * remaining;
    }
}

My neighbour cells are set up as follows:
int3 neighbours = new int3[]
{
                            //X(width),y(height),z(depth)
    new int3(-1, -1, -1), //Left, Bottom, Front
    new int3(0,  -1, -1), //Middle, Bottom, Front
    new int3(+1, -1, -1), //Right, Bottom, Front

    new int3(-1, 0, -1),  //Left, Middle, Front
    new int3(0,  0, -1),  //Middle, Middle, Front
    new int3(+1, 0, -1),  //Right, Middle, Front

    new int3(-1, +1, -1), //Left, Top, Front
    new int3(0,  +1, -1), //Middle, Top, Front
    new int3(+1, +1, -1), //Right, Top, Front

    new int3(-1, -1, 0),  //Left, Bottom, Middle
    new int3(0,  -1, 0),  //Middle, Bottom, Middle
    new int3(+1, -1, 0),  //Right, Bottom, Middle

    new int3(-1, 0,  0),  //Left, Middle, Middle
    //Middle, Middle, Middle (0,0,0) -> dont add, were already here
    new int3(+1, 0,  0),  //Right, Middle, Middle

    new int3(+1, +1, 0),  //Left, Top, Middle
    new int3(0,  +1, 0),  //Middle, Top, Middle
    new int3(+1, +1, 0),  //Right, Top, Middle

    new int3(-1, -1,+1),  //Left, Bottom, Back
    new int3(0,  -1,+1),  //Middle, Bottom, Back
    new int3(+1, -1,+1),  //Right, Bottom, Back

    new int3(-1,  0,+1),  //Left, Middle, Back
    new int3(0,   0,+1),  //Middle, Middle, Back
    new int3(+1,  0,+1),  //Right, Middle, Back

    new int3(-1, +1,+1),  //Left, Top, Back
    new int3(0,  +1,+1),  //Middle, Top, Back
    new int3(+1, +1,+1),  //Right, Top, Back
};

As you can see in this image, my enemy (magenta) now takes a weird path, but will always find a path towards target (blue).

sentences:
Resize rigidbody in runtime, Box collider OnTriggerEnter not work Scene setting:

Object A:
Rigidbody, kinmeatic
Box collider, is trigger true.

Object B:
Box collider, is trigger true.

Script is on Object A:

void FixedUpdate()
{
    if(increaseScale)
    {
        transform.localScale += transform.forward* speed;

        // when to stop
        if ((AEForward * transform.localScale.z).sqrMagnitude >= range * range)
            increaseScale = false;
    }
}

void OnTriggerEnter(Collider other)
{
    Debug.Log(other.transform);
}

No log message when part of object A is inside B.

And the funny part is if I use it on a sphere collider, it works. (use                       transform.localScale += new vector3(1,1,1)* speed; instead )

sentences:
Draw a sprite when a key is pressed in LibGDX I'm working with LibGDX. How can I draw a sprite when a key is pressed? I have tried with the following, but it doesn't seem to work.

if (Gdx.input.isKeyPressed(Input.Keys.X)) {
    batch.begin();
    sprite.draw(batch);
    batch.end();
}

sentences:
Sprite animation with "overlapping" animations? I'm trying to implement my own sprite animation system, and so far I've got it working quite nicely. I store each animation as a "take" which basically denotes the row of the animation in the sprite sheet, the starting frame and the number of frame. These takes are created during start-up and played by calling play(takeID) on the animation. The player is split into four sprites: head, torso, arms and legs, and different animations can be played on each of these separately from the other parts.

Now, this works fine for situations where I only need a single animation (walking, idling, running, swinging a sword etc.), but I need a more complex animation system for situations where the player performs multiple things at the same time, for example walking while swinging a sword.

I've tried to break down the requirements of the animation system by using the example above, and I've found these cases:

1. Player swings the sword
    1.1. Play swinging animation
    1.2. When done, play idle animation

2. Player starts walking
    2.1. Play walking animation until player stops
    2.2. Play idle animation when player stops

3. Player walks and swings the sword
    3.1. Play walking animation
    3.2. Replace the animation of the hands by a swinging animation
    3.3. When swinging animation is done, revert back to the "walking hands" animation

4. Player walks, initiates a swing and stops walking during the swing
    4.1. Play walking animation
    4.2. Replace the animation of the hands by a swinging animation
    4.3. (Player stops walking during the swing)
    4.4. Stop walking animation and play idle animation for
         all other body parts except the hands
    4.5. When swinging animation is done, play idle animation for hands

I've tried fiddling around with "overriding" animations where the animation with the higher priority (in this case, the "swinging" animation) would be shown instead of the lower priority animation (the walking animation) while updating still both simultaneously to maintain the correct rhythm of the original animation. However, I have trouble getting it to work properly.

The "reversion to idle animation" is a rather challenging task: if I have just the single walking animation, I can stop it and then play the idle animation (or rather, the "idle frame"), but when the sword swinging is added, it becomes more difficult to know when to swap to the idle animation.

So, to conclude with my question: has anyone faced a similar problem? How should I tackle this issue?

sentences:
Smooth vector based jump I started working on Wolfire's mathematics tutorials. I got the jumping working well using a step by step system, where you press a button and the cube moves to the next point on the jumping curve.

Then I tried making the jumping happen during a set time period e.g the jump starts and lands within 1.5 seconds. I tried the same system I used for the step by step implementation, but it happens instantly. After some googling I found that Time.deltatime should be used, but I could not figure how. Below is my current jumping code, which makes the jump happen instantly.

 while (transform.position.y > 0)
 {
   modifiedJumperVelocity -= jumperDrag;
   transform.position += new Vector3(modifiedJumperVelocity.x, modifiedJumperVelocity.y, 0);
 }

Where modifiedJumperVelocity is starting vector minus the jumper drag. JumperDrag is the value that is substracted from the modifiedJumperVelocity during each step of the jump. Below is an image of the jumping curve:

sentences:
Roguelike corridor creation; Connecting rooms I have a simple Tile[,] that I populate with Rooms. Now I need to connect the rooms with a single tile wide corridor. At first I used A* to hook up the rooms but that, of course, get's the best path from tile to tile, but that's a bit boring.

So I decided to roll my own path walker, which very inefficiently get's me the same paths currently as A* except for some reason it never reaches the end tile. I was planning to add a randomness to it by adding a random chance to go in a random direction for a few steps before going back to it's route.

public static List<Tile> GetPath( Room startRoom, Room endRoom, Tile[,] map, int drunkenStep )
{
    //Select random tile from the wall list
    Tile startTile = startRoom.wallTiles[ UnityEngine.Random.Range( 0, startRoom.wallTiles.Count) ];
    Tile endTile = endRoom.wallTiles[   UnityEngine.Random.Range( 0, endRoom.wallTiles.Count) ];
    startRoom.wallTiles.Remove( startTile );
    endRoom.wallTiles.Remove( endTile );

    //Make it a floor tile
    startTile.type = RoomType.FLOOR;
    endTile.type = RoomType.FLOOR;
    startRoom.floorTiles.Add( startTile );
    endRoom.floorTiles.Add( endTile);

    //Add the start tile to the list
    Tile selectedTile = startTile;
    List<Tile> path = new List<Tile>();
    path.Add( selectedTile );

    List<Tile> tilesToCheck = new List<Tile>();
    do
    {
        //loop four times for each adjascent tile
        for(int i = 0; i < 4; i++)
        {
            int x = selectedTile.x + Convert.ToInt32( selectedTile.adj[i].x );
            int y = selectedTile.z + Convert.ToInt32( selectedTile.adj[i].y ); //x/y because 2D map. Tile y is for height displacement
            //Check if we are within bounds
            if( x < 0 || x > map.GetLength(0) || y < 0 || y > map.GetLength(1) ) continue;
            //We cant back track through a room and only use tiles that aren't set yet
            if( map[x,y].type == RoomType.NONE || (map[x,y].type == RoomType.FLOOR && map[x,y].roomId == -1) ) tilesToCheck.Add( map[x,y] );
        }

        float minDist = Mathf.Infinity;
        Vector2 endPos = new Vector2( endTile.x, endTile.z );
        foreach (Tile t in tilesToCheck)
        {
            float dist = Vector2.Distance( new Vector2( t.x, t.z), endPos);
            if (dist < minDist)
            {
                selectedTile = t;
                minDist = dist;
            }
        }

        path.Add(selectedTile);
        tilesToCheck.Clear();

    } while( selectedTile != endTile );

    return path;
}

Right now this never resolves and i'm not entirely sure why it doesnt reach the end tile. So my question is:

What is going wrong and what should I do to get straighter corridors and maybe some drunken randomness; maybe have a path loop around a little bit

Thanks for your time!

sentences:
How to fit a bitmap to a random size rect so it does not strech? (Android Studio) I'm trying to fit a bitmap to a random size rect but I don't want the bitmap to be streched out. I've tried using BitmapShader and tile it but it become animated and not fixed.

Here is my code without BitmapShader.

 public void draw(Canvas canvas) {
      Paint paint = new Paint();
      canvas.drawBitmap(spike1, null, rectangle, paint);
      canvas.drawBitmap(spike1, null, rectangle2, paint);
 }

Here is my code with BitmapShader.

 public void draw(Canvas canvas) {
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(spike1, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT));
    canvas.drawRect(rectangle, paint);
    canvas.drawRect(rectangle2, paint);
}

Here is a picture of my problems

Can somebody tell what I need to do so the image is fix but not stretched?

sentences:
How to keep two objects in the same zone when they collide? I made a zone out of a cylinder with zero height. When one sphere moves to that zone it is fine but if another one moves to the same zone it only shows one sphere.

I tried to add a rigid body for each sphere but they collide inside the cylinder and both fly. I want both of them to collide but stay inside the cylinder zone with a distance between them like 2 units.

sentences:
How to make noise-generated terrain more square? I use a perlin noise generator to create a map. All works fine and dandy. It uses the following formula:

Generate perlin noise
Posterize the height values to be an integer between 0 and 5.

What I get works well. Just, the terrain is TOO organic for my purposes. Is there a way to make it a little more square and chunky?

sentences:
Room-based camera movement I'm trying to make a camera system where the camera never goes outside the edges of the current room (like Link to the Past or Mega Man, for example)

This is what I have right now:

using UnityEngine;
using System.Collections;
public class CameraFollow : MonoBehaviour {
public BoxCollider roomBounds;
public Player target;
Vector3 velocity;
float halfHeight,halfWidth;
void Start(){
    halfHeight = Camera.main.orthographicSize;
    halfWidth = halfHeight * Camera.main.aspect;
}
void LateUpdate(){
    Vector3 targetPosition = target.transform.position;
    if (targetPosition.x+halfWidth >= roomBounds.bounds.max.x || targetPosition.x-halfWidth <= roomBounds.bounds.min.x) {
        velocity.x = 0;
    } else {
        velocity.x = targetPosition.x - transform.position.x;
    }
    if (targetPosition.y+halfHeight >= roomBounds.bounds.max.y || targetPosition.y-halfHeight <= roomBounds.bounds.min.y) {
        velocity.y = 0;
    } else {
        velocity.y = targetPosition.y - transform.position.y;
    }
    transform.position += velocity;
}
}

It works on a rudimentary level, but the problem is, whenever you're moving out from a wall after the camera's stopped, it snaps a little to the left or the right, and then goes back. Same vertically.

Any idea as to what might be causing this and how to solve it?

P.S. I know there have been a lot of threads about this kind of system (even one 21 hours ago), but none I've found helped me much.

sentences:
realtime multiplayer game database design I'm creating a real time client/server game, where each match is a 1v1. I'm a little lost as how to implement this. I want it to be viable for 1,000 simultaneous matches, but as I'm expecting around 100 db entries per match (I need to log players' past states), that would be a 100k row table.

I don't know if I should use an RDBMS that indexes the table by match ID, and if that would be fast enough.

I'm also contemplating using plain files with my own extension for each match, but that would be 1,000 of them on my machine, and I don't know if that would be too slow.

If anyone has any suggestions on how I can implement this, I'd really appreciate it.

sentences:
Javascript game to Phonegap for android game? me and a friend of mine are in the process of building a javascrip/HTML5 game and I'm running into a few questions about the process of using converting it to an android game. I plan on using Phone gap as it appears to be fairly simple and does what I'm looking for it to do. I've done a little research, but there is still a few questions I have about the whole process.

Can I run the app offline? I want to be able to post the app to app store and allow people to download and play offline. Given the fact there will be no server requests can I make the game function offline?
As I make the game for the computer I'm relying on the keyboard as input to move around. Obviously, once I port it to mobile this won't be practical. What is the easiest way to go about doing this? I'm considering simply changing the game to have a click on screen which moves the character to that location or even a simple movement pad in the corner of the screen. Would these on screen clicks change correctly over to mobile.
Lastly, what is the easiest way to handle save data. On the computer side I plan to use HTML5 local storage to store game data. Does this convert to mobile or is there a better way?

I appreciate any help in this matter.

sentences:
Multiple SpriteSheets break batching The problem: I can't fit all my 2d animation sprites for all units and environment in 1 spritesheet.

Everything batches fine until I use two spritesheets... I noticed the following : all units from spritesheet A batch fine until something needs to be rendered fom spritesheet B. so lets say from back to camera : 50units - tree -50 units - camera will result in 3 drawcalls... Not that bad but if you have: unit- tree - unit -tree -unit -tree ... like it's probably most of the time... this wil result in 100+ drawcalls even though you have only two spritesheets...

How can you solve this? Or better, how can i use two spritesheets and have only two drawcalls even though the sprites are at different distances to the camera

Hope this image helps to understand the problem:

1 : the trees are on spritesheet B and batch fine
2: the batching is broken as the unitsprite sits on spritesheet A and is put in between the trees...

sentences:
Bartle taxonomy formula Anyone knows the formula inside the Bartle Test of players taxonomy?

I need to do the test, but I need the weight of each question to make something more accurate and trustworthy to the real test...

Some links to the online test:

http://matthewbarr.co.uk/bartle/
http://4you2learn.com/bartle/

sentences:
Show 3D elements on 2D background I'll make a navigation menu in my game and had the good idee to this the enemies to start games or go to the gun store. The problem is when I look in game mode, the enemy named ZomBear in hierarchy and gun are away.

The ZomBear and the gun are 3D elements that I will show on a canvas named StartScreen in hierarchy. How Can I do that?

(Click on image to see full size)

Notes by the hierarchy:

Everything that begin whit Btn are button elements.
StartScreen, PlayButtons and LevelButtons is a panel
Gun and ZomBear are 3D elements form the Prefab folder.

Here you have also a screen from aside:

sentences:
How can I render primitives to pixel coordinates? I'll emphasize that I am very new to graphics programming. I've been using XNA up until now and I've been looking for a way to build simple 2D functionality with textured quads. I'm sort of starting to get how the whole process works, but the idea of positioning things from 0 to 1 doesn't seem quite right for what I'm doing. Is this the only way to do it? I've learned that I'm supposed to be rendering quads to an orthogonal projection, but I guess my problem is exactly how to implement that the correct way.

I totally acknowledge that my problems are a result of not understanding the technology, but all of the tutorials I can find tend to gloss over a lot of the details. Is there a simple way to set up an orthogonal projection in d3d11, and is there a simple way to convert the coordinates so I can specify it in pixels (like the XNA spritebatch)? I'm hoping that seeing the answer to this will help me get a more solid grasp on a lot of the areas where I'm confused in general with graphics programming.

sentences:
GLSL: How can I optimize this lighting (fragment) shader? Basic 2D game, 30+ light sources cause significant frame loss I am using a fragment shader to create circular light sources in my 2D game. Full code at the bottom.
Essentially, an array of light source objects (called Lights in the code) are passed into the shader in groups of 40. The shader runs through a for loop for each light source in the batch (up to four) and attenuates the brightness of that pixel based on how far away from the light source it is. If there are more than forty light sources, additional passes of this shader are done until all the light sources on the screen are processed. Limiting the lights per shader pass is done to limit how much data is pushed to the GPU at once (this is what the book I am reading is telling me to do) to improve performance.
It works fine, but I notice pretty dramatic frame rate loss when the number of light sources on the screen exceeds 30 or so. By the time I'm at 80 or 90 light sources, the frame rate is down to about 10 fps. Not cool.
Some questions:

What sticks out in the loop as the most expensive operations, and how can they be done better? I have been commenting out some of these I try to see what effect each line has. Is there a better way to do this? How do I profile a shader program? I am new to this. Any help would be appreciated.
As you can see, I am using an older version of GLSL because I am using macOS X (version 1.20). Would this shader work more efficiently on a different platform with a new version of OpenGL?
I'm considering the possibility that 30+ light sources is simply too much I need to seek a way to optimize the shading process outside of this shader loop. I am using a deferred rendering process, but I have read about how some games render lighting using a partition light sources into different regions. I.e., a light source only affects pixels within a region around it (that it could reasonably affect), so that you don't have to run a calculation for every single pixel on the screen for each light source. Kind of like doing a broad-phase pass for collision detection. How do 2D games typically handle many light sources?

#version 120
uniform sampler2D LastPass;
uniform sampler2D DiffuseMap;
uniform vec3 AmbientLight;
uniform int LightCount;
uniform int PassNumber;

struct LightInfo {
    vec3 position;
    vec3 color;
    float radius;
    float falloff;
};

const int MaxLights = 40;
uniform LightInfo Lights[MaxLights];

void main()
{
    vec4 pixel = texture2D(LastPass, gl_TexCoord[0].xy);
    vec4 diffusepixel = texture2D(DiffuseMap, gl_TexCoord[0].xy);

    vec4 finalPixel = gl_Color * pixel;

    for(int i = 0; i < LightCount; ++i) {

        LightInfo light = Lights[i];
        vec3 L = light.position - gl_FragCoord.xyz;
        float distance = length(L);
        float d = max(distance - light.radius, 0);
        L /= distance;
        // calculate basic light attenuation
        float attenuation = 1 / pow(d/light.radius + 1, 2);
        // scale and bias attenuation such that:
        //   attenuation == 0 at extent of max influence
        //   attenuation == 1 when d == 0
        attenuation = (attenuation - light.falloff) / (1 - light.falloff);
        attenuation = max(attenuation, 0);

        //This line runs VERY slow when there are many light sources.
        finalPixel += (diffusepixel * ((vec4(light.color, 0.4) * attenuation)));

    }
    gl_FragColor = finalPixel;

}

Thanks for any help.

sentences:
Are any 3D design skills required for game development? I am no graphics designer, but I'm a good developer with lots of experience. So, my question is the following:

Are any 3D design skills required for game development? If not, how does one write a game with 3D characters without having to design them?

sentences: Display Lists in OpenGL I heard that there was a faster method of displaying vertices, rather than recreating the GL_TRIANGLES, each time the scene is drawn. I thought I read somewhere that this method was  obselete. Why would the OpenGL group remove something that was faster? Even if it is obselete, how would I go about implementing this?

sentences:
Algorithm for optimal control on space ship using accelerometer input data Does someone have a good algorithm for controlling a space ship in a vertical shooter game using acceleration data?

I have done a simple algorithm, but works very badly. I save an initial acceleration value (used to calibrate the movement according to the user's initial position) and I do subtract it from the current acceleration so I get a "calibrated" value. The problem is that basing the movement solely on relative acceleration has an effect of loss of sensitivity: certain movements are independent from the initial position.

Would anyone be able to share a a better solution? I am wondering if I should use/integrate also inputs from gyroscope hardware.

Here is my sample of code for a Cocos2d iOS game:

- (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    if (calibrationLayer.visible){
        [self evaluateCalibration:acceleration];
        initialAccelleration=acceleration;
        return;
    }

    if([self evaluatePause]){
        return;
    }

    ShooterScene * shooterScene = (ShooterScene *) [self parent];
    ShipEntity *playerSprite = [shooterScene playerShip];

    float accellerationtSensitivity = 0.5f;

    UIAccelerationValue xAccelleration = acceleration.x - initialAccelleration.x;
    UIAccelerationValue yAccelleration = acceleration.y - initialAccelleration.y;

    if(xAccelleration > 0.05 || xAccelleration < -0.05) {
        [playerSprite setPosition:CGPointMake(playerSprite.position.x +  xAccelleration * 80, playerSprite.position.y + yAccelleration * 80)];
    }
    else if(yAccelleration > 0.05 || yAccelleration < -0.05)
    {
        [playerSprite setPosition:CGPointMake(playerSprite.position.x +  xAccelleration * 80, playerSprite.position.y + yAccelleration * 80)];
    }

}

sentences: Incentive for players to choose hard difficulty In a single-player game with difficulty settings, it seems obvious for players to choose the easy difficulty setting. How can I make incentives for players to choose harder difficulty settings?

sentences: How does Trine's lighting look so spectacular? Is there some kind of "special" lighting in this scene? I notice that the sun seems to "pop".

sentences:
Is it illegal to use a commercial song in your game (that you intend to sell) If I were to buy, say this song: http://www.youtube.com/watch?v=3fumBcKC6RE, strip/find/get the instrumental, and use that instrumental in a game I'm making, as a theme, say for a recurring boss fight, and then sell this game, would this be illegal?

This is hypothetically speaking.

sentences:
2D Platformer - Methods to Implement a Whip Weapon I hope posting here isn't a faux pax, if it is please feel free to direct me to the correct location. Or, if there is a thread that already covered this I would love to be pointed in its direction.

I've tried looking in quite a few different forums and I can't seem to find very much information about this. What I'm looking to do is implement a whip weapon for a character that's similar to that of Castlevania 4's whip.

I have no idea where to start. I'm really just looking for any information. Things like how to program it, the idea of how it was done in the game, really just anything to help me figure out how to make a whip like Castlevania 4.

I would appreciate any help. Thank you.

sentences:
Implementing debug "overlay" info This question is actually about GameEngine2D which is part of PSM SDK (for PlayStation Vita development), however as stated in documentation it's loosely based on cocos2d library. I hope that my question is generic enough to be answered by other cocos2d users, so that's why cocos2d tag. Feel free to check my question on Sony forum.

Basically I'm trying to implement "debug layer" functionality, i.e. if I press, for example, "Triangle" button some debug information (like FPS) would apper "above" current Scene.

Currently I've implemented it this way:

I have a DebugNode : Node class, that performs necessary drawing,
it's instance is created on app init, and reference is stored in a
"global-like" Game class.
On Trianle press I check Director.Instance.CurrentScene.Children, and if does not contain DebugNode instance add it, or remove otherwide (so it's a toggle).

It's working fine, but it have issue I don't like, on a scene switch new scene does not have DebugNode, and also I need to remove DebugNode from CurrentScene before scene change, because Node can't have multiple parents. The solution to this could be by having multiple DebugNode instances, but that is also solution I don't like.

I have 2 questions regarding this:
1. Is my approach to a task is generraly reasonable? Is it done if not the best way, but at least reasonable way?
2. How my approach could be improved, particularly in case of Scene switching?

sentences:
Is finding graph minors without single node pinch points possible? Is it possible to robustly find all the graph minors within an arbitrary node graph where the pinch points are generally not single nodes? I have read some other posts on here about how to break up your graph into a Hamiltonian cycle and then from that find the graph minors but it seems to be such an algorithm would require that each "room" had "doorways" consisting of single nodes.

To explain a bit more a visual aid is necessary. Lets say the nodes below are an example of the typical node graph. What I am looking for is a way to automatically find the different colored regions of the graph (or graph minors)

sentences:
How can I achieve this top-down water effect in Unity? I want to create a virtual fish pond similar to this in Unity (full video):

The ocean floor and fish are not a problem, but the effect of moving water that displaces the content below the surface is a mystery to me. I have googled and looked at the Unity asset store, but most water assets and questions are regarding more general oceans in 3D games, and not this type of top-down clear water effect. My research has led me to believe that the effect can be achieved with shaders, however I don't know much about shaders.

What I need:

Top-down clear transparent water, where the content below the water is displaced by the moving waves
The waves need to reflect light (highlights on the wave fronts)
Ripples in the water based on collision, so touches will create ripples in the water

How can I achieve this in Unity? Are there any existing assets / tutorials / open source projects that do this, or do I need to write my own shader for it? And if so, what components do I need to include in that shader?

sentences:
Measuring enemy "success" against player I've been toying with an idea for a game prototype where the player must defend against waves of enemies, but between each wave the enemies "evolve" to better combat whatever tactics the player is using. Essentially each enemy type has some genetic information that can be used to generate their health, speed, attack type and so on; with the more "successful" enemy types being mutated into new sub-types, while ineffective enemy types are phased out.

What I'm trying to figure out, is what is a good way of measuring "success" against the player?

EDIT: Although I don't really want to get too specific about the game mechanics, let's assume that the game world is complex enough that you cannot figure out if an enemy type will be effective against the player without testing it.

So far I've thought of two basic solutions:

Use heuristics like whether a certain
enemy deals damage to the player or survives a long time without
being killed.

The problem I have with this approach is that it can be exploited if (when) the player
figures out how the algorithm works. For example you would be able to
deliberately let the weakest enemies land a few free hits to trick
the game into creating more of them. It may be possible to improve this with better heuristics however.
Only use about half the pool of enemy types at once and
swap types in and out randomly between waves. Analysis could
then be performed on the player's performance throughout the wave and each participating enemy type would be considered equally successful/unsuccessful. After a number of waves the success of  enemy types would be varied enough to perform mutation/deletion.

This solution seems intuitively harder to exploit and it would also pick up on successful combinations of enemy types that might not be possible to detect by looking at individuals, however it might also result in anomalies where useless enemy types are considered successful because they happened to get assigned to waves with stronger enemy types backing them up.

To clarify, I'm not asking about the actual process of evolving enemies, just about how to measure which enemies are successful against the player.

sentences:
Entity System Texture Rendering Performance Java I use Artemis and LibGDX.
I have the following two components which manipulate a texture:

ComponentTexture // Stores the texture
ComponentSource // Define a region for the texture, that will only be
                  shown
ComponentSize // The size of the texture
ComponentMirror // Stores wether you want to flup on x and y axe
ComponentOrigin // The origin of the texture
ComponentPosition // The position of the texture
ComponentRotation // Rotation of the texture
ComponentScale // The scale of the texture

Than I have a System that requires the Texture and position component(Thats the minimum to draw a texture) and draw them to screen, before I render I check if it has some possible extra components.

@Override protected void process(Entity entity)
{
    final ComponentTexture  componentTexture    = mComponentTextureMapper.get(entity);
    final ComponentSource   componentSource     = mComponentSourceMapper.getSafe(entity);
    final ComponentSize     componentSize       = mComponentSizeMapper.getSafe(entity);
    final ComponentMirror   componentMirror     = mComponentMirrorMapper.getSafe(entity);
    final ComponentOrigin   componentOrigin     = mComponentOriginMapper.getSafe(entity);
    final ComponentPosition componentPosition   = mComponentPositionMapper.get(entity);
    final ComponentRotation componentRotation   = mComponentRotationMapper.getSafe(entity);
    final ComponentScale    componentScale      = mComponentScaleMapper.getSafe(entity);

    // Texture
    final Texture texture = componentTexture.getTexture();

    // Source
    final Rectangle source;
    if(componentSource == null)
    {
        source = new Rectangle(0, 0, texture.getWidth(), texture.getHeight());
    }
    else
    {
        source = componentSource.getSource();
    }

    // Size
    final Vector2 size;
    if(componentSize == null)
    {
        size = new Vector2(texture.getWidth(), texture.getHeight());
    }
    else
    {
        size = componentSize.getSize();
    }

    // Mirror
    final boolean mirrorX;
    final boolean mirrorY;
    if(componentMirror == null)
    {
        mirrorX = false;
        mirrorY = false;
    }
    else
    {
        mirrorX = componentMirror.isMirrorX();
        mirrorY = componentMirror.isMirrorY();
    }

    // Origin
    final Vector2 origin;
    if(componentOrigin == null)
    {
        origin = new Vector2(0, 0);
    }
    else
    {
        origin = componentOrigin.getOrigin();
    }

    // Position
    final Vector2 position = componentPosition.getPostion();

    // Rotation
    final float rotation;
    if(componentRotation == null)
    {
        rotation = 0;
    }
    else
    {
        rotation = componentRotation.getRotation();
    }

    // Scale
    final Vector2 scale;
    if(componentScale == null)
    {
        scale = new Vector2(1, 1);
    }
    else
    {
        scale = componentScale.getScale();
    }

    mSpriteBatch.draw(texture, position.x - origin.x, position.y - origin.y, origin.x, origin.y, size.x, size.y, scale.x, scale.y, rotation, (int) source.x, (int) source.y, (int) source.width, (int) source.height, mirrorX, mirrorY);
}

I can create 5000 Entities with textures and a small rotation animation.
I'm wondering about the efficiency of this method and how bad of a performance hit I will get from creating a lot of instances in the method.
I plan to optimize this.

Does anyone have a good idea as to how I can get better performance from drawing textures?

How I can avoid the check for every component that the entity has?

Thanks for reading :D

sentences:
How to achieve "concept art" graphics? I'm currently working on a 3D Game and I want a unique graphic style.

Concept Arts have a cool "painted" look. You can clearly see that this picture is painted on a graphic tablet.
(https://i.stack.imgur.com/pnyzB.jpg) - Source: Destiny Concept Arts

How can you achieve that kind of graphics?
I guess you draw the texture just like the concept art and apply a light cel-shader?

sentences:
Usage of render states in Direct3D 11.x? I know there are four different render states. They are

Blend State
Depth Stencil State
Rasterizer State
Sampler State

One of my Direct3D reference books say that Direct3D is a state machine.
But how, where do we use these in game development?

sentences:
What concepts are there for interactive water? I want water to be a gameplay object in my game. The player should be able to take in in a bucket and tip it out somewhere in the world. Water should flow in some way so that it can be used to build rivers and transport game objects or to create particular apparatuses. It's comparable to the game Minecraft where you can build cool things involving water or just create just some small waterfalls. However, there my game isn't made out of blocks so there is smooth terrain.

In most games water is simply placed at a given height. That works well for lakes and Oceans, but for flowing rivers and usage in apparatuses this concept is to limited. In Minecraft water is implemented as a block which spreads inside the blocky grid, too. That approach is a bit more what I need to realize my idea but I don't use these blocks and therefore such water simulation would look very misplaced.

What concepts of representing water which the player can interact with in the mentioned manners are there? How can I realize oceans, rivers, buckets and so on with one general approach? There shouldn't be an infinite amount of water. If you fill your bucket, the volume of the lake the water was taken from should decrease unnoticeable. Moreover if the player would place water somewhere that volume of water should never go missing.

sentences:
Google Play Game Services Detecting Top 3 Players I used Google Play Services Leaderboard in my Libgdx game. This is what I want to do; I would like to give awards to the best 3 players in this table. How can I help you?
It automatically connects to the Google Play Services Leaderboard and I can show players' information in the game.
Please help

sentences:
Rendering Problems(Artifacts, Flickering) with the Mirage Solo VR Headset Im getting some strange flickering artifacts when testing on device (Mirage solo), this problem occurs on Unity 2018.3.2 and Unity 2019.1.2. Its not happening on other devices such as the OculusGo, Google Pixel, Samsung s7,s9. It seems to be only occuring on devices that use Qualcomm Adreno 540 GPU. Has anyone else encountered anything like this if so, did you fix it and how? The Environment is using a custom shader, the robot character is simply using a unity standard shader and there is a hologram at the side(right) which is using a custom shader.

Hardware: Snapdragon 835 SoC Qualcomm Adreno 540 GPU

Video: https://streamable.com/

Screenshots:

Bad:

Good:

sentences:
How do I double-buffer renders to a JPanel? I'm trying to make a little breakout game with Java and Swing. The only issue so far is that drawing on the JPanel causes lots of flickering!

The relevant code:

JFrame frame = new JFrame("Breakout");
JPanel gameField = (JPanel) frame.getContentPane();

private void gameLoop() {
    while(running) {
        update();
        render((Graphics2D) gameField.getGraphics());
    }
}

private void render(Graphics2D g) {
    g.clearRect(0, 0, gameField.getWidth(), gameField.getHeight());
    for (GameObject o : objects) {
        o.draw(g);
    }
}

I've looked into manually double buffering (e.g. by making an offscreen Image, drawing on it, then doing g.drawImage(offscreen). Is there a better way?

sentences:
Basic pseudocode to create a rope physics I am trying to simulate the physics of a 2D hanging rope, consistent of a series of n-links. It could be a series of four pendulums. I just want some movement of the rope and the ability to contact with the ground. I was inspired by this question and this one.

I would like to programme it from zero in Python or a similar modelling program, but I don't find simple maths to recreate this effects. Which are the basic equations to escalate a series of n-links to resemble like a rope, please?

sentences: What is the difference between the marching cubes algorithm and metaballs? After doing some research, I found out about the marching cubes algorithm and "metaballs". How exactly do they differ?

sentences:
What are some standard stair dimensions for good level navigation? I am trying to establish some scale standards for a level. I have been following this guide: http://www.worldofleveldesign.com/categories/ue4/ue4-guide-to-scale-dimensions.php

So far I have walls at 3m high, doors at 2.1m by 1.1m, with the character standing at 1.82m by 0.6m. I am now trying to work out a "good" staircase size. I have tried the above guide's suggestion of 0.15m high by 0.3m deep for each step. To reach 3m however would require 20 steps with these dimensions, which means a single staircase would be 6m long! Visually this looks quite silly in my opinion. If I compare this to real life using the following calculator: http://www.calculator.net/stair-calculator.html,
using realistic step heights and depths the same staircase can be achieved at less than 4m length. This seems more realistic to me.

My main concern is not simply the visual appearance of the staircase, but how much space it will take up in a given building. If in each smaller building the staircase is taking up the majority of the floor space, this won't leave much for the more important elements. At the same time, I am concerned that if I make the staircase too steep it will have a negative effect on the gameplay and navigation. I understand that each level is different, however is there a good rule of thumb for getting started with this?

sentences:
What is the best way to display a cut scene? How do we show cutscene in the game? Currently I am using images and animation upon them to show cutscenes or story. I heard from my friend that showing a video might be one of the option too.
Is it a good option or is there any other option except those two? I'd also like to know pros and cons of each option if you can provide.

sentences:
HTML5 game fps render lag I am currently creating a flappyBird-like HTML5 game using Proccessing.js

You can see current work here: http://files.tips4design.com/flappySlothRelease/

The problem is that even though the FPS is 60+ (or constant) there is an obvious shuttering in rendering.

I have read a lot of game-loop articles to solve this issue, but neither with Processing.js draw loop, browser's requestAnimFrame nor constant delta-time the problem was solved.

Now I use the variable deltaTime approach and Processing.js default draw() loop.

delta = now - lastTime;
...
position = position + velocity * delta

I have been stuck for two days with this problem, and ca not really figure out how to fix the shuttering.

Any help would be greatly appreciated!

Thank you!

sentences:
SpriteBatch memory leak I have a strange problem with XNA 4. I'm constructing a SpriteBatch using this.spriteBatch = new SpriteBatch( GraphicsDevice );.
This leads to a memory leak up to 600 MB memory consumption.

This problem didn't exist two days ago.

I have a static class called Resources:

public static GraphicsDeviceManager gdm;

This gets set in the Game-constructor

public class Game : Microsoft.Xna.Framework.Game {
    public Game() {
        Resources.gdm = new GraphicsDeviceManager( this );
        Content.RootDirectory = "Content";
    }
}

In the Initialize-Method I'm creating a SpriteBatch in the Resources

protected override void Initialize() {
    base.Initialize();
    Resources.Game = this;
    Resources.spriteBatch = new SpriteBatch( GraphicsDevice );
}

At the point Resources.spriteBatch = new SpriteBatch( GraphicsDevice ); it allocates up to 600 MB memory.

Why is XNA allocating so much after I created a SpriteBatch? How can I fix it? (It worked two days ago and I didn't change anything that could cause this problem.)

sentences:
Material slot is reversed in unity when importing .blend file? I'm importing .blend file into unity. The file contains 9 separate objects. Now all objects have the same 2 materials assigned. When importing in unity one object's material slot is reversed. But in blender I set the slots correctly.

Slot in blender

Slot in unity

This is only happening for one object (Curve.076).
This is important for me as I am assigning the material from code to each slot.
Here's the .blend file if you want to look at it. Download

New Update:

Okay so playing with the object for some time I found that the problem is with only related to one face.
In the picture below see the white face between blue faces, if leave the face like this than the slot in unity is
not reversing. But if I assign the face to the inside.004 material than the slots are reversing.
I tried delete the face and again filling the area. But same result. I have to make the face same material as the upper
part to not get the problem, which I don't want. Only work arround I can use currently is that extruding the face little
forward and assinging the material to it, which is not very neat. I might be missing something as I am not very good at
blender.

Unity 2018.3.4f1

Blender 2.79b

sentences:
Problem with progress bar visibility I have a code with several elements. One of these elements I would like you to initiate hidden.

So I did, set for the progress bar to start hidden. It started to go wrong when and I was calling its visibility (bind) the same stopped starting hidden.

I did a test with this problematic progress bar and another one created on time:

The progress bar that has the visibility setting function appears even if I set it to start hidden:

As I said, I believe that this strange behavior is due solely and exclusively to the fact that there is such a function:

Even though I have created a boolean variable that imposes a condition, the bar insists on appearing:

The variable quoted initiates by default as false:

I thought the blame could be on the return knot, but as you can see in the fourth image, even putting "hidden", the progress bar appears anyway.

sentences:
In a semi-infinite procedural (chunk based) map, how do you handle objects larger than a single chunk? I'll use an example to try and be more specific. Assume this is for a 2D top-down game. Chunks in this are made up of 32x32 tiles.

If procedural buildings were to be generated based on some kind of noise algorithm and a building was typically 3x3 chunks in size, how do you ensure the seed for this map will always produce the same buildings?

Given two adjacent chunks: chunk A and chunk B, what if they both meet the noise algorithm's requirement for being a spawn point for a building?

If they are both far from the player's current view range, it could depend on how the player approaches these chunks as far as which one gets generated first.

My first thought was to only check for buildings every so many chunks, however, I'd also like to have some objects that may span tens of chunks. I don't think this is a proper solution.

Should I simply be using a different type of algorithm to identify where buildings should be able to be spawned at, an ever expanding Voronoi diagram as an example, or is there something else I'm just not considering with how I'm already trying to attempt this? Perhaps I should be handling cross chunk objects on a grander scale (like a collection of 32x32 chunks)?

Thanks!

sentences:
How to calculate reflection vector from point sprite sphere? So far I achieved building a cube map following this tutorial. Then I drew three points using glDrawArrays(GL_POINTS,0,3) and calculate the normals based on a sphere.

To compute the incoming light direction and hence the reflection vector I need the surface position. My questions are

Do I need view-space or world-space coordinates for each fragment?
How to compute the surface position for each fragment?
What's the difference between computing lighting in view-space vs. world-space?

Forgot to mention that this is the way I compute the Normal for the spheres

vec3 N;
N.xy = gl_PointCoord * 2.0f - 1.0f;
float mag = dot(N.xy,N.xy);
if(mag > 1.0f) discard;
N.z = sqrt(1.0f - mag);
N = normalize(N);

sentences:
Alternatives to Singletons / globals I've heard countless times about the pitfalls of Singletons / globals, and I understand why they're so often frowned upon.

What I don't understand is what the elegant, non-messy alternative is.  It seems that the alternative to using Singletons/globals always involves passing objects a million levels down through your engine objects until they reach the objects that need them.

For example, in my game, I preload some assets when the game starts up.  These assets aren't used until much later when the player navigates through the main menu and enters the game.  Am I supposed to pass this data from my Game object, to my ScreenManager object (despite the fact that only one Screen actually cares about this data), then to the appropriate Screen object, and anywhere else?

It just seems that I'm trading global state data for cluttered dependency injection, passing data to objects that don't even care about the data except for the purpose of passing it on to child objects.

Is this a case where a Singleton would be a good thing, or is there some elegant solution I'm missing?

sentences:
TileEntitySpecialRenderer only renders from certain angle I'm developing a Minecraft mod with Forge. I've added a tileentity and a custom renderer for it. The problem is: The block is only visible from sertain angles. I've compaed my code to other peoples code and it looks pretty much like them.

The block is opaque and not to be rendered and the renderer is registered normally so the fault must be in the renderer.

Here's the renderer code:

public class TERender extends TileEntitySpecialRenderer
{
    public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)d, (float)d1, (float)d2);
        HeatConductTileEntity TE = (HeatConductTileEntity)tileEntity;
        renderBlock(TE, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, mod.EMHeatConductor);
        GL11.glPopMatrix();
    }

    public void renderBlock(HeatConductTileEntity tl, World world, int i, int j, int k, Block block)
    {
        Tessellator tessellator = Tessellator.instance;
        GL11.glColor3f(1, 1, 1);
        tessellator.startDrawingQuads();
        tessellator.addVertex(0, 0, 0);
        tessellator.addVertex(1, 0, 0);
        tessellator.addVertex(1, 1, 0);
        tessellator.addVertex(0, 1, 0);
        tessellator.draw();
    }
}

sentences:
Relative movement in Box2D (keep object from falling off planet) I'm creating a game with planets orbiting around a sun, like this:
The brown square is the earth, rotating around its center and around the sun. The yellow square is the sun, which doesn't move.
Now imagine a player standing on the planet, the planet moves at a velocity of 20 m/s. How do I prevent the player from falling off? I have to give the perception to the player that the planet isn't moving.
I got the gravity on earth working, but I don't know how I can keep the player on the planet! I have thought about two solutions until now:

Just apply the angular velocity and linear velocity of the planet on the player (if it's in a specified radius), I think this method will cause jittery movement/glitches.

Create a separate Box2D world for the planet and render this Box2D world with the rotation/translation of the planet. This method is complex though since it would add the problem of moving bodies between different worlds if the player would leave the planet. This image explains it:

I think there is another (better) way to fix this problem, but I haven't found a solution yet.

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:
How do i play mp3 files in Unity Standalone? I am making a game in Unity in which the player can select music files in their hard drive to use them in-game. I use the WWW class to load the sound files, but this only works for OGG, WAV and Tracker files. I use the following code:

WWW www = new WWW ("file:///" + soundPath);
while(!www.isDone){
    yield return 0;
}
GetComponent<AudioSource> ().clip = www.GetAudioClip(false, true);

I want to play audio files in mp3 format, which is the most widely used format for music in general, but when i try to play them, this gets printed to the debug log:

  Streaming of 'mp3' is not supported on this platform.

How can i easily achieve mp3 playback on desktop?

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: How do I get antialiasing in LibGDX with the LWJGL3 backend? Updated to the LWJGL3 backend for LibGDX to for controller connect / disconnect functionality and access to geometry shaders and I'd rather not go back. There used to be a "samples" field in the LWJGLApplicationConfiguration object for setting antialiasing, but it no longer exists in LWJGL3ApplicationConfiguration. (Oh, and I'm only targeting Desktop)

sentences:
How to simulate a spinning helicopter rotor visual effect programatically? I decided to display an animation that conveys to the viewer that a narrow flat surface is spinning really fast(such as an helicopter's rotor blade). Does anyone have any experience in implementing this effect and could provide an implementation?
Please remember a rotor on video looks different than it does in real life.
I need to make the rotor look like it does in real life and not on video.

sentences:
Preventing overlap in OnCollisionEnter2D So I have successfully built a script that can determine the physics for a ball reflecting linearly off of walls, similar to pong, while the ball is using a kinematic rigidbody. The issue is when the ball hits the wall and the OnCollisionEnter2D is called, the ball has had it's position adjusted based on it's velocity such that it is phased inside the wall a tiny amount. My understanding is that this is necessary in order for the engine to recognize the collision. The ball seemingly reflects like normal, but in the uncommon event that the reflected angle allows the ball to travel while still having it's collider phased inside the wall, and the ball impacts a different surface of the wall, this 2nd impact will not result in the OnCollisionEnter2D call and the reflecting result, since technically the collider never left the wall in this time. This causes the ball to fly past the wall and off-screen.

I've tried many solutions to fix this, mainly making it so that before the bounce occurs but in the collision event, I would move the ball back to the precise location where the edge of the ball hit the edge of the wall. This would mean that the collider of the ball is in-bounds at all times and therefore no odd behavior as a result of overlapping would occur. I've yet to find a good method to do this, and I'm wondering if there is one that could be suggested to me or if there's a different solution entirely (which doesn't involve changing the ball's rigidbody from kinematic).

Below is the appropriate parts of the script I have written currently, as well as an image of what the game view looks like for visualization.

public class sword : MonoBehaviour {

public Rigidbody2D rb;
public CircleCollider2D coll;

public float speed;
public Vector2 trajectory;
public GameObject Player;

// Use this for initialization
void Start () {
    speed = 0.0f;
}

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.tag == "player")
    {
        transform.position = new Vector2(-1000, -1000);
        Player.GetComponent<movement>().equipped = true;
    }
    if (collision.gameObject.tag == "solid")
    {
        ContactPoint2D otherObject = collision.contacts[0];
        Vector2 normal = otherObject.normal;
        trajectory = Vector2.Reflect(trajectory, normal);

    }
}

private void FixedUpdate()
{
    //constantly calculating new velocity
    rb.velocity = speed * trajectory;
    speed = speed * 0.93f; //drag
    if (speed < 0.0001f)
    {
        speed = 0.0f;
    }
    if (speed > 1)
    {
        Physics2D.IgnoreCollision(Player.GetComponent<CircleCollider2D>(), coll, true);
    }
    else
    {
        Physics2D.IgnoreCollision(Player.GetComponent<CircleCollider2D>(), coll, false);
    }
}

}

More Details: The sword in this image is what acts like the ball. My speed variable is set from a separate script. Everything is on the default layer. The Rigidbody for the ball it is kinematic, and for the walls it is static. Trajectory is a Vector2 that corresponds with the angular direction of the ball.

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 can I draw an Xbox Live avatar? I want to replace the main character of my 2D game by an Xbox avatar. How can I do that?
How can I add an avatar to my project?
How can I draw an avatar?

For example, I draw my main character like that:

spriteBatch.Begin();
  spriteBatch.Draw(Main_Character,Main_Character_Position,Color.White);
spriteBatch.End();

What must be changed to draw an avatar?

sentences: What comes with Nintendo's DS SDK? Presumably a development machine for sure, but would it contain any sort of editor (of any kind)? Or are there any editors in existence that work with the SDK that are commercially available?

sentences:
Problem Rendering TTF_Font Textures to one Texture with SDL2 I'm trying to render multiple lines of text to one texture so I only have to render one texture to the screen. However, when I use a dstrect argument in SDL_RenderCopy the text doesn't show up and when I use NULL for the dstrect argument it does work, but it is stretch to the entire texture which I don't want. I've checked the values of the dstrect (x,y,w,h) and they all seem to be at the right values when I try to render.

Here is the creation of the "Font Texture"

void Font::setMessage(std::string textureMessage, SDL_Color textColour){

if(text != NULL){
    SDL_DestroyTexture( text );
    text = NULL;
}

//contents is a string
contents = textureMessage;

//Render text surface
SDL_Surface* loadedSurface = TTF_RenderText_Blended( fontType, contents.c_str(), textColour );

if( loadedSurface == NULL ){
    std::cout << TTF_GetError() << std::endl;
}

if( loadedSurface == NULL ){
    //Error Check
    std::cout << "COULDN'T RENDER TEXT." << std::endl;
}
else
{

    //Create texture from surface pixels
    //text is of type SDL_Texture
    text = SDL_CreateTextureFromSurface( rendererPtr, loadedSurface );
    if( text == NULL ){
        //Error Check
        std::cout << "COULDN'T LOAD FONT TO TEXTURE." << SDL_GetError() << std::endl;
    }
    else{
        //w and h are int pointers to the SDL_Rect "textBox" offsets
        w = &textBox.w;
        h = &textBox.h;
        if( TTF_SizeText(fontType, contents.c_str(), w, h) != 0){
            std::cout << "COULDN'T SIZE FONT." << SDL_GetError() << std::endl;
        }
    }

}

//Get rid of old loaded surface
SDL_FreeSurface( loadedSurface );
loadedSurface = NULL;

}

And here is where I'm trying to render it to another texture:

    dstRect->x = xTemp;
    dstRect->y = yTemp;
    dstRect->w = messageLog.at(placeCount)->getW();
    dstRect->h = messageLog.at(placeCount)->getH();

    std::cout << dstRect->x << " " << dstRect->y << " " << dstRect->w << " " << dstRect->h << std::endl;

    if (messageLog.at(placeCount)->getSelf() != NULL){
        if ( SDL_RenderCopy(rendererPtr, messageLog.at(placeCount)->getSelf(), NULL, dstRect) != 0){
            std::cout << SDL_GetError() << std::endl;
        }
    }

Any ideas why giving an argument would make it not work but using NULL would?

sentences:
In Socket.IO, should I use JSON for communication between server and client? I'm building an MMO with Socket.IO and Node.js. It works quite fast (though I don't have 1000 players yet) but my feeling is that it's not very optimized. JSON is super cool and easy to use within Socket.IO but when I see a broadcast from the server (1 player connected):

   debug - websocket writing 5:::{"name":"snapshot","args":[{"players":[{"id":1,
"tx":-5.62,"y":23.74,"tz":-5.64,"tRotY":0,"tSpeed":0}]}]}

I take it all the variable name are broadcast as well. Isn't that a huge overhead? Wouldn't it be better if I glued all data together using delimiters like this?

1;-5.62;23.74;-5.64;0;0

The disadvantage here would be that I have to split the string each time I receive it. But isn't that much better for latency?

sentences:
Wrong faces culled in OpenGL when drawing a rectangular prism I'm trying to learn opengl. I did some code for building a rectangular prism. I don't want to draw back faces so I used glCullFace(GL_BACK), glEnable(GL_CULL_FACE);. But I keep getting back faces also when viewing from front and also sometimes when rotating sides are vanishing. Can someone point me in right direction?

glPolygonMode(GL_FRONT,GL_LINE); // draw wireframe polygons
glColor3f(0,1,0); // set color green
glCullFace(GL_BACK); // don't draw back faces
glEnable(GL_CULL_FACE); // don't draw back faces
glTranslatef(-10, 1, 0); // position

     glBegin(GL_QUADS);

     // face 1
     glVertex3f(0,-1,0);
     glVertex3f(0,-1,2);
     glVertex3f(2,-1,2);
     glVertex3f(2,-1,0);

     // face 2
     glVertex3f(2,-1,2);
     glVertex3f(2,-1,0);
     glVertex3f(2,5,0);
     glVertex3f(2,5,2);

     // face 3
     glVertex3f(0,5,0);
     glVertex3f(0,5,2);
     glVertex3f(2,5,2);
     glVertex3f(2,5,0);

     // face 4
     glVertex3f(0,-1,2);
     glVertex3f(2,-1,2);
     glVertex3f(2,5,2);
     glVertex3f(0,5,2);

     // face 5
     glVertex3f(0,-1,2);
     glVertex3f(0,-1,0);
     glVertex3f(0,5,0);
     glVertex3f(0,5,2);

     // face 6
     glVertex3f(0,-1,0);
     glVertex3f(2,-1,0);
     glVertex3f(2,5,0);
     glVertex3f(0,5,0);

     glEnd();

sentences:
How should I handle animation state systems in derived classes? I'm trying to get some kind of state system for my game objects.

I have a base Actor class that is derived by classes like Policeman, Informant or Brawler. Each of those classes describes different functionality, but I want as much of the functionality to be shared.

On of those is animation system. Each class has their own states (for example Policeman has Walking, Shouting and Shooting, while Informant has Idle and Whispering).

What is the best way of handling such states? Do I have the Actor class have something like

enum ActorState
{
state1,
state2,
state3,
...
}

And just map each behaviour of appropriate actor (Policeman, Informant, etc) to ActorState, so that the rendering system of ActorState can take over?

Or maybe is there some better solution that people use.

Game is 2D, sprite based, and I'm using Unity3D system, with Actor being a component to GameObjects.

sentences:
How to create a texture2d from an array of pixels in DirectX11 I currently have a ray-casting camera that holds an array of pixel colors (XMFLOAT4 color) that is 1024x768.

I am trying to create a Texture2D in DirectX11 that is also 1024x768 and simply copy over the pixels to the texture. I then want to apply the texture to a fullscreen quad to essentially display what geometry my rays are intersecting with.

    D3D11_TEXTURE2D_DESC textureDesc = { 0 };
    textureDesc.Width = 1024;
    textureDesc.Height = 768;
    textureDesc.MipLevels = 1;
    textureDesc.ArraySize = 1;
    textureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
    textureDesc.SampleDesc.Count = 1;
    textureDesc.SampleDesc.Quality = 0;
    textureDesc.Usage = D3D11_USAGE_DEFAULT;

    ID3D11Texture2D* fullScreenTexture = nullptr;
    ThrowIfFailed(mGame->Direct3DDevice()->CreateTexture2D(&textureDesc, nullptr, &fullScreenTexture), "ID3D11Device::CreateTexture2D() failed.");

Assuming I have XMFLOAT4 pixels[1024][768]; //Filled in appropriately with colors.

I'm not sure where/how I would take my pixel data and apply it to the texture. Any help would be greatly appreciated.

sentences:
How can I customize scrollbar sensitivity in editor property drawers in Unity3D? A custom property drawer, in my Unity 2017.3 project, has code like this in its OnGUI implementation:

public void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
    ...
    EditorGUI.BeginDisabledGroup(maxX == 0);
    scrollX = (uint)GUI.HorizontalScrollbar(new Rect(xyPos + new Vector2(slHeight, normalizedSize), new Vector2(normalizedSize, slHeight)), scrollX, 1, 0, maxX + 1, GUI.skin.horizontalScrollbar);
    EditorGUI.EndDisabledGroup();
    EditorGUI.BeginDisabledGroup(maxY == 0);
    scrollY = (uint)GUI.VerticalScrollbar(new Rect(xyPos, new Vector2(slHeight, normalizedSize)), scrollY, 1, maxY + 1, 0, GUI.skin.verticalScrollbar);
    EditorGUI.EndDisabledGroup();
    ...
}

But these scrollbars have a sensitivity of 10 (pressing the up/down, or left/right, buttons will change the current value by 10 in the respective direction). I need them to have a sensitivity of 1. How can I do it?

sentences:
Separate shaders from HTML file in WebGL I'm ramping up on WebGL and was wondering what is the best way to specify my vertex and fragment shaders.

Looking at some tutorials, the shaders are embedded directly in the HTML. (And referenced via an ID.) For example:

<script id="shader_1-fs" type="x-shader/x-fragment">
  precision highp float;
  void main(void) {
    // ...
  }
</script>

<script id="shader_1-vs" type="x-shader/x-vertex">
  attribute vec3 aVertexPosition;

  uniform mat4 uMVMatrix;
  // ...

My question is, is it possible to have my shaders referenced in a separate file? (Ideally as plain text.) I presume this is straight forward in JavaScript. Is there essentially a way to do this:

var shaderText = LoadRemoteFileOnSever('/shaders/shader_1.txt');

sentences:
Load scene without being in build settings and without using AssetBundle This is the closest I've gotten:

    EditorSceneManager.OpenScene(
        AssetDatabase.GUIDToAssetPath(
            AssetDatabase.FindAssets(
                "t:SceneAsset " + MenuSceneName,
                new string[] { "Assets" }
            )[0]
        )
    );

However this generates an error at runtime:

InvalidOperationException: This cannot be used during play mode, please use SceneManager.LoadScene()/SceneManager.LoadSceneAsync() instead.

I can't follow its suggestion because those functions require the scene to be in build settings or an asset bundle. So, is there any other option?

I wonder how (and if) Addressables achieve this? Note: I'm not willing to switch to Addressables - I'm quite enjoying working with AssetBundles.

Why?

My game uses AssetBundles for general loading of EVERYTHING, so there's only one blank scene in build settings. However, during development I'd rather not have to continuously build and load from AssetBundles, so I'm trying to dynamically load scenes WITHOUT having to add them to build settings.

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:
Collision Resolution of Axis-Aligned Bounding Boxes that Change Size I am developing an action platformer in Python, with Pygame. That said, my question is a general one about collision resolution strategies.

I use an axis-aligned bounding box for the purposes of collision detection. The bounding box changes sizes depending on the sprite's action and the frame of the action's animation.

When I update my sprite's position, I first update the y-coordinate, check for and resolve collision in the y-direction, then do the same for the x-coordinate. When I resolve collision, I simply move the bounding rect's sides to align flush with the appropriate walls.

Because the bounding rect changes sizes throughout my animations, I am noticing buggy behavior in certain situations when the frame moves from a smaller one to a larger one. The change of frame results in the sprite intersecting a wall and his position is resolved such that he falls off the map.

Here is a diagram illustrating the problem:

It doesn't matter whether I resolve in the x-direction or the y-direction first. They result in reciprocal buggy behavior when the next frame is wider or taller, respectively.

My question concerns general collision resolution strategies for axis-aligned bounding boxes that change size and shape. What are the best algorithms for collision resolution that avoid this issue?

Here are some of the functions and values I have access to:

colliderect -- tests if two rectangles collide
collidepoint -- boolean that tests if a point collides with a rectangle
rect.topleft, rect.topright, rect.bottomleft, rect.bottomright, rect.center,
rect.centerx, rect.centery -- various points on the rectangles
rect.left, rect.right, rect.top, rect.bottom -- values for the sides
of the rects
various vectors
in short, the usual stuff

Apologies if this question is a dupe. I imagine it is a pretty common one, though I couldn't find anything that helped me specifically.

sentences:
What is the difference between engine approach and language approach in terms of saving game data? I was asked to find a way to somehow save gamedata for a game we (my friends and I) are making and i found that there is something called engine and language approach. I have found something i would call language approach because it relies mostly on System libs but cannot find anything on the engine approach. Are scriptable objects the way of saving data by engine approach ? if so how do i combine them in one savefile ?
Game engine we are using is Unity and we're writing code in C#.

sentences:
Unity's 'Ambient' Occlusion occludes everything. How to do it better? I'm experimenting with custom AO solutions for Unity. While looking at the source for their built-in SSAO effect, I noticed the shader is doing this:

half ao = tex2D (_SSAO, i.uv[1]).r;
ao = pow (ao, _Params.w);
c.rgb *= ao;

So basically it's darkening the whole image as a post-process where the AO term is <1, specular and diffuse components included. I'd like my version to only attenuate the ambient component while leaving the direct lighting untouched.

So how to go about this? One option would be to go to the full on deferred renderer (not legacy light pre-pass), compute the AO texture after the G-buffer pass, and incorporate it into a custom shader to do the final lighting pass. But are there simpler options that would work with light pre-pass or even forward rendering?

sentences:
Optimizing Collision Detection in a 2D Game I am optimizing my "little" Java (LibGDX) shooter game, and perhaps unsurprisingly, collision detection is a "bottleneck"; I've kind of reached my performance goals already, but I want to tweak the game anyways.

Every monster in the game can collide with every other monster + friendly bullets.
The game is a single-screen shooter. I am using a QuadTree.

In my Sprite/Entity-class, I have a method:

public boolean canCollideWith(Sprite s) {
    return true;
}

This method is called twice in a loop within a loop, meaning that when enough Sprites are added, it gets called a lot. It shows up as a high HotSpot in VisualVM.

I override the method in various sub-classes, e.g. in the Bullet-class:

@Override
public boolean canCollideWith(Entity e) {
    if (friendly) {
        return (e instanceof Monster && !(e instanceof Player))
                        || e instanceof Missile;
    }
    else
        return e instanceof Player || e instanceof Warp;
}

...and in the Monster-class:

public boolean canCollideWith(Entity e) {
    return e instanceof Bullet && ((Bullet) e).isFriendly() || e instanceof Monster || e instanceof Tagger || e instanceof Flower || e instanceof Shockwave;
}

I don't really like these instanceof's in the first place... what would be an elegant and a fast solution to optimize this (hopefully both :)?

Excluding the QuadTree part, here's my whole collision detection method:

public static void collisionDetection(Array<? extends Sprite> sprites) {
        for (int i = 0; i < sprites.size; i++) {

            Sprite s1 = sprites.get(i);

            if (!s1.isCollidable()) continue;

            for (int k = i + 1; k < sprites.size; k++) {

                Sprite s2 = sprites.get(k);

                if (s1 == s2) continue;

                if (!s2.isCollidable()) continue;

                if (!s1.canCollideWith(s2)) continue;
                if (!s2.canCollideWith(s1)) continue;

                boolean intersects = s1.intersects(s2);

                if (intersects) {
                    s1.fireIntersectionEvent(s2);
                    s2.fireIntersectionEvent(s1);

                    s1.intersectsWith(s2);
                    s2.intersectsWith(s1);
                }
            }
        }
    }

Thanks for any ideas.

sentences:
Unity ECS: How do I stop an entity from spawning twice? I am implementing a flight dynamics model using Unity's built-in ECS package, Entities, and I keep running into one particular issue where the aircraft I'm trying to spawn gets converted into an entity twice.
Essentially, I have a singleton Monobehaviour that handles setting up the aircraft entity from a GameObject Prefab. Here's the script:
public class GameManager : MonoBehaviour
{

    private BlobAssetStore blobAssetStore;

    public static GameManager main;

    public GameObject planePrefab;

    public float zBound = 0.0f;
    public float throttleMaxBound = 1.0f;
    public float alphaMaxBound = 20.0f;
    public float bankMaxBound = 20.0f;
    public float flapMaxBound = 40.0f;
    public float throttleMinBound = 0.0f;
    public float alphaMinBound = 0.0f;
    public float bankMinBound = -20.0f;
    public float flapMinBound = 0.0f;

    public State state;
    public Properties prop;

    Entity planeEntityPrefab;
    EntityManager manager;

    private void Awake()
    {
        if (main != null && main != this)
        {
            Destroy(gameObject);
            return;
        }

        main = this;

        manager = World.DefaultGameObjectInjectionWorld.EntityManager;

        blobAssetStore = new BlobAssetStore();

        GameObjectConversionSettings settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, blobAssetStore);
        planeEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(planePrefab, settings);

        SpawnEntity();
    }

    private void OnDestroy()
    {
        blobAssetStore.Dispose();
    }

    void SpawnEntity()
    {
        Entity plane = manager.Instantiate(planeEntityPrefab);

        prop = new Properties(
            16.2f,
            10.9f,
            2.0f,
            0.0889f,        // slope of Cl-alpha curve
            0.178f,         // intercept of Cl-alpha curve
            -0.1f,          // post-stall slope of Cl-alpha curve
            3.2f,           // post-stall intercept of Cl-alpha curve
            16.0f,          // alpha when Cl=Clmax
            0.034f,         // parasite drag coefficient
            0.77f,          // induced drag efficiency coefficient
            1114.0f,
            119310.0f,
            40.0f,          // revolutions per second
            1.905f,
            1.83f,          //  propeller efficiency coefficient
            -1.32f          //  propeller efficiency coefficient
            );

        state = new State(
            0.0f,           // time
            0.0f,           // ODE results
            0.0f,
            0.0f,
            0.0f,
            0.0f,
            0.0f,
            0.0f,           // roll angle
            4.0f,           // pitch angle
            0.0f,           // throttle percentage
            0.0f            // flap deflection
            );

        float3 position = new float3(state.q1, state.q3, state.q5);

        manager.SetComponentData(plane, new Translation { Value = position });
    }

}

After a little bit of commenting here and there, I was able to determine that the following two lines are responsible for creating two separate entities, though the latter is the only one I'm capable of manipulating using the system. It's also worth mentioning that these two entities are virtually identical in the Entity Debugger, except for the fact that the first entity contains the "prefab" tag.
planeEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(planePrefab, settings);

and...
Entity plane = manager.Instantiate(planeEntityPrefab);

Is there a way to spawn this entity without both showing up in the debugger or is this unavoidable? If not, is there a way to remove the entity with the "prefab" tag from the world?
Thanks! :)

sentences: Best way to load multiple TextureRegion from multiple bitmaps in AndEngine I've seen a lot of examples of AndEngine usage where some bitmaps are mapped into some TextureRegions and loaded into an Atlas. But what if I have a lot of bitmaps, where each bitmap is a sprite sheet, with several sprites for a given entity? How can I extract multiple texture regions from each bitmap and load all that into a single Atlas?

sentences:
How to create scene template? I'm creating a game with Unity 3D, where has many levels, and I want create a button in all levels, to back to level menu.

Is possible can I create a "scene template" where I can only change one time, and all level scenes inherit template changes?

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:
Ultimate beginner's tutorial to 3d game dev using XNA Framework? I'm looking for a tutorial that starts at square 1 for game development and moves up through intermediate/expert levels of 3D game development. I really want to get into 3D game dev and I've been trying to for awhile in my free time, but I know so little at times that I'm not even sure what terminology to use in order to phrase a question properly.

Ideally, I'm hoping to find tutorials for the XNA Framework, what little experience I have is XNA.

I've been developing for years and don't really need help with the language. What I know I need help on is stuff like rendering, what exactly a Matrix represents, and other things in the framework's library. I don't even know what all is available in the library.

sentences:
Which Unreal Engine 4 project files can I ignore in source control? I want to put an Unreal Engine 4 project under source control with git. (I know the editor has Perforce and Subversion support, but I don't care for those.)

What folder and files do I include in the repository and which can I ignore?

The way I see it, the following is needed: Config, Content, Source, *.sln, *.uproject

Things that I can ignore: Binaries, DerivedDataCache, Intermediate, Saved, *.suo, *.sdf, *.opensdf

Is this correct?

sentences:
Proper way to use a RenderTarget2D to draw multiple textures? In the process of trying to resolve a split screen issue, I've been trying to use a RenderTarget2D to draw a portion of my scene to a Texture2D, and then again to another Texture2D, but the end result of both Texture2D's is coming out the same. Can anybody tell me what I'm doing wrong?

Texture2D camera1Render;
Texture2D camera2Render;

                GraphicsDevice.SetRenderTarget(RenderTarget);
                GraphicsDevice.Clear(Color.Transparent);

                map.Draw(mapDisplayDevice, Camera1, new Location(0, 0), false);

                camera1Render = RenderTarget;

                GraphicsDevice.Clear(Color.Transparent);

                map.Draw(mapDisplayDevice, Camera2, new Location(0, 0), false);

                camera2Render = RenderTarget;

                SetRenderTarget(null);

sentences:
Pokémon character turning / facing: How is it achieved? Movement is already done though You know that when the player playing Pokémon games want to change the facing of the main character, one would simply tap on the directional pad (D-pad) on the Game Boy (Color/Advanced/Advanced SP) or Nintendo DS systems, and the character would just turn towards the general direction the player wants to turn to.

As far as I know, the turning mechanics from Pokémon Gold/Silver/Crystal is also combined with the movement mechanics from Pokémon Red/Blue/Yellow, which the latter (movement mechanics) is successfully implemented in Java, shown below.

Movement mechanic:

package entity;

import level.BaseWorld;
import main.Keys;
import resources.Art;
import screen.BaseScreen;

public class TestEntity extends Entity {

    public Keys keys;
    int facing = 0;
    int turning = 0;
    int xPosition;
    int yPosition;

    int xAccel;
    int yAccel;

    boolean lockWalking;
    boolean lockTurning;
    int turningTick = 4;

    public TestEntity(Keys keys) {
        this.keys = keys;
    }

    @Override
    public void initialize(BaseWorld world) {
    }

    @Override
    public void tick() {
        if (!lockTurning) {
            if (keys.up.isDown) {
                turning = 2;
                lockTurning = true;
            }
            else if (keys.down.isDown) {
                turning = 0;
                lockTurning = true;
            }
            else if (keys.left.isDown) {
                turning = 1;
                lockTurning = true;
            }
            else if (keys.right.isDown) {
                turning = 3;
                lockTurning = true;
            }
        }
        if (!lockWalking && turningTick < 0) {
            if (keys.up.isDown) {
                facing = 2;
                yAccel--;
                lockWalking = true;
            }
            else if (keys.down.isDown) {
                facing = 0;
                yAccel++;
                lockWalking = true;
            }
            else if (keys.left.isDown) {
                facing = 1;
                xAccel--;
                lockWalking = true;
            }
            else if (keys.right.isDown) {
                facing = 3;
                xAccel++;
                lockWalking = true;
            }
            if (turningTick < -5)
                lockTurning = false;
        }
        handleMovement();
        turningTick--;
    }

    @Override
    public void render(BaseScreen screen) {
        screen.blit(Art.player[facing][0], xPosition, yPosition, 16, 16);
    }

    //-----------------------------------
    //Private methods

    private void handleMovement() {
        if (lockTurning) {
            facing = turning;
        }
        if (lockWalking) {
            xPosition += xAccel;
            yPosition += yAccel;
        }
        if (xPosition % 16 == 0 && yPosition % 16 == 0) {
            lockWalking = false;
            xAccel = 0;
            yAccel = 0;
        }
    }
}

The movement mechanics I have implemented as of now DOES NOT contain codes that rely on System.currentTimeMillis() or System.nanoTime(), which means it's not elapsed-time-based. Rather, it relies on current-states via fixed game ticks, which is prominent during the Game Boy era.

Unfortunately, it contains a side effect where if the player were to press multiple keys on the D-pad, it will cause the character to turn while it's moving. I can remove only the turning mechanics from the mixed mechanism above, and would obtain the movement mechanics that were used only in Pokémon Red / Blue, Generation 1 games.

However, I would like to use the movement + turning mechanics used from Pokémon Gold/Silver/Crystal, Generation 2 and above.

Could someone suggest an idea / tip / hint / solution for this problem?

You may also use the codes given above to your likings, just make sure to change stuffs a bit while you're at it.

sentences:
Synchronizing clients with a server and with each other What is the best way for keeping all clients synchronized with a server and with each other?

Currently, we have two approaches in mind:

When a client sends something to the server, the server immediately sends out messages to all clients, which react immediately.
Introducing some time delay, whereby the server sends out messages to all clients, with the directive, "act upon this at time t.

The second approach seems like it would more likely keep the clients all in better synchronization (since it caters for some degree of lag); but I wonder whether responsiveness would be lost to too high a degree (i.e. the user clicks 'jump' and there is a noticeable gap between pressing the button and actually jumping).

There is also the possibility of having clients calculate their own position (and not wait for servers to say "you have jumped"); but because of the inevitable lag, clients would get very out-of-sync.

Then there's the whole TCP vs. UDP question; because we want it fast, but I'd also hate for the server to say you're in a completely different location than you thought you were.

With all of these competing demands, it all gets very uncertain how we should approach this issue. Which of these approaches (or any other) would be best for keeping clients and server all in sync? Which ones are actually used in the industry?

sentences:
Unity Light Baking for Best Balance between Performance and Visuals I'm trying to optimize my Unity game.

I have static objects, dynamic objects and (only) static lights. I wish to fully pre-compute lighting and shadows for the static objects while still maintaining realtime lighting and shadows for dynamic objects, and making them work together seamlessly.

From the documentation:

Realtime: "Unity calculates and updates the lighting of Realtime Lights every frame during run time. No Realtime Lights are precomputed." So, If I set it to realtime, I'm not really optimizing anything, am I?
Mixed: "Unity can calculate some properties of Mixed Lights during run time, but only within strong limitations. Some Mixed Lights are precomputed." It's unclear what "some properties" are and what would the consequences be.
Baked: "Unity pre-calculates the illumination from Baked Lights before run time, and does not include them in any run-time lighting calculations. All Baked Lights are precomputed." This will work for static objects. However, dynamic objects will look as if there are no lights in the scene.

From what I see, Mixed would be what I need, but I would still have to adjust its sub-modes in the Lighting window which is non-trivial for me:

Subtractive: Its description suggests it would solve all my problems and still be a nice optimization. However, static objects don't seem to receive dynamic objects' shadows or the other way around either.
Baked Indirect, or Shadowmask: Does not seem to pre-compute direct lighting for static objects, throwing away performance gains.

The final question is: what method will lead me to the best performance in Unity with these requirements:

There are static and dynamic objects that both need to be lit by direct lighting
Both static and dynamic objects should be able to cast and receive shadows from each other
All lights are static
Indirect lighting is not important in this case

sentences:
How can I adjust the speed my character jumps at? I've applied this method How to make a character jump?, like:

  let wallForce = 0;
  const targetVx = -gravity * 4.0;
  const updatePos = delta => {
    const dt = delta * 0.01;

    const oldY = hero.y;

    hero.vy += wallForce * dt;
    hero.vy += gravity * dt;

    hero.x += hero.vx * dt;
    hero.y += hero.vy * dt;

    updateCollisionsBetween(oldY, hero.y);

    hero.vx += (targetVx - hero.vx) * dt;

    wallForce = 0;
  };

and on jump:

  let doubleJump = 0;
  const jump = delta => {
    wallForce = 0;
    hero.vy = -hero.jumpVy;
    if (doubleJump === 1) {
      hero.vx *= 2;
    }
  };

I want to speed up the jumps, that is I want the hero to jump and land faster. If I give a higher negative velocity on the jump (eg. hero.vy = -hero.jumpVy * 2.0), then the hero jumps higher but its speed doesn't change.

sentences:
Programmatically placing objects along Polygon Collider 2D In my game, I have Tiled "rooms" that were imported with Tiled2Unity.  All of these rooms have walls that are defined by Polygon Collider 2D objects.  In the event of a cave or dungeon, I'd like to implement torches.  Currently, I literally randomly place torches in each room, which is pretty good for lighting, but looks ridiculous.

After the room is added, rather than randomly place torches anywhere, I'd like to have them placed along the inside of the collider.  Is there a good way to make this happen?

Edit:

One of my first attempts was to get a list of all of the points in all colliders in a given room after it's instantiation.  I was starting with something like this.

GameObject _roomGO =
   (GameObject)Instantiate(_room.gameObject, new Vector3 (-6.5f, 6.5f, 0f), Quaternion.identity);

List<PolygonCollider2D> _polyList =
   _roomGO.GetComponentsInChildren<PolygonCollider2D>().ToList();

However, this only gets the points from the first collider, whereas I need the points for all colliders in the room GameObject.  Additionally, I'm not sure how those points are stored in such a way that I could create a List or Array of lines, then evaluate those lines to determine which are inside the room (as opposed to along the outside, so nothing in the set [(x,0),(x,-13),(0,y),(13,y)].

Once I had a list of lines that weren't part of that set, I could choose a point on the line and drop in a torch.

Edit2 - images:

Edit 3:

Thank to @SP., I've used some of his code as shown here:

        if (_torches)
    {
        Transform _roomGOLayer = _roomGO.transform;
        int numTorch = rndObjects.Next(2,4);

        List<PolygonCollider2D> _polyList = _roomGO.GetComponentsInChildren<PolygonCollider2D>().ToList();

        foreach (PolygonCollider2D polCol in _polyList)
        {
            foreach (Vector2 point in polCol.GetPath(0))
            {
                Debug.Log(point.x +" : "+ point.y);//you will be using these values

                GameObject _to = Instantiate(_torch, new Vector2(point.x, point.y), Quaternion.identity) as GameObject;
                _to.transform.parent = _roomGOLayer;
                _to.transform.position = _to.transform.parent.transform.position + new Vector3 (point.x, point.y, 0f);
            }
        }
    }

The biggest problem I'm having up front is that _polyList is only getting the first collider definition.  I think if I could solve that, I'd be in good shape.

sentences:
OpenGL - Stack overflow if I do, Stack underflow if I don't! I'm in a multimedia class in college, and we're "learning" OpenGL as part of the class. I'm trying to figure out how the OpenGL camera vs. modelview works, and so I found this example. I'm trying to port the example to Python using the OpenGL bindings - it starts up OpenGL much faster, so for testing purposes it's a lot nicer - but I keep running into a stack overflow error with the glPushMatrix in this code:

  def cube():
      for x in xrange(10):
          glPushMatrix()
          glTranslated(-positionx[x + 1] * 10, 0, -positionz[x + 1] * 10); #translate the cube
          glutSolidCube(2); #draw the cube
          glPopMatrix();

According to this reference, that happens when the matrix stack is full.

So I thought, "well, if it's full, let me just pop the matrix off the top of the stack, and there will be room". I modified the code to:

  def cube():
      glPopMatrix()
      for x in xrange(10):
          glPushMatrix()
          glTranslated(-positionx[x + 1] * 10, 0, -positionz[x + 1] * 10); #translate the cube
          glutSolidCube(2); #draw the cube
          glPopMatrix();

And now I get a buffer underflow error - which apparently happens when the stack has only one matrix.

So am I just waaay off base in my understanding? Or is there some way to increase the matrix stack size?

Also, if anyone has some good (online) references (examples, etc.) for understanding how the camera/model matrices work together, I would sincerely appreciate them!

Thanks!

EDIT:

Here is the pastebin of the full code: http://pastebin.com/QXxNisuA

sentences:
Cross platform low level graphic API When creating a system abstraction is better to have the platform different APIs hidden by a common interface at the lowest level that makes sense.

Taking in account the different modern (with no fixed function pipeline) native graphics APIs: OpenGLES 2.0+, OpengGL 3.0+, DirectX 10.0+, Xbox DirectX 9, LibGCM

If one was to create a stateless low level graphic API to sit on top of them all, what would be the best way to go to make it as thin and as fast as possible?

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:
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:
How to use Resources.Load with an AudioClip in Unity? I'm trying to load an audio clip that's in my assets directory and play it. Here is my C# script:

if (Input.GetKeyDown(KeyCode.X))
 {
     audioSource = gameObject.GetComponent<AudioSource>();
     Debug.Log((audioSource == null) ? "Audio source is null" : "Audio Source is not null");
     string path = "Sounds/Aurora/Aurora_IGSSin";
     Debug.Log(path);
     sound = (AudioClip)Resources.Load(path, typeof(AudioClip)) ;
     Debug.Log((sound == null) ? "Sound is null" : "Sound is not null");
 }

//Output:
//Audio source is not null
//Sounds/Aurora/Aurora_IGSSin
//Sound is null

There is an AudioSource component attached to this object, as proved by the first Debug.Log(). Attached is a picture of my folder, proving that the file path is correct. I've seen 90 different posts and tried this 81 different ways, including using the file extension in the path, omitting the directory and only including the file name, omitting (AudioClip) before Resources.Load(), using as AudioClip rather than typeof(AudioClip) and none of it has worked.

Please, someone help me before I pull my hair out over this. I'm incredibly flustered over being stuck on something that should be so simple, and I'd like to get on with my project.

My Project Directory:

sentences:
How does an Engine like Source process entities? On the Source engine (and it's antecessor, goldsrc, quake's) the game objects are divided in two types, world and entities. The world is the map geometry and the entities are players, particles, sounds, scores, etc (for the Source Engine).

Every entity has a think function, which do all the logic for that entity.

So, if everything that needs to be processed comes from a base class with the think function, the game engine could store everything on a list and, on every frame, loop through it and call that function.

On a first look, this idea is reasonable, but it can take too much resources, if the game has a lot of entities..

So, how does a engine like Source take care (process, update, draw, etc) of the game objects?

sentences: When using MVC, what is the proper way to handle a view refresh when the model isn't ready? I'm about to start building a game and am having trouble understanding the proper course of action when it's time to refresh the screen, but the model hasn't finished its calculations. I assume this isn't a huge problem for my little 2d platformer, but with many complex games there must be some hefty calculations that don't render in 1/30th of a second - I see these games stutter, but what's going on? Is the view just skipping this cycle? Is it an observer that's waiting for the model and will hang until the model is ready? Or will it display the models current state without regard to the computations ongoing? What's the correct way to handle this situation?

sentences:
How do I move many "static relative to each other" objects around? I'm currently building an Elevator Bank simulator in Unity3d and I'm stuck on how to reduce the amount of objects it's going to generate when it's done. The simulator will consist of one player (for now) walking into a building, calling an elevator, picking a floor, going up/down and getting out of the elevator again.

To illustrate the problem, I'll sketch 2 scenario's. One where there's no problem whatsoever. One where I simply scale upwards and create a mess. But first, a list of what's inside the simulator (excluding the player).

One hull of elevator shafts (3D .obj model).
One elevator car per shaft (3D .obj model).
One group of hall buttons per shaft per floor (one button for the top & bottom floor, two for the rest).
One group of control buttons per elevator car (door open, door closed, etc.). At least 3 buttons.
One floor call button per elevator car per floor.
Two doors per elevator car.
Two doors per shaft per floor.

A simple set-up of 3 shafts and 4 floors will already create 75 objects of which 30 are moving. Take 20 floors, 2 rows of elevators, 3 cars per row and I'm over 600 objects already.

Now. The Empire State building has 102 floors and 73 elevators. Which means multiple banks, a whole lot of floors, a whole lot of buttons and a whole lot of cars. Scaling my current set-up to support that will create a mess at best and simply won't work at worst.

Since this is an elevator simulator, the whole point of it is to make sure every elevator is active from starting the scene to ending the scene. So no tricks like only spawning what's in range of a camera, hibernating objects, object pooling and what not are out.

Now, objects in the same elevator car are static relative to each other. If the car moves up, everything moves up the same amount. So I hope I can move them as a group. Except I have no clue how to do such a thing in Unity. Prefabs may be part of the solution, but that still won't link their movements together. I've considered linking them together like a Snake game, but the amount of objects involved is orders of magnitude more. Luckily, all moving objects (except for the player) will only move on one axis. Doors only slide open/closed, elevator cars and their buttons go up and down. All rotations are fixed.

How do I move so many objects around in a single scene without creating a mess of variables in a performance-wise good way?

sentences:
Bad FPS for smaller size (OpenGL ES with SDL) If you saw my other question, well, there is still a little problem:

Click here to watch on youtube

Basically, the frame rate is very bad on the actual device, where for some reason the animation is scaled (it looks like the left side on the video). It is quite fast on the simulator where it is not scaled (right side).

For a test, I submitted this new changeset that simply hard-codes the smaller size (in SDL_CreateWindow() and in glViewport()), and as you see in the video, now it is slow even in the simulator (left side shows the small size, right side shows the original size -- otherwise the code is the same).

I'm clueless why it's soooo slow with a smaller galaxy, in fact it should be FASTER.

The question is not about general speed optimization like reducing screen resolution or joining glBegin(GL_POINTS)/glEnd() blocks.

Update: For a test, I simply reduced the screen size to 320x480 and compiled it to OS X desktop -- got the same speed as with 800x800, so this size-specific slow-down is on iOS only. Will post this on the SDL mailing list now.

sentences:
Unity : Casting shadows of anima2d characters I want to cast shadows of animated 2d character on a level like this :

The only thing here I want is dynamic shadows for anima2d character as animation progresses.Is there a way of achieving shadows with anima2D characters?

sentences:
Steering behaviours: collision avoidance with rectangles I'm trying to implement collision avoidance steering behaviour using rectangles. Most of the tutorials I've found are with circles, and there's a substantial difference. For example, I've been reading this:http://gamedevelopment.tutsplus.com/tutorials/understanding-steering-behaviors-collision-avoidance--gamedev-7777

My current approach: first, detect the nearest rectangle as done in the article. I create a point called ahead in front of my entity and then check if that point is inside the rectangle.
After calculating the nearest object, I decompose my rectangle in a set of points, equally spaced in the rectangle walls. My entity will flee those points.

EDIT: I've also proven to convert my rectangle in an electromagnetic repulsive rectangle with 4 bars of homogeneus charged. It didn't worked.
I also tried the "containment" section described in Craig Reynolds' website and it also didn't worked properly.

That works reasonably well: my entities try to avoid the rectangle. However, they sometimes get a bit into it, and when they're near the rectangle they start flipping to left and right quickly. That is not a very natural behaviour, so I think I want to prove another thing.

I've read this in gamedev SO: Wall avoidance steering I think that this could be what I need, approximately. However, I need some guidance on this.

First, the answer speakes about a dot product of the wall-boid vectors (let's call them WBi). Which is the another vector I have to multiply with? In the code sample is noted as partsList but I don't know what it is.
So, first question: what is this second vector?
In my opinion, this algorithm as a very important flow. If the force is exerted in the direction of normal of the wall, and by chance my entity goes with velocity normal to the wall, it will stop. This, I think, could be a rare event because more steering forces are involved...
Second question: there is a way to avoid this? Is this effect important enough to take care of it even if I have more forces?
In fact, I need an algorithm capable of detecting and avoding rectangles with steering behaviors -or, at less, a way to move my entities in a space with obstacles using something compatible with steering behaviors, because I use them for coordinate movement.

Take in account that some combinations of rectangles could create convex shapes.

EDITS:

The rectangles aren't rotated.

sentences: How to do concept art without knowing how to draw? I want to do some art's of my upcoming game, but dont really know how to draw. Wich program can I use, or should I draw it on paper? Just give me tips on how to do it.

sentences:
Monogame - Screen transition with fading I'm trying to create a fade logic with Monogame for my screen transitions. I've read tutorials online but I'd like to work with Premultiplied Alpha for the fading. I've seen people add 1x1 pixels black images to their content, scale it to the screen's width/height (depending on aspect ratio) and drawing it with the alpha value first decreasing, and then increasing (fade in, fade out). So I would like someone to give me an example code to work with, preferably, 2 methods: FadeIn() and FadeOut in something like a Transition class. I should be able to call these at the begging and at the end of my screen classes. Keep in mind that I'm using the following enum code for screen state management:

public enum gameStates
{
    splashScreen,
    engineScreen,
    titleScreen,
    optionsScreen,
    playScreen,
    gameOverScreen,
    creditsScreen,
}
private static gameStates currentGameState = gameStates.splashScreen;
public static gameStates CurrentGameState
{
    get { return currentGameState; }
    set { currentGameState = value; }
}
// And then switch(currentGameState) in Update() and Draw()

So maybe FadeIn() and FadeOut() should take an enum value as a parameter? So that when they are called, the value is passed and inside them the currentGameState is accessed through the property in Game1 and is changed. Would this be the correct approach? Thanks!

sentences:
Where and how to smooth a voxel-based terrain surface? I want to smooth the blocky terrain in a Minecraft-like world. The smoothing affects visual appearance and physics but not the logic of placing and picking blocks. I have my mathematical formula to smooth the cubes in a way the voxel grid stays recognizable. But I have no clue how to implement such an effect.

Moreover I do not know how to store and render the effect at all. My smoothing algorithm provides a height for each pixel of a block based on the surrounding blocks. This would result in million of triangles so I might need another approach.

Therefore I thought about calculating the smooth surface dynamically in a shader on the GPU. I never used the geometry shader or the tessellation shader before, but doing so sounds reasonable to me. But with this approach things become difficult when I want to apply correct physics to the smooth terrain surface since the triangles would only be stored on the GPU.

How can I effectively generate a detailed smoothed mesh and access the result for the physics simulation? Is there a technique to implement my idea without the creating of loads of additional triangles?

sentences:
How can I get the entity a player is looking at in a Bukkit plugin? I'm creating a wizardry plugin for Minecraft, and I was wondering how you would get the entity that a player was looking at, I know that you would have to use a Vector, but I really am not familiar with them. Pretty much what I'm looking for is something like this:

public void entityLookingAt(Player p){
    if(p.EntityLookingAt() instanceof Player){
        p.sendMessage("You're looking at a player!");
    }
}

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:
Breakout collision with block laterally I am creating a breakout game in c#.
Everything is working fine excepting one feature

My blocks are destroyed after the second hit ,but if the ball hits the side (left or right) of the block , the block is destroyed instantly..

Example here

What's the feature needed to avoid this problem ?
Thanks in advance !
Here is the code where the "action"  is happening :

foreach(Control x in this.Controls)
        {

            if (x is PictureBox && x.Tag == "block")
            {
                if (ball1.Bounds.IntersectsWith(x.Bounds))
                {
                    x.Tag = "Hit";
                    bally = -bally;
                }
            }
            else
            {
                if (x is PictureBox && x.Tag == "Hit")
                    if (ball1.Bounds.IntersectsWith(x.Bounds))
                    {
                       bally = -bally;
                        this.Controls.Remove(x);
                        if(score<=5)
                            speed = speed + 1;
                    }
            }
        }

x - my blocks

Point pt = ball1.Location;
if (pt.X < 0 || pt.X > ClientRectangle.Width - ball1.Width)
            ballx = -ballx;

sentences: Nvidia High Performance Processor Setting leads to graphical bug (Seizure Warning) with current lighting system, drawing completely in the shader code I followed the Lighting tutorial on learnopenGL, modifying some of the code to work in a 2D game engine. Everything was looking great and my team got our game done and the lights were quite simple for our designers to use. However we ran into a rare bug. as shown here: https://www.youtube.com/watch?v=to0mMP5I0cs one team member was able to recreate the bug by switching his Nvidia settings to use the "High Performance Processor" as opposed to "Integrated Graphics". Otherwise everything renders properly. The bug doesn't appear when there are no lights and everything is rendered in its full color. We have gone through alot of Ideas already but they haven't worked and now I am at a loss. Does anyone have any ideas about what is going on?

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 properly use String literals for loading content? I've been using verbatim string literals for some time now, and never quite thought about using a regular string literal until I started to come across them in Microsoft provided XNA samples. With that said, I'm trying to implement a new AudioManager class from the Net Rumble sample.

I have two (2) issues here:

Question 1: In my code for my GameplayScreen screen I have a folder location written as the following, and it works fine:

menuButton = content.Load<SoundEffect>(@"sfx/menuButton");
menuClose = content.Load<SoundEffect>(@"sfx/menuClose");

If you notice, you'll see that I'm using a verbatim string, with a forward slash "/".

In the AudioManager class, they use a regular string literal, but with two backslashes "\". I understand that one is used as an escape, but why are they BACK instead of FORWARD? (See below)

soundList[soundName] = game.Content.Load<SoundEffect>("audio\\wav\\"+ soundName);

Question 2:
I seem to be doing everything correctly in my AudioManager class, but I'm not sure of what this line means:

audioFileList = audioFolder.GetFiles("*.xnb");

I suppose that the *xnb means look for everything BUT files that end in *xnb? I can't figure out what I'm doing wrong with my file locations, as the sound effects are not playing. My code is not much different from what I've linked to above.

private AudioManager(Game game, DirectoryInfo audioDirectory) : base(game)
{
    try
    {
        audioFolder = audioDirectory;
        audioFileList = audioFolder.GetFiles("*.mp3");
        soundList = new Dictionary<string, SoundEffect>();

        for (int i = 0; i < audioFileList.Length; i++)
        {
            string soundName = Path.GetFileNameWithoutExtension(audioFileList[i].Name);
            soundList[soundName] = game.Content.Load<SoundEffect>(@"sfx\" + soundName);
            soundList[soundName].Name = soundName;
        }

        // Plays this track while the GameplayScreen is active
        soundtrack = game.Content.Load<Song>("boomer");
    }
    catch (NoAudioHardwareException)
    {
        // silently fall back to silence
    }
}

sentences:
Trouble drawing repeating and scrolling screen elements from a 2d array for an endless runner in swift I've been trying draw level segments for an iOS endless runner using 2d elements that repeat forever. I have a class that generates a random 2d array, then scene elements are drawn and animated to move left based on the 2d array. I also have a random number of ground tiles that generate in between each segment. The problem is when I attempt to have this action repeated forever. Everything I've tried has failed. My question is, what is the most efficient way to achieve this without any spaces in between segments? My goal is to generate the new segment when the end gets close to the viewing area, whereas to not take up unnecissary memory. Here is my code that generates only one segment:

func generateSegment() {

let wholeBlock = SKTexture(imageNamed: "wholeblock")
let halfBlock = SKTexture(imageNamed: "halfblock")
let ySegment = self.frame.height / 9
let randomSpacer = Int(arc4random_uniform(12) + 5)
let startPoint = (ySegment * CGFloat(randomSpacer))
let tempBlock = SKSpriteNode(texture: wholeBlock)
let sizeDifference = ySegment / tempBlock.frame.height
var moveBlock = SKAction.moveByX(-tempBlock.frame.width, y: 0, duration: NSTimeInterval(0.4))
var moveBlockForever = SKAction.repeatActionForever(moveBlock)

// get random 2D Array
var segmentMatrix: [[Int]] = GetLevelSegment().atRandom() as! [[Int]]

//draw random number of ground spaces between segments
for var x = 0; x < randomSpacer; x++ {
    var groundSprite = SKSpriteNode(texture: wholeBlock)
    groundSprite.setScale(sizeDifference)
    groundSprite.zPosition = 98
    groundSprite.anchorPoint = CGPointMake(0,0)
    groundSprite.position = CGPointMake((CGFloat(x) * groundSprite.frame.size.width), 0)
    groundSprite.runAction(moveBlockForever)
    gameLayer.addChild(groundSprite)
}

//set segment start point

//draw a 32 x 9 segment
for var i = 0; i < 9; i++ {
    for var j = 0; j < 32; j++ {
        if segmentMatrix[i][j] == 1 {
            var sprite = SKSpriteNode(texture:wholeBlock)
            sprite.setScale(sizeDifference)
            sprite.zPosition = 98
            sprite.anchorPoint = CGPointMake(0, 0)
            var xPosOne = CGFloat(j) * sprite.frame.size.height
            var xPosTwo = xPosOne + startPoint
            var segFromTop = CGFloat(i + 1) * sprite.frame.size.height
            var yPos = CGFloat(self.frame.height - segFromTop)
            sprite.position = CGPointMake(xPosTwo, yPos)
            sprite.runAction(moveBlockForever)
            gameLayer.addChild(sprite)
        }
        if segmentMatrix[i][j] == 2 {
            var sprite = SKSpriteNode(texture:halfBlock)
            sprite.setScale(sizeDifference)
            sprite.zPosition = 98
            sprite.anchorPoint = CGPointMake(0, 0)
            var xPosOne = CGFloat(j) * sprite.frame.size.height
            var xPosTwo = xPosOne + startPoint
            var segFromTop = CGFloat(i + 1) * sprite.frame.size.height
            var yPos = CGFloat(self.frame.height - segFromTop)
            sprite.position = CGPointMake(xPosTwo, yPos)
            sprite.runAction(moveBlockForever)
            gameLayer.addChild(sprite)
        }
    }
}

}

sentences:
Iterating through map : need help getting cluster of flags (points) while avoiding duplicates I have a grid style game where I make use of objects called flags which have points attached to them.
I want to be able to look at the map and find the tile(position) where it maximizes the points (using the cardinal flags North,South,West,East of current position and uses radius to give a bigger search area); while trying to avoid using the same flags.
My method works in the sense that it adds the points up correctly based on the position. However, when I move to the next tile over; if the previous tile uses flags (x,y) and the next tile over uses flags (x,y,z)
Example using method below:
Tile 1 @ Position (3,4)

Flags (x,y)

Tile 2 @ Position (3,5)

Flags (x,y,z)

Expected result for Tile 2 : z flag only
    //searches each tile for corresponding flag points
    public Map<Map<Integer, List<Flag>>, Position> checkTilePoints(Player player) {
        List<Flag> localFlags = new ArrayList<>();
        Map<Map<Integer, List<Flag>>, Position>tilePoints = new HashMap<>();
        int diameter = 4; //as much diameter as warfrig
        int radius = diameter / 2;
        int squareRadius = radius;
        for (int i = 0; i < context.getMap().getMap().length; i++) {
            for(int j = 0; j < context.getMap().getMap()[i].length; j++) {
                localFlags.clear();
                int pointTotal = 0;
                if(context.getMap().isRock(i, j, player) || context.getMap().isOutOfBounds(i, j)) {
                    continue;
                }
                for (int x = i - squareRadius; x < i + squareRadius; x++) {
                    for (int y = j - squareRadius; y < j + squareRadius; y++) {
                        if((java.lang.Math.pow(x - i, 2) + java.lang.Math.pow(y - j, 2)) < java.lang.Math.pow(radius, 2)) {
                            Flag checkedFlag = context.getMap().getFlag(x, y);
                            if ((checkedFlag != null) && (!localFlags.contains(checkedFlag))) { // add once only
                              localFlags.add(checkedFlag);
                            }
                        }
                    }
                }

                Flag north = context.getMap().getFlag(i, j + radius);
                Flag south = context.getMap().getFlag(i, j - radius);
                Flag west = context.getMap().getFlag(i - radius, j);
                Flag east = context.getMap().getFlag(i + radius, j);

                if ((north != null) && (!localFlags.contains(north))) {
                    localFlags.add(north);
                }
                if ((south != null) && (!localFlags.contains(south))) {
                    localFlags.add(south);
                }
                if ((west != null) && (!localFlags.contains(west))) {
                    localFlags.add(west);
                }
                if ((east != null) && (!localFlags.contains(east))) {
                    localFlags.add(east);
                }

                for(Flag points : localFlags) {
                    pointTotal += points.getSize().getID();
                }
                if(pointTotal != 0) {
                    //TODO - create hashmap to return
                }
            }
        }
        return null;
    }

I'm not sure if I explained my problem very well, but overall; I want to fix this method to just add the cluster of flags based on the position without using duplicate flag already checked

sentences:
Why don't my generated instances update when I change their prefab? I’m making an Editor tool -- a ScriptableWizard -- that instantiates a prefab on a grid. But I find that when I update the prefab, the instances don’t update.

When I instantiate prefabs interactively in the Editor by dragging them from the Project panel to the Scene or Hierarchy, then updates to the prefab affect the instances as expected.

I see another difference between my scripted instances and the ones created when I drag the prefab into the scene: when I do it interactively, the instance in the hierarchy is listed in blue. But the instances I create from script using the same prefab are listed in black, similar to objects created directly in the scene.

Here’s the hierarchy; the “JitterPrefab” was dragged into the scene, and the ones under “gridParent” were instances of the JitterPrefab generated from my script:

Here’s how I’m generating the instances:

public GameObject prefab; ...

void OnWizardCreate() { ...
  Transform instance = Instantiate (prefab.transform, pos, rot, parent.transform);
  instance.name = string.Format ("L{0:D2}-R{1:D2}-C{2:D2}", l, r, c);
  ...
}

When I make a change on the prefab, e.g. change the radius of the Jitter script from 0.025 to 0.25, the manually created instance updates:

But the script-generated instances do not:

What am I doing wrong? Why are my scripted instances no longer connected to the original prefab?
And, separately, how to I tell in the editor (or in script) whether an object in the scene is an instance of a prefab or not?

sentences:
Unity 5 - Occlusion culling at runtime I am creating a game in Unity where the game is rendered while playing. The game is made in a voxel style, and has thousands upon thousands of objects rendered while playing. Of course, this causes a huge amount of lag. Therefor I need to use occlusion culling, to make sure only the objects needed are rendered.

For occlusion culling, you need to bake the area, but I'm planning on creating a huge world. So, any tips on how I could do this?

sentences:
How to customize player script with different abilities in each scene? I'm making a game with Unity. I wanted the player script to not have some features in some scenes but couldn't remove them from the script because I needed them for other scenes.
So far, I just unpacked those player prefabs, created new scripts for each of them and removed the lines that I didn't want to have. I know this was not the best idea but I don't know any other way. One of its problems is that it makes managing the scripts hard and confusing.
Is there a way that I can change them without creating new ones? Since I'm going to switch to the new Input system, I want to avoid the possible problems and headaches around these scripts. I also did this (creating a new script) for pause menu script as well. I provided two examples below to make the situation more clear.
Example A) The player can use a shotgun in one of the scenes and I chose to not let him to use the knife in there. So I created a new script for that player and copied and pasted the original script (which had the melee attack ability) and then removed those lines from the new script.
Example B) Pause menu can disable the health bar game object whenever the escape button is pressed. But for one of the levels, I don't want to use the health bar, so I pasted the code in a new pause menu script and removed the line that disables the bar.

sentences:
Making animations not smooth while using Record button In my 2D sidescroller game, I want to separate the animations for the head and the body of my character.

While idling, my charcter's body bounces slightly up and down (kind of a breathing motion). Thus, the head should keep up.
However, when I press Record and make adjustments for the head, the head moves up and down smoothly instead of following the body frame by frame.

How can I remove the smooth transitions from one position to the other?

Here is a screenshot from Unity demonstrating the hierarchy and the animation keyframes.

sentences:
Dealing with binary data and endianness When distributing my game, I am going to compile all the resources and level data into a single binary package file, which is loaded from by the game.  Do I have to worry about my machine being a different endian-ness than the end-user's, or are discrepancies here obsolete?

If this is going to be a problem, what is the best way to circumvent or solve it?

sentences:
Optimize spawn & destroy? (Unreal Engine) I'd really like to know how you'd go about optimizing this? 20 actors each spawning 8 projectiles per 0.1 sec which are then destroyed 0.8 seconds later, all done through blueprints Gif: https://gyazo.com/eab053741012405926193c6302ef84a7
Pictures:

I thought about pooling but not sure if it's okay to have 1000 projectiles on standby since I know spawning and destroying is costly but going though all, picking one to re-locate and initializing the projectile per character might also be a problem, what cha say? other options? I can totally do pooling if that's the only way
Would really appreciate some tips/practices. Thank you all!

sentences:
Is it legal to reuse a 3D model as long as it has a new texture? If I create a 3D model and texture for a client, say a house. Can I reuse that same 3D model, but apply a new texture and then legally use that in my own game? Is that enough of a difference?

Thanks!

sentences:
Gamemaker - Maintain relative position between objects during rotation I have a large object and a small object - the small object updates its x and y position every step to match the x and y of the larger object. It is easy to keep it in the same position on the larger object without any rotation, as follows (in this instance, slightly above and to the right of the centre of the larger object, here called Owner:

x = Owner.x + 50
y = Owner.y - 50

However, this all goes pearshaped if the larger object is rotated from its sprite's initial position!

How can I maintain the relative position of the two objects even when rotated?

sentences:
How can I forward GLFW's keyboard input to another object? I'm having trouble trying to execute keyboard events in a another class with GLFW3. The problem I'm having is that GLFW3 uses a static function for input as shown:

static UI u;
...
...
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    u.controls(window, key, action);
}

u is also static and controls holds the the input for WSAD keys (the only way I could get get key events). From here, pressing a key works displaying which key is pressed in the console window. The trouble I'm having is trying to used the key pressed to manipulate a variable in another class.

I have another class called MainMenu that has the function update(). Is there a way I can use my UI class within this function?

sentences:
Tools or techniques for UV unwrapping/texturing terrain with features such as roads? I'm trying to create a map similar to Outset island in Loz: Wind Waker. Here is an example of what I'm trying to create:

As you can see, the roads more or less have dedicated tris. However, when I look at the UV data, it looks like a complete mess:

For reference, this is the texture without any overlays:

I have no idea how to go about creating a similar effect in my own game -- are there any tools I can use? What is this technique called?

sentences:
Quantity of dropped/spawned items in container I'm having trouble figuring out how to spawn more than one item in to a container with a weight limit. What I'm having trouble with is the understanding, rather than what statements to write;

My items are composed of weight, type and foundIn, among other things. My containers are items, with some minor changes. foundIn is an array of strings which match "container" items, and should be either "world", "container-name", or empty ([]). "container" items follow a similar structure, with slight deviance.

Whenever I want to drop an item, I get a pool of items in a foundIn location, make a Math.random check against the commonRate, and if that item is a type = "container", I try to fill the container.

Here is where I have my problem; I can not figure out how to decide if multiple items of the same type should be dropped inside the container, and if so, how many. If I can figure this out, I can have monsters carry their own drops, instead of having to write a whole monster drop-table with levels and oddities.

The following is my code. The last method, dropItem, glues the displayed methods together.

placeExists(place) {
    return this._itemPlaces.indexOf(place) > -1;
}

getItemsOfType(arrayOfTypes, inList) {
    if (!Array.isArray(arrayOfTypes)) throw new Error('Index must be string');
    let pool = this.list;
    if (inList) pool = inList;

    return pool.map((item => {
        if (arrayOfTypes.indexOf(item.type) > -1) {
            return item;
        }
    }));

}

populateContainer(container, pool) {
    let chance = Math.random();
    pool = pool.map(item => {
        let canBeFound = item.foundIn.indexOf(container.name) > -1
                || item.foundIn.indexOf('world') > -1;
        if (item.commonRate >= chance && canBeFound) return item;
    });

    this.getItemsOfType(container.availableTypePool, pool).some(item => {
        if (container.capacity.freeSpace <= 0) return true;
        if (item.commonRate >= Math.random()
                && item.weight <= container.capacity.freeSpace) {
            container.addItem(item);
        }
    });

    return container;
}

getItemsOfPlace(place) {
    return this._LIST.map(item => {
        if (item.isFoundIn(place)) {
            return item;
        }
    })
}

dropItem(fromPlace) {
    if (this.placeExists(fromPlace)) return [];
    let foundItem = [];

    let pool = this.getItemsOfPlace(fromPlace);
    pool.some(item => {
        let chance = Math.random();
        if (chance > item.commonRate) {
            if (item.type == 'container')
                foundItem.push(this.populateContainer(item, pool));
            else
                foundItem.push(item);
            return true;
        }
    });

    return foundItem;
}

// container abstracted method of adding an item

container.addItem = (item = new Item()) {
    if (item instanceof Item === false) throw Error('item needs to be of type Item');
    if (item.type == 'container') throw Error('Yo dawg, I heard you like containers...');

    this._contained.push(item.code);
    this.carryingWeight = +item.weight;
}

How do I decide if I should drop multiple items, and how do I randomly select that amount?

Note that this.list and this._LIST are the same list. For some reason, WebStorm seems to lose track of one or the other when inside certain callbacks, so I switch to avoid losing autocomplete. For reference, this.list is get list() { return this._LIST }, and is obtained from extending a custom List class.

sentences:
Experience embedding javascript I'm looking into scripting languages to embed in my game.

I've always assumed Lua was the best choice, but I've read some recent news about embedding V8 as was considering using it instead.

My question is two fold:

Does anyone with experience embedding v8 (or another javascript engine) recommend it?

How does it compare with embedding Lua?

I like that v8 has a c++ embedding API.  However Lua API has had lots of time to be refined (newer isn't always better and all that).

Note: At this point I'm not too concerned with which is better language or which library has better performance.  I'm only asking about ease of embedding.

sentences:
what can be done to improve the ultimate insane real time strategy game AI? I had this chat with a friend of mine about whether an AI can be created or not that could beat any human without resource cheating in a real time strategy game. An AI that would play almost perfectly. The AI of today's games have many areas that can be improved, most of them rely on resource cheating, a better early base developement because of that, and attacking in waves.

Still, the question is what would need to be done to improve on this to obtain the ultimate AI. Also, if you have any example of a game where a certain feature was used it would be great.

Edit: There is little clarification i can provide for those who haven't read the title or the few paragraphs describing the problem. This is about real time strategy games and the ultimate AI. That means Strarcraft, Warcraft, Generals, Red Alert, Age of Empires, AI War etc. Games that have more than one difficulty level, but the focus here is on the ultimate challenge.

tenpn has a fantastic post filled with great resources. Thank you, tenpn! I wish more people would contribute in that direction.

sentences:
How does one multiply by a constant in a VS1.1 assembly vertex shader? I'd like to multiply a vector by -1

e.g.

mul    r0,    r0,    -1

When I try this, I get this error message:

SimpleShaderA.vsh(20,17): error X2000: syntax error : unexpected integer '1l'

How can I specify -1 in my (first) shader program?

sentences: How well does Unity 3d work for both Android and iPhone? First off this question might be a bit broad so I apologize if it is. I am really just looking for peoples experiences and personal knowledge on the subject. I am looking to create a game for both Android and iPhone platform. I know Unity is a great game engine and my question is how well does it work for creating one code base to build for both Android and iPhone platforms? Time is a constraint on this project so I am very interested in how smoothly the process usually is when trying to build both applications and how much custom code must be written for each specific application. Any insite that people have on this topic would be much appreciated thanks.

sentences:
one time rotation Unity How do I rotate the object only once after a key press. So after it rotates say 10 degrees upwards, the user can't rotate it anymore.

this is my code which as continuous rotation -:

   void Update(){
 if (Input.GetKey(KeyCode.J))
     transform.Rotate(0, 0, 3f);
  }

sentences:
How to deal with characters picking up and dropping objects in a 2D game I'm quite new to game development, so would like to get a consensus on methods of doing this.

My game features a 2D character that is able to pick up and drop objects, for example, a stick.  My question is: is it advisable / possible to manipulate the image of the character and image of the stick to make it look like the character is now carrying a stick; or is it best to have a separate sprite sheet for the character with the stick and the character without?

EDIT:

To be clear - I have a lot of characters, with a few items (4 separate items and over 20 characters)

sentences:
Animation imported from Maya has interpolation issues I have imported animation from Maya (.fbx) and the curves for the animation in Unity are very different than in Maya. I can clearly notice a flicker for few seconds when I am scaling the object (0 to 1) in loop. The curve for scaling is shown below.
The rest in the animation work fine except for the scale. The problem is that Unity adds interpolation automatically to these curves which is why it creates an issue. I have selected the keys in the curves for the scale attribute and "Both Tangets -> Constant", but it did not have any effect.
How can I fix this?

sentences:
Smooth out movement of the snake in a 2d Snake game I am working on a 2-D snake game in C++ with the SFML library. I would like to smooth out the movement of my snake as it looks extremely choppy currently.
How the Snake moves
The snake is made up of a list of parts. If I want to move the snake, I simply remove one part from the back (.pop_back()) and then add a new part in the front accrding to the velocity. This works perfectly. The speed of the snake must be the same as the distance between the parts.  So if the distance is 15, the will be 15. But a speed of 15 is extremely high, so I need to only update the snake every few frames or use sf::Sleep(). Since the snake moves such a high distance every frame, the movement doesn't look smooth at all. And since the speed must be equal to the distance between the parts, reducing the speed doesn't work too. How can I come about tackling this?

sentences:
MagicaVoxel export world in 1 model So I'm currently working in MagicaVoxel and I have 2 objects in my world. When I export it as .obj it exports as seperate 2 obj models with 2 seperate textures and materials. Is there any way that I can export whole MagicaVoxel world to single object. If there is a way this would really made my work easier because I will add more objects to world.

Thank you for answers.

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:
How to make the whole game wait until some new feature at beginning is finished? In Unity I have been working on a driving game and its almost finished. I'm just trying to add some polishing touches. Ironically this part im stuck on now would not have been any issue at all in purely code based frameworks i used before (LibGDX/Xna) because I could just make a boolean that's called ReadyToPlay or something and just put that around all the code i want to wait to start.

I've made a secondary camera which rotates around the players car, it works fine but my problem is that the GUI is also already loading AND the race start countdown occurs still whilst the camera is still spinning.

I'm not sure in Unity how to go about stopping that to allow the time for the camera to spin.

One idea I have to fix this (i'm checking first because this doesnt seem right to me) is to use the yield routine in the GUI loading script and tell it exactly how many seconds the camera is going to spin for. I'd rather have just have the camera detected when its done a full spin and then make a boolean true, or trigger another method to start the game properly.

I promise I have done some research trying to find ways but the only thing i can find except yield, is Monobehaviour.Invoke but the invoke method still requires me to specify the time.

The whole strategy for yield or invoke feels wrong to me.
I guess my main problem is that the code is spread over a few scripts, instead of being funneled thru a main.cs and then gameManager.cs etc etc so theres no way (that I know) to break the chain higher up. I'd have to add bools to each script to say isLuxuryCameraAlive and that still seems wrong to me as I might have  5-10 scripts and have to also section of bits of code in each script.

How would you experienced programmers attack this issue??

Thank you!!

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:
How to achieve selection of a tile from a tile sheet based on an ID? Let's say I have a tile sheet that contains 8 sprites per sheet. Each sprite is a tile of 30x30.

I wrote my own custom map parser/map loader however I'm having trouble extracting a certain tile sprite from the file. I'll describe my problem better in order for everyone to understand.

I wrote an enum of materials, each material has a value according to it's location relative to the tile sheet. For example void is 1, grass is 2, rock is 3, etc. So in my tile sheet they are represented as such:

+---+---+---+---+---+
| 1 | 2 | 3 | 4 | 5 |
+---+---+---+---+---+

Which is equivalent to:

+------+-------+-------+
| void | grass | stone |
+------+-------+-------+

Basically when rendering, I created a tile class, each tile has 2 coordinates: X and Y (They are calculated automatically) and a material which can be represented either as a number, either as a value (ID). When rendering, I have a vector of sprites which are all taken from 1 file called tilesheet.png, however each of them must only draw a certain portion of the tile sheet, for example say I have something like this:

tile coordinateBounds(topLeftX, topLeftY, tileWidth, tileHeight);

During the initialization of the map I calculate an array of tiles, and I give each of them their position, their materials based on the values in a map file and a few other variables such as collision. I need to apply the coordinateBounds to each of them according to their material value. For example if the material is grass it should only take the grass sprite from the tilesheet. I must also mention I'm using SFML, and there are no borders or spacing between the tiles.

sentences:
Unity Animator default values overwriten I have created a project to reproduce the problem I'm currently facing.
I'm running a simple unity animation that moves a game object and expect to be able to reset the gameobject position. This can be done by adding an empty animation, that (since it does not change anything) simply writes the default values, thus returning our gameobject to its original position.

But here is where things get complicated: if the animator gameobject is set inactive while the animation is running, new incorrect defaults values will be saved when gameobject is activated, and I am unable to reset my gameobject position.

To reproduce this issue, run the attached project:
(Download from here)

Change the stop method to "PlayEmpty"
Hit Start Animation and watch the left "Hello world" text travel.
While it is traveling, click Disable Text GO. The left text disappears.
Click Enable Text GO and see the text comes back at its last location.
Click Start Animation and watch the left "Hello world" text travel.
Click Stop Animation - the text is returned to the position where it was when enabling the gameobject, rather than its original position.

Any help is welcome, suggestions on how to change the code to make the above scenario work.

Thanks,
Yaniv

sentences:
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:
How do I check if animation is of Animation Type "Humanoid"? One can set the Rig / Animation type of an animation to "Generic", "Humanoid", etc.

How could I check by script if an animation rig has been set to type "Humanoid"?

sentences:
Unable to list target platforms. Please make sure the android sdk path is correct. (Error) When i am trying to build an apk from unity. Than its show me some error something like this :-

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
E:/DEWA/msgs/Kunal/android-sdk-windows-1.6_r1\tools\bin\avdmanager.bat list target -c

stderr[

]
stdout[

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_121\lib\tools.jar;C:\Program Files\Java\jre1.8.0_141\lib\rt.jar;

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
E:/DEWA/msgs/Kunal/android-sdk-windows-1.6_r1\tools\bin\avdmanager.bat list target -c

stderr[

]
stdout[

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_121\lib\tools.jar;C:\Program Files\Java\jre1.8.0_141\lib\rt.jar;

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
]
exit code: 1

sentences:
Identifying Entity 'Types' in an Entity-Component System If an Entity has no explicit 'type' (e.g. player) and is simply a collection of components, how do I identify the entities that my systems should and should not be working on? For example, in a game of Pong the paddle and ball both collide with the window boundaries. However, the collision handling systems for each will be different, therefore a system should not handle entities of the wrong type.

void PlayerCollisionSystem::update(std::vector<Entity *> entities) {
  typedef std::vector<Entity *>::iterator EIter;
  for (EIter i = entities.begin(); i != entities.end(); ++i) {
    Entity *player = *i; // How do I verify that the entity is a player?

    // Get relevant components.
    PositionComponent *position = player->getComponent<PositionComponent>();
    VelocityComponent *velocity = player->getComponent<VelocityComponent>();
    SpriteComponent *sprite = player->getComponent<SpriteComponent>();

    // Detect and handle player collisions using the components.
  }
}

Both the player and the ball share the same relevant component types for collision handling yet their system implementations will be different.

If I have a container of all game entities, how do I identify specific types of entity without inheriting Entity or including a member variable such as std::string type, in which case an entity is no longer simply a collection of components?

sentences:
SDL Key Input previous and current key states not working as expected, how to fix? Here is my code that's part of the main game loop:

  // ResetKeyState stores currentKeyState in previousKeyState
  // and then clears currentKeyState
  engine.ResetKeyState();

  // Fill currentKeyState
  while (SDL_PollEvent(&e) != 0)
  {
     // Call input to notify
     engine.Input(e);
     if (e.type == SDL_QUIT)
        engine.Quit();
  }

  // Return control to programmer for implementation
 engine.EngineUpdate();

  // Draw a pretty picture
  engine.EngineDraw();

and then to handle the input I have Input(e)

void Engine::Input(SDL_Event e)
{
   switch (e.type)
   {
   case SDL_KEYDOWN:
      KeyIsDown(e.key.keysym.sym);
      break;

   case SDL_KEYUP:
      KeyIsUp(e.key.keysym.sym);
      break;

   default:
      break;
   }
}

KeyIsDown stores the boolean state in an array as a true value.

KeyIsUp stores a false value.

Then later, I thought I would be able to do this to get a single input.

if (IsCurrentKeyDown('a') && !IsPreviousKeyDown('a'))

IsCurrentKeyDown and IsPreviousKeyDown just get data from their arrays

bool currentKeyState[INPUT_SIZE];
bool previousKeyState[INPUT_SIZE];

This way if you've are currently pressing the key but the value hasn't yet been stored it takes input once.

IE: You press the key so currentKeyDown is true and previousKeyDown is false until next update where currentKey gets passed to previousKey and the statement is then false. It's how Monogame and XNA do it so I figured I'd implement it here.

But it didn't work. I put a break point with a hit counter on it and it would hit it more than once per press. What am I doing wrong?

sentences:
Unity: How to make script work with duplicated objects? I have an object in my game that, when clicked, causes the player to move toward it. It does this by sending its position to the player's SetTarget function. The player's Move function then heads toward the position.

This is working, but when I duplicate the object and click on it, the player still moves toward the original object's position. When I print debugging statements to the console, it appears that both positions are being calculated, but the original position is the last one and wins out. (I'm using the object's this.transform.position to send the position to the player's SetTarget function.)

Can I not duplicate objects like this and expect the script to work? Do I need to use a prefab? If so, how? I know how to create prefabs but am not sure what I would need to change with the script or other settings when they are created. Thanks.

Here's the code:

public class PotController : MonoBehaviour {

private GameObject chefObject;

void Start () {
    chefObject = GameObject.Find ("Chef");
}

void Update() {
    if(Input.GetMouseButtonDown(0)){
        //print ("pot clicked!");
        ChefController chefScript = chefObject.GetComponent<ChefController> ();

        print (this.gameObject.transform.position);
        chefScript.SetTheTarget (this.gameObject.transform.position);
    }
}
}

public class ChefController : MonoBehaviour {

private Vector3 target;
public float speed = 2;

// Use this for initialization
void Start () {
    target = this.transform.position;
}

private void MoveTowardsTarget() {
    Vector3 targetPosition = new Vector3(0,0,0);
    targetPosition = target;
    Vector3 currentPosition = this.transform.position;
    //check distance to target
    if(Vector3.Distance(currentPosition, targetPosition) > 0.4f) {
        Vector3 directionOfTravel = targetPosition - currentPosition;

        directionOfTravel.Normalize();

        this.transform.Translate(
            (directionOfTravel.x * speed * Time.deltaTime),
            (directionOfTravel.y * speed * Time.deltaTime),
            (directionOfTravel.z * speed * Time.deltaTime),
            Space.World);
    }
}

void Update () {
    MoveTowardsTarget ();
}

public void SetTheTarget (Vector3 position){
    target = position;
}

}

sentences:
What is the memory impact of having a pointer to the containing class type as a member of that class? If I have a class called Something, what will the consequences for memory be if I include, in that class, a pointer to another object of the same class? So if the objects ThingOne and ThingTwo are both Something objects, ThingOne's contained pointer could point to ThingTwo (and vice versa, I assume)? I am trying to create a very simple alternative to both typical arrays (I need something more dynamic) and classic vectors (they keep gumming up my work. Please do not misinterpret this question as asking for help on vectors, though).

Needless to say, the pointers would be empty in the class, only to be set when an instance of the object has already been created.

sentences:
Multiple volumetric lights I recently read this GPU GEMS 3 article Volumetric Light Scattering as a Post-Process. I like the idea to add volumetric light property to realtime render i'm working on. Question is will it work for multiple lights? Our renderer uses one render pass per light and uses additive blending to sum incoming light.

I'm mostly convinced that it have to work nice. Do you agree? Maybe there can be problem where light rays crosses each other.

sentences:
LibGDX Cross Platform Networking Backstory:
I've been developing a game with LibGDX for the past two years, and I've seen it refactored more times than I remember.

I jumped on the iOS iKVM port as soon as it was released.
But I've been struggling with it ever since in regards to cross platform networking.
Kryonet will not port over to iOS unfortunately. So it's either I ditch Kryonet, or lose a large chunk of my target audience (iOS Users)

My question for you is:
I noticed LibGDX has cross platform classes ready for sockets and HTTP Requests, but no documentation exists for these sockets at all.

Has anyone used these sockets at all in the past, and does anyone know how they work?

sentences:
Solving 2D Collision Detection Issues with Relative Velocities Imagine you have a situation where two objects are moving parallel to one-another and are both within range to collide with a static wall, like this:

  => 20m/s     => 40m/s
+==========+ +==========+          +======+
| Object A | | Object B |          | Wall |
+==========+ +==========+          +======+

 |-- 1m --|   |-- 1m --|  |- 1m -|

A common method used in dynamic collision detection is to loop through all objects in arbitrary order, solve for pair-wise collision detection using relative velocities, and then move the object to the nearest collision, if any.

However, in this case, if object A is checked first against B, it would see that the relative velocity to object B is -20 m/s (and would thereby not collide this time frame). Then it would see that the object A would collide with the static wall, and the solution would be:

+==========++==========++======+
| Object B || Object A || Wall |
+==========++==========++======+

And the red object passes through the blue one. So it appears to be a matter of choosing the right order in which you check collisions; but how can you determine which order is correct? How can this passing through of objects be avoided? Is ignoring relative velocity and considering every object as static during pair-wise checks a better idea for this reason?

sentences:
How to make a script's Gizmo toggleable in the Gizmos menu in Unity3D? I've implemented Gizmos for a few behaviours, and I'd like to make them toggleable in the Gizmos menu, just like the built-in ones.

Is this achievable?

sentences:
Prefab sorting layer wrongly displayed I have a prefab 'WhiteSmoke' that should render on top of the other objects on my game view but instead it just stays behind. The sorting layer some you see on the image named 'smoke' is the top layer, changing it to default and keeping the big order in layer number does not solve the problem.

The canvas render mode is ScreenSpace-Overlay.

Have any idea what I'm missing here? I don't know what else to try.

sentences:
How can I add a new item to my enum list in the inspector? I have a list of enums. I want to add a new item to it without scripting to make them more easily modifiable for game designers.
I made an inventory system and I want to define the type of an item. For an example apple is a type of food and stone is a type of object.

Is there a way to group these items in the inspector?

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {
    public const string[] typesStrings = {"Player", "Prop", "Enemy"};
    [System.Serializable]
    public class TypeList
    {
        public enum types
        {
            PLAYER = 0,
            PROP = 1,
            ENEMY = 2
        }

    };

    // MonoBehaviour class
    public TypeList.types selectedType;

    public void Start()
    {
        string selected = TypeList.typesStrings[(int)selectedType];
    }
}

This, however, gives me the following error:

  Assets/grouping.cs(5,31): error CS0134: A constant grouping.typesStrings' of reference typestring[]' can only be initialized with null

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:
Can someone explain this occurrence with a fbx model in xna? Because this is kind of weird to explain, let's show you what I mean.  This is in my game.  When I import this base ship model, it should be at (1000,1000,1000), but the model acts like it's at (1000,1000, 0).  Note it is positioned correctly when I use a .x model.  So it has to be the model.  I need to know what's wrong with it.

Here is the model file, tell me if anything is wrong with it: https://dl.dropbox.com/u/92848165/station2.FBX

http://i.imgur.com/VsjH8.jpg

EDIT: The model works if you import it into Google Sketchup...but you lose the textures, not very nice.

sentences:
Should i be worried about loading so much data? So a week ago or so i asked this question:
A few queries about my Map Data (& ideas of improvement, seconded opinion required)

And the advice in the comment was to ask them as 3 separate questions. So I' going to focus on map loading, and my concerns.
So recently i have been working on a new map editor, mainly creating some form of an entity system so that i can easily edit and manage any entities i have (animated tiles, enemies etc.). And i currently have animated tiles done.

But now I'm coming to the point were I'm going to-do the saving and loading in the editor.
And I'm just curious to know if i should be worried about loading quite a-lot of data in some cases.

So this might be an example of things that would be in my map files;

Map Data, the number of layers, the width & height of the map and finally then all the map tile data. (Currently in my old map format,
this is all the data the map's contain!)
Then having any Animated Tile data, their position, what animation file they use.
Enemy Data, the enemy type, positions of the enemies, the starting enemy state.
Level Exit Data, the position of the exit node, the destination of were the exit will take the player.

In terms of scale, i don't think a level will contain more than 20 enemies, in terms of Level Exit data, perhaps 3-4 max. Animation tiles, perhaps 20-40 max depending on the size of the level.

I'm just worried in that by loading up all this data it's going to take quite the hit on performance.
So my question is purely, should i be worried? Or am i just being overly sensitive to loading this much data? In-fact in comparison to other games, is that a-lot of data to be loaded in with a map (that would be an interesting comparison to settle me, to see another games map and perhaps compare the amounts of data stored).

Thanks in advance for any help :)

sentences:
Box2D body rotation with setTransform I' having a problem rotating a body with setTransform(), The body has multiple sensors that should rotate with the player. The rotation works but it rotates around the bodys local 0,0 position instead of the center. Note that the game is in a top-down perspective and the player can go in four different directions, thus I need to rotate him immediately (in one tick) in 90 degrees steps.

Up:

Down:

I can't find a way to set the rotation center.

Here's the code I use to rotate it:

float angle = direction * 90 * MathUtils.degRad; // direction is an int value from 0 to 3
body.setTransform(body.getPosition(), angle);

I also tried body.getLocalCenter().set() and body.getMassData().center.set() but it didn't seem to have any effect. How can I rotate the body around its center?

EDIT (added code to create fixtures):

This is the method to create a fixture:

private Fixture createFixture(FixtureDef fixtureDef, Body body) {
    PolygonShape ps = createPolygon(); // creates a polygon shape from XML config
    fixtureDef.shape = ps;
    Fixture fixture = body.createFixture(fixtureDef);

    if (fc.filter != null) {
        fixture.setFilterData(fc.filter);
    }
}

This is the simplified code to create the fixtures (they are really loaded with xml config but these are the values I set):

FixtureDef sensorDef1 = new FixtureDef();
sensorDef1.friction = 0;
sensorDef1.restitution = 0;
sensorDef1.isSensor = true;
sensorDef1.center = new Vector2(0.8f, 1.6f);
// and some filters

FixtureDef sensorDef2 = new FixtureDef();
sensorDef2.isSensor = true;
sensorDef2.center = new Vector2(0.8f, 1.6f);
// and some filters

FixtureDef sensorDef3 = new FixtureDef();
sensorDef3.isSensor = true;
// and some filters

createFixture(sensorDef1, body);
createFixture(sensorDef2, body);
createFixture(sensorDef3, body);

sentences:
How to avoid gimbal lock in Unreal Engine (c++)? I created an orbit camera (sometimes called turntable camera; similar to the one with the "use UE3 orbit controls" setting in a static mesh view).

I attached the camera to a USpringArmComponent with a TargetArmLength set to 400.
In the tick function, I rotate the arm with this simple method:

        // Simple, clamped version
        FRotator Rotation = CameraSpringArm->GetComponentRotation();
        Rotation.Yaw += CameraInput.X * CameraRotationSpeed;
        Rotation.Pitch = FMath::Clamp(Rotation.Pitch + CameraInput.Y * CameraRotationSpeed, -85.0f, 85.0f);
        CameraSpringArm->SetRelativeRotation(Rotation);

I had to clamp the pitch to hide the gimbal lock problem. But this prevent users to rotate completely around objects.
I don't understand why the Z rotation (the yaw) occurs on the world z axis ( FVector::UpVector which is (0, 0, 1)) and not on the local z axis. It turns out that this is exactly what I want.

I tried to solve this gimbal lock problem with this other method:

        // Taken from https://answers.unrealengine.com/questions/232923/how-can-i-avoid-gimbal-lock-in-code.html
        FRotator RotationDelta(CameraInput.Y * CameraRotationSpeed, CameraInput.X * CameraRotationSpeed, 0.f);
        FTransform NewTransform = CameraSpringArm->GetComponentTransform();
        NewTransform.ConcatenateRotation(RotationDelta.Quaternion());
        NewTransform.NormalizeRotation();
        CameraSpringArm->SetWorldTransform(NewTransform);

It works, but this time, the Z rotation (yaw) occurs on the local Z axis. How can I change it to rotate around the world Z axis, and the local Y axis, without gimbal lock?

I tried this hybrid solution, but the gimbal lock is still there:

        // Hybrid
        FRotator RotationDelta(CameraInput.Y * CameraRotationSpeed, 0.f, 0.f);
        FTransform Transform = CameraSpringArm->GetComponentTransform();
        FRotator Rotation = CameraSpringArm->GetComponentRotation();
        Rotation.Yaw += CameraInput.X * CameraRotationSpeed;
        Transform.SetRotation(Rotation.Quaternion());
        Transform.ConcatenateRotation(RotationDelta.Quaternion());
        Transform.NormalizeRotation();
        CameraSpringArm->SetWorldTransform(Transform);

I did solve this problem (a long time ago) in OpenGL using quaternions, so I tried this version:

        // Quaternion
        FRotator Rotator = CameraSpringArm->GetComponentRotation();
        FQuat Quaternion = Rotator.Quaternion();
        // Rotate around the world Z axis:
        Quaternion *= FQuat(FVector::UpVector, FMath::DegreesToRadians(CameraInput.X * CameraRotationSpeed));
        // Rotate around the local Y axis:
        Quaternion *= FQuat(Rotation.RotateVector(FVector::RightVector), FMath::DegreesToRadians(CameraInput.Y * CameraRotationSpeed));
        CameraSpringArm->SetRelativeTransform(Quaternion);

But this does not work. I also tried this:

        // Quaternion + transform
        FTransform Transform = CameraSpringArm->GetComponentTransform();
        Transform.ConcatenateRotation(FQuat(FVector::UpVector, FMath::DegreesToRadians(CameraInput.X * CameraRotationSpeed)));
        Transform.ConcatenateRotation(FQuat(Rotation.RotateVector(FVector::RightVector), FMath::DegreesToRadians(CameraInput.Y * CameraRotationSpeed)));
        Transform.NormalizeRotation();
        CameraSpringArm->SetWorldTransform(Transform);

without success.

sentences:
Positions are the same but appear in different locations I have a procedurally generated tile that is a part of a turn-based hex tile game. When I try to have the tile instantiate a prefab that is the placeholder for a unit, I used the tile's transform.position as the position part of GameObject.Instantiate(Object, Location, Rotation). Unfortunately, this is the result:

A similar thing happens no matter which tile I use.

More information: I tried placing a cube on where the hex is, supposedly. Its transform is very different. So what it appears to be is that the tile is being placed in the wrong place, not the cube.

Further experimentation shows that the cube is appearing at exactly half the hex's apparent transform (I added a multiplier of 2 to the cube's position and it appeared in the right spot). I still have no idea why.

sentences:
Is a computer science degree worth it? I'm in my last year of high school, and I've been looking at colleges. I'm taking a C++ class at a local community college and I don't feel that it's worth it. I could have learned everything in that class in a week.

This had me thinking, would a CS degree even be worth it? How much can it teach me if I can learn everything on my own? Even if I do need to learn more advanced subjects, many colleges put their material online AND I can buy a book. Will companies hire me if I don't have a CS degree? If I have a portfolio will I stand a chance? What kind of things are needed in the portfolio?

I want to live doing what I love - programming. So I will do it. I'm just not sure that a CS degree will do anything to me. In addition, if there is a benefit to getting a CS degree, what places are the best?

sentences:
Blender Edge Split Alternative What other options/alternatives are there to "edge split" for smooth shading low poly game models.

As I understand it, edge split does what it say's, its splits the mesh therefore increasing the vert count.  I have considered manually marking the edges as sharp however I would imagine this leaves artifacts on the model(in-game) ?

Cheers.

sentences:
Unity: Texture huge areas with decals I'm using 1024 textures for smaller buildings and 2048 for larger one's. Basic workflow:

1) Unwrap in Blender

2) Smack a concrete texture on it

3) paint some dirt here and there.

Result:

This only works for small buildings. Here is an example from Battlefield 2, they put a small 128x128 brick texture and tiled it across the entire building and added Dirt on top of that.

Is there a way to do this using Unity or do I have to create my own custom shaders? (God forbid)

sentences:
How do I implement friction in a billiards game? I'm having trouble implementing friction in a billiards game.

Currently, the ball only slows on collision with the edges, but I also want some friction with the background.

How can I implement friction? (I'm using PhysicsJS.)

sentences:
Strange warping/shimmering effect with Unity Tilemap and Cinemachine I'm using a Cinemachine Virtual Camera in a 2D project to follow around a target. The ground / background is a Unity Tilemap GameObject.

As you can see in the gif above (or on Imgur), when following around the player (a 24x24 sprite), the background tiles seem to warp or shimmer a bit.

I've tried to script all types of solutions to adjust the Virtual Camera transform position and hopefully snap/move it "correctly" to no avail.

I don't even know for sure that the source of the issue is with the camera setup. I'm running out of solutions to something that seems like a pretty straightforward and very common scenario. I've created a sample project illustrating the issue which can be downloaded here.

Using Unity 2017.3.1f1 Personal. The background sprites are 32x32, with a PPU of 32. No compression, Point (no filter), rendered using a material with Shader: Sprites/Default, and Pixel snap.

Cinemachine Virtual Cam is set to Ortho lens size 16, Body: Framing Transposer with default settings.

Thank you so much for any suggestions or tips!!!

It feels similar to what's being described here with sub-pixel movement but I don't know for sure, and the solution in that blog post seems like it should be unnecessary (but again - maybe not).

I've created camera scripts and attached them to the virtual camera as follows:

float maxPixelHeight = 32;
CinemachineVirtualCamera vcam;

public void Awake()
    {
        float scale = Screen.height / maxPixelHeight;
        float orthographicSize = (Screen.height / scale) / 2f;
        vcam = GetComponent<CinemachineVirtualCamera>();
        vcam.m_Lens.OrthographicSize = orthographicSize;
}

    public void Update()
    {
        Vector3 tempPos = vcam.transform.position;
      Vector3 newPos = new Vector3(Mathf.RoundToInt(tempPos.x), Mathf.RoundToInt(tempPos.y), Mathf.RoundToInt(tempPos.z));
        vcam.transform.position = tempPos;
    }

I've also tried:

public void Update()
    {
        Vector3 tempPos = vcam.transform.position;
Vector3 newPos = new Vector3((float)System.Math.Round((decimal)tempPos.x, 2) , (float)System.Math.Round((decimal)tempPos.y, 2), (float)System.Math.Round((decimal)tempPos.z, 2));
        vcam.transform.position = newPos;
    }

and something like:

public void Update()
    {
        Vector3 tempPos = vcam.transform.position;
        vcam.transform.position = new Vector3(RoundToNearestPixel(tempPos.x), RoundToNearestPixel(tempPos.y), RoundToNearestPixel(tempPos.z));
    }

    public float RoundToNearestPixel(float unityUnits)
    {
        float valueInPixels = unityUnits * maxPixelHeight;
        valueInPixels = Mathf.Round(valueInPixels);
        float roundedUnityUnits = valueInPixels * (1 / maxPixelHeight);
        return roundedUnityUnits;
    }

sentences:
Lerp problem object teleporting not moving Hi i just wanna move my object smoothly from one position to another but object disappear and immediately teleport to position where i clicking anyone know whats happen ?

    if (Input.GetKeyDown(KeyCode.Mouse0))
    {

        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit, 1000.0f))
            {

                Vector3 newpos = new Vector3(hit.point.x, 0, hit.point.z);
                Cube40.transform.position = Vector3.Lerp (Cube40.transform.position, newpos, 1f);

            }
    }

Thank you Vishnu i already fix it with code below your code was better anyway but there is another problem with Lerp method itself because no matter where i click object always transform his position with the same time and it can't be use in RTS game
rather i need something like transform.Translate with from:Vector3, to:Vector3 parameters.

GameObject Cube40;
RaycastHit hit;
Vector3 newPosition;

void Start()
{

    Cube40 = GameObject.Find("Cube1");
    newPosition = Cube40.transform.position;

}

void Update()
{

    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    if (Physics.Raycast(ray, out hit, 1000.0f))
    {

        Vector3 newpos = new Vector3(hit.point.x, 0, hit.point.z);
        if(Input.GetKeyDown (KeyCode.Mouse0))
        newPosition = newpos;
        Cube40.transform.position = Vector3.Lerp (Cube40.transform.position, newPosition, 0.1f);

    }
}
}

sentences:
Codify user progress I want to generate a string-code for the user that represents his progress in the game (so he can load this state somewhere else).
I don't want him to be able to guess the system and thus load a state which he hasn't yet achieved.

The following variables are involved:

A number X between 1-30 representing the highest level he unlocked.
For each level lower than X a boolean representing whether he made the level on hard or not.
For each secret object he could have found (also roughly 30) another boolean.

My idea was to just build a binary number from all these but that's just way too easy for the user to hack. If he beats level 1 and then saves, he will see his code being something like 0x1, while having bet level 10 will be something like 0x200.

sentences:
keyPressed is not working after adding ActionListener to JButton I have a serious problem while trying to build a menu for my game.
I've added two JButton to a main JPanel and added an ActionListener for each of them. The main JPanel also contains the game JPanel which have the keyPressed method inside keyController.

That's how it looks -

Main ->
      JPanel ->
        JButton, JButton,
        JPanel which contains the game and keyPressed function inside KeyController class which worked fine before I added the ActionListener for JButton.

For some reason after I added an ActionListener for each of the button, the game JPanel is not getting any keyPreseed events nor KeyRealesed.
Does anyone know the solution for my situation?
Thank you very much!

Main window -

  Scanner in = new Scanner(System.in);

    JFrame f = new JFrame("Square V.S Circles");
    f.setUndecorated(true);
    f.setResizable(false);
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    f.add(new JPanelHandler());
    f.pack();

    f.setVisible(true);
    f.setLocationRelativeTo(null);

JPanelHandler(main JPanel) -

  super.setFocusable(true);

        JButton mybutton = new JButton("Quit");
        JButton sayhi = new JButton("Say hi");

        sayhi.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e)
        {
            System.out.println("Hi");
        }
        });

         mybutton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e)
        {
           System.exit(0);
        }
        });
        add(mybutton);
        add(sayhi);
        add(new Board(2));

Board KeyController(The code inside is working so it's unnecessary to put it here) -

private class KeyController extends KeyAdapter {

    public KeyController()
    {
        ..Code
    }

    @Override
    public void keyPressed(KeyEvent e) {

    ...Code

    }

    @Override
    public void keyReleased(KeyEvent e){

     ...Code

    }

}

sentences:
Rendering Trailing Effect Using Opengl I have to develop a game for my Graphics Course. I came across this video on the net.

http://www.youtube.com/user/stanfordcs248

I want to know how are the hazy/smoky effects which trails along with the cube is rendered using OpenGL and c++?

sentences:
Sponza scene with more physically motivated materials fit for physically based renderers I've tried it with the default values and a lighting model copied straight from here, but the results were ludicrous. Basically since everything is way too shiny (high specular material values), most of the screen is very white unless I set the light intensity to a very small value or manually change roughness of the materials to very high values, in which case everything looks like someone spent years polishing the stuff.

Is there a version of the scene around with more physically motivated materials? Or am I just using them/interpreting them wrong?

The reason I even ask is because the scene seems to be very popular as testmaterial for global illumination algorithms, where physically based lighting seems to be commonplace.

sentences: Does the base game I choose for a steam mod matter? Me and a couple of my friends are planning on trying to make a source mod, but we can't figure out how to tell what game to use as a base. We hope to make a totally different game with it, and aren't sure how much of the base game will actually hang around. Like if we chose TF2 for the base would we be stuck with cartoony graphics and teams?

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:
Darkness, and a candle My game has a Pokemon-type movement mechanic.

I would like my level was a pitch black level, but the player having a candle can lighten a circular area, and so walk without being able to see more than some near steps beyond him. I.e. not being able to see the whole map.

How can I acheve that in Gamemaker Studio?

Elements in my game:

A character, moving squarely tile by tile.
A wall. Just a wall.
A background for the floor.

The game is not about Pokemon, but think as if I'm using the same mechanics for movement. It also happens to be the same concept as the flash HM in a cave.

sentences:
Why haven't graphics cards been designed for voxel rendering? I stumbled across the following article on Wikipedia regarding voxels that says:

  One such problem cited by Carmack is the lack of graphics cards designed specifically for such rendering requiring them to be software rendered, which still remains an issue with the technology to this day.

Does anyone know why this is the case and why voxels are not supported or optimized on a hardware level by graphics cards?

sentences:
Deferred Lighting - How to map to the generated texture? I'm trying to implement deferred lighting and I have done the first and second pass but I'm stuck on the third as I don't know how to map from the current pixel being drawn to the generated texture with the light.

Generated texture with light calculated

Current picture

I would appreciate it if someone could help me figure out how to map my generated texture with the current pixel I'm drawing.

I don't know if it matters, but I'm working with DirectX but an explantion with OpenGL would also be welcomed.

sentences:
GA - Genetic Algorithm for Enemy So I'm starting a project which aims to make a good AI for my game monsters.

So far I have set up the GA and got some results.

There's two genes, with one chromosome each.

The monster either 'attacks on sight' or 'flee on sight' depending on the gene it got. The fitness function is based upon time alive and the crossover is just eliminating the worst gene.

As expected the 'flee on sight' gene got better result.

What I'm here to ask is what are some good uses of GA in developing AI. Which genes/chromosome/fitnessfunction/crossover should I implement in order to have a challenging AI.

The game is a rogue-like, it's still pretty simple, not much added, so I can make the game around the GA instead of the other way around.

This may be a too broad question, but bear in mind that I don't have any experience in gamedev and AI as a whole.

EDIT:

To make this question a bit more narrow.

Since my fitness function is just 'survive' it's quite obvious that all the enemy generations would get better at fleeing. So,

What should I put in consideration to a good fitness function.

Damage to the player is also quite one-way solver, a monster-healer which doesn't have any attack power would drop his staff and punch the player.

The perfect fitness function for me should translate to 'make the player struggle', but I don't know what that would mean in the game terms, and specially code terms.

sentences:
Why separate data from logic? I don't understand the purpose of separate SystemClass for functions.
My composition looks like this:

class Color {
   void Blend(uint32_t entityID, float factor) {
      red[entityID] *= factor;
      green[entityID] *= factor;
      blue[entityID] *= factor;
   }

   static std::vector<float> red;
   static std::vector<float> green;
   static std::vector<float> blue;
}
std::vector<float> Color::red;
std::vector<float> Color::green;
std::vector<float> Color::blue;

I am keeping vectors of members to have possibility to iterate over specific member instead of loading whole struct.

My question is: what exactly is the reason for SystemClass with only logic?

class ColorComponent {
   static std::vector<float> red;
   static std::vector<float> green;
   static std::vector<float> blue;
}
std::vector<float> ColorComponent::red;
std::vector<float> ColorComponent::green;
std::vector<float> ColorComponent::blue;

class ColorSystem {
   void Blend(uint32_t entityID, float factor) {
      ColorComponent::red[entityID] *= factor;
      ColorComponent::green[entityID] *= factor;
      ColorComponent::blue[entityID] *= factor;
   }
}

How the second composition suppose to be better for performance?

I will be very grateful for explanation.

sentences:
How to smoothly track and draw player movement? I am currently using C# XNA Framework to simply connect some development concepts that I've learned/used over the past few months. Right now I have a Web Service that keeps track of connected clients and their 2D positions. I have a very small map that uses triangles to represent clients and their positions.

What I am seeing is my client updates very smooth (because I update my own position locally before sending it off to the web service), however, other triangles come in and appear choppy.

I use a web service that is called approximately every 20ms (and responds pretty quickly might I add). However, I know that XNA framework calls its update/draw methods approximately 60 times per second correct? Given this, there is ALWAYS going to be the appearance of choppiness.

Is there some strategy or pattern to handling this? I thought about implementing a method on the client side that basically says, give me start position and end position and I'll transition the triangle between the two points smoothly. But this may not be the right answer.

What are folks thoughts?

I am using a NetTcpBinding from WCF (Duplex). Is this technology simply too slow?

Is the right strategy simply to let the Service always tell me where the other clients are and the client simply draws them there?

Or does the client compute other information and make assumptions etc?

Thanks for any information on this topic!

sentences:
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:
How do I implement a field of vision for AI entities? I am considering how to implement a field of vision system for my AI entities, but am not sure on the order of steps to take. The thought process that I had was to use a combination of radial distance and dot product.

Keeping in mind that this is a 3D environment (meaning that all vectors have 3 components), and I will be using quaternions for the orientation of all entities.

What order should I do these in? and is my logic accurate?

Dot product: Taking the position of the playerObject, and the position of the AIEntity create a vector, and then take the orientation quaternion, and convert that to a vector of fixed length, and perform the dot product between them (testing for a specific range of values) to see if it is within a given arc.

Radius test: Simple 3D radius to determine distance.

I know for sure that a dot product test should be quite simple (3 subtractions, 3 multiplications, 2 additions, and however many operation to turn a quaternion into a vector), but arriving at the orientation vector I have no direct idea (if this process could be explained it would be of great help, I know I would have to multiply by the needed magnitude after normalizing), and radius test is also simple (3 subtractions, 3 additions, and 4 multiplications) both of these would still include a boolean tests, but which order would reduce faster?

My first guess would be to be the dot product, and then the radius test; As the dot product would be outside of bounds if the player is outside of the arc or to far away, and the radius test would only fail if the object is to far away. I understand that both tests can give false positives, but for some reason I feel that the dot product test would give fewer.

sentences:
How to stop 3D model from reflecting light like plastic I was browsing SketchFab and found a 3D model I decided to try in Unity.

This is how the model looks in SketchFab's viewer:

When I put it in Unity, I used a Directional Light object:

As you can see, it looks like plastic. I have been playing with the light's intensity, but the model seems to always reflect light as if it were some sort of plastic (unlike SketchFab's viewer).

How can I make it look like the above image?

The model is https://sketchfab.com/models/1ee9b44352c840bda4202895948c30bb

sentences: How to make sure that all the UI elements were the same size on all screens in new Unity 4.6 UI system I have made a HUD for my 2d mobile game with the help of the new UI system, that was introduced in Unity 4.6. But when I am trying to play game in Unity editor, the UI elements have normal size, but when I am playing this game on mobile devices, they have more small size than in editor. Why this is happening? May be I missed something while watching Unity tutorials about new UI system. Can anyone help me please.

sentences:
Minimal, unrealistic physics engine I'd like to prototype a game with custom, very simple physics. Something similar to older games, anything from Super Mario to Quake 3 Arena.

I'd prefer to avoid realistic physics engine because they usually reduce the control you have over your objects and require you to manipulate such objects in a specific way.

I'd want to be able to update the objects' physical state using my own rules. E.g. I'd like to implement and apply gravity, movements and all the rest using my own logic.

I believe that what I need is a small engine that handles an efficient representation of objects in a space and offers an interface to query it.
I'd also need it to offer decent utilities for very common problems such as collision detection, ray casting, moving overlapping objects away from each other etc.

Do similar engines even have a name?
They're not considered physics engine, are they?

I was planning to work on a 3D prototype, and use JavaScript and Three.js as a language and scene-graph/renderer. However I might be open to 2D environments and/or different technologies.
I'd love it if I could find a set of libraries that are meant to work with each other, so that I don't need to write a lot of glue code.

sentences:
Detecting walls or floors in pygame I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet hits the bottom, top or sides, its vector is adjusted accordingly. However, sometimes when I shoot, the bullet doesn't bounce, I think it's when I shoot at a border between two blocks.

Here is the update method for my Bullet class:

def update(self, dt):
    if self.can_bounce:
        #if the bullet hasnt bounced find its vector using the mousclick pos and player pos
        speed = -10.
        range = 200
        distance = [self.mouse_x - self.player[0], self.mouse_y - self.player[1]]
        norm = math.sqrt(distance[0] ** 2 + distance[1] ** 2)
        direction = [distance[0] / norm, distance[1 ] / norm]
        bullet_vector = [direction[0] * speed, direction[1] * speed]

        self.dx = bullet_vector[0]
        self.dy = bullet_vector[1]

    #check each block for collision
    for block in self.game.solid_blocks:
        last = self.rect.copy()
        if self.rect.colliderect(block):
            topcheck = self.rect.top < block.rect.bottom and self.rect.top > block.rect.top
            bottomcheck = self.rect.bottom > block.rect.top and self.rect.bottom < block.rect.bottom
            rightcheck = self.rect.right > block.rect.left and self.rect.right < block.rect.right
            leftcheck = self.rect.left < block.rect.right and self.rect.left > block.rect.left
            each test tests if it hit the top bottom left or right side of the block its colliding with
            if self.can_bounce:
                if topcheck:
                    self.rect = last
                    self.dy  *= -1
                    self.can_bounce = False
                    print "top"

                if bottomcheck:
                    self.rect = last
                    self.dy  *= -1 #Bottom check
                    self.can_bounce = False
                    print "bottom"

                if rightcheck:
                    self.rect = last
                    self.dx  *= -1 #right check
                    self.can_bounce = False
                    print "right"

                if leftcheck:
                    self.rect = last
                    self.dx  *= -1 #left check
                    self.can_bounce = False
                    print "left"

            else:
                # if it has already bounced and colliding again kill it
                self.kill()

    for enemy in self.game.enemies_list:
        if self.rect.colliderect(enemy):
            self.kill()
    #update position
    self.rect.x -= self.dx
    self.rect.y -= self.dy

This definitely isn't the best way to do it but I can't think of another way. If anyone has done this or can help that would be awesome!

sentences:
How to hit an enemy, or "how do entities interact with each other?" The title might be a tad simple for the purpose, but bear with me.

I'm a tad lost about how to do the interaction between game objects. I use an entity-component-system framework and I've got the basics up and running: the player can run around, collisions get reported correctly, graphics are updating nicely and so on. I even have an AI enemy wandering around.

However, what if I want to hit the enemy with a sword? How do I know what the player hit? The naive solutions (for e.g. Box2D) do something like this:

void BeginContact(b2Contact* contact)
{
    // Get the colliding bodies
    b2Body* body1 = contact->GetFixtureA()->GetBody();
    b2Body* body2 = contact->GetFixtureB()->GetBody();

    // Get the user data
    int body1UserData = body1->GetUserData();
    int body2UserData = body2->GetUserData();

    // Check if the enemy hit the player
    if((body1UserData == PLAYER && body2UserData == ENEMY) ||
       (body2UserData == PLAYER && body1UserData == ENEMY))
    {
        // Enemy collided with player, damage the player
        causeDamageToPlayer();
    }
}

This solution "works", but to my understanding has very little use in real-life scenario. Again: what if I want to hit an enemy with a sword? Which enemy did I hit? Should I really keep adding and removing the sword collider from the game world? I can't really find any good reads on this topic. There's lots of articles and books about game engines, but the actual game architecture is commonly left out.

I'm purposefully leaving this a bit vague since there is probably multiple ways to do that. I'm after some real-life usage examples and how to do things in a bigger scale, where there's tens of different enemies / entities, various weapons and so on.

sentences:
2D Sideview Procedural Water Generation How can I generate water in a procedural 2D sideview landscape?

Here's what I currently have:

First generate the heightmap of the land
Then generate the water, based on the land

Here's how I generate the water based on the land:

Assign each block a lake target for water (rain) flow.

First, choose the best direction.
Then, for each block it checks along the way, calculate the slope between that block and the next block. If that slope is zero, keep on going to create a noninteger slope, until a MAX_BLOCK_DELTA_X is reached. If this accurate slope is close to zero, we say the water drains or evaporates. Otherwise, keeping searching for the bottom of a lake, until the slope goes up again.

Next, lakes are created, based on the most targets chosen in one proximity.
Lastly, the lake height is calculated from the lake's amount of water (I don't know how to do this).

I see some problems with my current algorithm, like if the bottom of a lake is flat the water drains. Could this be improved? If so, how? Either way, how would I calculate the lake's height? How would I do rivers?

Edit: Caves and overhangs are not allowed.

Edit 2: This answer of my other question provides a way to identify valleys. I think this could be used, but I don't know which end to start scanning.

sentences:
How to blend two cameras when traveling through a portal in Unity3D Before I get to my question, I know the most obvious solution would be to use the normalized view port rect, however I need more complex shapes than a rectangle, and I've looked in to using the view port rect and it seems to not be my solution.

EDIT:
Some people were confused by my question, let me go in to a bit more detail.

What's happening is as the player moves in to one portal, I create a clone FPS controller and move it out of the other. This gives me two cameras, and the view you see on the right above. It's just showing one camera, and clipping through the portal. What I want is something similar to this where the cameras blend to create the illusion of a smooth transition. What I want to do is delete everything from the green checker image to the left in the image below, and replace that with the other camera. That way you get the part of camera A's view that is peaking out of the portal, blended with the part of camera B's view that's peaking out of the other portal, to get one complete image. And as you move through the portal the cut changes appropriately.

I've been designing a portal system, I have everything down, including getting the player to smoothly move through the portal. My main problem now is getting that camera blend effect Valve does. I need two cameras to blend together seamlessly, as if you were poking your head through the portal. And it can't just be a rectangle, it has to match however the player is looking through the portal.

My best lead on this right now is to possibly project a depth mask shader behind each portal, then make the camera from the portal you're traveling to be depth only. Then somehow mix the two cameras. My main problem is figuring out exactly how I'd do this, how to make the second camera only render what's outside of the portal, and have the rest default to camera 1 to get one full screen projection.

If you could give me ideas, or explain how I may do this with the depth mask shader that would be a tremendous help. I'll continue to work on this and update as I make break throughs.

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:
Pushing an object on other colliders makes the pusher object go through The Wall moves to the right and pushes the Character with it. The character travels along a bunch of Blocks with colliders attached to them.

This is the result:

At some point, the Character gets stuck and the Wall goes through the Character and comes out the other side.

I've tried to play around with the collision detection and other values of the rigidbodies. I tried to add a Physics material with no friction.

I am wondering what could cause this issue.

Here are the values of my GameObjects

sentences:
How to transform only part of an array in OpenGL ES? I have one texture atlas of which I select the "non-animated textures", I put all vertex and UV coordinates in two array:

vertices = new float[] {
            // background
            0.0f, 1920f, 0.0f,
            0.0f, 0.0f, 0.0f,
            1080f, 0.0f, 0.0f,
            1080f, 1920f, 0.0f,
            // character
            240f, 760.0f, 0.0f,
            240f, 14.0f, 0.0f,
            770f, 14.0f, 0.0f,
            770f, 760.0f, 0.0f,
            // object (Will be transformed)
            360f, 800f, 0.0f,
            360f, 600.0f, 0.0f,
            500f, 600.0f, 0.0f,
            500f, 800f, 0.0f,
    };

uv = new float[] {
            // background
            0.50f, 0.25f,
            0.50f, 0.75f,
            1.0f, 0.75f,
            1.0f, 0.25f,
            // character
            0.0f, 0.25f,
            0.0f, 0.75f,
            0.25f, 0.75f,
            0.25f, 0.25f,
            // object
            0.0f, 0.75f,
            0.0f, 1.0f,
            0.25f, 1.0f,
            0.25f, 0.75f
    };

My vertex shader:

uniform mat4 matrix;
attribute vec4 vPosition;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;

void main() {
    gl_Position = matrix * vPosition;
    v_texCoord = a_texCoord;
}

And my fragment shader:

precision mediump float;

varying vec2 v_texCoord;
uniform sampler2D a_texture;

void main() {
    gl_FragColor = texture2D(a_texture, v_texCoord);
}

I don't know how to animate just a part of the arrangements, also I try to create one more texture but when I run the app I only see the last texture.

sentences: For games that time stamp a saved game (think Half-Life), is the entire game state really being saved every time? It seems to me if that were the case that your directory of saved binaries or serialized objects could get massive real quick. Is there some sort of strategy being employed on top of the State pattern that is optimizing each time stamped saved game so that it isn't saving the entire game "context" all the time?

sentences:
How do I make my rigid body rotate a fixed angle value each time I click the movement keys Ive tried some experiments with the character rotation, but I dont want it to rotate when he touches something, but I also need to unfreeze the Z axis rotation or else the character doesnt rotate when I press a key. My code is this right now, each time I press play (with the Z axis unfreeze) the character just turns like 10 degrees each time I press a key and he is still interacting with objetcs, I dunno what I can do and I might need some help :/

public float speed = 2f;
private Rigidbody rb;
private float midJump = 1;
private Rigidbody rB;

//Character Movement

void Start()
{
    rb = GetComponent<Rigidbody>();
}
void Update()
{
    rb = GetComponent<Rigidbody>();

    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");

    Vector3 movement = new Vector3(moveHorizontal, 0f, moveVertical);

    rb.AddForce(movement * speed);

//Character Jump

    if (midJump == 1 && Input.GetKeyDown(KeyCode.Space))
    {
        rb.velocity = new Vector3(0, 45, 0);
        midJump = 2;
    }

//Character Rotation

    else if (rb.velocity.y == 0.0)
        midJump = 1;

    {
        if (Input.GetKeyDown(KeyCode.D))
            rb.AddRelativeTorque(new Vector3(0, 0, 90));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.A))
            rb.AddRelativeTorque(new Vector3(0, 0, -90));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.S))
            rb.AddRelativeTorque(new Vector3(0, 0, 180));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.W))
            rb.AddRelativeTorque(new Vector3(0, 0, 0));
        rb.angularVelocity = Vector3.zero;
    }

}

sentences:
Are javascript MVC model implementations too slow for games? I wanted to implement a game in javascript with an MVC design pattern, with each entity's state stored in a model.
So for example,
In an update loop we iterate over all models and apply the velocity attribute to the position attribute of the model.
A view associated with each entity/model would then receive a position changed event,
and update the representation of the entity.
This would happen independently of the views render method being called in a requestAnimationFrame callback.
What I found though, through a possibly naive implementation, is that setting attributes of a model is simply too slow.
As much as I prefer the architecture of this code, the framerate was significantly lower.
Should I give up on using MVC for frequently updated attributes like position?
Below, I've included some code to test aspects of setting attributes of an object.
The most minimal model-like behaviour, in which an attribute is set only when the new value differs from the current,
and a "changed" update event is triggered, is about 10x slower than just setting attributes directly.
Output:

> test(1000, 100, 10)
object[key]: 163 ms
object[key] if changed: 172 ms
object[key] if changed & emit backbone event: 953 ms
Backbone.Model: 4043 ms
eventsBackboneCount: 100000

var test = function(creations, iterations, keyCount){
  var eventsBackbone = _.extend({}, Backbone.Events);
  var eventsBackboneCount = 0;
  eventsBackbone.on('all', function(){
    eventsBackboneCount = eventsBackboneCount + 1;
  });

  var looper = function(label, create, set){
    var start = (new Date()).getTime();

    var data = {};

    for(var i = 0; i < creations; i++){
      data[i] = create(i);
    }

    for(var j = 0; j < iterations; j++){
      for(var i = 0; i < creations; i++){
        var key = ''+(j % keyCount);
        set(data[i], key, Math.random());
      }
    }

    var end = (new Date()).getTime();

    console.log(''+label+': '+(end - start)+' ms');

    return data;
  };

  looper(
    'object[key]',
    function(id){
      return {};
    },
    function(datum, key, value){
      datum[key] = value;
    }
    );

  looper(
    'object[key] if changed',
    function(id){
      return {};
    },
    function(datum, key, value){
      if(datum[key] !== value){
        datum[key] = value;
     }
    }
    );

  looper(
    'object[key] if changed & emit backbone event',
    function(id){
      return {id:id};
    },
    function(datum, key, value){
      if(datum[key] !== value){
        datum[key] = value;
        eventsBackbone.trigger('changed:'+datum.id, datum, key);
     }
    }
    );

  looper(
    'Backbone.Model',
    function(id){
      return new Backbone.Model({});
    },
    function(datum, key, value){
      datum.set(key, value);
    }
    );

  console.log('eventsBackboneCount: '+eventsBackboneCount);
};

sentences:
Unity3d wheelcollider falling through terrain I have created simple project with 3D car and terrain. I have added 4 Wheel Colliders on model wheels. But when I run project wheels falling through terrain.

Before run:

After run:

I am sure that at start wheel colliders above the terrain and not intersect it. Configuration is:

In what problem is? I have tried a lot of different things but I can't find a solution.

sentences:
What is the best practice for calculating a succesful action? Say for example in my game a player is able to kill an NPC, and there is an x% chance of an item dropping.

When calculating if the item actually dropped or not, what is the best way to calculate a success or failure?

Does the context of the action matter? Would you calculate drop chance the same way as a different RNG event? (x% to gain a perk, etc).

sentences:
Vector class throwing an error after publishing the FLA for generating .ipa from flash CS5 I am creating a flash game for iPhone using Flash CS5. Everything runs smoothly when creating the SWF via Ctrl+Enter. But when I am attaching the .p12 and provisioning profile files and publish the FLA to generate the .ipa there is an error thrown by the compiler that is:

"Incorrect number of arguments, Expected no more than 0"

private static function closestVertexOnOBB(p:Vector,r:RectangleParticle):Vector
{
    var d:Vector = p.minus(r.samp);
    var q:Vector= new Vector(r.samp.x, r.samp.y);

    for (var i:int = 0; i < 2; i++)
    {
        var dist:Number = d.dot(r.axes[i]);

        if (dist >= 0) dist = r.extents[i];
        else if (dist < 0) dist = -r.extents[i];

        q.plusEquals(r.axes[i].mult(dist));
    }
    return q;
}

sentences:
How to create a new civilization mod for Age of Empires 1 Definitive Edition? I want to make a mod for Age of Empires 1 Definitive Edition, in which I split an existing civilization (Phoenicians) into two civilizations:

Eastern Phoenicians: Primarily representing Canaanites
Western Phoenicians: Primarily representing Carthaginians

I want to do so to fix an historical mistake in the development of AOE1 in which the Phoenician tech tree includes war elephants:
As far as I know --- none of the Eastern Phoenicians regularly used war Elephants in their armies:

Eastern Phoenicians from north to south and west to east:

Kingdom of Ugarit | Mittani polities
Kingdom of Tyre   | Kingdom of Aram-Damascus
Kingdom of Israel | Kingdom of Ammon
Kingdom of Judah  | Kingdom of Moab
Kingdom of Edom   | Nabataean polities

My problem

As a webmaster coding primarily in Bash-HTML-CSS-JavaScript-Wiki-Markdown stack who never wrote a GUI program with languages common for the task (such as XML, C++, C# and others) I have no idea where to start.

My question

How to create a new civilization mod for Age of Empires 1 Definitive Edition?

sentences:
OpenGL ES 2.0: Setting up 2D Projection This article describes in general, how to draw sharp OpenGL 2D graphics, using fixed function pipeline.

http://basic4gl.wikispaces.com/2D+Drawing+in+OpenGL

Because OpenGL ES 2.0 has some ES 1.x functions not available (such as: glOrtho()), their functionality must be substituted in Fragment/Vertex shaders.

My question is, how to setup the following 2D projection in programmable function pipeline?

const XSize = 640, YSize = 480
glMatrixMode (GL_PROJECTION)
glLoadIdentity ();
glOrtho (0, XSize, YSize, 0, 0, 1)
glMatrixMode (GL_MODELVIEW)

How Fragment and Vertex shaders must be configured to fully substitute the above mentioned fixed function 2D projection setup?

sentences:
How to test Google Play Multiplayer locally I'm building a simple HTML5 game and I need to implement multiplayer without sharing the game on Google Play.

I'm using CocoonJS's multiplayer api.

How can I test Google Play Multiplayer locally? Do I really have to use websockets instead?

sentences:
How to make pathfinding agents avoid each other using A* in unity? So far Ive implemented a 2D grid graph using 2D physics. My enemies have a seeker script, AI destination setter (with the player position attached) and a basic AIPath script that is set to 2D
When I press play, my enemy game objects move away from the marked area where they can't go, and the area remains static. Is there a way to make this marked area follow the colliders using A*?
This is the script Im using: https://arongranberg.com/astar/documentation/4_1_16_7f164ebc/aipath.html
I don't have the pro version of the above asset though, so can't make use the built in function that handles situation like this.

sentences: What decrease of polycount should occur as a function of distance? What decrease in polycount should occur as a function of distance. I make a terrain and I wounder what is the right formula to keep the "poly size"(the screen size) constant. Or is there some mental flaw in this approach?

sentences:
Creating a toggle button in unity3d Scene vs Scripting I am making my first GUI in unity, and I am not sure if should create the toggle buttons in the game scene by creating new UI elements or by scripting.

Creating them in the game scene gives me more options but I have trouble to manipulate the input.

Because of this I am scripting them in the monodeveloper but it seems more difficult to work the visual side (I am using a texture but can't get rid of the little box (that shows f the button is clicked or not).

How do you make your toggle buttons and how do you develop your GUI?

Any help appreciated.

sentences:
Pixel Collision - Detecting corners How would I go about detecting the corners of a texture when I use pixel collision detection? I read about corner collision with rectangles, but I am unsure how to adapt it to my situation.

Right now my map is tile based and I do rectangular collision until the player is intersecting with a blocked tile, then I switch to pixel collision.

The effect I would like to achieve is when the player hits the corner of an object to push him around the side so he doesn't just hit the edge and stop.

Any ideas?

sentences:
Android notifications with Unity I'm working for the first time on a game for Android using Unity and I need to use Google Cloud Messaging to receive push messages.

I've already done the integration of my Unity project with GCM, using this project, and of now I can receive and read messages sent to my phone while the game is running. However, I want to be able to receive them while the app is closed. Currently, if I send a message and the app is not running, I get an error stating that my app stopped working.

So, in essence, I want to know: what are the steps to handle incoming push messages when my app is closed, display them as a notification in Android and launch my game app when I open such notification? What else should I do outside Unity so my project can handle Android notifications while closed?

sentences:
Accessing C++ class members with LuaPlus I've implemented LuaPlus in my engine eventmanager successfully and really like the flexibility I gained. But I'm still not exactly where I want to be, because I can't link my c++ classes to a Lua class.

For example, I have a Actor class in C++, and I want to be able to create the same class in Lua and gain access to members with LuaPlus, but I can't figure how I can achieve that.

Is this actually LuaPlus built-in functionality, or do I have to write my own interface that exchanges data tables between C++ and Lua?

My current approach would be to fire an event in Lua that creates an new actor class in C++ code, and transfer its ID and the data I need to back to Lua. When I modify the data I send the modifications back to C++ code again, but I actually thought there's something in LuaPlus that exposes this functionality already.

sentences:
Perpendicularity of a normal and a velocity? I'm trying to fake angular velocity on my vehicle when it hits a wall by getting the dot product of the normal of the edge the car is hitting and the vehicle's velocity:

            Vector2D normVel = new Vector2D();
            normVel.equals(vehicle.getVelocity());
            normVel.normalize();
            float dot = normVel.dot(outNorm);
            dot = -dot;
            vehicle.setAngularVelocity(vehicle.getAngularVelocity() +
                    (dot * vehicle.getVelocity().length() * 0.01f));

outNorm is the normal of the wall.

The problem is it only works half the time. It seems no matter what, the car always goes clockwise.

If the car should head clockwise:

--------------------------------------
       /
      /

I want the angular velocity to be positive, otherwise if it needs to go CCW:

--------------------------------------
       \
        \

Then the angular velocity should be negative...

What should I change to achieve this?

Thanks

Hmmm...

Im not sure why this is not working...

        for(int i = 0; i < buildings.size(); ++i)
        {
            e = buildings.get(i);
            ArrayList<Vector2D> colPts = vehicle.getRect().getCollsionPoints(e.getRect());

            float dist = OBB2D.collisionResponse(vehicle.getRect(), e.getRect(), outNorm);
            for(int u = 0; u < colPts.size(); ++u)
            {
                Vector2D p = colPts.get(u).subtract(vehicle.getRect().getCenter());
                vehicle.setTorque(vehicle.getTorque() + p.cross(outNorm));
            }

sentences:
Unity3D - Smooth rotation for seek steering behavior I am trying to implement Reynolds' seek steering behaviour, but I am having problems on the rotation part. This is what I have:

void FixedUpdate()
{
// get position of current waypoint
        Vector3 targetPos = new Vector3(path[currentWaypoint].x, transform.position.y, path[currentWaypoint].z);

        // velocity vector towards target
        Vector3 desiredVelocity = targetPos - transform.position;

        // calculate the steerforce required for the desired velocity based on current velocity
        Vector3 steerForce = desiredVelocity - currentVelocity;
        steerForce = new Vector3(steerForce.x, 0, steerForce.z);
        steerForce = Vector3.ClampMagnitude(steerForce, maxSteer);

        // create a move vector to be added to agent's current position
        // Then normalize it so it can be scaled according to the agent's max speed
        Vector3 moveVector = steerForce.normalized * moveSpeed * Time.fixedDeltaTime;
        transform.Translate(moveVector);
}

How would I do it so my agent will be rotated smoothly based only on the code above? I tried rotating based on the current velocity, but the agents is rapidly rotated in one frame towards the target waypoint. I am not working with rigidbodies.

Am I doing something wrong? What am I missing?

Thanks,
Jack

sentences:
Method of handling audio and memory in game I've started coding a new game project and I've implemented Ogre for the graphics rendering and begun thinking about the audio side of things.

I was considering using the SFML audio component for implementing audio. It is cross platform and can handle streaming music from the file or playing sounds loaded into memory from a buffer.

My initial thoughts were along the line of creating an audio manager class that can load all the relevant sounds into memory and then just be able to play them by reference when required. My concern there was the potential memory use of having a whole lot of sounds loaded into memory.

This is the code I came up with as a very rough test of what I was thinking. Obviously it would need to be improved a lot but it does seem to work.

#include <vector>
#include <string>
#include <iostream>
#include <unistd.h>

#include <SFML/Audio.hpp>

class gameSound
{
public:
gameSound();
~gameSound();

bool loadSound(std::string filename);

std::string name;
sf::SoundBuffer buffer;
sf::Sound sound;
};

gameSound::gameSound(){}
gameSound::~gameSound(){}

bool gameSound::loadSound(std::string filename) {
if(!buffer.loadFromFile(filename))
    return false;

sound.setBuffer(buffer);

return true;
}

class SoundManager
{
public:
SoundManager();
~SoundManager();

void PlaySoundByName(std::string name);
void AddSound(gameSound* snd);

std::vector<gameSound*> sounds;
};

SoundManager::SoundManager(){}
SoundManager::~SoundManager(){

while(!sounds.empty())
{
    sounds.pop_back();
}

}

void SoundManager::AddSound(gameSound* snd) {
sounds.push_back(snd);
std::cout << "gameSound added with name: " << snd->name << " total sounds : " << sounds.size() << std::endl;
}

void SoundManager::PlaySoundByName(std::string name) {

for(std::vector<int>::size_type i = 0; i != sounds.size(); i++) {
    if(sounds[i]->name == name) {
        std::cout << "Match found for " << name << std::endl;
        sounds[i]->sound.play();
    }
}

}

int main()
{

SoundManager* smgr = new SoundManager();

gameSound* s1 = new gameSound();
s1->loadSound("sound.ogg");
s1->name = "Sound";

gameSound* s2 = new gameSound();
s2->loadSound("alarm.ogg");
s2->name = "Alarm";

gameSound* s3 = new gameSound();
s3->loadSound("dog-grunt.ogg");
s3->name = "DogGrunt";

smgr->AddSound(s1);
smgr->AddSound(s2);
smgr->AddSound(s3);

smgr->PlaySoundByName("DogGrunt");

sleep(2);

smgr->PlaySoundByName("Alarm");

sleep(2);
return 0;
}

I know with most systems these days, especially gaming systems, there is usually plenty of memory so it might not be an issue. I was considering implementing a way to load the most important sounds into memory for instant access and then have less common sounds loaded and freed from memory as they are required.

I am interested to know how others have approached the handling of audio required for a game and if I am on the right track.

sentences:
Make a square flickering at a preset frequency I'm working on a medi-sci project where I want the patient to use brainwaves to exercise control the environment.

The environmnet is a 2D game where the game character is to be controlled by 2 flickering squares. Each square are supposed to be on different frequencies e.g. 7Hz and 9Hz. They should flicker between black and white.

These frequencies will be measured on the brain and used to move the characters in a BCI solution. The project is being made in Unity and in c#.

I tried to use the animator and the Update function in Unity to get a flickering but it didn't work out (Read: It was very bad) because when the game became slow so did the flickering. I couldn't use that.

A friend told me that there's a difference between CRT and LCD screens so the refresh rate is different and can't be used the same way.
I was also told to look into Timer.Interval in C# (or just the Timer class) and use that to switch between black and white squares to get the right frequency.

Is there anyone who could show me how to do this the right way in unity with C#?
I mean how can I use Timers.Interval or System.Timers.Timer (or something else in the Timer class) to give me the right frequency in Unity?

I would prefer an example because I can't see any way of getting to the solution at all...

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:
UnityEvent Array coding C# I am fairly new to Unity 5, as I was browsing through some prefabs, I found one for the Main menu in which UnityEvent was used in scripts to list down the menu options.

This UnityEvent was an array UnityEvent [ ] Event, which was nowhere initialized to anything but was showing no compiler errors and also during run, it was pointing to some predefined sets which the author was mentioning in the user manual... My questions are :

Is it possible to use UnityEvent Array without mentioning the size of the array.
What happens to the UnityEvent if we don't mention any of the events, but the Invoke functionality is called during runtime.

Btw, the prefab i used from was :Main Menu with Parallax effects

sentences:
How would I get this to UV map correctly? Alright so I have my code to draw out a big landscape using C++ and DirectX. I had it textured with one texture and then needed to add more. I saw people doing it where they had 1 texture image and the image contained 2 textures. Thats what I made, it's a 256x128 image. My problem now is that since my terrain automatically generated the coordinates to UV map 1 texture now it is displaying both textures. I need to make it so when the height of the world is high enough it is 1 texture and everything under is another texture. My code for the UV coordinates,

Vertices[y * WIDTH * x].U = x / 1.28;

Vertices[y * WIDTH * x].V = y / 1.28;

those are my mapping coordinates, X is the current X value of the vertice it is drawing and the Y value is its current y position. The heightmap is 128x128 so I divided by 1.28 to make it so that each polygon had the texture UV mapped on it. The height is calculated as well since I am loading a heightmap and im trying to get it so when it is high enough it UV maps 1 half of the image and if it is the other it UV maps the other side of the image. Someone please help!

sentences: Cross platform C++ UDP socket library Can somebody recommend a free C++ open source library which I will use to build a networked game using UDP. Must be available for Windows/Linux/Mac. As lightweight as possible please.

sentences:
Character can't jump in other angle with fixed angle off I turn off fixed angle so my character can rotate, but it can only jump in 1 angle but I want it to jump in every angle.

How do I do that?

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;
  public Vector2 jumpDirection = new Vector2(0f, 0f);
  public float jumpFocre = 500f;
  bool doubleJump = false;

  void Start ()
  {
    anim = GetComponent<Animator> ();
  }

  void FixedUpdate () {
    grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
    anim.SetBool ("Ground", grounded);

    if (grounded)
      doubleJump = false;

    float move = Input.GetAxis ("Horizontal");
    anim.SetFloat ("Speed", Mathf.Abs (move));

    GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);
  }

  void Update()
  {
    if((!doubleJump) && Input.GetKeyDown ("up"))
    {
      anim.SetBool("Ground", false);
      float move = Input.GetAxis ("Horizontal");
      jumpDirection.x = move;
      GetComponent<Rigidbody2D>().AddForce(jumpDirection.normalized * jumpFocre);

      if(!doubleJump && !grounded)
        doubleJump = true;
    }
  }

  void Flip()
  {
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
  }
}

sentences:
Flash AS3 sidescrolling tiles optimization I'm trying to make a sidescrolling game in Flash that will run on a low performance laptop.

While studying the subject from Tonypa I saw that he builds a Bitmap by making copys of the BitmapData of each tile from the Tile Sheet and placing it on the bigger Bitmat with the size of the screen.

But when I came to think on how to scroll my map I ran into some optimization doubts.
I came up with two choices:

Create a MovieClip, place a Bitmap instance for each tile that is shown on the screen + 1 row in it, then move them all. Then when the tile ran off the screen I would move it to end of the MovieClip and replace their BitmapData for the next row in my map.
Use a Bitmap with copys of each tile in it (as shown in Tonypa's tutorial) but 1 extra row, move the whole Bitmap, and when it comes the time to replace rows, redraw the whole Bitmap and move it back to the origin position.

The first idea is how a co-worker of mine suggested, the second one is my own, but none of us has enough technical knowledge to be sure on a technique that would be optimal in performance, can anyone help?

sentences:
Efficient sprite animation display methods? I'm making a game sprite, with animations for transitioning to different states, such as idle, sleeping, etc. I'm wondering what the most efficient way to play the animations is. As of now, I have a couple of ideas:

store all frames as separate PNG images, and display only the frames for the current state (e.g. play frames 1-5 for idle, 5-10 for transitioning, 10-15 for sleeping)
make the animations into GIFs and play the one corresponding to the current state.
merge them all into a spritesheet.

Please let me know which would be the best approach, or if there's a better way to do things. I'm new to handling images and animation with code, so I'm not sure what the advantages and disadvantages are. Thanks!
In case the information helps anyone, I'm planning to use Python for this (although I could also do Java or C++, if there are good solutions in those languages), and the sprite image size isn't large, it's pixel art.

sentences:
How do games deal with Z-sorting partially transparent foliage textures? I was busy implementing basic transparency in a prototype I'm working on when something occurred to me.

In order for a given texture's transparency to work as expected, the (semi-)transparent texture must be drawn after whatever is behind it, right?

Well, if we take for example a tree or shrub in a game like Skyrim, the texture(s) that make up the foliage on that tree or shrub must include some transparency somewhere, right?  A vertex-perfect leaf model would be far too resource-intensive.  But the player can move around, and sometimes through, any plant at will, thus changing the relative position of all textures to the camera.

Doesn't this mean that the game has to constantly Z-sort all textures, both between models and even within a single plant model, whenever the player moves (so potentially every single frame)?  Isn't that very resource-intensive?  How do games with lots of partially transparent textures deal with this?

sentences:
Antialiasing shader grid lines I would like to have in-game grid lines similar to ones found in Unity editor. There is simple solution(first listing) based on shaders found on unity forums(on right image). However, that solution does not take in account antialiasing and drawn lines looks terrible even few units away from camera.

float4 frag(vertexOutput input) : COLOR {
    if (frac(input.worldPos.x / _GridSpacing) < _GridThickness
        || frac(input.worldPos.z / _GridSpacing) < _GridThickness) {
        return _GridColour;
    }
    else return _BaseColour;
}

In order to address that, I tried using typical fwidth/smoothstep combination:

float4 frag(vertexOutput input) : COLOR{
    float distX = min(frac(input.worldPos.x / _GridSpacing), 1.0 - frac(input.worldPos.x / _GridSpacing));
    float distZ = min(frac(input.worldPos.z / _GridSpacing), 1.0 - frac(input.worldPos.z / _GridSpacing));
    float dist = min(distX, distZ);
    float delta = fwidth(dist);
    float alpha = smoothstep(_GridThickness - delta, _GridThickness, dist);
    return lerp(_GridColour, _BaseColour, alpha);
}

Even though it has nice fade, the result is not quite near to perfect - not only the lines looks thinner(which can be somewhat fixed by increasing width), but also have various artifacts(e.g. in joints) and horizontal lines disappear much sooner than vertical ones. Detail image(anti aliased on left):

I am interested in shader solutions, since according to answer to similar question relying textures there in can be no solution with textures. In addition I would like grid lines fade at reasonable distance(when closely inspecting aliased overview image you can see where plane ends) rather than continuing to infinity.
Full current version(for testing purposes) with signed distance.

sentences:
libgdx universal tween engine how to control the tweening speed? How can i control the speed of a tweening sprite? Here is the code:

in create ()

/*try tween*/
            w = Gdx.graphics.getWidth();
            h = Gdx.graphics.getHeight();

            texture = new Texture("nube_png_by_diieguiitoh-d4vhyzb.png");
            texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

            sprite1 = new Sprite(texture);
            sprite1.setPosition(50,0.25f*h);

            Tween.registerAccessor(Sprite.class, new SpriteAccessor());
            manager1 = new TweenManager();
            Tween.to(sprite1,SpriteAccessor.POSITION_X,1000f) //** tween POSITION_X for a duration **//
                    .target(w-100) // ** final POSITION_X **//
                    .ease(TweenEquations.easeInOutQuad) //** easing equation **//
                    .repeat(10,1000f) //** ten more times **//
                    .start(manager1); //** start it
            startTime = TimeUtils.millis();
/*try tween*/

In render()

        batch.begin();

        delta = (TimeUtils.millis()-startTime)/1000; // **get time delta **//
        manager1.update(delta); //** update sprite1 **//
        sprite1.draw(batch);

        batch.end();

sentences:
Unity Gyroscope orientation (attitude) "wrong" I am using the Unity reference and example implementation here https://docs.unity3d.com/ScriptReference/Gyroscope.html

I struggle to fix an orientation problem. When my phone lies flat on the ground, screen facing upwards, unity thinks I am looking as if I'd take a photo of a landscape. When I actually hold the phone as if I'd take a landscape photo, the screen shows me the sky. Rotating then shows me an arc from sky to my left or right side.

What I want is: Holding the phone as if I'd take a landscape picture should do the same in Unity.

Here is a short video where the phone lies flat and then I pick it up and look left and right on a chair.

and this is the codesnipped responsible:

protected void Update()
{
    GyroModifyCamera();
}

void GyroModifyCamera()
{
    transform.rotation = GyroToUnity(Input.gyro.attitude);
}

// The Gyroscope is right-handed.  Unity is left handed.
// Make the necessary change to the camera.
private static Quaternion GyroToUnity(Quaternion q)
{
    return new Quaternion(q.x, q.y, -q.z, -q.w);
}

sentences: How can I add background color to a libGDX TextButton? I have a TextButton in my libGDX project and I want to add a color background to it. I tried the setColor() method but that didn't work.

sentences:
Does GL Memory model guarantees that late Depth Testing accesses depth buffer values in same draw call Suppose I issue a draw command that draws 3 overlapping triangles (T1, T2, T3). Fragment shader assigns Depth = 3 to T1 fragments, 2 to T2 and 1 to T3 fragments. Depth Buffer is cleared to 0 before draw call. GL Test is set to GL_Less.

Now, when pixels for triangle 2 are depth tested by the hardware, is it guaranteed that hardware will read the latest written values i.e 3 (by T1 fragments)?

sentences:
Change alpha to a Frame in libgdx I have this

batch.draw(currentFrame, x, y, this.parent.originX, this.parent.originY, this.parent.width, this.parent.height, this.scaleX, this.scaleY,this.rotation);

I want to apply the alpha that it gets from the method, but theres is not overload from the SpriteBatch class that takes the alpha value, is there some wey to apply it? (i did it this way, because this are animation, and i wanted to control them) in my static ones i apply

sprite.draw(SpriteBatch, alpha)

Thanks

sentences:
Solid outline around block I'm creating a minecraft clone (for practice), and I'm trying to implement a feature in which the block that the player is looking at has a block outline. The way I do this is just by creating a GL_LINES mesh that covers the edges of the block, and then translating it to the block position. I'm using the LibGDX framework to do this - the outline ends up producing a ModelInstance.

It partially works, but this is what it looks like:

As you can see, some of the pixels are getting rendered, but some aren't. My theory is that this is because of the depth buffer - because the line is intersecting with the face, some of the pixels don't get rendered. So my question is, how can I ensure that the outline gets rendered solidly?

sentences:
How to save options at the game? In my game main character can move using tap or hold finger on the screen. I wanna create at the menu options, and there button to change control type.
How I can save player choose? Using Prefs?

sentences:
Java libgdx Game Screens and rendering tile map I'm working on a 2D tiled game with Java and libGDX. I'm having problems implementing gamescreens. I'm trying to set the screen to gameScreen and start rendering tiles, but I'm getting a nullpointer exception on my camera and my renderer.

I think what's happening is that it's calling the render method before the create method for some reason. The create method is where the camera and renderer are set up.

This is my entry point, gameClass

package com.psillicoder.farmGame;
import com.badlogic.gdx.Game;

public class gameClass extends Game {
    gameScreen gameScreen;

    public static final String TITLE="Farm Game";
    public static final int WIDTH=800,HEIGHT=600;

    @Override
    public void create() {
        gameScreen = new gameScreen(this);
        setScreen(gamaeScreen);
    }

    @Override
    public void render () {
        super.render();
    }
}

This is my gameScreen class:

package com.psillicoder.farmGame;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;

public class gameScreen implements Screen {
    gameClass game;

    private OrthographicCamera camera;
    private OrthogonalTiledMapRenderer renderer;
    private TiledMap map;

    SpriteBatch batch;

    float unitScale = 1/16f;

    public gameScreen(gameClass game) {
        this.game = game;
    }

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

        camera.update();
        renderer.setView(camera);
        renderer.render();

        batch.begin();

        batch.end();
    }

    @Override
    public void resize(int width, int height) {
    }

    @Override
    public void show() {

        TiledMap map = new TmxMapLoader().load("tdmap1.tmx");
        OrthogonalTiledMapRenderer renderer = new OrthogonalTiledMapRenderer(map,unitScale);

        OrthographicCamera camera = new OrthographicCamera();

        camera.setToOrtho(false,40,40);
        renderer.setView(camera);
        camera.update();

        batch = new SpriteBatch();
    }

    @Override
    public void hide() {
        dispose();
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }

    @Override
    public void dispose() {
        System.out.println("Disposed");
        batch.dispose();
        renderer.dispose();
    }
}

sentences:
Unity - Problems with scene object orientation and rotation after updating my project from 5.0.0 to 5.2.2 Last year I made a large project on Unity 5.0.0, today I re-opened it on 5.2.2 to do some work on it. I was given the message that the project needed to be updated, I allowed it to do the update. Now when I open up my scenes, many of my scene objects are misplaced, the rotation is completely wrong and positioned in the wrong place. My scenes are of a refinery and the most commonly broken object is the pipework, something that would take hours to correct manually.

My pipework is created this way...

All pipes are made in blender and each scene's pipes are saved as a single blender model (with each pipe make from a bezier curve and left as a separate object).
Once imported into Unity (as a single .blend file), I've then dragged and dropped coloured materials onto all the individual pipes, so they are all coloured correctly.

This has all been fine until updating the project to 5.2.2 - now some of the pipes are in the right place, but many are rotated in completely the wrong direction, leaving it looking a mess. If I delete the pipes from Unity and reimport the pipe model back in, this would solve the problem, but then all the materials/colours will be gone. Due to the sheer amount of pipes throughout the whole project, to re-colour them all again would be an extremely problematic task, especially as it's critical that the pipes are the right colour.

I am confused how some of the pipes within the same pipe model are fine and the others are wrong, it would be so much easier to sort if they had all changed rotation together, then I could just switch them all back in 1 go. I have a total of 13 scenes and so far all of them have suffered the same problem.

Nothing whatsoever has been changed on any of the scenes, assets or indeed anything in the project folder. In fact I haven't touched a single file within the project since October last year, so it is certainly to do with updating to 5.2.2. Is there anything I can do to fix the problem without having to re-import the models back in or manually rotate everything back?

I have attached some screenshots to show the issue - See how in the blender image, all the pipework is placed correctly and then in the Unity image, half the pipes have flipped and are facing the wrong way. I have removed the ground so this can be seen clearer. Any help would be much appreciated.

Many thanks

sentences:
Rendering 2D shadows in shader Update:

I am getting slightly better results by modifying the shader so that it sets a flag on entering a obscured region, and then only sets the fragment to black if the ray casting exits the obscured region. The bordering light is a little less noticeable this way. Additionally objects behind other objects will now be correctly obscured as long as they are not touching.

However as you can see in the image, I have noticed a new problem. The shadow becomes very choppy at the back due to the way I am doing raycasting.

Original:

I am currently trying to render shadows in a 2d game. I use the following shader to do so:

#version 120
varying vec2 vTexCoord;

uniform vec3 u_lightColor;
uniform sampler2D u_texture;

float drawShadow(){
    vec2 loc;
    vec2 norm = normalize(vTexCoord - vec2(.5,.5)); // Pointing from center to point
    vec4 smp;

    float dst = 0.0;

    // For now draw all casters
    if(texture2D(u_texture, vTexCoord - dst * norm).a > 0)
        return 1.0;

    for(int i = 0; i < 256; i++){
        loc = vTexCoord - dst * norm;

        if (length(loc-vec2(.5,.5)) < 1.0/256.0)
            break;

        smp = texture2D(u_texture, loc);

        if(smp.a > 0){
            return 0.0;
        }

        dst += 1.0/256.0;
    }

    return 1.0;
}

void main() {
    float dist = length(vec2(.5,.5) - vTexCoord.xy);

    float shad = drawShadow();

    float intensity = 1-dist*2.0;

    gl_FragColor = vec4(u_lightColor, 1.0)*vec4(shad*vec3(intensity), shad);
}

The light is being rendered at the center of the screen, and the texture being drawn is one where any shadow caster is drawn as a non transparent sprite.

The trouble is because of the way I am sending out the rays I end up with the following:

Where the shadows don't hug the edges of the sprites. Also, I would like to somehow obscure shadow casters if they are in the shadow of another shadow caster, but not if they are the first caster the light hits.

sentences:
Is it possible to debug a Unity Android game directly on a device? I'm working on my game and every time I make changes to it I send the game to my mobile device to debug it.

I want to know how I can directly debug my game using an Android device instead of the MonoDevelop editor?

sentences: 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:
Import 3D model into Unreal Engine 4 (Sorry if I misunderstood the context of what I want, I'm currently noob in game development).

I want to retrieve a 3D model from let's say Saints Row 3, and import it to Unreal Engine 4, is it possible ? If not is there a way to create it from scratch ?

What is the right way to achieve what I want ?

sentences:
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: How can I get pre-release reviews of my mobile game? My iOS and Android game is at its last stage of development. Is there a way for me to get pre-release reviews from people? Or maybe from the press? How should I proceed?

sentences:
How do I build Assimp with MinGW? How can I build Assimp with cMake and MinGW?

I tried, but I don't get a functioning library...

Details of my attempt:

I am trying to build the Open Asset Import Library (Assimp) but I have been running into problems. The assimp documentation is really poor and expects you to know exactly what you are doing. The developers haven't been particularly helpful either. I hope someone here has successfully built assimp and can let me know where I am going wrong. I suspect that I have several problems that are contributing to my failure. I am using 64 bit Windows 8.1 pro and using MinGW version 4.8.1.

The first thing I tried was downloading assimp 3.1.1 and boost 1.57. I extracted both folders and tried to use cMake to generate the makefile for MinGW. I haven't used cMake before and the assimp instructions are use cMake as you normally would, so I have no idea if I configured it right. I pointed BOOST_ROOT to the boost folder I extracted from the download, set it to build static libraries and generated the makefile.

I then tried running the makefile and got a number of errors. The first was

IFCReaderGen.cpp.obj: too many sections and was too big.

After some googling, I found a workaround was to set CMAKE_BUILD_TYPE to release. That seemed to work and it finished the build but I only got the files assimp32.dll and libassimp.dll.a, which I thought was odd because I was expecting lib/relese/libassimp.a to be generated as per the details on the assimp website. Though the website might also be wrong or out of date.

I linked with -lassimp.dll and that allowed me to build my program. However it crashed upon start-up - the error that appeared immediately at start-up was

  Program has stopped working

(There was no additional info.) I guessed that this was a dll problem—which was odd because I had (tried) to build the static libraries through cMake. I copied assimp32.dll into my executable folder. This time, the program wouldn't crash but the screen would be blank. I'm guessing that there was something wrong with the library I build that was causing it to link incorrectly.

At this point, I deleted everything to try a fresh start. I tried to follow this article:

I downloaded assimp 3.1.1 and boost 1.57 and extracted them.
I opened cmd, changed to the boost root directory and ran

bootstrap.bat mingw

I then ran

b2 --build-dir="C:/Libraries/boost/" variant=release link=static address-model=32 toolset=gcc

The result of this was

598 targets updates, 3 targets skipped, 2 targets failed.

I now have a folder C:\Libraries\boost\boost\bin.v2 with two folders libs and standalone, but I'm not certain what my BOOST_ROOT directory is anymore.
I opened cMake, selected the assimp folder I had extracted, and configured the following:

BOOST_ROOT = "C:/Libraries/boost/boost/"
ASSIMP_BUILD_STATIC_LIB = TRUE
ASSIMP_BUILD_TESTS = FALSE
ASSIMP_ENABLE_BOOST_WORKAROUND = FALSE
BUILD_SHARED_LIBS = FALSE

I then pressed configure and got the error that the boost libraries were not found.

I'm only guessing what these cMake settings do, as I can't find any documentation for assimp. I'd like to build some version of assimp that I can then link to and use in a simple test program. At some point I will go back and build the shared libraries, but first I just want to get something working and understand how to do it again.

Can someone see what has gone wrong?

sentences:
Why isn't my BoxCollider2D doing anything? I'm trying to make a speech bubble appear when you approach the tutorial board.

The bubble is there and it has its animation states "Appear" and "Disappear"

  Appear is called OnTriggerEnter2D

  Disappear is called OnTriggerExit2D

The collider is on the parent, tutorial board

The animator and script are on the bubble itself.

This is the script I have attached to the bubble, the conditions script.

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

 public class Conditions : MonoBehaviour
 {

     private Animator bubblecondition;
     private BoxCollider2D boxCollider;

     // Start is called before the first frame update
     private void Awake()
     {
         bubblecondition = this.GetComponent<Animator>();
         bubblecondition.Play("Disappear", 0, 1f);
     }
     void Start()
     {
         //bubblecondition.SetBool("Here", false);
         boxCollider = this.GetComponentInParent<BoxCollider2D>();
     }

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

     }

     public void OnTriggerEnter2D(Collider2D other)
     {
         if (other.tag == "Player")
         {
             bubblecondition.Play("Appear", 0, 0f);
         }
         else
         {
             return;
         }
     }

     public void OnTriggerExit2D(Collider2D other)
     {
         if (other.tag == "Player")
         {
             bubblecondition.Play("Disappear", 0, 0f);
         }
         else
         {
             return;
         }
     }
 }

What am I doing wrong? I spent an hour trying to know why.

  I even tried to have the console write a message on collision but it's
  just dead.
  Not only that, but I also tried to make it public and referenced it, still nothing.

Help me see my mistake :)

sentences:
Shaky Camera Effect 2D The camera in my game engine can be modified by following a rectangle properties, that can be scaled, moved and even rotated. I need this effect for the shaking of the screen when a zombie attacks a character.

How should I go about implementing this?

sentences:
Decide whether bot is approaching or leaving Consider a static obstacle placed in 3 Dimensional coordinate plane. A moving bot is programmed to pass through it. We know the position of obstacle. We also know the current position and current velocity of moving bot. Say, position and velocity are given as 3D vector.

How to decide whether the bot is approaching the obstacle or leaving the obstacle?

I think, the relative velocity should be able to differentiate it? Any approach please.

sentences:
How can I check if component is enabled? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraInformation : MonoBehaviour
{
    public string currentCameraState;

    // Start is called before the first frame update
    void Start()
    {
        var components = new List<Component>();
        foreach (var component in GetComponents<Component>())
        {
            if (component != this)
            {
                var fullName = component.GetType().FullName;
                if (fullName.StartsWith("Cinemachine"))
                {
                    currentCameraState = component.
                }
            }
        }
    }

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

    }

    private void OnEnable()
    {

    }

    private void OnDisable()
    {

    }
}

At this line I want to assign the string the component status if it's enabled true or false.

sentences:
How do you create a .XNB Font file for use with CocosSharp? I know the .XNB file format is an XNA thing and that CocosSharp inherits this from its MonoGame roots. However there doesn't seem to be any information on how to create your own .XNB fonts to use with CocosSharp. I've tried searching but can find any information.

Could someone explain it here or point me to a tutorial on how to create .XNB font file for use with CocosSharp?

A site to download already compiled .XNB Fonts would also be acceptable.

Update: Another thing that makes this tricky is that I guess XNA Game Studio could be used, but it's not compatible with Windows 8.1; which is what I currently use for my dev machine...

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:
Client-side Prediction Divergence with Input Packets and Time Differences | Multiplayer FPS I am running into a problem while implementing client-side prediction in my multiplayer FPS. I'm not entirely sure if I've completely and correctly understood the concepts. I have read the articles from Gambetta and from Valve, as well as several others.

What I'm currently doing is sending client input as key presses and key releases; the client sends when it presses 'W', for instance, and sends a packet once it has stopped pressing 'W'. The client then predicts the movement in a fully-deterministic way. The server then sends a position packets to all of the clients and the client checks if there is any divergence and corrects for it.

I am now running into the issue if the time between the input packets on departure differs from the time of the input packets on arrival, it will inevitably lead to small errors and massive divergence over time as the server will think the client will have pressed a key for longer or less time than it actually has. I haven't seen anyone mention this, so I'm questioning if what I'm doing is right.

Another issue I am seeing with this approach is that the client sends rotation updates to the server at 64hz (my tick-rate). This will, of course, lead to small differences in rotation from the server and client at specific times. Given that the movement is dependent on the orientation/rotation of the player, client-side prediction errors will inevitably ensue.

One way I was thinking that could fix the first problem, would be to send timestamps along with the input packets and have the server rewind positions and compensate for the delay imprecisions. Before I follow through with that, I am seeking some confirmation as to what I'm doing is right.

Any help would be appreciated! Thanks!

sentences:
Best approach to render text in OpenGL 4.5 I have tried to implement text rendering in OpenGL from several tutorials and guides but I am unable to implement any of them successfully.

The latest one I have attempted is [Here]
but it seems to be incompatible with GL 4.5. My end goal is to implement the ability to load TTF files into OpenGL and render them. If someone could give me a hand with a sample code snippet of how to implement this myself, or even to reconfigure the free type library, that would be appreciated!

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: Does bad AI lead to more sales? Games like HL2 and FEAR are legendary for having excellent AI. Recent titles (as of 2018) leave much to be desired. With improvements in our understanding of probability related state machines, and general machine learning (or AI as it's called sometimes) improves, it generally feels many commercial titles forego the development of good AI. Anecdotally, I have personally experienced in recent titles (where the AI is dumb as per say - far cry, wildlands, etc.). I feel having dumb AI may sell games more (giving a more accomplished feeling, pushing players towards multiplayer, etc.). So, let me pose the question, does any research show that bad AI leads to more sales?

sentences:
How to synchronize events to clients? I need to keep the client updated on data that's rarely changed (like health) or when an event occurs (like when a player is attacked and should have "-10 hp" above him). Those 2 specific part should be interdependent btw.

I need a way to instantly send this data to clients (or just without big lag), without resending it too many times and I need to be sure the clients received it.

I cannot just send a request to the client when something happens, because I'll just be sending a lot of tiny messages to a lot of clients and that's bad for performance.

I was thinking of accumulating packets of data (per client) and sending them no more often than 5 times a second and then if the client doesn't say he got a package just resend it. This way if nothing happens there is no overhead and if a lot of events are going on I'm sending them in bigger packets.

Is my solution good?
Is there a better, more popular way of dealing with this?

sentences:
Update sprite position when speed changes if frame rate is low I have a sprite moving horizontally from left to right. For each iteration I want to start decreasing the speed.
This works ok, and the sprite will stop at some point, however depending on the frame rate it won't always stop
at the same place. What's wrong with my code?

...
Vector2 Position;
Vector2 Speed;
...
Speed.X = 50;
...

public override void Update(GameTime theGameTime)
{
    float time = (float) theGameTime.ElapsedGameTime.TotalSeconds;

    Position += Speed * time;

    Speed.X-=10; // Reduce speed for next iteration
    if ( Speed.X < 0 ) Speed.X = 0;
}

I have also tried by doing

Speed.X-=10 * time;

but that didn't work.

sentences:
Update and render in separate threads I'm creating a simple 2D game engine and I want to update and render the sprites in different threads, to learn how it is done.

I need to synchronise the update thread and the render one.
Currently, I use two atomic flags. The workflow looks something like:

Thread 1 -------------------------- Thread 2
Update obj ------------------------ wait for swap
Create queue ---------------------- render the queue
Wait for render ------------------- notify render done
Swap render queues ---------------- notify swap done

In this setup I limit the render thread's FPS to the update thread's FPS.
Besides I use sleep() to limit both render and update thread's FPS to 60, so the two wait functions won't wait much time.

The problem is:

The average CPU usage is around 0.1%.
Sometimes it's go up to 25% (in a quad core PC). It means that a thread is waiting for the other because the wait function is a while loop with a test and set function, and a while loop will use all your CPU resources.

My first question is: is there another way to synchronise the two threads?
I noticed that std::mutex::lock don't use the CPU while it is waiting to lock a resource so it isn't a while loop. How does it work?
I can't use std::mutex because I will need to lock them in one thread and unlock in another thread.

The other question is; since the program runs always at 60 FPS why does sometimes its CPU usage jumps to 25%, meaning that one of the two wait is waiting a lot? (the two threads are both limited to 60fps so they ideally won't need a lot of synchronisation).

Edit:
Thanks for all the replies.
First I want to say I don't start a new thread each frame for render. I start both update and render loop at the beginning. I think multithreading can save some time :
I have the following functions:
FastAlg()  and Alg().
Alg() is both my Update obj and render obj and
Fastalg() is my "send render queue to" renderer" ".
In a single thread :

Alg() //update
FastAgl()
Alg() //render

In two thread:

Alg() //update  while Alg() //render last frame
FastAlg()

So maybe multithreading can save same time.
(actually in a simple math application it does, where alg is a long algorithm amd fastalg a faster one)

I know that sleep isn't a good idea, although I ve never have problems.
Will this will better?

While(true)
{
   If(timer.gettimefromlastcall() >= 1/fps)
   Do_update()
}

But this will be a infinite while loop that will use all the CPU. Can I use sleep(a number < 15) to limit the usage? In this way it will run at, for example, 100 fps, and the update function will be called just 60 times per second.

To synchronise the two threads I will use waitforsingleobject with createSemaphore so I will able to lock and unlock in different thread (whitout using a while loop), won't I?

sentences:
Problem drawing text in a for loop for (int i = -5; i < 5; i++)
{
    Rectangle screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);
    spriteBatch.Draw(foregroundTexture, screenRectangle, Color.White);

    Rectangle backGroundRectangle = new Rectangle(x + screenWidth * i, 0, screenWidth, screenHeight);
    spriteBatch.Draw(backgroundTexture, backGroundRectangle, Color.White);

    spriteBatch.DrawString(font, "Variable i:  " + i, new Vector2(0, 0), Color.Brown);
}

I want to show on the screen when I'm running the game the counting of i
like: -5 , -4 , -3...but not in a line, just like a timer. -5 then overwrite it and show -4 overwrite it and show -3 and so on...like seconds of a clock.

The problem is I'm getting a strange painting near the numbers like its repeating and painting something there all the time.

sentences:
Checking whether moving object has reached target position So I have a fast-moving object in my game, let's say a bullet. At each iteration of the main loop I update the object's position based on the delta time value dt and draw it at the new position.

I also check whether the object's new position is close to a target position. In that case the object will be removed:

S....|...|....|....|......|...|....|....|...|..T..|X

The object starts from location S, moving towards target position T. Each dot . represents one ms time. The vertical bars | represent a game loop iteration, in which I check whether the object has reached its target destination. At X the object will be removed.

Since these checks (ie. game loop iterations) might take place before or after the 100% exact target position (even if only a few pixels off), I perform this check with a distance between a line segment from the last position to the current position, and whether the target position is on that line. This approach works well.

There is one issue though: Since the check in which I recognize that the target has been reached happens after the real position of the target, the object moves a little bit further than desired. That's becoming more severe when the object is moving very fast.

Now my question: Is there kind of a "best practice" how to deal with this issue? I assume this is a common problem in game development.

PS: The only solution I could think of is to re-position the object to the real target position as soon as the check succeeds. However, that can look a bit like a "jump" back, which does not look great.

sentences:
LibGDX: How do I manage Player position? I'm making a 2D isometric tiled game using LibGDX. In my Player class, I created a vector2 that I named 'pos' to manage the player position, then I draw my Player with:

    batch.begin();
    batch.draw(localPlayer.texture,LocalPlayer.pos.x,LocalPlayer.pos.y);
    batch.end();

Let's say pos = (0,0), then the Player will be rendered at the bottom left corner of my screen.

When I translate the camera, the (0,0) still correspond with the bottom left of my screen, so the pos Vector2 is about my screen, not my map...

What should I do to get a Coordinate System based on the map and not on my screen? I would not prefer using the Sprite Class...

Thank you :)

sentences:
Tile based movement with SKAction (Xcode 8, Tile Map) I am trying to make a game where the Hero can move like in Pokemon with SKActions.
But the movement looks unprofessional and have delays.
How can we handle to move the Hero smoothly with SKActions from tile to tile without checking every frame if up is touched?

(the Joystick sends just a signal if a direction is pressed and released)

Edit: I am using Xcode 8 and the new Tile Map function

sentences:
Vertical alignment of a padded font generated by Hiero in libgdx I've generated bitmap fonts for libgdx using Hiero. I've got several distance field fonts that require a lot of padding, unfortunately they don't seem to align correctly.

Below is a font with a bounding box drawn to the values returned from getBounds().

I've just changed to distance field fonts and all my logic that handles vertical positioning is broken because of this. If I use a font without any padding above or below then fonts are drawn aligned correctly.

My padding is 10 on all sides. Playing with a couple of characters, if I increase the y by 10 and decrease the height by 10 in the .fnt file I get the image below instead, which looks far more accurate.

If someone can tell me how I can resolve this issue, or a good way to work around it then that would be appreciated.

sentences:
How to merge fiber subtools in Zbrush I just started learning Zbrush.

While using Fibermesh, I notice that the "fiber" subtools are different from the normal ones. For example, they can be exported as curves, and BPR renders them differently.

However, when I try to merge two fiber subtools, they become a normal subtool, i.e. all fibers become normal polygons. I can no longer treat it as fibers, nor can I export it as curves.

Is there a way to merge multiple fiber subtools into one?

A related question might be: is there a way to import an obj file into Zbrush, so that it becomes a fiber subtool?

sentences:
How to improve my graphics on HTML5 canvas? I am making my own army fighting simulator. Designer have made an 3D model with Blender and textured it, made animations. I have made sprites from that model and did programming. But the result is not as good as I expected. You can look at armyfight.com/simulator.html (refresh until it loads all images properly if it didn't at first time) and when you maximally maximize, you can see there are units moving. But I want to be them clearly visible, with details, high resolution like in flash-games and also that when they are really small units, would be understandable.

Is it possible on canvas?

Or it is my mistake and I must do somehow more HD sprites? I'm stuck now, and I don't know to improve the graphics..

sentences:
Value of the Game Institute Courses I'm considering purchasing courses from Game Institute, specifically, the Foundation Studies Package. Has anyone here taken their courses? If so, do you feel they are a good value? If you can, please be specific as to what you benefited from them, and their strengths and weaknesses.

Though I am most interested in reinforcing computer science fundamentals with respect to game development, I would also like to know if the material is relevant to today's technologies.

I'm especially interested in responses from working professionals who have taken their courses or reviewed their materials.

Background: My work week is spent mostly with SQL Server ETL and some C# web forms development. I have ideas for 2D and 3D platformers, but I don't have the skills to build them to completion yet.

TIA!

sentences:
Unit Testing with Cocos2D How to implement Unit Testing with Cocos2D framework?
What are the good practices?

Is there any testing framework like JUnit Framework at Eclipse for Android?

sentences:
How to generate a random tunnel consists of series of two line paths I have a 2D path that follows series of lines thru points p1 p2 p3 p4.

Like this:  ___/\__/\___

I want to make a tunnel out of this path, so I need to split this path in two sideways and make a hole inside of it.
Like this:

     ________
____/        \_____
     _______
____/       \_____

How do I do that?

I actually want to just generate a random tunnel it doesn't have to follow a path.

sentences:
Should I switch to a game development library? I'm making an RPG-like 2D game from scratch with Java.

By now I'm in a pretty advanced stage with my game, but I encountered a problem- my game using too much CPU.

I know it's because my game loop doesn't use Thread.sleep. I looked for a solution on the internet but most of the answers were "you should move to LWJGL or LIBGDX". I also didn't find any good advice for using Thread.sleep in my game loop.

So, should I move my platform to some of those libraries, or could someone give me some advice how to deal with my CPU usage problem?

Here is my game loop:

public void run(){
    int fps = 60;
    double timePerTick = 1000000000 / fps;
    double delta = 0;
    long now;
    long lastTime = System.nanoTime();

    while (running){
        now = System.nanoTime();
        delta += (now - lastTime) / timePerTick;
        lastTime = now;

        if (delta >= 1) {
            tick();
            render();
            delta--;
        }
    }

    stop();
}

I will just mention that I don't think that moving to one of those libraries will make things easier in the future, and that's because I'm in a pretty advanced stage in my game.

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: Collision detection: a bunch of special cases? I'm writing a simple physics engine in 2D.  My first goal is to get collision detection working.  I know that my objects will eventually be made up of primitive shapes, but I was wondering - would a collision detection library be composed of a bunch of special case functions, like "rayAndLine", "rectangleRectangle", "rectangleCircle" etc, or is there a common, underlying framework for collision detection that works regardless of which primitives are used to make the shape?

sentences:
How to manage collision of two player ? I'm developing a multi-player car game.
Suppose that car A hit car B: both A and B have Rigidbody and collision functions attached.
Because car A hit car B i want to take actions only to car A (add or remove point) but not to B.
So i need to identify that car A is 'hit' (with guilty ) car B that has no 'guilty'.
Can you suggest me how to do ?

sentences:
Pathfinding with car steering Is there pathfinding algorithm which takes car steering into account?

I have large space where user can place cars (trucks actually) and other blocker objects.
Objects can be placed vertically or horizontally oriented and have different sizes (may be 3x6 or 2x4 or other size).
User needs to be able to select new location for any car - then I need to calculate how can that car move to selected location.

I have pathfinding working, and I can find paths with different size but only for square objects.

Update:

Pathfinding need to give only path that is possible with that type of car. For example on empty map with only one car, if user selects new location right next to its current location, car can't strafe or turn in place it has to either reverse and steer or do U turn or something.
Also it must ensure that car orientation at end is what user requested.

sentences:
Dealing with collisions across adjacent static bodies The Problem:

I have the following setup:

A, B and C are rectangular static bodies in box2d.
p is a circular dynamic body in box2d.

The movement of 'p' is solely controlled by the current gravity force of the world.

When 'p' collides with a static body (A, B or C) I play a bouncy sound. I handle this through a standard ContactListener. No problems there.

The problem arises when 'p' is on 'A' and traveling left towards 'B'. This causes another collision to fire (on 'B') which results in another bouncy sound which is unwanted. If however 'p' was to be traveling right and contacted 'C' I would want the sound to play (given enough velocity, etc).

TL;DR - When sliding across multiple static bodies how do I effectively ignore collisions from a body that is on the same 'line' I'm already on?

What I've Tried:

I've tried numerous different approaches such as on collision tracking that normal as my 'ground' normal and ignoring collisions from the same normal. This works until I do something like make contact with 'C' which then becomes my new 'ground' normal. But having never lost contact with 'A' if I go back towards 'B' I will trigger another collision and we're back to square one.

The Plea:

Looking for code-based solutions or ideas if at all possible. I've considered trying something like a chain shape around my level's collidable areas, but with certain parts of my world being dynamic I don't feel like that's an adequate solution.

Thanks!

sentences:
How can I have realistically bending/flexing paper? I am a new hobbyist to Unity and I working on a game where the player goes around picking up clues in the form of paper notes to solve a mystery.

So far, thanks to the help I got here, I was able to animate a note made from a UI canvas and an image in game world to fly and rotate to align itself in front of the first person camera.

Although, it looks nice, it still looks like a rigid plank of wood rather than a piece of paper. Is there a way I could bend/flew/distort the canvas to give the illusion of a piece of paper rather than piece of wood?

Is it possible to bend a canvas or should I go towards another solution, like using an actual plane or quad during the animation effect?

sentences:
Unity - Camera Moving Vertical So I want to make a smooth transition with the camera from point A to point B while keeping direction and rotation.
My current approach is using Vector3.Lerp :
using UnityEngine;

public class CameraMoveVertical : MonoBehaviour
{
    public float cameraSpeed = 0.125f;

    public void moveCamera()
    {
        Vector3 lerpPosition = Vector3.Lerp(transform.position, new Vector3(transform.position.x, transform.position.y+50, transform.position.z), cameraSpeed);
        transform.position = lerpPosition;
    }
}

The camera does move but the movement is instant. Any way to make it a smooth transition?

sentences:
How can I read texel data on a separate thread in D3D11? In D3D10, I load a staging texture onto my GPU memory, then map it in order to access its texel data on the CPU. This is done on a separate thread, not the thread I render with. I just call the device methods, and it works.

In D3D11 I load the staging texture onto my GPU, but to access it (i.e. Map it) I need to use the Context, not the device. Can't use the immediate context, since the immediate context can only be used by a single thread at a time. But I also can't use a deferred context to Read from the texture to the CPU:

"If you call Map on a deferred context, you can only pass D3D11_MAP_WRITE_DISCARD, D3D11_MAP_WRITE_NO_OVERWRITE, or both to the MapType parameter. Other D3D11_MAP-typed values are not supported for a deferred context."

http://msdn.microsoft.com/en-us/library/ff476457.aspx

Ok, so what am I supposed to do now? It is common to use textures to store certain data (heightmaps for instance) and you obviously have to be able to access that data for it to be useful. Is there no way for me to do this in a separate thread with D3D11?

sentences: Bitmap to a custom coordinate pair when touched I am completely lost and needed some help.  I have a ontouchListener for a bitmap and know how to check if the touch was within the boundaries of the bitmap. But say I want the center of the image to be at a custom coordinate like [0,0] and the entire image to be in the range of [-319...319] and [-239...239] . Does any one have any thoughts on how to best implement an eventX and eventY to a custom coordinate pair?

sentences:
How do I make players believe they're doing something wrong even when they're not? You're doing it right. …right?

In the game Cart Life, you are led to consider this, even though you are doing fine. This effect is created by making you do mundane jobs, earn little money, and have and things happen that feel like your fault.

Is there a better way than life-like mundane and unfortunate encounters to make you feel like you're failing at the game? I want to use this to mess with how my players play the game. Overwhelm them. Make a little success feel huge. Make them feel depth. Any ideas?

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:
What library for octrees or kd-trees? Are there any robust performant libraries for indexing objects?

Objects would have bounds themselves, rather than being represented by points; and an object could therefore be in more than one compartment if the index divides things in fixed sized partitions.

It would need frustum culling and visiting objects hit by a ray as well as neighbourhood searches.

I can find lots of articles showing the math for the component parts, often as algebra rather than simple C, but nothing that puts it all together (apart from perhaps Ogre, although apparently PyOrge doesn't expose the octree).  Surely hobby game makers don't all have to make their own spartial indices?

(I am sitting down writing my own sphere-sphere, sphere-ray, ray-aabb, cone-aabb, cone-fustrum, aabb-fustrum and octree implementation; surely there is a better way i.e. someone has already done this and make a nice package?!?!)

(Python or C/C++ w/bindings preferred)

sentences:
Lighting in a Minecraftian World Minecraft is a game that is largely based on a heightmap and uses that heigtmap information to flood the world with light.  From my understanding the highest point in the heightmap is the end of the sunlight influenced area.  Everything above that is lit by sunlight, everything below that just is influenced by light nearby in a radius of 8 blocks.

Thus if you have a floating island on the top of your world everything below that will be seen essentially as a cave.  When two lights influence the same point the brighter light wins (unsure about that).

Either way there are a couple of problems with minecrafts lighting model: first of all, if your world does not have a heightmap it becomes trickier to figure out what exactly is supposed to emit sunlight and what not.  A simple way would be to assume that the world is (in my case) a floating rock and then traverse each axis from both directions and figure out where the rock starts and ends.  But this does not fully eliminate the problem as dents in the rock are not supposed to be in darkness.

Minecraft itself will cache the light information in its chunks together with the information about the material of a block.  Thus only if the world is modified the lighting has to update.  Unfortunately that process is still pretty slow on updates and on quick light changes one can see the lighting lag behind.  That's especially true if a lot of blocks change (TNT, sunset etc.) and you're not running the fastest computer (Or Java on Mac).

From my still limited understanding of 3D graphics lighting a world like minecraft shouldn't be the biggest issue.  How would you tackle the problem?

I think the basic requirements for lighting in a voxel world would be

update fast enough that it could happen in a single frame.  One might be able to do the lighting in the graphics device and download the changed light information to the main RAM.
light information must be quickly available for the main game logic so not entirely based on the graphics device: reasoning: light affects the growth of grass, spawning of monsters etc.
light updates would have to be local to a chunk or have some other limit so that one does not have to relight the whole world which might be very large in size.

The main idea would be to make the light updates fast, not necessarily more beautiful. For general light rendering performance improvements one could easily add SSAO on top of that which should result in much nicer worlds.

sentences:
Can I publish a game on Steam while obscuring my personal identity from the public? I'm looking to publish a game on Steam that contains explicit adult content.

I am seeking to make this a hobby that earns passive income as opposed to pursuing it as a full time job. I would prefer that a prospective employer could not easily track my name back to this game and thus not consider me for the job.

I have read the Steamworks Partner Program here:
https://partner.steamgames.com/steamdirect

And thus understand that for Steam's sake, I will need to identify myself. But can I publish under some sort of pseudonym to prevent a simple Google Search of my name from returning this game? Or will this pretty much be on my so-called "permanent record" for life?

sentences:
How to write a custom map canvas and project coordinates on it? I am writing a game with Objective C ( xcode ) and I need to use the users location service to mark their position on a map but since I need to create my own map component, I am not able to use the Map framework.

Doing this I think I need to project latitude and longitude which I receive from location framework on my custom planar canvas, this is a small part of my game but the other parts are pretty easy or could be done if I could manage to implement this part, however I dont know where to start.

did anybody does it before? is it easy to create a map canvas?

Any kind of hint and help or sympathy are welcome.

Thanks

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: Designing social network structure for a mobile game We are going to design a mobile game in which players could be related with each others in a social network-like mechanism. So, how we could integrate a mobile game and a social network (SN). Should we design a SN at first and then add game features to that or vice versa? Any suggestion?

sentences: Unity Multiplayer functionalities or Google's plug-in? I want to add multiplayer matches to a game I'm making for Android/PC, and something echoed in my mind: would the network functionalities Unity provides work in Android? I ask this because Google has a free plug-in for their services, but Unity also offers possibilities. Also, using any of the above, do I need to pay to rent a server? Or, for example, since we need a paid developer account to register our game at Google Play Store, the servers are part of the deal?

sentences:
Constructing a Planetoid Cube World? This is sort of a multidisciplinary question, so I'm asking it here rather than on one of the other Stack Exchange sites.

I've been toying with the idea of making a game that's a mix between Minecraft and Kerbal Space Program, where the world is actually a planet and can be traveled around (either on the ground or in orbit) seamlessly, yet still consisting entirely or mostly of cubes à la Minecraft.  It turns out this is actually incredibly difficult to wrap my head around!

There are a few requirements and concessions.

Requirements

Must be able to travel and build on all parts of the planet seamlessly (poles included)
Every tile must be able to be mapped exactly or roughly to a spherical coordinate.

Concessions

Planet's perceived 'radius' at varying depths can be uniform.
Depth of buildable area can (and should) be limited, meaning you don't need to be able to tunnel into the center of the planet and you don't need to be able to make an absurdly large tower.

Those are the main points, and the problem is open to interpretation and more concessions are able to be made so long as the illusion of being on a planet is maintained.

Initial Idea

Here is an I've had that may have some merit but I'm not sure if it'd actually work.

Tesselated Platonic Solid

The idea here is to create a 'virtual' sphere made of a patchwork of faces of a platonic solid (e.g. cube, icosahedron, octahedron).  The faces represent a plot of flat land, with each edge being the 'portal' to another faces and so on.  In this way the world is always 'flat' and you are basically traveling over a 2D unwrap of the original shape.

One of the problems with this method is that with some tesselated platonic solids (such as the cube above), the tesselated faces are warped and the surface area of each face is not uniform.  A little bit of this is acceptable, but not too much.

The Question

The real question here is ultimately "is this possible?" and if so, what would be the best method to achieve all of the requirements.  If not, what kind of concessions would I need to make to make a believable world?

sentences:
Syncing items between server and client I'm doing this game of mine, and I want to add the items to it.
I'm already familiar with the basic concept of syncing data between server and client,
Usually using sync state, that's what i've done with my friends in our previous game.
This game is sort of a recreating of the previous one, but written better.

The problem we had with items is that every item we created in the server was basically a Subclass of a class that is a subclass of Item, for example:

EmeraldStaffOfTheExiledMonk : Weapon : Item

When we wanted to have the item in the client side, what we had to do is to create an item class, which would hold the necessary information we need to have of an item, and have some sort of an initialization of an ItemPool.
Now, to sync that, we obviously have to sync the IDs of each item, assuming we have them.
My question to you guys is, is there any good way to actually sync items across client and server, without having any hard-code of those items in the client side?

What I eventually want is to have an ItemPool that would be generated in the client when you connect to the server, and the only thing the client would really need to have is the assets of that item(textures, and so on)

sentences:
Collision detection between image and drawables I'm trying to collide my ball_1 to greengreen drawable. How can I determine the collision?

public  class MainActivity extends Activity  implements Runnable{

    private Imageview ball1

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ball1 = (ImageView) findViewById(R.id.ball_1);
        Drawable gr1 = new Drawable(R.drawable.greengreen)

        public void run() {
            startballanimation();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }//trying to use an if else statement here to collide imageview ball1 to drawable"greengreen"
        }
    }
}

sentences:
Where to hire graphic designers for mobile games? I need to find someone talented to create a series of 2D graphics a la cart for my mobile games.  My graphics are just not impressive enough, but the game play is solid and fun.

This is sort of a multi-part question:

Where do I start to find someone?

What should I expect to pay for custom sprites and backgrounds?

What kinds of terms should I use so I receive exclusive, royalty-free, ownership of the artwork when it's finished?

sentences:
How do I create a 2D tile map, and implement movement within it? How do I create a 2D tile map that I can use? How do I get the world coordinates of it so I can move something to that tile?

I'm learning OpenGL, at the moment, but I'm having a lot of issues understanding how to create a 2D tile map. I have rendered tiles to the world, but I have no way of using them. For example, I'm trying to implement movement, where when clicking on a tile, I would move the player to that tile.

To elaborate, I want a tiles coordinates when I click near/on it, so I can use that position when implementing movement. Right now, I have no idea how to do that; I am able to get the windows 2D coordinates on click, but I don't know how to turn that into a useful way of finding the coordinates I want based on where my tile is in the world.

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:
Rotating around a non origin point I've been looking around the forums for some answers to the question I have. I've found some answer that seem to help but nothing that answers my specific question. That question being how to rotate an object in world space around a non origin point.

I have a grappling hook that I am trying to implement inside of a game I am making for a final college project. This grappling hook collides with another object in world space and I then want the player to rotate around this point as if a rope were present.

I have the point at which the grapple collides the point at which the player is located and the origin. I tried the standard translate to the origin rotate and translate back and that did not work.

This is being done in DirectX 9 and it is a C++ game. Any  help you could offer would be greatly appreciated. If you need anymore info please ask.

Edit: I should also add that we are doing a vector based storage for this setup. So I store the matrices in vectors(i.e Forward,Direction,Right,Position) and build the matrices on the fly

void CSpatialFrame::RotateAbout(D3DXVECTOR3 _Point, float _fDegPitch, float _fDegYaw, float _fDegRoll)
{
    D3DXMATRIX RotationMatrix;
    D3DXMatrixRotationYawPitchRoll(&RotationMatrix, D3DXToRadian( _fDegYaw ), D3DXToRadian( _fDegPitch ), D3DXToRadian( _fDegRoll ));
    D3DXVECTOR3 playerPos = m_Position;
    m_Position = _Point;

    D3DXMATRIX PlayerMatrix;

    PlayerMatrix._11 = m_RightVector.x;
    PlayerMatrix._21 = m_RightVector.y;
    PlayerMatrix._31 = m_RightVector.z;

    PlayerMatrix._12 = m_UpVector.x;
    PlayerMatrix._22 = m_UpVector.y;
    PlayerMatrix._32 = m_UpVector.z;

    PlayerMatrix._13 = m_DirectionVector.x;
    PlayerMatrix._23 = m_DirectionVector.y;
    PlayerMatrix._33 = m_DirectionVector.z;

    PlayerMatrix._14 = m_Position.x;
    PlayerMatrix._24 = m_Position.y;
    PlayerMatrix._34 = m_Position.z;

    D3DXMatrixTranslation(&PlayerMatrix, _Point.x, _Point.y, _Point.z);

    //D3DXMatrixTranslation(&PlayerMatrix, m_Position.x, m_Position.y, m_Position.z);

    D3DXMatrixMultiply(&PlayerMatrix, &RotationMatrix, &PlayerMatrix);

    //D3DXMatrixTranslation(&PlayerMatrix, _Point.x, _Point.y, _Point.z);

    m_RightVector.x = PlayerMatrix._11;
    m_RightVector.y = PlayerMatrix._21;
    m_RightVector.z = PlayerMatrix._31;

    m_UpVector.x = PlayerMatrix._12;
    m_UpVector.y = PlayerMatrix._22;
    m_UpVector.z = PlayerMatrix._32;

    m_DirectionVector.x = PlayerMatrix._13;
    m_DirectionVector.y = PlayerMatrix._23;
    m_DirectionVector.z = PlayerMatrix._33;

    m_Position.x = PlayerMatrix._14;
    m_Position.x = PlayerMatrix._24;
    m_Position.x = PlayerMatrix._34;
}

sentences:
Farseer - Difference between Position, GetLocalVector, and GetWorldVector I have used Box2D extensively, and am used to just calling body.GetPosition(). But Farseer does not have this. Instead it has a property Position, as well as methods GetLocalVector and GetWorldVector. Farseer seemingly has a complete lack of documentation, and I have been unable to figure out what the difference is.

Also, though I feel a bit dumb about it, I don't really get what GetWorldVector means as opposed to GetLocalVector. They take a localVector and a worldVector as their respective arguments, but what does that mean? What is the difference between local and world vectors?

Any help is appreciated.

sentences:
Visual Design for AI i'm developing an editor for a game...

and tonight i have been thinking about implement a visual ai designer...

this is how i think it should be:

What kind of visual components are used in theses tools? (Timers, Counters, Conditionals,...)
About implementation, i'm using C# and xna, how can i save/load this graphs?

sentences:
What does D3DXOptimizeFaces function do? I know that this function generates an optimized face remapping for a triangle list, but what actually this optimized remapping is?
The triangle faces are remapped, but based on what?

sentences: How to make plane thick with shader in Unity? I use plane as wall, door,... using Double Sided Shaders. I just want to make my wall, door,... thicker so it doesn't look like paper, I don't need to make it look super realistic. I wonder if I can do that with shader.

sentences:
How to create a reliable Installation Package for Windows in seconds? I am looking a reliable way to create an Installation Package for a Unity 3D Video Game.

I have just tried NSIS (Nullsoft Scriptable Install System)
But the default user interface (of the final result) appear too much old.

If you have a better method (based on script) please give an advice!

sentences:
DirectX Bullet Tracer Effect I'm wondering if anyone knows some common and efficient ways to do a fast tracer for an instant bullet.

I've seen people speak on forums of using primitive lines with DirectX, but I doubt this is up to "Commercial" standards. I also thought of using some sort of minimal prism geometry encompassing the line and using a shader but even then, I'm not sure how to give it that nice glow and fade.
I'm obviously not looking for any code in specific, just some ideas in general.

Thanks,
Joey

sentences:
XNA Vertex buffer/Index buffer high memory usage? I've got about 120mb of vertex and indices data, but when I set the data in the vertex and indices buffer it ramps up to about 300mb of memory used, this isn't really acceptable and I don't know why it is, my code to set them is:

        vertex_buffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, chunk_vertices.Count, BufferUsage.WriteOnly);
        vertex_buffer.SetData(chunk_vertices.ToArray());
        index_buffer = new IndexBuffer(device, IndexElementSize.ThirtyTwoBits, chunk_indices.Count, BufferUsage.WriteOnly);
        index_buffer.SetData(chunk_indices.ToArray());

sentences:
.md5mesh normals are not smooth I'm currently working on a project that requires me to load .md5mesh format and draw it.

Following this link I've managed to load the mesh into the engine successfully, but a problem arises when calculating normals; they just don't seem to smooth.

To clarify that it was not my rendering or shader code that was the problem, I loaded a model of .OBJ format, and that lights smoothly.

The mesh is calculated correctly too, as I am able to load in complex models with multiple joints and mesh parts.

Here's a screenshot of the lighting.

And here is how I currently calculate the normals (All normals are set to zero before computing):

EDIT Amended the psuedo-code to be more accurate to what I have. The original may have been confusing.

for (unsigned int i = 0; i < NumberOfTriangles; i++)
{
    Math3::vec3 r, s, result;
    Math3::vec3 p1, p2, p3;

    p1 = Triangle[i].Vertex[0];
    p2 = Triangle[i].Vertex[1];
    p3 = Triangle[i].Vertex[2];

    r = p2 - p1;
    s = p3 - p1;

    result = Math3::Cross(s, r);

    // Add the triangles face normal to each vertex
    // The Vertex's are not local to the triangles.
    // Triangle[i].Vertex[j] is just an index.
    Vertex[Triangle[i].Vertex[0]].normal += result;
    Vertex[Triangle[i].Vertex[1]].normal += result;
    Vertex[Triangle[i].Vertex[2]].normal += result;
}

After the loop I normalise each vertex normal to find the average normal.

EDIT Here is how I find the average normal:

for (unsigned int i = 0; i < NumberOfVerts; i++)
{
    float nx = Vertex[i].normal.x;
    float ny = Vertex[i].normal.y;
    float nz = Vertex[i].normal.z;

    float len = sqrt(nx * nx + ny * ny + nz * nz);

    Vertex[i].normal.x /= len;
    Vertex[i].normal.y /= len;
    Vertex[i].normal.z /= len;
}

As you can see in the image the .md5mesh model is shading flat instead of shading smoothly like the .OBJ model.

So what am I missing?

sentences:
2D Rectangle Collision I want to make a small 2D game.
In the game you can go in all directions(with the bird's-eye view) and can shoot.
(A little bit like BoxHead http://de.y8.com/games/box_head_2play)
My problem there is the collision detection and especially the response, in which the detection of a collision is not really the problem(I use for that a quad tree).
The real problem is the response to the collision.
For simplifying it, all objects in the game are rectangles that cannot rotate, no shapes or circles.
The rectangles are represented by a vector for the left bottom corner and a vector for the right top corner.
The origin of the coordinate system is in the left bottom corner(I know in games its often on the left top corner but I prefer the bottom corner).
So now a object in the world is composite with a rectangle and a velocity vector.
The algorithm for now is, change the velocity(For example if the user press a key) from a object(In this case the player), add the velocity on the object and at last check for collision(I leave fro now the acceleration alone).

The real question now:
How I response to the collision now ?
What should I do, if the quad tree detect a collision ?
Is the basic algorithm right ?

Still a small question: How I can detect collision in a endless world with a quad tree(Quad trees was always limited to a specify size) ?

You see I have a lot of questions.
I don't know where to start and handle/detect the collision.
I hope you can help me to get started.

EDIT:
I don't need/want advanced collisions/physics.
I only want that a player cant go through walls and detect if a bullet hits something.

sentences:
Ogre3D: customize water demo On the water demo supplied with Ogre3D's SDK, controls are set to actually control the camera and environment, but not actually the ogre head that generates the disturbances. I tried digging into the SDK code but couldn't find the actual pieces of code that allow customization of the controls (keyboard input). Maybe that's coming from the SampleBrowser application?

I intend to use that demo to generate the same Pygame/OpenGL water ripple effect I seek here: Pygame water ripple effect with the added benefit of the 3D engine. This is also targetted at a multitouch library that tries to stay away from Flash in support of harder reverse-engineering of the output binaries.

Bottom line, my question is, where are the keyboard controls bound to the scene on Ogre's SDK Water Demo? I am just starting in C/C++.

sentences:
Why would Assets.getBytes returns null in a test environment? I'm using the latest Haxe (2.10), NME (3.4.3), and MUnit.

I've written some unit tests that need to fetch bitmap data from SWF symbols. The first step is to actually load the SWF data. To do this, I use NME's getByteArray along with the swf library, like so:

var blah:SWF = new SWF(Assets.getBytes("assets/swf/test.swf"));

The call to Assets.getBytes returns null when I'm running this under MUnit. When running my actual game code, I'm able to get the byte array (and consequentially, instantiate the SWF class).

Am I doing something wrong? What am I missing?

Edit: My directory structure is:

. (root
.\assets
.\assets\*.png (other images)
.\assets\swf\*.swf (SWFs)
.\Source\*.hx (source code)
.\Test\*.hx (tests)

sentences: Add a sound to all the buttons in a project Is there an option on the texture_button or something like that where you can specify a sound to be played on button-press. I have created a global sound_manager but for the button presses, I have to manually code it everywhere the script has a button_pressed signal. Or some kind of logic that when a button is pressed anywhere in the project, sound_manager plays a particular sound.

sentences:
Why do I get this warning when using a null conditional operator? In the OnTriggerEnter2D function of my Bullet script, I have the following code:

private void OnTriggerEnter2D(Collider2D other)
{
     if (other.CompareTag("Enemy"))
     {
         var enemy = other.GetComponent<Enemy>();
         enemy?.Death();
     }
}

The reason for the null conditional operator (the question mark) in enemy?.Death() is because the Death function actually destroys the Enemy component script,
so it suppresses an error when the bullet hits the enemy again. It's supposed to be shorthand for:

if (enemy != null)
    enemy.Death();

The code works; the error is suppressed. However, the IDE that I'm using, Jetbeans Rider, gives the following warning:

  '?.' on a type deriving from 'UnityEngine.Object' bypasses the
  lifetime check on the underlying Unity object.

What does that mean exactly? Should I continue using the null conditional operator?

sentences:
How to access network player from internet I just followed a guide about basic UNet tut Here, Its spawning network car player which can be controlled by local player. I can make or join server through Network Manager HUD which is provide by the unity.

I am able to run and connect application on my LAN on different PCs but failed to connect it on other network. I don't know what are the reasons. Do I need to make or purchase a server for it or I am doing something wrong.

sentences:
Update the UI Rotation According to camera rotation I have a camera which is showing the userInterface (canvas) object into the front of my camera. I am only updating my userinterface position if the camera raycast is not hitting my userInterface object collider. something like this

public class UIPlacerAtCamFront : MonoBehaviour {

    public GameObject userInterface;
    public float placementDistance;
    Vector3 uiPlacementPosition;
    RaycastHit  objectHit;

    void Update () {

        Vector3 fwd = this.transform.TransformDirection(Vector3.forward);
        //Debug.DrawRay(this.transform.position, fwd * 50, Color.green);

        if (Physics.Raycast(this.transform.position, fwd, out objectHit, 50))
        {
            //raycast hitting the userInterface collider, so do nothing, userinterface is infornt of the camrea already
        }
        else
        {
            //raycast is not hitting userInterfae collider, so update UserInterface position accoding to the camera
            uiPlacementPosition = this.transform.position + this.transform.forward * placementDistance;
            userInterface.transform.position = uiPlacementPosition;
        }

        //Continuously update userInterface rotation according to camera
        userInterface.transform.rotation = this.transform.rotation;
    }
}

The above script has attached with my camera, it displaying the object correctly but as i start to rotate my camera my UI object rotation looks very strange as below image suggested

As i rotate, this problem occurs

I know that the problem is in rotation, so I tired to change my this rotation code

    userInterface.transform.rotation = this.transform.rotation;

to this

userInterface.transform.localEulerAngles = new Vector3 (this.transform.localEulerAngles.x,
            0,
            this.transform.localEulerAngles.z);

but it bring another strange rotation for me, like given below

I want that my userinteface object face my camera correclty, even my camera watching the start or end of my userinteface object. How can i rotate my UI according to camera rotation correctly?

sentences:
midpoint displacement algorithm in sdl I am trying to implement moving random hills in SDL. I am using midpoint displacement algorithm to create some random terrain and I have also accomplished to move the terrain too. But the problem is that the terrain repeats itself after certain period of time. Why is that exactly happening and how to rectify it. Here is my source code.

#include <SDL2/SDL.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
SDL_Window* gWindow = NULL;
SDL_Renderer* gRenderer = NULL;
int arr_size = pow(2.0,11.0) + 1;
int terrain_array[10000];
float roughness = 0.5;
int intial_displacement = 150;
int count = 0;
bool init()
{
    bool success = true;
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        cout << "SDL could not initialize. SDL_Error: " << SDL_GetError() << endl;
        success = false;
    }
    else
    {
        if( !SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" ) )
        {
            cout << "Linear texture filtering not enabled.\n";
        }
        gWindow = SDL_CreateWindow( "Midpoint_Displacement_Algortihm", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
        if( gWindow == NULL )
        {
            cout << "Window could not be created. SDL_Error: " << SDL_GetError() << endl;
            success = false;
        }
        else
        {
            gRenderer = SDL_CreateRenderer( gWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC );
            if( gRenderer == NULL )
            {
                cout << "Renderer could not be created. SDL_Error: " << SDL_GetError() << endl;
                success = false;
            }
            else
            {
                SDL_SetRenderDrawColor( gRenderer, 96, 96, 96, 96 );
            }
        }
    }
    return success;
}
void close()
{
    SDL_DestroyRenderer( gRenderer );
    SDL_DestroyWindow( gWindow );
    gWindow = NULL;
    gRenderer = NULL;
    SDL_Quit();
}
void initializeArray()
{
    for(int i = 0; i < arr_size; i++)
    {
        terrain_array[i] = 0;
    }
}
void generateTerrain(int leftindex, int rightindex, int displacement)
{
    if((leftindex + 1) == rightindex)
        return;
    int midindex = floor((leftindex + rightindex) / 2);
    int change = ((rand()%1) * 5 - 1) * displacement;
    terrain_array[midindex] = (terrain_array[leftindex] + terrain_array[rightindex]) / 2 + change;
    displacement = displacement * roughness;
    generateTerrain(leftindex, midindex, displacement);
    generateTerrain(midindex, rightindex, displacement);
}
void drawTerrain()
{
    int start_point = 1;
    int i;
    SDL_SetRenderDrawColor( gRenderer, 96, 96, 255, 255 );
    for(i = 1; i < arr_size; i++)
    {
        SDL_RenderDrawLine( gRenderer, start_point, SCREEN_HEIGHT, i, (terrain_array[(count + i)%arr_size] + 3 * intial_displacement));
        start_point = i;
    }
    count++;
}
int main()
{
    initializeArray();
    if( !init() )
    {
        cout << "Failed to initialize\n";
    }
    else
    {
        bool quit = false;
        SDL_Event event;
        while( !quit )
        {
            while( SDL_PollEvent( &event ) != 0)
            {
                if( event.type == SDL_QUIT )
                {
                    quit = true;
                }
            }
            generateTerrain(0, arr_size - 1, intial_displacement);
            SDL_SetRenderDrawColor( gRenderer, 96, 96, 96, 96 );
            SDL_RenderClear( gRenderer );
            drawTerrain();
            SDL_RenderPresent( gRenderer );
        }
    }
    close();
    return 0;
}

I am new to this stuff and trying to learn.
This is what it looks like.

sentences:
Performance in unity at runtime (mesh creation) vs (assets bundle loading) I'd like to load a 3d model that contains several objects in real-time. I believe I have to two methods to do this:

create an assets bundle that contains my model (all object) and loaded at runtime.
load mesh data (vertex, normals, vertex colors) to create a mesh (all object) at runtime.

Currently, my data is presented as mesh data (vertex, normals, vertex colors) and I would like to know if it is better to load them on at runtime and create the meshes from them. Or is it better to create an assets bundle from the mesh and put it in the server and then load the assets bundle?

To simplify my question is it more optimize to use:

(triangles, vertex, normals, vertex colors)?
or use unity assets?

Thank you in advance.

sentences:
How to set up node data for Pathfinding algorithm in 2D platformer? I've been doing a lot of research into the A* pathfinding algorithm and I'm trying to incorporate it into my program. This is not a game that I created so I have no control over the frames. However, I am reading the necessary information from memory and think I can create coordinate based way points based on the game physics. Currently, I am grabbing all the platforms which are walkable and storing them inside their own doubly linked node based on if they are connected with their vertices. However, I am not sure where to go from here. What other information should I be storing inside of these nodes and how should I be connected one node list to another?

struct Platforms{
    LONG x1;
    LONG y1;
    LONG x2;
    LONG y2;
    struct Platforms *prev;
    struct Platforms *next;
};
std::vector<Platforms*>P;
void GetPlatforms(){
    int platformCount = (int)ReadPointer(CWvsPhysicalSpace2DBase,OFS_PlatformCount);
    LONG rightWall = ReadPointerSigned(CWvsPhysicalSpace2DBase, OFS_RightWall);
    LONG leftWall = ReadPointerSigned(CWvsPhysicalSpace2DBase, OFS_LeftWall);
    LONG downWall = ReadPointerSigned(CWvsPhysicalSpace2DBase, OFS_DownWall);
    LONG upWall = ReadPointerSigned(CWvsPhysicalSpace2DBase, OFS_UpWall);
    //add_log("Platform Count: %d", platformCount);
    for(int i=0; i<platformCount-1; i++){
        LONG x1, y1, x2, y2;
        x1 = GetValue(platStruct, OFS_PlatformLeft);
        y1 = GetValue(platStruct, OFS_PlatformTop);
        x2 = GetValue(platStruct, OFS_PlatformRight);
        y2 = GetValue(platStruct, OFS_PlatformBottom);
        if((x2)-(x1) > 0){ //Make sure the platform is traversable
            //add_log("\n\nPlatform: %d X1: %d Y1: %d X2: %d Y2: %d", i+1, x1, y1, x2, y2);
            if(P.size() > 0){
                bool newHead = true;
                for(std::vector<Platforms*>::size_type i = 0; i != P.size(); i++) {
                    Platforms *curr = P[i];
                    while(curr != NULL){
                        if(curr->x1 == x2 && curr->y1 == y2){//curr->y1 - y2 > -50 && curr->y1 - y2 < 50){ //To account for slope
                            insert_front(&curr, x1, x2, y1, y2);
                            newHead = false;
                            //add_log("front segment found: X1: %d Y1: %d X2: %d Y2: %d", curr->x1, curr->y1, curr->x2, curr->y2);
                            break;
                        } else if(curr->x2 == x1 && curr->y2 == y1){
                            insert_After(curr, x1, x2, y1, y2);
                            newHead = false;
                            //add_log("connected segment found: X1: %d Y1: %d X2: %d Y2: %d", curr->x1, curr->y1, curr->x2, curr->y2);
                            break;
                        }
                        curr = curr->next;
                    }
                }
                if(newHead == true){
                    struct Platforms* head = NULL;
                    insert_end(&head, x1, x2, y1, y2);
                    P.push_back(head);
                }
            }else{
                struct Platforms* head = NULL;
                insert_end(&head, x1, x2, y1, y2);
                P.push_back(head);
            }
        }
    }
}

sentences:
Ignoring collisions without using physics layers Trying to ignore collisions between certain prefabs, but in this case I don't want to use layers since these are specific object pairs that I want to not collide, and creating a layer for each prefab would complicate the layer matrix more than I want to.

What I tried so far:

public void OnCollisionEnter(Collision collision) {
    if (collision.gameObject.tag == "Bullet") {
        Physics.IgnoreCollision(collision.collider, collider);
    }
}

So I tried ignoring the collision in the OnCollisionEnter, but this only worked partially. The objects did go one through the other, but they both slowed down. My guess is that the first frame of the collision, the one that generated the call to OnCollisionEnter, was calculated regardless of the ignore command.

Any ideas how I can make all bullets not collide to one another, without putting them in a separate layer?

sentences:
Cost of Unity Local Multiplayer VS Unity Online Multiplayer I know that making multiplayer games in Unity costs money because of the servers that are used in connecting the players. So basically its free upto 20 CCU and then it increases as per the CCU. Its true for the online multiplayer games.

But for local multiplayer games(LAN), should it cost the money for using it? Because we converted one of the devices in the local as the server and we don't need their servers. So am I thinking right ?? Or I am going wrong somewhere?

Just wanted to be clear about how to make a local multiplayer and not an online multiplayer.

Also wanted to ask if Photon supports local multiplayer?

Basically I am confused about how to make offline local multiplayer game.

sentences:
How can I simple use global or individual bool flag/s? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DoorsManager : MonoBehaviour
{
    public bool globalDoorsLockState = false;
    public bool[] doorsLockState;
    public GameObject[] doorsShieldFX;

    // Start is called before the first frame update
    void Start()
    {
        doorsShieldFX = GameObject.FindGameObjectsWithTag("ShieldFX");
        doorsLockState = new bool[doorsShieldFX.Length];

    }

    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < doorsLockState.Length; i++)
        {
            if (globalDoorsLockState == true)
            {
                doorsLockState[i] = true;
            }
            else
            {
                doorsLockState[i] = false;
            }
        }
    }
}

I want to be able to change all the doors flags to true/false or each door individually. Now in the Update it's working only for the global.

How can I add code or change it so it will also be able to change each door lock state individually?

sentences:
Improving performance on older Androids I'm learning to build html5 games for mobile. I'm worried about the FPS animation on older model Android... as I use a lot of setTimeouts to update certain aspects and would like some suggestions on other approaches I could adopt.

Any advice on making this run a bit smoother?

sentences:
OnCollisionEnter calls rapidly bool tntFall = true;

void Awake()
{
    tntFallTime = Time.deltaTime / 0.05f;
}

void OnCollisionEnter(Collision coll)
{
    if (CurrentScene != "ColorGame" && CurrentScene != "PaintingGame" && coll.gameObject.tag != "Player" && CurrentScene == "TNT Run" && tntFall)
    {
        Debug.Log(coll.gameObject.GetComponent<MeshRenderer>().material.name);
        if (coll.gameObject.GetComponent<MeshRenderer>().material.name == "TNT_0 (Instance)")
        {
            coll.gameObject.GetComponent<MeshRenderer>().material = TNT_Mat1;
            StartCoroutine(coroutine);
        }
        else if (coll.gameObject.GetComponent<MeshRenderer>().material.name == "TNT_1 (Instance)")
        {
            coll.gameObject.GetComponent<MeshRenderer>().material = TNT_Mat2;
            StartCoroutine(coroutine);
        }
        else if (coll.gameObject.GetComponent<MeshRenderer>().material.name == "TNT_2 (Instance)")
        {
            coll.gameObject.transform.position = Vector3.Lerp(coll.gameObject.transform.position, new Vector3(coll.gameObject.transform.position.x,-10,coll.gameObject.transform.position.z), tntFallTime);
            Destroy(coll.gameObject, 3);
        }
    }
}

IEnumerator TNTFallDelay(int WaitTime)
{
    tntFall = false;
    yield return new WaitForSeconds(WaitTime);
    tntFall = true;
}

This my code from Player script. If you look at my  as you can see it's actually cubes holding together. All i want is;

When player touches one of the cubes For the first time it will change material
When player touches that cube Second time it will change material again
When player touches that cube Third time cube is going to fall down.

But in these case (with my code) when i touch one of the cubes it does all of the if-else statements in a second and cube falls down.

sentences:
How can I make the object when rotating to keep looking on the character/camera? Not to look the character/camera direction but to look to the character/camera.

This is a screenshot of the object I'm rotating. And this is the face of the object and he is look at the camera(Looking at me).

The object is a child of a Camera and the Camera is child of a RigidBodyFPSController (1)

In the top of the script:

public float rotationSpeed;
private float x;
private int damping = 2;

In Update:

void Update()
    {
        if (Input.GetKey(KeyCode.R))
        {
            x += Time.deltaTime * rotationSpeed;
            objectToScale.transform.rotation = Quaternion.Euler(0, 0, x);
        }
        var lookPos = transform.position - objectToScale.transform.position;
        lookPos.y = 0;
        var rotation = Quaternion.LookRotation(lookPos);
        objectToScale.transform.rotation = Quaternion.Slerp(objectToScale.transform.rotation, rotation, Time.deltaTime * damping);
    }

Now when I press on R the object name NAVI is rotating but when I move the MainCamera around the NAVI object is not facing to me.

This is a screenshot when running the game first time the object is facing to me:

But when I'm pressing on R and the object is rotating it looks like the object is facing to the left and I see the object side:

Then I move the camera to the right he is rotating like I wanted facing to me:

And if I move the camera to the left when the object is rotating I see the object back:

But I want that each time the object is rotating that he will be facing to me.

The last screenshot showing the Hierarchy the RigidBodyFPSController (1) and the MainCamera as child and the NAVI as child of the MainCamera.

The script Change Scale is attached to the MainCamera and with this I'm rotating the NAVI.

The main goal what I want is simple. When I press on R rotate the object and always make the object facing to me.

I tried now in the Update when pressing R to do:

if (Input.GetKey(KeyCode.R))
        {
            x += Time.deltaTime * rotationSpeed;
            objectToScale.transform.rotation = Quaternion.Euler(0, 0, x);
            objectToScale.transform.LookAt(Vector3.forward);
        }

But now it's not rotating at all.

sentences:
Another try. List don't remove properly I hve that script:
public void ActivateCard(Card card)
        {
            Debug.Log("Activating card: " + card.CardsData);
            if (card.CardsData.creatureName != string.Empty)
                Summon(card);
            else
                CastSpell(card);

            if (_hand.Cards.Contains(card))
            {
                _hand.Cards.Remove(card);
                Debug.Log("Card " + card.CardsData.cardName + " deleted");
                Debug.Log("now we have(cards): " + _hand.Cards.Count);
            }

            _hand.TakingCards(0);
        }

And I expect that card will be removed from the list. But it allways remove only FIRST element in there. Here's what I have(card can't be the same in one list):

ADDICTION:
It's not a full code, but it's all we need I think.
Here's how this method calls:
-I-
public class InputClass
{
  void Update
  {
    if (targetSet)
     {
         if (Input.touches[0].phase == TouchPhase.Ended)
                    Cancel(true);
     }
  }

  void Cancel(bool isDone){ _actCard.Cancel(isDone); }
}

-II-
class ActCard
{
  public void Cancel(bool isDone)
  {
    if (isDone)
     {
        _activator.ActivateCard(_card);
     }
  }
}

-III-
class CardActivator
{
  public void ActivateCard(Card card)
        {
            Debug.Log("Activating card: " + card.CardsData);
            if (card.CardsData.creatureName != string.Empty)
                Summon(card);
            else
                CastSpell(card);

            if (_hand.Cards.Contains(card))
            {
                _hand.Cards.Remove(card);
                Debug.Log("Card " + card.CardsData.cardName + " deleted");
                Debug.Log("now we have(cards): " + _hand.Cards.Count);
            }
        }
}

-IV-
public class Hand
{
  List<Card> _hand = new List<Card>();

  public List<Card> Cards
        {
            get { return _hand; }
            set { _hand = value; }
        }
}
```

sentences:
Turn based card game multiplayer: http polling or TCP I am working on card games for mobile devices. For multiplayer I will be communicating through a central server. For the purpose I sorted out three options:

HTTP polling
TCP
Websocket (client libraries are not good, so will not use it)

HTTP polling is simple, but I fear it will introduce much more delay and too many HTTP calls. TCP introduces other complications.

So my question is: Is HTTP polling appropriate for a card game? Will the HTTP overhead be too much? How much interval should I keep for polling?

Can you give a sample game based on HTTP polling?

sentences:
How to have an event occur after x seconds? I want a method to run after every 10 or 15 seconds.

My timer is set to:

timer = (double) gameTime.ElapsedGameTime.TotalSeconds;

What would be the logic to check for every 10 or 15 seconds?

sentences:
Clamp point to triangle for sphere collision I'm having some issues clamping a 3d to barycentric triangle. I've searched for some time now and keep seeing the same results, that (u,v,w) should be clamped between 0 and 1. But when I clamp those values, I'm getting very weird results as it saying it's always intersecting. Maybe I'm just clamping the wrong values or what I'm doing wrong.

The issue is that I'm projecting a point on a normal from a given triangle, then testing if the point is inside the triangle, if it is, test if it's inside the sphere. Everything works great except when the sphere center is no longer above/in front of the triangle, so the spheres edge can pass through the edge of the triangle beings that the spheres center is no longer above it. Any help with how I'm supposed to clamp the position inside of the triangle would be much appreciated.

Here is a snippet of the triangle/sphere intersect method:

public boolean CollidesWithMesh(MeshCollider other)
{
    float sphereRadius = gameObject.scale * (bounds.Scale().Max()) / 2f;
    boolean collided = false;
    RawMesh mesh = other.gameObject.meshRenderer.mesh.rawMesh;

    for(int i = 0; i < mesh.triangles.length; i++)
    {
        //Store the verts used in the triangle
        int first = i++;
        Vector3 vert1 = mesh.vertices[(int) mesh.triangles[first]].Add(other.gameObject.position);
        Vector3 vert2 = mesh.vertices[(int) mesh.triangles[i++]].Add(other.gameObject.position);
        Vector3 vert3 = mesh.vertices[(int) mesh.triangles[i]].Add(other.gameObject.position);

        //Project a point along the normal closest to the spheres center
        Vector3 normal = mesh.normals[(int) mesh.triangles[first]];
        float dot = Vector3.Dot(normal, gameObject.position.Subtract(vert1));
        Vector3 d = normal.Multiply(dot);
        Vector3 point = gameObject.position.Subtract(d);

        //If the point is not inside the triangle, continue
        Vector3 v0 = vert3.Subtract(vert1);
        Vector3 v1 = vert2.Subtract(vert1);
        Vector3 v2 = point.Subtract(vert1);
        float dot00 = Vector3.Dot(v0, v0);
        float dot01 = Vector3.Dot(v0, v1);
        float dot02 = Vector3.Dot(v0, v2);
        float dot11 = Vector3.Dot(v1, v1);
        float dot12 = Vector3.Dot(v1, v2);
        float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
        float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
        float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
        if(!((u >= 0.0) && (v >= 0.0) && (u + v <= 1))) continue;

        //If the sphere does not encapsulates the point, continue
        if(!Contains(point)) continue;

        //Respond to the collision
        Vector3 responseNormal = point.Subtract(gameObject.position).Normalized().Multiply(sphereRadius - (point.Subtract(gameObject.position)).Length());
        Vector3.Subtract(gameObject.position, responseNormal);
        if(normal.y > 0.75) isGrounded = true;
        if(normal.y < -0.75) hitCeiling = true;
        collided = true;
    }
    return collided;
}

sentences:
How can I achieve dynamic pathfinding in Godot? I am new to Godot and trying to implement dynamic pathfinding on a 2D map which includes both static obstacles and moving units. As I understand it, Godot's NavMesh makes it almost trivial to generate a path through a pre-baked polygon map [1], as with the solid-line path in the below image. However, I want my game to be able to re-plan the path if an enemy (or other obstacle) moves to obstruct it--as with the dotted-line path in the image. Is this possible with built-in Godot functionality? And if so, how?

Alternatively, how would you recommend implementing a custom pathfinding script in Godot? I am comfortable with vanilla A* and I plan to learn GDScript and/or C#, but in my experience (in Python/Pygame), grid-based A* is much too slow to re-check the path every frame.

sentences:
How does collision detection work? I was curious on how hit collision works in games. I know there is a simple method that gives every object in a 2D or 3D world a recengular hitbox that makes it easy to detect a collision, but when rotating object, this becomes complocated. Because simple math can't be used to determine whether two rotated lines cross.

To explain my question I will give you an example of what I mean. If you have two lines: (1, 1, -1,-1) and (2,-2,-2, 2). How do you know if these two hit/cross each other and what if you take a circle with radius 1 and center (0, 0), and a line (2, 2,-2,-2). How would you possibly know if these objects hit or cross each other, also keeping in mind that the performance must be good.

sentences:
resize images in libgdx I know how to set Image width and height using pixel coords. Is there a way to set relative coords? I want to deal with multiple screens.

For example i have 1920x1080 screen size. And i have relative coords width (-100,100) and height = 200*1080/1920=112.5, height(-56.25, 56.25)

Can i use this relative coords to set width and height? and how to do it?
Is there any best practices to handle different screens ratio, handle orientation change correctly?

thanks in advance.

here is how i'm using it in my app:

create()

    public void create() {
         stage = new Stage();
            Gdx.input.setInputProcessor(stage);

            camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
            camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
            camera.update();

Skin skinBackground = new Skin();
        skinBackground.add("background", new Texture(Gdx.files.absolute(FilePathSlicer.preparePath(taskSheet.background.getPicUrl()))));
        background=new Image(skinBackground,"background");

        if(background!=null) {
            background.setWidth(width);
            background.setHeight(height);
            stage.addActor(background);
        }
    }

render

public void render() {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        Gdx.gl.glClearColor(255/255f, 255/255f, 255/255f, 1);
        stage.getBatch().setProjectionMatrix(camera.combined);
        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

sentences: Directx11 / Tessellation What is so special about directx 11's dynamic tessellation? Can't it be implemented by hand, and just render geometry tessellated by your own code using older versions of directx? What are the advantages of using dx11? Thank you!

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:
How to blend the sprite into background? I try to blend the character into game but I still cannot remove the blue color in the sprite sheet and discover that the white area of sprite is semi-transparent.

Before that, the color D3DCOLOR_XRGB(255, 255, 255) is set in D3DXCreateTextureFromFileEx. You will see the fireball through the sprite.

After I change the color to D3DCOLOR_XRGB(0, 255, 255), the result will be

Now, I am trying to remove the blue color of the sprite sheet and my expected result is something like that

Until now, I still cannot figure out how to do that. Any ideas?

void initPlayer()
{
    //  Create texture.
    hr = D3DXCreateTextureFromFileEx(d3dDevice, "player.png", 169, 44,
         D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
         D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(0, 255, 255),
         NULL, NULL, &player);
}

void renderPlayer()
{
    sprite->Draw(player, &playerRect, NULL, &D3DXVECTOR3(playerDest.X, playerDest.Y, 0),D3DCOLOR_XRGB(255, 255, 255));
}

void initFireball()
{
    hr = D3DXCreateTextureFromFileEx(d3dDevice, "fireball.png", 512, 512,
         D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
         D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255),
         NULL, NULL, &fireball);
}

void renderFireball()
{
    sprite->Draw(fireball, &fireballRect, NULL, &D3DXVECTOR3(fireballDest.X, fireballDest.Y, 0), D3DCOLOR_XRGB(255,255, 255));
}

sentences:
Do I have to explain the mechanical superiority of the player-character within the fiction of the game? For quite a while I wonder how to formulate this concept, which seems to be common, yet barely addressed within games. It is about the concept of player controlled characters (PC) being consistently superior to generic non-player controlled characters (NPC). This also must not depend on the actual player skill (defined as what the player can actively do), and instead be inherent to the PC itself.

Now for RPGs it's usually something like destiny, magic, superior skill, backstory, better (enchanted) equipment, having a rare power.

But what if it's about space ships with equal size, type and equipment? How could I explain that a player can repeatedly and easily grind through 5-10 space ships which he himself is using without having much room for player skill due to weapons and thrusters working automatically? Effectively pushing a button to start attacking just as his opponents are doing. Let's say it's the early phase of the game, just to keep this abstract. Also let's assume a standard, futuristic setting with no special lore-based elements like psi powers or crystals.

What guidelines or concepts exist which can be used to justify PC superiority in general? In a mathematical sense, do I have to explain -75% damage taken and +300% damage dealt as baseline for all PCs in a credible way? Or is that a silently accepted premise of games in general?

sentences:
Cancel a SpriteBatch I've started drawing Background:

I'm working on a control library for XNA to use in a couple game clients I've written. The way I've implemented Dialogs is to have them derive from the base XNAControl class.

XNAControl objects follow the Game Component model and are all derived from DrawableGameComponent. They are added to the Game.Components list as soon as the base class XNAControl constructor is called.

Problem:

Dialogs are popped up in game by instantiating an XNADialog object, unlike MessageBox.Show() which uses a static method. The constructor of XNADialog, in turn, instantiates a couple controls that are 'children' of the parent dialog control. Children are tracked by the dialog, and removed from the Game.Components list automatically when the Dialog is closed.

The problem with the model that I've created is that the child controls are added to the Game's components when they're constructed, so they start updating and drawing and thus show on the screen before the dialog is fully constructed. The case I'm trying to debug is where the labels for a dialog box will appear in the top left, and then move to the center of the screen a split second later once the Dialog is constructed.

What I've tried:

Separate constructor for base class XNAControl that doesn't add the control to the components when it's constructed. Instead, it relies on the child control (in this case dialog) to add itself to the Game.Components collection. This is what I have in place so far and it isn't working, which makes sense, because the labels are being added to the components collection prematurely anyway.
Initialized property of XNAControl. This property is set in the XNAControl.Initialize() method, and the base class XNAControl.Update and XNAControl.Draw return automatically if it is false. However, this isn't working either (also in place) because child controls have to call the base methods of update and draw before after they do their own drawing logic because otherwise some things would be drawn in the wrong order. I also don't want to have to check the Initialized property in every single child class I make because there are a lot of them and I'm looking for something more elegant
Moving the addition of the control to the components collection to the Initialize method. This didn't work because the control's initialize method didn't get called automatically because the control wasn't in the components collection yet.

Question:

What is the best way to keep the child controls from being updated and drawn prior to their parent control's construction? My only other ideas are:

Using a theading sync object, but this seems like overkill/unnecessary (or maybe it's exactly what I need?). I can't think of an elegant way to do it.
Finding a way to cancel any drawing that's been done by the SpriteBatch in the child classes, in XNAControl.Draw. I don't think this is possible though, and I can't find anything searching.

sentences:
Is it better to track rotation with a vector or a float? In XNA, you can see that to draw a rotated sprite with SpriteBatch, you'll need a float describing the angle in radians.

I'm used to making games in OpenGL. I just want a rapid prototyping environment in XNA, but I'm a little lost. It's my preference to always use Vectors to store my rotation, to do vector math, et cetera.

So my question is: in XNA, is better to keep a vector for your rotations, and each frame transform to a float angle, or just keep the float angle itself? If I prefer the vector, what would be my drawbacks compared to just using a float?

sentences: box2d prismatic joint friction I know it is possible to add friction to rev joints by enabling motor and adding maxMotorTorque. I want the same for prism joint but only maxMotorSpeed option is available which didn't quite work for me. Is there another way?

sentences:
Damping in Unity Shuriken Particle System Is there no damping functionality in Unity Shuriken Particle?
"Velocity Over Lifetime" is different from damping.

I try to find it on particle system, but can't.
Or is there any other way to apply particle damping?

I want to control each particle's velocity decrement?

Update: Add a poor art work :)

sentences:
Can I use feature creep to my advantage? Can I use feature creep to my advantage?

Every time I prototype a game, features are inadvertently added. This happens either through coincidence, or it happens to be easy to add based on existing content.

If I know the genre of the game, can I just start making the basic mechanics and add features as they become apparent?

For example, if I want to make a 2d platformer over the course of 6 months, can I just start making the running, jumping, shooting, etc. and add the core mechanics as I inadvertently find them? Or is this too risky of a time investment without a predetermined plan?

My logic behind this is that the design will be more bang for the buck. The design choices will more easily be built around what is easy to make (time-wise).

In summary, is there anything wrong with building a game before I design it?

sentences:
Mega Man-style screen scrolling design The NES classic Mega Man series uses a very specific scrolling technique that I'm having a hard time wrapping my head around implementing. Essentially, the level is divided into "screens" which are all the same size. Some of the screens smoothly scroll in to one another, creating the illusion of a wider fields of play. Some of the screens stop the camera from scrolling until the player has reached the edge of the screen, at which time a transition occurs and the next screen is shown. It is also possible for a single screen to have more than one transition, for example it has a ladder that goes up to one screen, but you could also walk forward to another screen.

How can these screen transitions be modeled?

Screen 0 is the starting screen, where the player starts.
Screen 0-3 is horizontally smooth-scrolling and appears to the player as one continuous field of play.
Since there is a transition between Screen 3 and it's neighboring screens 4 and 5, the camera will not advance past the right or top edges of Screen 3 unless the player moves to that respective edge and "pushes" through to the next screen.
Once the player moves to either of the transition edges, user input is momentarily disabled and the camera transitions into the new area, after which user input is restored.
The blue screen (Screen 5) has disabled horizontal scrolling so that only vertical transitions are possible.
The green screen (Screen 6) has a vertical transition back to Screen 5 but also allows horizontal smooth-scrolling into Screen 7.

Edit: Implementing the transitions in terms of rooms lead me to this:

The small notches with an arrow are the regions in which a transition can occur. Each region has a "direction" and lies just outside of the room's visible area. As soon as the player hits a region, a transition will be started.

sentences:
Should your world map have it's own collision object? I am attempting to understand collision detection at the moment. I have seen many examples of a simple flat plane with boxes or cubes which move around on the plane and react when the touch each other (or stop at the plane when dropped).

What I am not finding though are more advanced examples where instead of just a flat plane, your map is made up of hills, buildings, walls, etc.

Since all of the examples I have found this far use simple primitive collision object types (boxes and spheres), I am curious what the best approach would be for creating a collision object for something like a game map (like dust2 in counter-strike).

After reading through the bullet documentation I found that you can create a collision object from a triangle mesh, which leads me to believe this might be the best approach. However if your map consists of complex geometry (say hundreds of thousands of verticies and faces), would this be too detailed to use as a collision mesh? Would it then be better to create a separate collision version of the map which is made of simple low poly shapes?

My gut is saying "go with the separate low poly version", but if there is no reason for the extra work, it would make more sense to just use the high poly mesh.

sentences:
Unity RTS Single Selection Problem I am trying to build an RTS game and I have managed to form a way to select a unit using Raycast and the tag system. I made it so that if the object the ray falls onto is of tag "TankUnit" Make so and so variable true and allow it to move to another place. However, Units of the same tag even when not selected also move. How do I fix this problem? The script is bound to each unit.

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

public class UnitController: MonoBehaviour { bool clicked = false; //public float speed = 10f; //public float rotationSpeed = 10f;

 public LayerMask groundLayer;
 public NavMeshAgent playerAgent;
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButton(0))
     {
         Debug.Log("Clicked");
         FindClickPos();
     }
     if (Input.GetMouseButton(1) && clicked == true)
     {
         Debug.Log("I clicked right mouse");
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             MoveTo(hit);
         }
     }
 }
 private void FindClickPos()
 {
     RaycastHit hitInfo = new RaycastHit();
     bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);
     if (hit == true)
     {
         Debug.Log("I hit " + hitInfo.collider.name);
         if (hitInfo.collider.tag == "TankUnit")
         {
             Debug.Log("I hit" + hitInfo.collider.tag + "!");
             clicked = true;
         }
         else
         {
             Debug.Log("I didnt hit a unit :/");
             clicked = false;
         }
     }
     else
     {
         Debug.Log("I didnt hit anything...");
         clicked = false;
     }
 }
 void MoveTo(RaycastHit hit)
 {
     Debug.Log("Position: " + hit.point);
     playerAgent.SetDestination(hit.point);
 }

}

sentences: Unity3D/Blender: Bounding box rotated on import For some reason my bounding box is always tilted when i import to unity. I've checked for loose geometry and everything but there's nothing.

sentences:
How to use multiplication operation in game render delta time? We are using delta time like this:

private static final float SPEED = 200f; // Moving pixels in one second

@Override
public void render(float delta) {
    myObject.vx += SPEED * delta;
    myObject.vy += SPEED * delta;

    myObject.move();
}

So I am using this update method to apply friction on my object:

private static final float FRICTION = 0.98f;

@Override
public void render(float delta) {
    //...

    myObject.vx *= FRICTION;
    myObject.vx *= FRICTION;

    myObject.move();
}

I know this is wrong:
myObject.vx *= FRICTION * delta

I want to use friction with "multiplication operation" not "minus".

So how can I implement the delta time to my FRICTION variable?

sentences:
Convert the animation inside FBX into Unity Recently i bought a package with an fbx and lots of animations.

Since I want full control and change a couple of details, I want to convert them into the regular Unities Animation System.
I cant convert them into the normal Unity Animations though.
They are "read only".

I can load them, copy paste them into my own "not-read-only" animation file.
But somehow i cant change the file anymore after I pasted something inside.

What am I doing wrong?
Is that something "impossible"?
Can you guys help?

sentences:
HD video capture gameplay? Possible Duplicate:
  Tools to make a trailer…

I've developed some 3d experiences using unity3d and they are pretty much experimental at this level. Now the problem is that I need to make video captures in HD to showcase them.
I've tried Camtasia 7 with divx compression, and still the quality is not Up to standard and number of dropframes are quite high. I'm running on a Core i7 cpu with geforce GT240. So I was thinking If it's possible to capturing the video remotely so one pc is in charge of capturing and one running the application.
Or is there any better way to get the highest quality with least dropframes?
Number of draw calls are around 2k(I know sounds crazy, but I can't make changes right now.)

Grazies.

sentences:
Verifying that two words match — false negatives In my first game, I am trying to validate whether two words match: whether an input word matches a reference word from an array.

Unfortunately the only word for which it finds a correct match is the last value in the array I created. All the other words report an incorrect match even when input correctly.

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

public class MatchLetters : MonoBehaviour {
    public string word = null;
    public int wordIndex = 0;
    public string alpha;
    public Text WordMatch;
    public Text Question;
    public string name;
    public static string[] quest;
    int num;
    public List<string> Words;

    void Start () {
        TextAsset wordText = Resources.Load<TextAsset> ("Words");

        quest = wordText.text.Split ("\n" [0]);
    }

    void Update () {
       //  Question.text = quest[Random.Range(0, quest.Length)];
    }
    public void AlphabeticFunction(string alphabet){
        wordIndex++;
        word = word + alphabet;
        WordMatch.text = word;
    }

    public void WordsGenerate (){
        name = Question.text = quest[Random.Range(0, quest.Length)];
    }

    public void ValidateAnswer (){

        if (name == WordMatch.text) {
            Question.color = Color.green;
            Debug.Log ("Correct");
        } else {
            Question.color = Color.red;
            Debug.Log ("Incorrect");
        }
    }

    public void ResetAnswer(){
        wordIndex = 0;
        word = "";
        WordMatch.text = word;
    }
}

sentences:
Why doesn't my texture display with this GLSL shader? I am trying to display a DXT1 compressed texture on a quad using a VBO and shaders, but I have been unable to get it working. All I get is a black square.

I know my texture is uploaded properly because when I use immediate mode without shaders the texture displays fine but I will include that part just in case. Also, when I change the gl_FragColor to something like vec4 (0.0, 1.0, 1.0, 1.0) then I get a nice blue quad so I know that my shader is able to set the colour. It appears to be either the texture is not being bound correctly in the shader or the texture coordinates are not being picked up. However, I can't find the error! What am I doing wrong?

I am using OpenTK in C# (not xna).

Vertex Shader:

void main() {
    gl_TexCoord[0] = gl_MultiTexCoord0;
    // Set the position of the current vertex
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Fragment Shader:

uniform sampler2D diffuseTexture;
void main() {
    // Set the output color of our current pixel
    gl_FragColor = texture2D(diffuseTexture, gl_TexCoord[0].st);
    //gl_FragColor = vec4 (0.0,1.0,1.0,1.0);
}

Drawing Code:

int vb, eb;
GL.GenBuffers(1, out vb);
GL.GenBuffers(1, out eb);
//                      Position        Texture
float[] verts = {   0.1f, 0.1f, 0.0f,  0.0f, 0.0f,
                    1.9f, 0.1f, 0.0f,  1.0f, 0.0f,
                    1.9f, 1.9f, 0.0f,  1.0f, 1.0f,
                    0.1f, 1.9f, 0.0f,  0.0f, 1.0f
                };
uint[] indices = {
                   0, 1, 2,
                   0, 2, 3
                 };

//upload data to the VBO
GL.BindBuffer(BufferTarget.ArrayBuffer, vb);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, eb);

GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts.Length * sizeof(float)), verts, BufferUsageHint.StaticDraw);
GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(uint)), indices, BufferUsageHint.StaticDraw);

//Upload texture
int buffer = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, buffer);

GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (float)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (float)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (float)TextureMinFilter.Linear);

GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvMode.Modulate);

GL.CompressedTexImage2D(TextureTarget.Texture2D, 0, texture.format, texture.width, texture.height, 0, texture.data.Length, texture.data);

//Draw
GL.UseProgram(shaderProgram);

GL.EnableClientState(ArrayCap.VertexArray);
GL.EnableClientState(ArrayCap.TextureCoordArray);

GL.VertexPointer(3, VertexPointerType.Float, 5 * sizeof(float), 0);
GL.TexCoordPointer(2, TexCoordPointerType.Float, 5 * sizeof(float), 3);

GL.ActiveTexture(TextureUnit.Texture0);
GL.Uniform1(GL.GetUniformLocation(shaderProgram, "diffuseTexture"), 0);

GL.DrawElements(BeginMode.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0);

sentences:
Does calling VSSetShader() twice with the same shader have a performance penalty? Let's say I render 2 objects that are using the same shader (and the same ID3D11VertexShader object). When I call VSSetShader() to set the shader for the 1st object DirectX has to change previous shader to the new one which takes some CPU/GPU time. But when I then render the 2nd object and call VSSetShader() again with the same argument(s) does it set the shader again (and take as much CPU/GPU time as before) or is DirectX "smart" enough to figure out it's the same shader and it doesn't have to change anything?

Actually, I'd like to ask a broader question - does the same hold true for other analogous state changing function calls? Like setting buffers, sampler states, blending states etc... Pretty much whenever it's a matter of "applying"/"setting as current" objects and states when I actually try to set the same as before.

sentences:
"Time Control" in a 2d Platformer I am making a 2d platformer where the player can press a button, and restart the level, only their previous character will also run the level at the same time, like they are traveling back in time.

I know other games have done this before, and the way I have thought of doing it is to make the game character have a set of actions (Idle, Jumping, Walking Left etc.) and then detect changes in those actions and log them into a list along with the game time. So then when I need the character to run the level again on its own, I can just go through the list changing its actions at the right time.

Is this the best way to do it? Does anyone have any experience in this?

Thanks.

sentences:
Try-catch or ifs for error handling in C++ Are exceptions used widely in game engine design or it is more preferable using pure if statements? For example with exceptions:

try {
    m_fpsTextId = m_statistics->createText( "FPS: 0", 16, 20, 20, 1.0f, 1.0f, 1.0f );
    m_cpuTextId = m_statistics->createText( "CPU: 0%", 16, 20, 40, 1.0f, 1.0f, 1.0f );
    m_frameTimeTextId = m_statistics->createText( "Frame time: 0", 20, 20, 60, 1.0f, 1.0f, 1.0f );
    m_mouseCoordTextId = m_statistics->createText( "Mouse: (0, 0)", 20, 20, 80, 1.0f, 1.0f, 1.0f );
    m_cameraPosTextId = m_statistics->createText( "Camera pos: (0, 0, 0)", 40, 20, 100, 1.0f, 1.0f, 1.0f );
    m_cameraRotTextId = m_statistics->createText( "Camera rot: (0, 0, 0)", 40, 20, 120, 1.0f, 1.0f, 1.0f );
} catch ... {
    // some info about error
}

and with ifs:

m_fpsTextId = m_statistics->createText( "FPS: 0", 16, 20, 20, 1.0f, 1.0f, 1.0f );
if( m_fpsTextId == -1 ) {
    // show error
}
m_cpuTextId = m_statistics->createText( "CPU: 0%", 16, 20, 40, 1.0f, 1.0f, 1.0f );
if( m_cpuTextId == -1 ) {
    // show error
}
m_frameTimeTextId = m_statistics->createText( "Frame time: 0", 20, 20, 60, 1.0f, 1.0f, 1.0f );
if( m_frameTimeTextId == -1 ) {
    // show error
}
m_mouseCoordTextId = m_statistics->createText( "Mouse: (0, 0)", 20, 20, 80, 1.0f, 1.0f, 1.0f );
if( m_mouseCoordTextId == -1 ) {
    // show error
}
m_cameraPosTextId = m_statistics->createText( "Camera pos: (0, 0, 0)", 40, 20, 100, 1.0f, 1.0f, 1.0f );
if( m_cameraPosTextId == -1 ) {
    // show error
}
m_cameraRotTextId = m_statistics->createText( "Camera rot: (0, 0, 0)", 40, 20, 120, 1.0f, 1.0f, 1.0f );
if( m_cameraRotTextId == -1 ) {
    // show error
}

I heard that the exceptions are a bit slower than ifs and I shouldn't mix exceptions with if-checking method. However with exceptions I have more readable code than with tons of ifs after every initialize() method or something similar, though they are sometimes too heavy for just one method in my opinion. Are they ok for game development or better to stick with simple ifs?

sentences:
Errors on LibGDX tutorial I get the following errors on the LibGDX tutorial "Simple App"

  Exception in thread "main" java.lang.UnsatisfiedLinkError: no gdx64 in
  java.library.path     at java.lang.ClassLoader.loadLibrary(Unknown
  Source)   at java.lang.Runtime.loadLibrary0(Unknown Source)   at
  java.lang.System.loadLibrary(Unknown Source)  at
  com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:118)
    at
  com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.load(LwjglNativesLoader.java:41)
    at
  com.badlogic.gdx.backends.lwjgl.LwjglApplication.(LwjglApplication.java:52)
    at com.badlogic.drop.DesktopGame.main(DesktopGame.java:7)

I copied and pasted the final code onto the project, but I don't know why it wont run.

Whats the problem?  Is it the project set-up?

sentences:
Why does Unity not follow the z-value when drawing text? I'm currently working on the credits of our game. For this I'm using multiple elements in a canvas:

I want the order that these elements are drawn in to be as follows, I gave them a z-value based on this:

 Z    Object                             Object type
=========================================================
 0    Text (The actual credits)          Text
---------------------------------------------------------
-1    Hider (Green for demonstration)    Sprite
---------------------------------------------------------
-2    Divider (The grey line)            Sprite
-2    Gametitle                          Text

The camera has a z-value of -10. The canvas is in "Screen Space - Camera" render mode.

But for some reason Unity is not drawing these items based on these Z-values:

As you can see, the Divider is drawn over Text, but Text is above Hider and Gametitle. Why is this happening and what can I do so the credits get properly drawn?

sentences:
To Unity Rigidbody move like Character Controller on collision I want to a blue ball moving like a figure.

in CharacterController, it was possible.

but in Rigidbody, object was stucked.

help me.

sentences:
Assets from Tiled background layer not appearing in Cocos2d-x I'm running into an issue with a Tiled map used as a background image for a scrolling scene. I'm using two sprite sheets to provide assets for a background layer. In Tiled, all of these assets appear correctly, but in cocos2d-x, the assets from WorldSelectBG01.png do not appear. Any thoughts on what might be going on here?

Here's what the TMX file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" tiledversion="1.0.3" orientation="orthogonal" renderorder="right-down" width="1" height="10" tilewidth="640" tileheight="640" nextobjectid="15">
 <tileset firstgid="1" name="WorldSelectBG01" tilewidth="640" tileheight="640" tilecount="6" columns="3">
  <image source="WorldSelectBG01.png" width="1920" height="1280"/>
 </tileset>
 <tileset firstgid="7" name="WorldSelectBG02" tilewidth="640" tileheight="640" tilecount="6" columns="3">
  <image source="WorldSelectBG02.png" width="1920" height="1280"/>
 </tileset>
 <layer name="Background" width="1" height="10">
  <data encoding="csv">
1,
2,
3,
4,
5,
7,
8,
9,
10,
11
</data>
 </layer>
 <objectgroup name="GameSelectButtons">
  <object id="1" name="gd0" x="394" y="6308"/>
  <object id="5" name="gd1" x="251" y="6253"/>
  <object id="6" name="gd2" x="140" y="6113"/>
  <object id="7" name="gd3" x="227" y="5972"/>
  <object id="8" name="gd4" x="362" y="5907"/>
  <object id="9" name="gd5" x="499" y="5806"/>
  <object id="10" name="gd6" x="458" y="5651"/>
  <object id="11" name="gd7" x="336" y="5583"/>
  <object id="12" name="gd8" x="241" y="5477"/>
  <object id="13" name="gd9" x="294" y="5365"/>
  <object id="14" name="gd10" x="322" y="5213"/>
 </objectgroup>
</map>

And in cocos2d-x, I'm reading it like this:

void ABTScene::AddBackgroundTileMap(const std::string& backgroundTiledMapFilename)
{
    if (backgroundTiledMapFilename.empty())
    {
        return;
    }

    const cocos2d::Size visibleSize{ cocos2d::Director::getInstance()->getVisibleSize() };
    const cocos2d::Vec2 origin{ cocos2d::Director::getInstance()->getVisibleOrigin() };

    _backgroundTiledMap = cocos2d::TMXTiledMap::create(backgroundTiledMapFilename);
    CC_ASSERT(_backgroundTiledMap);
    if (_backgroundTiledMap)
    {
        CCLOG("Background tile map read from resource file: %s", _backgroundTiledMap->getResourceFile().c_str());
        cocos2d::Vector<cocos2d::TMXObjectGroup*>& objectGroups{ _backgroundTiledMap->getObjectGroups() };
        for (const cocos2d::TMXObjectGroup* objectGroup : objectGroups)
        {
            CCLOG("Object group found in tilemap: %s", objectGroup->getGroupName().c_str());
        }

        // all tiles are aliased by default, let's set them anti-aliased
        for (const auto& child : _backgroundTiledMap->getChildren())
        {
            static_cast<cocos2d::SpriteBatchNode*>(child)->getTexture()->setAntiAliasTexParameters();
        }

        _backgroundTiledMap->setAnchorPoint(cocos2d::Vec2(0.0f, 0.0f));
        _backgroundTiledMap->setPosition(origin);
        const float bgImageScaleFactor = visibleSize.width / _backgroundTiledMap->getContentSize().width;
        _backgroundTiledMap->setScale(bgImageScaleFactor);

        this->addChild(_backgroundTiledMap, -1);
    }
}

sentences:
Limiting framerate with a fixed timestep UPDATE:

I still need help determining how MAX_UPDATES works.  I want my game to be designed in such a way that if the user can't run the game at full speed, it slows down so that no updates are missed.. can someone help me understand that part of the code?  Also, how can I calculate an accurate realtime fps?

double frametime = 1000000./60, remainingTime = 0;
const unsigned int MAX_UPDATES = 10;

void Game::gameLoop(sf::RenderWindow &window)
{
    remainingTime += clock.restart().asMicroseconds();
    unsigned int updates = 0;
    while (remainingTime >= frametime)
    {
        remainingTime -= frametime;
        if (updates++ < MAX_UPDATES)
        {
            update();
        }
    }
    render(window);
}

Hi I'm learning how to create a 2d platformer in C++ using the SFML2 library.  My current goal is limiting the game's framerate.  SFML2 has a  window.setFramerateLimit(unsigned int limit) function for the window however I have found it to be imprecise due to it using sf::sleep.  Therefore I'm attempting to implement my own solution.  I want my game to used a fixed timestep and be framerate dependent as in the future when I implement attacks I want them to be based on frame data.

Since the game loop wont always execute exactly when a frame is supposed to happen, I create a delta variable that will account for the extra time spent starting the frame to start the next frame earlier by that same amount.

Does this all look right?

double frametime = 1000000./60, delta = 0;
void Game::gameLoop(sf::RenderWindow &window)
{
    t = clock.getElapsedTime().asMicroseconds();
    if (t + delta >= frametime)
    {
        clock.restart();
        delta = t + delta - frametime;
        update();
    }
    render(window);
}

edit: double shouldn't have f suffix doh

sentences: What does rebuilding the .vcxproj file do? I'm having the same problem this user had.  The solution is confusing me, because all I want to do is comment out the code I added that caused the compiler crash, get Unreal to accept it and stop crashing, but he sounds like he is rebuilding the whole engine, and I just have one crashing project.  I tried commenting out the code and saving the visual studio project, but it didn't change anything.  What is his solution doing?

sentences:
When there are multiple objects of the same type, how do I know which one I am colliding with? I'm working on a platformer game using Gamemaker Studio 2. , and currently I'm dealing with implementing platforms:

(Platforms are able to pass through from the bottom, but remains solid when landing on)

It's all working good and well for a single platform, but when I add multiple, then only the lowest placed platforms will work properly. I'm already aware that the problem lies on the second if-statement in the code below.

if (place_meeting(x, y+mySpeed[1], o_platform) &&       //If the player collides with a platform
    mySpeed[1] > 0  )                                   //if the player is falling
{
    if ((y + 29) < o_platform.y)                        //if the player's feets are located higher than a platform
    {
        while !place_meeting(x, y+sign(mySpeed[1]), o_platform)
        {
            y += sign(mySpeed[1]);
        }
        mySpeed[@ 1] = 0;
    }
}

The problem is likely because it's reading information from any platform. but not the higher platform I'm colliding with. So I should need a check to make sure I'm talking about the same object I'm colliding with.

If it was a build-in collision event, I could use the other statement to get the right instance, but currently I'm using place_meeting in a step method to collide, and other would be too broad to use properly. So how would I be able to archieve this?

sentences:
Simulating a real camera's perspective projection I'm trying to simulate a real camera's perspective projection of straight, parallel lines running along the ground (one-point perspective) by mapping the real-world 3D coordinates of the lines to 2D screen coordinates. Suppose the camera's tilt angle is known, is there a way to calculate the slopes/coordinates/expression of these lines projected on to the 2D plane? Which parameters of the camera are needed?

My understanding is that when the camera is tilted, the vanishing point is effectively shifted. But does tilting the camera cause the same changes in the perspective of the lines as moving the camera lower to the ground (closer to the lines)?

sentences: UE4 - Cloth collision How is collision working in UE4 Free Asset Paragon-Kallari? It seems like the body of the character and the cape is somehow colliding but I wasnt able to find any physics asset or any setting. Could someone help me with this?

sentences:
GetUserWidgetObject returns null I have a widget component inside of my character:

// ABCharacter.h

...
UPROPERTY(VisibleAnywhere, Category = UI)
    class UWidgetComponent* HPBarWidget;
...

// ABCharacter.cpp
...

AABCharacter::AABCharacter()
{
     // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    HPBarWidget = CreateDefaultSubobject<UWidgetComponent>(TEXT("HPBARWIDGET"));
    HPBarWidget->SetupAttachment(GetMesh());
}

I checked HPBarWidget is null and it wasn't:

if (HPBarWidget == nullptr) {
    UE_LOG(ArenaBattle, Error, TEXT("NULL"));
}

HOWEVER, When I try to get the widget object, it said it's null.

if (HPBarWidget->GetUserWidgetObject() == nullptr) {
    UE_LOG(ArenaBattle, Error, TEXT("NULL"));      // it printed NULL
}

What causes this returns null? I can clearly see I have a WidgetComponent that exists in my character's tree, and HPBarWidget wasn't null too.

I struggled this already hours and couldn't find any related issues. What did I wrong?

Using 4.24.3.

sentences:
C# Perlin noise - generating “endless” terrain chunks? I'm currently writing a little side scroller in C#, to both learn C# and have fun. Right now I have a simple random number generator generating the world but it isn't exactly all that great - so with some research, I've discovered that Perlin Noise generation may help me out quite a bit. Problem is, I want to have an "endless" landscape made up of several chunks.

Basically my questions / concerns are:

Using minecraft as an example (Ignoring the 3rd dimension), how is Notch getting each chunk to connect to each other perfectly? Tunnels, caves, ore veins, mountains, flat lands, biomes, etc. are all connected to each other even though each chunk is generated separately, and sometimes at a much later date. This is key for me, I want the player to be able to walk to the right and as they are walking, generate more landscape that connects to previous landscape, including underground tunnels and cave systems.
Going off of #1, how would this be accomplished under the assumption that each chunk is a square, and the world is 10 squares high, and infinite squares wide? I.e. Each "chunk" is 128x128 tiles and the world is 1,280 tiles tall total. (This is so that I can make an infinitely deep map if I choose to - and also to show that all 4 sides of a chunk / square need to be able to connect and continue on what the previous square/chunk was doing).

sentences:
how to make AI do jump on navigation mesh system? hi :D i'm currently using unreal for make a sand-box game for learning purpose.

and due to the unique attribute of sand-box game, i am looking for how AI move naturally on map (which changes so often).

i find a way to place Nav-links on map dynamically and working on that way. but i think if i can make AI do Jump or fall off,climb low height wall like thing, it would be more performance-friendly than placing bunch of Nav-links.

so i searched about that, and i find 'how to get navigation-mesh in unreal', 'how to override path following' kind of stuff. but i really can't find and don't get about 'How to make AI decide to jump when it need'

i put an image for detailed question. Stick man is the AI and while the flag on right top is the goal( target move location ), there is also 2 obstacles(A and B) for reach the goal.

so here is my question :

while the navigation mesh isn't linked between the platform and above the obstacle A. How path-finder knows it can use 'A' when it can do Jump?
i think obstacle B is more difficult situation. unlike situation A, 'navigation mesh B'has the same or inner positions of 'navigation mesh platform'. while the only noticeable difference is height, how AI or path-finder know it is valid path and needs do jump?
quite same question about B i think. i forgot to draw on image though. so, if AI figure out the path and try to do jump for reach to goal but there is some obstacle just placed which block the jump. how it know and fix the path?

i know it is very difficult question, and very hard to explain. especially the question 2 and 3. so i understand even only answer for question 1. and even so, i feel so appreciate about it.

since English is not my first language, please excuse my poor English skill. and hope you don't bother about it :).

thanks for reading, and hope you have a wonderful day and stay happy :)

sentences:
Simple Math Multiplayer game - is Ajax sufficient? I'm planning to create a simple math multiplayer game and I plan to just use Ajax for the server/client communication but I'm not sure if this is sufficient or if I need a socket server.

The game will look like this:

2-4 users
all get a simple math task (like: "37 + 14")
they have to solve it as fast as possible
first user who solves it is the winner

I will track the time for each user, since the game started, on the client side and everytime a user gives an answer, the answer and the passed time will be send to the server. Additionally I'll add a function which will check every 3 seconds if the other users finished, how much time they needed and who won.

Do you think this is possible just using Ajax? What alternatives are there?

sentences:
Storing game data on user end? A thought occurred to me after seeing this question:
Storing data - think character data for an online game - on the user`s computer is definitely less safe (maybe an understatement) than on a server under your control, but...

Is such a mechanism feasible? (while preventing cheating and such, of course...) If yes - why is it not used? Is it just me who hadn't seen it?

Some elaboration and ramblings:

A hypothetical advantage to this would be a need to store VERY little data on the server itself while still being able to handle a HUGE bookkeeping for the character, recording amounts of data you wouldn't dream of while storing the data on your server (think looking back on the exact date of your first attack in a game... sweet, useless, nostalgia :) ).

(Of course, there's a limit to how much you would do this way as well - your user isn't likely to condone a 1GB game save file... or they would... who knows.
Maybe an option for what data to keep could give users the choice between conservative and extensive logging of their adventures?)

Take the following example: I think that an attempt to:

Store a hash of the user's data on the server.
On the next run, request the data from the user`s end.
Hash it.
Compare the hashes.

is bound to fail.

The user could change the data on his end after the verification.
I'm assuming there will always be a 'hole' somewhere even if the programmer utilizes tons of checks throughout the game, verifying every action.

This could very well be a reason for not doing this... just remember I'm asking about feasibility, not practicality.

There are some more considerations, of course:

The user's data being at their hands can be less safe and less available.
They could lose it, have it stolen, forget their flash drive containing the file at home etc etc.

But it could also mean that the server has very little data on it to be compromised - say, if all of the user's data will be in their file, and the server will only be able to verify its authenticity via hashing mechanism and whatnot.

It will also be very easy to back up a server containing so little data.

The mechanism for the user should be a simple encryption/signature of the data file... or is that bound to fail as well?

sentences:
Convert bones by bone matrix I have a 3d-models from old game.
They have the following structure:

Model {
    List<Vertex> Vertices;
    List<Bone> Bones;
}

Vertex {
    // point
    float x;
    float y;
    float z;
    // normal vector
    float nx;
    float ny;
    float nz;
    // texture
    float u;
    float v;
    // bones info
    byte boneIndex1;
    byte boneIndex2;
    float weight;
}

Bone {
    float[,] matrix = new float[4,4];
}

I want to convert models to any other format that is supported by 3D editors.
I learned how to convert a mesh (to obj, fbx). But I can't convert the bones.
As I understand it, a 4x4 matrix is enough to form a bone. The role of the bone index is performed by their index in the array. Unfortunately, as I understand it, there is no data on the hierarchy of bones.

I looked at various specifications of file formats, but I did not find one where the bones can be specified as a matrix.

Maybe there are some formats that support such a recording of bones in the form of matrices?
Maybe I just misunderstand something and I need to look for something completely different?

sentences:
If statements seem to act as though the condition is always true I have other scripts in the same project using boolean if statements that work fine, but I've tried multiple methods of testing if the if statements below are working and none of them worked!

I don't really know what to ask because I don't know whats going on. I've tried placing theae statements in Update and Start, and in both instances the if statement completely ignored the check and just executed the contents of the block as though the check evaluated to true.

void OnTriggerEnter(Collider other) {
    if(other.gameObject.CompareTag("Player")); {
        working = true;
    }

    Extremity = false;
    if(Extremity); {
        Instantiate(Cannon, transform.position, transform.rotation);
        Extremity = !true;
    }
}

The false statement is only in there to show that even when the bool is set to false immediately before the check, it still runs the Instantiate method inside as though it were true.

sentences:
Geometry shader: Dynamic output? I'm currently using a geometry shader to generate grass blades out of single root points that are layed out in a grid. For each root point, I generate a grass blade with, right now, a constant number of vertices.

However, for level of detail, I would like to generate a number of vertices depending on the distance to the camera. Now, since there are no dynamic arrays, I tried to declare multiple techniques which call the geometry shader with the number of vertices.

I would then be able to divide my grass into patches/smaller grids, calculate the distance to the camera for this patch and then call the technique with the appropriate number of vertices.

The HLSL part looks something like this:

[maxvertexcount(24)]
void GS_LOD1(point GEO_IN points[1], inout TriangleStream<GEO_OUT> output)
{
    GS_Shader(points, 8, output);
}

[maxvertexcount(24)]
void GS_LOD2(point GEO_IN points[1], inout TriangleStream<GEO_OUT> output)
{
    GS_Shader(points, 16, output);
}

technique LevelOfDetail1
{
    pass Pass1
    {
        VertexShader = compile vs_4_0 VS_Shader();
        GeometryShader = compile gs_4_0 GS_LOD1();
        PixelShader = compile ps_4_0 PS_Shader();
    }
}

technique LevelOfDetail2
{
    pass Pass1
    {
        VertexShader = compile vs_4_0 VS_Shader();
        GeometryShader = compile gs_4_0 GS_LOD2();
        PixelShader = compile ps_4_0 PS_Shader();
    }
}

And the definition of the GS function:

void GS_Shader(point GEO_IN points[1], in const int realVertexCount, inout TriangleStream<GEO_OUT> output)
{
  [...]
  GEO_OUT v[realVertexCount];

However, even this way the compiler complains:

  array dimensions must be literal scalar expressions

Is this possible in any way? I guess what would is just writing several geometry shaders that basically do the same thing but with a already defined number of vertices - this sounds a bit messy though.

Thanks!

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:
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:
WEBGL antialias false to pixel art low resolution I know this issue maybe repeated and seems to be very common but I searched first and did not find anything concrete.

I am doing some test and playing around with pixijs. I created an stage 320x180 and I am rendering an sprite of 27x27 in a autodetected renderer (WEBGL always is selected) I am in a macos retina resolution (devicepixerate 4) the problem is I can not achieve having the sprite pixelated even setting antialias false in the renderer. I tested the same without pixijs but native canvas 2d context using drawImage and I could get what I wanted using some hacks like after every drawImage set context.imagesmoothingenabled to false and I have CSS file to canvas image-rendering: pixelated. With those I am having exactly what I want, but of course I would like to obtain the same using pixijs and WEBGL. Is it possible? Disable at all antialias in a WEBGL context? How we can deal with this to render pixel arts properly?

EDITED:
Using canvas 2d context native api

Using PixiJS webgl context.

Cheers.

sentences:
2D Tile Game - Smooth Biome Terrain Transitions While working on my 2D tile based game, I encountered a problem. I use Perlin Noise to generate the terrain. Some biomes (Desert, Forest, etc) have different flatness values depending on terrain, which causes the end/start of a new biome to have a big cliff because the terrain is different. When 2 biomes have the same flatness, they are fine, but if they are different, this can happen. Is there any way to keep this from happening?

Example (In programmer art)

sentences:
Applying the input for the always-moving player in the multiplayer game I've read several articles published on gambrielgambetta.com, gafferongames.com plus some pages about how Valve handles multiplayer networking in its games but I still can't get it how to implement the client-side prediction for my game where the player's always moving and he controls the speed by pressing the spacebar. When the client input has arrived the server already had simulated the world using the old velocity values. So we get a stretch in time.

Let's imagine that the player is moving between the 0.0 and 1.0 values. The current position is 0.2. The normal speed is 0.1. The "crawling" speed is 0.05.

Let's assume the server and the client have framerates both fixed and the latency is two steps high.

  STEP 0
  server 0.2
  client 0.2

  STEP 1
  server 0.3 (+0.1)
  client 0.3 (+0.1)

  STEP 2
  server 0.4 (+0.1)
  client 0.4 (+0.1)

  STEP 3 (Spacebar's pressed)
  server 0.5 (+0.1)
  client 0.45 (+0.05)

  STEP 4 (Spacebar's still pressed)
  server 0.6 (+0.1)
  client 0.5 (+0.05)

  STEP 5 (Spacebar's still pressed. Finally, the input has arrived)
  server 0.65 (+0.05)
  client 0.55 (+0.05)

  STEP 6 (Spacebar's still pressed)
  server 0.7 (+0.05)
  client 0.6 (+0.05)

  STEP 7 (Spacebar's released. Input was sent)
  server 0.7 (+0.05)
  client 0.7 (+0.1)

  STEP 8
  server 0.75 (+0.05)
  client 0.8 (+0.1)

  STEP 9 (Input has arrived)
  server 0.85 (+0.1)
  client 0.9 (+0.1)

It looks like nothing's wrong with this data while every multiplayer game's trying to hide the latency. But what if the periods of pressing the spacebar are different and the latency is different and the server and client have different framerates. I can't use the input duration when updating the player position because it allows the player to cheat (just lower the duration and you will start moving slower). And the server reconciliation works not very good since I'm getting the effects derived in the statistics above. When pressing the spacebar the player just jumps back and starts moving slower. So I need to compensate that somehow.

The core of the problem is how to handle the player input when the user can only decrease the speed of the character while the character's moving with the predefined speed.

sentences:
How to Generate Spritesheet from a 'problematic' animated Symbol in Flash Pro CS6? In the new Flash Pro CS6 there is an option to generate spriteheet from a symbol. I used these tutorials:

http://www.adobe.com/devnet/flash/articles/using-sprite-sheet-generator.html

http://tv.adobe.com/watch/cs6-creative-cloud-feature-tour-for-web/generating-sprite-sheets-using-flash-professional-cs6/

And it works really well!

An artist I'm working with created a bunch of assets for a game. One of them is a walking person as seen from a top-down view.

You can find the .fla here:

https://docs.google.com/folder/d/0B3L2bumwc4onRGhLcGNId1p2Szg/edit
 (If this does not work let me know, it is the first time I used Google Drive to share files)

1 .When I press ctrl+enter I can see it is moving. When I look for the animation, I do not seem to find it. When I select to create a spritesheet, flash suggest creating a spritesheet with one frame in the base pose and no other (animation) frames.

What is causing this and how do I correct it?

2 .I want to convert it to a sprite sheet for 32 angles of movement. Is there any magical easy way to get this done? Is there a workaround without using Flash CS6 to do the same thing?

sentences:
How to add ingame tutorial for first time? I want to know how to show tutorial when player playing for First time.
Only once

sentences:
Issue implementing wall jump in Unity I'm having troubles implementing a satisfying wall jump in Unity.
I managed to detect collision with a wall, but when I press the jump button, the result is alway weird or very weak. I think this have to do with the 2D physic in Unity, but I have no idead how to handle it correctly.

Here's my code with the concerned parts:

public void Move(float move, bool crouch, bool jump)
{
    // If the input is moving the player right and the player is facing left...
    if (move > 0 && !facingRight)
        // ... flip the player.
        Flip();
    // Otherwise if the input is moving the player left and the player is facing right...
    else if (move < 0 && facingRight)
        // ... flip the player.
        Flip();

    if (jump)
    {
        if (!grounded && walled)
        {
            StartCoroutine(WallJumpRoutine());
        }
    }
}

void Flip()
{
    // Switch the way the player is labelled as facing.
    facingRight = !facingRight;

    // Multiply the player's x local scale by -1.
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}

IEnumerator WallJumpRoutine()
{
    Vector2 wallJumpVector = new Vector2(jumpForce*10, 20f);

    GetComponent<Rigidbody2D>().AddForce(wallJumpVector, ForceMode2D.Impulse);
    yield return null;
}

To be more precise, the result I'm getting is either my player being moved a tiny bit (despite using the same force as my regular jump, which is working fine) or my player being moved a good distance but at very high speed (this is when I'm using ForceMode2D.Impulse).

Any help?

sentences:
Making classes available to others I'm currently working on a 2D game engine in XNA, and I am very interested in architecture, and how best to let my game objects communicate.

I know a lot of people use a Singleton design but I believe that this is more of a "counter-architecture" way of doing things, as every class will have access to the Singleton.

I was comtemplating using a Service-type architecture to allow for my Input, Sound, etc Manager classes to be available, but this is essentially the same problem as the Singleton as all the Classes are available to 'whoever' wants them.

I could of course pass references to the objects when they are needed, but this is bloated.

I wonder if making the 'Services' only allow certain objects to subscribe would be possible?

So is there a better way to make your classes available?

Or am I searching for an answer that doesn't have a question?

sentences:
Desaturate texture using mask in OpenGL 2 I have a very large texture i am using as background and i want to apply a filter to a small part of it, the "small part" is defined by the alpha layer of another texture i have (which is still RGB8888), i am not sure what's the best approach to do this. I'd like to keep the same (very simple) shader i am already using for other sprites, which is similar to the basic one, i.e.:

precision mediump float;
uniform sampler2D uTexture;
varying vec2 vTexPos;
void main() {
  gl_FragColor = texture2D(uTexture, vTexPos);
}

So, i have some questions

How can i apply my filter only to "masked" region and avoid drawing others?
Do i have any performance loss if i draw the big texture again once loaded to just apply it to a small portion of the screen?
Can i map a second texture to the shader and use something like "if uTexture2 != null" -> apply as mask? Will this give me any performance gain compared to using a second shader?
Both textures are premultiplied, how should i handle alpha masking?

What id like to do is something like this (original, mask, result):

My environment is Android 4.0, im using GLES20.

sentences:
How to program an attack that I control with the arrow keys? I'm making a 2D game prototype in Unity and I want to have the player attack be a sword that hovers around the player with its direction being fixed to the direction you indicate with the arrow keys. So if the sword is in the upward position and you press the left button, you can see the arc it takes and an enemy in the way of that arc takes damage.

The game is not a platformer. It's on a flat surface.

edit: I want to know how to have the sword hover in a radius to the player and point the direction i press the arrow keys. I want to get the action of moving the sword to these positions to do damage to an enemy. But if the sword is in a upwards position and the player presses down, I want it to do an action that attacks the whole radius around the player, on a cooldown.

How would I go about programming this? I'm new to programming so I would greatly appreciate some helpful pointers.

Edit2:

So this is how far I have gotten:
public class SwordSwing : MonoBehaviour {

public Transform swordHolder;

// Update is called once per frame
void Update ()
{
    if (Input.GetKeyDown(KeyCode.LeftArrow))
    {
        swordHolder.transform.Rotate(0, 0, -90);
    }

    if (Input.GetKeyDown(KeyCode.RightArrow))
    {
        swordHolder.transform.Rotate(0, 0, 90);
    }

    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        swordHolder.transform.Rotate(0, 0, 90);
    }

    if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        swordHolder.transform.Rotate(0, 0, -90);
    }

}

I don't know if this is right, because when I use the arrow keys it just turns the sword 90 degrees and not to the specified position I want it to move to.

So Candid Moon said that I have to use Mathf.Lerp() and StartCoroutine() but I have no idea how to use them. I'm not really sure how to animate this either, I have done some animations in Unity but have a hard time implementing them into anything.

The hierarchy is now:

Player > SwordHolder > Sword

Now I also have this script:

if (GetComponent<Rigidbody2D>().velocity.x > 0)
        transform.localScale = new Vector3(1f, 1f, 1f);
    else if (GetComponent<Rigidbody2D>().velocity.x < 0)
        transform.localScale = new Vector3(-1f,1f,1f);

That flips the player sprite when i move left. This also flips the sword, I don't really want this. How do I stop it?

Let me know if there is anything I missed, I'm trying to learn.

sentences:
AABB of rotated sprite? Say I have a sprite. Its AABB is easy to find since I know the width and height. Say I rotate it 45 degrees, I don't think the AABB would be big enough to cover it, so I need a new AABB. How can I calculate the bounding rectangle of a rotated rectangle (given a center point, an angle, and its width and height)?

Note that OpenGL does the rotation so I do not have access to the vertex information.

What I'm trying to do is get AABBs so I can do 2D culling for rendering.

Thanks

sentences:
Make character move behind object I used Tiled Editor for making maps for my own game, I do not run any engine or anything. I have separated terrain layer and object layer in TiledEditor.

However I have problem with trees I want to make my character move behind the tree. But I have no idea how because even if it is different layer I am still rendering it by 8x8 pixel blocks.

Now my character is always on top as it is the last thing that I render.

But if I change the render order my character would be behind the tree even if the character will stay in front of the tree like this:

sentences:
Approach in implementing the web browser game Im Phil and try to figoure out the best approach for my app.
I was searching Stack for my question but I didnt find a completely answer.
Assumptions:

It will be multiple user who can see in real time their vehicles(locations,state, fuel), places(state, is it planted, is it mowed) etc.
Action taken by players - e.g. User click build/drive and have to wait for example 45min. I want to display to user time to end of action.
should action be registered in queue system ? ( RabbitMQ or something like this,generally a message queuing system)
After this time the object of user should change - User get coins or the vehicle change his place from X to Y
Remove this action from queue and store information about ended action in DB

Is my approach correct? Could I ask for ways to implement this? Or should I go in a completely different direction? I will be grateful for all the advice!

EDIT:
I found different solution: Store action in DB to build / drive and save the current timestamp and time when action is finished. Now i should have bacgrond process which will be looking into this DB and change state when the action is finished (add coins to player X e.g.) In the same time when user clik the request to server is send. In response got the time when te action start and finish. Javascript will be drawing to user the progres bar (calculated from current timestamp and from db) What in situation when user not send another request (not rerfresh site)? The script should check if action in finished (current timestamp > timestamp from db ) and then should automatically refresh user site. Is that correct?
Second aproach is simpler to implement IMO.

sentences:
What would encourage a player to play the both the combat and building aspects of my game? I have been planning all of the features for my game idea. It is an RPG fantasy free roam game, in which the main focus of the game is on combat and adventure, though I also want to add in the ability to be a carpenter, shop keeper, brick mason, and/or cook.

Though this is all well thought out, another thought has cane to mind: Why would anyone actually follow through with the average life-style or even begin to think of living a normal life? I thought of how an experienced adventurer might "retire" and go into business for themselves, but what could be some other things that might make a player go for the worker's lifestyle?

sentences:
First encounter with dynamic lighting I have a game idea with lots of pretty lights (literally) in mind that I would really love to implement, but I have essentially zero experience with shadow mapping, deferred rendering, the lot of it. I've done some research into 2D shadow-casting, and I think I might try a method similar to this, but I haven't a fathom how to create a virtual rectangular manipulation of a polar image (from the point-light's perspective on the map).

My question: How can I create a virtual rectangular manipulation of a polar image whose process is quick enough that it can be run twice per frame every time a light moves in-game?

I'd like to be able to handle at least 4 dynamic lights on-screen at any time, but I'll take what I can get. I've started to learn OpenGL, so hopefully this isn't too high above my skill level.

sentences:
How can I implement sprite layering in a 2.5D game? I started making a game, which has a 3D engine under it, but achieves a 2D look by using ab orthographic camera and billboards. Similar to how Don't starve, Realm of the Mad God and (I think) the new Stardew Valley manages entity rendering.

All three games I posted have structures in them (grass, trees, etc), and the player can go behind them. I want to achieve this effect. Of course, by having a fixed Z coordinate for the entities (I use Z sorting) isn't enough for this.

I once achieved this effect by making the entity's Z coordinate change based on their clip space position, but this I felt like this wasn't the best solution.

Basically, what's the best (fastest) way to achieve the above mentioned effect?

sentences:
2D Ragdoll - should it collide with itself? I'm working on a ragdoll fighting game as a hobby project, but I have one dilemma. I am not sure if my ragdoll should collide with itself or not, i.e. if ragdoll's body parts should collide.

2D world is somewhat different than 3D, because there are several layers of stuff implied (for example in Super Mario you jump through a platform above you while going up).

The setup I'm currently most satisfied with is when only the parts which are joined by a joint don't collide, so head doesn't collide with neck, neck with chest, chest with upper arm etc, but the head can collide with chest, arms, legs.

I've tried every different way, but I'm not content with either. Which way would recommend me to go?

sentences:
How do I compile further libraries into my game? This might be vague; I don't know how to search for this.

How do I link a GUI framework (in my case, CEGUI) to a graphics framework (in my case, SDL)?

I'm using a Mac. My mental model on how to add libraries is something like this in my head:

  There are .framework files. They go in /Library/Framework/. You then link them to Xcode in build settings, then they magically work. Then there are libraries you add to header path, and library path and something about include and lib folders, but I don't understand those.

A guide from the ground up would help, because I would like to get a better understanding of how it works. I also have no idea what cmake is, although I've been seeing it a lot.

sentences:
Understanding webgl min/mag filter texture artifacts in orthographic projection? Summary

Flickering and shimmering of image plotted on a geometry where the viewport exceeds the size of the screen. I am using an orthographic projection for the camera. In this case, it is tied to THREE's OrthographicCamera where the left,right,top,bottom parameters are -w/2,w/2,-h/2,h/2 and h=height of data and w=width of data.
I am rendering a geometry that is larger than the screen viewport, but with the left,right,top,bottom defined above as fitting to the dimensions of the data, the entirety of the data fits on the screen.
This geometry is broken into PoT tiles. I am using a LUMINANCE format for texture with a barebones fragment shader (the data itself is float32)
The view matrix is based on an orthographic projection where the frustum extends to the extent of the geometry (so the entire geometry is in view)
I have both enabled/disabled mipmap generation and have seen the same results below

Issue

For sufficiently large geometries (often 10-100x larger than the viewport) this causes some annoying artifacts that cause the texture to "shimmer" effectively changing the visual representation of the data.

Examples

Here is an example where the camera is panning down the Y-axis (down) in very small values relative to the viewport dimensions and you can see the texture actually appear to change:

This aliasing effect is definitely apparent in datasets like the one above (a raster plot of a signal)

Here is a second example that shows it a lot more.

My suspicion is that this is an artifact of the minfilter when there are many texels per pixel. What the heck is going on here!?

sentences:
Choosing 3D modeling software Maya or 3D max? I've am a developer whose has spent most of my programming life developing web and business applications. I want to try my hand at something more challenging (but stay in the comfort of Visual Studio) ...perhaps XNA.

Want 3D modeling software would be best for someone developing XNA?
I have played with 3d MAX and Maya but never really did anything too involved.
What are the pros and cons between them (in terms of game development)?
Does one win out over the other for game development?
Or is it pretty much just preference?

I am new to game development and just trying to figure out the best tools to use before I really started. Any advice or other suggections would be greatly appreciated.

sentences:
Libgdx Hud with two stages I have an app that's currently working with a single stage but i need to add a side display/section as a HUD, with scores/lives etc on it, so that the HUD is on the left, and the main hand screen on the right. The main game screen will be fixed and will not move around.

From researching I've found a couple of solutions.

1 - two stages 2 - a group with two groups to it, possibly using a horizontalgroup 3 - two cameras one stage 4 - one stage, one camera, but changing the position of the camera for each set of actors.

I think, option 1 is my preference, but i have some questions.

Do stages always fill the whole screen, or can i start then where i want? This would make it easier for the right hand screen to calculate positions based on 0,0 of that screen rather than always having to add the width of the HUD on to any calculations.
Do i need to work about viewports? Currently I'm not using one (which i think means my stage is set to scaling by default) but nothing looks stretched as a result of this. I don't know much about viewports, but there always seems to be a compromise to be made with them, i.e. black bars top or sides.
If I have two stages, do they each have their own camera? Do I need to with about this? Can I possibly aim the right hand camera at an offset so i can still draw things from 0,0 with that being the bottom left corner of the right stage, not the whole screen?
Finally, off topic, I am a little confused about spritebatch. I'm not currently using one, because I use a stage. Is that OK, or should i still be using one in conjunction with a stage somehow? And add all my actors to that?

sentences:
Error When Loading a .tmx TILED map through the TiledMap class So I made a map using the TILED application and I have it as a .tmx for reasons, but whenever I use the TildMap class in the Slick2D library to render the map on the screen, it gives me an error. Here are the files:

Class file:

public TiledMap testMap = null;

//TILE-READER
public static TileReader tileReader;

public Game (int stateID) {}

@Override
public int getID() {
    return Main.game; //GAMESTATE = 1
}

@Override
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
    worldMap = new Image ("res/in_game_map.png");
    player = new Player(playerX, playerY, mapX, mapY);
    tileReader = new TileReader();
    player.init(gameContainer, stateBasedGame);
    tileReader.init(gameContainer, stateBasedGame);

    testMap = new TiledMap("res/worldMap.tmx");
}

@Override
public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int delta) throws SlickException {
    player.update(gameContainer, stateBasedGame, delta);
    tileReader.update(gameContainer, stateBasedGame, delta);
}

@Override
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException {
    graphics.scale(1.05f, 1.05f);

    graphics.translate(player.camera.getCamX(), player.camera.getCamY());
    gameMap.draw(mapX - mapLength, mapY - mapWidth);
    testMap.render(0, 0);
    tileReader.render(gameContainer, stateBasedGame, graphics);
    player.render(gameContainer, stateBasedGame, graphics);
    graphics.translate(-player.camera.getCamX(), -player.camera.getCamY());

    if (inputHandler.keyMAP) {
        worldMap.draw(0, 0);
    }

    graphics.drawString("Player X: " + player.getxPos(), 400, 400);
    graphics.drawString("Player Y: " + player.getyPos(), 400, 415);
}

And here is the error message that it provided me:

  Caused by: org.newdawn.slick.SlickException: Unsupport tiled map type: base64,zlib (only gzip base64 supported)

Is there an issue with the way I formatted the .tmx file or is it that I am using the latest version of Tiled and that slick2D is no longer compatible with the newer version?

sentences:
Fade to first level, on click Good evening all, about to pull my hair out because I cant figure out why I keep getting this error. The problem is this, I need the player to click on the start button, then, the screen will fade to black and load level 1. (logic and code was provided by a Brackeys tutorial(https://www.youtube.com/watch?v=0HwZQt94uHQ), awesome guy)

here is the code for the button.

public void OnPointerClick(PointerEventData eventData)
{
    float fadetime = GameObject.Find("_GM").GetComponent<FadeScreen>().BeginFade(1);
    yield return new WaitForSeconds(fadetime);
    SceneManager.LoadScene("Level_01");
}

Now the error is highlighted with a red line under OnPointerClick just after "public void".

And the error is - The body of 'StartGame.OnPointerClick(PointerEventData)' cannot be an iterator block because 'void' is not an iterator interface type. Ive been googling for around four hours now and I'm coming up blank.(lack of sleep might be causing me to miss something)

Please can someone point out what I cannot see myself?
Also I do apologize if this has been asked before, I was not able to find anything on the subject.
Thank you kindly.

sentences:
How to draw a smoother solid-fill circle? I'm experimenting with drawing circles and have brute-forced a very simple one:

Pseduocode:

r=7
d=r*2

for y = 0 to d
  for x = 0 to d
    if (x-r)^2 + (y-r)^2 <= (r)^2
      plot(x+r, y+r, c)
    endif
  next
next

The principal is simple. Step through every point in a square and plot every point which lies within the area of the circle.

I end up with something like this:

I don't want the single-pixels that appear on on each side so I adjusted this line from:

if (x-r)^2 + (y-r)^2 <= (r)^2

to:

if (x-r)^2 + (y-r)^2 < (r)^2

I end up with a circle like this:

While this IS a circle, it's not quite the circle that I want. The edges are too sharp and don't slope in a convincing way. Instead, I want to draw something little smoother like this:

But I'm not sure how to "relax" the the pixels to achieve this.

The code I posted is meant to illustrate how I'm drawing the circle-- I'm not looking for optimizations. I'm only interested in tweaking it to manipulate the smoothness of the circle being drawn.

This is more than an adjustment for the last pixel along each side. I want something that scales with the size of the circle.

UPDATE

I experimented with the code provided by @user1118321 an found that I could manipulate which pixels were drawn along the edge by considering the distance of the point being plotted from the center of the circle.

This allows me to apply a threshold on the points at the very edge of the circle and to decide which ones I want to skip over.

The results vary depending on a few different factors and would benefit from fine-tuning with a table for an optimal threshold for very small circles to taste.

Here is one solution which provided me with the circle I was looking for:

for y = 0 to r*2
  for x = 0 to r*2
    deltaX = r - x
    deltaY = r - y
    distance = sqr(deltaX^2 + deltaY^2)

    // Point lies outside of the circle
    if distance-radius > 1
      continue
    endif

    // Edge threshold
    if radius/distance < 0.9
      continue
    endif

    plot(x, y)
  next
next

Here are some examples of various circles I was able to create:

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:
Camera stacking for first-person view weapon in Universal Render Pipeline I just added URP to my project then upgraded the materials to URP and now it's not rendering the environment anymore

I found the problem is that I have 2 cameras which are stacking on each other:  one with a priority of 1 and the other 0 . The camera that has higher priority is blocking the lower priority camera.
How can I fix that? I want to render the higher priority camera on top of the lower priority one.

sentences:
Why is a fully transparent pixel still rendered? I am trying to make a pixel shader that achieves an effect similar to this video http://www.youtube.com/watch?v=f1uZvurrhig&feature=related

My basic idea is render the scene to a temp render target then
Render the previously rendered image with a slight fade on to another temp render target
Draw the current scene on top of that
Draw the results on to a render target that persists between draws
Draw the results on to the screen

But I am having problems with the fading portion. If I have my pixel shader return a color with its A component set to 0, shouldn't that basically amount to drawing nothing? (Assuming that sprite batch blend mode is set to AlphaBlend)

To test this I have my pixel shader return a transparent red color. Instead of nothing being drawn, it draws a partially transparent red box.

I hope that my question makes sense, but if it doesnt please ask me to clarify

Here is the drawing code

    public override void Draw(GameTime gameTime)
    {
        GraphicsDevice.SamplerStates[1] = SamplerState.PointWrap;

        drawImageOnClearedRenderTarget(presentationTarget, tempRenderTarget, fadeEffect);
        drawImageOnRenderTarget(sceneRenderTarget, tempRenderTarget);
        drawImageOnClearedRenderTarget(tempRenderTarget, presentationTarget);

        GraphicsDevice.SetRenderTarget(null);

        drawImage(backgroundTexture);
        drawImage(presentationTarget);

        base.Draw(gameTime);
    }

    private void drawImage(Texture2D image, Effect effect = null)
    {
        spriteBatch.Begin(0, BlendState.AlphaBlend, SamplerState.PointWrap, null, null, effect);
        spriteBatch.Draw(image, new Rectangle(0, 0, width, height), Color.White);
        spriteBatch.End();
    }

    private void drawImageOnRenderTarget(Texture2D image, RenderTarget2D target, Effect effect = null)
    {
        GraphicsDevice.SetRenderTarget(target);
        drawImage(image, effect);
    }

    private void drawImageOnClearedRenderTarget(Texture2D image, RenderTarget2D target, Effect effect = null)
    {
        GraphicsDevice.SetRenderTarget(target);
        GraphicsDevice.Clear(Color.Transparent);
        drawImage(image, effect);
    }

Here is the fade pixel shader

sampler TextureSampler : register(s0);

float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 c = 0;
    c = tex2D(TextureSampler, texCoord);
    //c.a = clamp(c.a - 0.05, 0, 1);
    c.r = 1;
    c.g = 0;
    c.b = 0;
    c.a = 0;
    return c;
}

technique Fade
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

sentences:
Which app markets should I deploy my Android game to? I just launched my Android game today. I'm curious to know where I can deploy it. Of course, Google Play is the veritable king of markets, and my own game site will be next.

After that, which marketplaces are mature and are worth deploying to?

I looked at:

SlideMe
GetJar
Soc.io

And some other ones that I didn't use:

YAAM (kept crashing and erroring out)
1Mobile (couldn't figure out how to upload my app)
Insyde Market

My question is really, which ones are out there and are worth uploading too? (And 1Mobile seems good, but just can't figure out how to upload.)

Each site requires their own size screenshots and logo, so it's a bunch of extra work. I'd rather stick to the 80/20 rule and apply 20% effort to hit 80% of the markets.

sentences:
How to make a moving platform in Godot not be affected by collisions? I am trying to make a moving platform in Godot (for a 2D platform game, but I suspect the issue would be similar in 3D).
Basically, both my player and my platform are KinematicBody2D, and they move via the move_and_slide() method. The documentation says:

You can use this to make moving or rotating platforms, or to make nodes push other nodes.

This seems to fit my use case. However, when the player collides with the platform, the latter will be affected. For example, if the player stands on top of the platform, it will slowly start going down. I don't want that, I want the platform to move in a fixed fashion no matter what is throw at it (and if the player stands in the path of the platform for example, the player should be pushed).
How can I solve this? I was thinking about using a StaticBody2D for the platform, but the documentation says:

A StaticBody2D is a body that is not intended to move.

So I am not sure if this is the correct solution. It seems that the move_and_slide() method has some additional parameters, such as infinite_inertia, but the documentation is not very clear to me as to what they do exactly.

sentences:
How do I keep Text[] values alive and reuse in the script I'm building a bowling game in which I am trying to save the number of pins fallen on every turn to a UI text box, taken as an array (public Text[] Count). I'm able to get the first score in the text box, but unable to save it while switching to other scenes.

There are two scenes; one has the ball, pins and alley, and the other scene has the score card, which is displayed in additive mode. The UI text is a child of the canvas. I've used DontDestroyOnLoad for the canvas, but it doesn't work at all.
I'm actually trying to reuse these values to display the score in the series.

Below is the code

public GameObject rootCanvas;
    public Text[] Count;
    public static int counter=0;
    public static int i;
    public static int co = 0;

    MovingBall ball = new MovingBall();

    public void Start()
    {
        ball.countText = GameObject.FindWithTag("Counttext").GetComponent<Text>();

        for (i=co;i<=29;i++)
        {
            if (counter < 1)
                {
                    Count[i].text = ball.countText.text;
                }
                else if (counter == 1)
                {
                    Count[i].text = ball.countText.text;
                    Count[i+1].text = (Convert.ToInt16(Count[i-1].text) + Convert.ToInt16(Count[i].text)).ToString();
                }

            counter++;

            co++;

            DontDestroyOnLoad(gameObject.transform);

            return;

        }

    }

    void Awake()
    {

        rootCanvas = GetComponent<GameObject>();

    }

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:
How to ignore collision between two objects I have a player that shoots in the direction that it is facing. However, the shot that is created when I click, also destroys the player (example). How would I make the shot ignore collision with the player? Or better yet, how to make a shot destroy anything it touches and destroy itself without affecting the player?

This is the code that controls collisions:

function OnTriggerEnter (col : Collider) {
    Destroy(col.gameObject);
}

The shot is a trigger, but the player isn't. Not sure if this changes anything in this case.

sentences:
Is it only possible to display 64k vertices on the monitor with 16bit? I did the first 3D tutorial over at riemers.net and stumbled upon that my graphic card only supports Shader 2.0 (Reach profile in XNA) which means I can only use Int16 to store the indices (triangle to vertex).

This means that I can only store 2^16 = 65536 vertices. Also I read on the internet that you should prefer 16-bit over 32-bit because not all hardware (like mine) does support 32-bit.

Yet, I am wondering: Do really all game scenes get along with only so little vertices? I though already faces of people used a lot of polygons (which are made up of vertices?).

It’s not relevant for me yet, but I am interested:

Do game scenes use only 65536 vertices?
Do you use some trade-off to display more (e.g. 64k in GPU buffer rest on RAM)
Is there some method to get more into the GPU buffer? I already read on some other posts that there seems to be a limit of 64k per mesh too, so maybe you can compact stuff to meshes?

sentences:
Improving Click and Drag with C++ I'm currently using SFML 2.0 to develop a game in C++.  I have a game sprite class that has a click and drag method.  The method works, but there is a slight problem.  If the mouse moves too fast, the object the user selected can't keep up and is left behind in the spot where the mouse left its bounds.  I will share the class definition and the given function implementation.

Definition:

class codePeg
{
protected:
    FloatRect bounds;
    CircleShape circle;
    int xPos, yPos, xDiff, yDiff, once;
    int xBase, yBase;
    Vector2i mousePos;
    Vector2f circlePos;
public:
    void init(RenderWindow& Window);
    void draw(RenderWindow& Window);
    void drag(RenderWindow& Window);
    void setPegPosition(int x, int y);
    void setPegColor(Color pegColor);
    void mouseOver(RenderWindow& Window);
    friend int isPegSelected(void);
};

Implementation of the "drag" function:

void codePeg::drag(RenderWindow& Window)
{
mousePos = Mouse::getPosition(Window);
circlePos = circle.getPosition();

if(Mouse::isButtonPressed(Mouse::Left))
{
    if(mousePos.x > xPos && mousePos.y > yPos
        && mousePos.x - bounds.width < xPos && mousePos.y - bounds.height < yPos)
    {
        if(once)
        {
            xDiff = mousePos.x - circlePos.x;
            yDiff = mousePos.y - circlePos.y;
            once = 0;
        }
        xPos = mousePos.x - xDiff;
        yPos = mousePos.y - yDiff;
        circle.setPosition(xPos, yPos);
    }
}
else
{
    once = 1;
    xPos = xBase;
    yPos = yBase;
    xDiff = 0;
    yDiff = 0;
    circle.setPosition(xBase, yBase);
}
Window.draw(circle);
}

Like I said, the function works, but to me, the code is very ugly and I think it could be improved and could be more efficient.  The only thing I can think of as to why the object cannot keep up with the mouse is that there are too many function calls and/or checks.  The user does not really have to move the mouse "fast" for it to happen, I would say at an average pace the object is left behind.  How can I improve the code so that the object remains with the mouse when it is selected?

Any help improving this code or giving advice is greatly appreciated.

sentences:
High poly vs Low Poly when creating model I am new in game development, but I have some knowledge in Maya and 3ds Max, I want to create pirate ship for game. So I spoke with many 3d artists and there are different opinions about low polygons and high polygons modelling. I am an iOS developer too so I know that it's hard for computer to process many polygons, so we should reduce amount of faces as much as we can. But my question is much more connected to 3D.

Do I need to create low polygons model at start and then smooth it to increase amount of faces or do I need to create high polygons model and then reduce amount of edges, faces and etc?

sentences: How does the GPU know how to form triangles for a given mesh? I have just begun learning shader programing. What I learned is that the rasteriser groups three vertices to form a triangle for doing further operations. If that's true how does the rasteriser determines appropriate vertices which form a triangle in the mesh/geometry?  Is it the 3D software which saves geometry in the proper order in model file like .3ds or .obj, .x or is it the GPU which internally triangulates the geometry irrespective of the order the vertices are passed?

sentences:
What are the different ways to balance an online multiplayer game where user spend different amounts of time online? Let's consider a game where every player is building his own medieval town. To make this question simple, let's assume that, on this persistent world, some people will play an hour every day (heavy players), and others will spend an hour per week (light players).

To keep the game fair, a gamer with a lot of free time shouldn't be able to grow much faster than a less present gamer just because he connects more often to the game.

So the first idea is to have a sort of time-based budget: You are saving "action points" as the time is passing. When you connect, you are able to spend this "action points". This way, players are fairly treated...

I see 2 problems:

On one hand, heavy gamers should have the opportunity to play. As often that they want to...
On the other hand, light gamers will be able to connect and make a lot of "actions" in a really short range of "real time" (for instance without been "seen" as the heavy players are..)

So my question is:

What are the solutions that allows light and heavy players to play flairly and balanced regardless of free time to play?

sentences:
Unity WebGL Canvas only loads on select machines https://herbertjoseph.com

There is a WebGL build in the background of this site, and it doesn't seem to laod on my iPad. I've asked a few people to visit and check it out, and some have said that the scene doesn't load on their workstations either...

I've checked the console of the builds, and found no egregious errors. Most browsers, even mobile, support webgl now...

How can I ensure it'll work across most/all devices?

sentences:
Where do I find the code for the open-source game Warmux? I found an open source game called Warmux but I don't know how to get the code.  I downloaded the file from here, but I don't know where to go from there.  I didn't find any instructions on how to use the source.
While I was looking for it, I came across something called git and repo. Do I use that?

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:
Integer vs String for "type" data in data-driven games I've been developing a few mobile games, in which those games fetch their data from a server-database.

I'm used to storing "type" values as an integer identifier, and an enum in the client to identify the data coming from the server.

I'm under the impression that games like MMOs or PC games that get patches model their data to identify "types" as integers.

As an example: On the database table:

Monsters Table: MonsterId(int), Name(string), MonsterType(int)

On the client-sided code:

typedef enum {
    MonsterTypeGround = 1,
    MonsterTypeAquatic = 2,
    MonsterTypeAmphibious = 3,
    MonsterTypeAerial = 4
}MonsterType;

Is there an objectively correct answer on what to use (int vs string) for these types of data?

Do I have the correct impression that MMO's usually use integers for this, or it highly depends on the developers as well?

sentences:
Reset Camera view - webgl I have camera rotating by dragging mouse.
 Im trying to add reset button that restart the scene to initial view.
 The rotating camera works as expected but I can't figure out how to reset it.
The scene rotating in weird directions, not as expected.

I have 2 vars - absX, absY which hold the overall change angle value from the init mode.

when reset applied:

mat4.rotate(getRotationCameraMat, degToRad(-absX/10), [0, 1, 0]);
mat4.rotate(getRotationCameraMat, degToRad(-absY/10), [1, 0, 0]);
absX=0;
absY=0;

apply the rotate:

mat4.multiply(mvMatrix, cameraRotationMat);

the camera code:

var mouseDown = false;
var prevMouseX = null;
var prevMouseY = null;

var cameraRotationMat = mat4.create();
mat4.identity(cameraRotationMat);

function handleMouseDown(event){
    mouseDown = true;
    prevMouseX = event.clientX;
    prevMouseY = event.clientY;
}

function handleMouseUp(event){
    mouseDown = false;
}
var absX=0;
var absY=0;

function handleMouseMove(event){
    if (!mouseDown){
        return;
    }

    var currentX = event.clientX;
    var currentY = event.clientY;
    var deltaX = currentX - prevMouseX;
    absX+=deltaX;
    var newRotationMatrix = mat4.create();

    mat4.identity(newRotationMatrix);
    mat4.rotate(newRotationMatrix, degToRad(deltaX/10), [0, 1, 0]);

    var deltaY = currentY-prevMouseY;
    absY+=deltaY;
    mat4.rotate(newRotationMatrix, degToRad(deltaY/10), [1, 0, 0]);

    mat4.multiply(newRotationMatrix, cameraRotationMat,cameraRotationMat);

    prevMouseX = currentX;
    prevMouseY = currentY;

}

sentences:
Should SIMD be used by people who are new to game development? I have been learning game development, using C++ and OpenGL, for about 4-5 months. Before that I used to program in C# and the .NET platform(about a year). So, I consider myself new to game engineering and software development as whole.

Recently I read about SIMD math. I found it interesting and started wondering if it was good to use it in my math library. But, considering that I have so much to learn and I haven't even laid the foundations of my knowledge of game development, should I explore it in depth and start using it? Or should I wait until I really start to need it?

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 do I make bullets in a list intersect with bullets from another list, when both lists are not in the same class? I have the initial "Game1" class, with a "Ship" class initiated inside, and within the "Ship" class there's a List, where the "Bullet" class is used.

How can I make a bullet in a list from one of the ship classes intersect with a bullet from the other ship's bullet list?

Do I have to make a list of Rectangles too for their hitboxes?

sentences:
Programmatically generated mesh vertex colors not showing up in Unity? I'm sorry if this is an obvious thing to solve but I just can't figure it out...did I miss something...I've generated a mesh and during vertices generation I've also set its colors (and colors32 just in case) by reading those values from a ply file, and afterwards I've added a number of vertex color shaders but none of them will show the vertex point colors in play mode, it's either solid black or just like I added no material to the mesh (which I've tried doing manually in play mode too).

Did I miss something please?

sentences:
Texture size and scaling, 2D, for OpenGl ES 1.0/1.1 I read everywhere that you have to use a power of two
size for your texture width and height, like 16, 32 or 64,
but right now my sprite drawing is based on Grid.java from
SpriteMethodTest, and I set the Vertex array "quad" to the pixel
size, 20 X 28, and and apply the texture, the same pixel size, to that,
and I'm not using any scaling information, and it's drawing them fine
and I don't seem to be getting any errors.

Is it actually scaling it behind the scenes?

When I process each Bitmap I use:

gl.glBindTexture(GL10.GL_TEXTURE_2D, iTextureName);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,    GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);

gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);

So if I start doing sprite batching instead, the image I grab
out of the bigger image has to be a power of two width
and height, if I want it drawn without any scaling?

Thanks!

sentences:
Pygame circular cropping/masks I have been going through the documentation and the Pygame functions and classes today, but couldn't find a reasonable way to either create a circular crop of an image or how to use a mask to perform this: assume an empty circle with a line width of 50px, with a single key color, that is supposed to be removed from surface A and then replaced with the contents of the same pixels on surface B (perhaps I'm mixing definitions here between Pygame's Mask and image editors' - such as Photoshop - masks).

I know surfarray can be used for the task (after a list of pixel coordinates is extracted from surface B), but my tests were too slow and ended up hanging the main loop.

Is there a way to achieve the described above through an efficient and quick method, that can be embedded into the main loop of the application without a significant drawback to the overall processing?

sentences:
Order array of points in counter clockwise I happened to see an answer to "Sort array of points in clockwise", could you please elaborate the 4th point of that answer:

sort points relative to their a value, using qsort for instance.

How do I do the above step?

I'm looking for an algorithm to sort list of points in counter-clockwise.

sentences:
D3D11 Multiple Render Targets I wanted to try rendering to multiple render targets as a first step to deferred shading, but I'm getting somewhat peculiar behavior where the contents of all render targets are the same as the first one.

So far all the render targets have the same format.

The relevant snippets from the shaders are:

//geometry rendering
struct PS_OUT {
    float4 diff : SV_TARGET0;
    float4 norm : SV_TARGET1;
    float4 spec : SV_TARGET2;
    float4 uv   : SV_TARGET3;
};

PS_OUT PS(PS_IN input)
{
    PS_OUT output;
    output.diff = mytexture.Sample(mysampler, input.uv);
    output.norm = input.normal;
    output.spec = float4(input.pos.xyz, 1);
    output.uv = float4(input.uv, 0, 1);
    return output;
}

//"compositing" with fullscreen quad
Texture2D diff;
Texture2D norm;
Texture2D spec;
Texture2D uv;
SamplerState mysampler;

PS_IN VS(VS_IN input)
{
    PS_IN output ;
    output.pos = float4(input.pos,1);
    output.uv = float4(input.uv, 1, 1);
    return output;
}

float4 PS(PS_IN input) : SV_TARGET
{
    float4 diffuse = diff.Sample(mysampler, input.uv.xy);
    float4 normal = norm.Sample(mysampler, input.uv.xy);
    float4 specular = spec.Sample(mysampler, input.uv.xy);
    float4 uvw = uv.Sample(mysampler, input.uv.xy);

    return normal;
}

Sorry for the long post.

Now, the weird part is, if I return any of the sampled colors alone, like for example the normal, the first G-Buffer "channel" gets drawn to the screen instead. (Even if the normal channel is the only one I sample).

However, if I return this instead: 0.0001*diffuse + 1.0*normal + 0.0001*specular + 0.0001*uvw then it does return the actual normal channel.

This 0.000*diffuse + 1.0*normal + 0.000*specular + 0.000*uvw however results in just the diffuse being drawn again.

There are no Info or Warning or Error messages from the debug layer, turning the debug layer off doesn't change anything either.

Could the HLSL compiler possibly be optimizing the Sample calls away since the result is not used, and then removing the texture objects alltogether since they are not sampled from?

PS, if you think seeing how I create and assign the render targets etc will help, I will add it. I just didn't want to make the post any longer.

sentences:
How can I solve the jerky images when camera positions were calculated and sent from another computer? I'm working on a simulator project. Computer A which uses a stick as a controller to produce operation data and calculate simulate data which will be sent to computer B as camera positions to render the 3D scene. They both run on 60FPS averagely.

The problem is that I found that the frame time cannot be 16.66ms strictly which produces the jerky images. For example, computer A sends the camera position at 15ms (which is means where the camera should be at 15ms). Then computer B receives the data successfully and start to render that frame, but the render time is 18ms (not because the render was too slow I use vSync to limit the FPS but it cannot be strict for every frame). Then the image was swapped at 18ms which should be swapped at 15ms. More importantly, the frame time float around 15ms-18ms, although the average FPS was 60.

Now I'm using interpolation to solve this problem. It has great help, but cannot fix this problem perfectly. Is there a better solution? Thank you for helping me out.

This is part of my code about interpolation.

long long nowTime = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
long long time = firstReceiveTime + nowTime - firstRenderTime;

CameraParamterNode* current = head;
while ((current->next->next != nullptr) && current->next->data->frameTime < time)
{
    current = current->next;
}

double diff = static_cast<double>(time - current->data->frameTime) / (current->next->data->frameTime - current->data->frameTime);

pos = (current->next->data->pos - current->data->pos) * diff + current->data->pos;
dir = (current->next->data->dir - current->data->dir) * diff + current->data->dir;
up = (current->next->data->up - current->data->up) * diff + current->data->up;

sentences:
Sometimes can't use the rendered mesh as a collider in Unity? Most of the times I can use the Mesh Filter's mesh as collider in Mesh Collider

But sometimes there is just nothing. No collider. Why?

I used this free asset: https://assetstore.unity.com/packages/3d/environments/fantasy/green-forest-22762

sentences: What are the restrictions of 3g online games I am looking into make a 3g online multiplayer game for the iphone. Multiplayer is my main focus but I have noticed all game apps require wi-fi. Dose anyone know if this is simply an issue with the speed of the 3g network or dose apple put restrictions on their 3g network that prevents developers from doing this?

sentences:
UDK Fixed AIController / Pawn Height [I already asked this question on the UDK forums, without much success though.]

I'm using a class derived from AIController to control my pawn in RTS-style. My problem is that the pawn does not have a fixed Location.Z so if his Velocity in X and Y direction changes the Velocity.Z also changes (for whatever reason). I have tried nulling the Velocity.Z in the tick method, using Move to move the character back to a constant height and some other things of which nothing had worked. How can I solve this?

sentences:
How to implement Boids steering efficiently? (ie. find nearest neighbours of moving entities) As I understand it, modern pathfinding uses ideas such as Boids steering on top of traditional A* and Dijkstra's algorithm.

It's easy to find recommendations for implementing Dijkstra's algorithm efficiently in say C++. That is I can find out what are the typical data structures to use.

With Boids steering I cannot find anything that definitively says what is the recommended way to go. You have these moving units and you need to be able to find for each unit all the nearby units to apply steering or whatever else.

What kind of data structure can I use to perform these nearest neighbour queries efficiently?

sentences:
2D Tile Engine Architecture I'm been working on a 2D tile game (sidescroller perspective) and I decided to rework my tile engine. Right now I store a new tile instance per block in the world (so there are like 1000 TileStone instances in memory). My plan was to change the current tile engine so that I store only a small object which tells the renderer a stone tile should be drawn there. The TileStone, TileDirt classes only store the block properties like hardness, texture and so on.

With this design I ran into a bit of a problem, some tiles, for example, a chest tile should be able to store custom data like the contents of the chest, or for instance a windmill block which needs to update all of its logic every update tick.

What would be a good way of implementing a tile engine, that meets these requirements?

Programming language: Java, Library: LibGDX

Thanks in advance
-ProRed

sentences: Are environments built in external applications or in Unity? Totally new to game development here– I know models are never built in Unity, but what about environments? Is it common to say, build an office building environment with hallways and doors (sans furniture and props) in Blender and import that into Unity and assemble the scene there?

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:
Lua or C++ in Cococ2d-x I am going to use Cocos2d-x to make a game for Android and ios, but my question is, do I use the Lua integration or only c++, I see Lua useful here because the compilation thing.

Or do I use only Lua for the configuration, save data and things in runtime?

I don´t know if using Lua for the whole game is the right thing :/

Can anyone help me with this question and why use it or not?

Thanks

sentences: Calculate Jump Limits My question is in a similar vein to this question, I am creating a pre-mapped pathfinding solution much akin to how Ash Blue was for my 2D platformer-style game (in XNA). As part of the process, I have to be able to 'neighbor' nodes in the pathfinding algorithm. To be able to do this, I need a procedural manner to precalculate the maximum capabilities of motion from a given game object at a given location. I am having a difficult time with one specific aspect of this: I cannot, for the life of me, figure out how to test whether or not a game object will be able to successfully jump to a given platform from where they are standing. I know there's a way to express this in some manner of equation, but I cannot find what the proper equation would be, it's probably in the vein of projectile physics, but the answer eludes me. If anybody can shed some insight into the matter, I would be very grateful.

sentences:
UE4 Crashes when editing migrated Nvidia Flex emmiter? I'm new to Nvidia Flex, and I've been trying to migrate the TestPackages (the folder with the pre-made emmiters and soft/rigid bodies,) over to my project. I've only been migrating the TestPackages folder and nothing else. Then, when I try to edit one of the fluid emmiters (flexTestEmmiter.uasset), UE4 completely crashed and gives me a crash log which I've put below. Please help, I'm not sure what to do. And if you can, an in-depth explanation would be lovely, as I'm not very familiar with C++ or UE4 in general. Thank you! :)
https://pastebin.com/H9fSrFhV

sentences:
Per-component Shader Blend in Unity Context :
I'm writing a 2D mobile game in Unity where the graphics are essentially black lines drawn on a background image plus some lighting. Running full RGB calculations for every step seems like a waste of processing power. What I'd like to do is render everything in [grey, alpha] and then multiply by the sRGB background image in a separate shader at the end. Actually, ideally, I'd like basically to specify custom components like [grey, highlight, additive, alpha], each of which can be ignored in a given pass, and then do a custom operation with those when I apply the background image, like ceil(src*(dst.r + dst.g)) + half4(dst.b). I can figure out how to do that between 2 textures within a shader, but not between texture and screen (a.k.a. src & dst).
Question :
Basically, is there a way of writing a per-component replacement of the built-in Blend functions? Because something like Blend SrcAlpha OneMinusSrcAlpha only works with the full float4 or half4 vectors.
Or do I need to grab the screen like a texture and handle it within a pass block, and then do Blend Off or Blend One Zero? Or do something with RenderTextures perhaps? My intuition suggests that that would undo some of the efficiency I'd gained in previous steps, though...?

sentences:
Where can I find 3d models of equipment for supermarket? Where can I find 3d models of equipment  for supermarket? I will use them in XNA.

UPD. I need equipment like this http://www.the3dstudio.com/product_details.aspx?id_product=419747 without products.

sentences:
How can I manually draw a Sprite in Unity? I'm creating a simple workaround on the unsupported prefab-on-prefab.

I've thus created this simple class:

[ExecuteInEditMode]
public class PrefabLinker : MonoBehaviour
{
    public GameObject prefab;

    private GameObject spawn;

    void Awake ()
    {
        #if UNITY_EDITOR
        if (!EditorApplication.isPlaying)
            return;
        #endif

        spawn=(GameObject)Instantiate(prefab);
        spawn.transform.parent=transform.parent;
        spawn.transform.localPosition=transform.localPosition;
    }

    #if UNITY_EDITOR
    void Update ()
    {
        if (EditorApplication.isPlaying)
            return;

        // Manually draw the Sprite

    }
    #endif
}

However I've no clue on how to manually draw the Sprite, without adding it to the scene.
Obviously I can't add it to the scene like I do when I play it, because otherwise the spawn would be saved in the prefab, polluting it and creating a mess.

I'm hesitant to add the spawn to the scene "somewhere else" and updating its position, because I'd like to prevent the level designers from mistakenly move this spawn instead of the PrefabLinker object.

This only needs to work with 2D stuff. I've found this link which I guess does something similar to my needs, but I've no idea how to fix it to work with sprites (and doesn't work out of the box).

sentences:
Collision resolution when moving in two directions I am making a bomberman clone and I'm having problems regarding moving on both x and y axis (pressing down+left, down+right, up+left). Here is a video to demonstrate the problem. I use Tiled for the map. Below is the code:

private void checkCollision(float delta) {
    player.getVelocity().scl(delta); // dont mind
    Vector2 position = player.getPosition();

    if(player.isMovingRight()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {
            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap right");
                player.setPosition(tile.x - player.getWidth() , player.getPosition().y);
            }
        }
    }
    if(player.isMovingLeft()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1),  (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {
            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap left");
                player.setPosition(tile.x + tile.width, player.getPosition().y);
            }
        }
    }

    if(player.isMovingUp()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE));
        for (Rectangle tile : tiles) {
            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap up");
                player.setPosition(player.getPosition().x, tile.y + tile.height);
            }
        }
    }
    if(player.isMovingDown()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE + 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {
            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap down");
                player.setPosition(player.getPosition().x, tile.y - player.getHeight());
            }
        }
    }

    player.getVelocity().scl(1/delta);

}

private Array<Rectangle> getTiles(int startX, int startY, int endX, int endY) {
    TiledMapTileLayer layer = (TiledMapTileLayer)level.getMap().getLayers().get(1);
    Array<Rectangle> rectangles = new Array<Rectangle>();
    for (int x = startX; x <= endX; x++) {
        for (int y = startY; y <= endY; y++) {
            Cell cell = layer.getCell(x, y);
            if(cell != null) {
                Rectangle rect = new Rectangle(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE);
                rectangles.add(rect);
            }
        }
    }
    return rectangles;
}

To reproduce the problem shown in the video: Try to collide (coming from up) with one of the blocks that is not on the sides, press both down and left. Try again but press down and right. For the third one, make sure you are colliding with the top wall by pressing up then press left (both are pressed). It can also be done on the bottom wall by pressing down and left.

sentences:
How do you approach resolution independence in raster based graphics content? Those games that are not fortunate enough to run on a locked platform spec, like handhelds, need to run across various resolution formats and aspect ratios.

In a 3D game you might have a HUD or menu GUI based on raster graphics, and in a 2D game you might have a bunch of quads which are vessels for sprites.

So my question is, how do you approach designing and operating content across various resolutions and aspect ratio? Let's assume you have a sprite character that is 300x400 pixels sprite and surrounded by a level made of tiles. On different resolutions/aspect ratios you'd see a different FOV altogether. Or if you have a HUD or a GUI menu, you'd want to keep some stuff at same positions and of same size relative to the screen. Yet, graphics source is raster bitmaps, not vector.

Obviously, problem has been addressed numerous times. I'm interested to hear abut various approaches that worked for you so far. Do you keep an arbitrary dimension agnostic 'pixel' unit that you magically transform into needed dimensions via formula based on res and aspect ratio or other approaches?

edit:

So, conclusion is to enumerate your aspect ratios. Lowest combination of aspect:resolution is the one you design important stuff into. A safe area if you will. Same aspect ratios, but higher resolutions are simple scaling issues. Art content is designed for highest resolution. Larger aspect ratios simply show more of level/FOV with information presented which is not critical as is the one in safe area. Something like in this image I made.

sentences:
How can I read a value from a file accessed via the Internet? I have made text file and I put it on Dropbox, I have in this text file a value. From my code, I want to check if this value is 1.

I have tried this code, inspired by the Unity example, but it looks like I'm not able to reach the file.

void Start()
{
    StartCoroutine(GetText());
}

IEnumerator GetText()
{

    UnityWebRequest www = UnityWebRequest.Get("https://www.dropbox.com/s/6jkhtnpskzsi5pj/TestTXT.txt?dl=0");
    yield return www.SendWebRequest();

    if (www.isNetworkError || www.isHttpError)
    {
        Debug.Log(www.error);
    }
    else
    {
        // Show results as text
        Debug.Log(www.downloadHandler.text);
        // Or retrieve results as binary data
        byte[] results = www.downloadHandler.data;
    }
}

sentences:
Math for Game Developers Possible Duplicate:
  What math should all game programmers know?

How many need know(learn) Math for Game Developer? for 2D and 3D games?
And where best learn Math for game development? in Wikipedia or maybe Books?

Thanks for answers.

sentences:
Networking with UDP, should I keep sockets open on the server I am working on making a 2D platforming game that will have multiplayer functionality. Over the last few days, I have done a lot of reading regarding how to deal with the networking, and believe that I am on the way to implementing some of the concepts I have read about.

I have decided to go with an Authoritative server/client model, where multiple clients will send actions made by the user to the server, client will predict the players next steps before comparing against the Authoritative reply from the server, etc. This seems to have been suggested in numerous corners of the web regarding games networking, and seems reasonable.

Before jumping straight into trying to get snapshots sent from the server, I wanted to make sure that I had an idea of some of the technical nuances of a language, as conceptual knowledge can only get me so far. I have set up a simple Echo Server that has worked rather well for a single client, but now my next step is to have multiple clients connected to the server at a single moment, and have each message that is sent from a client echoed to all clients connected to the server.

I feel that the answer might be language dependent, so I will mention now that currently I am using Java for the networking (a little bit of preliminary testing may suggest that Java has significant overhead in its network implementation, so I am open to change upon suggestion). I am using UDP for speed sake (and this seems to be what is predominantly suggested).

My question is with the server, should I be keeping each DatagramSocket that represents a connected client open and send DatagramPackets directly out without ever closing them (until the program terminates, client disconnects, etc.), and have them stored in some form of Collection, or should I close them after each message is sent and create a new outgoing socket whenever I need to send a packet? There are obvious performance disadvantages of creating a  socket whenever I need to send a message, but is there some fundamental reason that I have not come across that suggests leaving sockets open is not a good idea?

sentences:
Tweening in 2d side-scrolling RPG I'm working on a 2d side-scrolling RPG-ish game. Currently the movement of the main character(hero) is based on the A and D keys, because it's 2d and I don't really care about jumping. I would like to change it to a mouse oriented system.
   Something like this: if the hero is at position 100(x-axis) and I click at x=200, it would move(tween/ease) to 200px with 50px/s.
   PS: I'm using java with libgdx.

sentences:
how are the vertex properties of meshpart decided based on model format in xna Exactly how the question says , how does the vertex properties like vertex stride and the data stored in the mesh part decided based on the format of a model and how would i determine that and then decide which vertexdeclaration to be used properly

For ex - a .obj model might or might not have vt data , vn data based on which it may have a different data in the meshpart .
How would i go about deciding which vertex declaration to use to properly decode the data in that mesh's vertex buffer

sentences: How to convert game object world position to hex grid cell coordinates? I have a hex grid and a game object, let's say it's the player. What I want to do is know on which cell the player is on based on his world position, this would be easy on a simple grid but on a hex grid it's giving me a headache.

sentences:
Why am I unable to move a player that extends image? I wanted to create a simple game where I will be able to move a player image horizontally. I am using Screens (at least trying to do so) and created the below:

public class GameScreen implements Screen {

    private JumpingKitten jumpingKitten;
    private Stage stage;
    private OrthographicCamera camera;
    private SpriteBatch spriteBatch;
    private Player player;

public GameScreen(JumpingKitten jumpingKitten) {
    this.jumpingKitten = jumpingKitten;
    this.createCamera();
    this.stage = new Stage(new StretchViewport(1026.0f, 768.0f, this.camera));
    this.spriteBatch = new SpriteBatch();
    Gdx.input.setInputProcessor(this.stage);
    init();
}

private void init() {
    initPlayer();
}

private void initPlayer() {
    player = new Player();
    stage.addActor(player);
    stage.act();
}

private void createCamera() {
    this.camera = new OrthographicCamera();
    this.camera.setToOrtho(false, 1026.0f, 768.0f);
    this.camera.update();
}

@Override
public void render(float delta) {
    this.clearScreen();
    handleInput();
    this.camera.update();
    this.spriteBatch.setProjectionMatrix(this.camera.combined);

    spriteBatch.begin();
    stage.draw();
    spriteBatch.end();
}

private void clearScreen() {
    Gdx.gl.glClearColor(0.15F, 0.15F, 0.3F, 1.0F);
    Gdx.gl.glClear(16384);
}

private void handleInput() {
    if(Gdx.input.isKeyPressed(Input.Keys.A)) {
        player.STARTING_X -= 50 * Gdx.graphics.getDeltaTime(); // STARTING X incorrect
        System.out.println("A is pressed"); // shown in console
    }
    if(Gdx.input.isKeyPressed(Input.Keys.D)) {
        player.STARTING_X += 50 * Gdx.graphics.getDeltaTime();
    }
}

And below is the player class:

public class Player extends Image {

private static final int PLAYER_WIDTH = 119;
private static final int PLAYER_HEIGHT = 136;

public static int STARTING_X = 100;
public static final int STARTING_Y = 100;

public Player() {
    super(new Texture("Cat_Idle_1.png"));

    this.setOrigin(100, 100);
    this.setSize(PLAYER_WIDTH, PLAYER_HEIGHT);

    this.setPosition(STARTING_X, STARTING_Y);

}

Even though I have completed some simple tutorials, I am unable to retrieve the x coordinate of the player object. This is stopping me from translating the player object along the x axis. Can someone explain what I am doing wrong, here? I honestly think that I jumped into something I shouldn't have.

sentences:
I'm having very negative thoughts, can you help me? I'm 27 years old and I recently started vocational studies for app development. The first year is mostly about introduction to c# programming and also a light introduction to html and javascript. I have never studied anything related to coding before.

I know how to make pixel art , music and sounds, but coding is just so difficult for me. My objective in life right now is to make a very simple game and I feel so frustrated because I can't achieve anything. I have even tried things like stencyl or construct 2 but even that kind of software I can't understand it enough to make a very simple game.

I'm breaking all the rules here, but, can you help me? I read about people that are like 2 months into coding and are already making games. Am I too dumb? Should I just quit altogether?

sentences:
Double buffer - Managing Collision I'm thinking about how I should manage collisions in my game. I'm thinking about having a "Collision" class that checks for collision, and in case takes actions to resolve them.

My problem is this:

A and B moving to the other, when they collide they must bounce.

If I resolve the collisions sequentially, like calling:

A.collideWith(B)
B.collidesWith(A)

B will be stuck, because A has already updated his velocity and position, and when will be called B.collideWith(A) there won't be any collision anymore.

So, is it a good idea to use a double buffer pattern?

I'll write the values obtained by the collision resolver in some variables, they will be swapped to the real ones when all the collision has been resolved. In that way all should work fine.

But it is a good software design?

EDIT

I see, yes of course i check only for half.
So there should be a class that checks for collisions, and should be like:

checkedpairs.clear();
for( Object a : objects )
{
    for( Object b : objects )
    {
        if( ! a.collideWith( b ) || checkedpairs.contains( a, b ) ) return;

        Object a1 = copyf( a );
        Object b1 = copyOf( b );

        a.collideWith( b1 );
        b.collideWith( a1 );

        checkedpairs.add( a, b );
    }
}

Instead of putting the logic for the swap in the objects themselves...

But that way, I'm creating two objects for each collision, isn't too much overhead?

The problem is that I don't need only the position, but al lot of physics stuff like velocity, acceleration, mass... Should I pass them? Isn't it too hard-coded?

sentences:
Math and physics, where to start? the only math I know how is to add the velocity to position. Thats it. i would like to know how to do more stuff, physics, collision detection with stuff other than perfect circles, etc.
But where ever I go online to find source to learn I always end up with something that assumes prior knowledge, which is understandable in a lot of cases. But I don't know where to go to learn math and physics from the absolute beginnings. Also I'm dyslexic, so sites or ressources with just definitions of concepts and no relatable examples wont help that much. So could someone give me some links to books and/or sites that can help me learn math and physics for game development.

sentences:
We are asked not to use "Set Native Size" it's been around 2.5 weeks since we were tasked to build a 2d mobile game. The game heavely uses canvas and we have lots of images. Our designer uses Figma to design the game and I export images from it.
If you have ever used Figma or Sketch, you may know that their mobile phone frame width and height is quite different than the physical device. For example, iPhone Pro Max frame in Figma has 896x414 but the physical device 2688×1242. So all the screens and the images in design is scaled down to look good in Figma's 896x414 frame.
Another important thing I think worth to mention is that we set our Canvas Scaler's reference resolution to 1920x1080 as shown in the image below.

So the thing is, there is also a guy, who is much more experienced in Unity, told us that we should export images from Figma with 2x scale. He says that images will look blurry if we export them in 1x.
On top of that, he told us not to use Image component's Set Native Size property, because the image has twice the size shown in Figma. Instead we should scale down the images ourselves MANUALLY with eye decision (not sure if that phrase exists).
So I am confused and not sure if that method is correct. What is a common practice in such situations? Do people not use Set Native Size? What would be a correct way of exporting images from Figma to a 1920x1080 canvas?
P.S. As I am new to Unity, I may not be able to explain the situation correctly, if there is some extra information you need, feel free to ask in the comments.

sentences:
How do you handle loss aversion in probability-based games? The psychological phenomenon of loss aversion refers to how players feel losses twice as powerfully as victories.

For example, Bite Fight's PvP is a simulation based on probabilities related on character skills, and players voice this feeling many times per week in the community forums.

If you don't want to create a pay-to-win game, but you do want to let the worst players win often enough to feel good about it, how can you do that?

The question has two parts:

How do you handle it technically? Do you use some kind of math techniques or a memory based simulation to avoid many loses in the row for a certain player?
How do you handle it from the community point of view? What do you do about complaints like this on public forums?

sentences:
Touch Gesture Map Movement I really dig the way that the map is moved in Clash of Clans (https://itunes.apple.com/ca/app/clash-of-clans/id529479190?mt=8)...

I can recognize the pinch and finger movement needed for the zooming and the swiping around the map, what I'm looking for is a tutorial in any language that reveals how to test for the map going out of bounds when moved or scaled.

My google fu has failed so far on this one, any hints?

Right now I can perform the scale operations and the movement operations, but I can't figure out how to stop the map from going out of bounds when pinched or scaled.  My code is a crazy mess and makes me think I'm missing the fundamental logic of how this is done.

(I am using Starling with AIR, but a tutorial in any language if you have a link).

Update: this is what I'm basing what I have currently so far:
https://github.com/PrimaryFeather/Starling-Framework/blob/master/samples/demo/src/utils/TouchSheet.as

sentences: Flick Gesture in Unity3D Android I'm trying to create a football game where the user will make a flick gesture in order to kick the ball. I'm quite new to developing games in unity3d, I have successfully made a moving ball, added some rotation, gravity and some basic input (the ball follows the touch coordinates). How can I achieve the flick gesture?

sentences:
Conversation tree and question locking/unlocking I have been having issues with managing a conversation tree. I am using PAWN as a scripting language (I have no other options, unfortunately) and I use MySQL databases to store user and game data.

My current issue is storing game conversation trees using SQL. Currently, I have the following table:

TABLE NAME: dialogue
ID: global ID of conversation option
Prompt: question or sentence shown on player's screen
Answer: NPC's answer
[some other stuff related to conditions and mood checks, etc.]

Now, my problem is the following. Suppose I greet the NPC, this would be something like this:

ID: 1
Prompt: Hello there.
Answer: Hi, how's it going?

I want my conversation tree to progress after the player greets the NPC. This is not problematic, I simply use an additional SQL table for that:

TABLE NAME: dialoge_unlock_lock
ID: global ID of dialogue element
Unlocks: option this element unlocks
Locks: option this element locks.

My problem is the following: suppose I greeted the NPC, this would unlock 5 conversation options for the player to choose from (they would have IDs 2-6 for this NPC, and perhaps 241-245 for another NPC). I choose question #2, this would unlock question #8 and lock question #7.

How could I check what questions the player has locked in the current dialogue tree? In this example, I don't want the player to just see question #8, but I want him to see every question that is currently available to him (that is, questions 2-6 & 8).

I have been sitting on this for days and I can't figure out a way to do it. This pretty much sums up my attempts, any help would be greatly appreciated.

sentences:
When are oblique triangles used in game development? I'm working on a project that explains how trigonometry is used in video games, and I need to mention oblique triangles.
However, as far as I know, only right triangle diagrams are used in video games to perform calculations such as distance and angle.
Are right triangles always used, or are there some cases where oblique triangles are used, in which the Law of Sines and Law of Cosines are also used?

sentences:
I want to make a pause button on the scene I want to make a pause button on the scene. If I press the button it will show the guiTexture with a variety of buttons with each different script. So what steps should I take?
1. How do make it so if I press the pause button on a scene it will show guiTexture?

sentences:
Unity 5.x - Editor only constructor/initilization event I have three scripts:

Level - Represents a Tile Based level.

LevelEditor - Custom Editor for Level.

Tile - A non monobehaviour class for storing tile information.

Level contains an array of Tiles to be allocated with 'new'. To avoid putting 'If array != null' everywhere in the code, I want to initialize the array simply to a size of 0 before anything else is ran.

However, I do not want this initialization to happen at run time, just only for editing purposes.

Is there some event I can use that will run before Level.OnDrawGizmos(), and also not be part of runtime code? Or is LevelEditor.OnEnable() the best I can do, with some checks in Level.OnDrawGizmos()?

sentences:
Skydome and Ambient Intensity (Unity) I've made a custom skydome in my game. For all my lights I have set them to not affect the skydome. The only thing affecting the skydome is the ambient light.

For my game I have ambient intensity at 0.8, but this makes my skydome much darker than the original texture. What I want to do is to set the ambient intensity for the skydome to 1.0 and for all other objects to 0.8.

Is there any way I can say before drawing the skydome set ambient intensity to 1.0, and right after set it back to 0.8? Or is there perhaps a simpler solution? :)

sentences:
How to reposition a bouncing ball after it has passed through a surface I have a bouncing ball which can collide with lines of a random slope. The ball passes through the lines a bit and I need to set the ball back some distance from the line.

The ball (defined by position and radius) travels according to a speed vector (obtained by multiplying a direction vector by a magnitude) and I want to find the distance between the center and the line so I know how many pixels the ball passed through the line.

In the example the ball passed 10 pixels (radius - dist) after the line, I need to move the center of the ball 10 pixels in the opposite direction.

How can I those pixels between x and y so I can subtract them from the center coordinates?

Thanks

sentences: How to handle 2d avatar creation I am new to game design and i am creating a MMORPG that allows players to create 2d avatars that can be customized. If i had lets say a male character model (no equipment no armor). How would i handle body variation for this male model? If this has been answered please provide link. I know layering customizing for equipment and armor has but not morphing the character sprite itself.

sentences:
On changing a voxel, don't recombine everything again, only modify the changed parts? I'm working on a voxel based game, where destructible structures are made out of cubes. (Some of them has 3000 voxels)

I solved the framerate issues by combining them, but after making it able to handle multiple materials, calling the method causes a framerate drop.

And it's annoying during runtime, because currently it recombines the whole structure when a voxel is changed (changed material, destroyed voxel, etc).

One plan of mine is to decomposite the structures into smaller chunks, and only recombine the affected chunks instead of the whole structure.

This increases drawcalls, but decreases framerate drops. By finding a good chunk size and chunk "making" heuristic, it would work I think.

My other plan is to modify the combined mesh based on the affected voxels.

For example when a voxel is destroyed, find its vertices in the combined mesh, and remove them. Or change those faces' material, etc.
But I don't know how to do this.

The bottleneck of my mesh combining algorithm is this:

private static Mesh CombineMeshes(MeshFilter[] meshFilters, List<Material> materials)
{
    // Each material will have a mesh for it.
    var subMeshes = new List<Mesh>();
    foreach (var material in materials)
    {
        // Make a combiner for each (sub)mesh that is mapped to the right material.
        var combiners = new List<CombineInstance>();
        foreach (var meshFilter in meshFilters)
        {
            // The filter doesn't know what materials are involved, get the renderer.
            var renderer = meshFilter.GetComponent<MeshRenderer>();  // <-- (Easy optimization is possible here, give it a try!)

            // Let's see if their materials are the one we want right now.
            var sharedMaterials = renderer.sharedMaterials;
            for (int i = 0; i < sharedMaterials.Length; i++)
            {
                var sharedMaterial = sharedMaterials[i];
                if (sharedMaterial != material || sharedMaterial == null)
                    continue;
                // This submesh is the material we're looking for right now.
                CombineInstance ci = new CombineInstance();
                ci.mesh = meshFilter.sharedMesh;
                ci.subMeshIndex = 0; //With zero it works; with "i", every voxel in the structure will have every damagelayer.
                ci.transform = meshFilter.transform.localToWorldMatrix;
                combiners.Add(ci);
            }
        }
        // Flatten into a single mesh.
        var mesh = new Mesh();
        mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
        mesh.CombineMeshes(combiners.ToArray(), true);
        subMeshes.Add(mesh);
    }

    foreach (var meshFilter in meshFilters)
    {
        meshFilter.GetComponent<MeshRenderer>().enabled = false;
    }

    // The final mesh: combine all the material-specific meshes as independent submeshes.
    var finalCombiners = new List<CombineInstance>();
    foreach (var mesh in subMeshes)
    {
        CombineInstance ci = new CombineInstance();
        ci.mesh = mesh;
        ci.subMeshIndex = 0;
        ci.transform = Matrix4x4.identity;
        finalCombiners.Add(ci);
    }
    var finalMesh = new Mesh();
    finalMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
    finalMesh.CombineMeshes(finalCombiners.ToArray(), false);
    return finalMesh;
}

Could you recommend something? Thanks!

sentences:
How to detect matches in match-3 game? I am working on a match 3 game where the number of matched cells matters

  (if you match 3 then they just get removed, if you match exactly 4
  then something happens, and if you match more than 4 then something
  else happens)

Basically this image sums it up :

cells in the green frame should match and disappear, the ones in the red shouldn't.
Could anyone please help me out, am kinda stacked on how to tackle this.
Thank you

Edit
Thank you all for your help! flood-fill was the right thing to do, i made a good progress and faced a different problem, please check the new thread

sentences:
how to make coins explode out of monster in phaser? I am trying to make coins explode out of a monster when it is killed.
the explode would be similar to this example: http://phaser.io/examples/v2/particles/diamond-burst

I also want the coins to be clicked individually similar to this example:
http://phaser.io/examples/v2/groups/call-all-input

I am confused as to how to incorporate the two above examples together. Is emitting particles the way to go? I am also confused as to how to set each coin to have a different value depending on the monster.

Any help is appreciated.

sentences: Countdown Timer for Racing Game I want to make a countdown timer for my racing game such as "3... 2... 1... GO!" I'm using GLUT, OpenGL, and C++. I was wondering what the most appropriate method to handle this in C++. clock()? glutTimerFunc()? I plan on having 4 textured polygons that shrink and fade one after the other.

sentences:
How to compose a matrix to perform isometric (dimetric) projection of a world coordinate? I have a 2D unit vector containing a world coordinate (the player's direction), and I want to convert that to screen coordinates (classic isometric tiles).

I'm aware I can achieve this by rotating around the relevant axis but I want to see and understand how to do this using a purely matrix approach? Partly because I'm learning 'modern OpenGL' (v2+) and partly because I will want to use this same technique for other things so need a solid understanding and my math ability is a little lacking.

If needed my screen's coordinate system has it's origin at top left with +x & +y pointing right and down respectively. Also, my vertex positions are converted to the NDC range in my vertex shader if that's relevant.

Language is C++ with no supporting libraries.

sentences:
Platformer gravity where gravity is greater than tile size I am making a simple grid-tile-based platformer with basic physics.

I have 16px tiles, and after playing with gravity it seems that to get a nice quick Mario-like jump feel, the player ends up moving faster than 16px per second at the ground.

The problem is that they clip through the first layer of tiles before collisions being detected. Then when I move the player to the top of the colliding tile, they move to the bottom-most tile.

I have tried limiting their maximum velocity to be less than 16px but it does not look right.

Are there any standard approaches to solving this?  Thanks.

sentences:
Set Layer of UI Object being Dragged In my game, I have an inventory system with slots and images in those slots. The images are by default disabled, but when an item is added to the slot, the image component becomes enabled. I have implemented a very simple drag and drop system for moving objects around in the inventory using IBeginDragHandler, IDragHandler, and IEndDragHandler. As I am dragging an item from one slot to another, I want the item image to be rendered in front of the slots and the rest of the inventory. Currently, when dragging an item image, it renders behind the empty slots.

I don't want to use hierarchy order to organize the layers of these slots because moving items around is very dynamic and the hierarchy order of the slots changes seemingly randomly when I press play. Is there another way to ensure that the item image being dragged is "closer to the camera" or in front of the rest of the inventory? Thanks.

sentences:
Godot Procedural map, Need help to avoid overlapping areas I have piece of code that using a tile set, i can draw an area of what is going to be a small town/city.
The code seed_cities, make an X number of cities randomly on the map, whereas draw_city just paints the city over the screen.
My problem is that from time to time, 2 or more citites overlap in the map.
func seed_cities(num_cities):
    var initial_point
    var final_point
    for i in range(0, num_cities):
        initial_point = Vector2(int (rand_range(0, screen_size.x/10)), int (rand_range(0, screen_size.y/10)) )
        range_x = randi() % 10 + 5  # 5 being minium longitude
        range_y = randi() % 10 + 5  # 5 being minium longitude
        final_point = Vector2(range_x, range_y)
        var city_position = {
                initial_point: initial_point,
                final_point: final_point
        }
        cities.append(city_position)
        # TODO check if there is another city before
        draw_city(final_point,final_point)

now, i tried to use the function line_intersects_line_2d , but the appears an error saying that line_intersects_line_2d is not declared on the current class, so i have another method of checking if the cities overlap. i was thinking of using that or creating an area2D with code to check if there is a collision.
func draw_city(initial_point, final_point):
    for x in range(0,final_point.x):
         $Objects.set_cell(initial_point.x + x , initial_point.y,4)
         $Objects.set_cell(initial_point.x + x, initial_point.y + final_point.y,4)
    for y in range(0,final_point.y+1):
         $Objects.set_cell(initial_point.x, initial_point.y + y,4)
         $Objects.set_cell(initial_point.x + final_point.x, initial_point.y +y,4)

Any ideas on what i need to import to use line_intersects_line_2d?
What other way i can check if 2 cities overlap before saving it's position and draw them on the map?

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:
Adding spread to velocity Vector3D I am trying to give an object a velocity spread (e.g. shotgun bullets or particle effect).

//dir is the initial direction
float angle1 = atan(dir.x, dir.z) + spread;
float angle2 = atan(dir.y, abs(dir.z)) + spread;
vec3 xz_dir = vec3(sin(angle1, 0.0, cos(angle2));
vec3 yz_dir = vec3(0.0, sin(angle2), cos(angle2));
vec3 new_dir = vec3(xz_dir.x * yz_dir.z, yz_dir.y, xz_dir.z * yz_dir.z);
new_dir.normalize();

The new_dir spread works fine in the XY and YZ planes but if there is a Y component in the direction, the spread along the XY plane doesn't work.

sentences:
2D planetary system simulation- how to improve gravity model? How to control simulation speed? I'm making a simple planetary system simulator. I've run into some problems with physics model and simulation speed and I'd like to learn how to fix them.

My main class is Body:

public abstract class Body {

private double x, y; // position
private double w, h; // dimensions for drawing
private double vx = 0, vy = 0; //velocities along x, y axes
private double ax = 0, ay = 0; // accelerations along x, y axes
private double mass = 1;        //default = 1
private boolean stationary = false; //stationary body is centered during simulation

...
}

Then, in this class, the method I'm using to calculate the force of gravity. I decided to have another body as a parameter, so when I call the method it updates both of the bodies. If that's not the best way to do it, please tell me. I also know that using "this" inside a public method is not necessary, but it makes the code more clear for me.

public void interact(Body b2) {
    double x = calculateDistX(b2);
    double y = calculateDistY(b2);
    double r = calculateDistance(x, y);

    double f = (this.getMass() * b2.getMass()) / Math.pow(r, 2); // gravitational
                                                                    // force

    double fx = f * (x / r); // x component of the force - f times cosine of
                                // the angle
    double fy = f * (y / r); // x component of the force - f times sine of
                                // the angle

    /* calculate accelerations for both bodies, set vector orientation */
    if (b2.getX() > this.getX()) {
        this.setAx(fx / this.getMass());
        b2.setAx(-fx / b2.getMass());
    } else {
        this.setAx(-fx / this.getMass());
        b2.setAx(fx / b2.getMass());
    }

    if (b2.getY() > this.getY()) {
        this.setAy(fy / this.getMass());
        b2.setAy(-fy / b2.getMass());
    } else {
        this.setAy(-fy / this.getMass());
        b2.setAy(fy / b2.getMass());
    }

    /* calculate velocities for both bodies */
    this.setVx(this.getVx() + this.getAx());
    this.setVy(this.getVy() + this.getAy());

    b2.setVx(b2.getVx() + b2.getAx());
    b2.setVy(b2.getVy() + b2.getAy());

    /* calculate positions for both bodies */
    this.setX(this.getX() + this.getVx());
    this.setY(this.getY() + this.getVy());

    b2.setX(b2.getX() + b2.getVx());
    b2.setY(b2.getY() + b2.getVy());
}

Now, when I run the simulation it tends to blow up when bodies get too close. I will try to implement the Runge-Kutta or Verlet algorithm in the interact() method to change this, but how do I implement timestep? Should there be some timer that counts time and is used to calculate derivatives? Right now I'm using a Timer in my drawing method:

class DrawingPanel extends JPanel {
DrawingPanel() {
    int step = 15; // milliseconds
    ActionListener taskPerformer = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            repaint();
            }
    };
    new Timer(step, taskPerformer).start();
    Body b0 = new Star();
    addBody(b0);
    Body b1 = new Planet();
    addBody(b1);
    Body b2 = new Planet();
    addBody(b2);
}

List<Body> bodies = new ArrayList<>();

@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    bodies.get(2).interact(bodies.get(1));
    bodies.get(0).interact(bodies.get(1));
    bodies.get(0).interact(bodies.get(2));

    for (Body b : bodies) {
        f.draw(b);
    }
}
public void addBody(Body b) {
    bodies.add(b);
}
}

I feel like calling the interact() method in my paintComponent() method is not the right solution, but I don't know how to do it. Also, how to make the simulation slower? Right now changing the "step" to bigger value slows the simulation down, but it ends up being just low FPS, because it's just the separation between two drawing events. How should I implement the timer to control the simulation and preserve its smoothness?

sentences:
Unity sprites are no longer batched after the object rotates/moves With Unity 5 and access to the profiler, I'm running our game through some stress tests so I can find where our performance issues are.

While testing having 1024 units on the screen with 4 selection box corners each I ran into an odd problem. When I select all the units, 4096 selection box objects come into existence, my draw calls go from ~25 to 50 with 50 batches. Now when I tell the units to move, they rotate and the number of batches climbs up to 2090 and the draw calls climb to 2090 and stay there even after the units stop rotating or moving.

If I then reselect all the units, the selection boxes are destroyed and re-instantiated (I know, not the best way) and the batches and draw calls go back down to 50 from 2090.

What is causing this, and how would I go about fixing it?

After Selecting All Units

After having them rotate and move

After Re-selecting Them All

sentences:
Unity Mirror can't reflect another mirror across from it I created a mirror in Unity using the FX/MirrorReflection and the script that comes with it.
http://wiki.unity3d.com/index.php/MirrorReflection4

One mirror at a time works perfectly fine, but as soon as I add another mirror in front of the other mirror it starts bugging out.

See image below for the result I'm getting.

Does anyone know how to fix this so that both mirrors can reflect off each other?

sentences:
sample project that mix unityscript and c# I like the simplicity of unityscript, at same time I also like the plenty of c# library and open source projects.
I prefer to put my model/controller/logic flow in unityscript using standard unity3d sdk and invoke c# extension library.
Is there any sample project demonstrate how to mix the two scripts in one project?

Your comment welcome

sentences:
What is the rationale behind this method of computing the w-component from MD5 mesh files? In tutorials regarding the MD5Mesh format, like this one, we often see code like

float t = 1.0f - (q.x * q.x) - (q.y * q.y) - (q.z * q.z);

if (t < 0.0f) {
   q.w = 0.0f;
} else {
   q.w = -sqrt (t);
}

for computing the w-component of a unit quaternion given x, y, z.
Why do we obtain w in this manner?

sentences:
Center directional light shadow to the cameras eye I'm currently drawing my directional light shadow using this view and projection:

XMFLOAT3 dir((float)pitch, (float)yaw, (float)roll);
XMFLOAT3 center(0.0f, 0.0f, 0.0f);

XMVECTOR lightDir = XMLoadFloat3(&dir);
XMVECTOR lightPos = radius * lightDir;
XMVECTOR targetPos = XMLoadFloat3(&center);
XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);

XMMATRIX V = XMMatrixLookAtLH(lightPos, targetPos, up); // This is the view

// Transform bounding sphere to light space.
XMFLOAT3 sphereCenterLS;
XMStoreFloat3(&sphereCenterLS, XMVector3TransformCoord(targetPos, V));

// Ortho frustum in light space encloses scene.
float l = sphereCenterLS.x - radius;
float b = sphereCenterLS.y - radius;
float n = sphereCenterLS.z - radius;
float r = sphereCenterLS.x + radius;
float t = sphereCenterLS.y + radius;
float f = sphereCenterLS.z + radius;
XMMATRIX P = XMMatrixOrthographicOffCenterLH(l, r, b, t, n, f); // This is the projection

Which works prefect if the center of my scene is at 0.0, 0.0, 0.0. What I would like to do is move the center of the scene relative to the cameras position. How can I do that?

sentences:
How can I change a variable value in specific time duration according to animation clip time length? I will change my question with more details to make it more clear:

In the Assets I created Animator Controller and Animation: Named them both FPSController. FPSController is the object I want to animate it's rotation on the Z from 50 to 0:

Then I opened the Animator window and dragged the Animation into the Animator window:

Then I opened the Animation window and recorded the clip: The rotation on Z is going from 50 to 0 in 7 seconds. I'm rotating the FPSController on the Z from 50 to 0:

This is the Animation part and this is working fine. The FPSController(player) is starting when the Z rotation value is at 50 and slowly move to 0.

Now The game is start when the whole camera is blurry. For this I'm using Post Processing. Next step was to create a profile of the Post Processing called it CC and this profile I dragged in the Hierarchy to the FPSCamera:

In the FPSCamera I dragged to it a script name Post Processing Behaviour and then dragged to the script in the Inspector the CC profile: This way the Post Processing effects affecting the camera view:

So to make it clear: I'm rotating on the Z the FPSController by animation. And on the FPSCamera I'm using the Post Processing for making effects.

This is how the game start. This is the game view screenshot. The game start when everything is blurry and the FPSController(player) is rotating to the right by 50 degrees:

Now the part of the animation of rotating the FPSController by 50 is working fine. While it's rotating the FPSController I want slowly by the same time in this case 7 seconds to change the blurry effect and make the picture clear once the animation end. The property of the  Post Processing CC profile I need to change is the focalLength. By default I start it with the value of 300. And I need in 7 seconds to change it from 300 to 0.

This is the script I ended with so far:
The script is attached to the FPSCamera:

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

public class DOFControl : MonoBehaviour
{
    public PostProcessingProfile postProcProf;

    public Animator anim;
    private float clipLength;

    private void Start()
    {
        AnimationClip[] clips = anim.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        InvokeRepeating("incrementSpeed", 300, 0.1f);
    }

    void incrementSpeed()
    {
        var dof = postProcProf.depthOfField.settings;
        dof.focalLength -= 1f;
        postProcProf.depthOfField.settings = dof;
    }
}

I'm getting the animation clip time length 7 seconds. But the part with the InvokeRepeating is not working. I want to incrementSpeed the focalLength down from 300 to 0 by 7 seconds. Not sure if using InvokeRepeating is the right way at all.

sentences:
Prevent tile layout gaps I'm making a map viewer where you can specify where tiles go in a map and then see it on the screen, translate it, and zoom in and out.

Here's a picture showing the tiles used to make my example map

Here's the tiles connected together, more or less my desired result.

The problem is that at particular combinations of translations and zoom levels the spacing is off. Here's an example picture of the problem.

In order to arrange the tiles I'm using a Perspective projection matrix parametrized by the zoom level, a camera matrix which just translates the scene based the camera's 2d position, and finally each tile is translated using another matrix derived from its x and y position.

tile * camera * projection

How can I avoid this weird spacing issue at particular positions? I'm guessing this is some kind of floating point precision issue, but I'm not sure.

(for those interested, the tiles I'm using are from this collection)

EDIT:

I was using the following parameters for the standard openGL perspective projection matrix:

let near = 0.5;
let far = 1024.0;

let scale = zoom * near;
let top = scale;
let bottom = -top;
let right = aspect_ratio * scale;
let left = -right;

where aspect_ratio is the window width divided by the window height, (in pixels,) and zoom in the error case above was set to 8.0. I read some more on perspective projection and floating point errors but couldn't find anything sensible to change so I resorted to adjusting the parameters. Specifically I tried setting near to 1.0 and now I can't replicate the weird spacing. So I guess my problem is solved?

But this is a mysterious and unsatisfying answer, so I would still appreciate it if someone could explain what went wrong, and how I can avoid it in the future without fiddling with numbers until it "magically" works!

EDIT responding to amitp

Here's a screenshot from the same version as above (with near still set to 0.5), with the background set to red as suggested. This seems to indicate that it's something wrong with the tile layout, not image bleed.

sentences:
LibGDX how to change animations I have a Player Class and i have 3 different Animations for it. I can render them perfectly but i don't know how to change from one animation to another. For exmaple i have 3 animations, one for Running, one for Jumping and one for Rolling down. Now i want to to change from running animatioon to Jumping when user presses a button. Inpout is not the problem. I am using the same code at LibGDX wiki to create to sue animation just like in this link: https://github.com/libgdx/libgdx/wiki/2D-Animation

It would be very helpful if you could give an example too but its not necessary though.

sentences:
How to Implement ECS Archetypes in C#? I'm trying to figure out how to implement a simple ECS with an Archetype approach, similar to what Unity's ECS uses.
An archetype is just a category for entities that have a specific set of components.
Let's say I had three components, A, B, and C, and I had the following systems:

System 1 (Archetype requires component A)
System 2 (Archetype requires components A and B)
System 3 (Archetype requires components A and C)
System 4 (Archetype requires components A, B, and C)

Because components could be added and removed from entities on the fly, an entity switches archetypes whenever a component is added or removed.
I'm not quite sure what these archetype collections are supposed to look like. They must be arrays of some kind, but I'm not sure how to store and organize components in them that belong to a specific entity.
My question is, what would this look like in pure, vanilla C# code?
And could generics also help with this?

sentences:
How to calculate a quad based on a triangle pairs shared edge Based on two given triangles, I would like to calculate a quad that can be used as a 'fat' line for the edge between the triangles.

I have googled around and while it is very easy to draw lines in OpenGL or DirectX, the problem is that you can only guarantee a thickness of 1 pixel.

To overcome this I need to generate a quad for the line.

So given the below image...

I have a set of triangles, and I want to draw a line where the red dots are.
I know the start and end vectors for this line. And all the details of the triangles

I need to create a quad so that I can define the thickness (seen as the blue arrow)

An extra complication is that the triangles may not be on the same plane.

So from the side perspective, the 'line' would need to be created with its edge growing like this. Where both black lines are the sides of two separate tringles and the shared edge is from the point and moves into the screen.

All the calculation for this will be done offline

I am hoping that just a nudge in the right direction and I will be able to hammer this out on my own. (maybe)

OR if there is another way to solve the fat line problem then let me know.
I will be rendering this using OpenGL ES 1 (without a shader)

Thanks.

sentences: How can I convert screen space to GUI Space/View Space? Is there any way available to convert screen space into view space as like in the following figure:

sentences:
How can I call two functions in a sequence with onclick? I'm learning Unity.

I have two functions, one that transitions to a new scene and the other one is the button animation.

I add both functions to the onclick of a given button. I assume it calls both functions at the same time and executes the transition without running the animation.

I want the button to run the animation first (I'm using DOTWEEN) and once it's done to execute the transition.

sentences:
Draw line inwards in Unity using Line Renderer Is there a way to draw the line inwards instead of from the center using Line Renderer in Unity?

Another option would be to move the Vector points inwards by half the width of the line, but If I have a complex polygon how do I do it uniformly?

EDIT: Found this https://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons which may be useful

sentences:
When accessing components, is it better to do so in a script or to create a reference to them in the inspector? I am accessing the variable of one script from within another and I noticed there are multiple ways to do this, but two that are very similar.  The first is to simply find the game object and reference it within the other script like so:

void Start(){
    private int bye = 1;
    GameObject player = GameObject.Find("Meh");
    Test2 externalScript = player.GetComponent<Test2>();
    externalScript.hello *= bye;
    Debug.Log(externalScript.hello);
}

The other way is to create a global instance of the object the script is attached to and reference it within the inspector, like so:

private int bye = 1;
public GameObject player;
void Start(){
    Test2 externalScript = player.GetComponent<Test2>();
    externalScript.hello *= bye;
    Debug.Log(externalScript.hello);
}

Which way would be best in terms of performance and practice?  Would one way be better than the other when it comes to larger games and/or scripts?

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:
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:
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:
A*  Pathfinding Problems I'm trying to implement the a* pathfinding algorithm in my game. I've looked at dozens of tutorials but I can't seem to get it right. My code is below, and It's not working... does anybody see something I'm doing wrong?
Mainly, I followed these tutorials:
Tutorial 1
Tutorial 2

I'm sure you will be able to understand all of the classes/methods I've created. If you can look over this code and just tell me if it looks remotely correct that would be great.

public void highlightPath(Tile start, Tile end)
    {

        AStar astar = new AStar();

        Tile currentTile = start;
        Tile endTile = end;

        start.node.g = 0;
        start.node.h = astar.getHeuristic(start.getCoordinates(), endTile.getCoordinates());

        start.node.parent = null;//for the loop

        astar.openList.add(start);

        while(!astar.openList.isEmpty())
        {
            currentTile = astar.getTileWithLowestF();

            if(currentTile==endTile)
                break;

            astar.openList.remove(currentTile);
            astar.closedList.add(currentTile);

            AdjacentTiles adjacentTiles = getAdjacentTiles2(currentTile);

            //Assign G and H costs:
            adjacentTiles.aboveRight.node.g = 10 + currentTile.node.g;
            adjacentTiles.right.node.g = 14 + currentTile.node.g;
            adjacentTiles.belowRight.node.g = 10 + currentTile.node.g;
            adjacentTiles.below.node.g = 14 + currentTile.node.g;
            adjacentTiles.belowLeft.node.g = 10 + currentTile.node.g;
            adjacentTiles.left.node.g = 14 + currentTile.node.g;
            adjacentTiles.aboveLeft.node.g = 10 + currentTile.node.g;

            ArrayList<Tile> adjacentTilesList = new ArrayList<>();

            adjacentTilesList.add(adjacentTiles.aboveRight);
            adjacentTilesList.add(adjacentTiles.right);
            adjacentTilesList.add(adjacentTiles.aboveRight);
            adjacentTilesList.add(adjacentTiles.belowRight);
            adjacentTilesList.add(adjacentTiles.below);
            adjacentTilesList.add(adjacentTiles.belowLeft);
            adjacentTilesList.add(adjacentTiles.left);
            adjacentTilesList.add(adjacentTiles.aboveLeft);

            for(Tile t:adjacentTilesList)
            {
                t.node.h = astar.getHeuristic(t.getCoordinates(), endTile.getCoordinates());
            }

            for(Tile t:adjacentTilesList)
            {
               //Check traversability:
               if(t.exists == false)//Change this to test segments/elevation
                   continue;//skips everything below...

               if(astar.closedList.contains(t) && currentTile.node.g < t.node.g)
               {
                   t.node.g = currentTile.node.g;
                   t.node.parent = currentTile;
               }
               else if(astar.openList.contains(t) && currentTile.node.g < t.node.g)
               {
                   t.node.g = currentTile.node.g;
                   t.node.parent = currentTile;
               }
               else
               {
                   astar.openList.add(t);
               }

            }

        }

        Tile startingTile = start;
        Tile currentTile2 = endTile;
        ArrayList<Tile> path = new ArrayList<>();
        path.add(currentTile2);

        while(currentTile2 != start)
        {
            path.add(currentTile2.node.parent);
            currentTile2 = currentTile2.node.parent;
        }

        for(Tile t:path)
        {
            t.highlight();
        }

    }

sentences:
Smooth camera movement between followed objects I have 2d game where my camera follows the player. Simplified, it copies the player position as its own.

Now I have some other object in the game, that I want to camera to follow. This is easy enough by not setting the camera's position with the player's, but with the position of the other object.

The problem is that this camera movement is instant. I'd like to have a more smooth transition (e.g. panning over the level to the given object).

How can I achieve 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:
How does Half Life's covering work? Enemies in this game take cover. AFAIK HL uses some logical decisions for enemy to start searching for cover and to abandon cover, and I am able so far to find them; but how does he find a cover place?

I know HL has waypoints. I can only guess/speculate how they find cover point. They might search for nearest waypoint which has certain properties; I thought such node might have some "cover" tag but tutorials seem not to mention it; so maybe it is a node which is not visible by player AND offers attack possibility (crate or edge of wall).

Thank You. :)

sentences:
How should I update vectors, et cetera, in a time-based fashion? I'm trying to write something I believe is straightforward but wanted to check that I'm doing it right.

All I want is to update the position of a 2D sprite based an acceleration and velocity. I'm using time based modelling so I have time deltas at my disposal. My current approach looks a little like this:

int rotDuration = btnRight.GetDuration() - btnLeft.GetDuration();
ship.Facing += (ANGULAR_VELOCITY * (rotDuration)); //angular displacement (rads?)

Rise::Vector2D forwardDir(sin(ship.Facing), cos(ship.Facing));
Rise::Vector2D finalVelocity = ship.Velocity + (elapsedTime * btnAcc.GetDuration() * MAX_ACC * forwardDir);
ship.Position += finalVelocity;

Hopefully that's pretty straightforward. I get the duration that rotation was occurring for, then multiply this by the speed I wish to allow my ships to rotate. For the velocity, I applied the equation from here. I'm very unsure as to why it says to scale the whole thing by max acceleration, though...

Does this look correct and will it produce the sort of rotation you would expect? For context I'm simulating space- or ice-like inertia.

sentences:
Make Unity game using files directly from game directory For stats of enemies, and several other kinds of info, I've decided to use not inspector fields or hardcoded values, but to store values to some XML and other types of files, and read them from scripts, obtaining required values. And I want this files to stay in game folder, not packed to *.assets file, because I'd like to have possibility to quickly modify this values without need to rebuild whole game.

So, how can I mark asset in editor, that it should not be included to *.assets, but stay in unchanged form in game folder?

UPDATE: I will slightly rephrase what I want to achieve. I need possibility to have file in game directory, so I can read it from game, and I'd like to have this possibility in both editor and built game. So, as for answer, I will also receive information about what folder is considered as game folder in editor.

sentences:
Transforming normals along with vertex? (GLSL) So, I got a model matrix (Via uniform variable) in the shader, is there any way to use the model matrix to transform the normal of a vertex that has been transformed with glm::transform/rotate?

If you want, here is the code:

VERTEX SHADER:

#version 330 core

layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec3 vertexColor;
layout(location = 2) in vec2 vertexUV;
layout(location = 3) in vec3 vertexNormal;

out vec3 Normal;
out vec3 fragmentColor;
out vec3 vertPos;
out vec2 UV;

uniform mat4 MVP;

void main(){
    gl_Position =  MVP * vec4(vertexPosition_modelspace,1.0f);
    UV = vertexUV;
    fragmentColor = vertexColor;
    vertPos = vertexPosition_modelspace;
    Normal = vertexNormal;
}

FRAGMENT SHADER:

#version 330 core

in vec3 Normal;
in vec3 fragmentColor;
in vec3 vertPos;
in vec2 UV;

out vec3 color;

uniform sampler2D textureSampler;
uniform mat4 Model;

void main(){
    vec3 lightPos = vec3(1, 1, 1);
    mat3 normalMatrix = transpose(inverse(mat3(Model))); // I think this line could do it, but it doesn't seem to work.
    vec3 normal = normalize(normalMatrix * Normal);
    vec3 fragPosition = vec3(Model * vec4(vertPos, 1));
    vec3 surfaceToLight = lightPos - fragPosition;

    float brightness = dot(normal, surfaceToLight) / (length(surfaceToLight) * length(normal));
    brightness = clamp(brightness, 0.2, 1);

    color = vec3(brightness * 1 * (texture(textureSampler, UV).rgb * fragmentColor));

}

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:
Can steam features be used in a game bought on an alternate distribution platform? We're in the process of game development where we need to integrate with the Steamworks API for multiplayer matchmaking, achievements, player stats, etc. We also have a rudimentary implementation integrating with the Steam Workshop in order to distribute player-authored content.

However, I have a remit that the game should be publishable on other distribution platforms such as GOG.

If we were to distribute on an alternative platform such as GOG, is it acceptable to rely
on steam features? I presume this would mean the player
purchasing on GOG and being forced to install steam and set up a
steam account before playing. (I'm also aware that GOG are very much
anti-DRM which might entail a separate build version too, if even possible).
If not acceptable, what's the alternative? Are developers expected to employ platform-specific or a proprietary network system for multiplayer matchmaking for instance? How is this achieved in other games?

sentences:
90% CPU on Profile Editor: Throttle mainMessageLoop I have a big problem in my Unity game, in almost every scène of my game, my editor is laggy, when I record Porfile Editor / deep profile editor, here is the result:

I have no idea what is this throttle MainMessageLoop, what can I do ?
Thanks you !

sentences:
How can I draw a specific GameObject into a texture in Unity? I need to draw only a few specific objects into a texture (with their material) and then use that RenderTexture as a texture for an another object. I think Graphics.DrawMesh() and Graphics.SetRenderTarget() would be helpful, but I'm not sure.

Ultimately I'm trying to create refractive water, which will refract only specified GameObjects, not layers. How can I do this?

sentences:
Name of this technique used in games such as Minecraft or the sims In Minecraft, there are some blocks which are a little bit different than just cubes.

For example stairs or fences: these elements are "aware" of their surrounding blocks and render differently based on if they are an edge, in the center, etc.

Other building games such as the Sims use a similar technique in the house building mode: the "voxels" are the same 1x1 metres but the mesh itself is usually thinner (like walls, side walls, etc.).

My question is:

What is the name of this technique?

Reference image

For the user perspective, there is only one "stairs" block. But when put next to each other, they behave differently.

sentences:
How to upgrade a project in Unity Hub Before Unity Hub, it used to be the case that if you opened up a project that was from an older version, you would be prompted to upgrade the project.

I am now on the latest Unity Hub 2.0.0 and I am trying to open a project that was last saved with 2018.2.1f1 but I am unable to.
From installs, I am able to download and install the closest available version, 2018.2.21f1, but anytime I try to open my project I get the message

  Missing editor version 2018.2.1f1 on this machine. Select another version from the list or install the missing one.

How can I upgrade this project like we did in older versions?

sentences:
Calculating a RPG character's wages based off their attributes? I am programming a Mafia RPG where you can hire people with attributes. The attributes are the same for everyone, and are ranked from 1 to 10 (although this might change to 1 to 20)
I want to keep the attributes simple, no more than 6 skills.
The attributes could be anything, but lets say there are examples.

Driving: 1/10
Stealth: 1/10
Robbery: 1/10
Brains: 1/10
Toughness: 1/10
Greed: 1/10

Greed is meant to be a modifier, the higher the number the more greedier they are.  I'd like to use this for wages
The problem I have is, I am not sure how I should calculate a goons wages.
I don't just want to randomly pick a number; its needs to be reflective of the person's attributes.
At first I thought if they all go up to 10 or 20, I could use an average, with greed being a multiplier.  But this does not feel right.
The other idea I have is bands; so that if each attribute score is between X and Y the goon could get Z wages (which are then totalled up) with greed being a modifier; but this feels very dry.
Ideally, I would like the wages to be reflective of their attribute, and most importantly reflect how greedy they are but at the same time not make the wages unrealistic or spiral into very high figures.
I'm thinking the wages should be from $100 /wk up to $5,000 or $10,000 /wk but would welcome suggestions.
What would be the best way to calculate a RPG character's wages based off their attributes?
Many thanks

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:
Adding 'swerve' to a direction I'm not much of a maths expert, so this is probably quite straight forward. I was playing a soccer flash game where you take free kicks. You provide Power, Swerve and Direction. I'm reading up on vectors and such so I can use the direction and power information to shoot the ball with the correct velocity.

What I don't understand is how the 'Swerve' information is used. What formula connects the Swerve information with the Direction and Power? This is all assuming a 2D environment.

sentences:
Game Maker Error (Step HP) I keep getting this error now in Game Maker:

  FATAL ERROR in
  action number 1
  of  Step Event0
  for object base_enemy:

  Variable base_enemy.hp(100013, -2147483648) not set before reading it.
  at gml_Object_base_enemy_StepNormalEvent_1 (line 2) - if(hp <= 0){

I understand that it's not finding the variable hp in the object base_enemy during Step Event, but I'm not sure why. I think that the parenting I did has something to do with it, because it found hp before further edits to the code. It's set up like this:

base_enemy (top parent);
base_grunt (first child);
obj_grunt (second child)

The hp variable is set in the Create Event of the second child of each unit. Is it possible that the Step Event is checking for hp before the variable is declared?

sentences:
Flexible projectile system? Projectiles need to accommodate timed, homing, linear, and arced behaviours and have single, cone, and splash effects on hit. What is a good pattern to accommodate these different behaviours that require different parameters?

I want a system where I can call something like ProjectileManager.Fire (*Projectile Parameters*) from anywhere and have a projectile get fired. How would parameters like timeToDetonate, coneAngle, and aoeRadius be handled in a user-friendly way?

sentences:
My sweep and prune is giving false positives My code is just giving false positives.
Every frame it reports an imaginary collision.

Here is my code

Sweep And Prune:

 public static void updateObjects() {

     List<BoundingBox> activeList = new LinkedList<>();
     boolean adding = true;
     for (BoundingBox box : axisList) {
        box.getOverlappingPairs().clear();
        if(adding) {
            activeList.add(box);
            adding = false;
        }else {
            for(BoundingBox e : activeList) {
                if(box.collides(e)) {
                    box.setOverlappingPairs(e);
                    System.out.println("COLLISION " + box + " : " + e);
                }else {
                    activeList.remove(box);
                }

Edit:

My AABB boxes are colliding with themselves.
I have debugged my classes and have narrowed it down to the sweep and prune class.

I would appreciate if someone would help me.

sentences:
What happens when a texture is too large for a device The question is two fold:

What happens on a device when a texture is too large for it to handle? Will it crash or simply downsize it?
In Unity if I use texture atlases of size 4k and then set Texture Quality in the Quality settings as half res will it run normally on devices with maximum texture size of 2k?

sentences:
Unintended sliding blocks Unity (5) physics A game I'm working on right now relies on the Unity physics system for collisions, gravity etc. This all works well except for one strange thing. When an explosive is placed on a stone cube, it'll slide right off.

A video displaying the sliding behavior: https://www.dropbox.com/s/lr6lhnn30x61tvf/Unity%202015-02-19%2013-41-39-54.avi?dl=0

The stone gameobject settings: http://puu.sh/g3BFn/c15483b8ea.jpg The explosive has the same settings except for that the Mass is 1.

What could cause this weird sliding and how can it be fixed?

sentences:
Dynamic audio score/music I'm interested in developing a game who's background music changes with the mood and scenario of the game's action. Of course many existing games do this (halo for example), but I was interested in any resources/papers/articles talking about the techniques to develop a system like this.

I have some ideas, and I understand that this will be equally challenging to implement at the code level as it will be to come up or acquire music that fits this model. Any links or, answers with ideas in them would he appreciated.

Edit: this is the kind of info I'm looking for :)
http://halo.bungie.org/misc/gdc.2002.music/

sentences:
Circle Collider 2d is slipping off box colider2d when it shouldnt I have a crude rectangle sprite with a box colider 2d, and a circle sprite with rigidbody 2d and circle collider 2d, as seen in the image below. When I click on the red rectangle, it moves up fairly quickly a little more than the diameter of the circle.

If this occurs from the position show, or with the circle any further right than it currently is, the circle appears to fall down onto the yellow box almost instantly, hugging the side of the red rectangle. If I let the circle go a little more onto the red rectangle then it is pushed up correctly. Why is the circle falling off the red rectangle from this position, and how can I prevent it from acting like this?

sentences:
How can I reduce the size of bundled Unity DLLs on Android? I have created a simple project (I am a Unity beginner) for Android but the apk size is around 18 MB!

I checked the documentation. One way to decrease the apk size is to check the editor log. Then I discovered that imported DLLs have a size of 3.9MB.

I only used UnityEngine and Collision packages. So how can I avoid to import the other big DLLs?

sentences:
Which Kinect package for PC takes care of motion tracking too? I am aware that there are opensource drivers for interfacing Kinect with the PC. My question is - the drivers at OpenKinect seems to provide only the images and depth data (from the reading of their wiki and API). It seems that you need to provide your own imaging solution.

My question is - is there any all-in-one package, with samples/sources that not only grab images from Kinect, but also do the imaging/motion detection for you?

sentences:
how did coordinate-handling in old flightsimulators work? Im currently working on a combat flight simulator pure for own fun.
Using a floating-origin i thought the float inprecision was history, however this was the case untill i tried adding multiplayer to the game.

The server is authorative and i'm banging my head around positioning the players on the server and handling the gun hits and collisions.

Using sectors i reset the origin of the clients but the server keeps the original position. This will lead into float inprecisions on the server, thus physic and collision checking are terrible.

Now i'm just wondering how games like Airwarrior, Warbirds and aceshigh overcame these problems. What approach did they use? I'm assuming something else. If only i was able to use double precision, or even fixed point, but i'm tied to a physics model working with floats. I don't feel like changing that around, unless i have no other option.

Thanks for any pointers.

stephan

sentences:
XNA 2D rotation Matrix offset/origin I'm currently struggling with finding the offset for my original camera translation after I have applied a rotation for it.

transform = Matrix.CreateScale(new Vector3(1, 0.75f, 1))
            * Matrix.CreateTranslation(-playerpos.X+dash, -playerpos.Y, 1);

rotation = Matrix.CreateRotationX(MathHelper.ToRadians(valuex))
            * Matrix.CreateRotationY(MathHelper.ToRadians(valuey));

transform2 = rotation
            * Matrix.CreateScale(new Vector3(1, 0.75f, 0))
            * Matrix.CreateTranslation(-playerpos.X + dash, -playerpos.Y, 0);

My original transform matrix is for the camera that follows the player, I use transform2 for sprites I want to rotate.

spriteBatch.Begin( SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
                   null, null, null, camera.transform);

spriteBatch.Begin( SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
                   null, null, null, camera.transform2);

Edit:

for (int i = 0; i < 3; i++)
{
  spriteBatch.Draw( world.mcircle[i],
                    new Vector2(5320, 1200),
                    null,
                    Color.White,
                    (world.finishtime * 5) / (i + 1),
                    new Vector2(50, 50),
                    3f,
                    SpriteEffects.None,
                    0);
}

So I pass two different transformations based on whether I want stuff to rotate or not.

But I just can't seem to find the correct offset in position for the rotated sprites, they seem to gravitate towards (0, 0)? as the rotational value increases.

I'd be really glad if someone could help me out with this.

Edit: I think I'd only need a proper origin for the sprite position, because currently it goes towards (0, 0) and I'm unsure how to incorporate one in this state.

Edit:

Tried several origin points for transform2, but when I input the object's coordinates as source, it just displaces it by that amount, and when I set the object's position to (0,0) it still has the same effect as if having the original origin point.

transform2 = Matrix.CreateTranslation(0, 0, 0)
             * (rotation * Matrix.CreateScale(new Vector3(1, 0.75f, 0))
             * Matrix.CreateTranslation((-playerpos.X + dash), -playerpos.Y, 0)); //just an example currently

sentences:
Creating 2D billiard game with realistic movement I'm new to XNA and game programming.

I'm creating a 2D billiard game and I want to add balls with realistic movement (like 3D). Is it possible to achieve this without using 3D models? I only want to use 2D. Please give me examples.

sentences:
How are the positions of skinned mesh vertices with multiple weighted parents stored? I'm trying to wrap my head around the basics of skinning and skeletal animation.  I understand not every skeletal animation implementation works exactly the same, but I'm just trying to understand the generally accepted practice.

I'm not sure if I used the correct terminology for my question, but my issue is this - if I have a vertex with a single bone as a parent, I can just store the local coordinates to the parent.

So if my parent bone is at any random location and the vertex is located exactly where the parent bone is, I would store it's x,y location as 0,0.  If it were to move the vertex down the length of the bone parallel to it, regardless of the parent bone's angle and location, the local x value for the vertex would increase and the y would stay the same.  This makes sense, and the math to get from any arbitrary point in world space to that local position to it's parent is also very straightforward.  This position local to the parent also seems like the ideal way to store the vertex information for any given vertex with a single parent bone.

My question is if the vertex has multiple weighted parents, what xy location is stored?  Would I need to store the relative coordinates to each parent for each vertex, or is there some way to store a single coordinate that represents it's weighted position relative to all parents?  And if the math isn't simple enough to be explained here, what is the math required to get this multi-weighted relative coordinate called so I can go find more information?

sentences:
Unity Mechanim makes physics behave weirdly I'm developing a 2D Wrestling game in Unity 5 build 5.1.2f1. It's just the beginning so the character only has a number of animation states and a rigidbody2d.
This is the state machine

and these are the Animator and Rigidbody2D components

Note that I'm using Root motion to animate "High Knee" state since I've animated the character jumping in the air(high knee) by animating character's transform.

This is the simplest form of code to move the character

void Start ()
{
    rb = GetComponent<Rigidbody2D>();
    anim = GetComponent<Animator>();
}

void Update ()
{
    print (rb.velocity);
    if(Input.GetAxis("Horizontal") > 0)
    {
        rb.AddForce(new Vector2(0,50));
        anim.SetBool("isWalking",true);
    }

    else if(Input.GetAxis("Horizontal") < 0)
    {
        rb.AddForce(new Vector2(0,-50));
        anim.SetBool("isWalking",true);
    }

    else if(Input.GetAxis("Vertical") > 0)
    {
        rb.AddForce(new Vector2(50,0));
        anim.SetBool("isWalking",true);
    }

    else if(Input.GetAxis("Vertical") < 0)
    {
        rb.AddForce(new Vector2(-50,0));
        anim.SetBool("isWalking",true);
    }

}

The Character starts moving in x direction with a constant speed as soon as i press the horizontal keys. But for the y axis, when i press up or  down key, character starts at 0 and speeds up really really fast( like 50 milisecs) and then the speed keeps increasing and increasing until i release the key. It still keeps moving but the speed doesn't increase anymore. I'm not sure but i think the former behavior is weird and latter is fine (or vice versa). When i remove all the "anim.SetBool" lines in the above code, speed becomes constant for the y axis too, that is, it starts behaving exactly like the x axis. But when i disable the Animator component, x axis movement starts behaving like y axis, that is, speed starts at 0 and quickly increases and keeps increases as long as the key is held down. When i uncheck the "Apply Root Motion" check box, character doesn't move at all. I don't know what's happening. Any help would be appreciated.

sentences:
Script not working (Function not changing value) I have this script that I made for an FPS character.
public class Player_Movement : MonoBehaviour

{
public CharacterController controller;
public Transform camera;
public float gravity = -9.81f;

public Transform groundCheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;
bool grounded;

public GameObject joystick;
public bool isMoving;
public float speed = 12f;
public float turnSmoothTime = 0.1f;
float turnSmoothVelocity;

public float jumpHeight;
public Vector3 yPosition;
public bool jumpAble = true;

// Update is called once per frame
void FixedUpdate()
{
    grounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

    if (grounded)
    {
        yPosition.y = -2f;
        jumpAble = true;
    }

    Vector3 direction = new Vector3(joystick.GetComponent<Joystick>().inputDirection.x, 0f, joystick.GetComponent<Joystick>().inputDirection.y);
    isMoving = direction.magnitude != 0 ? true : false;

    if (isMoving)
    {
        controller.Move(direction * speed * Time.deltaTime);
    }

    yPosition.y += gravity * Time.deltaTime;
    UnityEngine.Debug.Log(yPosition);
    controller.Move(yPosition * Time.deltaTime);
}

public Vector3 Jump()
 {
     UnityEngine.Debug.Log(jumpAble);
     UnityEngine.Debug.Log(grounded);
     if (jumpAble && grounded)
     {
         jumpAble = false;
         yPosition.y = Mathf.Sqrt(jumpHeight * -2 * gravity);
         UnityEngine.Debug.Log(yPosition.y);
         UnityEngine.Debug.Log(yPosition);
         return yPosition;
     }

     return yPosition;
 }

}
The game operates on mobile touch controls, and the Jump() is called when the jump button is pressed. However, the character does not jump when I press the button, even though the function is being called, and the yPoisition is being changed in the function. I know that changing the yPosition should make the player jump, as when I add this code to the Update:
if (Input.GetKey(KeyCode.Space) && jumpAble)
         {
             fallDown.y = Mathf.Sqrt(jumpHeight * -2 * gravity);
         }

Everything works fine.
Why is the new yPoisition value not being passed to Update, and why is this happening?

sentences:
How should I handle functions, where two classes have equal use? I'm working on a few features for a strategy engine I'm making. I'm trying to figure out the best spots to separate the components, as either option will provide the same amount of coupling, with the same effectiveness.

For example, all players have a Damage component, a Player component, and a HealthBar component:

abstract class Damage
{
    protected abstract void sendDamage(Player targetPlayer, int rawDamage);
    public abstract int calculateRawDamage(Attack attackUsed);
    public abstract void receiveDamage(int rawDamage);
}

class Player
{
    List<Armor> equippedArmor;
    List<Buffs> currentBuffs;
    public Damage damageComponent;
    public List<HealthBars> healthBarComponents;
}

abstract class HealthBar //can be inherited for mana or health bar
{
    protected Color color;
    public float percent; //0.0 - 1.0
}

When a player receives damage, I need to show a red number floating up from their head, indicating the amount of damage. This can either be implemented in HealthBar, or in Damage. It fits damage better, but then healing works in the same way, and wouldn't be called from damage. I could abstract damage into something like ChangeValue, which would change mana, health, etc in any direction, or I could use the abstract HealthBar class to show this number being changed.

I'm trying to think of a general rule that would solve this and other problems, where two classes use the same function equally. This is an oversimplified version of my classes, but it makes more sense this way.

How should I handle functions, where two classes have equal use?

sentences:
How to change transform.position.x after a state is changed? When I press attack button, player will change to Normal Attack state to perform Normal Attack animation and you will notice the player seem like step back a little bit as the width of sprite for Normal Attack animation is longer than Idle animation.

http://youtu.be/hnPXt-kprqQ

To solve this issue. I need to change the transform.position.x =+ 0.5 to move a bit further to match the position of Idle animation stands and transform.position.x =- 0.5 when Normal Attack state done its animation and back to Idle state.

How can I perform transform.position.x =- 0.5 when when Normal Attack state done its animation and back to Idle state?

sentences:
Box 2d Level Editor for AndEngine I am getting started with Box2d in AndEngine.
I need to know if there is any level editor to be used with box2d and gives output capatable with AndEngine.

Is there any tool which can help me building complex body with joints like a bike or car?

What do you suggest which is the best way to do this kind of stuff.

sentences:
Use references to UIManager script or direct for children OBJs So I've got a canvas with UIManager script attached to it, the canvas has a lot of buttons and texts as children OBJs and they somehow need to communicate to each other. Should this be done through the UIManager or through direct scripts?

EDIT: Fixed, the point was to set other buttons and other UI elements active or de-active, I ended up using different methods in the UImanager script to do so, without having like 20 scripts.

sentences:
Odd exception when calling a method in DirectX 11 I am following the "3D game programming with directx 11" book (Frank Luna) and I am trying to render a cube. In the code there is this m_device->CreateBuffer() function which is giving me problems.
The exception I get is:

Device was 0XFFFFFFFFFFFFFFFF
DirectX11 exception in a method which is external to where the CreateDevice() method is called

So I tried to put it in the method where the device is created, and it gives no exception, so I'm wondering if I have to make the m_device something like global or I don't know.
struct Vertex {
        XMFLOAT3 Pos; XMFLOAT4 Color;
    };

 Vertex vertices[] = {
        { XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT4((const float*)&Colors::White)},
        {XMFLOAT3(-1.0f, +1.0f, -1.0f),  XMFLOAT4((const float*)&Colors::Black)},
        {XMFLOAT3(+1.0f, +1.0f, -1.0f),  XMFLOAT4((const float*)&Colors::Red)},
        {XMFLOAT3(+1.0f, -1.0f, -1.0f),  XMFLOAT4((const float*)&Colors::Green)},
        {XMFLOAT3(-1.0f, -1.0f, +1.0f),  XMFLOAT4((const float*)&Colors::Blue)},
        {XMFLOAT3 (-1.0f, +1.0f, +1.0f), XMFLOAT4((const float*)&Colors::Yellow)},
        {XMFLOAT3 (+1.0f, +1.0f, +1.0f), XMFLOAT4((const float*)&Colors::Cyan)},
        {XMFLOAT3 (+1.0f, -1.0f, +1.0f), XMFLOAT4((const float*)&Colors::Magenta)}
    };
    D3D11_BUFFER_DESC vbd;
    vbd.Usage = D3D11_USAGE_IMMUTABLE;
    vbd.ByteWidth = sizeof(Vertex) * 8;
    vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    vbd.CPUAccessFlags = 0;
    vbd.MiscFlags = 0;
    vbd.StructureByteStride = 0;
    D3D11_SUBRESOURCE_DATA vinitData;
    vinitData.pSysMem = vertices;
    m_device->CreateBuffer(&vbd, &vinitData, &mBoxVB); //exception is here

I repeat the code perfectly works in the method where I called the CreateDevice() method, but doesn't here, in another method of another class.

sentences:
How to detect if a 2D object overlaps any other 2D objects I am programmatically placing 4 large dots on my 2D scene which already has some objects on it. If the new dot overlaps an existing object I want to destroy the existing object. All the objects have 2Dcolliders and all are on the same layer ("Action").
Since I only do this once during the initial setup of the game I don't want to use collision detection events, instead it would seem that Collider2D.OverlapCollider would be the way to do this but I can't get it to work. The following code is called from Start() after all the objects have been placed, and thinking it might be something to do with the colliders not being active until the first frames, I also called it from a mouse click with the same result (no overlaps).
    void EraseOverlapDots()
    {
        GameObject[] largeDots = GameObject.FindGameObjectsWithTag("LargeDot");
        foreach(GameObject ldot in largeDots)
        {
            Debug.Log("Object:" + ldot.tag + "(" + ldot.transform.position + ")");

            Collider2D collider = ldot.gameObject.GetComponent<Collider2D>();
            ContactFilter2D contactFilter2D = new ContactFilter2D();
            contactFilter2D.SetLayerMask(ldot.layer);
            contactFilter2D.useLayerMask = true;

            List<Collider2D> collisions = new List<Collider2D>();
            int colCount = collider.OverlapCollider(contactFilter2D, collisions);
            int i = 0;
            foreach (Collider2D col2d in collisions)
            {
                i++;
                Debug.Log("HIT"+i+":" + col2d.tag + "(" + col2d.transform.position + ")");
            }
        }
    }

In an attempt to debug this I purposely put 4 small dots in exactly the same position as the large dots to ensure they overlap. When I run the game they are visibly exactly on top of each other but the result is always zero overlaps.

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:
Storing and Finding Art Assets I've started down a line of art asset development that will allow me to (hopefully) reuse and improve assets for several games.

But how do I go about storing and finding them?

Let's say for example I decide to focus on RPGs for ~2 years. I would create items, monsters, etc. and store them somewhere. How would I categorize them and make them easier to search later on?

Is the best solution "use directories with broad categories like landscape/items/monsters/etc.?"

sentences:
Android device - C++ OpenGL 2: eglCreateWindowSurface invalid I am trying to debug and run OGLES on Native C++ in my Android device in order to implement a native 3D game for mobile smart phones. The point is that I got an error and see no reason for that. Here is the line from the code that the debugger complains:

    mSurface = eglCreateWindowSurface(mDisplay,
                                      lConfig, mApplication->window, NULL);

And this is the error message:

    Invalid arguments ' Candidates are:
        void * eglCreateWindowSurface(void *, void *,
                                      unsigned long int, const int *) '

--x--

Here is the declaration:

    android_app* mApplication;

    EGLDisplay mDisplay;
    EGLint lFormat, lNumConfigs, lErrorResult;
    EGLConfig lConfig;
    // Defines display requirements. 16bits mode here.
    const EGLint lAttributes[] = {
        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
        EGL_BLUE_SIZE, 5, EGL_GREEN_SIZE, 6, EGL_RED_SIZE, 5,
        EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
        EGL_NONE
    };
    // Retrieves a display connection and initializes it.
    packt_Log_debug("Connecting to the display.");
    mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    if (mDisplay == EGL_NO_DISPLAY) goto ERROR;
    if (!eglInitialize(mDisplay, NULL, NULL)) goto ERROR;
    // Selects the first OpenGL configuration found.
    packt_Log_debug("Selecting a display config.");
    if(!eglChooseConfig(mDisplay, lAttributes, &lConfig, 1,
        &lNumConfigs) || (lNumConfigs <= 0)) goto ERROR;
    // Reconfigures the Android window with the EGL format.
    packt_Log_debug("Configuring window format.");
    if (!eglGetConfigAttrib(mDisplay, lConfig,
        EGL_NATIVE_VISUAL_ID, &lFormat)) goto ERROR;
    ANativeWindow_setBuffersGeometry(mApplication->window, 0, 0, lFormat);
    // Creates the display surface.
    packt_Log_debug("Initializing the display.");
    mSurface = eglCreateWindowSurface(mDisplay, lConfig, mApplication->window, NULL);

--x--

Hope someone here can shed some light on it.

sentences: Quaternion.AngleAxis smallest value? If I'm using an angle with a value of somewhat below 0.1 degrees in Quaternion.AngleAxis, the quaternion will not apply a rotation at all. Why is this?

sentences:
How to retrieve the coordinates of an animated object? On Unity, I created a script in C # to animate a cube.
I am trying to create a script in C # which, once the animated object and in support of a key of the keyboard (for example F) returns to me the coordinates of the object at the moment when I pressed F

Can you give me this script?

Thank you for your help

sentences:
Unity: Adjusting 2D physics for different mobile resolutions I created a test project to see how different mobile resolutions affects Unity's 2D Physics.

They way I handled the resolutions was to contain all the objects (including non-UI objects) in a Canvas and use a Canvas Scaler component to adjust for multiple resolutions. Although this approach is probably not one of the ways the Canvas was not meant to be used, it works well when working with a single orientation.

Despite the quick solution to handle the multiple resolutions, there seems to be the issue of the physics acting differently depending on what aspect ratio is being used.

Images can be viewed here: http://imgur.com/a/p5wmf

The green and blue blocks both have the Rigidbody2D and Box Collider 2D components. The floor (big white block) only has a Box Collider 2D component.

As you can see from the images above, the different aspect ratios cause the blocks to collide with the floor at different times. Also, when using rigidbody.addforce in the Y direction, the different aspect ratios cause the blocks to jump at different heights.

Obviously these issues could cause an unfair advantage in a game with support for several resolutions.

So how would I go about adjusting the physics so that the blocks fall and jump at the same rates relative to the different resolutions?

Also if there is a more practical way to adjust for multiple resolutions that doesn't involve a plugin and doesn't break physics, let me know!

sentences:
Obscuring stored info in a flat-text file I have an idea for an addon for World of Warcraft which would basically be a minigame within the game itself. Eventually, I'd like to have players be able to compete against each other directly. The game would have some RPG-like elements, particularly statistics and abilities, which it would be undesirable for the end users to modify.

So the fact that this is a client-side script, where everything (logic and data storage) are all in flat text files, means that it's impossible for me to truly secure things. But I'd like to at least make it non-trivial to alter things, e.g. so that you can't just open up a file in notepad and type in 'Strength = 256'.

I'm looking for any ideas on how I might obfuscate the data, preferably something which is easy to implement as it's not really what I feel like spending my time on, but probably more sophisticated than ROT-13.

As an example, one idea I had, which I'm not sure if it's feasible (have never made an addon for WoW before) is to serialize the data in base-64.

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:
tcp multiplayer security/structure I'm creating a real time multiplayer game. Each piece of data needs to be received, but it still needs to be as fast as possible which is why I don't want to use TLS for every request.

Here's what I was thinking:

The player logs in using TLS, and receives a session ID and symmetric key that the server generates

The server stores the player's ip address and symmetric key in the database for future reference

When they start a match, they receive a match ID, and send data to the server including the match ID, their session ID, and any necessary data using a symmetric encryption algorithm

The server takes their IP, finds the symmetric key from the database, and decrypts the message and authenticates the user based on the session ID

If everything checks out, the server accepts the data.

Is this approach plausible/efficient? would it be better for me to store the each player's symmetric key using their IP, or for me to get rid of the IP/symmetric key link table and send the data with the session id not encrypted, and store the key using the session id?

Any answers/comments would be greatly appreciated.

sentences:
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:
Memory allocation strategy for the vertex buffers (DirectX 10/11) I'm writing a CAD system. I have a 3D scene and there are many different objects (walls, doors, windows and so on). The user can add or delete objects.
The question is: How do I keep track of all the vertices for all my objects?

I can create vertex buffer for every object. But I think drawing/switching from one buffer to another would have performance penalty.

Another way - I can create several big buffers for every object type. But I don't understand how to update such buffers. It is too big to update whole buffer (for example buffer for all walls). What would I do if I wanted to delete an object that's in the middle of the buffer?

I have the similar question here on Stack Overflow.

Most examples I've found work with static models. Therefore, they tend to create a single vertex buffer with their list of points, and then are just manipulated by matrix transformations. I, on the other hand, will be updating the scene very often. So what's the best way to keep track of and store this information?

sentences:
Detecting right/left collisions with a bounding box I'm building a platformer in cocos2d, my first game project. I'm working on movement and collision detection. I'm using a tilemap with a "meta" layer of invisible blocks that are designated collidable.

Everything seems to work pretty well except for one minor detail: when the character jumps from above into a platform, he does not fall but clips through it. If he jumps from below, it recognizes it and resets his Y velocity accordingly. I know that it's because of how I'm  detecting the collisions, and just doing a simple comparison of the origin.y's, but I'm unsure of how to refactor this code better:

- (void) update: (ccTime) dt {
    CGPoint scaledVelocity = ccpMult(leftJoystick.velocity, 35.0f);
    CGPoint newPosition = ccp(player.position.x + scaledVelocity.x * dt, player.position.y);
    CGPoint oldPosition = [player position];

    float velocityX = player.Velocity.x + scaledVelocity.x * dt;
    float velocityY = player.Velocity.y;

    BOOL isCollision = NO;
    BOOL isCollisionBelow = NO;
    BOOL isCollisionRight = NO;
    BOOL isCollisionLeft = NO;

    NSMutableArray* collisionSprites = [[NSMutableArray alloc] init];

    if (oldPosition.x > newPosition.x) {
        player.flipX = YES;
    }
    else if (oldPosition.x < newPosition.x) {
        player.flipX = NO;
    }

    for (CCSprite* sprite in gameplayLayer.collidableTiles) {
        if (CGRectIntersectsRect(player.boundingBox, sprite.boundingBox)) {
            isCollision = YES;
            [collisionSprites addObject:sprite];
        }
    }

    // Figure out which direction collision is in
    if (isCollision) {
        for (CCSprite* collisionSprite in collisionSprites) {
            if (collisionSprite.boundingBox.origin.y < player.boundingBox.origin.y) {
                isCollisionBelow = YES;
            }
            if ((collisionSprite.boundingBox.origin.x > player.boundingBox.origin.x) && (collisionSprite.boundingBox.origin.y >= player.boundingBox.origin.y)) {
                isCollisionRight = YES;
            }
            if ((collisionSprite.boundingBox.origin.x < player.boundingBox.origin.x) && (collisionSprite.boundingBox.origin.y >= player.boundingBox.origin.y)) {
                isCollisionLeft = YES;
            }
        }
    }

    if (isCollisionLeft) {
        velocityX = 0.5f;
    }
    else if (isCollisionRight) {
        velocityX = -0.5f;
    }

    if (isCollision && !isCollisionBelow && player.characterState != kStateFalling) {
        velocityY = 0;
        velocityY -= 0.8f;
        [player setCharacterState:kStateFalling];
    }
    else if (!isCollisionBelow) {
        velocityY -= 0.7f;
    }
    else if (isCollisionBelow) {
        velocityY = 0;
        [player setCharacterState:kStateIdle];
    }

    if (rightButton.active) {
        if (player.characterState != kStateJumping) {
            velocityY += 15.0f;
            [player setCharacterState:kStateJumping];
        }
    }

    // Ground friction
    if (player.Velocity.x > 0) {
        if (player.Velocity.x < 0.5f) {
            velocityX = 0;
        }
        else {
            velocityX -= 0.5f;
        }
    }

    if (player.Velocity.x < 0) {
        velocityX += 0.5f;
    }

    [player setVelocity:ccp(velocityX, velocityY)];
    [player setPosition: ccp(player.position.x + player.Velocity.x, player.position.y + player.Velocity.y)];
    [gameplayLayer setViewpointCenter:newPosition];
    [player setOldPosition: player.position];
}

How can I refactor this code to work properly from all angles and reduce the complexity (I feel that there's too many booleans, and they all get a bit confusing).

sentences:
Unity General Prefab I have 2 questions about how i should approach this.

I want to make a 2D game, with alot of different creatures.

Question one: If i have alot of monsters and i'm using ScriptableObjects, since they have very similar variables. How can i make one Enemy prefab which will load the right ScriptableObject information? For example i have an Enemy Prefab, then it will load random monster between: Dragon, Frog, Wolf. How can i achive this without creating 3 new Prefabs for each one and instead load just the right ScriptableObject.

Question two: Should i create new prefab for each monster? Or is approach 1 the right way to do it, if you plan to expand over 100+ creatures.

Thanks

sentences: Why does clipping take place after illumination? Can you explain why clipping takes place after the illumination process in the rendering pipeline? Would it be not cheaper to clip first and do then the illumination?

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:
vector.size() instead of literal type breaking my draw code I'm writing a simple class to draw all the debugging lines I have in my scene at once.

The code in the draw loop is this so far: (If I put for example, 2 instead of temporary2DVerts.size() where I have marked with //THIS LINE, the code works fine.) when I run the code below the line breaks //HERE. Access violation reading location 0x00000000. seems like the create buffer line is not working, but why? what's the solution?

D3D10_BUFFER_DESC bd;
bd.Usage = D3D10_USAGE_DYNAMIC;
bd.ByteWidth = sizeof(VERTEX) * temporary2DVerts.size();// THIS LINE
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
bd.MiscFlags = 0;

device->CreateBuffer(&bd, NULL, &pBuffer);

void* pVoid;

pBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid); //HERE
memcpy(pVoid, &temporary2DVerts[0], sizeof(temporary2DVerts[0]) * temporary2DVerts.size());
pBuffer->Unmap();

    device->IASetInputLayout(screenVertexLayout);

    device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST);

    UINT stride = sizeof(VERTEX);
    UINT offset = 0;
    device->IASetVertexBuffers(0, 1, &pBuffer, &stride, &offset);

    screenPass->Apply(0);

    device->Draw(temporary2DVerts.size(), 0);

    temporary2DVerts.clear();

sentences:
Can I use real currency name/symbol as an in-game currency? Can I use a real currency name (i.e USD, PKR) or symbol ($, Rs.) for my in-game currency with the same exchange value as original currency? I couldn't find anything about it in google play store policies neither in government websites.

Of course I have other options, I can call it gold or silver etc but I'm just wondering if it is allowed or not.

sentences:
Game Center Leaderboard not dismissing I was implementing Game Center into my app and all was going well except for the leaderboard done button not dismissing the leaderboard even with gameCenterControllerDidFinish added in. I call up the leaderboard with the touch of a button in the .m file as so:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
 UITouch *touch = [touches anyObject];
 CGPoint location = [touch locationInNode:self];
 SKNode *node = [self nodeAtPoint:location];

 if ([node.name isEqualToString:@"rankButton"]) {

    [self runAction:[SKAction playSoundFileNamed:@"fishtran.m4a" waitForCompletion: NO]];
     GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc]
  init];
        if (gameCenterController != nil)
   {

        gameCenterController.viewState = GKGameCenterViewControllerStateAchievements;
        UIViewController *vc = self.view.window.rootViewController;
        [vc presentViewController: gameCenterController animated: YES completion:nil];
    }
} else if ([node.name isEqualToString:@"Leaderboard"]) {
    GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc]
  init];
    if (gameCenterController != nil)
    {

        gameCenterController.viewState = GKGameCenterViewControllerStateLeaderboards;
        UIViewController *vc = self.view.window.rootViewController;
        [vc presentViewController: gameCenterController animated: YES completion:nil];
    }
}

...
and then I added thegameCenterControllerDidFinish immediately after as so:

- (void)gameCenterControllerDidFinish:(GKGameCenterViewController*)gameCenterController {

    UIViewController *vc = self.view.window.rootViewController;
    [vc dismissViewControllerAnimated:YES completion:nil];
}

and the done button still doesn't work and i haven't been able to find any solutions. And yes, I do have GKGameCenterControllerDelegate in my .h file. Any help would be greatly appreciated, Thanks!

sentences:
Indie devs working with publishers I'm an independent game developer considering working with a publisher.  This question is very informative however I have more questions.  Please give feedback on the following issues... I think this can be helpful to many indie devs in the same situation.

Source code: is it common for developers to give the publisher the source code?
Code quality:  does this matter when working with a publisher any more so than when just working on your own (or in a small team)?  Just wondering if developers working for the publisher might scoff at the code quality and perhaps influence the relationship between developer and publisher.
Unique game concepts: are publishers generally biased towards new/novel game concepts?
Intellectual property: if I send a playable demo to a publisher what's to stop them from just reproducing the new/novel game mechanic?  I think the answer is basically nothing... but I'm wondering if this is a realistic concern.
Revenue sharing: how does it work? what's a common ratio?  70/30?  30/70?
Flaky publishers: how common is it for a publisher to "string along" developers for a while then just drop them?  Can this be reconciled with a contract of some kind?

And any other issues you've encountered or heard of.

sentences:
How to do offline notifications for Android in Unity3d I am making a game for Android with Unity3d.
I've been looking for a solution to this on the web for a little, but I couldn't find anything suitable:

I want to make my game have offline notifications.Like...I want to set up an alarm that notifies the user at some point in the future e.g.

  "Building complete!"

but the app should not have to be running.

How do I accomplish that?

sentences:
Physical attributes as a function of age My workerclass has physical attributes such as physical_fitness and sexual_fitness which are intended to be functions of their age (the attribute is, unsurprisingly, called age). When the class is initialized, the initial values of XYZ_fitness are computed by a randomized normal distribution.

In each game tick, worker's grow a year older. I want to appreciate/depreciate the values of their physical attributes such that, for example, they increase until they are at their maximum value around age 35, and decline with age after that. What is an efficient way of defining this function?

Would this involve something like running their age through a quadratic function with its maxima at the age value 35? I'm sure there's some elegant math/statistics here that's escaping me.

sentences:
c++ RPG - Handling buffs / equipment stats I'm trying to develop a character calculator for a RPG, and it could evolve into a turn based combat / text based RPG. One of my concerns is how to handle the equipment stats / buff system.

Currently each of my buffs / equipment object and my character object itself has a member bonusstats, which is a struct containing a (potentially) very large amount of possible modifiers (attributes, misc_skills, protections, secondary_stats, etc and their multiplier versions).

struct BonusStats {
    int attribute[8], misc_skill[30], protection[9], HP, MP, ... ;
    //define constructor, operator+=, reset function
}

And everytime an actualize call is requested every stat is recomputed:

Character::Actualize() {
    this->bonusstats.reset();
    for /*iterate through vector of buffs and equipped items*/ {
        this->bonusstats += item->getBonusStats();
    }
}

While this is a rather simple approach I am concerned about two things mainly:

1.- Is it performance-wise acceptable? I get the feeling that having to sum two structs containing 100 elements just to add a buff is not a very good practice. Would there be any practical advantage in using a function like Character::ApplyStats( std::function<void(BonusStats*)> itemstats) instead?

2.- How could I implement more complex buffs than stat modifiers? For example, reflecting x% damage when blocking a melee attack. The thing that comes to my mind is to create complex stats like percent_damage_reflected_on_melee_block and check its value everytime conditions are met. Is it a good approach?

sentences:
How do you organize your game files and classes? Although it isn't necessary to exclude things like graphics and audio packages, I'm most interested in the organization of the folders for classes that deal with AI and game state. I'm thinking something like this in Java using packages as the example:

import com.rpg.characters;
import com.rpg.characters.antagonist;
import com.rpg.characters.neutral;
import com.rpg.characters.protagonist;
import com.rpg.characters.state;
import com.rpg.gameplay;
import com.rpg.gameplay.engine;
import com.rpg.gameplay.maps;
import com.rpg.weapons;

Also, does it make a huge difference between 2d and 3d games?

sentences:
XNA 4.0 - Strange edges with multilight shader I am generating a light, a depth and a normalmap to calculate the lightning at each pixel with multiple lights.

On both rendertargets, i set the preferredMultiSampleCount parameter to 16 samples because I want smooth edges.
It seems to work well on the first picture (normalmap).
In the second picture (lightmap), multisampling works great, too.
But somehow there are flickering edges at the end of each model.

I think it may have to do something with the depthmap because due to using Surfaceformat.Single I have to use

minfilter = point;
magfilter = point;
mipfilter = point;

for the Texture filter and I think AA doesnt work with filter type point.

Is this a known newbie problem or should I upload the source of my shader files for a better understanding of my problem?

EDIT:
If I turn multisampling off, I dont get these edges:

(Take a look at the bottom of the square in the middle.. )

sentences:
How to add emission to texture in shader? I want a texture to emit itself by 1, not more. In Standard Shader I enable Emission and set texture to Color and Color to 1. I don't need emission to go beyond the object, I only need the texture to shine.

My shader:

Shader "Mobile/My Bumped Diffuse" {
Properties{
    _MainTex("Base (RGB)", 2D) = "white" {}
    [NoScaleOffset] _BumpMap("Normalmap", 2D) = "bump" {}
    _Color("Color", Color) = (1, 1, 1, 1)
}

    SubShader{
        Tags{ "Queue" = "Transparent" "RenderType" = "Transparency" }
        LOD 250
        ZWrite Off
        Blend SrcAlpha OneMinusSrcAlpha

    CGPROGRAM
    #pragma surface surf Lambert noforwardadd alpha:fade

    sampler2D _MainTex;
    sampler2D _BumpMap;
    fixed4 _Color;
    fixed4 _Emission;

    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;
        o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
    }
    ENDCG
}

    FallBack "Mobile/Diffuse"

}

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

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

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

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

sentences:
Whats the best way to expose current settings to your classes? Just as the title states, whats the best way to expose current settings like resolution to my classes?
(I know this might have been asked, but I couldn't find anything)

I was thinking of the service-locator design pattern, but I am unsure, as I read that it can be abused easily.( I mean it might not fit this particular use-case )

sentences: How make a laser path prediction line like a “slingshot cowboy” game? How so I make a laser path prediction line like a “slingshot cowboy” game in cocos2d or box2d and select the target like "slingshot cowboy" game.

sentences:
Since D3DX utility library is deprecated, what can I do about this legacy code? D3DX Structures utility library is deprecated for Windows 8 and its not supported for Windows Store apps. So my question is, Does anyone know what to replace this legacy code with..

std::vector<ID3D11Texture2D*> srcTexture(size);
for(UINT i = 0; i < size; ++i)
{
    D3DX11_IMAGE_LOAD_INFO iload;

    iload.Width  = width;
    iload.Height = height;
    iload.Depth  = D3DX11_FROM_FILE;
    iload.FirstMipLevel = 0;
    iload.MipLevels = D3DX11_FROM_FILE;
    iload.Usage = D3D11_USAGE_STAGING;
    iload.Format = format;
    iload.BindFlags = 0;
    iload.CpuAccessFlags = D3D11_CPU_ACCESS_WRITE | D3D11_CPU_ACCESS_READ;
    iload.MiscFlags = 0;
    iload.Filter = filter;
    iload.MipFilter = mipFilter;
    iload.pSrcInfo  = 0;

    HR(D3DX11CreateTextureFromFile(d3ddevice, filename[i].c_str(),
        &iload, 0, (ID3D11Resource**)&srcTexture[i], 0));
}

I have been using directXTK to try an replace them but its a difficult process, both
D3DX11CreateTextureFromFile and D3DX11_IMAGE_LOAD_INFO still need replaced and D3DX11_FROM_FILE is also a depreciated parameter, is there an alternative or effective solution available?

thx in advance

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:
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:
What is the standard way of delivering HTML5 games to portals and such? Let me explain what I mean by "standard way of delivering"...

Think about Flash games sites. Flash games can be delivered as a single file, either hosted by the site, or, I guess, provided by someone else.

HTML5 games, on the other hand, don't have something so standard. Usually, they have their own page, and portals just link to that page. I think that it greatly hinders the purpose of that portal, because, well, you want people to stay on your site and look for other games.

Now, I think that a some kind of iframe way of delivering games would help solve this problem greatly. I saw some games doing that, and they were often included on tutorial sites to show a live example, which is obviously a great thing.

So, is there a standard at all? Any suggestions? Can you create a game that just preloads itself in an iframe (I heard something about a "single document" or something)?

sentences:
Would it perform faster to split calculation between vertex and fragment shaders? Assuming the total amount of computation would be the same (at least as far as my code goes), would there be any performance increase in splitting the calculation and using separate vertex and fragment shaders vs. doing all the calculations in just a fragment shader?

In my use case, I would not be using vertex shaders as they are typically intended (so, not processing actual vertices). I just thought if the GPU hardware is set up such that the pipeline is expected to be used, would it be better to take advantage of that, or would it be just as fast to put it all in a fragment shader. Conceptually, it would be simpler to just use the fragment shader.

Note, that I do need a lot of data going to the fragment shader that is updated every frame (eg. texture buffer object).

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:
I have a Unity addon that generates noise via a shader. How can I use it besides just dragging it onto a mesh? I'm probably asking this question wrong. I'm using Turbulence Library to generate noise as shaders. What I want to do is take the noise generated by these shaders and apply them to Texture2Ds that I'm procedurally generating.

What I want to do is take the value of each pixel from the noise, then while procedurally generating a texture, use to determine how much I put another color "on top of" another color in a procedurally generated mesh. I would post an example picture, but I can't do that since I can only post one link with my reputation.

I strongly suspect that I will just have to write my own shader from scratch, but is there no way to just take noise from a shader and apply it to a Texture2D so I can continue to use the Standard shader?

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:
Problem getting mouse events while keys held down in SDL2 I'm attempting to write input capturing code using SDL2 on Windows.  However, I'm running into a problem.

Whenever a key is held down, the SDL event queue has no mouse movement, nor will the mouse move on my screen. Instead, The SDL event queue continually returns the key I am holding down as an SDL_KEYDOWN event.

Here is a simple example program which reproduces the problem exactly:

#include <SDL2/SDL.h>
#include <iostream>

int main(int argc, char** argv) {
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Window* window = SDL_CreateWindow("Moust Input Test", SDL_WINDOWPOS_UNDEFINED,
                                        SDL_WINDOWPOS_UNDEFINED, 640, 480,
                                        SDL_WINDOW_SHOWN);
  SDL_Event event;
  for(; ;) {
    while (SDL_PollEvent(&event)) {
      if (event.type == SDL_QUIT) {
        SDL_DestroyWindow(window);
        return 0;
      } else if (event.type == SDL_MOUSEMOTION) {
        int x, y;
        SDL_GetMouseState( &x, &y );
        std::cout << "Mouse moved to: " << x << " " << y << std::endl;
      } else if (event.type == SDL_KEYDOWN) {
        std::cout << "Code of key pressed: " << event.key.keysym.sym << std::endl;
      }
    }
  }
  return 0;
}

What I would expect to happen is that, when I hold down a key (for example, 'a'), it prints exactly once:

Code of key pressed: 97

And then, while they key is held down, if the mouse is moved, it prints every time the mouse is moved:

Mouse moved to: [wherever]

Instead, I'll keep seeing over and over again:

Code of key pressed: 97

And I will not get any mouse movement whatsoever on the screen, nor will I get my mouse movement log printed, until I release whatever keys I am holding down.

Anybody know how I can capture mouse movement while I have a key held down?

The only thing I can think of which could possibly be relevant is I am compiling with MinGW using:

g++ -Dmain=SDL_main test.cpp -o test.exe -L./lib/SDL2 -lmingw32 -lSDL2main -lSDL2 -mwindows -mconsole

Thanks.

Edit: I've also just noticed that the problem persists even when the window is minimized- if I am holding a key down in this text window while my program is minimized in another Window, the mouse stops working, though my program is not printing out the key code.

sentences:
Rope Colliding with a Rectangle I have my rope, and I have my rectangles.

The rope is similar to the implementation found here: http://nehe.gamedev.net/tutorial/rope_physics/17006/

Now, I want to make the rope properly collide with the rectangle such that the rope will not pass through a rectangle, and wrap around the rectangle and all that good stuff.

Currently, I have it set so no rope node can pass through a rect (successfully), however, this means a rope segment can still pass through a block. Ex:

So the question is, what can I do to fix this?

What I have tried:

I create a rectangle between two nodes of a rope, calculate rotation between the nodes, and get myself a transformed rectangle.

I can successfully detect a collision between rope segments and a (non-transformed) rectangle.

Create a new node or pivot point around the corner of the block, and rearrange nodes to point to the corner node. Trouble is determining what corner the rope segment is passing through. And then the current rope setup goes wonky (based on verlet integration, so a sudden change in position causes the rope to wiggle like a seismograph during a magnitude 8 earth quake.) Among other issues that might be solvable, but its turning into a case by case thing, which doesn't seem right.

I think the best answer here would just be a link to a tutorial (I simply can't find any, most lead to box2D or farseer, but I want to at least learn how it works before I hide behind an engine).

sentences: TTF fonts are being converted to image in CPU or GPU? Once I use a TTF font, when they are being converted to images to be rendered? Does CPU or GPU do the conversion? How heavy is that operation?

sentences:
Collision detection between a sprite and rectangle in canvas I'm building a Javascript + canvas game which is essentially a platformer. I have the player all set up and he's running, jumping and falling, but I'm having trouble with the collision detection between the player and blocks (the blocks will essentially be the platforms that the player moves on).

The blocks are stored in an array like this:

var blockList = [[50, 400, 100, 100]];

And drawn to the canvas using this:

this.draw = function() {
    c.fillRect(blockList[0][0], blockList[0][1], 100, 100);
}

I'm checking for collisions using something along these lines in the player object:

this.update = function() {
    // Check for collitions with blocks
    for(var i = 0; i < blockList.length; i++) {
        if((player.xpos + 34) > blockList[i][0] && player.ypos > blockList[i][1]) {
            player.xpos = blockList[i][0] - 28;
            return false;
        }
    }

    // Other code to move the player based on keyboard input etc
}

The idea is if the player will collide with a block in the next game update (the game uses a main loop running at 60Htz), the function will return false and exit, thus meaning the player won't move.

Unfortunately, that only works when the player hits the left side of the block, and I can't work out how to make it so the player stops if it hits any side of the block. I have the properties player.xpos and player.ypos to help here.

sentences:
Game states & passing data between scenes I'm not entirely sure if I'm doing this right, but I always considered the scene system in Unity as some sort of state management (rather than e.g. a level system) which allows to group the contents (entities, components) into the usual main states of the game (menu, ingame), which can then be invoked or replaced together.

Now I have a very specific concern and I have no clue how to deal with that in Unity, mostly because of it's abstractions from code and other restrictions:

My game features a procedurally generate terrain where as I'd like to tweak the generator before actually launching it. The tweaking is done in some sort of 'pre-game' state (as part of the main menu) where the values are stored in e.g. TerrainData model class. Usually in other engines, I'd to it like this:

Providing an UI within the menu state to tweak the parameters of the game
Storing the parameters in a view model (and data model)
Instantiate the ingame state (which requires said data model in the .ctor
Pass the data model to a generator and start the generation

Now, here are the main problems:

Most types in unity (scenes, monobehaviors) do not allow constructors because they use it for themselves
It doesn't seem possible to instantiate scenes manually (there's only e.g. Application.LoadLevel("") which only takes the name of the scene, not a instance reference etc.
it doesn't seem possible to pass data between scenes, without reverting to awkward workarounds such as singletons, playerprefs, DontDestroy etc. which are all not really suitable for this case.

So, how can I properly solve this? Is there a better way to manage states rather than scenes? Prefabs maybe?

Backlink to UntityAnswers question: http://answers.unity3d.com/questions/1149480/game-state-management-and-passing-data-between-sce.html

sentences:
Starting Couroutine in newly activated gameObject I'm working on a UI system that animates an element's properties using coroutines. Every element that should be animated has a component called AnimatedUIElement which provides the function Enter().
The function Enter() is basically starting coroutines depending on the chosen animation settings, but only after calling Enable(), which sets the gameObject active with gameObject.SetActive(true);, updates its component references and makes the element interactable.
AnimatedUIElement also defines an Exit() function acting similar, but disabling the element after the animation.

public class AnimatedUIElement : MonoBehaviour {
    private CanvasGroup canvasGroup;
    // ...

    public void Enter() {
        // ...
        TriggerEntry();
    }

    private void TriggerEntry() {
        PlayChildrenEntry(); // Calls Enter() on all animated Children
        Enable();
        StartCoroutine(SomeAnimation(...));
    }

    private void Enable() {
        gameObject.SetActive(true);
        Init();
        canvasGroup.interactable = true;
        canvasGroup.blocksRaycasts = true;
    }

    private void Init() {
        canvasGroup = GetComponent<CanvasGroup>();
        // ...
    }

    private IEnumerator SomeAnimation(...) { ... }

    public void Exit() {
        // Similar to Enter, but disabling the element
    }
}

Now I want to open the options panel by clicking a button in the game's UI. The panel is inactive (unticked) in the beginning, while the AnimatedUIElement component is enabled.

UI Hierarchy: Options Button calls Enter() on Options Panel.

The desired setup in the Button Component calling OptionsPanel.Enter() and MainPanel.Exit()

But clicking the button throws the following exception:

Coroutine couldn't be started because the the game object 'Main Menu Button' is inactive!
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
AnimatedUIElement:AnimatePosition(Vector2, Vector2, Single, AnimationCurve) (at Assets/Animated UI Elements/AnimatedUIElement.cs:265)
AnimatedUIElement:TriggerEntry() (at Assets/Animated UI Elements/AnimatedUIElement.cs:93)
AnimatedUIElement:Enter() (at Assets/Animated UI Elements/AnimatedUIElement.cs:73)
AnimatedUIElement:PlayChildrenEntry(Transform) (at Assets/Animated UI Elements/AnimatedUIElement.cs:219)
AnimatedUIElement:TriggerEntry() (at Assets/Animated UI Elements/AnimatedUIElement.cs:79)
AnimatedUIElement:Enter() (at Assets/Animated UI Elements/AnimatedUIElement.cs:73)
UnityEngine.EventSystems.EventSystem:Update()

In this stack trace you can see that the Options Panel did not start coroutines as no animation was defined in its component, but called Enter() on its children, which are animated.

Using debug logs I found out that, while Init() is called immediately after Enter(), Awake() is called after the coroutines (which happen later in the program flow) throw errors. This makes it seem like the object is not available instantly after calling setActive(true).

Is there an explanation and possibly a fix for this behavior?

sentences:
How do C# and UnityScript differ in Unity development? Other than the obvious language differences, how do UnityScript and C# differ when developing games in Unity3D?

Is there a noticable performance difference?
Is the UnityScript code packaged as-is? If yes, does this help the game's moddability?
Is it possible to use libraries developed for one language while developing in the other one?
Can the two languages be mixed in the same Unity project; coding some parts in C# and others in UnityScript?

sentences:
How stoper one annimation model on XNA? I do not understand how to pause an animation of XNA. I can "Start" the animation of my model but not stop it. I use SkinningSample_4_0 sample dll

Here is my code to use.

Here is my code to use.

    protected override void LoadContent()
        {
            //Model - Player
            model_player = Content.Load<Model>("Models\\Player\\models");
            // Look up our custom skinning information.
            SkinningData skinningData = model_player.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["ArmLowAction_006"];

            animationPlayer.StartClip(clip);

}

protected overide update(GameTime gameTime)
{
            animationPlayer.Update(gameTime.ElapsedGameTime, true, Matrix.Identity);
            KeyboardState key = Keyboard.GetState();

            //  If player don't move -> stop anim
            if (!key.IsKeyDown(Keys.W) && !keyStateOld.IsKeyUp(Keys.S) &&           !keyStateOld.IsKeyUp(Keys.A) && !keyStateOld.IsKeyUp(Keys.D))
            {
                //animation stop ? not exist ?
                animationPlayer.Stop();
                isPlayerStop = true;
            }
            else
            {
                if(isPlayerStop == true)
                {
                     isPlayerStop = false;
                     animationPlayer.StartClip(Clip);
            }
}

sentences:
Spine runtime for libgdx clipped rendering issue I've started to play with the Spine for libgdx runtime in Java.

But I can't seem to render without some sort triangular clipping.

The code is based on the Spine examples:

public class AnimalTest extends ApplicationAdapter {

   OrthographicCamera camera;
   PolygonSpriteBatch batch;
   SkeletonRenderer renderer;

   TextureAtlas atlas;
   Skeleton skeleton;
   AnimationState state;

   public void create () {

      camera = new OrthographicCamera();

      batch = new PolygonSpriteBatch();

      renderer = new SkeletonRenderer();

      atlas = new TextureAtlas(Gdx.files.internal("animals/Animals.atlas"));
      SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.

      SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("animals/Animals.json"));

      skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
      skeleton.setSkin("5");

      skeleton.setX(1000);
      skeleton.setY(-400);

      AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines mixing (crossfading) between animations.

      state = new AnimationState(stateData); // Holds the animation state for a skeleton (current animation, time, etc).

      state.setAnimation(0, "idle", true);
   }

   public void render () {

      state.update(Gdx.graphics.getDeltaTime()); // Update the animation time.

      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

      state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
      skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.

      // Configure the camera, SpriteBatch, and SkeletonRendererDebug.
      camera.update();
      batch.setProjectionMatrix(camera.combined);

      batch.begin();
      renderer.draw(batch, skeleton); // Draw the skeleton images.
      batch.end();

   }

   public void resize (int width, int height) {
      camera.setToOrtho(false);
   }

   public void dispose () {
      atlas.dispose();
   }

}

sentences:
Java 2D Game Hitbox Detection & Rounded Corners I am working on a simple 2D game with Java, Swing and no framework. I have a rectangular player that the user can move around. On the map are few obstacles which the player should not be able to go through. I did this by making a new Rectangle Object for the player and each obstacle with their bounds. But I’m not really sure if this is the right way to do it. It works but the movements of the player are not really user friendly. If the player wants to pass two obstacles they must be on the perfect coordinates to pass.

Is it even a good idea to check for intersections between the player and the obstacle with a Rectangle object or should I do it another way?

Now for my 2nd question:
I’d like to replace the rectangular hitboxes with the same hitbox but with rounded corners so the player could pass more easily.

This is what the game looks like with hitboxes enabled.

The code that checks if the player and the obstacles have yet intersected:

for (Player p : this.getPlayerArray()) {
    Rectangle recPlayer = p.playerBounds();
        for (Obstacle kiste : obstacleArray) {
            Rectangle recKiste = kiste.obstBounds();

            if (recPlayer.intersects(recKiste)) {
                p.setX(100); //Not actual code here
            }
        }
}

The function that returns the hitbox of the player / obstacle:

public Rectangle obstBounds() {
    return new Rectangle(this.getX(),
    this.getY(), image.getImage().getWidth(null),
    image.getImage().getHeight(null));
}

sentences:
LibGDX full screen display mode and camera resize I'm creating a simple 2D platformer and I have problem with my camera y position when I enter full screen mode. But first here's my code

screenY = Gdx.graphics.getHeight();

public void updateCamera(){
        camera.position.x += (player1.getHitBox().x - camera.position.x);
        if(screenY < player1.getHitBox().getY() && player1.getHitBox().getY() > (screenY - Gdx.graphics.getHeight())){
            screenChanger++;
        }else if(player1.getHitBox().getY() < (screenY - Gdx.graphics.getHeight())){
            screenChanger--;
        }
        screenY = Gdx.graphics.getHeight() * screenChanger;
        camera.position.y = (screenY - screenY/2);
        camera.update();

        System.out.println(Gdx.graphics.getHeight() + " " + screenY);
    }

So here's my results:
1) When I start the game all works fine

2) But when I enter to fullscreen here what I get

3) here how it looks when I zoom out my camera

sentences:
Strange momentum on projectiles shot out of "parent" object I'm trying to shoot a projectile out of a moving "parent" object. Both objects move off of rigidbody physics, so I'm using addforce for the projectile.
Whenever I move the "parent" object and turn while it's moving and shoot the projectile, I instantiate the projectile, copy the projectile spawn position to the projectile's position, copy the rotation of the "parent" to the projectile, then add force to the projectile.
It'll shoot but I notice it moves in the direction of the momentum of the "parent" rather than straight forward from where it was created. I'm pretty sure this is just me not understanding how rigidbody physics works for adding force but if anyone has any suggestions as to how to make the projectile move straight forward from where it's created rather than copying the momentum of the parent I'd appreciate it greatly.
My code for moving and creating a projectile looks like this:
void FixedUpdate()
{

    if (Input.GetKey(KeyCode.W))
    {
        //player.transform.Translate(Vector3.forward * 10f * Time.deltaTime);
        this.GetComponent<Rigidbody>().AddForce(transform.forward * 15);
    }
    if (Input.GetKey(KeyCode.S))
    {
        this.GetComponent<Rigidbody>().AddForce(transform.forward * -15);
    }
    if (Input.GetKey(KeyCode.A))
    {
        transform.Rotate(Vector3.up * -15 * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.D))
    {
        transform.Rotate(Vector3.up * 15 * Time.deltaTime);
    }
}

void ShootBullet()
{
    //create bullet GameObject
    bullet = Instantiate(bulletPrefab);

    //set location where bullet will spawn from
    bullet.transform.position = bulletSpawn.position;

    //set direction of the bullet
    bullet.transform.rotation= bulletSpawn.transform.rotation;

    //add force to the bullet
    bullet.GetComponent<Rigidbody>().AddForce(bulletSpawn.forward * bulletSpeed, ForceMode.Impulse);

    //destroy bullet after x time
    Destroy(bullet, lifeTime);
}

sentences:
LibGdx Positioning the camera I've been following some tutorials about libGdx and I've tried to create a 2d platformer but I've got stuck at how would be the right way to make the camera not go out of the screen when the player moves :(
The camera follows the player when it moves on the x coordinate position but if i go near where the map ends the camera will go out of the screen  and i'm not sure how to solve that

Here is the main code of the game:

public PlayScreen(SuperShooter game){
        this.game = game;
        atlas = new TextureAtlas("Diz_Pack.atlas");
        gamecam = new OrthographicCamera();
        gamePort = new StretchViewport(SuperShooter.V_WIDTH / SuperShooter.PPM, SuperShooter.V_HEIGHT / SuperShooter.PPM, gamecam);

        hud = new Hud(game.batch);
        mapLoader = new TmxMapLoader();
        map = mapLoader.load("Level1WithObjects2.tmx");
        renderer = new OrthogonalTiledMapRenderer(map, 1/SuperShooter.PPM);
        //initailly set our gamecam to be centered correctly at the start of
        gamecam.position.set(gamePort.getWorldWidth()/2 , gamePort.getWorldHeight()/2, 0);

        world = new World(new Vector2(0,-10), true);

        new B2WorldCreator(world, map);

        controller = new Controller(game);

        // b2dr = new Box2DDebugRenderer();
        player = new John(world, this);

        world.setContactListener(new WorldContactListener());

    }

public void update(float dt){
        handleInput(dt);
        world.step(1/60f, 6, 2); // in order for box2d to execute our physics simulation we need to tell it how many times to calculate per second
        player.update(dt);
        gamecam.position.x = player.b2body.getPosition().x;
        gamecam.update();
        renderer.setView(gamecam);
    }

public void render(float delta) {

        update(delta);
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        renderer.render();
        //render our Box2dDebugLines
        //b2dr.render(world, gamecam.combined);

        game.batch.setProjectionMatrix(gamecam.combined);
        game.batch.begin();
        player.draw(game.batch);
        game.batch.end();

        game.batch.setProjectionMatrix(hud.stage.getCamera().combined);  //you have something that can draw to the screen via gpu like the spritebatch. And you have a camera.
        //you gotta tell the spritebatch where we are / where the camera is looking, because on screen shall be what the camera is looking at.
        hud.stage.draw();
        controller.draw();

    }

The camera is at first set on the left bottom of the screen but then, while the game updates it's placed on the x position of the player and that's why it looks like that:( do you guys know how should it be done to show only the map when the player moves? should i position the camera in front of the player or something like that?

Help would be appreciated! thanks

sentences:
Does using the XNA Content Pipline eliminate the overhead caused by file IO when working with a large number of files? I'm working on a game in XNA with my goal being that it is fairly data driven so that I can easily tweak the system without having to update code. The research I've done shows that using XML files combined with the content pipeline should provide me with what I need to accomplish this.

That being said, being a developer that really has only been exposed to object oriented programming I have this "one class per file" mindset that I really like because it makes finding and updating what I want to change very easy. This leads me down a path of wanting to set up a system where instead of a large, heavily nested XML file that defines everything (like the web.config files I am used to), I want to go with a folder structure with files that define individual objects - or at the very least something in between. At this point in time I'm not entirely sure how many files I could end up having but I believe it could escalate to a point where it could cause a performance problem if done wrong and if I discover a performance problem because of it, redesign and consolidation of it all could be a big enough chore that I definitely want to try my best to make the right decision up front.

Usually I would see the above mentioned approach being a big performance hog because of the large amount of file IO that would have to be done when loading up the game. Based on my experience with images in the content pipeline, I am assuming that XML files are also combined into a single XNB file when compiled. From this my questions become:

If it is true that all XML files become a single XNB file should I still expect a notable performance loss when loading the data from these "files" or has that overhead disappeared since its all within a single XNB file?

If yes I am sure there tools out there that can make managing / updating a single and very large XML file more manageable which I will begin researching and am open to suggestions on.

sentences:
Why should a FPS game use a "floating arms" approach over full body one? I've seen many first person shooter games both single and multiplayer using a set of floating arms and a gun instead of using the whole body model.

What is the advantage of floating arms? You are technically doubling the work making two meshes and two animations for each action.

sentences:
Handling sound effects for Multiple Collisions How can I generate somewhat realistic sound effects for collisions in a physics engine that simulates lots of objects?

E.g. take >10 marbles that are bouncing off walls and off each other.

If I generate a sound for each collision I would quickly overload the system (Windows Phone 7).

Is there an algorithm that lets me combine multiple collisions to create fewer sound effect instances?

sentences:
Pathfinding in 3d voxel: waypoints? I have an application where I have a 3d collision voxel space (passable or non-passable at each point) and I want to plot a short unobstructed path between two points.  There are no gravity constraints, so the shortest unobstructed path is a straight line between two points.

I know that A* can be generalized to 3-space, but this is a bit slow for my purposes.  In my particular application, the collision space changes infrequently and there is a finite number of permutations, so what I'd like to do is automatically pre-process the voxel and generate a set of 'waypoints' with the following properties:

Each waypoint has a set of connected waypoints; the straight line path between any two connected waypoints is unobstructed.
For every passable point in space, there is an unobstructed straight line path to at least one waypoint.  I'll probably store a lookup table to make this easy to find.
Ideally, the waypoints are generated so that the paths are still reasonably close to optimal, but I don't need to find the absolute optimal path.

If it's relevant, my collision space mainly consists of a few large contiguous 'blobs'; all empty spaces should be accessible, but the 'blobs' do have concave areas and holes allowing passage.  Also, since I'm precomputing this, I can live with relatively long running times (though I'd prefer an upper bound of minutes, rather than hours or days.)

Is there a well-known algorithm for doing this?  My first thought is some sort of repeated A* for random point pairs and looking for 'choke points' (regions through which a lot of paths go), but I'm guessing this is a problem that has already been studied.

sentences:
Some OpenGL code not working, but some is I'm just starting out using GLEW and GLFW in a C++ project for my rendering code, but I'm having trouble actually getting anything to render.

I know OpenGL is working in some capacity, because I am able to change the background colour, but nothing else is working beyond that.

I'm setting up the OpenGL context with this code:

    //Attempts to initiate GLFW. If it doesn't, it returns immediately
    if (!glfwInit()) {
        fprintf(stderr, "Failed to initialize GLFW\n");
        return;
    }

    //glfwWindowHint(GLFW_SAMPLES, 4); // 4x antialiasing
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // We want OpenGL 3.3
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL

    window = GLFWwindowPtr();
    window.reset(glfwCreateWindow(width, height, windowTitle, NULL, NULL), DeleteWindow);

    if (window.get() == nullptr) {
        fprintf(stderr, "Failed to open GLFW window\n");
        glfwTerminate();
        return;
    }

    glfwMakeContextCurrent(window.get());

    glewExperimental = GL_TRUE; // Needed in core profile
    int errorCode = glewInit();
    if (errorCode) {
        printf("%i", errorCode);
        fprintf(stderr, "Failed to initialize GLEW\n");
        return;
    }

    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glfwSwapBuffers(window.get());

A little while after that in my main loop, I call this code every frame:

float ratio;
int width, height;

glfwGetFramebufferSize(WindowHandler::getMainWindowGLPointer(), &width, &height);
ratio = width / (float)height;
glViewport(0, 0, width, height);
glClearColor(red / 255, green / 255, blue / 255, 1.0);
glClear(GL_COLOR_BUFFER_BIT);

Now this code works. I'm incrementing the red, green and blue variables every frame so that I can check that OpenGL is working as a whole and I see the background colour change.

However, when I put the following code after it, I'm seeing nothing different appear.

glBegin(GL_QUADS);              // Each set of 4 vertices form a quad
glColor3f(red/255, green/255, blue/255); // Red
glVertex2f(-0.5f, -0.5f);    // x, y
glVertex2f(0.5f, -0.5f);
glVertex2f(0.5f, 0.5f);
glVertex2f(-0.5f, 0.5f);
glEnd();

I used the code from an existing example found on https://www3.ntu.edu.sg/home/ehchua/programming/opengl/CG_Introduction.html so I had a better chance of it being something in my implementation and not me messing up trying to write OpenGL code.

sentences: Rotate relative to set point in a specified direction in a 3D space I know there's a geometry formula to calculate the next point in rotation relative to another point in 2D but I'm working in 3D and I want to calculate the next position in specified direction as well. Think Spiderman or the Bloodstalkers from ARK. I'm working in a game engine that uses the basic {x = 1, y = 2, z = 1} for vectors. I'm pretty bad at math so I honestly can't figure this out myself.

sentences:
How to fix double click problem in this code? Please see the gif below to better understand what's going on.

On first click they all work normally but after first click I have to double click them to select them. I'm not a advanced developer so I've been trying to figure this out for straight 2 hours and last choice I wanted to ask you guys.

I declared select effect here. (White circle) And added an Array to get all select effects.

    public GameObject selectEffect;
    private bool isSelected = false;
    public GameObject[] selectEffectArray;

I put them inside the Array.

    private void Awake()
    {
        selectEffectArray = GameObject.FindGameObjectsWithTag("planetSelected");
        selectEffect = transform.Find("selectEffect").gameObject;
    }

I deactivate all select effects on start.

    void Start()
    {
        Deactivate();
    }

Here's Deactivate code.

    void Deactivate()
    {
        foreach (GameObject effect in selectEffectArray)
        {
            effect.SetActive(false);
        }
    }

When I click one of the planets these happens. (I'm a little confused so I hope you can understand it.)

    void OnMouseUp()
    {
        if (isSelected)
        {
            selectEffect.SetActive(false);
            travelbutton.SetActive(false);
            isSelected = false;
        }
        else
        {
            Deactivate();

            planetName_text.text = planet.name;
            requiredFuel_text.text = planet.requiredFuel.ToString();
            travelbutton.SetActive(true);
            selectEffect.SetActive(true);
            isSelected = true;
        }

    }

I don't want to double click a planet to select it.

sentences: Export session variables easily and permanently in php I feel like I must be missing something simple, or misunderstanding sessions or cookies. I want to save all session variables and allow players to copy/paste a long string to load the game up from a different computer or give to someone else, much like in Cookie Clicker or Adventure Capitalist etc. There is no need for sql, or for any kind of security; people can "cheat" if they want to.

sentences:
unity4.3 rigidbody2d unexpected force behaviour So guys ive edited the question and here is what my problem is i have a player which has a rigidbody2d attached to it.my player is able to doublejump in the air nicely and stick to walls when colliding with them and slowly slides to the ground.All movement is handle through physics and no transform manipulations.here i did something similar to this in the FixedUpdate of my player.

    void FixedUpdate()
    {
     if(wall && Input.GetButtonDown("Jump"))
      {
       if(facingright)//player is facing the left side of the wall
        {
         rigidbody2D.Addforce(new vector2(-1f,2f)*jumpforce);
         /*Now the player should jump backwards following this directional vector and
   should follow a smooth curve which in this part works well*/
        }
       else
       {
        rigidbody2D.Addforce(new vector2(1f,2f)*jumpforce);
        /*Now this is where everything gets complicated as you should have noticed
          this is the same directional vector only the opposite x axis value
        and the same amount of force is used but it behaves like the red curve
        in the  picture below*/
       }
      }
    }

bad behaviour  and vector in red

.I tested the same thing(both addforce methods) for a simple jump and they exactly behave like mentionned above in the picture.so here is my problem.Jumping diagonally forward with rigidbody2d.addforce() do not have the same impact,do not follow the same curve as jumping the opposite direction with the same exact amount of force.if i could fix this or get past this i could implement a walljump system like a ninja jumping in zigzag between two opposite wall to climb them.Any ideas or alternatives?

sentences:
How to increase drag sensitivity while dragging distance is less than a certain value I built a inventory hotbar wheel for mobile controls. The wheel can be accessed if I put my finger on a specific "hitbox" on the right side of the screen and drag left. The result looks like this.

I haven't added in item icons and such, but the black stain things are going to be the outlines of the items, and there will be item icons in the middle of them. As you can see, the larger, darker outline is the active item (the one that will be used/equipped from the inventory). I have coded the script for the inventory so that the active item will be 3 slots away from the right side of the screen.
This is the script
public class Quick_Acces_Slider : MonoBehaviour, IDragHandler, IPointerUpHandler, IPointerDownHandler
{
public Image quickAccessSlider;
public Canvas canvas;

public float slotDistance;
public float[] slotPosition;
public float trueOffset;
public float offset;

public float canvasWidth;

public Vector2 originalPosition;
public Vector2 position;

public float slideDistance;
public float slideCap;

public float scrollSpeed;

// Start is called before the first frame update
void Start()
{
    canvasWidth = canvas.GetComponent<RectTransform>().rect.width;
}

public void OnPointerDown(PointerEventData drag)
{
    originalPosition = drag.position;

    slotPosition = new float[quickAccessSlider.transform.childCount];
    slotDistance = 1f / (slotPosition.Length);

    offset = trueOffset * slotDistance;

    for (int i = 0; i < slotPosition.Length; i++)
    {
        slotPosition[i] = ((i * slotDistance) + (slotDistance/2)) + offset;

        if (quickAccessSlider.transform.GetChild(i).gameObject.activeInHierarchy)
        {
            slideCap = slotPosition[i];
        }
    }

    OnDrag(drag);
}

public void OnDrag(PointerEventData drag)
{
    position = originalPosition - drag.position;

    slideDistance = Mathf.Clamp(((position.x / canvasWidth) * 2f), 0f, slideCap);

    for (int i = 0; i < slotPosition.Length; i++)
    {
         //Scale active objects, change color, etc
    }

    quickAccessSlider.rectTransform.anchoredPosition = new Vector2(slideDistance * -quickAccessSlider.rectTransform.rect.width, quickAccessSlider.rectTransform.anchoredPosition.y);
    }
}

public void OnPointerUp(PointerEventData release)
{
    Array.Clear(slotPosition, 0, slotPosition.Length);
    originalPosition = Vector2.zero;
    position = Vector2.zero;
    slideDistance = 0;
}

}
The inventory slider is set up so that there is a rectangular panel, with the item slots as its children, and the pivot point of the panel is the right side of the screen, as such:

Essentially, right now, because I have the offset value which makes the active object the one that is 3 slots from the right side, I actually have to swipe a certain amount before I can get to the first active item.
I want to make it so that the slider is more sensitive to drag while the slide distance is less than the offset value, so that I don't have to drag as mush to get to the active item. I also want the effect to work in the reverse scenario, where I am trying to stow the slider (dragging toward the right of the screen).
I've tried a few methods such as where I tweak the slideDistance while it is less than the offset, or where I try to Lerp the slideDistance value to the offset value, but none of them seem to work due to a few reasons.
The main reasons my solutions didn't work was because the slideDistance value needs to be equal to the offset value once I'm done tweaking the value/it is not longer less than the offset value to prevent jittery movement, and because I need the increased sensitivity to work both ways, when dragging left and also dragging right.

sentences:
Are OpenGL Textures more memory efficient than Android Bitmaps? I have a custom application that deals with many Bitmaps tiles that are 256x256 images (png,jpg). I'm currently using the View 2d canvas and bring in all images as RGB_565. Although I'm generally happy with the applications performance, I have features I'd like to add that will require even more map tiles (Bitmaps). I've been thinking about using opengl ES 2.0 but am fairly new to it.

Would opengl Textures be more memory efficient than keeping Bitmaps
around? I assume you can load a Bitmap into a Texture and then
dispose of the Bitmap
Is it an acceptable practice in opengl to dynamically load many
different Textures at runtime?
Do you need to cache Textures or does the GPU handle that for you?

sentences:
How do I make a doorway going into the next scene? I new to GDevelop and I use it on a Chromebook.
I'm making this game that I'm kind of proud of! I've found a way to teleport players to the next scene, by just putting the condition, then just make the event: Open url (and then the link of the scene I want the player to travel to). When I use the method I am using now, The game keeps opening tabs of different scenes! And, when I try going back to a tab, It creates like, eight new tabs! It is probably just a glitch. I go to the events section then I set the action to be: open url or file: And then the link of the next scene. I would just like to find a better way.
Can I get a javascript code to make the player teleport when it touches the door or the teleporter?
I would really like to find a BETTER way to teleport the player.

sentences:
How to efficiently keep the player from moving outside the gameobject he is colliding with? I am developing a game with Unity 2017.
The game mechanics are as follow:

Classic top-down RPG;
Movements are: UP, DOWN, LEFT and RIGHT;
Player evolves in a 16*16 map;
He can dig in the direction he wants to make his way through the map one tile at a time;

At first I was using a very classical approach using tilemaps, RigidBody2D and BoxCollider2D on tiles and the player GameObjects.

Collision detections went fine and my tilemap looked pretty much like that (red being the walls and white the empty spaces):

The problem with this approach is that I have to keep in memory the state of 256 tiles in a List<Vector2f> and to create the 256 expected GameObjects representing either my walls (which a totally black), or my floor (the empty space).

Creating a black GameObject with its own BoxCollider2D for each of the tile seems a little bit overkill. And this brings me to the second iteration of my game: to keep in memory only the tiles the player digged.

What I would like to achieve efficiently, is to let the player evolve as long as he is colliding with an underlying tile, but stop moving as soon as he doesn't.

This is ok:

This isn't, and player should be placed to previous state.

I could take advantage of OnTriggerEnter2d and handle custom collision and response, but I have the feeling that something more simple and more optimized may exists somehwhere in the wild!

Thanks to any help provided!

sentences:
character and camera not moving in the same speed the two scripts below do the similar things,
 get the key press and calculation the direction
after the direction calculated, they multiple with the same speed,  say 0.05f,
while the character and the camera, do not move at the same speed,
and the character move faster than the camera.
if i rotate the camera a bit and move the character, the character move even faster than camera.
i believe there are something wrong in the variable direction, i would like to like how can i fix it so that both of them can move at the same speed in every direction.
Thank you.

character movement script:

    animation.CrossFade("moving");
        direction = Vector3.zero;
        myposition= transform.position;

    if(Input.GetKey("i")) {
        animation.CrossFade("moving");
        direction += Vector3.forward;
        currentkeydown=true;
    }
    if(Input.GetKey("k")){
        animation.CrossFade("moving");
        direction += Vector3.back;
        currentkeydown=true;
    }

if(Input.GetKey("j")){
       animation.CrossFade("moving");
       direction += Vector3.left;
       currentkeydown=true;
    }

if(Input.GetKey("l")){
    animation.CrossFade("moving");
    direction += Vector3.right;
    currentkeydown=true;
}

       //if two key press
if(Mathf.Abs(direction.x)+Mathf.Abs(direction.y)+Mathf.Abs(direction.z)>1){
          direction.x/=2;
          direction.y/=2;
          direction.z/=2;
         }

         //if direction change
         if (direction != Vector3.zero) {
             direction = Quaternion.Euler(0.0f, Camera.main.transform.localEulerAngles.y, 0.0f) * direction;
             transform.rotation = Quaternion.LookRotation(direction);
         }

         if(currentkeydown){
          transform.position+=direction*speed;
         }

and camera script

if(Input.GetKey("i")) {

         direction += Vector3.forward;
         currentkeydown=true;
       }

       if(Input.GetKey("k")){
         direction += Vector3.back;
         currentkeydown=true;
       }

       if(Input.GetKey("j")){
         direction += Vector3.left;
         currentkeydown=true;
       }

       if(Input.GetKey("l")){
         direction += Vector3.right;
         currentkeydown=true;
       }

       if(Input.GetKey("u")){
         transform.RotateAround(player.transform.position,Vector3.up,-2f);
       }
       if(Input.GetKey("o")){
         transform.RotateAround(player.transform.position,Vector3.up,2f);
       }

       direction = transform.TransformDirection(direction);
       direction.y = 0;
       if(currentkeydown){
         if(Mathf.Abs(direction.x)+Mathf.Abs(direction.y)+Mathf.Abs(direction.z)>1){
          direction.x/=2;
          direction.y/=2;
          direction.z/=2;
         }
       transform.position+=direction*speed;
       }

sentences:
In Godot, how to make a Kinematic body affectable by rigid bodies? Background Info

I'm currently following the FPS tutorial from the official site. By the end of Part 1, there is a Player object implemented as a KinematicBody and controlled by player input, and a few cubic blocks scattered around, implemented as RigidBodies. The KinematicBody is moved with the move_and_slide function that takes static colliders into account, so the player is able to stand on the floor and bump into walls.

However, the player can't bump into or stand on the cubes. If you attempt to jump onto a cube, it will slide from under you. If you try to push a cube into a wall, it will glitch around a little, then slide away, without even slowing you down. The cubes have no power to stop the KinematicBody from moving through them.

Question

How can I change the behaviour to make it possible for a KinematicBody to stand on a RigidBody?

sentences:
2D snake game ( how to rotate snake's head with movement ?) I want to know:

how to rotate snake's head with movement
how to make tail prefabs (body) follows head direction.

public class Snake : MonoBehaviour {

    bool ate = false;
    bool isDied = false;
    public GameObject tailPrefab;
    Vector2 dir = Vector2.right;
    List<Transform> tail = new List<Transform>();

    void Start ()
    {
        InvokeRepeating("Move", 0.3f, 0.1f);
    }

    void Update () {
        if (!isDied) {
            if (Input.GetKey (KeyCode.RightArrow))
            {
                dir = Vector2.right;
                //transform.rotation=Quaternion.Euler(0, 0, 180);
            }
            else if (Input.GetKey(KeyCode.DownArrow))
            {

                dir = -Vector2.up;
                //transform.rotation = Quaternion.Euler(0, 0, 90);
            }
            else if (Input.GetKey(KeyCode.LeftArrow))
            {

                dir = -Vector2.right;
                //transform.rotation = Quaternion.Euler(0, 0, 0);
            }
            else if (Input.GetKey(KeyCode.UpArrow))
            {

                dir = Vector2.up;
                //transform.rotation = Quaternion.Euler(0, 0, 270);

            }
    }

    void Move() {
        if (!isDied) {
            Vector2 v = transform.position;

            transform.Translate (dir);

            if (ate) {
                GameObject g = (GameObject)Instantiate (tailPrefab,
                                  v,
                                  Quaternion.identity);

                tail.Insert (0, g.transform);

                ate = false;
            } else if (tail.Count > 0) {
                    tail.Last ().position = v;

                    tail.Insert (0, tail.Last ());
                    tail.RemoveAt (tail.Count - 1);
            }
        }
    }

    void OnTriggerEnter2D(Collider2D coll) {
        if (coll.name.StartsWith("Food")) {

            ate = true;

            Destroy(coll.gameObject);
        } else {
            isDied = true;
        }
    }
}

sentences: Do Java and Actionscript use OpenGL? As far as I know there are only 3 base graphics libraries on Windows, the GDI, OpenGL and DirectX, is that correct, so that means that Java, Actionscript and all language use one of these 3 libraries if they are to display graphics, or maybe Java has it's own graphics library/API?

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

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

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

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

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

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

sentences:
What are .fxo and .cod files for? I've been reading about shaders and looking at code. I found this in the code I'm looking at and it obviously has "Basic.fxo" there.

BasicFX = new BasicEffect(device, L"FX/Basic.fxo");

Now my question is what the file is for? I look in the folder and there is Basic.fx, Basic.fxo, and Basic.cod. I'm familiar with Basic.fx that's the shader? So I took out the .fxo and .cod reran the program and it just regenerated the files? What are the .cod/.fxo files for? Where do they come from? What do they do?

sentences:
Create.js CPU High load I'm new in Create.js and I'm trying to make countdown progress bar.

I have this simple code:

var stage = new createjs.Stage("timerCanvas");

stage.canvas.width = document.getElementById('timerProgress').offsetWidth;
stage.canvas.height = document.getElementById('timerProgress').offsetHeight;

var square = new createjs.Shape();
square.graphics.beginFill('red').drawRect(0, 0, stage.canvas.width, stage.canvas.height);

stage.addChild(square);

createjs.Tween.get(square, { loop: false }).to({ scaleX: 0 }, 90000);

createjs.Ticker.timingMode = createjs.Ticker.RAF;
createjs.Ticker.addEventListener("tick", stage);

My canvas width is 1920px and height 5px.
My CPU average load is 20%, when this script runs...

I think it is high load, for such simple script. Am I right?
If I am, What I'm doing wrong?

sentences:
How do I pause Andengine, but still get input? In my game when I pause the game, I'd like to display three options (Resume, Restart and Menu) so I did this after calling mEngine.stop():

Sprite resume = new Sprite(CAMERA_WIDTH/2, CAMERA_HEIGHT/2, RM.resume, vertex){
            @Override
            public boolean onAreaTouched(TouchEvent event, float pTouchAreaLocalX, float pTouchAreaLocalY) {
                if(event.isActionDown()){
                    this.setScale(1.1f);
                    Log.i("Click","Click");

                }

                return super.onAreaTouched(event, pTouchAreaLocalX, pTouchAreaLocalY);
            }
        };

But the Log "Click" never display. So I tried to do this with the Engine active and the Log displays correctly.

How can I stop my game (Modifier, Physics, Score) without using the mEngine.stop() method ?

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:
Different textures inside and outside a cube in DirectX 11 I want different textures for the outside and inside of a box (cube).
The image below shows what I want to achieve. It is kind of an open box, where we can see a different texture inside:

I was trying to solve it by checking whether the normal of the face is point towards the view or to inside the screen, that is we are seeing the "back" of the face.
I was also looking into cube mapping, but it does not seem to be the way.
What method should I use to achieve that result?

sentences:
Which technique should I use to create procedurally generated planets I am working on a personal project to create a game, in which you can fly in space to various planets and land on said planets.
I was originally using a script to create an IcoSphere which I stored using recursive chunks which worked as a LOD.
The results looked good from space, however, after creating a player on the planet, the triangles were still very large. The IcoSphere was only subdivided 5 or 6 times due to the lengthy processing times.
I was going to base the texturing of the magnitude of the point on the sphere taking into account various factors.
Is there a better method to generate planets without these processing times?
EDIT
I am only interested in generating the planet surface, not the positioning in the galaxy/universe
I have done research online into different techniques. I've seen people using cube spheres however that looked to have caused a lot of distortion around the corners. I've also seen Octohedrons which were subdivided but I think that'd give the same problems as my icosphere technique

sentences:
Divert gameobject around mesh surface I am trying to find a way to divert a vector3 position around the surface of a mesh which doesn't have a collider. I have a function (found online) that calculates the closest position on the surface of the mesh but it only works if the position is outside the mesh.

In the diagram below, the red arrow represents whats currently happening. It works great when it's outside the mesh and will give a position on the surface of the mesh, but once it moves forward and enters the mesh, it just keeps walking straight. The green line shows what i would like to happen.

sentences:
Recenter User Orientation on X and Y axis on with Oculus GO and Unity I am working on an Oculus GO App for patients in a doctors chair. They'll be using Oculus GO Headsets while sitting, lying, or something in between. So what I am trying to do is to recenter the HMD orientation when the HMD is mounted. But since the patients position can be seated or lying horizontally, I will need to recenter the rotation on all three axis, or at least X and Y.

Unity provides:

UnityEngine.XR.InputTracking.Recenter();

But that will only recenter the Y Axis.

Oculus Integration provides:

OVRManager.display.RecenterPose();

But under the hood its just using the Unity InputTracking.Recenter() again.

So how can I recenter my whole scene or the player on y-axis as well?
If you go to Oculus GO main menue and push the recenter button on your controller, it does exactly what I want. However I can't find a way to do the same thing in my Unity application.

Thanks in advance!

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:
Unity - How to save variables for Android Game? This is my current code, it only work into unity, when i test it in an Android Device it don't save the variable

public class Click : MonoBehaviour{

public UnityEngine.UI.Text proiettiliTotali;
public UnityEngine.UI.Text bpc;
public float proiettili = 0.00f;

void OnEnable(){
        proiettili = PlayerPrefs.GetFloat("Player Score");
}

// Update is called once per frame
void Update () {
    proiettiliTotali.text = ConvertiroreProiettili.Instance.GetCurrencyInString(proiettili, false, false);
    bpc.text = ConvertiroreProiettili.Instance.GetCurrencyInString (proiettiliOgniClick, false, true);
}

public void Clicked () {
    proiettili += proiettiliOgniClick;
}

void OnDisable(){

    PlayerPrefs.SetFloat("Player Score", proiettili);
    PlayerPrefs.Save ();
    Debug.Log (proiettili);
}

sentences:
Why are 16×16 pixel tiles so common? Is there any good reason for tiles (e.g. Minecraft's) to be 16×16?

I have a feeling it has something to do with binary because 16 is 10000 in binary, but that might be a coincidence.

I want to know is because I want to make a game with terrain generation, and I want to know how big my tiles should be, or if it doesn't really matter.

sentences:
Howdo I create differently sized texture atlases for different screen sizes? I am beginning game development and using texture atlases.
I've created textures based on the resolution 1920x1080, so I created a 1024x1024 size Texture Atlas for storing multiple graphics.

If the game is played on a 800x480 size device, the atlas will be very big to load in memory. An atlas of 512x512 would be enough and on devices with 480x320 resolution the game might not even work due to the different texture size.

How can I resize the atlas to save memory? Can I use different texture atlases for different screen sizes?

I just want to know how other game devs do it?

sentences:
Changing the duration of motion state transitions in Animator Controller Anyone around who is experienced with Unity animation states and the Animation Controller? I wonder is it possible in Unity to change the duration of time it takes between motion transitions in the Animator Controller?

To give an example let's say I have a human character that has an initial state of Grounded and in this state I have several motions like idle, running forward/backward and strafe left/right. When I now have the character in idle and I move left/right to go into strafe motion, the duration of the transition from idle to strafe left/right takes too long and I want it to be faster. I only want that transition between the motion states to be faster but not the actual animation itself. I think there should be a way to do this but I can't find any options for changing the duration between motions.

I'm aware that the duration between states can be changed by selecting a transition connection between states but what I'm talking about here are the motions inside a state.

sentences:
Diagonal movement behaving strangely when other key is pressed I'm following the tutorial at http://blog.sklambert.com/html5-canvas-game-the-player-ship/. I'm at the part where bullets get added to the game. Prior to this in the section about movement where I split the movement loop into two seperate loops, one for up-down and the other for right-left movement. When one of each is pressed the ship moves diagonaly.

How it was presented in the tutorial.

if (KEY_STATUS.left) {
            this.x -= this.speed
            if (this.x <= 0) // Keep player within the screen
                this.x = 0;
        } else if (KEY_STATUS.right) {
            this.x += this.speed
            if (this.x >= this.canvasWidth - this.width)
                this.x = this.canvasWidth - this.width;
        } else if (KEY_STATUS.up) {
            this.y -= this.speed
            if (this.y <= this.canvasHeight/4*3)
                this.y = this.canvasHeight/4*3;
        } else if (KEY_STATUS.down) {
            this.y += this.speed
            if (this.y >= this.canvasHeight - this.height)
                this.y = this.canvasHeight - this.height;
        }
        // Finish by redrawing the ship
        this.draw();

What I did.

 if (KEY_STATUS.left && this.x >= 0) {
            this.x -= this.speed
        }
        else if (KEY_STATUS.right && this.x <= this.canvasWidth - this.width) {
            this.x += this.speed
        }
        if (KEY_STATUS.down && this.y <= this.canvasHeight - this.height) {
            this.y += this.speed
        }
        else if (KEY_STATUS.up && this.y >= 0) {
            this.y -= this.speed
        }

        // Finish by redrawing the ship
        this.draw();

All was fine at first, the ship was moving as I wanted it to. Then I added.

if (KEY_STATUS.space && counter >= fireRate) {
        this.fire();
        counter = 0;
    }

Now the movements work fine untill I press the Space key. This is what confused me the most. While Space is pressed, only the UP+Right, diagonal movement works, while all the other default to one or the other.
 Ex: UP+Left gives Up or Left depending on which was pressed first.
 As far as I can tell the problem has nothing to do with the order of the comands in the loops. Some sources suggest that it might be a problem with my keyboard.BTW, I've ran across this problem with a similar project(c++,sfml). So am I messing up something in my code or should I get a new keyboard?
PS: I copied almost all of the code from the tutorial.Still has the same problem.

sentences:
How can I continue to rotate a 2D UI Object using OnPointerEnter when object is on its side? (OnPointerExit is triggered) I have been wracking my brain on this for days. I'm trying to create a nice looking hand of cards, when the card is hovered over, it bobs up and down and rotates. This is triggered by OnPointerEnter, however, whenever it turns on its side and out of the mouses path OnPointerExit triggers, I've tried MANY things, including a bool that triggers the hover effect OnPointerEnter but it is just toggled off when it's turned on its side.

Is it possible to use the collider on my card with OnPointerEnter? Because that would probably solve my problem but haven't found anything on this.

Since the card is on UI, I have some placeholder code in there in order the have the inspected card render on top and return to its place.

    void Update()
{
    if (inspect)
    {

        transform.localScale = cardUpscale;

        posOffset = transform.position;

        transform.Rotate(new Vector3(0f, Time.deltaTime * degreesPerSecond, 0f), Space.World);

        // Float up/down with a Sin()
        tempPos = posOffset;
        tempPos.y += Mathf.Sin(Time.fixedTime * Mathf.PI * frequency) * amplitude;

        transform.position = tempPos;
    }
}

public void OnPointerEnter(PointerEventData eventData)
{
    zoomPlaceholder = new GameObject();
    zoomPlaceholder.name = "zoomPlaceholder";
    zoomPlaceholder.transform.SetParent(this.transform.parent); //binds the placeholder to the hand
    zoomPlaceholder.transform.SetSiblingIndex(this.transform.GetSiblingIndex());

    LayoutElement cardProxy1 = zoomPlaceholder.AddComponent<LayoutElement>();
    cardProxy1.preferredHeight = this.GetComponent<LayoutElement>().preferredHeight;
    cardProxy1.preferredWidth = this.GetComponent<LayoutElement>().preferredWidth;
    cardProxy1.flexibleHeight = 0;
    cardProxy1.flexibleWidth = 0;

    zoomPosition = transform.parent;
    transform.SetParent(transform.parent.parent);
    inspect = true;
}

public void OnPointerExit(PointerEventData eventData)
{
    inspect = false;

    this.transform.SetParent(zoomPosition);
    this.transform.SetSiblingIndex(zoomPlaceholder.transform.GetSiblingIndex());

    transform.localScale = cardNormalScale;

    Destroy(zoomPlaceholder);

}

sentences:
Accessing a UI Image that is a child of a GameObject? I'm sure there is a very simple solution to this issue. I am creating a UI for a 2D RPG in Unity.

I have a Canvas with a two GameObjects:

DialogManager & MenuManager

The Dialog Manager has a child "DialogBox" which is a UI Image.

And the Menu Manager has three children for each part of the menu, so: three UI Images.

How the heck do I access these UI Images in a script attached to a different gameObject? Since they're technically not gameObjects, I can't just use the old gameObject.Find(). I've seen some things about Transforms and Children, but I just can't wrap my head around it.

sentences:
How do I connect circuit to PC so that I can use it to play a game? I made a circuit, which acts like a digital dice using diodes 1N4148, IC 555, IC 4017, 8 & 16 pin IC socket, LED, push-to-on switch, resistors & connecters.

By pressing the push button, 4017 counter toggles between 0 & until released. Once released, a random number is displayed. This is determined by the clock pulse generated by IC 555, which determines the state of 4017 counter.

Now I am thinking of making an application so as to capture this value(LED's lit) so that it can be used in a game like monopoly.

Is there any way I can achieve this ?

sentences:
How to remove an element from the scene while keeping it in array? I combined cube meshes to make a big one. I stored the info of every cube in an array within a list of chunk. Now i want to delete the cubes in the scene to only keep the combined result, but without deleting the elements in the array. After combining meshes, i want to be able do destroy cube from it. So i want to keep the info so when i click the mesh, i get the position of the cube that would be there and check if it matches wit ha cube from the array. If it does, i want to remove it from the array and regenerate the mesh without that deleted cube.

How would I do that ?

sentences:
xna 2.5d gravity system i currently developing a game using the xna API.

now the game i am developing is 2.5d.

by 2.5d i mean the character or object can move left and right and a up and down(not just by jumping) that it would look like there is depth to the level.

try to think something like little fighter 2 where you can also walk up and down.

now i need to develop a gravity system,so far i used the idea that i draw a shadow on the ground of the level,and it follows the object or character and when the character jumps,he moves parabolic like in the real world(using very simple physics).

the gravity system detects landing if the position of it's shadow is the position of the character( or the position of the character is below the position of the shadow). is there a better way to simulate gravity in this 2.5d approach?

sentences:
Creating a Slide-Up Menu How can I create a menu that slides up while "un-fading" as illustrated in this video?

As you can see in the video, the menu also falls down a bit in the end which gives it a realistic feel. I really have no idea on how to approach this, and searching the web did not help either.

Any help is appreciated.

sentences:
Directional light shadow on terrain When player is walking on terrrain, around him Unity is rendering shadow coming from directional light.

But after some radius in the distance, shadows are not rendered.

Only when player walks close to some prefab, shadow is being drawn.

This is not very realistic. I would like that shadows are visible in the distance as in real terrain.

How to fix that ?

sentences:
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:
Access a Private GameObject in Unity Hope you bear with me, I'm a beginner! Maybe I should've paid better attention to the tutorials but they all seem to use public variables/game objects that we can then drag into using the Unity Editor. However, if I have a private Game Object, how can I reference that programatically? I have the following:

private GameObject menuCanvas;

void Start()
{
menuCanvas = GameObject.Find("menuCanvas");
menuCanvas.SetActive(false);
}

Where the menuCanvas is named such in the Unity editor. However, I usually get the following error:

"The variable menuCanvas of myScript has not been assigned."

myScript is attached to a different GameObject in the scene, but not attached to menuCanvas. What am I doing wrong? Thanks for the help!

Edit: another question - which is generally better to use?

Edit 2: Hi guys, I figured it out. I had to move some code around to the Awake() function, so it looked like this:

private GameObject menuCanvas;

void Awake()
{
menuCanvas = GameObject.Find("menuCanvas");
}

void Start()
{
menuCanvas.SetActive(false);
}

And that worked. I realized that myScript was attached to multiple objects, which would cause the menuCanvas to be set inactive more than once (but it could not be referenced inactive).

S. Tarık Çetin's answer worked just as well! Thanks for the help

Edit 3: As Jesse Williams answered, an internal definition keeps the variable hidden from the editor, but it can still be assigned via code.

sentences:
Unity Rendering (Bug): Objects rendered as multiple instances after repositioning Context: I am currently making the menu for my game demo. It involoves "Raindrop"-Gameobjects (Sprites) being repositoned and recolored after a random amount of time. I do this by instantiating a predefined amount of Raindrops and manipulate them after said amount of time.

I am using Unity 2018.1.6f and, if possible, want to avoid switching to another version. If it is of relevance and requested, I can also post my sprite import settings.

Problem: Upon repositioning a sprite, it keeps being rendered at its old position AND the new position, making it appear as if a new instance was created

(this isn't the case as 1. the objects in the hierarchy view remain the same, and 2. the unwanted "multiple renderings" aren't shown in the scene view either, only in game view)

As seen below, there are 5 Raindrop objects in the hierarchy as well as in the scene view. In the game view however, there a lot more than 5 Raindrops are being rendered. The amount of rendered Raindrops increases each time a single one is repositioned.

Further notice:
I had a fairly similar problem once where a bug in my code caused it tho delete all objects at once. The objects were deleted but kept on being rendered and even functioning as if nothing happened, save for the difference that all moving objects would be rendered like the cards in solitaire once the game is over (I do not know of a different way of describing it). None of the code above, except for the Exit() function of MenuEnvironment destroys any object. As you can see, the rainbow objects are only instantiated once, upon Setup(GameObject, GameObject) and being continuously manipulated in Unity's Update Loop.

sentences:
How to alter image pixels of a wild life bird? Hello so I was hoping someone knew how to move or change color and position actual image pixels and could explain and show the code to do so.

I know how to write pixels on a surface or screen-surface

usigned int *ptr = static_cast <unsigned int *> (screen-pixels);

int offset = y * (screen->pitch / sizeof(unsigned int));

ptr[offset + x] = color;

But I don't know how to alter or manipulate a image pixel of a png image my thoughts on this was

How do I get the values and locations of pixels and what do I have to write to    make it happen?

Then how do I actually change the values or locations of those gotten pixels and how do I make that happen?

any ideas tip suggestions are also welcome!

  int main(int argc , char *argv[])
    {

        SDL_Surface *Screen = SDL_SetVideoMode(640,480,32,SDL_SWSURFACE);

        SDL_Surface *Image;

        Image = IMG_Load("image.png");

        bool done = false;

        SDL_Event event;

        while(!done)
        {

            SDL_FillRect(Screen,NULL,(0,0,0));

            SDL_BlitSurface(Image,NULL,Screen,NULL);

                while(SDL_PollEvent(&event))
                {

                    switch(event.type)
                    {

                            case SDL_QUIT:
                            return 0;
                            break;

                    }

                }

                SDL_Flip(Screen);

        }

    return 0;

}

sentences:
Using a object as origin for a Raycast using mouse position as direction Is there any way to cast a ray from an object using the mouse position as the direction for the ray?
I´ve been looking for a while but I can´t find something like that anywhere, so if anyone could help with this it would be great.

I´m using kind of a top view, you can see how here:

And what I want to do is set a empty game object on top of the character to act as the origin for the ray, then when I press a key the mouse is unlocked and an area appears, here´s how that looks:

And I want to use the position where the mouse clicks to be the direction of the ray.

sentences: How to calculate ray unit grid intersections? P is ray origin, D direction. How do I calculate tx, ty(s)? This is for octree raycast. The primary goal is to get 1st intersection voxel (v) then second (v") and so on.

sentences:
Unity3D: How to play 360 video without VR mode? i followed the official Unity tutorial to make an inverted sphere and play a 360 video inside it and i managed to do it but the problem is i can't build the project to my phone because it says i have to turn on virtual reality support from player settings but the thing is i don't want to because when i do that it also turns on VR mode(that split screen view).

what i want is to play a normal 360 video(full screen) and navigate using the gyro of phone just like Youtube. Youtube provides a button to toggle between headset and non-headset mode.

sentences:
Where can I find articles/books on 2D graphics (how it works etc.)? After I have been through more intensive C++ studies, I am thinking of giving it a start in my practices of computer game programming. Therefore, I think 2D knowledge (processing images, animating frames, etc.) would be a good place to start. However, I don't seem to find many articles on 2D (mostly 3D), and if found one, it is mostly stuffs like how to use a 2D game engine. I would really want something much more low-level, or "from scratch" ideas.

I want articles/books that would answer something like:

How would I import images into C++? (Let's say, if I want to import jpeg/bmp/etc. file into raw C++ code, what would I do?)

Basically, I just want to have enough low-level knowledge about computer graphics to be able to create something like 2D game engine from scratch.

sentences:
Finding a tile number in a grid system Hi I am trying to find the Tile number of a grid of tiles based on the Z and X coordinates.

Where the Z and X axis are potentially infinite in either direction how can i get the number of the tile, based on the Z and X coordinates.

Sorry for the crude drawing

sentences:
Handling cameras in a large scale game engine What is the correct, or most elegant, way to manage cameras in large game engines? Or should I ask, how does everybody else do it?

The methods I can think of are:

Binding cameras straight to the engine; if someone needs to render something, they bind their own camera to the graphics engine which is in use until another camera is bound.

A camera stack; a small task can push its own camera onto the stack, and pop it off at the end to return to the "main" camera.

Attaching a camera to a shader; Every shader has exactly one camera bound to it, and when the shader is used, that camera is set by the engine when the shader is in use. This allows me to implement a bunch of optimizations on the engine side.

Are there other ways to do it?

sentences:
Spawning 5 bullets at once and checking if alive, gives an error I am developing a game for my University project and came across a problem with pointers. I have a vector of bullets that has every bullet checked for collisions. But, when I try to spawn 5 bullets at once (shotgun shot), it spawns everything correctly, then I go through the vector and check if the bullet is alive. For some reason it finds a NULL pointer or a corrupted data of a pointer. Would be really appreciated if someone knew how to fix this. Thanks!

Bullet check:

void Bullet::checkOutOfRange()
{
    if(type == "enemy_bullet")
    {
        if(body->GetPosition().x <= -10.0f)
        {
            alive = false;
        }
    }
    // checks if the body is out of the window size
    else if (body->GetPosition().x > 510.0f || body->GetPosition().x < -10.0f || body->GetPosition().y > 291.0f || body->GetPosition().y < -10)
    {
        alive = false;
    }
}

Bullet collision detection:

class MyContactListener : public b2ContactListener
{
    void BeginContact(b2Contact* contact) override
    {
        if (contact && contact->IsTouching())
        {
            Entity* A = static_cast<Entity*>(contact->GetFixtureA()->GetBody()->GetUserData());
            Entity* B = static_cast<Entity*>(contact->GetFixtureB()->GetBody()->GetUserData());

            //------
            if((A->type == "player_bullet" && B->type == "enemy") || (A->type == "enemy" && B->type == "player_bullet"))
            {
                Bullet *bullet = nullptr;
                Enemy *other = nullptr;
                if (A->type == "player_bullet" && B->type == "enemy")
                {
                    bullet = dynamic_cast<Bullet*>(A);
                    other = dynamic_cast<Enemy*>(B);
                }
                else if (A->type == "enemy" && B->type == "player_bullet")
                {
                    bullet = dynamic_cast<Bullet*>(B);
                    other = dynamic_cast<Enemy*>(A);
                }
                if ((A && B) || (B&&A))
                {
                    other->bodySprite.set_animation("death");
                    bullet->alive = false;
                    other->alive = false;
                }
            }
        }
    }
}

Bullet check in game:

    for (auto itr = player_bullets.begin(), itrEnd = player_bullets.end(); itr != itrEnd; ++itr)
    {
        (*itr)->checkOutOfRange(); // go to declaration to see where the bullets stop
        (*itr)->bodySprite.set_position((*itr)->body->GetPosition().x, (*itr)->body->GetPosition().y);
        (*itr)->bodySprite.set_rotation((*itr)->bulletDir * 180 / PI);
        (*itr)->moveBullet(20.0f);
        if ((*itr)->alive == false)
        {
            input_world->DestroyBody((*itr)->body);
            delete *itr;
            itr = player_bullets.erase(itr);
        }
    }

Shotgun shot spawn:

void spawnShotgunShot(float x, float y, float dir, b2World *world)
{
    // maybe bad pointer management?
    Bullet *bullet_ptr1 = new Bullet(x, y, dir, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr1);
    Bullet *bullet_ptr2 = new Bullet(x, y, dir + 0.5, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr2);
    Bullet *bullet_ptr3 = new Bullet(x, y, dir + 0.25, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr3);
    Bullet *bullet_ptr4 = new Bullet(x, y, dir - 0.5, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr4);
    Bullet *bullet_ptr5 = new Bullet(x, y, dir - 0.25, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr5);
}

And here is a testbuild with the sln in it:
Link to testbuild

sentences: Use pathfinding algorithm in a navmesh with several endpoints I need to implement a pathfinding algorithm in a navmesh with several endpoints, and I would like to find the path to the closest endpoint. I suppose that Dijkstra algorithm is the best solution for that but it needs some adaptation. Is someone could help me please ?

sentences:
Should I bake all textures to a texture atlas in a game level? I'm writing my own game engine using Java/OpenGL.  I'm creating levels in Blender 3D and exporting them in a custom file format.  I'm not going to be auto-generating any terrain - everything is going to be exported directly from Blender.

I'm trying to figure out the best way to deal with textures for the static objects in my scene (including very large objects like long ridges of cliffs, grassy fields, canyon floors, etc).  One possibility is to just use the textures at they are applied in the editor.  I have a lot of tiling textures for grass and dirt and such that are not too big and which cover large meshes.  This doesn't take up much texture memory space, but is a little inflexible from an art/design standpoint.  Also, if I want to do something special - like create a blend shader to have a dirt path run through my field - I'll need to code a unique shader to handle this case.  (To complicate things further, Blender doesn't provide support for custom GLSL shaders, so exporting unique things like this will be non-trivial).

Alternately, I can create a single texture atlas for the entire level and bake everything onto it.  This way I don't have to worry about special purpose shaders or multiple tiling textures.  The down side is that this texture would be enormous.  I'm worried such a large texture might be bigger than my device can handle.

Anyhow, I'm not sure what the best practice is in these cases.  Should I bake everything out, or have each model with its own texture?

sentences:
Animation won't play unless movement key is held down In Game Maker I am creating a 2D RPG and combat is a part of it. I have some animations that will play when the left or right mouse button is pressed (Depending on if you want ranged or melee attacks) but when a movement key (for example, D) is not pressed the animation won't play. Only when that key is pressed will the animation play, which is annoying as it ruins the fluid nature of the game. I'll post the code for pressing D and pressing RMB down (not A orLMB` because the code is identical, just reversed).

RMB:

if mouse_check_button(mb_right)
{
  if cusdirection = 0
  {
    if inair = true
    {
      //Do Nothing
    }
    else
    {
      hspeed = 0
      sprite_index = spr_qa_atk_bow_right
    }
  }
}

D:

if keyboard_check(ord("D"))
{
  hspeed = -5
  cusdirection = 0
  if inair = false
  {
    sprite_index = spr_qa_walk_right
  }
  else
  {
    sprite_index = spr_qa_inair_right
  }
}

sentences:
Licensing classic (vintage) car models for game I know that I cannot use real car models in a game without permission. However, I am interested in a classic (vintage) cars from era before 1950. Some of the companies no longer exist, or were bought by some other company and this by some other company etc. Some cars had custom-made chasis on top of a "skelet".

How is licensing for those cases? Same as for "today" cars, or is there any exception? Something like books where from certain date there are no longer copyrights.

sentences:
Basic/research RTS engine/model Does a basic/research RTS engine/model exist that can be used as a basis for further experimentation/research? I'd like to avoid reinventing the wheel if possible.
I'm aware of Spring Engine and Stratagus, but those are real game engines and may not be the best to experiment with and learn from.
Ideally the docs for the model would answer questions like:

How exactly do units move? (constant velocity? constant acceleration? constant force?)
How is pathfinding handled? Does every grid cell become an A* graph node (may be expensive)? Does it consider threats?
How are groups handled? (w.r.t pathfinding and movement)
How is combat handled?

I'm mostly interested in the low-level model details (for now), not the graphics etc.
I've read a lot of the other quesions (and answers/references) tagged RTS but I haven't found my answer yet.

sentences:
LibGDX - TiledMap Unit Scale I'm working on a 2D rpg-style game and I'm currently rewriting my game to get a more clean and structured code. Some thing that has been bugging me is that I have no idea how unit scales work with the OrthogonalTiledMapRenderer, it's kind of like a "Hey it works, I don't know how, but it works" solution. Basically to scale my map up, since it's a pixel game I use

renderer = new OrthogonalTiledMapRenderer(map, 4);

which seems completely wrong since I've seen other examples using things such as 1/32f. However using that makes me unable to even find my map in game when moving the camera.

I've looked up on unit scales but I have a hard time grasping why and how I should use them and if they are really necessary. And by using the code above, which I'm guessing I use the wrong way, does that bring any problems?

Thanks in advance!

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 to texture voxel terrain without triplanar texturing? How can a voxel terrain (marching cubes) be textured without triplanar mapping ?

The goal being to have more artistic freedom.

I think, I could unwrap the mesh while extracting the isosurface then use projective painting. But I do not know how to handle terrain modifications without breaking the texture. I also guess that virtual texturing could help here.

Links for these matters would be appreciated.

sentences:
XNA Library DrawPrimitives throwing primitiveCount error I downloaded the project from here http://silverlight.bayprince.com/tutorials.php?tutorial=13 and tried adding a new OBJ file with a few thousand vertices listed.

The classic teapot works but when I tried loading a different model with alot more vertices included, it suddenly throws this primitiveCount error when the DrawPrimitives gets called.

EDIT:

The code includes a class that would read the data from the OBJ file. This will then return a VertexBuffer object back to the main program. The drawing starts when the Draw event is called.

There are 417936 vertices created from the OBJ file and since I'm using a trianglelist, I divided the vertices by 3 to get the total primitives count.

here's the code for the draw event:

private void DrawingSurface_Draw(object sender, DrawEventArgs e)
        {
            GraphicsDevice device = GraphicsDeviceManager.Current.GraphicsDevice;

            device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, new Microsoft.Xna.Framework.Color(0, 0, 0, 0), 10.0f, 0);

            device.RasterizerState = new RasterizerState()
            {
                CullMode = CullMode.None
            };

            device.SetVertexBuffer(_vertexBuffer);

            foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
            {

                    pass.Apply();
                    device.SamplerStates[0] = SamplerState.LinearClamp;
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, _vertexBuffer.VertexCount / 3);
            }

            // set camera
            _effect.World = Matrix.Identity;
            _effect.View = Matrix.CreateLookAt(new Vector3(_x, _y, _z), Vector3.Zero, Vector3.Up);
            _effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 2.0f, 1.0f, 100.0f);

            // move camera along a circumference
            _x = (float)(_radius * Math.Sin(_hAngle * (Math.PI / 180)));
            _z = (float)(_radius * Math.Cos(_hAngle * (Math.PI / 180)));

            // move camera along a circumference
            //_y = (float)(_radius * Math.Cos(_hAngle * (Math.PI / 180)));

            e.InvalidateSurface();
        }

then the error occurs on the DrawPrimitives.

Any clues about this?

sentences: VSCode doesn't open the specified Unity script I have downloaded Visual Studio Code to edit Unity scripts. When I double click on a script in Unity, VSCode opens but it doesn't open the script, only an empty file called Unity appears. Anyone knows how to solve this?

sentences:
How can I save an XML file with Unity on the Android platform? I am writing a game that has a save function which looks like this

    public void Save()
    {

        System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(this.GetType());
        System.IO.StreamWriter file = new System.IO.StreamWriter(("Assets/Resources/Save");
         ser.Serialize(file, this);
        file.Close();
    }
}

This will work fine in the editor and on Windows machines, but when we build to Android the saving no longer works. Why is that?

sentences:
Texture blends into one single color It looks like that it's being sampled from the least detailed MIP level, at least RenderDoc sees the texture as it should be, and what the actual texture looks like is the same as MIP 9th. I'm using DirectXTex, so I think the shader resource view should be correct.
    DirectX::ScratchImage* pImageData = new DirectX::ScratchImage();
    LoadFromDDSFile(path.c_str(), DirectX::DDS_FLAGS_NONE, nullptr, *pImageData);
    const DirectX::TexMetadata& textureMetaData = pImageData->GetMetadata();
    const DirectX::Image* image = pImageData->GetImage(0, 0, 0);
    DirectX::CreateShaderResourceView(
        GetDevice(gfx),
        image, textureMetaData.mipLevels,
        textureMetaData,
        &pShaderResourceView);

and the sampler is
    D3D11_SAMPLER_DESC samplerDesc;
    samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC;
    samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.MipLODBias = 0.0f;
    samplerDesc.MaxAnisotropy = 4;
    samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    samplerDesc.MinLOD = 0;
    samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

    DX::ThrowIfFailed(GetDevice(gfx)->CreateSamplerState(&samplerDesc, &pSamplerState));
    pImageData->Release();

then
    GetContext(gfx)->PSSetShaderResources(0u, 1u, &pShaderResourceView);
    GetContext(gfx)->PSSetSamplers(0u, 1u, &pSamplerState);

Input layout might be relevant
    const std::vector<D3D11_INPUT_ELEMENT_DESC> inputElemDesc =
    {
        {"Position", 0u, DXGI_FORMAT_R32G32B32_FLOAT, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u},
        {"TexCoordinate", 0u, DXGI_FORMAT_R32G32_FLOAT, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u},
        {"Normal", 0u, DXGI_FORMAT_R8G8B8A8_UNORM, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u}
    };

Vertex shader
struct VertexIn
{
    float3 position : Position;
    float2 texCoord : TexCoordinate;
    float3 normal : Normal;
};

struct PSstruct
{
    float4 PosH : SV_Position;
    float3 PosW : Position;
    float3 NormalW : Normal;
    float2 Tex : TEXCOORD;
};
PSstruct main(VertexIn vin)
{
    PSstruct vout;

    vout.Tex = vin.texCoord;;
    return vout;
}

pixel shader. I removed light related code, I'm fairly sure that here it's not important. And I temporarily disabled it
Texture2D cubeTexture : register(t0);
SamplerState cubeSample : register(s0);

struct PSstruct
{
    float4 PosH : SV_Position;
    float3 PosW : Position;
    float3 NormalW : Normal;
    float2 tex : TEXCOORD;
};
float4 main(PSstruct pin) : SV_TARGET
{
    float4 texColor = float4(1, 1, 1, 1);
    texColor = cubeTexture.Sample(cubeSample, pin.tex);
    float4 litColor = texColor;
    return litColor;
}

sentences:
What is the correct and most efficient approach of streaming vertex data? Usually, I do this in my current OpenGL ES project (for iOS):

Initialization:

Create two VBO's and one IndexBuffer (since I will use the same indices), same size.
Create two VAO's and configure them, both bound to the same Index Buffer.

Each frame:

Choose a VBO/VAO couple. (Different from the previous frame, so I'm alternating.)
Bind that VBO
Upload new data using glBufferSubData(GL_ARRAY_BUFFER, ...).
Bind the VAO
Render my stuff using glDrawElements(GL_***, ...);
Unbind the VAO

However, someone told me to avoid uploading data (step 3) and render immediately the new data (step 5). I should avoid this, because the glDrawElements call will stall until the buffer is effectively uploaded to VRAM. So he suggested to draw all my geometry I uploaded the previous frame and upload in the current frame what will be drawn in the next frame. Thus, everything is rendered with the delay of one frame.

Is this true or am I using the good approach to work with streaming vertex data?

(I do know that the pipeline will stall the other way around. Ie: when you draw and immediately try to change the buffer data. But I'm not doing that, since I implemented double buffering.)

sentences:
Detecting if a point is inside a rectangle I have mouse coordinates in 2D game (x and y) and a rectangle (x, y, width, height).
How do I determine if the point is in the rectangle? I do not have any code to post here. I'm just searching for help.

sentences:
How does an FPS like Overwatch have client time run ahead of the server? In watching the GDC talk about Overwatch netcode, it mentions that the client is always ahead of the server, that the "current tick" on the server is behind that of the client.
From their explanation this makes sense. If the client is ahead of the server, then by the time the client messages arrive at the server, the server will have caught up and can handle them when it wants them.
But how does this get setup to begin with? The client connects to the server, the server starts a game... does the client jump ahead of it's own accord? (Server says "game is starting, I'm at tick 0", and the client is like "okay, well, based on my ping I'm going to be tick 20 then")

If the server is in charge of what's going on in the game, how does the client even know what's going on in that future tick? I would assume constant extrapolation of game events from the last server update would be bad. Having the client in the past to allow it to interpolate between server updates would make a lot more sense to me.

Or am I wrong in assuming that client and server tick times need to remain in sync, and it is instead more loosely based on server updates and the number of client events that happened since that update was received, rather than the client actually caring about what tick they're on compared to the server?

It's the time/tick synchronization, despite one or the other having to be in the past, that I can't wrap my head around...

sentences:
Moving object through nodes in Quadtree I'm working on my own quadtree for use in games for physics (collision detection to be exact) but am unable to move an object from one node to another node.

What I'm doing is if some object is to be moved, I'm deleting it from its old position and adding a new object (with same property, such as width and height) to the new position. Is my approach correct or is there any other optimized process to do same?

The problem I'm facing is that if I move an object from node 0 to node 3 (both node being children of, for ex., root node) the root node container(I'm using std::vector) gets the object but it is not updated in the node 3's container.

Any solution to my problem? Though would be happy to try some other method too.

Thanks.

sentences:
2D Grid-based Pathfinding with Elevation I'm creating an isometric game which currently uses A* Pathfinding on a basic grid representation of the map.
Having elevations and allowing the Players to traverse up-and-down is an integral part of the game - however I'm stuck on exactly how to implement that, whether it be with A* or something else.
For example,
---------------------------------
| 0 | 0 | 0 | X | 0 | 4 | 4 | 4 |
---------------------------------
| 0 | 0 | 0 | 0 | 0 | 4 | 4 | 4 |
---------------------------------
| 0 | 0 | 1 | 2 | 3 | 4 | 4 | 4 |
---------------------------------

Assuming X is the Player, the numbers are tile elevations, and that the Player can only traverse tiles +/- 1 elevation to the tile they're currently on, is there an accepted/known way of doing this pathfinding?

sentences:
Combine skin material to two elements without a visible seam Software used: 3ds max 2015 and Photoshop CC 2014.

I have two elements of the head, the "FaceHead" and "UpperHead". I used unwrap UVW for both elements and used Photoshop to add a skin color (eye and lips for "FaceHead") and the same skin color for "UpperHead". I created an image for both elements in Photoshop and added the image to the elements using the Material Editor (with Bitmap option). The problem is, that there is a visible seam between the 2 elements, although I used the same color for both. Is there a solution to solve this?

What I tried:

Used of MaterialByElement
Used of different color
Extend to 2 pixel from the border using Photoshop when applying Paint.

sentences: Horizontal wrapping with AndEngine How would one implement the effect of a sprite disappearing on one side of the screen and appearing on the other using AndEngine? Like in Kid Icarus, seen here at around 1:22.

sentences:
Different ways to mark the status of an enemy I have a 3D game with a "eagle view", I have enemies and I have magics that will affect the status of the enemies.

I want to show the status of the enemies( frozen, on fire(dot damage), slowed...etc)

I think about two possibilities

Put a 2D image in the enemy that show status
Change the color of the enemy with vertex shaders

Is there other,or correct way?
In case of use vertex shader, how I change the color of enemy without losing all details(Something like a filter)?
shaders

sentences:
How to compare recorded skeleton with live skeleton by using kinect sensor? I am developing project where user will perform movement in front of the kinect. Up to now I can calculate the angles between joints and can detect body parts. My second approach is recording these movements and store in database and then patient will try to follow this motion. Now I need to compare live skeleton with recorded skeleton. I am working with c#. This screenshot gives what i done up to now.

My Question is how to save motion by using kinect and how to compare save motion with live skeleton. If there any reference please let me know.

sentences:
Vertex data split into separate buffers or one one structure? Is it better to have all vertex data in one structure like this:

class MyVertex
{
  int x,y,z;
  int u,v;
  int normalx, normaly, normalz;
}

Or to have each component (location, normal, texture coordinates) in separate arrays/buffers? To me it always seemed logical to keep the data grouped together in one structure because they'd always be the same for each instance of a shared vertex and that seems to be true for things like character models (ex: the normal should be an average of adjacent normals for smooth lighting).
One instance where this doesn't seem to work is other kinds of meshes like say a cube where the texture coordinates for each may be the same but that causes them to be different where the vertices are shared.

Are they normally kept separate? Won't this make them less space efficient if there needs to be an instance of texture coordinates and normals for each vertex (they won't be indexed)?
Can OpenGL even handle this mixing of indexed (for location) vs non-indexed buffers in the same VBO?

sentences:
How to implement a Play As Guest feature on a mobile device using PhoneGap? I have a Facebook Web Game that I converted to Android and iOS using PhoneGap. I can use Facebook for authentication on my mobile apps, but I would also like to allow the user to play as a guest. I've seen various games implement this workflow before and I'm curious how it is actually done. What unique identifier is the phone sending to the server to authenticate against? Does each phone have something unique about it that PhoneGap can expose via a plugin? Does anyone know the logic behind the "Play As Guest" feature many mobile games implement?

Thanks!

sentences:
Continuously get keyboard input from user and remember last character [Java] I want to write a Snake game in Java. How can I continuously monitor input and if user pressed W set variable Char lastDirection = 'w'; //hence, Direction.UP?

I know about the Scanner method: Scanner scan= new Scanner(System.in);... But then user would have to hit enter each time he presses the button. Document Listener (Swing) seems better, but then I would have a long string of user input saved somewhere that I don't need. What is the right method for listening to keyboard and remembering the last character?

sentences:
Getting Started with Component Architecture: DI? TLDR:  if I have entities like Ship and Bullet and components like Positionable and Drawable, should I create interfaces for each component and inject them into my entities using DI, or should I be doing something else?

(In this case, Ship would extend IPositionable and have an instance of a PositionableComponent which is injected by DI. Any calls to ship.getX or ship.setX would be implemented as myPositionable.getX or myPositionable.setX.)

I just moved away from MVC towards something more component-architecture-like. I have no concept of messages yet (it's rough prototype code), objects just get internal properties and values of other classes for now.

That issue aside, it seems like this is turning into an aspect-oriented-programming challenge. I've noticed that all entities with, for example, a position component will have similar properties (get/set X/Y/Z, rotation, velocity).

Is it a common practice, and/or good idea, to push these behind an interface and use dependency injection to inject a generic class (eg. PositionComponent) which already has all the boiler-plate code?

(I'm sure the answer will affect the model I use for message/passing)

Edit: The DI model I'm proposing is as follows.

Create entity classes like Ship and Bullet
Create interfaces to represent these components. Eg. I can expect a PositionableComponent.getX method.
Create component classes like PositionableComponent, DrawableComponent which implement my interface
Entities like Ship will have components like PositionableComponent. They will implement the methods by internally keeping an instance of a positionalbleComponent and redirecting all interface calls to the component.
My DI framework will (presumably automatically) wire up components by interface, eg. Ship._positionableComponent = new PositionableComponent(). This is how NInject works, which is the only framework I've ever used (and I'm working in Haxe now).

This will allow me to work on a higher level (ships contain components), and reduce boilerplate code (component implementations), but introduces duplicate code (redirecting to the internal component). Since I'm working in Haxe, I may be able to avoid writing that boilerplate by hand.

However, the advantage is that I can override component behaviours. If undeadMonster.IsAlive() should return true when its HP is above -100 (instead of 0), I can easily code this, and the change becomes very visible from the code level.

But I'm not sure if I'm solving this correctly.

sentences:
2D Camera sizing and movement Apologies if this is a basic question, or been asked a 1,000 times in the past...

I'm new to Unity, and having problems understanding some of the basics to do with 2D cameras (orthographic), and while I've read a lot nothing has made me have that 'ah-ah!' moment yet.

What I'm trying to create is the following (camera position depicted by the box with the pink dashed line) - where the yellow filled boxes are made up of a whole bunch of sprites.

Overtime, the camera need to move left to right, and then bottom to top...

What my issue seems to be is understanding how I can get the camera to display all of the sprites - in other words, resize the camera view to fit the background sprite's height, and know when to stop the camera in order to start moving it up.

What I'd like to understand is how and why to solve this problem - it's the only way I'll learn!

Thanks

Kieron

sentences: Do I need a UPC barcode to sell my game? Is it necessary to register a Universal Product Code for a video game intended for sale offline? What about online?

sentences:
Ideas for extending tic-tac-toe game? I'm building a 3D tic-tac-toe game and this is what I've implemented so far:

3D renderer with texture mapping
Playing against the computer
Playing online (multiplayer)

Now I'm a little lost what I could add. Obviously, tic-tac-toe isn't that exciting or advanced, but I just miss something to salt it a little bit.

Therefore, could anyone please suggest some ideas that would be worth implementing?

Thanks!

sentences:
Randomised Path from A to B for cursor movement simulation I'm trying to simulate the movement of the mousecursor, by creating a path from point A to B that has random variation. The algorithm I'm using at the moment is very basic, and is limited in that  it's only really good for creating a path where X and Y distance from the start are the same, forming a square:

The code looks something like this:

   function calcualtePath(from, to)
   {
      var pathNodes = [];
      while (from.x != to.x || from.y != to.y)
      {
         var newTransition = {x: from.x, y: from.y};

         if (Rand(1, 3) != 1 && newTransition.x > to.x)       newTransition.x--;
         else if (Rand(1, 3) != 1 && newTransition.x < to.x)  newTransition.x++;
         if (Rand(1, 3) != 1 && newTransition.y > to.y)       newTransition.y--;
         else if (Rand(1, 3) != 1 && newTransition.y < to.y)  newTransition.y++;

         pathNodes.push(newTransition);
         from = newTransition;
      }
      return pathNodes;
   }

I'd like some assistance in creating is a relatively fast algorithm that creates a randomised path between point A and B, that has a more curve like path and isn't limited like the one above. Ideally something a bit like this, with a pronounced curve:

sentences:
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:
Why does my character stop a little before landing on the ground? I made a little game with side-scrolling and a box (the player) jumping across the level. The simple physics are almost done, but I have two problem with the way things behave:

On landing, the box takes a little time to reach the floor
When the box hit a roof, there is always a little space between it and the object.

Here is my collision code (in the player's Step Event):

myGravity = 0.5;
if (vspeed > 10)  vspeed = 10;

speedAir = abs(vspeed+1);

//ON_FLOOR = !(place_free(x, y + speedAir));
ON_AIR = place_free(x, y + speedAir);

FREE_RIGHT = place_free(x + speedScreen, y);
FREE_UP = place_free(x, y - speedAir);

KEY_UP = keyboard_check(vk_up);
KEY_LEFT = keyboard_check(vk_left);
KEY_RIGHT = keyboard_check(vk_right);
KEY_FIRE = keyboard_check(vk_space);

/* JUMP */
if ON_AIR
{
    gravity = myGravity;
    gravity_direction = 270;

    if !(FREE_UP)
    {
        vspeed = 0;
    }
}

else // if ON_FLOOR
{
    gravity = 0;
    gravity_direction = 270;
    vspeed = 0;

    // JUMP
    if KEY_UP & FREE_UP
    {
        vspeed = -10;
    }
}

/* LATERAL */
if (FREE_RIGHT)
{
    x += speedScreen; // screen side-scrolling
}

How can I do this correctly?

sentences:
Integrate Stripe with Unity I'm trying to install the Stripe API Library through NuGet Manager in Visual Studio but it installs it inside packages folder of the Project (I.E. before Project's Assets folder) doing this I cannot use the library:

Using UnityEngine;
Using Stripe; //Doesn't recognise this

Then I:

Moved those installed files from packages to Assets folder
Uninstalled Stripe from NuGet (as I could now access them in my script by using Stripe)

Now these are the main errors that I'm getting:

PrecompiledAssemblyException: Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included for the current platform. Only one assembly with the same name is allowed per platform. Assembly path: {0}
Assembly 'Assets/Temp/lib/netstandard2.0/Stripe.net.dll' will not be loaded due to errors:
Unable to resolve reference 'System.Collections.Immutable'. Is the assembly missing or incompatible with the current platform?

Assembly 'Assets/Temp/lib/netstandard1.2/Stripe.net.dll' will not be loaded due to errors:
Unable to resolve reference 'System.Collections.Immutable'. Is the assembly missing or incompatible with the current platform?

sentences:
How do I convert screen coordinates to between -1 and 1? I'm writing a function that allows me to click on my tiles. The origin for my tiles is the center, however, the mouse's origin is the top left. I need a way to transform my mouse coordinates into my tile coordinates.

Here is what I already have (but is not working):

void mouseClick(int button, int state, int x, int y)
{
    x -= 400;
    y -= 300;
    float xx = x / 100; // This gets me close but the number is still high.
    float yy = y / 100; // It needs to be between -1 and 1
}

sentences:
Game logic implemented using TPL / async / await, and performance of it I'm working on a game, and as a typical game (here using Monogame) it uses frame based approach, where all logic happens in Update() method called every frame.

As a consequence, any sequential logic of operation, like going from one level to another, moving some entity to a different place over time or having a bunch of entity movements happening one after another has to be implemented in some complicated way, using states and finite state machines to track what is where. I obviously can't do anything like this:

foreach (var level in Levels)
{
    while (!level.LevelCompleted)
    {
        level.ShowIntroduction();
        WaitForClick();

        level.ShowMapOverview();
        WaitForClick();

        level.Run();

        level.ShowResult();
        WaitForClick();
    }
}

(might be little dumb example, but you get what I mean)

This while and foreach would block everything. But the thing is, it is very often the best way to describe the algorithm behind, way better than state machines, and these algorithms do get complicated sometimes.

And I just learned a lot about TPL recently and WOOOOOWW, what a great thing it is. Now I can do this. I tested this already both for simple few second actions of moving things in a game, as well as for complete control of scenes and intermissions, where one async method takes minutes or even hours. It can look like this:

foreach (var level in Levels)
{
    while (!level.LevelCompleted)
    {
        level.ShowIntroduction();
        await WaitClickAsync();

        level.ShowMapOverview();
        await WaitClickAsync();

        await level.RunAsync();

        level.ShowResult();
        await WaitClickAsync();
    }
}

To make this work, I have some AsyncManager, which allows me to wait for next frame, like this:

private async Task WaitClickAsync()
{
    while (true)
    {
        await asyncManager.WaitNextFrameAsync();

        if (World.Keyboard.JustPressed.Contains(Keys.Space))
            return;
    }
}

This thing await asyncManager.WaitNextFrameAsync() is used to break the execution of a method and continue it at the next frame. This makes it very easy to make code like above, or to make movement of entities etc. All other stuff in Update() still works, things gets rendered, and all is done without using any additional threads.

Of course in reality it needs to be more complicated than this, to support cancellation of these async methods, but TPL seems to have good support for this.

So first of all I wanted to share it with. And then ask the following, before I start modifying all of my game logic to use TPL:

am I not going in trouble using it everywhere in my game? I'm not really sure if TPL designers really thought about using it for such scenarios, and have those methods run for hours. Any cons?
what could the price in terms of performance be, if anything significant? Am I going to get some problem here?

sentences:
Call function after Level loaded I'm stuck in this situation:

I have a GameObject with a script, that persist trough Level loads.

Inside this script, when a condition is meet, i Load a Level, and also call a function. That function is a C# Messenger Broadcast() function.

The level that I am loading contain the script with the Listener for that Messenger Broadcast.

The problem is that the Broadcast occurs before the level has been loaded, and so there is no Messenger Listener that can receive the event.

  BroadcastException: Broadcasting message OnConnectionError but no listener
  found.

I need to do the Broadcast only after the level has been loaded, but I don't know how, or maybe there is a better solution.

For a simple example here is the code:

public class NetworkingManager : MonoBehaviour {

    void Start(){
        DontDestroyOnLoad (this);
    }

    void OnConnectionLost(BaseEvent _event ){
        if(Application.loadedLevelName != "LoginScreen"){
            Application.LoadLevel ("LoginScreen");
        }
        Debug.Log ("Disconnected. Reason: " + _event.Params["reason"]);
        Messenger<string>.Broadcast ("OnConnectionError", "Disconnected");
    }
}

sentences:
Unity FP Character Can't Look Vertically I have a FP Character and well, it can't look vertically. Its happened about 3 times now, each time I just replaced it with the standard assets prefab, first few times it worked fine, but then after a little while, I suddenly couldn't look vertically. I have checked and double check the vertical clamping on the prefab and they haven't been touched. I really need my player to be able to look vertically as soon as possible, could someone show me how to fix this?

Thanks in advance!

sentences:
Rendering performance in FlasCC + UDK when compared to Stage3d and UDK on Windows? Adobe recently released the Flash C++ Compiler, which UDK uses to target Flash Player.

Developers can now access UDK for browser applications. Does this mean greater performance than using a Stage3D engine (Away3D 4) and how much of a noticeable difference in performance would it make in rendering speeds?

Is there any benchmark you could propose that would allow to compare them fairly?
I am asking this to help myself understand the consequences in performance for deciding to use UDK in a browser based game. I would also like to know how it compares with UDK running natively in Windows?

I am not asking which technology to use or which is better. Only interested in optimizing rendering speed in a 3d browser game with flash.

sentences: Add Objects in LWJGL without using glTranslationf function It is possible to add an object in LWJGL without using translation function (glTranslatef) ? and if it is possible does this improve somehow performance ?

sentences:
Foreach loop with 2d array of objects I'm using a 2D array of objects to store data about tiles, or "blocks" in my gameworld. I initialise the array, fill it with data and then attempt to invoke the draw method of each object.

foreach (Block block in blockList)
  {
    block.Draw(spriteBatch);
  }

I end up with an exception being thrown "Object reference is not set to an instance of an object".

What have I done wrong?

EDIT:
This is the code used to define the array

Block[,] blockList;

Then

blockList = new Block[screenRectangle.Width, screenRectangle.Height];
  // Fill with dummy data
  for (int x = 0; x <= screenRectangle.Width / texture.Width; x++)
  {
    for (int y = 0; y <= screenRectangle.Height / texture.Width; y++)
    {
      if (y >= screenRectangle.Height / (texture.Width*2))
      {
        blockList[x, y] = new Block(1, new Rectangle(x * 16, y * 16, texture.Width, texture.Height), texture);
      }
      else
      {
        blockList[x, y] = new Block(0, new Rectangle(x * 16, y * 16, texture.Width, texture.Height), texture);
      }
    }
  }

sentences:
What sounds need to be transcripted when using Closed Captions? I have no experience with captioning, but we are developing a game and we want to make it as accessible as possible so we thought of 2 levels of subtitles: dialogues and Closed Captions (dialogues + sound effects).
The problem I can think of is what sounds need to be transcripted in Closed Captions? All sounds of the game could clutter the screen with subtitles and distract the player. Too few sounds and the player could miss some details.
For example we could have an electric door which makes some sound when opened or closed, this kind of sound should be transcripted always? Or just the first time it's encountered, and then the user will know that all the similar doors should make the same sound?
And is it too much to put 2 subtitles (one for opening, one for closing)?

sentences:
Formatting Unity data for communication with a REST API I am pretty new to unity but I am not new to programming. I am building a Hololens application in Unity 2017.2 and it communicates with a REST api that I built. I am using Unity as a front end more or less and it manages my state. Coming from the web developement world, I have my server converting my models into JSON and I am sending that as a response. For the most part, it works well but since Unity works on an older version of C#, I am having issues working with the JSON data, mainly if the data type is not a string, int, float, or double. For example, if my model contains a date data type I am having issues converting it back into a c# model or even arrays are proving to be a pain. I don’t want to rely on unity packages too much as most I have tried don’t do what I need but I am open to any good ones if you know of any.

My question is, what is the best way to send data from my API to Unity? Should I send xml or a csv instead? Or even a more C# native approach? (If that makes sense)

sentences:
What techniques can I use to render very large numbers of objects more efficiently in OpenGL? You can think of my application as drawing a very large ball-and-stick diagram (or graph).  At times, this graph can get very large, where the number of elements even outnumbers the pixels on the screen.  Currently I am simply passing all of my textures (as GL_POINTS) and lines to the graphics card using VBO's.

When the number of elements outnumbers the number of pixels, is this the most efficient way to do this?  Or should I do some calculations on the CPU side before handing everything over to the GPU?

If it matters, I do use GL_DEPTH_TEST and GL_ALPHA_TEST.  I do some alpha blending, but probably not enough to make a huge performance difference.

My scene can be static at times, but the user has control over a typical arc-ball camera and can pan, rotate, or zoom.  It is during these operations that performance degradation is noticeable.

sentences:
openTTD tileset atlas I'm trying to create an isometric game and would like to use some tiles from Open Transport Tycoon Deluxe
newGRF library link
The atlas I'm used to work with are basically a big image that can be splitted in 64x32 tiles, so I can use any Atlas import tool or just easily extract the tiles with a loop.
However, OpenTTD uses atlas that I don't understand. The files look something like this, where each tile has a numer and starts at positions that are not evenly distributed.
I assume it might exist some file with metadata that contains the locations and sizes of each tile, in order to be extracted and used.
Has anybody experience with this type of Atlas? How can I extract the tiles so I can use them?
Thanks

sentences:
Projectile code reports wrong number of arguments I'm not certain as to why my code isn't working. The error reports that the instance_create line uses a wrong number of arguments. What am I doing wrong?

if(ammo > 0)
{
    ammo -= 1;

    bullet_id = instance_create(
        x + lengthdir_x(lenx, image_angle) - lengthdir_y(leny, image.angle),
        y + lengthdir_y(lenx, image_angle) + lengthdir_x(leny, image_angle));

    bullet_id.direction = image_angle;
    bullet_id.image_angle = bullet_id.direction

sentences:
Cinematic in 2D games I am searching for a way to create and integrate cinematic in a simple 2D game with XNA for Windows Phone.
I don't know if the best way is to create an animation with sprite and commonly process to animate them... or Is it possible to create the animation with an external tool and read it from the code.

Thanks for your help

sentences:
Adding mesh's\objects to procedural isosurface terrain Thanks again for reading!

So following on from my last question, I have my fully working isosurface terrain and now its time to add my trees and grass and whatever to the world.

The old way I was doing it was to cast rays in a grid faceing down over the terrain, I would then read the normal from the ray hit and place things if the normal was < as value.

I would do this at different grid resolutions for each plant\tree\grass time and offset there x, z and scale by some random value then adding the object to my 2d BV tree because I was only working with height map terrain so I only had one row of bounding volumes for the tree.

I can still use the above method but as you know it will only place objects on parts of the terrain that can see the sky.

Part of building my new terrain system involved making a real octree so I no that I will use that to store my objects but what is the best way to generate my object positons.

From what I have read around I should somehow use the voxels I build but I'm not really sure how I would go about it.

sentences:
Lower WebCamTexture dimension without requesting Handling image with high resolution / dimension can cause heavy lag in low spec computer . So i need to lower the dimension of the image to make it less lag for processing . I know i can do it with WebCamTexture.request(width/height) , but if the camera does not support low dimension image , the result image dimension will be still big .
I've tried to convert it to Texture2D using WebCamTexture.GetPixels() and uses lower width and height for the Texture2D , but it breaks the image and the result was unexpected .
I also have tried to set the WebCamTexture to an object , and get that object captured by in-game camera , and resize the image that was captured by the camera , but then it means the high dimension image is doubled (WebCamTexture and image from the in-game Camera) and doubled the lag than just using WebCamTexture .
Can anyone here help me please ? i will upvote for any attempt to help .

sentences:
LibGDX - Rectangle Collision and Response I've been using LibGDX for the past few weeks and I have some problems that I need help on. What I need help on is understanding how to use LibGDX Rectangle class for a platformer.

I found this project on github that seems to be useful.

https://github.com/obviam/star-assault-reboot

I was able to wrap my mind around how this game worked for the most part.

The only thing I can't understand, which is the most essential part of the game, is how the collision detection and response works.

In the project, the BobController class holds the everything that's used to detect collision.

https://github.com/obviam/star-assault-reboot/blob/master/core/src/net/obviam/starassault/controller/BobController.java

I tried going to the website linked in the github project for answers, but it seems to be empty.

Maybe I'm just dumb, but I can't wrap my mind how this works. Even with the comments provided in the project, I still don't understand.

Can someone explain in greater detail how this class handles collision detection and response using the LibGDX Rectangle class.

EDIT:

This is the specific function that I don't understand:

/** Collision checking **/
private void checkCollisionWithBlocks(float delta) {
    // scale velocity to frame units
    bob.getVelocity().scl(delta);

    // Obtain the rectangle from the pool instead of instantiating it
    Rectangle bobRect = rectPool.obtain();
    // set the rectangle to bob's bounding box
    bobRect.set(bob.getBounds().x, bob.getBounds().y, bob.getBounds().width, bob.getBounds().height);

    // we first check the movement on the horizontal X axis
    int startX, endX;
    int startY = (int) bob.getBounds().y;
    int endY = (int) (bob.getBounds().y + bob.getBounds().height);
    // if Bob is heading left then we check if he collides with the block on his left
    // we check the block on his right otherwise
    if (bob.getVelocity().x < 0) {
        startX = endX = (int) Math.floor(bob.getBounds().x + bob.getVelocity().x);
    } else {
        startX = endX = (int) Math.floor(bob.getBounds().x + bob.getBounds().width + bob.getVelocity().x);
    }

    // get the block(s) bob can collide with
    populateCollidableBlocks(startX, startY, endX, endY);

    // simulate bob's movement on the X
    bobRect.x += bob.getVelocity().x;

    // clear collision boxes in world
    world.getCollisionRects().clear();

    // if bob collides, make his horizontal velocity 0
    for (Block block : collidable) {
        if (block == null) continue;
        if (bobRect.overlaps(block.getBounds())) {
            bob.getVelocity().x = 0;
            world.getCollisionRects().add(block.getBounds());
            break;
        }
    }

    // reset the x position of the collision box
    bobRect.x = bob.getPosition().x;

    // the same thing but on the vertical Y axis
    startX = (int) bob.getBounds().x;
    endX = (int) (bob.getBounds().x + bob.getBounds().width);
    if (bob.getVelocity().y < 0) {
        startY = endY = (int) Math.floor(bob.getBounds().y + bob.getVelocity().y);
    } else {
        startY = endY = (int) Math.floor(bob.getBounds().y + bob.getBounds().height + bob.getVelocity().y);
    }

    populateCollidableBlocks(startX, startY, endX, endY);

    bobRect.y += bob.getVelocity().y;

    for (Block block : collidable) {
        if (block == null) continue;
        if (bobRect.overlaps(block.getBounds())) {
            if (bob.getVelocity().y < 0) {
                grounded = true;
            }
            bob.getVelocity().y = 0;
            world.getCollisionRects().add(block.getBounds());
            break;
        }
    }
    // reset the collision box's position on Y
    bobRect.y = bob.getPosition().y;

    // update Bob's position
    bob.getPosition().add(bob.getVelocity());
    bob.getBounds().x = bob.getPosition().x;
    bob.getBounds().y = bob.getPosition().y;

    // un-scale velocity (not in frame time)
    bob.getVelocity().scl(1 / delta);

    }

sentences:
How to retrieve a cube collision by faces I work for a while on a minecraft game (voxel).
I am front a problem for a long time about the collision detection. I want recover the cubes collision from my highlighted black's cube like on the picture , but only on the sides. And not on the edges !
Actually i got all cubes in red and green when i check with the boundingBox method.
Actually i use the method with the class "BoundingBox" to check for collisions.
Can anyone help me or direct me on the best way for retrive the right cube ?

Code example with the boundingBox methode for check the collision

List<Node> nodeParent = regions[modelSelected.regionIndex].Nodes[modelSelected.Id].Where(m => modelSelected.BoundingBox.Intersects(m.boundingBox)).ToList();

i want to get only the green cube and not the red .. From the black cube in the middle

Thank's a lot guy

sentences:
How to end a game when player picks up certain number of objects I've got a small maze game where the player has to find a certain number of objects. If the player find all of them, I want the game to end. For now, I just simply want it to stop gameplay completely. I'll worry about ending it elegantly later. This is what I have, but I can't figure out what to put in the if statement. I can't seem to find a simple game state end function or anything like that. (Not really a whole lot of code to show for this. If for some reason someone needs to see more, please let me know and I can post other code, I just don't think anything else is relevant).

void APlayerCharacter::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

    if (Score == 5)
    {
        //WHAT CAN I PUT HERE TO END GAME????
    }

}

sentences:
Bounding box collision handling makes player glitch to the other side of the wall The way I handle simple collision detection causes a really frequent and easy to reproduce glitch, which affects gameplay severely. Here's my code (Python 3.5):

 def move(self, _map):
    self.col = False
    for y in _map.actors:
        for actor in y:
            if actor[1]:
                if not (((self.y + self.h) < (actor[1].y - self.cam.y)) or (self.y > ((actor[1].y - self.cam.y) + actor[1].h)) or (self.x > ((actor[1].x - self.cam.x) + actor[1].w)) or ((self.x + self.w) < (actor[1].x - self.cam.x))):
                    print(self.col)
                    self.col = True
    if not self.col:
        if self.directions[0]:
            self.cam.y -= self.speed
        if self.directions[1]:
            self.cam.y += self.speed
        if self.directions[2]:
            self.cam.x -= self.speed
        if self.directions[3]:
            self.cam.x += self.speed
    else:
        if self.directions[0]:
            self.cam.y += self.speed
        if self.directions[1]:
            self.cam.y -= self.speed
        if self.directions[2]:
            self.cam.x += self.speed
        if self.directions[3]:
            self.cam.x -= self.speed
    if self.running:
        self.speed = system.RUNNING_PLAYER_SPEED
    else:
        self.speed = system.NORMAL_PLAYER_SPEED
    self.x = ((self.cam.w / 2) - (self.w / 2))
    self.y = ((self.cam.h / 2) - (self.h / 2))

As you can see, I'm detecting collision against walls and whatever (Any actor in the map) in the player's "move" method. The logic is pretty straightforward, a basic bounding box collision test (I consider the position of the player relative to the camera, since the player is always in the center (It's the camera that moves)).
If I just stop the player if there's a collision, the player gets stuck inside the wall, thus creating the necessity of "teleporting" the player to its former position, as you can see in this other question.
The problem with that solution is that it leads to this glitch, which I need to illustrate in order to make myself clear.

In this first example, I'm going up (pressing W) towards the wall.

The collision works fine just pressing W, it gets teleported in the opposite direction at each collision. The problem is when I start pressing S (Down) at the same time. The player goes to the opposite direction, glitching up towards the other side of the wall, since the collision test always returns true when the player is "inside" the wall, just like this:

This would severely compromise the gameplay, since players would be able to play outside the boundaries of the map in multiplayer. How can I avoid this using bounding box collision or other method?

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:
Rendering a 3D scene without a window This is kind of an odd question, but what would be the best solution for rendering a 3D scene without a render window active? The end goal would be to simply render a 3D scene to an image file.

I have done similar things in the past with DirectX and XNA but both required me to have a render window running in-order for the API to initialize. Is there a way to render directly to a texture so that you could perform the rendering with a DLL file in other desktop applications?

The way I envision it working is you create a self contained DLL which has all the rendering logic, a user is using a standard windows application to customize his parameters, once he has them locked he sends a render request to the DLL and it responds with a PNG file of the rendered scene. Ideally this would be a CPU based render since performance is not a huge issue.

Are there APIs out there which one could use to accomplish this?

sentences:
Creating random path in grid I need to find a path with required length in the NxN matrix without loops and deadlocks. For example:

We Have a grid 7x7 (49 blocks in total) with START
(orange) point.

We need to build random path length of 25 cells.

etc

My problem is I don't know how to create the path with required length fast and avoid loops and deadlocks.

sentences:
Transforming a primitive tetrahedron into a primitive icosahedron? I've created a tetrahedron by creating a BoundingBox and building the faces of the tetrahedron within the bounding box as follows (see image as well):

VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[12];
BoundingBox box = new BoundingBox(new Vector3(-1f, 1f, 1f), new Vector3(1f, -1f, -1f));

vertices[0].Position = box.GetCorners()[0];
vertices[1].Position = box.GetCorners()[2];
vertices[2].Position = box.GetCorners()[7];

vertices[3].Position = box.GetCorners()[0];
vertices[4].Position = box.GetCorners()[5];
vertices[5].Position = box.GetCorners()[2];

vertices[6].Position = box.GetCorners()[5];
vertices[7].Position = box.GetCorners()[7];
vertices[8].Position = box.GetCorners()[2];

vertices[9].Position = box.GetCorners()[5];
vertices[10].Position = box.GetCorners()[0];
vertices[11].Position = box.GetCorners()[7];

What would I then have to do to transform this tetrahedron into an icosahedron? Similar to this image:

I understand the concept but applying it is another thing entirely for me.

And to clarify, I'm not wanting an animation, I simply want to create an icosahedron from the vertices of a tetrahedron.

EDIT: So I now have an alternative way to create an icosahedron using golden rectangles. That's fine for the purposes of my particular project. However, I'd like to leave the question open for solutions to the original problem, i.e. mathematically converting a tetrahedron in Cartesian co-ords into an icosahedron (not vice-versa).

sentences:
Convenience of mySQL over xml Currently I use XML to store specific information to correctly load a few things such as a list of specfied characters, scenes and music, Once more I use JAXB in combination with standard compression/decompression(ZIP) functionality to store a list of extrenous data. This data is called to add functionality to the character, somewhat like Skills in an RPG. Each skill is seperated into its own XML file with a grandlist which contains the names of each file with their extensions omitted and zipped in folder that gets encrypted.

At first using xml was working fine however as the skill list grow i worry about its stability. I was wondering if I should begin storing the data in mySQL. Originally I planned to simply convert everything to JSON over xml but i think possibly mySQL would be a better move.

Can anyone inform me of the key difference and pros and cons of each
I guess i'm looking for the best way to store the data more conviently and would be easier to operate on. The data is mostly primatives and strings and the only arraylist of values i have i can just concat into a single field and parse later

Edit:

If I am going in the right direction with XML would it make sense to convert it to JSON and use maybe Kyro or EclipseLink JAXB (MOXy)

sentences:
D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_12_0) ISSUE I'm getting this error when I compile this code.

D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_12_0,
IID_PPV_ARGS(&pDevice)).
Error! No such Interface supported

I've got a rtx 2060 GPU installed in my computer.
All my GPU drivers are up to date.
I've got the windows 10 version 1803(OS Build 17134.590)
I've got visual studio 2017 installed and used to compile my code.

Here is the code I'm trying to compile.
https://github.com/acmarrs/IntroToDXR

What, in the hell is this error man its so stupid.
I've been stuck for over 6 damn hours man.
Any help, much appreciated.

sentences:
Why is my spritesheet displaying all messed up in game? I'm having an issue I don't quite understand, where my spritesheet is looping strangely and not showing the full sprite I want, even though I feel like I'm specifying it correctly. My code is in phaser.js.

Example: https://imgur.com/a/xJ95Qbj

My code for it is as follows:

this.load.spritesheet('dude', 'assets/bunny.png', { frameWidth: 32 , frameHeight: 42 });

    this.anims.create({
        key: 'left',
        frames: this.anims.generateFrameNumbers('dude', {start: 56, end: 64}),
        frameRate: 5,
        repeat: -1
    });

    this.anims.create({
        key: 'turn',
        frames: [{key: 'dude', frame: 4}],
        frameRate: 20
    });

    this.anims.create({
        key: 'right',
        frames: this.anims.generateFrameNumbers('dude', {start: 40, end: 48}),
        frameRate: 5,
        repeat: -1
    });

Look fine on the 'turn' frame, but not so fine on movement. For reference, here's the spritesheet I'm attempting to use: https://imgur.com/Rzi5i7Z

sentences:
2D Circular Distribution Overlap I'm working with the C# wrapper for SDL and am stumped at how to handle this issue. Right now I have a simple Actor that spawns N number of bullets from himself and fires them circularly outward. The problem is that the last bullet renders on top of everything and looks awful.

Below is a picture with the last bullet painted blue with the shooting actor in the center (also blue).

I was hoping to try and figure out how to get it above the 2nd to last bullet while the bottom half is under the first. The closest thing I could find on this subject was this CSS article. The problem though is that it is solving the issue with 3D and I am working in pure 2D. Here's a picture from the article of what I am trying to achieve.

I can't tell if this is something easy or really hard to achieve, but it appears I definitely don't know what to search for because even that one article I found, I just happened to stumble upon it by looking at Google Images.

So I guess my question is, what is the proper term for this and what are the tricks to trying to solve this in a 2D space?

sentences: Directx9, FBX sdk and indices problem So I've set up my program, know how to get everything going except for one thing: indices. I've been stumped as to how I retrieve that set of data. Does anyone know what I function I need to get them? Thanks in advance!

sentences:
Pixel thin lines appearing between sprites on camera move I'm going to apologize in advance for the lack of screenshots, but this was a very hard thing to capture, but very obvious to see.

I'm using LibGDX to create a tile base rogue-like. Everything is going alone smoothly and working well, but there is one graphical glitch that is very bothersome. I have the camera LERPing towards the player, but this smooth movement causes very small gaps to appear for about a frame between the floor tiles that's quite distracting.

The tile rendering code looks something like this:

for(int y = 0, i = 0; y < mHeight; y++) {
    for(int x = 0; x < mWidth; x++, i++) {
        batch.draw(mTiles[i].textureRegion, x * TILE_SIZE, y * TILE_SIZE);
    }
}

Where mTiles is a 1D array representing the 2D dungeon, batch is the main SpriteBatch used for rendering, and textureRegion is the TextureRegion of the tile.

The camera code looks like this:

pos = mEntity.getPosition();
mCam.position.x = MathUtils.lerp(mCam.position.x, pos.x * TILE_SIZE, delta);
mCam.position.y = MathUtils.lerp(mCam.position.y, pos.y * TILE_SIZE, delta);

The problem is solves if I cast the result of the LERP to an int, forcing the camera to line up with the tiles, but it's not ideal. I also tried creating a new texture of the entire dungeon floor from the texture regions that make it up, but there doesn't seem to be any elegant way to do this.

Anyone else face a similar situation? I'll try and capture some screenshots and post them later.

sentences:
C++ SDL2: How to join two windows in one: top_Window + bottom_Window? I have a code where the camera scroll left, right, up, down, and I would like to add a progress bar similar to the one below at the bottom of my window

Is it possible to create the progress bar in a different window and then join my top game window with this new window, so they can render at different times? If not (by using only one window) when scrolling up and down I would have that progress bar in the way, indeed my camera is set to the exact dimension of window height and window width and currently works flawlessly without that bar because the bar is not part of my current texture.
Any suggestion how to join two windows in one? I have created the bottom_Window so far (so I can try to develop the progress bar) but I want it to be fully merged with the top one (the actual game) so they can be moved at the same time)
Many thanks!

sentences:
OOP implementation of BUFFS and Stats. Suggestion I am developing an MMORPG server using NodeJS.

I am not sure how to implement Buffs, i mean, equipped objects or used skills have effects on the Player() which has many Stats(), some of them have a max cap...

Effects can change the Stat value, increasing or decreasing it by a value, a percentage or completly rewrite the value of the stat.

After a while I have decided to create a base class for buffs, which can be hidden (if they are casted from an equipped object) or shown if they came from an ability (Spell).

Anyway I need suggestion how to implement it, use an array for all active buffs for a stat and have a function calculate the value of the stat affected by buffs each time I need the value of the stat or...? Other more OOP's ways to do it?

I have read this What's a way to implement a flexible buff/debuff system? but this implements only a percentage system, which buffs can only say "+10%, +20%, etc...", but I would love to have an hybrid system, which can have percentage values or static values (like WoW does), and using modifiers it's hard to implement, because modifiers refers to the current value of stat :/

Thanks for suggestions :)

sentences:
Can't work with universal tween engine while having added it to gradle I'm actually developing a game with libgdx and I'd like to create a splash screen. To do this, I must use the Universal Tween Engine. To add the Universal Tween Engine, I followed the instructions of the libgdx doc at this link: https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine

I created a new directory called "libs" in my project directory (not with Eclipse) and put on it the universal tween engine files I got by downloading the universal tween engine.
At this time, I had this:

After that, I made the edits in the dependencies sections of "build.gradle" (by adding this: compile fileTree(dir: '../libs', include: '*.jar') )

Then I tried to refresh the gradle dependencies (by right clicking on my core and android projects and pressing "refresh".)

After restarting eclipse, I tried to work with the universal tween engine by trying to import some of the tween engine (I typed on the top of my main class "import aurelienribon.tweenengine.TweenAccessor;").

The problem is that I got a problem message saying "the import aurelienribon cannot be resolved", even after trying to fix the project setup, I got a message saying that this problem is unresolvable.

What shall I do?

Thanks for your answers.

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:
Trapping Asserts in Visual Studio I'm writing a 2D game with some fairly complex off-screen logic, with plenty of room for bugs. My usual habit is to write code with a lot of Asserts in it. When an Assert gets hit I drop into the debugger, have a look around, find and fix the bug. Works for me.

Problem is: how to get Unity Asserts to call into the Visual Studio debugger. So far they just seem to get generate a log message in the Editor Console, and then Unity carries right on as if they didn't matter. What use is that?

There is an 'experimental' option in the Unity VS settings, but it doesn't seem to do anything (good or bad).
Any suggestions? I can think of a couple of really hackish things to try, but surely there must be a right way?

After further experimentation:

Enabling Assert.raiseExceptions (only) makes Unity grind to a halt (instead of carrying on regardless) but otherwise no change. No trap into VS.
Enabling the experimental Exceptions mode (only) causes Unity to crash with a bug check on the first assert failure.
Doing 1+2 is the same as 1 only.

This is VS 2015 in case it matters.

sentences:
How to script sequential events in GameMaker? I am wondering if there is an elegant way to script sequential events in GameMaker 2.

In Godot 3.1, it is very easy to chain events together using yield() and signals. You just start doing something, yield until it emits a signal that it's done, and then continue your code. I am wondering if there is anything similar in GameMaker 2.

In Godot, for example, if i wanted to spawn an explosion cluster which consisted of 10 explosions, each starting 50 milliseconds after each other, I could do something like this.

func create_explosion_cluster(x, y):
    for x in range(10):
        create_explosion(x, y)
        timer = Timer.new()
        add_child(timer)
        timer.wait_time = 0.05
        timer.start()
        yield(timer, "timeout")
        timer.queue_free()

I used this method for complex boss behaviors as well. For example,

func boss_attack():
    animation_player.play("intro_to_attack")
    yield(animation_player, "animation_finished")
    animation_player.play("attack")
    for x in range(10):
        create_projectile(x, y, vector_to_player)
        timer = Timer.new()
        add_child(timer)
        timer.wait_time = 0.05
        timer.start()
        yield(timer, "timeout")
        timer.queue_free()
    animation_player.play("outro_to_attack")
    yield(animation_player, "animation_finished")`

In fact, I use this technique all over the place when I want certain events to follow other events (in transitions, cutscenes, enemy behaviors, etc.)

Is there a way to script sequential events in GameMaker with similar flexibility as you have in Godot?

If there is a general design pattern to solve this kind of problem without yield(), co-routines, and so on, I'd love to know it.

sentences:
What record stores the inventory in a Skyrim savegame file? For The Elder Scrolls V: Skyrim, I'm looking for a way to read the player's inventory without having to go into the game to do it.

I've scoured the pages from the UESP wiki on save file format but I couldn't find where the player's inventory is, even after writing a crude REFR change form reader. The wiki has a lot of information on many structures, but none are clearly identified as the player's inventory.

So, does anyone know where the inventory (RefID and count) is in the savegame file?

sentences:
Cannot implicitly convert type object[] to UnityEngine.GameObject[] So, I cannot implicitly convert type object[] to UnityEngine.GameObject[]. But why? As far I know, are all types a inheritanced types of object. So, for my logic, I could put a GameObject array in a object array. That's why, this should work:

spawnedObjects = FindObjectOfType<Tools> ().AddObjectToArray (spawnedObjects, go);

//

public object[] AddObjectToArray(object[] _array, object _toAdd){
    if (_array.GetType() == _toAdd.GetType()) {
        object[] a = new object[_array.Length + 1];
        a = _array;
        a [a.Length] = _toAdd;
        return a;
    } else {
        Debug.LogWarning ("The object that should be added to the array have to be the same type as the arrays type. Initially array was retuned!");
        return _array;
    }
}

But yeah, it won't do

sentences:
XNA Content Pipeline With Map Creation Utility I've been looking into how to use the XNA Content pipeline appropriately for a game I am working on. I have however been having a hard time wrapping my head around it and am not sure on the best way to proceed.

The specific example is, I have a top down 2-d RPG style game. I want to create a utility (probably Windows Forms) that will allow me to easily create and edit maps. Each map consists of 1 or more graphic layers, each layer containing a N x N grid of tiles. In turn each tile starts out as a bitmap.

Given the above information I see a few ways to proceed:

Store the map info in an XML file compatible with the Content Pipeline XML loader. Each tile is stored as a string reference to the corresponding texture asset. Texture assets are added in the game project.
Store the map info in an XML file compatible with the Content Pipeline XML loader.
Each tile is stored as the path to the corresponding .bmp/.png files.

Now there are things that I really don't like about both approaches. The main issue with approach one is that the map creation and the .xnb texture asset creation are completely separate. The .xml map file is created by the utility, while the texture asset is added to my content in my game. This becomes an issue trying to make sure the .xml map file and all the texture assets in the project stay in sync.

Approach two would allow me to keep all the appropriate image file next to the map files using the map utility. However, it seems like I shouldn't have to do something like this. Also I would need to be more intelligent about loading the maps so that I am not rapidly loading the same image off disc for each tile.

So my question is: If you want to add a content generation utility (like a map editor), what is the best way to make sure that the custom content (map file) stays in sync with the texture assets. Also, keep in mind that in my map editor I would need the ability to load and display the texture assets.

Any input is much appreciated.

sentences:
AnimatedActor class don´t work Let me explain: I´m reading a book I got given that is called "Beginning Java Game Development with LibGDX", and get to the section where the book talks about animating actors, or animating "sprites". The example code they presented is as follows:

    public class AnimatedActor extends BaseActor {
    private float elapsedTime;
    private Animation anim;

    public AnimatedActor(){
        super();
        elapsedTime=0;
    }

 public void setAnimation(Animation a)
 {
 Texture t = a.getKeyFrame(0).getTexture();
 setTexture( t );
 anim = a;
 }

 public void act(float dt)
 {
  super.act( dt );
  elapsedTime += dt;
 if (velocityX != 0 || velocityY != 0)
  setRotation( MathUtils.atan2( velocityY, velocityX ) * MathUtils.radiansToDegrees );
 }

 public void draw(Batch batch, float parentAlpha)
 {
  region.setRegion( anim.getKeyFrame(elapsedTime) );
  super.draw(batch, parentAlpha);
  }
}

I'm running the examples, using android studio, and surprisingly I find the following situation: the code that proposes the book marks an error ... and it is exactly in this line:

 public void setAnimation(Animation a)
 {
 Texture t = a.getKeyFrame(0).getTexture(); <------- getTexture() is the error
 setTexture( t );
 anim = a;
 }

The error I'm getting is

  cannot resolve method getTexture()

I'm a bit surprised, since I'm not supposed to have any errors, since I'm reading from a book ... trying to implement something similar for my project, but ... I found this. Surely, it should be that the function should be removed in recent versions of LibGDX.

The only thing I try to do is that the moment you click on an actor on the stage, the texture set, change to the animated sprite. How can you create an animation in LibGDX?

sentences: What does cache mean? I'm kinda new to the programming scene. I'm still a high school student but I want to be a game designer so I'm studying independently before I graduate to get an edge. The issue with this is that although I have learned some programming, I can't follow all of the technical terms that get thrown around on the game dev forums. One of the terms that gets used a lot is cache, and I'm wondering what that means. Outside of programming it means a secret stash of something you don't want others to know about, which could be referring to things like AI, login info or, something like that. I would like a more specific answer if anyone would be willing to give the time.

sentences: Screen Space vs World Space Canvas When should I use one over the other? I'm pretty sure I understand the key differences, but I'm not sure which use cases would prefer one over the other. For example, let's say I have objects on the ground in my 3D game and they have UI Images above them with the objects' names. Which method is better? Should I stick to world space for objects which are located in the 3D world and screen space for overlay type stuff?

sentences:
Why does my isometric rendering technique leave large gaps between tiles? I've followed tutorial after tutorial for converting from cartesian coordinates to isometric coordinates.

The cartesian behavior of my game works fine... that part is easy... For the most part, I can even get the isometric display to work, following along with the math I've found online. But it comes with some serious problems.

I use the following formulas in the getIso() functions:

isoX = (X-Y) - xOrientation
isoY = ((X+Y)/2) - yOrientation

I also apply the following transformation and draw each terrain square with its filter:

double axis = (double) GameWorld.GRID_SIZE;
transform.scale(1, 0.5);
transform.rotate(Math.toRadians(-45), axis, axis/2);
op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);

It comes out looking like this when the terrain is drawn:

Each block should be neatly side-by-side. If I change the scale values (while maintaining the 2:1 ratio) then either the terrain image is clipped or they start to overlap one another, but it's never perfectly aligned. Here's the function I use to draw the terrain:

void draw(Graphics2D G)
{
    int x = world.getIsoX(xCoord, yCoord);
    int y = world.getIsoY(xCoord, yCoord);
    if (isVisible() == true) G.drawImage(op.filter(sprite.buffer, null), x, y, null);
}

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 prevent clicking through object in GameMaker I've been making my first, simple game in Game Maker. You have to click a moving ball (obj_ball), each time you click it, it wil start moving faster. I wanted to add a way to lose the game: if you would miss a ball, it would redirect you to another room. I tried creating a new object (obj_gameover) covering the whole backgroud and adding a 'left pressed' event with a proper execute line to it, but whenever I click on a obj_ball, it also clicks on a obj_gameover, executing events from both objects. Is there any way to fix my problem?

sentences:
Flat and crispy shading Im trying to create a mobile game that has flat, bright colors and I want every place to be lightened the same. Like this game:

and this is my game's current state:

I don't know what the problem is. It is too dark and not as good-looking as the first image. If i increase the light, it gets bright, not saturated and crispy. Maybe wrong lighting or wrong material usage? First image looks so crispy and it almost like a Vector art. I modeled all of the assets myself in Blender. I tried using Ambient lighting but it didn't work. I also turned off shadows but still the same.
Also there is a distortion in the big red circle i drew and i don't know why is it hapening. And i don't want the shiny light in the little red circle.

sentences:
Where should collision detection logic be placed? I am developing a small 2D game engine. The characters have a paint method which currently does the following:

Calculate the new position of the character as per its speed, etc.
Update the collision grid cell **
Draw the character at the new position

** I have created a collision grid to reduce the number of intersection checks

Now the basic algorithm which I have thought for detecting collision is:

For Each Character
    Check intersection with characters in surrounding 8 cells

I can simply place this code in the paint method. But here is the problem I anticipate.

Suppose two characters A and B lie in adjacent cells in the collision grid. Now as per the above algorithm in the iteration of character A it will detect that it has collided with B. In the iteration for character B it will detect that it has collided with A.

But I have an idea that when A detects that it has collided with B, it should inform B that it has collided with A. This would save lot of comparisons when there are more than 2 actors colliding. But I am not sure how to handle this. I think instead of every character checking for its collision, I should check for the collision inside the game loop.

Would this approach be correct? How have you handled this kind of problem? I thought of the collision grid thing myself. Are there any alternatives to collision grid logic?

sentences:
What tech will enable a script to run after a certain amount of time elapsed following a user's action? I'm trying to experiment in creating an MMO browser-based game using PHP, MySQL, Javascript, HTML5, and CSS.

There is this certain functionality that I want in my game that I'm having trouble with.

In detail, here's what happens:

The user clicks an action
Then a time limit will commence
After the time limit, then a script will run and the changes will take place.

I've heard of cron jobs but these changes are not in a set time. It depends on when a player makes a move or something.

Here are the possible ways I can think of carrying this out:

You save the time when the user makes a move, and when the user checks back again, there will be a script that will check if the time the user made a move and compare it with the current time. The problem with this is that, I wan't the changes to take place even when the player is offline. With this method, the changes will only happen after the player checks back again.
A cron job will do the above action of checking the time the user made a move and compare it with the current time. Probably every 30 minutes or every hour. The problem with this is, won't this be too much for the server? And still, it will be every 30 minutes or so. Will this be possible too if done in seconds?
A combination of the two. A cron job will check every hour and it will also check every time a user logged back in.

Of course these are the solutions I can think of using only cron jobs. I don't know if there is any better technology out there. I do hope that there is a better way like actually running a script after a certain amount of time elapse after an action even when offline. If there is, tell me. I'm talking server-side here ok.

Yeah, anyone can help me out with this?

sentences:
What is a normalized Vector? Can someone explain the following code? I need to learn what each part means so I can turn it into enemy movement in a space shoot-em-up

Vec2d playerPos;
Vec2d direction; // always normalized
float velocity;

I get the above is naming two 2d Vector objects, and creating a variable called velocity. I'm not sure what the normalized comment is about, though.

update()
{
   direction = normalize(playerPos - enemyPos);
   playerPos = playerPos + direction * velocity;
}

sentences:
Partial Shader Signatures HLSL D3D11 C++ I had been debugging a problem I was having in a single shader file with 2 functions in it. I'm using DirectX 11, vs_5_0 and ps_5_0. I have stripped it down to its basic components to understand what was going wrong with the shaders, because the different named components of the Pixel and Vertex shaders were swapping the data being input:

void QuadVertex ( inout float4 position : SV_Position,
            inout float4 color : COLOR0,
            inout float2 tex : TEXCOORD0 ) {
    // ViewProject is a 4x4 matrix,
    // just included here to show the simple passthrough of the data
    position = mul(position, ViewProjection);
}

And a Pixel Shader:

float4 QuadPixel (  float4 color : COLOR0,
            float2 tex : TEXCOORD0 ) : SV_Target0 {
    // Color is filled with position data and tex is
        // filled with color values from the Vertex Shader
    return color;
}

The ID3D11InputLayout and associated C++ code correctly compiles the shaders and sets them up with some simple primitive data:

        data[0].Position.x = 0.0f * 210;
        data[0].Position.y = 1.0f * 160;
        data[0].Position.z = 0.0f;
        data[1].Position.x = 0.0f * 210;
        data[1].Position.y = 0.0f * 160;
        data[1].Position.z = 0.0f;
        data[2].Position.x = 1.0f * 210;
        data[2].Position.y = 1.0f * 160;
        data[2].Position.z = 0.0f;
        data[0].Colour = Colors::Red;
        data[1].Colour = Colors::Red;
        data[2].Colour = Colors::Red;
        data[0].Texture = Vector2::Zero;
        data[1].Texture = Vector2::Zero;
        data[2].Texture = Vector2::Zero;

When used with the shader, the float4 color always ended up with the position data, and the float2 tex always ended up with the color data. After a moment, I figured out that the shader's input and output signatures needed to be in the correct order and the correct format and be laid out in the exact order of the output from the Vertex Shader, regardless of the semantics:

float4 QuadPixel (  float4 pos : SV_Position,
            float4 color : COLOR0,
            float2 tex : TEXCOORD0 ) : SV_Target0 {

    return color;
}

After finding this out, My question is: Why don't the semantics map the appropriate components when going from Vertex Shader to Pixel Shader? Is there any way that I can make it so certain semantics are always mapped to other semantics, or do I always have to follow the rigid Shader Signature (in this case, Position, Color, and Texture) ?

As a side note for why I'm asking: I know that when using XNA, my shader signatures for functions could differ in position and even drop items from Vertex Shader to Pixel Shader function parameters, having only the COLOR0 and TEXCOORD0 components being used (and it would still match up correctly). However, I also know that XNA relied on DX9 (and maybe a little DX10) implementation, and that maybe this kind of flexibility no longer exists in DX11?

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:
Instantiate and launch prefab that's overlapping player? I’m very new to Unity and C#. I’m trying to create my first game and I have now invested about 15+ hours trying to find solutions to this issue...I’m stumped!

My player sprite (blue square) needs to launch a prefab sprite (red circle) of similar size ‘appearing’ to originate from itself. Here is a GIF of what I have so far...I don’t want the blue cube to collide and go flying.

After clicking and dragging on Player (drag-to-aim) via OnMouseDrag to set the target vector, I’m trying to Instantiate a prefab sprite (Dynamic RigidBody2D, CircleCollider2D) using the Player sprite’s position (a Dynamic RigidBody2D, BoxCollider2D) and have it APPEAR to be originating from inside the Player object. Launch is triggered via function called in OnMouseUp. Both objects should immediately come under control of Physics to collide with the environment which will include other moving RigidBody2D objects later. Targeting should allow 360 degrees to include straight into an obstacle allowing rebound effect.

Here is some excerpts of my code:

using System.Collections;
using UnityEngine;

public class Teleportation_Grenade : MonoBehaviour {

/*
    This script is attached to Player and requires_
    projectile prefab.

    tested with thrust set between 100 and 200.
*/

    public float thrust;
    public Transform prefab;
    public LineRenderer playerShotLine;

    private Vector2 playerToMouse;
    private Vector2 targetVector;

//...

    void OnMouseDrag()

    {
        Vector3 mouseWorldPoint = Camera.main.ScreenToWorldPoint (Input.mousePosition);
        Vector2 playerToMouse = mouseWorldPoint - transform.position;
        mouseWorldPoint.z = 0f;

        playerShotLine.SetPosition (0, transform.position);
        playerShotLine.SetPosition (1, mouseWorldPoint);
        playerShotLine.sortingOrder = 3;

        //opposite direction of line renderer
        targetVector = -playerToMouse;

    }

    void OnMouseUp()

    {
        SpawnPrefab ();
    }

    void SpawnPrefab()

    {
        Instantiate(prefab, new Vector3(transform.position.x, transform.position.y, 0), Quaternion.identity);

        prefab.GetComponent<Rigidbody2D> ().AddForce (targetVector * thrust, ForceMode2D.Impulse);
    }
}

This is only one of many, many iterations. It's the gist of it though. I appreciate any insight from the community.

sentences:
Realtime Multiplayer - How to handle user updates coming in different times I have a game loop that sends new positions of every player to other players.

But there is no guarantee that the users will send the server their new positions at the same time. Actually if their connection is slow or some errors happen inbetween, then the data of the clients will flow to the server in a very varying way for every other user.

My question is, how should I handle so varying data on the server, and decide who should win in a fast-paced multiplayer game. Is the key, timestamp of the requests (seems like it is widely open to cheating), or just the clients sending me directions where they go, and their actions like pressing a button etc?

I've read lots of articles on the web, but none of them seems to completely cover the subject.

PS: I just want to decide on the server side, what should be the next 'frame' in the game by applying the game scenario to the user inputs.

sentences:
how to make different sprite when moving and aiming I want to create top down game where you are Russian soldier in libGDX.
The player controls the soldier with W/A/S/D and aims with the mouse. That way the soldier can run sideways and shoot towards enemy.

What is best way to make his legs walk into the right direction but aim the weapon towards the mouse pointer?

My idea is to make two sprites, for both torso/weapon and legs and let them lay over each other but I don't know if that is best way to do it.

sentences:
Bullets Stop Working Error I've made a vector which is used by a universally accessible namespace called 'BULLET_HANDLER'. This vector stores and updates all bullets that are produced from the 'shootBullet' function. The problem I'm facing is that after a while of firing bullets, the vector does not draw or update the bullets and does not push back anymore bullets. It also doesn't crash the game and the game continues normally but none of the objects can fire bullets.

Here is the code for the Bullet Handler:

#include "BULLET_HANDLER.h"

static vector<Bullet*> BULLET_ARRAY;

void BULLET_HANDLER::shootBullet(Bullet *BULLET) {
  BULLET_ARRAY.push_back(BULLET);
}

void BULLET_HANDLER::Update() {

  for (unsigned int i = 0; i < BULLET_ARRAY.size(); i++) {
    if (BULLET_ARRAY.size() > 0) {
      if (
        BULLET_ARRAY[i]->getX() <= 0 - BULLET_ARRAY[i]->getW() ||
        BULLET_ARRAY[i]->getX() >= WINDOW_WIDTH) {

        BULLET_ARRAY.erase(BULLET_ARRAY.begin() + i);
      }
    }

    BULLET_ARRAY[i]->Update();
  }
}

void BULLET_HANDLER::Draw(SDL_Surface *Window_Surface) {

  for (unsigned int i = 0; i < BULLET_ARRAY.size(); i++) {
    BULLET_ARRAY[i]->Draw(Window_Surface);
  }
}

void BULLET_HANDLER::clearBulletArray() {
  BULLET_ARRAY.clear();
}

sentences:
how to properly rotate in directX11 I am trying to Rotate a textured quad in directX however I think i am missing something. I am pretty sure it is because i am applying transformations to the WorldMatrix instead of the ObjectWorld, however i do not have an object world matrix so i am unsure how i would get that since i am not storing much except the texture and the position of 4 vertices directly to the buffer and only updated when it is needed.

here is what i have tried

bool GraphicsClass::Render(float deltatime)
{
D3DXMATRIX worldMatrix, viewMatrix, projectionMatrix, orthoMatrix, rotationZ;
bool result;

// Clear the buffers to begin the scene.
m_D3D->BeginScene(0.0f, 0.0f, 0.0f, 0.0f);

// Generate the view matrix based on the camera's position.
m_Camera->Render();
//DrawingStuff
// Get the world, view, projection, and ortho matrices from the camera and d3d objects.
m_Camera->GetViewMatrix(viewMatrix);
m_D3D->GetWorldMatrix(worldMatrix);
m_D3D->GetProjectionMatrix(projectionMatrix);
m_D3D->GetOrthoMatrix(orthoMatrix);
//Transform World Matrix with a rotation matrix
D3DXMatrixRotationZ(&rotationZ, 90.0f);
D3DXMatrixMultiply(&worldMatrix, &worldMatrix, &rotationZ);
// Turn off the Z buffer to begin all 2D rendering.
m_D3D->TurnZBufferOff();
// Put the bitmap vertex and index buffers on the graphics pipeline to prepare them for drawing.
result = m_Bitmap->Render(m_D3D->GetDeviceContext(), 124, 124);
if(!result)
{
    return false;
}

// Render the bitmap with the texture shader.
result = m_TextureShader->Render(m_D3D->GetDeviceContext(), m_Bitmap->GetIndexCount(), worldMatrix, viewMatrix, orthoMatrix, m_Bitmap->GetTexture());
if(!result)
{
    return false;
}

// Turn the Z buffer back on now that all 2D rendering has completed.
m_D3D->TurnZBufferOn();

// Present the rendered scene to the screen.
m_D3D->EndScene();

return true;
}

the full code can actually be downloaded from http://www.rastertek.com/dx11tut05.html with the minor difference that render takes in delta-time since last frame using a custom timer class which is not provided by them as well as a few minor tweaks but it is mostly the same.

i did find this http://www.rastertek.com/dx11tut25.html which i may try to implement however that is not really what i want, i want to rotate the actual quad, not the texture.

sentences:
Rotating UI element using touch for mobile - Unity 2D I want to create the above object that will rotate on z-axis following the direction of a finger. Like a dial. I have written the following code and attached it to that element:

private float rotationRate = 3.0f;

    void Update()
    {
        // get the user touch input
        foreach (Touch touch in Input.touches)
        {
            Debug.Log("Touching at: " + touch.position);

            if (touch.phase == TouchPhase.Began)
            {
                Debug.Log("Touch phase began at: " + touch.position);
            }
            else if (touch.phase == TouchPhase.Moved)
            {
                Debug.Log("Touch phase Moved");
                transform.Rotate(touch.deltaPosition.y * rotationRate,
                                 -touch.deltaPosition.x * rotationRate, 0, Space.World);
            }
            else if (touch.phase == TouchPhase.Ended)
            {
                Debug.Log("Touch phase Ended");
            }
        }
    }

But the element does not move at all. Any ideas?

EDIT:

Here is a gif for better understanding:

sentences:
Getting Vector at 90 Degrees from provided vector I need a function that can take a vector as an input and provide a vector that is at a 90-degree angle to the provided vector. I understand that in 3D there is an infinite amount of vectors that could be produced from this calculation, but I only require 1. I have been using GLM and have tried using its built in vector rotation functions but to no avail. I would like to keep the solution compatible with GLM as I wish to have everything standardized.

Here is a basic visualization of what I need.

Edit
The function's purpose is to pass a direction vector into a function, radius, and an angle and it will create a point around the origin at x angle in space. The reason for this is so I can loop through and create a point cloud in 3D space and then join them together to make shapes such as cylinders (see photo)

Solution Code

glm::vec3 CreateAngledPoint(glm::vec3 rotation_point, float radius, float angle, glm::vec3 normal)
{
    // Normalize the normal (axis to rotate on)
    normal = glm::normalize(normal);
    // Create a vector that will be used for the dot product
    glm::vec3 to_cross = glm::normalize(glm::vec3(0.0f,1.0f,0.0f));
    // Make sure that the normal and cross vector are not the same, if they are change the cross vector
    if (to_cross == normal) to_cross = glm::normalize(glm::vec3(0.0f, 0.0f, 1.0f));
    // Get the cross product
    glm::vec3 to_return = glm::normalize(glm::cross(normal,to_cross));
    // Rotate point around the axis
    to_return = glm::rotate(to_return, angle* RAD_TO_DEG, normal);
    // Scale the point up from the origin
    to_return *= radius;
    // Apply it to the point in space we are rotating around
    return rotation_point + to_return;
}

Example of its usage

sentences:
Unity / NodeJS Projectile synchronization I am working on a MOBA game similar to League of Legends. I am building the game server system in NodeJS/Socket.IO but I'm running into issues on figuring out the best way to handle projectiles (aka player skill-shot abilities) on the server-side. The Main goal is to be able to spawn a projectile (or projectiles) on the server-side and update the position in a certain direction (all on the server-side separate from Unity) until I specify the projectile to be destroyed. This way, each time the projectile moves I can check with every single players current position and see if the projectile hit (thus allowing me to damage the player on the server-side).

How could I achieve this effect, or something similar?

sentences:
How do I play an animation using lib3ds? I am having trouble playing an animation of a .3ds object using lib3ds.

I am able to load the .3ds model with lib3ds. But I can't find a way to play (for example) my 'walk' animation. Where can I find the animation data and how can I play the animation using lib3ds?

sentences:
Does glScissor affect stencil and depth buffer operations? I know glScissor() affects glColorMask() and glDepthMask(), but does it affect the stencil and depth buffers?

For example:

glEnable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);
glEnable(GL_STENCIL_TEST);

glScissor(X,Y,W,H);

// Is this color mask set only for the scissor area?
glColorMask(TRUE,TRUE,TRUE,TRUE);
// Does this stencil function only work within the scissor area?
glstencilfunc(GL_ALWAYS);
// Does the stencil function only work within scissor area?
glstencilop(GL_KEEP,GL_KEEP,GL_KEEP);
// Is this depth  mask set only for the scissor area?
glDepthMask(GL_TRUE);
// Does this depth function only work within the scissor area?
glDepthFunc(GL_ALWAYS);

sentences:
Should damage calculation in a competitive multiplayer game be done client-sided or server-sided? I'm interested in creating a moba style game like League of Legends and need help with a situation.
More exactly: I have an item that gives the player 50 Attack Damage or an ability that does 50 Attack Damage. Is the information about how much damage the items/ champion abilities do kept in client side of the game or the server.

Option 1: I hit the enemy and the client tells the server to deduct 50HP from the enemy i hit
or
Option 2: I hit the enemy and the client tells the server only that I hit the enemy, then the server looks at the item I have/ ability used and based on code on the serves side deducts the 50HP

sentences:
Blur effect on background to make the forground more clear unity I'm making a game in unity and I'm trying to add a background blur effect to my game to make things a bit more clear.

Here is an example of what I am looking to do:

I'm trying to get the background blurriness and cloudy effect, but I have no idea how to go about getting a similar effect. It looks like a blur + cloudiness of some sort, but I've tried blurring my background objects and it just looks terrible.

Here is what I currently have:

I'm using Unity, it's all 2D sprites so I don't think I can use shaders, which is the only solution I could find people talking about, and have no idea how to proceed. Any help would be appreciated, Thanks.

Edit: Even knowing the terms I could use to search for a solution would help as I'm not quite sure what it is called.

sentences:
How add a sprite to canvas using JavaScript? I'm very new to sprites and I'm trying to figure out how to use them. I want to use a simple solution. Something like this:

var c = document.getElementById ('canvas)
var ctx = c.getContext ('2d');
    ctx.upload('image/testImage');

I'm very sorry if the solution is an obvious one, I'm not very good at JS. I am using pure JavaScript, I don't really like using engines.

sentences:
Is there any public in-game data mining/knowledge discovery repository? I'm taking an Introduction to Data Mining course at the university and we have to work on a final project.

As you may already know, it's difficult to collect this kind of data manually (specially when you're not working for a company of have the proper contacts).

Is there any public collection of in-game data in order to apply data mining algorithms? The kind of data I'm looking for is the sort of data they used in this paper "Predicting Player Behavior in Tomb Raider Underworld".

Characteristics: playing time, number of deaths, causes of death, rewards, treasures. Other kind of in-game data (possible an MMORPG): race, level, equipment, guild, items usage, hp/mp rate, level-up mean time, hours played by day/week/month, log-in/log-off time, etc.

The kind of problems I'd like to tackle could be represented as questions like:

What are the chances a player is likely to pass the game [in X seconds]?
What are the best X guilds to be with in order to meet my expectations as a player and not end up being expelled?
What is the best world area in order to level-up faster now while minimizing death possibilities?

sentences:
How should I design my score to visually accommodate large numbers? I am creating a simple punching game that counts the total number of punches dealt.

Could you suggest a way for my game to visually accommodate very large numbers (>100000). Currently my wire-frame looks like this:

How should I display very large numbers here? I thought about shrinking the fonts, and creating abbreviations, but I'm not sure it's the proper way to go.

sentences:
MonoGame crash trying to load font from .xnb file My MonoGame project uses a pre-compiled .xnb file to load a sprite font, and it works fine on Windows XP. The .xnb file is marked as content and copied to the output directory.

I've copied the project across to a machine running Windows 7, and now the game crashes when I try to load the sprite font. There is no exception thrown. The application just exits with code -1073741819 (0xc0000005).

Both machines have MonoGame 3.0 installed. The Windows XP box (where the game works) also has XNA 4.0.

I can't remember exactly how I generated the .xnb file! I originally just took it from the output of an XNA project, but when I switched from MonoGame 2.5 to 3.0, I remember having some issues with it and tried to use the MonoGame content pipeline instead. So my .xnb file could be from either method.

How can I work out why spritefont loading is failing?

sentences: Drawing in 3D with LibGDX Is there any way to simply draw in 3D, just like you would draw with ShapeRenderer or SpriteBatch? All I want is to draw circles that are in x.y.z coordinates, so some circles are far away from view and some are closer. Also I would like to be able to rotate these circles.

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:
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:
Rotation of sprite is not smooth I am making a speed meter of car. Its pretty simple when ever speed increases or decreases the meter pin moves accordingly. I have done the movement part of pin but I am unable to get a smooth movement.

    public Image meterPin;

    const float maxPinAngle = -116f;
    const float minPinAngle = 16f;

    float meterMinSpeed = 10f;
    float meterMaxSpeed = 210f;

    void Update()
    {
        changeMeterSpeed();
    }
    void changeMeterSpeed()
    {
        meterMinSpeed = userSpeed;
        meterMinSpeed = Mathf.Clamp(meterMinSpeed, 0f, meterMaxSpeed);

        meterPin.transform.eulerAngles = new Vector3(0, 0, getTransformRotation());
    }

    float getTransformRotation()
    {
        float totalAngle = minPinAngle - maxPinAngle;

        float speedNormalized = meterMinSpeed / meterMaxSpeed;

        return minPinAngle - speedNormalized * totalAngle;
    }

The userSpeed value is calculated in another function in this script. The only issue is that the movement is not smooth. Any ideas if I can fix the smoothness issue in this script.

EDIT:

Here is a gif to explain whats happening.

Thanks

sentences:
Component based entity system API naming problems My engine uses a component-based entity system internally, and I want to bind it to Lua for scripting.

Now, I want to save people who write scripts for it typing work. In C++, to set the position of an entity, you'd do the following:

pEntity->GetComponent< CPoint >()->SetPos( Vector( X, Y ) );

That means, if I'd bind it to Lua 1:1 you'd also have to:

ent:GetComponent( CP_POINT ):SetPos( 123, 456 )

But let's be honest, would you want to type so much just to set an entities' position?

I don't think so, that's why I "hid" the component system from Lua:

Right now, what you do is

ent:SetPos( 123, 456 )

The component stuff is handled internally. You can still manually add and remove components from Lua with ent:AddComponent and ent:RemoveComponent, etc.

Now, this doesn't seem perfect either:

The Entity metatable gets cluttered because it has to take all functions of all components
Naming problems: ent:SetJointMotorEnabled() again seems kind of bad

Do you have any ideas how I could find a better naming scheme for component functions, without risking the scripting comfortability?

sentences:
which courses in Computer Science are really needed for game development? I would like to know what courses that somebody interested in game development, should take in a Computer Science Career?

I suppose that are necessary for example:

- Discrete Mathematics
- Computer Graphics
- some programming language courses, for example C++ or C#
- AI
- Web programming

what else does anybody involved in this field could recommend me? I got a group of universities that I would like to apply, but their computer science curricula are not the same for every case.

This question is not for generating a debate about which career to follow. I think the natural way will be to follow CS, but here the question is what model would be more suitable according to the standard curricula?

Somebody from mathematics would lack the background in CS, and also that problem comes with people from arts.

Any advice?

sentences:
Modifying GLFW callbacks I'm currently using Imgui for the GUI part of my OpenGL/C++ engine with the GLFW binding. The problem is though that this binding has encapsulated the input callbacks in a global .cpp file which makes it impossible to access for other classes. Now I could always use the regular routine to handle input without the callbacks like:

if(glfwGetKey(m_window, GLFW_KEY_A) == GLFW_PRESS)
   ...

but yet this won't give me the one-to-one mapping like the key callback provides as the conditional code is processed more than once. I have tried using static booleans without success to see if I could overcome the problem by setting the boolean to true when the key is pressed in the callback and then handling the outcome elsewhere. I also know that you can override callbacks with different ones but that would not make any sence in this case.

Does anyone know how to solve this problem?

sentences:
How do you create images that work for multiple resolutions? I'm currently doing some game development and I've been curious about this situation for many years.

Let's say your game has two resolutions: 640x480 and 800x600 (using small numbers just for simplicity). I have an image that I want to, no matter, take up 1/4 of the screen. For 640x480 resolution, it would be 320x240; while 800x600 resolution, it would be 400x300. There's a few ways I think of that this could be accomplished:

Make the image 320x240 and scale it up on the larger resolution (will look pixelated)
Make the image 400x300 and scale it down on the smaller resolution (loss of detail)
Create two separate images for each resolution (size bloat)

Just for 4:3 aspect ration, you probably have 5-6 resolutions that are commonly found in more professional games; plus additional ones for 16:10 and 16:9. Creating separate assets for each aspect ratio makes sense, but doing it for each resolution sounds like overkill and a huge size jump.

How do developers normally handle this sort of situation?

Thanks!

UPDATE: This information would be used for a 2D platformer.

Part of the reason that I'm interested in this is trying to keep a "level playing field" for all players no matter what resolution they are at. I don't want the 800x600 resolution player to be able to see more of the level than the 640x480 player can.

Additionally, since I really have no graphics experience, I'm not sure how much the resolution changes would affect the integrity of the images.

sentences:
Stop Mesh render on intersect I am generating camera frustum mesh through code, it is working fine. Now I am searching a solution (shader based or else) to restrict
the camera frustum mesh if it intersect with any object. Like you can see in the image my frustum is passing through the plane which is not correct.
How can I control it, I search and apply different kind of shader but nothing worked.

sentences:
Has anyone used MonoTouch for a game? With the pending release of MonoDroid we have decided to revisit MonoTouch as a possible alternative to gearing up some Objective-C skills.  I was wondering if anyone had any experience and would share the gotchas before everyone else hits them.  Set to CW, one hurdle per answer please.

MonoTouch allows C# development of iPhone and iPad applications with access to native code libraries.

sentences:
Why is this orthographic projection matrix not showing my textured quad? I've been following tutorials, mainly this one, and I am still not quite sure why my textured quad is not showing inside the frustum that I've rendered before. I can see it if and only if I don't multiply gl_Position with OrthoProjMatrix * vertexmodelspace, and instead, multiply gl_position with vertexmodelspace.

Here is some of my code; my Main.CPP is also available via PasteBin.

Orthographic Projection Matrix Setup Code:

void OpenGL_Engine::OrthoProjectionSetup(GLuint program)
{
    GLfloat Right = 100.0;
    GLfloat Left = 50.0;
    GLfloat Top = 100.0;
    GLfloat Bottom = 50.0;
    GLfloat zFar = 1.0;
    GLfloat zNear = -1.0;

    GLfloat LeftAndRight = 2.0f / (Right - Left);
    GLfloat TopAndBottom = 2.0f / (Top - Bottom);
    GLfloat ZFarAndZNear = - 2.0f / (zFar - zNear);

    GLfloat orthographicprojmatrix[] = {
    //XX XY XZ XW
    LeftAndRight,
    0.0, 0.0,
    - (Right + Left) / (Right - Left),

    //YX YY YZ YW
    0.0,
    TopAndBottom,
    0.0 ,
    - (Top + Bottom) / (Top - Bottom),

    //ZX ZY ZZ ZW
    0.0,
    0.0 ,
    ZFarAndZNear,

    //WX WY WZ WW
    - (zFar + zNear ) / (zFar - zNear),
    0.0,
    1.0
    };

    GLint orthographicmatrixloc = glGetUniformLocation(program, "OrthoProjMatrix");
    glUniformMatrix4fv(orthographicmatrixloc, 1, GL_TRUE,
        &orthographicprojmatrix[0]);
}

Vertex Shader Code :

#version 330 core

layout(location = 0) in vec4 vertexposition_modelspace;
layout(location = 1) in vec2 vertexUV;
out vec2 UV;
uniform mat4 OrthoProjMatrix;

void main()
{
    gl_Position =  OrthoProjMatrix * vertexposition_modelspace;
    UV = vertexUV;
}

I'm having problems with the orthographic projection matrix; either it is not being done correctly, not setup correctly, my shader is not setup correctly or it's the textured quad that is not in view. Please note that I do not want to use a library for this. What am I doing wrong?

sentences:
How can I make background elements wrap around the screen? I'm looking to make my clouds wrap around the screen in my game (like the picture).

Right now it just continues off the screen. The current movement code is:

Cloud.center = CGPointMake(Cloud.center.x +0.032, Cloud.center.y)

sentences: How do I override a SteamVR Controller's transforms in Unity? I'm trying to provide an illusion to the user by rotating the controller about an arbitrary axis in the LateUpdate() method. But this doesn't seem to be having any effect as the controller probably is constantly getting updated by its real world location. Is there any way to override its real world position and orientation with a transformation in script?

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:
curve of animation in C# I think that the animation curves in Unity lack the fact of being configurable because they are only chosen with a certain type (no sinusoidal function) and adjustable with handles.

How in C # create an animation (tanslation, rotation, scale) so as, for a selected mesh, to introduce parameters of a chosen mathematical function and any corresponding, if it is a translation for example, to x_position, y_position and z_position in function of the time variable?

thank you !

What if I now need to define time intervals?
for example:

a function f1 on [0.20]

a function f2 on [20.50]

The most difficult is to convert by the correct Time.time factor so that the real time varies well in seconds within the limits defined by each of these intervals.

thanks

sentences:
Why is my primitive xna square not drawn/shown? I have made this class to draw a rectangle, but I cant get it to be drawn, I have no issues displaying a 3d model created in 3dmax, but shown these primitives seems much harder

I use this to create it

board = new Board(Vector3.Zero, 1000, 1000, Color.Yellow);

And here is the implementation

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Shapes;
using Quadro.Models;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Quadro
{
    public class Board : IGraphicObject
    {
        //Private Fields
        private Vector3 modelPosition;
        private BasicEffect effect;
        private VertexPositionColor[] vertices;
        private Matrix rotationMatrix;
        private GraphicsDevice graphicsDevice;
        private Matrix cameraProjection;

        //Constructor
        public Board(Vector3 position, float length, float width, Color color)
        {
            var _color = color;

            vertices = new VertexPositionColor[6];
            vertices[0].Position = new Vector3(position.X, position.Y, position.Z);
            vertices[1].Position = new Vector3(position.X, position.Y + width, position.Z);
            vertices[2].Position = new Vector3(position.X + length, position.Y, position.Z);
            vertices[3].Position = new Vector3(position.X + length, position.Y, position.Z);
            vertices[4].Position = new Vector3(position.X, position.Y + width, position.Z);
            vertices[5].Position = new Vector3(position.X + length, position.Y + width, position.Z);

            for(int i = 0; i < vertices.Length; i++)
            {
                vertices[i].Color = color;
            }

            initFields();
        }

        private void initFields()
        {
            graphicsDevice = SharedGraphicsDeviceManager.Current.GraphicsDevice;
            effect = new BasicEffect(graphicsDevice);
            modelPosition = Vector3.Zero;

            float screenWidth = (float)graphicsDevice.Viewport.Width;
            float screenHeight = (float)graphicsDevice.Viewport.Height;
            float aspectRatio = screenWidth / screenHeight;
            this.cameraProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
            this.rotationMatrix = Matrix.Identity;
        }

        //Public Methods
        public void Update(GameTimerEventArgs e)
        {

        }

        public void Draw(Vector3 cameraPosition, GameTimerEventArgs e)
        {
            Matrix cameraView = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                effect.World = rotationMatrix * Matrix.CreateTranslation(modelPosition);
                effect.View = cameraView;
                effect.Projection = cameraProjection;
                graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 2, VertexPositionColor.VertexDeclaration);
            }
        }

        public void Rotate(Matrix rotationMatrix)
        {
            this.rotationMatrix = rotationMatrix;
        }

        public void Move(Vector3 moveVector)
        {
            this.modelPosition += moveVector;
        }
    }
}

sentences:
How to implement an event system Im trying to implement an Event System for a game, where there are classes that can fire or handle an event wheter or not they implement these interfaces:

public interface IGameEvent<T> where T : EventArgs
{
     event EventHandler<T> OnEvent;
}

public interface IGameHandler<T> where T : EventArgs
{
    void OnEvent(object sender, T e);
}

everything looked great until i realized that no class can implement more than 1 IGameEvent because it would cause duplicate declaration,

Here is an example:

public class Event
{
    public KeyPressEvent OnKeyPress;
    public UpdateEvent OnUpdate;

    public void AddHadler<T>(IGameEvent<T> eEvent , IGameHandler<T> eHandler) where  T : EventArgs
    {
        eEvent.OnEvent += eHandler.OnEvent;
    }

    public void RemoveHandler<T>(IGameEvent<T> eEvent, IGameHandler<T> eHandler) where T : EventArgs
    {
        eEvent.OnEvent -= eHandler.OnEvent;
    }
}

KeyPressEvent:

public class KeyPressEvent : IGameEvent<KeyPressEvent.KeyPressedEventArgs>
{
    public class KeyPressedEventArgs : EventArgs
    {
        public KeyPressedEventArgs(Keys key)
        {
            Key = key;
        }

        public Keys Key { get; private set; }
    }

    public event EventHandler<KeyPressedEventArgs> OnEvent;

    private void OnCheckForKeyPressed()  //Example
    {
        if (OnEvent != null)
            OnEvent(this, new KeyPressedEventArgs(Keys.Space));
    }
}

Would be better to manually store the suscribers in a list in the EventSystem ?

How slower or faster than this approach that would be?

Thanks!

sentences:
Allowing one sprite to move through another in Quintus I have a Bumper class extended from Sprite:

Q.Sprite.extend("Bumper", {

    init: function(p) {
        this._super(p, {gravity: 0});
        this.add("2d, ... //etc.
}

I have an Enemy class that should trigger a function when the center of the Bumper and of the Enemy collide.

I was thinking about doing something like this in my Enemy class :

this.on("bump.top, bump.bottom, bump.left, bump.right", function(collision) {
    if(collision.obj.isA("Bumper")) {
        if (this.p.x == collision.obj.p.x && this.p.y == collision.obj.p.y) {
        //Do something
        }
    }
});

But for that I need the two sprites to move through one another. Is there a way to do that while still checking for collision ?

sentences:
Unity Visual Effect: Play() has no effect I am making my first visual effects, and I make effect, when my ship is flying. So I am want to play it only when the ship is actually moving. I would suppose it's easy, you call Play(), it will play. You play Stop() it will stop. But when I call play, nothing happens.
public void Update()
{
    _ship.Rotate(Input.GetAxis("Horizontal"));

    var move = Input.GetAxis("Vertical");
    _ship.Move(move);
    if (move > 0)
    {
        FlyEffect.Play();
        FlyEffect.SetVector3("Velocity", new Vector3(0, -_ship.Speed * move, 0));
    }
    else
    {
        FlyEffect.Stop();
    }
}

When I let in Initial Event Name OnPlay, it is playing as it should be. But nothing from the script... What I am missing here?

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:
Rotating image angle, direction of object that is resting on floor object I have an object, in this case a space ship, resting on a floor or platform object. The bottom of the space ship is flat, and is resting flush with the flat surface of the platform object (due to my collision detection). Now obviously, the player is able to move the space ship by pressing up. The player is also able to turn the ship (image_angle and direction) by pressing left or right, which transfers the speed to that direction if they are flying. However, in the scenario mentioned above where the ship is currently resting flat on a flat surface, if the player presses left or right, the ship still rotates and the sides clip into the surface of the platform, which causes collision detection to essentially glue the ship to the platform. How can I use collision detection to allow the player to still rotate the ship while it is resting on a flat surface, but instead of clipping, have the object perhaps "roll" or fall over?

here is my collision detection:

// Gravity
if (vspeed < 10) vspeed += .02;

// Collision detection
if (place_meeting(x, y + vspeed, obj_block))
{
    while (!place_meeting(x, y+1, obj_block))
    {
        y += 1;
    }
    vspeed = 0;
    hspeed = 0;
}

sentences:
Isometric tiles math for 4:3 ratio (64 x 48 pixels) I've read and tested the code from this article, http://clintbellanger.net/articles/isometric_math/, and also from this Isometric rendering and picking? and I can get the math and tile picking to work properly for a 2:1 isometric base tiles. However I haven't come across any article on tile picking math that involves a 4:3 ratio isometric base tiles. Can I just use the same math for the 4:3 ratio isometric or should I change it to make it work? If so, can anyone point me in the right direction of what is the right tile picking math for a 4:3 ratio isometric base tiles?

Thank you.

sentences:
How can I fix sprite vibrating randomly which is moving towards the mouse while using camera.position set to the sprite as the center? So, when I use

camera.position.x = player.x;
camera.position.y = player.y;

to set the center of camera to my sprite, the code doesn't work as intended to. It's slightly hard to explain so i made this video(https://youtu.be/afCamx_wB_4) in which I show how it should work and the difference/problem when using camera.position

The code related to this is:

function setup() {
  createCanvas(displayWidth,displayHeight);
  level = new Level;
  player = createSprite(100,100,10,10);
  edge = createEdgeSprites();
  player.speed = 5;
}

function draw() {
  background(255);
  level.play();
  player.rotation = Math.atan2(mouseY-player.y, mouseX-player.x) * 180/PI;
  drawSprites();
}

player.collide(edge); //this part is from level.play()
var run = mouseX - player.x;
var rise = mouseY - player.y;
var length = sqrt((rise*rise) + (run*run));
var unitX = run / length;
var unitY = rise / length;
player.x += unitX * player.speed;
player.y += unitY * player.speed;

Also if you notice, when using camera.position, the vibration happens at specific distance of the sprite from the mouse, and the patter is that the distance is 0 right at the center of the canvas and keeps increasing as you move away from the center.

sentences:
box2d resize bodies arround point I have a compound object, consisting of a b2Body, vector-graphics and a list polygons which describe the b2body's shapes. This object has its own transformation matrix to centralize the storage of transformations. So far everything is working quiet fine, even scaling works, but not if i scale around a point.

In the initialization phase of the object it is scaled around a point. This happens in this order:

transform the main matrix
transform the vector graphics and the polygons
recreate the b2Body

After this function ran, the shapes and all the graphics are exactly where they should be, BUT:
after the first steps of the b2World the graphical stuff moves away from the body.
When I ran the debugger I found out that the position of the body is 0/0

the red dot shows the center of scaling. the first image shows the basic setup and the second the final position of the graphics. This distance stays constant for the rest of the simulation.

If I set the position via

myBody.SetPosition( sx, sy );

the whole scenario just plays a bit more distant for the origin. Any Idea how to fix this?

EDIT::

I came deeper down to the problem and it lies in the fact that i must not scale the transform matrix for the b2body shapes around the center, but set the b2body's position back to the point after scaling. But how can I calculate that point?

EDIT 2 ::

I came ever deeper down to it, even solved it, but this is a slow solution and i hope that there is somebody who understands what formula I need.

assuming to have a set polygons relative to an origin as basis shapes for a b2body:

scaling the whole object around a certain point is done in the following steps:

i scale everything around the center except the polygons
i create a clone of the polygons matrix
i scale this clone around the point
i calculate dx, dy as difference of clone.tx - original.tx and clone.ty - original.ty
i scale the original polygon matrix NOT around the point
i recreate the body
i create the fixture
i set the position of the body to dx and dy

done!

So what i an interested in is a formula for dx and dy without cloning matrices, scaling the clone around a point, getting dx and dy and finally scale the vertex matrix.

sentences:
How to apply a script to multiple Objects in Unity? In Unity, I've almost 200 or more objects. I wish to apply single script to all those objects.

I'm a beginner & learning scripts in Unity.

Edit: At the time of editing the scene itself.

sentences:
Kryonet - Open a server locally only On the game I'm working on I wanted the singleplayer mode to use an integrated server to make adding more players via networking easier. The way I have it right now is I open a server and connects the client to my local address which works fine. But the problem is that if I play the game Singleplayer I don't want to leave anything exposed to the internet while only playing locally. Is there any way to limit the "range" of the server to only let communication happen via LAN?

Thanks in advance!

EDIT: I am using kryonet for networking. The game is written with LibGDX.

sentences:
Why Sorting process not happening? I created 10000 array and assigned value 1 and 0 to it, then used gizmos to generate 10000 cubes. I paint it black or white depending on the assigned value.
After that I use the bubble sort algorithm to sort the cubes, expecting all black cubes pieled on the bottom but when I run it, the sorting does not happen and I can't spot where my mistake is.
    using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    int x;
    int y;
    int z;

    int[,] array1 = new int[100, 100];
    int temp;
    // Start is called before the first frame update
    void Start()
    {

        for (x = 0; x < 100; x++)

        {
            for (y = 0; y < 100; y++)
            {
                array1[x, y] = Random.Range(0, 2);

                Debug.Log(string.Format("{0},{1},{2}", x, y, array1[x, y]));

            }
        }
        OnDrawGizmos();

    }
    void OnDrawGizmos()
    {

        for (x = 0; x < 100; x++)
        {
            for (y = 0; y < 100; y++)
            {
                Vector2 pos1 = new Vector2(0 + x, 0 + y);
                Gizmos.DrawCube(pos1, transform.position);
                Gizmos.color = (array1[x, y] == 1) ? Color.black : Color.white;
            }
        }
    }

    void update()
    {
        for (z = 0; z < 100; z++)
        {
            for (x = 0; x < 100; x++)
            {
                for (y = 0; y < 100 - z; y++)
                {
                    if (array1[x, y] > array1[x, y + 1])
                        temp = array1[x, y];
                    array1[x + 1, y] = array1[x, y];
                    array1[x, y] = temp;

                }
            }
        }
        OnDrawGizmos();
    }
}

sentences:
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:
Why is it when I render a basic cube, my editor's grid changes too? I have one HLSL file for DirectX11 that only has input layout for color and position. Then another HLSL file for the simple cube that has position, normal and textures. What I noticed is when I render the simple cube; the grid also changes and doesn't remain pure white color. They have different pixelshaders, vertexshaders, constant buffers and different inputlayout descriptions.

Would anyone like to chip in and help get this resolved? This has been puzzling for a day!

sentences:
Unity networking, make player disappear for all clients As title says I need to make the player disappear when he gets in car. Right now, it works as a single-player, but since I am new to unet I don't really know how to achieve this, I tried some ways, but they didn't work. Here is script:

 [Client]
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     //so if we hit car
     if(hit.collider.tag == "Vehicle")
     {
         //if we pressed "E"
         if (Input.GetKeyDown(KeyCode.E))
         {
             //call method to disable some stuff taht should be disabled, like: controller, shoot, weapons etc.
             if (isServer)
                 CmdCall(inVehicle, hit);
             else
                 RpcCall(inVehicle, hit);
         }
     }
 }
 [Command]
 void CmdCall(bool invehicle, ControllerColliderHit hit){

     RpcCall(inVehicle, hit);
     }
 [ClientRpc]
 void RpcCall(bool invehicle, ControllerColliderHit hit)
 {

     disable(inVehicle, hit);
 }

  I can't see any errors in console but I cant enter play mode cause there are some compiler errors, which again i cant see in console. thank you for any tip, comment, downvote, upvote, or hint :)

--Nick.

sentences: Handling game states like Braid's timeshift or Shooter's Killcam me as very unexperienced game developer, I wondered how I could achieve something like re-winding the time in my game or jump back to a special moment (killcam) and replay it for the user.

sentences:
How to allow infinite custom inputs? Summary: What approach should I take to allow custom inputs saved in a file be interpreted in the engine?
So I am making a game engine similar to Mugen where I want characters to have their own special combo inputs. Similar to how Kage has the Shun Goku Satsu. Where its just a combination of multiple keys pressed in quick succession. The thing is I want to give the ability to create these combinations to the character creators and let the engine handle the rest.
I already parsed the list of moves from the character file, so now I got an in-memory list of valid input sequences for each character and what moves they trigger. But I don't really know how to interpret a valid sequence.

sentences:
Is there a way to do local multiplayer on a combination of Windows/Ubuntu computers? So far I've tried Bluetooth but it doesn't appear to work on either windows or Ubuntu (for this use-case; it can connect to printers fine). I've also looked up USB-bridge-cables, but from what I’ve read so far, they can't be used for this, either.

Since the game is a hobby-project, the solution can neither be expensive, nor require months of work. It's a turn-based game. Otherwise I wouldn't be asking but finding a different project after finding out neither Unity nor Unreal Engine can do this; currently, I'm using neither.

Is there a way to do local multiplayer on a combination of Windows/Ubuntu computers?

sentences:
Java 2D Game Development - Best Performance With Rendering I have seen two different rendering methods. One of them is rendering multiple bufferedImages like g.drawImage(image1 to imagexxx, x, y). Like in my game I have to render, on each tick, 880 buffered images. This is very bad. I have a good computer but my max fps is 140. There should be another way to get better performance.

The second way is drawing one single bufferedImage and setting its pixels to RGB from the other bufferedImages.

What is the best way? Is there another way to get better performance?

sentences:
Calculate object coordinates from window coordinates using inverse projection matrix What I am trying to to is placing 3D Objects (A Sphere) in the world when I click there.

I am using a perspective projection so the first step after calculating the canonical clip coordinates from window coordinates is to reverse the perspective transformation:

    void addSphere(int screenX, int screenY) {
    // invert y axis
    screenY = screenHeight - screenY;

    // determine depth of the pixel
    GLfloat z;
    glReadPixels(screenX, screenY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);

    // transform x and y to canonical clipping space
    GLfloat x = -1 + (screenX / (float)screenWidt) * 2;
    GLfloat y = -1 + (screenY / (float)screenHeight) * 2;
    std::cout << "<" << x << "," << y << "," << z << ">" << std::endl;

    // now we reverse the projection which means we have object coordinates
    // given the MODELVIEW Matrix is identity
    glm::vec4 center = glm::vec4(x, y, z, 1);
    center = inverseProjection * center;
    std::cout << glm::to_string(center) << std::endl;

    // add the sphere centered at the calculated position
    Sphere *sp = new Sphere(center);
    sphereList->push_front(sp);
}

The big question is what do I insert for the forth value for the center vector? As far as I see there is no method to get the transformed w value from the framebuffer.

sentences:
How to make transitions between images in canvas (unity) So I have 3 same images, but with different colors which I want to cycle in my menu. They are only with different hue/saturations and I want them to slowly reduce their alpha 1 by 1 so that the one behind pops up and then restart the cycle.

I'm trying to set a public image and reduce it's alpha, but it's not smooth.

sentences:
Scale screen space quads (used in font rendering) I have quads positioned in <0, 1> x <0, 1> coordinates. I use this system for font rendering.

In vertex shader I have:

gl_Position.xy = 2.0 * POSITION.xy - 1.0;

that brings the position to the screen space <-1, 1> x <-1, 1>.

My quads are created from two triangles ABD, BCD

D-C
|\|
A-B

Now, I want to scale the quad by a scale factor. Can I achieve this with this data?

I have tried to change geometry and store quad center and half-sizes, then calculate the final position as

gl_Position.xy = 2.0 * (CENTER_POSITION.xy + HALF_SIZE.xy) - 1.0;

This way, I can translate points to origin, scale them and translate them back. However, this scale single quad correctly, but the two closely neigboring quads are no longer closely neigboring, since the space between them is constant.

So the final question. How can I scale quads used for font rendering, so that the text is still readable without large gaps between glyphs?

sentences:
NullReferenceException in StartCoroutine method Maybe it's a repeated subject in the community but other answers didn't solved my question...

I tried as the tutorial: http://answers.unity3d.com/questions/11021/how-can-i-send-and-receive-data-to-and-from-a-url.html and worked fine in start method but when I try:

public Class A
 {
 //    ...CODE...
 new B().JSONRequest(jsonString);
 }

public Class B
{

public void JSONRequest(string json) {
string url = URL.LOCAL.url;
Hashtable postHeader = new Hashtable();
postHeader.Add("Content-Type", "application/json");
UTF8Encoding encoding = new System.Text.UTF8Encoding();
WWW request = new WWW(url, encoding.GetBytes(requisicaoJSON.ToCharArray()), HashtableToDictionary<string, string>(postHeader));
 print("Request: "+request);

StartCoroutine(WaitForRequest(request));
}

IEnumerator WaitForRequest(WWW www)
{
    yield return www;
        // check for errors
        if (www.error == null)
        {
            Debug.Log("WWW Ok!: " + www.data);
        } else {
            Debug.Log("WWW Error: "+ www.error);
        }
    }
}

It gives me in the StartRoutine line:
NullReferenceException
UnityEngine.MonoBehaviour.StartCoroutine (IEnumerator routine) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineMonoBehaviourBindings.gen.cs:61

Console prints Request: UnityEngine.WWW so it does not appear to be null. –

sentences:
Android split build - manual obb file download necessary? I have an apk built with Unity 5.0.1 that has over 50MB. Google Play does not accept files over 50MB so I have to make a Split Build as covered in the Unity manual:
http://docs.unity3d.com/Manual/android-OBBsupport.html

Now it says that I need to download the obb file manually. On the other hand, elsewhere I read that all apps that are downloaded from the play store are already downloaded with the obb file. So which one is it? Do I have to use the Google Play Obb Downloader or not? Where is the downloaded obb file stored in the filesystem?

sentences:
Finding closest coordinate of a pre-known set Let's say I have a large number of conceptual objects of some kind, each of which occupies a pre-known set of points in a Cartesian 3-space.

1) What is the best combination of data structure (for modeling these objects, their occupied points, and/or the enclosing space) and algorithm for the purpose of being able to retrieve only the point within each object that lies closest to an arbitrarily selected point, with speed the first concern and memory footprint secondary (but still important)?

2) Let's say that that a point may be visually occluded with respect to another point, according to a black-box true/false rule, and I now want to retrieve the closest visible point of each object.  Asking the same question as in #1, is the answer the same or is something else now advisable?

3) Let's say that the pre-known set of points for each conceptual object may potentially change somewhat frequently, enough so for computational expense in data structure management to be a concern.  Are the answers to #1 and #2 still good, or are they expensive enough in setup/teardown to be likely to cause problems under this condition?

(I really do want to know the answers to these items separately, if they have distinct answers.  Mega bonus points for any answers that generalize well to a Cartesian 4-space.)

sentences:
Will Unity skills be transferable? I'm currently learning Unity and working my way through a video game maths primer text book.

My goal is to create a racing game for WebGL (using Three.js and maybe Physic.js).

I'm well aware that the Unity program shields you from a lot of what's going on and a lot of the grunt work attached to developing even a simple video game, but if I power through a bunch of Unity tutorials, will a lot of the skills I learn translate over to other frameworks/engines?

I'm pretty proficient at level design with WebGL, and I'm a good 3D modeller. My weaknesses are definitely AI and Physics.

While I am rapidly shoring up my math, and while
Physics is undeniably interesting there's only so many hours in the day and there's a wealth of engines out there to take care of this sort of thing.

AI does appeal to me a lot more, and is a lot more necessary. AI changes drastically from game to game, is tweaked heavily during development, and the physics is a lot more constant.

Will leaning AI concepts in Unity allow me to transfer this knowledge pretty much anywhere? Or will I just be paddling up Unity creek with these skills?

sentences:
Do iOS users use Facebook and Twitter buttons within games? Does anyone have any insight or experience into the successfullness of placing Facebook or Twitter "share" buttons within an iOS game?  For example, when a user gets a high score, presenting them with the option to share their score via Facebook or Twitter.

My reservations/bias against including Facebook or Twitter buttons in my game are:

Distrust of buttons that auto-post without giving one the chance to format the text yourself
I don't use themself because I tend to manually create tweets or Facebook wall posts on my own

On the other hand, the potential benefits of such buttons can obviously be profound.  The question is simply: do iOS users actually use such buttons?

sentences:
Have two steamworks accounts? I am finishing my game project and I already have my steamworks registration, I am just fine-tuning details and preparing marketing for the start.

But I look a little short of cash, I would like to invest more in marketing, when I heard this, a friend recommended that I sell some educational games that I had done a while ago (type "dora the explorer") but I don't want to publish them in my account , since my current project is a game of gore, blood, violence etc. I don't think it's right that they are "together", can I generate a new steamworks account to publish my other games?

I have not found anything in the document confirming that yes or no

sentences:
ResourceContentManager with folders I am attempting to do something like the following:
http://blogs.msdn.com/b/shawnhar/archive/2007/06/12/embedding-content-as-resources.aspx
(Access the content via a DLL)

However, I need to maintain the folder structure of the fonts and images. I have attempted to add the folders to the resources file, but it doesn't add the folder if I drop it in the resources file in VS. I am thinking I might need to embed the content as just a regular folder, and each file will need its property to be set to embedded resource, but I need to use it in another assembly.

I looked at: http://zacharysnow.net/2010/07/03/xna-load-texture2d-from-embedded-resource/
but I think I can only do that with textures. I need to do it with fonts as well.

I looked at: https://stackoverflow.com/questions/859699/how-to-add-resources-in-separate-folders and that doesn't seem to help me much.

Whats the best way I can embed my resources in another assembly, while maintaining my content loading strings?

sentences:
Rendering hundreds of animated characters in Unity3D I am currently doing some research in anticipation to the development of a game where there is going to be hundreds of secondary entities which will interact with the player and among themselves (little soldiers with a very simple AI and not too many faces).

What I've found so far is that there is a way of avoiding the GameObject overhead, at least for the rendering bit of things, by using the Graphics class, with the Drawmesh method more specifically.

I've tested it and it's not too complicated. I could render any of my models using it and then make them move by rendering the graphics around coordinates in some non-unity "Character" object. The fact that the drawmesh call has to be every frame is actually quite convenient in this case !

However, I've ran into a problem : how do I deal with animated objects ?
Now, I've also done some research on that, and what I've found is that you can "Bake" the skinned mesh into a mesh usable with Graphics.Drawmesh. Then I thought about rendering animated far away characters by updating their mesh with their current animation at a certain interval. This would make the character look wierd but at long distances and among many others it should render quite well.

But the thing is, since I don't want to create a GameObject for each entity, or more precisely only for the ones up close that need a collider and everything so the players can target them with a raycast. And I sure as hell don't want to create a skinned mesh renderer for each far-away character, as it would defeat the point of using Graphics.Drawmesh.

I've thought about one solution to this problem : I could have one "hidden" GameObject with the proper models and animations get requests from "Optimized", meaning far-away character to set himself to a certain frame of a certain animation, bake his mesh and send it back to whoever requested it. I did not run any tests with that solution (I came up with it while writing this) but I'm kinda afraid that updating the mesh of a single entity potentially hundreds of times per frame might lead to wierd behaviors. Besides, I'd have to put it far away so that it doesn't get found by the players.

So, my exact question is : Do you have any better idea as to how I could optimize rendering all those characters some other way, and if not, is there a way to ask Unity "what would this mesh look like on this frame of this animation", thus allowing me to avoid creating a Gameobject just for that.

Thanks a lot in advance !
Cheers !

sentences: How to apply Collider to Particle and what components are needed for particles? i want to apply collider to particle system because if i applied the collider to particle ,if any other game object touched to that particle its gives some action or do some operation.so only i need.

sentences:
Optimal solution to render sprites with transparent edges in Unity Since I'm currently developing a 2D game for mobiles, overdraw and drawcall count is my first priority in the design of the application
I've thought initially to split each sprite in two parts: one where each pixel is fully opaque (to render with cutout shaders in front-to-back order) and the other part with semi transparent edges (which will be ordered back to front)

Since I need to support ES2.0 devices, I can't use texture-arrays and I need to fit as many sprites as possible in a single 2048x2048 texture atlas to reduce drawcalls and ensure mobile compatibility, but as you can see from this picture:

Splitting sprites in opaque and non-opaque parts will certainly double the space occupied in the atlas, thus decreasing by half the potential amount of consecutive sprites I can draw in a single drawcall

This way, I'm paying drawcalls to reduce overdraw.
By rendering the entire sprite with transparent shaders I'd pay overdraw to reduce drawcalls.

Am I missing something? Is there a better approach?

sentences:
How can I reduce aliasing in my outline glow effect? I'm trying to replicate the glowing outline effect in the Left 4 Dead game. The effect causes an objects outline to glow, even when the object is occluded. Here is a screenshot of the effect:

I'm somewhat able to replicate this effect in my OpenGL based program. This is what I'm currently doing:

Create a color and depth texture that is half the screen size for rendering the glowing objects
Clear the glow color/depth textures. Color is cleared to black.
For each glowing object, render it to the glow texture as a solid color
Perform a separable gaussian blur on the glow texture
Render the full resolution scene as normal
Additively blend the glow texture with the normal scene, but use the glow depth texture to mask out the object, leaving just the blurred outline.

Here is a screenshot of my approach:

Here is the fragment shader that combines the glow texture with the scene:

uniform sampler2D glowColorTex;
uniform sampler2D glowDepthTex;
uniform sampler2D sceneColorTex;
void main()
{
    vec2 uv = gl_TexCoord[0].st;

    vec4 color = texture2D( sceneColorTex, uv);

    float depth = texture2D( glowDepthTex, uv).r;
    if(depth == 1.0) {
        color += 2.0 * texture2D( glowColorTex, uv);
    }

    gl_FragColor = color;
}

As you can see, it seems to work for the most part, but the aliasing on the outline is really bad.

Does anybody have any suggestions for smoothing the inner edge of the outline?

Should I be sampling the neighboring depth values of each pixel and scale the glow based on the number of depth values that equal 1.0?

Or is there a better approach that will produce smoother results?

sentences:
Unity UI Mask is not working in samsung SM-G610f I am using unity 2018.3.13f1 and getting the issue that unity ui mask is not working in a specific device like Samsung SM-G610f.
The masking work in other android devices. But(Samsung SM-G610f) the mask became rectangle.
Below is the reference image link.
https://drive.google.com/file/d/1aTvKIxFh0HhNXgTYg5FOqvTsCy0aqr4e/view?usp=sharing
Please help.
Thanks.

sentences:
Where is the LocalizedFontProcessor in XNA? I tried this tutorial to localize my XNA Windows Phone game, but I can't find the LocalizedFontProcessor in the drop-down list. Why is the LocalizedFontProcessor missing in the drop-down list? What is wrong?

In this picture you can see that the LocalizedFontProcessor is missing in the drop-down list:

Is there another way to localize a Windows Phone game?

Edit: Here is my LocalizedFontProcessor class

namespace LocalizationPipeline
{
[ContentProcessor]
class LocalizedFontProcessor : ContentProcessor<LocalizedFontDescription,
                                                SpriteFontContent>
{
    /// <summary>
    /// Converts a font description into SpriteFont format.
    /// </summary>
    public override SpriteFontContent Process(LocalizedFontDescription input,
                                              ContentProcessorContext context)
    {
        // Scan each .resx file in turn.
        foreach (string resourceFile in input.ResourceFiles)
        {
            string absolutePath = Path.GetFullPath(resourceFile);

            // Make sure the .resx file really does exist.
            if (!File.Exists(absolutePath))
            {
                throw new InvalidContentException("Can't find " + absolutePath);
            }

            // Load the .resx data.
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(absolutePath);

            // Scan each string from the .resx file.
            foreach (XmlNode xmlNode in xmlDocument.SelectNodes("root/data/value"))
            {
                string resourceString = xmlNode.InnerText;

                // Scan each character of the string.
                foreach (char usedCharacter in resourceString)
                {
                    input.Characters.Add(usedCharacter);
                }
            }

            // Mark that this font should be rebuilt if the resource file changes.
            context.AddDependency(absolutePath);
        }

        // After adding the necessary characters, we can use the built in
        // FontDescriptionProcessor to do the hard work of building the font for us.
        return context.Convert<FontDescription,
                               SpriteFontContent>(input, "FontDescriptionProcessor");
    }
}
}

sentences:
The children of a Transform are in reverse order I am making a simple 4-player turn-based card game.
At one point, a player can "open" his hand on the table. As the player does this, I want cards to be aligned in a way such that left side of each one is visible.

In my hand, the cards look like this.

When I carry them on the table, they look like this

Not only the order is reversed, which I wouldn't mind, but also the cards are not visible now.

This is how the green area looks like in the Inspector

I don't want cards to change shape to fill the area, and I also don't want them to go outside the green area.

When I unselect Control Child Size, the cards are aligned just as I want, but now they are too spread out and outside the green area.

Is there a way to achieve the behavior that I want?

sentences:
Making an efficient collision detection system I'm very new to game development (just started 3 months ago) and I'm learning through creating a game engine. It's located here. In terms of collision, I know only brute-force detection, in which case, the game slows down if there are a number of objects. So my question is How should I program the collisions?

I want them to happen automatically for every object and call the object's collision(GObject other) method on each collision.

Are there any new algorithms which can make this fast?
If so, can anybody shed some light on this topic?

sentences:
Apply a texture on a Box - jMonkeyEngine How can i wrap a texture (for ex a 4x4 pixels) on a box (1x1x1) in such a way that the texture is repeated and not enlarged to cover all the surface.

 Geometry box = new Geometry("Box", new Box(1f,1f,1f));

sentences:
Using Racing Wheel force feedback with a JavaScript game I have a Thrustmaster T80 Racing Wheel that I am using while developing an online game with ThreeJS.

I have already made it so I can drive the car with the wheel and the game knows when I crash the car. But looking online I couldn't find a way to make the wheel 'rumble' or shake when the car crashes.

The wheel does support this on other (downloaded exe) games but it would be amazing if it was possible to achieve in a JS game, but I couldn't find any mention of doing this online.

sentences:
How to know if an overriden method calls its super method or not? Consider this situation, where a Player class inherits from a more general Actor class:
Actor.gd
class_name Actor extends KinematicBody2D

func _ready():
    print("I am an actor")
    _foo()

func _foo():
    print("I was thinking I was an actor")

Player.gd
class_name Player extends Actor

func _ready():
    print("I am a player")

func _foo():
    print("I was thinking I was a player")

When one instantiate a player in a scene, we have this output:
I am an actor
I was thinking I was a player
I am a player

How to know when a method will call its super class?

sentences:
Box2D/Farseer - Moving fixtures on a Static Body I am attempting to create a Pool of Fixtures, in order to reduce memory consumption.  My problem is that when I attempt to return a Fixture to the Pool and re-assign its position on the Parent Body, once it is repositioned the Fixture no longer provides any collision response with other world objects.

It seems that if you want to move a Fixture on a Static body, it needs to be destroyed and re-created.  This method doesn't allow me to use my Pool however.

Does anyone know if it is possible to move a Fixture on a Static Body?  I do not want to move the Body, but the Fixtures attached to it.

sentences:
3DS Max MassFX -- Animation to XNA without bones/skins? I made a model in which a number of cobble stones fall into a hole using the rigid bodies in 3DS Max 2012 MassFX. They are just editable polys, no skin, no bone. I want this to play (Take 001, 0-100 frames) when the game loads the mesh. I haven't found a way to get to the animation though.

Does anyone have suggestions? All the tutorials for animated skinned models don't seem to work with a model set up like this? Do I really need to give each of 145 rocks a bone? If so, does anyone have a suggestion how to streamline that, or if there is an alternate solution to achieving this effect? The animation only needs to play once when the game starts, and that's it.

Thanks.

sentences: What is the benefit of YCbCr? Why would someone want to store images as YCbCr instead of RGB in RAM or in GPU memory?

sentences: Unity post processing Bloom lags on mobile I made my (first) game today and noticed, that it looked kind of boring, so I decided to add some bloom to my camera and it was looking waaay better. The only problem was the performance, it dropped down from constant 60 fps to like 20-30, I looked it up in the profiler to be sure and yep, it was the post-processing, I saw mobile games which had post-processing including bloom, but these games never lagged on my phone. My phone has pretty good specs for a phone (Samsung Galaxy M20) so how do I make my post-processing performant, are there some special settings I have to make or is it just my phone?

sentences:
How to create a mathematical mechanism in order for a game to be balanced? For example, in a game like Diablo, how did they decide how much damage each skill does?
Is it the amount of clicks that the player needs to do? Or maybe the expected lifetime of a player? Maybe calculate the probability that the player will die?

sentences:
How can I clear the screen in Xcode? so I am following a tutorial to make a snake game in my Xcode console. But the tutorial i am following is using windows and therefore the "system("clear")" command isn't working with my mac, and all of my research seems to show that there is no way to do that in Xcode

my question is, don't many games need to have their screen cleared constantly?
how would games that are being designed in Xcode clear their screens if there is no easy way to do this?

sentences:
DirectX function calls' duration Today I downloaded Nvidia Nsight in order to profe my game GPU side and I came across some doubts:

I can't find only any resource of what are the average times for the
different DirectX functions (such as map/unmap, clear the target
view, draw (even if is strongly dependant on shader and similar my
are really basic), ...) and so I can't know if my values are normal
or not. For example for the map function (with write_discard) I've
got an average of 0.8-1 microseconds.
There are always peaks in each function: map() for example goes up to
200 microseconds (randomly and rarely).

Here's a screenshot:

Is it normal?

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:
RWTexture3D in Compute Shader on Intel HD 4000 I'm having some weird issues running a Compute Shader with DirectX 11 on an Intel HD 4000 GPU.

The goal is to write different shapes into a DXGI_FORMAT_R32_FLOAT 3D Texture with a size of 128x128x128 - the example below creates a sphere.

On a NVidia GTX 680 the texture is generated fine, but on an Intel HD 4000 it seems the Z-coordinate/3D texture slice coordinate is multiplied by 4 (see image below).

The drivers for the Intel GPU are up to date (Dec 2015). The compute shader is executed only once, immediately after initializing DirectX swapchain/viewport/... and I disabled all other render code in the application which could influence the compute shader.

I'm running DirectX with D3D11_CREATE_DEVICE_DEBUG enabled which prints no warnings/errors and shader compilation returns no error messages either.

In this picture you can see the 3D Textures generated by the two GPUs in comparison - the slices of the 3D texture are placed besides each other:

DirectX Code:

// INITIALIZATION

//loads & compiles shader from file
ID3D10Blob* computeShaderbuffer = m_Context->loadShaderFile(compute_shader, "cs_5_0");

device->CreateComputeShader(computeShaderbuffer->GetBufferPointer(), computeShaderbuffer->GetBufferSize(), NULL, &m_ComputeShader);

D3D11_TEXTURE3D_DESC desc = {};
desc.Width = m_dataSize.x; // 128
desc.Height = m_dataSize.y; // 128
desc.Depth = m_dataSize.z;  //128
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_R32_FLOAT;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;

device->CreateTexture3D(&desc, nullptr, &m_DensityTexture3d);
device->CreateUnorderedAccessView(m_DensityTexture3d, nullptr, &m_DensityShaderWriteResource);

// EXECUTION
deviceContext->CSSetShader(m_ComputeShader, nullptr, 0);
deviceContext->CSSetUnorderedAccessViews(0, 1, &m_DensityShaderWriteResource, nullptr);

deviceContext->Dispatch(m_dataSize.x, m_dataSize.y, m_dataSize.z);

deviceContext->CSSetShader(nullptr, nullptr, 0);
deviceContext->CSSetUnorderedAccessViews(0, 1, &uav_null, nullptr);

Compute Shader:

RWTexture3D<float> output : register (u0);

[numthreads(16, 16, 1)]
void main(uint3 id : SV_DispatchThreadID)
{
    float3 size;
    output.GetDimensions(size.x, size.y, size.z);
    float3 center = size / 2.0f;

    float max_distance = center.x * 0.7f;
    float3 norm_position = float3(id) / size;

    output[id] = 1.0f - (length(float3(id)-center) / max_distance);
}

Am I doing something wrong or is it simply an Intel issue?

Thanks for your help!

sentences:
What is the most efficient way to find hit point of BOX and internal Ray? most efficient AABB vs Ray collision algorithms
I found this topic on AABB ray test. Some of them could find hit point of external Ray and BOX.
I did my version for both external and internal ray, but it seem not working for internal ray.
What's the problem on my solution? Or any good algo for this use case?
   bool hit(thread Ray& ray, float2 range_t, thread HitRecord& record) const constant {

        float tmin = range_t.x;
        float tmax = range_t.y;

        float3 normal = float3(0);

        for (auto i : {0, 1, 2}) {

            auto min_bound = (mini[i] - ray.origin[i])/ray.direction[i];
            auto max_bound = (maxi[i] - ray.origin[i])/ray.direction[i];

            auto ts = min(max_bound, min_bound);
            auto te = max(max_bound, min_bound);

            tmin = max(ts, tmin);
            tmax = min(te, tmax);

            if (tmax < tmin) { return false; }
            //if (tmax <= tmin || tmax < 0) { return false; }
            //if (tmax <= tmin || tmax < 0 || tmin < 0) { return false; }

            if (ts >= tmin) {
                //tmin = ts;
                normal = float3(0);
                normal[i] = abs(min_bound) < abs(max_bound)? -1:1;
            }
        }

        record.t = tmin;
        record.n = normal;

        if (tmin < 0) {
            record.t = tmax;
        }

        return true;
    }

```

sentences:
'No Platforms Found' error in Unity Android I am having a problem with Unity Android - every time I try to "build", a 'No Platforms Found' error pops up.

Thing is that I already have Android SDK in my computer (copied it into my G drive from the official .zip download). JDK is installed too.

I use Unity 4.0.0f7 Pro version, and have SDK Platforms 2.1 (API 7), 2.2 (API 8), 2.3.3 (API 10), 3.0 (API 11), 3.1 (API 12), 3.2 (API 13), 4.0 (API 14), 4.0.3 (API 15) and 4.2.2 (API 17).

How can I remove this error and build successfully?

P.S.  I have already had a look at some of the threads in Unity website regarding this matter. None of the suggested answers has worked for me.

sentences:
Comprehension question to MVC Pattern in Game Programming So is my assumption right?

If I use MVC in Games I will have to implement a Model,Controller,View for every kind of interaction object.

For example in an Motorbike game. My Motorbike object will have its own controller, view and model class. Or is it enough if I define a model,view and controller for the world object and just use that view for drawing my bike?!

Or am I mixing something up?

sentences:
Why are my sprite sheet's frames not visible in Cocos Builder? I have created a sprite sheet with zwoptex. Then I just dragged the .plist and .png files to my Cocos Builder project. After this I wanted to take a sprite frame and set it to a sprite:

But the sprite image is empty! At first I thought it was just empty in Cocos Builder, and that it must have been working correctly when imported to a project. But if I try to run that scene with CCBReader I still see an empty sprite. Why?

sentences:
projected textures not appear on the "back" of the mesh as well? I want to create blood wounds on my character's bodies by using projected textures. I've watched some commentaries on games like Left 4 Dead and they say they use projected textures for the blood.
But the way projected textures work is that if you project a texture on a rigged character, say his chest, it will also appear on his back.
So what's the trick? How to get projected textures appear only on one "side" of the mesh?

I use the Panda3D game engine, if that will help.

sentences:
How to make a 'One Hit and Dead' platformer feel fair I am currently making a run 'n gun platformer, in which the player dies instantly when they get hit. I'm curious how to make this feel fair. I'm aware of putting checkpoints frequently enough, allowing the player to retry almost instantly, and merciful hitboxes. But I'm curious to know how I should go about level design? Run 'n guns are much different from sanic-speed wall jump platformers like meat boy.

You see, games like Hollow Knight let you learn how to avoid taking hits early in the game by giving easy challenges. If you get hit by something unexpected in Hollow Knight, you can always focus and gain some health, and it wouldn't feel unfair. If that happened in my game, that would feel unfair.

Since I'm designing a Megaman-X like game with a boss at the end of each stage, how am I supposed to go about teaching the player how to dodge fast moving projectiles that you would only know how to dodge after seeing how they act?

And yes, there is going to be a first level before you can go play the other ones in whatever order you like.

sentences:
Import .fbx animation from Maya 2012 to Unity 2018 I have a grass made by PaintEffects tool (1) and "animated" by adding turbulence (2) and then baked with Maya 2012.

And in Maya everything looks perfect - animation works. Problem is, when I'm importing that .fbx animation to Unity 2018, nothing happens. I can't either see this animation in Preview, I can see only the "model" itself. I read on the internet that's maybe because I set wrong animation, or rig option in Unity, but I tried every one of them. Is there something I missed, either in Maya, or Unity? Maybe I have too old version of Maya?

Also, I was trying to save that animation into separate files, or with extensions like .ma, .mb... Nothing works either.

sentences:
How can you tell if what you're buying is legal? In the past few days I've been browsing 3D asset marketplaces and repositories (I've been doing it for ages, but a lot recently). Many assets are paid for, others are free. In the past few days I've found suspicious activity on these sites, for example something sold on one site and given free on another site. I've recently reported many of these cases to the respective sites. The problem is, that now I look really closely at these models before buying them. I try to compare textures, geometry where I can, and poly count as tools for sniffing out property theft (copyright infringement).

I have bought some real bargains lately, and I know they're the real deal because I have spoken individually with the artists and am 99% I know it's the real deal. However how can I approach a store and have any confidence that what I'm buying isn't some reskinned asset ripped from a commercial game? (These are harder to spot as comparing geometry is harder)? I've tried to stick to reputable and popular sites, but I've already reported a number of people on these for abuse. It's worrying how often sellers aren't discovered by the site's owners or anyone else before I say something. For example there might be multiple thumbs up or 5 star reviews for people buying models that I've found out are actual rip-offs, or have been ripped off by someone else.

How can I know that a model I buy didn't come from some commercial game from 5 or 10 years ago, or from some mod from some point in time? Do I have any protection for example in future I release a commercial game and it's discovered that one of my assets from someone's mod or a commercial game from the past?

A while back I'd bought some products that seemed to be real bargains, and now that I'm a lot more cautious about these issues, I regret buying them.

sentences:
Pausing animation and resuming on same frame How do you stop an animation and then resume on the same frame where you paused? I tried:

if (paused) {
    anim.speed = 0;
} else {
    anim.speed = 1;
}

Sure, it pauses and plays but it doesn't resume on the frame it paused. It starts over the animation. I also tried playing around the Speed field in Animator (instead of via code) while the animation is playing and its the same way. When the animation is playing and I change the value of Speed, the animation doesn't slow down, it gets reset.

sentences: How to select multiple frames from a sprite sheet in unity I have a sprite sheet and cannot figure out how to select multiple frames in unity 5.5 I am watching a tutorial and it doesn't say how to do it. Is there a button I have to press while clicking or is it having to change some settings?

sentences:
How do I move from mainstream to indie development? I'm a game programmer for a AAA-level developer and publisher—which I know falls into the 'nice problem to have' category. However, I'm becoming disenchanted with the direction of both the company and the AAA-portion of the industry as a whole.

I want to do something fundamentally different.

It seems the market has never been better for smaller-scale projects, and I'd love to jump into that (and I've done small demos for Android and have started digging into iOS), but I obviously can't put anything out while I'm working for the company. I'm concerned that I shouldn't even do substantial development in my spare time on anything I'd eventually like to release on my own.

At the same time, I'm leery of leaving my job, for hopefully-obvious reasons, especially without a specific plan in place.

Has anyone out there got experience with 'going indie' out of a mainstream job? Do you have specific suggestions as to a best approach and what to specifically think about or be careful of?

sentences:
How to set root signatures specified in HLSL in my command list? From Microsoft Docs, I can specify the root signature of my shader in HLSL. How do I use it though?

Since at the beginning of the command list, root signature is undefined. I need to use ID3D12GraphicsCommandList::SetComputeRootSignature(ID3D12RootSignature*) or ID3D12GraphicsCommandList::SetGraphicsRootSignature(ID3D12RootSignature*) set root signature, but having specified in HLSL instead of C++ code, I do not have a pointer to my root signature objects, how should it be done then?

sentences:
Procedurally create a polygonal shape filled with texture in unity 2d I want to procedurally create a polygonal shape filled with texture in unity 2d (no 3d meshes). Something that looks like this: https://www.conceptdraw.com/How-To-Guide/picture/landscape-plan/Building-Plans-Landscape-Garden-Design-Elements-Roofs.png

As you can see roofs can be rectangles, but also any polygonal shapes.

I have tried so far LineRenderer which outlines a shape but I see no way how to put a texture of the same shape into it.
I have tried sprites as well but I could not find a way to procedurally generate them
I saw an example of https://github.com/epezent/ShapeRenderer and https://assetstore.unity.com/packages/tools/sprite-management/shapes2d-make-art-fast-62586
Ultimately I want something like https://docs.unity3d.com/Manual/9SliceSprites.html for any polygonal shape

Can it be done in vanilla unity 2d? Or should I rely on 3rd party libraries and if so which one would fit best?

p.s. I will most likely overlay that object with PolygonCollider2d for physics

sentences:
How do I consolidate the differences between iOS and Android update loops? I'm currently working on moving some Android-ndk code to the iPhone.

From looking at some samples it seems that the main loop is handled for you and all you've got to do is override the render method on the view to handle the rendering. Then add a selector to handle the update methods. The render method itself looks like it's attached to the windows refresh.

But in android I've got my own game loop that controls the rendering and updates using C++ time.h. Is it possible to implement the same here bypassing Apple's loop? I'd really like the keep the structures of the code similar.

sentences: How can I tune material values with the slider in the Unity inspector more finely? I'm adjusting a material's texture tiling and offset values in the editor but its increments are too large and it's jumping over the value I need. Is there a way to slow it down or adjust the amount it increments by (without using a custom script)?

sentences:
How do I set what beta branch I want to upload my build to in Steamworks? I have many beta branches, and when uploading the game I just run a command which executes the app-build-xxxx.vdf file. How do I set what specific branch I want those changes to be uploaded to? My configuration file looks something like this:
"appid"           "xxxxx"
"desc"            "Beta branch xxxx "

"buildoutput"     "..\output\"
"contentroot"     "..\..\Game\"

"setlive"         "<Name of the branch here as it is in steamworks>"

sentences:
Maths and basics for a 2d top down game (object moving and rotating around center) I want to eventually create a pseudo 3d game engine like the original Wolfenstein or doom. I am starting from 0 so my first step is to create a 2d top down view where my character would be in the center of the screen always looking up and objects would move around him.

I know how to create a game like Zelda where objects move but dont rotate and the center character just look in different directions. But after that i need some help. I tried to do some research online but could not find exactly what i was looking for.

I dont know yet what language i would use to code my engine. My 1st choice would be c++ but i want my evenual game to be easily ported on different platforms. For that reason ill probably go with Java.

sentences:
World space coords for 2d images How can I make an 2d image using World space coords with a shape? Like a circle instead of a quad.In 3d you can modify the vertices but if I want a smooth circle there will be too much vertices. What I want to achieve is something like a cirle mask that will be move over the global texture at runtime.
So has anyone done something similar?
I've tried combining some shaders with two uv's one for world space and one for alpha uv mesh but it gives some weird artifacts.

This is the how the shader looks on the right:

Shader "Unlit/WorldspaceTiling"
 {
     Properties
     {
         _MainTex ("Texture", 2D) = "white" {}

 }
 SubShader
 {
      Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
 LOD 100

 ZWrite Off
 Blend SrcAlpha OneMinusSrcAlpha
 Cull Off
     Lighting Off
     ZWrite Off
     Fog{ Mode Off }
     Pass
     {
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #include "UnityCG.cginc"

         struct appdata
         {
             float4 vertex : POSITION;
             float2 uv : TEXCOORD0;
         };

         struct v2f
         {
             float2 uv : TEXCOORD0;
             float4 vertex : SV_POSITION;
         };

         sampler2D _MainTex;
         float4 _MainTex_ST;

         v2f vert (appdata v)
         {
             v2f o;
             o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);

             // Gets the xy position of the vertex in worldspace.
             float2 worldXY = mul(_Object2World, v.vertex).xy;
             // Use the worldspace coords instead of the mesh's UVs.
             o.uv = TRANSFORM_TEX(worldXY, _MainTex);

             return o;
         }

         fixed4 frag (v2f i) : SV_Target
         {
             fixed4 col = tex2D(_MainTex, i.uv);
             return col;
         }
         ENDCG
     }
 }

}

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:
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:
Why is the "bind pose" one with outstretched arms? Something I've often wondered about is the "bind pose". The bind pose for human skeletons is one where their legs are straight, and their arms are perpendicular to their body:

My question is: why? Is such a pose easier for the animators to work with, or the programmers, or both? As far as I understand the math, the bind pose doesn't make a difference to the outcome.

sentences:
HLSL Buffer Data Type I'm working on converting a dx11 shader from a .fx file for use in Unity3D and I'm a little puzzled by the HLSL Buffer<> type declared in the shader. More specifically, what are these and how can I implement them in Unity? I'm aware of the Structured, Append, and Consume Buffers but those appear to be different then this and the Microsoft documentation wasn't to helpful. Is it just like an array that is populated and sized from code before getting assigned to the shader? Are they read only or writable as well?
So far I'm thinking the closest approximation I can use is a StructuredBuffer but the .fx file has its own declaration for that as well so I'm not entirely sure I should go that route.

Example:

Buffer<float4> g_someData : register(t18);

sentences:
How to check whether an angle lies within a specific negative to positive range? I'm trying to develop a script that detects if an object's angles are tilting too much.

I am new to Unity, and I am sure this is not the best way to test an object's angles, but I am trying to learn C# so I'd rather figure that out myself.

All I want to know is how to check whether a value is between -101 and 101.

I have tried this so many different ways, and even though it is working fine for positive integers, the if statement is not applying the moment that my z angle becomes negative.

Here is what I have tried so far:

(maxangle = 101, minangle = -101)

if(Player.transform.rotation.eulerAngles.z > Mathf.Sign(-101) &&
Player.transform.rotation.eulerAngles.z < maxangle),

if(Player.transform.rotation.eulerAngles.z > minangle &&
Player.transform.rotation.eulerAngles.z < maxangle)

sentences:
Collision not smooth in unity3d I am working on a project(Racing car).
When it hit an object the object should be destroyed. The Object is being destroyed when it is hit, but the car stops for a moment after hitting like an obstacle.
How can I make this smooth, like the object is there and it is destroyed on collision but the car moves with the same speed?

Script attached to the object:

void OnCollisionEnter(Collision col){

    Destroy (gameObject);

}

Nothing needs to stop or slow down.
It doesn't need to exert any physical force.

Thanks.

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:
How can I fix the turret is facing the opposite direction of the target? This script is attached to the turret parent.
The object that rotate on X and Y is the child Cube of the Cylinder.
The target is the Sphere.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TurretAI : MonoBehaviour
{
    [SerializeField]
    private float turnRateRadians = 2 * Mathf.PI;

    [SerializeField]
    private Transform turretTop; // the gun part that rotates

    [SerializeField]
    private Transform bulletSpawnPoint;

    [SerializeField]
    public GameObject target;

    void Update()
    {

        TargetEnemy();
    }

    void TargetEnemy()
    {
        if (target != null)
        {
            Vector3 targetDir = target.transform.position - transform.position;
            // Rotating in 2D Plane...
            //targetDir.y = 0.0f;
            //targetDir = targetDir.normalized;

            Vector3 currentDir = turretTop.forward;

            currentDir = Vector3.RotateTowards(currentDir, targetDir, turnRateRadians * Time.deltaTime, 1.0f);

            Quaternion qDir = new Quaternion();
            qDir.SetLookRotation(currentDir, Vector3.up);
            turretTop.rotation = qDir;
        }
    }
}

This is a screenshot of the parent turret that I set to be static so it will not rotate too and the script attached to it :

This is a screenshot of the Cube that rotate on X and Y and should be facing the target :

And the missels :

And last when running the game you can see the Sphere target position and the turret is facing the opposite direction. If I will drag and move the Sphere the turret will rotate to it but with the missels back instead with the missels front side :

sentences:
Create dynamic cities of perspective angle x with least amount of tiles I found you can create unique building sizes with perspective with six tiles using parallel projection, whose angles are always 45 degrees... this allows you to connect to the next tile without issue:

The issue with that is you're stuck to a 45 degree angle... I feel like a 75 degree angle better matches my game's overall perspective...

But doing anything other than 45 degrees limits how deep my building is (how far back the building top goes)... so this seems to force me to create additional buildings if I want to make the top reach back further... Which adds complexity

Question:

Is there a way to achieve what I'm doing for any angle I choose such that I can create one building tileset (of 6 tiles) and create dynamic cities?

Or, do I have to sacrifice the angle of my choosing and go with the simple 45 degrees?

Thanks

sentences:
Amazon FreeTime Unlimited Monetization So I've recently noticed how great FreeTime Unlimited is for my daughter. There's no ads, no in-app purchases, etc. She can just play the games/apps and I don't have to worry about it.

As a develop I thinking it could an interesting avenue to go down, but there's a few things that I for the life of me can't get Amazon support/forums to answer in any logical manner.

So the idea according to their information is that the apps are highly scrutinized to verify they are child friendly content, which is excellent. Also, you can't use webviews, ads, or in-app purchases.

My question is: How do devs monetize these applications? Clearly they're not just giving away their work for free? The only logical answer I can guess at, is that it uses the Amazon Underground scheme of earning $$ based on the amount of time the user spends in the app/game??

Does anyone have and actual experience or information on this? As I said, I've reached out to multiple people at Amazon, and keep getting the runaround with all of them pointing me to the same useless link.

sentences:
A star pathfinding and discrete/smooth positions The A* (A-star) algorithm usually represents a path on a grid.

Once a path has been found, however, the path looks blocky and is not suited if you move your units with floating point datatypes.

Here is an image describing the problem. The whites tiles represent the path found by A*. The black line path  is the path I want, the red line path is the one I don't.

One solution would be to select a corner when the path turns, and switch/keep side when the path turns the other way. Seems like the most logical and cleanest way to do this.

sentences: How to implement in-app-Billing in libgdx? I'm trying to implement in-app-Billing in libgdx game. Does someone have a working example? There is some explanation on developer.android but it's not helpful for libgdx.

sentences:
Unity GridLayoutGroup children ignoring resizing Can anyone explain why, in the editor I get:

while, on my Galaxy S6, I get:

My Panel UI element (which is the parent) has the GridLayoutGroup component, as well as the ContentSizeFitter. The child elements have a LayoutElement component with a FlexibleWidth/Height of 120 and all anchors are set to stretch in all directions.

The Canvas is set to Scale with Screen size, with a reference res of 320x480 and screen mode is to match height.

Regardless of the amount of squares (which is dynamic) the editor perfectly resizes child elements within the parent, but my device makes them tiny. I'm really confused.

There is no setting of sizes or anchors within the script, purely an instantiate and an assignment of parent, like so:

    for(int i=0; i < amount; i++)
    {
        GameObject emptyCell = (GameObject)Instantiate(emptyCellObject);
        emptyCell.transform.SetParent(cellHolder);
        emptyCell.GetComponent<RectTransform>().localPosition = new Vector3(0f, 0f, 0f);
        emptyCells.Add(emptyCell);
    }

I've also checked all docs related to: http://docs.unity3d.com/Manual/comp-UIAutoLayout.html - And even UI tutorial movies, as well as some blog posts about the 'new' UI tools, but nothing changes the dimensions on the physical device, and seems to change nothing in the editor as that remains the same.

I'm sure I'm doing something silly, but I've exhausted all avenues and was hoping someone had come across this oddity previously.

sentences:
Shaking objects near correct position (with video) All right, so I'm testing two box objects. One is standing fixed in a position and another at the beginning of the program goes to the first one. And at the end the latter should stand completely over the first (so the center of both is equal).

Here's my method in the Object class:

Old code

void Object::moveTo(Point _p) { // _p is always the center of the other object we want to go to

    // adjust speed, don't worry it's not important here, I guess
    if (current_speed == 0)
        current_speed = speed/16;
    else if (current_speed >= speed)
        current_speed = speed;
    else
        current_speed *= 2;

    // we want to calculate the new center of the
    // our object (the one that run this method)
    Point center;
    // distance(x) calculate the distance between the center point of the object and
    // the x point passed
    if (distance(_p) <= current_speed) {
        // we don't want shaking things!
        center = Point(_p.x, _p.y);
    } else {
        // move diagonally
        center.x = getCenter().x + current_speed*std::cos(angle(_p)); // angle calculates the angle between the center of the object and the _p point
        center.y = getCenter().y + current_speed*std::sin(angle(_p));
    }
    // since we draw sprites by the top left corner we need to convert
    // the center point to the correct top left point
    center = toPosition(center);
    sprite.setPosition(center);
}

New code

Notice that the origin of the sprite is set to be in the center so setPosition will correctly set the center and that getCenter() returns sprite.getPosition() which is the center point.

void Object::moveTo(Point _p) {
    Point center;
    //std::cout << distance(_p) << std::endl;
    if (distance(_p) <= speed) {
        center = Point(_p.x, _p.y);
    } else {
        center.x = getCenter().x + speed*std::cos(angle(_p));
        center.y = getCenter().y + speed*std::sin(angle(_p));
    }
    sprite.setPosition(center);
}

This is what happens: http://youtu.be/Ngra3FXFe0A.

The distance keeps going from 15.xxx to 16.xxx and I don't know why.

Testing surprise

Doing distance(_p) <= 10 instead doesn't make it shake. With 9, 8... or minor it shakes.
Defining a minor speed the object gets nearer the correct position before start shaking.
Setting the white cube to follow the player (yellow sprite) it moves like a jagger: http://youtu.be/9FjRfHHprEQ
Here's a recent video: the 3 little squares points (its the specific top left corner) to: blue = box center, red = player center, green = top left corner of the box. As you can see they are correctly calculated (this test was made with speed of 1, while the others were made with a greater speed): http://youtu.be/iFAWGssk7NI

Distance function:

float Object::distance(Point _p) {
    return sqrt((pow((getCenter().x - _p.x), 2) + pow((getCenter().y - _p.y), 2)));
}

Angle function

float Object::angle(Point _p) {
    //  (180 / PI = 57.3065)
    return 57.3065f * atan2(getCenter().y - _p.y, getCenter().x - _p.x);
}

Why is that?

sentences:
Monogame/XNA - How do you resize a Texture2D and then scale it? Problem:
It seems like the Draw() call allows us to use either Destination Rectangle for resizing (5of8) or Scale (6of8/7of8) but not both.

Purpose:
I would like to resize a button from 567x634 to 400x480 and then using scale to further reduce it by 0.8 to 320x400.

sentences:
Can I use flat shading on a generated mesh? I tried to generate a mesh from code in Unity. The problem is, that the edges are automatically smoothed. When I import a model into Unity, I can set the smoothing angle of the edges, but is something like this possible with a generated mesh?

I would like to have no smoothing at all.

sentences:
How 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:
Only do 1 SphereCastAll in Unity3D? I just want to make one SphereCastAll with a center and a radius.

I don't want unnecessary sweeping in a desired direction with a desired length. How is this achievable? My solution is pretty unreliable, I think.

var hits = Physics.SphereCastAll(center, radius, forward, 0.0001f, mask);

sentences:
What does "Poser-like" mean? The Wavefront OBJ exporter of 3DSMax says it can flip YZ axis. Claiming this is "Poser-like". What does this mean?

And what is the exact transformation if we decide to flip?
Is it simply this?

x => x
y => -z
z => y

UPDATE: related matrix transformation

1  0  0
0  0 -1
0  1  0

sentences:
LibGDX : Scene2D ScrollPane I want to create a list of buttons with ScrollPane , but I cant create a ScrollPane . In the constructor method in the examples Skins are used (.atlas , .json files) but how to create these files?

Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));

Is there a program to generate this json ? As I noticed a lot of Scene2D elements need skins.

sentences:
Just 2 images on a window loaded using DirectX10...But how? I am a beginner to DX and I have tried looking everywhere for something very similar to this concept but can't find anything.

I just want two rectangles on a window.

Rectangle 1 : on some x,y with some width and height with background as a PNG image
Rectangle 2 : on some x,y with some width and height with background as a PNG image

And one other thing. I am trying to make it so that the image doesn't resize as I resize the window as this makes the pictures really blurry as they get bigger.

I know this is not the type of question that stack likes, but if you can give me some example that does this, I would be very delighted.

Thank you so much.

sentences:
Bullet Physics too many rigid bodies framerate drops I have a question regarding rigid bodies in bullet physics.

At the moment I have low-poly asteroids, which I create a convex Hull shape.
Then I add a motion state and give them a linear velocity.

Collision and everything is working fine, if its a low amount of asteroids (less than 5).

But as soon as the amound of objects in the world get higher, my framerate starts to drop under 1 FPS.

I have a Intel i56600k and a AMD Fury. Could it be related to my hardware?
Or is bullet limited in this regard? Or did I do something wrong in my program?

I'm writing the game in C++.

sentences:
How to clip textures when drawing? How do i draw a texture2D in a specific area (rectangle) where the texture is bigger than the rectangle, and i dont want to draw outside the rectangle. So that means i want to cut the texture so it fits the rectangle area (if its too big).

For example if the rectangle area is 200 x 100 and my texture (the smiley) is 200 x 150
then i want to cut the last 50 off so it only draws 200 x 100

sentences:
How to show NGUI menu in the upper of a Game Scene? I am new to Game Development. I made a menu with NGUI plugin. I have a background image in the behind of this menu. Now, I want to place my Game Scene in place of the background image. I have tried in several ways. But, Failed. Any suggestions will be highly appreciated.
Thanks

sentences:
Sound Delay With AVAudio Player I'm using the following code in my viewDidLoad to load a sound:

NSURL * url = [NSURL fileURLWithPath:
   [NSString stringWithFormat:@"%@/Moto - Hit Sound.mp3",
   [[NSBundle mainBundle] resourcePath]]];
NSError * error;
hitSoundPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:&error];
hitSoundPlayer.numberOfLoops = 0;

Then I'm using this in a void method to play the sound:

if(CGRectIntersectsRect(main.frame, enemy1.frame)){
    [hitSoundPlayer play];
}

This does seem to work, however the first time the sound is played there is a lot of lag and the game stops temporarily. I'm using this same method for when in an IBAction and it works fine, it must be the fact that it's also detecting a collision that makes the sound lag. If I want to be able to play sounds quickly and on the spot without any sort of lag am I doing the right thing? Do I want to use another method?
I'm not using any frameworks like cocos2d. If you need to see any more code just ask.

sentences:
What is a good approach to dynamically change actor Position? In my card game there are 2 players with each player having a hand(a ListArray of  of Cards.In this case its handPlayer1).
The Card class extends Actor.This is the code I use to deal the cards to the first player(I call this in the show() method) :

 for (int i = 0; i < 6; i++) {
        handPlayer1.get(i).setPosition(20 + i * 35, TABLE_HEIGHT - CARD_HEIGHT - 30);
    }

For now whenever a player plays a card it is removed from their hand and moved to the table.If the player draws a card it is added to the hand of the player like so :

deck.get(deck.size() - 1).addAction(Actions.moveTo(handPlayer1.get(handPlayer1.size() - 1).getX() + 20, 30, 0.1f));

But the problem is that sometimes the cards go out of screen bounds when the player has too much cards and are not visible.

.What is a good way to manipulate the positioning of Actors so that the hand stays in the center and all cards are a set distance from one another? I have read up on Groups but I don't know if adding the cards to a Group would change anything.(Picture below for reference)

sentences: How can I copy/move a file from a folder to another with RGSS? I've been trying to do this but I can only find Ruby answers. I'm trying to move or copy a file from, say, Game Directory/Graphics/Pictures/file.png to Game Directory/file.png. How can I do this in RGSS?

sentences:
Can't figure out how to create texture from a font-surface I can't seem to be able to render my font, it crashes and I can't figure out why. It seems to load the font correctly, but the parts relating to surface crashes.

Why does my texture crash?

Here is the code bits relating to it. SDL2 and TTF has been initialized properly.

        TTF_Font *arial;
        SDL_Color mm_txt_color = {255, 255, 255, 0};
        SDL_Texture *myTexture;
        SDL_Rect myRect;
        load_font(MM_FONT_ARIAL, 18,  &arial);

        get_text_and_rect(0, 0, "Exit", arial, &myTexture, &myRect);

int load_font(char *filepath, int size, TTF_Font **font)
{
    (*font) == TTF_OpenFont(filepath, size);
    if((*font) == NULL ) {
        printf("ERROR: Failed to load font: %s.\n", filepath);
        return FAILURE;
    }
    return SUCCESS;
}

    void get_text_and_rect(int x, int y, char *text, TTF_Font *font,
        SDL_Texture **texture, SDL_Rect *rect)
    {
        int text_width;
        int text_height;
        SDL_Surface *surface;
        SDL_Color textColor = {255, 255, 255, 0};

        surface = TTF_RenderText_Solid(font, text, textColor);
        *texture = SDL_CreateTextureFromSurface(renderer, surface);
        text_width = surface->w;
        text_height = surface->h;
        SDL_FreeSurface(surface);
        rect->x = x;
        rect->y = y;
        rect->w = text_width;
        rect->h = text_height;
    }

sentences:
I cannot update a shader constant via a constant buffer in DirectX 11 I've tried everything I can think of, but I cannot get a constant buffer to update a variable in my shader in DirectX 11. I followed the examples on msdn. I read and re-read the articles on constant buffers. I even followed the nearly identical thread on this site. But for some reason I simply cannot get this to work. Can someone point me in the right direction?

Here's the relevant code:

//my data variable to keep everything together
struct VS_CONSTANT_BUFFER
{
    D3DXMATRIX mWorldViewProj;
    D3DXVECTOR4 vSomeVectorThatMayBeNeededByASpecificShader;
    float fSomeFloatThatMayBeNeededByASpecificShader;
    float fTime;
    float fSomeFloatThatMayBeNeededByASpecificShader2;
    float fSomeFloatThatMayBeNeededByASpecificShader3;
};
    //I initialize my data variable
    D3DXMATRIX identity;
D3DXMatrixIdentity( &identity );
m_ConstantBufferContents.mWorldViewProj = identity;
m_ConstantBufferContents.vSomeVectorThatMayBeNeededByASpecificShader = D3DXVECTOR4(1,2,3,4);
m_ConstantBufferContents.fSomeFloatThatMayBeNeededByASpecificShader = 3.0f;
m_ConstantBufferContents.fTime = 1.0f;
m_ConstantBufferContents.fSomeFloatThatMayBeNeededByASpecificShader2 = 2.0f;
m_ConstantBufferContents.fSomeFloatThatMayBeNeededByASpecificShader3 = 4.0f;

// Fill in a buffer description.
D3D11_BUFFER_DESC cbDesc;
cbDesc.ByteWidth = sizeof( VS_CONSTANT_BUFFER );
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
cbDesc.MiscFlags = 0;
cbDesc.StructureByteStride = 0;

// Fill in the subresource data.
D3D11_SUBRESOURCE_DATA InitData;
InitData.pSysMem = &m_ConstantBufferContents;
InitData.SysMemPitch = 0;
InitData.SysMemSlicePitch = 0;

// Create the buffer.
HRESULT hr = pDevice->CreateBuffer( &cbDesc, &InitData, &m_ConstantBuffer );

    //from my update function, I update the contents of my buffer like so

m_ConstantBufferContents.mWorldViewProj = view;
// Set the buffer.
pDeviceContext->UpdateSubresource( m_ConstantBuffer, 0, 0, &m_ConstantBufferContents, 0, 0 );
pDeviceContext->VSSetConstantBuffers( 0, 1, &m_ConstantBuffer );

    //And this is how I attempt to use it in my shader
    //--------------------------------------------------------------------------------------
    // Constant Buffers
    //--------------------------------------------------------------------------------------
    cbuffer cbPerObject : register( b0 )
    {
       matrix  g_mWorldViewProjection  : packoffset( c0 );
       matrix  g_mWorld                : packoffset( c4 );
       float4  g_MaterialAmbientColor  : packoffset( c8 );
       float4  g_MaterialDiffuseColor  : packoffset( c9 );
    }

I'm sure it's something simple and stupid that I've overlooked, but I cannot seem to find the problem myself. Any ideas?

Goishin

sentences:
Presenting game center leaderboard I have the following code:

-(void)showLeaderboard {

GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != NULL)
{
    leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
    leaderboardController.leaderboardDelegate = self;
    [self presentModalViewController: leaderboardController animated: YES];
}

[leaderboardController release];

}

Which I am trying to use to make my leader-board pop up. The issue is cocos2d will not allow me to use the line:

        [self presentModalViewController: leaderboardController animated: YES];

How do I fix this?

Thanks

PS I am using cocos2d

sentences:
Unity not updating sprite animations (possible bug) I have a simple animation of a foot which i want to change sprites from one sprite to another, which is seen in the following two images:

now as one can see in the animation timeline there is a change in sprites of the foot (a slight distortion), however if one looks in the inspector the sprite remains constant. The sprite in the inspector seems to choose whichever sprite was last placed on the animation timeline, until the game is played and at this point it reverts to foot1. The sprite never changes whenever you scrub through the timeline. This is a 2D project and I am running a 64 bit version of windows 8.1 running the most recent version of unity (which has been reinstalled), this looks like a bug to me but if i am doing it wrong then please feel free to tell me so. I am using C# in order to develop my project. I am not using any mods, or anything downloaded from the asset store.

I have tried uninstalling and reinstalling unity, so that is not the problem, my project is available here:

http://www.filedropper.com/newunityproject6-copy

I have tried to give as much information as possible, but please do not hesitate to ask any further questions.

My computers properties:
8gb of ram
64 bit
intel i5-3230M CPU@ 2.60 GHz
Windows 8.1
Lenovo g780

sentences: Using UDP vs Websockets I am running a Unity Game on a PC (for development purposes) and then on an Android phone (for production). I need to send data to the Game continuously from a WiFi enabled microcontroller (Esp32). Is it better for me to use UDP or Websockets for data transfer? What are the pros and cons of each method? In this scenario, the game device will act as a mobile hotspot while the esp32 will connect to this hotspot.

sentences: Pixel Art size for different resolutions What size I should make the UI elements (mostly buttons). How do pixel graphics look good on all resolutions? How would I get to know what size I need the buttons or other pixel graphics overall?

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:
Aron Granbergs Unity Pathfinding AI goes back and forth The agent goes back and forth after calculating the path with seeker.StartPath (transform.position,target.transform.position, OnPathComplete);. The gizmo shows the correct path. Please watch this short video to get an impression on what happens.
It starts after adding about 100 obstacles during runtime. Is this a known bug or am I doing something wrong? My test case is really simple. I can provide the project if necessary.

Link to the Video:
http://screencast.com/t/2ww04975l

sentences:
Rendering a image with some transparency has removed all black pixels and makes full texture transparent I am writing a program where with Directx11 I am rendering a texture to a flat rectangle something along the line a of 2D engine. Now parts of this image need to be transparent, to this effect I looked into alpha blending and it seemed to work until i changed textures and realized that it had removed all black pixels and made the whole image transparent not just those pixels that are blank. So how in Directx11 do you have it so that you preserve the transparency of the original image. I am using a ShaderResourceView that is a loaded png for the texture

**//Setup Blend State
D3D11_BLEND_DESC BlendStateDescription;
ZeroMemory(&BlendStateDescription, sizeof(D3D11_BLEND_DESC));

BlendStateDescription.RenderTarget[0].BlendEnable = TRUE;
BlendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
BlendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;

BlendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC1_COLOR;
BlendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
BlendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;
BlendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
BlendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;

dev->CreateBlendState(&BlendStateDescription, &blend);
float blendFactor[] = { 0, 0, 0, 0 };
UINT sampleMask = 0xffffffff;

devcon->OMSetBlendState(blend, blendFactor, sampleMask);**

sentences:
How to scroll background image-Android App Basically, I have a main menu, and I would like the background image to scroll (parallax I believe is the term?  Like the Angry Bird's title screen background).

However, I'm used to just having a variable iterate (x++) and setting that as the x value so the image scrolls.

So is there any way to confer variables and such between xml and my java files so I can use iteration?  Or can I skirt this completely somehow?

sentences:
Are huge, static objects like environment transmitted from server to client in modern multiplayer games? I have an authoritative system, where when the player joins the match, it gets all the already spawned objects - spawned on itself (the client).

It looks like this:

Client sends the access token to the Server
Client receives the acceptance from the Server
Client switches scene to the game scene
Server sends players, crates, objects you can interact with so the client can spawn and display them.

But what about the ground object?
For now, I have the exact same scene on the server and the client - with one static plane acting as a floor. Currently I'm adding new stuff, trees, stairs and build things together.

I thought - we're good. But shouldn't the environment be synchronized too? Be networked somehow? Owned by the server?

Let's take League of Legends:

It's a static environment, probably one combined mesh (stairs, grass, walls, shop). But is it really kept on the client or is it sent by the server during the loading screen?

sentences:
Scaling of a bone is working while rotation is not Unity3d I'm using Unity3d and I'm trying to rotate the left leg bone of an avatar but it is not working although scaling is working well.

This is the code used for scaling and is working perfect:

 r.localScale += new Vector3( 0.1f , 0.1f , 0.1f);

and these are my attempts to is the code of rotation but not working:

 r.eulerAngles = new Vector3(10, 10, 10);
 r.rotation = transform.rotation * r.rotation;

where r is the transform of the left leg.

EDIT:

This is my file.

So this doesn't work when I'm using the Update function, like nothing happens to the avatar.
If I used LateUpdate function, I can see the rotation made but then flickers back to the old position, I wonder how to apply the rotation to all the remaining frames as well.

If anyone could please advise

sentences:
Making Basic Touch Behaviors I am trying to make Basic Touch behaviors for my game where i want to

Pan Camera by Single finger touch.
Zoom Camera by pinch With two fingers ofCourse.
Rotate Camera by two fingers rotation.
Rotate camera around an object and move only in x axis using Two fingers y position.

i am having problem in making camera to rotate on X axis but i am not able to do it correctly plz help and it also conflicts with my pan behaviour when input is given

   public float comfortZoneVerticalSwipe_A = 10;
    public float comfortZoneHorizontalSwipe = 50;
    public float minSwipeDistance = 100;

    public float startTime;
    public Vector2 startPos;
    public float maxSwipeTime = 0.5f;

    if (Input.touchCount > 0 && Input.touchCount < 2)
            {
                Touch touch = Input.touches[0];
                switch (touch.phase)
                { //following are 2 cases

                    case TouchPhase.Began: //here begins the 1st case
                        startPos = touch.position;
                        startTime = Time.time;

                        break; //here ends the 1st case

                    case TouchPhase.Moved:

           Vector3 offset = transform.right * (-Input.touches[0].deltaPosition.x * 0.9f) * panSpeed + transform.up * (-Input.touches[0].deltaPosition.y * 0.9f) * panSpeed;
                                Vector3 newTargetOffset = Vector3.ClampMagnitude(offset, maxOffsetDistance);

                                transform.position += newTargetOffset - targetOffset;

                        break;

                    case TouchPhase.Ended: //here begins the 2nd case

                         float swipeTime = Time.time - startTime;
                        float swipeDist = (touch.position - startPos).magnitude;

                              Debug.Log("Mathf.Abs(touch.position.x - startPos.x) " + Mathf.Abs(touch.position.x - startPos.x));

                            Debug.Log("swipe Time " + swipeTime);

                            Debug.Log("swipe Dist " + swipeDist);

                            if (Mathf.Abs(touch.position.x - startPos.x) < comfortZoneVerticalSwipe_A && swipeTime < maxSwipeTime && swipeDist > minSwipeDistance && Mathf.Sign(touch.position.y - startPos.y) > 0)
                        {

                            Debug.LogWarning(transform.rotation.x);
                            transform.rotation = new Quaternion(transform.rotation.x - 5 , transform.rotation.y , transform.rotation.z , transform.rotation.w);
                           if (transform.rotation.x > 0.2)
                           {
                                transform.Rotate(Vector3.right, -2);
                            }
                                Debug.LogError(transform.rotation.x);
                            Debug.LogWarning("Up");

                        }
                            else if (Mathf.Abs(touch.position.x - startPos.x) > comfortZoneVerticalSwipe_A && swipeTime > maxSwipeTime && swipeDist > minSwipeDistance && Mathf.Sign(touch.position.y - startPos.y) < 0)
                            {

                                 transform.rotation = new Quaternion(transform.rotation.x - 5 , transform.rotation.y , transform.rotation.z , transform.rotation.w);
                                if (transform.rotation.x < 0.9)
                                {
                                    transform.Rotate(Vector3.right, 2);
                                }
                                print("down");

                            }

                        break; //here ends the 2nd case
                }
            }

sentences:
How to use Irrlicht game engine in cygwin? How can I develop a game with Irrlicht game engine in a cygwin environment?

I tried google, but honestly I didn't find any useful tutorials about setting that game engine in cygwin.

Thanks, Ehsan.

sentences:
Dynamic vertex buffer mapping call order From the book Introduction to 3D Game Programming with DirectX10:

 // Update the vertex buffer with the new solution. Vertex* v = 0;
 HR(mVB->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&v ));

 for(DWORD i = 0; i < mNumVertices; ++i) {
     v[i].pos = mCurrSolution[i];
     v[i].color = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f); }

 mVB->Unmap();

  The ID3D10Buffer::Unmap function must be called when you are done
  updating the buffer. The argument D3D10_MAP_WRITE_DISCARD passed into
  the first parameter of the Map function instructs the hardware to
  discard the buffer and return a pointer to a newly allocated buffer;
  this prevents the hardware from stalling by allowing the hardware to
  continue rendering from the discarded buffer while we write to the
  newly allocated buffer.

The bold text says that it's supposed to render while we are writing to the buffer.
Doesn't that mean that the Draw() call should happen right after we called the Map() function?

If not, why not?

EDIT:

A second question about dynamic vbuffers: When we don't only want to change the vertices inside the buffer, but we also want to create additional vertices, would it be more performance-friendly to just create a static buffer and recreate the buffer?

sentences:
How to "amplify" a force and physic using AddForceAtPosition? I have the object in the image.

The red box is kinematic: when an object hit it , i set kinematic to false, so Unity apply normal physic.

But I would like to apply also a force to the point indicated by the violet cross.

So I'm using Rigidbody.AddForceAtPosition

_rb.AddForceAtPosition (ForceDirection * ForcePower, PointForcePosition.transform.position, ForceType);

PointForcePosition is an empty GameObject child of the red box object, placed where violet cross is pointing.

My question are:

Force Position: can I use that approach (an empty gameObject placed where i want to apply force ) ?
Force Direction: is it corret a Vector3 ( 0 , -1 , 0 ) to indicate a down force
Which ForceMode is the best for my purpose ?  Impulse ? Force ?

Thanks

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:
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:
Rendering SVG art directly in XNA Suppose I have a bunch of 2D art in some vectorized format such as SVG. Is there an easy-ish way to render that directly without having to implement a full SVG renderer myself?

Of course I could rasterize it off-line (e.g. in the content pipeline) for different resolutions/zoom levels, but I would like to maintain the crisp visuals at continuous zoom levels that vector graphics offer.

sentences:
Removing/Updating Spritebatch I am designing a Spritebatch class, for static and dynamic objects with WebGL.
A problem I'm facing is that I have read several different opinions on sprite batching but with one goal.

Put all vertices in one buffer and render them

So in WebGL I'm using gl.bufferData(....,new Float32Array(size), gl.STEAM_DRAW).

And here is my first problem: when the spritebatch should be dynamic then size is not fixed and will increase, which leads to recreating the Float32Array which I found out is very expensive for n ≥ 10000 (at least on my machine).

Second Problem, let's say I give the Float32Array(maxElements) a maximum size, and I add 4 Sprites then I have allocated much more than I actually need.

Other way: I create Spritebatch when I know how many sprites I have. So basically I put 4 Sprites into my scene, then before rendering I create a Spritebatch with size 4 * numVerticesPerSprite. However let's say I want to update Sprite 2, I need some kind of index structure in my Spritebatch class to identify at which position the vertices of Sprite 2 are stored inside the SpriteBatch (inside Float32Array()).

So my question is :

How is a dynamic Spritebatch supposed to work and can you think of an indexing method to identify Sprite X's vertices inside the Float32Array to update/remove them? (Additionally: Do particle systems solve what i am looking for? I assume they are also some kind of sprite batching)

sentences:
iOS game center game is out of sync I've been building a game center game for iOS and it works great so far. I finally started testing the game and theres (obviously) some latency, which is causing the game to be out of sync.

Basically I have 2 players, each controlling a game character. The game character can shoot fireballs and iceballs etc. These attacks do damage, and they have effects. For example. the ice ball effect will freeze the opponent for 3 seconds if it makes contact. the fireball will do extended fire damage for 3 seconds.

so the problem is, when I was playing against my brother, because of the latency, my game said I had 40 health left and he was down to 0, while on his device, the game said I had 0 and he had 20.

This means that attacks were registering/colliding on one device (based on the positions of the characters/fireballs) and not on the other. and vice versa.

I'm currently using the default peer-to-peer game-center architecture. Would using a client-server architecture (one person becomes the server) solve this out-of-sync problem?

if not, what other options do I have with the game kit API?

sentences:
Save Script Doesn't Save Item Variables I've been working on an RPG videogame, and I have been trying to implement a Save button into my game, which is supposed to save the player's itemAmount variable, which is in another script, called ItemInformation. I retrieve the itemAmount variable at Start() by getting the script from the itemHolder GameObject. I plan to use this script in multiple GameObjects, because I use the same variable (itemAmount) with different values in different GameObjects. For some reason, I don't receive any errors or warnings in the Console. Here is my script to the Saving System:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

public class InventorySave : MonoBehaviour
{
    // Public variables for inventory and health
    private GameObject itemHolder;
    private ItemInformation myItemAmount;

    // Initiates before the first frame
    void Start()
    {
        // Gets components for the player variables
        itemHolder = transform.gameObject;
        myItemAmount = itemHolder.GetComponent<ItemInformation>();
    }

    // Function that will be called when player saves game from pause menu
    public void SaveGame()
    {
        // Creates file to store variables
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/SaveData.dat");
        SaveData data = new SaveData();

        // Gets the player data
        data.itemSave = myItemAmount.itemAmount;

        // Writes player data to file and encrypts it
        bf.Serialize(file, data);
        file.Close();
    }
}

// Holds data that is to be saved
[Serializable]
class SaveData
{
    // Variables for save file
    public int itemSave;
}

sentences:
Common structure for MIDI systems? I'm thinking of writing a MIDI system for my game that would take in an instrument and a note, then play a sound.

Considering so many rhythm games have already been made, I am curious as to how others have tackled this issue, so I might learn what things they considered in making a better system.

To be clear, I am not asking for opinions of 'which way is better', but rather, 'what have others done?'

sentences:
In LIBGDX how to give different frametime to animations As of now I've been using Gdx.graphics.getDeltaTime() to achieve this but I think this shouldn't be the correct way.

Let's say I have 3 images/sprites and I want the first one to stay for 1 second, the second sprite for 0.5 second and the third sprite for 3.5 seconds, so it combines a 5 second animation.

As of now I've been using "ifs", as in

if time <= 1 second, draw first image

if time > 1 && time <= 1.5, draw second image

if time > 1.5 && time < 5, draw third image

I've followed 2D Animation tutorial, but to run multiple sprites in order, they all have the same time between them and I want it to have different frametime.

Any idea that might I would be apreciated.

The idea is to run timed based animations for a certain amount of time.

sentences:
Store temporary state in DB or not Background

I'm trying to implement a little MMORPG. I'm planning to use Cassandra DB for the database.

Question

I don't really understand which data should be store in DB and which one should be just kept in memory.

For example : the friend list. Friend list will be stored in DB, but what about connected / disconnected friends ? Should I keep in memory all connected account and access it directly ? Or should I store this information in the DB (therefore writing / reading quite often for something that could be kept in the memory) ?

sentences:
Doom-style 2.5D Movement Animations I've started working on a demo for my 2.5D game. For a basic scene I figured I would just use the good old fashioned doom sprites textured to a double sided plane. Simple enough. But I've been scratching my head as to how to display the proper sprite animation relative to the player viewing the sprite...if that makes since.

For example suppose I have three players in the scene Players A, B, and C as such:

Player C should see player A as:
Here's an example of what I think player A should look like from C's perspective:

While player B would see player A as follows:

My current idea is that for any given player, I will need to know the current direction of each other player, and where they are located/moving to relativly. From this, I could calculate which sprite image is required.

Is this correct? What improvements/optimizations could be made?

** EDIT **
Total number of directions will be 8 as depicted below:

For each direction there are two sprites (to show walking movement, sprites for the right hand directions are mirrors of the left):

** EDIT 2 **
Got this working and have a simple javascript/threejs example for anyone interested: https://github.com/commanderZiltoid/threejs-2.5d-fps

sentences:
How to detect collision between a camera and a mesh? I am wondering how you would be able to extract mesh properties (i.e. faces, vertices, and vertex normals) and use them to create a collidable object, one that a camera can't go through ?

I am using @TheCodingUniverse's OBJLoader. The files are in the episode_24 and utility folders.

sentences:
Are C and Objective-C sufficient for creating games on the iOS? These days, I'm focusing on games development on the iOS.
C++ is the lingua franca for games development but seriously, I prefer to code in C programming language, not in C++.

So for iOS games development, are C and Objective-C sufficient for creating games?

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:
Order of render with transparency opengl I tried to render using different render configurations (GL_BLEND_FUNC()) but I couldn't get the back object to render in certain angles. The first screenshot here shows one angle where the back object is not visible through the front one. In th second screenshot, I looked at the blocks from 180 degrees.

Is there a way I could render them through? Or would I have to implement a sorting algorithm?

sentences:
Unity 3D platform spawning problems I'm making an infinite runner game in Unity 3D. I have it so that platforms spawn and move backwards toward the player and they are destroyed once past the player. Over time when the platforms are spawned, the position they're spawned at gets more and more inaccurate. Sometimes they over lap slightly and sometimes there are small gaps in between them. And as the game is continuously played, it gets worse and worse. You can watch the video below to see what I mean. This is the script I use to spawn the object
 public GameObject[] objectSpawned;

 public PlatformKiller myPlatformKiller;

 void Start()
 {
     myPlatformKiller = GameObject.Find("PlatformKiller").GetComponent<PlatformKiller>();
 }

 private void Update()
 {
     if (myPlatformKiller.readyForSpawn)
     {
         int rand = Random.Range(0, objectSpawned.Length);
         Instantiate(objectSpawned[rand], transform.position, transform.rotation * Quaternion.Euler (-90f, 0f, 0f));
     }
 }

Here is a video so you can see what I'm talking about: https://youtu.be/eASouQlTsqs
Also, I know the exact unit size for each platform is 11.92. I know this because I added a c# script to each one that shows me the vector3 values. There are originally 20 platforms. And to know exactly where to spawn the object I did 11.92*20 = 238.4. And the first platform is at -4.78. So I subtracted that from 238.4 and got 233.62. So a z position of 233.62 is the correct place to spawn the object. I just wanted to include that in there so you know that the spawner gameobject is in the right place. Please let me know if there is any additional information about this that I can give you. Everything should theoretically work I think, so I seriously have no idea what to do. Thanks for your help!
readyForSpawn is set in my PlatformKiller script shown below:
public bool readyForSpawn;

void Update()
{
    readyForSpawn = false;
}

void OnTriggerEnter(Collider target)
{
    if (target.tag == "Floor")
    {
        readyForSpawn = true;
        Destroy(target.gameObject);
    }
}

And that script is attached to PlatformKiller Game Object:

sentences:
Any GL transformation not working Today I was trying to make a test camera, with a new method(I usually use gluLookAt)

So I got a problem,

void GameDraw()
{
    glPushMatrix();
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90, WIDTH / HEIGHT, 0.001, 10000.0);
    pitch += 1;
    glRotatef(pitch, 1.0, 0.0, 0.0);
    glRotatef(yaw, 0.0, 1.0, 0.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    s->bind();
    test->drawMesh();
    glPopMatrix();
}

And my draw function is:

glDrawElements(GL_TRIANGLES, indices, GL_UNSIGNED_INT, nullptr);

if it isn't working with glDrawElements is there any alternative to use?

Edit: Disabling shader it works fine, but how I can use this with Shader

Please don't use glm examples, because I don't like to use it, I feel more comfortable by using the my math

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:
Raycasting in Unity3D? I have a game object on screen represented by a cube (but say it was a quad or something else all the same).

How do I raycast to check intersections? Keeping in mind I may not be raycasting fora  physical object, just a gameobject of any sort.

Another question I have is, how can you raycast in Unity3D just to check against an intersection against anything in general (say the first gameobject to be hit)?

sentences:
Saving data in games? I'm soon going to make a game for the iPhone as a school project.

My idea was to make a TLOZ remake, with Tiled Maps.

However, I'm not quite sure how save the data.
In TLOZ you have a lot of sub-quests, treasures, items, and much more.
I want the user to only be able to open a treasure once.

Therefore I have to save this information somehow.
However, I'm not sure how to assign the data to that certain object, for example that treasure that Link has opened.

I thought about making id's for every object, but I'll have multiple maps, and it doesn't seem like the right solution.

Are there any standards for this?

Or does anyone have another idea?

sentences:
Jerky Character movement after adding mouse orbit script I added a custom mouse orbit script to my project. When the right mouse button is clicked, the camera can be rotated around the player.

The issue, after this change, is my player movement has become jerky / choppy and not smooth. If I remove my mouse orbit script, player moment is back to normal i.e smooth. I can't seem to pin point what is causing this jerky movement withing MouseOrbit script

Video demo

Code

/* This is where we initialize our script */
void Start()
{
    Initialize();
}

/* This is where we set our private variables, check for null errors,
 * and anything else that needs to be called once during startup */
void Initialize()
{
    h = this.transform.eulerAngles.x;
    v = this.transform.eulerAngles.y;

    cameraTransform = this.transform;
    cam = Camera.main;
    smoothDistance = distance;
    timerot = TimeSignature((1 / rotationDampening)) * 100.0f;
    NullErrorCheck();
}

/* We check for null errors or warnings and notify the user to fix them */
void NullErrorCheck()
{
    if (!viewTarget)
    {
        Debug.LogError("Please make sure to assign a view target!");
        Debug.Break();
    }
    if (collisionLayers == 0)
    {
        Debug.LogWarning("Make sure to set the collision layers to the layers the camera should collide with!");
    }
}

/* This is where we do all our camera updates. This is where the camera
 * gets all of its functionality. From setting the position and rotation,
 * to adjusting the camera to avoid geometry clipping */
void Update()
{
    if (!viewTarget)
        return;

    if (Input.GetMouseButton(1))
        {
            Cursor.lockState = CursorLockMode.Locked;

            h += Input.GetAxis("Mouse X") * horizontalRotationSpeed * Time.deltaTime;
            v -= Input.GetAxis("Mouse Y") * verticalRotationSpeed * Time.deltaTime;

            h = ClampAngle(h, -360.0f, 360.0f);
            v = ClampAngle(v, minVerticalAngle, maxVerticalAngle);
            //              Debug.Log ("value of h: "+h);
            newRotation = Quaternion.Euler(v, h, 0.0f);
        }
        else
        {
            Cursor.lockState = CursorLockMode.None;
        }

    if (Input.GetKeyDown(KeyCode.D))
    {
        h = transform.eulerAngles.y + 90;
        newRotation = Quaternion.Euler(transform.eulerAngles.x, h, transform.eulerAngles.z);
    }

    if (Input.GetKeyDown(KeyCode.A))
    {
        h = transform.eulerAngles.y - 90;
        newRotation = Quaternion.Euler(transform.eulerAngles.x, h, transform.eulerAngles.z);
    }

    /* We set the distance by moving the mouse wheel and use a custom
     * growth function as the time value for linear interpolation */
    distance = Mathf.Clamp(distance - Input.GetAxis("Mouse ScrollWheel") * 10, minDistance, maxDistance);
    smoothDistance = Mathf.Lerp(smoothDistance, distance, TimeSignature(distanceSpeed));

    /*We give the rotation some smoothing for a nicer effect */
    smoothRotation = Quaternion.Slerp(smoothRotation, newRotation, TimeSignature((1 / rotationDampening) * 100.0f));

    newPosition = viewTarget.position;
    newPosition += smoothRotation * new Vector3(0.0f, height, -smoothDistance);

    /* Calls the function to adjust the camera position to avoid clipping */
    CheckSphere();

    smoothRotation.eulerAngles = new Vector3(smoothRotation.eulerAngles.x, smoothRotation.eulerAngles.y, 0.0f);
    Vector3 dir = new Vector3(0, 0, -distance);

    cameraTransform.position = newPosition;
    //cameraTransform.position = viewTarget.position + smoothRotation * dir;
    cameraTransform.rotation = smoothRotation;
}

Time Signature
with speed as input

private float TimeSignature(float speed)
{
    return 1.0f / (1.0f + 80.0f * Mathf.Exp(-speed * 0.02f));
}

sentences:
Menus for LWJGL - Swing or other? Okay so I want to create a main menu which includes several buttons and text fields, is there a built in library for LWJGL or would I use normal Swing and start a thread of the application?

Its a 2D game and I'm simply looking for a way of starting it from a menu rather than having it jump straight into game.

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 to get the physical camera sensor size on iOS / Android in Unity I'm trying to get the physical camera sensor size on iOS and Android mobile devices for intrinsics calculations.
On Android the sensor size should be found in the SENSOR_INFO_PIXEL_ARRAY_SIZE (Android CameraCharacteristics API). However I don't find a way to access that array via ArFoundation. I can imagine to write a plug-in for that, but I would also require a plug-in for iOS so I don't know if that's the right way to go.
Is there maybe another (easier) way to get the physical sensor size?

sentences:
Impact of object's statistics on the rendering Consider two 3D objects with n points and n triangles. One of the objects has a smooth surface such as a ball or a box, and the other object is like a fuzzy onion-layered object with large intersecting faces. Is there any difference between the rendering (complexity and time) of these two objects?

I know that regardless of the input, the rendering process has a fixed complexity, but I am wondering whether it is possible to evaluate the impact of objects' (vertex and connectivity) statistics on the rendering (complexity and time).

sentences:
How do I make my 3d cube move left and right with buttons in Unity with RigidBody.AddForce? How do I make my 3d cube move left and right with buttons in Unity with RigidBody.AddForce()?
I can't figure out how to do this in Unity!
I'm trying to make my game playable on Android but I can't get my cube to move with buttons!

sentences:
Execute Timer Events of another Blueprint from the C++ UE4 I am having problem and it's about a week now that I still can't figure out how to get it right.

It seems that I can't run any functions from the blueprints that contain timers at all.

I have a Datatable full of details of each functions that will executed according to its key input and the owner of the functions.

The ordinary functions and custom events executed well but will stopped at a timer.

This is the code that I have made so far. I added the matching functions string into the delegate with its Owner which is the obj, and it will executed on key input.

p.s: Ignore the error, Intellisense was messing me up

I saw the error regarding the world not found here,

but I'm not sure if that is the case since other functions without any timer inside can execute well. Any ideas? Thanks.

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:
Promoting independent iOS games Possible Duplicate:
  What are effective marketing strategies for iPhone games?

I'm interested in promoting my latest iOS game.  What have you done that really helped spread the word?  Any smaller game review sites that were helpful?  How about publishing?

sentences:
Why do I get white highlights at the edge once light build complete? Whenever I build my lights in Unreal, why do I always get white highlights at the edges? I can't seem to solve this. I get this problem with both static and stationary lights. Can someone please help? I have also seen this problem in Unity and I could not solve it.

-Kumsan-

sentences:
How to understand huge code bases? I read about game loops, read tutorials of simple games like Asteroids and programmed them by myself. Nevertheless if I try to start reading code of a game with many many thousand lines of code, I have no clue at all where to start, what files to open first and which next to understand how it all work together.

My question is, are there any projects/tutorials out there, that gives a rookie some guidance (by example) how to start reading code of large open source game projects?

sentences:
How to prevent a duplicated shadow? It's a blob shadow which is built in Unity's standard asset package.

As you see in the figure below, a shadow that is created by the Unity Projector is duplicated at the floor below.

How can I prevent this duplicated shadow?

sentences:
Direct3D9 depth write without depth test In OpenGL and Direct3D11 depth write is disabled if depth test is disabled. To enable depth write with out depth test in gl you must enable depth test with depth func always.

OpenGL

  Even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. In order to unconditionally write to the depth buffer, the depth test should be enabled and set to GL_ALWAYS (see glDepthFunc).

Direct3D11

  DepthEnable and StencilEnable enable (and disable) depth and stencil testing. Set DepthEnable to FALSE to disable depth testing and prevent writing to the depth buffer. Set StencilEnable to FALSE to disable stencil testing and prevent writing to the stencil buffer (when DepthEnable is FALSE and StencilEnable is TRUE, the depth test always passes in the stencil operation).

I can't find any documentation on this behavior for d3d9.

In Direct3D9 if D3DRS_ZENABLE is set to D3DZB_FALSE and D3DRS_ZWRITEENABLE is set to TRUE is the depth buffer written to?

sentences:
VBO with texture index buffer different than vertex index buffer I am trying to write my own OBJ importer and renderer in OpenGL (yes, I know, reinventing the wheel) and I found a problem that I don't knwo how to handle.

In an OBJ file faces are defined by a list of indices that refers to the vertices IDs that belongs to that face (and the same for texture coordinates IDs), an example of a face could be:

  f 2411/905 2414/906 2913/1463

which would mean that this face is created by vertices 2411, 2414, 3913 and texture coordinates IDs 905, 906, 1463. And this leads to different index buffers, if I am not mistaken...

Now the question is, having both a buffer of vertices and a buffer of texture coordinates, how can I use both "at the same time", if I am only able to bing one index buffer and the indices to be used for a particular face are different for vertices and texture coordinates? Is there any trick to bind two index buffers, one for vertices and another one for texture coordinates?

And finally, just to give some code of what I've tried and that obviously doesn't work because I am binding two different GL_ELEMENT_ARRAY_BUFFER_ARB before drawing..., so it ends up with random texture coodinates.

// TEXTURE VBO
glBindBufferARB(GL_ARRAY_BUFFER_ARB, texCoordBuffer);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, texIndicesBuffer);
glIndexPointer(GL_INT, 0, 0);

// GEOMETRY VBO
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffer);
glVertexPointer(3, GL_FLOAT, 0, 0);
glEnableClientState(GL_VERTEX_ARRAY);

glBindBufferARB(GL_ARRAY_BUFFER_ARB, normalBuffer);
glNormalPointer(GL_FLOAT, 0, 0);
glEnableClientState(GL_NORMAL_ARRAY);

glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indicesBuffer);
glIndexPointer(GL_INT, 0, 0);

// Bind texture and draw...

sentences:
Couldnt visualize the mechanism describe by the code Was reading this article http://www.jgallant.com/2d-liquid-simulator-with-cellular-automaton-in-unity/ but couldn't understand the mechanism in "CalculateVerticalFlowValue". Is the remaining liquid represent the tile just above the tile "destination liquid"? Would appreciate if can provide simpler example to visualize the mechanism as I couldn't see the logic behind this code.
using UnityEngine;
using System.Collections.Generic;
public class Liquid {

// Max and min cell liquid values
float MaxValue = 1.0f;
float MinValue = 0.005f;

// Extra liquid a cell can store than the cell above it
float MaxCompression = 0.25f;

// Lowest and highest amount of liquids allowed to flow per iteration
float MinFlow = 0.005f;
float MaxFlow = 4f;

// Adjusts flow speed (0.0f - 1.0f)
float FlowSpeed = 1f;

// Keep track of modifications to cell liquid values
float[,] Diffs;

public void Initialize(Cell[,] cells) {
    Diffs = new float[cells.GetLength (0), cells.GetLength (1)];
}

// Calculate how much liquid should flow to destination with pressure
float CalculateVerticalFlowValue(float remainingLiquid, Cell destination)
{
    float sum = remainingLiquid + destination.Liquid;
    float value = 0;

    if (sum <= MaxValue) {
        value = MaxValue;
    } else if (sum < 2 * MaxValue + MaxCompression) {
        value = (MaxValue * MaxValue + sum * MaxCompression) / (MaxValue + MaxCompression);
    } else {
        value = (sum + MaxCompression) / 2f;
    }

    return value;
}

sentences:
PID controller error value for heading correction I'm using a PID controller in my AI to steer my NPCs to a desired heading (by adding torque). I've adapted the code from here: http://answers.unity3d.com/questions/199055/addtorque-to-rotate-rigidbody-to-look-at-a-point.html

The above example uses the cross-product of the two headings as the error value for the PID controller. This works great if the angle between the desired and current headings is less than 90 degrees but if the angle is greater than that, the PID controller corrects to the opposite direction than I want (as it tries to correct to zero)!

What is a good error value between two vectors to pass into a PID controller that works no matter what the angle between the desired, and current heading?

Note: because the PID controller returns the correction as a vec3, the error value must also be a vec3

sentences:
glBufferSubData and offset alignment? I'm having trouble rendering some of my meshes; some display just fine, some are drawn wrong or not at all.

While troubleshooting I was looking at the openGL docs (http://www.opengl.org/sdk/docs/man3/) and on the topic of glBufferSubData the following line caught my eye:

Clients must align data elements consistent with the requirements of
the client platform, with an additional base-level requirement that an offset
within a buffer to a datum comprising N bytes be a multiple of N.

I am buffering vertex + normal and index data like this:

glGenBuffers(1, &mVBO);
glGenBuffers(1, &mIndexBuffer);
glGenVertexArrays(1, &mVAO);

// buffer vertex, normals and index data
glBindVertexArray(mVAO);
glBindBuffer(GL_ARRAY_BUFFER, mVBO);
glBufferData(GL_ARRAY_BUFFER, (vertexData.size() + normalData.size()) * sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, NULL, vertexData.size() * sizeof(float), &vertexData[0]);
glBufferSubData(GL_ARRAY_BUFFER, vertexData.size() * sizeof(float), normalData.size() * sizeof(float), &normalData[0]);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexData.size() * sizeof(uint32_t), &indexData[0], GL_STATIC_DRAW);

glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid*)(vertexData.size() * sizeof(float)));

// unbind array buffer and VAO
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);

So for the vertex and normals I first allocate the complete buffer using glBufferData and then fill it in using glBufferSubData.
My question then is, according to the docs, do I need to align the offset my normal data, and if so with what? Is this what couldve caused some meshes to draw incorrectly?

sentences:
How can I add up the Transform/GameObjects in the Array of Waypoints in Unity? I come up with this code and I try to get the waypoint + 1 when I reach the waypoint and it adds up till the last waypoint. I get Array is out of Index error. I guess I need and foreach loop of waypoints ?

Code:

public float speed;
public float turnSpeed;

public Transform[] waypoints;
private int currentWp = 0;

void FixedUpdate ()
{

    if(waypoints.Length >= currentWp)
    {
        return;
    }

    player.position = Vector3.MoveTowards(player.position, waypoints[currentWp].transform.position, speed * Time.deltaTime);

    var rotation = Quaternion.LookRotation(waypoints[currentWp].transform.position - player.position);
    player.rotation = Quaternion.Slerp (player.rotation, rotation, turnSpeed * Time.deltaTime);

    float distance = Vector3.Distance(player.position, waypoints[currentWp].position);

    if(distance <= 10)
    {
        currentWp++;
    }
}

sentences:
How to perform alpha blending on saved raw argb videos(a image and a video will also work) using direct3d9 , direct3d10 or direct3d11? I'm trying to perform alpha blending on videos using direct3d11. I've wrote the code snippet below to achieve this. I've tried to read the video file out2.argb frame by frame and store it in the rawData. Later, I passed that rawData to CreateTexture2D but pTexture remained null after the execution of the API. So I tried passing NULL to the CreateTexture2D and passing rawData to the UpdateSubresource but again the pTexture remained NULL.

HRESULT result;
    FILE * fp = NULL;
    int size = 1280 * 720 * 4 ;
    void * rawData = NULL;
    D3D11_TEXTURE2D_DESC desc;
    desc.Width = 1280;
    desc.Height = 720;
    desc.MipLevels = 0;
    desc.ArraySize = 1;
    desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    desc.SampleDesc.Count = 1;
    desc.Usage = D3D11_USAGE_DYNAMIC;
    desc.BindFlags = D3D11_BIND_SHADER_RESOURCE| D3D11_BIND_RENDER_TARGET;
    desc.CPUAccessFlags = 0;
    desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;

    D3D11_SHADER_RESOURCE_VIEW_DESC shader;
    shader.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    shader.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    shader.Texture2D.MipLevels = -1 ;
    shader.Texture2D.MostDetailedMip = 0;

    fp = fopen("../Engine/Data/out2.argb", "rb");
    rawData = malloc(size);

    D3D11_SUBRESOURCE_DATA data;
    data.SysMemPitch = 1280 * 4;
    data.SysMemSlicePitch = 1280 * 720 * 4;

    if (NULL == rawData)
        return -1;
    int row_pitch = (1280 * 4) * sizeof(unsigned char);
    if (fp)
    {
        /*while (!feof(fp))
        {*/
            fread(rawData, size,1, fp);
            //D3D11_SUBRESOURCE_DATA *sSubData = new D3D11_SUBRESOURCE_DATA[1];
            //for (int i = 0; i < 1; i++) {
            //  sSubData[i].pSysMem = rawData;
            //  sSubData[i].SysMemPitch = (UINT)(1280 * 4);
            //  sSubData[i].SysMemSlicePitch = /*(UINT)(1280 * 720 * 4)*/0;
            //}

            //data.pSysMem = rawData;
            // GOT FRAME
            device->CreateTexture2D(&desc, NULL, &pTexture);
            deviceContext->UpdateSubresource(pTexture, 0, NULL, rawData, row_pitch , 0);
            result = device->CreateShaderResourceView(pTexture, &shader, &m_texture);
            if (FAILED(result))
            {
                return false;
            }

    /*  }*/

        fclose(fp);
        fp = NULL;
        free(rawData);
        return true;
```

sentences:
Polygon count target range for MMO being released in 2 years What would a realistic poly count target range be for NPC and player models in a 3D MMO that will be released in 2 years? What about poly count target range for the entire camera view (environment, NPC and player meshes)?

I read in some places that one should not aim too low if the game will come out in a couple years because technology is always advancing. If you can give some mesh poly stats on what other current MMOs / MMORPGs are running and future projections, that would be great.

Thank you.

sentences: Do I need an Indie Studio Name? I've recently been making a mobile game which I'm going to publish to Google Play. Google Play requires a Developer Name. Most Google Play Developer use their game studio name like Gameloft, Supercell, etc. But some indies use their names as the developer name like Scott Cowthon, FNAF Developer. I was wondering what are the advantages and disadvantages of each type to me as the only developer of my game?

sentences:
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:
Scrolling Background - smoothest way I am trying to find the best solution for drawing a scrolling background in my app in Java. For now, I have two images and I move them by 1x and put it's thread to sleep for hmm, 5ms.

The problem is here that the background is too fast. What should I do?
Probably put the thread to a longer sleep. But when I do this, the background 'freezes' - jumps for 15 pixels each step and it doesn't look smooth.

The main question is:
How to handle a thing like this? Should it be done by sleeping it's thread, or maybe I should make positions floats, increment them by 0.1 and move only when they are integers? << this is my idea, I don't have an idea if it would work.

We have floats: width = 1000.0 height = 1000.0;
When increment width by 0.1 in each 'update iteration' in a gameloop.
If it's a int (1001, 1002, 1003), we move the background. What do you thing? What would be the best way?

sentences:
MonoGame/Xna gamepad inputs and joystick I've been around xna game development since very recently, and I'm actually developing a sort of Library for my games. But then I want to make an enemy with default Player settings for keys layouts and stuff. I've managed to create one for Qwerty and Azerty but I also want to create one for gamepad Controllers. Here comes the problem. The default XNA Input Framework is very limited (I think) because, from what I saw, it only manages few buttons that do not include Dpad or Joysticks.

So, is there a way to manage them in xna? or do I need an external Library?

Thanks for your help;

sentences:
"Non-additive" alpha blending in OpenGL ES 2.0, Android (AndEngine) I have several monochromatic sprites and I render them with alpha = 0.25 (all of them the same value). I want to "paint" with them, so when they overlap, the alpha won't be added. I am not sure if I can express myself properly in English - here is an image of what I want to achieve (background visibility is important).

Is this achievable in OpenGL ES 2.0? I was trying to figure out the different modes of alpha blending, but without success. Also if anyone can tell me, how is this called, I can continue my search.

If this is not possible, I was thinking maybe I can somehow render the monochromatic sprites (alpha = 1) to a texture and only then render this texture on screen. How can this be done in AndEngine?

sentences:
Why is the ownership fixed when synching objects? I'm creating a billiard game where one white ball will be controlled by two online players.

I have set my object photonview to ownership takeover.

When a player shoots the ball in one client, it is synced on other client.
Now when I update the ball on the other client, the other client is not updated.

Why is the ownership fixed?

Only one client is sending the updates to the other client, and not vice versa.

What should I do here?

sentences:
Why does my custom network Manager disable the main one Whenever I add a custom Network Manager to add functionality to and override it's functions, the main NetworkManager got disabled so I could not see the NetworkManager HUD or start matches. It there a way around that?

(EDIT)
[Thanks for the response]
It's not just the HUD that's the issue. The Networking is disabled entirely. Can I change this through a custom HUD?

sentences:
convert orientation vec3 to a rotation matrix I've got a normalized vec3 that represents an orientation.

Each frame of animation, an object's orientation changes slightly, so I add a delta vector to the orientation vector and then normalize to find the new orientation.

I'd like to convert the vec3 that represents an orientation into a rotation matrix that I can use to orient my object.

If it helps, my object is a cone, and I'd like to rotate it about the pointy end, not from its center :)

PS I know I should use quaternions because of the gimbal lock problem.  If someone can explain quats too, that'd be great :)

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:
Figuring out the exponent in a spotlight equation from the angle of a cone I followed a tutorial on how to build a spotlight using DirectX. This tutorial uses a point light equation plus a line of code to limit the light to the shape of a cone. I have everything working, but the equation for constraining the light uses a constant exponent to control the broadness of the light, which is all well and good if I was just tweaking the value for looks alone, but I also want to know the precise size of the cone in order to do culling on the CPU side. Here's the equation:

float lightAmnt = dot(lightToSurfaceVector, inputNormal); // point light

lightAmnt /= attenuationA + attenuationB * distance + attenuationC * distanceSquared; // falloff

// exponentConstant to control broadness
lightAmnt *= pow(max(dot(-lightToSurfaceVector, lightDir), 0.0f), exponentConstant); // spotlight

what I'd like to do is create an angle theta for the cone on the CPU, and then create the exponentConstant based on that and the range aka cone height, but I don't know how that math would work. And I realize there are other spotlight equations, but I like this one because the attenuation works identically between point and spot lights. Can anybody lend a hand?

link to the tutorial: https://www.braynzarsoft.net/viewtutorial/q16390-21-spotlights

sentences:
Optimal Compression for Speech I'm designing a game that depends heavily on audio; I will have some 300+ speech files (most of them just a word or two long). This can very quickly escalate the size of my final game.

What's the optimal way to encode/compress speech files to keep the size minimal without getting audio artifacts?

Please address both per-file compression/encoding, and also zipping/compressing the set of all speech files together in your answer. Because I'm not sure which (or combination of both) factors will give me the best results.

Edit: I need this to run in Silverlight and Android, so I'm presumably stuck with only MP3 as my option (other than uncompressed wave files).

sentences:
Get world-position in Vertex shader I'm wondering how I can get the final position of a vertex. I use glTranslate in my render code, and I'm not getting the world-coordinates correct. My world is devided in chunks and my position get's screwed up.

I have tried multiplying the position with the 3 built-in matrices, but no success.

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:
Is there a way to start with OpenGL 3.0+ without need to write my own shaders? I'm starting with OpenGL and found out that after OpenGL 3.x you must write your own shaders (think it's obligatory). Am I right here?

I have made some research but I can't seem to find the answer.
If it's necessary to write the shaders for OpenGL 3 the I still can use 2.x right? Just because I'm just starting and OpenGL seems a little bit more level than I'm accustomed to. So I think I'll have a really hard time writing a shader myself.

P.S. My GPU only supports up to OpenGL 3.0. I think it's because of the drivers, I'm running a Linux distro that only has FLOSS (no proprietary software).

sentences:
My rigid body controller stuck in middle of screen (unity) Still working on my Star Fox clone and am changing up the camera a bit.

The problem I keep having is my Ship gets locked in the middle of the screen and can't move while its parent (spinMe) is still moving.

I'm working with rigidbody-ception here I have a rigidbody with in a rigidbody. Both of them move up, down, left, and right.These two are called spinMe and Ship.

In this version  the player is able to move until they reach the end of the screen.

What I'd like to do is have the camera move slightly as well to help Ship cover more of a bases and help with perception. Star Fox did this as well.

So spinMe pulls Ship around with it but for some reason that keeps Ship from moving independently while being moved around by spinMe. Only when spinMe can't move any further Ship will move.

So I guess I would like to know is why can't I get my Ship to move at the same time as spinMe.

So this is the main chunk of the code for spinMe

    Vector3 movementy = transform.TransformDirection(Vector3.up * Input.GetAxis("Vertical") * turnSpeed);
    Vector3 newPos = transform.position + movementy;
    Vector3 offset = newPos - Midpoint.position;
    transform.position = Midpoint.position + Vector3.ClampMagnitude(offset, radius);

    Vector3 movementx = transform.TransformDirection(Vector3.right * Input.GetAxis("Horizontal") * turnSpeed);
    Vector3 newPosx = transform.position + movementx;
    Vector3 offsetx = newPosx - Midpoint.position;
    transform.position = Midpoint.position + Vector3.ClampMagnitude(offsetx, radius);

And this is the movement for Ship

Vector3 pos = Camera.main.WorldToViewportPoint(transform.position);
    pos.x = Mathf.Clamp01(pos.x);
    pos.y = Mathf.Clamp01(pos.y);
    transform.position = Camera.main.ViewportToWorldPoint(pos);
   Vector3 moveDirection = new Vector3(turnSpeed * Input.GetAxis("Horizontal"),
                                       turnSpeed * Input.GetAxis("Vertical"), 0);
   moveDirection = transform.TransformDirection(moveDirection);
   rb.MovePosition(transform.position + moveDirection);

I've tried this a variety of different ways and I believe this is my best chance of getting this working.

sentences:
DirectoryNotFoundException for an existing file path on Unity startup I'm not sure why this error appears in my console when I start up my Unity editor but it is stopping me from running any Unity projects by pressing the play button.

I have tried re-installing Unity, checking out the file at the specified file path destination and searched my local Unity folders for any relevant files that are calling for a file path search.

I want to know which file is responsible for specifying/assigning the file path causing the error.

The error message is pasted below with a screenshot of the Unity editor (with the error message in its console) and a screenshot of the specified file in the file path:

Error message

DirectoryNotFoundException: Could not find a part of the path "F:\Computer Science\Aston University Work\Final Year (for real)\Game Development\Labs\LabSeven\Workspaces\labSeven_Home_Vers\Library\PackageCache\com.unity.analytics@3.2.2\Tests\Editor\Unity.Analytics.StandardEvents\Unity.Analytics.StandardEvents.EditorTests.asmdef"
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at :0)
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at :0)
(wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize, System.Boolean checkHost) (at :0)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) (at :0)
System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) (at :0)
System.IO.StreamReader..ctor (System.String path) (at :0)
(wrapper remoting-invoke-with-check) System.IO.StreamReader..ctor(string)
System.IO.File.ReadAllText (System.String path) (at :0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.LoadCustomScriptAssemblyFromJson (System.String path) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:463)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.SetAllCustomScriptAssemblyJsons (System.String[] paths) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:681)
UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:SetAllCustomScriptAssemblyJsons(String[])

Screen shots

Many thanks in advance.

sentences:
UX guidance for mobile games I m in need of some UX guidance if there is any for a game in mobile.

for example for pausing the game (assume I m not using iOS) say you want to pause the game and you dont want to loose part of the screen on having a button that will pause. I was thinking of using some sort of gesture ( double tap?, slide up?) is there any default standard?

Cheers

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:
Very less vertical transformation Im using pretty basic code here

charcter.transform.Translate(Vector2.up * speed * Time.deltaTime);

Im using rigidbody 2d and I'm creating a platformer. When i press the button the character transforms very little in y axis.

sentences:
How can I implement a third-person camera in an SC2 map? I want to try creating a custom Starcraft 2 map with a third-person camera following a unit. A few custom maps with this feature exist already, so I know it's possible.

How do I do this? Do I need a custom mods file, or can everything be done in the map file?

sentences: When should I use auto-managed buffers in LWJGL 3? LWJGL3 has two methods of creating buffers that I know of: Auto-managed buffers that clean up the buffers automatically using the MemoryStack class, and manually managed buffers that must be manually cleaned, are are created with the MemoryUtil class. What I am wondering is should I always use MemoryStack, or are there certain times when one method would be more efficient than the other?

sentences:
How do I create this windblown snow effect? How do I create this snowy wind kind of effect, where wisps of snow appear to blow through the air close to the ground?

I have seen this in several games like Skyrim, the new God of War, but I don't know what name to call it by.

I found this God of war gameplay https://youtu.be/b7u59Iutb0c

sentences:
How much to bake user input in a client-server? Assume a client-server game where there server manages all state and the clients are simply rendering / input.

How much should I bake user input from the client before sending it off to the server?

Does it make sense to send "jump" or "space keydown"?

I'm inclined to bake the input as much as possible.  Am I setting myself up for pain later?

sentences:
How can I test on a device I don't have? I received a report that my application fails to run on a specific device (smartphone).

However, not only I don't have access to that device, but they're also quite rare, and I'm not going to buy one just to fix this problem.

Unfortunately, it is imperative that I support that device, as it is a requirement to get published on a store I need to publish on.

Do you guys have any ideas on what can you do when you need to test on a device you don't and can't have?

sentences:
Imported Blender .fbx model appears transparent I exported a model that i made in blender to a .fbx file. I imported it to Unity and, as you can see in the image, one arm of my character appears transparent.

I already have the normals pointing in the right direction, so i can't see what's causing this. I even tried to create a new arm from the other one, but the problem persisted.

What is causing this?

sentences:
Spherical fractal noise generator in shader I have a growing sphere in space, and I thought of having a procedural generated texture over it. Since it is growing, I thought a fractal would be a great choice, because more details would be visible the larger the sphere get (and I could mess with some parameter over time to have it animated).

A quick Mandelbrot implementation in GLSL showed it would be too expensive to have it in the devices I am targeting; also, I don't know how to map a cool looking fractal over complex plane onto a sphere without distortions (I expect the players to fly around this sphere in every direction, so there should be no "glued" edges or collapsed points), neither I have the background to devise/project a fractal over the spherical surface myself (probably was done before, but I could not find).

So weighting the requisites of the procedural texture:

Fast to run, for low-end/mobile GPU;
Over a spherical surface domain;
Growing in details with growing in size;
Possible to animate (BONUS);
Cool looking (of course);

then I thought it might be impossible within the constraints. But since I am no expert in this fractal thing, I thought I could ask it here first before scraping out the idea.

Maybe it is really not a fractal I need, and there is some other kind of noise with growing details I could use. Do you know of such noise generation procedure?

Do you know of any noise generator with uniform distribution over spherical sufaces, or any fractals whose domain is a sphere?

Can you suggest any alternatives for my situation?

sentences:
How to create gui image with script So I've been fiddling around with the new UI system recently -- and one problem I have is adding images of my sprites to the ui.

I know I can create a prefab of an image gameobject with the sprite I want, but I have hundreds of the sprites I want to add to the ui (They're different characters) so I don't want to create hundreds of prefabs. Instead, what I want to do is in a script, create an image gameobject, set its sprite, and child it to a parent panel in my canvas. Is this possible?

sentences:
How do i calculate the velocity of a sprite after it leaves circular motion? I'm trying to make a game where the character can swing on a rope.

I want to know how the velocity of player is calculated when it stops circular motion. Any help would be appreciated.

sentences:
LibGDX: Colllisions between bullets and enemies in arrays I am writing a "Gauntlet" style game. So far I have managed to successfully detect collisions between my player object and my ghost enemy objects, and when they collide they drain the player's energy.

The Ghosts are stored in an ArrayList. I now have bullets which the player can fire, these are instantiated from the Player class and added to another ArrayList called bullets.

I typically have around 50 ghosts on the screen dotted around the map.

ArrayList<Ghost> ghosts = new ArrayList<Ghost>();
ArrayList<Bullet> bullets = new ArrayList<Bullet>();

The ghosts and bullets are added to these lists when spawned/fired

I have tried to implement a method as per below, to try and determine whether a ghost's bounding rect and a bullet's bounding rect overlap, as follows:

/**
 * Check if a ghost has been hit by a bullet
 */
public void checkGhostsHit() {

    Iterator<Ghost> iterEn = ghosts.iterator();

    while ( iterEn.hasNext() ){
        Ghost g = iterEn.next();

        //initialise the bullet iterator each time here
        Iterator<Bullet> iterBul = Player.bullets.iterator();

        while ( iterBul.hasNext() ) {
            Bullet b = iterBul.next();

            if ( b.getBoundingRect().overlaps( g.getBoundingRect() ) ) {
                Gdx.app.log("Enemy", " Hit");
                iterBul.remove();
                iterEn.remove();
            }
        }
    }
}

This method is being called from my main render loop but I cannot get it working for love or money. I have tried various forms of the above method, including 'For' loops etc.

Am I performing the check in the correct place? Should the Bullet class instance iteself be checking for a collision, or is the above approach the correct idea.

As you can tell I'm a noob to this and I am still struggling with working out which activities should be undertaken by particular game Classes.

sentences:
Determine if 2D-projected point is visible I render a model and do have various 3D points around the surface of it. Because it's easier and I'm already using D2D for UI rendering, I implemented it so that these points are rendered as 2D points onto the screen.

The thing is that of course not all points are always visible. I'd like to test that and only show these which are actually seen by the camera.

Is there any way besides rendering them in Direct3D or reading the depth-buffer CPU-side to test it?

sentences: Looking for online resources to understand game camera properties What are some good online resources to understand game camera properties, such as fov, aspect-ratio and more?

sentences:
Unity doesn't show always the score I don't know if this issue is in Unity or in my script, the score work well in scoreText, but in the scorePanel its show before last score like it showing 1 rather than 2; the issue doesn't always appear its appear just in specific moment when my score++ and player die nearly in same time, so here is my script.
AddToScore is called with InvokeRepeating, scoreText who show me the correct score, it works well

void AddToScore(){
    score++;
    scoreText.text = score.ToString ();
    mySound.Play();
}

This is when my player Die

void OnCollisionEnter2D(Collision2D other)
{
    Time.timeScale = 0;
    Die ();
}

void Die (){
    Pause.SetActive (false);
    Panel.SetActive (true);
    GameOverPanel.SetActive (true);
    GenerateObstacles.HighScore ();
}

And here is the HighScore from GenerateObstacles

public void HighScore(){
    if (score > highScore) {
        PlayerPrefs.SetInt ("highScore", score);
        highScore = PlayerPrefs.GetInt ("highScore");
        scorePanel.text = score.ToString ();
        highScorePanel.text = highScore.ToString ();
    }
    else if (score <= highScore) {
        highScore = PlayerPrefs.GetInt ("highScore");
        scorePanel.text = score.ToString ();
        highScorePanel.text = highScore.ToString ();
    }
}

Here is a paint to understand

sentences:
Canvas overlapped by scene objects I am doing a space game and I have a little problem when doing the GUI.

As you can see here:  the objects from the scene overlap the text from the GUI.

From what I've seen on other topics, it seems that using Camera screen space any object closer than the Plane distance overlaps, but if I decrease the plane distance I can't see the canvas.

I've also tried setting the screen space to overlay, which should fix this, but then the GUI is not shown in the screen.

Anybody knows how to prevent the overlapping or at least what should I do for being able to use screen space overlay? Thanks!

sentences:
Nonsense error in the overlap between 2 warriors and a tower I have a project where 1 warrior is generated every 5 seconds. This warrior as it is generated tries to follow a path that contains 4 target points. Between the target point 1 and the target point 2 there is a tower.

Then the warrior is going to meet the target point 2, but as soon as he hits the tower, he fails to reach the target point 2 and goes to meet it until it is destroyed.

The part of the code circled in pink was to be executed only after the destruction of the tower (when the life of the tower reaches 0), which does not happen, but the worst thing is that when it executes, it does not execute completely, the tower is not destroyed, but the warrior moves toward target point 2.

Result in game:

Look that the impression occurs for the two warriors.

Maybe the message log will help:

I decrease the delay time of the loop to 0.1 and as there is no time for the second warrior to overlap the tower along with the first warrior, everything works correctly.

The problem occurs when more than one warrior reaches the tower simultaneously.

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:
Significant 2D SmallTalk/Squeak Game? Smalltalk/Squeak vs. C# Prompted by this question about becoming a faster programmer, I'm curious to know if anyone has made a significant-sized 2D game in SmallTalk or Squeak.

And if so, how does it compare to C#? I'm using C# with FlatRedBall for my graphics/physics stuff, and I find it pretty easy to make whatever I want to make. Also, how is Squeak/SmallTalk as far as automated testing?

It's not clear from the Squeak site how the games work; are they download-and-play? I prefer in-browser (via a plugin, like Flash/Silverlight).

sentences:
Do I have to compile Unreal 4's source myself in order to make games with it? Now I understand the need for this if people want to make modifications to the engine itself, but if I want to use the engine as is and just program games with it, do I need to do all this?

I figured I needed to build the Engine because a UE4 programming tutorial said "I assume you have already downloaded the engine source from GitHub and compiled it in VS2013", nobody says why, nobody clearly states whether or not this is required to make a game in C++ using Unreal Engine 4.

Can anyone help?

sentences:
Mobu: Motion Files Naming Scheme for Unity When exporting takes as several fbx files in Motionbuilder 2014 with File > Motion File Export..., the files are named like so:

file_Take1.fbx
file_Take2.fbx
file_Take3.fbx

In order for the motion files to be loaded into Unity correctly, I have to rename them to:

file@Take1.fbx
file@Take2.fbx
file@Take3.fbx

Having to replace underscores with '@' is fine for small projects but can become time consuming when working with many takes in large projects.
Is there a way to change the default naming scheme in Motionbuilder, through preferences or python scripting, so that the default underscore is replaced with an '@'?

sentences:
How can I make a character stand on slopes? First of all, note that I want to understand the principle, so I would prefer explanations in plain english (but of course I have nothing against some code to complement these explanations).

I am wondering what is the way to make a character step correctly on a slope, let's start with two screenshots of the game Limbo to show you what I mean :

So, as you can see on these pictures, it looks like the spine of the character is actually perpendicular to the horizon and not to the surface of the ground and this observation leads me to my question:
How can you reproduce such a behavior with Sprite Kit ? Because if I attach a physic body to a node, I have the possibility to let it rotate, so I would get something like this :

If I disable the rotation I would get something more like this :

As you can see these ways to do both present important issues and doesn't looks natural at all. So how should I do to make it look natural ? I thought to create several sprites and several physics bodies and then attaching them all together with joints I don't think that it will look natural because if you look at this :

Although I can physically link these nodes, how will I do to make them look real graphically ? Because in the reality, for example, the thigh and calf are linked by a knee...

Any ideas ?

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:
Path finding: avoid being surrounded by enemies I'm building a bot that plays a simplified version of Pac-Man. The bot does a pretty good job, but sometimes it chooses a path where it ends up surrounded by enemies.

Here is an example:

XXXXXXXXXXXXXXXX         XXXXXXXXXXXXXXXX         Legend:
xxxxO1   E1              xxxxPE1
XXXX XXXXXXXXXXX    ---> XXXX XXXXXXXXXXX         O Objective
E2   P        O2            E2 E3      O2         P Player
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX         E Enemy
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX         X Wall
XXXXXXXXE3XXXXXX         XXXXXXXX XXXXXXX         x Wall

In this situation, my bot is at the point of no return. It will choose to move
to and pick up objective one (O1), as it is the closest objective in sight,
and in theory is still a safe path. However, in doing so, enemies will surround
him and he will die. (Map on the right).

I'm trying to come up with ideas on how to make my bot avoid that path, and go for a safer one. The bot should determine if completing the current path (to O1) is a good idea or not, in advance, and make a decision.

How would I go about this? I'm using a simple A* for path finding over a grid.

sentences:
How are you handling scores that can worsen (e.g. Elo rating) in Game Center? Currently, Game Center leaderboard scores can only change one-way (e.g. increase). This makes it impossible (I think) to deal with Elo ratings and the like. How are you getting around this in your leaderboards?

I have filed a bug report / feature request with Apple already FWIW.

Are you using a third-party leaderboard service? Rolling  your own?

sentences:
pygame double buffering I am trying to use double buffering in pygame. What I'm trying to do is display a red then green screen, and switch from one to the other. Unfortunately, all I have is a black screen. I looked through many sites, but have been unable to find a solution. Any help would be appreciated.

import pygame, sys
from pygame.locals import *

RED = (255, 0, 0)
GREEN = ( 0, 255, 0)
bob = 1

pygame.init()
#DISPLAYSURF = pygame.display.set_mode((500, 400), 0, 32)
DISPLAYSURF = pygame.display.set_mode((1920, 1080), pygame.OPENGL | pygame.DOUBLEBUF | pygame.HWSURFACE | pygame.FULLSCREEN)
glClear(GL_COLOR_BUFFER_BIT)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
running = True
while running:

if bob==1:
    #pygame.draw.rect(DISPLAYSURF, RED, (0, 0, 1920, 1080))
    #pygame.display.flip()
    glBegin(GL_QUADS)
    glColor3f(1.0, 0.0, 0.0)
    glVertex2f(-1.0, 1.0)
    glVertex2f(-1.0, -1.0)
    glVertex2f(1.0, -1.0)
    glVertex2f(1.0, 1.0)
    glEnd()
    pygame.display.flip()
    bob = 0

else:
    #pygame.draw.rect(DISPLAYSURF, GREEN, (0, 0, 1920, 1080))
    #pygame.display.flip()
    glBegin(GL_QUADS)
    glColor3f(0.0, 1.0, 0.0)
    glVertex2f(-1.0, 1.0)
    glVertex2f(-1.0, -1.0)
    glVertex2f(1.0, -1.0)
    glVertex2f(1.0, 1.0)
    glEnd()
    pygame.display.flip()
    bob = 1

for event in pygame.event.get():
    if event.type == pygame.QUIT:
        running = False
    elif event.type == KEYDOWN:
        if event.key == K_ESCAPE:
            running = False

pygame.quit()
sys.exit()

I'm using Python 2.7 and my code need to be os independent.

Thanks for your help.

sentences:
Where can I find pixel-art artist? Possible Duplicate:
  Where can I go to find a game graphic artist?

I'm pretty good programmer, and I want to create new pixel-art-game. I know how to program, visualise and optimize the game. But I can't draw! I think there is a lot of people like me... So.. I'm looking for an artist, who can draw pixel-art sprites.

Where I can find "free" pixel-art artist, who just want to create a game (I think that he should have the similar problem, but instead of looking for artist he looks for programmer).

sentences:
Steering and wall hugging problem What I'm hoping to achieve is that when the player steers into a wall the movement is smoothed out by hugging along the wall, moving only with the velocity parallel to the wall, zeroing out the normal force) rather than bouncing back from the wall using the "generic" avoidance method.

I want this: Not this:

The two images are actual behaviors from my code. One removes the velocity normal to the wall so it glides smoothly hugging the wall. The other steers away from the wall creating the bouncing effect. The latter case actually works quite reliably but I do not like the bouncing behavior.

Here's my design for the for handling this case:

The vertical wall is actually made up of many square tiles
The wall avoidance steering checks one unit ahead to see if it is in contact with a tile
The normal is determined by which edge on the tile I'm closest to
zero out the velocity of the player normal to the wall

However this is not reliable for several reasons:

in the gif above, if the look ahead ends up on the bottom edge of a tile, it gets the wrong normal (goes horizontal instead)
the player can get stuck if it happens to penetrate the wall to much (i.e. stay on track for 1 frame, then next frame gets the wrong/perpendicular normal, then both velocities are canceled out)
player can penetrate the wall quite easily if they pick the right spot (which I don't have an obvious sense why)

I am wondering if anyone has a better suggestion on how to handle this case? The only requirement that I prefer to keep is the tile based wall as I have a map editor that generates the map data. Also if there is a method that can be extended to sloped walls that would be even better!

Thanks!

sentences:
How ID's work in FPS games I am wondering how games generate IDs/GUIDs for their entities (along these lines), and which entities specifically get them. To narrow the scope of the question down, I am just focusing on FPS games such as Halo. This was an earlier question that helps explain how state is synced across clients in an FPS:

The state that is synced when a window is broken in a FPS game

The goal with that question was to learn what kinds of data is sent around to sync clients. The piece that is still missing for me is what entities in the game actually get an ID of some sort (either a GUID, or a scoped ID such as some incremented integer or something).

Some of the game "entities" I am considering are:

Particles of light, individual pixels, physical forces, etc. (the lowest level vectors/points for calculating light or physics stuff).
Topology (mountains, roads, etc.).
Landscape features (grass, bushes, trees, rocks, water, rain drops, etc.).
City features (cars, signs, buildings, windows, shards of glass from a broken window, etc.).
Tools / items (weapons, potions, etc.).
Other players.

It seems that some of these "entities" you can interact with (e.g. destroying a car in GTA, or the other players in the game), some you can to some degree (i.e. bushes might sway when you walk by, but you can't shoot them for example), and some you cannot (like the sun in a skybox).

I am thinking in terms of state syncing, it seems like there must be IDs somewhere in the picture so you can map a game entity from computer A to the same game entity in computer B. Even without syncing, it seems like you might want some sort of IDs on objects to allow for easier handling of events and tracking objects. But at the same time I don't really see "IDs" in simple "game engines" like these JavaScript game engines, so that is why I'm asking the question.

The question is, for large games like Halo, what the entities are that have IDs (or some of the main ones), and if the IDs are GUIDs (or generally what kind of ID they are: incremented integers, random numbers, UUIDs, etc.).

Like I'm wondering, maybe bushes have IDs. Maybe the individual leaves on the bushes have IDs. Maybe every single triangle in the graphics has an ID. That's what I'm wondering. Maybe the shards of glass have IDs because you can pick them up. Maybe only the players have IDs for some reason. Etc.

I am interested because (a) it seems like IDs are necessary in different ways (for state syncing, for tracking player behavior with different entity types to improve the game experience, etc.), and (b) there is a lot of variation in performance when it comes to using IDs. For example, I just tried generating 1 million particles like this and got these results:

crypto.getRandomValues: 5.7 seconds to generate 1 million IDs.
Math.random(): 18ms to generate 1 million IDs.
i++: 5ms to generate 1 million IDs.

In addition, there is the space constraint, so by using i++ you can use fewer bits for the ID until it gets very large, but they don't work as GUIDs so you need to do extra work to create ID "scopes" or things like that. Anyways, I would like to figure out how to deal with IDs in games, and looking to FPS as an example to demonstrate where the IDs might be used. Any help would be appreciated. Thank you.

If it is a complicated topic (I'm not sure), then just knowing roughly an outline of how it is typically done, or even a place to look for more information, would be helpful. Also, just saw how Unity is a good example of a Component/Entity system, so maybe instead of FPS a better example is how generic game engines do it. Either way, whatever helps explain how it works.

sentences:
How can I color in only specific regions of my scene? I am interested in having large portions of my game be grayscale, but I'd like certain parts of the scene to have full color.
Something like this:

Is this something that is possible with shaders or the like within unity? What sort of techniques would I need in order to leech color from most areas like in my screenshot above?

sentences: Optimal way to select a random item from a list based on its chance to appear in Unity I am creating a random object spawning script in Unity with c#, and am wondering what the ideal way to do this task would be. So I have a list of 31 objects or so, of my special class type. Each one has an arbitrary number assigned as it's weight. This number is divided by the sum of all their weights and multiplied by 100 to make their percent chance for appearing. It's at this stage where I'm stumped. How should I go about selecting them with a random number between 0 and 100? My first idea was to give each one a range and if the random number falls within it, I select that one, but that method does not sound like it would be the most elegant and would involve like 31 IF statements. What is the standard way to do this sort of random selection?

sentences:
Obtaining a world point from a screen point with an orthographic projection I assumed this was a straightforward problem but it has been plaguing me for days.

I am creating a 2D game with an orthographic camera.  I am using a 3D camera rather than just hacking it because I want to support rotating, panning, and zooming.  Unfortunately the math overwhelms me when I'm trying to figure out how to determine if a clicked point intersects a bounds (let's say rectangular) in the game.

I was under the impression that I could simply transform the screen point (the clicked point) by the inverse of the camera's View * Projection matrix to obtain the world coordinates of the clicked point.  Unfortunately this is not the case at all; I get some point that seems to be in some completely different coordinate system.

So then as a sanity check I tried taking an arbitrary world point and transforming it by the camera's View*Projection matrices.  Surely this should get me the corresponding screen point, but even that didn't work, and it is quickly shattering any illusion I had that I understood 3D coordinate systems and the math involved.

So, if I could form this into a question: How would I use my camera's state information (view and projection matrices, for instance) to transform a world point to a screen point, and vice versa?  I hope the problem will be simpler since I'm using an orthographic camera and can make several assumptions from that.

I very much appreciate any help.  If it makes a difference, I'm using XNA Game Studio.

sentences: Farseer - Apply Impulse I'm new to Farseer and have a simple question. The demos I went through didn't seem to demonstrate what I want. I would like to apply an impulse (not force) to an object at a specific position on that object. How would I go about doing this in code? (I've created the objects already). I'll be using XNA and SL, but I guess the code for this method would be the same. thanks

sentences:
Repeat or wrap texture (DirectX 9) Sure there's something I'm missing about wrap/repeat textures in D3D 9.  I've tried setting the sampler in the shader, i.e. :

sampler DiffuseSampler =
sampler_state
{
    Texture = <DiffuseMap>;

    MipFilter = NONE;
    MinFilter = POINT;
    MagFilter = POINT;

    AddressU = WRAP;    // Repeat on X
    AddressV = WRAP;    // Repeat on Y.
};

, and I've also tried doing it in code before I render the object:

device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);

I thought there might be something screwy with my texture coordinates too, so I hard coded them to be 0.0, 0.0 on the left and 2.0, 2.0 bottom right.  I expected x 2 repeat but got a similar result to the screenshot, with the texture top left and then what looks like clamp across the rest of the image.

What mistake have I made here? (Note that the screenshot isn't the 0.0, 0.0 -> 2.0, 2.0 experiment I did, it's the general case I get as I'm panning my image around).

sentences:
A* search in hexagonal grid with minimum turn radius I need to run an A* search through a hexagonal grid. However, I have one nasty constraint: my vehicle can only turn so sharp. It has a specified minimum turn radius. I can't quite see how to translate this constraint into something I can use with each cell expansion to determine if a neighbor is viable or not. My grid cells are significantly smaller than the minimum turn radius.

I have an initial angle and location of the vehicle; it seems I need to keep a current angle with each cell. With that in mind, I'm not quite sure when I need to reset reference point. It seems that I cannot do that every cell or I will only go in a straight line.

I can translate that turn radius into a polygon (with several hundred sides) where each side length is the distance between my grid cells. I'm not sure how to use this, though.

sentences:
Multiplayer online game engine/pipeline I am implementing online multiplayer game where client must be written in AS3 (Flash) to embed game into browser and server in C++ (abstract part of which is already written and used with other games).

Networking models may differ from each other, but currently I'm looking toward game's logic run on both client and server parts but they're written on different languages while it's not the main problem.

My previous game (pretty big one - was implemented with efforts of ~5 programmers in 1.5 years) was mainly "written" within electronic tables as structured objects with implemented inheritance: was written standalone tool which generated AS3 and C++ (languages of platforms to which the game was published) using specified electronic tables file (.xls or .ods). That file contained ~50 tables with ~50 rows and ~50 columns each and was mainly written by game designers which do not know any programming languages. But that game was single-player.

Having declared problem with my currently implementing MMO, I'm looking toward some vast pipeline, where will be resolved such problems like:

game objects descriptions (which starships exist within game, how much HP they have, how fast move, what damage deal...)
actions descriptions (what players or NPCs can do: attack each other, collect resources, build structures, move, teleport, cast spells) - actions are transmitted through server between clients
influences (what happens when specified action applied on specified object, e.i "Ship A attacked Ship B: field "HP" of Ship B reduced by amount of field "damage" of Ship A"

Influences can be much more difficult, yes, e.i. "damage is twice it's size when Ship has >=5 allies around him in a 200 units range during night" and so on. If to be able to write such logic within some "design document" it will be easily possible to:

let designers to do their job without programmer's intervention or any bug-prone programming
validate described logic
transfer (transform, convert) to any programming language where it will be executed

Did somebody worked on something like that?
Is there some tools/engines/pipelines which concernes with it?
How to handle all of this problems simultaneously in a best way or do I properly imagine my tasks and problems to myself?

sentences:
How to get asset folder path in android native activity? I am trying to create a small game with android native activity. I wish to load textures using stb image. I don't know how to get the path to assets folder.
Is there any API to get path to apk directory so that I can use that to get textures? Thanks.

sentences:
How to architect collision detection in SFML I have a pretty simple game engine that I'm making for a 2d platformer game. I don't want it to be super advanced, but it does have some basic properties. Most important to this question is a class called Entity. Entities are basically just objects in the game that are drawn to the screen and move around. They all have a square bounding box aroud them. Each different entity inherits from the class Entity (ex. Player and Ground inherit from Entity).

I want a nice, object oriented way to handle collisions between different entities. I'd like to be able to write rules of what happens when two things collide in such a way that I don't have to do a ton of casts or rewrite a lot of code. I was thinking of doing something like

class Entity {
    public:
        void collide(Entity* ent);
}

But I'm not sure how I would go about getting the type of the argument. Any suggestions on what to do?

sentences:
Why specular reflection work only in center of virtual scene? How to calculate this cpecular reflection?

HLSL

void calculateSpecular(
    in float4 Normal,
    in float4 SunLightDir,
    inout float4 Specular
){
        Specular = specularLevel * pow(saturate(dot(reflect(normalize(abs(eyePosition)), Normal), SunLightDir)), specularExponent);
}

/// in pixel shader
float4 Specular = float4(0.f,0.f,0.f,1.f);
calculateSpecular( input.normal, -sunLightDir, Specular );

///sunLightDir it's just camera position + vec3(0,10,0)

/// in vertex shader
output.normal = mul( float4( input.normal, 0.f ) , World );

sentences:
How can I cleanly separate the UI from the game logic in my Cocos2d game? I've been working on a little game for the last few months, trying to approach it as a software engineer and employ best patterns and practices in my coding. I have gotten to the point where I have to distinct elements in my game.

The Game Logic: aka business logic. Its the meat of the game rules. It contains all information about game objects (such as Character, Weapon, and Item class definitions). It contains the game world as far as rules are required; mainly so Characters are aware of the world they are in, and who else is in it. It contains a chunk of logic use to determine how Fighting is resolved between Characters, as we as other game actions requiring rules. It contains my AI implementations. So in reality it's a combination of Class definitions and Service logic.

As it stands, the Game Logic can actually play out a game without any interface. All I need to do is create a World, add some Characters to it, assign some AI's to them, then in a loop tell their AIs to run. The result of each AIs action is reflected in the states of the Characters (eg, if damaged, health is reduced), and a summary of what happened is returned by the execution (which is intended for the UI to make sense of what happened).
The Game UI: which is using Cocos2d-xna for WP7. It contains definitions of all the different animations. It takes in inputs and sends the to the Game Logic, and renders its results.

As it stands, as well as all UI components for a Character (textures, sprites, animations) a UI Character also contains a Begin method which executes a Cocos2d Sequence (ccSequence) to do two things 1) Execute AI and render result for this Character 2) Re-Execute the sequence (essentially its own call back loop for executing actions).

The problem I keep running into is, the more I try to keep these two layers separate, the more they need to come together. E.g., my UI Character which is used to render what the Game Logic character is doing, so it needs a reference to the Character object from Game Logic. When this Character's AI attacks someone in the Game Logic world, the UI needs to know what happened. This works fine for rendering its own Animations based of its results, but to know what to do for other Characters affected by this action is difficult as I dont have reference to them. At the moment I do this by queuing up Pending Animations in the other character's Game Logic Character and render it when that character next executes, but this is anti SoC (Separation of Concerns) as it now contains something specific for the UI to focus on.

I don't want the two projects to merge into one where a Game Logic Character contains all things UI as well, such as animations and actions. Is there a nice clean way that is used for this separation? Ideally something that works nicely with Cocos2d's Action pattern?

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:
Rotate/Translate object in local space I am just trying to create a movementcontroller class for game entities. These class should  transform the entity affected by the mouse and keyboard input. I am able to calculate the changed rotation and the new globalPosition. Then I multiply:

 newGlobalMatrix = changedRotationMatrix * oldGlobalMatrix;
 newGlobalMatrix = MatrixSetPosition(newPosition);

The problem is that the object rotates around the global axis and not around the local axis.

I use XNAMath for the matrix calculation.

sentences:
How can I obtain a HBITMAP or HICON from a Direct2D bitmap? Is there any way to obtain a HBITMAP or HICON from a ID2D1Bitmap * using Direct2D? I am using this function to load the bitmap.

The reason I ask is because I am creating my level editor tool and would like to draw a PNG image on a standard button control.

I know that you can do this using GDI+:

HBITMAP hBitmap;

Gdiplus::Bitmap b(L"a.png");
b.GetHBITMAP(NULL, &hBitmap);

SendMessage(GetDlgItem(hDlg, IDC_BUTTON1), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);

Is there any equivalent, simple solution using Direct2D? If possible, I would like to render multiple PNG files (some with transparency) on a single button.

sentences:
Combination Keypad in Unity Im having a slight problem in getting my Combination keypad to work. Ok so basically I'm using gameObject buttons to use for the numbers 0-9. So each gameObject button has a number link to it. The combination passcode is found by finding items, in which these items have link numbers to them as well, hence item.password. The problem Im having trouble with is for the combination to show if its correct or incorrect and also if you push one of the buttons 5 times it will show incorrect code. Please help if you can Here is the code:

This is where I will have the mouse click on the button to declare a password digit.

public class RayCasting : MonoBehaviour
{
public float pickupDistance;
public List<Item> items;
public List<Keybutton> buttons;

// This is for the KeyPad Buttons Area

    foreach(Keybutton button in buttons)
    {

        if(Input.GetMouseButtonDown(0)) {
            if (button.gameObject.Equals(hit.collider.gameObject))
            {
                hit.transform.renderer.material.color = Color.red;
                    button.ButtonWasClicked(button.currentCombination);
                break;
            }
        }
    }

}

}

This is where the magic works. This is basically the gears of the combination to work. It suppose to get the 5 combination numbers from my Item class password variable and implement them to make the combination. The thing is that Im not sure if that works plus if I hit one gameObject button 5 times it says incorrect passcode.

[System.Serializable]
public class Keybutton
{
public GameObject gameObject;
private int Combination;
public int currentCombination;
private int buttonClickProgress;

public void  ButtonWasClicked (int buttonNmb){
Item item = new Item ();

Combination = item.password;
buttonClickProgress++;
currentCombination = buttonNmb;

if(buttonClickProgress < 5){
    decimal d = (decimal)currentCombination / 10;
}
else{
    if(currentCombination == Combination){
        Debug.Log("Correct Passcode");
        buttonClickProgress = 0;
        currentCombination = 0;
    }
    else{
        Debug.Log("Wrong Passcode, reseting...");
        buttonClickProgress = 0;
        currentCombination = 0;

        gameObject.SetActive(false);
    }
}
}
}

Any ideas? I know its a lot but feel free to ask whatever you need.

sentences:
Java Scrolling 2d Block game - Optimise my code? I have a 2d game where you look down from above and can scroll up, down, left and right using a viewport and a much bigger map.

I have been having trouble drawing a rectangle around the block under the cursor but finally cracked it more through luck than anything else but ended up with this code. Can you help me optimise it and simplify it?

int blockwidth=gridsize-2;

//Draw coloured blocks
for (int x=0;x<sizex;x++){
   int thex=-(int)locationx+(x*gridsize);
        for (int y=0;y<sizey;y++){
        int they=-(int)locationy+(y*gridsize);
        //if (thex>-blockwidth && thex<800){
            g.setColor(new Color( tiles[x][y][1]));
            g.fillRect(thex,they,blockwidth,blockwidth);
        //}
    }
 }

Especially this piece

//Cursor co-ords updated
cursorx=(int)locationx+(int)GameInput.mousex;
cursorx=(int)cursorx/gridsize;
cursorx=-(int)locationx+(cursorx*gridsize);

//Draw on screen cursor
        g.setColor(Color.yellow);
        g.drawRect(cursorx,cursory,blockwidth,blockwidth);

sentences:
How can I teleport seamlessly, without using interpolation? I've been implementing Bukkit plugin for creating toggleable in-game warping areas that will teleport any catched entity to other similar area.

I was going to implement concept of non-Euclidean maze using this plugin, but, unfortunately, I've discovered that doing Entity.teleport() causes client to interpolate movement while teleporting, so player slides towards target like Enderman and receives screen updates, so for a split second all underground stuff is visible.

While for "just teleport me where I want" usage this is just fine, it ruins whole idea of seamless teleporting, as player can clearly see when transfer happened even without need to look at debug screen.

Is there possibility to somehow disable interpolating while teleporting without modifying client, or maybe prevent client from updating screen while it's being teleported?

sentences:
ELO algorithm for handling people who don't play often I'm using the ELO algorithm to rank players in an ongoing pong competition. Most players play every day, but we've got one player who hasn't played in a month. My algorithm currently only tracks scores over the last 30 days, and as a result, this player is rapidly rising through the ranks, despite having never played. He lost a bunch of his first games, but won most of his last few games, which means that his losses are dropping off the charts and his score is going up as a result.

Obviously, my plan to drop off scores after 30 days isn't working. What other methods can I use to penalize players for not playing often?

The only thing I've come up with thus far is to reduce the points based on percentage that is based on the days of inactivity (i.e. if a user hasn't played in a week, his points are only worth 70% of normal, and he would have to play X times to get back up to 100% points).

However, this seems too arbitrary. Does anyone have any better ideas or suggestions for handling inactive players in an otherwise active environment?

Thanks in advance.

sentences:
Android - Canvas.drawBitmap gives an awful performance I am using SurfaceView for my game and I am loading all of the bitmaps that are the right size for the screen (pre-scaled in mipmap folder) into a class when the game starts. And I am drawing the bitmaps to the canvas using the drawBitmap method.
Though all of the bitmaps are compressed in 8 bit PNG format and scaled for the screen size, I am getting an awful FPS rate (around 40 FPS)
Things I have tried:
Made sure drawBitmap is the cause of the issue by recording the performance via performance monitor and examining the results. Basically, that is the only method that is causing an overhead.
Trimmed all of the transparent bits that are on the sides and used the fill canvas method for the background.
Scaled and compressed the bitmaps properly
Made sure nothing above or below the screen gets rendered
So this left me wondering; is a modern phone equipped with who knows how many times more powerful CPU and GPU than the computers in the early 2000s unable to utilize its hardware and thus unable to perform such a simple rendering request that those computers that are 2 decades old managed to do? I know drawBitmap uses CPU but nonetheless...
I am only drawing a bitmap that is 1/3 of the size of the screen and 2-3 small bitmaps on top of it (1/6 of the screen size) seeing as low as 30 FPS in such a simple task after all those optimizations is simply disappointing. Migrating to OpenGL will break so many parts of the code and obviously will be more challenging. And as far as I know, there isn't a library that simplifies drawing bitmaps by handling the OpenGL side and only exposes the canvas-like API.
So is there anything else I can do to increase the performance?

sentences:
Keyboard.GetState() only work first time, and Memory increase (not Disposing) EDIT UPDATE 3
I been searching the web for a solution and found several people struggling with Memoryleak using MonoGame while trying to dispose objects.
It could be the case that MonoGame should be started and then closed as a own process, not from another program which are my case.
When I click on the button, a new thread is created and the MonoGame application is started:

 viThread = new Thread(startDemo);
 viThread.Priority = ThreadPriority.Highest;
 viThread.Start();

 private void startDemo()
 {
        using (Demo d = new Demo())
            d.Run();
 }

The "Demo" is closed by a Game.Exit command and i have also tried with Disposed(true) without any success. Next time I launch the MonoGame is Keyboard.GetsState() always empty and the memory is incresed. I made a loop where I started and closed the application 100times and it are eating my memory. I have seen lots of discussion about SharpDX not working correcly with dispsing resources. So here I am, stuck. Just want to point out that this worked fine for XNA but not now when changed to MonoGame. And again, thanks for all comments I got so far.

I have uploaded a project where you can see the issue by yourself. The second time dosn't the keyboard input work but mouseinput does and the memory is increasing for each time:

Donwload sln project

EDIT UPDATE 4

It is SharpDX which increase the memory, I perform following line before i exit:

SharpDX.Diagnostics.ObjectTracker.ReportActiveObjects().Length

And its increasing all the time. So I guess it isnt released.
Someone know how to do that?

sentences:
C# Monogame Enemy shooting at random intervals I am currently coding a simple Monogame Space Shooter.

I have almost finished my enemy shooting behaviour,
but I spent a long time on fixing it and got to the point
where I wanted somebody to help me out.

Okay so basiclly I have my 9 enemies (instances of Enemy class) in my
Level class, and in level update I do stuff like checking if enemy has been hit by player, if they are Dead so I can remove them from the list etc.

I made a simple Timer class that has only 1 function, uses

var timer += GameTime.ElpasedGameTime.TotalMiliseconds

and simply checks if timer is bigger or equal than function input parameter(or argument?), and func is a bool so it then returns T or F.

Now inside my Enemy.cs claas I have this function:

public bool IsShooting()
        {
            if (enemyTimer.Wait(randomFloat))
            {
                shot = true;
                return true;
            }
            else
            {
                shot = false;
                return false;
            }
        }

enemyTimer = new Timer() & randomFloat = field(variable at the top of the class)
in my Enemy class.

And now last but not least(actually the problem here) is this, so now in my Level class I got this little update function:

public void Update(Weapon weapon)
        {
            if (enemies.Count == 0)
                isFinished = true;

            if(!isFinished)
            {
                for (int i = 0; i < enemies.Count; ++i)
                {
                    if (enemies[i].shot)
                    {
                        seconds = rand.Next(1, 10);
                        randMiliseconds = 1000f * seconds;
                    }

                    enemies[i].randomFloat = randMiliseconds;
                    enemies[i].Update();

                    if (enemies[i].isDead == true) // If enemy is dead, remove it from level
                    {
                        enemies.RemoveAt(i);
                        --i;
                    }

                    foreach (Bullet bullet in weapon.bullets)
                    {
                        if ( !(i < 0) && weapon.ShotEnemy(bullet, enemies[i])) // If not enemies count == 0 and if
                        {                                                      // enemy has been shot decrease its health
                            enemies[i].Health -= weapon.Damage;                          // and set bullet visibility to false;
                            bullet.isVisible = false;
                        }
                    }

                }

            }

        }

This for loop goes through all the enemies, first if block is used for checking that
if the enemy has shot the bullet, then set random value again to something different, if shot has not yet been fired then use the old value and wether it has been changed or not it sets randomFloat field in Enemy class to that value.

Now this is how it works: First all of 9 enemies shoot 1 bullet at the same time (Just about when I open the window, cause I putted randomFloat = 1000f; in my Enemy CTOR), and then randomFloat value is set in Level class to something different, I have message output and FOR EVERY DAMN ENEMY randomFloat is the same.... now that is a problem, I want the rand value to be different for all of them, and it should, right?
Becouse those 9 enemies are all different instances of that class and if in each for(;;) loop cycle in my Level.Update() if it gets positive value that enemies[index] has fired a shot it should change it to some number that is very unlikly to be the same for all 9 enemies (seconds = rand.Next(1,20); randomFloat = 1000 * seconds; ). So basiclly randomFloat get random, but it is the same every time for all enemies, and they all shot and will shot at the same random Time

Expected result: Every enemy shooting at different random time

sentences:
Effecient finding of long-range spotting targets I'm creating a top-down 2d strategy game, with a square grid map.
So far, I've used Bresenham's line drawing algorithm in a circle to determine what's in LOS of each unit, and then targedt one of the targets in the circle.
Now I find that this limits my units to shoot only at targets that they see. I want to extend my targeting algorithm to target any other unit in range of my weapon, even if they're out of sight range of this given unit, if they're "spotted" by another friendly unit. In other words, I want to enable usage of weapons with ranges longer than sight range.
Is there a better way than iterating over all sighted units and computing range and LOSto each of them?

sentences:
How to tap a square and draw "Cross (X)" on tic-tac-toe for iibGdx I am having much difficulty trying to figure out how to draw the cross in the square of where the person just touched.

I have made a class called 'CellPositions', by making 9 invisible squares around my board Texture; Example of CellOne...

public CellOne cellOne;

public CellPositions(Board board) {
    load(board);
}

public void load (Board board) {
    cellOne = new CellOne(board);

}

public class CellOne {
    public Rectangle square = new Rectangle();

    public CellOne (Board board) {

        square.x = board.boardRect.x;
        square.y = (board.boardRect.y + board.boardRect.height) - (board.boardRect.height / 3);
        square.width = board.boardRect.width / 3;
        square.height = board.boardRect.height / 3;
    }
}

I have made a 'Controller' class to handle my input and a 'Renderer' class to handle rendering images to the game.

What I want to do is draw the "Cross" on the square the person touched. For eg. if he/she touches the first square - cellOne - how would i render my "cross" to that specific square.

I've tried making a class called "Cross" and made the x and y coordinates Gdx.input.getX() and Gdx.input.getY(), but the 'cross' was not in the square, but intersecting the lines.

Please help! I am trying to get used to libGdx by making a simple game like tic-tac-toe, but it's really not so simple when trying to draw your cross on a certain square.

Here is my board class for further info

private TextureRegion reg;
public Rectangle boardRect;

public Board () {
    init();
}

private void init () {
    reg = Assets.instance.board.boardRegion;
    boardRect = new Rectangle();
    boardRect.set((Constants.SCREEN_WIDTH / 2) - (340 / 2), 15,
            340, 340);

}

public void render (SpriteBatch batch) {
    batch.draw(reg, boardRect.x, boardRect.y,
            boardRect.width, boardRect.height);
}

I have made my screen width and height be 480x480.

sentences: How can I write a Save/Load system for my game? I'm trying to figure out a way to write a save/load system for my game in C++. As of right now, I'm doing it all using binary flags. Anyone got a clue on how to do it another way? I don't mind using binary, but I want to know my options. I also want something in which it would be easy to check on the status of just one event being complete or incomplete in order to decide certain things (a lot of the items system in this game is dependent on what the player has or has not done throughout the course of the game).

sentences:
How do I change a background in movement in Unity? I'm developing a game and the background is moving and I wanna change to another image without losing the current speed of the movement.
File:
public class BackgroundMovement : MonoBehaviour

Material material;
Vector2 offset;
GameManager gameManager;
UIManager uiManager;
SpawnManager spawnManager;
public float speed = 0.3f;

private void Awake()
{
    material = GetComponent<Renderer>().material;
    gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
    uiManager = GameObject.Find("Canvas").GetComponent<UIManager>();
    spawnManager = GameObject.Find("SpawnManager").GetComponent<SpawnManager>();
}

// Update is called once per frame
void Update()
{
    offset = new Vector2(speed, 0);
    if(gameManager.gameOver == false)
    {
        GameSpeed();
        material.mainTextureOffset += offset * Time.deltaTime;
    }
}

In Unity, I added to the material of the background a shader "unlit/transparent" and added the background in it. The object that this material is in, is a quad.
I tried to change creating a list of background images that I wanted on the game. One of the times I tried, I managed to change the background, but the image didn't move, only the first.
This is the inspector of the background.

sentences:
How to make a custom event system framerate friendly? I have a simple event system:

class GameEvent{
    float executionTime;
    Action action;
}

class EventMgr : MonoBehaviour{

    List<GameEvent> events = new List<GameEvent>();

    void Update(){

        float timeNow = Time.time;

        for(int i=events.Count - 1; i >= 0; i--)
        {
            if(timeNow >= events[i].executionTime)
            {
                exents[i].action();
                events.RemoveAt(i);
            }
        }
    }

    public void ScheduleEvent(float delay, Action action){
        events.Add(new GameEvent(){
            action = action,
            executionTime = Time.time + delay;
        });
    }
}

Then,

I schedule events like this:

eventMgr.ScheduleEvent(0.1f, () => {
    // EVENT A - should be fired first
};

eventMgr.ScheduleEvent(0.15f, () => {
    // EVENT B - should be fired second
};

Everything works fine when I play on 60 FPS. Update() is fired once every ~0.016s. When I play the game on a device with 20-40FPS - things got a little bit tricky. Events seem to run in an incorrect order (Event B fired before event A).

The only possible cause is of course the framerate itself.
If the game runs at 20FPS, Update() would be called less frequently and both of these events would be fired in the same frame - and then, the order of their execution depends on the list itself.

What to do here?
Is there any trick to prevent this, is there any pattern for accurate, ordered event system in games which is FPS friendly?

sentences:
How can I implement "quality levels" for models and textures? I'm preparing to build a 3D game without an engine and am wanting to know how I could implement graphic detail levels for my models.

To do this, are the models made in the highest quality level and then the artists remove polygons and texture detail for each model of a lower quality? Or does it work in some other way?

sentences:
Why doesn't my computer paddle move in my Pong game? I'm making a pong game and I can't figure out why the computerPaddle won't move up or down when it's supposed to to hit the ball automatically!

Please help me.

Here's code:

<html>
<h3>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PONG- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</h3>

<canvas id="gameCanvas" width="800" height="600"></canvas>

<script>
var canvas;
var canvasContext;
var ballX = 50;
var ballY = 50;
var ballSpeedX = 11;
var ballSpeedY = 5;

var playerPaddleY = 240;
var computerPaddleY = 240;
const paddleHeight = 120;
const paddleThickness = 12;

function calculateMousePos(evt) {
    var rect = canvas.getBoundingClientRect();
    var root = document.documentElement;
    var mouseX = evt.clientX - rect.left - root.scrollLeft;
    var mouseY = evt.clientY - rect.top - root.scrollTop;
    return {
        x: mouseX,
        y: mouseY
    };

}

window.onload = function() {

    canvas = document.getElementById('gameCanvas');
    canvasContext = canvas.getContext('2d');

    var framesPerSecond = 30;

    setInterval(function() {
        moveEverything();
        drawEverything();
    }, 1000 / framesPerSecond);

    canvas.addEventListener('mousemove',
        function(evt) {
            var mousePos = calculateMousePos(evt);
            playerPaddleY = mousePos.y - (paddleHeight / 2);
        });

}

function ballReset() {
    ballX = canvas.width / 2;
    ballY = canvas.height / 2;
    ballSpeedX = -ballSpeedX;

}

function computerMovement() {
    if (computerPaddleY < ballY) {
        computerPaddleY += 5;
    } else {
        computerPaddleY -= 5;
    }
}

function moveEverything() {

    ballX += ballSpeedX;
    ballY += ballSpeedY;

    if (ballX > canvas.width) {
        if (ballY > computerPaddleY && ballY < computerPaddleY + paddleHeight) {
            ballSpeedX = -ballSpeedX;
        } else {
            ballReset();
        }
    }

    if (ballX < 0) {
        if (ballY > playerPaddleY && ballY < playerPaddleY + paddleHeight) {
            ballSpeedX = -ballSpeedX;
        } else {
            ballReset();
        }

    }

    if (ballY > canvas.height) {
        ballSpeedY = -ballSpeedY;
    }

    if (ballY < 0) {
        ballSpeedY = -ballSpeedY;
    }

}

function drawEverything() {

    canvasContext.fillStyle = 'black';
    canvasContext.fillRect(0, 0, canvas.width, canvas.height);
    canvasContext.fillStyle = 'white';
    canvasContext.fillRect(2, playerPaddleY, paddleThickness, paddleHeight); //
    player

    canvasContext.fillRect(786, computerPaddleY, paddleThickness, 120);
    //computer player

    canvasContext.beginPath();
    canvasContext.arc(ballX, ballY, 12, 0, Math.PI * 2, true); //ball
    canvasContext.fill();

}

</script>

</html>

sentences: Is Edge by Mobigames 3D or isometric 2D? I'm trying to make a similar to http://www.cultofmac.com/edge-for-iphone-controversy-rumbles-on-game-again-pulled-from-app-store/13115, but I'm not sure if it's real-time 3D or just really good 2D. Any thoughts?

sentences: Resources to learn programming rigid body simulation Where I can start learning about simulating rigid bodys 2d and 3d ?

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: Shed some light on this Nvidia Pascal slide? What are the meanings of all the terms in this slide? Why is the correct operator to roughly compute (guesstimate) the improvement in performance multiplictive and not instead bottle necked by the new weakest link?

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:
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:
Sprite-sheets vs Sprites/MovieClips in Flash We create 3D models in Maya2011 and create PNGs and import the bunch into Adobe Flash CS5 to create a sprite.

I read somewhere that sprite-sheets can save space over making the sprite in Flash. How big of a difference does it make? None of our art team has experience in creating sprite-sheets. Is it worth learning it and adopt that workflow? How difficult is it? How much of a difference in file-size can we achieve?

Keeping size constraints apart, I see a draw back using sprite-sheets: I wont be able to create multiple combinations of loop animations using the same set of images. I can even create multiple sprites within the same SWF with our current workflow.

sentences:
Finding closest object to a location within a specific perpendicular distance to direction vector I have a location and a direction vector indicating facing, I want to find the closest object to that location that is within some tolerance distance (perpendicular distance) to the ray formed by the location and direction vector. Basically I want to get the object that is being aimed at.

I have thought about finding all objects within a box and then finding the closest object to my vector from them results, but I am sure that there is a more efficient way.

The Z axis is optional, the objects are most likely within a few meters of the search vector.

sentences:
Black bar in beetween the image when Background move infinite I'm trying to scroll my background forever and so I'm using the background image twice. When the first one goes off screen, it should relocate to the end of the second one. However, there seems to be a black bar in between the two images and so it seems that the image is not being moved into place quick enough. What would be the algorithm to do such a thing to give the illusion of a continuous background? I've got this at the moment.i use this line of code for moving the background

>  for 1st sprite poistion

    >     sprite->setPosition(Vec2(0,0));
        sprite->setAnchorPoint(Vec2(0,0));

    for 2st sprite poistion

    > sprite2->setPosition(Vec2(sprite->boundingBox().size.width -10, 0));
        sprite2->setAnchorPoint(Vec2(0,0));

    void HelloWorld::sprite_move(){
    > sprite->setPosition( Vec2(sprite->getPosition().x-1, sprite->getPosition().y));
        sprite2->setPosition( Vec2(sprite2->getPosition().x-1, sprite2->getPosition().y));

        if( sprite->getPosition().x <-sprite->boundingBox().size.width){
            sprite->setPosition( Vec2( sprite2->getPosition().x + sprite2->boundingBox().size.width, sprite->getPosition().y));
        }
        if( sprite2->getPosition().x <-sprite2->boundingBox().size.width){
            sprite2->setPosition( Vec2( sprite->getPosition().x + sprite->boundingBox().size.width, sprite2->getPosition().y));
            }
        }

sentences:
Unity - How to Receive "Animator" on AnimationEvent How to receive "Animator" by parameter on an Animation Event parameter?

Its possible?

sentences:
What is the best way to check if a moving 2D object will collide with another immobile one before reaching its destination? Provided that both objects have rectangular hitboxes, x and y positions and height/width, what is the best way to check if a moving 2D object will collide with another immobile one before reaching its destination?
No engine is being used.

sentences:
How to achieve this particular screen filter with GLSL? I know this may be a "short" question, but still here it goes.

I would like to know how to achieve a post rendering effect, that looks like the following image from walking dead series:

I will make the art already fitting the style, but what if I want to make the colors more coherent by adding a color filter such as the one in the picture?

Thanks

sentences:
Using normals in DirectX 10 I've got a working OBJ loader that loads vertices, indices, texture coordinates, and normals. As of right now it doesn't process texture coordinates or normals but it stores them in arrays and creates a valid mesh with the vertices and indices.

Now I am trying to figure out how can I make the shader use the correct normal in the array for the current vertex if I can't setnormals() to my mesh. If I were to just use an index in my array of normals corresponding to the index in the vertices, how would I retrieve the current index the shader is processing? BTW: I am trying to write a blinn-phong shader technique.

Also when I create the input layout and I've added the semantic NORMAL to it, how would I list the multiple semantics in that single parameter? Would I just separate it with a space?

PS: If you need to see any code, just let me know.

sentences:
Get normal dependent on collisions position As I hask ask here I'm working on how my objects can move over the terrain and other objects. My proposal and also an idea in the answers was to calculate the rotation from the object with the normals from other objects around (under and in front) the moving object.

My main problem for that is how I can get the normal from an object at a special position. Let's take the ramp on the road from the old example. It depends from which side my car comes. If it comes from front it can drive along the ramp but if it comes from back it moves against the wall. Of course there are other normals if I come from the other side. All my objects have these variables:

float vertices[];
float normals[];
short drawOrder[];

float[] modelMatrix;
AABBox boundingBox;

So you see I can allways get the vertices, normals and the position. I can also test if the object collides with another object with the bounding box (axis aligned) but I have no idea how I can get the normal where the collision happens but that is the important thing for the rotation of the car. Do you have any ideas or are there usual way how to do this?

sentences: PokeMMO. How they do it? Well PokeMMO is a JAVA game project which basically is the original FireRed title for the GBA made online. They know this type of projects don't last long because of the copyrighted material used, but they somehow made their client extract resources from ROMS. So they don't offer any copyrighted material on their download. I wonder what technique they could be using for this? All I know is that they use LWJGL.

sentences:
Custom Pan/Tilt Input device and Unreal Gaming Engine I have an augmented reality project I'm doing for a museum, using Unreal Engine. I've begun designing the controller (a pan and tilt visor you look through and move around). Originally, I was designing the input device to emulate a standard mouse output, but because it's augmented reality, will need really good absolute positioning. So I'm looking into absolute encoders for output- it needs to work as soon as you power on with no calibration required.

The question is two parts: if I start building my own input device which outputs discrete coordinates, rather than incremental x and y movement (as a traditional mouse controller chip does)
1) Can I get that data into Unreal Engine?
2) Can I control the camera rotation with that data?

The bigger question is- Is there a better way to do this? All I'm looking to do is build an Unreal Scene with a fixed virtual camera that is controlled by an external Pan/Tilt mechanism.

Many thanks for your input. Ha! Get it. Input.

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 do I go about creating the "Watcher" component? Last weekend, I spent several hours writing a basic entity component model, in JavaScript. I was largely referencing the Ash Actionscript game engine. I successfully worked out how the systems, components, nodes, and entities all link up, but one thing that eludes me is how to implement the "watcher" that checks the entities for their components, creates nodes for them, adds those nodes to the various systems automatically, and watches for any changes in the components on an entity. I was a bit confused by the way it works, in Ash, and all of the posts and tutorials on the subject that I have read seem to forgo the details of that part of the implementation.

Right now, I currently have the following:

Entity, which is assigned components.
Engine, which keeps a track of the systems and entities.
Node, which contains references to the components in an entity that we want the system to modify (I am currently creating these, manually, and adding it to the system).
Component, which contains the data to be modified by the system.
System, which operates on the nodes, which in turn change the data in the entity.
I also have various other classes, dedicated to holding lists of the various objects.

How do I go about creating the "Watcher" component?

sentences:
Calculating bullet travel knowing coordinates and radian I have a player sprite that has a x and y coordinate and also a radian. The radian determines which way the sprite faces in a top-down game interface. In this case, the radian points from the player sprite to the mouse cursor, so the player is always facing the mouse.

I'm calculating it like this:

this.radian = Math.atan2(inputs.mousey - this.ypos, inputs.mousex - this.xpos);

Now I want the player to be able to fire bullets. The bullet sprite is 5x5 pixels, and I want it to fire directly away from the player in the players direction (so it's basically firing in the direction of the mouse cursor). The bullets the player fires are held in an array called (conveniently) bullets. It's a 2-dimensional array that looks like this:

var bullets = [
    [xpos, ypos, radian], // first bullet
    [xpos, ypos, radian], // second bullet
    [xpos, ypos, radian]  // third bullet
]

The bullet is to travel 5 pixels on each game tick, in the direction determined by the radian. But I'm having trouble working out the math for this. I already have the bullet being drawn to the canvas, and I can make it move, but have no idea how to make it follow the direction the radian is pointing.

Could anyone lend a hand, perhaps a code sample? Thanks.

sentences:
Is it possible to have a SoA Vertex Buffer in DirectX 11? Hi!

I'm wondering if it is possible to structure a Vertex Buffer in a SoA approach like this

{ x1, x2, x3 . . . xn, y1, y2, y3 . . . yn, z1, z2, z3 . . . zn }

instead of the traditional AoS approach

{ x1, y1, z1, x2, y2, z2, x3, y3, z3 . . . xn, yn, zn }

If that beeing the case.. Is it possible to design the ID3D11InputLayout like this?

D3D11_INPUT_ELEMENT_DESC inputDesc[] = {
            { "POSITION", 0, DXGI_FORMAT_R32_FLOAT, 0, 0,       D3D11_INPUT_PER_VERTEX_DATA, 0 },
            { "POSITION", 1, DXGI_FORMAT_R32_FLOAT, 0, offsetToY, D3D11_INPUT_PER_VERTEX_DATA, 0 },
            { "POSITION", 2, DXGI_FORMAT_R32_FLOAT, 0, offsetToZ, D3D11_INPUT_PER_VERTEX_DATA, 0 }
        };

And how does one call the deviceContext->IASetVertexBuffers correctly with this type of layout?

Any suggestions? Thank you!

sentences: Unity 2.5D Character Movement I'm wondering if anyone can point me in the right direct as to how to take a 2D character/sprite in Unity and have said character turn corners in a 3D style. Solutions or resources welcome.

sentences: Are 2D art assets typically created at their intended in-game display size? I'm wondering if game makers create their sprites smaller than their intended in-game size in order to be more efficient or whether doing that produces unacceptable quality.

sentences:
Data structures for territories in a 2D map I am diving into game development with a 2D game. The game will display a territorial map (borders, capitals, etc.).

What is a common data structure to use for storing and manipulating the data in such a game? I'm considering using a graph (as in Graph Theory, not graphing).

Also, what are common file formats for storing the "polygon data" for each territory? Are there any standard or semi-standard formats?

sentences:
XNA 4.0 Model into parts is there a way to split a .fbx model into parts, and move those parts individualy in XNA 4.0 ?

Thanks

sentences:
How to render a large, seamless platforming world without scene transitions? In the game Limbo for example, the whole 2-3 hours of gameplay takes place in one continuous world. The player navigates from one area to another seamlessly, with no obvious loading or transitions.
It looks like the whole game world (ie. all the ground sprites and every puzzle) is always active on and off camera. Is that feasible?
How can I make a large world like this without overwhelming the player's device with all the content that needs to be loaded?

sentences:
Adding Leniency to Jumping Mechanic I have written some jumping code for my player in a platformer game. At the moment it has some basic logic which says that the player can jump if he is on the ground. The pseudocode looks something like this:

### Input Handling ###
if(jumpButtonPressed){
    if(onGround){
        jump
    }
}

### Player Update Loop ###
onGround = false
movePlayer
resolveCollisions
if(player collided with ground){
      onGround = true
}

This works fine for basic static tile levels, but when the player is standing on a descending platform, or moving down a downward slope for instance, it becomes very difficult to jump. The reason for this (in the case of the descending platform) is that the platform has moved from underneath him in that frame, so for that moment he is not actually colliding with the ground, and therefore the condition to be able to jump is not fulfilled.

Is there a general way to add some leniency into the jump mechanic so that the player can jump even if they are not technically on the ground for that exact frame? This seems like it should be quite a common problem but I cannot seem to find any similar questions on stackexchange or google.

sentences:
Path following with Asteroids-like movement. Time to complete path I'm currently learning about how to do this, but it's best to post the problem beforehand. (posting on Physics and GameDev, as you guys know your math)

It's quite difficult to explain. This specific problem revolves around a problem of creating a guidance system for rocket powered craft.
Think: 'I want the ship from game "Asteroids" to follow a specific path and compute, how much time will the whole trip take beforehand"

A craft has it's own properties like mass, linear and angular acceleration. It is only able to accelerate in its forwards direction. Also, quite a pain in the... it's maximum traverse velocity is limited.

Hopefully the picture clears some things out:

The problem lays in the very first step. The program is initiated while the craft is already moving with random velocity and faces random direction.
In order to move fully toward the target point, first the craft has to turn to face "U" vector. But while doing so, it still moves, so the vector "U" will change.
From the picture you can see that the direction of turn can change, don't worry, it's not a problem.

So, the problem. I tried using only vector math, but with no success as the variable I'm trying to compute relies on equations involving this variable. I'm too dumb to get only the variable I'm interested in on one side of equation.
I think the solution would involve a function of distance from craft to object over time.

[Edit 1]

For your interest. Here is the part where I get stuck.

From the beginning. We have the craft on initial position "A", travelling with velocity "V1" and the target on initial position "B", with velocity "V2" (better include it just in case)

From that we can compute the burn vector "U", that we need to align ourselves to in order to travel towards the target at the speed of "Vmax"

The bigger the angle between craft's heading "Cf" and vector "U", the longer it will take the craft to turn. Which means, the craft will cover more distance while turning (uppermost picture). Which means the angle will change during turning etc. etc.

On second picture, in red box. at the top we compute dot product, at the bottom we multiply magnitudes of vectors. As the Cf vector is of length 1 all the time, we can spare it.

The primary thing I'm looking for is variable "t", currently I'm out of ideas.

sentences:
Is UDP still better than TCP for data-heavy realtime games? I know that UDP is usually recommended for real-time multiplayer games with high data usage.

Most articles are serval years old, and since ~80% of all data transmitted on the internet is TCP, a lot of optimization must have been done for TCP.

This make me wonder: is UDP still superior in terms of speed and latency?  Could recent TCP optimizations have made TCP perform better than UDP?

sentences:
What do you use to support multiplayer turn-based network game for iOS and Android games? If I'm doing a turn-based card game, what kind of technique do you use to support multiplayer gameplay over Internet?

Is it socket? If it's socket, which SDK (CoronaSDK etc.) can provide solid socket library?

Can Unity3D can be used solely to support what I need without using other socket servers like SmartFox or Electro?

sentences: How to Translate and Position at the same time? Hi I'm having problem Translating and Positioning at the same time e.g take example of retro spacecraft shooting games in which your spaceship moved in x-axis automatically and you just needed to control position on y-axis. I'm using transform.Translate(new Vector3(0f,Time.deltaTime * speed,0f),Space.World); to translate and then transform.position = new Vector3(Input.mousePosition.x,0f,0f); to position using mouse but it doesn't seem to work. Help !

sentences:
How to instantiate prefab outside Resources folder? I'm trying to developing a tool to help me "remember" all my prefabs / fbx assets.

My assets are almost in a subFolder (for instnace) "3d models" .

I've developed a routine to get all ".prefab" or ".fbx" files and store it in a List / Array.

Now, in a test scenem, i want to instantiate them (using 2 buttons: previous prefab and next prefab).

Using :

_currentPrefab = Instantiate ( Resources.Load (prefabs [currentPrefabIndex].ToString(), typeof(GameObject)), SpawnGameObject.transform.position, new Quaternion(0,0,0,0)) as GameObject;

Give me an error because (i'm pretty sure) my prefab is outside Resource folder.

So my question is: how can i Instantiate my prefab outside that folder ? Is there a way ?

Thanks

sentences:
Understanding diffuse lighting in The Division Here is a screenshot of the main character walking under a bright lamp:

His hat, that was originaly dark grey, turns completely white. My question is how can such lightsource do this without making everything around it superbright? Cuz that's what my humble attempts resulted in.

I can only think of two options:
 - they either use a standard diffuse formula (it has got to be diffuse light as it does not react to camera movement) and have a lightsource that fades extremely quickly (fastar than the standard quadratic attenuation model.
 - or they use some clever shaders for clothes to make them "catch light" so fast.

Maybe there is an easier solution?

Here are two more shots, the floor is not nearly as bright as the character that goes under the lamp:

UPDATE: I think I got my problem - they have a different attenuation formula. I think if I improve my attenuation I whould be able to achieve similar results.

sentences:
How do I calculate the position of a vehicle moving between tiles, over time? I'm working on a small multiplayer game where players can create cities, and these cities will be placed on what's called the "world map." The world map is basically a giant coordinate plane made up of tiles, and the server will load the "world map" in chunks from the database relative to a player's position on the world map.

Now, I want players to be able to send planes from their city to another spot/tile anywhere on the world map. Say for instance player who owns City 1 at position 10,10, wants to create an oil_well at position 70,30. I want a plane to fly from the departure point to arrival point, and client that loads the chunk will see that plane flying across the map.

How can I make the server calculate where the plane is? I have the following information:

departure_time, origin_x, origin_y, arrival_x, arrival_y, speed. speed is the time in seconds that a plane can cross a tile on the world map.

I also have distance, which is simply calculated as (distance formula):

var distance = Math.sqrt(Math.pow( data.arrival_x - data.origin_x , 2) + Math.pow( data.arrival_y - data.origin_y , 2));

Again, how can I calculate the current position of a moving plane on this world map? Because the plane can fly at many different angles, depending on the angle of departure point → arrival point.

sentences:
How to await player input using Coroutines How can I accept player input using Coroutines, pausing execution of Unity while the player has not yet provided input? It seems like a simple problem, but I can't seem to figure it out. Here is my latest attempt. In this program I want to do some logic and pause in the middle, continuing only when the player has inputted some data. Someone please tell me I'm on the right track :O

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

public class InputTester : MonoBehaviour
{
    int choice = -1; // valid choices for this example are 0 and 1

    void Start()
    {
        StartCoroutine(DoSomeLogic());
    }

    IEnumerator DoSomeLogic()
    {
        print("Starting...");
        print("Awaiting your choice - 0 or 1. :: ");
        // yield return StartCoroutine(WaitForKeyDown(KeyCode.Alpha0) || WaitForKeyDown(KeyCode.Alpha1));
        // how to combine these two into a single method that gives the player a choice?
        print("Continuing...");
        switch (choice)
        {
            // logic based on the choice
        }
    }

    IEnumerator WaitForKeyDown(KeyCode k)
    {
        while (!Input.GetKeyDown(k))
            yield return null;
        SetChoiceTo(k);
    }

    private void SetChoiceTo(KeyCode keyCode)
    {
        switch (keyCode)
        {
            case (KeyCode.Alpha0):
                choice = 0;
                break;
            case (KeyCode.Alpha1):
                choice = 1;
                break;
        }
        //StopAllCoroutines(); // how do I stop all the coroutines that accept player input?
        print(choice);
    }
}

sentences:
Animation inside GUI Good day.
I would like to create a "rich" GUI for my game.

How can i add a 3d model to a GUI Button (with continous rotation ) ?
If I can't add a 3d model to a GUI button, what is the best way to visualize a 3d model rotating ?

Maybe creating a video file or animated gif and adding it to my button ?

Thanks

sentences:
Dynamic 2d terrain loading / stitching in Unity I'm currently working on a top down 2d game (in Unity 2d) where I'd like to build a huge terrain for the player to explore.
My question is - do you have any good practices or ideas on how to chunk the terrain, work on it in Unity (should I work on terrain chunks in different scenes etc.) and finally load it dynamically and efficiently in runtime ?

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:
How to blend multiple normal maps? I want to achieve a distortion effect which distorts the full screen. For that I spawn a couple of images with normal maps. I render their normal map part on some camera facing quads onto a rendertarget which is cleared with the color (127,127,255,255). This color means that there is no distortion whatsoever. Then I want to render some images like this one onto it:
If I draw one somewhere on the screen, then it looks correct because it blends in seamlessly with the background (which is the same color that appears on the edges of this image). If I draw another one on top of it then it will no longer be a seamless transition. For this I created a blendstate in directX 11 that keeps the maximum of two colors, so it is now a seamless transition, but this way, the colors lower than 127 (0.5f normalized) will not contribute. I am not making a simulation and the effect looks quite convincing and nice for a game, but in my spare time I am thinking how I could achieve a nicer or a more correct effect with a blend state, maybe averaging the colors somehow? I I did it with a shader, I would add the colors and then I would normalize them, but I need to combine arbitrary number of images onto a rendertarget.
This is my blend state now which blends them seamlessly but not correctly:
    D3D11_BLEND_DESC bd;
    bd.RenderTarget[0].BlendEnable=true;
    bd.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
    bd.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
    bd.RenderTarget[0].BlendOp = D3D11_BLEND_OP_MAX;
    bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
    bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
    bd.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_MAX;
    bd.RenderTarget[0].RenderTargetWriteMask = 0x0f;

Is there any way of improving upon this?
(PS. I considered rendering each one with a separate shader incementally on top of each other but that would consume a lot of render targets which is unacceptable)

sentences:
Moving a character based on a list of Vector 3's I have a client server scenario. On the server there is an AI character who chooses a random point on the map and pathfinds to it, when at that point it chooses a new point and pathfinds again etc. The path to each point is an array which I send to the client, then a character on the client goes to each point in the array, making it look as though it is in sync with the server's AI character. (I realise with Unet all I really need is a network identity script and  network transform component but this is a means to an end using this method).

So when the server creates the array and sends its own AI character off on the path, this array is sent to the client, the client then puts it into a List. Then using this List the Clients character moves to each node smoothly looking just like the server. My problem is that sometimes it moves and others it sticks and I get an error

  "ArgumentOutOfRangeException: Argument is out of range. Parameter name: index"

My code is as follows:

Script that sends path and receives:

public class AccessingTargetPos : NetworkBehaviour {
public List<Vector3> receivedArrays = new List<Vector3>();

[ClientRpc]
void RpcPosFromServerToGoTo(Vector3 [] path)
{
    UnityEngine.Debug.Log ("Going to ... " + path);
    receivedArrays.AddRange (path);
}

public void PrintPath(Vector3 [] path)
{
    if (isServer)
    {
        UnityEngine.Debug.Log("Send Array ...");
        RpcPosFromServerToGoTo (path);
        UnityEngine.Debug.Log("Sent!!");

    }
}

}

And my code that moves the client character based on the List:

public class ClientAiMoveToPosArray : MonoBehaviour {

AccessingTargetPos accessingTargetPos;
public float speed = 1;
public Vector3 endPoint;
int index = 0;
// Use this for initialization
void Start ()
{
    accessingTargetPos = GameObject.Find ("A*").GetComponent<AccessingTargetPos> ();
}
// Update is called once per frame
void Update ()
{
    transform.position = Vector3.MoveTowards (transform.position, accessingTargetPos.receivedArrays [index], speed * Time.deltaTime);

    if(transform.position == accessingTargetPos.receivedArrays [index])
        {
            index++;
        }
}
}

I don't understand why I am getting this error and why at times my clients character sticks. I assume I am going wrong somewhere in my ClientAiMoveToPosArray script. Am I wrong in there somewhere?

UPDATE

The error occurs for 3 reasons:

At the beginning when the client has no point to move to i.e. I start the server then the array is generated, however the client hasn't connected yet. If the client connects when the AI is moving along a path it has to wait until a new path is generated before moving.
If the AI character on the server gets stuck in an unwalkable area.
If the client is moving exactly like the server AI character. The error is appears here because when the array is generated it has to be sent over to the client, resulting in a slight delay.

sentences:
Follow behavior with randomization factor I'm trying to make enemy follow player as in picture below, the code below is code for following player with steering behavior ( i'm not sure it steering works tho but it does follow player ), how would i code something like in the picture below to make the following more randomized but still going in direction of where player is.

Vector2f velocity,steering,desiredVel;
velocity = new Vector2f(player.getX() - getX(), player.getY() - getY());
velocity.normalise();
velocity.scale( maxVelocity);

// unsure what to do with random numbers yet
Random rand = new Random();
int randy = (rand.nextInt(101) -50);
int randx = (rand.nextInt(101)-50);

desiredVel = new Vector2f(player.getX() - getX() +randx, player.getY() - getY() +randy);
desiredVel.normalise();
desiredVel.scale( maxVelocity);

steering = desiredVel.sub(velocity);

steering = truncate(steering,maxForce);

steering.scale(1 / mass);

velocity = truncate(velocity.add(steering) ,maxSpeed);
this.velocity = velocity;

position.add(velocity);

sentences:
Is it NOT feasible to create a web-based game which provides cash prizes due to bots? Say you want to build an online web-based game of (say) Hangman where the person who continues to win eventually wins a cash prize. The more players that enter the game the more the eventual winner wins.

However, it is clear these days, that any game which has cash prizes will attract the bot-writers. I would assume that even a game like Hangman would be a trivial matter for an experienced bot-writer to create a bot which would provide a significant edge over a human player.

Based on this fact; that any online game could provide a bot-writer with a advantage over human players, my question is: is it possible to create a online game which provides cash prizes which a bot-writer would have no significant advantage over human players? Or is it simply that bots are too powerful and pervasive now in gaming and a real-money-transaction game is not feasible?

sentences:
XNA 3D coordinates seem off I'm going through a book, and the example it gave me seems like is should work, but when I try and implement it, it falls short.

My Camera class takes three vectors in to generate View and Projection matrices.
I'm giving it a position vector of (0,0,5), a target vector of Vector.Zero and a top vector (which way is up) of Vector.Up.

My Three vertices are placed at (0,1,0), (-1,-1,0), (1,-1,0).

It seems like it should work because the vertices are centered around the origin, and thats where I'm telling the camera to look but when I run the game, the only way to get the camera to see the vertices is to set its position to (0,0,-5) and even then the triangle is skewed. Not sure what's wrong here.

Any suggestions would be helpful.

Just to make sure I've given you guys everything (I don't think these are important as the problem seems to be related to the coordinates, not the ability of the game to draw them):
I'm using a VertexBuffer and a BasicEffect.

My render code is as follows:

effect.World = Matrix.Identity;
effect.View = camera.view;
effect.Projection = camera.projection;
effect.VertexColorEnabled = true;

foreach (EffectPass pass in effect.CurrentTechnique.Passes)
                {
    pass.Apply();

    GraphicsDevice.DrawUserPrimitives<VertexPositionColor>
         (PrimitiveType.TriangleStrip, verts, 0, 1);
}

sentences:
How can I ensure the player learns all skills in a single open level? I am making a game that only has a single level. It is a survival game. If there were multiple levels, I can have the player learn new skills gradually. For example, level one requires jumping, level 2 requires climbing, level 3 requires both.

As a single open-world level which is intended to be replayed multiple times, I am having trouble finding any linearity in which I can teach the player how to play the game a little bit at a time. I am tossing them to the wolves.

Is there a common strategy to force the player to learn all the necessary skills to succeed? Currently I have 4 directions which the player can travel from the starting point. Each of which teaches them something. But my fear is that they will learn a single way and then have no reason to learn the other three skills, as each skill is equally beneficial.

How can I force the player to learn all four gameplay skills when only one is required to succeed at the game? Keep in mind, because of mechanics of this particular game and there only being one level, they must have the ability to learn all 4 skills from the beginning.

I hope this is not too foolish of a question, but I am stumped on how to make the players learn all four skills without front loading a tutorial.

Reason for only one level is time and scope. Just can't make more. Gotta get this one right.

sentences:
Center of Mass for Convex shape in 3D For an arbitrary convex shape in 3D, how can I calculate its center-of-gravity?

I have face-normals, and the vertices for each face.

@Ocelot No, it most certainly is not the average of the vertices, as demonstrated in this simple 2D case.

The average of coordinates is in top of shape, whereas the C.o.M. is in the bottom half.

sentences:
World Location issues with camera and particle I have a bit of a strange question, I am adapting the existing code base including the tile engine as per the book: XNA 4.0 Game Development by example by Kurt Jaegers, particularly the aspect that I am working on is the part about the 2D platformer in the last couple of chapters.

I am creating a platformer which has a scrolling screen (similar to an old school screen chase), I originally did not have any problems with this aspect as it is simply a case of updating the camera position on the X axis with game time, however I have since added a particle system to allow the players to fire weapons. This particle shot is updated via the world position, I have translated everything correctly in terms of the world position when the collisions are checked.

The crux of the problem is that the collisions only work once the screen is static, whilst the camera is moving to follow the player, the collisions are offset and are hitting blocks that are no longer there.

My collision for particles is as follows (There are two vertical and horizontal):

    protected override Vector2 horizontalCollisionTest(Vector2 moveAmount)
    {
        if (moveAmount.X == 0)
            return moveAmount;

        Rectangle afterMoveRect = CollisionRectangle;
        afterMoveRect.Offset((int)moveAmount.X, 0);
        Vector2 corner1, corner2;

        // new particle world alignment code.
        afterMoveRect = Camera.ScreenToWorld(afterMoveRect);
        // end.

        if (moveAmount.X < 0)
        {
            corner1 = new Vector2(afterMoveRect.Left,
                                  afterMoveRect.Top + 1);
            corner2 = new Vector2(afterMoveRect.Left,
                                  afterMoveRect.Bottom - 1);
        }
        else
        {
            corner1 = new Vector2(afterMoveRect.Right,
                                  afterMoveRect.Top + 1);
            corner2 = new Vector2(afterMoveRect.Right,
                                  afterMoveRect.Bottom - 1);
        }

        Vector2 mapCell1 = TileMap.GetCellByPixel(corner1);
        Vector2 mapCell2 = TileMap.GetCellByPixel(corner2);

        if (!TileMap.CellIsPassable(mapCell1) ||
            !TileMap.CellIsPassable(mapCell2))
        {
            moveAmount.X = 0;
            velocity.X = 0;
        }

        return moveAmount;
    }

And the camera is pretty much the same as the one in the book... with this added (as an early test).

    public static void Update(GameTime gameTime)
    {
        position.X += 1;
    }

sentences:
List of Lists for sending paths from client to server? I have a client server scenario and I'm looking into distributed AI. I want the server to move x amount of ai characters around a map by pathfinding and then send the x amount of paths to the client which will apply each path to its corresponding AI character. This is for research purposes to see if this approach, by sending the new path of each server AI to the client AI for it to follow, is better than constantly sending a positional update across a network everytime a server gameobject moves slightly. I would like this X amount to range anywhere from 10 to 2000, a big ask i know, but i'll go into what I have atm.

Atm I have this working for 2 AI characters and it can be expanded, but with my existing code it would mean an awful lot of copying and pasting! So on the server when the path is created it is sent to a script which can bundle it into an RPC an send it on its way:

public class GrabbingArrayFromUnitScript : NetworkBehaviour {

public List<Vector3> receivedArrays = new List<Vector3>();
public List<Vector3> receivedArrays1 = new List<Vector3>();

    [ClientRpc]
    void RpcPosFromServerToGoTo(Vector3 [] path, String name)
    {

    if (name == "SeekerPrefab")
    {
        receivedArrays.AddRange (path);
        UnityEngine.Debug.Log ("Received");
    }
    if (name == "SeekerPrefab (1)")
    {
        receivedArrays1.AddRange (path);
        UnityEngine.Debug.Log ("Received 1");
    }

    }

public void PrintPath(Vector3 [] path)
{
    if (isServer)
    {
        UnityEngine.Debug.Log("Send Array ...");
        RpcPosFromServerToGoTo (path, transform.name);
        UnityEngine.Debug.Log("Sent!!");

    }
}

}

So as you can see from the above if I wanted to add more AI characters in I would have to add more if statements to the RPC call, and if I wanted 2000 AI in that would be alot of copying. So what could I do here to reduce this code down? Would I use a list of lists? Any help would be greatly appreciated!

sentences:
Changing handedness coordinate system between unity and opencv For my problem given System A, opencv and unity.
I have the

Inversed extrinsic parameters in the "System A convertion".
Intrinsic parameters (Can form into projectionMatrix) in the "Opencv convention".

My first question is
When I'm doing the projection. Do i need to convert a convention to have the same direction as opencv then I do the projection. Or I can do it directly without any negated axis?. The step you can see below.
===========================================================================

I want to set the camera from System A into the unity. What I did is following the image.

I rearrange the axis from System A to be the same as Unity. (Rotating + Negated the sign)

Once it had the same convention to the unity.I took the rotation matrix and use the scipy.transform.as_euler(R, order='zxy'). Then negated the sign the get the angle for left-handed.

Rotation into Euler angles by using scipy.transfrom.as_euler (order of 'zxy' following unity document). Since the scipy accept the right-handed coordinate system. Then i will got an angle of rotation. Then negated the axis.

Translation : I don't know that this should got negated the direction of an axis

My second question is
I think my procedure is wrong. Since the scipy libs accept the right-handed system. So I don't know that how to find the euler rotation angle from given rotation matrix in the right-handed system and change it into the left-handed system.
Thank you very much,
Regards,
Puntawat Ponglertnapakorn

sentences:
Game physics presentation by Richard Lord, some questions I been implementing (in XNA) the examples in this physics presentation by Richard Lord where he discusses various integration techniques. Bearing in mind that I am a newcomer to game physics (and physics in general) I have some questions.

15 slides in he shows ActionScript code for a gravity example and an animation showing a bouncing ball. The ball bounces higher and higher until it is out of control. I implemented the same in C# XNA but my ball appeared to be bouncing at a constant height. The same applies to the next example where the ball bounces lower and lower.

After some experimentation I found that if I switched to a fixed timestep and then on the first iteration of Update() I set the time variable to be equal to elapsed milliseconds (16.6667) I would see the same behaviour.
Doing this essentially set the framerate, velocity and acceleration to zero for the first update and introduced errors(?) into the algorithm causing the ball's velocity to increase (or decrease) over time. I think!

My question is, does this make the integration method used poor?
Or is it demonstrating that it is poor when used with variable timestep because you can't pass in a valid value for the first lot of calculations? (because you cannot know the framerate in advance).

I will continue my research into physics but can anyone suggest a good method to get my feet wet?
I would like to experiment with variable timestep, acceleration that changes over time and probably friction. Would the Time Corrected Verlet be OK for this?

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:
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:
What organic traffic can I expect from publishing on Google Play, without other marketing? I've just published a new Android game on Google Play. It has been a bit over 48 hours.  It's active in the store, and I can search for it by name to get to it.  However, I've had 0 organic downloads thus far, only a couple from my friends. As far as I know, it has not been shown in the "new games" list yet, and the only store listing views in the stats are the ones from myself and friends.

Is there some time by which I can expect some "organic" exposure, or will I ever?  Is promoting my game by other channels the only option?

I'm not asking for advice on promoting my game. I'm only asking about what organic exposure I can expect on Google Play.

sentences:
Starcraft 2 Editor: I want to make two players share their income I have a scenario where there are 4 teams vs. a raging Zerg horde constantly attacking them. The idea was allow that player 1 & player 2 in the same team share their income, so that one player could focus on getting the income (SCV income as they deliver the goods) and the other defending.

I haven't gotten the trigger right yet. Anyone have some tips for me?

sentences:
zoom to cursor calculation I want to be able to zoom in and out of the map using the scroll wheel. I want to zoom towards the cursor like google maps does but I'm completely lost on how to calculate the movements.

so far, all I have is the resizing but I now need to change the map position.

What I have: map x and y; map width and height; cursor x and y.

Any help would be most welcome.

sentences:
How do I get objects using layer name? I am creating an FPS game in local multiplayer. One player creates the hot-spot game, and the other one connects through WiFi network and plays the game.

I want to find all of the player objects on the network that have a specific layer name, and store them into an array when the player spawns on the network. I've been able to add the object to the array, but I can't find the layer's objects with what I found with Google searches.

LayerMask.NameToLayer("LayerName");

LayerMask.LayerToName(8);

This returns the name of layer and layer index. How can I get the objects using a specific layer name, and also store it in to an array?

sentences:
Which gaming engine can be used for pixel manipulation? Here is the gist of where I am going with this. I work for a printer company and basically all of our input files(or output files for virtual printers) are bitmap files. We currently have a tool built in java over 10 years ago that works, but chokes on our high end 1600x1600 files.

So I was thinking, why not utilize a game engine's built-in ability to utilize the power of a gpu?

I am thinking all I would have to do is create a 1600x1600 plane, feed it the image file and draw the scene. I figure this is the easy part.

However, the hard part is reaching into the image for example and clicking the mouse on a particular pixel. Getting RGB data, converting to CYMK, making changes, converting back into RGB and then redrawing the scene. Not only that but pulling the modified texture out of memory and saving it back into a bitmap.

Is this even possible? I haven't used a game engine since college and that was opengl 2.0.

Just figured this looked like a good place to ask. Thanks.

sentences:
Is it possible to construct a cube with fewer than 24 vertices I have a cube-based world like Minecraft and I'm wondering if there's a way to construct a cube with fewer than 24 vertices so I can reduce memory usage.

It doesn't seem possible to me for 2 reasons: the normals wouldn't come out right and per-face textures wouldn't work.

Is this the case or am I wrong?  Maybe there's some fancy new DX11 tech that can help?

Edit: Just to clarify, I have 2 requirements:  I need surface normals for each cube face in order to do proper lighting and I need a way to address a different index in a texture array for each cube face

sentences:
Bandwidth cost / hour for one MMORPG player I am trying to calculate / guesstimate the costs of running an MMORPG for a client. And now I need a pretty accurate estimate for the monthly bandwidth cost so I can calculate the possible revenue of the investor / client. So what is a pretty reasonable bandwidth cost for each player per hour?
The MMORPG I'm trying to make is a virtual conference with gamification. We can go to booths, see other people, make a transaction in the booths. And we will also have a quest and mini-game system for the gamification.
We will be making it using Unity + Forge. We were thinking of using Photon before, but when I reached out to them, they said I need to subscribe for Photon Industries since it's not a game, per se, which is like 2.5x the cost of PUN.
We will split the server into two: the game server and the REST API server. I'm in charge of the game side of the project so the REST API and backend is not my jurisdiction. I this is the specs of the game that I had in mind:

The event will be held for 10 days, possibly running 24 hours straight.
Max customer that we have anticipated is around 1000-2000 CCU
There will be multiple scenes / rooms that the customer can go to (e.g. Commerce area, Lobby area, Mini-Game area, etc)
The quest system, booth transactions, and other features that doesn't need real time update will be handled by the backend.

So that leaves these data that needed to be synced:
Player:

position : 4 bytes * 3 (X, Y , Z) = 12 bytes
currentScene: 1 byte
avatarModel: 4 bytes (will use bitmasking to handle the current type of clothing and accessories of the player model)
playerAction: 4 bytes (player's enumerated action type)
playerActionTarget: 4 bytes (player's action's target)

Scene:

sceneStatus: 16 bytes (any status of the current scene e.g. the current quest. Still unsure how many bytes I need to sync)

So, this is what I have calculated so far using AWS EC2 (possibly wrong):

sentences:
Unreal engine project not responding to key binding changes I'm getting started with learning Unreal development, and I've created a new project based off the FPS C++ template.

I've changed the key mappings inside the DefaultInput.ini, rebuilt the Visual Studio solution, and rebuilt the project in the Unreal editor, but none of my changes are taking effect.

What step am I missing?

sentences:
NavMesh.SamplePosition() fails after rebaking NavMesh? So today I was refurbishing a scene when this happened. After baking a new Navmesh the SamplePosition() returned only infinity. I tried a lot of things out but eventually went back to an older version of my project. Sooner or later I will have to bake a new Navmesh though, so I'd really like to know what happened there.

Here is the part of the code that appears to cause trouble:

Vector3 randomDirection = Random.insideUnitSphere * roamRadius;
NavMeshHit hit;
NavMesh.SamplePosition(randomDirection, out hit, roamRadius, 1);
direction = hit.position;

And of course this, since it tries  to look into infinity I suppose:

transform.LookAt(transform.position - direction, Vector3.up);

Again, this code works fine. Only after baking a Navmesh this fails horribly.

sentences:
Rope 2D Hinge disconnection I have a game that needs to use a rope-like mechanic should do two things.

Restrict Player's Movement within the length of the rope. In other words, some kind of rubber band that brings the player back to the rope imitating real world.
Rope sections should not go beyond their hinge limits

I'm using the Rigidbody2D.velocity to move the player, the hinges do not stop the player from moving beyond the rope's limits. Thus, causing this visually breaking of the joints.

This is more visible when we flip the player's scale x to -1 since we're moving the player to the left. This also causes the rope segments to spasm or rotate at absurd speeds.

The break force is set to Infinity. I tried looking online for a solution but I'm not entirely sure what joint to use.
These are my hinge settings:

Questions:

How do I fix the rope segments to not have these gaps?
How do I safely flip the player without causing problems in the rope?

sentences:
DirectX11 Equivalent of OpenGL code I am currently porting parts of my engine over to D3D11 from OpenGL and was trying to figure out how I would accomplish the following blending functions in D3D11.

glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glDepthMask(GL_FALSE);
glDepthFunc(GL_EQUAL);

I believe it should be something like this:

D3D11_BLEND_DESC blendDesc;
ZeroMemory(&blendDesc, sizeof(blendDesc));

D3D11_RENDER_TARGET_BLEND_DESC rtbd;
ZeroMemory(&rtbd, sizeof(rtbd));

rtbd.BlendEnable = true;
rtbd.SrcBlend = D3D11_BLEND_ONE;
rtbd.DestBlend = D3D11_BLEND_ONE;

rtbd.BlendOp = D3D11_BLEND_OP_ADD;
rtbd.SrcBlendAlpha = D3D11_BLEND_ONE;
rtbd.DestBlendAlpha = D3D11_BLEND_ONE;
rtbd.BlendOpAlpha = D3D11_BLEND_OP_ADD;
rtbd.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
blendDesc.AlphaToCoverageEnable = true;
blendDesc.RenderTarget[0] = rtbd;

m_D3D->GetDevice()->CreateBlendState(&blendDesc, &m_blendMode);

However this does not work. How can I achieve the same effect as in the first code snippet?

Thanks

sentences:
Constantly Checking Collisions and OnTriggerEnter Ok so i wanted to ask a basic question.
suppose i have an edge collider 2d,

Fact - if i add the OnTriggerEnter() into my code. it will check for trigger enters constantly.

Now,
If the edge collider exists but i don't put OnTriggerEnter(), will the game still check for trigger enter collisions? or will it not check for them?

sentences: Started work on a time based business game- one similar already exists... What should i do? Yeah so like i said, i started to work on a time based game that involves business investments, and as it turns out, there is a game called adventure capitalist that has pretty much the same idea about it. I planned to greenlight my game on steam and i found that adventure capitalist is on steam. Im not sure what i should do. Should i continue but make changes to the game (and if so, what sort of changes) or should i give up and work on something else. I should have mentioned this earlier but in the game, you make investments in the electronic industry, and each type of investment will have a different payout per second and a different base investment price to other types. For example, investing in computers will cost you £500 and have a payout of £5/second but investing in smartphones will cost only £100 and have a payout of £1/second. When you can afford it, you can level up your investment. I havent really added any more to the game than that so any advice would be appreciated, thanks.

sentences:
Top Down bounds of vision Obviously in a first person view point the player sees only what's in front of them (with the exception of radars and rearview mirrors, etc).  My game has a top down perspective, but I still want to limit what the character sees based on their facing.

I've already worked out having objects obstruct vision, but there are two other factors that I worry would be disorienting and want to do right.

I want the player to have reduced peripheral vision and very little view behind them.  The assumption is he can turn his head and so see fairly well out to the sides, but hardly at all behind without turning the whole body.  How do I make it clear you are not seeing behind you?
I want the map to turn so the player is always facing up.  Part of the game is to experience kind of a maze and the player should be able to lose track of North.  How can I turn the map rather than the player avatar without causing confusion?

sentences: In a 2D multiplayer game should I send the position of user to the server all the time? In a 2D game where the user moves with the keyboard arrows, should the user send all the time he moves his position (x, y)?. If the user has some speed, the user would send (x, y) like 50 times pixel by pixel in just a second.

sentences: Where could I look online to learn about being a game designer? I'm interested in being a video game designer but I know next to nothing about how to do what ever it is I will be doing as a game designer. Could you offer any advice of a good online area where I could learn about the basics of game designing and later on the more complicated information.

sentences:
Google's ForPlay library, where does it fall down? ForPlay is lauded as a pretty amazing accomplishment by Google's own. But I'm holding off on making any solid judgements as yet...

I'm wondering if anyone has used this and has found any major flaws? I'd like to know what these are. Considering that the code is written in Java and is compiled for Flash, Android and HTML5 additionally, I'm wondering how it performs on those platforms as compared with games written natively for those platforms -- if anyone has done any comparisons in this regard.

For those who are unaware of what ForPlay (now renamed PlayN) is, see the repository and this video.

sentences:
Fixed timestep, how to determine how far back other clients are simulated I'm working on networking code for a social MMO (very low-intensity compared to an FPS) and have a question about fixed timestep.

This answer does a good job of explaining the forward-dating part of utilizing a fixed timestep, but doesn't seem to have the whole picture.
If the forward-dating was meant to account for the packet getting all the way through the server to the other clients, wouldn't it have to either take into account the latency of the most latent client in order to arrive in time, or deal with it being late? I assume this is where the "simulate other clients as being a few ticks behind" concept comes in.

My question is: how is this back-dating offset calculated? Is it a single number for all other clients, or should it be variable through the server sending each client's latency? What goes into the calculation?

I would assume that the starting point is any delay caused by differences in tick rate between the game tick and networking tick (e.g. game is 60 ticks/s, network is 20 and both are in phase, you need to push clients back at least 2 ticks to let the server's network re-tick.) Is this understanding accurate?

sentences:
Why does XNA create two GraphicsDeviceManager services? While working with XNA today, I looked at the debugger information for Game.Services to retrieve the GraphicsDeviceManager so that a component could utilize it. Instead, I found two different objects:

[IGraphicsDeviceManager, GraphicsDeviceManager] KeyValuePair<Type, object>
[IGraphicsDeviceService, GraphicsDeviceManager] KeyValuePair<Type, object>

Or rather, what I assume to be one instance of an object, but indexed according to two different interfaces. Why?

(For context, I'm trying to understand all the different Graphics/Device classes so I can make a ScreenComponent that moves it cleanly away from the main Game object.)

sentences:
Acceleration based on current speed? The faster an object goes, the slower it will accelerate, going from 0 to 50 takes a lot less time then going from 50 to 100,

How do I calculate that, though?

EDIT: Extra details,

This specific scenario is about a space ship, here is the code I'm using for giving it a constant acceleration, which I'd like to rewrite so that the faster it goes, the slower it accelerates.

EDIT2: Thanks to Sam Hocevar the code I showed was flawed, I've updated the code.

var dx = this.x - this.destination.x,
    dy = this.y - this.destination.y,
    r = Math.atan2(dx, dy) * -1,

this.speed += this.acc;
if(this.speed > this.maxSpeed){ this.speed == this.maxSpeed; }

this.x = Math.sin(r) * this.speed + this.x;
this.y = (Math.cos(r) * this.speed * -1) + this.y;

Old code.

this.sx += (this.destination.x > this.x) ? this.acc : -this.acc;
this.sy += (this.destination.y > this.y) ? this.acc : -this.acc;

if(this.sx > this.maxSpeed){ this.sx = this.maxSpeed; }
if(this.sx < -this.maxSpeed){ this.sx = -this.maxSpeed; }
if(this.sy > this.maxSpeed){ this.sy = this.maxSpeed; }
if(this.sy < -this.maxSpeed){ this.sy = -this.maxSpeed; }

this.x += this.sx;
this.y += this.sy;

sentences:
RPG movement holding down button I've been writing a simple top down mini RPG in python.

My problem is that when I move the player I have to repeatedly tap the arrow key. Each time I tap the key the player moves 5 PX in the direction of the key I press, but if I hold down the key he doesn't keep moving, he just moves the first 5 PX.

My moving code looks like this:

# event loop
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.KEYDOWN:          # check for key presses
            if event.key == pygame.K_LEFT:        # left arrow turns left
                x = x + -x_speed
            elif event.key == pygame.K_RIGHT:     # right arrow turns right
                x = x + x_speed
            elif event.key == pygame.K_UP:        # up arrow goes up
                y = y + -y_speed
            elif event.key == pygame.K_DOWN:     # down arrow goes down
                y = y + y_speed

And farther up I define the x_speed ect.

How do I make it keep moving when I hold down the key?

sentences:
What is a good budget ratio for computation time? What sort of budgets do they put on computation time?

For example, lets say a football game needs to run at 50 frames per second.  That means that each frame can only be 20 milliseconds long.  How is that 20 milliseconds divvied up?  For example, it could be:

Pathfinding - 3ms limit
Ball Physics - 8ms limit
Particle Effects - 2ms limit
Animations - 7ms - limit
Total - 20ms

However, I just made those numbers up without any idea what I was doing.

Is there a rule of thumb or a standard practice used?  I know every game is different depending on art-style, game genre, etc.  I am looking for as generic as an answer that can be had; however, if specifics are needed, then Madden Football 2017 can be used as the example game.

What percentage of milliseconds should be allowed for each aspect of game development?

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:
How does one integrate Game Center leaderboards in Monogame? Do anyone know how to integrate a Game Center leaderboards for an iOS game using MonoGame framework?

I have searched high and low yet I haven't gotten any luck of finding articles or tutorials that talks about the topic of Game Centre leaderboard integration. A direct link to where I can learn how to do the implementation will be very much appreciated. Thank you!

sentences:
Making a camera in a 2D game (glOrtho) I'm trying to make a camera that follows my character and it seems I've managed. However, I don't know how to limit that my camera don't follow me when my character reachs the boundaries of the windows (it's ugly see black spaces beyond my tile map x_x).

So, this is my code:

public class Camera {
    public void update(Vector2f spritePos) {
        Vector2f pos = new Vector2f(spritePos.getX()-368, spritePos.getY()-268);

        if((pos.getX()+368 > 368) && (pos.getY()+268 > 268)) {
                glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            glOrtho(pos.getX(),
                pos.getX() + Display.getDisplayMode().getWidth(),
                pos.getY() + Display.getDisplayMode().getHeight(),
                pos.getY(),
                -1,
                1);
            glMatrixMode(GL_MODELVIEW);
        }
    }
}

I substract 368 to the X position, because I want to place my character at the center of my camera. Same with 268. This is a bad way to archieve this, because my camera "jumps" roughly to the position of my character >.

Thank you very much.

sentences:
What is the correct way to raycast on click? I am using raycast from screen point to detect if the user has clicked/touched on something.

The following fails 1/10 times; at first I thought due to the raycast missing the subject below, but after adding in the drawline i realise that it randomly doesn't even fire:

// layerMask declared with correct layers
void FixedUpdate(){
    if(Input.GetMouseButtonDown(0)){
        Debug.Log("click");
        Ray ray;
        RaycastHit hit;
        if(Physics.Raycast (ray, out hit, Mathf.Infinity, layerMask)){
            Debug.Log("You clicked on " + hit.collider.gameObject.name,hit.collider.gameObject);
        }
}

If I run this in Update() function instead, it will work perfectly - so FixedUpdate() seems to understandably cause the missed clicks... but i'm told I should always run the raycasts in FixedUpdate() for physics optimisation.

Maybe I should split this basic action over 2 functions?

A friend said i need an event handler

sentences:
World coordinates on vertical grid game for different aspect ratios (Unity) new to game development and unity so hopefully someone can help.

I want to make a 2D portrait mobile game that will have a grid of constant size where units can move on in Unity.

This should support different aspect ratios. To do that I was thinking to cut sections at the top and bottom of the screen for smaller aspect ratios.

Additionally, I would like the coordinate system to be natural to the grid, so coordinate (0,0) would be the bottom left tile in the grid, (1,0) would be the tile to the right of that,... To illustrate this concept I drew something quickly:

I tried with a script that resizes the size of the orthographic camera to fit the content horizontally. Problem I had with that is that I couldn't get a good coordinate system on the grid after the camera gets resized depending on the aspect ratio since the number of horizontal world units varies depending on the aspect ratio.

Any thoughts on what would be the best way to do this? Thanks!

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:
Strange effects (inadvertently dividing edges) when doing Maya's extrusion Firstly, I thought this was the best place to post my question, since there isn't a Maya section or a generic 3-D modeling section, as far as I saw.

I am following a tutorial which can be found here https://www.youtube.com/watch?v=fhPWIDX5iQ0

Currently, I am struggling to figure out what setting I messed with to create such weird effects when I am trying to extrude. Apparently it is dividing every edge connected to the four vertices I am trying to extrude in half, then connecting the new vertices together. You can see the vertices I am extruding in yellow.

Any suggestions on what I may have messed up? I am clueless, and probably don't even know what to search for other than "Strange Maya Extrusion" and "Maya Extrusion Dividing Edges", without any luck. So, anyone know why this is happening or how to fix it?

Thanks

sentences:
How to calculate view matrix for OpenGL 3.+ 2D Camera Roll I'm trying to create a camera object for my 2D game engine, but I just can't seem to get the view matrix down right.

Here's the code I'm currently using:

glm::mat4 Camera::GetViewMatrix()
{
    glm::mat4 view;
    glm::vec3 camPos = glm::vec3(this->pos, CAM_Z);
    GLfloat xup, yup;

    xup = sin(this->rot);
    yup = cos(this->rot);
    view = glm::lookAt(camPos, camPos + glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(xup, yup, 0.0f));

    return view;
}

The result I get from this is as follows
Before rotation:

After rotation:

As you can see, the camera is rotating around its top left corner. The top left corner is the origin point (0,0,0) and the camera's position is (0,0). Shouldn't the lookAt function position the camera at (0,0,1) and point it at (0,0,0)? That's not what seems to be happening.

I'm just trying to get the camera to roll about it's set position.
Any help would be greatly appreciated! Thanks in advance!

sentences:
Animations not accepted in animator In the official Unity Animator State Machine tutorial video animation clips are dragged out from the assets folder into the animator and dropped.

I have a 3D model that i bought online to experiment with that comes with animations. I added a custom made animation as well. These all work well in my demo project. But when i add a animator to the assets and try to drag and drop animations onto it it doesnt work. I get a forbidden-sign as a mouse pointer. I try to add animations through the inspector but that does not work either.

The tutorials makes it seem so easy and does not talk anything about what animations can be used. What am i doing wrong?

sentences:
Can I use Havok Physics for free in my game? I found out that Microsoft purchased the Havok physics engine. Where can I get it for Windows Visual Studio 2015 Community?

I tried to look around, but I could not find anything for the latest version. There are no download links at both the official website, nor on the Microsoft site.

What do I need to do to use Havok in my own game?

sentences:
AABB - AABB Collision, which face do I hit? To allow my objects to slide when they collide, I need to :

Know which face of the AABB they collide with.
Calculate the normal to that face.
Return the normal and calculate the impulse that to apply to the player's velocity.

Question

How can I calculate which face of the AABB I collided with, knowing that I have two AABB's colliding? One is the player and the other is a world object.

Here's what that looks like (problem collision circled in white):

Thank you for your help.

sentences:
2d grid vision(eye sensor) for a neural network bot? I have a 2d grid and neural network bots living above it. What is a good way to give them vision of tiles in front of them?

Below I describe my idea that I don't know how to efficiently(or inefficiently) implement.

Bots can see other bots like in this video and it's already slowed my simulation, because I'm not so smart I guess and there is no code from this video available. I mean I've implemented it as good as I could and it doesn't bother itself with tiles, only with other bots. But due to the large amount of tiles to see in front of them and the fact that my bots can travel above them, I've decided to make a separate eye sensor just for tiles(soil, plants). No need to see other bots using this sensor.

My first idea was to get a cone vision, and I can get tiles inside this cone(triangle for simplicity) using triangle rasterization. BUT then I need to put all found tiles into 1D(or 2D doesn't matter) array that will make sense for my bots. And for that it must always be of the same size. And tile that is CCW to vision cone start and CW to another tile must always be between 1D array start and CW tile. And if tile is farther away from another tile inside cone(concentric circles), it must always be further away in 1D array.

But now I think it's too difficult and computationally expensive.

Shape of the vision cone is constant but number of tiles that fit with current rotation can differ. On this picture I check distance to the tile center and that center is inside using brute force approach, but I think during triangle rasterization it will differ as well.

On the picture you can see bot and his vision cone and 1D array I imagined. Null means that on this concentric arc could have been more tiles but in this rotation they are not inside. I don't know how to calculate number of tiles on each level. I think on the first always can fit only 1 tile and it's 0. On the second can be 1 or 2, now it's two(1,2). On third it can be 2(maybe more, I don't know how to calculate) tiles but now it's only one, number 3. etc.

sentences:
Which UVs to use when I have more UVs coordinates than vertices Obj I have a simple sphere exported from 3DS Max in .obj format. I noticed that I have more UVs than vertices. I parsed the file with a simple program I wrote and then I put the various vertices and UVs coordinates and indeces in WebGL buffers. The result is that the texture is mapped to the sphere, but it is highly distorted. I tried using differend UV unwrap methods, but there still is a lot of distortion, all over the model.

So I'm thinking that maybe I'm using the wrong UVs coordinates. Right now I'm really just parsing the coordinates, and then applying them in the order they come. For example, I have 482 vertices and 559 UV coordiantes, so I just match them in the order they come (Vertex 1 gets UV 1, Vertex 2 gets UV 2...) and then the remaining 77 coordinates are unusued (I assume, I just load them in the buffer and let WebGL do its thing really).

So I thought maybe I should use those later coordinates instead of the early ones. Like, if I have a vertex with two or more sets of coordinates, use the last one I find while parsing the file. Or maybe I'm just plain wrong, can you give me some help? Thank you

sentences:
DirectX 11 generate normals for tessellated triangles I've spent a couple days looking for an answer to this - How can I access the newly created triangles of tessellation and generate normals for them? I've followed much of the shader code from the following tutorial:
http://www.richardssoftware.net/2013/09/bump-and-displacement-mapping-with.html

I would like to use these normals so that I can correctly light the new triangles as part of my displacement mapping implementation. Can this be done? My other idea was to use bump mapping as well as displacement mapping in order to get the correct normals and bi/tangents. Would this be overkill? Would it look right?

Any advice would be greatly appreciated.

Thank you

sentences:
Dynamic Terrain Triangulation Is there someone who know/have an algorithm which can perform terrain triangulation like on the example image right under (there is a secondary image as well).

The reason I say "Dynamic" is because I want it to support Dynamic changes to the terrain, like if one was to dig into the ground or into the side of a mountain, then it should be capable of triangulating the new changes without destroying the old terrain which doesn't need changes.

Ignore the things like the trees, etc. This is only about the style of the terrain itself.

Click here for fullscreen picture
Secondary Image

I've tried using the Marching Cubes Algorithm, though it didn't give me that triangle'ish feeling, like in the image(s) above (While ignoring the normal rendering in my example).

Bottom Line

Does anybody know/have an algorithm, or any idea of how to...

Triangulate terrain so it have that style like in the above example image(s).
Support dynamic changes like Marching Cubes does, but with this triangle'ish style.

Note: All the "points" would be in an unsorted list, where the "points" of course is all the vertices, which should be used to generate all the triangles from.

  Disclaimer: I usually answer and sometimes ask question on Stack Overflow, so if anything is wrong with my question here I apologize, though comment and I will fix whatever is wrong.

sentences:
Accept keyboard input when game is not in focus? I want to be able to control the game via keyboard while the game does not have focus... How can I do this in XNA?

EDIT: I bought a tablet. I want to write a separate app to overly the screen with controls that will send keyboard input to the game. Although, it's not sending the input DIRECT to the game, it's using the method discussed in this SO question:

https://stackoverflow.com/questions/6446085/emulate-held-down-key-on-keyboard

To my understanding, my test app is working the way it should be but the game is not responding to this input. I originally thought that Keyboard.GetState() would get the state regardless that the game is not in focus, but that doesn't appear to be the case.

sentences:
Rotating object around circumference of circle I'm trying to get a lens texture to rotate around the circumference of the circle and although I picked the centre of the circle as the rotating point of the lens it doesn't work.

 private float angle;

//Initialize Method
circlePosition.X = vp.X + vp.Width / 2;
circlePosition.Y = vp.Y + vp.Height / 2;

lensPosition.X = circlePosition.X;
lensPosition.Y = circlePosition.Y + 155;

//Load Content Method
circleOrigin.X = Circle.Width / 2;
circleOrigin.Y = Circle.Height / 2;

lensOrigin.X = Lens.Width / 2;
lensOrigin.Y = Lens.Height / 2;

 //Update Method
 angle += 0.005f;

//Draw Method
spriteBatch.Draw(Circle, circlePosition, null, Color.White, 0.0f,
    circleOrigin, 1.0f, SpriteEffects.None, 0f);

spriteBatch.Draw(Lens, lensPosition, null, Color.White, angle,
  circleOrigin, 1.0f, SpriteEffects.None, 0f);

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:
How to detect collision between two directed object? I'm currently writing a game which is like Battle City game. But right now I'm facing a trouble involved to checking collision between two objects. This is the code that I wrote:

//-------------------------------------------------------------------------------------------
//  check collision between a tank and another object
//
bool GameController::checkTankMeetsObject(Tank tank, GameObject ob)
{
    int obX = ob.getCoord().getX();
    int obY = ob.getCoord().getY();

    // calculate area of obstacle: bottom left (X1, Y1), top right (X2, Y2)
    int obX1 = obX - SQUARESIZE / 2;
    int obX2 = obX + SQUARESIZE / 2;
    int obY1 = obY - SQUARESIZE / 2;
    int obY2 = obY + SQUARESIZE / 2;

    int tankX = tank.getCoord().getX();
    int tankY = tank.getCoord().getY();

    switch (tank.getDir())
    {
    case UP:
        if ((tankX < obX2 + SQUARESIZE / 2 && tankX > obX1 - SQUARESIZE / 2) &&
            (tankY + SQUARESIZE / 2 > obY1 && tankY + SQUARESIZE / 2 < obY2))
            return true;
        break;

    case DOWN:
        if ((tankX < obX2 + SQUARESIZE / 2 && tankX > obX1 - SQUARESIZE / 2) &&
            (tankY - SQUARESIZE / 2 > obY1 && tankY - SQUARESIZE / 2 < obY2))
            return true;
        break;

    case LEFT:
        if ((tankX - SQUARESIZE / 2 < obX2 && tankX - SQUARESIZE / 2 > obX1) &&
            (tankY > obY1 - SQUARESIZE / 2 && tankY < obY2 + SQUARESIZE / 2))
            return true;
        break;

    case RIGHT:
        if ((tankX + SQUARESIZE / 2 < obX2 && tankX + SQUARESIZE / 2 > obX1) &&
            (tankY > obY1 - SQUARESIZE / 2 && tankY < obY2 + SQUARESIZE / 2))
            return true;
        break;
    }

    return false;
}

This code does well with normal circumstance, but in special ones like which I describe below, it doesn't work.

The white squares are obstacles and the grey square is the tank. Current direction of the tank is RIGHT. In this situation, I can not move the tank RIGHT or LEFT, only direction I can go is DOWN. Is there any solution to optimize my code?

sentences:
Vertex fog producing black artifacts I am rendering a textured model using the XNA BasicEffect.  When I enable fog, the model outline is still visible as many small black dots when it should be "in the fog".  Why is this happening?

Here is a minimal example showing my problem: (the ship model that this example uses is from the chase camera sample on this site — in case anyone wants to try it out ;))

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    Model model;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);

        // TODO: use this.Content to load your game content here
        model = Content.Load<Model>("ship");
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect be in mesh.Effects)
            {
                be.EnableDefaultLighting();
                be.FogEnabled = true;
                be.FogColor = Color.CornflowerBlue.ToVector3();
                be.FogStart = 10;
                be.FogEnd = 30;
            }
        }
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        // TODO: Add your drawing code here
        model.Draw(Matrix.Identity * Matrix.CreateScale(0.01f) * Matrix.CreateRotationY(3 * MathHelper.PiOver4),
            Matrix.CreateLookAt(new Vector3(0, 0, 30), Vector3.Zero, Vector3.Up),
            Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 16f/9f, 1, 100));

        base.Draw(gameTime);
    }
}

sentences:
Fragment shader operations before vector transformations I feel like I'm misunderstanding how to work with vector/fragment shaders. My vector shader is as follows:

uniform mat4 uVMatrix;    // view (camera transformations)
uniform mat4 uMMatrix;    // model (object transformations)
uniform mat4 uPMatrix;    // projection
attribute vec4 aVertexPosition;     // passed in
attribute vec4 aVertexColor;
varying vec4 vColor;

void main() {
    gl_Position = uPMatrix * uVMatrix * uMMatrix * aVertexPosition;
    vColor = aVertexColor;    // pass the vertex's color to the fragment shader
}

Pretty simple. Right now I just have a simple square that I'm transforming in 3D space and drawing. I want to make a see through circle in the middle of the suqare as follows:

This square has 4 vertices that I transform in the vector shader. Here's my fragment shader:

precision mediump float;    // how precise to be with floats
varying vec4 vColor;        // interpolated from the vertices

void main() {
    gl_FragColor = vColor;
}

Now, I've seen I have access to gl_FragCoord, but that coordinate is after all the vector transformations, right? How can I manipulate the pixels in the square, before all the projection transformations, etc.? I don't think I can do it in the vector shader, as there's only 4 vectors...

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:
How can I spin a child capsule of a cube parent? I have a parent cube and to make it like a surface I had to change the rotation of the cube on the X to 90. and as a child, I added a capsule, and to make the capsule-like standing I had to change the capsule X also to 90. The result is :
The reason I put the capsule child of the cube is that I want the capsule to move with the cube.

The capsule rotation on the X is also 90 :

Then in a script at the top, I added speed and index variables for the rotation :
private int index = 0;
private int rotationIndex = 0;

In the Update :
RotateTo();

And the method : curvedLinePoints is a List
private void RotateTo()
    {
        var distance = Vector3.Distance(capsule.position, curvedLinePoints[rotationIndex].transform.position);
        if(distance < 0.1f)
        {
            rotationIndex++;
        }

        // Determine which direction to rotate towards
        Vector3 targetDirection = curvedLinePoints[rotationIndex].transform.position -capsule.position;

        // The step size is equal to speed times frame time.
        float singleStep = rotationSpeed * Time.deltaTime;

        // Rotate the forward vector towards the target direction by one step
        Vector3 newDirection = Vector3.RotateTowards(capsule.forward, targetDirection, singleStep, 0.0f);

        // Draw a ray pointing at our target in
        Debug.DrawRay(capsule.position, newDirection, Color.red);

        // Calculate a rotation a step closer to the target and applies rotation to this object
        capsule.rotation = Quaternion.LookRotation(newDirection);
    }

The problem is that because the capsule is a child when I rotate the capsule it looks like the capsule changes its shape and not spinning around itself. If I remove ut the capsule from the prefab and will rotate it on its own it will spin fine but when it's a child of the cube the result is :

I tried before running the game to play with the capsule rotation in the editor in the inspector changing the Y and Z values and the result is like in this screenshot. but I want to spin it around itself but because it's a child of the cube it's not spinning but looks like it's changing its shape.
The workaround I found is to create an empty GameObject at 0,0,0 and put both Platform and Capsule as a child of it.
Then I added this part to the script above :
private void LateUpdate()
    {
        capsule.localPosition = transform.localPosition + new Vector3(0, 1.4f, 0);
    }

This way the Capsule is following the Platform. The empty GameObject is just to put them both together.
and for testing I just did in the Update :
capsule.Rotate(0, 10, 0);

and it's working fine. Now I have to figure out how to make this rotation with the code in the RotateTo method.

sentences:
How can a load and play an .x model using vertex animation in XNA? From a game I developed years ago, I still have character models that my former 3D engine designer created and that I'd like to reuse in a Windows Phone project now.

However, the files are in DirectX format (.x) containing keyframe animation only. No bones. No skeleton.

There are a lot of animation keys defined on several frames to animate the characters.

I don't quite understand how that works, to be frankly. However, I did a lot of research regarding a possible way of getting the characters animated via XNA on Windows Phone and all I found are hints that it is generally possible but not supported. Possibly by implementing own Content Importers and Processors.

I didn't find anyone who successfully did something like that yet. How should I go about loading and displaying these models in XNA?

sentences:
Will the inclusion of LGBT characters in my game detract from possible sales? As we all know, the inclusion of LGBT characters has been a mighty controversial topic in recent film and literature (Beauty and the Beast probably being the premier example). Some love it with every fiber of their being, while others absolutely detest the very thought of it. Now, keep in mind that I am not here to start a political firestorm nor am I here to preach my own personal beliefs regarding this, I'm simply asking the question: will the inclusion of LGBT characters decrease potential sales?

In our game, a pseudo-'90s JRPG, one of our main story writers added two consuls (of a civilization with heavy Roman influence, but with different laws), both female, married. Originally hailing from an area in which LGBT relationships are looked down upon, I was quick to note that it may be too much controversy, but it truly depends on where you live—for him it was almost completely normal.

As I see it, we have three choices.

We can keep the characters just as they are.
We can keep the characters, but only imply their relationship.
We can alter the relationship entirely, changing one to a male.

Right now, our main goal is to satisfy the general public while still strongly appealing to those who actually played JRPG's such as Dragon Quest or Final Fantasy back in the day. Which of these three options should we choose to best enhance our sales, or, if it's not up there, what is the wisest way to go about doing this? I am looking for facts and data if possible and/or applicable.

EDIT: Our target audience is Everyone! Like we said, we’re aiming to satisfy the general public while still appealing to those who played JRPG’s back in the ‘90s.

EDIT II: Wow. Every almost answer here contained a wealth of information, and I'd like to formally thank all that contributed. I will be using the information from just about all of these answers, and I'm sure may others facing this issue may as well.

EDIT III: If you have comments that aren’t answers or you’d like to further discuss this, please refer to the official chat room as opposed to commenting. Thanks!

sentences:
Opengl Best VAO model for voxel engine I make a voxel engine on LWJGL 3 (OpenGL binding for JVM).
I store all object data in world class.
World is subdivided into 32*32*32 chunks.
Chunks use octree storage.
The main part of all my rendering is cubes that share one mesh but have different transformation matrices and some other data.
To render those i use one VAO per chunk, it contains only one cube mesh instance and has all cubes data (like transformations) stored in its VBOs.
I construct each chunk VAO once and render it fully in one call - glDrawElementsInstanced.
If i need to change some cube data in a chunk, i will reconstuct VAO from ground up or change individual buffer data. That should be pretty efficient, right ?

But I need some other stuff to be rendered, like complex mesh objects or effects or some debug stuff.

How should I render those objects ?
Should I create a VAO for each mesh and then perform instanced rendering for each object with the same mesh ?
Or should I batch all objects with their meshes into one VAO for each chunk and render it fully ?

I was trying to create a VAO recently, that contained one instance of each mesh and all object data. But i could not render it correctly. Because each time I needed to somehow switch object data VBO while rendering an instanced mesh. It didn't work.

Code for the last VAO: http://pastebin.com/WanNsR5L

sentences:
Can i add friction in air? I have issue regarding speed in air. When i jump and move simultaneously that time speed of player increase.For jump i am using impuls and for movement i am using force.I want to slow speed when player is in air.

Thanks in advance

Following is my update method ih HUDLayer

-(void)update:(ccTime)dt :(b2Body *)ballBody :(CCSprite *)player1 :(b2World *)world
{

    if (moveRight.active==YES)
    {
            ballBody->SetActive(true);
        b2Vec2 locationworld=b2Vec2(maxSpeed,0);
        double mass=ballBody->GetMass();
        ballBody->ApplyForce(mass*locationworld, ballBody->GetWorldCenter());
      //  ballBody->SetLinearDamping(1.2f);
    }
    else if(moveLeft.active==YES)
    {
            ballBody->SetActive(true);
        b2Vec2 locationworld=b2Vec2(-10,0);
        double mass=ballBody->GetMass();
        ballBody->ApplyForce(mass*locationworld, ballBody->GetWorldCenter());
    //    ballBody->SetLinearDamping(1.2f);

    }

}
Following is jump

-(void)jump:(b2Body*)ballBody:(ccTime)dt:(BOOL)touch
{
    if (touch)
    {

        if (jumpSprte.active==YES)
        {
            ballBody->SetActive(true);
            b2Vec2 locationWorld;
        //locationWorld=b2Vec2(0.0f,98.0f);
            locationWorld=b2Vec2(0,32);
//        double mass=ballBody->GetMass();
            ballBody->ApplyLinearImpulse(locationWorld, ballBody->GetWorldCenter());
      //  ballBody->ApplyForce(mass*locationWorld, ballBody->GetWorldCenter());
            ballBody->SetLinearDamping(1.2f);

        }
    }
}

So where i apply logic??

sentences:
Find a path centered on the edge between traversable tiles I'm trying to implement a pathfinding system in a simple tower defense game I'm working on. I've a 15x8 tilemap where each cell is of size 64x64.
image 1

 A is the start point, B is the end point, the green blob is the bad guy, the brown tiles are the route and the green tiles are the "walls".

So basically I want to auto find a grid-based path from point A to point B for the enemy, similar to this:
image 2

Down below are the scripts I've implemented in the game, should be a bit messy...

Main script

func _astar_search(graph, source, target):
    var q = Heap.new()
    var nodes = {}
    nodes[source] = Vertex.new(source, null, 0)
    q.insert(source, 0)

    while not q.empty():
        var current = q.extract_min()

        if current == target:
            break

        for next in graph.neighbors(nodes[current]):
            if nodes.has(next) == false:
                nodes[next] = Vertex.new(next)

            var new_cost = nodes[current].get_cost() + graph.weight(nodes[current], nodes[next])
            if new_cost < nodes[next].get_cost():
                nodes[next].set_cost(new_cost)
                nodes[next].set_parent(current)

                if q.contains(next) == false:
                    q.insert(next, nodes[next].get_cost() * _heuristic(target, next))

    return nodes

func _find_path(nodes, source, target):
    var path = []
    var current = target

    while current != source:
        path.append(nodes[current])
        current = nodes[current].get_parent()

    path.append(nodes[source])
    path.invert()
    #_dir.invert()
    return path

func _heuristic(a, b):
    return abs(a.x - b.x) + abs(a.y - b.y)

Graph class

func neighbors(vertex):
    var cell = vertex.get_cell()
    var result = PoolVector2Array([
        cell + Vector2.UP,
        cell + Vector2.LEFT,
        cell + Vector2.DOWN,
        cell + Vector2.RIGHT,
    ])

    #if fmod(cell.x + cell.y, 2) == 0:
    #   result.invert()

    result = _filter("_in_bounds", result)
    result = _filter("_walkable", result)
    return result

func _in_bounds(cell):
    return cell.x >= 0 and cell.x < size.x and cell.y >= 0 and cell.y < size.y

func _walkable(cell):
    return obstacles.has(cell) == false

It's not working properly. I need the path to be centralized in between the two "roads" just like the image 2, but what I've now is:

image 3

The blue line is the path generated by the algorithm and the red dots are the same path but centered at tile's position

Do you have any suggestions on how could I center the path?

sentences:
How can I store all my level data in a single file instead of spread out over many files? I am currently generating my level data, and saving to disk to ensure that any modifications done to the level are saved.

I am storing "chunks" of 2048x2048 pixels into a file.  Whenever the player moves over a section that doesn't have a file associated with the position, a new file is created.

This works great, and is very fast.  My issue, is that as you are playing the file count gets larger and larger.

I'm wondering what are techniques that can be used to alleviate the file count, without taking a performance hit.  I am interested in how you would store/seek/update this data in a single file instead of multiple files efficiently.

sentences:
alpha test shader 'discard' operation not working - GLES2 I wrote this shader to illustare alpha test action in GLES2 (Galaxy S6).
I think is not working at all cause I don't see any change with or without it.
Is there anything Im missing?
Any syntax error?
I know its better not using if in shader but for now this is the solution I need.

precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;

        //0 - CMPF_ALWAYS_FAIL,
        //1 - CMPF_ALWAYS_PASS,
        //2 - CMPF_LESS,
        //3 - CMPF_LESS_EQUAL,
        //4 - CMPF_EQUAL,
        //5 - CMPF_NOT_EQUAL,
        //6 - CMPF_GREATER_EQUAL,
        //7 - CMPF_GREATER

        bool Is_Alpha_Pass(int func,float alphaRef, float alphaValue)
        {
            bool result = true;
            if (func==0)
            {
                result = false;
                break;
            }

            if (func==1)
            {
                result = true;
                break;
            }
            if (func==2)
            {
                result = alphaValue < alphaRef;
                break;
            }
            if (func==3)
            {
                result = alphaValue <= alphaRef;
                break;
            }
            if (func==4)
            {
                result = alphaValue == alphaRef;
                break;
            }
            if (func==5)
            {
                result = alphaValue != alphaRef;
                break;
            }
            if (func==6)
            {
                result = alphaValue >= alphaRef;
                break;
            }
            if (func==7)
            {
                result = alphaValue > alphaRef;
                break;
            }
            return result;
        }

void FFP_Alpha_Test(in float func, in float alphaRef, in vec4 texel)
{
    if (!Is_Alpha_Pass(int(func), alphaRef, texel.a))
        discard;

}

sentences:
2D UI - Image with 1px border randomly gets different thickness I created a test image that is 60 x 60 px, which has a 1px border.  I then drop that into Unity as a UI sprite image set to the same size, however the 1px border on a few sides can appear to be thicker, and this ruins the look I am going for especially when there are multiple of them.

I've tested in the editor and creating builds (testing resolutions), and the same issue in all cases.

It's easier to explain this with images.

The left screen shot is the actual size of the image in the game view.  The zoomed in image is another case where the borders change thickness, but zoomed in to make it more clearer.

I've tried various settings, always the same issue.

How can I get the image to appear exactly as it should with no changes to the borders?

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:
Help interpreting the physics of a rolling ball I'm using this article for reference. I understand handling the collision aspect, but I can't figure out how to calculate the new velocity once the ball collides with the ramp. Without it the ball just slides down the slope and stops at the bottom, with no horizontal velocity generated from the descent.

The equation mentioned is

tangentialVelocity = velocity – (velocity * normal)normal

Which I've tried as

        ball.velocityX = _magnitude - (_magnitude * _normalX) * _normalX;
        ball.velocityY = _magnitude - (_magnitude * _normalY) * _normalY;

to no avail.

Here is what I've done so far, which finds how far the ball is intersecting in the ramp and moves it outside.

        var _distance:int = FP.distance(circleWorld.x, circleWorld.y, ball.x, ball.y);
        var _penetration:int = _distance + ball.radius - worldRadius;

        if (_penetration > 0)
        {
            var _componentX:int = circleWorld.x - ball.x;
            var _componentY:int = circleWorld.y - ball.y;

            var _normalX:Number = _componentX / _distance;
            var _normalY:Number = _componentY / _distance;

            ball.x += _normalX * _penetration;
            ball.y += _normalY * _penetration;
        }

sentences:
Best practices for implementing collectible virtual item "packs"? I'm in the process of building a game in which virtual items can be obtained either by in-game play (defeating enemies, gaining levels), or by purchasing "packs" via microtransactions.

Looking at an existing example like Duels.com's item packs, it looks like a lot of thought went into their implementation, including:

Setting clear player expectations as to what can be obtained in the pack
Limiting pack supply to increase demand and control inflation

Are there other considerations that should be taken into account?  For example, should the contents of the packs be pre-generated to guarantee the advertised drop rates, or is each drop rate just a random chance, and you could end up with higher or lower supply?

sentences:
How can I make backtracking interesting? When a player navigates a space for the first time, it is very interesting: the content is new, the dangers are unknown, paths need to be found. However, various situations force the player to backtrack, or navigate the same space multiple times. Perhaps the level designers are being economical, or trying to build familiarity with a space. Perhaps the game itself is open-ended, or like a sandbox, where navigating the same spaces is part of the game itself. These can make the same spaces seem tedious and sparse.

Given that backtracking (or navigating the same space multiple times) is unavoidable, what are some effective, economical ways of making it interesting? Please keep in mind:

We are reusing levels deliberately, either for effect or to save on cost. Therefore modifying the levels beyond recognition would be against our intent.
We also cannot modify the gameplay too much; if we were attempting to save cost by reusing levels, incurring more costs by adding gameplay would be counterproductive.

One quick-fix I had in mind was to give the player some sort of powerup or vehicle so that they could backtrack faster. I'm sure there are better methods, and examples of games where they were used.

sentences:
Help understanding Unity Profiler time in ms I'm a little confused about this column shown in the picture above.

When it shows 0.22 does it mean "22 miliseconds" or does it mean a fraction of a milisecond (i.e. in this case, around 1/5 of a milisecond) ?

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: Tilemaps not showing up on Android build I'm having trouble developing a 2d game for Android. I use tilesmaps for the ground and a few other things. On the editor, everything works fine and dandy. But, when I deploy to a phone(Build and Run), the tiles aren't there. It's like they never existed. I go back to the editor and they're there. I play the game directly from the editor and they're there. I even play the game while running unity remote, on the test phone, and the tiles are there. No idea what's going on. This only happens with tilemaps. Everything that isn't a tilemap is visible.  I'm running Unity 2019.3.0f6

sentences:
Making a quad cover the screen I'm trying to make a shader and I need a fullscreen quad to do so.

I have everything set up and working, but when I render the quad it appears as a small square. This would probably be because I'm passing the cameras world, projection and view matrix into the shader and so the quad appears as a normal object. If I remove this it doesn't appear at all.

How do I go from it rendering as a part of the scene which moves with the camera to being something that completely covers the screen?

edit:

Vertices:

new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 0)),
new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 1)),
new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 1))

Indices:

ushort[] indices = { 0, 1, 2, 2, 1, 3 };

Render:

        for (int l = 0; l < loader.GlowShader.CurrentTechnique.Passes.Count; l++)
        {
            //loader.GlowShader.Parameters["World"].SetValue(camera.World);
            //loader.GlowShader.Parameters["View"].SetValue(camera.View);
            //loader.GlowShader.Parameters["Projection"].SetValue(camera.Projection);
            loader.GlowShader.Parameters["glowTexture"].SetValue(renderTargetTexture);

            loader.GlowShader.CurrentTechnique.Passes[l].Apply();
            renderQuad.Render();
        }

sentences:
Game Loop design that is speed hack proof I'm not sure if this is possible, but it's worth a shot asking. How does one design a game loop in such a way that hooking and enabling a speed hack app to the game(dx11) doesn't matter?
I found this in stackoverflow:

I think the reason why i does not work in some applications (mostly games) is because some games link the in game clock to the frames per second. Therefore your game will either tank or crash altogether if you try to speedhack it
ref: https://stackoverflow.com/questions/17512906/how-does-cheatengines-speed-hack-work

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:
Can an application break the graphics card? Quick note: I know this is a game development Q&A site but I guess you guys most of all know and have experience with graphics cards so I address this question to you. If you think this is completely off-topic, please refer me to a proper site/forum. Edit: Actually, it is gamedev-related: if a bad code can result in card overheating or breaking then game developers should be aware of that and make sure their applications don't do that.

This might seem like a weird or stupid question but is it actually possible to write such a graphics rendering application that can break the graphics card (in any way)?

The immediate reason that made me ask this question was (no surprise) my own broken graphics card. After having it repaired the serviceman said that they tested various apps (games) on it and it worked fine. But when I launched my own app (deferred shading demo) it heated it to over 100 degrees Celsius. So my card didn't turn out to be fixed after all but what's important here is that the problem seemed to only occur when running my own app.

I've played various GPU-demanding games on it (like Crysis) and often pushed it to the limit and more (had settings so high that the games ran at 5 FPS), some benchmarks as well... So I've given my card, many times, so much work-load that it couldn't catch up (hence low FPS) but it never reached dangerous temperatures. But my own application managed to achieve that (at least when the v-sync was off). :P Since it was only my own app, I don't think a bad cooling system was the culprit.

So I ask - do you think (or maybe know) whether or not it is possible to break the graphics card (in any way, not just by overheating) by some vicious code?

Update:

Joe Swindell said that overheating may be the problem (well, it definitely can break the card). But shouldn't a proper cooling system prevent that from happening (under any circumstances)?

Boreal pointed out another problem. If I understand correctly, FPS is bound by both CPU and GPU (is that right?). So low FPS might signal either high CPU load or high GPU load. But again - shouldn't a proper cooling system prevent GPU from overheating even if the card is "used at 100% all the time"?

sentences:
What is the point of "delta" in this code? Does it reflect a standard thing in game dev? I know very little about game programming but would like to learn more. I am trying to understand the code for this game. I am trying to understand why the code is passing a "delta" to Shipcontrols.js, which changes the direction of the ship based on user input.

Basically the game calculates "delta" every loop...

Here is an abbreviated version of the stack that uses delta thru one loop...

var delta = now - this.time;
this.time = now;
this.current.render.call(this.current, delta, this.renderer);

Steps into here...

ctx.manager.add("game", scene, camera, function(delta, renderer)
{
if(delta > 25 && this.objects.lowFPS < 1000) this.objects.lowFPS++;
var dt = delta/16.6;
this.objects.components.shipControls.update(dt);

Steps into here...

bkcore.hexgl.ShipControls.prototype.update = function(dt)
{
var pitchAng;
var yaw;
var roll;
if (undefined != hand){

Which does stuff like this...

if(this.key.forward)
    this.speed += this.thrust * dt;
else

and this...

if(this.key.right)
{
    angularAmount -= this.angularSpeed * dt;

What is the point of delta here? Is it just trying to introduce an element of randomness? The code for this game is very good. Why did this guy use delta?

sentences:
Spatial Hashing is set up.. now how should I go about actual collision logic? So I have a spatial hashing system set up and it works. It puts players in buckets based on their x/y/width/height

So I was going to check collisions on each frame when I loop through the entity for updating their physics. But how would I go about duplicate collisions? Say I'm checking for player a, which is in the same bucket as bullet a.. I check if there's a collision and there is, should I do the collision logic right there? Or should I add the collision to a list and iterate through that list at the end of the frame to handle the logic for each collision? This way I can also apply logic to prevent duplicate collisions. Or should I just do all the logic right there and then when the initial collision is made?

sentences:
Spawning prefab when other prefab appears Im trying to make a bottle spawn when it is broken.

This is the code that makes that:

public class romperobjetos : MonoBehaviour {

public GameObject BrokenBottle;
public float breakVelocity = 5f;
public GameObject NoBrokenBottle;
public bool rompible = false;
public Vector3 oldPosition;
public Quaternion oldRotation;
public bool botellarota = false;

public void Start()
{

}

// Use this for initialization
public  void Update()
{
    Debug.Log(NoBrokenBottle.GetComponent<Rigidbody>().velocity.magnitude);
    if (NoBrokenBottle.GetComponent<Rigidbody>().velocity.magnitude > breakVelocity)
    {
        rompible = true;
    }
    else
    {
        rompible = false;
    }

}
public void OnTriggerEnter(Collider other)
{
    if ((other.gameObject.name == "Plane") && (rompible))
    {
        oldPosition = NoBrokenBottle.transform.position;
        oldRotation = NoBrokenBottle.transform.rotation;
        Debug.Log("vamos bien");
        BreakBox();
    }
}
public void BreakBox()
{
    Instantiate(BrokenBottle, oldPosition, oldRotation);
    Debug.Log("se rompe");

        NoBrokenBottle.SetActive(false);
        botellarota = !botellarota;
}

}

The broken bottle prefab has a boolean variable that is true when it appears, but the unbroken bottle doesn't instantiate. This is the script for the spawn:

public class SpawnBotellas : MonoBehaviour {

public Transform[] spawnPoints;
public GameObject[] whatToSpawnPrefab;
public GameObject[] whatToSpawnClone;
public bool botella1rota = false;
// Use this for initialization
void SpawnAlgo()
{
    whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnPoints[0].transform.position, Quaternion.Euler(0, 0, 0));
}
 void Update()
{
    //botella1
    if (GameObject.Find("alidobas blanco roto").GetComponent<alidobasrota>().alidobasblanco)
    {
        Debug.Log("asdkj");
      //  whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnPoints[0].transform.position, Quaternion.Euler(90, 0, 0)) as GameObject;
    }

Sorry for my bad English and thanks.

sentences:
How is constant buffer allocation handled in DX11? I'm starting with DX11 and I'm not sure if I'm doing the things right. I want to have both pixel and vertex shader program in one file. Both use some shared and some different constant buffers. So it looks like this:

Shader.fx

cbuffer ForVS : register(b0)
{
    float4x4 wvp;
};

cbuffer ForVSandPS : register(b1)
{
    float4 stuff;
    float4 stuff2;
};

cbuffer ForVS2 : register(b2)
{
    float4 stuff;
    float4 stuff2;
};

cbuffer ForPS : register(b3)
{
    float4 stuff;
    float4 stuff2;
};

....

And in code I use

mContext->VSSetConstantBuffers( 0, 1, bufferVS);
mContext->VSSetConstantBuffers( 1, 1, bufferVS_PS);
mContext->VSSetConstantBuffers( 2, 1, bufferVS2);

mContext->PSSetConstantBuffers( 1, 1, bufferVS_PS);
mContext->PSSetConstantBuffers( 3, 1, bufferPS);

The numbering of buffers in PS is what bugs me, is it alright to bind random slots to shaders (in this example 1 and 3)? Does that mean it still uses just two buffers or does it initialize 0 and 2 buffer pointers to empty?

Thank you.

sentences:
Invulnerability timer while standing on spikes I want to decrement the player's health every .7 seconds while the warrior is standing on a spike tile. Every frame, the game calculates what kind of tile the player is walking into. I've tried calling a function that uses setTimeout from the spike tile code in the walkingIntoTileType switch statement and I've tried using setInterval directly in the switch statement. My current implementation has this declaration at the top of the warrior class:

this.interval = setInterval(function() {
            //blank
        }, 1000);
clearInterval(this.interval);

I then have this in the warrior movement code, which gets run every frame:

switch( walkIntoTileType ) {
  case TILE_GROUND:
    this.x = nextX;
    this.y = nextY;
    this.onSpikes = false;
    break;
  //other tile type code...
  case TILE_SPIKES:
    this.x = nextX;
    this.y = nextY;
    this.onSpikes = true;
  default:
    // any other tile type number was found... do nothing, for now
    break;
}
if(this.onSpikes){
    if(!this.running){
        this.running = true;
        this.interval = setInterval(function() {
            this.playerHealth--;
        }, 700);
    }
}
else{
    this.running = false;
    clearInterval(this.interval);
}

Despite this, the player's health never gets decremented when on the spikes, and the console returns no errors. I would think the interval is not falling victim to garbage collection since its variable is declared at the top of the class, but obviously I could be wrong.

sentences:
How can I manually advance a timeline in GameMaker? I have a timeline from 0 to 300 frames divided into maybe 20 different steps.

When I certain condition is met, I want to jump to the next step of that timeline. How can I do that?

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:
Using Unity built-in sprites programatically I'm trying to figure out how to use the "Panel" built in resource in a game I'm making. I've been able to figure out some potential solutions, but I can't quite figure out how to put all of the pieces together.

panelImage.sprite = UnityEditor.AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/InputFieldBackground.psd");
panelImage.sprite = Resources.GetBuiltinResource(typeof(Sprite), "Resources/unity_builtin_extra/Background.psd") as Sprite;

The first produces the button sprite, which is almost what I want, but not quite. The second doesn't work at all. I'm missing some small piece of what it takes to make this work, but I can't quite figure it out. How can I use the panel background programmatically?

sentences:
libGDX/HTML5 game sounds doesn't work on iPhone I have a libGDX/HTML5 project that works well on desktop browsers, but on mobile browsers it has problems.

I can have some sounds on Android browsers (not perfect) but on iPhone browsers it doesn't work at all.

I don't know exactly which part of the project to put in here. There is an mp3 file to be played at menu screen, "music.mp3". I use:

import com.badlogic.gdx.audio.Music;
...
public class MyGame extends ApplicationAdapter {
...
private Music music;
...
@Override
    public void create () {
    ...
         music = Gdx.audio.newMusic(Gdx.files.internal("music.mp3"));
         music.setLooping(true);
         music.setVolume(0.1f);
         music.play();
    ...
    }
}

I would appreciate any help.

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:
What is a good balance between client and server actions? I'm working on a voxel-based game right now which will have a lot of events, like clicking a block or object.

Say I want to open an interface when I click a certain block. Should I handle this on the client, or send a packet to the server with the action and it's details such as what the ID of the block is, its position et cetera, and then send a packet back to the client with the action OpenInterface with the interface ID?

sentences:
Cannot convert bitmap to texture I'm doing a little C# / OpenGL project and I can't manage to load textures properly.

So here is my texture class :

public class Texture
{
   public String Filepath;
   private int TextureID;

   public Texture(byte[] Filename)
   {
        Stream s = FileManager.FindTexture(Filename);

        if (s == null) return;

        Bitmap b = new Bitmap(FileManager.FindTexture(Filename));

        b.MakeTransparent(Color.FromArgb(255,0,255));

        //b = BitmapEx.Resize(b, b.Width * 2, b.Height * 2);

        //b.Save(DateTime.Now.ToFileTimeUtc().ToString() + ".png");
        //GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);

        GL.GenTextures(1, out TextureID);
        GL.BindTexture(TextureTarget.Texture2D, TextureID);

        BitmapData data = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

        GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, data.Width, data.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);

        b.UnlockBits(data);

        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);

        if(!GL.IsTexture(TextureID))
        {
            throw new Exception();
        }

    }

    public void Apply()
    {
        if (TextureID != 0)
        {
            GL.BindTexture(TextureTarget.Texture2D, TextureID);
        }
    }
}

As you can see, my bitmap loads well from the stream. I tried to save it after it loaded into a my debug folder and every texture loaded saves. So I'm pretty sure this part is not the problem. But everytime I try to do GL.IsTexture it returns false, I tried to apply my textures either it doesn't work.

I've used a similar method in another project where it was working.

        Bitmap bitmap = new Bitmap("Data/UI/" + File);

        GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);

        GL.GenTextures(1, out Texture);
        GL.BindTexture(TextureTarget.Texture2D, Texture);

        BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height),
            ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

        GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0,
            OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
        bitmap.UnlockBits(data);

        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);

I can't see why it is not working right now.

My textures are loaded way after OpenGL is initialized.

I'm using C# .NET framework 3.5 with OpenTK 1.1 ( Runtime 2.0.5, fresh out of their websites ).

Can someone give me a hint on why it is not working, please ?

Warm regards, Chaussette.

sentences:
Drawing realistic 2d waves with SDL2 and Rust I am making a very simple 2d topdown sailing simulator with Rust and rust-sdl2. I am having a very hard time figuring out how I should implement wave rendering. My current idea is to use a Vec<Spring> and render all of the wave shading on top of these springs. But I have no idea how this rendering should be done. Here is an image which mostly represents the effect I want:

Most questions here are to do with OpenGL which I have no experience with and don't understand at all. Any pseudocode would be particularly helpful!

sentences:
More than 8 lights without deferred shading / lighting I want to know if there is any technique (efficient) to use more than 8 lights in a scene made with OpenGL and GLSL. Without making use of deferred shading / lighting.

I have not implementadon these techniques for their limitations and not being able to use transparency or antialiasing.

If there is a good alternative, describe it with an example.

I use OpenGL 2.0.

Thank you.

sentences:
How should I model exact 90-degree rotations in 3D? I'm familiar with quaternions... have used them in the past to model arbitrary rotations in 3D, as for a plane flying around with full pitch/yaw/roll freedom. Works great.

Now I'm working on a 3D puzzle where the rotation is "quantized": all rotations are whole multiples of 90 degrees. I could use quaternions, but it seems like complexity overkill for this situation. And more importantly, I need to be able to test different orientations according to their quantized values, aligned to the three main axes. Quaternions (usually) use floating point values rather than integers, so if we compose several rotations and then compare the resulting orientation to a known orientation, it may not be straightforward to test whether a certain face is pointing a given direction, due to rounding.

Anyway, there may be an easier way to model this.

The puzzle is like "netwalk", but in 3D. So the requirements are:

Be able to rotate a given piece +/-90 degrees, around a specified axis, updating its orientation state (which is modeled how?)
Be able to query whether a particular piece, in its current orientation, is connected in a particular direction (e.g. has a tube touching the face that is in the positive X direction)
For the latter we probably have an array of booleans that say whether the piece is connected in each direction in its "initial" orientation. But in order to make use of this, we need a way to rotate this initial state to the current orientation.
Oh, we also need to be able to display each piece graphically in its updated orientation. But that could use a separate orientation state if necessary... it's a pretty standard feature of scene graph libraries.

Maybe I just need to implement an integer version of quaternions?

Thanks for any thoughts...

sentences:
How should I separate drawing from system collision? Well, in my game while I'm drawing I have to verify the collision between the views. After a collision, I have to draw some things. But I can't draw them with a batch but with a stage. So I have to begin and end a lot of batches and this makes my game very slow.

Here is the part of code which I talked about:

for(int i=0;i<1000;i++)
    {
        if(i<999)
            list.get(i+1).xTubo = list.get(i).xTubo + list.get(i).distanza;

        for(int j=0;j<=60;j++)
        {
            if( (xPersonaggio==list.get(i).xTubo + j || xPersonaggio==list.get(i).xTubo-j*3)&& yPersonaggio<=list.get(i).altezza-50)
            {
                batch.begin();
                if(ySalto==0)
                    batch.draw((TextureRegion) animation.getKeyFrame(time, true), orthographicCamera.position.x - 300, 60 + ySalto);
                else
                    batch.draw(textureAtlas.createSprite("h"), orthographicCamera.position.x - 300, 60 + ySalto);
                scrittaHaiPerso.draw(batch,"HAI PERSO!",orthographicCamera.position.x-50,500);
                menu.draw(batch,"MENU",orthographicCamera.position.x,300);
                batch.end();
                stage.draw();

                fineGioco=true;
            }
        }
        batch.begin();
        batch.draw(spriteTuboVerde,list.get(i).xTubo,-30,120,list.get(i).altezza);
        batch.end();
        if(xPersonaggio>list.get(i).xTubo+50)
            tubiSaltati++;
    }

In this cycle I draw a lot of views, as you can see at the bottom. At the top I have my very rudimental collision system. When a collision happens, an imagebutton appears on the screen and I have to draw it with a stage. So I have to begin and ends a lot of times the batch and this doesn't go well at all. How can I write less batches?

NOTE: The order of drawing has to be this

sentences:
How do I create a Button when I click another Button? I need help. When I click a Button, I want to create a new Button. My code, however, creates four Buttons. What should I do?

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

public class AddButton : MonoBehaviour
{
    public GameObject prefabButton;
    public RectTransform ParentPanel;
    public Button saveButton;

    void Update()
    {
        if (Input.GetMouseButton(0))
        {
           // for (int i = 0; i < 2; i++)
            {
                GameObject button = (GameObject)Instantiate(prefabButton) as GameObject;
                button.transform.SetParent(ParentPanel, false);
                button.transform.localScale = new Vector3(1, 1, 1);
             }
        }
    }
}

sentences:
Host Migration (P2P) with RTMFP and AS3 I was wondering if this is a possibility with RTMFP since it acts like UDP/P2P..

Host Migration

Player A starts and host a game..
Player B and C connects..
Player A quits..
Player B is now assigned as new host/server
Game not interrupted or disconnected.

Maybe some basic example on how this is done with RTMFP/AS3?

sentences:
how taxes work on steam? I have been developing a game for some time thinking of distributing it on steam.

I had a question about taxes. And is that since I am not a resident of the United States, I made my tax questionnaire and I have a 10% rate for the sale of video games due to the treaty with my country.

And was I reading that every country has a tax? special? (VAT) or something like that, for example United Kingdom 20%

Which means that if I sell a game of 10 (€) I think this should happen

Scenario 1:

1 Unit Sale  ---  10.00 €
- (VAT)            1.66 €
-------------------------
Sale w/o VAT       8.33 €
- Steam 30%        2.50 €
-------------------------
S w/o Steam cut    5.83 €
- ISR USA (10%)    0.58 €
-------------------------
Sale revenue       5.25 €  (Less taxes from my country later calculated, this amount is the one deposited by steam)

Scenario 1 considers that each subtraction is made on a non-total balance

Or

Scenario 2:

The percentage is fixed on the total sale

1 Unit Sale  ---  10.00 €
- (VAT)            1.66 €
- Steam 30%        3.00 €
- ISR USA (10%)    1.00 €
-------------------------
Sale revenue       4.33 € (Less taxes from my country later calculated, this amount is the one deposited by steam)

Does anyone know how this situation is handled ?, or where could I get more information?

sentences:
Best aproach to Ground level detection for spells/skills I'm making a 3d Hero Defense/Tower defense kind of game with unity3d. A made a skill system with scriptable objects that lets the Defender use skills on the terrain doing damage to enemies that can be damaged. Because of the complexity of the terrain in some parts (slopes going up or down) i made a function to detect ground level like this:

protected float GetGroundPosition(Vector3 position)
{
    LayerMask GroundLayer = 1 << GROUND_LAYER;
    RaycastHit hitInfo;
    Physics.Raycast(position, -transform.up, out hitInfo, GROUND_DETECT_DISTANCE, GroundLayer);
    if (hitInfo.collider != null)
    {
        return hitInfo.point.y;
    }
    else
    {
        Physics.Raycast(position, transform.up, out hitInfo, GROUND_DETECT_DISTANCE, GroundLayer);
        return hitInfo.point.y;
    }
}

Then i subdivided my raycast in several small ones like this:

protected void DealBaseDamageInALine(Vector3 cursorPosition, float slashSize)
{
    List<GameObject> alreadyHit = new List<GameObject>();
    Vector3 startRaycast = new Vector3(transform.localPosition.x, GetGroundPosition(transform.position), transform.localPosition.z);
    for (int i = 1; i <= GROUND_COLLISION_RAYCAST_NUMBER; i++)
    {
        Vector3 endRaycast = startRaycast + transform.forward * (config.GetAoe() / (i * 2));
        endRaycast = new Vector3(endRaycast.x, GetGroundPosition(endRaycast), endRaycast.z);
        Debug.DrawLine(startRaycast, endRaycast, Color.blue, .5f);
        RaycastHit[] hits = Physics.CapsuleCastAll(startRaycast, endRaycast, slashSize, Vector3.up);
        foreach (RaycastHit hit in hits)
        {
            var hitObject = hit.collider.gameObject;
            var damageable = hitObject.GetComponent<HealthSystem>();
            if (damageable != null && !alreadyHit.Contains(hitObject))
            {
                float damageToDeal = config.GetDamage();
                damageable.Damage(damageToDeal, config.GetElementalType());
                alreadyHit.Add(hitObject);
            }
        }
        startRaycast = endRaycast;
    }
}

I made a graph to better conceptualize what i made:

I use around 64 segments and a 50f raycast depth for the ground detection and it works/performs quite well (i noticed a 3-4ms increase in my older PC though).

But my question is: are there better approches to this? maybe i overdid something that could be done more easily.

sentences: Why calculate A* Pathfinding F Cost? I just made an A* Pathfinding system in unity that doesn't calculate the f cost (g cost + h cost) and I wondering why do u actually have to calculate the f cost? I mean my pathfinding system that works perfectly fine. Any ideas?

sentences: SVD vs Normal decomposition for BRDF compression In the slides over here by NVidia, they describe methods for BRDF compression. They first create a BRDF matrix where each column(or row) corresponds to a single light direction (or outgoing view direction). This matrix is then compressed by decomposing it either by using SVD or Normalized decomposition. My question is that they claim SVD gives better results than Normalized decomposition for similar compression sizes. Does anyone know what could be the possible reason for this?

sentences:
Copying section of map array I'm experimenting a bit with pathfinding. I'm using Javascript.

I have a map array as follows:

mapArray = [
             [0, 0, 0, 1, 1, 0],
             [1, 0, 0, 1, 0, 0],
             [0, 1, 0, 1, 1, 0],
           ];

The map is fairly excessive in size and I would like to take out a portion of it to pass to the pathfinding algo. How could I go about doing this? From the above, I could take out a section to leave this for instance:

mapArray = [
             [0, 1, 1],
             [0, 1, 0],
             [0, 1, 1],
           ];

Which would be copying from 0,2 through to 1,4 (xy).

My first thought was a for loop but it is failing for a reason I don't fully understand. Probably a misunderstanding of inserting into arrays?

var pathfindingMapArray = [];

for ( y = startRow; y < endRow; y++ ) {
    for ( x = startColumn; x < endColumn; x++ ) {

        pathfindingMapArray[y][x] = mapArray[y][x];
    }
}

The above fails as a TypeError.

sentences:
How do I write a "Connect Four" AI? I've made a Connect Four game. The first move is made by the player and the second by the computer. Currently, the computer moves randomly; its moves are generated by C++'s random number generator rand(). I'd like to build a basic AI that tries to win or prevent the player from winning.

How can I go about doing this?

sentences:
What data to exchange in multiplayer real time games? I am a hobbyist programmer and right now I am curious about what data is exchanged in a multiplayer session in real time games like starcraft 2. I did a bunch of searches. I found gafferongames.com offering a very good overview of the issues to consider.

Glenn in his article and comments gives a very strong case for using UDP over TCP, but SC2 obviously uses TCP. To qoute Gleen,

  The problem with using TCP for games is that unlike web browsers, or
  email or most other applications, multiplayer games have a real time
  requirement on packet delivery. For many parts of your game, for
  example player input and character positions, it really doesn’t matter
  what happened a second ago, you only care about the most recent data.

So from his statement, I am guessing that his approach is to send the the full game state of every unit on each frame. If the server does not receive a player input on the current frame, then it's just back luck on that player. For God of War: Acension, in which he is lead network dev, this should work quite well I guess.

For SC2, due to it's replay capability, my gut feeling tells me that the underlying engine is a deterministic fixed timestep "user input playback machine", where the only data exchanged is player inputs. Hence Glenn's statement mybe completely irrelevant for SC2. Player input is important, and input sequence is even more important. I don't think it's feasible for SC2 sending game state of 200 units and more at 30 - 60 FPS.

Question: I could be wrong, but I have attempted to identify 2 possible types of data. What are other techniques? Will be good to qoute the game if you will.

EDIT: found this link about starcraft networking model

sentences:
Start iTween MoveTo from a specific node? (Unity) I just started using iTween as part of my day/night cycle. I'm trying to move the sun and moon along a curve, but I want have the sun/moon start at a specific location depending on the time of day. That would mean beginning the MoveTo() function from, say, the 3rd node instead of the 1st node, but I can't figure out how to access specific nodes.

If that's not possible, is there some other workaround? I thought of making several paths of two nodes each and calling the next path once the first one finishes, but then the object has to move in a series of straight lines.

sentences:
How to implement Fog Of War with an shader? Okay, I'm creating a RTS game and want to implement an AgeOfEmpires-like Fog Of War(FOW).
That means a tile(or pixel) can be:

0% transparent (unexplored)
50% transparent black (explored but not in viewrange)
100% transparent(explored and in viewrange)

RTS means I'll have many explorers (NPCs, buildings, ...). Okay, so I have an 2d array of bytes byte[,] explored. The byte value correlates the transparency.

The question is, how do I pass this array to my shader? Well I think it is not possible to pass an entire array. So: what technique shall I use to let my shader know if a pixel/tile is visible or not?

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:
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:
My polygons only register a collision if they are the same shape and directly over top of each other I'm trying to learn about 2d polygon collision detection/handling and have ran into a snag.

After running through lots of tutorials and sample code I've attempted to implement my own polygon class and separating axis functionality.

I have two polygons of the exact same shape and size that I can move around the screen, but they only register a collision if they are directly (to the pixel) over top of each other.

I suspect the problem to be in my isSeparatingAxis() or flattenPoints() function, as I'm struggling with some of the math involved in those.

Here's the relevant stripped down code / working example
https://jsfiddle.net/gyngbo0d/

sentences:
Subdived objects in different shapes Currently I'm working on an Android OpenGL 3D game and now I want to implement a collision detection. For this I want to use oriented bounding boxes but here is my problem. For a normal oriented bounding box I have to store the middle and then the length into every dimension. Now let's say I have a tree and of course my character can walk under the treetop but not into the tree trunk. I tried to sketch up the different bounding boxes here:

Tree as two rectangels                         Normal bounding box

-----------------------                   ------------------------------
|                     |                   |                            |
-----------------------                   |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |             x              |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        -------                           ------------------------------

If you think about the collision detection in the first sketch you can walk under the treetop because the border of the tree is subdivided into different shapes and the outline of a tree is still visible. In the second picture you can't tell something about the outline of the object because you only have one big box around the whole object so you can't walk under the treetop. You see the first method is much better then the second method for my plan.

Now my question: Do you have any ideas how I can subdivide my objects into different shapes? Maybe even in triangles, circles and so on. Is there an algorithm  for this or do I have to do it by myself?

sentences:
Collision bug with gravity in slick2D I have fixed some of the previous problem. The collision when running into a corner(a wall on two sides) however is still not working. When the player runs into a corner he just falls down and out of the map. Not sure what is happening.

manageWallCollision Method:

@Override
public void manageWallCollision(Scene currScene) {
    for(int i = 0; i < currScene.getMapManager().getWalls().size(); i++){
        MapTile currTile = currScene.getMapManager().getWalls().get(i);

        if(currTile.isCollidable()){
            if(this.getBounds().intersects(currTile.getBounds())){
                //down
                if(vy > 0 && y2 > currTile.getY() && y2 < currTile.getY2()&& y < currTile.getY() && y < currTile.getY2() ){
                    setY((currTile.getY() - getHEIGHT()) - 7);
                    break;
                }
                //up
                else if(vy < 0 && y < currTile.getY2() && y > currTile.getY() && y2 > currTile.getY2() && y2 > currTile.getY()){
                    setY(currTile.getY2() + 7);
                    break;
                }
                //right
                else if(vx > 0 && x2 > currTile.getX() && x2 < currTile.getX2() && x < currTile.getX() && x < currTile.getX2() ){
                    setX((currTile.getX() - getHEIGHT()) - 7);
                    break;
                }
                //left
                else if(vx < 0 && x < currTile.getX2() && x > currTile.getX() && x2 > currTile.getX2() && x2 > currTile.getX()){
                    setX(currTile.getX2() + 7);
                    break;
                }
                break;

            }
        }
    }
}

If you need any more code or info just ask. Any help is appreciated.

bump

sentences:
Positioning 2D (non-UI system) game objects As an old Flash dev I'm slightly confused about how you position game objects on the screen in Unity since game objects have no width or height (only a scale).

Let's say I have a container gameobject that has several child game objects with sprite renderers representing tiles on them. If I set the container to x0, y0, the whole tile layout will extend from the screen center upwards and to the right.

What are the commonly used ways to position the game object so that it would be centered on the screen? I could calculate the width/height of my container but that would still not be very useful because the x/y coordinates work in a different scale than pixel (right?). E.g. my test screen is 640x1024 and to center my container (while running in the editor) I'd have to set x/y to -4.5. How does that make any sense?

Of course Unity's UI system would be a solution but I don't want to create the playfield with the UI system.

sentences:
Is ArrayLists so slow that it is doomed to kill performance in Unity? I was reading Which Kind Of Array Or Collection Should I Use?

The document states to use list for the most performance.

  "...They are the fastest array in unity. For this reason, built-in arrays are the best choice if you need the fastest performance possible from your code (for example, if you're targeting iPhone)...performs significantly faster than ArrayList."

I am inclined to use list besides performance issues as well because...

If you're using List you won't have to cast objects since it's generic and use a T[] backing storage (at least .net does this). ArrayList have to cast everything to object and cause boxing with value types.
faster for value types as it avoids boxing., strongly typed elements.

But it got me to wonder, since everyone seems to favor to make a degrading statement about ArrayLists, is ArrayLists that horrible? If so why does it even exist? Is it more of trace of supposedly deprecated codes?

sentences: What are game save files? I've reached the saving part of my game, as in, you press save and it writes to a text file, but I've noticed that most games and programs out there use custom save formats, like Dwarf Fortress DAT files. What are these? are these just text files formatted for the program, or are they a lower level thing?

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:
Prevent Unity optimizing local variables out Is there a way to instruct Unity compiler not optimize (best only for builds run from Unity editor)? More precisely, I would like it to stop removing local variables, because it complicates debugging. For example, inspecting node

void Generate() {
   var node = new Node();
   node = node; //breakpoint here, node cannot be inspected
   var x_nearest = Nearest(new_node);
   Debug.Log(new_node);//new_node still cannot be inspected, but x_nearest can
}
Node Nearest(Node node)
{
   //node is an argument here and can be inspected
}

in Visual Studio produces error rather than displaying its value.

  The identifier node is not in the scope

A solution would be make every local variable a private member instead:

private Node node;
void Generate() {
   node = new Node();
   node = node; //breakpoint here, node can be inspected
}

this would, however require frequent back and forth refactoring. I am using Unity 5.6.0f3 with C# 6.0 support and Visual Studio 2017.
note: provided code is for illustration only and the question is not about debugging said code because reproducing specific compiler behavior is not trivial

sentences:
How do I select a portion of the window using Love2d I want to be able to divide the window of the game in, lets say, 3 places, and when the mouse (or touch) click one of those places, execute some code.

Do I have to make each portion a button-like object? or is there a way for me to use love.mouse.getPosition() and give different instructions to specifics range of coordinates?

sentences:
timezone independant Date.now() for node.js game I have a game I'm working on using node.js and socket.io. The issue I'm having, is I'm trying to have it so that players execute whatever actions they inputed about 50ms in the future, giving everyone a chance to stay relatively in sync.

I've got frame-independant code running, which works well until a client has a different time than the server.

to predict when the client should act out movement code from the server, I use

Date.now() >= command.timeStamp

The issue I'm having is that the client isn't in the same timezone as the server, for instance someone I'm testing with is just one minute above/below my server time, resulting in commands being 900 milliseconds in the past or future, which is non-ideal.

Is there some way I can use a common timestamp across clients and server?

sentences:
Movement and rotation of bodies in top down game We are developing a 2D top down game with libgdx using the included box2d as physics engine.

We don't want our bodies to accelerate but to instantly move with the wanted velocity.
The bodies are moved like this, which works perfectly for our purpose:

Vector2 currentVelocity = body.getLinearVelocity();
Vector2 targetVelocity = velocity.velocityApplyVector.cpy();
targetVelocity.sub(currentVelocity);

targetVelocity.scl(body.getMass());

body.applyLinearImpulse(targetVelocity, body.getWorldCenter(), true);

The problem now is, that we also want the bodies to instantly rotate to the direction they are facing. The direction of the player is determined by the mouse position, so it is possible that the body is moving in another direction than it is facing. I tried to accomplish it like this:

float bodyAngle = body.getAngle() * MathUtils.radDeg;
float totalRotation = (inputRotation - bodyAngle) % 360;
if(Math.abs(totalRotation) > 1) {
    if ( totalRotation < -180) totalRotation += 360;
    if ( totalRotation >  180) totalRotation -= 360;
    float impulse = body.getInertia() * totalRotation;
    body.applyTorque(impulse, true);
}

This causes the body to rotate in the wanted direction but it needs multiple frames until it totally reaches the wanted angle.

The body mass is set to 70 and the angular damping to 8 (I tried some values for the damping and 8 was the best value for my cause, but that's, of course, not a final solution...).

I guess I have to somehow increase the needed impulse depending on the body mass and the angular damping (we want to be able to change it) but I can't figure out how to get the values right. I don't want to use setTransform since it totally destroys the physically correct behaviour of the bodies. How can I calculate the needed values? Is there any better way to solve my problem?

sentences:
With Slick, how to change the resolution during gameplay? I am developing a tile-based strategy game using Java and the Slick API.

So far so good, but I've come to a standstill on my options menu. I have plans for the user to be able to change the resolution during gameplay (it is pretty common, after all).

I can already change to fullscreen and back to windowed, this was pretty simple...

//"fullScreenOption" is a checkbox-like button.
if (fullScreenOption.isMouseOver(mouseX, mouseY)) {
   if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
      fullScreenOption.state = !fullScreenOption.state;
      container.setFullscreen(fullScreenOption.state);
   }
}

But the container class, contrary to my previous beliefs, does not seem to have any resolution-change functions! And that's pretty much the situation...I know it's possible, but i don't know how to do it, nor what is the class responsible!

The AppGameContainer class, used on the very start of the game's initialization as of Slick's examples and tutorials, is the only place with any functions for changing the display-mode that I've found so far, but it's only used at the very start, and i haven't found a way to travel back to it from my options menu.

  //This is my implementation of it...
  public static void main(String[] args) throws SlickException {
    AppGameContainer app = new AppGameContainer(new Main());
//    app.setTargetFrameRate(60);
    app.setVSync(true);
    app.setDisplayMode(800, 600, false);
    app.start();
  }

I can define it as a static global on the Main, but it's probably a (very) bad way to do it...

sentences:
How to lower the cost of realtime lights? Besides Deferred rendering, what can I do to make realtime lights cheaper to render? I don't really need them but I could make good use of them in my game.
BTW I thought Deferred render would give me a bigger boost on scenes with many lights but I got kinda let down. Maybe my expectations were too high.

sentences:
FPS networking with server sending input instead of gamestate Why do all fps games have the server send gamestate instead of input which is smaller?

One reason I can sort of see is that if the server sends input to the clients and a packet gets dropped then the client will not be able to gave an accurate simulation until a resend of that packet occurs which could be an entire timeout plus one way trip latency. Presumably this is considered unreasonable for a real time fps game.

But what if at time T the server sends the input processed at time T to the client and at time T+1 the server sends the input processed at time T and time T+1. This way if the packet containing the input processed at time T is dropped the client will get the next packet sent by the server which contains the input processed at time T and time T+1. Thus the client will not stall on the simulation because the server is redundantly sending previous input. The server stops sending a previous input when it gets an ack from the client.

This seems to avoid sending the entire game state. Can someone tell me why this idea is just bad and why no fps games use it?

sentences:
Allow Pushing|Boosting in free browser MMOGs? There seems to be a set of rules (or game design criteria) common to free MMOGs, to encourage fair competition. One such rule is that each player may have only a single account (despite the difficulty of enforcing this effectively). A related issue has recently come to my attention, where a player who does not themselves play often, instead of using their limited resources for their own gain transfers them to another, stronger player. Commonly these might include spouses or disinterested roommates or children, or friends who are no longer active in the game.

Does this advantage violate an essential aspect of the design of the game, or should it be permitted?

sentences:
Rotate sphere in Javascript / three.js while moving along x/z plane I have a sphere/ball in three.js which I want to "roll" around on the x/z plane. For the z axis I could simply do this no matter what the current x and y rotation is:

sphere.roll_z = function(distance) {
      sphere.position.z += distance;
      sphere.rotation.x += distance > 0 ? 0.05 : -0.05;
    }

But how can I roll it along the x axis? And how could I properly do the roll_z? I've found a lot about quaternion and matrices, but I can't figure out how to use them properly to achieve my (rather simple) goal.

I'm aware that I have to update multiple rotations and that I have to calculate how far to rotate the sphere to match the distance, but the "how" is the question. It's probably just lack of mathematical skills which I should train, but a working example/short explanation would help a lot to start with.

Here is an example of how the rotation goes wrong (WASD movement): http://js.blockheaven.net/simple.html

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:
Map handling - Indoors/Outdoors and loading large maps I have two questions regarding the handling of maps.

Question 1. My map will consist of outdoor enviroments as well as dungeons, houses etc. How would I go on about connecting the outdoors with the indoors?

My simple solution to 1.
Put everything in the same map file and when you, for example, walk through a door the player will be "teleported" to the indoor location. Let's say the outdoor location of the door is at the coordinates (10,10) and the indoor enviroment of the given house is at (1000,1000) the player's coordinates will be set to (1000,1000) when he walks through the door.

Is this optimal or is there a better way of doing this?

Question 2. My map will consist of a bunch of larger cities and paths connecting these cities. Obviously the map will be pretty big and I'm not sure if I can keep the whole map in memory. How would I go on about creating an effective map management system?

My simple solution to 2.
Have the map consist of "chunks" with x*x tiles where x is the number of tiles that will fit in the screen. I would then load the chunk the placer is currently in and also the surrounding chunks but nothing else. When the player moves to a new chunk the map will load new surrounding chunks etc.

Would this be a more effective way of handling the map than loading the entire map into memory? Advantages of this way is that I don't have to keep the entire map in the memory but it will take time to dynamically load each "chunk" when it's needed thus creating loading time.

Any improvements to my rudimentary solutions is gladly appreciated.

sentences:
Tiled/TMX C++ Library/Parser Where can I find an easy to use and up to date C++ parser/library for the .tmx map format (used by the Tiled Map Editor) ?

EDIT: David's comment, 'Unless you want to build your game around the format of the parser..', got me thinking... So I have downloaded pugixml, which is an easy to use xml-parser with very straightforward documentation. Together with the spec for the TMX Map Format, I think I'll give it a try myself. I'll probably compare with Cocos2d-x's CCTMXTiledMap at some point.

sentences:
Understanding constant acceleration in terms of game physics simulation There are various integration methods that can be used for games. I am trying to write a simple physics engine deciding between semi-implicit Euler and Verlet variants.

What I don't understand is where most information says that they work well for constant acceleration. Say more than one force acts on a body, and acceleration is calculated using force/mass. Velocity and position are derived from this. This means that the acceleration is not constant surely?

Am I incorrect in my understanding that applying a force in one step, and a different force at another step, is variable acceleration? Is it simply that the error amount is small enough to be ignored. So semi-implicit Euler, with fixed time-step but variable acceleration, for example, will be a good approximation?

I'm very confused, I've read so many different things. I'd appreciate any insights. Thanks!

sentences:
Should I combine multiple tiles of terrain as one mesh in Unity3D? I have a tiled terrain, generated by multiple noise algorithms. Currently, each tile is it's own GameObject, that has a handler for an OnMouseOver event. The area that is loaded at a time consists of 9 chunks that each contain 4096 tiles. This totals to 36864 tiles that are loaded at a time. On top of this, there are actual objects on top of these tiles.

Is there any considerable performance difference if I were to combine some of these tiles into a single GameObject and mesh?

sentences:
Particle spawn on collision spawns too many particles So i have the following code:

private void OnCollisionEnter(Collision collision)
    {
        foreach (ContactPoint contact in collision.contacts)
        {
            if (contact.otherCollider.CompareTag("Ground"))
            {
                //Instantiate your particle system here.
                Instantiate(Effect, contact.point, Quaternion.identity);
            }
        }
    }

Now this works great however it spawns way too many particles (as the animation I am doing with the item hits the ground a lot).

Is there a way to limit the particles in a sensible way?

sentences:
How many active shaders at one frame in the game should I typically use? 5 or more like 100? How many shaders are usually active, at the same time in one scene, in modern games? I know that multiple shaders are being used, with the games switching between them in each frame, and it's common to draw objects via the shader:

Draw all objects with shader one
Change from shader one to shader two
Draw all objects with shader two

Still, I know it's not as simple, especially with effects like a glow effect for whole scene, render to texture, etc., but I guess we can assume it works that way most of the time, right? The "group by shader" approach is good, because switching shaders is an expensive operation.

From one side, you cannot have too many shaders, because you want to render the scene fast. On the other hand, you need many different shaders (or uber-shader with branches - quite similar) for skin, metal, water etc.

How many (and which) different shaders would the theoretical, modern, third person, 3D detective game for PC (DirectX 11, if it matters) use? It would be 5, 20 or more like 100 active shaders, counting only active, at some "frame X"? I know it's not one number, but I wonder what scale and factors are important, in consideration for a PC game.

In my sample game, I would use about 9-11 per frame (count it as different, small shaders or one uber-shader - doesn't matter now):

Skin shader
Eye shader (not too much? but they are different)
Metal shader
Ground shader
Snow/rain shader (if required)
Water shader (if the water exists in scene)
Glow shader (only when some special effects are involved)
Light emiter shader (street lamps etc.)
Standard shader (for all other, just standard shading)
Standard shader with normal maps
2D shader (for GUI etc.)

Is it "much" or "not many"? Did I forget about some important shaders that I would need?

sentences:
Optimal solution for storing card values in a multiplayer card game I am developing multiplayer turn based card game(Mendikot)

in JAVA.There are four players in two teams, partners sitting opposite
A standard international 52-card pack is used. The cards of each suit rank from high to low A-K-Q-J-10-9-8-7-6-5-4-3-2.
Each player gets random 13 card each.

Now I have two ways to store this data,one is to store the data using data structure as below.

private static String[] suits = { "Hearts", "Spades", "Diamonds", "Clubs"};

private static String[] ranks = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" };

and then store each combination of "suits and ranks" for each of the four players in a separate list and then update the list after each turn to remove played card.

Secondly I can go a database solution with table like "Players","Card","Moves" etc.
where in the "Moves" tables will store cards own by each player.Which can be cleared after the game is over

I am considering this Portal as multithreaded as many players can form different rooms to play.

Please suggest me the optimal way to store the data considering the concurrent nature of the portal.

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:
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:
Switching from software Engineer to Game developer I don't know if this is the right place to ask this.

I've been working as a software engineer for 3.5 years so far, mostly web apps, mobile apps, web pages in banking systems, educational, etc but I always wanted to work as a game developer.

Currently I have a university degree in CS, and I'm attending a masters degree in Apps design.

I've very little experience in game dev (only for hobby), some space shooters and some steps in unity, also I took some courses of blender, and did some simple sprites (those 8 bit characters but animate them is a big problem for me atm.) but I've never gone too far.

I know I cannot focus on all aspects of game development, because it is a huge world integrated with different disciplines, but I need to make a portfolio with some of my games at least. (I only have partial prototypes, some of them work, some don't...)

I need some advise of people who are in the game business.

Which platform/framework do you recommend for me ? I already know a bit of Unity and I feel pretty comfortable with it. I can get some assets to work with (models/audio, etc), there are some free material in the store, and I have budget to spend on that too if necessary.
How do game companies hire people? What am I suppose to aim for a job? I mean this is a world full of disciplines and I need to focus in something particular I guess, I'm a senior frontend developer too, so I guess I should focus on coding. I think portfolio is the best way of showing your work.

Any suggestions are welcome! thanks!

sentences:
Bullet Physics Step Simulation Crash when maxSubSteps is not 0 I am using Bullet physics along with Irrlicht. My program consistently crashes when maxSubSteps is not set to zero when calling stepSimulation. I believe it has something to do with the time between the stepSimulation calls because when I stopped Irrlicht from drawing the scene, Bullet worked perfectly fine. Here is my stepSimulation call:

dynamics_world->stepSimulation(frame_delta_time, 0);

The segfault crashing does not occur when the maxSubSteps is zero. I would like to find a better solution to this as I have read that disabling substepping is experimental. Does anyone know how to fix this?

The parameters I am using when calling bullet's stepSimulation() are:

const irr::u32 then = device->getTimer()->getTime();
...
const irr::u32 now = device->getTimer()->getTime();
const irr::f32 frame_delta_time = (irr::f32)(now-then)/1000.f;

The value of frame_delta_time when the program crashes is 0.009.
fixedTimeStep is the default 1/60.

Values other than 0 I have set maxSubSteps to are 1 (the default), 10 and 100.

The gdb stack trace indicates the program is crashing at releasePredivtiveContacts():

Program received signal SIGSEGV, Segmentation fault.

#0  0x000055555557463b in btDiscreteDynamicsWorld::releasePredictiveContacts() ()
#1  0x00005555555746fc in btDiscreteDynamicsWorld::createPredictiveContacts(double) ()
#2  0x0000555555573c8f in btDiscreteDynamicsWorld::internalSingleStepSimulation(double) ()
#3  0x0000555555575335 in btDiscreteDynamicsWorld::stepSimulation(double, int, double) ()

Edit:
The full code is on Github: https://github.com/morgenm/PMC-Game/tree/master/src

sentences: Moving an object in a circular path I want to move one object (dot) in a circular path. How should I change the X and Y coordinates to accomplish this?

sentences:
Clicker economy and bonus system How is an economy system implemented in clicker games? Obviously, you can't store values like 1 Quintilian in long type. I understand that there might be some string operations or even better, some int array where every index has it's value, though I'm curious if there are better methods and what they are.

Also, how to make this system generic and reusable for any other clicker or not clicker game.

And about bonus system, for example, 50 000% increase, I bet it's a bad idea to multiply this value every frame for every other kind of object that generates game currency.

How is this system implemented as well? If you have different sources of bonuses, do you have modifier object that multiplies values?

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

sentences:
Best way to mask 2D sprites in XNA? I currently am trying to mask some sprites.  Rather than explaining it in words, I've made up some example pictures:

 The area to mask (in white)

 Now, the red sprite that needs to be cropped.

 The final result.

Now, I'm aware that in XNA you can do two things to accomplish this:

Use the Stencil Buffer.
Use a Pixel Shader.

I have tried to do a pixel shader, which essentially did this:

float4 main(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 tex = tex2D(BaseTexture, texCoord);
    float4 bitMask = tex2D(MaskTexture, texCoord);

    if (bitMask.a > 0)
    {
        return float4(tex.r, tex.g, tex.b, tex.a);
    }
    else
    {
        return float4(0, 0, 0, 0);
    }
}

This seems to crop the images (albeit, not correct once the image starts to move), but my problem is that the images are constantly moving (they aren't static), so this cropping needs to be dynamic.

Is there a way I could alter the shader code to take into account it's position?

Alternatively, I've read about using the Stencil Buffer, but most of the samples seem to hinge on using a rendertarget, which I really don't want to do.  (I'm already using 3 or 4 for the rest of the game, and adding another one on top of it seems overkill)

The only tutorial I've found that doesn't use Rendertargets is one from Shawn Hargreaves' blog over here.  The issue with that one, though is that it's for XNA 3.1, and doesn't seem to translate well to XNA 4.0.

It seems to me that the pixel shader is the way to go, but I'm unsure of how to get the positioning correct.  I believe I would have to change my onscreen coordinates (something like 500, 500) to be between 0 and 1 for the shader coordinates.  My only problem is trying to work out how to correctly use the transformed coordinates.

Thanks in advance for any help!

sentences:
Find connected hex of same color I'm using Lua. I have a hex map. It is randomly generated into an table.

hexmap[y][x].color = "red"

I wish to find each "group" of hex's. i.e. all hex's of the same color that connect to each other will belong to one group.

As an example, in the following image:

The result should be:

1 blue group (all hex's connect)
3 green groups
1 black group

Any suggestions?

Thank you.

sentences:
How to prevent 2D camera rotation if it would violate the bounds of the camera? I'm working on a Camera class and I have a rectangle field named Bounds that determines the bounds of the camera. I have it working for zooming and moving the camera so that the camera cannot exit its bounds.

However, I'm a bit confused on how to do the same for rotation. Currently I allow rotating of the camera's Z-axis. However, if sufficiently zoomed out, upon rotating the camera, areas of the screen outside the camera's bounds can be shown.

I'd like to deny the rotation assuming it meant that the newly rotated camera would expose areas outside the camera's bounds, but I'm not quite sure how. I'm still new to Matrix and Vector math and I'm not quite sure how to model if the newly rotated camera sees outside of its bounds, undo the rotation. Here's an image showing the problem:

http://i.stack.imgur.com/NqprC.png

The red is out of bounds and as a result, the camera should never be allowed to rotate itself like this. This seems like it would be a problem with all rotated values, but this is not the case when the camera is zoomed in enough.

Here are the current member variables for the Camera class:

private Vector2 _position = Vector2.Zero;
private Vector2 _origin = Vector2.Zero;
private Rectangle? _bounds = Rectangle.Empty;

private float _rotation = 0.0f;
private float _zoom = 1.0f;

Is this possible to do? If so, could someone give me some guidance on how to accomplish this? Thanks.

EDIT: I forgot to mention I am using a transformation matrix style camera that I input in to SpriteBatch.Begin. I am using the same transformation matrix from this tutorial.

sentences:
Travelling in a 2D grid I have a 2D grid (x,y coordinates) where each cell corresponds to each pixel of the interface that I am working with and I have a point A(x1,y1). Now I need to travel around in the grid, and I wont just move this single point, but would like to move a bunch of points together. Now what do you think is the best figure that I shall move, i.e. a circle with a predefined radius, or a square with a fixed side.

Also, once I decide upon the figure, I need to know, what all points are there in the figure, given a specific central point, and work with those points too.

I was thinking that a square would be a better idea, since I'll just have to check the if the difference of the coordinates of the point to be checked from the central point is less than side/2.

But I've heard that calculations with circle are not bad either.

Kindly suggest,

sentences:
Changing the camera movement in unity I have a code that allows me to move the camera on the x-axis. I need it to move on the y-axis as well as the x.

    using UnityEngine;
using System.Collections;

public class orbit : MonoBehaviour {

    public float turnSpeed = 4.0f;
    public Transform player;

    private Vector3 offset;

    void Start () {
        offset = new Vector3(player.position.x, player.position.y + 8.0f, player.position.z + 7.0f);
    }

    void LateUpdate()
    {
        offset = Quaternion.AngleAxis (Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * offset;
        transform.position = player.position + offset;
        transform.LookAt(player.position);
    }
}

sentences:
How to create a walkable 3D terrain I want to make a terrain for a RPG game that I'm developing. I started modeling the surface and implementing it to my game, but now I realized that i might be doing everything wrong. So I would like to ask a few questions:

How should I make the surface Model?

I'm developing my game without an engine, so I have to do coding for everything (Java, LWJGL). I use Blender to model the surface, and I export it to an .smd model file.

How to detect intersections between the surface and other models?

I guess I need to detect intersections, to make the terrain walkable. The problem is that I don't know the best and easiest way to do that. I tried making a triangle-triangle intersection detection algorithm, but it was to hard for me, and I guess I need something faster and simpler.

sentences:
pygame performance issues I'm trying to make a tactics game using python and the infamous pygame library. I use threading for networking and pathfinding. The game uses a p2p lockstep architecture, with one of the players acting as a host. The server starts 2 threads (send / receive) for every connected player. All the connected clients also start 4 threads during their lifetime, 2 for networking, one for the main game loop and a new temporary thread for each pathfinding request.

My problem is that the program uses a lot of CPU and memory, even for very small maps, even when not blitting any sprites with transparency or running any pathfinding algorithms the program is slow and CPU intensive.

The map in my game is built out of tiles, which are 96x96 pixel pygame surfaces, which map sprite images are blitted to

# draw the map
for element in self.atlas.all_objects:
   try:
       self.map_surf.blit(self.map_sprites[element.sprite], element.rect)
   except:
       pass

The map, along with any units are finally blitted to the screen, simply

self.screen.blit(self.map_surf, self.map_surf_rect)

A very small map surface, with 8x8 tiles will make my CPU (amd 8 core 3.10ghz) run at 25%, with 70mb memory used per client (the cpu-fan goes crazy). The frame rate is still normal at this point.

A slightly larger map, 16x16 tiles shows a drop in frame rate, down from the desired 60 to around 48.

A map of what I'd want to be small/normal size for a real game, 40x40 tiles, brings the fps down to 12 and uses a surprising 215mb memory (all the spritesheets combined are 22mb, and I'm only using a basic green tile for testing), with the same CPU utilization as before.

On the same 40x40 map, replacing the image sprites with blank 1x1 pygame.Surface objects results in a frame rate of 27 (it's set to 60)

My basic question is this: Is the problem likely to be in my code, or is pygame itself horribly inefficient? If the latter, is there anything short of learning to code c++ that can replace pygame for these purposes?

If the problem is more likely to be in my code, how can I find out what it is?

EDIT:
I profiled my code, and here are some of the highest numbers

map size 40 x 40 tiles:

4606119 function calls (4606113 primitive calls) in 145.974 seconds

ncalls  tottime  percall  cumtime  percall filename:lineno(function)

127128    0.225    0.000    0.225    0.000 vec2d.py:18(__len__)
218530    1.406    0.000    1.406    0.000 geometrical.py:64(__init__)
253534    0.544    0.000    0.544    0.000 vec2d.py:21(__getitem__)
1400934    2.309    0.000    2.309    0.000 {method 'append' of 'list' objects}
4626   20.189    0.004   20.189    0.004 {method 'fill' of 'pygame.Surface' objects}
2086545   64.417    0.000   64.435    0.000 {method 'blit' of 'pygame.Surface' objects}
1289   10.843    0.008   95.724    0.074 bullet_client.py:714(draw)

So it appears a lot of time is spent appending items to lists, but I'm sure not what kind of other, more efficient method of organizing my game there is. As expected however, blitting pygame surfaces trumps the other functions by a huge factor, as shown by the cumtime (whatever that is).

So I guess the question is the same, can pygame be replaced by something, or might there be a more shallow problem in my code still?

sentences:
What is data-driven design? I've been reading up on a lot of articles covering data driven design for games. It seems to come down to:

No hard coding
No game-specific code in the engine
Scripting for AI, cutscenes, et cetera.
Generalizing code for reusability
Component design
Modularity
Low coupling
Editors (for data, maps, scripts)
External data retrieval
Constants kept in text files (.ini or otherwise)
Expose data through editors for scripting and manipulation by designers

Now, my question is, is this understanding correct?

sentences:
Should a mesh consist of triangles or quads? Currently I am a bit puzzled. I am writing my master thesis about procedural mesh and texture generation and for that I am writing a Blender Add-On to generate low poly planets with physical physically based rendering textures.

This blog (http://blog.digitaltutors.com/modeling-with-quads-or-triangles/) says that it's better to use quads instead of triangles and n-gons. The wireframe looks cleaner, subdivides are more logic and having edge loops. Another blog about this topic can be found here http://blog.digitaltutors.com/ngons-triangles-bad/

But I also read this Why do game engines convert models to triangles compared to keeping it as four side polygon which says that in the end everything is converted to triangles. So I would assume that it's better to use triangles from the beginning so that the engine doesn't need to convert quads to triangles.

And now I don't know if it's better to use triangles or quads.

I could think of it this way:

For modeling use quads, because it's easier to manipulate a quad-mesh.
When modeling is done convert to triangles and export the mesh. But I think this is altering the low poly art style.
Use in a Game Engine.

If I read the ngons-triangles-bad blog post it says that there could be render issues with triangles. So why do engines than convert the mesh to triangles?!

Am I missing something important?

Any advice or more info? Thanks!

sentences:
Black border all around simulation / viewport in iOS using Xamarin + CocosSharp I'm just getting started with Xamarin and CocosSharp so it's possible I've missed something basic here.. but whatever it is I can't seem to figure it out.

I'm trying to get my app/game to be fullscreen (I would prefer to see the status bar with connection, battery, and time.. but for now I'll settle for just full screen.

I'm editing this line:

CCScene.SetDefaultDesignResolution(1080, 1920, CCSceneResolutionPolicy.ShowAll);

And I've tried a bunch of different resolutions, but no matter what I do I can't get it to use the entire screen. As you can see in the image below, even if I enter a very large value for the height, it still does not use up the free space.

How do I make it so the game uses the entire screen, and if possible shows the statusbar?

If it makes any difference the program is set to portrait only.

sentences:
Does game engines (like Unreal, Unity, Crafty) add value compared to pure js frameworks (react, ember..) for my isometric tile-based games I'd like to create a huge tile-based board (say 100K tile). The game does not have any advanced graphics (you don't see the players or landscapes), the main difficulty is that it has 100K tiles to show; something like this (but with many more tiles) or like this

Also, I can't use any technique like in minecraft where I only show smaller "regions" at a time of the map - all of the map has to be shown on the screen at once (people will zoom)

Would a game engine (unity, unreal, crafty, etc) add anything compared to pure javascript frameworks (react, ember, etc) if the only thing you are using them for is to render a tile based board (no animated graphics or characters moving on the screen)? With each tile only showing the state of a tile (occupied or not).

I might need collision detection as 2 players can't be on the same tile (note: I don't think it would be too hard to do this in javascript)
And maybe GPU acceleration out of the box?

sentences:
Unity: Trying to add an in-scene 'press E to open' tag as UI element In Unity 5.4.1 I'm trying to add a tag that says 'press E to open' to a door as you approach it. I've got a RayCast pointing forward from the player, detecting the door and , connected to my PlayerController, I've got a copy of a prefab GameObject which itself contains a Text UI element. The GameObject _interactionTag is instantiated into the scene when the player is close enough.
But I'm having some trouble getting it to display correctly in the scene and I'm not sure why.

Here are the relevant parts of my PlayerController:

public class PlayerController : MonoBehaviour {
    public Canvas _canvas;
    private Vector3 _fwd;
    private RaycastHit _hit;
    public GameObject interactiveTag;
    private GameObject _interactiveGameObject = null;
    private GameObject _interactionTag;

    void Update () {
        _fwd = transform.TransformDirection(Vector3.forward);
        if (Physics.Raycast(transform.position, _fwd, out _hit, 3)) {
        if (_hit.distance<1) {
            _interactiveGameObject = _hit.collider.gameObject;
            GameObject _interactionTag = (GameObject) Instantiate(interactiveTag, _interactiveGameObject.transform.position, _interactiveGameObject.transform.rotation);
           _interactionTag.GetComponentInChildren<Text>().text = _interactiveGameObject.GetComponent<IsInteractive>().interactionText; // this gets a text string from the door 'press E to open'
           _interactionTag.transform.SetParent(_canvas.transform, false);
        }
    }
}

In game, the _interactionTag is appearing - though it's backwards and does not appear attached to the door. Also is any of this the best way of getting the 'press E to open' tag to appear attached to the center of the door? I'm beginning to wonder if what I'm doing is best practise.
Thanks for any help.

sentences:
(Java) Trying to animate an arraylist of coins with a (working) animation class I have a coin class which takes in an integer numOfCoinsand an enum LayoutType, which can be linear or curved. A linear layout displays the coins in a straight line one after the other - we'll work with this since the method is small and straight forward.

My constructor looks like this:

public Coin(float xPos, float yPos, int numOfCoins, LayoutType layout) {
        setType(ObjectType.COIN);
        coinList = new ArrayList<Coin>(); // arraylist of coins
        setPos(xPos, yPos); // set starting position of coin(s)
        if (layout == LayoutType.LINEAR)) {
            linearLayout(); // display coins in a straight line
        } else if (layout == LayoutType.CURVE{
            curveLayout();
        }

}

And my linearLayout() method looks like this

public void linearLayout() {
        //draw numOfCoins amount of coins in a straight line
        for (int i = 0; i < numOfCoins; i++) {
            Coin coin = new Coin(xPos, yPos);
            coinList.add(coin);
            xPos += 50; // place coins 50 pixels apart
        }
}

I have a working animation class and a spritesheet for the coins - however, the way I have modelled my coins is in such a way that 1 coin object can contain numOfCoins amount of coins, so I can't just directly call the animation in the draw method.

The class' draw() method is in an abstract class GameObject which Coin extends. It looks like this:

public void draw(SpriteBatch batch) {
    // if the object is a coin iterate through the list of coins
    // and draw the sprites, if it isn't a coin, simply draw the objects sprite
    if (type == ObjectType.COIN) {
        for (Coin coin : getCoinList()) {
            coin.getCoinList().draw(batch);
        }
    } else {
        sprite.draw(batch);
    }
}

This draw() method is called in World.render().

How would I create an animation using my Animatorclass for each coin if I have 6 coins in a straight line for instance? I can't seem to find a way. Highly grateful for any help, thanks.

sentences:
Pong in assembly waiting for input instead of moving the ball I am writing pong in assembly x86 with TASM and I have a problem.

The program is waiting to get input from the user to move the paddle (int 16h ah=0h) and while it is waiting the ball and the other paddle doesn't move.

What should I do?

sentences:
How can I combine multiple bodies into one in Farseer? I want to create a windmill in Farseer, but I don't know how to combine the 3 windmill sails bodies to one body. During gameplay, the sails could get destroyed. For example, if another body hits one of the sails, then this sail will be destroyed, separating the sails. This means the parts should be able to come apart again.

I'll use the following sprites to create the windmill:

The final windmill should look like this:

What method should I use to combine these together, but have them able to separate when destroyed?

sentences:
SDL Multiple keyboard support I am making a game with multiplayer split screen mode using SDL. Basically, I like the idea of having each player plug in his own keyboard to the PC, set custom controls via options and being able to play it with controls that he likes.

However, there's a problem. This code gets the keyboard event:

SDL_Event event;
SDL_PollEvent(&event);

SDL_Event has member SDL_KeyboardEvent key, which has member Uint8 which. In short:

event.key.which;

According to this, it should represent keyboard device index, however, I've tried connecting three keyboards to my PC and press the buttons at the same time and the result wasn't satisfying: they all had same keyboard indexes. Is there a solution to this? Or am I missing something?

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:
Unable to draw single particle effect at two places I am using Libgdx ParticleEffect to draw a fire particle effect .

The issue I have is that when I try to render a ParticleEffect at two different locations within single game loop, only the last draw call has the effect drawn on screen. I update the Particle effect only once per game loop but set its position to two distinct locations and draw it. Is this a trivial problem with Libgdx ParticleEffect:

ParticleEffect effect = new PartcleEffect();
effect.load(gdx.files.internal("data/effect.particle"),atlas,"");
effect.start();

In render :

effect.update(deltaTime);

effect.setPosition(x1,y1);
effect.draw(batch);

effect.setPosition(x2,y2);
effect.draw(batch);

Can someone tell me why it isn't working?

sentences:
How do I calculate an inverse bind-pose matrix for COLLADA? I want to port a rigged mesh from a custom format to COLLADA. The bones I have define a position for the bone (local) and a matrix that transforms the child-bones' positions into the next-higher coordinate space. (The position of the root usually is {0, 0, 0}.)

How can I convert these to the inverse bind-pose matrices used for COLLADA?

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:
Sprite with transparency: Create box collider (ignoring transparent area) I have a sprite which has a transparent area in it. The non-transparent area is a free-form graphic (red). I would like to create a box collider around it (yellow), but ignoring the transparent area.

Some notes to the image above:

Left: This is what happens, if I apply a PolygonCollider2D. The yellow line represents the area covered by the PolygonCollider2D. This is not what I want.
Middle: This is what happens, if I apply a BoxCollider2D. The yellow line represents the area covered by the BoxCollider2D. This is also not what I want, as it includes the transparent area of the sprite.
Right: This is what I want: Have a BoxCollider2D outside my free-form graphic.

Here's how I currently load my sprite data into the game during runtime:

My sprites are located in the /Assets/Resources/SceneData/... folder structure of my project. The graphics are stored as .png files.
When loading a level, I load the required graphics as sprites like this:

    var sprite = Resources.Load<Sprite>("SceneData/AfternoonAtTheBeach/DragAndDrop/Graphics/Level1/ElephantWithIceCream");

"ElephantWithIceCream" is the .png file (Resource.Load wants me to refer to this file without file extension)

After that, I create a new game object and attach a SpriteRenderer component to it. The sprite is assigned to the
SpriteRenderer by setting the sprite attribute of the SpriteRenderer component.

My first thought on how to solve my problem was to do something like this:

Create a PolygonCollider2D and try to convert it into a BoxCollider2D. But I was not able to find code examples on how to do this.

After that, I thought of trying it to do like this:

Create a PolygonCollider2D and try to extract some useful information out of it (such as bounds, center, extents, etc...).
Delete the PolygonCollider2D and create a BoxCollider2D. Use the previously extracted info to create the BoxCollider2D.

But I fail doing so. I am also a bit confused as sometimes they refer to world space or local space. Does anyone have a working recipe for doing something like this? I do not really understand how to work with center, bounds and extents. If there is any better way of doing this, I am highly interested. Thanks a lot for your help!

sentences: How to attach one sprite to another in LibGDX? I want to attach one sprite to another so that it is always located at the 'bottom' of the other sprite, regardless of how the main sprite is rotated.

sentences:
Problem with HLSL :TextureCoordinate0 is missing I'm trying to create a very simple game, and am working with HLSL. I got this error in my draw method:

  The current vertex declaration does not include all the elements
  required by the current vertex shader. TextureCoordinate0 is missing.

Here is my draw method:

public void Draw(Matrix View, Matrix Projection,Vector3 CameraPosition)
{
        // Calculate the base transformation by combining
        // translation, rotation, and scaling

        Matrix baseWorld = Matrix.CreateScale(Scale) *
            Matrix.CreateFromYawPitchRoll(Rotation.X, Rotation.Y, Rotation.Z) *
            Matrix.CreateTranslation(Position);
        foreach (ModelMesh mesh in Model.Meshes)
        {
            Matrix localWorld = modelTransforms[mesh.ParentBone.Index] * baseWorld;

            foreach (ModelMeshPart part in mesh.MeshParts)
            {
                Effect effect = part.Effect;
                if (part.Effect is BasicEffect)
                {
                    ((BasicEffect)effect).World = localWorld;
                    ((BasicEffect)effect).View = View;
                    ((BasicEffect)effect).Projection = Projection;
                    ((BasicEffect)effect).EnableDefaultLighting();
                }
                else
                {
                    setEffectParameter(effect, "World", localWorld);
                    setEffectParameter(effect, "View", View);
                    setEffectParameter(effect, "Projection", Projection);
                    setEffectParameter(effect, "CameraPosition", CameraPosition);

                    Material.SetEffectParameters(effect);
                }
            }
            mesh.Draw();
        }

But in VertexShaderFunction (in LightingEffect), instead of output.UV = input.UV I put output.UV=float2(somefloat,somefloat) I get no error.

There is a another thing, I got this error when I try to load my "Cathedral" model and others, but for "teapot" model I get no error.

Here is my complete code and models.

sentences:
Don't understand how paddle location is tracked; using XNA tutorial Wanting to learn how to make games, decided to use Monogame. Have pretty light programming knowledge, so I apologize beforehand for my ignorance to this surely obvious oversight.

Following a beginner's tutorial on XNA game development. It's a simple ball and paddle game that has a game class, paddle class, and ball class.

Now my problem lies in the code for the ball class.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;

    namespace BreakingOut
{
class Ball
{
    Vector2 motion;
    Vector2 position;
    float ballSpeed = 4;

    Texture2D texture;
    Rectangle screenBounds;

    public Ball(Texture2D texture, Rectangle screenBounds)
    {
        this.texture = texture;
        this.screenBounds = screenBounds;
    }

    public void Update()
    {
        position += motion * ballSpeed;
        CheckWallCollision();
    }

    private void CheckWallCollision()
    {
        if (position.X < 0)
        {
            position.X = 0;
            motion.X *= -1;
        }
        if (position.X + texture.Width > screenBounds.Width)
        {
            position.X = screenBounds.Width - texture.Width;
            motion.X *= -1;
        }
        if (position.Y < 0)
        {
            position.Y = 0;
            motion.Y *= -1;
        }
    }

    public void SetInStartPosition(Rectangle paddleLocation)
    {
        motion = new Vector2(1, -1);
        position.Y = paddleLocation.Y - texture.Height;
        position.X = paddleLocation.X + (paddleLocation.Width - texture.Width) / 2;
    }

    public bool OffBottom()
    {
        if (position.Y > screenBounds.Height)
            return true;
        return false;
    }

    public void PaddleCollision(Rectangle paddleLocation)
    {
        Rectangle ballLocation = new Rectangle(
            (int)position.X,
            (int)position.Y,
            texture.Width,
            texture.Height);

        if (paddleLocation.Intersects(ballLocation))
        {
            position.Y = paddleLocation.Y - texture.Height;
            motion.Y *= -1;
        }
    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(texture, position, Color.White);
    }
}
}

When I run the game, it functions properly. Player moves the paddle, and when the ball collides with the paddle, it bounces off.  I don't understand how the Ball class knows the paddle location though.  It's not like paddleLocation is a public variable in the paddle class.

sentences:
Crouching Up and Down XNA C# Controller The game is a 2D platformer.

The problem I have is when I press the B button to crouch from standing, I do not know how to implement a function where B can be pressed again to move back to the standing sprite.

the issue is if i use the code presented below it will check every frame for B == Pressed, basically appearing as if the player never crouched at all. Could somebody help please?

if (facingRightSide == true)
        {
            if (currPad.Buttons.B == ButtonState.Pressed)
            {
                m_currState = AnimState.CrouchRight;
                isCrouchedRight = true;
            }
        }

if (isCrouchedRight == true)
        {
            if (currPad.Buttons.B == ButtonState.Pressed)
            {
                m_currState = AnimState.FacingRight;
                isCrouchedRight = false;
            }
        }

Thank you for your time.

sentences:
How would I go about coloring marching cubes terrain? I'm making a game with marching cubes terrain (I know very original idea) and I don't exactly know how to color it. I have a system to do it, I just need to know how to interpolate it where it's not all smoothed out.
I just want flat colors, I think it boils down to this function (this is this guys code http://www.paulbourke.net/geometry/polygonise/):
glm::vec3 VertexInterp(const float& isolevel,const glm::vec3& p1,const glm::vec3& p2, const float& valp1, const float& valp2) {
    float mu;
    glm::vec3 p;

    if (ABS(isolevel-valp1) < 0.00001)
        return(p1);
    if (ABS(isolevel-valp2) < 0.00001)
        return(p2);
    if (ABS(valp1-valp2) < 0.00001)
        return(p1);
    mu = (isolevel - valp1) / (valp2 - valp1);
    p.x = p1.x + mu * (p2.x - p1.x);
    p.y = p1.y + mu * (p2.y - p1.y);
    p.z = p1.z + mu * (p2.z - p1.z);

    return p;
}

So if anyone could help me implement a flatter or smoother variant of that function it would be very much appreciated
(I know all the rest of the things I need to do I just need help with this)

sentences:
Libgdx opacity partial error My model must support transfer textures but I can't do this using mesh + modelBuilder.part
Opacity is tested correctly on only half of the model.
BlendingAttribute blendingAttribute = new BlendingAttribute();
        blendingAttribute.opacity = 1.0f;

        modelBuilder = new ModelBuilder();
        modelBuilder.begin();
        modelBuilder.part("minecraft:loading_model", mesh, 4, new Material(TextureAttribute.createDiffuse(atlas), blendingAttribute));
        modelInstance = new ModelInstance(modelBuilder.end());

sentences: Implementing an efficient method of server-side checking I'm making a web-based action RPG game. I don't want players to cheat, but I also don't want the game to constantly pause to wait for the server to respond. I made it so the game is played on the client-side (for responsiveness) and the server does routine checking to validate the game state. But the system is very cumbersome. The server has to calculate every single frame and compare the entire game state to the game state sent from the client. If anything in the game states are different form each other, the server kicks the player off. However, this means the game has to send 30 requests a second, and the server must calculate it all in time. If many people are playing the game, I don't think my one free Heroku dyno can handle that. How do I implement an efficient and elegant way of validating players' moves on the server side?

sentences:
How do games on Windows locate libraries? I've always wondered how games handle libraries. What if you want to use a dynamic library in a game, let's say OpenGL.

You could just put it inside the /lib folder on Linux(-like), and have everything working properly; even better, on Debian systems you could just set it as a dependency.

How does this work on Windows?
There is no clear /lib directory, where do you put it?

Obviously you cannot ask the user to manually install the libraries!
Do you simply create a folder for it somewhere and add that to the PATH environment variable?
Or do you first check where other programs might have put it?

Is there a 'standard' to do this?

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:
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:
Can you help with collision detection and response in a 3D car racing game? I am trying to implement the collision detection and response in 3D car racing game.

I have a car model, for collision I am assuming my car as a cuboid. my collision detection with walls is quite good and the response is also good. My model has a velocity, position, acceleration and orientation. I am using matrix to save the orientation and position.

My problem is collision and its response with the ground (in my case it's road). When the ground is a simple plane with a constant y-axis, then there is no need for collision detection as there is no force or movement in the y direction. But if my road is not linear, if it has some elevation, then I am having a collision detection problem when it comes to calculating its orientation.

Any help and suggestions will be of great help.

sentences:
Unity order issue with TilemapRenderer.Render I'm using unity, with 2D Tilemaps (I'm doing something like an RPG)

I want to have a Tile which should be rendered with a random sprite.

When I use a tile like a tree that is bigger than the tile size and RandomTile, the draw order seems to get confused. Even if the sort order on the Tilemap Renderer is set appropriately, some of the tiles are drawing on top of the other tiles with no consistent pattern.

After stepping through with the Frame Debugger, it looks like all tiles with the same sprite are drawn at the same Draw Dynamic event under TilemapRenderer.Render.

I'm using the following script:

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

#if UNITY_EDITOR
using UnityEditor;
#endif

using UnityEngine;

namespace UnityEngine.Tilemaps
{
    [Serializable]
    public class RandomTile : Tile
    {
        [SerializeField]
        public Sprite[] m_Sprites;

        public override void GetTileData(Vector3Int location, ITilemap tileMap, ref TileData tileData)
        {
            base.GetTileData(location, tileMap, ref tileData);
            if ((m_Sprites != null) && (m_Sprites.Length > 0))
            {
                long hash = location.x;
                hash = (hash + 0xabcd1234) + (hash << 15);
                hash = (hash + 0x0987efab) ^ (hash >> 11);
                hash ^= location.y;
                hash = (hash + 0x46ac12fd) + (hash << 7);
                hash = (hash + 0xbe9730af) ^ (hash << 11);
                Random.InitState((int)hash);
                tileData.sprite = m_Sprites[(int) (m_Sprites.Length * Random.value)];
            }
        }

#if UNITY_EDITOR
        [MenuItem("Assets/Create/Random Tile")]
        public static void CreateRandomTile()
        {
            string path = EditorUtility.SaveFilePanelInProject("Save Random Tile", "New Random Tile", "asset", "Save Random Tile", "Assets");

            if (path == "")
                return;

            AssetDatabase.CreateAsset(ScriptableObject.CreateInstance<RandomTile>(), path);
        }
#endif
    }

#if UNITY_EDITOR
    [CustomEditor(typeof(RandomTile))]
    public class RandomTileEditor : Editor
    {
        private RandomTile tile { get { return (target as RandomTile); } }

        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();
            int count = EditorGUILayout.DelayedIntField("Number of Sprites", tile.m_Sprites != null ? tile.m_Sprites.Length : 0);
            if (count < 0)
                count = 0;
            if (tile.m_Sprites == null || tile.m_Sprites.Length != count)
            {
                Array.Resize<Sprite>(ref tile.m_Sprites, count);
            }

            if (count == 0)
                return;

            EditorGUILayout.LabelField("Place random sprites.");
            EditorGUILayout.Space();

            for (int i = 0; i < count; i++)
            {
                tile.m_Sprites[i] = (Sprite) EditorGUILayout.ObjectField("Sprite " + (i+1), tile.m_Sprites[i], typeof(Sprite), false, null);
            }
            if (EditorGUI.EndChangeCheck())
                EditorUtility.SetDirty(tile);
        }
    }
#endif
}

Is there any way to fix it?

sentences: Can i use art from another videogame as base for my art? For example: if I take the 3d models and textures from GTA: San Andreas and I modify them making better models and textures, can i use this new art to make a game with a different gameplay and sell it without infringing the game's copyright?

sentences:
How to prevent/"reverse" displacement from a collision? In my game I can throw a hammer. The hammer moves based on physics in Unity.
The hammer destroys the first object it touches. I want it to continue moving as though it didn't touch anything when this happens.
To try and achieve this, I made it destroy objects using a separate, larger trigger collider, intending to destroy the object before the physical collision occurs.
However, when moving at very high speeds (as in the GIF), both colliders hit at once, so the hammer moves and the object deletes.

How can I prevent the hammer from moving when/before the trigger occurs, or (I suppose more realistically) "reverse" the movement such that there's no perceptible collision?

I tried using the impulses from each of the contacts in the collision to apply forces in reverse, but didn't really understand what I was doing and ultimately failed.

NOTE: I cannot simply disable the physics collider, because it doesn't destroy everything.

sentences:
Implementing cheat safe loot algorithm at clientside I am developing a "city building" type of browser based flash/flex game. I was checking some of the implementation of existing one of the popular games in facebook using decompilers. I noticed they have implemented the loot algorithm the client side and sending the loot item to the server which I think is not cheat safe.

Knowing the fact that there are cheaters every where and it is easy to manipulate the messages and send the best loot always, is there any way we can counter this type of cheats?

I dont have a concrete solution designed for it yet but I am thinking to track the drops by maintaining the loot history.

So instead of mere updating the resources/inventory, I will implement a logic which will compare the loot with history to see if the player is receiving the rare drops excessively and flag the user or take a smart decision (which I don't have yet)

Or

Is it a good idea to implement the loot algorithm in the server side? Since this is "city building" kind of game, where it will not have extensive user actions like in typical RPG games which can trigger loot events.

sentences:
How can I more efficiently write my Math-Code in AS3 So this might be an odd question to ask. But I'm not really the biggest mathematician out there, and I have a weird habit of writing code. So I'm going to post what I'm working on. I'm doing a self-game jam this weekend which will be 48 hours long, and I've kind of cheated by already starting. The question is -- well what I'm trying to do is create a ease-in / bouncing effect without using a Tween library.

I feel that what I have is suffice, but I don't think it is very efficient and that I'm overcomplicating my code with clutter.

Below is code from my Engine class with comments that should help decipher what I am doing.

package {
    import flash.display.MovieClip;
    import flash.ui.Mouse;
    import flash.display.Stage;
    import flash.events.Event;

    public class Engine extends MovieClip {

        public var spaceShip:Ship = new Ship(stage);
        private var logo:IcarusLogo = new IcarusLogo();

        //Math, Velocities , Numbers
        private var vF : Number = 0.5; // Velocity Forward
        private var vX : Number = 0; // Velocity X
        private var vY : Number = 0; // Velocity Y
        private var iV : Number = 0.2; // Initial Velocity
        private var fV : Number = .90; //Friction
        private static var pI:Number = 3.14; // pI

        public function Engine() {
            initGraphics();
            runGame();
            Mouse.hide();
        }
        //INIT EVERYTHING
        private function initGraphics():void {
            initShip();
            initLogo();
        }
        private function initShip():void {
            spaceShip.x = stage.stageWidth/2;
            spaceShip.y = stage.stageHeight/2;
            stage.addChild(spaceShip);
        }
        private function initLogo():void {
            stage.addChild(logo);
            logo.x = stage.stageWidth - 1200;
            logo.y = 200;
        }
        //RUN THE GAME
        private function runLogoStyles():void {
            logo.x += vX;
            iV = .025;
            vX *= fV + iV;
            if (logo.x <= 450) {
                logo.x += vX;
                vX += fV + iV;
                iV = -.2;
            }
        }
        public function runGame():void {
            stage.addEventListener(Event.ENTER_FRAME, update);
        }
        public function update(e:Event):void {
            runGame();
            runLogoStyles();
        }
        //TRASH EVERYTHING THATS NOT NEEDED.
        //AS3 HAS NO NARC RULE SO JUST REMOVE.CHILD
        public function trashCan():void {
            //TrashCan is similar to init. Create Sub-Functions // and init everything in here.
        }
    }
}

Here's a screenshot to give a better understanding : http://f.cl.ly/items/3X3j0L052v0M2b0v2p1b/screen.png

sentences:
LWJGL Game crashes on some other machines I just tried running my game on a friend's laptop, but for some reason it crashes. The exported .jar runs fine on my machine, and some others too. I can see that is has something to do with the glDrawArrays function, that is this code:

glPushMatrix();

glTranslatef(pos.x*world.chunkSize.x, 0.0f, pos.y*world.chunkSize.z);

glBindBuffer(GL_ARRAY_BUFFER, vao_id);

glVertexAttribPointer(world.game.positionAtt, 3, GL_FLOAT, false, 36, 0);
glVertexAttribPointer(world.game.normalAtt, 3, GL_FLOAT, false, 36, 12);
glVertexAttribPointer(world.game.texCoordAtt, 2, GL_FLOAT, false, 36, 24);
glVertexAttribPointer(world.game.lightAtt, 1, GL_FLOAT, false, 36, 32);

glDrawArrays(GL_TRIANGLES, 0, arraySize / 9);

glBindBuffer(GL_ARRAY_BUFFER, 0);

glPopMatrix();

As said, the exact same .jar runs fine on my system, and some more I have tried it on.

My friend's pc has Intel HD Graphics 3000, with GLSL version 1.40 and OpenGL 3.1.0.

Crash dump: http://pastebin.com/X8x4xX8j

Thanks in advance.

sentences:
Sampling procedural texture generated in shader? We have a custom Unity surface shader which generates some procedural patterns.

However we are getting very bad moire effects when the pattern frequency is too high (made worse by distance, surface angle).

I would like to apply some kind of blur on the texture to reduce this moire effect. All of the shader blur examples I can find rely on sampling surrounding pixels from the texture bitmap.  Since we've generated the pattern procedurally per pixel, such a bitmap doesn't exist.

Does anyone know how we might introduce some kind of blur effect in this case, to reduce the moire?

Thank you.

sentences:
AssetManager proper usage in libgdx I am a beginner in libgdx and I am coding a simple game. This game is like a word puzzle where each letter is a texture. Before loading the first level I need to load into memory 26 textures, one for each alphabet letter, and also an English dictionary stored in memory as a .txt file. The problem is that my dictionary needs to be processed and loaded into memory (complexity  Big-O is O(n) where n is around 200k). Where should I process it? Inside the asset manager class or in the class where it will actually be used?

Also, different levels may use the exact same textures so it would be great to load them in memory only once rather than disposing them every time a level ends. Is storing them in a static variable in the Assetmanager class a nice solution to this problem?

sentences:
Sharing Physics in Unity I'm making a game with an endless mode where you have to dodge asteroids until you eventually die. Since the game could be endless, I wanted to avoid the coordinates issue mentioned here.

My player ship remains at 0,0,0. The asteroids spawn at the top of the screen and "fall" to simulate the player flying past them. The player can also accelerate and decelerate. I have tried scripting asteroid movement, but now I would like to try using Unity's physics to simplify code.

When accelerating/decelerating I could add force to all existing asteroids, but then asteroids which haven't spawned yet will not reflect the player's current speed. I basically want all asteroids to have the same speed.

I was thinking maybe I could create a dummy physics object that I can apply forces to, that also keeps track of its speed. It would be great if all objects could just reference this dummy object's speed and forces. Is something like this possible with Unity's physics? Or is there a better way to do what I'm attempting?

sentences:
Moving and shrinking circle to a circle inside of it (PUBG like zone) I am trying to create a battle royale circle gamemode within Arma3 that would work like in PUBG.
For anyone who doesn't know how it looks like:

Red circle should smoothly shrink into the blue one (that means sides that close to each other should move very slowly by adjusting speed of the red circle center)
Global variables:
Center = (getMarkerPos "marker_start"); // eg. [1000, 1000]
ClosingSpeed = 0.5;
CurrentRadius = 1000;
EndingRadius = 250;
Offset = 1;

Code for generating new circle:
// Determines maximum radius of a new circle
private _maxRadius = CurrentRadius * 0.7;
// Generates radius of the new circle
private _randomRadius = [_maxRadius * 0.6, _maxRadius] call BIS_fnc_randomNum;
// Generates new circle center
private _randomCenter = [CurrentRadius * 0.1, (CurrentRadius - _randomRadius)] call BIS_fnc_randomNum;
// Randomizes position of the new circle within the old one
FinalCenter = Center getPos [_randomCenter, random 360];
EndingRadius = _randomRadius;
ClosingSpeed = ClosingSpeed / 2;
// This number should be somehow calculated to make the closing circle animation work properly
Offset = 0.75;

Shrinking code, executed every 100 ms:
// Decreases radius
CurrentRadius = CurrentRadius - ClosingSpeed;
// Gets the angle between two center points - in degrees
private _angle = ((FinalCenter select 1) - (Center select 1)) atan2 ((FinalCenter select 0) - (Center select 0));
if (CurrentRadius > EndingRadius) then {
    // This sets new position of the circle
    Center set [0, (Center select 0) + ((Offset * ClosingSpeed) * cos (_angle))];
    Center set [1, (Center select 1) + ((Offset * ClosingSpeed) * sin (_angle))];
};

Without the correct Offset it shrinks like this - center points (red circle center was moving at a wrong velocity):

sentences:
Most Needed Open Source Project A few questions on the site have mentioned the need for more open source projects. I agree and wonder what frameworks should be developed.

I'll start the list.

A geometry kernel, including
serialization (JSON, binary,
compressed binary), tailored for
OpenGL/DirectX
Gesture recognition

sentences:
Trying to leave a trail of particle effects with a Particle system attached to an Object Unity C# I have a particle system attached to my game object, which starts to emit particles when I press down the "W" key and stops when I release it. The particle system works fine, but when I rotate the object, the particles rotate with the object. I would like to have the particles leave behind a trail of the path of the object.

Script below:

public class Motor : MonoBehaviour {

public ParticleSystem EngineLeft;
public ParticleSystem EngineRight;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetKey(KeyCode.W))    {
        transform.Translate(Vector3.forward * Time.deltaTime * Speed);
    }

    if (Input.GetKeyDown (KeyCode.W)) {
        EngineRight.Play ();
        EngineLeft.Play ();
    }

    if (Input.GetKeyUp (KeyCode.W)) {
        EngineRight.Stop ();
        EngineLeft.Stop ();
    }

sentences:
Slick2D crashes on Image.getGraphics() on some machines On some machines, creating a new Image and calling getGraphics() on it causes lwjgl to enter into some kind of faulty state that crashes when swapping buffers. Any idea what causes this and how to make Slick clean up after itself properly?

Reproduction code:

package crashrepro;

import org.newdawn.slick.*;

public class CrashRepro extends BasicGame {
    public static void main(String[] args) throws Exception {
        CrashRepro cr = new CrashRepro("CrashRepro");
        // Crash only happens in fullscreen mode.
        AppGameContainer agc = new AppGameContainer(cr, 800, 600, true);
        agc.start();
    }

    public CrashRepro(String title) { super(title); }

    @Override
    public void init(GameContainer gc) throws SlickException {}

    @Override
    public void update(GameContainer gc, int i) throws SlickException {}

    @Override
    public void render(GameContainer gc, Graphics grphcs) throws SlickException {
        Image img = new Image(128, 128);
        img.getGraphics(); // This crashes the game.
    }
}

Stack trace:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.WindowsContextImplementation.nSwapBuffers(Ljava/nio/ByteBuffer;)V+0
j  org.lwjgl.opengl.WindowsContextImplementation.swapBuffers()V+35
j  org.lwjgl.opengl.ContextGL.swapBuffers()V+3
j  org.lwjgl.opengl.DrawableGL.swapBuffers()V+0
j  org.lwjgl.opengl.Display.swapBuffers()V+39
j  org.lwjgl.opengl.Display.update(Z)V+44
j  org.lwjgl.opengl.Display.update()V+1
j  org.newdawn.slick.AppGameContainer.gameLoop()V+78
j  org.newdawn.slick.AppGameContainer.start()V+17
j  crashrepro.CrashRepro.main([Ljava/lang/String;)V+27
v  ~StubRoutines::call_stub

sentences:
LibGDX Rectangle not Scaling to ImageButton Instance as Expected below is the class I wrote for a GameButtoninstance:

public class GameButton {

private ImageButton button;
private TextureRegionDrawable drawableUp, drawableDown;
private Rectangle hitbox;

public GameButton(int x, int y){
    final int boxSize = 100;
    drawableUp = new TextureRegionDrawable(AssetLoader.gameButtonUp);
    drawableDown = new TextureRegionDrawable(AssetLoader.gameButtonDown);
    button = new ImageButton(drawableDown, drawableUp, drawableUp);
    button.setPosition(x,y);
    button.setSize(100,100);
    hitbox = new Rectangle(x,y,0,0);

    button.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if(button.isChecked()){
                hitbox.setSize(boxSize,boxSize);
                Gdx.app.log("Button", "active ("+hitbox.getWidth()+","+hitbox.getHeight()+")");
            }else{
                hitbox.setSize(0,0);
                Gdx.app.log("Button", "inactive ("+hitbox.getWidth()+","+hitbox.getHeight()+")");
                button.setChecked(false);
            }
        }
    });
}

public Rectangle getHitbox(){ return hitbox; }

public ImageButton getButton(){return button;}}

Essentially this class defines an ImageButton with a bounding Rectangle that changes size whenever I click the button. The size change works as expected, however the bounding Rectangle isn't up to scale with the ImageButton. AssetLoader.gameButtonUp is a TextureRegion with coordinates (131,142) the same dimensions as the texture image.

However, when I use ShapeRenderer to draw where the rectangle is on screen I get this,

when the desired outcome to have that big square is to be on top of the blue button in this image and for it to be the same size

(Ignore the smaller rectangle in the top left)

I'm still new to libGDX, so any help would be appreciated.
Thanks.

sentences:
How do I fill a region in Roblox? I try this:

workspace.Terrain:FillRegion(Region3.new(Vector3.new(2048, -256, 2048), Vector3.new(-2048, -512, -2048)):ExpandToGrid(4), 4, Enum.Material.Basalt)

I get the error Region cannot be empty. What gives? Of course the region is empty, I am trying to change that. Is :FillRegion() broken?

sentences:
Why is programmable pipeline( GLSL ) faster than fixed pipeline? So I'm teaching myself GLSL and am trying to figure out why it's suppose to be faster than the fixed function pipeline.

The reason I am having a problem is that from my understanding , the shaders you create are replacing sections of the pipeline that were there before. So, how's simply providing your own version speeding things up?

The only thing I can think is if you tried to supply say your own lighting equation before, you would have to do the calculation on the CPU, but now you can do the calculations on the GPU which will be faster.

Am I understanding this correctly?

sentences:
How do I create a curved line or filled circle or generally a circle using C++/SDL? Hello I've been trying for ages to make a pixel circle using the putpixel function provided by SDL main website here is that function :

void putpixel(int x,int y , int color , SDL_Surface* surface)
{
    unsigned int *ptr = static_cast <unsigned int *> (surface->pixels);

    int offset = y * (surface->pitch/sizeof(unsigned int));

    ptr[offset + x] = color;
}

and my question is how do I curve a line or create an circle arc of pixels or any other curved shape then a rectangle or singular pixel or line.

for example here are some pictures

filled pixel circle below
enter link description here

now my idea was too

change the x and y value of the pixel position using + and -  to create the curves but in practice didn't provide the correct results

what my results are in this is to be able to create a circle that is made out of pixels only nothing else.

thank you for anyone who takes the time to read this question

thanks! :D

sentences:
Resize the Texture Region (parallax background) to fit my screen size in libgdx I am using libgdx to make a running game. I am using vertical parallax background. I have successfully implemented parallax background many times. But for this game, I want my Texture region to fit my screen size. I tried several things but the texture region is streched badly.Here is a screenshot.

I used this code:

texture_bg  = loadTexture("data/road1.png");
bg  = new TextureRegion(texture_bg, 0,0, 600, 600);

that is obvious. Now ..what should I do... so that while making it as a parallax background... it would fit my screen... I am worried only about the width.... as if the width will fit the screen width... it will look like a running road... no matter how long the height is.

I found some solution here
https://stackoverflow.com/questions/7551669/libgdx-spritebatch-render-to-texture

but not able to understand.. it seems somewhat complex.
Please make it clear if it is the solution or suggest on other possibilties.

sentences:
Day/Night cycle with GLSL - blend from one colour to another along Sin curve I am attempting to implement a day/night cycle using a GLSL fragment shader in a 2D game i'm developing in SFML. I am a novice with shaders with this one being my first.

Currently I am using a lightmap to achieve ambient lighting and spotlights from lightsources (e.g. campfire) which is working nicely. The lightmap shader I am using I got from following an old Alcovegames tutorial, see below:

uniform sampler2D texture;
uniform sampler2D lightmap;

uniform vec4 ambient;
uniform vec2 resolution;
uniform int theta;

float PI_180 = 3.141592653589793 / 180;

vec3 ToGlColour3(in vec3 colour)
{
    float dv = (1.0/255);
    return vec3
    (
        dv * colour.r,
        dv * colour.g,
        dv * colour.b
    );
}

vec4 ToGlColour4(in vec4 colour)
{
    return vec4
    (
        ToGlColour3(colour.rgb),
        (1.0/255) * colour.a
    );
}

void main()
{
    vec4 diffuse = texture2D(texture, gl_TexCoord[0].xy);

    vec2 lightcoord = (gl_FragCoord.xy / resolution.xy);
    vec4 light = texture2D(lightmap, lightcoord);

    vec4 ambientLight = ToGlColour4(ambient);

    float ambientIntensity = ambientLight.a * (sin(theta * PI_180) + 0.5);
    vec3 ambientColour = ambientLight.rgb * ambientIntensity;
    vec3 intensity = (ambientColour + light.rgb);

    vec3 result = diffuse.rgb * intensity;

    gl_FragColor = vec4(result, diffuse.a);
}

The ambientIntesity calculation is my attempt at cycling from night to day.
My issue is that it doesn't cycle bright enough to give an adequate daytime effect.

I was thinking I could use the current value of sine(theta) and interpolate from my ambient colour to white (representing fully lit daytime).

I'm just not sure how to achieve this in GLSL. Ideally a solution within GLSL would be possible to help develop my knowledge of shaders.

I appreciate any help, Thanks.

sentences:
How can I make my character jump? I'm trying to make a platformer. I'm trying to figure out how to make my character jump. I have tried setting a direction variable (after I enabled physics on the room, the character, etc), and it does jump, but it spins, and falls weird. I just want a simple Mario jumping up or something.

I'm using Game Maker Studio 2 (drag-n-drop).

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:
How to set a box2d body to follow a strict path I'm making an infinite runner type game and I want one of my enemies (when it's created) to swoop down in a sort of U motion where it'll hit the player if they don't react quick enough once the enemy (bat) leaves the screen it'll be destroyed and created again once certain requirements are met . The path will be the same each time so I don't need anything to do with AI. Unfortunately I'm only in grade 10 so calculus makes no sense to me and neither does the pathfinding libgdx documentation. I either need something similar to this (But written for libgdx) or some way to get a box2d body to move in an exact way.

My game is structured like this:

in Bat.java:

public class Bat extends Sprite {

private World world;

public Bat(GameScreen screen) {

    this.world = screen.getWorld();
}

In GameScreen.Java

public class GameScreen implements Screen {

private Bat bat = new Bat(this);

public World getWorld(){
    return world;
}

sentences:
How can I hide an object for one eye for the unity oculus rift DK2 platform? I am trying to build a game for my son for the Oculus Rift DK2 to help treat his lazy eye using Unity.

I need objects that:

Appear only to his left eye
Appear only to his right eye
Appear for both eyes.
(this helps force the brain to use both eyes together to form the complete scene)

How can I pull this off?

Thanks!

sentences:
Calculating projectile velocity from moving object I'm working on a top down space shooter and am having trouble with calculating/understanding the physics for projectiles launched from the space ship.

The ships have a velocity vector and a turret with rotation independent from the body of the ship. Currently projectiles are launched based on the turrets rotation by making a normalized vector then multiplying each component by a speed. However, this doesn't work when the ship is moving faster than the speed scalar.

Right now if the ship is going faster than the projectile speed scalar and the turret is aimed in the same direction as the ship's velocity, the projectile goes backwards (away) from the ship. Assuming there is no drag/gravity (very deep space), how should I go about handling projectiles?

sentences:
server/client architecture, how to combine physics data, scene graph and database over the network? I'm writting a C++ server and a C++ client for a rpg game.

The client is using OpenSceneGraph for rendering the 3D. RakNet is used for communication between the client and server.

At this time, the client and the server can communicate together. I have installed bullet for physics, but I didn't added bullet to the server nor the client.

The first reason is because I would like to know what you think about my idea to put the whole physics on the server and just sending to each clients, the updated quaternions for all actors view by each clients.

My second problem is, I never really used bullet, moreover never with a 3D engine. And I don't know if I need to build a scene graph on the server, or if I have to use another strategy. More precisely, most of such games seem to use a database. I using sqlite in some other C++ projects, so I don't have some question about that, but only about the fact that I never wrote a scene graph, so the question is, should I wrote one database scene graph ? or use a scene graph in memory and using a database to save the whole scene graph ? if so, should I do that every frame ?

sentences:
2D XNA C#: Texture2D Wrapping Issue Working in C#/XNA for a Windows game: I'm using Texture2D to draw sprites. All of my sprites are 16 x 32. The sprites move around the screen as you would expect, by changing the top X/Y position of them when they're being drawn by the spritebatch.

Most of the time when I run the game, the sprites appear like this:

and when moved, they move as I expect, as one element.

Infrequently they appear like this:

and when moved it's like there are two sprites with a gap in between them - it's hard to describe.

It only seems to happen sometimes - is there something I'm missing? I'd really like to know why this is happening.

[Edit:] Adding Draw code as requested:

This is the main draw routine - it first draws the sprite to a RenderTarget then blows it up by a scale of 4:

protected override void Draw(GameTime gameTime)
{
    // Draw to render target
    GraphicsDevice.SetRenderTarget(renderTarget);
    GraphicsDevice.Clear(Color.CornflowerBlue);
    Texture2D imSprite = null;

    spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointWrap, null, null);
    ManSprite.Draw(spriteBatch);
    base.Draw(gameTime);
    spriteBatch.End();

    // Draw render target to screen
    GraphicsDevice.SetRenderTarget(null);

    imageFrame = (Texture2D)renderTarget;

    GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
    spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointClamp, null, null);
    spriteBatch.Draw(imageFrame, new Vector2(0, 0), null, Color.White, 0, new Vector2(0, 0), IM_SCALE, SpriteEffects.None, 0);
    spriteBatch.End();

}

This is the draw routine for the Sprite class:

public virtual void Draw(SpriteBatch spriteBatch)
{
    spriteBatch.Draw(Texture, new Vector2(PositionX, PositionY), null, Color.White, 0.0f, Vector2.Zero, Scale, SpriteEffects.None, 0.3f);
}

sentences: A game community equivalent to IMDb Pro? Is there one resource that tracks and lists games in development, similar to what IMDb Pro does for films in development? MobyGames is good for post-mortem, who did what, but what about a resource that gives you intel on what games are in production?

sentences:
How to propertly send map to clients in MMO? I'm designing a game where the map has 1 M tiles. The game is simple, is a 2D game with low graphic requirements and without player movements, only change states, so I don't need to update player positions for example. But I have a doubt about how to synchronize the map.

When a client connects, the server should send him data related with proximity tiles. Each tile is represented with a different picture, so I can represent them with an id (integer). Developing in c#, each tile requires 4 bytes to store the id. So when the client connects, I have to send him (4 bytes*number of tiles). Sending data of 1000 tiles (a 30x30 grid), I'm sending 4 kb, and this is just in the first connection. When the client player moves, I have to send him more and more data, which has not a good performance.

On the other hand, if I store all the ids in the client, I will need to store 1M*4 byte = 4 mb per client. This is just to store tile ids, but it seems to be ok.

How can I design or optimize the data messaging ?

sentences:
How can I prevent small numerical advantages from dominating the balance of an encounter? I've been tinkering for some time with a game and I'm having a fair amount of trouble with something:

I have two characters, each of whom have attributes (about ten) in a range (between 1 and 20). I want to use these attributes to generate a 'roll' such that the higher roll wins that particular encounter. It's worth noting that the two characters are not damaging/defending each other. They're both rolling to see if they pass what I guess we could call a skill check. They're both rolling to pass/fail against a common value. They do not interact with one another.

However, when one of the characters has even a small numerical advantage, any formula I've come up with results in the ever-so-slightly superior one winning a huge majority of the time. This is undesirable.

I've tried weighting the 'most relevant' attribute for the test at 80% and the sum of the other attributes at 20%. I also tried comparing averages to produce a relative difference and using that to boost the weaker character. Both approaches resulted in the significant advantages I'm trying to remove (for example, if I run the encounter 5,000 times, it quite regularly produces one side winning all 5,000).

Adding a "luck" component only matters, it seems, if it's weighted somehow in favour of the lesser character, and I haven't hit a good balance there.

What approaches can I take to blunt the impact of a small numerical advantage but still preserve and increase that advantage as the relative gap in attributes increases?

Per the request, here are the specifics I have so far. Some things I haven't figured out yet so they remain generalities:

At the moment, the roll is generated as

0.8 * (mainAttribute) + 0.2 (1/3 * subAttA + 1/3 * subAttB * 1/3 subAttC)

At present, this produces numbers in the neighborhood of 4.0. Attributes are randomly generated between specified ranges. The current test uses one character with attributes from 2 to 4, and the opponent between 3 and 5. Predictably, this produce averages close to 3 and 4 respectively.

With this one-point advantage, I'd like to see the stronger of the two win in the area of 55% to 60% of the time, with this scaling up to winning about 80% of the time with an average attribute advantage of 5 or 6, 90% at advantages of 7 or 8, leaving some room for an unlikely win when the gap grows larger. I'd prefer not to ever have guaranteed wins, but perhaps things becoming very unlikely - to the tune of winning 99.5% or 99.6% of the time when the gap gets very large.

The current formula produces a non-random number. Randomness comes from the selection of which attributes are relevant. Not all of the attributes are used for each roll. It's possible for the one with the overall weaker attributes to be stronger in the areas relevant to that roll, and steal a win. But, predictably, it happens rarely.

My next attempt was to weigh their relative strengths, by taking an average of all of each's stats, dividing them against each other, and using that value to give a small boost to the lesser character. This smoothed things out a little, but still had a pronounced tendency to produce things like 5,000 wins for one guy out of 5,000 tries.

sentences:
How to get into video game writing? I'm an excellent writer with a talent for crafting characters, worlds, and plotlines of a unique and appealing nature. For some reason I'm studying computer science, but I know fiction writing is my true calling.

How can I find an entry-level job or internship developing the stories, characters, and dialogue for a video game? That would be my dream job, and I know I could make a superb showing.

Any tips on where I can find opportunities? Google searches turned up a ton of game design jobs, but I think that's different. I couldn't find anything related to writing.

Thanks!

sentences:
Setting up an "Oct-Tree" Instead of spam the same hard question like my previous one that Is difficult to get a minimum verifiable example for, I have decided to rework my path-finding and I can fix a lot of my issues with an oct-tree, not a true one but rather just subdividing my world into 8 or however many i specific in the function as this is all thats needed.

I already know what i need to do the stage after this, but I'm a not sure the best way to approach the subdivision so i get the right vector points of the subdivided cubes.

div = the number of cubes I want to create.

If I already have my 8 points,

    worldspace(Vector3 origind, float sized)
{
    //  face1
    ca = Vector3{ origin.GetX() + sized,origin.GetY() + sized, origin.GetZ() - sized };
    cb = Vector3{ origin.GetX() + sized,origin.GetY() - sized, origin.GetZ() - sized };
    //-----------------------------------------------------------------------------
    cc = Vector3{ origin.GetX() - sized,origin.GetY() - sized, origin.GetZ() - sized };
    cd = Vector3{ origin.GetX() - sized,origin.GetY() + sized, origin.GetZ() - sized };
    //  face 2
    ce = Vector3{ origin.GetX() + sized,origin.GetY() + sized, origin.GetZ() + sized };
    cf = Vector3{ origin.GetX() + sized,origin.GetY() - sized, origin.GetZ() + sized };
    //-----------------------------------------------------------------------------
    cg = Vector3{ origin.GetX() - sized,origin.GetY() - sized, origin.GetZ() + sized };
    ch = Vector3{ origin.GetX() - sized,origin.GetY() + sized, origin.GetZ() + sized };
};
~worldspace();

I can define my worldspace as worldspace(0,0,0,25) so thats a cube of 25 units, but then I want to divide it in the most efficient way into 8 = cubes lets say or so and make them into a vector.

I'd like the function to be able to specify how many subdivisions i want, I don't want a dynamic one, so I think. So I'm thinking I could do something along the lines of

semi pseudocode

createoct(div)
int divisions = div
for (int i = 1; i =< div; i++)
{
  dist of ca to cb / div ?
  store the new point
  do the same for the other points ?
}

Am I going about this the right way ? what would be the best way to calculate the subdivisions and store their 4 seperate points as one object ? perhaps a new class ?

sentences:
How do I randomly generate a top-down 2D level with separate sections and is infinite? I've read many other questions/answers about random level generation but most of them deal with either randomly/proceduraly generating 2D levels viewed from the side or 3D levels. What I'm trying to achieve is sort of like you were looking straight down on a Minecraft map. There is no height, but the borders of each "biome" or "section" of the map are random and varied. I already have basic code that can generate a perfectly square level with the same tileset (randomly picking segments from the tileset image), but I've encountered a major issue for wanting the level to be infinite: Beyond a certain point, the tiles' positions become negative on one or both of the axis. The code I use to only draw tiles the player can see relies on taking the tiles position and converting it to the index number that represents it in the array. As you well know, arrays cannot have a negative index. Here is some of my code:

This generates the square (or rectangle) of tiles:

    //Scale is in tiles
    public void Generate(int sX, int sY)
    {
        scaleX = sX;
        scaleY = sY;

        for (int y = 0; y <= scaleY; y++)
        {
            tiles.Add(new List<Tile>());

            for (int x = 0; x <= scaleX; x++)
            {
                tiles[tiles.Count - 1].Add(tileset.randomTile(x * tileset.TileSize, y * tileset.TileSize));
            }
        }
    }

Before I changed the code after realizing an array index couldn't be negative my for loops looked something like this to center the map around (0, 0):

for (int y = -scaleY / 2; y <= scaleY / 2; y++)
for (int x = -scaleX / 2; x <= scaleX / 2; x++)

Here is the code that draws the tiles:

            int startX = (int)Math.Floor((player.Position.X - (graphics.Viewport.Width) - tileset.TileSize) / tileset.TileSize);
        int endX = (int)Math.Ceiling((player.Position.X + (graphics.Viewport.Width) + tileset.TileSize) / tileset.TileSize);
        int startY = (int)Math.Floor((player.Position.Y - (graphics.Viewport.Height) - tileset.TileSize) / tileset.TileSize);
        int endY = (int)Math.Ceiling((player.Position.Y + (graphics.Viewport.Height) + tileset.TileSize) / tileset.TileSize);

        for (int y = startY; y < endY; y++)
        {
            for (int x = startX; x < endX; x++)
            {
                if (x >= 0 && y >= 0 && x <= scaleX && y <= scaleY)
                    tiles[y][x].Draw(spriteBatch);
            }
        }

So to summarize what I'm asking: First, how do I randomly generate a top-down 2D map with different sections (not chunks per se, but areas with different tile sets) and second, how do I get past this negative array index issue?

sentences:
Unity Inspector - Turn off script for a group? I have a large group of objects in Unity that can be grouped and for one instance I want to turn off a script on each one, for over 100 this can be tedious, can this be done group wise within the inspector? Instead of me going into each one and manually turning a script off?

I have tried doing this within a script but it will not work for this situation.

sentences:
How can I make 3D games in 4K that are a few megabytes? I would like to make 3D games in 4K that are a few Megabytes (MB) in download size.

Is there a way to use 3D Vector Graphics in games to reduce the file size ?
Or is there any other way to achieve the same level of compression achieved by Flash(.swf) and Swift3D ?

sentences:
Rotate 3D Model from a custom position I have a 3D Model like above in which i want to rotate it from a given location(pointed in red) but I can only rotate it from the middle. How can I rotate it from a custom point.

Edit:

I successfully able to rotate the model from the below position by getting the radius of the model and applying it to the world matrix

        Vector3 point = new Vector3(-radius, 0, 0);
        world = Matrix.CreateTranslation(-radius, 0, 0);

But now I cannot change the position of the object and it always centered in middle of the screen. I think that's because i applied the above code. How can I place it anywhere I want?

sentences:
How do I make a background fill the whole screen in Libgdx? I'm using this code to set a 800x420 image to be full screen:

public void show() {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();
    camera = new OrthographicCamera(1, h / w);
    batch = new SpriteBatch();
    texture = new Texture(Gdx.files.internal("images/splashatlas/splashatlas1.png"));
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    TextureRegion region =
    new TextureRegion(texture, 0, 0, 800, 420);
    sprite = new Sprite(region);
    sprite.setSize(0.9f,
            0.9f * sprite.getHeight() / sprite.getWidth() );
            sprite.setOrigin(sprite.getWidth() / 2,
            sprite.getHeight() / 2);
            sprite.setPosition(-sprite.getWidth() / 2,
            -sprite.getHeight() / 2);
}

public void render(float delta) {
    Gdx.gl.glClearColor( 1f, 1f, 1f, 1f );
    Gdx.gl.glClear( GL20.GL_COLOR_BUFFER_BIT );
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    sprite.draw(batch);
    batch.end();
}

But on real device it looks like this:

I tried to setSize with different parameters:

    sprite.setSize(1.0f,
            1.0f  );

Now it's fullscreen, but it's really stretched:

What is the way to set a background to be full screen? I want it to look like this:

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:
Supporting user-made content/add-ons I'd like to start allowing for user-made content in my game. I'd like users to be able to add their own levels, entities and quests (along with all of the assets that are required). However, I'm unsure of the best way to do so.

Currently, the game loads its levels, entities, etc. from a JSON file. This file is embedded into the executable, and whenever the user starts a new game, it is created from this file. When the new game is saved, it is saved as a JSON file of the same format.

As an example, let's say that an add-on would be a folder containing the following:

A JSON file describing any new levels, new entities, new quests.
A single script file with one function that is called to make any modifications to the default game content, since it's not directly available. This would allow the addition of portals to new levels, characters to initiate new quests, etc.
Audio, images, scripts for entities.

An editor will be provided in order to create the add-on; the author can create entities, levels, etc., so that they don't need to edit the JSON file manually.

Should the player be able to:

Load add-ons at any point during the game (game == JSON save file)?
Remove an add-on? Would the add-on author (or I) have to keep track of every new level, entity and quest that the add-on added and remove them? What if the entity is already removed?

It seems that the safest way to allow add-ons is to mandate that they be added at the beginning of a new game and cannot be removed once added. If an add-on makes a new weapon available, for example, removing the add-on once the player has already picked up the weapon would leave the game buggy. However, this seems very prohibitive.

Is this a sane approach? Is there a better one? How much responsibility should I leave with the add-on author? How have games that were designed to be customised handled this?

sentences:
ScriptableObject not saving data in PC Build I am using ScriptableObject to save state of my game.
Currently Saving:
- Selected object
- Object count

It works fine in editor, but when I make a PC build the data doesn't saves and everything I launch the PC build the game is in default state.

My GameConfig ScriptableObject is located in the Resources folder, can anyone help out exactly what the issue can be? The scriptable object is serialized and so are the fields in it.

Unity version: 2017.3.1p1

sentences:
How to "properly" display a 2d sprites in a 3d environment? I would like to show "the classic" missile lock viewfinder (the target symbol) of a war aircraft.
So the target symbol must follow the enemy, and became red when "lock" it.
So i thought simply to Show the 2d sprite centered on screen (x and y = screen.height and width /2 )  but, depending of the Z , the sprite became bigger (near camera) or smaller (far from the camera).

How to display a 2d sprite indipendent from Z axis ?

Thanks

sentences:
Admob is load failing by No Fill error I’m using official admin plugin for Unity implementing Reward video.

But it’s only working for test unit id, when I replacing it to my own unit id, it just failing load by error “No Fill”.

Even when I add test device, still happening the issue.

How can I fix this?

sentences:
How to create scrollable text in AndEngine? I'm creating some tutorial text that the user should be able to scroll.

Is there any way to make vertical scroll in AndEngine so that we can easily view all the content by scrolling up and down?

sentences: Glow shader limited by the texture area I'm working on a glow shader (for 2D engine Futile relying on Unity). It works OK but the effect is limited by the texture area. Except from adding a lot of empty pixels around the textures (which would result in un-optimized/too big texture atlases), is there a better solution to cope with this problem? I'm quite new with shaders so maybe this is a classic problem with some well known solutions, maybe I'm not searching with the right keywords.

sentences:
Libgdx storing rendered frames quickly to use them later I have implemented a gif-button for my libgdx game that allows the player to store the last few seconds of gameplay as a gif.

It works by storing frames in memory, and encoding them into a gif if the player presses a Button.

The problem is, that my method of storing the frames takes around 20ms, far to slow for my 60fps game. This leads to stuttering.

Currently im storing the frames like this:

private static LinkedList<Pixmap> frames = new LinkedList<>();

private static float delay = 0;
static Pixmap pixmap;
static int width = Gdx.graphics.getWidth();
static int height = Gdx.graphics.getHeight();

// called every frame
public static void act(float delta) {
    delay -= delta;
    if (delay <= 0f) {
        // the actual storing of the frame. ~20ms
        Gdx.gl.glPixelStorei(GL20.GL_PACK_ALIGNMENT, 1);
        pixmap = new Pixmap(width, height, Pixmap.Format.RGBA8888);
        Gdx.gl.glReadPixels(0, 0, width, height, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixmap.getPixels());
        frames.add(pixmap);

        // remove old frames and reset delay
    }
}

I have tried to allocate as little memory as possible but its still way to slow.

Concurrency is not an option for this approach since the gl methods need to be called on the rendering thread.

I would be very thankful for a solution or ideas for other possible ways to achieve my goal.

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:
Design pattern for world objects caching I'm developing in Unity a voxel-generated terrain and I'm trying to find an extensible design pattern for voxels and more in general, world objects caching. E.g. storing in a 'ChunkCache' class only the nearest Chunks and updating it after a set amount of time

As of now, I'm using a static World class with the following members in pseudocode

static class World
   Player reference
   Enemies reference
   WorldCache reference
   etc.

The WorldCache instance contains a list of objects all deriving from the same base class 'Cache'. The implementation so far calls worldCache.update() method with an enum indexing this list of 'Cache' objects

WorldCache class
   List<Cache> differentTypesOfCache;

   void update(Enum whichCache) {
      differentTypesOfCache[whichCache].update();
   }

The problem I'm facing with this design pattern is different types of derived Cache classes need different types of information (e.g. a ChunkCache class will judge wether a chunk needs to be removed from the cache depending on the player's distance from the center of the chunk, whereas other types of derived Caches may need differing information) and as of now the only way to gather this information is to directly query the static World class members.

Also if a certain Cache object requires information from another Cache object, it starts to look spaghetti.

Is there a completely different pattern better suited for this scenario, or a way to modify the existing one for the better?

sentences:
Words to describe stat stacking behavior? A character has a series of attributes.

Char {
    BaseStrength 1
    BaseHealth 100
    BaseLuck = 50
    BaseCharm = 20
}

and items will grant them modifiers

item0 {
  Modifier {
    Charm: + 1
  }
}

itemA {
  Modifier {
    Strength: ++ 1
  }
}

itemB {
  Modifier {
    Health: * 2
  }
}

itemC {
  Modifier {
    Luck: ** 1
  }
}

The way I was planning the operations + ++ * ** to work
was if a player has 2 of each type of item. it would stack as follows.

finalCharm = BaseCharm + item0.Charm (no stacking)

finalStrength = BaseStrength + itemA.Strength + itemA.Strength

finalLuck = BaseLuck + BaseLuck*(itemC.Luck + itemC.Luck)

finalHealth = BaseHealth + (BaseHealth * itemB.Health) + (BaseHealth * itemB.Health)

All except charm could be considered 'stacking' buffs.

itemA stacks additively, items B & C stack multiplicative.

How can I describe the stacking behavior differences between B & C to the player using words?

sentences:
Blending for multiple lighting passes I am attempting to perform shadow mapping with deferred shading, using the following code:

for (auto light : m_ShadowDirs)
{
    //render shadow map
    shadowDirPass(m_ShadowBuffer, light);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE);
    // activate shader for non shadow casting lights
    m_ShadowDirLightShader.activate();
    m_FrameBuffer.LightingPass(m_ShadowDirLightShader);
    m_ShadowDirLightShader.setUniform(("WSCamPos"), m_ActiveCamera->getPosition());
    m_ShadowDirLightShader.setDirLight(("dirLight"), static_cast<DirLightData&>(light->getLightData()));
    m_ShadowDirLightShader.setUniform(("ShadowTransform"), m_ShadowDirMatrix);
    //bind depth map
    m_ShadowDirLightShader.bindTexture(("shadowMap"),5, m_ShadowBuffer.getDepthTexture());
    //render
    renderQuad();
    glDisable(GL_BLEND);
}

shadowDirPass(m_ShadowBuffer, light); Simply renders the geometry to the shadow map.
m_FrameBuffer.LightingPass(m_ShadowDirLightShader); Just binds the Gbuffer textures.

I have two directional lights in the scene, one with red colour (1,0,0), and one with blue colour (0,0,1)

One would think that the scene would be coloured purple, but no.
Every time I render (for each) light, the image in the target framebuffer is overwritten completely, instead of blended together. To illustrate this, see the following images:

Above is the scene with a single red light.

Above is the same scene, with a single blue light, but from a different direction. (See shadows).

When I enable both lights, the result is as if the first light was never used, though by stepping through the code, I can confirm that it is definitely going through a render cycle.

I'm pretty sure than I've messed up the blending somehow, but I could use some guidance.

sentences:
Color Based Collision Javascript (Cocos2d-js) I'm looking to make an isometric game so my partner designed the isometric map (jpg image) along with the map objects (png) on Adobe Illustrator. The thing is I would like to set the player path based on color, for example if the terrain is white the player can go through, if it's black then the player is not allowed to pass. Is this a viable method to do this or are there better methods? Also I'm using Cocos2D-js so my coding is JavaScript

I would appreciate any suggestions.

sentences:
Align UI element to gameObject in 2D I have a 2d game where I want to display UI element perfectly aligned to specific gameObjects.

I have an ortographic camera and I used to Camera.main.WorldToScreenPoint() function giving it the gameobject position modified, for instance, by +1 on X component to get the UI element on its perfect right.

My problem is that the element is not on the gameObject's perfect right, but sensibly above. See this schema:

Expectation:

G -> UI element

Reality:

---> UI element
G

I tried also to use the WorldToViewportPoint() but it's not giving the desired result.
So, I think this is the right way to go but I can't guess what I'm missing.
Any clue?

EDIT:
After a little bit more observations it seemed that the UI element alignment depends somehow on it's distance from the center of the screen (of the camera viewport I guess), so that if the gameObject is below half height the UI element y position won't be on the perfect right but slightly below it and if above half heigth will be slightly above the perfect right. Same for x coordinate. Is there a way I could control this?

sentences:
Unity Event Register / Deregister and Scene Unload From what I understand in C#, normally when you register an event, it maintains a reference to the object of the containing method, so in order for garbage collection to pick up an object, you need to first deregister it.
My question:  In unity when one scene is loaded and another is unloaded, do I need to first clean up and deregister any registered events, or does the scene unload process destroy objects and remaining references?

sentences:
How to use a decal / logo / tatoo texture on a object or character? It appears I've misunderstood the purpose of Standard Shader's "Secondary Texture" options.

If I wish to map temporary details to an object, what is the Unity-appropriate way to do this? I am referring to effects like the following:

Tatoos
Blood Spatters
Logos
Decals
etc...

I'm aware that I could have two materials, but this is render-inefficient, and I avoid hackish workarounds when I can.

Standard practice?

EDIT:

Per the comment below, I will elaborate slightly:

In my specific case I'd like to have one of two scenerios:

1: Areas where a logo can be inserted (player created), pre-uv assigned.
2: Drag/drop logo placement, similarly, but without constraints. This would mean of course passing UV boundaries.

sentences:
Google Play Games Signs Out Automatically without Internet Unity I am using this in my game to implement games saving and loading.
I have also tried the basic sign in process by using the following start function :-

{

        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder ()
        // enables saving game progress.
        .EnableSavedGames ()
        .Build ();

        PlayGamesPlatform.InitializeInstance (config);
        // recommended for debugging:
        PlayGamesPlatform.DebugLogEnabled = true;
        // Activate the Google Play Games platform
        PlayGamesPlatform.Activate ();

        Social.localUser.Authenticate ((bool success) => {
            if (success){
                MyAutoSave.isLoaded = false;
            }
        });
    }

}`

I can sign in on google play games without any issues. Soon after that if I quit the game and start again without data connection, it gets authenticated without any issue.
If my data connection remains off for say more than an hour, and I start the game without Internet connection, there is no authentication whatsoever. If I close the game and start again soon after that, it gives me that google play games sign in popup. So what i can conclude is that it signs out automatically after some time if there is no Internet available. Is there any fix for this.?
Thanks

sentences:
DRY 0-bandwidth-overhead-serialization in C#: virtual, delegates or reflection? I'm (de)serializing some datastructures for a network-multiplayer game, and for each datastructure that's to be (de)serialized, I want to define the order of (de)serialization only once for maintainability without any additional bandwidth overhead, and as little performance cost and extra typing as possible.

I can use C#'s abstract class methods to achieve my goal, but there's several problems with doing so:

performance: adding an additional abstract method call to each (de)serialization operation isn't ideal
extra typing: I have to needlessly initialize all variables I'm deserializing because C# won't allow me to pass "ref" and "out" parameters interchangeably

How can I avoid duplicating the definition of a datastructure's (de)serialization while also avoiding some or all of the above issues, and continuing to avoid any additional bandwidth cost?

(ProtoBufs and BinaryFormatter both seem to use some additional bandwidth for metadata to describe the "payload" data, and XmlSerializer, DataContractSerializer and NetDataContractSerializer are all xml based and therefore more bandwidth intensive than a straight binary serialization. I also toyed with delegates and reflection, but this solution came to me most readily):

public struct ControllerSnapshot
{
    public Vector2 m_lStick;

    static private void Op(ref float lStickX, ref float lStickY, Op<float> op)
    {
        //define (de)serialization order here once and only once
        lStickX = op.Invoke(lStickX);
        lStickY = op.Invoke(lStickY);
    }
    public ControllerSnapshot(uLink.BitStream bitStream)
    {
        OpRead<float> opRead = new OpRead<float>(bitStream);
        float lStickX,lStickY;
        lStickX = lStickY = 0.0f;//2.can't use "out"; have to match Op's "ref" params
        Op(ref lStickX,ref lStickY,opRead);

        m_lStick = new Vector2(lStickX,lStickY);
    }
    public void Serialize(uLink.BitStream bitStream)
    {
        OpWrite<float> opWrite = new OpWrite<float>(bitStream);
        Op(ref m_lStick.x, ref m_lStick.y, opWrite);
    }
};

//in order to make the above work this needs to be defined:
abstract class Op<T>
{
    public Op(uLink.BitStream bitStream)
    {
        m_bitStream = bitStream;
    }
    abstract public T Invoke(T arg);

    protected uLink.BitStream m_bitStream;
}
class OpRead<T>:Op<T>
{
    public OpRead(uLink.BitStream bitStream) : base(bitStream) { }
    override public T Invoke(T arg)
    {
        return m_bitStream.Read<T>();
    }
}
class OpWrite<T>:Op<T>
{
    public OpWrite(uLink.BitStream bitStream) : base(bitStream) { }
    override public T Invoke(T arg)
    {
        m_bitStream.Write<T>(arg);
        return arg;
    }
}

//by contrast, the "obvious" code duplicates the order of (de)serialization, which I
//want to avoid, especially as (de)serialization becomes increasingly complex:
public ControllerSnapshot(uLink.BitStream bitStream)
{
    float lStickX,lStickY;
    lStickX = bitStream.Read<float>();
    lStickY = bitStream.Read<float>();

    m_lStick = new Vector2(lStickX,lStickY);
}
public void Serialize(uLink.BitStream bitStream)
{
    bitStream.Write<float>(m_lStick.x);
    bitStream.Write<float>(m_lStick.y);
}

sentences:
Nested Sprite Batch and background draw my code looks something like this:

        graphicsDevice.Clear(Color.Black);
        spriteBatch.Begin();
        spriteBatch.Draw(contentLoader.VerticalGradient, tileSafe, null, Color.DarkGreen, 0, Vector2.Zero, SpriteEffects.None, 0.5f);

// snip a lot, including drawing stuff on the sprite batch.

        // create a new sprite batch (for snipping)
        var initialViewport = InitialBatch.GraphicsDevice.Viewport;
        InitialBatch.GraphicsDevice.Viewport = new Viewport(displayRectangle);
        var newBatch = new SpriteBatch(InitialBatch.GraphicsDevice);
        newBatch.Begin();

// draw stuff on the new batch

        newBatch.End();
        InitialBatch.GraphicsDevice.Viewport = initialViewport;

// more stuff on the original batch

        spriteBatch.End();

My problem is the third line of code I just added. I want to have a "background" on what I'm drawing (so it's not just black). So I draw it first.

Before I added that third line, everything worked great. But when I added it, everything drawn on the new/inner batch doesn't get displayed. If I draw it all on the normal sprite batch, it gets drawn (but doesn't get snipped properly), if I remove the drawing of the new texture, then the inner spritebatch works fine.

Additional things I've tried

I've tried moving the depth of the "background" texture, and when I do, it either makes the background disappear, or it makes the inner sprite batch stuff disappear. I want both.

Is there any way I can get both? Am I making sense? Is this inner sprite batch thing just crazy? I thought I used a standard example to do snipping, but maybe I got lucky and stumbled upon something crazy that just happens to work?

sentences:
Managing many draw calls for dynamic objects We are developing a game (cross-platform) using Irrlicht. The game has many (around 200 - 500) dynamic objects flying around during the game. Most of these objects are static mesh and build from 20 - 50 unique Meshes.

We created seperate scenenodes for each object and referring its mesh instance. But the output was very much unexpected.

Menu screen: (150 tris - Just to show you the full speed rendering performance of 2 test computers)
a) NVidia Quadro FX 3800 with 1GB: 1600 FPS DirectX and 2600 FPS on OpenGL
b) Mac Mini with Geforce 9400M 256mb: 260 FPS in OpenGL

Now inside the game in a test level: (160 dynamic objects counting around 10K tris):
a) NVidia Quadro FX 3800 with 1GB: 45 FPS DirectX and 50 FPS on OpenGL
b) Mac Mini with Geforce 9400M 256mb: 45 FPS in OpenGL

Obviously we don't have the option of mesh batch rendering as most of the objects are dynamic. And the one big static terrain is already in single mesh buffer. To add more information, we use one 2048 png for texture for most of the dynamic objects. And our collision detection hardly and other calculations hardly make any impact on FPS. So we understood its the draw calls we make that eats up all FPS. Is there a way we can optimize the rendering, or are we missing something?

sentences:
Animate from end frame of one animation to end frame of another Unity3d/C# So I have two legacy FBX animations; Animation A and Animation B.

What I'm looking to do is to be able to fade from A to B regardless of the current frame A is on.

Using animation.CrossFade() will play A in reverse until it reaches frame 0, then play B forward.

What I'm looking to do is blend from the current frame of A to the end frame of B. Probably via some sort of lerp between the facial position in A and the facial position in the last frame of B.

Does anyone know how I might be able to accomplish this? Either via a built in function or potentially lerping of some sort?

EDIT:
Does anyone perhaps know of a way to read bone positions of an animation at a certain frame? Perhaps if I could read that I could fake animations by doing Vector3 lerps.

sentences:
Finding vector from a vertex to a plane I am trying to implement Dual Contouring, following serveral sources, mainly http://www.sandboxie.com/misc/isosurf/isosurfaces.html
but now I want to implement finding the feature point as explained in this post https://gamedev.stackexchange.com/a/83757/49583

It begins with

  The QEF you are minimizing is simply the total distance to each of the planes that are defined by the intersection point/normal pairs for that cell.

I do have the intersection point, which is just the edge vertices averaged by their densities.
I got the normal by averaging the normal of the edge vertices.
I do it like this :

        //calculate normals by gradient of surface, d(x,y,z) = density function, d0 = density at p0, d1 = density at p1
        Vector3 n0 = new Vector3(d((int)(p0.x+1),   (int)p0.y,      (int)p0.z       ).Value - d0,
                                 d((int)p0.x,       (int)(p0.y+1),  (int)p0.z       ).Value - d0,
                                 d((int)p0.x,       (int)p0.y,      (int)(p0.z+1)   ).Value - d0);
        Vector3 n1 = new Vector3(d((int)(p1.x+1),   (int)p1.y,      (int)p1.z       ).Value - d1,
                                 d((int)p1.x,       (int)(p1.y+1),  (int)p1.z       ).Value - d1,
                                 d((int)p1.x,       (int)p1.y,      (int)(p1.z+1)   ).Value - d1);

        this.normal = Vector3.Lerp(n0,n1,m);

My plane is this :

Vector4 plane = new Vector4(edge.normal.x, edge.normal.y, edge.normal.z, Vector3.Dot(edge.point, edge.normal));

And I have a vertex at (x,y,z),

  Basically, you start the vertex in the centre of the cell. Then you average all the vectors taken from the vertex to each plane and move the vertex along that resultant...

How do I get the vector from the plane to the vertex?

sentences:
Box2D strange collisions (jitter) on sharp edges I'm currently developing 2D side scroll game with Libgdx + Box2D.
And I'm facing some problems with ChainShape (the ground) and PolygonShape (the cart body) collisions.
Please look at this video: http://www.youtube.com/watch?v=gljgMn8lYfs

As you see the PolygonShape jitters(?) when collides with ChainShape.
BUT it only happens on sharp edges!

What I've tried:

Increase/decrease velocityIterations/positionIterations. Didin't
help. Currently they are set to 10/8 (as shown in video).
Turn off CCD. Didin't help. Currently is turned on.
Set velocityThreshold to zero. Didin't help. Currently is default - 1f.
Set restitution/friction values to zero. Didin't help.

Any suggestions why it's happening and how can I fix/avoid it?

sentences:
Why do I get an exception when accessing my sprite members in this fashion? I'm getting a NullReferenceException error on the line where I do new Vector2(...).

I think the problem is with the variables I'm using even though they're working to control the player sprite, so surely they can't be null, right? That is, however, in a different class and is initialized at the top of this one.

Here is the method in question:

public void Shoot()
{
    //if bullet delay resets then shoot
    if (bulletDelay >= 0)
        bulletDelay--;

    //if bullet delay is 0 then create a bullet at player bulletPosition
    if (bulletDelay <= 0)
    {
        //Here I create the new bullet passing in the texture and then modifying the bulletPosition were the bullet will appear from
        bullets newBullet = new bullets();
        bulletPosition = new Vector2(mySprite.imgX, mySprite.imgY);

        newBullet.isVisible = true;
        //These two lines mean that you can have no more that 20 bullets on screen at once
        if (bulletList.Count < 20)
        {
            bulletList.Add(newBullet);
        }
    }

    //reset bullet delay
    if (bulletDelay == 0)
        bulletDelay = 10;
}

bulletDelay is so the player can't spam the shoot button and have it be too easy. I tried to add a breakpoint on that line, when I run the program and hit the space bar that runs the Shoot() method the program stops and tells me about the error. When I hover over though it still says they are null.

I had the instances of the classes in the following code below. I've changed it so they are in the Shoot() method and all seems to well however I'm curious as to why the below code wasn't the correct way to do it:

public void Initialize()
{
    mySprite = new PlayerSprite();
    bulletList = new List<bullets>();
}

sentences:
The best way to store and protect game data I'm writing a sandbox-type game and i'm looking for a good way to store game data. I tryed Lua and plain text files, but the have a big minus - player can edit them his self!

So how do I protect data from player? Thank you!

sentences:
Detecting collision with walls (is this a good solution?) I'm trying to make the collision smooth (it must open the animation, but not move the character).

I've implemented 'fake positions':

int step = 20;
fake_left_x = x-step;
fake_right_x = x+step;
fake_up_y = y+step;
fake_down_y = y-step;

While updating player position, I'm checking if fake positions are out of the screen. If yes - nothing happens.

Is this a good solution? What do you think?

sentences:
How to get consecutive voice clips to sound natural In the game I'm working on I have to play several short consecutive voice-clips to form a complete sentence. Example (each [] bracket is a different voice clip):

[Bob here,] [we're at]  [some town] [and are on our way to] [some city].

Stitching together different voice-clips like this makes it sound stilted and disconnected. This is because there are unnatural pauses when switching clips, and the pitch and tone of the speaker changes.

My current efforts include two methods for removing the unnatural pauses:

starting the next clip early if a silence is detected at the end of the preceding clip
skipping the first few milliseconds of the new clip up to the first detected 'sound'.

These work OK at removing the unnatural pausimh, but detecting what 'silence' is is difficult, especially when dealing with multiple voice-actors and microphones.

How could I make stitching together voice-clips sound more natural? Any advice would be appreciated. This has to be done in real-time inside the game (I'm using Unity), and can't be pre-processed or done ahead of time.

sentences:
Difference between texture arrays and multiple single textures? I've just learnt that DirectX 10 and above have a feature called "texture arrays". Which, basically, is just a normal array of textures (shader resources) which in a shader is declared like:

Texture2D myTextures[2];

What I've been using so far is 2 multiple separate textures:

Texture2D myFirstTexture;
Texture2D mySecondTexture;

Is there any practical (performance, memory etc...) difference between the two?

sentences:
Find the footprint of an isometric entity I'm working on making a 2D isometric engine in Java. I'm getting into collision detection and I've hit a bit of a problem.

Characters in-game are not restricted to movement from tile to tile - they move freely. My problem is that I'm not sure how to stop a player from colliding with, say, a crate, without denying them access to the tile.

For instance, say the crate was on .5 of a tile, and then the rest of the crate was off the tile, I'd like the player to be able to move on to the free .5 of the tile instead of the entire tile becoming blocked.

The problem I've hit is that I'm not sure how to approximate the size of the footprint of the object. Using the image's dimensions don't work very well, since the object's "height" in gamespace translates to additional floorspace being taken up by the image.

How should I estimate an object's size? Mind, I don't need pixel-perfect detection. A rhombus would work fine.

I'm happy to provide any code you might need, but this seems like a math issue.

sentences:
How can I make RPC function calls in Unity? I am making a multiplayer game. I am sending score via the server and client but I want to be sure that can I call an RPC function of a script from any other script.

For example, say Table_Manager as a script which contains a get_score function and I want to call it from a game_stat script like Table_Manager.networkview.rpc("Table_Manager", rpcmode.all, 25); The get_score method would look something like:

[RPC]
public void get_score(int new_score)
{
   // ...
}

How can I accomplish that?

sentences: Is it OK to use player supplied music in my game? Is it copyright infringement if I create a game based around music beats but allow the players to use their own mp3 files?

sentences:
swift fast enumeration on MDLAsset not working I load an MDLAsset from my main bundle and get an compile error when fast iterating the asset object.

Type 'MDLAsset' does not conform to protocol 'SequenceType'

Documentation says it does support fast enumeration:

https://developer.apple.com/library/prerelease/ios/documentation/ModelIO/Reference/MDLAsset_Class/

Iterating over the asset is rather simple

for obj in asset {
    ...
}

I am using XCode7.1.1 and Swift2, is there something broken or what is it I am doing wrong?

sentences:
Implementing a motorized hinge joint I have a 2d physics engine, with three boxes: "body", "left wing" and "right wing".
The wing boxes are connected to the body using a hinge joint. The physics world has no gravity.

I'm attempting to rotate the wings around their hinge connection, as if the joint is motorized but I'm not exactly sure how to achieve that. If I exert force with a downward vector on the center of the wings, the body itself flies down. This is undesirable. With an actual hinge motor, only the wings will rotate about the hinge, affecting the body only when they hit it.

Which forces should be added to the wings, and at which origin points?

I'm using Phaser.io, with P2.js physics, but the question is platform-agnostic.

sentences:
How do I get the GUI to draw above the kinematic bodies when their z_index is changed? Currently the Labels in the GUI are below the player and other objects, so the player appears above them.
How can this be fixed?

extends Node
var load_1 = true

    onready var level = preload("res://scenes/levels/Level.tscn")

    var Level = null

    func _ready():
        Level = level.instance()

        add_child(Level)
        move_child(Level, 0)
        VisualServer.canvas_item_set_z_index($GUI/Label3, 4000)
        print("I'm here")

    func _process(delta):
        getallnodes(self)
        pass

    func set_z_index(node):
        for N in node.get_children():
            if N.get_class() == "KinematicBody2D":
                N.z_index = N.position.y

    func getallnodes(node):
        for N in node.get_children():
            if N.get_child_count() > 0 and N.get_class() != "RigidBody2D" and N.get_class() != "KinematicBody2D" and N.get_class() != "StaticBody2D":
                getallnodes(N)
            else:

                if N.get_class() == "KinematicBody2D" or N.get_class() == "RigidBody2D":
                    setZOrder_kine(N)
                    print("- "+N.get_name())
                if N.get_class() == "StaticBody2D":
                    setZOrder_kine(N)
                    print("- "+N.get_name())
                elif N.get_class() == "Sprite":
                    setZOrder(N)
                    print("- "+N.get_name())

    func setZOrder_kine(node):
        for N in node.get_children():
            if N.get_class() == "Sprite":
                var myPos = N.get_global_transform().get_origin()
                var mySize = N.get_texture().get_height()
                var bottomOfSprite = (mySize*N.get_scale().y * N.get_parent().get_scale().y)/(2 * N.vframes)
                N.get_parent().z_index = (myPos.y+bottomOfSprite)

    func setZOrder(N):
        var myPos = N.get_global_transform().get_origin()
        var mySize = N.get_texture().get_height()
        var bottomOfSprite = (mySize*N.get_scale().y)/(2 * N.vframes)
        N.z_index = (myPos.y+bottomOfSprite)

    func _physics_process(delta):

        if(Level.get_node("Player")):

            $GUI/Label.text = "Velocity: " + str(Level.get_node("Player").velocity.length()) + ", " + str(Level.get_node("Player").velocity.x) + ", " + str( Level.get_node("Player").velocity.y)
            $GUI/Label2.text = "Position: " + str(Level.get_node("Player").position.x) + ", " + str(Level.get_node("Player").position.y) + ", " + str(Level.get_node("Player").z_index)
            $GUI/Label3.text = "Sword: " + "rotation " + str(Level.get_node("Player").rotation)
            $GUI/Label4.text = "stamina" + str(Level.get_node("Player").stam.current) + "attack_charge: " + str(Level.get_node("Player").stab.charge.current) + "countdown: " + str(Level.get_node("Player").stab_countdown[0]) + "cooldown: " + str(Level.get_node("Player").stab_cooldown[0])

sentences:
"Pixel-perfect" camera positioning in 2d game I am writing a 2d game using LibGDX. The view to the game world is top-down. The game shows a grid of lines, which looks nice when the camera is at its initial position (0,0).

The problem is now that when I move (shift) the camera left/right/up/down this grid sometimes becomes a bit blurry, so the lines do not look perfectly sharp any more.

I assume this is because in these cases the grid lines are not exactly on screen pixels, but somewhere in between. Is this correct?

In any case: Are there any "best practices" how to address this problem (not necessarily LibGDX-specific)?

sentences:
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:
Can you specify which VBO/EBO to use with glDrawElements? I'm creating a voxel-like game. I'm not sure if I am using VBO/EBO's correctly. I am creating a new VBO & EBO for every chunk. This is done once, but chunks call a render function in every block inside, and the block calls glDrawElements (Is there a more efficient way?). How can I specify which VBO & EBO each is supposed to use? Is this possible?

Thank you!

sentences:
something very strange in one of the collisions with OpenGL 3.3 I'm developing a game engine in C, and I came across a problem that left me kind of lost. When I was developing my collision system, I saw something very strange in one of the collisions. During the collision, a white line appeared, well to the legs of the sprite. I have no idea why. I'm using OpenGL 3.3, without additional use of third-party libraries. Before the collision system, I never noticed that, so I think there's something to it. Anyone know what it could be?
NOTE: The sprite that presented the problem was the sprite of the player that moves, in time 1:07. I could not cut the video, because for some reason the video editor sums up with the bug when it rendered the video (maybe because it was small it took as a noise). If you can not see it, reduce the speed to 0.25 on youtube and set to 720p to leave the sharp image!
https://www.youtube.com/watch?v=uC1sQagC_Bw&feature=youtu.be&t=67&fbclid=IwAR2y3w-4w28OwIg27ENZ6vdWvJUpeYgLuGor33uBZ4Z63AYn83QHHKaNeR4
responding to user1118321:

there is the print, it's very subtle, it appears quickly in one of the frames underneath the player. The problem does not seem to be the sprite, because in the surrounding frames, the "white line" does not appear, only at that specific point, and it is a bug that does not always appear, have to try many times to be able to reproduce again

sentences:
AI, Pathfinding - Searching Behavior I'm developing a top-down 2D game mostly based off a tilemap/grid. The player will be able to build structures on this grid while other objects like vehicles will move around freely. I've been working on the AI for awhile and have struggled with coming up with a searching method.

The basic behavior I'm looking for is that of a dog barking at someone inside a house. When the person inside runs to the left out of view, the dog will run left and could very well run around the whole house trying to reach/see the person.

Standard pathfinding algorithms look for shortest paths or near shortest paths. But the behavior I'm looking for is more dynamic and isn't about finding a path as much as searching for a way in.

The example I'm working with currently, as seen below, depicts a zombie that has sight of a player inside a building through a window. The player then moves to the right out of view. The desired effect would be that the zombie runs to the right and all the way around the building until finding the player again or giving up. Note that I don't want the zombie to go left and in through the door (which would be the shortest path) to reach the player.

I've fiddled with ideas about using steering behavior, weighted tiles based on distance, wall-following, etc. and nothing has really made sense yet. I'm looking for any thoughts on ways to go about this kind of behavior driven searching.

sentences:
What would be the best way to create a cone representing the field of view of an entity in Godot Engine? I would like to create a game in which PC and NPCs would have a field of view, shown as a cone in the front of the entity (see picture for an example).

As it would be the first game I develop using Godot Engine, I am wondering what would be the best way to implement this feature. Also if possible, in later versions of the game, I would like to be able to make the decor stop the field of view, like what is done in Monaco: What's yours is mine.

Would you have any recommendation?

sentences:
How to make the inside of a cube accessible I have a cube, it is made up of smaller cubes each making the big cube 8x8x8. The cube is the map. The player of the game needs to be able to appraise the entire map and understand it without having to zoom through the inside of the cube since he may need to see opposite ends and interior at the same time.

How can I make this cube easy for the player to access?
Requirements:

Player must be able to see any 2 cubes at the same time, including the interior.
Player must be able to understand depth of cube
Player must be able to click on interior cubes.
Player must be able to differentiate between allied/enemy soldier, and soldier class.

if it helps at all, imagine if the rubiks cube had more cube inside it, obviously in the real world, we have no way to control them, but in a game, how would i allow someone to see and manipulate several at one time. Note: not a realtime game.

sentences:
How to make rhythm game long notes in Unity? I'm making a rhythm game for a university course and I can't figure out a way to make the long/sustained notes. For reference, this is what I mean taken from Guitar Hero:

I already have a system working for regular notes. The way I do it is that the notes are stored in an external file as numbers which represent the absence or presence of a note as well as what type of note it is, separated into musical bars:
000
010
020
001

There are three lanes for the notes to be, and this means that in this particular bar there are notes wherever it's not 0 (with the numbers being different types of notes).
I had thought of using this system to create long/sustained note start and end markers (say 3 and 4) and that create another game object which would be the line between the start and end markers. But the way my note generator works is that the notes are not all generated at once because that'd be pretty heavy.
Instead, the notes are generated at a certain time taking into account its speed so that it's instantiated and will reach the player's activator when it's supposed to. The following is a part of my note generator code, put in the Update method:

// if current song time - time offset is greater than
// time taken for all executed bars so far
// spawn the next bar's notes
if (songTimer - _timeOffset >= (barExecutedTime - barTime))
{
   StartCoroutine(PlaceBar(noteData.bars[barCount++]));

   barExecutedTime += barTime;
}

And here is the PlaceBar coroutine:

// go through all notes in a bar
// creates an instance of note prefab
// depending on which note is meant to be spawned
private IEnumerator PlaceBar(List<SongParser.Notes> bar)
{
   for (int i = 0; i < bar.Count; i++)
   {
       if (IsThereNote(bar[i].bottom))
       {
          GameObject _obj = (GameObject) Instantiate(GetNotePrefab(bar[i].bottom, true), new Vector3(bottomLane.transform.position.x + distance, bottomLane.transform.position.y, bottomLane.transform.position.z - 0.3f), Quaternion.identity);
       }
       if (bar[i].middle != 0)
       {
          GameObject _obj = (GameObject) Instantiate(GetNotePrefab(bar[i].middle, false), new Vector3(middleLane.transform.position.x + distance, middleLane.transform.position.y, middleLane.transform.position.z - 0.3f), Quaternion.identity);
       }
       if (bar[i].top != 0)
       {
          GameObject _obj = (GameObject) Instantiate(GetNotePrefab(bar[i].top, true), new Vector3(topLane.transform.position.x + distance, topLane.transform.position.y, topLane.transform.position.z - 0.3f), Quaternion.identity);
       }

       yield return new WaitForSeconds((barTime / bar.Count) - Time.deltaTime);
   }
}

So if I were to make start and end markers, the start marker would not know where the end marker is because it doesn't exist. Could anyone help please?

sentences:
loading a texture in Opengl I am working on a graphics project I want to make a city using opengl with c++ anyway in the last few days I have been trying to load a texture but it didn't work with me in any way I have tried many codes and tried to follow some tutorials but it didn't went ok

here is my load texture function:

int LoadTexture(char *filename,int alpha)
{
    int i, j=0; //Index variables
    FILE *l_file; //File pointer
    unsigned char *l_texture; //The pointer to the memory zone in which we will load the texture

    // windows.h gives us these types to work with the Bitmap files
    BITMAPFILEHEADER fileheader;
    BITMAPINFOHEADER infoheader;
    RGBTRIPLE rgb;

    num_texture++; // The counter of the current texture is increased

    if( (l_file = fopen(filename, "rb"))==NULL) return (-1); // Open the file for reading

    fread(&fileheader, sizeof(fileheader), 1, l_file); // Read the fileheader

    fseek(l_file, sizeof(fileheader), SEEK_SET); // Jump the fileheader
    fread(&infoheader, sizeof(infoheader), 1, l_file); // and read the infoheader

    // Now we need to allocate the memory for our image (width * height * color deep)
    l_texture = (byte *) malloc(infoheader.biWidth * infoheader.biHeight * 4);
    // And fill it with zeros
    memset(l_texture, 0, infoheader.biWidth * infoheader.biHeight * 4);

    // At this point we can read every pixel of the image
    for (i=0; i < infoheader.biWidth*infoheader.biHeight; i++)
    {
            // We load an RGB value from the file
            fread(&rgb, sizeof(rgb), 1, l_file);

            // And store it
            l_texture[j+0] = rgb.rgbtRed; // Red component
            l_texture[j+1] = rgb.rgbtGreen; // Green component
            l_texture[j+2] = rgb.rgbtBlue; // Blue component
            l_texture[j+3] = alpha; // Alpha value
            j += 4; // Go to the next position
    }

    fclose(l_file); // Closes the file stream

    glBindTexture(GL_TEXTURE_2D, num_texture); // Bind the ID texture specified by the 2nd parameter

    // The next commands sets the texture parameters
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // If the u,v coordinates overflow the range 0,1 the image is repeated
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // The magnification function ("linear" produces better results)
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //The minifying function

    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECR );

    // Finally we define the 2d texture
    glTexImage2D(GL_TEXTURE_2D, 0, 4, infoheader.biWidth, infoheader.biHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, l_texture);

    // And create 2d mipmaps for the minifying function
    gluBuild2DMipmaps(GL_TEXTURE_2D, 4, infoheader.biWidth, infoheader.biHeight, GL_RGBA, GL_UNSIGNED_BYTE, l_texture);

    free(l_texture); // Free the memory we used to load the texture

    return (num_texture); // Returns the current texture OpenGL ID
}

I call the function in init section

textureID = LoadTexture("Building.bmp",255);

and in the display section I wrote :

glBindTexture(GL_TEXTURE_2D,textureID);
    glBegin(GL_QUADS);
            //front
            glTexCoord2f(1,0) ;         glVertex3f(1,-1,0);
            glTexCoord2f(1,1) ;         glVertex3f(1,1,0);
            glTexCoord2f(0,1) ;         glVertex3f(-1,1,0);
            glTexCoord2f(0,0) ;         glVertex3f(-1,-1,0);
    glEnd();

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:
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:
How Apple Metal API distinguishes uniforms from vertices buffers? I am not sure how metal distinguishes uniforms from vertices buffers?
As far as I know code for passing uniforms in buffers are the same like for vertices:

[self.commandEncoder setVertexBuffer:positionBuffer offset:0 atIndex:0];
[self.commandEncoder setVertexBuffer:uniformBuffer offset:0 atIndex:1];

In shader code there is no keyword defining some struct as uniforms, so how Metal know it? In Opengl GLSL was uniform keyword which was clear for me but I can't figure how it is solved in metal.

sentences:
Making isKinematic false when OnCollisionEnter()? I have an issue with my script, I want to make rb.isKinematic go from true to false when collision is detected. With this script, nothing happens when a supposed collision is happening which means that rb.Kinematic = false does not work... The problem is that collision CANNOT be detected in the first place because rb.isKinematic is initially true (in my other script)! I checked this using Debug.Log to detect collisions. How can I fix this problem?

string lastTagCollided = "";
public Rigidbody rb;

void OnCollisionEnter(Collision col)
{
    if(col.gameObject.tag == "Pentagon" && lastTagCollided == "Pyramid")
    {
    rb = GetComponent<Rigidbody>();
    rb.isKinematic = false;
    transform.DetachChildren();
    Destroy (GameObject.FindWithTag("Sphere"));
    }

if(col.gameObject.tag == "Pyramid" && lastTagCollided == "Pentagon")
{
    rb = GetComponent<Rigidbody>();
    rb.isKinematic = false;
    transform.DetachChildren();
    Destroy (GameObject.FindWithTag("Sphere"));
}

lastTagCollided = col.gameObject.tag;
}

My other script if you are curious:

void OnCollisionEnter(Collision col)
{
if (col.gameObject.tag == "Pyramid" || col.gameObject.tag == "Pentagon")
    {
        rb = GetComponent<Rigidbody>();
        rb.isKinematic = true;
        gameObject.transform.SetParent (col.gameObject.transform);
    }
}

sentences:
Why isn't my mouse input working as expected in a DX10 game? I've made myself a camera for a DirectX 10 game, and the keyboard control works fine. However, I can't see to get the mouse to work. My biggest problem is I can't find out how to hide the mouse on the display to allow a crosshair (I don't need a visual one) and make movement like it would be in any other common 3D game. I looked at this tutorial, but it doesn't seem to work (The mouse part, that is). Everything I try just seems to result in the camera spinning very fast...

I'm using C++ and DirectInput.

sentences:
When and how should I apply forces in a Cocos2D + Box2D game? I have some small circles just rolling across the bottom of the screen in my Cocos2D/Box2D iOS app.  The bodies are dynamic... so I make them roll by applying a horizontal force to the center of mass (when the linear velocity is below the max velocity).

Currently I apply this force in -(void) tick: (ccTime) dt.  Is this the best place to apply it?  Or should I subclass something and implement an update function somewhere?  Please keep in mind I'm very new to Cocos2D/Box2D.

sentences:
change the pivot point of an empty object I have couple of objects and put them inside the empty object (to act as custom pivot point) .
Now, i want to change the pivot of the empty.
Normally i will unlink the objects first, move the empty to desired position and then link the object back (as child). But is it possible to change the pivot of the empty without unlink the objects first ?

sentences:
How to combine tap and long hold gesture recognizers? I have a game in which the player moves around a sprite by tapping on various sections of the screen (left, right, up, down). So far, each tap moves the sprite one tile (I use a tile system for movement, among other things), so to move the sprite a long distance the player has to tap in the direction they want for a while. Is there a way to combine a tap gesture recognizer and a long hold gesture recognizer so that if the player taps once, the sprite moves one tile in the direction tapped and if the player holds, the player moves in that direction until the player stops holding?

Here's my code for a single direction just as an example of what I have:

-(void)handleRightTap {

    self.player.direction = RIGHT;
    float currentSpriteX = self.playerSprite.center.x;
    float currentSpriteY = self.playerSprite.center.y;

    //If the animation is not already happening and the destination is accessible...
    if(!self.isAnimating && self.toTile.isWalkable) {
        self.isAnimating = YES;

        //If the player has reached the edge of the screen...
        if([self checkIfPlayerHasReachedEndForPoint:toPoint]) {
            self.isAnimating = NO;
            return;
        }
        CABasicAnimation *moveAnimation = [CABasicAnimation animation];
        moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(currentSpriteX + TILE_WIDTH, currentSpriteY)];
        [moveAnimation setDelegate:self];
        [moveAnimation setFillMode:kCAFillModeForwards];
        [moveAnimation setRemovedOnCompletion:NO];
        [moveAnimation setDuration:MOVE_ANIMATION_DURATION];
        [self.playerSprite.layer addAnimation:moveAnimation forKey:@"position"];
    }
}

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:
Tilemap mesh issue with z, -z axis I don't understand why the created mesh is upside down if z ( z*tileSize ) is positive, the mesh is then rendered with the texture looking down. With "-z", the mesh texture is looking up correctly, but it then starts at 0,0,0 and follows his path to the negative values, which I don't want. (I would like the mesh to create tiles in the X/Z axis, not in the X/-Z axis).

Would you know how to fix this? Here is the method to create the mesh : (if I switch the normals to -Vector3.up, the plane texture is still looking down, and it becomes black.)

public void BuildMesh() {
        int numTiles = size_x * size_z;
        int numTris = numTiles * 2;

        int vsize_x = size_x + 1;
        int vsize_z = size_z + 1;
        int numVerts = vsize_x * vsize_z;

        // Generate the mesh data
        Vector3[] vertices = new Vector3[ numVerts ];
        Vector3[] normals = new Vector3[numVerts];
        Vector2[] uv = new Vector2[numVerts];

        int[] triangles = new int[ numTris * 3 ];

        int x, z;
        for(z=0; z < vsize_z; z++) {
            for(x=0; x < vsize_x; x++) {
//HERE
                vertices[ z * vsize_x + x ] = new Vector3( x*tileSize, 0, -z*tileSize );
                normals[ z * vsize_x + x ] = Vector3.up;
                uv[ z * vsize_x + x ] = new Vector2( (float)x / size_x, 1f - (float)z / size_z );
            }
        }

        for(z=0; z < size_z; z++) {
            for(x=0; x < size_x; x++) {
                int squareIndex = z * size_x + x;
                int triOffset = squareIndex * 6;
                triangles[triOffset + 0] = z * vsize_x + x +           0;
                triangles[triOffset + 1] = z * vsize_x + x + vsize_x + 1;
                triangles[triOffset + 2] = z * vsize_x + x + vsize_x + 0;

                triangles[triOffset + 3] = z * vsize_x + x +           0;
                triangles[triOffset + 4] = z * vsize_x + x +           1;
                triangles[triOffset + 5] = z * vsize_x + x + vsize_x + 1;
            }
        }

Thanks

sentences:
Fire Emblem/Advance Wars/Turn Based Strategy like Artificial Intelligence I have made a Fire Emblem/Advance Wars like game, and I was wondering if there are any particular techniques in the AI's in those games.

I was wondering how to let the AI make the best decisions. I have the tiles a unit can move to, I have the enemy unit positions and I have formulas to calculate battle outcomes, now I want to add those together so that, for example, the AI attacks the weakest unit, blocks a chokepoint or just moves closer to the enemy if nobody is in range.

What is the best approach to this?

sentences:
In Unity, how do get access to animation clips in selected model from EditorWindow? I need to add some animation events or copy them from other models. So I decided to make a EditorWindow. Unfortunately there's not much information about this, and I'm stuck in here.

void OnGUI() {
    GUILayout.Label("Source Object contains Animation Clips", EditorStyles.boldLabel);
    sourceObject = (GameObject) EditorGUILayout.ObjectField(sourceObject, typeof(Object), false);

    if(GUILayout.Button("Copy")) {
        if(sourceObject == null) {
            throw new System.NullReferenceException("Source Object is missing.");
        }

        // Do Copy here

    }
}

What I need to do is:

Extract all animation clips from the selected model(fbx) - it's the source object
Select "AnimationClip" to want to copy. Note that AnimationClip in here is not inside of model, it's seperated AnimationClip that duplicated from original model because basically animation clip from imported model is read-only, so I have to duplicate to update it.

How do I get animation clips from selected fbx model with ObjectField? Any advice will very appreciate it.

sentences:
Good practices when optimizing HTML5/Javascript Game Developement I'm just starting out as a game developer and have created a few crappy but playable clones of classic games like pong, and bomberman.
Being self taught (bless the internet) I do this by just stuffing in code to make the games work.

Now I feel the time has come to create something complete, for this I need to know how a game is structured. I've searched on the web but there isn't that much to be found. The only "high-level" language I know is javascript so reading a tutorial or article based on C++ doesn't help me that much.

I'm looking for good resource's pedagogically covering the theory and possibly examples (in Javascript or pseudo code that is understandable for a beginner) of how the game pieces fit together.

From the start screen to asset loading and running the game loop. I'm not looking for anything complicated like reading through a 4000 line source code.
All I want to learn is where, how and when the main parts of every game should be called.

If you know any good resources to share, or maybe even have an answer for me I would deeply appreciate it.

sentences:
Making DirectInput and XInput work together I have working wrappers for Xinput and DirectInput in my game, but I had problems with xbox controllers, because they are also recognized as generic controllers by directinput.

I have found out that Microsoft recommends to solve this problem like described on this MSDN page (See the IsXInputDevice function in the code sample).

I implemented the suggested function, but sadly it is very slow and I found out that the following call takes about half a minute to finish on my computer:

pIWbemServices->CreateInstanceEnum(bstrClassName, 0, NULL, &pEnumDevices);

Could anyone solve this problem and if yes, how? I imagine many games use this method to select the correct input method for gamepads, but the problem is not common at all.

For the time being, I began writing a wrapper for raw input but I'd be happy if this also got solved.

sentences:
How to render a grid of dots being exactly 1x1 pixel wide using a shader? I would like to render a grid with many dots, all equally spaced and being exactly 1 pixel wide.
What I was able to achieve so far is this :

What I would like is (simulated using image editing program):

Here is the shader I wrote (which give result of 1st image).
This is rendered as a giant quad.
Shader "Custom/Grid"
{
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            struct vertInput {
                float4 pos : POSITION;
                float4 uv : TEXCOORD1;
            };

            struct vertOutput {
                float4 pos : SV_POSITION;
                float4 uv : TEXCOORD0;
            };

            vertOutput vert (vertInput input)
            {
                vertOutput o;
                o.pos = mul(UNITY_MATRIX_MVP, input.pos);
                o.uv = input.uv;
                return o;
            }

            fixed4 frag (vertOutput output) : SV_Target
            {
                float4 uv = output.uv;
                float x = step((uv.x * 100.0 + 0.025) % 1.0, 0.05);
                float y = step((uv.y * 100.0 + 0.025) % 1.0, 0.05);
                float c = min(x, y);
                return float4(c, c, c, 1.0);
            }
            ENDCG
        }
    }
}

Is it possible to achieve what I want using a shader ?
What is needed from first draft is to control the size of each dot.
I have tried to use partial derivatives (ddx and ddy) but was not able to make it work.

sentences:
How to collapse a structure after procedural destruction When considering this temple structure with procedural damage in pink:

How can I efficiently determine the collapse of such structure as below?

Even if the model is defined on a voxel grid, it would still require possibly wide-ranging searches for connected-ness?

In the 2D case, flood-filling and labeling disconnected components is probably doable, but what about the 3D-case?

Can this be done without traversing the entire world space, every frame -- which I imagine, wrecks havoc to a data cache?

Lastly, what is the technical term for this problem of "making stuff fall down after procedural damage?"

sentences:
Loading texture from constructor doesn't work but does from function call I am trying to load a SDL texture through my class's constructor. All I'm doing is calling a function from the constructor to load the texture. As mentioned in the title, this does not seem to work. However, if I call the function directly then it loads fine and I can see it on the screen. I'm fairly new to C++ so please let me know what I'm doing wrong.

Game.h

#include "Player.h"

class Game {
  private:
   Player player;

  public:
   Game();
   ~Game();

   void update();
   void draw();
}

Game.cpp

#include "Game.h"

Game::Game() {
  this->player = Player("somefile.png", 0, 0, 10, 10);  // Doesn't draw
  this->player.load("somefile.png", 0, 0, 10, 10) // Will draw
}

void Game::update() { /* ... */ }

void Game::draw() { /* ... */ }

Player.h

class Player {
  private:
    SDL_Texture* texture;
    SDL_Rect source, destination;

  public:
    Player();
    Player(const std::string& filepath, const int x, const int y, const int w, const int h);
    ~Player();

    void load(const std::string& filepath, const int x, const int y, const int w, const int h);

    void update();
    void draw();
  }

Player.cpp

#include "Player.h"

Player::Player() {}

Player::Player(const std::string& filepath, const int x, const int y, const int w, const int h) {
  this->load(filepath, x, y, w, h);
}

void Player::load(const std::string& filepath, const int x, const int y, const int w, const int h) {
  this->texture = SDL_CreateTextureFromSurface(renderer, IMG_Load(filepath.c_str());

  if (this->texture != nullptr) {
    this->source = { x, y, w, h};
    this->destination = { 0, 0, w, h};
  }
  else {
    std::cout << "Could not load image." << std::endl;
  }
}

void Player::update() { /* ... */ }

void Player::draw() { /* ... */ }

In Game.cpp, if I use the line with the constructor then nothing draws in the window. If I use the line that has load(), then it works fine. I never get the Could not load image. error in either cases.

sentences:
OpenGL profiling with AMD PerfStudio 2 I'm rendering just a really small amount of polygons for my UI but however I still tried to increase the FPS. In the end I removed redundant calls which increased the FPS. I really don't want to lose FPS for nothing so I keep looking for more improvements.

The first thing I noticed is the "huge" time where no calls are made before SwapBuffer (the black one). Well I know that OpenGL works asynchronous so SwapBuffer has to wait until everything is done. But shouldn't PerfStudio mark this time also as black ? Correct me If I am wrong.

The second thing I noticed is that some glUniform2f calls just take longer (the brown ones). I mean they should all upload 2floats to the GPU how can the time be so different from call to call. The program isn't even changed or something like that.

I also tried to look at other programs like gDebugger or CodeXL but they often crashed and they show less statistics (only # of calls or redundant calls etc.)

EDIT: I also realized that the draw calls also have different durations, which was obvious for me but sometimes drawing more vertices is faster than drawing less vertices.

sentences:
Is there a reason to inherit both generic and non-generic version of an interface? I've just gotten into some C# programming and decided to expand my knowledge of how games are made in C# by looking through some open-source frameworks. While doing this I noticed something very odd; classes that they make would implement both generic and non-generic interfaces that represent the same data structure. For example:

public class SomeSpecialList<T> : IList<T>, IList {
    ...
}

I couldn't find any explanation to this - Is this something I should be thinking about when programming games in C#? Why? Is it a performance thing?

sentences:
When drawing transparent object in OpenGL it cuts some sides of other object? I am making some OpenGL program, and I have a lost of cubes next to each other like this:

When I am making this hole, I am just skipping those cubes, just don't draw them.

for (int i=0;i<NUM_OF_CUBES;i++) {
        for (int j = 0; j < NUM_OF_CUBES; j++) {
                if ((i==3 && j==3) || (i==4 && j==3) ||
                    (i==3 && j==4) || (i==4 && j==4))
                        continue;
                cubes[i][j].draw(true);
        }
}

The result is:

But when I make those cubes invisible, by setting alpha to 0, the result is:

The code is:

for (int i=0;i<NUM_OF_CUBES;i++) {
        for (int j = 0; j < NUM_OF_CUBES; j++) {
                if ((i==3 && j==3) || (i==4 && j==3) ||
                    (i==3 && j==4) || (i==4 && j==4))
                        cubes[i][j].draw(true);
                else
                        cubes[i][j].draw(false);
        }
}

true/false fleg which I send to draw function just sets alpha to 0 or 1, if true alpha coordinate of glColor4f is set to 0, and if false is sent alpha coordinate is set to 1.

Does anyone have idea why it looks like some sides of the other cubes are cut? Like they don't exist.

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:
How are entity systems cache-efficient? Lately, I've been doing a lot of reading on entity systems to implement in my C++/OpenGL game engine. The two key benefits that I constantly hear lauded about entity systems are

the easy construction of new kinds of entities, due to not having to tangle with complex inheritance hierarchies, and
cache efficiency, which I'm having trouble understanding.

The theory is simple, of course; each component is stored contiguously in a block of memory, so the system that cares about that component can just iterate over the whole list, without having to jump around in memory and kill the cache. The problem is that I can't really think of a situation where this is actually practical.

First, let's look at how the components are stored, and how they reference each other. Systems need to be able to work with more than one component, i.e. both the rendering and physics system needs to access the transform component. I've seen a number of possible implementations that address this, and none of them do it well.

You can have components store pointers to other components, or pointers to entities that store pointers to components.  However, as soon as you throw pointers into the mix, you're already killing cache efficiency. You can ensure that every component array is 'n' large, where 'n' is the number of entities alive in the system, but this approach is hideously wasteful of memory; this makes it very difficult to add new component types to the engine, but still throws away cache efficiency, because you're jumping from one array to the next. You could interleave your entity array, instead of keeping separate arrays, but you're still wasting memory; making it prohibitively expensive to add new components or systems, but now with the added benefit of invalidating all of your old levels and save files.

This is all assuming that entities are processed linearly in a list, every frame or tick. In reality, this is not often the case. Say you use a sector/portal renderer, or an octree, to perform occlusion culling. You might be able to store entities contiguously within a sector/node, but you're going to be jumping around, whether you like it or not. Then you have other systems, which might prefer entities stored in some other order. AI might be okay with storing entities in a big list, until you start working with AI LOD; then, you'll want to split that list up according to distance to the player, or some other LOD metric. Physics is going to want to use that octree. Scripts don't care, they need to run, no matter what.

I could see splitting components up between "logic" (e.g. ai, scripts, etc) and "world" (e.g. rendering, physics, audio, etc), and managing each list separately, but these lists still have to interact with each other. AI is pointless, if it can't affect the transform or animation state used for an entity's rendering.

How are entity systems "cache-efficient" in a real-world game engine? Perhaps there's a hybrid approach that everyone's using, but not talking about, like storing entities in an array globally and referencing it within the octree?

sentences:
Tree batching problem in Unity I have some problems with batching trees.
I'm using the default unity terrain system and trees.
My problem is that trees won't get batched together (I've set up static, dynamic, and GPU instancing) and as I've inspected the frame debugger I've come to these results:
I used trees with the optimized bark material and optimized leaf material
What causes distinct draw call:
1- Wind
2- color and size variations for trees
draw call reason:
non instanced properties set for instanced shader
if I remove Wind or variations the GPU instancing would work (I don't want to remove wind and variations), Is there any way to batch trees in this case?

sentences:
How can I create this navigation system? I try to make a navigation/waypoint system. Well I have a concept but no idea how I could create this system. Well here's an image and an explanation:

You can see 3 waypoints as well as an goal and a player. The function should take the player position (X,Y,Z), a waypoint position array as well as an goal position. If the player is now on the position like in the image then it should output the second waypoint position because it's the closest waypoint in the direction of the goal. If the player is on the second waypoint position then it needs to output the third waypoint and so on  to the finish. Well that's my crude concept. I hope that somebody can help! Thanks in advance :D

NOTE: You can add any values you want to add the most important thing is that it helps me :)

sentences:
How can I choose a pathfinding target for a unit group and move the group to that target? So I've got some units which should move to a specific position which is given by the player. Currently the units can move there by finding a path with the A* algorithm (to be more precise: A* Pathfinding Library for Unity)

I was wondering what the best way to move the units is? When the player has selected e.g. 20 units, some of them are near each other, some of them are far away from the others, what is the best way to navigate them to a single position defined by the user. Obviously they cannot just all have the same target since they would never reach it when the first unit moved to it. Thus what do I have to do? Do I have to assign different targets to each unit or do I calculate the target position relative to the position they were to each other before?

sentences:
Unity2D: Repeating of code makes game lag (Spawnning script) does anyone knows how to shorten down this script and that I can edit the amount of enemies I want to spawn in, so that I don't have to keep on copying and pasting the same method below again and again, my code is also making my game a bit laggy. Which isn't a good sign. This is my code:

    public bool fromTop = false;

public GameObject enemy1;
public float enemy1Time = 2f;

public GameObject enemy2;
public float enemy2Time = 2f;

public GameObject enemy3;
public float enemy3Time = 2f;

public GameObject enemy4;
public float enemy4Time = 2f;

// Variable to know how fast we should create new enemies

void Start() {
    InvokeRepeating ("Enemy1", enemy1Time, enemy1Time);
    InvokeRepeating ("Enemy2", enemy2Time, enemy2Time);
    InvokeRepeating ("Enemy3", enemy3Time, enemy3Time);
    InvokeRepeating ("Enemy4", enemy4Time, enemy4Time);
}

void Enemy1() {
    Vector2 spawnPoint = new Vector2 (transform.position.x, transform.position.y);

    if (fromTop)
    {
        float x1 = transform.position.x - GetComponent<Renderer> ().bounds.size.x / 2;
        float x2 = transform.position.x + GetComponent<Renderer> ().bounds.size.x / 2;

        // Randomly pick a x point within the spawn object
        spawnPoint.x = Random.Range (x1, x2);
    }
    else
    {
        float y1 = transform.position.y - GetComponent<Renderer> ().bounds.size.y / 2;
        float y2 = transform.position.y + GetComponent<Renderer> ().bounds.size.y / 2;

        // Randomly pick a y point within the spawn object
        spawnPoint.y = Random.Range (y1, y2);
    }
    Instantiate (enemy1, spawnPoint, Quaternion.identity);
}
void Enemy2() {
    Vector2 spawnPoint = new Vector2 (transform.position.x, transform.position.y);

    if (fromTop)
    {
        float x1 = transform.position.x - GetComponent<Renderer> ().bounds.size.x / 2;
        float x2 = transform.position.x + GetComponent<Renderer> ().bounds.size.x / 2;

        // Randomly pick a x point within the spawn object
        spawnPoint.x = Random.Range (x1, x2);
    }
    else
    {
        float y1 = transform.position.y - GetComponent<Renderer> ().bounds.size.y / 2;
        float y2 = transform.position.y + GetComponent<Renderer> ().bounds.size.y / 2;

        // Randomly pick a y point within the spawn object
        spawnPoint.y = Random.Range (y1, y2);
    }
    Instantiate (enemy2, spawnPoint, Quaternion.identity);
}
void Enemy3() {
    Vector2 spawnPoint = new Vector2 (transform.position.x, transform.position.y);

    if (fromTop)
    {
        float x1 = transform.position.x - GetComponent<Renderer> ().bounds.size.x / 2;
        float x2 = transform.position.x + GetComponent<Renderer> ().bounds.size.x / 2;

        // Randomly pick a x point within the spawn object
        spawnPoint.x = Random.Range (x1, x2);
    }
    else
    {
        float y1 = transform.position.y - GetComponent<Renderer> ().bounds.size.y / 2;
        float y2 = transform.position.y + GetComponent<Renderer> ().bounds.size.y / 2;

        // Randomly pick a y point within the spawn object
        spawnPoint.y = Random.Range (y1, y2);
    }
    Instantiate (enemy3, spawnPoint, Quaternion.identity);
}
void Enemy4() {
    Vector2 spawnPoint = new Vector2 (transform.position.x, transform.position.y);

    if (fromTop)
    {
        float x1 = transform.position.x - GetComponent<Renderer> ().bounds.size.x / 2;
        float x2 = transform.position.x + GetComponent<Renderer> ().bounds.size.x / 2;

        // Randomly pick a x point within the spawn object
        spawnPoint.x = Random.Range (x1, x2);
    }
    else
    {
        float y1 = transform.position.y - GetComponent<Renderer> ().bounds.size.y / 2;
        float y2 = transform.position.y + GetComponent<Renderer> ().bounds.size.y / 2;

        // Randomly pick a y point within the spawn object
        spawnPoint.y = Random.Range (y1, y2);
    }
    Instantiate (enemy4, spawnPoint, Quaternion.identity);
}

Please and Thank you. :)

sentences:
How should a player object to communicate with a map object? I'm writing my first game (in Javascript / Node over WebSockets) and am running into a bit of chicken and egg problem, and am afraid how I'm doing it right now won't scale once the game gets more complex.

Here is how the game is architected. It's a tiled strategy game. When a user connects, a new Game object is created:

// width and height of the board / map
function Game(width, height) {
  this.map = new Map(width, height);
  this.player = new Player();
  // ...
}

game = new Game(100,100);

What's reasonable way for 2-way communication between a player object (or any object), and the map?

For example, if a player wants to move left, first I must check that there is no obstacle in his way, then, once this condition is true, his position must be updated, and he loses a stamina point, so both the map and the player objects are updated depending on conditions that most objects both meet (in the simplest case, where there is no interaction with other objects).

One way I can think, is to have a global GAME object, so that the map can access GAME.player and the player can access GAME.map, but this doesn't seem elegant (and will cause me a headache once I have multiple rooms with separate games running on the same node instance).

sentences:
No Support for UnityScript (JavaScript) on 2018.3 Hey I’ve been working on a project for over 3 years and yesterday I have updated the unity from 2018 to 2018.3 and lost support for JavaScript.
All of my scripts attached to gameobjects are there but not working while playing the game.
I’ve tried the UnityScript to C# website but didn’t work.
I’m a macOS user so couldn’t use the converter tool on git (because it’s been developed only for windows).
I’ll appreciate any suggestions.

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:
Downsides to automatic UV unwrapping I have seen several software packages that offer auto UV unwrapping as an option.

My question is why would you ever manually UV unwrap if there is an automated tool to do so? Are there any significant downsides to using an automatically generated UV map?

sentences:
Resolving this kind of situation in my platformer (movement on slope with roof) I'm building a simple 2D character controller based on raycasts. At this moment I'm trying to finish the player-ground interaction. For the ground I will be using edge colliders and no tiling information.

I have most code working but there's something I don't really know how to fix. Here is an screenshot explaining the situation:

As you can see, Player (purple rectangle) is on a slope. When player wants to move right the new x and y coords are calculated to set the player feet again on the slope (Blue rectangle). But, after this response has been applied to the player to make it out of the slope, It is pushed through the roof and some part of it is sticking out the edge collider (red box).

How do you handle this situation?

On the other hand, If there's any way to accomplish this in a simpler fashion I'm all ears :).

Cheers.

sentences:
How can I achieve a bullet tracing effect similar to the one in Planetside? I've noticed that bullet tracers in Planetside 2 don't show up close -- every time I see them, it came from a barrel a ways away. I don't believe Planetside traces every bullet either, because then it'd look really weird.

I'm not sure what the exact parameters are, so how can I achieve a similar affect?

sentences: Unity 3D engine for Ubuntu? Is there any way to get Unity 3D to run on Ubuntu. I am currently running Ubuntu 12.04 64bit edition. I also have Wine installed.

sentences:
Unity3D : Prefab Instancing Issue I am using latest unity engine and I am having a scripting issue.

I create a prefab , added a few scripts to it and I am trying to instantiate a few of those objects like this :

        GameObject go = Instantiate(Prefab) as GameObject;
        var co = go.GetComponent<MyScriptA>();

Issue here is co is always null, this means that MyScriptA is no on the go instance.
Accessing the prefab.GetComponent also returns null, but the prefab has the scripts in the editor and its assigned also in the editor to the Prefab variable (drag dropping). So I am not sure what might be wrong.
For example if I Debug.Log(prefab) its not null.

So what am I doing wrong here?

sentences:
Increment grid by rotation I'm currently working on a grid for snapping objects side by side. My current script is working fine, but only for game objects which haven't been rotated.

Here is an example video of the problem:

https://vid.me/jN6D

The cube at the right has a rotation of Vector3.zero, the left one has been rotated on the Y axis.

As you can see snapping works perfectly for the right one, but at 0:15 you can see that the snapping doesn't work well for the rotated cube, that's because I've currently no idea how I can add the rotation in my current script.

Here is a snippet of the most important part of code I'm currently using to calculate the grid:

Vector3 pivotToPoint = hit.point - nearestGameObject.transform.position;

float positionX = nearestGameObject.transform.position.x +
                  Mathf.Round(pivotToPoint.x / nearestGameObject.transform.renderer.bounds.size.x) *
                  nearestGameObject.transform.renderer.bounds.size.x;

float positionZ = nearestGameObject.transform.position.z +
                  Mathf.Round(pivotToPoint.z / nearestGameObject.transform.renderer.bounds.size.z) *
                  nearestGameObject.transform.renderer.bounds.size.z;

Vector3 origin = new Vector3(positionX, 0, positionZ) + Vector3.up * 100;

if (Physics.Raycast(origin, Vector3.down, out hit, Mathf.Infinity, layerMask)) {
    previewGameObject.transform.position = new Vector3(positionX, hit.point.y, positionZ);

    previewGameObject.transform.rotation = nearestGameObject.transform.rotation;
}

Maybe some of you guys have an idea how to solve this, it's driving me crazy.

p.s. Here is some guy with a similar problem, but I'm very lost when in comes to adding the solution into my code.

sentences:
C++ - what is the best library that I can use to create GUI if a textview already exists I have a 2D char array in the textView.Basically,I need to map each char to a texture and render the whole view. Given a limited time, what is the possible best library that I can use?

The header for the text view is

    class TextView {
    char **theMap;
    std::string race;
    int gold;
    int flr;
    int hp;
    int atk;
    int def;
    std::string action;
    std::string pendingAction;
public:
    TextView();
    void update(int x, int y, char c);

    // for the rest of the methods, notice that it takes
    // the NEW VALUE rather than the CHANGE as its parameter
    void updateGold(int newValue);
    void updateHp(int newValue);
    void updateAtk(int newValue);
    void updateDef(int newValue);
    void updateFlr(int newValue);
    void updateRace(std::string newValue);
    void updateAction(std::string newValue);

    void print(); // just print to cout, rather than give a reference to a ostream
    ~TextView();
};

sentences:
Are there still advantages to using gl_quads? OK, I understand that gl_quads are deprecated, and thus we're not 'supposed' to use them anymore. I also understand that a modern PC when running a game using gl_quads is actually drawing two triangles.

Now, I've heard because of that a game should be written using triangles instead. But I'm wondering if, due to the specifics of how OpenGL makes that quad into two triangles, it is ever advantageous to use quads still?

Specifically, I'm currently rendering many unconnected quads from rather large buffer objects. One of the areas I have to be careful is how large the vector of floats I'm using to make/update these buffer objects get (I have quite a few extra float values per vertex, and a lot of vertices in a buffer - the largest buffers are about 500KB).

So it strikes me that if I change my buffer objects to draw triangles this vertex data is going to be 50% larger (six vertices to draw a square rather than 4), and take 50% longer for the CPU to generate.

If gl_quads still work, am I getting a benefit here, or is the 50% extra memory and CPU time still being used on OpenGL's automatic conversion to two triangles?

sentences:
Libgdx app closes immediately after opening I have a libGdx app, and I am running it using android studio.

It closes immediately after starting it and I see no error report.
Could anyone help?

Starfield.java

public class Starfield extends ApplicationAdapter {

    private static final float STAR_DENSITY = 0.01f;
    ShapeRenderer shapeRenderer;
    Array<Vector2> stars;

    @Override
    public void create() {
        // Initialize a shapeRenderer
        shapeRenderer = new ShapeRenderer();

        // Call initStars
        initStars(STAR_DENSITY);

    }

    public void initStars(float density) {
        // Figure out how many stars to draw. You'll need the screen dimensions,  which you can get using
        // Gdx.graphics.getWidth() and Gdx.graphics.getHeight().
        int screenHeight = Gdx.graphics.getWidth();
        int screenWidth = Gdx.graphics.getHeight();

        // Create a new array of Vector2's to hold the star positions
        stars = new Array<Vector2>((int) (screenHeight * screenWidth * density));

        // Use java.util.Random to fill the array of star positions
        Random random = new Random();

        for (int i = 0; i < stars.size; i++) {

            int x = random.nextInt(screenWidth);
            int y = random.nextInt(screenHeight);

            stars.add(new Vector2(x, y));

        }

    }

@Override
public void resize(int width, int height) {
    shapeRenderer = new ShapeRenderer();
    initStars(STAR_DENSITY);
}

@Override
public void render() {
    // Make the night sky black
    Gdx.gl.glClearColor(0, 0, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // Begin a shapeRenderer batch using ShapeType.Point
    shapeRenderer.begin();

    // Loop through the star positions and use shapeRenderer to draw points
    for (Vector2 vec: stars) {

        shapeRenderer.point(vec.x, vec.y, 0);

    }

    // End the shapeRenderer batch
    shapeRenderer.end();

 }

    @Override
    public void dispose() {
        // Dispose of our ShapeRenderer
        shapeRenderer.dispose();
        super.dispose();
    }
}

Here is the gradle log

Run build   1s 241ms
Run init scripts    33ms
Configure settings  1ms
Configure build 327ms
Project :   326ms
Resolve dependencies :classpath 200ms
Resolve dependencies :android:classpath 0ms
Calculate task graph    26ms
Project :desktop    15ms
Project :core   3ms
Run tasks   824ms
:core:compileJava   82ms
Resolve dependencies :core:compileClasspath 5ms
:core:processResources  3ms
:core:classes   1ms
:core:jar   16ms
:desktop:compileJava    73ms
Resolve dependencies :desktop:compileClasspath  14ms
:desktop:processResources   2ms
:desktop:classes    0ms
:desktop:run    642ms
Resolve dependencies :desktop:runtime   3ms

EDIT: I got an error, dumb me, I did not see the console.

Exception in thread "LWJGL Application" java.lang.IllegalStateException:    autoShapeType must be true to use this method.
at com.badlogic.gdx.graphics.glutils.ShapeRenderer.begin(ShapeRenderer.java:198)
at gamedev.starfield.Starfield.render(Starfield.java:87)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:215)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)

Thanks, any help would be appreciated.

sentences:
Simple (and fast) dices physics I'm programming a throw of 5 dices in Actionscript 3 + AwayPhysics (BulletPhysics port).

I had a lot of fun tweaking frictions, masses etc. and in the end I found best results with more physics ticks per frame. Currently I use 10 ticks per frame (1/60 s) and it's OK, though I see a difference in plus for 20 ticks.

Even though it's only 5 cubes (dices) in a box (or a floor with 3 walls really) I can't simulate 20 ticks in a frame and keep FPS at 60 on a medium-aged PC. That's why I decided to precompute frames for animation, finishing it in around 1700 ticks in 2 seconds. The flash player is freezed for these 2 seconds, and I'm afraid that this result will be more of a 5 seconds or even more, if I'll simulate multi-threading and compute frames in background of some other heavy processes and CPU drawing (dices is only a part of this game).

Because I want both players to see dices roll in same way, I can't compute physics when having free resources, and build a buffer for at least one throw of each type (where type is number of dices thrown). I'm afraid players will see a "preparing dices........." message too often and for too long.

I think the only solution to this problem is replacing PhysicsEngine with something simpler, or creating own physicsEngine. Do You have any formulas for cube-cube and cube-wall collision detection, and for calculating how their angular and linear velocities should change after a collision occurs?

Edit: I'm assuming the only way to solve my problem is to make a cube-cube and cube-wall collision engine, however maybe there's another solution for my problem.

As Arthur pointer out, there can be one animation - for me this is just a shortcut, I could as well show the final result without any dices rolling.
However, I thought about making 100 precomputed dice throws, though a user won't avoid repetition here as well. Sometimes a dice sits on it's edge (or corner) for a while, and that gives player some excitement (will it fall on 5 and give me a full house?), but with limited number of animations a player would already know how the animation will end.
Buffering solution would work, if players would see dices roll in different way (results would still be the same) - I'm considering this solution, however I'm still going to try to create a simple physics engine and see how it works.
less ticks is a solution I don't consider, because at as few ticks to be able to simulate physics in real-time, the dices behave not better than if I treated them as balls in my physics engine...

sentences:
Unity: Creating a panel that stretches using anchors Relative newbie to Unity so please excuse any oversights. I have a component (canvas/panel) that I'm wanting to add a panel to, so that when the parent component's height changes, the child panel's height changes to match. I've achieved this manually using the inspector (see top half of attached pic) to set the anchor points at min(0.5, 0) and max(0.5, 1) (pivot is unchanged at (0.5,0.5)).

I want to create that stretching panel in scripting, and have the following code that results in the bottom half of the attached pic where the rect transform's anchors aren't set at all.

GameObject panel2 = GameObject.Find("Panel2");

GameObject divider = new GameObject("RunTimeLine");
divider.layer = LayerMask.NameToLayer("UI");
divider.transform.SetParent(panel2.transform);

CanvasRenderer c = divider.AddComponent<CanvasRenderer>();

RectTransform rt = (RectTransform)divider.AddComponent<RectTransform>();

Image img = divider.AddComponent<Image>();
img.color = Color.red;

rt.localPosition = new Vector2(0f, 0f);
rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 20);
rt.anchorMin.Set(0.5f, 0);
rt.anchorMax.Set(0.5f, 1);

Any suggestions? I've also tried setting the min/max offsets and pivot but haven't been able to create what I've got manually in the inspector.

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:
Why is unity's RaycastHit2D contact point is slightly off This is a small test I made, basically I have a simple BoxCollider2D that has the top surface aligned with the x axis. It's just a 1x1 cube placed at (0, -0.5). Now when I cast a ray down from position (0, 1) I would expect the resulting RaycastHit2D's contact point to be (0, 0) however when I log the contact point, it shows it is slightly over the actual surface at (0, -2.384186E-07).

So the question is, why does this happen? Also, can it be fixed somehow (like tweaking settings or something)?

sentences: Tools for non-programmers to add new tasks to games Since graphic designers/end users are not programmers, what are the technique to allow them to add new tasks or change application logic in a game? what are the end user tools? I want some popular examples.

sentences:
Lasers in 3D space game I am creating this little 3d space shooter and am somewhat unsure on how to implement the laser beams.

I'm thinking about something along Star Wars and the like where mostly you shoot rather short laser beams but very many of those.

Should I create a "tube" for each of the beams, render them via instancing and give them a better look just with the shader?

How would you go on about this? I was rather perplexed that there was no good tutorial on this matter out there.

sentences:
Map generator sometimes doesn't work I am making a dungeon map generator and am currently trying to make it place empty rooms. It first checks if the space is empty and then places a room.
The problem is that most of the times it compiles and I get a map/2d array printed, but sometimes it compiles but doesn't print the map. I don't get an error.

public class Mapa {

public static void main(String[] args) {
     // Create a 2D array map filled with floors

    char map1[][] = new char[100][100];
    for (int i = 0; i < map1.length; i++) {
        for (int j = 0; j < map1[i].length; j++) {
            map1[i][j] = tiles.wall();

        }
    }
    char mapFinal[][] = roomPlacement(map1);
    for (int i = 0; i < mapFinal.length; i++) {
        for (int j = 0; j < mapFinal[i].length; j++) {
            System.out.print(mapFinal[i][j] + " ");
        }
        System.out.println();
    }

}

public static char[][] roomPlacement(char map1[][]) {
     // this method places rooms into the 2D array map

    char mapReplacement[][] = map1;

    int roomNumber = (int) (10 + (Math.random() * 10));
    int roomLength = (int) (10 + (Math.random() * 10));
    int roomWidth = (int) (10 + (Math.random() * 10));

    int startPositionX = (int) (Math.random() * (mapReplacement.length - roomLength));
    int startPositionY = (int) (Math.random() * (mapReplacement.length - roomWidth));

    int counter = 0;

    while (roomNumber > counter  ) {
        if (position(startPositionX, startPositionY, roomLength, roomWidth, mapReplacement)) {

            if (roomSpace(mapReplacement, startPositionX, startPositionY, roomLength, roomWidth) == true) {
                for (int i = startPositionX; i < (startPositionX + roomLength); i++) {
                    for (int j = startPositionY; j < (startPositionY + roomWidth); j++) {
                        mapReplacement[i][j] = tiles.floor();
                    }
                }
            }
            if (roomSpace(mapReplacement, startPositionX, startPositionY, roomLength, roomWidth) == false) {
                startPositionX = (int) (Math.random() * (mapReplacement.length - roomLength));
                startPositionY = (int) (Math.random() * (mapReplacement.length - roomWidth));

            }

            counter++;
        }

        roomLength = (int) (10 + (Math.random() * 10));
        roomWidth = (int) (10 + (Math.random() * 10));

    }

    return mapReplacement;
}

public static boolean roomSpace(char map1[][], int startPositionX, int startPositionY, int roomLength,
        int roomWidth) {
    // this method checks if there is enough free space

    boolean isFreeSpace = false;
    char mapCheck[][] = map1;

    int counter = 0;
    for (int i = startPositionX; i < (startPositionX + roomLength); i++) {
        for (int j = startPositionY; j < (startPositionY + roomWidth); j++) {
            if (mapCheck[i][j] == tiles.wall()) {
                counter++;
            }
        }
    }

    if (counter == (roomLength * roomWidth)) {
        isFreeSpace = true;
    }

    if (isFreeSpace == true) {
        System.out.println("true");
    } else if (isFreeSpace == false) {
        System.out.println("false");
    }

    return isFreeSpace;

}

public static boolean position(int startPositionX, int startPositionY, int roomLength, int roomWidth,
        char mapReplacement[][]) {
    boolean position = false;
    // checks if the room is out of bounds
    if (startPositionX > 0 && startPositionX < mapReplacement.length && startPositionX + roomLength > 0
            && startPositionX + roomLength < mapReplacement.length && startPositionY > 0
            && startPositionY < mapReplacement.length && startPositionY + roomWidth > 0
            && startPositionY + roomWidth < mapReplacement.length) {
        position = true;
    }

    return position;
}

  }

Sorry for the long code but wanted to let you see the whole code to better understand it

sentences:
Playing one song after another results in horrible grinding noise; how can I fix this? I'm currently working on a game using slick2d java framework and I want to set it up so that the intro to a piece of music will play once, then the main body of the piece loops infinitely. I've got:

public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{
    BossInt = new Music("OST/bossintronly.wav");
    Boss1 = new Music("OST/bossloop.wav");
    Boss1.setVolume(0.5f);
    BossInt.setVolume(0.5f);

    BossInt.play();
}

then in my update method

if (BossInt.playing() == false) {
        Boss1.loop();
}

It ends up playing through the intro once as intended, but then instead of looping the main body as I'd hoped it just blasts a horrible grinding noise. It's definitely not a problem with the wav file, I've checked and replaced that multiple times.

Can anyone help me out?

sentences: Where is MonoGame's API reference? I wanted to pick up Monogame, but I can't find documentation. All I see on GitHub is some tutorials. I'm looking for class reference like this from XNA.

sentences:
Steering forces - Avoidance does not affect trajectory when flying directly at a target I'm trying to implement a simple seek & avoid system for a 3d game wherein planes fly around. Using https://gamedevelopment.tutsplus.com/series/understanding-steering-behaviors--gamedev-12732 as a reference.
During testing I found that if a plane was flying directly at a target it should avoid, the avoidance force (a Vector3 that points in direction from the plane's target to the plane) is in the complete opposite direction of its velocity (also a Vector3), thus it doesn't steer at all. I could detect this and rotate the avoidance force a bit, but that seems like a poor solution.
func _avoid() -> Vector3:
    var avoidance_force := Vector3.ZERO

    var ray_start = host.get_position()
    var ray_length = host.get_view_distance()
    var collision = host.get_world().direct_space_state.intersect_ray(
        ray_start,
        ray_start + -host.global_transform.basis.z * ray_length,
        [host], 31, true, true)

    if collision.empty():
        return avoidance_force

    if collision.collider.name == 'Avoidance':

        var collision_dist = (host.get_position() + host.get_velocity() - collision.position).length()

        avoidance_force = (collision.position - collision.collider.global_transform.origin).normalized()

        # if direction_change == -1, then the plane is flying directly at its target
        # var direction_change = avoidance_force.dot(host.get_velocity().normalized())
        return avoidance_force

sentences:
How do people implement pathfinding movement? I understand how A* works, but I don't understand how movement is implemented, e.g. creating a list of directions and then going through that list until every direction is empty. How does that work?

EDIT: Node based.

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:
How to offer directional ambient audio I'm working on a game side-project that will be heavily audio-based. One feature I'd like to offer are ambient sound zones which correspond to locations of nearby areas.

Say for instance the player is standing on a beach with waves breaking to the right, and a rainforest to the left. Each of these regions has its distinct ambience. If you continue forward, the breaking waves should still be just as loud on your right. Similarly, if you head into the forest, the sound of the waves should slowly be replaced as you move away from the beach. Many games seem to treat ambient sound as either vaguely positional, or as an environmental sound that comes from everywhere at once. What I'm trying for are different areas with different distinct sounds so you can actually orient yourself to them (I.e. you should be able to return to the beach by listening for the breaking waves, they shouldn't just be omnidirectional and faint.)

I don't want to get too deep into architecture, but my system is simple 2-D tile-based. I've thought of several possible approaches and am wondering a) which is best or b) if I've missed one that is better.

Place distinct, loud ambient sounds in specific locations. This would certainly provide directionality of a sort, but I wonder if the ocean waves might eventually sound ahead or behind and right as you walk down the beach, since all the ambience is coming from a single point. This also wouldn't allow for, say, walking out in the ocean past the breakers and hearing them behind you.
Placing sound sources throughout the area, spaced a reasonable distance apart. So for instance the breakers might be a single row of wave sounds which you could walk along or past. Similarly, the forest would be a grid of scattered nature sounds. This seems like the best approach, but I wonder if I'd quickly hit some limit for number of sounds that can be mixed. I'm using the web audio API, not sure if that intelligently doesn't render sounds that are too soft to hear. While this seems conceptually simpler, a long beach might have hundreds of distinct sound nodes placed along it.
Track the player's nearest intersection with a given zone, and play its ambience at those coordinates. So if you're walking along a beach with breaking waves to your right, I'd project out an invisible circle for as far as you can realistically hear, identify the closest intersection with various audio zones, and play their respective ambience. Maybe limit this to the nearest 2-3, since any more would likely be overwhelming. This seems least demanding in that it'd play fewer sounds, but would likely require more collision checks and thus might be impractical.

Thoughts?

sentences:
Suitable interpolation for animating explosions Is there a standard interpolation function for animating explosions? Like there is with smoothstep or smootherstep for walking animations or cars going from point A to B.

I'm assuming the explosion needs to grow very fast at the beginning and then slow down - how much in relation to the default linear interpolation, I don't know.

I've tried inverse smoothstep and inverse squared from this article: Interpolation Tricks, but none quite cuts it, maybe I'm applying them wrong.

sentences:
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:
Can't create "hero walking" animation I'm creating a Fez-based HTML5 Canvas game and animating my hero image using sprite sheets. The problem is that I can't create the animation of the hero walking, don't matter how much I try, the output is a weird animation that looks like the hero is just shaking its legs. Can someone help me? You don't need to create the sprite sheet for me if you don't want, just show me what's the correct leg position. I'll post the game link in a comment because I can't post more than two links.

Note that the "hero's legs" are compound by 3 pixels each, that are 2x up scaled.

Here is the sprite sheet:

the walking animation is compound by the 6 first frames.

EDIT: If you fall in the demonstration, open the console, type localStorage.x = localStorage.y = 0; and then reload the page immediately to return to the starting point.

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: Scrolling the map in a 2D a tiled game I am making a small game where I store information about the world around the player (like tiles) using a small 2d array of integers. In the game you can scroll the screen to the left or right. I also want to be able to read portions of the world from a file instead of loading the entire world at once for performance reasons. My concept of doing this is when the camera has scrolled a certain amount, shift the array by a certain amount and replace the old array data with new information from the file. I'm not sure if this makes sense performance wise or if there is a more performance friendly way of doing this so I was wondering if anybody could provide some insight. I drew an image to show what I am talking about.

sentences: background animation algorithm for single screen I’m writing simple strategy game (in xna), and would like to have an animated background. In my game all the actions happens inside one screen and thus standard parallax effect does not look appropriate. However, I found a video of a game with suitable background animation for my game http://www.youtube.com/watch?v=Vcxdbjulf90&feature=share&list=PLEEF9ABAB913946E6 (from 3 to 6s, while main character stays at the same place). What is the algorithm to do this stuff? It would be nice if someone can provide a reference for a similar example (language is not important).

sentences:
How to adapt pathfinding algorithms to restricted movement? Imagine car-like movement where entities cannot turn on a dime. Say, for the sake of discussion, that when at-speed they can turn 90 degrees per second. This would in many cases change the optimal path and therefore the pathfinding. It may even make 'usual' paths entirely impossible to traverse.

Are there any pathfinding algorithms or movement planning algorithms that can keep this in mind, or are there simple ways to adapt the popular ones?

sentences:
Projecting world coordinates to screen coordinates issue - points disappear when origin not in view I am trying to implement a 2d line drawing effect on a 3d mesh using Ogre. In order to do so, I perform silhouette detection on the lines of the object (this works) and then project these lines from world to screen coordinates.

Here is the code I use for converting the coordinates:

            bool toDeviceCoordinates(Ogre::Vector3 &result, Ogre::Vector3 &point,Ogre::Camera *camera)
            {
                if(!camera->isVisible(point))
                {
                    return false;
                }
                Ogre::Vector4 p(point.x,point.y,point.z,1);

                p = camera->getViewMatrix()*p;
                p = camera->getProjectionMatrix()*p;

                result = Ogre::Vector3(p.x,p.y,p.z);
                result /= p.w;

                return true;
            }

To draw these points to the screen I just pass them through the shader like so:

            gl_Position = gl_Vertex;

This works fine except when the origin of the scene is not visible.

Any idea where I am going wrong?

sentences:
Pathfinding with inertia I'm currently working for pathfinding for a game where units are moving, but they have inertia.  Most typical pathfinding algorithms (A*, Djikastra, etc.) are simply designed to minimize the length of the path.

However, these techniques do not apply, as far as I know, to instances where the unit has inertia.  If the unit has inertia, then there is a significant difference in the cost to leave a tile in a particular direction based on the direction you want to go.

For example, the cost of leaving a tile proceeding North is significantly higher if you entered the tile from the East than if you entered from the South.  (In the former example, you would have to slow down to halt you East-West velocity, while in the latter, you could go straight through.)

The fact that the system has inertia means that in order to make a turn, you may have to slow down well in advance of making the turn.  My best thought to date is that you calculate the additional time it would take to slow down, and then add it to the heuristic cost of moving.  However, this would seem to imply that you could never add a tile to the closed list, as entering from another direction could fundamentally change the cost of moving.

In addition, the concept of using a grid is an abstraction anyway, because both position and velocity are floating-point concepts.  Is there some algorithm that could handle pathfinding on an open plane with inertia better than A*, or what modifications could I make to a pre-existing algorithm to make it suitable to this kind of motion?

sentences:
Basic rigidbody movement This is a noob question but, what is the rigidbody movement equivalent of:

transform.position += transform.right * speed * Time.deltaTime;

sentences:
Managing draw calls for customized materials when targeting mobile I want to know how to minimize draw calls when rendering multiple customized characters onscreen, presumably with 3-4 materials apiece. Is there a better way to achieve custom color configurations than instancing/duplicating materials? Am I overthinking the problem?

Our game is a frenetic, goofy arena fighter, made in Unity. We plan to publish on mobile, first. I am tasked with creating an art pipeline which allows for customizable additions and color changes to the player's avatar. I'm trying to look ahead to when this character creator will be a part of the game and consider the performance implications of this kind of system. A character creator could potentially serve us in the generation of random NPCs at launch, and will feature heavily when we move to multiplayer.

My concern is with the number of draw calls on mobile. Currently, we have a bunch of identical characters, all creating instances of the main material on spawn to differentiate by random color. Since draw calls are directly linked to the number of materials onscreen, this process concerns me. Before complicating the issue with variations in mesh and texture on a per-object basis, having 1 material per character already limits us to a certain number of NPCs onscreen.

I delivered a material solution which allows changing one color to differentiate from other characters. Now the director is asking about the feasibility of breaking each character into multiple materials to allow for player customization. With 4 materials per character (1 shared), draw calls would increase geometrically per spawn. I've heard mobile platforms tend to be limited to about 20-120 draw calls between low and high end devices. That would make for 5-35 characters allowed onscreen at once, assuming we could get the environment down to  around 5 draw calls.

I would be especially interested in any material masking techniques people are aware of. Having a need for around 4 customizable aspects would seem to point towards using some sort of RGBA texturing and masking solution, but I have no idea how to make Unity do that.

sentences:
XNA significant loss in fps by just adding a few hundred thousand more triangles? I've got a minecraftish game that's running nice and smooth with a total of 9.3 million triangles, about 50-70fps average.  Then if I try to render 9.9 million triangles I get hell and it drops to < 1 fps.  I'm drawing them exactly the same way, it's definitely the drawing as I have a vertex buffer for each chunk, then I run through them all, check if they're in sight and if they are I draw them.  It works fine at high fps until I have just those few extra triangles which destroy the FPS.

Edit: Added drawing code:

First I loop through all the chunks.  I check if they're visible and if they are I mark them as visible then draw them.

        foreach (Chunk chunk in GlobalWorld.LoadedChunks)
        {
            if (chunk == null || !chunk.DrawThis)
                continue;

            if (!player.ViewFrustrum.Intersects(chunk.Bounding))
            {
                chunk.IsInSight = false;
                continue;
            }
            chunk.IsInSight = true;

            GlobalGame.graphicsDevice.SetVertexBuffer(chunk.VertexBuffer);
            GlobalGame.graphicsDevice.Indices = chunk.IndexBuffer;

            ChunkShader.Parameters["xWorld"].SetValue(chunk.WorldMatrix);
            ChunkShader.CurrentTechnique.Passes[0].Apply();
            GlobalGame.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, chunk.VertexBuffer.VertexCount, 0, chunk.IndexBuffer.IndexCount / 3);
        }

Then after that I draw all the transparent parts of the chunk (so they don't conflict with other chunks).  I already made clear if they're visible above so I just check if that bool is true.

        foreach (Chunk chunk in GlobalWorld.LoadedChunks)
        {
            if (chunk == null || !chunk.IsInSight || !chunk.DrawThisTransparent)
                continue;
            GlobalGame.graphicsDevice.SetVertexBuffer(chunk.TransparentVertexBuffer);
            GlobalGame.graphicsDevice.Indices = chunk.TransparentIndexBuffer;

            ChunkTransparencyShader.Parameters["xWorld"].SetValue(chunk.WorldMatrix);
            ChunkTransparencyShader.CurrentTechnique.Passes[0].Apply();
            GlobalGame.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, chunk.TransparentVertexBuffer.VertexCount, 0, chunk.TransparentIndexBuffer.IndexCount / 3);
        }

With 3721 chunks loaded it runs fine with them all being drawn at the same time.  With 3844 chunks being loaded it runs fine unless you view all of them.  Now that's only just over 100 more chunks yet it's dropping from 60fps to < 1 fps.

sentences: Is there any Lua API that works with C# for PC & XBox 360 Development? I am reading a book on Game Development in which they show you how to make scripts for your game in Lua. They program Lua and use it from C++, but I was wondering if there is a library or API to use Lua from C#: specifically from XNA to develop games for PC and XBox 360?

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:
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: Why does Intel Graphics Monitor crash after I set a depth stencil state in my Direct3D 11 application? I'm programming a managed Direct3D 11 application with SlimDX. I want to use Intel Graphics Monitor to capture draw calls for a single frame. When I try to set a depth stencil state my application crashes...any ideas?

sentences:
How public should you make your betas? I am approaching the point where I can release a playable beta of a very complex game I am making in Flash/AS3. It is fairly involved and the deepest game Ive made so far. I plan on hosting it on my personal site but I want to try and get good feedback on the game elements so far.

Is it worth it to expose this beta to as many places as possible before the release? What are good communities to do this?

Please note this will be freeware in its final release

sentences:
How to make child transforms honor parent origin I'm working on a 2D transform system that has the following requirements:

Transforms can have children
Transforms have anchor points/origins that offset them
Children should honor the parent's origin for translation
Rotations occur relative to the local origin (i.e. objects rotate
around their origin rather than the parent's)

As an example of what I'm looking for:
- You add red square in the middle of the screen and center its origin
- You add a white square, center its origin, scale it down slightly and make it a child of the red square
- Every frame you rotate both squares by a fixed amount

What you should see is a red square rotating around its center in the middle of the screen and a white square rotating inside the red square.

The way that I'm doing it now is something like this:

c = child;
p = child.parent;
c.local_transform.translate(c.translation);
c.local_transform.rotate(c.rotation);
c.local_transform.scale(c.scale);
c.local_transform.translate(c.origin.inverse());
c.local_transform.translate(p.origin);

c.world_transform = c.local_transform * p.world_transform;

This doesn't fully work however. The red square appears in the center and rotates around its origin but the white square seems to rotate both around its origin AND the world origin (i.e. the top left corner of the window).

What am I missing?

sentences:
How do I 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:
Unity - Ignore mouse click outside of the UI I am having a problem with my in game UI menus like the pause menu.

When I hit the escape key the mouse cursor and pause UI is shown with 2 buttons "Continue" and "Exit". I have locked the player from moving when this UI is shown. But when I click outside of the buttons the mouse disappears and the player can move once again, the UI is still shown but it's lost focus or something.

Is there a simple way to stop this? I've seen some scripts which seem to try to catch this behavior and ignore the click but I'm hoping there is a property on the canvas or something that I can use built into the engine.

Thanks, Sam

sentences: Are lightmaps also considered textures? I want my game to support phones with max texture size of 1024 so my texture atlases are 1024. My question is: are lightmaps also considered textures and their max size must be 1024? Or they can have higher dimensions like 4096?

sentences:
How to correctly combine scoreboard data? I need a help with a scoreboard I am making. Here's the scoreboard I want to achieve:

I actually have 4 tables and each tables has its own scoreboard but for this question only one table matters.

Here's how I am creating this kind of scoreboard:

if (gametable_no == 1)
{
    for (int i = 0; i < tzPlayInfo.Instance.bc_gametable_history_list.Count; i++)
    {
        newString[0] += tzPlayInfo.Instance.bc_gametable_history_list[i].r;
        newString[0] += ",";
    }
    string[] groupedString = newString[0].Split(',');

    foreach (string allchars in groupedString)
    {
        int x = 0;
        int y = 0;

        GameObject o = Instantiate(prefab_big_road[0]) as GameObject;
        o.transform.SetParent(pos_big_road[0]);
        o.transform.localScale = Vector3.one;
        o.transform.localPosition = new Vector3(2.0f, -5.0f, 0f);
        o.transform.localPosition = new Vector3(o.transform.localPosition.x + x,
            o.transform.localPosition.y + y, o.transform.localPosition.z);

        if (allchars.Contains(playerwinnopairboth))
        {
            o.GetComponent<UISprite>().spriteName = "layout_player_bigline-01";
            NGUITools.SetActive(o, true);
        }
        if (allchars.Contains(bankerwinnopairboth))
        {
            o.GetComponent<UISprite>().spriteName = "layout_banker_bigline-01";
            NGUITools.SetActive(o, true);
        }
        if (allchars.Contains(tienopairboth))
        {
            o.GetComponent<UISprite>().spriteName = "layout_tie_bigline-01";
            NGUITools.SetActive(o, true);
        }
    }
}

The result I get with this code is this:

Here's what the data I use to generate the table looks like:

Gametable 1 history : P  ,P  ,P  ,B   ,B P,P P,TBP

So I need a way to know if the character is changing in the gametable 1 history data.

Here's the expected scoreboard output with the data above:

If the value is not changing like P  ,P  ,P then the position should only increment on the y-axis. If the next value is different like B   , then it will move on the x-axis.

So, how would I implement this?

sentences:
Rotate Rigidbody to face away from camera with AddTorque I have a camera that rotates around an object with "Look At" .

I want the object to rotate to face the direction the camera is pointing (Camera.main.transform.forward) using AddTorque, but I can't understand how.

I tried to create a rotation in which the more the object's forward vector rotates towards the camera, the more it should slow down the rotation until it stops. But it only works in sections, when I use the rotation of the camera the object rotates and then stops, as if it detects only one part of the rotation, while the other is a blind spot.

What equation can I use to rotate the object well?

var currentR = rb.rotation.y;
var targetR = Camera.main.transform.rotation.y;
rb.AddTorque(transform.up * 1000f * (targetR - currentR));

@DMGregory♦
I put your script as it is in a separate new script on a new object, equipped with a rigidbody.
I post the script how I entered it. At "targetOrientation" I gave the value of "Quaternion.LookRotation (Camera.main.transform.forward);" because I want the object to follow the direction of that camera.
The result is that all the axes of the rigidbody are influenced by the rotation (if I lift the camera the object turns towards the ground, etc.), and above all that the rotation works even if I block the axes with Freeze Rotation, and with this script the object is no longer affected by external forces.

public class rotation : MonoBehaviour
{
    private Rigidbody rb;
    public Transform direction;
    // Start is called before the first frame update
    void Start()
    {
      rb = GetComponent<Rigidbody>();
    }

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

     Quaternion targetOrientation = Quaternion.LookRotation(Camera.main.transform.forward);
    Quaternion rotationChange = targetOrientation * Quaternion.Inverse(rb.rotation);

    rotationChange.ToAngleAxis(out float angle, out Vector3 axis);
    if (angle > 180f)
        angle -= 360f;

    if (Mathf.Approximately(angle, 0)) {
        rb.angularVelocity = Vector3.zero;
        return;
    }

    angle *= Mathf.Deg2Rad;

    var targetAngularVelocity = axis * angle / Time.deltaTime;

    float catchUp = 1.0f;
    targetAngularVelocity *= catchUp;

    rb.AddTorque(targetAngularVelocity - rb.angularVelocity, ForceMode.VelocityChange);

     }
    }

I set a command [if (Input.GetKeyDown (KeyCode.T)) rb.AddTorque (transform.up * 5500f, ForceMode.Impulse);] to rotate the object with an impulse and this does not work when your rotation script is active.
I also place a video where you see the object before activating the rotation script, and after it is active, to see how it does not react to the impulse with T, and how it rotates reacting on all rotation axes, while I want only that the rigidbody only rotates its Y-axis of rotation, in the direction of the camera (as a person does when turning in one direction). In the video The axes of rotation X and Z are on freeze (otherwise without fixed the rotation the object falls moving).
I also put a video of the desired effect taken from a game so as to explain me better.

My video
desired rotation

sentences:
Stop 2D platformer character from sliding down slope I'm making a 2D platformer game with the default Unity 2D physics. I am implementing slopes, but my player slips down the slope because of the physics.

Here is the code I use for the player movement:
MoveInput = Input.GetAxisRaw("Horizontal");
rbd2.velocity = new Vector2(MoveInput * speed, rbd2.velocity.y);
//rotacion de personaje
if (MoveInput > 0)
{
    transform.localScale = new Vector3(1f, transform.localScale.y, transform.localScale.z);

}
if (MoveInput < 0)
{
    transform.localScale = new Vector3(-1f, transform.localScale.y, transform.localScale.z);

}

sentences:
Pathfinding across multiple levels For a final school project, I have implemented an A* algorithm for pathfinding across a tile graph. So far, it has worked far surpassing my expectations. However now I'm in the process of adding a bit more complexity to the level and I am not sure that tile graphs will cut it any longer.

I would like to add multiple floors, but for the sake of simplicity I will just create two floors. At the present moment, I have a 2D array of Nodes that represent the single floor in a level. I don't think this will be scalable any more to anything besides one floor. I am proposing a method to find paths across two floors using multiple clusters containing nodes for different sections of the map where some nodes are flagged as exit nodes that will lead to other clusters.
 Moreover exit nodes will also be marked for the ones that lead up stairs to a second floor. The heuristic cost of moving from one floor to another will be higher than if an agent was to simply move across the same level.

I'm thinking if an agent is trying to traverse from one path to the next, it first checks to see if the start node and exit node are on the same floor. If so, then the cost is simply the euclidean distance, otherwise it tries to find the path to the exit node on the cluster it's currently on, compute the path to that node, then compute the cost to the next exit node within that same cluster. Repeat ad nauseam.

So as a visual representation of this, this is a terrible representation of a floor plan. The only highlighted nodes are the exit nodes

This is what I could come up with. Is there any other way besides searching through a ton of tiles and clustering? So far on a tile of 100X100 performance seems to be ok and not an issue. I have heard of using nav meshes, but I'm not entirely sure how to implement them in my project. Since this class is an advanced game development class, if we do use nav meshes, we need to create and implement our own and not use Unity's built in navmesh

sentences:
Worker threads are not being utilized in Time rewind system, is this job system really multi-threaded? I am trying to make a simple time rewind mechanic. It's working but it becomes slower as number of game objects increases. I decided to give Job System a shot. My idea is to interpolate between positions and rotations for N game objects in parallel. It is certainly running faster than single thread execution.
However, when I see the profiler, the worker threads are sitting idle.
Here's the screenshot:

And here's the IJob code:
using System;
using System.Collections.Generic;

[BurstCompile]
struct RewindJob : IJob
{
    public int RewindableIndex;
    [ReadOnly]
    public NativeArray<Vector3> positions;

    public NativeArray<Vector3> finalPositions;
    public float currentTime;

    public void Execute()
    {
       //rewind code for interpolating b/w positions
    }
}

and this is how I schedule RewindJob for each entity like this in main thread:
NativeArray<Vector3> finalPositions = new NativeArray<Vector3>(m_Objects.Count, Allocator.TempJob);

for (int i = 0; i < m_Objects.Count; i++)
{
    NativeArray<Vector3> positions = new NativeArray<Vector3>(count, Allocator.TempJob); ;

    TimeRewindable rewindable = m_Objects[i];

    for(int yo = 0; yo < count; yo++)
    {
        positions[yo] = rewindable.m_Transforms[yo].position;
    }

    RewindJob rewindJob = new RewindJob();
    rewindJob.finalPositions = finalPositions;
    rewindJob.positions = positions;
    rewindJob.RewindableIndex = i;

    JobHandle handle = rewindJob.Schedule() ;
    handle.Complete();
    positions.Dispose();
}

for(int i = 0; i < m_Objects.Count; i++)
{
    m_Objects[i].transform.position = finalPositions[i];
    m_Objects[i].transform.rotation = finalRotations[i];
}

finalPositions.Dispose();
finalRotations.Dispose();

What I can understand is it's not real multi-threading but context switching. Can anyone just explain a little bit what's happening? Thanks.

sentences:
Sampled texture renders dark I'm taking a texture from a shared texture handle and rendering it on the screen. I do this by creating a simple mesh that covers screen space, and then sampling the texture like so

float4 main(PixelInput pixelInput) : SV_TARGET
{
    return sourceTexture.Sample(textureSamplerState, pixelInput.uv);
}

However, the texture on the screen appears significantly darker than the source texture. I suspect this is because the type of the texture from which I am sampling is DXGI_FORMAT_R8G8B8A8_UNORM_SRGB but my back buffer is DXGI_FORMAT_B8G8R8A8_UNORM. For technical reasons, I am unable to change the format of either.

I tried the following conversion to linear color space

    float4 sRGBA = sourceTexture.Sample(textureSamplerState, pixelInput.uv);
    float3 sRGB = float3(sRGBA.x, sRGBA.y, sRGBA.z);
    float3 RGB = sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
    return float4(RGB, sRGBA.w);

But this seemed to make no difference at all (which I found surprising in and of itself).

There are no other shader effects or interesting pieces being applied.

What here might cause the effect of the darker rendering?

Thanks in advanced, let me know if there is any additional interesting information!

sentences:
glCreateShader causes segmentation fault I can't create a shader when trying to use shaders with sfml. The function glCreateShader(GL_VERTEX_SHADER); causes a segmentation fault. At first I googled it and found that it does that when the program does not have an opengl context. I tried SDL first but the poor documentation and "look at the header to know what to do" made me go for sfml

the code that causes the seg fault is bellow

    sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");

// Set color and depth clear value
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);

// Enable Z-buffer read and write
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);

// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

GLuint vertShader = glCreateShader(GL_VERTEX_SHADER);

    //...

I'm including glew, gl.h, sfml-window, sfml-system, using opengl 2.1 on gcc linux.

What is missing?

sentences:
How can I manage entities(in entity component system) using Lua scripts? Suppose I have a code like this in C++

// Game.cpp
Entity* hero;
Entity* witch;
... // entity initialization

if(/player near witch/) {
    if(hero->get<HealthComponent>()->getHealth() < 100) {
        say("Let me help you");
        witch->get<GraphicsComponent>()->setAnimation("witch.heal");
        hero->get<HealthComponent>()->setHealth(100);
    }
    else {
        say("Go away!");
    }
}

Suppose I want to put this code into Lua script, so I make an "interact" function in C++

void interact(Entity* first, Entity* second);

And call it like this:

interact(witch, hero);

Then I can call lua script, which gets first and second entity IDs and does something like this:

-- Script.lua
function interact(firstId, secondId)
    if(getHealth(secondId) < 100) then
        say("Let me help you")
        setAnimation(firstId, "witch.heal")
        setHealth(secondId, 100)
    else
        say("Go away")
    end
end

And then I can define wrapper functions in C++ like this

void setAnimation(int firstId, const std::string& animationName) {
    Entity* e = entities[firstId];
    e->get<GraphicsComponent>()->setAnimation(animationName);
}
// etc.

and call it from Lua. But this gets quite troublesome as I need to write lots of binding and wrapping(like "setAnimation") functions. Is there any other methods to control entitity behaviour using Lua?

sentences:
How to use multiple animations? convert an animated model:
3dsMax(CAT) -> Export FBX -> fbx-conv -> model.g3dj
my code:
...
val model = modelLoader.loadModel(Gdx.files.getFileHandle("model.g3dj", Files.FileType.Internal))
val modelInstance = ModelInstance(model)
val controller = AnimationController(modelInstance)
controller.setAnimation("Take 001", -1, 0.5f, null)
...

docs:

setAnimation(java.lang.String animationId)
Set the active animation, replacing any current animation.

How to set animationId in the source file (FBX) ?
my research:
model.g3dj
{..., animation: { id: 'Take 001', ... } }
format: https://github.com/libgdx/fbx-conv/wiki/Version-0.2-%28draft%29
model.fbx
AnimationStack 'Take 001'
format: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=files/GUID-E5C89F5F-09D1-4C32-BA83-28F63D0B2A6C.htm,topicNumber=d30e11661
my question: How to set AnimationStack.name in 3dsMax?
https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/3DSMax/files/GUID-26323F8D-3CC2-4918-A60D-C9D6C558584E-htm.html

sentences:
rendering a reflection on a texture I want to render reflection on a planar surface but the reflecting surface has a texture mapped onto it.Would the normal technique of using stencil buffer and then blending in the reflected image with the reflecting surface in this case?
If not then could some one suggest me how to render reflection on a surface that has a texture mapped onto it?
Thanks

sentences:
What are the practical differences between discrete and continuous simulations? I've done some research regarding how to simulate a game world, and it seems that I need to decide whether I want to write a continuous or a discrete simulation.

From my understanding, in a continuous simulation, I simulate each entity based on the time passed from the last calculation. For example, if I have a moving entity which has the speed of N units per second and one second has passed since the last calculation, the entity will move N units. In a discrete simulation, I calculate "turns", and my entity will have a speed measured in units per turn.

From what I understand, discrete simulation is not as granular as a continuous simulation, but is easier to calculate. I'm not sure that I have this right. I'm in the planning stage of a Dwarf Fortress-like roguelike game and I'm not sure which method will be fine for my purposes.

What are the practical differences between continuous and discrete simulations, in terms of game mechanics and playability? In relation, what are the benefits and disadvantages of each simulation, and do I have any holes in my understanding of the concepts?

sentences:
Do you actually use diagrams to model games? I mean mostly UML but any method that works is viable. So - do you actually model your games with UML/other diagrams or different methods? I had a subject at my university about modelling with UML and it seemed like more effort than actual benefit but I realise that might be only because I've never created a huge complex IT system. So is it worth the while and what types of diagrams/methods are usually* the best?

*Of course, many times concrete tools need be chosen to concrete problems but maybe there are some patterns.

Edit: I forgot one important thing - do you create diagrams before or after implementing stuff? What I mean is - when one designs and implements something one usually changes mind or something unexpected comes up and one has to make changes, sometimes major ones - and doing them in already complex diagrams seems equally hopeless as in the code itself.

sentences:
How to make a temporary collision? I have a key and door system working, the character(ball) picks up the key and when it is within the collider it sets the text("press E to open") on the screen to active so that they can open the door. This only needs to be there while the door is closed. How Would I fix this. Thank you so much in advance.

    //GameObject E is the canvas text to instruct the player to press E to open the door.
public GameObject E;
//Door is the door itself, I assigned this manually because the door consists of the doorframe and door.
public GameObject Door;
private bool Unlock;
// Use this for initialization
void Start ()
{
    E.SetActive(false);
    Unlock = false;
}

// Update is called once per frame
void Update ()
{
    if (Unlock)
    {
        if (Input.GetKeyDown("e"))
        {
            Door.GetComponent<Animation>().Play();
            E.SetActive(false);
            CodeManager.GotKey = false;
        }
    }
}
void OnTriggerEnter(Collider other)
{
        if (CodeManager.GotKey)
        {
            if(other.gameObject.CompareTag("Player"))
            {
            E.SetActive(true);
            Unlock = true;
            }
        }
}

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:
Controlling resolution in Unity 3D. Beginner's problems i started working on developing games one month ago. I really like it, although it isnt easy.

The problem i have now, is with display resolution after i build game. So far i have been working with 2D Space Shooter game (getting help from the tutorial), everything is working smoothly. The only thing that i hardly understand is the resolution, aspect ratio thing. I have made a game that looks like this:

I have drawn a gizmos around the allien formation, and written a script with some calculations that everytime formation hits the edge, it goes to the other edge, hits the other edge, and goes to the other edge, and so on and on. In the free aspect movement looks great, but however, then i change the resolution to any other, movement is stuck, or it barely moves.

Now here is my question. What should i do, to make the game look and work smoothly on every resolution like it works on the free aspect display? I tried to change formation height and width and so on, but i assume this is not an option.
I will add my formation controller script as well(it contains several other things so i printscreened only the code that helps formation to move):

Thank you for your time, and sorry if you can't understand everything or something is unclear to you, i'm beginner at game development and English is not my first language.

sentences:
Voxel heightmap terrain editor I've recently been experimenting with a simple Voxel-based 3d engine (think Minecraft) which uses heightmaps to define terrain in the following format:

http://en.wikipedia.org/wiki/Heightmap

Does anyone know of the best software for producing these kind of maps? Preferably with the ability to define a texturemap also. Are terrogen and picogen the only real alternatives?

sentences:
Add single color background to texture using shader I want to add a single color background to my texture.
In my case, in Unity UI, I can simply create two Image components, one on top of another, and use the one on the bottom as a single color background.
However, I would like to do it in a single draw call, using a shader. This is the shader that I use:

   Shader "UI/Background Tinted"
   {
    Properties
    {
        [PerRendererData]_MainTex ("Sprite Texture", 2D) = "white" {}
        _BgClip ("Offset Mask", Range(0,0.1)) = 0.025

        _StencilComp ("Stencil Comparison", Float) = 8
        _Stencil ("Stencil ID", Float) = 0
        _StencilOp ("Stencil Operation", Float) = 0
        _StencilWriteMask ("Stencil Write Mask", Float) = 255
        _StencilReadMask ("Stencil Read Mask", Float) = 255

        _ColorMask ("Color Mask", Float) = 15

        [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
    }

    SubShader
    {
        Tags
        {
            "Queue"="Transparent"
            "IgnoreProjector"="True"
            "RenderType"="Transparent"
            "PreviewType"="Plane"
            "CanUseSpriteAtlas"="True"
        }

        Stencil
        {
            Ref [_Stencil]
            Comp [_StencilComp]
            Pass [_StencilOp]
            ReadMask [_StencilReadMask]
            WriteMask [_StencilWriteMask]
        }

        Cull Off
        Lighting Off
        ZWrite Off
        ZTest [unity_GUIZTestMode]
        Blend SrcAlpha OneMinusSrcAlpha
        ColorMask [_ColorMask]

        Pass
        {
            Name "Default"
        CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma target 2.0

            #include "UnityCG.cginc"
            #include "UnityUI.cginc"

            #pragma multi_compile __ UNITY_UI_CLIP_RECT
            #pragma multi_compile __ UNITY_UI_ALPHACLIP

            struct appdata_t
            {
                float4 vertex   : POSITION;
                float4 color    : COLOR;
                float2 texcoord : TEXCOORD0;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };

            struct v2f
            {
                float4 vertex   : SV_POSITION;
                fixed4 color    : COLOR;
                float2 texcoord  : TEXCOORD0;
                float4 worldPosition : TEXCOORD1;
                UNITY_VERTEX_OUTPUT_STEREO
            };

            fixed4 _TextureSampleAdd;
            float4 _ClipRect;
            float _BgClip;

            v2f vert(appdata_t v)
            {
                v2f OUT;
                UNITY_SETUP_INSTANCE_ID(v);
                UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
                OUT.worldPosition = v.vertex;
                OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);

                OUT.texcoord = v.texcoord;

                OUT.color = v.color;
                return OUT;
            }

            sampler2D _MainTex;

            fixed4 frag(v2f IN) : SV_Target
            {
                half4 main = tex2D(_MainTex, IN.texcoord);

                float mask = 1.0 - main.a;

                half4 bg = IN.color;
                bg.a = mask;

                half4 color = main + (bg * mask);

                return color;
            }
        ENDCG
        }
    }
}

With two Images component everything is fine. However, with single shader approach I encounter sharp edges near image alpha boundaries.

Using 2 images, looking fine:

Using single shader, jagged edges:

How do i fix that, using a single shader approach?

sentences:
How do I get an xbox 360 controller to rumble? I am interfacing with the controller using the windows HID API. It seems that its output report length, as provided by the HID driver, is 0, which means I can't send it anything (e.g. make the rumble work). I've also noticed that the input report doesn't include the state of the big "X" button. Am I wrong about this? Is there a workaround, a better API, a workable filter driver that doesn't involve making .infs, etc...?

As I need to support an arbitrary number of controllers (keyboards, mice, and anything for that matter), xinput isn't an option. Installing drivers is also not an option, unless it can be done silently without breaking the device for every other application.

sentences:
OpenGL Core profile - Array of arrays in glBufferData for VBOs I want to send each face as VBO, and I structured the data as this

facevbo[0] =  x x x x x x   //x,y,z,r,g,b,s,t
facevbo[1] =  x x x x x
facevbo[2] =  x x x x x x x
facevbo[3] =  x x x x
.
.
.
facevbo[numfaces] = x x x x

Basicly I have dynamic 2d array with different column size:

GLfloat** faceVBO = new GLfloat*[m_numOfFaces];
faceVBO[dfaceIndex] = new GLfloat[pFace->numOfVerts*8];

When I print all the faces, everything is fine,
but when im trying to put them to use,
i have problem at this line:
(ideally I would iterate trough all the faces to bind each face, but lets take the first column)

glBufferData(GL_ARRAY_BUFFER, 4*oindices, faceVBO[0], GL_STATIC_DRAW);

the third parameter (faceVBO[0])
"argument of type GLfloat is incompatible with param. of type const void*"

but if i tead from array, like

GLfloat facevbo[] = {x,x,x,x...}

and

 glBufferData(GL_ARRAY_BUFFER, 4*oindices, faceVBO, GL_STATIC_DRAW);

it works OK.
How should i send the data in this case?

Thanks

sentences:
Multiplayer Synchronization I am developing multiplayer game in unity. For multiplayer i am using photon networking library. I created room and join client successfully.

But Problem is I am doing gameobject movent by this code:

public GameObject player;
IEnumerator Moving (String temp)
{

    for (int i = 0; i < 3; i++) {

        player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
           (Ease.Linear);
        yield return new WaitForSeconds (0.5f);
    }
}

DoMoveis library here.

Problem is player movement is not synchronized.

For Synchronization I add photonview component to player gameobject.

And i call coroutine though RPC like this.

player.GetComponent<PhotonView>().RPC ("Moving", PhotonTargets.All, "temp");

Accordingly i changed coroutine like this:

[PunRPC]
IEnumerator Moving (String temp)
{

    for (int i = 0; i < 3; i++) {

        player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
           (Ease.Linear);
        yield return new WaitForSeconds (0.5f);
    }
}

I got this error

Illegal view ID:0 method: Moving GO:player
UnityEngine.Debug:LogError(Object)

sentences:
Symmetry preserving path simplification I'm using the Douglas peucker (DP) algorithm to simplify some (2d) closed paths forming a shape. This works pretty good, but not so much for closed paths that have some symmetry. Take for example a pyramid like shape, with the slopes essentially being staircases. Depending where you define the start for DP it will (obviously) result in different simplified shapes.

Does anyone know of some sort of generic symmetry preserving simplification algorithm? In the case of (a top up) pyramid you could force this manually by having DP run from the end vertice of the top line to the first vertice of the bottom line, and another run from the end vertice of the bottom line to the first vertice of the top line. but this is of course very specific to the symmetry of this particular pyramid.

sentences: Having player names over models in 3d space I wanted to have in my multiplayer game, the players name's over their models, however I am faced with the question of how? Should I create a new Canvas object for each game model or just use 1 main canvas and move their names around relative to position in 3D world space? My aim is to have an open world game.

sentences:
How to implement the graph for pathfinding using A* The game I am working on is based on a maze where each level is procedurally generated. The pathfinding grid is a 2D array where each node holds its connections. Path requests are handled one at a time so there can't be two path calculations going on simultaneously. So far I have each node hold its data required for the A* (H,F,G scores and its parent) and manipulate them directly in the algorithm. Since the nodes are the actual nodes and not copies of them, every time the algorithm runs the data changes permanently and I have to manually set them on default values before the next run.

So my questions are :

1) Is this a valid way of handling pathfinding in a game?

2) What other data manipulation techniques I could use in order to avoid that?

If you need a copy of the code it's all on my github under Pathfinding
and Managers/PathfindingManager.

sentences:
Game class and main function I have a Game class with my main game functions and instances of game objects like screen, etc. My game is made using C++ and SDL.

I was wondering, though, should main be a function of my class? Or should I do "Game game;" from "int main();" and have the loop inside main?

My doubt is - if I do it from an outside-main, then most of my stuff will have to be public, and that is kinda bad, isn't it?

Any ideas? Thank you!

sentences:
Calculate the rest length of a box2d distance joint Given the length of a distance joint along with its frequency and the mass of the bodies involved, is it possible to determine the final rest length?
I'm only interested in the vertical axis if that makes the formula simpler.

E.g. Imagine the simple case of a dynamic body of mass=1 sitting vertically atop another similar body and attached via a distance joint with length=1 and frequency=1 and gravity=10.
What would the rest length be? I.e. What would the final distance be between those two bodies?

I'm currently just trial and error fudging the frequency values I need in my game but I really need a formula to compute this as every time I change the masses, I have to re-fudge everything.

Thanks.

sentences:
Error with Quaternion.FromToRotation in Unity? I get multiple errors whenever I run this code:

transform.rotation = Quaternion.FromToRotation (Vector3(0, 0, 0), Vector3(0, 0, 270));

Can you suggest a fix for this code?

Errors:

Expression denotes a type', where avariable', value' ormethod group' was expected
The best overloaded method match for `UnityEngine.Quaternion.FromToRotation(UnityEngine.Vector3, UnityEngine.Vector3)' has some invalid arguments
Argument #1' cannot convertobject' expression to type `UnityEngine.Vector3'

sentences:
Who owns the intellectual property to Fragile Allegiance? Fragile Allegiance was developed by Gremlin Interactive, which was later acquired by Infogrames (Atari). I couldn't find any details of the acquisition though.

The only interesting thing I have found online is that the owner of the registered trademark Fragile Allegiance is Interplay, who published Fragile Allegiance. However, the only copyright note I've found was in one installation .ini file, claiming it for Gremlin.

What are the common business practices when it comes to old, unused IPs? What do publishers/developers actually need to legally claim an intellectual property? Does anyone have an experience with contacting big publishers with copyright/IP inquiries?

Related legal question.

sentences:
Transform world space using Kinect FloorClipPlane to move origin to floor while keeping orientation The Kinect SDK provides a property SkeletonFrame.FloorClipPlane that describes the orientation of the floor plane relative to the camera. MSDN contains slightly more information in the Coordinate Spaces page for Kinect.

I want to determine a matrix that transforms the camera coordinate space to a 'world space'. In this world space the origin would correspond be a projection of the camera position on the floor, ie straight below the camera.

The X axis is to the sides of the camera, but rotated to be parallel to the floor, compensating for pitch
The Y axis is straight up from the ground to the Kinect, compensating for yaw
The Z axis is straight forward from the camera/origin, but rotated to be parallel to the floor, compensating for tilt

The 2 steps in the transformation would be

Translate from the camera position to the ground
Rotate around the origin while keeping orientation

Unfortunately my linear algebra is rusty and always has been.

Solution update:

I adapted the solution below to create the following method that creates a transformation matrix based on the floor normal and camera height:

Matrix CameraTransform(Vector3 normal, float scalar)
{
    // Note the first three coefficients of the plane equation are the normal
    Vector3 yNew = new Vector3(normal.X, normal.Y, normal.Z);
    Vector3 zNew = new Vector3(0, 1, -normal.Y / normal.Z);
    zNew.Normalize();
    Vector3 xNew = Vector3.Cross(yNew, zNew);

    // assumes column vectors, multiplied on the right
    Matrix rotMatrix = new Matrix(
        xNew.X, yNew.X, zNew.X, 0,
        xNew.Y, yNew.Y, zNew.Y, 0,
        xNew.Z, yNew.Z, zNew.Z, 0,
        0, 0, 0, 1);

    Matrix translationMatrix = Matrix.CreateTranslation(0, scalar, 0);

    return rotMatrix * translationMatrix;
}

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:
Switching to a vertex shader TL;DR I need to switch from a vertex array passed to the pixel shader with a real vertex shader approach.

In my prototype, the terrain is procedurally generated and I have the following result:

The terrain vertices are passed directly to the pixel shader through an array:

//Number of vertices in terrain array
static const int verticesCount = 20;

//The vertices array, in pixel coordinates
float2 terrain[verticesCount];

//A fixed distance between neighbor vertices
float fixedDistance;

float4 PixelShaderFunction(float2 pixelCoords : VPOS,
                           float2 textureCoords :TEXCOORD0) : COLOR0
{
    float4 color = tex2D(s0, textureCoords);
    int i = pixelCoords.x / fixedDistance;
    float delta = (pixelCoords.x - terrain[i].x)/(terrain[i+1].x - terrain[i].x);
    if(smoothInterpolate(terrain[i].y, terrain[i+1].y, delta) >= pixelCoords.y)
    {
        color.rgba = 0;
    }
    return color;
}

As you can see I just interpolate between the vertices and mask the texture to the terrain.

Now I need a different approach because I'm using a view matrix for the camera and it does not affect these vertices that do not go through the vertex shader, how can I replace the terrain array with a vertex shader to get a similar result?

All suggestions are welcome!

sentences:
Can you dynamically set which texture to use in-shader? I'm working on a user interface system, and I want to be able to mix textured polies with frag-coloured polies. Here's my shader code, that doesn't work:

attribute vec2 vertex_coords;
attribute float texid;
attribute vec4 fragdetails;

varying float usingtex;
varying vec4 v_fragdetails;

void main(){
    gl_Position =  gl_ModelViewProjectionMatrix * vec4(vertex_coords,0.0,1.0);

    usingtex = texid;
    v_fragdetails = fragdetails;
}

Fragment:

varying float usingtex;
varying vec4 v_fragdetails;

uniform sampler2D thetexture;

void main() {
    if (usingtex != 0.0){
        thetexture = int(usingtex);
        gl_FragColor = texture2D(thetexture, vec2(v_fragdetails[0], v_fragdetails[1]));
    } else {
        thetexture;
        gl_FragColor = v_fragdetails;
    }
}

Frag_details consists of either [r, g, b, a] for a coloured poly, with texid set to 0, or [texture x, texture y, 0, 0] for a textured one.

However, samplers must be uniform, and uniforms can't be modified. So how on earth would I swap between textures in one draw? Do I have to set them all up as uniforms and then pick from those? I'd have to use an array, and know the length, which isn't really practical for a UI system where buttons will be clicked, tabs changed, and so on.

Is there a way to do this?

sentences:
Unity Spaceship camera control I'm trying to make a third person spaceship control system in Unity. In theory, it works like this:
Let's suppose you move your mouse to the right. The targeted direction would rotate to the right compared to the current camera direction and the camera would rotate to face towards the new direction as well.

The problem lies in the calculations: how can I calculate the direction change using the current camera rotation? Also, please mind that the ship rolls with Q and E to the left and right, respectively, as to improve player control.

The system is designed this way to help controlling bigger, slower turning ships (where direct, limited mouse following is not an option because of the low turning speed). But if you have a suggestion for a better control system for such ships, I'd be glad to hear it.

sentences:
How can I reduce a frustum to the subset that passes through a portal AABB? I'm trying to implement portal based occlusion culling:

There are sectors and portals.

When a portal is visible, the sector it is connected to is rendered.

The sector is made of polygons and portals.

The sector is sealed by a portal to the next sector.

The portal has an axis aligned bounding box.

The view frustum has an array of mathematical planes in it. There is top, bottom, left, right, near and far.

The view frustum planes change shape when in contact with a wall.

When the view frustum planes are in contact with the portal's AABB, the sector get rendered.
Then an array of mathematical planes are added behind the portal to create a reduced view frustum.

Reduced frustums are made from other portals in contact with the view frustum until there are no more portals in view.

How can I perform the bolded step, where I find a new collection of frustum planes representing the portion of the original frustum that continues through the portal's AABB?

sentences:
Time critical events based on framerate Problem Description

Basically, I've made a "programming game" in which I've made my own scripting language. It is a completely standard Lunar Lander game, though instead of directly controlling the lander using keyboard input, it instead fires a sequence of commands you have provided through the scripting language I made. This all works, and I've hit a critical problem.

So essentially, using the scripting language, you specify something like After 5 seconds, activate thrust for 10 seconds, and then after 2 seconds, rotate the lander for 4 seconds. The goal is then to chain together a sequence of commands which will get you to land the lander safely.

Of course, this comes with one problem. If you repeat the sequence of commands, each command will have to be fired at exactly the same spot in the level, that is, after x amount of seconds, but also with the lander being in the exact same spot. If you did not use timer-based movement, sure you could indicate that a command should activate after 5 seconds, but the lander moving at 60 FPS would have moved way further than a lander moving at 30 FPS.

Why of course, I thought I would simple just make the lander use timer-based movement so it is independent of FPS (I am using the very standard approach of taking the amount of time passed last frame, and multiplying it to a constant move speed). Then I would count seconds using the system clock. So the after x amount of seconds, the lander would be in the same spot in the level when the command activates.

Unfortunately, this approach do not work. Every time I run a sequence of commands, they will be activated with, sometimes very slight, variations, making it impossible to actually get a consistent and reliable path for the lander.

My Question

So my question is, am I tackling this problem a completely wrong way? What exactly do you do when it is absolutely critical that timed events defined by the user will activate at exactly the same time and spot in a level? I seem to be quite stuck with this question.

sentences:
How do 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:
Materials and Mesh association I'm trying to implement a Material system in a small engine for training and I've got  questions about materials.

Currently I've got that:

Material: A Material with array of Technique
Technique: Stock an array of Pass
Pass: Content RenderState (blend to apply, draw mode, face culling, …), Shader/Program and an array of Parameter
Geometry: Buffers, Indices, Vertices, ….
Parameter: A parameter is use to stock and share values with program (color, texture,…)

Now I'm not sure about that:

A Material is something shared by Meshes or each Mesh have his own Material?
In my scene, I've got 5 trees: two red trees and 3 blue shiny red trees (same Geometry). Each tree have is own Material or each tree have a reference to the same Material?
The Material own by a Mesh is a copy of a Material or a reference to the original Material?
In my Material I have texture offset and scale, it's useful for drawing a part of the Texture only, but how can I manage offset and scale if my Material is shared and each owner didn't use the same values? (In the case where all my objects are in the same texture atlas)
If each mesh have his own Material instance (a copy of an original Material) how can I know if each Mesh have the same Material? (An ID per Material may be?)

Thanks a lot!

sentences:
Looping trough a std::map won't work Answer :

  Turns out the for loop did work.

  Lesson Learned :

  You might want to
  try putting something in it to see if the code inside actually
  executes....

As the title says I would like to loop trough a std::map filled with sf::Sprite*'s.

However when I try it like this :

(in .h file)

std::map<std::string, sf::Texture*> textures;

(in .cpp file)

for (auto const &ent1 : textures)
{

}

It tells me that the Debug Assertion Failed!.

With this error "log" :

  Program: C:\WINDOWS\SYSTEM32\MSVCP140D.dll
  File: c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtree
  Line: 237

  Expression: map/set iterator not dereferencable

At this point I've tried reading some on how it works, and I don't understand what I'm doing wrong.

I've been playing around with it, removing some parts and adding new ones.

I'be been removing const, removing the & and combining those two.

sentences:
Crystal Transparency(Shadows) I'm having a really hard time getting the shadows the become transparent.  I've looked online and followed tutorials, but it's not working(See Below).

It may be a little difficult to see so you should look at it in a different window.

How do I add transparency to the shadow(color less saturated), in a way to make the light look like it goes through the crystals?

sentences:
Correct way to handle A* no pathing? I'm developing a little game for fun and I wrote a pathfinding system based on the A* algorithm. What is the best or correct way to deal with unavailable paths?

A* by default will go through every node on the grid until it either finds the target node or it has exhausted all of them. This can become problematic if certain areas are cut off into "islands" and A* tries to find a path there.

The obvious solution might be to flood fill regions and check in advance, but the problem is that I plan for my world to be a bit dynamic - new areas might appear, some areas which are accessable at one point might not be later, etc.

Another solution I've read about is that I can limit the amount of nodes it's allowed to search before it gives up, but this sounds a bit hacky and something I'd like to avoid if possible if there are better ways, because it means that there could be a very long and complex path to the target but it'll still not find it just because of this limit.

So how should I do it? I appreciate any help here, fellow devs!

sentences:
How can I duplicate this color/hue shifting effect in C#? I am looking for a way to duplicate this color shifting effect:

I don't think it matters but the starting frame would be this:

My instinct was that some type of hue shift is occurring in a way that causes it to loop back over. The problem arose when I saw that the source of this effect was taking any image of any color palette and reducing it to this effect, always taking 14 frames to finish the loop.

Input frame:

Result of effect:

I'm not sure how this effect is being performed, I'm hoping someone will be able to help me duplicate it. This is for a game where I'm using C#. If I can get something working in C# I'll probably move it over to a shader. I'm using the MonoGame platform.

sentences:
Dynamic character in UE4 I've been creating simple characters in Blender for a while, and now I want to add dynamic details to them. I managed to make a cloak with using UE4 cloth physics.

However I have trouble with smaller things. As english isn't my primary language, I don't even know how to name this issue properly. Example of things I want to achieve:

Simple polygon ponytail that bounces while running
Edges of clothes, like shorts are loose and also move while running
Accessories like bracelets or dangling keys on wrists / hanging from clothes which also move a bit while walking

Is this something I do in Blender and export, or is it something I add in Unreal?
What should I look for?

EDIT:
So far I found this thanks to a comment:
https://docs.unrealengine.com/en-US/Engine/Animation/NodeReference/SkeletalControls/AnimDynamics/index.html

But if anyone else has suggestions, please keep them coming.

sentences:
Programmers/Designers: working with artists Expanding on this question, what information do I need to communicate my artistic goals for a game to a professional artist?

Assuming I'm an indie programmer. and I've found or hired an artist to for my game, how to I go about setting a template or a brief for the look and feel of my game?

sentences:
Launching a projectile and landing it in a specific spot with different elevations? I have a starting position for a projectile and a target position I want it to land on given an initial x and y velocity.

Doing this on a level field is fairly straightforward but I'm struggling to figure out how to do it on two different levels.

I've crudely illustrated what I'm trying to accomplish:

sentences: How do I measure a string that will be drawn with SpriteBatch? Is there a way to measure width and height of an ever-changing string (a player's score, specifically)?

sentences:
How do I create an in-app update for a mobile game? I'm researching how to make an in app update on mobile game.

When there is a hotfix, or an update, I don't want users to have to go to Play store, or App Store to update, but rather for them to update inside the game (like in Clash of Clans). I want to do this because Apple takes too much time for reviewing.

I found https://ionic.io, they use Cordova to embebed HTML inside. We can do live update, rollback to old version with a click. This is pretty suitable for normal app, but for game, the performance is not great.

How can I create an in-app update like this?

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:
Procedural vs Event Driven Paradigm Clash in HTML5 I've been writing some console-based games in python and got in the habit of having a "mainloop" that looks something like this (if it were JS):

// mainLoop would be
function mainLoop() {
    while ( state === "playing" ) {
        if ( turn === "player" ) {
            playerTurn(table, board);
            turn = "computer";
        } else {
            computerTurn(table, board);
            turn = "player";
        }
    }
}

This is great as I can easily swap out computer for player2 so the basic structure doesn't change much for AI vs 2-player games.

However, in HTML5 things get really confusing. Part of me wants to hold onto the simplicity of my mainloop structure, but since I need the listen for events in JS, it looks like I need to completely shift paradigm.

I did actually get what I want happening using

document.addEventListener( "click", function ( event ) {
    if ( event.target.matches( "#reset" ) ) {
        init( );
    } else if ( event.target.matches( ".cell" ) && turn === "player" ) {
        playerTurn( event, table, board );
        if ( hasFreeSpot( board ) ) { // don't switch player if board full (or win position?)
            computerTurn( table, board );
        }
    }
}, false );

and updating turn to player or computer within playerTurn() and computerTurn()

It's hard to reproduce a working example of what I'm trying to do as the program is quite long. what I'm looking for here if possible is some big-picture advice on how to implement player vs computer games in HTML5 where the player move comprises of clicking on some element.

Is there a basic template I can use for this kind of thing? Is the idea of a mainloop relevant in this context?

Is seems my current approach is a very confusing hybrid of procedural code for the computer turn and even-driven code for the player turn.

I will be happy to edit my question an include a full example if that is what you guys want here.

Thanks in advance.

sentences:
Detecting mouse clicks in Unity UI Beta I want my game script to detect mouse clicks everywhere on my screen, except one corner where I have a pair of buttons to control the sound and will be handled separately. To help identify this corner, I've created a soundPanel object with the Rect Transform component (available in the Unity 4 Beta 17+) and have sized/positioned it appropriately in the editor in my UI layer.

In my game's script, I have passed in this corner object, and tried using it in the following way:

bool tap = (Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0))
           && !soundPanel.rect.Contains(Input.mousePosition);

Clicking in the soundPanel still triggers a tap. I figured this is because the mouse position and soundPanel.Rect are not in the same coordinate space. Since the documentation on the new Unity Beta UI is a bit lacking / hard to find, I tried converting the mouse coordinates to everything I could:

if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0))
{
    if (soundPanel.rect.Contains(Input.mousePosition)) { print("Raw"); }
    if (soundPanel.rect.Contains(camera.ScreenToViewportPoint(Input.mousePosition))) { print("ScreenToViewportPoint"); }
    if (soundPanel.rect.Contains(camera.ScreenToWorldPoint(Input.mousePosition))) { print("ScreenToWorldPoint"); }
    if (soundPanel.rect.Contains(camera.ViewportToScreenPoint(Input.mousePosition))) { print("ViewportToScreenPoint"); }
    if (soundPanel.rect.Contains(camera.ViewportToWorldPoint(Input.mousePosition))) { print("ViewportToWorldPoint"); }
    if (soundPanel.rect.Contains(camera.WorldToScreenPoint(Input.mousePosition))) { print("WorldToScreenPoint"); }
    if (soundPanel.rect.Contains(camera.WorldToViewportPoint(Input.mousePosition))) { print("WorldToViewportPoint"); }
    print("-------------------");
}

When I click with the above code, "ScreenToViewportPoint" and "ScreenToWorldPoint" print no matter where I click, and no others trigger. I suspect I need to transform the soundPanel somehow.

Here is the Hierarchy, Scene, and Inspector. The selected rect is the soundPanel, and it is in the bottom-right of the UI Canvas:

sentences:
How to render a PNG-file on the screen with SDL? I'm coding a 2D platformer in using C++ and SDL2. I've started by coding the GUI, however I'm unsure how to get the menu buttons onto the screen and in the right positions.

How do I load the PNG menu buttons onto the screen in a way that I can adjust them to get them in the right spots?

sentences:
MeshParts - Why do they exist? For my current game I'm working on I've decided to implement a custom model class to store my models in. Reasons being is that I want to make adding new models as painless as possible for the rest of the team without needing to go through the XNA/Monogame content pipeline (Them having VS + Dev framework installed just to compile a few models, or passing them onto me to compile every time a change is made would just get tedious further on, not to mention different timezones when testing slowing things down)

To this end I've been looking at the model structure of different frameworks, XNA/Monogame, SharpDX and AssImp.NET being the main ones. The structure for XNA/MG and SharpDX is Model->MeshCollection->MeshPartCollection, whereas Assimp only has Scene->MeshCollection.

From previous experience in XNA, MeshParts seem kinda redundant. None of my meshes ever had more than one, and a lot of the XNA examples I've seen only ever had one mesh part per mesh.

From everything I've experienced and seen, MeshParts seem redundant, surplus to requirements and just makes for an extra level of complexity (Should I use a loop, or just hardcode it to use the first element in the collection?). Is there some useful aspect of them that I am not aware of, or a particular use case or scenario where they are actually useful?

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:
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:
2D isometric game with 3D prefabs Is it possible to have a 2D isometric game in Unity, but also have 3D prefabs in the scene?
Will that work or should I make the game in 3D with an isometric camera?

sentences:
Loading and using GLEED2D levels into WP7 Game I've been trying to use this modified version of GLEED2D that includes WP7 support,

The progress so far, is I've been able to load the level XML file to the project and read it successfully thanks to This answer

I got in touch with the author of the modified version, he added the answer to the wiki

The problem now is I cannot implement the following steps, according to the wiki, I now need to:

  "enumerate the levels and then enumerate each item in each level. For
  each item, add the object/sprite into XNA."

My initialize() method now looks like this

    protected override void Initialize()
    {

        Stream stream = TitleContainer.OpenStream("Content/leveltest.xml");
        //Stream stream = TitleContainer.OpenStream("Content/level.gleed");
        XElement xml = XElement.Load(stream);
        level = LevelLoader.Load(xml);

        base.Initialize();
    }

When I debug I find the level object loaded successfully and has list of layers and list of items inside the layers, but I'm not sure how to continue my way from here to Display the level items on the screen.

Any idea?

--UPDATE--

I added

foreach (Layer layer in level.Layers)
{
   foreach (LayerItem item in layer.Items)
   {
      item.Properties.Visible = true;
      //something should be added here to draw
   }
}

I am not sure what to add now to draw the item into it's position on screen !?

sentences:
Are there any serious advantages for C++ compared to C? so I know a little bit about C (read like a few university level textbooks on it, I am not an experienced programmer or anything) and now I would like to learn the ropes of the Unreal engine to fidle with it an make my first 3D game :P (I know it's a huge step easier said than done but I just want to go with it)
My question is about how wise would it be to stuck with what I already know and built upon it?
Will I hit soon some nasty walls while trying to make things work using C should I instead use C++ or will I be fine? In other words does C++ will make my life easier or can do things I wouldn't be able to do with C or that I needed serious puzzlesovling skills and much bigger hardware level knowledge in order to overcome them while using C?
Long story short should I invest more time expanding what I know in C or should I start learning C++ instead which would save me time and bring me the most comfort?

sentences:
Default Controller Mapping? It seems like different controllers have their buttons mapped differently. I was wondering if there was some sort of standard. X is the first button, then A, then B, then Y. I looked and couldn't find any standards anywhere.

EDIT: I'm specifically talking about controllers used with computers. Usually with 2 joysticks, a hat, 4 letter buttons, 2 triggers, and 2 bumpers.

sentences:
unity spriterenderer scale to fit screen portion let me explain what i have.
a camera that render only a sprite ( sprite renderer) and what i'm looking for is to scale that sprite renderer to fit a screen portion (not the entire screen) for example 0.145 (normalized) anyone can help me?
fix : i mean, from 0 to 0.145 so the entire area ( it will be a 125x125 image ) so i need to keep the aspect ( same width and height) and i'm using orthographic camera

sentences:
Collision detected on only the latest added tile I'm making a 2D platformer and I'm using tiles as the ground. I have a Tile class and I'm loading the tiles with the help of a list in the main game class:

public static List<Tile> tiles = new List<Tile>();

The following is how I load the tiles from the list with 2 for loops in the LoadContent method:

for (int i = 0; i<=20; i++)
            tiles.Add(new Tile(Content.Load<Texture2D>("tile"), new Vector2(i * 16, 304)));
        for (int i = 0; i <= 10; i++)
            tiles.Add(new Tile(Content.Load<Texture2D>("tile"), new Vector2(i * 16, 288)));

Now, I wanna apply some kind of gravity and collision, still it's just something primitive. I'm applying these inside a Player class within a foreach loop like this:

foreach (Tile tile in Game1.tiles)
        {
            if (isInAir == true) { velocity.Y = 100f; }
            else { velocity.Y = 0f; }

            if (recBot.Intersects(tile.rectangle)) colBot = true;
            else colBot = false;
        }

        if (colBot == true) isInAir = false;
        else isInAir = true;

The issue is that the collision occurs only on the last loaded tile by the for loop in the LoadContent method. The sprite stops falling when it collides with the last added tile, but when I'm moving left or right and it intersects with other tiles, it doesn't apply the collision and it falls through them.

I'm kinda new to programming, so take me easy :) Any other things that you need to know, just tell me and I'll add more details or code!

sentences: What do I need to change in Box2D to work in pixels? Box2D seems to be set up in such a way that you cannot work in pixels (i.e. physics scale = 1). It produces very strange results as it hits maximum speed limits at low speeds and looks very strange. It only seems to work well at a physics scale of around 15 or 30. For me, working in pixels is the logical way to handle physics and movement in a game, as you are already using that measurement for lots of other things. I don't want to have postionX/30 all over my code, so what variables do I need to hack in the box2d source in order to make physics scale 1 work as if it was physics scale 30? I'm using the latest version from box2dflash.org.

sentences:
Most efficient way of brighten and darken sprites with OpenGL > 2.0 So I have been shading (brighten/darken +adding color) my sprites by using glTexEnvf with GL_MODULATE and GL_ADD and a vertex color.
I only had to rebind the batch every time I needed to change from modulate to add and vice versa.
it was not perfect but worked well enough.

However libGDX 1.0 dropped support for OpenGL1.1 and the only way I see is to use shaders. I want to stay up to date and therefore want to update.
I am new to shaders but I found some code that works to brighten a sprite. However as far as I understood I need to rebind the batch every time I want another value for my brightness => batch binding on every sprite I render. That is not very performant.

Is there a way to change values between the bindings? (I don't think it's possible because shaders get compiled afaik).
Or do you have another idea how to archive this effect with openGL2.0 (like I did before)?
Or is rebinding every sprite the most efficient way with OpenGL2.0?

sentences:
How to execute a piece of code for X seconds in Andengine? I need to execute some code in my game for 5 seconds using the Andengine framework. So far, I've tried with the onTimePassed update handler:

 scene.registerUpdateHandler(new TimerHandler(5f, true,new ITimerCallback() {

            public void onTimePassed(final TimerHandler pTimerHandler) {
                                    // code here
                }

But that only executes AFTER 5 seconds have passed by. I've also tried with the onUpdate but, keeping apart performance issues, there's no way I can count how many seconds have passed by since the execution entered the loop. If it helps, I only need the code to execute once per second for 5 seconds.
Thank you!

sentences:
Andengine reducing sprite quality? I have a problem with bandings using andengine. When painting a picture on PC and uploading it to my phone, they look exactly the same. But as soon as I use that bitmap (PNG) in Andengine, I have bandings (big color steps).

Now I know that my display is capable of displaying the image right and I know how to us dithering but it bothers me. Does anyone know how to disable this quality reduction in Andengine?

sentences:
I want to drop a platform after I land on it I want to disable z-axis translation lock 2 seconds after my player hits the object in question. I am using Unreal 4. Been slamming my head against it for a week and a half, please save this newb.

I just noticed this is the iteration where I enabled gravity instead of disabling z lock... the intended result is be the same for both of these

UPDATE

now the thing drops but it doesnt wait for the timer

UPDATE! I DID IT!

sentences: Are square or hex grids better for pathfinding? Is there any significant difference between using a square or hexagonal grid for the area searched by a path finding algorithm. In other words, is square or hexagonal better, and if so why.

sentences:
UDK iOS: System Requirements confusion Unreal Development Kit for iOS was recently released. The system requirements note that Windows is needed. Does this mean that iOS game development is possible on a PC now?

I am confused since I thought iOS development required an OSX machine.

Thanks in advance.

sentences:
when to do A* pathfinding? I'm trying to build my first game, a really simple RTS like Age of Empires but I have a question about pathfinding.

When do this kind of games usually do pathfinding?

I've read some games do a global pathfinding once at game start but I'm not sure if that will fit this kind of games.

Do they usually calculate pathfinding each time a game entity starts a new task and has to move?

How do they handle when a obstacle suddenly appears on the path? Do they re-calculate pathfinding on every step? Or do they check if the current path is clear on every step? Or they just walk the current path until they actually hit the unexpected obstacle?

Actually if you know a link to a source code of pathfinding on some RTS game I would really appreciate it.

Thanks in advance

sentences:
Different kinds of movement in component based entity system I am writing a pong clone with a component based entity system.
But I am having trouble with the different kinds of movement in the game.

The problem is the following: My paddles will just move up and down, so I only need a Y-velocity for these.
But the ball can move in each direction. So the ball will need an angle and a velocity.
Now my question is: Is it usual to put the data for moving a ball in another component than the data for moving a paddle?
Because if I would do so, I would need two systems just for movement. Is that a good approach?

A little bit information about my system: My entites are only IDs. I have an entity manager which holds all the entities and the linked components. Components only hold certain data on which systems operate.
Basically I am using this approach: Tutorial

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:
How does the Direct3D 9 rasterizer determine triangle coverage? I'm working on a software rasterizer to use in my project. I have implemented one that works well, however, often my rasterizer under or overestimates triangle coverage. I need perfect emulation of the hardware rasterizer. I'm using the exact same rasterization rules from MSDN (including the top-left rule).

How does the Direct3D rasterizer determine which pixels are covered by a triangle? What's the algorithm being employed? Does it rasterizer use the pixel center coordinate or the pixel's top-left coordinate when determining triangle coverage?

When I use the pixel's top-left coordinate I get better results. I've also been determining the planes perpendicular to the triangle's edges, then admitting pixels if their coordinate is "behind" each plane.

sentences:
Rigidbody2D loses speed on collisions I'm trying to create a simple Breakout-style game. In my game, the ball strikes a paddle that moves with the player's mouse. Depending on the position of the strike, the ball changes its direction. This allows the player to aim the ball.

The problem I'm having is that each time I set the position, the ball loses velocity. I've tweaked every Physics2D setting I could find, but I'm not seeing any changes. Here's what my Ball class looks like:

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

public class Ball : MonoBehaviour {

  public float initialVelocity;
  public float collisionAngleRange;
  public Paddle paddle;

  private Rigidbody2D body;

  public void Start() {
    body = GetComponent<Rigidbody2D>();
    body.velocity = VectorUtilities.AngleToVector2(135) * initialVelocity;
  }

  // When colliding with the paddle, use the position of the strike to adjust the ball's position.
  public void OnCollisionEnter2D(Collision2D collision) {

    // Ignore the object if it's not the paddle.
    if (!collision.gameObject.CompareTag("Paddle")) { return; }

    // Get the collision coordinates
    Bounds bounds = collision.gameObject.GetComponent<BoxCollider2D>().bounds;
    float left = bounds.min.x;
    float right = bounds.max.x;

    Vector2 contact = collision.contacts[0].point;

    // Interpolate the contact point and determine the angle.
    float interpolation = (contact.x - left) / (right - left);
    float angle = 90 - collisionAngleRange / 2 + collisionAngleRange * (1 - interpolation);

    // Change the direction of the ball without affecting its speed.
    body.velocity = VectorUtilities.AngleToVector2(angle) * body.velocity.magnitude;

    // Log what's happening with the velocity
    Debug.Log(body.velocity.magnitude);
  }
}

The VectorUtilities class looks like this:

using UnityEngine;

// A set of utility methods and extensions for Vector2 and Vector3.
public static class VectorUtilities {

  public static Vector2 AngleToVector2(float degrees) {
    return new Vector2(Mathf.Cos(degrees * Mathf.Deg2Rad), Mathf.Sin(degrees * Mathf.Deg2Rad));
  }
}

Here are my Ball game object's Rigidbody2D and CircleCollider2D settings:

The paddle's settings:

The material settings:

Physics2D settings:

I recognize I could solve this problem by multiplying the ball's normal vector by my desired speed, but it's more important to me to understand why this is happening and to fix the underlying problem. Why does the ball lose speed on every collision, and how can I prevent that from happening?

sentences:
Transform coordinates in vertex shader or in geometry shader? Currently I have a vertex shader which just passes the coordinates to the geometry shader and a geometry shader which does some sort of tessellation. Now I also want to transform my model with a 4x4 matrix before applying the tessellation.

I could apply the transformation either at the end of my vertex shader or in the beginning of my geometry shader.

Does that make any difference? Is there a recommended practice?

sentences:
First frame has a much longer delta time than other frames I had a problem where my AI moved extreme at the first frame and then normal after that. I then figured out it was my delta. It's about 0.016 seconds (60 fps), but the first frame was about 19000 seconds, which is obviously impossible. Does anybody know what might be happening? Also the delta later on likes to oscillate from 0.01 to 0.03.

    long time = Sys.getTime() * 1000 / Sys.getTimerResolution();
    float delta = (time - lastFrame) / 1000f;
    lastFrame = time;
    return delta;

That's the delta code.

EDIT: Wow, you guys really like to take the fun out of composing a question with all your editing.

sentences:
How can I achieve glow effects similar to those in  WoW? I've recently implemented a glow effect using a gaussian filter and could not get the full effect I was wanting. I'm curious to know if how certain glow effects are done in WoW. Like this image:

Around the sword is a really nice glow effect. How might this be done? Also, sometimes in WoW you see these glow effects take a life of there own. Like the purple glow in this pic:

Are these accomplished with particle effects?
Are there any good resources/tutorials that could help with someone to learn how to do these effects?

sentences:
How do you calculate if a line is facing a curve? Given the 2 points describing a line segment, and the 3 points describing a quadratic bezier curve, how do you calculate if the line is facing towards or away from the curve?

The line has a fixed length, and is stored in 2D as x1/y1 and x2/y2. The curve is a quadratic bezier curve, and is stored as x1/y1 (control point), x2/y2 (bezier point), x3/y3 (control point).

sentences:
Questions for QueryAABB I'm currently having trouble getting my head around QueryAABB, and hope to find some answers here.

The LowerBound of an AABB the upper-left corner (and vice versa). Why is that and what idea is behind that?
When exactly does an object count as inside the AABB and is therefor found by a query?

sentences: How important is music to mobile phone (smart PDA) games? Specifically iPhone/iTouch, Droids, and the new Windows Phone 7? I don't know how to quantify this, or if any research has been done. I am wondering how important the music is to the gaming and what % of games come with music at all, if good music at that.

sentences:
Multiplayer XNA without a LIVE account? (PC) I decided it was time to stick in a bit of multiplayer into my game, but came across my first hurdle when i quickly downloaded an example from the XNA website.

It prompted me with a login to live. However i really DO NOT want my game to use live accounts.

This is PC btw.

Basically i wanted to know, is it possible to have multiplayer with XNA without logging in through a live account?

Also, is it better to stick with the built in XNA networking, or use a totally different library such as lidgren?

sentences:
is there any method to simply ignore some files in unity build? as im trying to build my new app on unity android specially when i want to use gradle, there is always some conflict with manifest or libraries and .....

for debug and problem exploration i need to ignore some folders to check for those bugs instead of need to move them somewhere else.

i just thought about git branching but it can cause lots of branches and maybe not efficient

sentences:
How to determine collision direction between two rectangles? I am trying to figure out how to determine the direction a collision occurs between two rectangles.

One rectangle does not move. The other rectangle has a velocity in any direction. When a collision occurs, I want to be able to set the position of the moving rectangle to the point of impact.

I seem to be stuck in determining from what direction the impact occurs.  If I am moving strictly vertically or horizontally I manage great detection.  But when moving in both directions at the same time, strange things happen.

What is the best way to determine what direction a collision occurs between two rectangles?

sentences: Camera Coordinate To Screen Coordinate I want to convert the camera coordinate to screen coordinate. I have asked this question because my camera is 48m wide and 32m high but my screen is 480x320 pixels. So whatever collision point I get those are based on camera. Also I like to mention that my camera set at center of the screen. So I get (0,0) coordinate at middle of the screen. At collision time I put some particle effect but now that particle effect not at correct place in the screen. So someone from community please help.

sentences:
Why when using Lerp and StartCoroutine to Lerp between -3 and 3 it's not working? private bool alreadyFading = false;

Then
private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Teleporting Object")
        {

            if (!alreadyFading) StartCoroutine(Teleport(-3, 3, 5f));
        }
    }

And
IEnumerator Teleport(float from, float to, float duration)
    {
        alreadyFading = true;

        var timePassed = 0f;
        while (timePassed < duration)
        {
            var factor = timePassed / duration;
            var value = Mathf.Lerp(from, to, factor);

            material.SetFloat("_DissolveAmount", value);

            yield return null;
        }

        material.SetFloat("_DissolveAmount", to);

        alreadyFading = false;
    }

Using a break point it's getting to the Teleport function but it's not changing the values from -3 to 3.
It does nothing to the shader to the property _DissolveAmount.
I want it to change the value from -3 to 3 with duration once not ping pong. but it's not just it's just don't do anything.

sentences:
Torch fire always up regardless of handle direction I have a prefab from some asset pulled into our project.  It is a simple torch.. handle and a particle system for the fire.  Works perfect if mounted on a wall and torch angle adjusted no problem.

Now the problem.  I attach the torch to the hand of a walking person, so the arm is not "fixed" and is in a more fluent movement environment.  How can I adjust this (C# scripts possible to attach too) so that the fire element is always in an upright burning position even if the arm/hand are in a somewhat swinging position.

I'm still a little early on in my gaming exposure, but 3+yrs in C#.net and OOP experience.

sentences:
Destroy multiple actors by pressing a button I'm making a simple project to learn Unreal Engine.

I have 50 actors (blueprints) and at the start a function will loop 5 times and spawn 5 of the 50 actors randomly.

How can I destroy the actors by pressing a button, irrespective of which of the 50 actors are spawned?

sentences: Why might a PC game have a set number of resolutions? There's an obvious reason games choose to use a set number of resolutions in fullscreen mode - a machine only has access to its own set of resolutions, and the intersection of the two sets determines what resolutions the game can run.  However, even in windowed mode the user is often limited to some set of resolutions.  What are some reasons games might opt to limit the size of the window in this way, rather than let the user dynamically resize the window themselves?

sentences:
Effective way of transferring data to HLSL shader in MonoGame and storing it I'm toying around with HLSL shaders in monogame. Lets say I want to use a structure in my shader which is like this:

struct Light
{
    float2 pos;
    float  intensity;
};

I'm going to use a varying amount of these Light objects in each frame draw call.

In what kind of structure/array should I store my Light objects in my shader? If I understand correctly I can declare an array like this:Light lights[n];, however n needs to be known at compile time. I can declare a stupidly large array and fill it with some default initialized garbage that I can check for, however this seems very inefficient.
Can I use constant buffers to alleviate my pain? This question makes it seem like it would be an efficient way of transferring and using data on the GPU (I have some CUDA experience, so I know about constant memory and such), but I can't wrap my head around how to use them in this case.

sentences:
What is the "correct" way to render to a cubemap using Vulkan? After searching far and wide for the solution to this, the only one I have been able to find that verifiably works is to the render a face to a framebuffer and then use a memcpy to copy that framebuffer over to the respective part of the cubemap image.

This sounds stupid.

So I ask: Surely there must be some way to render directly to one face of a cubemap image, seeing as it's such an important feature in a whole lot of 3D rendering techniques. How do you do it?

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:
Calibration using quaternion I have an external hardware which gives me quaternion values.
Now I would like to calibrate the device at a certain position and show tilt variations from that position on the UI.
For example, I have a small 3D plane model. Whatever position the device maybe, after calibration the model's back should be facing the user with the tail up and from that position the rotation should be relative to the device's rotation.
How to do that?
Simply recording the quaternion values at the calibration position and using that to subtract from the current quaternion values from the device and setting to the 3D model is not working.

Below is the code where I apply the calibrated values:

imu.xAxis = (Style.qX + (imuData.quatX - Style.bX))
imu.yAxis = (Style.qY + (imuData.quatY - Style.bY))
imu.zAxis = (Style.qZ + (imuData.quatZ - Style.bZ))
imu.wAxis = (Style.qW + (imuData.quatW - Style.bW))

where qX,qY,qZ and qW are the initail postion of the model, quatX, quatY, quatZ and quatW are the current quaternion values from the device and bX, bY, bZ and bW are the quaternion values at the calibration position.

sentences:
Unity Seamless Terrain I am programmatically generating terrain using unity's terrain object and assigning height maps to it via the terrainData, the problem is that there are seams even when using the GroupingId(which is used for auto connect).
I even tried creating a terrain object in the editor with neighbours, and modified their terrain data via script, seams still there.

I have also tried SetConnectivityDirty after applying terrainData.

Most people who have reported this seemed(lol) to have issues with their normals at the edges, I cant see that being the issue here, but if it is, how do i approach solving it given I am using unity terrains.

If there is no good answer I will have to resort to custom meshes and lose all the nice terrain tool functionality.

Edit: Here is how I'm setting heights.

var terrain = GameObject.Find("test").GetComponent<Terrain>();
var terrainData = terrain.terrainData;
var noiseMap = Tool_Generators.GenerateNoiseMap(chunkSize, seed, scale, octaves, persistance, lacunarity, 0f, 0f);
terrainData.SetHeights(0, 0, noiseMap);

Then the actual noise generation is just a 2D array of heights, i have been using a simplified version with only 1 pass for testing.

  public static float[,] GenerateNoiseMap(int chunkSize, int seed, float scale, int octaves, float persistance, float lacunarity, float offsetX, float offsetY)
  {
    float[,] noiseMap = new float[chunkSize, chunkSize];

    for (int y = 0; y < chunkSize; y++)
    {
        for (int x = 0; x < chunkSize; x++)
        {
            float noiseHeight = 0;

            float sampleX = (x + offsetX) / scale;
            float sampleY = (y + offsetY) / scale;

            noiseHeight = Mathf.PerlinNoise(sampleX, sampleY);
            noiseMap[y, x] = noiseHeight;
        }
    }

    return noiseMap;
  }

sentences:
How do I make an area in the screen clickable with XNA? I am programming a penalty shoout game, my question is how make an area in the screen clickable with XNA? I know that for seeing the mouse I have to use:

this.IsMouseVisible = true;

But I want this for the direction of the soccer ball? Any ideas?

I want something like this or this but I don't find anything about this in XNA.

sentences: Custom node editor in Unity Im currently making a game on unity, and in the game i want to make quest system to be flexible, as the game world is generated randomly. I also want to make it easy to create quests for myself and possibly modders. So i want to make a menu for creating quests, however i couldnt find any info on how to make node editor window in unity(like shader graph, vfx graph, etc.). How do I do this?

sentences:
Acknowledgement reliability using UDP I have a question about UDP. For context, I'm working on a real-time action game.

I've read quite a bit about the differences between UDP and TCP and I feel I understand them quite well, but there's one piece that has never felt correct, and that's reliability, and specifically acknowledgements. I understand that UDP offers no reliability by default (i.e. packets can be dropped or arrive out of order). When some reliability is required, the solution I've seen (which makes sense conceptually) is to use acknowledgements (i.e. the server sends a packet to the client, and when the client receives that message, it sends back an acknowledgement to the server).

What happens when the acknowledgement is dropped?

In the example above (one server sending a packet to one client), the server handles potential packet loss by re-sending packets every frame until acknowledgements are received for those packets. You could still run into issues of bandwidth or out-of-order messages, but purely from a packet-loss perspective, the server is covered.

However, if the client sends an acknowledgement that never arrives, the server would have no choice but to eventually stop sending that message, which could break the game if the information contained in that packet was required. You could take a similar approach to the server (i.e. keep sending acknowledgements until you receive an ack for the ack?), but that approach would have you looping back and forth forever (since you'd need an ack for the ack for the ack and so on).

I feel my basic logic is correct here, which leaves me with two options.

Send a single acknowledgment packet and hope for the best.
Send a handful of acknowledgment packets (maybe 3-4) and hope for the best, assuming that not all of them will be dropped.

Is there an answer to this problem? Am I fundamentally misunderstanding something? Is there some guarantee of using UDP I'm not aware of? I feel hesitant to move forward with too much networking code until I feel comfortable that my logic is sound.

sentences:
Drawing transparent and opaque 3D objects. How do I preventing z-fighting? I am using a transparent weighted average algorithm to draw my transparent objects.

The transparent object is drawn with the following notable render states (the rest are default XNA values):

    CustomBlendState.Additive,
    DepthStencilState.DepthRead,
    RasterizerState.CullNone,
    SamplerState.PointClamp

The opaque object is drawn using the following states:

    BlendState.Opaque;
    DepthStencilState.Default;
    RasterizerState.CullCounterClockwise;
    SamplerState.PointClamp;

In the picture below there is what I believe is a z-fighting issue where the green block and the wooden block meet.

How can I keep the objects in the same location and stop this issue from occurring?

When changing the transparent object's DepthStencilState.DepthRead state to DepthStencilState.None the issue goes away.  While this is what led me to believe it was a z-fighting issue, the opaque object will then no longer occlude the transparent object when viewed from another angle.

EDIT:

Applying a depth bias to the situation makes no discernible difference either:

    public static RasterizerState SolidNoCullBias = new RasterizerState()
    {
        CullMode = CullMode.None,
        FillMode = FillMode.Solid,
        DepthBias = 1f,
        SlopeScaleDepthBias = 1f,
    };

EDIT 2:

Culling the triangles will cause the object to look incorrect as a transparent object should show both the inside and outside faces.

EDIT 3:

Depth Stencil State is as follows with 'LessEqual' compare function (doesn't solve the issue)

sentences:
Compress the variance in a set of numbers? I'm not sure if there's a better way to ask that, but I have a hovercraft which hovers by imparting force at each of four corners. I'd like to clamp the maximum variance between the thrusters so if one corner hovers over something higher altitude, the effect is less dramatic.

For example, if I had 4-6-8-10, I might want it to compress to 4-5-6-7.

sentences:
Sprite Animation of Tank Turning - how many items in sheet I have a question about this tank you can see below. It's from a game called Command and Conquer from the 90s. My question is, how is something like this animated as the tank is turning? Did the game designers draw the tank at a basic position and then draw it again +1 degree and then draw again +2 degrees, etc. until they get all the way around?

http://cnc.wikia.com/wiki/Mammoth_tank_(Tiberian_Dawn)?file=CNCTD_Mammoth_Tank_Ingame.png

sentences:
How do I prevent identity spoofing in a multiplayer game? I'm thinking about clients spoofing IP addresses, tricking other clients that they are the server; that sort of stuff. (I don't know much about this, so if this is completely wrong, please correct me.)

What should I do to prevent this? Because it is a real-time game, if I were to use encryption, I would use something fast and secure like RC4. Should I encrypt packet data with a key, that the server gives to the client?

If it makes any difference, I'm using UDP.

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:
Extract a rotation matrix given a camera direction (vector) and a up vector for the camera? I am having some issues constructing a rotation matrix from a camera direction vector.

The Up vector is computed from the camera direction as such:

up = cross(cross(direc,(0,1,0)),direc)

How do i given the up vector and a camera direction vector compute the rotation vector, that tells the camera how it should be rotated such that it points toward my object?

sentences:
How to turn off antialiasing in Graphics class? I have been using the following code with a Graphics2D buffered image

g.setRenderingHint(
  RenderingHints.KEY_INTERPOLATION,
  RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);

to ensure the image looks correct when scaled in.

If I use the Graphics class instead of Graphics2D it appears to auto anti-alias and present a zoomed image as blurred.

Is there a way to turn off anti-aliasing with the Graphics class so I do not have to use the Graphics2D class?

sentences:
UI background animation makes camera render beyond canvas, need fix? I have a background animation for a menu where I have to make the background larger than the canvas and drag it over it. Even though I am using a panel the same size as the canvas as a mask, this causes the camera to render beyond the canvas. How can I get this same effect while only rendering what's on the canvas?

w/o mask (so you can see how big this background is):

w/ mask:

running in editor (looks good):

running build of the game from executable (camera shows more than it should but nothing was changed):

The camera bounds are fixed to the canvas, as it should be, if I remove the animated background, so that is the major cause.

(BTW, I know the gifs look crappy but the animation is seamless; I just had to crop the gifs to reduce file size.)

Also, you guys might not be able to see, but the tiling pattern has a slight white border where the tiles meet (the sprite it uses is only like 227x227 on "repeat"), does anybody know how to avoid that?

UPDATE @ 1:12am PST: upscaling turd texture to 256x256 eliminates white border, as suggested by trollingchar.

sentences:
How to change animation start/end proprieties via script? Is there a way of changing the start/end proprieties (Transform, Rect Transform, etc..) of an animation via script? Like, I have 5 objects that start at the same position but should end in different positions, so I would like to change the end positions of each one via script.

As I haven't found a way to do this, I created 5 animations for this, but I'd like to just have one animation and change its proprieties in runtime.

sentences:
Integrating accelerometer data samples to get velocity and displacement I am working on an android app built in Unity that would allow the users to track their movements by just using the data coming from the device sensors. I have read about similar issues already and I am aware that this approach doesn't really give any good results in practice, due to the inaccuracy of the sensors, but I still need to measure the performance of this method for research purposes.
My implementation makes use of the Unity function InvokeRepeating to fetch the acceleration values at a certain rate and to then calculate the velocity and displacement by using a two step integration:
private readonly float dt = 0.001f;
private void Start()
{
    //...
    Input.gyro.enabled = true;
    Input.gyro.updateInterval = 0.001f;
    InvokeRepeating("AccelerationSample", 0.0f, dt);
}

private void AccelerationSample()
{
    Vector3 data = Input.gyro.userAcceleration * 9.81f; //Fetch the current acceleration
    lastAccel = data * kFilteringFactor + lastAccel * (1.0f - kFilteringFactor); //Apply Kalman filter
    totalAccel += data - lastAccel; //Accumulate the acceleration value

    vel = initVel + (totalAccel * dt); //Calculate the current velocity
    initVel = vel; //Update the initial velocity for the next frames

    distance += vel * dt; //Calculate the distance from the velocity value
}

The raw acceleration values are multiplied by 9.81f to match the real world acceleration (since the values coming from the gyroscope are normalized) and are filtered through a Kalman filter to reduce noise. The acceleration values are accumulated in order to take into consideration both the positive and negative parts of acceleration that the gyroscope provides when the device moves. The velocity and displacement values are then calculated using simple physics formulae.
This approach gives decent results when considering acceleration and velocity only. Though the displacement value does not seem to be updating as fast as I expected, and sometimes the calculations go completely off. Also, when the acceleration goes back to zero after any movement, the evaluated velocity does not go down to zero as well, therefore I need to find some conditions under which I can safely reset its value.
I hope I was able to properly describe the issue and that some of you might help me to revise my implementation and/or give me any hints on how I should go about the problem.

sentences:
How to create rounded TV edges effect in Unity? Is there a way to get rounded TV edges like these:

I want rounded egdes and the distortion effect, but I can't find a way to do this. I am using Unity 2017.

sentences:
How do I tag an empty space for an 'InAir' Boolean? I've been working with my game's settings to get the perfect jump height, gravity and movement that suits the player, however my problem is my player essentially floats back down to the ground, when I want them to fall much faster (it's a 3D game) but I don't want to tamper the gravity anymore solely for the player.

What I've done is created 2 extra Booleans alongside my Grounded Boolean, one for In Air and another for Extra Gravity, and this is where my problem comes in.

I have no idea how to set a tag to the empty space in the air, and I was wondering if anyone knew how to do this, or if there is a better method for detecting when my player is in the air?

This is what my script currently looks like:

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

public class PlayerScript : MonoBehaviour
{
    public float movementSpeed = 5f;
    public float jumpForce = 7;
    public float jumpSpeed = 7;
    public Rigidbody rigidbody;
    private Vector3 input;
    public GameObject Player;
    public bool grounded;
    public bool inAir;
    public float ExtraGravity;

    // Use this for initialization
    void Start()
    {
        var rigidbody = GetComponent<Rigidbody>();
        var col = GetComponent<CapsuleCollider>();
        Player = GameObject.FindWithTag("Player");
    }
    void FixedUpdate()
    {
        if (Input.GetKeyDown("space"))
        {

            if (grounded)
            {
                Debug.Log("Spacebar pressed");
                rigidbody.AddForce(0, jumpForce, 0);
            }

            if(inAir)
            {
                Vector3 vel = rigidbody.velocity;
                vel.y -= ExtraGravity * Time.deltaTime;
                rigidbody.velocity = vel;
            }

        }
    }

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

        if (Input.GetKey("w"))
        {
            transform.position += transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 5.5f;
        }
        else if (Input.GetKey("s"))
        {
            transform.position -= transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 4.5f;
        }
        else if (Input.GetKey("d"))
        {
            transform.position += transform.TransformDirection(Vector3.right) * Time.deltaTime * movementSpeed * 5.5f;
        }
        else if (Input.GetKey("a"))
        {
            transform.position -= transform.TransformDirection(Vector3.right) * Time.deltaTime * movementSpeed * 5.5f;
        }

        if (Input.GetKey(KeyCode.LeftShift))
        {
            transform.position += transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 20.5f;
        }

    }

    void OnCollisionStay(Collision collision)
    {
        if (collision.gameObject.CompareTag("Floor"))
        {
            grounded = true;
        }
    }

    void OnCollisionExit(Collision collision)
    {
        if (collision.gameObject.CompareTag("Floor"))
        {
            grounded = false;
        }
    }

}

sentences:
Unity Raw Image ui not showing when small I have some Images online that I download using WWW class and the use as UI elements.
So far all of them where working perfectly but now the one I added recently is acting up.
First you should know that all of the images are being downloaded by the same script and handled by that so there should be no difference between  their materials and stuff AFAIK (if I'm missing something please tell me).
Second , the problem is that this particular image only shows up when it's taking more than one sixth of the screen, for example if I make it bigger by changing it's size in the inspector, or if I go to scene view and zoom in on it, it starts to fade in the larger it gets on the screen.
Also, I changed the picture to something that was working properly to make sure it's not from the image.

    public IEnumerator AddTools(Tool Tool)
    {
        Texture2D T = new Texture2D(4, 4, TextureFormat.DXT1, true);
        SpriteTool ST = new SpriteTool();
        ST.TheTool = new UnityEngine.Texture();
        ST.ID = Tool.ID;
        ST.ToolName = Tool.Name;
        ST.Type = Tool.Type;
        WWW wWw = new WWW(Tool.Url);
        while (!wWw.isDone)
        {
            yield return wWw.progress;
        }
        wWw.LoadImageIntoTexture(T);
        ST.TheTool = T;
        ST.TheTool.name = Tool.Name;
        SpriteTool PA = ObjectTools.SingleOrDefault(p => p.ID == ST.ID);
    }

The SpriteTool Type is a class I made for storing some of the information needed to build the UI element later.

    private GameObject CreateButton(SpriteTool item = null, float angle = 0)
    {
        Texture2D T2D = (Texture2D)item.TheTool;
        T2D.SetPixels(T2D.GetPixels(0, 0, T2D.width, T2D.height));
        T2D.Apply();
        GameObject Tool = new GameObject();
        Tool.transform.SetParent(GUICanvas.transform);
        //There was some code for positioning the element and resizing it that I
        //did not include but I can see in the scene view that the size and the position
        //are what they supposed to be so that's not the problem
        Tool.AddComponent();//The type is RawImage
        Tool.GetComponent().texture = T2D;//the type is RawImage
     }

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: Feasibility of an XNA game on PC A friend and I are doing a 2D XNA game. Thus far, the API seems really cool and performance is acceptable.  My question is more towards the release of it though.  As other developers how have done games, how well have they done for you on PC (as far as downloads, sales, etc)?  I know the statistics about the Xbox360 from seeing it personally but, I was curious as to how successful these were on PC?

sentences:
Jump without bouncing in physics engine I am using Ogre3D as my rendering API, and OgreBullet as my physics engine.

I have an test entity that when the y part of the velocity is 0 and spacebar is pressed, the velocity changes to, lets say: (10, 10, 0) that is a forward jump.

The thing is that when it arrives to the ground, instead of staying still (like any normal human jump) it bounces like a box and changes orientation.

What would be the correct way of implementing a human-like jump in 3D? I fixed it using a if() in the update loop that sets the y-velocity to 0 if it touches the ground, but this doesn't seem the correct way of doing it.

sentences:
Can I change the background color where a sprite is shown in the inspector? this is how a sprite shows in the inspector.
It's white pixelart with transparent background.
Is there a way to change the background checkered pattern color in the inspector so I can actually see the sprite?

Note: I don't want to change any color in the game, just the background in the inspector, in the editor, so there's some contrast and I can actually see the sprite pattern.

sentences:
Port sandbox flash game to Android and iOS I'm want port my sandbox game to Android and iOS. Game written in AS3 (i'm use my simple 2d engine on stage3d). What do you recommend I use?

Haxe + OpenFL
MonoGame + Xamarin (C#), or other 2D engine in C# for mobile?
LibGDX + robovm (Java)
or AIR? It's slowly (seems).

I'm know C#, but don't know Haxe and Java. Game render many sprites: tiles (walls/blocks/liquids), background, entities, particles + lighting system.

My game: http://www.youtube.com/watch?v=y_KbvZCljnA

sentences:
How to rotate enemies on 2D radar and clip them to circle shape? I've been working on implementing a 2D radar for a 3D game lately, it's working fine in a very basic version. This is what is looks like:

It works by transforming the 3D coordinates of the enemies nearby to the local player space and then drawing those coordinates with the center-offset of the radar circle.

Transforming the enemy positions (and adding them to a vector):

if (LocalPlayer)
{
    Vec3    diff;
    double  distance;
    position.clear();

    for (auto i = commonInfected.begin(); i != commonInfected.end(); ++i)
    {
        diff = (*i)->GetPosition() - Global::camera->GetPosition(true);
        distance = diff.xz().Length();

        if (diff < 100)
        {
            position.push_back(diff);
        }
    }
}

Drawing the enemies:

    for (int i = 0; i < position.size(); ++i)
    {
        pos.x = position[i].x;
        pos.y = position[i].z;

        pos += {80, 80}; // center of the circle

        context->DrawText("x", pos.x, pos.y);
    }

However, the problem I have is that the plotted enemies do not rotate with the player and that plotted enemies can "go out" of the circle shape of the radar. How do I approach this kind of problem?

I have seen and carefully read through this question but couldn't understand it.
Plotting entities on a radar

sentences:
How much data can a phone's USB transfer per second? I'm conceiving a game that relies heavely on transfer speed from pc to phone. From USB it seems to be faster than wi-fi. But i can't get precise numbers on the net, everywhere tells me a diferente story.
Does anybody know how much data can i transfer from pc to phone via USB per second?

sentences: Is there any way to automaticaly rig a sprite? I'm making an AR test where the player takes a photo, them i get the bones from the pose and set a t-shirt sprite's bones position to match the ones from the photo. I was wondering if there's any way to make the sprite rigging process, with just the main bones like LRshoulder,LRelbow and LRHip, automatic in Unity.

sentences:
How can I implement a camera like the one in RotMG? RotMG, an MMO top-down shooter, takes on a unique 2d-3d style, and has an intriguing camera;

The game is obviously 3d, not simply isometric, and if you play the game and turn on camera rotation you will notice the effect the game produces, like so.

RotMG is made using flash, and I am currently experimenting with libgdx (which uses lwjgl/opengl). How should I go about implementing a RotMG-like camera?

sentences: What name should I give each difficulty level? I have a game with 4 difficulty levels (or levels of AI) and I'm wondering what to name them instead of the boring Easy, Normal, Hard, Impossible.

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:
How does Megatexture work? I've been thinking about developing a small engine not only to develop small experimental games, but also to serve as a base to test various rendering techniques and things like that. Right now I've been thinking a lot about how to handle textures and stumbled on megatexture, but this is something that is a bit puzzling. There is a lot of talk of it being better than the traditional approach to having a bunch of textures around and loading them as needed, but how does megatexture avoid this, I've read around that they use streaming and you can just stream bits and pieces of it as opposed to loading each texture individually, but how does that offer better performance, and isn't that just another form of tilling?

How do we sample such a texture when in a shader, do we stream part of it into memory then work on it. I've seen the latest videos of Rage and the texture do look great, but is that just the result of great artists or does the tech come into play.

To sum up, how does it work, why is it great and how could I do something similar.

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:
Collision doesn't work in isometric view I have problems with collision detection in my isometric game - the collision is on a different spot then the actual object is, its like the SDL_Rect  is somewhere else then the object itself which is impossible.
I checked the values with the debugger it seems there is everything right.

My player has Isometric movement. This is the calculation for the screenworld to isometric

Vector2 Vector2::PosToIso()
{
    return Vector2(x - y, (y + x) / 2);
}

When the player doesnt have the isometric movement the collision works fine.
I tried to calculate the the objec's x and y pos to iso and i tried with the normal 2D screen values same result.

Collision code:

    bool checkCollision( SDL_Rect a, SDL_Rect b )
{
    int leftA, leftB;
    int rightA, rightB;
    int topA, topB;
    int bottomA, bottomB;

    leftA = a.x;
    rightA = a.x + a.w;
    topA = a.y;
    bottomA = a.y + a.h;

    leftB = b.x;
    rightB = b.x + b.w;
    topB = b.y;
    bottomB = b.y + b.h;

  if( bottomA < topB )
    {
        return false;
    }

    if( topA > bottomB )
    {
        return false;
    }

    if( rightA < leftB )
    {
        return false;
    }

    if( leftA > rightB )
    {
        return false;
    }
    return true;
}

sentences:
LibGDx android : Show animation on button click I am trying to create an application using libgdx where i need an animation to be played on pressing an image button, i've been able to achieve it using this code

   if(slapBossFlag==true) {
        currentFrame = animation.getKeyFrame(timePassed, true);
            batch.begin();
            timePassed += Gdx.graphics.getDeltaTime();
        Gdx.app.log("time","time is"+timePassed);
            batch.draw(currentFrame, screenWidth / 2 - ((currentFrame.getRegionWidth()) / 2), screenHeight / 2 - ((currentFrame.getRegionHeight()) / 2));
            batch.end();
            slapBossFlag = false;
    }

the problem is the animation goes by too quickly.

i've tried setting timePassed to zero when slapBossFlag is false, and that didnt work.

Can anyone help?

sentences:
How to move sprite mimicking mouse/touch position on some part of the screen? I am having a difficulty and I am been doing it wrong, I think. I want to move sprite relatively to touch. Just like when you are playing space shooter like 1943. I just learning some math and try to mimic those control by myself but I have no luck doing so far.

I have snippet of code, its far from perfect, I was able to move the sprite relatively but keeps jumping off when I first touch and moved.

Here is what I got so far:

When the touch move:

void Trooper::onTouchMoved(cocos2d::Touch * touch, cocos2d::Event * event)
{
    mPreviousTouchPosition = mTouchMovePosition;
    mTouchMovePosition = touch->getLocation();

    cocos2d::Vec2 delta = utility::Object::getPosition() + (mTouchMovePosition - mPreviousTouchPosition);
    delta = utility::Object::getContainingScene()->convertToNodeSpace(delta);

    utility::Object::setPositionTo(delta);

    CCLOG("Coordinates when moved : %f , %f" , delta.x , delta.y);
}

Here is the data I logged and the first line for coordinates when moved seem anomalous to me:

Coordinates on touch : 633.746338 , 395.874329
Coordinates when moved : 883.746338 , 644.876404
Coordinates when moved : 882.747925 , 644.876404
Coordinates when moved : 880.752136 , 642.879517
Coordinates when moved : 878.755249 , 641.881104
Coordinates when moved : 876.758423 , 640.882690
Coordinates when moved : 874.761536 , 637.887939

I shouldn't be seeing this kind of huge number when my actual sprite is on 250 , 250. The difference of previous touch position and the current touch position should be added to the sprite position. I wanted to achieve relativeness regardless I touch and move. The sprite should mimic that. Did I missed something or anything wrong with my math?

Thank you!

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:
How can I tweak this A* search pathfinding algorithm to handle different terrain movement values? I'm creating a 2D map-based action game with similar interaction design as Diablo II. In other words, the player clicks around a map to move their player. I just finished player movement and am moving on to pathfinding.

In the game, enemies should charge the player's character. There are also five different terrain types that give different movement bonuses. I want the AI to take advantage of these terrain bonuses as they try to reach the player.

I was told to check out the A* search algorithm (http://en.wikipedia.org/wiki/A*_search_algorithm). I'm doing this game in HTML5 and JavaScript, and found a version in JavaScript: http://www.briangrinstead.com/blog/astar-search-algorithm-in-javascript I'm trying to figure out how to tweak it though.

Below are my ideas about what I need to change. What else do I need to worry about?

When I create a graph, I will need to initialize the 2D array I pass in passed on with a traversal of a map that corresponds to the different terrain types.
in graph.js: "GraphNodeType" definition needs to be modified to handle the 5 terrain types. There will be no walls.
in astar.js: The g and h scoring will need to be modified. How should I do this?
in astar.js: isWall() should probably be removed. My game doesn't have walls.
in astar.js: I'm not sure what this is. I think it indicates a node that isn't valid to be processed. When would this happen, though?
At a high level, how do I change this algorithm from "oh, is there a wall there?" to "will this terrain get me to the player faster than the terrain around me?"

Because of time, I'm also debating reusing my Bresenham algorithm for the enemies. Unfortunately, the different terrain movement bonuses won't be used by the AI, which will make the game suck. :/ I'd really like to have this in for the prototype, but I'm not a developer by trade nor am I a computer scientist. :D

If you know of any code that does what I'm looking for, please share!

Sanity check tips for this are also appreciated.

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:
How can I test different TV display types for my XBLIG game? The XBLIG submission check-list asks to ensure all gameplay-critical graphics be visible in the 'TitleSafeArea'.

I've received a bug report during play-testing that says parts of my scrolling 2D map are only half-visible (chopped off from the left of the screen).

I've tested the game on a 47" TV and a 19" VGA monitor and both look fine. However, the bug report says the issue occurs on a standard 20" TV.

How can I test different sizes without buying differently sized TVs?

sentences: Render (screenshot) weapon model in Counter-Strike: Global Offensive I need to take screenshot of weapon model from screen like this, without any background. Tried to remove and change resources using mat_texture_list console command, but no success.

sentences:
Enumerating full game tree for small board game I am trying to list all the possible positions in a small board game (nannon) (using C++)

So far I have decided to split it into two parts, the pieces that are in home positions and end positions (which aren't on the board) and the pieces that are in play (on the board).

Now, I can list the positions when the pieces are on the board with the  STL algorithm next_permutation (on a 6 point structure like : point_1 = "White", point_2="empty"......point_5="Black", point_6="empty")

I am left with how to list all the positions of pieces which are off the board.

I have decided to have a set of bins:

white in home position
white in end position
White in play
black in home position
black in end position
black in play

white has three pieces that can be put in any of these bins (e.g 2 in home bin and 1 in play bin), same goes for black, like this:

white in home position = 2
white in end position = 0
White in play = 1
black in home position = 0
black in end position = 1
black in play = 2

Any ideas of how I go about this?

p.s: (i tried just adding the home/end/in-play bins to the "board" structure and running next_permutation but that gives nonsensical positions like black pieces in the home bin. I guess I could just list them ALL and then prune the nonsensical ones but that seems like over kill)

sentences:
Unity: How to make an array of video clips and play them? I have 26 video files which I have to put in an array and play for different objects. So far I have written this from what I know:

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

public class videomanager : MonoBehaviour {

    public VideoClip[] vids;

    private VideoPlayer vp;

    // Use this for initialization
    void Start () {

        vids = new VideoClip[25];
        vp = gameObject.GetComponent<VideoPlayer> ();
    }

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

    }
}

I have attached this script on a plane on which I am playing the video.

Before that, I had 26 different planes, one for each different video, but I think it would be better if I could play them on a single plane and change the video according to logic.

I am not sure how I should load them into my player and play them.

sentences:
Relation between game systems and components in a component-based architecture? Based on a question I previously asked here regarding to decoupling input from other components of an entity I developed a small component architecture on top of XNA to understand how everything works and plays together. Basically, my architecture has the following components/services/systems:

Game

This is the root of any game, responsible for ticking the game loop (updating, drawing) as well as instantiating all systems.

GameModule

A game module responsible for a certain aspect of the game, such as UI (UIModule), input (InputModule), animations (SpriteAnimationModule), scenes (SceneStackModule) etc.

Scenes

Holds the current state of the game. Basically an entity manager. :)

Entity

Entity which only holds a collection of components and very basic world space information such as position, rotation etc.

Component

A component of an entity, which can be anything (SpriteComponent, ScriptComponent, ControllerComponent)...

However now I seem to have a problem of the responsibilities between my game systems (modules) and the components, which are not aware of each other. For instance, I have an UIModule instantiated in my game, which I need to update/render before any other systems in order to appropriately handle input events on the UI. For this, I'd need to loop through all UIComponents - which are unfortunately encapsulated within the current scene. Which in turn is only accessible via the SceneStackModule (LIFO collection for scenes). So I have to either make my UIModule aware of the concept of scenes (by making the SceneStackModule a dependency of the UIModule), create an UIModule for each scene or make the UIModule a dependency and register the UIComponent twice (once in the entity, once in the module).

Approach 1

public class UIModule : GraphicalModuleBase {
    public UIModule(SceneStackModule sceneStack) { }

    public void Draw(GameTime gameTime) {
        var uiComponents = SelectUIComponentsFromEntities();
        uiComponents.Draw(gameTime);
    }
}

Approach 2

public class MainScene : Scene {

    public UIModule UIModule { get; } = new UIModule();

    public void Draw(GameTime gameTime) {
        var uiComponents = SelectUIComponentsFromEntities();
        uiModule.Draw(gameTime, uiComponents);
    }
}

Approach 3

public class UIComponent : ComponentBase {
    public UIComponent(UIModule uiModule) {
        uiModule.RegisterComponent(this);
    }
}

All three approaches are not very nice (why does the UI need to be aware of scenes, why no components need modules as dependencies or why do I have to declare my 'main render logic' (UI before everything else) a part of every scene?). So I either clearly missed something here or that's another nasty part of game development. :/

sentences: How do I make a rope from point A to B in Box2D? I need to make a rope (preferably not elastic) from one point to the next in Box2D. If it helps, I'm trying to develop one of those 2D Spiderman games, like this: http://www.gamesbutler.com/game/4327/Hanger/

sentences:
Drawing and scrolling very large zoomed tilemaps I've been working on my game editor and doing some performance tests. In the meantime I realized that my editors performance goes significant down if I draw a large map and zoom it.

100% zoom = 112 tiles on the screen

50% zoom = 364 tiles on the screen

25% zoom = 1350 tiles on the screen

12.5% zoom = 5247 tiles on the screen

5247 is a much of it. But that are only these tiles which are need to draw.

for (var layerX = minTileX; layerX < maxTileX; layerX++)
for (var layerY = minTileY; layerY < maxTileY; layerY++)

I decided to render areas of the map to rendertargets and draw only these. The framerate goes up. But if I want to scroll it goes down again, because it have to recreate and render all rendertargets.

Maybe I could draw the whole map on rendertargets (256*256 pixel per rendertarget => 63 rendertargets on a 500*500 large tilemap with 32px tiles)?
But I dont think thats is the right way to do it.

sentences:
Rotating according to ground normal on Unity 3D I know there are already some threads about this, but my problem isn't exactly with the algorithm itself.
I was able to use RayCast and get the ground normal, using it to store the rotation necessary to align to the ground in a quaternion using:

slopeRotation = Quaternion.FromToRotation (transform.up, hit.normal);

Where hit.normal is the normal of the ground. After this, I check whether the player is moving (the user is moving the joystick axis) or standing still. If it's standing still, I align it with the ground using:

transform.rotation = Quaternion.Slerp(transform.rotation,slopeRotation * transform.rotation,10*Time.deltaTime);

When the player is moving, I rotate using:

transform.rotation = Quaternion.Slerp (transform.rotation,slopeRotation *camRotation*movementRotation , 10 * Time.deltaTime);

Where camRotation is simply the rotation of the MainCamera(a third person one) on the Y axis and movementRotation is the rotation of the joystick axis, also on the Y axis, calculated using:

movementRotation = Quaternion.LookRotation (new Vector3(Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical")));
camRotation = Quaternion.Euler (0, cam.transform.rotation.eulerAngles.y, 0);

Although the code above makes sense in my head, it doesn't work as expected, as seen in the picture below:

As you can see, it works fine when you're standing still, which means that the ground normal and the slopeRotation are correctly calculated. When the player moves though, the combination of all the quaternions seems to cause some kind of problem that makes the player slightly deviate from the correct rotation.
It might be worth noting that camRotation and moveRotation also work completely fine on their own, so the player moves correctly according to both the rotation of the camera and of the joystick, both on the floor and on ramps.

sentences:
Get an image from canvas on android? At the moment I have not worked with android and am not familiar with its capabilities.
In the browser, it is possible to get an image from the canvas using the methods
toDataURL()
toBlob()

Are there any similar methods on android canvas (android.graphics.Canvas, if I understood correctly) to get an image?
Or is it possible only in canvas in the webview component?
Thanks.

sentences:
How do I choose the scaling factor of a 3D game world? I am making a 3D tank game prototype with some physics simulation, am using C++. One of the decisions I need to make is the scale of the game world in relation to reality. For example, I could consider 1 in-game unit of measurement to correspond to 1 meter in reality. This feels intuitive, but I feel like I might be missing something.

I can think of the following as potential problems:

3D modelling program compatibility. (?)
Numerical accuracy. (Does this matter?) Especially at large scales, how games like Battlefield have huge maps: How don't they lose numerical accuracy if they use 1:1 mapping with real world scale, since floating point representation tend to lose more precision with larger numbers (e.g. with ray casting, physics simulation)?
Gameplay. I don't want the movement of units to feel slow or fast while using almost real world values like -9.8 m/s^2 for gravity. (This might be subjective.)
Is it ok to scale up/down imported assets or it's best fit with a world with its original scale?
Rendering performance. Are large meshes with the same vertex count slower to render?

I'm wondering if I should split this into multiple questions...

sentences:
Unity: Unable to take screenshots in server build I am trying to take snapshots in the server build of my Unity application.
But the output image is all grey. From this post, I read that in headless mode, calling camera.Render() is necessary for rendering. I changed my screenshot logic accordingly.
Here is my script
private IEnumerator TakeSnapshot()
{
    yield return new WaitForEndOfFrame();

    var tempTexture = RenderTexture.GetTemporary(Screen.width, Screen.height);
    camOV.targetTexture = tempTexture;
    camOV.Render();

    var tex = new Texture2D(tempTexture.width, tempTexture.height, TextureFormat.RGB24, false);

    // Read screen contents into the texture
    tex.ReadPixels(new Rect(0, 0, tempTexture.width, tempTexture.height), 0, 0);
    tex.Apply();
    RenderTexture.active = tempTexture;

    // Encode texture into PNG
    var bytes = tex.EncodeToPNG();
    snapshotBase64 = Convert.ToBase64String(bytes);
    // File.WriteAllBytes("/Users/varun/Desktop/" + Time.time + ".png", bytes);
    Destroy(tex);
}

I initalize the camera in the Start() method
    camOV = Camera.main;

This works fine inside the editor but once I create a server build for Mac and try to run it I get this error.
ReadPixels was called to read pixels from system frame buffer, while not inside drawing frame.
 #0 ???
 #1 operator delete[](void*, std::nothrow_t const&)
 #2 operator delete[](void*, std::nothrow_t const&)
 #3 operator delete[](void*, std::nothrow_t const&)
 #4 operator delete[](void*, std::nothrow_t const&)
 #5  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Texture2D:ReadPixelsImpl_Injected (UnityEngine.Texture2D,UnityEngine.Rect&,int,int,bool)

Can someone give any suggestions? Thanks!

sentences:
Multiple joysticks event handling I want to make a game which is totally same idea as "Who pressed the button answers the question".

I have 2 joysticks and both are connected to a pc. My application will be Winforms and I will develop it on Visual studio 2012.

I've used SlimDX, Sharpx so far I've found nothing for multiple joysticks. My problem is not mesuring the time until a player presses a button, all I want to know is which joystick / gamepad have pressed a button first.

Could you give me ideas about how I can achieve this ?

sentences:
From simple physics with a ball, to a more complicated shape Hello fellow game devs and stack overflowers...

I recently made a transition from OpenGL ES 1.1 to 2.0 (on Android via NDK) and things are going well so far. I'm working on doing a dice rolling application (gaming dice up to 20 sided, not just regular 6 sided die) as a way to learn more about how physics is implemented in a gaming environment.

I've explored implementing existing engine options (such as Bullet) and I don't think I need to implement something quite so sophisticated. I've found several tutorials that handle a lot of the general physics involved with initial trajectory, velocity, angle of contact and reflection angle, etc. I'm confident that I'd be able to implement ball-like behavior without much trouble.

My question lies in when I attempt to make the interaction of the die shape with another surface more "realistic," for example... the die strikes the floor surface at such an angle where only one corner makes contact with the floor. In my mind, the center of gravity of the object would play a part in determining how the die bounces away, possibly even spinning it it faster, etc... but I am not sure what the actual math involved is.

Are there any recommended resources for getting into this level of detail? Initial searches haven't turned up much...

Thanks to everyone in the community,
-Jeremiah

sentences:
Point welding on generated terrain I am converting two 2D images (A Voronoi graph and a Diamond Square noise map) into a 3D object.

However when finding the corner points of the Voronoi I am left with gaps, so I thought to drop these by calculating adjacency to existing nodes before creating the vertex. However no matter which algorithm for the weld I use, or the tolerance level of the distance I can't seem to get it to work.

This has led me to believe I am doing something wrong.

Image of the issue:

These gaps do not appear if I run without the weld, they are created by the weld jumping to spots, but then later welds not finding that spot.

I have even tried to increment the weld distance to a maximum of 10, if a suitable node wasn't found. But this is far to aggressive and has the effect of simplifying the mesh instead and creating more gaps.

My Repo for the full code is here: https://github.com/HughAJWood/TerrainGenerator

private void CalculatePolys()
{
    var nodesForEdges = new List<VNode>();
    foreach (var region in _regions)
    {
        foreach (var point in region)
        {
            if (point == null)
            {
                continue;
            }
            // We calculate where the voronoi node corners are, and pass them into the region
            var diff = ColoursDifferent(point);
            if (diff > 1)
            {
                RenderNodePointsOnImage(point);

                // Points are 2D, so to translate to 3D they are set to the Z property of the 3D node
                var node = new VNode
                {
                    X = point.X,
                    Z = point.Y
                };
                // Weld points within 1 unit from each other by determining if we already have one that exists
                // then using the existing node instead
                // A weld is calculated by determining the X,Z distance to see if we have a node stored already
                // that is within 2 units of the node we are creating
                VNode existingNode = Nodes.FirstOrDefault(n => n.Adjacent(node));
                if (existingNode == null)
                {
                    // Optimise node creation by skipping perlin lookup and ID iteration for only when needed
                    node.ID = VNodeId;
                    node.Y = _perlin.GetPixel(point.X, point.Y).R;
                    Nodes.Add(node);
                    Mesh.ControlPoints.Add(new Vector4(node.X, node.Y, node.Z, 1));
                }
                else
                {
                    node = existingNode;
                }
                nodesForEdges.Add(node);
            }
        }
        //if (i++ > 20) return;
        AddNodesToMeshAsPolys(nodesForEdges);
        nodesForEdges.Clear();
    }
}

The adjacency method is currently simplified to the fact I want to ignore the height of the node.

internal static bool Adjacent(this VNode a, VNode b, int tolerance = 3)
{
    var distance = Math.Abs(a.X - b.X) + Math.Abs(a.Z - b.Z);
    return distance < tolerance;
}

[UPDATE]

I have tried sorting the points by distance and fuzzy distance, both sort in the correct order. Then I tried taking the first point and using that as the welding point. Same effect.

I tried to average the points at the intersections at the image level and pass that back as the point every time, then weld. Same effect.

Clearly there are many approaches I can take for this, the problem arises when there are 2 points close to each other on the edge of a voronoi region. Sometimes they weld and create a gap. Sometimes however in some variances of the algorithm that the points don't weld even though their X,Z coordinates are very close to each. I'm still stumped as how to approach this.

sentences: Move an object towards a point relative to its position I am attempting to move an object a set distance in a direction relative to the objects current position. In other words I want the object to move to whatever point is 144 pixels below the object, and then stop moving. How can I do this?

sentences:
Is Windows window creation faster / more efficient than GLFW window creation? Are there any benefits to using Windows window for OpenGL or Vulkan rendering, rather than using GLFW window?

Is there any performance hits when using C++ Window creation over GLFW since it provides OpenGL and Vulkan interface?

sentences:
How do you create a grid using a wire-frame shader? So I'm having trouble going about creating an 80s neon color grid wire-frame, like the examples.

How would you go about making the floor into an 80s styled grid floor? I'm just looking for square grids.

Here is what I'm currently using

Shader "Custom/Grid" {
  Properties {
    _GridThickness ("Grid Thickness", Float) = 0.01
    _GridSpacingX ("Grid Spacing X", Float) = 1.0
    _GridSpacingY ("Grid Spacing Y", Float) = 1.0
    _GridOffsetX ("Grid Offset X", Float) = 0
    _GridOffsetY ("Grid Offset Y", Float) = 0
    _GridColour ("Grid Colour", Color) = (0.5, 1.0, 1.0, 1.0)
    _BaseColour ("Base Colour", Color) = (0.0, 0.0, 0.0, 0.0)
  }

  SubShader {
    Tags { "Queue" = "Transparent" }

    Pass {
      ZWrite Off
      Blend SrcAlpha OneMinusSrcAlpha

      CGPROGRAM

      // Define the vertex and fragment shader functions
      #pragma vertex vert
      #pragma fragment frag

      // Access Shaderlab properties
      uniform float _GridThickness;
      uniform float _GridSpacingX;
      uniform float _GridSpacingY;
      uniform float _GridOffsetX;
      uniform float _GridOffsetY;
      uniform float4 _GridColour;
      uniform float4 _BaseColour;

      // Input into the vertex shader
      struct vertexInput {
          float4 vertex : POSITION;
      };

      // Output from vertex shader into fragment shader
      struct vertexOutput {
        float4 pos : SV_POSITION;
        float4 worldPos : TEXCOORD0;
      };

      // VERTEX SHADER
      vertexOutput vert(vertexInput input) {
        vertexOutput output;
        output.pos = mul(UNITY_MATRIX_MVP, input.vertex);
        // Calculate the world position coordinates to pass to the fragment shader
        output.worldPos = mul(unity_ObjectToWorld, input.vertex);
        return output;
      }

      // FRAGMENT SHADER
      float4 frag(vertexOutput input) : COLOR {
         if (
          frac((input.worldPos.x + _GridOffsetX)/_GridSpacingX)
            < (_GridThickness / _GridSpacingX)
             ||
          frac((input.worldPos.z + _GridOffsetY)/_GridSpacingY)
            < (_GridThickness / _GridSpacingY)) {
          return _GridColour;
        }
        else {
          return _BaseColour;
        }
      }
      ENDCG
    }
  }
}

sentences:
Shader that draws just vertex points The game I am developing is in unity and I want to make a shader which can be put on a mesh that only 'draws' color on each vertex point. I am not proficient with shaders, and out of all my searching I have come up empty handed; I unfortunately don't even know how to look up this question (I seem to only find results about point clouds, which only serves to confuse and scare me more ;P).

Any help or if you can point me in the right direction on what to search, I would be very much greatful.

sentences:
HTML5 Canvas Converting between cartesian and isometric coordinates I'm having issues wrapping my head around the Cartesian to Isometric coordinate conversion in HTML5 canvas. As I understand it, the process is two fold:

(1) Scale down the y-axis by 0.5, i.e. ctx.scale(1,0.5); or ctx.setTransform(1,0,0,0.5,0,0); This supposedly produces the following matrix:

[x; y] x [1, 0; 0, 0.5]

(2) Rotate the context by 45 degrees, i.e. ctx.rotate(Math.PI/4); This should produce the following matrix:

[x; y] x [cos(45), -sin(45); sin(45), cos(45)]

This (somehow) results in the final matrix of ctx.setTransform(2,-1,1,0.5,0,0); which I cannot seem to understand... How is this matrix derived? I cannot seem to produce this matrix by multiplying the scaling and rotation matrices produced earlier...

Also, if I write out the equation for the final transformation matrix, I get:

newX = 2x + y
newY = -x + y/2

But this doesn't seem to be correct. For example, the following code draws an isometric tile at cartesian coordinates (500, 100).

ctx.setTransform(2,-1,1,0.5,0,0);
ctx.fillRect(500, 100, width*2, height);

When I check the result on the screen, the actual coordinates are (285, 215) which do not satisfy the equations I produced earlier... So what is going on here? I would be very grateful if you could:

(1) Help me understand how the final isometric transformation matrix is derived;

(2) Help me produce the correct equation for finding the on-screen coordinates of an isometric projection.

Many thanks and kind regards

sentences: Do any 3d engines natively import Google Sketchup models Google Sketchup is about the only 3d cad program I can use, because I suck.  Do any 3d engines natively import Sketchup models?  Are there any major caveats when doing so?

sentences:
2d Circle different ARC's Collision detection I've read about the way to detect collision between 2 circles or circle and line
using trigonometry.

But now I would like be able to detect which part of the circle arcs I'm hitting.
For example I divided my circle to 4 different sized arcs.
I would like to know which arc gets hit, 1, 2, 3, or 4?
See image:

What is the best collision detection algorithm for this? Or what is this called?

sentences:
Best Practices for class usage and game architecture I'm making a 2D game similar to mario in Java.

I have some questions about class organization and proper method usage.

I have the following classes:

Main: runs the game in a JFrame
GamePanel: JPanel with boundary rules, timer, paintComponent, scoring, keyboard input, collision check
Player: only knows about its own attributes... has getter and setter methods for x, y location, height, width, weight etc...
Item: Same thing as Item class... this class will be used for items in the game, like bullets, cars, etc...
Physics: I was going to use this class to contain all actions for all items in the game (items class, player class, etc)... Like the rules for jumping, or running, etc...

Am I using the classes appropriately? I'm not sure whether each class should contain its own unique methods...

For example, only Player class objects will be able to jump and run... So should Player class have jump() and run() methods? Or should it just have setX(), setY() methods which alter its location based on run() from another class like Physics()?

And for a gun, I have shoot() which creates a new Item

 bullet = new Item(this, player.getX(), player.getY()+40, 25, 10, 10, bulletVelX, 0);

But as you can see below, I'm actually moving the bullet via the timer() class by calling the Item class's autoMove() method to change the bullet Item's location.

I'm also confused on the correct usage of timer():

I'm using it to run methods at a certain interval if a given boolean is set true...

public void timer() {
    timer.scheduleAtFixedRate(new TimerTask() {
        public void run() {
            collisionCheck();
            if (jump) {
                player.jump(velocityX, -velocityY);
                velocityY--;
                checkPlayerBounds(player);
                repaint();
            }
            if (shoot) {
                if (!bulletMag.isEmpty()) {
                    for (Item bullet : bulletMag) {
                        bullet.autoMove(bullet.getVelocityX(), bullet.getVelocityY());
                    }
                    if (bulletMag.size() > 30) {
                        bulletMag.clear();
                    }
                    repaint();
                }
            }
        }
    }, 0, 100);
}

Is is okay to put all that logic inside the timer class? Or should the timer class be kept as clean and empty as possible? Is that where my main Game loop is?

Lastly, paintComponent():

I put a paintComponent in each class (Player, Item, and  GamePanel so far), and paint them by calling them from within the GamePanel's paintComponent. Is that right?

public void paintComponent(Graphics g) {
    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);
    player.paintComponent(g);
    for (Item bullets : bulletMag) {
        bullets.paintComponent(g);
    }
}

So, in summary is my usage of classes, timer, and paintComponent correct?

sentences:
How to get the attack animation cycle all the way through after one KeyEvent without twitching? (Java awt) So I figured by myself (supposedly) how to make the attack animation cycle all the way through after pressing a key without needing to keep it pressed. But now it doesn't always start at the same frame index and sometimes doesn´t even complete the animation (as you will see, sometimes it does). Heres a gif of what's going on.

These go in the constructor

    aR = new Animation(50, Assets.aRight);
    aL = new Animation(50, Assets.aLeft);
    aF = new Animation(50, Assets.aFront);
    aB = new Animation(50, Assets.aBack);

I use this timer to keep track of the cooldown and also set the flag (timerFlag) that indicates the start of the attack animation to true.

    attackTimer += System.currentTimeMillis() - lastAttackTimer;
    lastAttackTimer = System.currentTimeMillis();
    if(attackTimer < attackCooldown){
        timerFlag = false;
        return;
    }

    if(!handler.getKeyManager().attack)
        return;

    timerFlag = true;

(after a little bit of code attackTimer is set to 0)

To decide what the game will render I use an int (stillLock) that saves the last direction the player faced and I have a second static flag that indicates that the animation started. (I even reset the index every time it starts just to make sure *sadface)

else if(timerFlag&&!animCd){

        switch (stillLock){
        case 1:      //to attack
            animCd = true;
            timerFlag = false;
            aL.setIndex(0);
            return aL.getCurrentFrame();
        case 2:
            animCd = true;
            timerFlag = false;
            aR.setIndex(0);
            return aR.getCurrentFrame();
        case 3:
            animCd = true;
            timerFlag = false;
            aB.setIndex(0);
            return aB.getCurrentFrame();
        case 4:
            animCd = true;
            timerFlag = false;
            aF.setIndex(0);
            return aF.getCurrentFrame();
        }
    }
    else if(animCd){
        switch (stillLock){
        case 1:         //to finish attack animation
            aL.tick();
            return aL.getCurrentFrame();
        case 2:
            aR.tick();
            return aR.getCurrentFrame();
        case 3:
            aB.tick();
            return aB.getCurrentFrame();
        case 4:
            aF.tick();
            return aF.getCurrentFrame();
        }

And this is the Animation class where the magic happens

public class Animation {

private int speed, index;
private long lastTime, timer;
private BufferedImage[] frames;

public Animation(int speed, BufferedImage[] frames){
    this.speed = speed;
    this.frames = frames;
    index = 0;
    lastTime = System.currentTimeMillis();
    timer = 0;
}

public void tick(){
    timer += System.currentTimeMillis() - lastTime;
    lastTime = System.currentTimeMillis();

    if(timer > speed){
        index++;
        timer = 0;
        if(index >= frames.length){
                index = 0;
                Player.animCd = false;
        }
    }
}

public BufferedImage getCurrentFrame(){
    return frames[index];
}

public void setSpeed(int speed){
    this.speed = speed;
}

public void setIndex(int index){
    this.index = index;
}

}

And finally it renders like this.

public void render(Graphics g)
{
    g.drawImage(getCurrentAnimationFrame(), (int) (x - handler.getGameCamera().getxOffset()),
            (int) (y - handler.getGameCamera().getyOffset()), width, height, null);
}

I'm trully sorry for the code dump, I swear I worked hard narrowing it down only to the important stuff and being specific. Hope you can help me, I've been stuck with this for weeks... :)

sentences:
Unity - How to add bones to procedural mesh Basically this is the set up: An N amount of prefabs are bundled together into a new GameObject. This is then merged into a single main mesh composited of M amount of material submeshes.
The shape is standing upwards on the Y axis and is a bunch of arms.
The goal is to move these by adding bones.

I wasn't able to find many examples on how to properly assign bones to a procedural mesh which isn't a simple cube.

The problem is assignment of vertices to the boneweights. I'd like for the transform Y=0 vertices to have no weight and the Y=furthest vertices have full weight. I am not sure how the assignment should be done.. Any pointers? :)

So far the Lower and Upper bone transforms are in the right place, but when moving them the mesh isn't bending as I hoped it would in a nice curve, half of the vertices are simply moved uniformly with a thin mesh line connecting the two halves.

private void _AddBones()
{
    if(m_SkinnedRenderer != null)
    {
        // Make bone weight for vertices
        BoneWeight[] weights = new BoneWeight[m_MainMesh.vertexCount];
        int halfway = (weights.Length / 2);
        for (int i = 0; i < weights.Length; i++)
        {
            if(i < halfway)
            {
                weights[i].boneIndex0 = 0;
                weights[i].weight0 = 1;
            }
            else
            {
                weights[i].boneIndex0 = 1;
                weights[i].weight0 = 1;
            }
        }

        m_MainMesh.boneWeights = weights;

        // Make bones and bind poses
        Transform[] bones = new Transform[2];
        Matrix4x4[] bindPoses = new Matrix4x4[2];
        bones[0] = new GameObject("Lower Bone").transform;
        bones[0].parent = m_MergedRoot.transform;
        bones[0].localRotation = Quaternion.identity;
        bones[0].localPosition = Vector3.zero;
        bindPoses[0] = bones[0].worldToLocalMatrix * m_MergedRoot.transform.localToWorldMatrix;

        bones[1] = new GameObject("Upper Bone").transform;
        bones[1].parent = m_MergedRoot.transform;
        bones[1].localRotation = Quaternion.identity;
        bones[1].localPosition = new Vector3(0, 1.5f, 0);
        bindPoses[1] = bones[1].worldToLocalMatrix * m_MergedRoot.transform.localToWorldMatrix;

        m_MainMesh.bindposes = bindPoses;
        m_SkinnedRenderer.bones = bones;
        m_SkinnedRenderer.sharedMesh = m_MainMesh;
        m_SkinnedRenderer.rootBone = bones[0];
    }
}

sentences:
How can I transform a group of objects in libGDX? I'm new in LibGDX.
I created group with actors in show method and add listener (where i calculate rotation matrix) and want to rotate all actors from group with batch.setTransformMatrix(matrixResult); but nothing happens. How can I force to rotate all actors of group?

 @Override
   public void show() {
      camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      camera.position.set(0f, 0f, - 120);
      camera.lookAt(0,0,0);
      camera.near = 0.1f;
      camera.far = 300f;

      camera.update();
      stage = new Stage();
      shader = new ShaderProgram(vertexShader, fragmentShader);
      myBatch = new SpriteBatch();
      shapeRenderer = new ShapeRenderer();
      sphere = BuildSphere(5, 100);
      group = new Group(){
         @Override
         public void draw(Batch batch, float parentAlpha) {
            batch.setTransformMatrix(matrixResult);
            super.draw(batch, parentAlpha);

         }
      };

      group.setTouchable(Touchable.enabled);
      group.addListener(new InputListener(){

         @Override
         public boolean touchDown(InputEvent event, float x, float y,
               int pointer, int button) {
            Gdx.app.log("MOUSE_X_BEG", Float.toString(x));
            Gdx.app.log("MOUSE_Y_BEG", Float.toString(y));
            begX = x;
            begY = y;
            return true;
         }
         @Override
         public void touchDragged(InputEvent event, float x, float y,
               int pointer) {
            endX = x;
            endY = y;
            //isRotate = true;
            float translationX = endX-begX;
            float translationY = begY-endY;
            float length = (float)Math.sqrt(Math.pow(translationX,2) + Math.pow(translationY,2));
            Vector3 axis = new Vector3(0, 0, 0);
            if(length>0){
               if(begX-endX == 0){
                  axis.x = 1;
               }else{
                  float angle = (float) (Math.atan(translationY/translationX) + Math.PI/2.0*(translationX <0 ? -1 : 1));
                  axis.z = 1;
                  axis.x = (float) Math.cos(angle);
                  axis.y = (float) Math.sin(angle);
               }
            }
            quaternion = new Quaternion(axis, 0.02f*length);
            Matrix4 rotation = new Matrix4(quaternion);
            matrixResult = rotation.mul(matrixRotationOld);
            matrixRotationOld = matrixResult;

         }

      });
      //group.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      for (CenterCoordinate cenCoordinate : sphere.getPolygonCenterCoordinates()) {
         Vector3 vector = cenCoordinate.getCartesianCenter();
         Polygon polygon = new Polygon(1, cenCoordinate.getType().getCode(), cenCoordinate.getRadius(), cenCoordinate.getPsi(),
               cenCoordinate.getKsi(), vector, cenCoordinate.getRotation());

         group.addActor(polygon);
      }

      stage.addActor(group);
      Gdx.input.setInputProcessor(stage);

   }

Polygon extends Actor draw method :

         @Override
  public void draw(Batch batch, float parentAlpha) {
     translation.setToTranslation(vertex.x, vertex.y, vertex.z);
     matrix.mul(translation);
     shader.begin();
     shader.setUniformMatrix("u_worldView", matrix);
     mesh.render(shader, GL20.GL_LINE_LOOP, 1, mesh.getNumVertices()-1);
     shader.end();
     matrix.idt();

  }

sentences:
Whats a good way to make realistic brick walls? This is a screencap from Blackops III:

I tried this using 5 maps including displace and normal, but it still looks too flat. I was wondering what a good method or workflow is to make walls actually look like theyre popping out, like what the steps are. For example, do people displace in their modeling software and import the mesh? I just want to hear the steps you guys of the community would take to produce this effect. Thanks.

My wall:

sentences:
Object look at target direction? How to make an object look at the target direction not at the target himself ?

public Transform target;

void Update() {

    transform.LookAt(target);
    float step = 2 * Time.deltaTime;
    transform.position = Vector3.MoveTowards(transform.position, target.position, step);

}

sentences:
Faster ways of rendering to a texture what is viewed by a camera in a given specific moment (Unity) What I want to achieve is to render to a texture what is viewed by a camera in a given specific time or frame, and then stop rendering to the texture, delete the camera and stay with that texture for the rest of the gameplay.

So, I know how to set a Camera to continuously render to a texture in Unity: it's all about 1) to create a RenderTexture; 2) to specify such RenderTexture in the "Target Texture" field of the desired camera;  3) to assign the RenderTexture to a diffuse material; 4) to apply such material to a given object, let's say a plane.

It works great: all that is viewed by the camera is being rendered to the plane surface, but continuously (i.e. on the fly). This means that if, for instance, I delete the camera, the RenderTexture becomes a solid color. How can I save in the RenderTexture what the camera is viewing in a specific moment and then stop rendering to the texture?

EDIT: currently, I managed to achieve it by using the following code.

    RenderTexture rendText = RenderTexture.active;
    RenderTexture.active = mycam.targetTexture;
    mycam.Render();
    Texture2D cameraImage = new Texture2D(mycam.targetTexture.width, realcam.targetTexture.height, TextureFormat.RGB24, false);
    cameraImage.ReadPixels(new Rect(0, 0, mycam.targetTexture.width, realcam.targetTexture.height), 0, 0);
    cameraImage.Apply();
    RenderTexture.active = rendText;

However, for a RenderTexture with 1980x1080 (i.e. far from high quality), that piece of code takes around 50ms to perform the capture of the camera into a Texture2D. If I try it with a RenderTexture of 4096x4096 resolution, it takes around 160ms.

What is the correct way to accomplish this task for a more performant solution?

sentences:
How do I simplify terrain with tunnels or overhangs? I'm attempting to store vertex data in a quadtree with C++, such that far-away vertices can be combined to simplify the object and speed up rendering.

This works well with a reasonably flat mesh, but what about terrain with overhangs or tunnels? How should I represent such a mesh in a quadtree?

After the initial generation, each mesh is roughly 130,000 polygons and about 300 of these meshes are lined up to create the surface of a planetary body. A fully generated planet is upwards of 10,000,000 polygons before applying any culling to the individual meshes. Therefore, this second optimization is vital for the project.

The rest of my confusion focuses around my inexperience with vertex data: How do I properly loop through the vertex data to group them into specific quads? How do I conclude from vertex data what a quad's maximum size should be? How many quads should the quadtree include?

sentences:
Why isn't this UIButton visible in Xamarin.iOS? I'm trying to implement buttons into my game. I noticed iOS has the UIButton class, which I tried, but upon drawing it nothing is shown. The asset image is properly loaded, I've checked this. The SpriteBatch isn't drawing on top of the buttons either. Draw is properly being called on every frame. The button's enabled property is set to True.

The code, simplified:

private List buttons;

public void AddButtons()
        {
            UIButton b = new UIButton(UIButtonType.Custom);
            b.SetBackgroundImage(UIImage.FromBundle("icon.png"), UIControlState.Normal);
            b.Frame = new System.Drawing.RectangleF(0, 0, 256, 256);
            buttons.Add(b);
        }

    public void Draw()
    {
        foreach (UIButton b in buttons)
        {
            b.Draw(b.Frame);
        }
    }

Why isn't it visible?

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:
Game engine like Unity 3D that allow me to use .NET code I've been looking at Unity 3D for developing a 3D PC game and I really like the scene editor and how it simplifies the process of constructing 3D scenes, managing assets, animations, transitions etc. However, I don't want to restrict myself to using the Unity 3D scripts for handling every bit of game logic in the game.

E.g. If I want to construct a RPG dialogue system I don't want to do it with unity 3d scripts - I'd like to use C#/.net. Also, I might want to use e.g. windows azure and sql azure as backend, and use 3rd party .net libraries such as reactive-extensions etc.

Is there a .net engine out there that helps me with asset loading, animations, physics, transitions, etc. with a scene editor, but allow me to plug it into a visual studio .net project?

Thanks

sentences:
Libgdx sprite rotation (image quality) This one is probably really simple but I didn't find a solution.

I'm trying to create a widget (speedometer) with libgdx.
For the arrows I'm using the setRotation() function.
But when the image is rotated, the quality drops.

The result looks like this:

How can I improve the quality of the arrows?

sentences:
Is this a good way of separating graphics from game logic? My current architecture for me game engine looks like this, though it is not accurate:

Everything graphics related is done in by GraphicsEngine, and through its components, like Material, Mesh, etc). My problem is that I want to store the pointers in RenderData, but I have to include the Mesh, Material etc header files, which have included glew.

I currently change an objects material using GetRenderer().SetMaterial("xyz"), which sets a string in the renderData, to be processed by the graphics engine; then the correct pointer will be set, if it exists. This is not so modular, because the scene has graphics related files included, like glew. This is a problem.

My only solution is to store indices in RenderData. There wont be a material pointer, but instead, an index where the material is in the GraphicsEngines material store. This way, RenderData is just a "blind" integer and string store, in which the Renderer egy the GraphicsEngine works.

Is this a good solution?

Meshes have VertexData members (position, normal, texture). When I call GraphicEngine.CreateMesh(), passing the MeshName and FileName, where should the file processing go? I use Tiny Obj Loader, and I don't know where I should include it, and call its function.

I call the function from inside GraphicsEngine, then I transform the returned structures to my Mesh's structure, which I pass to the Mesh's constructor. The initialised list will assign it to the corresponding member variable. Inside Mesh, I pass the FileName to the Mesh constructor, and let it handle it all by itself. I think the first solution is better, but I don't really know why.

Maybe using GraphicsEngine to "create" assets is better than GraphicsEngine commanding assets to "be created"; but this is just a personal feeling. Which solution is better?

sentences:
How does a subpass dependency guarantee the layout transition of a swapchain image happens after presentation engine finish reading the very image? I'm going through vulkan-tutorial:
https://vulkan-tutorial.com/Drawing_a_triangle/Drawing/Rendering_and_presentation
And I found something weired:

How does this subpass dependency guarantee the layout transition(from UNDEFINED to COLOR_ATTACHMENT_OPTIMAL)of swapchain image happens after present engine finish reading(or working on) this swapchain image?i.e.Layout transition of this swapchain image bewteen external and subpass0 guarantees to happen after the imageAvailableSemaphores is signaled.
I did find some explanations on this topics from this blog:
http://themaister.net/blog/2019/08/14/yet-another-blog-explaining-vulkan-synchronization/

External subpass dependencies Render passes in Vulkan have a concept
of EXTERNAL subpass dependencies. This is arguably the most
misunderstood aspect of Vulkan sync. I’d like to dedicate a section to
this, because too many developers are lured into using it in cases
where it’s not terribly useful and very likely to cause bugs.
The main purpose of external subpass dependencies is to deal with
initialLayout and finalLayout of an attachment reference. If
initialLayout != layout used in the first subpass, the render pass is
forced to perform a layout transition.
If you don’t specify anything else, that layout transition will wait
for nothing before it performs the transition. Or rather, the driver
will inject a dummy subpass dependency for you with srcStageMask =
TOP_OF_PIPE_BIT. This is not what you want since it’s almost certainly
going to be a race condition. You can set up a subpass dependency with
the appropriate srcStageMask and srcAcessMask. The external subpass
dependency is basically just a vkCmdPipelineBarrier injected for you
by the driver. The whole premise here is that it’s theoretically
better to do it this way because the driver has more information, but
this is questionable, at least on current hardware and drivers.
There is a very similar external subpass dependency setup for
finalLayout. If finalLayout differs from the last use in a subpass,
driver will transition into the final layout automatically. Here you
get to change dstStageMask/dstAccessMask. If you do nothing here, you
get BOTTOM_OF_PIPE/0, which can actually be just fine. A prime use
case here is swapchain images which have finalLayout =
PRESENT_SRC_KHR.
Essentially, you can ignore external subpass dependencies. Their added
complexity give very little gain. Render pass compatibility rules also
imply that if you change even minor things like which stages to wait
for, you need to create new pipelines! This is dumb, and will
hopefully be fixed at some point in the spec.
However, while the usefulness of external subpass dependencies is
questionable, they have some convenient use cases I’d like to go over:

Automatically transitioning swapchain images Typically, swapchain
images are always just used once per frame, and we can deal with all
synchronization using external subpass dependencies. We want
initialLayout = UNDEFINED, and finalLayout = PRESENT_SRC_KHR.
srcStageMask is COLOR_ATTACHMENT_OUTPUT which lets us link up with the
swapchain acquire semaphore. For this case, we will need an external
subpass dependency. For the finalLayout transition after the render
pass, we are fine with BOTTOM_OF_PIPE being used. We’re going to use
semaphores here anyways.
I also do this in Granite.

sentences:
In SDL2 what is the fastest / most efficient way to draw pixels onto the screen? Using SDL_RenderDrawPoint or SDL_RenderCopy with a Texture? I want to add pixel splatters and particle effects to a game. For this my options were to have a bunch of pre-made animations in the form of textures, OR create a particle engine.

For the particle engine approach, my options as far as I know are to create pixels and render them either using:

SDL_RenderDrawPoint(s) (Using SDL_SetRenderDrawColor)
SDL_RenderCopy (Using Textures with SDL_SetTextureColorMod)

I'm not sure what's a better approach. #2 is probably easier as I have a whole system built around fast texture rendering (not necessarily faster than 1., but seemingly easier to implement with my current system.) #1 seems ideal because it's in the SDL2 library for a reason I'd think, but really I'm unsure which approach I should go with.

sentences:
How to perform collision detection in 3D space? I've got to write, what can be summed up as, a complete 3D game from scratch this semester. Up until now I have only programmed 2D games in my spare time, the transition doesn't seem tough, the game's simple. The only issue I have is collision detection. The only thing I could find was AABB, bounding spheres or recommendations of various physics engines. I have to program a submarine that's going to be moving freely inside of a cave system, AFAIK I can't use physics libraries, so none of the above solves my problem.

Up until now I was using SAT for my collision detection. Are there any similar, great algorithms, but crafted for 3D collision? I'm not talking about octrees, or other optimizations, I'm talking about direct collision detection of one set of 3D polygons with another set of 3D polygons. I thought about using SAT twice, project the mesh from the top and the side, but then it seems so hard to even divide 3D space into convex shapes. Also that seems like far too much computation even with octrees.

How do professionals do it? Could somebody shed some light.

sentences:
Game area where I can not click? I created a project based on the Top Down Example.

What is happening is that there is an area just above my character where I can not click.

Image showing location where the mouse is and soon after, when I move it a little to the left it disappears:

By the minimap you can see that the game recognizes as if the mouse was on top of the character, very close.

I went to test to see if this happened in all Top Down Examples, but it does not happen:

I've modified the position of the camera a bit in this project where I'm having problems (image 1). Is there a non-clickable area defined based on the camera, to prevent the player from clicking the location where the character is? And with the change of position the area is no longer equivalent to the position of the character?

This area in red I can not click:

I have not changed anything that has to do with the mouse in the character's blueprint:

What is going on?

EDIT 1 (tests done based on some comments to clarify the question and to verify possible cause of the problem)

I pressed P to see if there was any area of the map where there could be no click:

See I can put my mouse right below the character, and even click:

From there up the mouse does not appear, and obviously I can not click:

Location where the mouse appears again and what I can click:

These 3 images were captured in the character's home position without moving it. But the problem persists wherever the character is.

Through the test I did below, I prove that the problem is directly related to the position the character is in:

The green question marks the spot where my mouse is.

EDIT 2 (I think I discovered the problem)

I read DMGregory's comment again and went to look at the collider, it was small and it already existed before the problem happened.

I started the game and paused. I came across this image:

I created this sprite to appear on the minimap, I believe that may be the cause of the problem. How to make the mouse skip it? Without having to simply upload it?

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: Should I used Box2D for a Flash platformer or use something for gaming like Fixel or Flashpunk? I'm trying to make a platformer with Flash/AS3 and have been looking for something to help with some of the collision etc. I've look at a few engines and Box2D/WCK seems the most sophisticated. Do I need that level of sophistication or should I just stick to something simple like Fixel or Flashpunk? OR should I just do everything myself?

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:
Game Architecture and Separation of Concerns I'm trying to build a "simple" Tetris game, but I want to have enough flexibility to add a few things:

The game can be played by a human, or (if the human presses a certain key) an AI is swapped in.
The rendering code should be "configurable". That is, the user may enable or disable animations, or speed them up.

MVC initially looks like a good fit: the game itself is encapsulated in a Game object, providing some methods to interact with it (moveLeft, rotate). The Controller would handle user input or AI. The View just renders the game, and gets notified of updates by the Game itself whenever something interesting happens (PieceMoved, LineDestroyed and so on).

However, my problem mostly lies in "What if I want a blocking animation?"

When lines are destroyed, I want to do a "falling" animation where the top lines crush the bottom lines (or whatever), but since this animation may take some time, I want to avoid updating the game (that is, piece gravity) until the animation is completed.

Does it make sense to have the Controller do something like...

void update() {
    input.process()
    render.update()
    if (!render.blocked()) {
        game.update();
    }
}

Is MVC a bad fit for this? What's a good way to separate concerns in games?

(I am using libGDX, but my question isn't limited to it.)

sentences:
XNA:Rectangles Movement Behavior im trying to create simple pong game, and learning some XNA.
im creating for each paddle 3 rectangles, who represnt the collision when the ball hit them, so i can dicide where to throw the ball back.
here is the function that i create the rectangles:
List<Rectangle> collisonRectanglesList = new List<Rectangle>(3);
      private void creatCollisonRectangles()
        {
 smallPaddleWidth = collisionRect.Width;
             smallPaddleHeight = collisionRect.Height / 3;
            for (int i = 0; i < collisonRectanglesList.Count; i++)
            {
                if (collisonRectanglesList[i] != null)
                    collisonRectanglesList.RemoveAt(i);
            }
             collisonRectanglesList.Add(new Rectangle((int)position.X + smallPaddleWidth, (int)position.Y + smallPaddleHeight * 2, smallPaddleWidth, smallPaddleHeight));
             collisonRectanglesList.Add(new Rectangle((int)position.X + smallPaddleWidth, (int)position.Y + smallPaddleHeight, smallPaddleWidth, smallPaddleHeight));
             collisonRectanglesList.Add(new Rectangle((int)position.X + smallPaddleWidth, (int)position.Y , smallPaddleWidth, smallPaddleHeight));

        }

now i want this to follow the paddle it self so i put this function in the update method
and made a simple texture so i can draw them and see where they are on the screen.
my problem is that when i call the creatCollisonRectangles() 1 of the rectangles paint it self in the middle and not in the place it should be.
any idea why?
this is when im not calling it in the Update method:

and this when i do:

(sorry for my english)

sentences:
Libgdx: scrolling background for preview screen Good day, I have been coding for quite a while now and I'm at a certain point where I am having difficulties on solving something. I've been creating a preview screen which contains the following:

reads .txt file and stores them in an array which will be displayed on the screen.
the text will have an animation which will be moving upwards like a Star Wars type of intro.
the background of the screen will also move upwards.

The problems that I have encountered are the following:

my text did not fit on the screen, but I did try to change the font and the font size and also did change the spacing in the .txt file.
the text always starts in the middle of the screen which it should start at the bottom of the screen.
the background is buggy, tried to debug it but still can find a solution for a parallaxbackground(scrolling background)

and here is the code.

public class PreviewScreen implements Screen {

    private static DugManMainClass game;
    private SpriteBatch batch;
    private OrthographicCamera camera;
    private Texture tx1 = Assets.bgmenu;
    private BitmapFont font = Assets.menufont2;
    private final static List<String> lines = new ArrayList<String>();
    private static int time = 0;
    private float temp = 0;
    private Sprite s;

    public PreviewScreen(DugManMainClass game) {

        this.game = game;

        //reads .txt file and stores them in an array

        try
        {
            BufferedReader br = new BufferedReader(new InputStreamReader(Gdx.files.internal("previewtext.txt").read()));
            String line = "";
            while ((line = br.readLine()) != null) {
                lines.add(line);
            }
            br.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public void render(float delta) {

        float w = s.getHeight();

        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        //temp is a timer which will do the animation effect for the text and background
        temp += Gdx.graphics.getDeltaTime();

        while(temp>1.0f/60.0f)
        {
            PreviewScreen.tick();
            temp -=1.0f/60.0f;

            //here is my problem for the background

            s.setU(temp+1f);
            s.setU2(temp+1f);

        }

        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        s.draw(batch);

// i commented this out because i waited to draw my sprite which is the background text(parallaxbackground)
//      batch.draw(s, 0, -(temp / 10 % w));
//      batch.draw(s, 0, -(temp / 10 % w) + w);

        int yo = time / 4;

        //this is where the the text problem is
        for (int y = 0; y <= 420 / 12; y++)
        {
            int yl = yo / 12 + 420 / 12 - y;
            if (yl >= 0 && yl < lines.size())
            {
                font.draw(batch,lines.get(yl), (800 - 30 * 12) / 2,  y * 12 + yo % 12);
            }
        }

        batch.end();

    }

    @Override
    public void resize(int width, int height) {}

    @Override
    public void show() {

        batch = new SpriteBatch();

        float w = 800;
        float h = 420;

        camera = new OrthographicCamera();
        camera.setToOrtho(false, w, h);

        tx1.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);

        s = new Sprite(tx1);
        s.setPosition(0, 0);

        Assets.bgsound3.play(1f);

    }

    @Override
    public void dispose() {
        Assets.dispose();
    }

    public static void tick() {
        time++;

        if (Gdx.input.isKeyPressed(Keys.ENTER) || Gdx.input.isTouched()) {
            game.setScreen(new MainMenuScreen(game));
            Assets.bgsound3.stop();
        }

        if (time / 4 > lines.size() * 10 + 250) {

            game.setScreen(new MainMenuScreen(game));
            Assets.bgsound3.stop();
        }
    }

}

sentences:
How to Calculate Velocity in a 2D space game I am currently using

screenpos.X = (float)(screenpos.X + velocity * Math.Sin(r));
screenpos.Y = (float)(screenpos.Y - velocity * Math.Cos(r));

For my Movement with r being the Rotation in Radians. However, I want to know how I can calculate my velocity realistically based on values of Thrust and Mass.

Any Idea's?

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:
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:
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:
Trouble with Index Out of Range Exception I'm trying to make a textbox for a small game and I've run into an issue. I'm using drawString, which doesn't support \n so I've made an array of strings for multiple lines like so. Also, there is a global int called lettersShown that will be important later.

int lettersShown = 0;
String[] result = new String[] {" "," "," "," "," "," "," "," "};

In the constructor of the class, I then created a random event containing an array of 8 strings(Sorry if this is long and poorly formatted, its just for testing purposes.)

travel.add(new Event(this, new String[]{"You walk along a winding dirt
road,", "exposed to the scorching of the sun.",
            "Every so often, you pass the remains", "of blasted homes
and dilapidated", "hovels. The air is especially arid",
            "today, and by the time the sun drifts", "down into the horizon
you find", "yourself parched."}, -20,0,0,0));

So after I did that, I created a method to draw each line in order.

public void drawText( int x, int y, Graphics g) {

    for(int i = 0; i <result.length; i++) {
        g.drawString(result[i].substring(0, lettersShown), x, y);
        if(result[i].length() > lettersShown) {
            lettersShown++;
    }
        //lettersShown = 0;
        y+=15;

    }
}

This method works perfectly for any arrays that only have one string, such as this one:

travel.add(new Event(this, new String[] {"You traveled to a new city"},
0,0,0,0));

However, the second it starts to render an event with multiple lines, I get this exception

Exception in thread "Thread-1"
java.lang.StringIndexOutOfBoundsException: String index out of range:23
at java.lang.String.substring(String.java:1963)
at mains.EventManager.drawText(EventManager.java:149)
at mains.Game.render(Game.java:185)
at mains.Game.run(Game.java:87)
at java.lang.Thread.run(Thread.java:748)

I've been trying so many things to fix this seemingly small issue and I'd rather not resort to just having a ton of strings and drawing each of them one at a time so any guidance or anyone who can identify the problem would be greatly appreciated. Thanks!

sentences:
XNA Framework Reach profile does not support separate alpha blend Yesterday I released my app 'Pic Words' to the windows phone store. It is an Silverlight/XNA app that runs on Windows Phone 7.1 & 8. I have BugSense incorporated into my app. Today I started receiving a lot of crash reports emanating exclusively from the 8.0.10211.0 version of Windows Phone 8. I could not replicate the issue since I do now currently own a Windows 8 phone and the emulator is running OS version 8.0.9903.0, which I don't think can be changed. The error from BugSense is as follows:

XNA Framework Reach profile does not support separate alpha blend. BlendState.ColorDestinationBlend and AlphaDestinationBlend must be set to the same value.

Stack Trace:

at Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ThrowNotSupportedException(String message, Object arg1, Object arg2)
at Microsoft.Xna.Framework.Graphics.BlendState.Bind(GraphicsDevice device)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.set_BlendState(BlendState value)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.SetRenderState()
at Microsoft.Xna.Framework.Graphics.SpriteBatch.End()
at GlobalEngine.Base.SpriteBatchManager.ResumeSpriteBatch()
at GlobalEngine.Base.SpriteBatchManager.Begin(SpriteBatchParams spriteBatchParams)
at GlobalEngine.Base.SpriteBatchManager.Begin(Rectangle scissorArea)
at GlobalEngine.Base.SpriteBatchManager.Begin()
at FourWords.Screens.GameScreen.Draw(Color tint)
at GlobalEngine.ScreenUtils.ScreenManager.Draw(Color tint)
at GlobalEngine.Base.Engine.Draw()
at FourWords.GamePage.OnDraw(Object sender, GameTimerEventArgs e)
at Microsoft.Xna.Framework.GameTimer.RaiseDraw(GameTimerEventArgs gameArgs)
at Microsoft.Xna.Framework.GameDispatcher.RunFrame()
at Microsoft.Xna.Framework.GameDispatcher.OnTick(Object sender, EventArgs e)
at MS.Internal.DirectRendering.OnGameUpdate(Object sender, EventArgs e)
at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)

GlobalEngine is just my library of basic classes like screen management and so on. SpriteBatchManager is a class I created also for managing the spritebatch.

I Begin the spriteBatch with the following parameters:

SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None

Additionally, I manipulate the graphic device as follows in the GamePage.xaml:

protected override void OnNavigatedTo(NavigationEventArgs e){
    // Set the sharing mode of the graphics device to turn on XNA rendering
    SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true);
    SharedGraphicsDeviceManager.Current.PreferredBackBufferFormat = SurfaceFormat.Color;
    SharedGraphicsDeviceManager.Current.ApplyChanges();
    //other unrelated code....}

I could not find any help from searching online about this issue and would appreciate any advice on fixing it. Thanks.

sentences:
How to instantiate a gameobject multiple times in unity during runtime? After destroying a gameobject in unity, how to instantiate it and make it do the exact same thing what the gameobject before getting destroyed was doing? My gameobject is a car which follows a path made out of nodes. After it is destroyed at a particular node, I want to instantiate it at a particular point which is the spawnSpot in my code, then I want it to follow the same path again and then get destroyed again and get instantiated again and follow the same path again and so on.
Right now, I am able to make my car follow a certain path and then destroy it at a certain node and and instantiate it and make it follow the same path again. Then my car is destroyed again and instantiated again but this time it does not follow the path and stays right at the spawnPoint.
I am using the destroy and instantiate functions in fixed update. Here's the relevant part of my code:

private void Destroy()
{
    if(currentNode == nodes.Count - 1)
    {
        Destroy(this.gameObject);
    }
}

private void Instantiate()
{
    if(currentNode == nodes.Count - 1)
    {
        Instantiate(prefab, spawnspot, Quaternion.identity);
    }
}

P.S. prefab is the gameObject.

sentences:
Libgdx and Box2D TiledMap render is not smooth I'm building simple side scroller game. My player (square) move fast and it interacts with other world objects. Problem is when my player is moving it seems that all world is rendering somehow strange (for example box2d objects are not rendering smooth). When player is not moving everything is ok. Here pic when player is moving

and here when my player stands still

Here I add my code

private OrthogonalTiledMapRenderer renderer;

mapLoader = new TmxMapLoader();
    map = mapLoader.load("level1.tmx");
    renderer = new OrthogonalTiledMapRenderer(map, DIV);
    gamecam.position.set((gamePort.getWorldWidth() / 2),    (gamePort.getWorldHeight() / 2), 0);

public void update(float dt){
        world.step(1/60f, 6, 2);
        if(playerAndGroundTest){
            player.update(dt);
        }

        float x = gamecam.position.x - gamecam.viewportWidth * gamecam.zoom / DIV;
        float y = gamecam.position.y - gamecam.viewportHeight * gamecam.zoom / DIV;

        float width = gamecam.viewportWidth * gamecam.zoom * 2 / DIV;
        float height = gamecam.viewportHeight * gamecam.zoom * 2 / DIV;
        renderer.setView(gamecam.combined, x, y, width, height);

        gamecam.position.set(new Vector2(player.getBody().getPosition().x, (gamePort.getWorldHeight() / 2)), 0);
        gamecam.update();
    }

    @Override
    public void render(float delta) {
        update(delta);
        Gdx.gl.glClearColor(0.4f, 0.4f, 0.4f, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        renderer.render();

        b2dr.render(world, gamecam.combined);
    }

here's Player update function

public void update(float dt){
        body.setLinearVelocity(200 * dt, body.getLinearVelocity().y);
    }

sentences:
How to profile CPU and GPU performance if I have a monster PC? I'm going to upgrade my PC soon. I'm worried that I will no longer spot performance losses in my game because of the better specs.

I can check memory usage easily, but how do I check and debug CPU and GPU usage? I used to rely on the framerate, but I guess that it is not accurate.

sentences:
Question about segment of code in XNA Basically when the code says

public static Camera Instance
{
// Code and something with get statement
}

Is it declaring a method? I don't think it is a method because there is no parenthesis to indicate the area to put in parameters.
Here is the full class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace ScrollingTest
{
    public class Camera
    {
    private static Camera instance;
    public static Camera Instance
    {
        get
        {
            if (instance == null)
                instance = new Camera();
            return instance;

        }

    }
}
}

sentences:
Central logic in entity-component-architectures I've build a architecture based on the entity-component-system-idea.
So I got

Components - Just store Data
Systems - Operates isolated on Components
Scripts - Which are just objects from type Script and attached to a ScriptComponent. A ScriptSystem will execute the init() and update() functions on the scripts then.

However, I'm wondering where to place the central game logic since the I have to check a few things about the overall game process, holding the map, counting the points, checks the points if they are enough for the end-screen, etc. ...

Should I create a single entitiy with just such a script attached to it or are there better solutions out there?

sentences:
How do I convert a Source engine NPC model to a player model? The Source engine's NPC and player models differ: An NPC model applied to the player has no animations. It cannot walk and holds its arms out to the side by about a foot. The weapon is held in the right hand and you can see the player switch weapons, but the weapons also have no animation.

How do I convert between these model types?

sentences:
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:
Unity new Input system lists actions and compare them to current input I have a scriptable object called Move that had a list with keycodes (for example to make a Hadouken) easy to use and compare with the current input made it with the old system, but with the new input system I don't know how to make a list of actions (actions that are in my Input Action Asset not new ones) and compare that with the current inputs (and also I do not have any idea how to make buffering inputs like the last input repeats 3 frames).
I already tried and not worked (InputMa is my InputActionAsset generated class):
-InputActions[]
-InputMa[]
-InputMa.PlayerActions
-InputActionReferences[] this seems the correct option, but I don't know how to get the reference from the current input.

sentences:
How is it possible to use Android libraries in libGDX? I want to make an android application game that uses both android API like Location, even Google Maps API and also use libGDX framework as well. How is this possible?

I noticed there's an Android and a core folder created when making a libGDX project, where do all the classes go, but I'm very confused.

sentences:
SetColorMod() with mini delay when the texture is rendered for the first time I have one image.png that I load using SDL_IMG. I load by creating a surface. Then I create a texture using CreateTextureFromSurface() and I free the original surface. I repeat the same process but now at the end I use SetColorMod(128, 128, 0) to this new texture. This changes the color of the image as I wanted! Cool!

This whole process is done way before the images are rendered to the screen. The original texture (without the color change) is rendered normally. The texture with the color change creates a mini delay when rendered for the first time. After that it keeps rendering without any delay.

I’m using SDL 2.0.2 (I’m using ubuntu 14.04)

A quick preview of the code to give an idea of what is happening

// load function
func load() {
    newSurface, err = img.Load(fname)
    defer newSurface.Free()
    newTexture, err = renderer.CreateTextureFromSurface(newSurface)
    return newTexture
}

// pre load
func init() {
    sprite1 := load()

    sprite2 := load()
    sprite2.SetColorMod(128, 128, 0)
}

// render...
func render() {
    Renderer.Clear()
    //loop for each object
    obj1 := sprite1
    obj2 := sprite2
    Renderer.CopyEx(obj1, &crop, dst, render.Angle, render.Center, render.Flip)
    // LAG HERE
    Renderer.CopyEx(obj2, &crop, dst, render.Angle, render.Center, render.Flip)
    Renderer.Present()
}

sentences:
How can I respawn enemies in Gamemaker Studio 2? I know this may have been asked before but I would like an updated answer. So how do I respawn enemies in Gamemaker Studio 2?

Say I have an object called objBullet and an enemy objenemy; when they collide with each other I want the bullet to destroy the enemy, and the enemy to respawn after a few seconds. As a bonus, if you could tell me how to respawn the enemy in a new random spot that'd be awesome.

sentences:
Are there any open source Source engine VTX/VVD viewers? I've been playing with loading and displaying Source Engine models (TF2, specifically) and have had mild success, but there are some aspects of it that are eluding me still. I've been primarily looking at http://developer.valvesoftware.com/wiki/MDL and online forks of the SDK headers like http://hlssmod.net/he_code/public/studio.h to understand the formats, but I've found the headers to be helpful, but lacking some crucial implementation details. The Developer Community pages do talk implementation, but much of it is speculation and I've already identified several points where it is wrong, so I'm struggling to locate some better resources.

I've got the whole .VVD file parsing now (as in: I can get the correct verts for a given LOD, verified by rendering a pointcloud.) The specific issue I'm looking at now is in the .dx90.VTX file. Drilling down into the Mesh Strip Groups, it seems like I can render the first strip group just fine (I have the Heavy's chest, arms, and legs rendering) but subsequent meshes are a mess of random triangles. It feels to me as if there should be a per-mesh offset into the .VVDs vertexes somewhere within the .VTXs structure, but I can't locate one. Maybe there's something in the .MDL, which I haven't started looking into yet, but it feels very odd to me to have such closely related data in separate files.

I know that's probably all gibberish to anyone that's not intimately familiar with the Source model formats. Really what I could use more than anything else is some reference code from another app that is loading these files. Are there any open-source exporters/viewers out there?

sentences:
c++ text rpg loading rooms/mobs So for practice and as a learning exercise i foolishly decided to make a text based rpg on my phone using the c4droid ide. ive done well and have learned a lot.

So far you can create a new character or load the previous one. and you can walk around in the rooms ive made.
currently the rooms load from a file when you enter it, and then it loads again every time you do anything except leave,which loads the next room instead. ill be tweaking my gameloop so it doesnt reload the room everytime soon.

My next step is the addition of mobs.   and here ive run into a problem i cant find the answer to with google.
My plan was/is to make a class for mobs and instantiate it when there was a mob present and load data from a file.  But then i was trying to figure out how to code which room to load them in.  First answer was to have the room file dictate which mobs, if any to load. great. except that i want the mobs to stay dead, not reapawn everytime the room reloads.
so now im wondering if i should be loading the rooms from file all at the same time before the game loop.  Potentially too memory intensive down the line when the game has more rooms and mobs? and what to load them to? i havent used arrays in c++ yet, though i have used map which seems similar. Im not even sure what a vector is.  i expect ill be needing to read up on those very soon.

so the basic question is this: leave loading the rooms the eay it is, load them all at the beginning of the game, or something else?

all help is appreciated

sentences:
In GameMaker Studio, how can I make an auto-updater for my game? I would like to let players update their copy of my game by clicking a button, which would:

Check for updates
Download the update
Prompt the user to restart the game

I want to do this because my friends hate to re-download my game each time I make a change.

Is this possible with GameMaker? If so, how?

I have Dropbox premium, could I take advantage of that?

sentences:
How can I get my entire game to scale based on screensize? I'm currently building a 2d mobile game and I'm currently stuck trying to get my game to scale with screen sizes. Currently my background is scaled to 1920 X 1080. When I run the game on my Galaxy S10+, it scales to 1920 X 1080, but you can see blue space on the sides (See Image). How do I get that 1920 x 1080 background to fill the entire screen without using a UI canvas?

I want the game to fill the entire screen. If I set the resolution to the Galaxy resolution, it fills the entire screen. But won't this look weird on other screens that don't have the same resolution?

I'm not trying to scale any UI. Everything I find online is only talking about scaling UI. That's not the issue. I'm trying to get the entire game to adjust based on screen sizes.

sentences:
Is Kip R. Irvine's claim of Assembly being practical for game development accurate? Kip R. Irvine's book, Assembly Language for x86 Processors, sixth edition, begins by comparing the Assembly language against high-level languages. One of the pros for Assembly, was game development:

  Game programmers are experts at writing code that takes full advantage
  of hardware features in a target system. They use assembly language
  as their tool of choice because it permits direct access to computer
  hardware, and code can be hand optimized for speed.

Whereas a high-level language:

  Produces too much executable code, and may not run efficiently.

This caught my attention. While I do realize that Assembly can optimize your programs, perhaps even significantly, I wonder if, at this point, it is at all practical?

My skepticism comes from:

Assembly seems to be difficult to maintain.
High-level languages aren't so slow.
I'm pretty sure that we have a handful of cutting-edge games based solely on high-level languages.
A particular interest in game development is to make your product cross-platform. I can only think of this as a significant obstacle for anyone using Assembly.
How much is "too much" executable code? I'm not entirely sure how reliable can this measure be.

Even if he meant to use Assembly for specific portions of your game, it still seems (to me) somewhat unpractical.

I'm not particularly advanced in Assembly, so I'm not sure. Are these claims accurate?

sentences:
Get original image size in Ren'py I'm building a visual novel and in one scene, I want to have a couple of different images move from one position to another and change size as it moves.

My first position is called "doorway", my second is called "left2".
Here's the code:

init:
    $ doorway = Transform(xpos = 0.34, xanchor = 0, ypos = 0.6, yanchor = 1.0, size = (100, 400))
    $ left2 = Transform(xpos = 0.4, xanchor = 0.5)

label room1:
    show room1

    show laura normal at doorway
    show laura normal at left2 with move
    hide laura with dissolve

    show annie normal at doorway with dissolve
    show annie normal at left2 with move

My problem is that when I run this, both laura and annie stay at (100, 400) size. I'd like them both to revert to their original size once I move them.

I wondered whether I could write size = (0.5, 0.5) instead of (100, 400) to halve them (this would work for my purposes) and then put size = (1.0, 1.0) in the left2 Transform declaration to bring them back to full-size, but that didn't work at all and actually didn't show their images whatsoever.

Is there a way to do it with relative sizing, or another way entirely? Thanks :)

sentences:
What are the most-valuable research fields to explore nowadays concerning game AI? I'm having some troubles coming up with a subject for my master's degree thesis. I'd like to know what areas of research are valuable at this time (and the near future) so I can narrow my search and idea-creation.

Thanks in advance.

sentences:
Is quadrilinear texture sampling hardware supported? If you have a volume texture with mipmaps, GL_LINEAR_MIPMAP_LINEAR texture sampling will perform quadrilinear texture sampling.

Is that implemented in hardware like bilinear texture sampling is? Or does the driver just do two trilinear texture samples and interpolate those results for you?

Is trilinear sampling even supported by hardware?

sentences:
XNA spritebatch.Draw: Which part gets colored by the color parameter? Which part gets colored and how can I control it?
I have a rounded block and my goal is to have the center filled with a certain color chosen by that parameter. Here's the picture:

When I draw it with Color.Red for example, just nothing happens.
Simply creating the texture in these colors I need won't help, I want to create the colors very dynamic. That's a very simply texture but I also want to apply it on harder ones.

The center is transparent already.

sentences: In what instances would you want to use path-finding algorithms other than A*? I am familiar with how the common ones technically work (BFS, DFS, Dijkstra, A*) but as far as their realistic benefits I don't quite see the need for them. Considering that, given the right heuristics, A* is more performant then why bother with any others?

sentences:
Simple 2d Movement (Non platformer) This seems so simple but my searching as failed to find a good result.

The idea is that you can move in 360 degrees but you aren't faster when you move in a diagonal direction. I know how to do this with trig. The problem is I I want some physics so that if you are traveling north and start traveling south you first need to slow down to zero to go south. (And if going 270 deg to 30 deg it would be a more complicated.) The character has acceleration and a max speed.

I know that vectors are the solution but I can't find how to apply them the current speed to get smooth movement.

I'm doing this in GameMaker Studio 2, but pseudocode should suffice. Here's what I have.

var h,v;
h = key_to_axis(vk_right,vk_left);
v = key_to_axis(vk_down,vk_up);

var dir = point_direction(0,0,h,v)
spd = approach(spd,max_spd,accel);
x+= lengthdir_x(max_spd,dir);
y+= lengthdir_y(max_spd,dir);

Note that this movement is shared by characters that can move in the full 360 degrees.

sentences:
How can I pass an array of floats to the fragment shader using textures? I want to map out a 2D array of depth elements for the fragment shader to use to check depth against to create shadows. I want to be able to copy a float array into the GPU, but using large uniform arrays causes segfaults in openGL so that is not an option. I tried texturing but the best i got was to use GL_DEPTH_COMPONENT

glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 512, 512, 0, GL_DEPTH_COMPONENT, GL_FLOAT, smap);

Which doesn't work because that stores depth components (0.0 - 1.0) which I don't want because I have no idea how to calculate them using the depth value produced by the light sources MVP matrix multiplied by the coordinate of each vertex.

Is there any way to store and access large 2D arrays of floats in openGL?

sentences:
LibGDX How do I create a Shop? My game is fully working but now I want to make a shop so that the player can buy boosts or other useful stuff for the money the player has collected.

What is the best way of doing this kind of shops:

*The collected coins you have saved goes up/down in value when you buy something

*The item activates if bought.

Is this possible in libGDX and how can I start?

sentences:
Do rendered-to-textures need to be bound when being drawn to? In OpenGL, if I'm rendering to a texture using a framebuffer, do I have to have that texture bound while I'm rendering to it? In code:

glBindTexture(...);
glTexImage2D(...);

glBindFramebuffer(...);
glFrameBufferTexture2D(...);

//START DRAWING HERE: does the texture I'm rendering to need to be bound here?

sentences:
How do I better organise rendering in an entity component system? I'm developing an isometric RPG, with 3D characters in 2D level. I was using a standard object orientated programming paradigm, but was faced with a lot of issues. Recently, I learned about entity component systems, and am currently rewriting my engine using this paradigm.

I use OpenGL, and have two rendering systems - one for drawing in 2D, and one for drawing in 3D. Each system consists of one VBO id, with the appropriate geometry, shader program id, id of texture unit binded to the texture atlas (which accommodates all tilesets or all model textures) and other information like that. The alternate systems provide different logic for drawing in 2D and 3D.

When it comes to the components for these systems, I am stuck.

Say I have component, defined by the buffer offset from the beginning of VBO buffer and the primitive count that needs to be rendered. Let's pretend that I have two instances of these components. The first instance belongs to the level floor entity, and describes the bunch of quad tiles. The second instance is a character mesh that belongs to the player entity. The first component instance should use the 2D rendering system, and second instance should use the 3D rendering system, but the data structure of these instances are identical. It must be said that I use EntityX and the components gets in the systems, automatically depending on their type.

Both systems require position and craphics components, so both systems will take both component instances, and one of these component will be processed improperly, what with a 2D graphics component in a 3D rendering system, and vice versa. I'm thinking about creating the "hollow" components, like sprite and model, which will indicate what graphics components in the entity mean. Since these component will not contain any properties, and would be used only as flags, this solution seems clumsy.

How do I better organise rendering in an entity component system?

sentences:
Bump mapping Problem GLSL I am having a slight problem with my Bump Mapping project. Although everything works OK (at least from what I know) there is a slight mistake somewhere and I get incorrect shading on the brick wall when the light goes to the one side or the other as seen in the picture below:

The light is on the right side so the shading on the wall should be the other way. I have provided the shaders to help find the issue (I do not have much experience with shaders).

Shaders:

varying vec3 viewVec;
varying vec3 position;
varying vec3 lightvec;
attribute vec3 tangent;
attribute vec3 binormal;
uniform vec3 lightpos;
uniform mat4 cameraMat;

void main()
{

    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = ftransform();

    position = vec3(gl_ModelViewMatrix * gl_Vertex);
    lightvec = vec3(cameraMat * vec4(lightpos,1.0)) - position ;

    vec3 eyeVec = vec3(gl_ModelViewMatrix * gl_Vertex);
    viewVec = normalize(-eyeVec);

}

uniform sampler2D colormap;
uniform sampler2D normalmap;

varying vec3 viewVec;
varying vec3 position;
varying vec3 lightvec;

vec3 vv;

uniform float diffuset;
uniform float specularterm;
uniform float ambientterm;

void main() {

    vv=viewVec;

    vec3 normals = normalize(texture2D(normalmap,gl_TexCoord[0].st).rgb * 2.0 - 1.0);

    normals.y = -normals.y;

    //normals = (normals * gl_NormalMatrix).xyz ;

    vec3  distance = lightvec;
    float dist_number =length(distance);
    float final_dist_number = 2.0/pow(dist_number,diffuset);
    vec3  light_dir=normalize(lightvec);
    vec3  Halfvector = normalize(light_dir+vv);
    float angle=max(dot(Halfvector,normals),0.0);
          angle= pow(angle,specularterm);
    vec3 specular=vec3(angle,angle,angle);
    float diffuseterm=max(dot(light_dir,normals),0.0);
    vec3 diffuse = diffuseterm * texture2D(colormap,gl_TexCoord[0].st).rgb;
    vec3 ambient = ambientterm *texture2D(colormap,gl_TexCoord[0].st).rgb;
    vec3 diffusefinal = diffuse * final_dist_number;
    vec3 finalcolor=diffusefinal+specular+ambient;

    gl_FragColor = vec4(finalcolor, 1.0);

}

sentences:
Texture Tiling and Texture Coordinates in Unreal Engine I've just started to learn how to develop games and everything is new for me now.

I don't know where to start and I decided to start with Textures and there is something it is difficult to understand for me: Texture Tiling.

I'm not an English speaker and I have searched the meaning of tile and tiling on my own language (Spanish) and I think tile is a way to say repeat the texture across the model instead of stretching it.

I have found PolyCount Wiki and this is how they explain tiling:

  Textures can be repeated across a model, by Tiling the
  TextureCoordinates.

My problem here is that I don't understand the meaning of Tiling. Can I replace Tiling with Repeating without changing the meaning of the sentence?

I have another question is about Texture Coordinates. On PolyCount Wiki they say that:

  Texture coordinates are measured in a scale of 0.0 to 1.0, with 0.0
  and 1.0 at opposite sides of the texture. When a model has a UV
  distance greater than 1 (for example, UV goes from -1 to 2) then the
  texture will tile across the model.

How can I know if I model has a UV distance greater that 1?

By the way, I'm using Unreal Engine, and on its Texture Coordinate element I don't understand the meaning of amount of tiling in their UTiling and VTiling properties.

sentences:
Collision within a poly For an html5 engine I'm making, for speed I'm using a path poly. I'm having trouble trying to find ways to get collision with the walls of the poly. To make it simple I just have a vector for the object and an array of vectors for the poly. I'm using Cartesian vectors and they're 2d.

Say poly = [[550,0],[169,523],[-444,323],[-444,-323],[169,-523]], it's just a pentagon I generated.

The object that will collide is object, object.pos is its position and object.vel is it's velocity. They're both 2d vectors too.

I've had some success to get it to find a collision, but it's just black box code I ripped from a c++ example. It's very obscure inside and all it does though is return true/false and doesn't return what vertices are collided or collision point, I'd really like to be able to understand this and make my own so I can have more meaningful collision. I'll tackle that later though.

Again the question is just how does one find a collision to walls of a poly given you know the poly vertices and the object's position + velocity? If more info is needed please let me know. And if all anyone can do is point me to the right direction that's great.

sentences:
Java RPG class implementation (design pattern ?) For my school project I'm making a little NFC based game on Android.
The concept is simple, on each phone you create a character and you can fight with other people through NFC.

The character will have have a set of attributes, like strength, agility, etc which are represented as short (only 2 bytes => for NFC communication).
A character must have a race (human, dwarf, ...) and a class (warrior, wizard, ...).
Each race has attribute advantages (ex : + 2 strength for dwarf) and a passive bonus ex : +5% gold after a fight.
Each class can wear different weapon and will have a different attack() methods.

My problem is that I don't know how I should create my character class and allow it to have a race and a class.

Does anyone have an idea of how I can accomplish this ?

sentences: How do games go about designing weapon damage? In Action-RPG games, I was wondering how weapon damage numbers  and attack speeds are decided on. Do most games come up with their own or do they "steal" numbers from other games? How would I go about coming up with my own numbers?

sentences: How I can count how many time gameOver scene is loaded? I'm building a game using unity 3d and I want to add an interstitial ads to it, but I want it to appear after the player lost every 3 times. So when the player loses for the first time the ads will appear, and when he loses for the second and third time, nothing appears until he lost for fourth time.

sentences:
Enable SteamVR hand collision for when holding objects Just getting started on a game project with SteamVR in Unity. I've run into an issue with the collisions though. The hands and the objects that can be held collide with everything in the scene as they should. But when an object is picked up, the hand and the object stop colliding with everything.

How would I go about fixing this? I could leave it as is, but if an object is let go of inside another, it gets flung out of the object it was inside.

The other odd behavior happens after you let an item go. The hand that was holding it continues to not collide with anything until you move the hand away. After that it'll collide with everything normally again.

sentences:
Help with NPC following the player in a sidescroller I'm a beginner with C# and am having a bit of trouble coding an NPC that follows the player in a 2D sidescroller. The player has two speeds, a walk and a sprint. I have a very basic companion follow script but it's only set on one speed, and if I increase the speed so that the NPC will keep up when the player sprints, the NPC jitters when it follows the walking player, which makes sense. I'm just wondering if there's a way in which the NPC can dynamically follow the player in the exact same speed as the player so that this issue doesn't arise. I figure this would inquire an entirely new script, but that's fine. Again, I'm still new to all this, so any help would be greatly appreciated! Thanks!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CompanionFollow : MonoBehaviour
{
public float speed;
public float stoppingDistance;

private Transform target;

// Start is called before the first frame update
void Start()
{
    target = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
}

// Update is called once per frame
void Update()
{
    if(Vector2.Distance(transform.position, target.position) > stoppingDistance)
    {
        transform.position = Vector2.MoveTowards(transform.position, target.position, speed * Time.deltaTime);
    }
}

}

sentences: Why models that are far from camera not rendered correct in unity? I am making a roguelike in unity and i came across a problem where models are far from the center of camera rendered weird like upper right enemy. I have added screnshot there are also camera settings. I tried changing field of view but it did not work. Does anyone know which option causes that distortion?

sentences:
Determining first voxel ray intersects I'm trying to implement the Fast Voxel Traversal Algorithm on a uniform grid of axis-aligned rectangles. Having read the paper, I understand how the traversing works, but not the initialization. I've looked around and I did find a readme that overviews the algorithm, but I fail to see how the derive how to determine the index in a data structure (such as an array) that corresponds to the first voxel the ray intersects.
Using the construct presented in the readme, assuming the grid is 2x2 and stored in (going to use Python) an list like so:
+--------+--------+
|        |        |
|        |        |
|  0, 1  |  1, 1  |
|        |        |
|        |        |
+--------+--------+
|        |        |
|        |        |
|  0, 0  |  1, 0  |
|        |        |
|        |        |
+--------+--------+

grid = [[(0, 0), (1, 0)],
        [(0, 1), (1, 1)]]

In the overview, the compute r2 = r and resolve t = 27/32, but I fail to see how they translate that to the index grid[0].
Some other resources I've used to try and understand:

StackOverflow post
Flipcode blog

sentences:
Lighting large scene with dynamic lights - Unity3D I am working on a game project where most of the action takes place in a large scene that is built to look like a space station. Because it is all technological and enclosed, I can't use a directional light to light the whole scene, and I need to be able to change the color of the lights for an alarm system. I can't bake the lights, because then I can't change their color, and I can't leave them all as dynamic lights, because I have about fifty spot-lights, and they take up a huge amount of memory, so much so that the lights can't even render on mobile devices.

Is there any way to do this without baking?

I am getting about 3000 batches in the Unity Editor Stats on average, in some places it is higher. Even viewing the game in full screen in the editor makes the game run super slow because of the amount of rendering it has to do, and I have a pretty new computer.

Here's a picture of my scene (As you can see, it is fairly large as you are able to see the UI box clearly from the scene editor):

And here's the Stats box:

Here is an example of my scene in play mode:

UPDATE:
I removed the shadow casting, which isn't necessary for my project, and it improved the framerate slightly, and the batches number is smaller, averaging out at about 1500 now, but the performance still is not optimal.

sentences:
Secure login for a game that is open source I am making a game which i will be open sourcing. Its a simple arcade like game but requires a network connection because it is meant to be played with other people.

The thing i am worrying about is how would i be sure that the client is the one that i put out for the end user to play with? Kind of a like of sv_pure for Team Fortress 2.

I was thinking of different ways to combat this such as the server requesting the client's version or even it's md5 hash but people with simple java knowledge could just force a method to always return what the server wants.

sentences:
What steps can developers take to improve the graphics of their games? My understanding is that the differences in graphic quality between games for systems like Xbox One and PS4 and Pixar-style movies stems from that the former are rendered in real-time.

But even with real-time rendering, it looks like some game makers can get rather nice looking results. An example below is about the new Gears of War game:

Above image is from this YouTube video posted by GameSpot. So admittedly it could be from a video (e.g. a promo) that has been rendered more than the actual game.

Anyway so what I wanted to ask is, are games solely dependent on the real time rendering on the target system, or are there some steps developers can take (besides the obvious: start with as good graphics as possible) to improve the graphics in their game?

Edit: here I am referring strictly to in-game graphics.

sentences:
Spider physics to patrol on platform smoothly when changing direction I have a 3 tile wide platform. I want my spider to hang from the ceiling and patrol this platform left and right.
I have dx property for velocity. I want a physics code that shows how to achieve this.
I tried this but it is too harsh:
  if (dx < 0 &&
      !base.isSolid(-16, -1)) {
    dx *= -1;
  } else if (!base.isSolid(16, -1)) {
    dx *= -1;
  }

What I want spider is to slow down on edges change direction and speed up.

sentences:
How to manage "jump" in my 2d platform game? I'm developing a simple 2d platform game with Unity 2d.
I have a problem managining my "Jump" action for the player.

I would like the player to Jump only when he has his feet on a "surface": terrain, platform, crate etc.
I'm considering using colliders: when my player collides with a surface, set my bool canJump = true.
When he jumps, I set canJump = false (he is midair).

My terrain has a Rigidbody2d is Kinematic and a Box Collider 2d.
My Player has a Rigidbody2d is Dynamic and a Capsule Collider 2d (or a Polygon Collider.. )

The events OnCollisionEnter2d() and OnTriggerEnter2d() are never raised when Player collides with terrain.

Does anyone know what's wrong?

Thanks

EDIT: Now i'm using this to check if "something" is under my feet:

RaycastHit2D hit = Physics2D.Raycast(rb.transform.position, -Vector2.up, 0.1f);
        if (hit)
            canJump = true;

It doesn't works!
hit is always true!
I'm getting mad!

sentences:
How to implement special weapon and armor effects (ex: vampiric, holy, damage shield, thorns)? I'm working on the inventory system for my game, and am interested in how do I implement additional weapon and armor properties that are not just damage or armor?

If all I have is damage and armor, the equation is simple: damage = weapon damage - armor;

But I'm looking for a more interesting user experience - namely items that have 2-3 properties that modify various game mechanics.

For example, I can use a bunch of flags and write a big if/else statement in my attack method and check for all these at appropriate points:

if (weapon is vampiric)
{
heal attacker for x
}

if(weapon is holy)
{
check defender type, add extra damage
}

if(armor absorbs first x damage)
{
reduce damage to defender by x
}

Another way that I thought might be better is the decorator design pattern - progressively wrapping the output of one weapon creation into another :

public class Main {

    public static final void main(String[] args) {
    Weapon w = new MeleeWeapon();

        w = new Holy(w);
        w = new Vampiric;
        w = new Enchanted(w,1);

        Damage damage = w.damage();

    }

}

It seems to me that decorator would allow me to write more flexible code and add more types later, but I'm not sure if it will just move the if/else statements into the weapons special property method.

sentences:
UDK iOS ; base Class I want to make a game with UDK for mobile and I wonder if There is any limits?

I mean, for example, can I use UTPawn as my base Pawn class when making a game for my mobile(iOS) game?

How can I know which classes are legal in my case?

sentences:
How to make my character slide (not bounce) off a slope My character needs to slide and not bounce off a slope.

The solutions I found here use a Reflection vector, but they make my character bouncy when they run downwards a slope.

var reflectVector = normal.clone().multiplyScalar(-this.velocity.clone().dot(normal));
this.velocity.addSelf(reflectVector);

How can I make my character simply stick to the terrain when they walk?

sentences:
Remove delay when changing axis input in the Unity Input Manager I had a problem playing with the Input Manager, where for example:

When Horizontal (+) is pressed, it increase its value but, when Horizontal (-) is pressed, the horizontal value stays positive for a little, but keeps decreasing. This causes the character to continue playing "right" animations and still moving to right for a few seconds, instead of instantly playing 'left" animations and moving to left. The problem also makes the character movie a little after the player releases the key.

I have also used Input.GetKey(), but that means the player cannot change the setting from the game launcher, and I don't want to create player setting in-game, for now.

What I am trying to achieve is when Horizontal (+) is pressed, then the player presses Horizontal (-), it should instantly turn left without delay. When the player is not pressing any Horizontal key, it should stop moving horizontally, instantly. This problem also appears along the Vertical axis.

How do I make it so input snaps to -1 or 1, with out slowly moving back and forth?

sentences:
Does swap buffer with vsynch guarantee synchronization? I was wondering if I could assume that all buffer related GPU operations such as:

glDrawElements
glBufferData
glSubBufferData
glUnmapBuffer

are guaranteed to be completed after swap buffer is performed (i.e. frame is finished) assuming vsync is on.
I'm confused as I've come across implementations of vertex streaming techniques such as rond robin vbo which imply that a vbo could still be in use during the next frame.
What I basically want to do is stream vertices through glMapBufferRange with GL_UNSYNCHRONIZED_BIT, managing the correct ranges myself so that writes and reads never overlap.
This would work very well if I could just assume synchronization and reset the stream range index at the end of the frame.
In other words, does swap buffer with vsynch guarantee synchronization?

sentences:
How do 3d engines add textures to objects? I was wondering how 3d engines like Unity or OpenGL added textures to objects.

Example:

How would Unity add this texture to the side the arrow is pointing to?

sentences:
How can I call Schedule() on interface that inherits from IJob So I have a voxel terrain engine, and I have an interface that all meshing jobs should inherit from. That looks like this (simplified from the actual):
public interface IMesherJob : IJob
{
    VoxelDataVolume<byte> VoxelData { get; set; }

    NativeArray<MeshingVertexData> OutputVertices { get; set; }
    NativeArray<ushort> OutputTriangles { get; set; }
}

One example of a meshing job is marching cubes, which looks like this: public struct MarchingCubesJob : IMesherJob
So here's my question: If I have a reference to an IMesherJob, can I somehow call Schedule on it? If I have a reference to MarchingCubesJob, I can call Schedule on it:
This works:
MarchingCubesJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64)

But this does not work:
IMesherJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64);

I noticed that Schedule() is an extension method for T where T : struct, IJob so that might be interfering with it, but it should still work because IMesherJob inherits from IJob

sentences:
Why do I get these weird errors when using pow() for my game? /usr/bin/ld: /tmp/ccfm5eKc.o: undefined reference to symbol 'pow@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

I get this error when trying to use pow(). Why?

sentences:
Why the spotlight is working only in scene view window but not in game view? What i did is disabled in the Hierarchy the Directional Light.
The Spotlight is child of the character so it will move with it.

Then in Window > Lighting > Settings

In the Spotlight i just changed the range and rotation a bit.
It's strange since it's showing the light in the scene view but not in the game view not even when running the game.

And this is the Spotlight config:

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:
Unity provides wrong Input value if game is started with bumpers pressed down As the title states I am having an issue with the following. It is a pretty specific edge case but it is something I can't work around.

In Unity I have created two Axes to allow me to check the value of the of the left and right bumpers on an Xbox controller. The problem I am having is the controller I am using is a special product where by default the left and right bumper are always on. This is intended on the controller and is definitely not changeable. The issue here is that because the controller has the bumpers pressed in by default when Unity is launched it reads the input of those buttons with a value of 0 instead of 1 (as I have the controllers set to provide a positive input).

I've tested this with a normal Xbox controller by manually pressing the trigger in before I launch the game and I get the same results so I can confirm that it is a Unity thing and not a controller issue. The only way to fix the controller's input is to manually refresh the bumpers (which are attached to sensors in this case).

This is currently not an acceptable way for me to refresh the device I just need to get the devices correct input immediately. Is there a way I can, in code, not have the game recognize the controller until I specify? The reason for this is if I plug my device in AFTER the game starts I get the correct values.

This game will only ever be run on Windows so I would be open to coding up an OS level script that utilizes some of the Windows functions.

EDIT: I thought I should add I have tried sending visualized input to the device via code and this has not fixed the issue.

sentences:
Depth Map resolution shifting the problem is with shadow mapping as you can see,

actually it works fine but in a certain condition that the Depth Map size must be equal to the size of rendering buffer, I use an infinite directional light

so if the window is 800x600 the depth map must be 800x600, and when i change the size of the shadow map to be 900x600 it starts to be shifted and when it's size be 1024x1024 it also shifts till it disappears

the GLSL shadow function

float calcShadow(sampler2D Dmap, vec4 coor){

vec4 sh = vec4((coor.xyz/coor.w),1);
sh.z *= 0.9;
return step(sh.z,texture2D(Dmap,sh.xy).r);
}

here's the result when it's the same size as the window

Colored result & Depth Map

and here's the shifted result, as you can notice the depth map is exactly as the previous one with the addition of white space to the right.

Colored result
http://goo.gl/5lYIFV

Depth Map
http://goo.gl/7320Dd

sentences:
BufferedImage canvas is null I'm sorry if this isn't the right place for this post, but I don't know where to go.

I'm trying to make a simple game loop but it's already failing

package main;

import javax.swing.JPanel;
import java.awt.*;
import java.awt.image.*;

public class Logic extends JPanel implements Runnable {

/**
 *
 */
private static final long serialVersionUID = 1L;

// Main Game Stuff
private int gWidth = 800;
private int gHeight = 640;
private int scale = 2;

private int fps = 30;

private boolean running;

private Thread thread;
private BufferedImage image;
private Graphics2D g;

public Logic(){
    super();
    setPreferredSize(new Dimension(gWidth, gHeight));
    setFocusable(true);
    requestFocus();
}

public void addNotify(){
    if(thread==null)
    {
        thread=new Thread(this);
        thread.start();
    }
}

public void init()
{
    image = new BufferedImage(
            gWidth, gHeight, BufferedImage.TYPE_INT_RGB
        );
    g = (Graphics2D) image.getGraphics();
    System.out.println("Hello!");
    running = true;
}

private void update() //main logic
{
    //do stuff
}

private void render(Graphics2D g)
{
    g.setColor(Color.BLUE);
    g.fillRect(0, 0, gWidth, gHeight);
}

private void PaintCanvas(){
    Graphics g2 = getGraphics();
    g2.drawImage(image, 0, 0, null);
    g2.dispose();
}

public void run()
{
    init();

    int loops = 0;
    long startTime = System.nanoTime();
    float rate = 1000/fps;
    long lastTime = startTime;
    float waitTime = rate;

    while(running) // game loop
    {
         long currTime = System.nanoTime();
         if(currTime > (lastTime + waitTime))
         {
             waitTime = rate;
             if((currTime - lastTime) > rate)
                 waitTime = currTime - lastTime;

             //-- Paint Canvas --//
             PaintCanvas();

             //-- LOGIC -- //

                update();

             ////////////////
             //-- RENDER --//
             if(loops % 2 == 0)// draw every second frame
             {
                 render(g);
             }
             ////////////////
             loops++;

             lastTime = currTime;
         }

    }
}

}

I keep getting this error:

Exception in thread "Thread-2" java.lang.NullPointerException
at main.Logic.PaintCanvas(Logic.java:67)
at main.Logic.run(Logic.java:93)
at java.lang.Thread.run(Unknown Source)

Why is the image null? I can't for the life of me figure it out. I already declared it in the init() function.

sentences:
Unity color transparency is affecting image transparency I am building a chess board in Unity.
I have a Grid Layout component made out of 64 Single_Field PreFabs.
I instantiate the field like this
public GameObject[,] fields = new GameObject[9,9];
public GameObject field;
public GameObject fieldParent;

//double for loop over I,J,
GameObject newField = Instantiate(field);
fields[i, j] = newField;
newField.transform.SetParent(fieldParent.transform, false);

Then outside of the loop I do
    fields[3, 4].GetComponentInChildren<Single_Field>().pieceSprite.GetComponentInChildren<Image>().sprite = blackPieceImages[0];

Nothing shows up. Because the color of the prefab where the piece image will be has a transparency of zero.
If I add this line,
    fields[3, 4].GetComponentInChildren<Single_Field>().pieceSprite.GetComponentInChildren<Image>().color = Color.white;

Then the piece shows up exactly correct, with the chess board behind it.
However, if I start out by making the prefab non-transparent, it covers my whole chessboard with squares.
Any ideas?

sentences:
AssetBundles with shaders that contain #include to cg/hlsl I have a shader that contains some #includes to other cg/hlsl scripts. If i put that shader into an AssetBundle, how am i suppose to handle the cg/hlsl scripts?

Are they not necessary anymore because they are compiled into the shader during the AssetBundle build process? Unity version is 5.6.6f2

Or do i have to put the cg/hlsl scripts into the AssetBundle too? If that is the case, how do I load them during runtime such that the Shader finds them?

Someone suggested me to inline them, but I would like to avoid it if possible.

sentences:
What happens if I delete .meta files? In Unity, what happens if I delete the meta files? Or if I import files, but not their respective .meta files?

What are some issues I could come across? Is there ever a reason I would want to delete meta files?

I was asked this question recently, and I do not know the answer.

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:
How to correctly specify the offset in a call to glVertexAttribPointer()? I'm trying to draw a simple triangle using the following vertices:

std::vector<VertexFormat> vertices;
vertices.push_back(VertexFormat(glm::vec3(0.25, -0.25, 0.0),
    glm::vec4(1, 0, 0, 1)));
vertices.push_back(VertexFormat(glm::vec3(-0.25, -0.25, 0.0),
    glm::vec4(0, 1, 0, 1)));
vertices.push_back(VertexFormat(glm::vec3(0.25, 0.25, 0.0),
    glm::vec4(0, 0, 1, 1)));

The corresponding Vertex format is given by the following struct:

struct VertexFormat
{
    glm::vec3 position;
    glm::vec4 color;

    VertexFormat(const glm::vec3 &iPos, const glm::vec4 &iColor)
    {
        position = iPos;
        color = iColor;
    }
};

The first call to glVertexAttribPointer() is easy since the position vector appears first in the struct, the call is as follows:

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)0)

The second call to glVertexAttribPointer() should be made specifying a suitable offset for the color attribute of a vertex. Since the color vector appears after the position, then such offset should be given by sizeof(glm::vec3). The corresponding call is:

glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)(sizeof(glm::vec3)))

The output of the program using these parameters is:

This output is wrong. There are only two colors (green and blue) and the colors are in the wrong position, note that the bottom-left vertex is blue, but according to the code the vertex should be green.

If the offset is changed to sizeof(glm::vec4) the call is:

glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)(sizeof(glm::vec4)));

And the triangle is rendered correctly

So, Is my understanding of the offset parameter wrong? Why using an offset with the size of a vec4 gives the right output?

Any help would be appreciated.

P.S. Sorry for the bad english.

Edit: After reading the answer of Fibbles, and the comments of Fuzz Logic, I checked the size of the VertexFormat struct. A sizeof() gives a size of 32 bytes for a 32 bit executable. So padding is indeed the problem here. Using the macro suggested by Fibbles solves the problem. Thanks for everything guys!

sentences:
What is a reasonable OpenGL version baseline for a mid-range 3D game? I decided recently write a 3D game in my spare time, as I was tired of my daily  "corporate programming". If I expect to be done in 6 months/1 year, which version of OpenGL should I use as baseline? In other words, which version of OpenGL should I require my potential users to have?

I did some OpenGL has a student, but that was in the days of the first edition of the red book. Things have changed a lot since then.

sentences:
Storing few values in an int - small gain This might be a bit hard-to-answer question, but... I had a DirectX::XMFLOAT3 as a vertex attribute. I have changed it to just an int by placing the 3 floats into int (using only 8 bits per float). In the vertex shader I am extracting the bits like this:

// example int bits: 00000000 10011000 00011101 11111111

input.weight.x =   ( input.w >> 16 )               / 255.0f; // 10011000 / 255.0f
input.weight.y = ( ( input.w & 0x0000FF00 ) >> 8 ) / 255.0f; // 00011101 / 255.0f
input.weight.z =   ( input.w & 0x000000FF )        / 255.0f; // 11111111 / 255.0f

But with this manner I've only gained like 1-5 fps (from ~130 to ~135), how is that possible that the fps boost is that small? What's the culprit here? Is the extracting bits on GPU that heavy?

sentences:
How can I use D3DXLoadMeshFromX with Direct3D 11? I'm trying to write some class for loading meshes from X files.

But I can't use the function D3DXLoadMeshFromX because its third parameter is LPDirect3DDevice9.

In my D3D initialization code I don't have variable of this type. Did I initialize D3D incorrectly? How can I call this function?

sentences:
What are screen space derivatives and when would I use them? I see the ddx and ddy glsl functions and the hlsl equivalents come up in shader code every now and then. I'm currently using them to do bump mapping without a tangent or bitangent but I basically copy-pasted the code. I don't understand what these functions actually are, what they do, and when I would look to use them.

So questions:

What are the screenspace derivatives functions?
What do these functions do? The input values and output values
What effects are they most commonly used for?
What sort of effects require that you look toward these functions?

sentences:
Any interesting thesis topic? I study Computer Science at Technical University of Lodz (in Poland) with Computer Game and Simulation Technology specialization. I'm going to defend BSc thesis next year and I was wondering what topic I could choose but nothing really interesting is coming to my mind.

Maybe You could help me and suggest some subjects related to programming graphics, games or simulations? (or maybe something else that is interesting enough :) ). I would be very grateful for any suggestion!

sentences:
Accesing child GameObjects of GameObject I have already tried really much with all "GetChildren" and similar functions, but I haven't found out how to do it yet.

I have a GameObject named "koffer".
I have added several other GameObjects as children to it.

I have added a script to "koffer" in which I try to retrieve the children.
In this script I have stated this line:

    string sThis = this.name; //just for testing. "sThis" becomes "koffer", so it looks perfectly fine.
    foreach (GameObject g in this.GetComponentsInChildren<GameObject>()) // doesn't retrieve anything. So obviously I'm not doing it correctly.

However this doesn't retrieve anything.
Is this not the correct function for such a case?

Is there any built-in function to retrieve theses game obects?

I have found several custom made functions from some years ago, and I don't know if they are still needed or if Unity has integrated some functions for that.

What really bothers me is that there are so many custom-made functions that deal with "Transform" instead of "GameObject". Why would somebody need Transform instead of GameObject?

Thank you.

sentences:
Understanding Screen Position Node in Unity Shader Graph I'm struggling to understand what exactly the Screen Position node outputs in Unity's Shader Graph.
I'm using the screen position with scene depth to calculate the distance between two objects.
Every tutorial I saw (like Brackey's forcefield one) is using the alpha channel of the Screen Position output:

I read that the Screen Position node outputs the mesh vertex screen positions.

Does it means the 2D position on the screen projection?
Or the vertex 3D position from the eye space?
And more importantly, what is exactly the apha channel of this output? (I have the feeling this is related to the "clip space W component" in the documentation)

sentences:
Why do I get these "Invalid command android" errors trying to build for Android in Unity? Trying to move a unity project over to android using gradle as the build system. I get the following 3 errors:

Error:Invalid command android

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/joeljohnson/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]
exit code: 64
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()

and

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/joeljohnson/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]

It turns out a lot of people have been having this problem and the most common solution is to move to an earlier version of the apk. When I tried that, I still received the same three errors. I moved down to api level 23 from the most current. I am one a mac.
    exit code: 64

sentences: 2D Tiled Map - Small tiles or big tiles with pixel-precise movement I am using Java - LWJGL - Slick2D . I have tried to do a proper collision detection with 32 x 32 tile size but failed three times. I just cant get it to work! I found a youtube video that was using ligbdx (but the code was understandable) that used small tiles and achieved something like pixel-precise movement , so here is the question , NOT opinion based. Keep trying to make a legit collision system or use small tiles? Also , please give me some info related to your answer like "tiles need to have X times Y size" or "a good resource is X Site for pixel-precise movement".

sentences:
What kinds of conflict-resolution can be fun beyond combat in an RPG? As someone who grew up on the single-digit Final Fantasy games and AD&D, there are few ways of solving an rpg problem as fun as a fight. Different streams of accomplishment (object acquisition/crafting, skill trees, puzzles, player strategies, team combination/synergies, etc) all go into a few minutes of frenetic action, allowing for the feeling of accomplishment and progress via stat increases as the game progresses.

That said, we tend to characterize rpg players as murderhobos for good reason. When you incentivize killing things, it's not long before all problems start looking like something to hit with your sword. And when you're able to steal anything not nailed down, why not do it?

While other kinds of conflict-resolution can be fun when in their element (farm/ Civ/Sim games for the sense of building something, spy/ninja/assassin games for deftness and exploiting situations, social games for roleplaying a character or out-thinking the other guy), they're often not fun outside their very narrow venue. And because we're limited to conversation with a computer (at least in single-player games), social games can't even explore the whole of their venue.

I'm racking my brain trying to figure out how to properly gamify the societal ideals of don't-kill, don't-steal in such a way that attacking or stealing becomes a conscious choice, not just a default means of action...but at the same time keep the same diversity of fun-inputs that fighting/stealing games have. Most games just code in consequences: the town guards are sent after you and/or some faction is less willing to deal with you. But this feels unnatural, and only invites further gaming of the system, producing better murderhobos at the end.

My reason for doing so? The main theme of my game is a heavily philosophical one(think a halfway-understandable Xenosaga) on how morality might play out in the post-post apocalypse. While killing and stealing would be a part of that, I feel that our natural tendency as gamers wouldn't allow this question to play out 'fairly'.

Any idea on how to put killing and stealing on a truly equal playing field with other forms of conflict resolution?

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:
How to implement transition between screens Last night I showed my game to my friends and they said it was a bit jumpy.

The example he gave was in the pokemon games when a battle starts music plays, the screen flashes then pixels out then the pokemon slide on from the side and the battle menu appears.

In my game you are walking along and the all of a sudden you are staring at the battle menu, I do see his point.

I am using a switch statement for my game loop, 1 is a fields and 2 is battle, in battle I run an if statement, if battle active do battle else display results screen/wait for user input.

I thought about making a state for the transition but them I would need a stater for field -> battle, battle -> field, town -> field and the list goes on an on seeming like lots of repeated code to me but I cant think of a way to pause the state while i play an animation like pokemon

With that sort or architecture how would transition between screens smoothly like my mate suggests?

C++ and directX

Edit: the problem I have is that once the state is changed the update routeen for that state is not called so all the sprites disappear as they are textures and only the background remains so I cannot just play a animation then change state or it will look even worse.

sentences:
Unity Re-import doesn't re-import fbx So I have an fbx file with animations and materials on it. Simple stuff.

But when I change something on the fbx, like adjusting some animation, then re-export as fbx, Unity does not re-import the fbx when I do RMB -> Re-Import. It shows the loading bar but doesn't actually effect the current mesh by re-importing.

Is this normal?

Is there a way to re-import the fbx while keeping the modification I made on the mesh. Like, I changed the Scale Factor and some other things, so I want to keep these while re-importing.

sentences:
Parsing Blender exported collada file in c++ Since I could not find any libraries that can help me parse collada files in my c++/opengl project, I decided to write my own. (I did find assimp, but binaries for Visual Studio 2013 were't available, and I don't know enough to build it myself from the source; Can anyone build it and share it please? )

I read up a little about the structure of .dae files, figured I could do it, and exported Suzanne from Blender in a .dae file. Fine. Now I open up the .dae file in Notepad++ just to make sure I got the basic understanding right, and I found something weird.

So the tags [float_array id="Suzanne-mesh-positions-array" count="1521"] and [/float_array] contain the huge list of vertex positions right?

And the tags [p] and [/p] inside [polylist count = "968"] and [/polylist] should contain vertex indices in triangular order right?
But that doesn't make sense, cause then the first triangle is going to be vertex[46], vertex[0] and vertex[0].. But how is that possible? Any help please? If I've got it wrong, can someone direct me to some place where i can learn how to parse collada files. Thanks a lot.

EDIT: I finally managed to build Assimp for VS 2013 (YAAYYYY!!)after getting awesome instructions at http://www.learnopengl.com/#!Model-Loading/Assimp

But my confusion regarding the vertex indices remain.

sentences:
2d array to calculate height for player in heightmap? I'm trying to work out how to do so my player position takes into the account of the floor so if I generate a floor that is hilly when I walk I won't walk through the heel. The problem is that I'm not sure how to do it.

I can do basic collision detection for walls. However, this isn't collision detection. I need the add the height of the terrain to the player.

So as you see the terrain is really a grid with 4 points making a face. So I can get the 4 points and work out. I can probably work this out on myself, but I was wondering if I should store say the heigh at (x,z) in a 2d array or do I just work out the height again everytime I move?

It just I use simplexnoise and I worry that this will be expensive to do every turn.

 import java.util.ArrayList;

    public class VoxelLevel
    {
    Mesh mesh;
    Material material;
    Transform transform;
    Shader shader;

    VoxelLevel(String textureName)
    {
        material = new Material(new Texture(textureName));
        transform = new Transform();

        shader = BasicShader.getInstance();

        generateLevel();

    }

    private void generateLevel()
    {
        ArrayList<Vertex> vertices = new ArrayList<Vertex>();
        ArrayList<Integer> indices = new ArrayList<Integer>();

        int sizeX = 10;
        int sizeZ = 10;
        int freq = 25;

        for(int x=-300; x<300; x+= sizeX)
        {
            for(int z=-300; z<300; z+=sizeZ)
            {
                indices.add(vertices.size()+0);
                indices.add(vertices.size()+3);
                indices.add(vertices.size()+2);
                indices.add(vertices.size()+0);
                indices.add(vertices.size()+1);
                indices.add(vertices.size()+3);

                vertices.add(new Vertex(new Vector3f(x,50+25*(float)(SimplexNoise.noise(x/freq, z/freq) + 0.25 * SimplexNoise.noise(2*x/freq, 2*z/freq)),z), new Vector2f(0.75f,0.75f)));
                vertices.add(new Vertex(new Vector3f(x+sizeX,50+25*(float)(SimplexNoise.noise((x+sizeX)/freq, z/freq) + 0.25 * SimplexNoise.noise(2*(x+sizeX)/freq, 2*z/freq)),z), new Vector2f(0.75f,1.0f)));
                vertices.add(new Vertex(new Vector3f(x,50+25*(float)(SimplexNoise.noise(x/freq, (z+sizeZ)/freq)+ 0.25 * SimplexNoise.noise(2*x/freq, 2*(z+sizeZ)/freq)), z+sizeZ), new Vector2f(1.0f,0.75f)));
                vertices.add(new Vertex(new Vector3f(x+sizeX,50+25*(float)(SimplexNoise.noise((x+sizeX)/freq, (z+sizeZ)/freq)+ 0.25 * SimplexNoise.noise(2*(x+sizeX)/freq, 2*(z+sizeZ)/freq)),z+sizeZ), new Vector2f(1.0f,1.0f)));
            }
        }

        Vertex[] vertArray = new Vertex[vertices.size()];
        Integer[] intArray = new Integer[indices.size()];

        vertices.toArray(vertArray);
        indices.toArray(intArray);

        mesh = new Mesh(vertArray, Util.toIntArray(intArray));
    }

    public void input()
    {

    }

    public void update()
    {
        //SimplexNoise.noise(0.25, 0.25);
        //SimplexNoise.noise(0.35, 0.65);
        //SimplexNoise.noise(0.254, 0.225);
        //SimplexNoise.noise(0.254, 0.215);
    }

    public void render()
    {
        shader.bind();
        shader.updateUniforms(transform.getTransformation(), transform.getProjectedTransformation(), material);
        mesh.draw();
    }

}

sentences:
How to simulate feather fall in box2d? I am working with AndEngine with Box2d extension, but general answer or a concept idea will be appreciated too.

I have feather-like objects in a 2D side view world that I want to be part of the physics simulation. I am using linear damping to make the "feather" fall slowly. This might not be a good idea, maybe I should rather apply force in each update, but nevertheless, this works and it makes the object look "light" and it feels like there is air with resistance.

Now how can I make the objects actually look like feathers falling through air?

Specifically I am looking for two types of objects: Long with low density, that should move down in a slow swinging motion and square objects that would just randomly change trajectory. It would be great if this could be one simulation and length would be a parameter - the longer the object is, the more it would swing. Right now I want to simulate feathers, leaves and snowflakes in a cartoon world.

sentences:
Get average tile color In my 2D game I have TileSet class that loads the texture and creates Rectangle[] array which stores each tile coordinates. Pretty basic stuff. Now I'd like to also calculate and store the average color of each tile. How do I do that in XNA/C#?

My goal is to tint the tile with the color based on its value when highlighted. Or maybe there is some other way to achieve similar effect?

sentences:
Tracking small moving targets in Vuforia I am trying to track up to two small moving objects the size of a small toy car (about 7x4x4 cm / 3x2x2”)  from a 75cm / 2ft distance. I’m aware that the distance/size ratio is about 20, which is off by factor compared to the by Vuforia recommended ratio.

I've tried frame markers and while frame markers are super fast close up, they don't work well at a distance. I'm hesitant to use expensive object recognition on moving targets. I’ve tried black and white QR codes and AR markers as image targets but Vuforia seems to have trouble recognizing them, even though the QR code has a five star rating.

I’m considering two more options:

1) an optimized 4x4cm color image target

2) add LEDs to the objects and track the LEDs, for example like this: https://www.youtube.com/watch?v=IoL0bIGk_uE

My questions:

1) Are there specific tips for creating small image targets (I have read the generic image target optimizations tips assume not all those tips apply to small targets)

2) Is there an easy way to track LEDs in Vuforia?

sentences:
What are good games to "earn your wings" with? I believe that in order to become a good game developer, you need to make games.

From a programmer's perspective, what are some good entry level games to get your hands dirty? What skills and challenges do each of these games teach you?

sentences:
How can I hide the collision layer in libGDX with TiledMap? I'm making a 2D game with libGDX, and I'm using its TileMapRenderer to render my map which I have made in the map editor Tiled. In Tiled, I have a dedicated collision layer. However, I can't figure out how I'm supposed to hide it and its tiles in the game.

This is how a map is loaded:

TiledMap map = TiledLoader.createMap(Gdx.files.internal("maps/map.tmx"));
TileAtlas atlas = new TileAtlas(map, Gdx.files.internal("maps"));
tileMapRenderer = new TileMapRenderer(map, atlas, 32, 32);

Currently the collision tiles are rendered on top of everything else, as I see them in the map editor.

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:
What are the most popular software development methodologies used by game studios? What is the best (as in most used by professional game developers and/or companies) software development methodology used in game development?

I've heard that SCRUM is popular, but i'm not sure.

sentences:
XNA content.load Dependancy The project I'm building for test purposes is working fine but I have dependencies flying around everywhere due to the XNA framework.

My issue is in the content.load textures/sounds/fonts.
I have them as public variables (i.e.
Texture1 = Content.load(of texture2d)("Texture1") )

I'm passing a 'Game1' pointer into the constructor of every new class being instantiated to gain access to these variables.

Am I missing an OOP trick that would prevent me having to pass a pointer to 'game1' to every New class?

sentences:
Is It Possible To Make Matchmaking System Without Server? I want to make a matchmaking system without a server, but I don't know much about matchmaking. First, let me list what I want to do:

Cheating is not important in the game, so that the architecture will be listen-server. (One of the clients in the lobby will be host.)
The players will be connected to each other by sending invitations. I will not list any lobbies in the game.
All the data in the game will be sent via RPC functions. (I have already coded this.)

The game will be published on mobile platforms. I wonder if I can connect 2 players to each other in the game without a server. Is that possible? Can I make this kind of system by using a library like socket.io?

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:
How can one implement hot-swappable C++ modules? Fast iteration times are key to developing games, much more so than fancy graphics and engines with truckloads of features in my opinion.  No wonder many small developers choose scripting languages.

The Unity 3D way of being able to pause a game and modify assets AND code, then continue and have the changes take effect immediately is absolutely great for this.  My question is, has anybody implemented a similar system on C++ game engines?

I have heard that some really super high end engines do, but I am more interested in finding out if there is a way to do it in a home-grown engine or game.

Obviously there would be tradeoffs, and I can't imagine that you can just recompile your code while the game is paused, have it reloaded and working under every circumstance or every platform.

But perhaps it's possible for AI programming and simple level logic modules.  It's not as if I want to do that in any project in the short (or long term), but I was curious.

sentences: Is it possible to show vertex information in tables in VS2012 like in PIX? In PIX I was able to watch the objects' vertex data at different stages in tables, like before vertex shader, between vertex and pixel shaders, and so on. Can you see this in Visual Studio 2012 graphics debugger? I mean, you can see the data as a list of sorts, but it's impossible to get a good overview of that if you have more than like 3 vertices.

sentences:
Using real football (soccer) names from the past? Is it legal to use really old names in a manager style game?
It there an expiration on name license rights?

sentences:
Unity / How do I change the color of an object based on its depth? The objective here is to change the color of the nearest object.
(the nearer the object, the more "colorful" the object gets rendered; and the farther away, the more "grey" the object gets rendered), so far away objects are completely grey and close objects are in full color.
How I'm thinking about this so far:
You know, every frame, there is this certain float value, which determines if a pixel should be drawn or not. (aka z-buffer)
Can anyone tell me the variable - name of it?
Or how can I access it?
Can I even access it?
Edit:

The GPU is comparing two values: the depth of the new fragment you're
drawing (a) and the depth value of whatever's already been drawn in
that spot of the depth buffer (b).
Typically if b <= a it skips
drawing the fragment because it's behind whatever's already been
rendered previously.

I think I need both (a) and (b) variables - since I always need the nearer one.
Im not sure though...
I think its also fine if I could only access the (b) and check every frame if the previous b was smaller.

sentences:
Creating practically solvable 15 puzzle inputs I am now developing a 15 puzzle game. I know the method to detect unsolvable puzzles. But unlike 8-puzzle, solution for 15-puzzle takes quite long time for some input states and can be solved within 5 seconds some other set of input states.

Now the problem is that I cannot give the user(the player), a problem for which the solution takes more than 10 seconds(if he/she chooses to see the solution). So what I want is that when I initially shuffle the puzzle, I want to only present those puzzles which can be solved within 10 seconds. There must be some way to determine the hardness of the puzzle. I tried searching the net but could not find it.

Does anyone know a way of determining the hardness of a puzzle?
NOTE : I am using A* algorithm to find out the solution on a computer with 3GB RAM and 2.27GHZ processor.
EDIT : I have an additional requirement also. I am including a Puzzle Solver also. So based on the user's input, the cpu will solve the problem. Present A* algorithm with manhattan distance as heuristic takes a lot of time. First of all I would like to know which algorithm to choose - A* or IDA or some other. And I would like to know about other heuristics also.

sentences:
Using AdMob with Games that use Open GLES Can anyone help me integrating Admob to my game. I've used the badlogic framework by MarioZencher ... and My game is like the SuperJumper. I am unable to use AdMob after a lot of my attempts. I am new to android dev...please help me..I went thru a number of tutorials but not getting adds displayed ...

I did the following...

get the libraries and placed them properly
My main.xml looks like this

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

My Activity class onCreate method:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

RelativeLayout layout = new RelativeLayout(this);
adView = new AdView(this, AdSize.BANNER, "a1518637fe542a2");
AdRequest request = new AdRequest();
request.addTestDevice(AdRequest.TEST_EMULATOR);
request.addTestDevice("D77E32324019F80A2CECEAAAAAAAAA");
adView.loadAd(request);
      layout.addView(glView);
      RelativeLayout.LayoutParams adParams =
              new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                              RelativeLayout.LayoutParams.WRAP_CONTENT);
      adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      adParams.addRule(RelativeLayout.CENTER_IN_PARENT);
      layout.addView(adView, adParams);
      setContentView(layout);

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
glView = new GLSurfaceView(this);
glView.setRenderer(this);
//setContentView(glView);

glGraphics = new GLGraphics(glView);
fileIO = new AndroidFileIO(getAssets());
audio = new AndroidAudio(this);
input = new AndroidInput(this, glView, 1, 1);
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");

}
My Manifest file looks like this ....

    <activity android:name="com.google.ads.AdActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|smallestScreenSize"/>

</application>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk android:minSdkVersion="7" />

When I first decided to use the XML for admob purpose ..it showed no changes..it even didn't log the device id in Logcat...

Later when I wrote code in the Main Activity class.. and run ...
Application crashed ... with 7 errors evry time ...

The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.

The android:configChanges value of the com.google.ads.AdActivity must include uiMode.

The android:configChanges value of the com.google.ads.AdActivity must include screenSize.

The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.

You must have AdActivity declared in AndroidManifest.xml with configChanges.

You must have INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.

Please help me by telling what wrong is there with the code?
Can I write code only in xml files without changing the Activity class ...
I will be very grateful to anyone providing support.

sentences:
Unity2D: Scaling and Locking Image to anchor points I have a script that uses Index to change an objects sprite using OnClick to move through the sprites, like a slideshow. I want the image to scale to the size of my anchor points, because I've notice that when I stretch the game or put the game on maximize play the image stays the same size and doesn't scale to the size of my anchor points. How would I do that?
This is my script:

public Sprite[] Images;
//Index starts at one because we are setting the first sprite in Start() method
public int _Index = 1;

void Start(){
    //Set the image to the first one
    this.gameObject.GetComponent<SpriteRenderer>().sprite = Images[0];
}

public void onClick(){
    //Reset back to 0 so it can loop again if the last sprite has been shown
    if (_Index >= Images.Length)
        _Index = 0;

    //Set the image to array at element index, then increment
    this.gameObject.GetComponent<SpriteRenderer>().sprite = Images[_Index++];
}

Thank you. :)

sentences:
Best way to draw a textfield in OpenGL, when performance really matters? I'am creating my own GUI library in LWJGL (opengl for Java).
I already managed in creating buttons and panels, and I've also got the hover and active states of the components implemented. This question is about finding a fast way to render a complex component.
The library should be very performant!

So I pre-render everything I can, before the gameloop starts.
I also want to decrease the use of VBO's, triangles, and textures to render a single component.
My approach for creating a button is: pre-render the button appearance using a java Graphics object and put the drawing in a Power Of Two sized BufferedImage. That image is the texture.

Then I've got a FilledRectangle class. That class gets a BufferedImage (the texture) and an x, y, width and height. The class creates a VBO that just renders the Button.
For the hover state and active state, I really do the exact same thing, except that there is another drawing made with the Graphics object. So I just create another VBO for each state.

When it comes to rendering components that change their appearance, I can't pre-render too much.
I want to create a TextField.
Now I pre-render the background (the box of the textfield).
And I also pre-render the cursor.
The text has to be rendered during the game, and I have the following options:

Rendering the text using a Graphics object from the java graphics.
Pre-render a spritesheet (a character map) with all characters on it in a specific font, and then use that texture to create a new VBO for every time the text changes.
Note that the box of the component and the cursor are seperate VBO's so, when the text changes, I only have to deal with text rendering in a fast way.

My questions

It's very easy for me to draw things using a java Graphics object, but isn't this too slow when I have to use this during the gameloop?
Is it OK to recreate a VBO for every visible change?

sentences:
The 'speed' value of the Nav Mesh Agent component does not seem to affect speed at all (Unity3D/C#) The speed value of the Nav Mesh Agent component doesn't seem to have any effect whatsoever on the speed of my game object. Actually none of the motion values seem to have any effect. I've attached photos of how I've set up my Nav Mesh Surface Plane and how I've set up the Nav Mesh Component attached to my game object. I followed an online tutorial to use the Nav Mesh Agent component via a C# script. The object moves randomly just fine except that the speed and other values on the Nav Mesh Agent component don't seem to do anything. You will notice that there is a commented out 'randSpeed' public float variable that I experimented with. Changing that variable also did not affect the speed.

Any ideas about this problem are appreciated. Thank you.

public class  RandomMovement2: MonoBehaviour
{
    UnityEngine.AI.NavMeshAgent navMeshAgent;
    public float timerForNewPath;
    private bool inCoroutine;
    //public float randSpeed;

    // Start is called before the first frame update
    void Start()
    {
        navMeshAgent = GetComponent<UnityEngine.AI.NavMeshAgent>();
        //randSpeed = navMeshAgent.speed;
    }

    Vector3 getNewRandomPosition()
    {
        float x = Random.Range(-40, 40);
        float z = Random.Range(-40, 40);

        Vector3 pos = new Vector3(x, 0, z);
        return pos;
    }

    IEnumerator doSomething()
    {
        inCoroutine = true;
        yield return new WaitForSeconds(timerForNewPath);
        GetNewPath();
        inCoroutine = false;
    }

    void GetNewPath()
    {
        navMeshAgent.SetDestination(getNewRandomPosition());
    }

    void Update()
    {
        if (!inCoroutine && (Reaction2.stopMoving==false))
        {
            StartCoroutine(doSomething());
        }
    }
}

sentences:
Legal status of games with similar titles I've been working on a game for around a year and a half named Planetfall, in which you build a colony on a new planet.

I've bee working on it with that title since before the announcement of Age of Wonders: Planetfall. The games have some overlapping mechanics and aesthetic, but other than that it would be clear that my game is not a clone or a rip-off.

I know that I probably should change the name anyway (so there's no confusion between the titles) but I was wondering what the legal status is of a title that was in development since before the announcement of another similar title. If I decided to go ahead and not change the name, what could happen?

sentences:
Is a game's world-wide visibility in app stores affected by the publisher's country of residence? I've noticed on Apple Store (and I assume on Google Playstore too) I find different games and apps in France than in the US. Does this mean if my company resides in a small country and I register my game in this country, it'll only be shown to users of my country? Or is it just a matter of some settings and I can decide to be shown all around the world, for instance for American users (which is a larger market than my country), same as game producers living there?

Does a game developer's country of residence influence how many downloads world-wide he can reach at all?

My question is about Apple Store and Google Playstore, but answers for other platforms are welcome too.

sentences: HLSL Shader Optimilation with MAD(m,a,d) I understand that the expression x = m*a+d is most efficiently written as x = mad(m,a,d) because at the assembly level only one instruction is needed rather than a multiply and add separately. My question regards optimally writing this expression: x += m*a. Should this be written as x = mad(m,a,x) or x += m*a? The difference is too subtle to profile but I'm wondering if anyone can see the difference at the assembly level. (I don't know how to view the assembly code.)

sentences:
Where should I place my reaction code in Per-Pixel Collision Detection? I have this collision detection code:

public bool PerPixelCollision(Player player, Game1 dog)
{
    Matrix atob = player.Transform * Matrix.Invert(dog.Transform);

    Vector2 stepX = Vector2.TransformNormal(Vector2.UnitX, atob);
    Vector2 stepY = Vector2.TransformNormal(Vector2.UnitY, atob);

    Vector2 iBPos = Vector2.Transform(Vector2.Zero, atob);

    for(int deltax = 0; deltax < player.playerTexture.Width; deltax++)
    {
        Vector2 bpos = iBPos;
        for (int deltay = 0; deltay < player.playerTexture.Height; deltay++)
        {
            int bx = (int)bpos.X;
            int by = (int)bpos.Y;

            if (bx >= 0 && bx < dog.dogTexture.Width && by >= 0 && by < dog.dogTexture.Height)
            {
                if (player.TextureData[deltax + deltay * player.playerTexture.Width].A > 150 && dog.TextureData[bx + by * dog.Texture.Width].A > 150)
                {
                    return true;
                }
            }
            bpos += stepY;
        }
        iBPos += stepX;
    }
    return false;
}

What I want to know is where to put in the code where something happens. For example, I want to put in player.playerPosition.X -= 200 just as a test, but I don't know where to put it. I tried putting it under the return true and above it, but under it, it said unreachable code, and above it nothing happened. I also tried putting it by                bpos += stepY; but that didn't work either. Where do I put the code?

sentences:
How to mitigate when applying horizontal force to a rigidbody seems to overpower gravity? I've started testing movement using the example code in this answer of making a body accelerate to a target velocity
    private void FixedUpdate()
    {
        Vector2 input = GetInput();

        if (Mathf.Abs(input.x) > float.Epsilon || Mathf.Abs(input.y) > float.Epsilon)
        {
            Vector3 desiredVelocity = new Vector3(input.x * speed, 0f, input.y * speed);

            Vector3 delta = desiredVelocity - body.velocity;
            Vector3 acceleration = delta / Time.deltaTime;

            if (acceleration.sqrMagnitude > maxAccel * maxAccel)
            {
                acceleration = acceleration.normalized * maxAccel;
            }

            body.AddForce(acceleration, ForceMode.Acceleration);
        }
    }

and I've encountered the following curious behavior:
https://imgur.com/snGyVYK
When moving the body by applying force, the body seems to levitate as if gravity is not being applied. It actually is being applied but it seems as if the force being applied to the body is overriding the force of gravity because as soon as I let go of the movement keys the body suddenly drops. I am not applying any force on the y axis so I'm not sure what exactly is at play here. What is going on here and what can I do to mitigate this behavior?

sentences: What is the name of the AI/algorithm used by most MMOs for monsters or mobs? Is there a standard name for the (fairly dumb) AI that most MMOs use where you 'aggro' a monster/mob when you are within a certain radius of it, and the monster chases your character for a set amount of time or distance when you attempt to run away?

sentences:
Libgdx Texture Size Rounding Problem with Camera I have a problem with with camera usage. I use camera and a virtual coordinate system because I want to scale my game screen to whatever the actual system resolution is.

If I set camera viewport size to 1200, 1600 for example and real application pixel resolution is 600x800 then this problem happens. I want to draw a 62x62 image to the horizontal center of screen. when I use draw function with x equals (1200/2 - 62 / 2) this problem happens.

600 - 31 = 569. Since i draw 62 units wide in virtual coordinate space, its actually 31 pixels in this example. The problem is 31 pixels is impossible to center on a even numbered x axis (600 actual pixels in this example). But camera tries to solve this very badly by default. It just cuts last vertical line from my image and it's rendered wrong!

Ofc in this example I can change app resolution to whatever I want but I want to focus on mobile and support many different screen resolutions and I just wanna think in virtual coordinate space and its units not the pixels resolution of the device. What's the point of using camera when I think about the resolution? How can I prevent such problems?

If I put image to elsewhere (some even number) in x axis for example x=0 the image scales perfectly well and no missing pixels. If I don't use camera at all it also scales perfectly (using only pixel based units).

If there is no solution I feel like camera and viewport classes are useless and everyone must use pixels.

Screenshot of the problem:

Code for my game class:

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class MyGame extends ApplicationAdapter
{
   private SpriteBatch batch;
   private OrthographicCamera camera;
   private Texture myTexture;

   @Override
   public void create ()
   {
      batch = new SpriteBatch();
      batch.enableBlending();
      batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);

      camera = new OrthographicCamera(1200, 1600);
      camera.translate(camera.viewportWidth / 2, camera.viewportHeight / 2);

      myTexture = new Texture(Gdx.files.internal("circle.png"), true);
      myTexture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.MipMapLinearLinear);
   }

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

      camera.update();

      batch.setProjectionMatrix(camera.combined);
      batch.begin();
      batch.draw(myTexture, 569, 150, 62, 62);
      batch.end();
   }

   @Override
   public void dispose () {
      batch.dispose();
      myTexture.dispose();
   }
}

Code for its desktop launcher:

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

public class DesktopLauncher {
   public static void main (String[] arg) {
      LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
      config.width = 600;
      config.height = 800;
      new LwjglApplication(new MyGame(), config);
   }
}

Image asset I've used in this example:

sentences:
How do I use Android's adaptive icons in Unity? As of API 26, Android uses something called adaptive icons.

When targeting API 25 and lower, my app's icon looks fine:

But when targeting API 26+, it shows up in a white circle like so:

How can I target API 26+ while utilizing Android's adaptive icons?
What if I want to target API 26+, but not use Android's adaptive
icons?

sentences:
Formula for attack range using hexagons I need a little help with a formula to calculate the attack range for my turn-based strat game. Since it's a hexagon grid, I'm having trouble coming up with a formula that would pick the character range variable and calculate if an enemy object is in range.
I'm using Game Maker Studio 2.3. My old script used to check like this:
var unity_attack_range = attacker.RNG;

var hex_dist = 90 * unity_attack_range;
with(defender)
{
    if (point_distance(defender.x, defender.y, attacker.x, attacker.y) <= hex_dist)
    {
        //attack code stuff
    }
}

As you can see, it multiplies the attacker range variable by 90 (hexagon width/2), and then it would just point the distance between the attacker and, if inside it, then you can attack. However, I noticed it makes a circle-shaped check after the attacker with the current formula, and it will include enemies from outside the supposed range.
The hexagon shape is 180 x 120, and the distance between each hexagon center is 90 in both axis.
I don't think it will be worth entering all positions to check, since for range = 5, it would be necessary 90 positions to check manually. I need ideas on how to make it work with maths, like Civ 6 does. Any ideas? Also, thanks for the attention!

sentences:
LibGDX render sprites in tiled-map format ( convert texture to sprite ) I am creating a game in which till now I have used textures to create A 2D tiled game.
I have created a matrix which converts the touch co-ordinates into a array index number and according to that index number, a specific tile gets selected. The problem is that I want to emulate the same behaviour for sprites instead of textures. But I get stuck on what could possibly be given as the co-ordinates for the sprite position? I want to just use Sprites instead of using textures as Sprites are easier to animate. No matter which values I give, the screen remains white and sometimes a different tile's texture gets rendered at a different position. What am I doing wrong?

//      Function returns the position of tile touched
int getPos(int screenX, int screenY) {
    x = screenX / (int)xSize;
    y = screenY / (int)ySize;
    y = Squares_Y - 1 - y;
    int result = y * Squares_X + x;
    return result;
}

// Previous Render function
public void render(float delta) {
    batch.begin();
    Tile current=initial_layout;
    if(current.topLink != null)
    {
        for (int Pos=0; Pos<Squares_X; Pos++) {
            for (int ypos=0; ypos<Squares_Y; ypos++) {
                batch.draw(bg_texture, Pos * xSize, ypos * ySize, xSize, ySize);
                if(current!= null)
                {
                    batch.draw(current.getTexture(), Pos * xSize, ypos * ySize, xSize, ySize);
                    current=current.topLink;
                }
            }
        }
    }
    if(Gdx.input.justTouched()){
        if(win == false)
        {
            int x =Gdx.input.getX();
            int y =Gdx.input.getY();
            touchDown(getPos(x, y));
        }
        else{
            System.out.print("\nLevel Completed !! : " + utils.level);
            game.dispose();
        }
    }
    batch.end();
}

// New Render Function
public void render() {
    batch.begin();
    Tile current=initial_layout;
    if(current.topLink != null)
    {
        for (int Pos=0; Pos<Squares_X; Pos++) {
            for (int ypos=0; ypos<Squares_Y; ypos++) {
                batch.draw(bg_texture, Pos * xSize, ypos * ySize, xSize, ySize);
                if(current!= null)
                {
                    spriteBatch.begin();
                    texture = current.getTexture();
                    sprite = new Sprite(texture,(int)xSize,(int)ySize);
                    sprite.setPosition(Pos * xSize, ypos * ySize);
//                  batch.draw(current.getTexture(), Pos * xSize, ypos * ySize, xSize, ySize);
                    sprite.draw(spriteBatch);
                    current=current.topLink;
                    spriteBatch.end();
                }
            }
        }
    }
    if(Gdx.input.justTouched()){
        if(win == false)
        {
            int x =Gdx.input.getX();
            int y =Gdx.input.getY();
            touchDown(getPos(x, y));
        }
        else{
            System.out.print("\nGame WON for Level : "+utils.level);
            game.dispose();
        }
    }
    batch.end();
}

sentences:
Problems with 3D Array for Voxel Data I'm trying to implement a voxel engine in C++ using OpenGL, and I've been working on the rendering of the world. In order to render, I have a 3D array of uint16's that hold that id of the block at the point. I also have a 3D array of uint8's that I am using to store the visibility data for that point, where each bit represents if a face is visible. I have it so the blocks render and all of the proper faces are hidden if needed, but all of the blocks are offset by a power of 2 from where they are stored in the array. So the block at [0][0][0] is rendered at (0, 0, 0), and the block at 11 is rendered at (1, 1, 1), but the block at [2][2][2] is rendered at (4, 4, 4) and the block at [3][3][3] is rendered at (8, 8, 8), and so on and so forth.

This is the result of drawing the above situation:

I'm still a little new to the more advanced concepts of C++, like triple pointers, which I'm using for the 3D array, so I think the error is somewhere in there. This is the code for creating the arrays:

uint16*** _blockData; //Contains a 3D array of uint16s that are the ids of the blocks in the region
uint8*** _visibilityData; //Contains a 3D array of bytes that hold the visibility data for the faces

   //Allocate memory for the world data
_blockData = new uint16**[REGION_DIM];
for (int i = 0; i < REGION_DIM; i++)
{
    _blockData[i] = new uint16*[REGION_DIM];

    for (int j = 0; j < REGION_DIM; j++)
        _blockData[i][j] = new uint16[REGION_DIM];
}

//Allocate memory for the visibility
_visibilityData = new uint8**[REGION_DIM];
for (int i = 0; i < REGION_DIM; i++)
{
    _visibilityData[i] = new uint8*[REGION_DIM];

    for (int j = 0; j < REGION_DIM; j++)
        _visibilityData[i][j] = new uint8[REGION_DIM];
}

Here is the code used to create the block mesh for the region:

//Check if the positive x face is visible, this happens for every face
//Block::VERT_X_POS is just an array of non-transformed cube verts for one face
//These checks are in a triple loop, which goes over every place in the array
if (_visibilityData[x][y][z] & 0x01 > 0)
{
    _vertexData->AddData(&(translateVertices(Block::VERT_X_POS, x, y, z)[0]), sizeof(Block::VERT_X_POS));
}

//This is a seperate method, not in the loop
glm::vec3* translateVertices(const glm::vec3 data[], uint16 x, uint16 y, uint16 z)
{
    glm::vec3* copy = new glm::vec3[6];
    memcpy(&copy, &data, sizeof(data));

    for(int i = 0; i < 6; i++)
        copy[i] += glm::vec3(x, -y, z); //Make +y go down instead

    return copy;
}

I cannot see where the blocks may be getting offset by more than they should be, and certainly not why the offsets are a power of 2. Any help is greatly appreciated. Thanks.

sentences:
android game development dilemma I'm doing a android game project that has a character that can do basic movements like step, turn left, turn right, raise left arm etc. When combining those moves together, the character can do some complicated movements like a dance routine or so.

I'm banging my head to figure out what to do about the graphics. I can do a 3D model with animation then export it to the format of Bones library that displays the character movements. Like shows in this video. I wish to have different characters with different characteristics like height, clothes colour and such. However, that means I have to stock pile more 3D models that have different settings.

Alternatively, I can attempt to code from scratch that have bones system, meshes, skinning, animation. More control and flexibility but the appearance won't be as good as 3D model and it takes alot more afford (as it appears to me). The character will be in 2D if I go down this route. I will use Android OpenGL library for this.

I thought of 2D but then I realize that it's pretty similar to 3D option.

My question is that what can I do here? What else I can do to make the best of this situation?

Edit: thanks for the comments and answer but I have sorted my "dilemma" now. Im using jpct-ae and bones library for my project. The downside is that I need to use a 3D model to make use of those library. They are actually very good and suitable for my need when working with a 3D model. Cheers.

sentences:
Vertex Snapping on a mesh with an armature I've made a selection of modular walls for a game i'm working on and some of the pieces have moving parts, like doors and flaps, but the moving pieces with an armature attached don't use vertex snapping like all of the other pieces and it leaves ugly gaps in the walls.
I've tried everything I can think of to get them lined up, the closest I can get is lining them up by eye and this leaves small gaps when in game and isn't perfect.
Does anyone know of a way to get vertex snapping to work with meshes that have an armature attatched?
I've attached a picture to try and explain:

sentences:
Storing stats for multiple tiers of upgrades on an item I have one script for all my weapons (I have 3 weapons in total) and each of these 3 weapons has 3 different tiers.
I'm currently using a method to set the values, like this:
public void SetTier1Value()
{
    if (weapon1IsActive == true)
    {
        damage = 6
        fireRate = 18
        etc...
    }
    if (weapon2IsActive == true)
    {
        damage = 5
        fireRate = 20
        etc...
    }
    // and like this for the rest of the weapons and tiers
}

All the weapons and all the tiers will have the same variables, the only difference between them are the values of their stats.
I know that the way that I'm doing stuff is over-complicating a lot.
I want to fix so in the future it's easier to add new weapons and the code in general isn't that bad to change.
What I want from this script is to be able to change the values of the weapon easily by code.
What ways can I do this?

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:
Finding the Distance between 2 Objects I have 2 objects One Having a Transformation Matrix T1 and other Having Transformation Matrix T2. And We are having a View Matrix V and Projection Matrix P.
Basically 2 Object are render using this function

Render(vec3 position,X Rotation , Y Rotation, Z Rotation, Scaling);

So i am having 2 different T1 and T2 transformation matrix.

How should i find the distance between these 2 objects ?
Please Explain ?
I have tried by simple formula using position vector but it is giving me incorrect distance ?

sentences:
How do I properly implement zooming in my game? I'm trying to implement a zoom feature but I have a problem. I am zooming in and out a camera with a pinch gesture, I update the camera each time in the render, but my sprites keep their original position and don't change with the zoom in or zoom out.

The Libraries are from libgdx.

What am I missing?

private void zoomIn()
{
    ((OrthographicCamera)this.stage.getCamera()).zoom += .01;
}

public boolean pinch(Vector2 arg0, Vector2 arg1, Vector2 arg2, Vector2 arg3)
{
    // TODO Auto-generated method stub
    zoomIn();
    return false;
}

public void render(float arg0)
{
    this.gl.glClear(GL10.GL_DEPTH_BUFFER_BIT | GL10.GL_COLOR_BUFFER_BIT);
    ((OrthographicCamera)this.stage.getCamera()).update();
    this.stage.draw();
}

public boolean touchDown(int arg0, int arg1, int arg2)
{
    this.stage.toStageCoordinates(arg0, arg1, point);
    Actor actor = this.stage.hit(point.x, point.y);

    if(actor instanceof Group)
    {
        ((LevelSelect)((Group) actor).getActors().get(0)).touched();
    }

    return true;
}

Zoom In

Zoom Out

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

sentences:
How to debug Android App Eclipse? Ok. So while this isnt a programming question. I wanted to know how do people debug apps? How do you view log cat, and where these exceptions are thrown etc? And do I need to run the app on the emulator to see all the stuff, or is there a way to view this after running the app on my phone(while not being connected to the computer)

Links to plugins and tips would be really helpful, as im gonna start work on my next game, and while the first one works fine, had a lot of problems while debugging.

sentences:
Soft Body rendering from OBJ model As part of my master thesis I have to do an softbody simulation.

I 'm using Bullet Physics engine.

I'm trying to render softbody, create from Meshes, with Shaders in OpenGL but the object doesnt seem to be rendered (it doesnt appear in the window).

I'm not sure if the problem is because of the way I created the sobtbody or the way I render it.
Thank you in advance.

I'm using this function for creating a softBody from my OBJ Liver model :

        btScalar* verti = new btScalar[3 * (Liver.getMeshes()[0].vertices.size())];
        for (int i = 0; i < Liver.getMeshes()[0].vertices.size(); i++)
        {
            verti[3 * i] = Liver.getMeshes()[0].vertices[i].Position.x;
            verti[3 * i + 1] = Liver.getMeshes()[0].vertices[i].Position.y;
            verti[3 * i + 2] = Liver.getMeshes()[0].vertices[i].Position.z;
        }

        int* indi = new int[Liver.getMeshes()[0].indices.size()];
        for (int i = 0; i < Liver.getMeshes()[0].indices.size(); i++)
        {
            indi[i] = Liver.getMeshes()[0].indices[i];
        }

        btSoftBody* LiverSBody = btSoftBodyHelpers::CreateFromTriMesh(softBodyWorldInfo, verti,
            &indi[0],
            int(Liver.getMeshes()[0].indices.size()) / 3);

        LiverSBody->m_cfg.kVC = 0.5;
        btSoftBody::Material* pSpMat = LiverSBody->appendMaterial();
        //LiverSBody->m_materials[0]->m_kLST = 0.5;
        pSpMat->m_kLST = 1.0;
        LiverSBody->setPose(false, true);

        btTransform trans;
        trans.setIdentity();
        trans.setOrigin(btVector3(0,0,0));
        LiverSBody->transform(trans);

        LiverSBody->generateBendingConstraints(2, pSpMat);
        LiverSBody->m_cfg.piterations = 2;
        LiverSBody->m_cfg.kDF = 1.0;
        LiverSBody->m_cfg.kSRHR_CL = 1;
        LiverSBody->m_cfg.kSR_SPLT_CL = 0;

        LiverSBody->setTotalMass(10, true);
        LiverSBody->scale(btVector3(0.02, 0.02, 0.02));
        LiverSBody->getCollisionShape()->setMargin(0.1);

        float Friction = 0.9;
        float Restitution = 0.5;

        LiverSBody->setFriction(Friction);
        LiverSBody->setRestitution(Restitution);

        m_pSoftBodyWorld->addSoftBody(LiverSBody);

I'm using this class for loading and visualizing model https://learnopengl.com/code_viewer_gh.php?code=includes/learnopengl/model.h
I need to extract from the softBody some data (Position, normal, texCoords, tangent and bitangent) to fill the vertex buffer objects but i don't know where to find most of it... I know that the position and the normals are in the softbody nodes but i can't find the other information needed (texCoords, ..).

//btSoftbody.h
struct Node : Feature
    {
        btVector3 m_x;       // Position
        btVector3 m_q;       // Previous step position
        btVector3 m_v;       // Velocity
        btVector3 m_f;       // Force accumulator
        btVector3 m_n;       // Normal
        btScalar m_im;       // 1/mass
        btScalar m_area;     // Area
        btDbvtNode* m_leaf;  // Leaf data
        int m_battach : 1;   // Attached
    };

sentences:
Elegantly simulating NPC movement in inactive areas My AI is utility-driven in a similar pattern to The Sims, where all unique behavior is coded into interactable objects, and the only thing an NPC does is decide which object they wish to use, path to it, and activate it. This is deceptively powerful, as I can extend nearly any desired behavior by creating a novel object and shaping constraints leading to its selection.

The challenge I'm having with this approach is giving the illusion that NPCs are moving around when the player isn't nearby. The game runs a 24/7 clock and seeks to have each NPC go through the motions of maintaining a regular schedule: going to work, going to bed, and randomly doing weird things in their free time to preserve the illusion of unpredictability. This is implemented with a dict(float time, Appointment appointment), which acts as a global behavior queue and is called every time the in-game clock changes to teleport each AI who has an appointment to use an object to that object's position. This works well enough for prototyping other systems, but it isn't very convincing: you never see NPCs moving through the world, and when you're familiar with a few specific characters it becomes very obvious that they're teleporting around when you can't see them.

Is there a better way to simulate movement around a world with a large number of NPCs, or am I better off keeping my current queue-oriented behavior system and writing an entirely different system to fake movement? My optimal endpoint would be a system that can order NPCs to be at any location, at any time, and trust them to move there in a convincing way, but I worry I'm putting too much detail into a simulation that could fake the same behavior more convincingly with a simpler solution.

sentences:
How to design a turn-based game which is easy for humans but difficult for AI? Until recently, Go used to be of the last bastions of turn-based no information-hiding games where world-class human players could not be defeated by computers. But now this bastion has fallen, as the program AlphaGo managed to beat one of the world top players.

However, Go was never designed as a game which is hard for AI. It was developed thousands of years ago. Being hard for computers was an unintentional side-effect of the game design, not a stated design goal.

What game mechanics make a turn-based strategy game without information hiding hard for AI, yet still playable for humans?

In case someone wonders "Why is this question also relevant for video game developers"?

because it shows us how to design competitive multiplayer games where players can not cheat by using an AI assistant.
For single player games it shows us what to avoid when we plan to add an AI opponent later.

sentences:
How to design an AssetManager? What is the best approach to designing an AssestManager that will hold references to graphics, sounds, etc. of a game?

Should these assets be stored in a key/value Map pair?  I.e. I ask for "background" asset and the Map returns the associated bitmap?  Is there an even better way?

Specifically I'm writing an Android/Java game, but answers can be generic.

sentences:
Reading from depth textures always returns 1 I create a packed depth/stencil texture and attach it to a framebuffer like this:

glGenTextures(1,&_depthStencilTexture);
glBindTexture(GL_TEXTURE_2D,_depthStencilTexture);
//set filtering to gl_nearest, not shown cause not important
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH24_STENCIL8,width,height,0,GL_DEPTH_STENCIL,GL_UNSIGNED_INT_24_8,nullptr);

//... create framebuffer and attach some color attachments
glFramebufferTexture(GL_FRAMEBUFFER,GL_DEPTH_STENCIL_ATTACHMENT,_depthStencilTexture,0);

The creation of the framebuffer causes no OpenGL status errors.

In terms of usage for depth and stencil testing, the texture/attachment seems to work correctly. If I disable depth testing, I get the usual artifacts of objects in the back being drawn over objects in the front if they are drawn in the wrong order. If I disable stencil testing, the effects I'm using related to that don't work anymore (I'm masking out areas that shouldn't be lit by the lighting pass). Also, if I simply don't attach the depth/stencil buffer to the framebuffer, the related tests stop working (as expected).

However, reading from that texture in a shader always returns 1 if I read the depth part, and 0 if I read from the stencil part.

I confirmed this via glReadBuffer(GL_DEPTH_STENCIL_ATTACHMENT) and glReadPixels. All integers read show up as 0xffffff00, directly after clearing them via glClear and a black clearcolor and also after the screen is drawn full of stuff.

Drawing to and reading from the rest of the attached textures (four color buffers for now) works fine.

I have to note that I'm not actually manually drawing anything to the depth-stencil attachment in the fragment shader when rendering - I'm assuming OpenGL automatically draws depth and stencil values to the correct buffer.

What could be the cause of these incorrect values showing up when reading from the texture?

sentences:
Frame timing for GLFW versus GLUT I need a library which ensures me that the timing between frames are more constant as possible during an experiment of visual psychophics.

This is usually done synchronizing the refresh rate of the screen with the main loop.

For example if my monitor runs at 60Hz I would like to specify that frequency to my framework.

For example if my gameloop is the following

void gameloop()
{

// do some computation

printDeltaT();
Flip buffers
}

I would like to have printed a constant time interval. Is it possible with GLFW?

sentences:
What advantages does bare OpenGL provide over frameworks/engines to small developers? I've noticed a trend of indie developers steering away from frameworks and engines, and moving towards using bare OpenGL, or using it combined with SDL/SFML2. As an indie developer, I can't see what low-level OpenGL can offer over separate engines or frameworks.

Most decent engines and frameworks give the functionality that you need, and never get in your way. They might also open the option to deal with OpenGL directly. Some even offer the functionality to compile cross-platform!

I understand the aspiration to learn what is happening below the hood, but I can't see any upsides that OpenGL might offer to indie developers over engines or frameworks.

Could you explain the reasoning behind building games from scratch using OpenGL?

sentences:
How do you make game objects (enemies, NPCs) move in interesting, non-linear ways? (e.g. shoot 'em up enemies) I'm using a series of easing equations to make menus and transitions a little more interesting in my first game. That got me thinking about how game objects (enemies, NPCs, spaceships, whatever) are 'scripted' to move along complex paths. I'm no maths guy, but I've read that paths can be plotted using Bezier curves (define 2+ control points, interpolate to get position values using start, change and duration values). However I'm not exactly sure how to best go about this (in a structured way that works for a variety of different motions).

I already have a bunch of tweening functions, but these are relatively simple linear, quadratic and cubic curves.

An example - say I wanted enemies to appear at a certain point, then spin in an archimedes spiral until they were off-screen. How would this be best accomplished, and indeed, made generic enough so that another enemy of the same type could move along a sin wave-esque path instead?

sentences:
UnityWebRequest security I have a game where I would like to register users and post the outcome of matches between two users through web requests in Unity but have some security questions regarding UnityWebRequest.
Assume the following code for sending a web request:
public class TestHTTP : MonoBehaviour
{
    [SerializeField]
    private bool sendRequest = false;
    // Update is called once per frame
    void Update()
    {
        if (sendRequest)
        {
            Model testModel = new Model();
            testModel.ID = "0001";
            testModel.name = "Random_Name";
            testModel.int1 = 555;
            StartCoroutine(SendWebRequest(testModel));
            sendRequest = false;
        }
    }
    public IEnumerator SendWebRequest(Model m)
    {
        string json = JsonUtility.ToJson(m);
        //string text = JsonUtility.ToJson(SimpleAESEncryption.Encrypt(json, "some_password"));
        using (UnityWebRequest request = UnityWebRequest.Post($"some_https", json))
        {
            request.method = UnityWebRequest.kHttpVerbPOST;
            request.SetRequestHeader("Content-Type", "application/json");
            yield return request.SendWebRequest();
            if (request.isNetworkError)
            {
                Debug.Log("NETWORK ERROR:::" + request.error);
            }
            else if (request.isHttpError)
            {
                Debug.Log("HTTP ERROR:::" + request.error);
            }
            else
            {
                string returnData = request.downloadHandler.text;
            }
        };
    }
}

After doing a bit of testing I noted that sending via http would give a plain text body, which was remedied by switching to a https target. Is this enough of a level of encryption or should I add a layer of encryption for the model prior to sending?
Lets assume my model contains data regarding the outcome of a match between two players. Would https (TLS 1.2) be enough to stop someone resending the same request/packet to inflate their number of wins for example? Or should additional measures be taken to stop this?

sentences:
problems programmatically creating UIView on iPad App I have been struggling with this problem for a few days.

My iPad app is designed to be a portrait game. To satisfy Apple's expection, I also support landscape mode. When it goes into landscape mode, the game goes into a letterbox format with back borders on the sides.

My problem is I am creating the UIWindow and UIView programmatically. For some unkown reason, the touch controls are "locked" in to think I'm always in landscape mode. And even though visually in portrait mode everything looks correct, the top and bottom of the screen does not respond to touch.

To summarize how I am setting this up, let me provide the skeletal framework of what I'm doing:

in main.cpp:

int retVal = UIApplicationMain(argc, argv, nil, @"derbyPoker_ipadAppDelegate");

In the delegate, I am doing this:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
 CGRect screenBounds = [[UIScreen mainScreen] bounds];
 CGFloat scale = [[ UIScreen mainScreen] scale ];

 m_device_width = screenBounds.size.width;
 m_device_height = screenBounds.size.height;
 m_device_scale = scale;        // Everything is built assuming 640x960

 window = [[ UIWindow alloc ] initWithFrame:[[UIScreen mainScreen] bounds]];
 viewController = [ glView new ];
 [self doStateChange:[blitz class]];

 return YES;
}

The last bit of code sets up the UIView...

      - (void) doStateChange: (Class) state{
 viewController.view = [[state alloc] initWithFrame:CGRectMake(0, 0, m_device_width, m_device_height) andManager:self];
 viewController.view.contentMode = UIViewContentModeScaleAspectFit;
 viewController.view.autoresizesSubviews = YES;
 [window addSubview:viewController.view];
    [window makeKeyAndVisible];
}

The problem seems to related to the line viewController.view.contentMode = UIViewContentModeScaleAspectFit;

If I remove that line, touch works correctly in portrait mode. But the negative is when I'm landscape mode, the game stretches incorrectly. So That's not a option.

The frustrating thing is, when I originally had this set up with a NIB file, it worked fine. I have read through the docs about UIWindow, UIViewController and UIView and have tried about everything to no avail.

Any help would be greatly appreciated.

sentences:
Unity display message upon keypress? Hi I'm trying to get NGUI's HUDtext to display a set of text message one of which being "Try using WASD to move" and displaying "Well done!" upon input of any of the four keys. Unfortunately I'm not well versed in C# and am currently stuck and unsure how to implement this.

using UnityEngine;
using System.Collections;
using System;

//public KeyCode KeyCode.Alpha2;

public class Test : MonoBehaviour {

    public int seen = 123;
    public HUDText hudText;

    void Start() {

        StartCoroutine(MyCoroutine());
        //Debug.Log(KeyCode);
        Tutorial ();

    }

    void Tutorial() {

        while (true) {
            while (!Input.GetKeyDown(KeyCode.Return)) Debug.Log ("Hit return");
        }

    }

    IEnumerator MyCoroutine() {

        hudText.Add("Welcome", Color.white, 3f);
        yield return new WaitForSeconds(3);    //Wait one frame

        hudText.Add("This is System Defence", Color.white, 4f);
        yield return new WaitForSeconds(4);

        hudText.Add ("Try using WASD to move", Color.red, 3f);
        yield return new WaitForSeconds(3);

    }

}

I would appreciate it if someone could tell me how would I go about doing this.

sentences:
Finding texture coordinates for plane I am creating a 3D ray tracer and want to add textured planes.

My planes are stored using a position vector and a normal vector.

I want to use a square texture and map it repetitively onto the plane.

How do I figure out a transformation from points (3D vectors) on the plane and points (2D vectors) on a texture? Once I know how to do this transformation, I don't think making it repetitive will be hard, as we can just apply modulo arithmetic.

I thought I could make a basis on the plane by calculating a vector B1 perpendicular to the normal, and then another one, B2, perpendicular to the normal and B1. But once I have these two vectors, I still don't know how to express the point (which is the argument for the function below) in this basis.

Vector3 position, normal;
Bitmap texture;

public override Vector3 GetColor(Vector3 point) {
    int u = ?
    int v = ?

    return texture.GetPixel(u, v);
}

sentences:
Simulating Gas Density and Pressure in a 2D World I'm building a small spaceship simulation app that looks a lot like a game for an upcoming talk I'm giving where I use this sample app to teach the F# programming language.

This small app is something like FTL meets Oxygen Not Included where you have a top-down 2D grid of tiles (similar to an old RPG) where each tile has its own mixture of gasses - right now oxygen and carbon dioxide, but potentially others.

I've got a few things I'm trying to simulate:

When new gasses are added to a tile by something like a vent or a life support system, that gas should expand to neighboring tiles if possible
When a pressure changes (e.g. opening a door to another area of the ship or a hull breach), air should flow from the high pressure tile to the low pressure tile next to it.

Given this, and given that some gasses naturally sift to the top of others, I'm trying to figure out a small set of simple rules to govern this behavior.

Previously I had all gasses equalizing with their neighbors and no concept of pressure, but that made it very difficult to treat scenarios like hull ruptures, so I'm looking for something a bit more realistic without getting complex or hyper-accurate.

For example, given tile A with 15g oxygen and 6g CO2 and neighboring tile B of 3g oxygen and 1g CO2, some air should clearly flow from A to B. However, what flows? Is it the lightest gasses? The heaviest gasses? A random or representative sampling of gasses in A? Are there any relevant physics principles I should be aware of?

Note: I posted here instead of in physics because I don't care extremely about nuanced accuracy, just something simple and believable

sentences: How can I change the default New Project directory in Godot Engine? When I go to create a new project in Godot Engine (version 3.2) my Project Path is always the original default directory, no matter what path I last used. There doesn't appear to be any configuration inside the Project List window. How can I change the default project path for new projects?

sentences:
How to implement object velocity as a vector I'm working on a Breakout game, and want to change the ball's movement code from how I currently do it, to something based on vectors (as I feel learning and implementing movement based on vectors will help me in the long run).

Currently I am doing something like this (Pseudocode):

if(ball.Y < HEIGHT)
    ball.Y += 1; // I actually save a direction as well,
                 //and multiply this by the direction (1 or -1)
else
    ball.Y -= 1;

if(ball.X < WIDTH)
    ball.X += 1;
else
    ball.X -=1;

Anyway, you get the gist of it. My current code is actually much more verbose, but handles collisions well. Basically I am just using screen coordinates, and I find that this is probably not the best way to be doing this.

How would you implement a more correct, extensible (to other projects), way to move objects?

EDIT:
I am not looking to use a 2D Vector library; more-so I am looking for an explanation of how vectors are used for movement in games, and how I can implement them myself.

sentences: Ray tracing and Z buffering in graphics I am a high school student taking computer science as a subject, and someone who is very interested in the game development industry. I am currently writing an essay on Raytracing and Z-buffering by comparing them and deducing the right situation for each of them. I was wondering if the developers could help me answer a question of in what specific situations those two are used specifically. I already know how both of them work. Also, do developers prefer another method than these two or is there a way to combine both to make an even more efficient 3D graphics algorithm? Thanks a lot!

sentences:
Efficient modification of Texture2D at runtime for a 2D painting game in Unity3D I have spent some time looking for different solutions to be implemented in a mobile painting game I'm creating.  At this time, everything is working but I have some serious performance problems on large screens and slow devices because I massively use setPixel / setPixels and apply on Texture2D.

I have come across 2 ways to speed things up:

1) Tile the image in small chunks, every chunk would be a Texture2D, and just upload (calling Texture2D.Apply()) the modified chunks.

2) Another trick I could apply on top of the tiling solution is to catch changes in an array and write them down to the needed Texture2D chunk and apply it every X miliseconds if modified.

I would like to know what other optimizations I could apply to this subject.  Perhaps I should throw setPixel away and go with another more efficient way?

Cheers.

sentences:
OpenGL ES - read content of VBO Is it possible to read back content of VBO in OpenGL ES 2.0 ?
I have tried glMapBufferOES, but there is no READ flag.

I dont want any answers, like "you shouldnt do it" or "keep copy of geometry in ram".

sentences: Are there any video tutorials available for game programming with Max? Are there any videos on how to make a small game using Max? I mean is it only done in Max or are there other things used? I am a newbie in game programming.

sentences: What are the document grid settings in inkscape for making an isometric tilemap for tiled? I am using inkscape to create a isometric tilemap.  What settings do I need on the grid in document properties in inkscape to make it match up to a 64 x 32 grid in tiled?

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:
Gradle Build Error Unity 2019.1.6 I found out that unity has deprecated the internal build system and has defaulted to gradle. I've not built with the gradle build system before, and now after upgrading to unity 2019.1 full version, I can't build an android project.
And, I installed the android module using unity hub, what can I do to fix this?
Screenshot1
Screenshot2
Screenshot3
Screenshot4
Screenshot5
Screenshot6

sentences:
Procedural terrains in 3D: what has been done ? Are there common algo and/or theories about it? Besides programming, modeling an environment takes a great deal of time.

I don't know about the work time involved, for example, in a WoW dungeon level, or other beautiful city-like, future environment, jungles, fantasy, etc, but this kind of work is made from scratch by artists.

What are the techniques involved in the TorchLight level randomizer, and does other titles have similarities with this ? Is there a family name for such techniques ?

sentences:
How to check audio quality after changing import settings I have changed the quality of an audio clip from 100 to 10 in the import settings. But when I played the clip from the inspector, I didn't hear any noticeable difference

The compression format of the audio clip is set to 'Vorbis'

So I wonder if it's the original file or the compressed file that is being played by the Unity Editor?

sentences:
Instantiation of a custom class I have a custom class named Stars:

class Star
{
    public int primaryID;
    public string properName;
    public string HIPID;
    public string HDID;
    public string HRID;
    public string GLID;
    public string BFID;
    public decimal rightAscension;
    public decimal declination;
    public string magnitude;
    public string colourIndex;
    public int scale;
    public int red;
    public int green;
    public int blue;
    public bool isSimulated;
    public double x;
    public double y;
    public double z;

    public void setDetails(int primaryID, string properName, string HIPID, string HDID, string HRID, string GLID, string BFID, decimal rightAscension, decimal declination, string magnitude, string colourIndex)
    {
        this.primaryID = primaryID;
        this.properName = properName;
        this.HIPID = HIPID;
        this.HDID = HDID;
        this.HRID = HRID;
        this.GLID = GLID;
        this.BFID = BFID;
        this.rightAscension = rightAscension;
        this.declination = declination;
        this.magnitude = magnitude;
        this.colourIndex = colourIndex;
        decimal deg2rad = 0.01745329251994329576923690768489m;

        this.isSimulated = true;

        // Decimal datatype is used to make sure that values are very accurate and precise
        decimal degrees_ra;
        decimal degrees_dec;
        decimal radians_ra;
        decimal radians_dec;

        degrees_ra = Decimal.Multiply(rightAscension, 15);
        degrees_dec = declination;

        radians_ra = Decimal.Multiply(degrees_ra, deg2rad);
        radians_dec = Decimal.Multiply(degrees_dec, deg2rad);

        // Converted from decimal to double because the Math library cannot work with decimals
        float distanceStars = 19113;

        this.x = (distanceStars * Math.Cos(decimal.ToDouble(radians_dec)) * Math.Cos(decimal.ToDouble(radians_ra)));
        this.y = (distanceStars * Math.Cos(decimal.ToDouble(radians_dec)) * Math.Sin(decimal.ToDouble(radians_ra)));
        this.z = (distanceStars * Math.Sin(decimal.ToDouble(radians_dec)));
    }

    public Vector3 getVector()
    {
        return new Vector3((float)z, (float)y, (float)x);
    }
}

There are many of these stars and I want to instantiate them at run-time:

void plotStars()
{
    int i = 0;
    while (i < (StarDataBank.Instance.NumOfStars))
    {
        string name = StarDataBank.Instance.StarName[i];
        string HIP = StarDataBank.Instance.StarIDHIP[i];
        string HD = StarDataBank.Instance.StarIDHD[i];
        string HR = StarDataBank.Instance.StarIDHR[i];
        string GL = StarDataBank.Instance.StarIDGL[i];
        string BF = StarDataBank.Instance.StarIDBF[i];
        decimal RA = Convert.ToDecimal(StarDataBank.Instance.StarRA[i]);
        decimal Dec = Convert.ToDecimal(StarDataBank.Instance.StarDec[i]);
        string Mag = StarDataBank.Instance.StarMag[i];
        string ColI = StarDataBank.Instance.StarCI[i];

        var star = new Star();
        star = Instantiate(ObjectStar, transform.position + star.getVector(), Quaternion.identity);

        star.transform.parent = StarObject.transform;
        star.transform.localScale = new Vector3(star.scale, star.scale, star.scale);
        i++;
    }
}

But I am experiencing a lot of errors.

Unity isn't instantiating the Stars because it can't convert UnityEngine.Transform to Star
Star doesn't contain definition of Transform

Is there a way to assign a class as a gameobject?

sentences:
Implementing proportional navigation in 3D Good afternoon guys,

a = N * λ' * V

is the formula for the commanded acceleration required to hit the target,
where N is the proportionality constant, λ' is the change in line of sight and V is the closing velocity.

Data I natively have:

[x,y,z] position of both missile and target;
[vx,vy,vz] velocity vector of both missile and target;
[x,y,z] vector which points from missile to target and opposite;
This is set by me but still: maximum speed of missile.

Data I can get with some calculations:

Vertical angle between missile and target (and opposite)  ;
Horizontal angle between missile and target (and the other way around).

That's the reference system of the game:

λ' or the derivative with respect to time of the Line of Sight it's a concept I really didn't understand...  its unit should be, in theory, Hz or (s^-1) since m/s^2 = λ' * m/s -> λ' = 1/s
V should be pretty easy to calculate: V = v(missile) - v(target) OR
Vx = (v(missile) - v(target)) * cos (x0y)
Vy = (v(missile) - v(target)) * sin (y0z)
Vz = (v(missile) - v(target)) * cos (y0z)
N well it's a scalar number, usually 3.

The computed acceleration will then be passed to a RK4 integrator which will move the interceptor towards its target.
To steer the missile, I will simply change its velocity vector at every update (every 1/60th of a second) and its orientation accordingly. For example: if the missile has a velocity of [0,100,0], he's going 100 m/s due y+ axis. If at the next frame it should slightly turn right, then he'll be going to have a velocity of [10,99,0] and so on.

That's the only thing left to finish off my little thesis and unfortunately I'm stuck here. In the meantime,  thank you very much!

Here's a video I made, but it doesn't still actually use the Proportional Navigation law: it checks if the missile is "aligned" to its target and eventually correct its route.
That's my actual code: pastebin

That's what i've come up with but sadly doesn't work as expected:

params ["_n","_missile","_target"];
private "_a";

_vm = velocity _missile;
_rm = getPosASLVisual _missile;

_vt = velocity _target;
_rt = getPosASLVisual _target;

_vr = _vt vectorDiff _vm;
_r = _rt vectorDiff _rm;

_omega = (_r vectorCrossProduct _vr) vectorMultiply (1/(_r vectorDotProduct _r));

_a = (_vr vectorCrossProduct _omega) vectorMultiply _n;

_a

Similar questions:
Finding the components of Proportional Navigation in 2D

sentences:
How can I skew my XNA sprites? I would like to make a 2D tile based game, but, to make it look a bit prettier, I would need to skew textures so that it would look more like a 2.5D game.
So I thought maybe I should skew textures to something like this:

So far I only found one topic about it - http://forums.create.msdn.com/forums/p/37143/215098.aspx#215098

But I don't really understand it. Maybe some of you do, can tell me how to skew my sprites?

sentences:
Remove previous scenes from memory in Unity 3d I'm making a game in unity3d which I optimized as much as I can.

I've made different levels in each scene.

After a few scenes the game starts to lag on mobile devices. And works smoothly if application is restarted and game is continued from last scene .

How can I clear previously loaded scene in Unity3d or overcome the problem I mentioned above ?

sentences:
GL_TEXTURE_MAX_LEVEL equivalent on DirectX I'm trying to mix atlas and mipmapping for a kind of Minecraft editor I'm doing. Everything looks good until I reach the smaller mipmaps of the atlas texture, where obviously all the textures are mixed into one, looking horrible at the distance.

With OpenGL I'd use glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, n); to avoid this problem, but I'm unable to find the DirectX equivalent. Is it possible to do this in DirectX?

Thanks in advance

sentences:
How do I implement a quaternion based camera? UPDATE The error here was a pretty simple one. I have missed a radian to degrees conversion. No need to read the whole thing if you have some other problem.

I looked at several tutorials about this and when I thought I understood I tried to implement a quaternion based camera. The problem is it doesn't work correctly, after rotating for approx. 10 degrees it jumps back to -10 degrees. I have no idea what's wrong. I'm using openTK and it already has a quaternion class. I'm a noob at opengl, I'm doing this just for fun, and don't really understand quaternions, so probably I'm doing something stupid here. Here is some code: (Actually almost all the code except the methods that load and draw a vbo (it is taken from an OpenTK sample that demonstrates vbo-s))

I load a cube into a vbo and initialize the quaternion for the camera

protected override void OnLoad(EventArgs e) {
    base.OnLoad(e);

    cameraPos = new Vector3(0, 0, 7);
    cameraRot = Quaternion.FromAxisAngle(new Vector3(0,0,-1), 0);

    GL.ClearColor(System.Drawing.Color.MidnightBlue);
    GL.Enable(EnableCap.DepthTest);

    vbo = LoadVBO(CubeVertices, CubeElements);
}

I load a perspective projection here. This is loaded at the beginning and every time I resize the window.

protected override void OnResize(EventArgs e) {
    base.OnResize(e);

    GL.Viewport(0, 0, Width, Height);

    float aspect_ratio = Width / (float)Height;

    Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspect_ratio, 1, 64);
    GL.MatrixMode(MatrixMode.Projection);
    GL.LoadMatrix(ref perpective);
}

Here I get the last rotation value and create a new quaternion that represents only the last rotation and multiply it with the camera quaternion. After this I transform this into axis-angle so that opengl can use it. (This is how I understood it from several online quaternion tutorials)

protected override void OnRenderFrame(FrameEventArgs e) {
    base.OnRenderFrame(e);

    GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

    double speed = 1;
    double rx = 0, ry = 0;

    if (Keyboard[Key.A]) {
        ry = -speed * e.Time;
    }

    if (Keyboard[Key.D]) {
        ry = +speed * e.Time;
    }

    if (Keyboard[Key.W]) {
        rx = +speed * e.Time;
    }

    if (Keyboard[Key.S]) {
        rx = -speed * e.Time;
    }

    Quaternion tmpQuat = Quaternion.FromAxisAngle(new Vector3(0,1,0), (float)ry);
    cameraRot = tmpQuat * cameraRot;
    cameraRot.Normalize();

    GL.MatrixMode(MatrixMode.Modelview);
    GL.LoadIdentity();

    Vector3 axis;
    float angle;

    cameraRot.ToAxisAngle(out axis, out angle);
    //////////////////////////////////////////////////////////////////////
    // THIS IS WHAT I DID WRONG: I NEED TO CONVERT FROM RADIANS TO DEGREES
    //////////////////////////////////////////////////////////////////////
    //BEFORE
    //GL.Rotate(angle, axis);
    //AFTER
    GL.Rotate(angle * (float)180.0/(float)Math.PI, axis);
    GL.Translate(-cameraPos);

    Draw(vbo);
    SwapBuffers();
}

Here are 2 images to explain better:
I rotate a while and from this:

it jumps into this

Any help is appreciated.

Update1: I add these to a streamwriter that writes into a file:

    sw.WriteLine("camerarot: X:{0} Y:{1} Z:{2} W:{3} L:{4}", cameraRot.X, cameraRot.Y, cameraRot.Z, cameraRot.W, cameraRot.Length);
    sw.WriteLine("ry: {0}", ry);

The log is available here: http://www.pasteall.org/26133/text. At line 770 the cube jumps from right to left, when camerarot.Y changes signs. I don't know if this is normal.

Update2 Here is the complete project.

sentences:
OpenGL Fragment Shader Interpolation Vs Inverse Calculation I have found openGL fragment shader tutorials on the web, some that use use inverse calculations to revert the fragment coordinate back to the world space and others that interpolate the position.  With that said...

Is there a difference between interpolated world-space position and the actual world space position calculated using inverse matrices and the fragment window space coordinates?
Does anyone know of any resources that would help me understand the mathematical differences between these two things, if they are different?
If they aren't different, then why would anyone use inverse matrices instead of interpolating, which seems less expensive?

I wrote a shader to test 1, but I cannot tell if rounding errors are to blame for the differences or not.

Thanks!

sentences:
How to solve conflicting OnValidate() functions I have two OnValidate() functions in two scripts, one attached to the Enemy (EnemyScript) game object and the other to the Enemies(EnemiesScript) game object.

In OnValidate() in EnemyScript I have the following:

    void PrepareEnemyType(EnemyType enType) {

    // by default hasHibernated = false
    if (!hasHibernated) {
        if (enType == EnemyType.Green) {
            gameObject.GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Sprites/greenEnemy");

        }
        else if (enType == EnemyType.Red) {
            gameObject.GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Sprites/redEnemy");

        }
    }

    else if (hasHibernated) {
            gameObject.GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Sprites/greyEnemy");

    }
}

In OnValidate() in EnemiesScript I have the following:

for (int i = 0; i < enemies.Length; i++) {
        if (!enemies [i]. hasHibernated) {
            enemies[i]. hasHibernated = true;

        }
    }

based on the above all the enemies should change sprite to greyEnemy sprite, but that doesn't happen. Before I run the application all of them change to greyEnemy sprite initially, then after I run the application some of them change back to their original sprites, and when I stop running the application they sprites remain the same as when the application was running (different sprites). At this point, the only time that they all become grey again is when I make some other edit to either one of the scripts and save it. Then the above transition repeats.
I suspect there could be some conflict with the two OnValidate() functions, not certain though. How can I resolve this?

sentences:
3D sphere generation I have found a 3D sphere in a closed-source game engine that I really like the look of and would like to have something similar in my own 3D engine.

This is how the sphere looks like when it is created in the game engine, at program/game start:

At program start, a function named CreateSphere is called and the user has the option to choose a 3D position and a radius of the sphere. That's all I know about the function since the engine is closed source.

Anyone have any idea of how this sphere might be generated programmatically?
I have checked other posts/sites discussing spheres but none of them has the look of the sphere in the image.

Edit: removed some unnecessary information to get to the point of what I need help with.

sentences:
Game Either Runs Poorly or at Different Speeds I'm making a simple 2D shooter game using C++ and SDL2. For my main game loop, I used the code from the famous Fix Your Timestep article. The problem is that, because I'm using a fixed delta time, the game's objects move at different speeds depending on the hardware of the computer it is being played on. On more powerful PCs, the game runs very fast, and on weaker PCs, it runs slowly.

I was able to get around this problem by removing the if (frameTime > .25) { frameTime = .25; } statement, however this caused, paradoxically, the game to run poorly on computers with more powerful CPUs. I'm not limiting the FPS, and so when I run the game on a powerful PC, it starts off running at around 1500 FPS, but then the FPS quickly drops to unplayable levels, all while using up a significant percentage of the CPU power. On weaker PCs, however, the game runs just fine.

My question is, how do I balance these two issues so that the game runs at an acceptable framerate, while also making sure that the game objects move at the same speed, regardless of the hardware it is being played on? The game runs at a low resolution and uses very simple graphics, so it should be able to run smoothly even on weak PCs.

sentences:
What are good ways to find collaborators for a coding weekend? Not sure if this belongs here, feel free to push it somewhere else if needed.

When i was at university we would sometimes come together into a room full of beer and fast food and crank out software in a weekend. Unfortunately the group has kind of split up and its just not possible any more.

My question is now: Where can i find like-minded people on the Internet that would like to do something like this? I have an idea what i wanted to do next, but of course other people have ideas too.

sentences:
How do multiple render targets get rendered onto the back buffer(s) then screen? I'm using DX11. I understand how render targets are created, set, and why they are used, but I am really unsure how this all plays together with presenting it to the screen.

Does the GPU automatically flatten all render targets onto the back buffer, and how does this work with multiple back buffers?

If I were to have multiple render-targets for deferred rendering, or some customized post processing shader (using a ping-pong model) how do multiple render targets get presented accordingly?  I assume I have to set the final render-target used to be presented to the screen. But I am not sure.

sentences:
Pac-Man - Public Domain? I've googled this and haven't come up with anything. Can I create a Pac-Man game and not get in trouble with?

Like can I sell it, and be able to make money without having to pay someone else royalties?

sentences:
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:
How do I center a sky sphere on the camera? I'm trying to render a sky using D3D 11. What I have seen in tutorials so far uses cube mapping, which I don't want to use. I want to create a sphere, texture it, and center that sphere on the camera, but I don't know how to do the last part.

How do I center it around the camera?

sentences:
How do I provide a fully programmable pipeline for rendering? I am writing a game engine and I want people who use it allow to define the rendering pipeline. Just they can define the scene geometry, characters, items, light sources, and so on. So the term programmable pipeline doesn't refer to using custom shaders in OpenGL, which is the case anyway.

To provide a programmable pipeline, I want to abstract the OpenGL level so that people who use the engine don't directly have to struggle with framebuffers, render targets, and so on. The definition of the pipeline have to be done in scripting. The engine will then load the definition and create the framebuffers, render tagets and so on at initialization time.

Are the already approaches to this kind of a programmable pipeline in game engines? How can I let the people who use the engine define the pipeline on a sensible abstraction level? I do not want them to create all their render targets on their own. It would be better to just define connections beweent passes and the shaders which should be used.

Another problem is to connect geometry and lights with the pipeline if it is customizable. How can I approach this challenging goal? Every idea, as answer or comment, is appreciated.

sentences:
How do you avoid lag with Three.js and mousemove? I'm trying to create a browser moba-like game using three.js. I'm using WASD for movement and the player rotation follows the mouse with mousemove then lookAt() the intersection.

The problem:

As I start to move the mouse rapidly and doing other stuff like movement or shooting the game starts to lag and slow noticeably.

How can I increase performance of the game, should I create a worker thread for the raycasting, use other movement technique (e.g. right click to move). What is your recommendation?

var mouseCallback = function(e){
  if(e.clientX >= renderer.domElement.clientWidth-2){
    mouse.x = 1;
  } else {
    mouse.x = ( e.clientX / renderer.domElement.clientWidth ) * 2 - 1;
  }
  if(e.clientY >=  renderer.domElement.clientHeight-2){
    mouse.y = -1;
  } else {
    mouse.y = - ( e.clientY / renderer.domElement.clientHeight ) * 2 + 1;
  }
  if(player){
    raycaster.setFromCamera( mouse, camera );
    var intersects = raycaster.intersectObject( terain );
    var direction;

    for(var i = 0; i< intersects.length;i++){
      direction = intersects[0].point;
    }

    if(direction){
      var focalPoint =
        new THREE.Vector3(
            direction.x,
            player.position.y,
            direction.z
            );
      player.lookAt(focalPoint);
    }
  }
}

sentences:
How can I calculate the penetration depth between two colliding 3D AABBs? I'm currently working on implementing a very basic collision system in my game at the moment that only uses 3D AABBs. My AABB struct currently looks like this at the moment.

/// <summary>
/// This struct represents a 3-dimensional bounding box that is aligned
/// to the three world axes.
/// </summary>
public struct AxisAlignedBB
{
    public Vector3 Position { get; set; }
    public Vector3 HalfScale { get; set; }

    /// <summary>
    /// Constructor for the AxisAlignedBB struct.
    /// </summary>
    /// <param name="position">The position of the AABB.</param>
    /// <param name="halfScale">The half scale of the AABB.</param>
    public AxisAlignedBB(Vector3 position, Vector3 halfScale)
    {
        this.Position = position;
        this.HalfScale = halfScale;
    }
}

I'm stuck on how the penetration depth between two different colliding AABBs with the AABB format I've laid out in the struct above is calculated. I've spent hours trying to come up with and look for a solution to this but I just can't seem to find anything.

sentences: Play Protect Submission I just filled submission form for google play protect for my new-developed game. the problem is with URL download link. I used file.io to generate a direct download link. it worked fine for the first time but now error 404 for "not found" is shown. I re-submit a new form with same information but different URL to download my APK (I used DropBox to generate direct link and bit.ly for shortening the link) but google told me via email that it doesn't need to re-submit. I know that the the process for accepting my game could last for 7-10 days. what do you suggest?

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:
How can I draw image and label on another image The idea is to make a shop structure like in Arrow game from KetchApp.

As I think I need to create ShopCell class, add objects of this class to Table, then add this Table to ScrollPane(so I can scroll my shop). But not really sure how to implement this.

The main problem for me is to create ShopCell class. It seems reasonable to start this way:

public class ShopCell extends ImageButton {

But how can I draw a Texture (item image) and Label (price) on another Texture (background)?

sentences:
Beyond "Novice" Game Projects I was reading this answer on the type of math a game developer should know and this part really stood out at me:

How do I move my game object? The novice might say:

"I know! I'll just do:" object.position.x++.

That is how I would think to do it so I guess that shows my skill level. At least for the types of 2D side-scrolling, arcade-style games that I've made in the past, that's all I needed.  That and a bit of trigonometry.

In fact, I haven't used much linear algebra or even heard of quaternions before reading that post.  Is it because these math don't show up until you work with 3D or is it because my 2D games are fairly simple that I got away with naive implementations.

Follow up question: If I want to get familiar with that type of math, what type of projects should I undertake? IE: write a game engine, work on a 3D game, etc.

sentences:
Minecraft : Mod-making (MCreator) : Redstone Result Event I am currently using a Mod-making Tool called "MCreator" made by Pylo.

I am currently making a Block Element and creating an event when The block is right clicked by a Prismarine Shard, then The block will power redstone.

I did this by doing the following:

Event : On block rightclicked
Condition : itemInPlayersHand[] == Items.prismarine_shard
Event parameters (Redstone Power; State of power) : true
I also checked "Can provide power?" In Advanced properties

The problem is that when I test the mod in a client environment and click the block, it will not power any redstone around it.

I tried to change when the event happens to Print a text and when I tested and clicked on it with a prismarine shard, it printed the text to the console.

So is there something wrong with the Redstone Power event result or am I doing something wrong.

Thanks in Advanced,
Bryan

sentences:
What is the purpose of bitdepth for the several components of the framebuffer in glfwWindowHint function of GLFW3? I would like to know what are the following "framebuffer related hints" of GLFW3 function glfwWindowHint :

GLFW_RED_BITS
GLFW_GREEN_BITS
GLFW_BLUE_BITS
GLFW_ALPHA_BITS
GLFW_DEPTH_BITS
GLFW_STENCIL_BITS

What is the purpose of this?
Usually their default values are enough?
Where are those bits stored? In a buffer in the GPU?
What do they affect? And by that I mean in what way

Thank you in advance!

sentences:
GLSL Atomics With Floats I am implementing SDSM and in a GLSL compute shader I need to min/max vec3 values to compute the shadow map bounds. The sample implementation (in HLSL) uses vectors in "light space" that spans from 0-1 and then casts them with touint (in GLSL uintBitsToFloat) so that it can call InterlockedMinMax (atomicMin/Max) with them.

I was wondering if it is a better idea to quantize the values to an uint using the bounding volume in light space as uints instead of moving them into the 0-1 range so integer min/max works on the float bit pattern?

On the one hand using float bits in unit throws about about 2/3 the precision, because the sign bit and exponent are ignored. On the other hand almost all algorithms I came up to quantize the values somehow go past the 0-1 float range and would probably loose the precision anyway.

sentences:
How do I correctly multiply an XMMATRIX by a scalar? Using DirectXMath and its XMMATRIX structure in C++ and Direct X 11, how does one multiply that matrix structure by a single float scalar?

I want to implement the operation B = A * f; where A and B are XMMATRIX and f is a float.

I found all sorts of functions to multiply a matrix by another matrix or a vector. I found all sorts of functions to construct matrices.

I could find no scalar multiplication! Why is there no such function? Is there no use case? Did I miss something? How do I implement scalar multiplication?

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

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

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

sentences:
Tilemaps in a Entity System Framework? I have been reading up on Entity System Frameworks specifically Artemis. I am trying to decide if it is right for me. I strictly work on tile based 2d pixel art games, and I don’t think they will ever be that resource intensive. I have always used standard OOP with a lot of inheritance in the past.

My understanding of the Entity System Framework right now (I am not sure if I grasp it completely yet) is:

Entities are nothing but ID's
Components are nothing but dumb data added to an entities component pool
Systems are update functions that are attached to the world to handle every entity that matches the Systems component signature

If my understanding is correct then I am having quite a bit of trouble conceptualizing adding tilemaps and AI Behavioral Trees into this framework. I will ask about AI in the future.

Should a tilemap be built into this framework? Or should it be kept separate to make it easy to generate with a tilemap editor?

If the tilemap should be built into this framework, is each tile a different entity? And the tilemap a system? Or is the tilemap itself a single entity with inheritance built off of it?

If the tilemap is sperate, what would be the best way of collision detecting entities against the external tilemap?

I understand that multiple options that I have listed might be correct, but if anybody has done this in the past they might be able to shed some light on my confusion. Maybe there is another alternative that I have not thought of?

Thank you.

sentences:
Ideas wich design patterns apply in my school assignment For a assignment for school i've to develop a game in Microsoft XNA 4. Let me first clear out that my intention of this post is NOT to give me codes. I want to figure out things by my self. The intention of this post is to help me and give me advice wich design patterns may be better to apply in wich situation.

This game should use the following design patterns:

strategy
factory
decorator
singleton
observer
template

The assignment is as follow:

In this game the player should avoid the attack from his enemies who want to attack his spaceship. The enemies have their own way of attack and movement.

When the game starts the player has one cannon who can shoot bullets each 0.2 seconds. The spaceship can move horizantally with the keyboard. With the spacebar the player kan shoots bullets.

There are 3 kind of enemies who have their own attack and the way they move.

Chure : Moves horizantally from left to right, each time when the chure hits the edge
he moves down and again he move horizontally but this time in the opposite direction    (thus from right to left). Each chure drops at any time (random) a bomb. Each level the speed of the drop will increase.
Thege: Moves from the corner of the stage diagonal to the player. When the Thege hits the player, the player loose one life and starts the level again. When the Thege don't hit the player and reach the bottom of the stage he will remove from the stage and won't come back again in that level.
Sinode : Moves from top to bottom of the stage, when the Sinode reach the bottom of the stage hi moves the opposite direction (from bottom to top). The Sinode stays on the stage as long as the player didn't shoot him. When the player shoots the Sinode he will be remove from the stage.

Each enemie can carry an upgrade wich will be released when he will be shot by the player. either the enemie has a upgrade or not has been choosen randomly. There are three kinds of upgrades. The player can use his spaceship but once expand with each type of upgrade. If the player already has a upgrade the upgrade will remove from the stage.

The three type of upgrades are:

Lasers (Specs aren't important)
Rockets (Specs aren't important)
Guided missile (Specs aren't important)

some conditions to the game:
 - The game consists of 3 levels
 - Each player starts with 3 life
 - The level will be ended when all of the enemies are destroyed or not visible on the stage.

Now i've some ideas wich design pattern will be good by wich scenario but i would be gratefull if u guys can help me out how i can implement the factory and the observer pattern in this case and maybe help me out and give advice how i can implement the rest of the patterns.

Thank u

sentences: Port libgdx application to iOS I made my game using libgdx which is a cross-platform framework which supports desktop, Android and html5 (using Google Web Toolkit). What could be a possible route to port my game to iOS?

sentences:
Large-Scale 2D worlds with a "world texture" to draw to causing memory issues Background:

I've currently implemented a world class where the dimensions are provided in meters and those dimensions are translated to pixel values for an allegro (4.x) memory bitmap to be created so objects can be draw to it. This seemed like a good idea...until I learned the hard way that world dimensions translated to pixel dimensions such that the bitmap created would be upwards of 100,000,000 pixels causes um..."issues" and allegro (4.x) barfs.

Question:

How would I implement large-scale worlds such that they can be any arbitrary size and still have a bitmap/surface/texture to draw to that's small enough to fit into memory along with everything else? Please limit answers to allegro 4.x solutions.

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: GLSL Shader Solution for Ambient Occlusion? For the iOS app I am writing I want to incorporate some aspects of ambient occlusion for photo manipulation. Can someone suggest a GLSL approach that will work. Realtime performance is not super critical. Under a second compute time is fine.

sentences:
Finding rotation quaternion from orthonormal basis? Given three 3D unit vectors \$a\$, \$b\$, \$c\$ such that:

\$a \times b = c\$

\$b \times c = a\$

\$c \times a = b\$

(ie \$a, b, c\$ form an orthonormal basis)

How do we calculate a unit quarternion \$q\$ such that the sandwidch product (ie rotation) of \$q\$ on (1,0,0) is \$a\$, (0,1,0) is \$b\$ and (0,0,1) is \$c\$ ?

sentences:
InputAssembler and emtpy/incomplete buffers I was wondering what the InputAssembler does if the size of the bound buffers does not match the vertex count of the Draw() call.

I've seen the example at http://msdn.microsoft.com/en-us/library/windows/desktop/bb232912%28v=vs.85%29.aspx where the InputAssembler is used without any buffers, however, the vertex shader input is simply defined as

struct VSIn
{
    uint vertexId : SV_VertexID;
};

and I understand that SV_VertexID is filled in by the InputAssembler.

But what if I define the input as follows?

struct VSIn
{
    uint vertexId : SV_VertexID;
    float4 color : COLOR;
};

I tested this and it appears that input.color always returns the default value float4(0, 0, 0, 0). Is this expected behavior or might other drivers produce different results?

A more elaborate example: If I bind a buffer with ten positions to slot 0 and a buffer with five colors to slot 1 and render ten vertices, will the first five vertices have the color as defined in the color buffer and the other five have color zero? I tested this as well and this seems to be the case. Again, Is this expected behavior or might other drivers produce different results?

And even if i can to this, should I?

Background: I have "regular" vertex data which I bind to slot 0. In some (rare) cases I have additional data which I bind to slot 1. At the moment if I don't have additional data I will still generate a secondary buffer of equal size as the "regular" buffer filling it all with zeros. I was wondering if this is necessary or if I can simply set the secondary buffer to null and let the InputAssembler do the work.

Bonus question: Can I change the default value the InputAssembler uses if there is no buffer value?

sentences: RigidBody or Character Controller for Zero Gravity first person shooter I am developing a single person, first-person shooter that takes place in space. I want to be able to simulate zero gravity. Should I use a Rigid-Body or a Character Controller?

sentences:
How to pause audio playback when a breakpoint is hit or resume afterward? When my code hits a breakpoint, audio that was previously started (via an AudioSource) continues to play while the threads are paused.
I'm using a coroutine to query the status of the AudioSource, and update my UI. Because the audio continues to play, then after I've spend some time stepping through code the next frame tick when Unity gets control back runs the next iteration of this coroutine, which updates the UI. I never get to see the in-between states.
Because it's a relativley short audio clip it's usually finished playing before I've finished stepping through the code.
I'm using Unity 2018.4 with VSCode and the Debugger for Unity extension, if that helps.
I'm quite lost at what to try here. Looking for issues with Unity's AudioSource and breakpoints yields a lot of varied information about audio issues in general in Unity.
I've tried using Debug.Break(). It pauses the Unity editor, which can be useful but has the following caveats:

it requires extra effort on each breakpoint that requires enabling (if the call is not there already)
it requires manual intervention to resume the editor once you've finished stepping through code
because it is code, it cannot be added after Unity is playing, e.g. to additional breakpoints that are added once debugging has started

Does Unity have a mechanism that enables this behaviour that I've just missed? If not, what's an appropriate alternative approach?

sentences: Unity Change Rotation of Animated Object at Runtime So I made an animation, but sometimes i nedd to rotate the animation, but for some reason it isnt working. I can change the rotation of the object and then click play and it works perfectly like in the gif, but if I attempt to change the rotation on runtime nothing happens. Why?

sentences:
Quick 3D sight calculation algorithm I have a tile based board game where units move in 3D space on a 2D isometric view. When calculating attack tiles for a unit, how do I verify that they aren't shooting through a wall or a level too high for them see. I need quickly verify a lot of these attack tiles are within a unit's range of sight (about 20). What's the fastest way I can verify line of sight with the x, y, and z axis?

Somebody posted a similar question here, but it covers 2D sight calculation instead of 3D (making the answer very different).

sentences:
install unity package in to iphone? HI All,
 what is the steps of to install the unity package in to iphone and create a build (app file )that my client can also able to install in his iphone .

Thanks,
balraj.

sentences:
cocos2d-x "immediate mode"? I have some c++ game code that draws the game state on each game-loop cycle in "immediate mode". By that I mean that the game code does not add the sprites to be drawn to any sort of "scene graph" or other data structure. It just starts from a blank slate on each game loop cycle, and piles on the sprites from back to front. (I know you might wonder what API this c++ code is actually using. Well, it's written in Marmalade, which I'm moving away from. Marmalade provides an abstraction layer and the essence of this question is about replacing that abstraction layer.)

I am having trouble understanding what "immediate mode" really means in opengl es, and how it relates to the "fixed function" vs. "programmable" pipeline. Some things I read say, don't use the old immediate mode functions, use the modern shader-based programmable API instead." But at the same time, I believe glDrawArrays() is fine to use in opengl es 2.0, right? So that's an "immediate mode" function.

(I believe what's going on here is that "immediate mode" means different things at different levels. My understanding is that a library like cocosd2-x is "retained mode" in that you add sprites to a scene graph that's managed by the engine. But at the opengl level itself, I think "immediate mode" means something a bit different, namely whether you keep the vital drawing structures in CPU space until you draw them with a begin() end() sandwich, versus uploading them ahead of time to the GPU. So it that sense the GPU "retains" your data across calls. But still, you can draw a frame in "immediate" mode in the sense of piling on sprites one at a time using glDrawArrays() as many times as necessary.)

In the "hello world" example of cocos2d-x, we see

// add the sprite as a child to this layer
this->addChild(sprite, 0);

That is exactly what I don't want to have to do, because as I say, my code base is set up not thinking of the sprites as objects, but just as drawing a bunch of rectangles from texture sheets (atlases) stacked on top of each other. I don't want to think of adding sprites to some scene graph and "letting the engine take care of it." That may be a fine way of thinking in general, but it would involve a huge rewrite of my existing code.

On the other hand, I think I like the idea of cocos2d-x because it gives me a convenient way to develop a code base that I can develop on Windows and run on iPhone, Android, and elsewhere.

So what I'm trying to understand is: Can I use cocos2d-x in some "immediate mode" fashion?

Basically, in opengles 2.0, I am allowed to call glDrawArrays(), correct? And if I batch up my sprites in a reasonable way, I can limit the number of calls to glDrawArrays() in each frame. So I want to do that, and I'm fine writing that gl code myself. But I think even though perhaps this defeats some of the point of using cocos2d-x in the first place, there are still huge portability and not-reinventing-the-wheel advantages of using cocos2s-x vs writing things from scratch myself?

So can I use cocos2s-x in that "immediate mode" way, and still retain the write-once/run-everywhere benefits?

sentences: Is there anything equivalent to Portal 2's linked_portal_door in any other engines? I need the functionality of the linked_portal_door that's in Portal 2. I've searched a little in UDK and mostly got people trying to duplicate the portal gun. Does anyone know if UDK, CryEngine, Unity3D, or any other engine has something similar? I'm not against using Source, I just want to know what my options are.

sentences:
How could I render a star like those in Elite Dangerous - coronas and some sort of 3D "plasma" effect on the surface? Lets assume I wish to render a large, 3D, star object in a game engine using OpenGL. I can use a few different meshing methods: this includes mapping a cube to a sphere (with better subdivision to reduce distortion), a primitive lattitudional/longitudional based "globe" mesh, or a selectively subdivided icosphere. I would choose whatever would be easiest to apply the 3D effect to: I'm guessing an isocahedron, since it doesn't distort as much and the issues with mathematical discontinuities (when finding the Tangential, Normal, and Binormal) vectors should not be a worry (unless rendering the following effect would use a bump/normal mapping technique with a GPU-generated texture?)

Further, lets assume I wish to render a boiling, roiling, or vaguely evolving surface. The diamond-square algorithm could generate the proper effect, but how could this be used in 3D to generate something that looks vaguely like the surface of a star? Could I use the GPU to generate a texture that is then evolved with time, and use a procedural noise algorithm that includes the analytical derivatives to do so(for acquiring normal/bump map components to add "depth")? Should the noise algorithm be in 2D or 3D?

Lastly, what if I want to render the corona of the star in some volumetric fashion as well? Corona's created with billboards work well enough, but rapidly fall apart in appearance once the viewpoint gets closer to the star (as is common with sprite-based techniques).

Example images:

sentences:
Monogame - All effects in one file? I am successfully drawing all of my geometry with an AlphaTestEffect and would like to apply shaders. I've built a shader Effect from a tutorial and can't seem to find anything on the web that answers my question:

Does monogame support passing separate effects with the same geometry to the Graphics Device, or do you have to perform all Techniques you intend to apply to a model in the same effect?

sentences:
Can XNA's content pipeline be used to load C# source files? I am wondering if its possible to use the XNA Content Pipeline to load C# files?

I'm working on a game and am currently writing a FSM. I would like to be able to load states from the content pipeline, but the states would be written in C# and must use my interface.

Anyone know how to do this?

sentences:
Edit bone transforms for each key frame to fix mixamo animation I have downloaded FBX animations from Mixamo.com for use in game.

But seems like the "root" skeleton bone does not have translations in Z axis; which makes animations like climbing a ladder or ledge unusable in game engine.

The animation file does not have any mesh data and has just one animation layer.

So I am trying to write a small utility application using FBX SDK 2017.1 that will:

Read an FBX file that I got from Mixamo.com
For each keyframe translate the root skeleton bone to always maintain an offset in Z direction from pelvis bone
The above step will make the skeleton hierarchy jump due to root bone being translated. So in this step I want to recursively set pelvis bone at an offset for each key frame

Export the edited scene into an FBX file

Here's a code snippet

for (int keyIndex = numKeys-1; keyIndex >= 0; keyIndex--)
    {
        // For each key frame fix the Z transform for ROOT bone
        // Similar loop for PELVIS bone
        FbxAnimCurveKey pRootAnimKey = pRootAnimCurve->KeyGet(keyIndex);

        pRootAnimCurve->KeyModifyBegin();
            float originalValue = pRootAnimKey.GetValue();  // for debugging purposes
            float fixValue = 0.0f;
            FbxAnimCurve *pPelvisAnimCurve = pPelvisBone->LclTranslation.GetCurve(pAnimLayer, FBXSDK_CURVENODE_COMPONENT_Z);
            if (pPelvisAnimCurve != NULL) {
                FbxAnimCurveKey pPelvisAnimKey = pPelvisAnimCurve->KeyGet(animKeyIndex);
                // this "delta" can be a +ve or -ve value calculated from skeleton's Rest/T-pose
                fixValue = pPelvisAnimKey.GetValue() + delta;

                pAnimCurve->KeySetValue(keyIndex, fixValue);
            }

        pAnimCurve->KeyModifyEnd();
    }

I want the root bone to stay in between legs at an offset from pelvis bone, just as it is in rest T-pose.

Issue is that the exported file does have root bone follow pelvis bone's Z translation but after second loop is run and the file is exported my pelvis bone does not seem to follow root bone.
I have tried doing once conversion at a time i.e.

BUGGY animation -> FBX with root following pelvis bone
(1) -> pelvis following root bone

any ideas how to fix this?

There are ways to download mixamo animations without root bone i.e. pelvis is the root bone in that case and manually edit animation in Autodesk Maya to make it work. But I have 2400+ animations that needs to be fixed, so that would be a lot time consuming.

sentences:
What is the most efficient way to store world data for a 2D tile game? I'm working on a 2D tile based survival game for my programming class and as I was working on GUIs I realized that I would need an efficient way of storing and recalling not only the tile data and location as the world expands, but the active entities, their inventories, and the item data in said inventories.

What would be the best way to do this? Is there a specific file format or data structure that would be best? I get that my question is kind of vague but I'm stuck.

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: 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:
Displaying a grid based map using C++ and sdl I am trying to create a roguelike game using c++ and SDL. However, I am having trouble getting it to display the map, which is represented by a 2d array of a tile class.

Currently, my code is this:

for (int y = 0; y!=MAPHEIGHT; y++)
{
    for (int x = 0; x!=MAPWIDTH 1; x++)
    {
        apply_surface( x * TILEWIDTH, y * TILEHEIGHT, mymap[x][y].image, screen );
    }
}

However, running this code causes it to both dither for a while before opening the SDL window, and (usually) tell me there is an access violation.
How can I display my map?

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:
How can I draw a model with a color on WP7? How can I draw a model with a color (and still be aware of the lighting)?

This is really straight forward when you can use shaders, but on Windows Phone you can't.

sentences:
Why my canvas isn't showing anything after I put code in the loop for tile map? My canvas stop showing anything when I want to display a tile 25 times. No errors. Here is the code:

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");

var StyleSheet = function(image, width, height) {
  this.image = image;
  this.width = width;
  this.height = height;

  this.draw = function(image, sx, sy, swidth, sheight, x, y, width, height) {
    image.onload = function() {
      context.drawImage(image, sx, sy, swidth, sheight,x, y, width, height);
    }
  }
}

var Loader = function(src) {
  this.image = new Image();
  this.image.src = src;

  this.image.onload=function(){
    var sprite = new StyleSheet(background, 16, 16);
    for (i = 0; i < 25; i++) {
      for (j = 0; j < 25; j++) {
        sprite.draw(background, 30, 30, 36, 36, i * 36, j * 36, 36, 36);
      }
    }
  }
  return this.image;
}

var background = new Loader("https://opengameart.org/sites/default/files/PathAndObjects.png");
console.log(background);

sentences:
Cubes drawing on top of each other In follow up of my previous question: Limit the number of draw calls

I've lowered my draw calls to only 58 a frame!! But now I have another problem. I have 2500 cubes all drawn in the same position. I have no idea why. Everything that was done in my previous question works fine. This is my draw method that draws my chunk.

    public void Draw(BasicEffect effect, ThirdPersonCam cam)
    {
        device.SetVertexBuffer(vertexBuffer);
        device.Indices = indexBuffer;

        foreach (EffectPass pass in effect.CurrentTechnique.Passes)
        {
            no++;
            pass.Apply();
            effect.VertexColorEnabled = false;
            effect.TextureEnabled = true;
            effect.Texture = grass;

            Matrix center = Matrix.CreateTranslation(new Vector3(-0.5f, -0.5f, -0.5f));
            Matrix scale = Matrix.CreateScale(1f);
            Matrix translate = Matrix.CreateTranslation(cubePosition);

            effect.World = center * scale * translate;
            effect.View = cam.view;
            effect.Projection = cam.proj;

            effect.FogEnabled = true;
            effect.FogColor = Color.CornflowerBlue.ToVector3();
            effect.FogStart = 1.0f;
            effect.FogEnd = 50.0f;

            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 12);
        }

There might be some problems with the way the code is ordered in the method, but this is after moving things around. Changing the values in my DrawIndexedPrimitives line to vertices.Count and cubes.Count draws more cubes, but very strangely. There's 4 rows of 50 and then another row with just 10

sentences:
How can I automatically fit elements in libGDX layouts? Recently I wanted to use libGDX's Table to show four buttons. But my table doesn't fit on the stage:

Here is the code I used:

table.add(new GameButton("1"));
table.add(new GameButton("2"));
table.add(new GameButton("3"));
table.add(new GameButton("4"));
table.align(Align.bottom);
table.setFillParent(true);
stage.addActor(table);

(GameButton is a TextButton subclass with a special TextButtonStyle.)

When I change table.add(new GameButton("1")); to table.add(new GameButton("1")).width(Gdx.graphics.getWidth() / 4);

I get this result:

Does Table (or another libGDX layout class) have functionality to auto-fit elements like in the second picture? Or I should always add some width/height options after adding element?

sentences:
How do I change the sprite used for an object, while the game's running? Engine Used: Gamemaker Studio

I want to be able to swap between two armors on the player character. They've each got their own unique animation / general sprite stuff. How do I "equip" the second armor while the game is running? Is there even a way?

Do I need to destroy the object, and instead replace it with a different object that just has a different sprite?

sentences:
MMO Client-Server Spoofing Vulnerabilities Ive created a working authoritative client-server system using LiteNetLib for my game however im wondering if packet sniffing+modification is a real worry i should be developing for.

I read some information that other Client sniffing the packets of another client is pretty much impossible since the packets are routed through their ISP. Therefore: should i only worry about the client causing problems for the server, instead of also worrying about clients causing problems for other clients?

Currently im encrypting every packet sent by the client including movement commands such as 'move left'. My idea is that this will make packet-sniffing fail, packet-modification fail, and packet-spoofing fail.

If i remove my encryption doesn't that mean someone can spoof a packet by changing the packet source in the header? (thus sending game commands for another client - moving another player!). Usually when its encrypted i know that only the client with the secret key could have sent it, thus validating the packet source.

I see everyone saying that people shouldn't encrypt general traffic like this, but whats the truth here! Whats the best way?

sentences:
How to drag-and-drop objects in libGDX? I am drawing blocks of various amino acids (array of aminoacid objects), where one line of amino acids represents one sequence.

aminoacid class:

public void renderShape() {
    shaperenderer.setProjectionMatrix(cam.combined);
    shaperenderer.begin(ShapeType.Filled);
    shaperenderer.setColor(cc.getR(), cc.getG(), cc.getB(), 0);
    shaperenderer.rect(xpos, ypos, aawidth, aaheight);
    shaperenderer.end();
}

public void renderBatch() {
    batch.setProjectionMatrix(cam.combined);
    batch.begin();
    font.setColor(Color.BLACK);
    font.draw(batch, name, xpos+Game.AAFONTOFFSETX, ypos+Game.AAFONTOFFSETY);
    batch.end();
}

Now I need a way to drag and drop feature to move the individual blocks. How can I do this? Can I use the DragAndDrop class of libGDX? If so, how should I do it??

As a side note, I found a way to do it without libGDX:

public class AminoAcidDragAndDrop extends JFrame {
  private String brr_A = "EAQITAPFELSAFTGRPEWI";
  private JTable table;
  private DefaultTableModel tableModel;

  private DefaultTableModel getDefaultTableModel() {

    String[] cols = new String[brr_A.length()];
    for (int i = 0; i < brr_A.length(); i++) {
      String currentAminoAcid = String.valueOf(brr_A.charAt(i));
      cols[i] = currentAminoAcid;
    }

    return new DefaultTableModel(null, cols);
  }

  public AminoAcidDragAndDrop() {
    super("Amino Acid Drag and Drop Demo");

    tableModel = getDefaultTableModel();
    table = new JTable(tableModel);

    JScrollPane sp = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    getContentPane().add(sp, BorderLayout.CENTER);
    getContentPane().setPreferredSize(new Dimension(1024, 768));
  }

  private static void createAndShowGUI() {
    // Create and set up the window.
    AminoAcidDragAndDrop test = new AminoAcidDragAndDrop();
    test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Display the window.
    test.pack();
    test.setVisible(true);
  }

  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        // Turn off metal's use of bold fonts
//              UIManager.put("swing.boldMetal", Boolean.FALSE);
        createAndShowGUI();
      }
    });
  }
}

Can I convert it for libGDX? If so, how?

I also tried it with Actors but how can I use an Actor array? Would an ArrayList<> work?

Now I can move the first aminoacid, but DragAnDrop needs a final int. How can I solve this for all aminoacids?

public void drop (Source source, Payload payload, float x, float y, int pointer) {
    aminoacidlist.get(aaiddnd).setBounds(aminoacidlist.get(aaiddnd).getXpos()+Game.AAWIDTH, aminoacidlist.get(aaiddnd).getYpos(), Game.AAWIDTH, Game.AAHEIGHT);
    minoacidlist.get(aaiddnd+1).setBounds(aminoacidlist.get(aaiddnd+1).getXpos()-Game.AAWIDTH, aminoacidlist.get(aaiddnd+1).getYpos(), Game.AAWIDTH, Game.AAHEIGHT);
}

The compiler tells me:

  aaiddnd cannot refer to a non-final local variable.

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 do I make so when user moves the camera it doesn't go beyond the scene borders in Unity3D? How do i make so when i move my camera, it doesn't go beyond the border of the canvas while playing. This is the script i use to make the camera move:

        if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Moved)
    {
        Vector2 touchDeltaPosition = Input.GetTouch (0).deltaPosition;
        transform.Translate (+touchDeltaPosition.x * speed, +touchDeltaPosition.y * speed, 0);
    }

sentences:
Linking maps in Java game In my Java game, I've got a number of randomly-generated maps made of tiles.
I'm struggling with writing the code to handle the entering/exiting of the maps.

Originally, I only had Ascend and Descend. Easy. Enter exit, arrive at entrance. Basically, I used depth-- and depth++. Start at level 1, descend to level 2. Ascend to level 1 if desired.

Now I have maps that have North, East, South, and West entrances.
So when I exit North, I need to arrive at the South entrance. Similarly, when I enter East, I need to arrive at the West entrance.

I'm working on an elaboration of the Ascend/Descend --/++ system. This basically means I have to have code for:

eastEntrance sends player to westExit,

westEntrance sends player to eastExit,

northEntrance sends player to southExit,

southEntrance sends player to northExit.

westExit sends players to eastEntrance (etc for east, south, north).

This seems pretty cumbersome.
What is a good way to link my maps?

I'd really appreciate any input on this.

sentences:
How to march tiles together like in Terraria? I've been trying to get tile marching to work like in Terraria, and I got something to work. I don't think it's actually very good way of doing this, so I'm wondering what would be really the main way of doing this.

Here's a picture of what I want to accomplish:

As you can see, this really does the thing that I want, but it's so horrible looking and it'd be a pain to extend for different types of tiles.

Here is my code for this. I coded this as a test, so my full game would use tile classes etc.

for x, tile in enumerate(row):
    if tile:
        try:
            air = row[x + 1]
        except Exception:
            pass
        else:
            if not air:
                if not LEVEL[y - 1][x]:
                    tile = 3
                else:
                    tile = 6
        air = row[x - 1]
        if not air:
            if not LEVEL[y - 1][x]:
                if tile == 3:
                    tile = 5
                else:
                    tile = 4
            else:
                if tile == 6:
                    tile = 8
                else:
                    tile = 7
        LEVEL[y][x] = tile
for y, row in enumerate(LEVEL):
    for x, tile in enumerate(row):
        if LEVEL[y - 1][x] in (6, 3, 14):
            try:
            pos = LEVEL[y][x + 1]
        except Exception as e:
            print(e)
        else:
            if pos in (2, 3):
                LEVEL[y][x] = 11
    if LEVEL[y - 1][x] in (7, 4, 15):
        pos = LEVEL[y][x - 1]
        if pos in (2, 4):
            LEVEL[y][x] = 12
    if LEVEL[y - 1][x] in (5, 8):
        if LEVEL[y][x] == 1:
            LEVEL[y][x] = 13
    if LEVEL[y][x] == 6:
        if LEVEL[y][x - 1] in (2, 4):
            LEVEL[y][x] = 14
    if LEVEL[y][x] == 7:
        try:
            tile = LEVEL[y][x + 1]
        except Exception as e:
            print(e)
        if tile in (2, 3):
            LEVEL[y][x] = 15

The basic idea behind this is just to look for some air and dirt, and set the tiles image from those.

Basically then when I'm drawing this I just take the value at a coord and blit the corresponding image to the screen.

So how would I go about making this as readable and easily extendable as possible? Does anyone know how Terraria handles this?

sentences:
Can you use a public instance variable of one class within another class(A) in c++? A simple hypothetical example:

A.h

using namespace std;

class A {
public:
    int m_variable = 5;
}

B.cpp

include iostream>

using namespace std;

void B::method() {
    // Why do get an error stating 'invalid use of non-static data member on this line?
    int x = (A::m_variable) * 2;
    cout << x << endl;
}

sentences:
How to find grid cells not seen by an object I am writing a VB.NET program.

I have a grid view which is made of multiple small cells called grid cell.

On the grid view, I have placed an obstacle (red box) and an observer (blue box).

My task is to find how to find grid cells which are not seen by the blue box.
You may refer to the screenshot below.

Take note that the yellow box shape is not necessary a rectangle.

1) I have considered to loop through all grid cells in the grid view and check each of them if it is seen by the blue box.

However, there could be millions of grid cells in the grid view and looping through each of them will consume a lot of time and is not efficient.

Is there any better way to locate grid cells not seen by the blue box other than looping through all the grid cells in the view?

Thank you.

sentences:
Calculate gears rotation for a realtime simulation I'm trying to do a game with real time simulations of gears. There is a big Gear with inside a smaller gear.
I managed to draw gears with different diameters but equal size teeth, but if i try to move the smaller one inside the bigger one the movement is odd.
See the animated gif:

The biggest gear is in center C1 and the small in the center C2. I calculate C2 position in this way:
C2.x = C1.x + C1_RADIUS-C2_RADIUS) * cos(t);
C2.y = C1.y - C1_RADIUS-C2_RADIUS) * sin(t);

for t that goes from 0 to TWO_PI in n steps.
I apply as rotation the angle t, but maybe it is wrong and i have to calculate another rotation for get a perfect joint.
EDIT:
I am using radians for rotations and I think this is OK.
My main problem is that I want to achieve a perfect joint between teeth like this example. My teeth are overlapping in some odd way.
EDIT
a working example can be found here: http://www.openprocessing.org/sketch/83665

sentences:
Can't play animation from script in unity I'm making a 2D sidescrolling game in Unity, and when the player shoots an obstacle, I want the obstacle animation to play and then destroy itself. I got it to destroy itself, but the animation won't play. Any suggestions?

    public class obstacleAnim : MonoBehaviour {

    protected Animation obsanim;

    // Use this for initialization
    void Start () {
        obsanim = GetComponent<Animation> ();
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "circle")
        {
            obsanim.Play ("circobs");
            Destroy (gameObject, 1.0f);
        }
    }
}

thank you for any help!

sentences:
How can I draw a "vision cone" (targetting element) into the game world? I'm wanting to indicate various things using a "pie slice" sort of shape as below.  Similar to vision cones in stealth game minimaps, or targetting indicators in RTS type games for frontal area attacks.  Something generic enough to be used for both would be ideal.

I need to be able to procedurally (and efficiently) change things like the slice width and length, color, transparency, position in the world, etc.  For my particular situation, there's no concern with elevation, funky terrain, or really any third axis at all as far as this element is concerned.

I have two first inclinations on how to accomplish this:
1) Manually generate the vertices for a main triangle, (possibly two, superimposed to get the border effect), a handful more to approximate the arc at the end, and roll it into a mesh.

2) Use some sort of 2D drawing library to create a circle and mask it off at the right angles, render to texture, and use that.

For reference, I have some experience with Ogre3D, but I'm not attached to it as this is a mostly academic pursuit at the moment.  Other technologies that might be better at accomplishing this are more than welcome.

Finally, I'm kind of curious about how to do a "flashlight" or similar 3D effect that could produce the same result, but on all surfaces in the lit area.

sentences: Is there an FBX file/model viewer for Mac OS X? Is there a free tool I can use to view and inspect FBX assets? I've got a bunch of FBX files and I'd like to look at the mesh and textures and preview the animations.

sentences:
Saving Scores Using Cookies I've recently created a small galiga like game recently using JavaScript and HTML5. I've run into a bit of trouble saving cookies, the cookie saves, but then resets itself when the page is refreshed, my code:

function saveScore() {
 var date = new Date();
  date.setMonth(date.getMonth()+5);
  var expires = "; expires=" + date.toGMTString();
  document.cookie = "score=" + lvl + expires + "; path=/";
}

function loadScore() {

  var cookiearray = document.cookie.split(';');
  for (var i = 0; i < cookiearray.length; i++) {
    var name = cookiearray[i].split('=')[0];
    var value = cookiearray[i].split('=')[1];
    if (name == "score") {
      alert("Prior score found. Loading score...");
      lvl = value;
    }
  }
}

EDIT:
It appears as though I made an error outside of the given code, and reset the level to zero, I fixed this, and everything works well, I apologize for any confusion caused.

sentences:
What makes Minecraft so CPU intensive, and what could be done to improve it? Recently I've been searching for VPSes that allow Minecraft servers to be hosted, and surprisingly very few do. Most allow for games - but Minecraft in specific is disallowed by many.

Now it's fairly obvious why this is - it's very CPU intensive, and fairly ram hungry... But why? The answer I've gotten a lot through googling is "It's written in Java", or "Java's memory management is bad", but those aren't really answers - they're cheap cop outs.

What I really want to know, what I want to track down - is what exactly is eating up so much processing power? And given the desire to do so, what could be done to fix those issues.

I'm not looking to start a discussion on the merits of Java, or how well written Minecraft is - I'm curious if there's an actual answer, actual sections of code or ways things are done that are causing such high CPU usage, and ideally what could, theoretically, be done to fix them.

sentences:
Resources.Load doesn't grab values of my child class I have a parent class Unit, and child classes melee unit/ranged unit. The parent class  holds uninitialized fields such as health, damage, etc. the child class sets the values of these fields in an Awake function.

In another script, I have a Start method:

void Start(){
    gridX=5;
    gridY=5;
    for (int i = 0; i<(gridY*gridX);i++){
        allies.Add(new GameObject());
    }
    AddUnits();
    SetupGrid();

}

AddUnits looks like this:

void AddUnits(){
        allies[0] = (GameObject) Resources.Load ("Units/melee unit");
        allies[1] = (GameObject) Resources.Load ("Units/ranged unit);
        number = 2;
    }

The resources loaded are prefab gameobjects containing their respective melee unit or ranged unit script (both which derives from base class Unit)However, when I check the health value of the gameobjects allies, they're always 0. Can anyone help me figure out why?

sentences:
LibGDX Drawing sprites when moving orthographic camera I've been having this problem for a long time and I just can't seem to find the exact problem. I have a game where the map is 480x1600 and my camera has a view of 480x800. I have a button that when pressed, allows the user to place a platform on the map, and since the map is too big to fit on the screen, I made it so the user can move the camera up and down the map by dragging.

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    Vector3 pos = new Vector3(screenX, screenY, 0);
    cam.unproject(pos);
    cam.position.y = pos.y;
    return true;
}

Method that controls when the user tries to put a platform down

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    Vector3 pos = new Vector3(screenX, screenY, 0);
    cam.unproject(pos);
    Gdx.app.log(Game.LOG, "X Coordinate: " + pos.x + " Y Coordinate: " + pos.y);

    if (GameScreen.createPlatform == true) {
        world.setPlatform(new Vector2(pos.x - 0.6f, pos.y - 0.1f), 1);
        GameScreen.createPlatform = false;
        return true;
    }

    ...
}

Where I render the platform sprites

public void render(float delta) {
    ...
    spriteBatch.setProjectionMatrix(cam.combined);
    spriteBatch.begin();
    for (Sprite platformSprite: world.getPlatformSprites()) {
        platformSprite.draw(spriteBatch);
    }
    spriteBatch.end();
    ...

}

The game works fine when I don't move the camera. But when I do, the platforms aren't placed where I click, they're always either higher or lower where I actually clicked. Also, the platforms are always placed somewhere where the camera was originally looking before anything has been moved.

I think it's doing this is because for some reason, the coordinates never actually change. So wherever I am on the map, the top of the screen is always 120 and the bottom is always 90. This also causes objects on the map to have different coordinates if I move the camera.

This problem has me completely lost and I would appreciate any help.

sentences:
Game loop implementation I'm implementing simple Windows game. Here is my game loop, which I've written based on some tutorials found on the Web:
constexpr nanoseconds ms_per_update(500ms);
TimePoint current_time;
TimePoint start_time = Clock::now();
nanoseconds delta_time;
nanoseconds lag(0ms);

while (continueRunning) {

    while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);

        if (WM_QUIT == msg.message) {
            OutputDebugString(L"--- WM_QUIT (WndMain) ---\n");
            continueRunning = false;
        }
    }

    current_time = Clock::now();
    delta_time = duration_cast<std::chrono::nanoseconds>(current_time - start_time);
    start_time = current_time;
    lag += delta_time;

    while (lag >= ms_per_update) {
        Game::Update();
        lag -= ms_per_update;
    }

    Game::Render();
}

Here are my questions
What really the Update and Render methods should do? Am i right that Update should for e.g. run through all game entities just updating theirs coordinates while the Render should call Render method for every game object which will just draw it on the screen having the position set by Update?

sentences:
Unity3d - How to freeze a Animation in the Editor Is it possible to freeze my Animation in the Editor at a specific frame?

I made a simple camera animation, I try to select a specific frame inside of that animation and pause it, so I can work in the editor with everything positioned at the current positions at that specific frame.

This does not work at the moment. If I select my desired frame and then select another object, then my animation is set to start again.

This makes it very hard to work in the editor and prepare the animation.

EDIT:

Ok I try to explain it more simple. Let's assume I am animating the main camera and I have three animation points, A, B, and C.  (I know I have more, but lets just assume it for this example to simplify it)

At A the camera is obviously at the start position:

At at B it is somewhere in between A and C:

At C the camera is at the end position:

What I need is to pause the animation at B, so my animation object stays at this position the whole time, even though when it has no focus and another object is selected. This would make it much easier for me to place objects exactly where I need them.

What actually happens is that my animated object (maincamera) is set to it's "start position", but I need it to stay in place, so I can place other objects perfectly.

I hope that was clear enough.

(side note: as you can see this is bugged, the rotation is weird now...)

sentences:
Declaring controls in multi form/usercontroll game In my game I have 2+ forms and 4+ usercontrols.
Where should I declare, lets say a textbox that I use in form2, but I need to modify it in form1.

Should I make them public in their own form/usercontrol or should I make a static class with all the controls?

(Edited to clarify my question)
I want to know the most used and flexible way.

sentences:
How do reflections work for large flat surfaces? I understand how reflections work for objects. A cubemap would be rendered around a certain point in 3D space, usually at the center of the object that the reflection is to be applied to, and that is the surrounding world it reflections.

But this leads to the question, what about large flat surfaces like floors and walls? If you're only rendering the cubemap from a single point in 3D space, reflections only work for a small area around this. If you walk down the hall and look at the same floor, the reflections would make no sense at all.

How are large, flat surfaces reflected?

sentences:
How to get asset/model name from (custom) Content Processor in XNA 4.0 I'm trying to make multiple animations for multiple models in XNA 4.0 and I need to get the name of the model/asset from the content processor which is a custom one (XNA default I think), I'm trying doing this by the split method which requires reading from a file the animations but I need to get the model's name to match it with the files because I'll have several files for several models.

public override ModelContent Process(NodeContent input,
                                         ContentProcessorContext context)
    {
        ValidateMesh(input, context, null);

        // Find the skeleton.
        BoneContent skeleton = MeshHelper.FindSkeleton(input);

        if (skeleton == null)
            throw new InvalidContentException("Input skeleton not found.");

        // We don't want to have to worry about different parts of the model being
        // in different local coordinate systems, so let's just bake everything.
        FlattenTransforms(input, skeleton);

        // Read the bind pose and skeleton hierarchy data.
        IList<BoneContent> bones = MeshHelper.FlattenSkeleton(skeleton);

        if (bones.Count > SkinnedEffect.MaxBones)
        {
            throw new InvalidContentException(string.Format(
                "Skeleton has {0} bones, but the maximum supported is {1}.",
                bones.Count, SkinnedEffect.MaxBones));
        }

        List<Matrix> bindPose = new List<Matrix>();
        List<Matrix> inverseBindPose = new List<Matrix>();
        List<int> skeletonHierarchy = new List<int>();

        foreach (BoneContent bone in bones)
        {
            bindPose.Add(bone.Transform);
            inverseBindPose.Add(Matrix.Invert(bone.AbsoluteTransform));
            skeletonHierarchy.Add(bones.IndexOf(bone.Parent as BoneContent));
        }

        // Convert animation data to our runtime format.
        Dictionary<string, AnimationClip> animationClips;
        animationClips = ProcessAnimations(skeleton.Animations, bones);

        //split animations
        animationClips = SplitAnimations(animationClips["Take 001"], @"F:\Education\GP\GP\Animations\defs.txt");

        // Chain to the base ModelProcessor class so it can convert the model data.
        ModelContent model = base.Process(input, context);

        // Store our custom animation data in the Tag property of the model.
        model.Tag = new SkinningData(animationClips, bindPose,
                                     inverseBindPose, skeletonHierarchy);

        return model;
    }

I want to replace the "defs" with the model/asset name to make it load the correct animations.
Sorry if my question is vague or redundant.
Thanks in advance.
Is there something wrong with the question ? ._.!

sentences:
Retrieving an array of images from Firebase Storage As title says I'm trying to get all images on firebase storage and save them to an array which later on i will be using to load them into the scene. i can manage downloading on image so far but I'm unsure of how to make them into an array.
This is the code I'm using now to download one image by name and assigning it into a texture variable
        storage = FirebaseStorage.DefaultInstance;
        storageRef = storage.GetReferenceFromUrl(_url);

        storageRef.Child(_resourceName).GetBytesAsync(1024* 1024).ContinueWithOnMainThread(task =>
        {
            if (task.IsCompleted)
            {
                Texture2D texture = new Texture2D(1, 1);
                byte[] fileContent = task.Result;

                texture.LoadImage(fileContent);
                Debug.Log(texture.name.ToString());
                selectedText = texture;
            }
            if (task.IsFaulted)
            {
                Debug.Log("faulted DOWNLOAD");
            }

        });

now through that i want to replace my current function which loads all images through the inspector.
 if (LevelSystemManager.Instance.CurrentLevel < source.Length)
        {
            selectedText = source[LevelSystemManager.Instance.CurrentLevel];
        }

Source being the array i use from the inspector to load those images into the game scene which then are selected into the selectedTex Texture2D and loaded based on the level, so 0 element in array == level0 , 1 == level 1 etc. etc.
So i was wondering if i have a couple of folders inside firebase with 10 to 20 images each how can i make that source array pull from that folder? And as a result remove the need to have them in the game and of course not setting them through the inspector.

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: GTA style camera - Unity I am wanting to make a 3d RPG with unity, and I'm in the planning phase. For the camera I decided to make it GTA style. I want the camera to be rotated around the player without effecting the movement of the player. If anyone can give any pointers on this, I would be very grateful.

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:
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 to create guides to off-screen objects? I've played Metroid Blast on Wii U, and would like to build one of its features in a three.js game.

The feature is: if an opponent is out of view, a guide is displayed showing the direction of the opponent.

An example of it is here:

(Image source)

Notice the small circles with arrows in the left side.

How could I have a similar feature in my game?

sentences:
Which consoles may I target with OpenGL? I'm thinking on technical design for a game/game engine using OpenGL, and I wonder if there is any recent consoles (Xbox360, PS3, Wii U, Xbox one and PS4) that I could work with if I do so.

I found plenty of conflicting answers through forums. The only straight answer seems that it is impossible for Xboxes because Microsoft forbid to use something else than DirectX, its own product.

So, finally, does anyone know for sure which consoles can support an OpenGL-based game?

sentences:
How to calculate left/right oriented angle between two 2D vectors? I would like to calculate angle between two 2D vectors. Here's a picture of what I'm trying to achieve:

I have an obstacle line segment AB and incoming moving PC. If I'm coming from one side C¹D¹ and angle ⍺ < π/2 (i.e. right side) then PC will turn left. On the other hand if ⍺ > π/2 then PC will turn right. But if PC will come from the other side C²D² it should work as well for angle β as per picture.

So what I need is to determine whether the angle between AB and CD is larger to the left or right basically.

I've tried these things, while having vectors defined as:

Vector2 ab = Vector2.Normalize(new Vector2(b.x - a.x, b.y - a.y));
Vector2 cd = Vector2.Normalize(direction);

1) To calculate angle using atan2, but it works only randomly (1/4 of cases).

Single angle = Math.Atan2(cd.Y, cd.X) - Math.Atan2(ab.Y, ab.X);

if (angle > MathUtil.PiOverTwo)
{
    RotateRight();
}
else if (angle < MathUtil.PiOverTwo)
{
    RotateLeft();
}

2) To use normals somehow. This works a bit better but only from one side I think. (1/2 of cases, better but not there)

Vector2 normal1 = Vector2.Normalize(new Vector2(-ab.Y, ab.X));
Vector2 normal2 = Vector2.Normalize(new Vector2(ab.Y, -ab.X));
Double angle1 = Math.Atan2(normal1.Y, normal1.X) - Math.Atan2(cd.Y, cd.X);
Double angle2 = Math.Atan2(normal2.Y, normal2.X) - Math.Atan2(cd.Y, cd.X);

if (angle1 > angle2)
{
    RotateRight();
}
else if (angle1 < angle2)
{
    RotateLeft();
}

sentences:
Vulkan PushDescriptorSetTemplates (Can only parts of the UpdateTemplate be updated?) I'm exploring the VkDescriptorUpdateTemplate usage and really like the efficiency in coding this versus individual DescriptorSets, except I have one concern. When making an UpdateTemplate for each shader "program" with multiple UBOs, SSBOs, combined image samplers, etc. and attempting to update a single buffer/sampler, I have to update them all based on the template. In reading the specification and googling (not much information on descriptor templates), it isn't clear if there is a way to update only part of the DescriptorTemplate and allow the remainder of the bindings to remain.

Quick Code Example (Updating all three buffer/sampler bindings). This works but in changing the sampler, I have to rebind the other buffers as well.

FDescriptorInfo Sampler(LinearSampler, Tex->ImageView, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
FDescriptorInfo Desc[] = {VertexBuffer, CameraBuffer, Sampler};
vkCmdPushDescriptorSetWithTemplateKHR(Vulkan->CommandBuffer, Vulkan->MeshProgram.UpdateTemplate, Vulkan->MeshProgram.Layout, 0, Desc);

If I just want to update the combined image sampler; is there a way to only update the 3rd binding? The example below gives validation errors along with attempting to just pass a single DescriptorInfo as there is no way to tell PushDesctiptor which binding I want to update versus all of them in the template.

FDescriptorInfo Sampler(LinearSampler, Tex->ImageView, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
FDescriptorInfo Desc[] = {0, 0, Sampler};
// FDescriptorInfo Desc[] = {Sampler}; // Also tried this but there is no way to tell vkCmdPushDescriptorSetWithTemplate I'm only updating the 3rd binding.
vkCmdPushDescriptorSetWithTemplateKHR(Vulkan->CommandBuffer, Vulkan->MeshProgram.UpdateTemplate, Vulkan->MeshProgram.Layout, 0, Desc);

Is it possible to reduce re-binding/re-pushing other buffers when utilizing the DescriptorSetTemplates?

Thanks in advance for any advice.

sentences:
Need help with making a journal system My game uses a system similar to Metroid Prime's logbook, in that it logs things the player encounters and discovers on their journey, categorizing it, etc.

I want to write out all of the possible entries they can find, with the categories and all, but I need a system similar to what'll be in the final product to toy with, and use as an example for when it gets implemented into the game itself.

A click through menu sort of thing. Writing out all of these long descriptions would be too much of a hassle in a regular text document (and would make it FAR too long), and doing it through HTML or something sounds far too messy.

Basically, I want something, like an app, that I can edit, and that'll let me click through the categories till I get to the entry I want, which should display on the side. Here's a really terrible example of what I'm looking for.

I'm probably stupid for asking this, and there's likely an extremely obvious solution to this, but I have a thousand other things related to the game to think about, and Googling didn't result in anything.

sentences:
How to draw 2d above 3d scene? I have an OpenGL(3.3)+GLEW application.
I want to draw a black vertical rectangle at the left side of the window for writing some information on it, like fps (I use GLEW function for drawing text).

I have a common pipeline, like this:

 m_transformation = PersProjTrans * CameraRotateTrans *
           CameraTranslationTrans * TranslationTrans *
           RotateTrans * ScaleTrans;

I know how it works, but I can't figure out how to draw a projection of the rectangle on the window, like 2d.

I would be glad to any advise.

sentences:
Create Random Platformer-Gameworld Evening.

I created a xna-game like the iOS Platformer game "Banana Kong".
The level-layers are currently saved as XML files.

Example:

<level>
    <layer1>
        <tile type="0" x="50" y="70"></tile>
        .. And so on
    </layer1>
    .. And so on
</level>

Its a temporary solution, yes, but when I sell/release it, static levels are not very good.

So How I could create levels randomly?

The engine would have to pay attantion, to not create tiles, the player can't reach, or create tiles an other tiles.

My current concept is, that the engine could create random tiles as long a tile fits every condition - but there is a unlikely chance that this will never happen and I think there are better methods to do this.

So, I hope anybody could give me some resources, theories or anything, what can help me.

sentences:
Easy SpriteKit question on creating a function The following code is what I'm working on to animate characters in a SK scene class. I can run the code without building, no problem, but I can't build it and run it; I get one error message: Binary operator '+=' cannot be applied to operands of type '[(SKTexture)]' and '[SKTexture!}'.
The code is below:

func initStoryBegin() {
    let CaitAtlas = SKTextureAtlas(named: "cait")
    let DrewAtlas = SKTextureAtlas(named: "drew")

    CwalkAnimation = self.animateSheet(CaitAtlas, walkAnimation: CwalkAnimation, formattedword: "cait%01d")

}
// ***This is where I am having trouble. In the walkAnimation += line.
func animateSheet(nameAtlas: SKTextureAtlas!, walkAnimation: [(SKTexture)], formattedword: String) -> [SKTexture] {
    for index in 1...nameAtlas.textureNames.count {
        let imgName = String(format: formattedword, index)
        walkAnimation += [nameAtlas.textureNamed(imgName)]
        println(walkAnimation)
        return walkAnimation
    }
}

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    let charNode = self.childNodeWithName("charNode")

    if (charNode != nil) {
        let animation = SKAction.animateWithTextures(CwalkAnimation, timePerFrame: 0.2)

    charNode?.runAction(animation)

    }
}

I can't figure out why the code works when I run it, but it doesn't work when I try to build and run? Any help would be greatly appreciated.

sentences:
How AAA games use this texture in the tone-mapping shader? I found that Battlefield 3 as well as Saint's Row the Third use this texture in their final tone-mapping stage. Can anyone share a link to an article about how this texture is used?

UPDATE: As there are hardly any examples of Color Grading implementation on the net, I will post my quick and dirty sample for XNA 4.0. This does nothing but builds the default 2d colormap from scratch on GPU, copies it's contents into a 3d texture on CPU and performs the actual color-correction with the shader code from the article provided in the answer.
XNA 4.0 Color Correction Sample
If you want to know what you can do with this, look here:
http://the-witness.net/news/2012/08/fun-with-in-engine-color-grading/
In short the author explains there, how you can basically make a screenshot of your normal in-game image with the default color grading palette on top, perform screenshot color correction in photoshop, cut and copy the deformed color correction palette into the engine and have that color correction applied for every in-game scene automatically.

sentences:
Node.js MMO - process and/or map division I am in the phase of designing a mmo browser based game (certainly not massive, but all connected players are in the same universe), and I am struggling with finding a good solution to the problem of distributing players across processes.
I'm using node.js with socket.io.
I have read this helpful article, but I would like some advice since I am also concerned with different processes.
Solution 1:
Tie a process to a map location (like a map-cell), connect players to the process corresponding to their location. When a player performs an action, transmit it to all other players in this process. When a player moves away, he will eventually have to connect to another process (automatically).
Pros:

Easier to implement

Cons:

Must divide map into zones
Player reconnection when moving into a different zone is probably annoying
If one zone/process is always busy (has players in it), it doesn't really load-balance, unless I split the zone which may not be always viable
There shouldn't be any visible borders

Solution 1b:
Same as 1, but connect processes of bordering cells, so that players on the other side of the border are visible and such. Maybe even let them interact.
Solution 2:
Spawn processes on demand, unrelated to a location. Have one special process to keep track of all connected player handles, their location, and the process they're connected to. Then when a player performs an action, the process finds all other nearby players (from the special player-process-location tracking node), and instructs their matching processes to relay the action.
Pros:

Easy load balancing: spawn more processes
Avoids player reconnecting / borders between zones

Cons:

Harder to implement and test
Additional steps of finding players, and relaying event/action to another process
If the player-location-process tracking process fails, all other fail too

I would like to hear if I'm missing something, or completely off track.

sentences:
Object shrinks at same rate no matter what I am using the following code to shrink a sprite:

public bool shrinking = false;
public float targetScale = 0.1f;
public float shrinkSpeed = 0.1f;

void Update () {
    if(shrinking) {
        mySprite.transform.localScale -= Vector3.one * Time.deltaTime * shrinkSpeed;
        if(mySprite.transform.localScale.x <= targetScale) {
            shrinking = false;
        }
    }
}

However, no matter what I change shrinkSpeed to, the object shrinks at the same rate. I know it probably has something to do with putting it in the update function but where should I move it to fix the problem?

sentences:
How to Stop Background Music When The Game is Over? I am working on a 2D Angry Birds type Unity game. I Created Menu Scene and Level One Scene and all the required scripts are added. After adding background music to Level One, when the game is over and return to Menu I can't stop the music. The Menu scene has its own music and when the level one is over, it continues with its own music and gets mix with the menu scene music. I tried to add Destroy() function to level one GameObject but Level One music became silent after I restart with my menu scene. Here is my code for the attached music game object:

public class background_sound : MonoBehaviour {
    public static bool soundBreaker = false;

    public void Start () {
        if (!soundBreaker) {
            AudioSource myAudio = GetComponent<AudioSource> ();
            myAudio.Play ();
            DontDestroyOnLoad (myAudio);
            soundBreaker = true;
        }
    }
}

And here is the Menu Script:

public class MenuScript : MonoBehaviour {

    public void StartGame () {
        SceneManager.LoadScene ("Level One");
    }
    ...

Here is the code that loads the Menu Scene..

public void GameOver() {
    musicObject.setActive(false);
    startCoroutine(restTime());
}

IEnumerator restTime() {
    yield return new WaitForSeconds (3);
    SceneManager.LoadScene("Menu");
}

sentences:
Drag event inverts in landscape mode I am developing an car game for android  with an UI steering wheel to control the car. I'm following Answer example for the wheel rotation. This is the code to rotate the wheel.

rectT.localEulerAngles = Vector3.back * wheelAngle;

This code working completely fine in unity and in the portrait mode of actual device.

But in the landscape modeof actual devices , the rotation get inverted.
Please help me to solve this problem.
Thank you

sentences:
XNA: Deforming/Destroying a model I want to be able to destroy and deform a car in-game.

For example, I want two cars to crash and a) break the meshes apart (probably applying force to fly them apart) and b) deform the mesh (like bending the side doors).

How would I go about this?

Thank you in advance.

sentences:
Detect transform from detection of QR code? I want to calculate the transform I need to render a 3D object in my world.

How I see my idea:

You open a camera
You point it at a QR code
The app detects the QR code and returns the 4 corners and the correct direction
The app calculates the transform that this QR code is currently at (I need help with this step)
The app uses that transform to render the 3D object in a fixed position over the QR code

I want something like Vuforia, but for QR codes (as they are used often).

I don't really know how I can extract the transform from the detected QR code (I will get the location of the 4 corners)

sentences:
gpu_rotate a texture2d or rendertexture How does one gpu rotate a Texture2D or RenderTexture using Unity c#? Or, is that possible?

I think it might be something like this...
I'm also trying to understand how gpu_scale seems to work here?

    // Internal unility that renders the source texture into the RTT - the scaling method itself.
    static void _gpu_scale(Texture2D src, int width, int height, FilterMode fmode = FilterMode.Trilinear)
    {
        //We need the source texture in VRAM because we render with it
        src.filterMode = fmode;
        src.Apply(true);

        //Using RTT for best quality and performance. Thanks, Unity 5
        RenderTexture rtt = new RenderTexture(width, height, 32);

        //Set the RTT in order to render to it
        Graphics.SetRenderTarget(rtt);

        //Setup 2D matrix in range 0..1, so nobody needs to care about sized
        GL.LoadPixelMatrix(0, 1, 1, 0);

        //Then clear & draw the texture to fill the entire RTT.
        GL.Clear(true, true, new Color(0, 0, 0, 0));
        Graphics.DrawTexture(new Rect(0, 0, 1, 1), src);
    }

Edit:

The input image is rotated 90 degrees ccw to fit in the left part (replacing the beige with pink dots) of this texture (no alpha is needed). If you want some numbers, it's a rect from 0,0 to new Vector2(794, 1024):

sentences:
Octagon border algorithm I'm working on an open source game for 2 years but I'm very bad at math. The game permits moving a character on an octagonal basis. When the character reaches the border coordinate (colored in yellow), I permit him to travel to another octagon:

The map is a simple 2d array of x, y coordinates. The goal is to know if an x, y tile coordinate is on a "yellow" tile, and which direction it represents (north, northeast, east etc.) depending on map width and height.

I wrote this algorithm many times and in two different language, example with Rust:

pub fn get_corner(width: i16, height: i16, new_row_i: i16, new_col_i: i16) -> Option<CornerEnum> {
    let left_col_i_end = width / 3;
    let right_col_i_start = (width / 3) * 2;
    let top_row_i_end = height / 3;
    let bottom_row_i_start = (height / 3) * 2;
    let mut more = if new_row_i >= 0 { new_row_i } else { 0 };
    #[allow(unused_assignments)]
    let mut right_col_i = 0;
    #[allow(unused_assignments)]
    let mut left_col_i = 0;

    if new_row_i < top_row_i_end {
        right_col_i = right_col_i_start + more;
        left_col_i = left_col_i_end - more;
    } else {
        if new_row_i >= bottom_row_i_start {
            more = (height / 3) - (new_row_i - bottom_row_i_start + 1);
            more = if more >= 0 { more } else { 0 };
            right_col_i = right_col_i_start + more;
            left_col_i = left_col_i_end - more;
        } else {
            left_col_i = left_col_i_end;
            right_col_i = right_col_i_start;
        }
    }

    if new_col_i < left_col_i && new_row_i < top_row_i_end {
        return Some(CornerEnum::TopLeft);
    }
    if new_row_i < 0 && left_col_i <= new_col_i {
        return Some(CornerEnum::Top);
    }
    if new_col_i >= right_col_i && new_row_i < top_row_i_end {
        return Some(CornerEnum::TopRight);
    }
    if new_col_i > width - 1 && top_row_i_end <= new_row_i {
        return Some(CornerEnum::Right);
    }
    if new_col_i >= right_col_i && new_row_i >= bottom_row_i_start {
        return Some(CornerEnum::BottomRight);
    }
    if new_row_i > height - 1 && left_col_i_end <= new_col_i {
        return Some(CornerEnum::Bottom);
    }
    if new_col_i < left_col_i && new_row_i >= bottom_row_i_start {
        return Some(CornerEnum::BottomLeft);
    }
    if new_col_i < 0 && top_row_i_end <= new_row_i {
        return Some(CornerEnum::Left);
    }

    None
}

But it is not working too well: it works only for some borders, but not for others, apparently depending on width/height odd/even... I curse my math. I'm sure it's not that complicated but I've failed for two years. So, I'm here to ask for a solution... which would be greatly appreciated!

sentences: How to create a material with variable color I'm new to Unity and trying to create a Carrom game. Since all the White and Black pieces, Queen basically have the same material and physical properties and texture except for their color, I'm trying to create a single material that I could assign to all 3 types of objects but could then set the material color per object type. Can this be achieved in Unity (I'm using 5.3.2)?

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:
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:
Using pixel art on small high resolution screens I'm making a game and I would like to utilize pixel art as my style. But I faced a problem, modern displays on my target platform (iOS) have extremely high resolution.
So if my artist makes me some sprites in 1 to 1 pixel resolution, each character sprite will look like 2x3 millimeters, and that's not what I want.

How do I fix this problem? Do i just use 4 pixel blocks as 1 pixel in my art, or there is some other way?

Another question, is how do I utilize high-crisp display of those devices with pixel art?

How do I go with using images on older devices? Do I have to make double assets or downscale/upscale some images?

sentences:
LookAt only in Z axis I'm fairly new to game development, like many of us asking questions here

Currently, I'm trying my luck working on a simple space shooter.

I'm trying to add some enemy ships with movement, they will only move forwards, but, at all time, will be facing the player ship´

I have that figured out, after playing with many options, LookAt was my saviour, but now, I'm having an issue, they do rate to face the player, but they also rotate on the Y axis

This is how they are in the editor looking

This is the position setting

Their properties

Their code

using UnityEngine;

public class AlienMovement : MonoBehaviour {

    public GameObject PlayerShip;
    public float speed;

    // Use this for initialization
    void Start () {
        GetComponent<Rigidbody> ().velocity = transform.up * speed * -1;
    }

    // Update is called once per frame
    void Update () {
        transform.LookAt (PlayerShip.transform, Vector3.up);
    }
}

And how they look once the game is running (frame still)

Transform properties for the one on the right

Any idea what I'm doing wrong?

sentences:
How to manage requests for a MMOG? I read that most servers handle more than 50 requests per second. Is this true? how many requests can a normal server handle?

How do MMOG manage requests having to update player actions instantly?

sentences:
How can I post scores to Facebook from a LibGDX Android game? I am using LibGDX to create an Android game. I am not making the HTML backend of the game. I just want it to be on the Android Google Play store.

Is it possible to post the scores to Facebook? And if so, how can I do it? I searched and found the solutions only for web-based games.

sentences:
Update movement actor with collisions in 2D game I have the algorithm for moving an actor.
The actor has:

4 states: Stay, Move, Jump, Fall and direction vector x,y.
The direction vector can be -1.f and 1.f or 0.f in both directions.
Boolean value onGround.
currentJumpVelocity
startJumpVelocity

Algorithm:

if (direction.x != 0.f) {
    // move X
    // check collision X by direction = true
    //// move to difference
}

if (onGround == true) {
    // check collision down == false
    //// state = state == State::Jump ? State::Jump : State::Fall
    //// direction.y = state == State::Jump ? -1.f : 1.f
    //// currentJumpVelocoity -= state == State::Jump ? deltaTime*startJumpVelocity : currentJumpVelocity
    //// onGround = false
}

if (state == State::Jump) {
    // doJump -> when press Space currentJumpVelocity sets from startJumpVelocity
    // check collision up
    //// move to difference
    //// state = Fall
    //// direction.y = 1.f
    //currentJumpVelocity -= state == State::Jump ? deltaTime*startJumpVelocity : currentJumpVelocity
}
else if (state == State::Fall) {
    // doFall
    // check collision down
    //// move to difference
    //// state = direction.x != 0.f ? State::Move : State::Stay
    //// onGround = true;
    //// direction.y = 0.f
    //// currentJumpVelocity = 0.f
}

Is this correct algorithm?

sentences:
Need a better function for transportation efficiency I'm making an economic kind of game, and one of the things I'm simulating is the transportation of resources to a central depository, e.g. moving metal from a mine to the city (so it can be turned into swords). I want it to behave so that a producer farther away from the city is considerably less efficient, but the player can bring the efficiency back up by assigning additional carters.

The function I have right now is:

efficiencyPercent = 100 - pow(9 * travelTime, 4/3)*pow(2/3, carters)

However, this doesn't have the behavior I want; carters are too powerful, either because pow(2/3, carters) converges to 0 much too fast, or because pow(9 * travelTime, 4/3) grows too slowly, or both, I'm not sure. No matter how big travelTime is, the player can overcome it by assigning a reasonable number of carters. I want it to work so that modest travelTime is defeatable by a reasonable number of carters, but once it gets too high it takes an absolutely incredible number of carters to defeat it.

What's a better sort of function that will have this behavior? I think I need the inefficiency to be exponential in travelTime but I don't know what to do about carters. Please help!

EDIT: DeadMG suggests that I have combined two effects (effect of travel time & effect of carters) that would be better off separated. I'm not sure I agree, but I'm not sure I disagree either, so I'm restating the question in support of this theory.

What I'm looking for is some kind of mechanic, involving carters and travel time, with the following behavior:

An iron mine can generate iron at a rate dependent on the number of laborers assigned to the mine; for example, 40 miners produce a maximum of 10 iron per month. This is strictly linear and I'm not changing it at this point. No matter how many carters you assign, there should never be a way to convince the mine to provide more than this amount.
In order to be used, the iron has to be transported to a city. The miners are willing to do this to some extent, but they become less willing the farther they have to carry it. If the mine is right in the middle of town, no carrying is necessary and the miners work at full power; farther away and they are forced to take time off to haul wagons. In the interest of concreteness, the miners shouldn't be willing to carry a significant amount of stuff farther than 5 days away. (I can fiddle with the exact balance later).
You can assign additional laborers (from the city's pool) as carters, allowing the miners to get on with their proper jobs. Dedicated carters are far better at moving things than miners moonlighting as teamsters. Assigning more carters should have diminishing returns. For concreteness in fiddling with constants, a mine 5-7 days away should be restored to 95% efficiency by roughly 10 carters.
The farther away the mine is, the more carters it should take to achieve a given efficiency improvement. Mines that are too far away (for concreteness, 14 days or so) should require a completely impractical amount of carters to increase the efficiency to usable levels. Ideally, in this situation the player would rather build a new city, closer to the mine, than assign such an incredible amount of workforce simply to cart things around.

The formula I have satisfies all of these except the last, which is the one I'm having trouble with. I'm particularly looking for a mechanic that provides all of these features in a "smooth" way, without arbitrary breakpoints or funny corner cases, because I want to be able to change the constants depending on the empire's technology levels. Whether this is two separate formulae as DeadMG suggests, or a single combined one like I have now, or any other kind of mechanic, I don't care. Any suggestion, up to and including the simulation of little carter automata moving around the map, is what I'm looking for.

sentences:
Unity 3D rotating object around 2 axes rotates it around 3 I am developing a 3D space shooter and I've fount that when triying to rotate the ship using X and Y axes it also rotates on the Z axe.

The answer
here helped me a lot, but now when I try to rotate on 3 axes I have the same problem on the 2 axes sharing local space.

The code I have right now is this:

    float rotZ = 1;
    float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
    float rotUpDown = Input.GetAxis("Mouse Y") * mouseSensitivity;
    transform.Rotate(0, rotLeftRight, 0, Space.World);
    transform.Rotate(-rotUpDown, 0, 0, Space.Self);
    transform.Rotate(0, 0, -rotZ, Space.Self);

Anybody knows how to make all 3 rotations independent from each other? Thanks!

sentences:
How to drag an object with mouse with collision? I want to drag a GameObject with the mouse but I need collision. The basic mouse dragging code simply sets the position of the object to the hit.point with an offset from the difference at the start of the drag.

As for collision, I've tried using kinematic rigidbodies and setting the position with rigidbody.MovePosition(uh) but that allows the object to rotate while pushing it up against a corner on one side.  With rotation constraints enabled, it flickers a lot and still intersects a lot. I also tried playing with collision detection and interpolation. None of the settings improved it.

I also tried Physics.ComputePenetration but that is extremely messy because some of the objects I'm dragging, have several colliders. The distance it calculates is per collider so it doesn't calculate the offset required to separate the entire object. I tried disabling all the colliders and then adding a single box collider sized to fit the bounds of the object. That had bad flickering problems.

The last thing I tried was box casts on each side that would find the closest point and offset the mesh in that direction. But if I moved the mouse too fast it would go inside the other mesh and would no longer register any colliders intersecting the box casts. It also suffered from flickering problems.

Ideally, I want to have fairly accurate detection. I don't want to approximate the other colliders (not the ones on the object I'm dragging). Assume the other colliders could be any type (box/capsule/sphere/mesh).

The image below shows the problem I'm having. The green dot shows approximately where the cursor was (also the hit.point from the raycast on the surface of the red cube). What I expect is that the couch should be offset so that it was close to the cursor but prioritizes not intersecting other meshes over sticking to the mouse.

sentences:
Assistive Machine Learning for Scene Creation A few years ago, I have seen a talk about assistive ML tools in game development. I think was from
Ubisoft La Forge, but could be wrong.
In the video it was demonstrated, how an „AI“ understood the relationship of objects in a room and it was possible to give it simple commands like „clean the room“ and everything was put in its place, like books in the shelf, chess pieces on the board and so on. But it was also possible to ask to make the room look used by a child to change the scene accordingly.
The problem is, I can‘t find the video anymore and neither do I remember the name of the tool or the creator. Any idea how it was called and what‘s the state of it?

sentences:
What is an OO way for my input layer to act upon objects? I'm building a top-down RPG specifically to practice Object Oriented thinking and design. I am keeping in mind coupling, single-responsibility, and so forth. One design issue that's been bugging me is how to ultimately have objects talk while maintaining the loosest coupling possible. As an example, I'm designing the input class now, which will be made up of two layers, like so:

The conundrum is that I don't know how to bridge that gap between Input and HeroActor, which is initialized from the PlayState class, which is also where the hero.update() method is called. Let's say Keyboard has just executed

public void keyPressed(KeyEvent e) {
    switch(e.getKeyCode()) {
        //Some cases

        case KeyEvent.VK_UP:
            //Assume InputEvent.INPUT1 is a defined enumeration in InputEvent
            inputHandler.passInput(InputEvent.INPUT1);
            break;

        //Some more cases
    }
}

I've basically landed here:

public class Input {

    public void passInput(InputEvent e) {
        switch(e) {
            //Some cases

            case InputEvent.INPUT1:
                ????????????????????

            //Some more cases
        }
    }

}

My ideas have been:

Pass a reference to the instance of HeroActor to the Input object, then have Input directly call the moveUp() method on the HeroActor instance.

case InputEvent.INPUT1:
    actor.moveUp();

My instinct tells me this is bad OO design as it tightly couples the two classes.
Make the instance of HeroActor global and basically do the same as above. Even worse OO design.
Write a registerInput(Input inputHandler) function in the Actor class, like so:

public class HeroActor extends Actor {

    //Existing fields and methods

    private Input inputHandler;

    public void registerInput(Input inputHandler) {
        this.inputHandler = inputHandler;
    }

Still, then the HeroActor would have to poll the inputHandler every frame to find out if any actions have applied to it.

I'm in the same situation trying to figure out how to write the collision engine without passing it specific references to the player's HeroActor instance or the dozens of EnemyActor instances in the PlayState constructor.

Any help would be greatly appreciated. My request is not for specific code, but rather common techniques for handling the many objects in a game without ending up with a god object. I've seen some material suggesting an Observer pattern being applied for things like the input layer above, but before I go too far, I'd like some feedback from the community since I've got so many different answers among all of my Googling today.

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: Importing FBX model with updated textures into unity creating duplicate textures when using "Extract Textures" I am trying to figure out the best way to update models, textures and materials. I have a city model (city.fbx) that comes into unity with baked textures and materials from C4D. I bring it in to unity, extract the textures into a local folder called  "Textures" and extract the materials into a local folder called "Materials". Everything is remapped automatically by Unity. Let's say I then update the model using a file syncing program which replaces city.fbx with the same model, but with updated textures. In this case, the textures have been updated to green, where as before they were blue textures. when I extract the textures into the local "Textures" folder, unity creates duplicate textures instead of replacing the old ones. So we now have buildingtexture (the old blue texture) & buildingtexture 1 (a new green texture) - what is the  correct way to import the updated model so as to avoid this?

sentences:
Can't read input from keyboard I'm new to game dev,and I just trying to create my first game,a simple pong game.But i can't handle the keyboard input.

This is what i got :

const Uint8 * keystates = SDL_GetKeyboardState(NULL);
SDL_PumpEvents();

if (_keystates[SDLK_s])
    std::cout << "Down is pressed";

But if i run it and press 's',nothing ever happens.

if (_keystates[SDLK_RETURN])
    std::cout << "Return is pressed";

For this one is working just when i press 'j'... Yeah,right?

And more,if I add this line :

if (_keystates[SDLK_DOWN])
    std::cout << "Bla bla..";

My game crashes,what do you think is the problem?Thank you.

sentences:
Why do Monsters drop things? Why do Monsters drop things in so many games?
It creates all sorts of problems, including:

in-game gold hyper-inflation

questionable moral implications, if there is a strong incentive toward killing things but no incentive not to

Monster-killing giving XP is equally bad - you rename an ingame currency to XP, the mechanics stay the same. Here you have something like "fighting force inflation," so after some levels you have to have giant giants attacking your small figure or it stops being interesting. This is just hyper-inflation written a different way.
Is it enough reward if a monster stops killing you?
What benefits of monster-killing rewards make up for these problems, or how can we compensate for those problems?

sentences:
Where to find animated matrix transformations in an fbx file? Where can I find matrix transformation animation data in an fbx file?

I have an fbx file with animations. I have successfully read the indices, matrix, and weight from it.

How can I get the frame-by-frame changes in the matrix? Unfortunately, I haven't been able to find the answer in the Autodesk documentation.

sentences:
Control how quickly 2D vehicle straightens out I'm implementing vehicle movement in a 2D environment, where a vehicle consists of a front and a back "axle", both represented as 2D points. When the front axle moves, the back axle should follow in that direction, mimicking the way vehicles move. The way I have it right now looks like this:

After moving the front point A (white), I place B on the line between A and B such that a constant distance (the vehicle length) is kept. More accurately, I use the vector from A to B, normalize it, multiply it with the vehicle length, and add it to A, to get the new B. When searching for similar issues, I found this question's answer to come to the same technique.
As you can see, the resulting movement is quite recognizable as vehicle movement. The front also does not need to move as smoothly. Below I moved the front manually by dragging it around. As you can see, backwards movement also works perfectly:

I want to use this movement system as the back bone of a puzzle game, so its stiffness is actually an asset, since it is also quite predictable.
The only issue that I have is that it takes a good while for the vehicle to straighten out, by which I mean have the back come in line with the travel direction of the front. I'm looking for a way to control how quick this happens.
I have already played around with biasing/weighing the back point onto the line on which the front appears to be traveling, but that resulted in weird moving behavior for any other scenario than moving in a perfectly straight line. I also haven't been able to think of a different system that would inherently straighten out quicker.
So... I'm happy to try out any ideas that you might have!
Thanks!
Update 1: I've implemented the idea from @GaleRazorwind. This results in the back point moving away from the front point:

sentences:
Is it ok to destroy mesh directly from MeshFilter in Unity? Mesh.Destroy(myGameObject.GetComponent<MeshFilter>());

May it cause any problems or undefined behaviour? (the reason I ask this is that I'm trying to destroy an exiting component which is returned from function.

sentences:
Keep a rigidbody velocity constant I have a "board" with a ball (rigidbody) moving over it and colliding with obstacles.

I want its velocity magnitude to remain constant throughout time.

How do I achieve this?

What I've tried/achieved so far:

My first guess was to use OnCollisionExit to set the velocity manually, but that lead to weird physics.
I don't see how to use AddForce to do this since the previous movement would still be factored.
To be clear, what i want is to set the velocity at all times to rigidbody.velocity.normalized x magnitude, where magnitude is a float I set previously. This would allow the physics engine to make all impact math to decide the direction of the ball after the collision, but my math would keep the velocity intact.
I then decided to add UpdatedFixed and on every call set the velocity as stated above. It's working, but feels like a bad hack because I'm updating the velocity every frame and forsaking the physics engine.

sentences: Sprite editor "minimum size" feature alternative in Unity 5 As you know , unity has been removed its minimum size feature in sprite editor multiple auto slice mode. In some pics Unity discovers a lot of tiny rubbish sprites for example as 4x3 or 10x5 pixels. Is there anyway to set minimum size for good auto slicing in Unity 5?

sentences:
Why is my OpenGL enabled Java game not detected by Fraps? Recently I found out that I could enable OpenGL hardware acceleration in my Java game with the line

System.setProperty("sun.java2d.opengl", "True");

Initial tests showed a big boost in performance. However, several days later I wanted to make a small test video using Fraps but I found out that it didn't recognize my application (as in the  FPS counter did not show and I could not record anything). After I removed the earlier mentioned line of code (thus disabling OpenGL hardware acceleration) it recorded just fine.

Is there any way to use Fraps while I have OpenGL enabled in my Java game?

sentences:
How to use batch rendering with an entity component system? I have an entity component system and a 2D rendering engine. Because I have a lot of repeating sprites (the entities are non-animated, the background is tile based) I would really like to use batch rendering to reduce calls to the drawing routine. What would be the best way to integrate this with an engtity system?

I thought about creating and populating the sprite batche every frame update, but that will probably be very slow. A better way would be to add a reference to an entity's quad to the sprite batch at initialization, but that would mean that the entity factory has to be aware of the Rendering System or that the sprite batch has to be a component of some Cache entity. One case violates encapsulation pretty heavily, while the other forces a non-game object entity in the entity system, which I am not sure I like a lot.

As for engine, I am using Love2D (Love2D website) and FEZ ( FEZ website) as entity system(so everything is in Lua). I am more interested in a generic pattern of how to properly implement that rather than a language/library specific solution.

Thanks in advance!

sentences:
How to set up Easy Mobile Pro to work with assembly defintions? I have a project with EMP imported, and now I would like to use assembly definitions to clean up my project a little bit. Everything works fine in the editor, but when I hit Build player script in my Addressables or just trying to Build I get a bunch of nasty error messages. When I switch to VS obviously there are no issues in the code editor.
I have asmdef files in:

Core folder in my Scripts folder, these are scripts created by myself. -asmdef
EMP-Editor folder -> this one references 3. -asmref
EMP-Scripts folder -asmdef

There are the kind of errormessages coming up(when trying to build only, there are 200 of them):

Assets\Plugins\EasyMobile\Editor\EM_BuiltinObjectCreator.cs(6,19): error CS0234: The type or namespace name 'SceneManagement' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Assets\Plugins\EasyMobile\Editor\EM_SettingsEditor_Privacy.cs(9,24): error CS0234: The type or namespace name 'SerializedProperty' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Assets\Plugins\EasyMobile\Editor\EM_SettingsEditor_Privacy.cs(10,24): error CS0234: The type or namespace name 'EditorStyles' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

I tried adding a refernece to the Unity.Editor dll in VS to the EMP assembly, but VS just doesn't do anything, no errors, no messages...Tried the same in asmdef file in Unity with no luck...

I got the inspiration from this video, and it was working ok...

Unity 2019.3
VS 2019
Android platform
EMP 2.5.2

Thanks

sentences:
How can I provide an instance of a certain script to all scripts that need it? Problem
Whenever a player is added to the game (in the form of the server instantiating a player Game Object with a Player component), I want to provide it to every script that needs a reference; in other words, dependency injection.
Potential Solutions
I thought I'd create an IPlayerRequester interface and have the Player script look up all implementing scripts on the client when it's created, but Unity has no interface-searching equivalent of FindObjectsOfType<>().
More Info
The game is multiplayer, where 1 player is the host — a client and the server — that is joined by other clients.
I'm using Mirror.
When a new client is added, the Player script's (that was just spawned) callback OnStartLocalPlayer() is invoked, and so far, that's the only way I've found to access the local environment.
But because this is the same Player that I'm trying to inject into requesting scripts, I can't just raise an event in that method, so that's out.

What would be a good solution here?

sentences:
Shader - Realtime texture masking The first thing that comes in mind is masking using RGBA values. With this you can obtain this kind of textures and this kind of results.

But with this, you can only store up to 4 masks inside a texture and blend between maximum 4 textures.

I am wondering if there's a way to store more than 4 masks inside a texture and being able to blend more than 4 textures using this mask texture. The aim would be to store as much as possible masking data inside a texture.

Is it possible ? How ?

sentences:
What data structure to use for the map in Pac-Man? I am trying to make a Pac-Man game in C# using GDI+. I have done some basic work and I have previously replicated games like Copter-It and Minesweeper, but I am confused about how I can implement the map in Pac-Man. I mean: which data structure to use, so I can use it for moving AI controlled objects and check collisions with walls.

I thought of a 2D array of ints but that didn't make sense to me. Looking for some help.

sentences:
How can I reduce the performance impact of rendering trees? I'm making a low poly stylized kind of game. I have a terrain with some water, and I want lots and lots of trees; I have 10,000 trees mass placed, at the moment. Each tree consists no more than 200 triangles, so they aren't too taxing.

The main problem is, there are lakes, and the lakes are quite large. You can't actually see any trees on the other side of the lake, and that looks really bad, especially when you walk there and trees suddenly appear.

To fix this, I have to increase the tree distance so that you can see a decent amount of trees on the other side of the lake, but that reduces performance to 40-50fps, and there is hardly anything else in the game yet. I'm using a GTX 1080, if that helps.

What can I do to make my game run faster with more trees?

sentences: How to take advantage of multiple core GPUs I'm interested in developing for the new Nexus 7 tablet when it finally arrives.  I've done a little OpenGL development for Android but I'm not sure what I have to do to take advantage of the 12-core GPU on the Nexus 7.  Does OpenGL take advantage of the cores for you (in some/all cases); if not, how do I specify which core does what, synchronize between them etc?

sentences:
How to protect your real time online shooter from potential bots I'm looking to create a multiplayer top down shooter. While I've read about different topics, I can see them I've got some real challenges ahead, but I'm all up for it.

One thing I can't understand is how am I supposed to be protecting the game from people who try to create bots?

What I mean is, as far as I understand, it's impossible to protect the network traffic in a way that players won't be able to create programs that listen to what's going on and understand it.

So what worries me is that people can create bots that listen to the current location of rival players, and send communication that mimic as if the player is shooting in the exact "perfect" location to win that match.

So what kind of techniques are used to protect real time games from such bots?

Also I'd like to mention that I've tried searching for discussions (as this sounds like something many people struggle with), but couldn't find anything about it specifically, only as a part of broader questions about networking in real time games. If I should have looked harder feel free to put me in my place :)

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:
adventure game architecture I would like to make an adventure type game functioning similarly to machinarium or broken sword. The only way I can think of doing this is to draw an image as a background on a canvas and use some animated sprites that moves around and responds to touches on the screen.

But having a runnable that keeps re-drawing the canvas seems like a waste of memory to me, especially when it comes to larger images like the background.

I'm pretty new to game development and canvas animations and I was wondering if anyone could point me in the right direction? What would be good training for an adventure type game?

sentences:
Behavior tree implementation details I have been looking around for implementation details of behavior trees, the best descriptions I found were by Alex Champarand and some of Damian Isla's talk about AI in Halo 2 (the video of which is locked up in the GDC vault sadly).

However, both descriptions fall short of helping one actually create a BT, one particular question has been bugging me for a while.

When is the tree in a behavior tree evaluated?

Furthermore:

If the tree is in the middle of executing a sequence of actions (patrolling waypoints) and a higher priority impulse comes in (distraction sound) , how to switch to that side of the tree seamlessly without resorting to a state machine like system and if it is decided that the impulse was irrelevant (the distraction is too far away to affect this guard), how to go back to the last thing that the guard was doing ?

I have quite a few questions like this and I don't wish to flood the board with separate queries so if you know of any resource where questions like these can be answered I would be very grateful.

sentences:
How to distort graphics in a wave-like way? I saw a certain graphics distortion effect on multiple games over time and am interested in doing it in 2D. It is like a wave-like texture distortion, I am not entirely sure what it is called actually. Super Mario 64 had an effect like that when you enter a painting depending on your position (https://www.youtube.com/watch?v=H6r5oF73gNI#t=72), also Braid has one which is even more similar to that what I am trying to achieve when you use the time ring (https://www.youtube.com/watch?v=uqtSKkyJgFM#t=38).

I would really like to know how those effects were implement and if there is support for something like that in LWJGL (or even Slick2D). So far, I found absolutely nothing explaining on how it was done.

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:
How do they keep track of the NPCs in Left 4 Dead? How do they keep track of the NPC zombies in Left 4 Dead?

I am talking about the NPCs that just walk into walls or wander around aimlessly. Even though the players cannot see them, they are there (say inside rooms or behind doors). Let's say there's about 10 or so zombies in a hallway and inside rooms. Does the game keep all of those zombies in a list and iterate through giving them commands? Do they just spawn when the user is within a certain radius or reached a special location?

Say you placed the 4 units (controlled by players) on completely different places throughout the map. Let's assume you aren't being swarmed and then you have not killed any of these aimless NPCs. Would the game be keeping track of 10 x 4 = 40 zombies in total?

Or is my understanding completely off?

The reason I ask is if I were to implement something similar on a mobile device, keeping track of 40 or more NPCs might not be such a great idea.

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:
How to prevent showing outside of Game Map ( Cocos2D-x ) ( Scrolling game ) I'm trying to make a tower defense game and it can zoom in/out and scrolling over my world map. How to scroll over the game and how to restrict it not to show outside of my map(black area).

At below I scroll over the map by using CCCamera but I don't know how I can restrict it.

CCPoint tap = touch->getLocation();
CCPoint prev_tap = touch->getPreviousLocation();
CCPoint sub_point = tap - prev_tap;

float xNewPos, yNewPos;
float xEyePos, yEyePos, zEyePos;
float cameraPosX, cameraPosY, cameraPosZ;

// First we get the current camera position.
GameLayer->getCamera()->getCenterXYZ(&cameraPosX, &cameraPosY, &cameraPosZ);
GameLayer->getCamera()->getEyeXYZ(&xEyePos, &yEyePos, &zEyePos);

// Calculate the new position
xNewPos = cameraPosX - sub_point.x;
yNewPos = cameraPosY - sub_point.y;

GameLayer->getCamera()->setCenterXYZ(xNewPos, yNewPos, cameraPosZ);
GameLayer->getCamera()->setEyeXYZ(xNewPos, yNewPos, zEyePos);

And for zooming I used such code:

GameLayer->setScale(GameLayer->getScale() + 0.002); //zooming in

sentences:
Android Swipe In Unity 3D World with AR I am working on an AR application using Unity3D and the Vuforia SDK for Android. The way the application works is a when the designated image(a frame marker in our case) is recognized by the camera, a 3D island is rendered at that spot. Currently I am able to detect when/which objects are touched on the model by raycasting. I also am able to successfully detect a swipe using this code:

if (Input.touchCount > 0)
{
         Touch touch = Input.touches[0];

         switch (touch.phase)
         {
                case TouchPhase.Began:

                    couldBeSwipe = true;

                    startPos = touch.position;

                    startTime = Time.time;

                break;

                case TouchPhase.Moved:

                    if (Mathf.Abs(touch.position.y - startPos.y) > comfortZoneY)
                    {

                        couldBeSwipe = false;

                    }
                    //track points here for raycast if it is swipe
                break;

                case TouchPhase.Stationary:

                    couldBeSwipe = false;

                break;

                case TouchPhase.Ended:

                    float swipeTime = Time.time - startTime;

                    float swipeDist = (touch.position - startPos).magnitude;

                    if (couldBeSwipe && (swipeTime < maxSwipeTime) && (swipeDist > minSwipeDist))
                    {

                        // It's a swiiiiiiiiiiiipe!

                        float swipeDirection = Mathf.Sign(touch.position.y - startPos.y);

                        // Do something here in reaction to the swipe.
                        swipeCounter.IncrementCounter();
                    }

                break;

            }

         touchInfo.SetTouchInfo
          (Time.time-startTime,(touch.position-startPos).magnitude,Mathf.Abs (touch.position.y-startPos.y));
       }

Thanks to andeeeee for the logic. But I want to have some interaction in the 3D world based on the swipe on the screen. I.E. If the user swipes over unoccluded enemies, they die. My first thought was to track all the points in the moved TouchPhase, and then if it is a swipe raycast into all those points and kill any enemy that is hit. Is there a better way to do this? What is the best approach?

Thanks for the help!

sentences: RTS engine tick rate I've seen some varying tick rates used for RTS engines. Supreme Commander ran at a super-low 10 ticks per second. Is this normal for RTS engines, or do they normally have a higher tick rate?

sentences:
How can I use ImGui to render simple text instead of using stb_truetype directly? Since ImGui builds on top of stb_truetype for its font rendering, I thought it could be nicer to use its already built font-processing capabilities (ImGui::GetIO().Fonts), and render with those, instead of using stb_truetype directly.

However, I've been having trouble figuring out how to do this, specifically how to get quad position/texture coordinates for a given string to use with the preloaded texture at ImGui::GetIO().Fonts->TexID.

I'm not looking to draw buttons/text inside ImGui windows, all I want to do is to use ImGui to build vertex data for a given string so that I can render it anywhere.

sentences:
SDL TTF render variable This is the way I render the score in my main game , and I made this new project to understand how to use it... It works , the score is updated and it display on the screen but the problem is memory... it increase forever , from 20mb when I start untill it runs out of memory..it nevers stop. And in the main game it's working at 2fps... I hate TTF I just can't understand how it works and how should I do it... every tutorial is in c++ and I have to make the game in pure C for college...Help.

#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <SDL.h>
#include <SDL_ttf.h>
#include <SDL_image.h>

int main(int argc, char ** argv)
{
    bool quit = false;
    SDL_Event event;

    SDL_Init(SDL_INIT_VIDEO);
    TTF_Init();

    SDL_Window * window = SDL_CreateWindow("Example",SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640,480, 0);
    SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, 0);
    SDL_Surface * surface;
    SDL_Texture * texture;

    int score = 0;
    char buffer[50];
    int texW = 0;
    int texH = 0;
    TTF_Font * font = TTF_OpenFont("font3.ttf", 25);
    SDL_Color color = { 255, 255, 255 };

    while (!quit)

    {
        SDL_RenderClear(renderer);

        SDL_WaitEvent(&event);
        switch (event.type)
        {
        case SDL_QUIT:
            quit = true;
            break;
        }

        score += 100;
        sprintf(buffer, "SCORE: %d", score);

        surface = TTF_RenderText_Solid(font, buffer, color);
        texture = SDL_CreateTextureFromSurface(renderer, surface);
        SDL_QueryTexture(texture, NULL, NULL, &texW, &texH);

        SDL_FreeSurface(surface);
        SDL_Rect dstrect = { 0, 0, texW,texH };
        SDL_RenderCopy(renderer, texture, NULL, &dstrect);

        SDL_RenderPresent(renderer);
    }

    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_DestroyTexture(texture);
    TTF_CloseFont(font);

    TTF_Quit();
    SDL_Quit();

    return 0;
}

sentences: Should I preload interstitial ads when my game starts? I just recently added interstitial ads to my game. I loaded my interstitial ads when the main game actually starts so it wouldn't take long to load after the user exits to the menu, but on profiling the memory usage, I realized that there are a lot of ad related allocations that are causing the gc to run wild. Is it that I should only request ads when I need them?

sentences:
Debugging an AMD GPU specific problem without an AMD GPU I've recently started to receive reports from users that I game I'm working on isn't rendering properly on AMD GPUs. I'd like to track down the problem and fix it, but I'm a hobby developer just using my own computer and I don't have an AMD GPU.

Do I have any options here besides going out and buying another graphics card? Perhaps some sort of emulator or a cloud compute service with AMD GPUs? I've looked at the major cloud compute providers (AWS, Google Cloud and Azure) but they all seem to offer only Nvidia GPUs.

sentences:
Assigning bone transform in every draw a good idea? In my Draw method, I am doing the following:

thisMesh.CopyAbsoluteBoneTransformsTo(transforms);

Is this a good idea?  Or should I do this once at the constructor level?

sentences:
Multiple lights shadows I'm trying to achieve multiple lights shadows. Currently my program works using only 1 spotlight as a light source that produces shadows. Well... I want to involve multiple lights to give a more realistic effect to my scene.

However, I'm facing a scenario which is a little bit unclear for me:

The steps I follow to create shadows is

a) Create FBO

b) Render scene from light's perspective using a depth texture attached to my FBO

c) Render the scene normally, using my texture from my FBO as a shadowmap texture in order to be able to sample it and creating finally shadows.
The steps I follow to create multiple shadows is

a) Create FBO1 and FBO2

b) Render scene from 1st light's perspective using a depth texture attached to my FBO1

c) Render the scene normally, using my texture from my FBO1 as a shadowmap texture in order to be able to sample it and creating finally shadows.

d) Render scene from 2nd light's perspective using a depth texture attached to my FBO2

e) Render the scene normally, using my texture from my FBO2 as a shadowmap texture in order to be able to sample it and creating finally shadows.

Now, the step 1) is pretty clear, works fine. When I manage to implement step 2), something happens: the shadows rendered will be the shadows of my last light (depending the order I call rendering methods). So in this case I get shadows only from my 2nd light.

If I reverse the order of calls (this order: a -> d -> e -> b -> c) and render first in my second FBO and then in my first FBO I get the shadows from my first light source. So basically I conclude: my shadows are not working simultaneously.

Is this the correct approach? (I've seen a solution which uses in fragment shader an array of shadowMaps, an array of lightSpace coordinates so this involves multiple uniforms... what do you think about this?)

Thanks

sentences:
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:
OpenGL picking performance: ray casting vs. color picking I am curious of how the performance of color picking compares to ray casting. I am looking at the scenario when the mouse is clicked which means only then the scene is rendered in a backbuffer for color picking or ray-cating has to be applied.

Note: I have found this question which unfortunatly does not give any indication.

sentences:
How can I prevent other applications from interrupting my game's exclusive fullscreen mode? I am developing a game using D3D 11.

When I  got a pop-up message from a chat client (HipChat), my game's full screen mode is disabled because IDXGISwapChain::Present returns DXGI_STATUS_OCCLUDED. How can I avoid or prevent this? I don't want my game's exclusive full-screen access interrupted.

sentences:
Creating a Player object in a physics engine I have a working physics environment using Farseer - but how do I create a player object that can walk around?

My current attempt involves applying forces to a rectangular body whenever keys are pressed.

This... works... to some degree. The player box moves around and such, after significant angle damping doesn't flip over much either. But I want a smooth moving simple player that can walk around and climb slopes but not walls and stuff like that. As it currently stands, the player object can climb any slope no matter how steep due to continue sideways force being applied. The player also does not stop quickly, but rather slides heavily due to low friction - and raising the player body's friction value doesn't help all that much.

I just don't know how to do a standard player object without making it move around in ridiculous ways due to the physics engine being a full physics engine.

sentences: AndEngine: Painting on a canvas rather than composing image from objects I'm trying to implement drawing a line with a finger, similar to a Pencil tool in image editors. From what I've found on AndEngine, it seems like the recommended approach would be to create a line entity on every finger move, from the previous position to the new one. To me it seems rather inefficient to mimic this raster tool by vector graphics: apart from creating tens on objects per simple swipe, I guess that all these objects are repainted on each frame which is bad for speed. So I'm looking for a way to do all the painting on a bitmap canvas and draw it as a single entity. Am I missing something conceptually or did I just overlook some method?

sentences:
Handling Unity Animations In C# Script So, I'm fairly new to coding with unity and c#, and I want to change my animations based on the player's mouse position. This is my script so far:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour {
    public float moveSpeed = 2f;
    private bool right = true;
    private bool left = false;
    private bool up = false;
    private bool down = true;
    public Animation rightUpAnim;
    public Animation leftUpAnim;
    public Animation rightDownAnim;
    public Animation leftDownAnim;
    public string horizontalAxis;
    public string verticalAxis;
    private Vector2 movement = Vector2.zero;
    private Rigidbody2D rb;
    public Transform tf;
    public Animator an;

    private void Start() {
        rb = GetComponent<Rigidbody2D>();
    }
    void Update() {
        movement.x = Input.GetAxisRaw(horizontalAxis);
        movement.y = Input.GetAxisRaw(verticalAxis);
    }
    private void FixedUpdate() {
        rb.MovePosition(rb.position + movement * moveSpeed * Time.deltaTime);
        var mousePos = Input.mousePosition;
        mousePos.x -= Screen.width / 2;
        mousePos.y -= Screen.height / 2;
        if (mousePos.y > tf.position.y) {
            up = true;
            down = false;
        }
        else if (mousePos.y < tf.position.y) {
            down = true;
            up = false;
        }

        if (mousePos.x > tf.position.x) {
            right = true;
            left = false;
        }
        else if (mousePos.x < tf.position.x) {
            left = true;
            right = false;
        }

        if (left && up) {
            an.controller = leftUpAnim;
        }
        else if (right && up) {
            an.controller = rightUpAnim;
        }
        else if (left && down) {
            an.controller = leftDownAnim;
        }
        else if (right && down) {
            an.controller = rightDownAnim;
        }
    }
}

However, I get an error saying that 'Animator' does not contain a definition for 'controller'. What is the correct way to do this?

sentences:
Handling Different Aspect Ratios for a Multiplayer Game I'm currently designing a competitive 2D, side-scrolling multiplayer game and I want support full screen play at any aspect ratio (e.g., 4:3, 5:4, 16:10, 16:9). Doing that is not so much a problem, my concern is that the viewable area of the game for a player with a 4:3 monitor will differ from that of a player with a 16:9 monitor quite a bit. In a competitive multiplayer game where being able to see more of the game world gives a player a significant advantage over players who cannot this is a serious problem.

So far I've come up with two possible solutions for this:

Just support different aspect ratios and don't worry about it.
Pick a specific aspect ratio (say 16:9) and do a best fit on all other aspects (i.e., letterbox or pillarbox)

Option 1 doesn't suit me because it's a lazy cop out. Option 2 is much better but then a portion of the screen will be unused for some players. Certainly not the end of the world but not incredibly desirable either. This could be mitigated by rearranging the UI based on the aspect ratio and filling the letter/pillarbox with UI elements instead of simple black bars making better use of available screen real estate.

How is this sort of thing handled in games like Quake, CoD, StarCraft and Battlefield?

sentences:
Pygame Fullsreen Display Issue Code:

import pygame
pygame.init()
#
def Main(display,colors):
    clock =pygame.time.Clock()
    #
    surface = pygame.Surface(surface_resolution) # Create main surface
    surface.fill(colors["RED"])
    pygame.draw.rect(surface,colors["GREEN"],pygame.Rect((0,0),(110,110)))
    pygame.draw.rect(surface,colors["BLUE"],pygame.Rect((10,10),(100,100)))
    #
    while True:
        clock.tick(60)
        #
        for event in pygame.event.get(): # Main event loop
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE: # Exit game with Escape key
                    pygame.quit()
                    return
        #
        display.fill(colors["WHITE"]) # Fill the display white
        display.blit(surface,(display.get_size()[0]/2-surface.get_size()[0]/2,display.get_size()[1]/2-surface.get_size()[1]/2)) # Blit main surface on center of display
        #
        pygame.display.flip()
#
if __name__ in "__main__":
    global resolution
    global surface_resolution
    resolution =         (1920,1080) # Resolution of the display
    surface_resolution = (1536,864)  # Resolution actually seen
    #
    #
    display = pygame.display.set_mode(resolution,pygame.FULLSCREEN) # Create fullscreen display
    #
    colors = {                 # Defign colors
        "WHITE":(255,255,255),
        "RED"  :(255,0,0),
        "GREEN":(0,255,0),
        "BLUE" :(0,0,255),
        "BLACK":(0,0,0)
    }
    #
    Main(display,colors) # Run main loop

I have been experimenting with various resolutions in fullscreen Pygame. My new computers native resolution is 1920x1080 as apposed to my old computers resolution of 1366x768, so I started to test resolutions higher than 1366x768. However, when I run pygame with my native resolution, the highest resolution that fits my monitor is 1536x864 with the rest of the primary display off the screen.

This code creates a red surface with a 110x110 rectangle in the upper left corner and blits it to the center of the display. When I set the surfaces size to anything higher than 1536x864, parts of the 110x110 rectangle are cut off, and when I set the display and the surface size to 1366x768, Pygame stretches the display to fill my moniter.

The pygame display docs say that:

  When requesting fullscreen display modes, sometimes an exact match for the requested resolution cannot be made. In these situations pygame will select the closest compatible match. The returned surface will still always match the requested resolution.

However, when I run the following code to get all the available fullscreen resolutions, I see that 1920x1080 is an available resolution.

>>> for mode in pygame.display.list_modes():
        print(mode)
(1920, 1080)
(1680, 1050)
(1600, 900)
(1440, 900)
(1400, 1050)
(1366, 768)
(1360, 768)
(1280, 1024)
(1280, 960)
(1280, 800)
(1280, 768)
(1280, 720)
(1280, 600)
(1152, 864)
(1024, 768)
(800, 600)
(640, 480)
(640, 400)
(512, 384)
(400, 300)
(320, 240)
(320, 200)
>>>

My question is why does this happen, and how can I stop Pygame from stretching the display in this manner? I feel like I'm completely missing the point with this, but I couldn't find anything about this anywhere else.

sentences:
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:
Sprite quickly disappears after rendering I'm currently making space invaders and I'm using the game loop pattern as described here. I have an entity class from which there is a spaceship derived class. The base entity class contains all of the general entity data such as the x/y position, speed, etc...
Currently, I have the X and Y positions initialized to (0,0) so the spaceship is rendered in the center of the screen. I tried initializing the y position to a different coordinate corresponding to a position, but for some reason, the spaceship just keep moving vertically as if the y position is just being accumulated at each frame. I think the problem is caused by the fact that in my render() method of the spaceship class, I'm translating the modelmatrix with the x and y position of the spaceship as that would explain why there isn't vertical movement when the coordinates are (0,0). I'm not sure exactly if this is the proper way to structure the render() method but I couldn't think of another way to change the object's position. Below is the relevant code:
Spaceship class definition:
class Spaceship : public Entity {
public:
    Spaceship(float xDirect, float yDirect,
        float xPosition, float yPosition, float speed, float rState, ShaderProgram* program, SheetSprite newSprite, bool movingLeft, bool movingRight):
        Entity(xDirect, yDirect, xPosition, yPosition, speed, rState, program, newSprite), movingLeft(movingLeft), movingRight(movingRight)
    {
        posY = 0.1;
    }

    virtual void Update(float elapsed) {
        // move stuff and check for collisions

        if (movingLeft) {
            posX -= elapsed* 0.001;
        }

        else if (movingRight) {
            posX += elapsed * 0.001;
        }
    }

    virtual void Render() {
        setOrthoProj();
        setObjMatrices();
        translateObj(posX, posY, 0.0);
        mySprite.Draw();
    }
    bool movingLeft;
    bool movingRight;
};

Initialization Code in main
Spaceship* spaceship = new Spaceship( 1.0f, 1.0f, -5.1f, 0.0f, 3.0f, 0.0f, program,mySprite, false, false);
    spaceship->Render();

Game Loop movement code
    const Uint8 *keys = SDL_GetKeyboardState(NULL);

    if (keys[SDL_SCANCODE_LEFT]) {
        spaceship->movingRight = false;
        spaceship->movingLeft = true;
        spaceship->Update(elapsed);

    }
    else if (keys[SDL_SCANCODE_RIGHT]) {
        spaceship->movingLeft = false;
        spaceship->movingRight = true;
        spaceship->Update(elapsed);

    }
    spaceship->Render();

For some reason, the first render() call outside of the loop isn't rendering the spaceship, only the one inside the loop works.
Given the structure of the program, what could be causing the problem?
EDIT
Translate method from Entity base class
void translateObj(float x, float y, float z) {
        posX = x;
        posY = y;
        modelMatrix.Translate(posX, posY, 0.0);
    }

void setObjMatrices() {
        glUseProgram(program->programID);
        program->setModelMatrix(modelMatrix);
        program->setProjectionMatrix(projectionMatrix);
        program->setViewMatrix(viewMatrix);

    }

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:
Importing fbx models made in Cinema4D in unity at runtime In my app I have requirement that I will be given a url and using this url I have to download a fbx model and then show it in the scene.

I am able to download the model from the url using the below code.

IEnumerator loadModel(string modelName)
{
    if (!isDownloaded)
    {

        string targetUrl = "http://XXX.XXX.X.XX:3000/" + modelName;
        Debug.Log("targetUrl" + targetUrl);
        WWW www = new WWW(targetUrl);

        yield return www;
        if (www.isDone)
        {
            Debug.Log("downloaded " + www.bytesDownloaded);
            var path = System.IO.Path.Combine(Application.dataPath+"/Resources", modelName);

            System.IO.File.WriteAllBytes(path, www.bytes);
            isDownloaded = true;

            LoadAndAttachModel(imageTargetTransform, modelName);
        }
        else
        {
            Debug.Log(www.bytesDownloaded);
        }
    }
}

And with the below code I tried using loading the model in the scene

public void LoadAndAttachModel(Transform parent, String modelName)
{
    Debug.Log(modelName);
    var path = System.IO.Path.Combine(Application.dataPath + "/Resources", modelName);
    String name = modelName.Substring(0, modelName.IndexOf("."));
    GameObject load = Resources.Load(modelName) as GameObject;
    Debug.Log(load.name);
    if (load != null)
        {
           // load.transform.parent = parent;
            load.transform.localPosition = Vector3.zero;
            load.transform.localRotation = Quaternion.Euler(new Vector3(90, 90, 0));
            load.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
        }

    else
    {
        Debug.LogWarning("Can't find boneName : " + parent);
    }
}

but this code always gives exception that the gameobject load is null. I tried with the obj model and that was working fine but with fbx models this is giving exception every time.

So how can I instantiate the downloaded gameobject in my scene ?

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:
Creating an object in javascript with unity (unityscript) So I have a ton of experience with JavaScript (its what I do for a living) but I am new to unity. I have built a game engine in javascript but now want to move it over to unity. I have been trying to implement my player class but am running into this error.

I have a getter function for my level_up stats. and inside of my level_up function I call that getter function and store it now I know this would work in normal javascript but its not in unity and I have having a heck of a time googling any information on objects in unityscript. Here is the relevant code:

function level_getter(){
    return {base_level_exp : float , lvl_exp_modifier : float , current_level : int};
}

function level_up(){
    var level_object = new Object();
    level_object = level_getter();

    level_object.current_level += 1;
    level_object.base_level_exp = level_object.base_level_exp * level_object.lvl_exp_modifier;

    level_setter(level_object.base_level_exp, level_object.lvl_exp_modifier, level_object.current_level);

}

I guess my first question is, is it even valid to return an object like that in unityscript?(in the level_getter() function). If its not valid what do people suggest I do instead. Set a getter function for each var? My second is how do I declare level_object so that it can accept the return if it is valid, and so that I can access the members of the object.

I have been looking around at tutorials and google for several hours now and have found nothing to clear up my confusion over objects in unityscript. So any help would be appreciated.

sentences:
Does allocating and freeing a huge chunk of memory at startup "clean up memory?" The book Game Coding Complete, Fourth Edition, chapter 5 (Game Initialization and Shutdown), section Checking Memory contains this interesting code sample:

bool CheckMemory(const DWORDLONG physicalRAMNeeded, const DWORDLONG virtualRAMNeeded)
{
    MEMORYSTATUSEX status;
    GlobalMemoryStatusEx(&status);
    if (status.ullTotalPhys < physicalRAMNeeded)
    {
        // you don’t have enough physical memory. Tell the player to go get a
        // real computer and give this one to his mother.
        GCC_ERROR("CheckMemory Failure: Not enough physical memory.");
        return false;
    }
    // Check for enough free memory.
    if (status.ullAvailVirtual < virtualRAMNeeded)
    {
        // you don’t have enough virtual memory available.
        // Tell the player to shut down the copy of Visual Studio running in the
        // background, or whatever seems to be sucking the memory dry.
        GCC_ERROR("CheckMemory Failure: Not enough virtual memory.");
        return false;
    }

    char *buff = GCC_NEW char[virtualRAMNeeded];
    if (buff)
    {
        delete[] buff;
    }
    else
    {
        // even though there is enough memory, it isn't available in one
        // block, which can be critical for games that manage their own memory
        GCC_ERROR("CheckMemory Failure: Not enough contiguous memory.");
        return false;
    }
}

This raises some questions.

The first part just asks the OS (Windows) how much physical RAM is available.
The curious part is the second one, which allocates a huge chunk of memory and frees it right away:

char *buff = GCC_NEW char[virtualRAMNeeded];
if (buff)
{
    delete[] buff;
}

The author goes on to explain:

  ... this function allocates and immediately releases a huge block of memory.
  This has the effect of making Windows clean up any garbage that has accumulated in the memory manager
  and double-checks that you can allocate a contiguous block as large as you need. If the call succeeds,
  you've essentially run the equivalent of a Zamboni machine through your system's memory,
  getting it ready for your game to hit the ice...

But I have my reservations on that.

"Cleaning garbage that has accumulated in the memory manager?" Really? If the game has just started, shouldn't there be no garbage?

"Making sure you can allocate a contiguous block?" In the very specific case where you are going to manage memory yourself, this would them make some sense, but still, if you do allocate a lot of memory right of the bat, you pretty much make it impossible for any other application to run in the system while yours is on.

Also, isn't this likely to force the OS to commit all that memory, and as consequence evict a lot of memory to the swap disk space, slowing your app startup a lot?

Is this really a good practice?

sentences:
Unity particles rendering on top of camera space UI I'm using LWRP in Unity 2019.1.12f1. The UI is in Screen Space - Camera. The shader used for the particles is Lightweight Render Pipeline/Particles/Unlit (Transparent, Premultiply).

Any ideas?

sentences:
How to have real time (blood) traces? https://www.youtube.com/watch?v=Tzf3zjPJYw4

In this game, Ink, color blobs fall then they create pretty color spots.

The color traces are unlike any other game.

For an example, in Super Meat Boy https://www.youtube.com/watch?v=snaionoxjos

The red traces of SM Boy was more of sprites aligned across the surfaces of the object.

The trace in game Ink is different from those traditional traces of other games because...

They stack infinitely.
Come in many different shapes.

The approaches I can think of are...

Prepare many different shapes sprites, then put then where traces should be.
Assign each block with their own texture, then draw the traces on that texture.

The issues I see however are...

First solution will lead to having many-MANY-MANY sprites being generated to look as if the traces are being drawn upon the object.
Heavy calls between GPU and CPU. Keep drawing traces while uploading drawn new texture onto the GPU to be rendered. Significantly slowing down the game.

I don't have a good computer. My computer cannot handle either approach 1 or 2. But it can the run the game Ink.

So I am assuming Ink must use some sort of clever approach to handle this crucial visual aspect of the game. But I am out of ideas.

sentences:
Still having problems using Json data in Unity I have the following classes and json file, i thought id followed the documentation exactly but I am clearly wrong. Can anyone see why I get an error just saying : INVALID VALUE in my unity console:

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

[Serializable]
public class DataReader
{
public float[] x;
public float[] y;
public float[] z;
}

GameController:

public class GameController : MonoBehaviour {
    public static GameController instance;

DataReader dataReader;

private string gameDataFileName = "level1.json";

private void Awake()
{
    dataReader = JsonUtility.FromJson<DataReader>(gameDataFileName);
    instance = this;
}

void Start () {

    // create level:
    print("DATA: " + dataReader.x[0]);
}

}

and the json is stored in StreamingAssets folder (I also tried a copy in Resources folder):

{
"x": [{1},{1},{1},{1}],
"y": [{1},{1},{1},{1}],
"z": [{1},{2},{3},{4}]
}

sentences:
iSGL3D Occlusion Culling I was testing a cool 3D Scene Graph Library called iSGL3D. Since I found some functions called alpha culling for displaying partly hidden objects (making the ones in front transparent). I was wondering if it's possible to also do dynamic occlusion culling.

I know there are several descriptions for that like View Frustum Culling, Hidden Surface Detection, Hidden Surface Removal, but I can't find anything with google or on their homepage.

sentences:
Deep Cloning C++ class that inherits CCNode in Cocos2dx I'm stuck with something in Cocos2dx ...

When i copy my class that inherits CCNode, i get a shallow copy of my class but the base type seem to still point to the original node address. We dont seem to get a deep clone of any object that inherits CCNode, any ideas anyone?

Basically i have....

GameItem* pTemp = new GameItem(*_actualItem);

// loops through all the blocks in gameitem and updates their position
pTemp->moveDown();

    // if in boundary or collision etc...
if (_gameBoard->isValidMove(pTemp))
{
    _actualItem = pTemp;

    // display the position
    CCLog("pos (1) --- (X : %d,Y : %d)",  _actualItem->getGridX(),_actualItem->getGridY());
}

Then doesn't work, because the gameitem inherits CCNode and has the collection of another class that also inherits CCNode with is a pointer.

its just creating a shallow copy and when you look at children of the gameitem node in the copy, it still just points to the original base type?

class GameItem : public CCNode {

// maps to the actual grid position of the shape
CCPoint* _rawPosition;
// tracks the current grid position
int _gridX, _gridY;
// tracks the change if the item has moved
CCPoint _offset;

public:
//constructors
GameItem& operator=(const GameItem& item);
GameItem(Shape shape);

}

then in the implementation....

GameItem& GameItem::operator=(const GameItem& item)
{
_gridX = item.getGridX();
_gridY = item.getGridY();
_offset = item.getOffSet();
_rawPosition = item.getRawPosition();

// how do i copy the node?

return *this;
}

Any ideas are welcome at this point!!

thanks

sentences:
How to draw texture to screen in Unity? I'm looking for a way to draw textures to screen in Unity in a similar fashion to XNA's SpriteBatch.Draw method. Ideally, I'd like to write a few helper methods to make all my XNA code work in Unity. This is the first issue I've faced on this seemingly long journey.

I guess I could just use quads, but I'm not so sure it's the least expensive way performance-wise. I could do that stuff in XNA anyway, but they made SpriteBatch not without a reason, I believe.

So I see there is some sort of GUI notation in Unity. Maybe I could efficiently draw everything using it?

sentences:
How can I have more values in array on X axis than Y axis in my tilemap? Following my old question Array of map data renders the map the opposite way after I got the answer to it and fixed my problem, I got another problem that occurs. If my mapArray[] is bigger on X axis than Y axis, I get

  script.js:113 Uncaught TypeError: Cannot read property '0' of undefined

So if my array looks like this, for example:

[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],

I get an error. If I change it to this:

[2, 2, 2, 2, 2, 2,],
[2, 2, 2, 2, 2, 2,],
[2, 2, 2, 2, 2, 2,],
[2, 2, 2, 2, 2, 2,],
[2, 2, 2, 2, 2, 2,],
[2, 2, 2, 2, 2, 2,],
[2, 2, 2, 2, 2, 2,],
[2, 2, 2, 2, 2, 2,],
[2, 2, 2, 2, 2, 2,],

(more values vertically) it works fine. I know that it has to do with my loop condition:

for (let i = 0; i < mapArray.length; i++) {
    for (let j = 0; j < mapArray[i].length; j++) {

j < mapArray[i].length this is not true if j is bigger than i length. Makes sense. But if I change the comparison < value to > I don't get drawn on the canvas anything but the white bg only.

My question: How can I have a big mapArray horizontally so that I could scroll it and have big game world without making it huge on the y axis as well?

Code:

var mapArray = [
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
  [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0],
  [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
];

function render(viewport) {
  context.save();
  if(Math.floor(boatPosX / 36) < 10) {
    context.translate(view.x, view.y);
  }

  requestAnimationFrame(render);
  var oldPosX = boatPosX;
  var oldPosY = boatPosY;

  for (let i = 0; i < mapArray.length; i++) {
    for (let j = 0; j < mapArray[i].length; j++) {

      if (mapArray[j][i] == 0) {
        this.sprite.draw(
          background,
          190,
          230,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );
      }
      if (mapArray[j][i] == 1) {
        this.sprite.draw(
          background,
          30,
          30,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );

      }
      if (mapArray[j][i] == 2) {
        this.sprite.draw(
          background,
          200,
          20,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );
      }
    }
  }
  this.ship.drawimage(boat, boatPosX, boatPosY, 50, 50);

  if(isPositionWall(boatPosX + 36, boatPosY)) {
    //boatPosX = oldPosY;
    console.log("collision");
  }
  context.restore();

};

I know what's causing the problem (the loop) but not sure how to fix it properly.

sentences:
How can I convert a paid iOS game to a free game with in game purchases? I have developed a game for iOS that has had a decent amount of downloads, but I think I would get significantly more revenue if I were to convert the game to free to play, with in app purchases (especially since some competitors products are now free to download with in app purchases).

My question is what is the best way to go about converting to a free game with in app purchases without annoying the existing users?

On upgrading I'd like the people who previously paid for the app to have access to all the in-app purchases because I don't want to make them have to pay for content they previously had, and I don't want to make all the content (that is currently in the game) free.

sentences:
Understanding a client/server relationship I'm currently designing a simple game in C# and want to implement online multiplayer support. Before venturing onto doing something like this, I just had a few questions about clients and servers.

Is a server responsible for sending and receiving data to and from clients?
If a client wants to send data to another client, should it send the data to the server, and let the server send that data to the specified client?
When it comes to handling data, should the server have access the same classes the client does? This way the server can convert the bytes sent in, to a specific class? Or should the server just handle all the data in bytes, and send it back out if necessary?

Sorry if there are to many questions, any help would be appreciated!

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:
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:
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:
Unity custom inspector - How to serialize scene objects in ScriptableObject? I am writing a custom inspector for the artist in our team to design some simple animations (without using mecanim).

The basic setup is the following:

Animations are saved as ScriptableObjects. There is a class AnimationBase that inherits from ScriptableObject and different Animation classes that inherit from AnimationBase.

There is an AnimationSystem script that stores the animations for one gameobject. Animations can be added dynamically for different events (I got multiple MyAnimation[] to store those per event type). It also stores a string with the name of a ScriptableObject AnimationList. That ScriptableObject stores the filenames for all the used animations in lists of strings for the different animation event types.

Now I have an animation "EnableAnimation" (inheriting from AnimationBase and therefore a ScriptableObject) that should enable a gameobject. If I select a gameobject from the assets, the reference is saved in the EnableAnimation asset as expected. But when I select a gameobject from the scene, the EnableAnimation assets shows "Type mismatch" instead.

I think the problem is that I use a EnableAnimation asset but want to store information in the scene. Is it possible to store the ScriptableObject in the scene instead?

Other things to take into account for solving the problem:

The custom inspector should work for prefabs, prefab instances and normal gameobjects. If possible prefab instances should be allowed to use the same animations as the prefab but change some values per scene.
I have a prefab "A" that has an AnimationSystem component and a child gamobject "B". With the default inspector I can select B as an gameobject in a script and apply that change to the prefab. If I select a different gameobject in the scene and try to apply, the prefab does not save the reference. If possible, this behaviour should be used too.

Thank you for your help!

sentences:
Can Soomla directories be safely moved one directory down in Unity? I'm integrating in-app purchases in my game. To do so, I chose to use Soomla (http:soom.la) asset. I use the free version registering for the grow bundle. I've downloaded a unitypackage named unity3d-grow-spend from my grow web console.

When I'm going to import the unitypackage I find that it wants to import things in a variety of top-level directories, like:

/GROW/*
/Plugins/Android/*
/Plugins/GROW/*
/Plugins/iOS/*
/Plugins/Soomla/*
/Plugins/WP8/*
/Soomla/*
/WebPlayerTemplates/SoomlaConfig/*

All this installs inside my /Assets directory.

The thing is that in my assets I only have

/Assets/Scenes
/Assets/Plugins

and I do not want pollution in there.

Question:

Is it safe to move /Assets/GROW into /Assets/Vendor/GROW and move Soomla and WebPlayerTemplates also into the Vendor directory?

Or doing that movement some in-app purchases mechanism will fail?

This would result in having only

/Assets/Scenes
/Assets/Plugins
/Assets/Vendor

in the top-level, which is rather nice.

sentences:
2D Spaceship Thruster Movement - Turning I have a spacecraft (shown in the image) built out of ‘blocks’ / 3D planes. It is drawn within a 3D space, but I’m ignoring the Y axis for now and keeping things on a “2D” XZ axis.

The ship has a number of thruster blocks (represented in blue); each of which should fire depending on user input (does the user want to go forward? or turn left? etc).

Although the image doesn’t show it, each thruster is oriented in a logical direction; i.e the thrusters labelled A & E point left, B & F point right, thrusters G & H point down, thrusters C & D point up.

Thrusters are placed arbitrarily around the ship. There is no actual 'Thruster A' or 'Thruster B'; I'm just using the spacecraft in the above image as an example.

I already have the following which works for forward/backward thrust and strafing (in pseudo code):

foreach(thruster in ship.thrusters) {

    // Forward thrust
    if(keyPressed W) && thruster.direction == ShipLocalSOUTH) {

        thruster.fire();
    }

    // Backward thrust
    if(keyPressed S) && thruster.direction == ShipLocalNORTH) {

        thruster.fire();
    }

    // Strafe Left
    if(keyPressed Q) && thruster.direction == ShipLocalEAST) {

        thruster.fire();
    }

    // Strafe right
    if(keyPressed E) && thruster.direction == ShipLocalWEST) {

        thruster.fire();
    }

    // Turn left
    if(keyPressed A && ??) {

        // ??
    }

    // Turn right
    if(keyPressed D && ??) {

        //??
    }
}

class Thruster {

    private thrusterPower = 10;

    public void fire() {

        shipRigidbody.AddForceAtPosition (thruster.transform.forward * thrusterPower, thruster.transform.position);
    }
}

My problem lies in determining which thrusters to fire to turn the ship.

I’ve done a lot of googling on this and have found quite a lot of info already. I.e:

Using Torque and Thrusters to Move and Rotate a Player-Designed Spaceship

However my maths/trig skills are - to be blunt - crap and so I’m hoping to get a somewhat simpler explanation or even some code to help me understand and solve this problem. I'm not aiming for superbly accurate physics, just something that is fun to play.

sentences:
Rendering transparent textures in directX I am working with a directX application with WPF, I am facing a problem with videos and images that contains transparent pixels, I have to draw a color in background an then a video/image over it. What I expect is background color should be visible while playing video only non transparent pixels should be visible but what I get is a black background behind the video.
I am using following settings on device to achieve alpha blending :

device.RenderState.SourceBlend = Blend.SourceAlpha;
device.RenderState.DestinationBlend = Blend.InvSourceAlpha;
device.RenderState.AlphaBlendEnable = true;

What am I missing here? What is the best approach to handle transparent videos?
Any help will be of great value to me.

sentences:
Float inaccuracy. libgdx only? java only? also why? Hey all I have just come to notice that floats are not accurate even when they are explicitly set and unchanged. For example i have some basic code running and it is:

 if (bike.getY() < previousBikeY){
        bike.accelY = 50f;

        System.out.println("bike accel Y :" + bike.accelY);
    }

The result in the log is:

I/System.out: accelY: 49.770126

If I wanted 49.77 id have set 49.77, this also makes me wonder about all the other uses of float i have (such as position, speed, gravity, time, etc).

A) Does this happen in other languages such as C++ or C#?
B) is this normal and something i should ignore OR do I need to take action?

sentences:
How to become a Game Artist? If I understand correctly, there are two major kinds of artists involved in game development - 2D and 3D.

I think I somewhat understand, that if I want to go 3D, I should learn some 3D modeling package really well and that would be it. Please correct me if I am wrong.

With 2D I am completely lost. There are a lot of tutorials on the web describing so many different topics like general drawing, vector graphics, raster graphics, pixel art and a whole lot of other things.

So what tools and techniques are most commonly used by professional 2D artists and if I wanted to become one, exactly were should I start(like tomorrow) and what should my goals be?

sentences:
Unity : Rotate object on touch looks weird Touch and hold the screen then rotate object continue("Object is unity default cube")  that's my operation, but when object is Rotate then it's look like weird.

I upload the example for better understand, it's looks like above image.

public void StartHold()
{
    pointerDown = true;
}
public void StopHold()
{
    pointerDown = false;
}
void Update()
{
  if(pointerDown){
    Rotator.transform.Rotate(new Vector3(0, 0, 90) * 2f * Time.deltaTime);
  }
}

It's just simple way to rotate object not to much complication then why object rotation look like this, anyone can know then help me and what is the solution of this problem.
Thanks.

sentences:
No performance gain from instanced rendering? I recently worked through this tutorial about instanced rendering. At the end it promises to draw a huge amount of instances of one model without performance drops.
So I tried some simple instanced rendering to see these effects. So I created a VBO containing four times xyz-coordiantes, vertex color and texcoords.

float[] backgroundData = new float[] {
            -1.0f, -1.0f, 0.0f, 1f,1f,1f,1f, 0.0f, 0.0f, 0.0f,
            1.0f, -1.0f, 0.0f, 1f,1f,1f,1f, 1.0f, 0.0f, 0.0f,
            -1.0f, 1.0f, 0.0f, 1f,1f,1f,1f, 0.0f, 1.0f, 0.0f,
            1.0f, 1.0f, 0.0f, 1f,1f,1f,1f, 1.0f, 1.0f, 0.0f
    };

I also created a VAO and EBO containing the glVertexAttribPointers and indices int[] indices = new int[]{0,1,2,1,2,3};.

Now I draw everything with glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0, 10_000). But the Framerate drops as much as if I had the indices 10.000 times in my EBO. Why is the outcome so different? Did I do something wrong?

sentences:
Vertex Normals, Loading Mesh Data My test FBX mesh is a cube. From what I surmise, it seems that the cube is on the extreme end of this issue, but I believe that the same issue would be able to occur in any mesh:

Each vertex has 3 normals, each pointing a different direction. Of course loading in any type of mesh, potentially ones having thousands of vertices, I need to use indices and not duplicate shared verts. Currently, I'm just writing the normals to the vertex at the index that the FBX data tells me they go to, which has the effect of overwriting any previous normal data. But for lighting calculations I need more info, something that's equivalent to a normal per face, but I have no idea how this should be done. Do I average the 3 different verts' normals together or what?

sentences:
How to calculate ray polygon intersection? I'm in a class where we are creating a ray tracer from the ground up in C++. I'm at a point where I can't seem to wrap my head around the math that is required to calculate the point at which a ray intersects a polygon.

We have some direction for how to do this, but all of the class materials as well as my Googling of the subject have not helped.

These are the functions we must complete:

bool polygon::Intersect(const ray &R, intersection &inter)
{
    // To Do: If you have implemented the "CalculateNormal" method
    // below, should already be calculated and placed in the member
    // "n".
    //
    // Now, using n, you need to calculate the intersection of the
    // ray with the plane containing the polygon.  Then, once you
    // have that point, you need to loop through each edge in the
    // polygon and make sure the point is to the left of that edge.
    //
    // If it is to the left of every edge, then fill the structure
    // inter with all of the data for the intersection and return
    // true, if not, return 0.
    //
    // Don't forget to check to see if the t you calculate for the
    // ray is > 0.

    return false;
}

void polygon::CalculateNormal(void)
{
    // To Do: Use the edges of the polygon to calculate the normal
    // of the polygon. You should be careful to take care of the
    // case where two edges give you a zero normal.  Place the
    // normal into the member "n" so that the intersection method
    // can use it when called.
    //
}

Could someone please explain this in a bit further detail?

Note: I am not asking for anyone to write the code or do my homework for me, but instead help me understand what exactly is going on here.

Thank you.

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:
In Unity unable to find second github branch I'm using github for unity asset and for some reason I can't find new branch that was created on a different PC.
I tried refreshing, fetching, reinstalling asset, reinstalling asset and recloning repository.

Strangely, my laptop shows the branch, but not my personal home computer.

Any ideas why is this happening?

sentences:
What's it like being a game developer? I am a 6th grade student and I would like to be a video game designer.  In class, we all had to choose a career that we would like to have and interview someone with that career.  Finding a game designer locally has been difficult, so I thought I would try online.  If some of you would take the time to answer these questions I would be grateful.  Some of the questions I have for you are:

Why did you choose your career?

What kind of education did you have to complete for this career?

How is math related in this career?

What would a day in your normal life in this career typically look like?

How do you dress for this career?

What is your favorite part about this career?

What kind of games do you create?

You do not have to answer all of the questions but it would be much appreciated if you would answer most of them.  Thanks!

sentences:
Correctly bitmasking path tiles based on existing paths Currently, I have a bitmasking implementation that sometimes incorrectly bitmasks the tiles. Conventionally, it is done correctly, and the math/etc is sound, but it achieves results such as the following:

This is similar to what you might expect, and looks fine when doing simple x-shaped crossings. However, I would like for the images to remain unchanged in some of these cases. For instance, the parallel paths in the third image would remain parallel paths instead of being bitmasked into many crossings. In the first and second images, only the parts of the path highlighted in the following images would be bitmasked (Different parts of path labelled for clarity.)

If I purely update only the tiles that make up the newest path, I again get good results in simple x-shaped crossings, however I get results such as those demonstrated in the following image:

What could I do to achieve results where this would not occur? I have though about adding some sort of flag to the tile to indicate that it is a crossing, but how could I detect that?

sentences:
How to optimize SpriteBatch usage? From what I understand, SpriteBatch's purpose is to batch as many draw operations to send to the GPU. Each batch can handle one texture at a time, and changing SpriteBatch context/texture is expensive, so when you need to draw many different textures in one frame you use a texture atlas, putting sprites that are most likely to be drawn by the same component in the same page.

So my questions are:

Assuming there are numerous components using the same texture page, how am I supposed to group them together and issue their drawing method?
What is an efficient way to deal with a component that uses sprites from two different texture pages? Should I handle two different drawing methods for each texture page? or perhaps take the context texture page as parameter and draw only what's relevant for it?
What about dynamically generated textures?
What if you don't know which texture pages a component needs? (For example, a custom visual equipment where you can't possible put all the equips in the same texture page since there might be thousands of em, and it's determined only at runtime)

I've seen many articles on how SpriteBatches work technically but nothing meaningfull on how to actually make the best use out of them. Would a good solution be to somehow queue my draw operations sorted by texture? If so, what would be a good generic way to implement it?

sentences:
How do I support animation with frames of different sizes? I'm trying to create a simple top-view 2D rpg, in the style of Zelda and Secret of Mana, using PyGame. I've managed to make the beginnings of a game, with an animated character walking around. However, when I start animating attacks, I'm running into problems because the sprite with the sword slash is bigger than the walking sprite. This makes the character appear to be jumping around when attacking.

I managed to handle the problem by defining a center of gravity, so to speak, for each image, and apply a suitable offset at each frame in the animation to make the center of the character stay at the same place throughout the animation. I defined a dictionary of lists of images (instances of pygame.Surface), where I pick out the correct list by the state of the character, so for example there is one list for walking left, and then I loop over the list to get the animation. To handle the offset, I similarly created a dictionary of lists of offsets, looping over those in the same way.

However, I'm not entirely pleased with this implementation, so I'm looking for a more elegant solution.

I tried to add an attribute called offset to each instance of the pygame.Surface class, to hold the offset for each image, but the Surface class doesn't allow new attributes to be set. I then thought about subclassing pygame.Surface, which would allow me to set any attribute I wanted, but then I couldn't load my images with pygame.image.load without a lot of extra code.

I imagine everyone who makes a game with animations where the size of the sprite changes between frames would have to deal with this problem, so if anyone could suggest an elegant implementation, that would be great. If example code with PyGame is available, that would be even greater.

sentences:
SDL2: Unable to get center of screen when drawing more than one texture? so I've been trying for the last four hours to get this to work and although I can get to the center of the screen when printing one texture using:

TextureManager::getInstance()->drawTexture("block_brown",
    SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->w / 2 - 101 / 2,
    SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->h / 2 - 171 /2,
    101,
    171,
    Game::getInstance()->getPrimaryRenderer(),
    SDL_FLIP_NONE);

I get the following result:

I can keep the center of up to two textures in a row and after that it gets out of hand and I completely lose it. I'm using the following for the two:

for (int i = 0; i < 2; i++) {
    for int j = 0; j < 2; i++) {
        TextureManager::getInstance()->drawTexture("block_brown",
            SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->w / 2 - i * 101,
            SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->h / 2 - 171 / 2,
            101,
            171,
            Game::getInstance()->getPrimaryRenderer(),
            SDL_FLIP_NONE);

which produces the following result:

As you can see, it looks to be in the center of the window, but if I try to add more than two in a row or more than one in a column, I then have to start fighting it to keep it in the center.

So my question is, how would one manage to get the textures to stay central, no matter how many I add?

EDIT:

This is the final result I'm ultimately looking for:

When I start trying to add layers I then have to start fighting it again to keep it central?

This the result I'm having right now:

The more I think about this, the more I think I'm going completely the wrong way and doing it completely wrong.

sentences:
How to factorize code in Unreal Kismet (i.e. "Material Function"s for Kismet) In the Unreal Development Kit, when using the Material Editor, one can factorize frequently-used groups of nodes by creating a Material Function (content Browser → right-click → new matrial function, IIRC).

When defining the behaviour of some actor in Kismet, one can easily have a dozen nodes involved.

If I have many actors that share the same behaviour, then I'll copy-paste these nodes, and change the variables so they point to the other actors.

This leads to inconsistencies (a modification in the behaviour of an actor isn't propagated in the copy-pasted nodes), complexity (you end up with hundreds of nodes), and generally useless effort.

My question is : Can I create a "kismet function", just like a material function ?

Note: I'd rather avoid using UnrealScript.

I don't even know where to type UnrealScripts, don't know where the documentation is and more generally don't have enough time to invest in learning UnrealScript.
This "kismet function" feature must be usable by graphists (with little programming knowledge).
If a (simple) script suffices to add this feature in the Kismet editor, so that one can create several "functions" without using UnrealScript, then fine, but I don't really want to have to write a script each time I want to factorize a few nodes.

Thanks for any information !

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:
How to Keep Unity From Changing Sprite When Changing Orthographic Size? so I have a simple X animation, and at the end (when it looks like a full X), it looks good on one orthographic size, but bad on another. Here's what it looks like when the size is 3:

Now you can notice, there are a few pixels that look a bit off, but it still looks pretty good. Here's what it is supposed to look like:

So if you look closely, it is a bit different, and that's the point. However, if you change the orthographic size to.. say 5, you get this horrid thing:

Why is Unity doing this, and how can I fix this so that it looks how it's supposed to? Also, in this, my X is upscaled x2. Would it fix it just to have it made to the right size, and then upscaled x1 (e.g none)?

sentences:
Strange realtime shadows in Unity3D I'm trying to do realtime lighting, and my shadows are acting very strange. When I project a spotlight out from the camera (like a flashlight in a first person game) my shadows show up as 3D skews of the objects, and I can actually clip through them if I move the camera in the right way... if I detach lights from the camera and just have them sit in one position, I don't seem to have this issue (cylinder to the right is just the model Im using for the flashlight... its attached to the camera):

All objects have Cast Shadows set to "On"
All objects have Receive Shadows checked
All objects have Light Probes and Reflection Probes set to "Blend Probes"
All objects have Motion Vectors set to "Per Object Motion"
All objects have Lightmap Static unchecked
All objects have Dynamic Occluded checked
All lights have Mode set to "Realtime"
All lights have Shadow Type set to "Soft Shadows"
All lights have Realtime Shadow Strength set to 1
All lights have Realtime Shadow Resolution set to "Very High Resolution"
All lights have Realtime Shadow Bias set to 0 (changing this doesn't seem to effect the issue)
All lights have Realtime Shadow Normal Bias set to 0 (changing this doesn't seem to effect the issue)
All lights have Realtime Shadow Near Plane set to 0.1 (changing this doesn't seem to effect the issue)
All lights have Draw Halo unchecked
All lights have Render Mode set to "Auto"
All lights have Culling Mask set to "Everything"
Camera has Clear Flags set to "Solid Color"
Camera has Background set to #000000
Camera has Culling Mask set to "Everything"
Camera has Projection set to "Perspective"
Camera has Field of View set to 60
Camera has Near Clipping Plane set to 0.3
Camera has Far Clipping Plane set to 1000
Camera has Viewport Rect set to 0, 0, 1, 1
Camera has Depth set to 0
Camera has Rendering Path set to Use Graphics Settings
Camera has Occlusion Culling checked
Camera has Allow HDR checked
Camera has Allow MSAA checked
Camera has Allow Dynamic Resolution unchecked
Camera has Target Display set to "Display 1"
In Player, Rendering Color Space set to "Linear"
In Player, all Rendering Auto Graphics APIs checked (win, mac, lin)
In Player, Rendering Static Batching checked
In Player, Rendering Dynamic Batching checked
In Player, Rendering GPU Skinning unchecked
In Player, Rendering Graphics Job (Experimental)* unchecked
In Player, Rendering Lightmap Encoding set to "High Quality"
In Graphics, all Built-in Shader Settings are set to "Built-in shader"
In Graphics, Shader Stripping Lightmap Modes is set to "Automatic"
In Graphics, Shader Stripping Fog Mode is set to "Automatic"
In Graphics, Shader Stripping Instancing Variants is set to "Strip Unused"
In Graphics, Preloaded Shaders Size is set to 0
In Lighting, Skybox Material is set to "Default-Skybox"
In Lighting, Sun Source is set to "None (Light)"
In Lighting, Environment Lighting Source is set to "Color"
In Lighting, Environment Lighting Ambient Color is set to #000000
In Lighting, Environment Lighting Ambient Mode is set to "Realtime" (and the dropdown box is greyed out, so I can't change it)
In Lighting, Environment Reflections Source is set to "Custom"
In Lighting, Environment Reflections Cubemap is set to "None (Cubemap)"
In Lighting, Environment Reflections Compression is set to "Auto"
In Lighting, Environment Reflections Intensity Multiplier is set to 0
In Lighting, Environment Reflections Bounces is set to 1
In Lighting, Realtime Global Illumination is checked
In Lighting, Baked Global Illumination is unchecked
In Lighting, Fog is unchecked

sentences:
How to make a triangle pixellated with GLFW? How can one make a triangle look pixelated without modifying the size of the window in GLFW3?

Preferably, I'd like to accomplish this without the use of shaders. For example, by setting the size of the frame buffer to be 1/8th the size of the window.

I've created an Xcode test project for this and tried setting a small window size to create a small framebuffer, then changing the window size to be big afterwards, but the framebuffer size always changes to match the window size.

Example project output:

Desired output:

sentences:
Is it better to connect signals in source code or with the IDE feature? In Godot IDE, what are the advantages and the caveats of using the visual IDE to connect signals to listerners instead of doing this:
var state: bool

onready var countdown: Timer = $Countdown

func _ready() -> void:
    state = true
    countdown.connect("end", self, "_toggle")

func _toggle() -> void:
    state = not state

sentences: where can I download unity assets without opening it in in unity. I'm browsing through my mobile phone and I need to download unity assets but unity asset store demands that I open the assets in unity directly. How or which site can I download it on my mobile and send it to my PC.

sentences:
How to make a Google Play app with paid and free-with-in-app-purchasing versions? I want to implement an IAP system as well as a fully paid one in my game.
There are about 8 levels in my game. I want the paid version to cost around $4 and in case of IAP, each level can be unlocked for 0.99 cents.
Do I have to create two separate apps (one for paid and one for IAP) or can I have both of these in a single app? The user can then decide if they want to buy the entire game or unlock a few levels using the IAP feature.

sentences:
Why can't I import third-party modules I've installed in the python-ogre SDK's interpreter? Background Information

I'm using the python-ogre SDK, located here, under Windows 7.  The SDK seems to have its own interface to the python 2.7 interpreter, judging from the fact that the generic interpreter (the one located in C:\python27) must be present in order for the SDK to function.

If the generic python 2.7 interpreter is not installed, the python-ogre interpreter complains that python27.dll is missing.

In addition, modules seem to be highly compartmentalized.  The python-ogre modules are only available under the python-ogre interpreter, and not the generic python 2.7 interpreter.  The inverse is also true.  Modules installed to the generic python installation are not available to the python-ogre SDK interpreter.

I'm not really sure what's going on here, so general clarifications would be helpful.

The Import Problem

I recently installed PyYAML and it imports successfully in the standerd python 2.7 interpreter.  However, when I try to import it from the python-ogre SDK's interpreter, I get an ImportError:  No module named yaml error.

What gives?

This may be a general python issue, but it does seem to relate directly to the python-ogre SDK.

As usual, I will be happy to provide additional information upon request.
Any advice or help would be greatly appreciated!

OK GOT IT!

I just did a sys.path.append('C:\Python27\lib\site-packages').  Apparently all 3rd party modules are installed to this directory.

Is this safe to do?  Do I risk creating conflicts between python-ogre and regular ol' python?

sentences:
What do potential employers look for in a good portfolio? A buddy from work and myself are wanting to get into the indie scene for game development. I've done a few tech demos demonstrating different ideas and approaches for various problems. Now, I feel it's time for us to commit to a project in order to develop a portfolio for later down the road.

I've been struggling greatly with how to begin an actual project, more specifically to create an engine or use an OTS package, or use one then create one, or create one then use one.. etc.

Which looks better to potential employers? A smaller portfolio of games that includes your engine or a (possibly) larger one that was built using something OTS?

I am a programmer. I'm not an artist. I will be performing most of the programming for this project. My buddy is also a developer, but he is also proficient with graphical tools (thus, he becomes the art guy).

At work, we are both .NET developers (C#). I know, I know "Well then use XNA" some will yell at me. The demos I've completed thus far have been in XNA. But I have some concerns with building an XNA portfolio. While it is nice to abstract DirectX, I worry that I may not build the necessary knowledge base to extend beyond XNA easily. The counter to that argument is probably "you can more easily move on to DirectX after XNA", but since I will   move careers from Business Development to Game Development, is it even worth while to focus on XNA currently? Or will potential employers giggle when I say XNA?

Should I embrace the experience of XNA knowing the concepts and lessons learned will mostly transfer? Or spend my most valuable resource (time) else where?

Looking for some advice from any industry vets out there.

sentences:
Can state setting warnings be ignored? If I am running DirectX 11 in debug mode (D3D11_CREATE_DEVICE_DEBUG), I am constantly getting these warnings:

D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM DepthStencil is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD]
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 6 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD]

It is because I am setting a resource as a render target while it is currently bound to the PS. However, my rendering flow is set up such as it relies on the api to force the resource slot to null, and it works.

Is there any reason I should be bothered with these warnings or I can rely on the api to enforce this every time? I only tested on 2 GPU-s: Intel HD 3000 and Nvidia GT525m.

sentences:
How to implement accurate frame-rate-independent physics? So, I have been working on a project for a while now and recently stumbled across a problem:

The common approach to frame-rate independent physics is to either use a fixed update interval (ie. Unity) or just multiply each physical change with delta.
So it would look something like this:

update(int delta)
{
   ...
   positionX += velocityX * delta;
   ...
}

And when acceleration is added, the velocity change is treated similar:

update(int delta)
{
   ...
   velocityX += accelerationX * delta;
   ...
}

This works fine for most use cases. In fact so fine, that I haven't noticed anything was off for months. But there is a problem with this logic, namely that the position will be slightly off for entirely different frame-rates. This problem is negligible when working with small frame-rate changes, but is entirely noticeable once the delta time is changing by bigger amounts. Say, FPS rate from 30 to 600. Now, in a normal game the FPS are just locked and even if the positions are off for a few frames by like 5% it doesn't matter because one doesn't notice it. But I manually multiply the delta with a factor to accomplish a certain effect, and the error is somewhat noticeable and game breaking.

A small example to clarify what I mean:

There is a game object with start position posX = 0 and a x-Velocity of 10 and an horizontal acceleration of 0.1.

After two frames, for 50FPS this would lead to (with an average delta)

velocityX += acceleration * delta;
posX += velocityX * delta;

velocityX += 0.1 * 20; //velocityX = 12
posX += 12 * 20 //posX = 240

//next frame

velocityX += 0.1 * 20; //velocityX = 14
posX += 14 * 20 //posX = 520 (240 + 280)

After one frame with 25FPS, which equals the same time interval like two frames with 50FPS, this would get us:

velocityX += 0.1 * 40; //velocityX = 14
posX += 14 * 40; //posX = 560

So two situations with the same time interval elapsed we get different results (520 for 50FPS and 560 for 25FPS).

Now, the problem obviously is that there is one extra frame (in this example, it could be any number of frames but the results still differ for the same interval) in which the acceleration is applied and therefore you get further with less FPS.

Stabilizing the delta is not an option as I need different deltas for said effect, so I need to physics to be entirely independent there. Has anyone ever come across a similar situation and are there any solutions for it?

sentences:
Should game logic update per second or per frame? I'm trying to wrap my head around how and when to update an entities position.

My game loop updates logic at 25 FPS and renders at 50-60 (Depending on the computer hardware).

So lets say I'm moving an object from 0 to 75 over a course of 100ms. In my update logic, should I update the position based on a per frame value or a per second value?

I was doing the math, and came up with and interesting find.

Since the update function updates at a rate of 25 fps, this means that it will be called at 40ms, 80ms and 120ms.

And the render function updates faster at a rate of 60 fps (for the sake of argument), which means it will be called at 16, 32, 48, 64, 80, 96, and 112ms

So if you line up all of these events on a timeline you'll notice that at the 6th render (96ms) the value of our position would be 72. And on the 7th render, the position would be 75.

Then the update function would be called at 120ms and would notice that the value is 75, but the current time is 20ms over what it should be.

Now I know that 20ms isn't much, but how do you compensate in collisions, physics, and AI for this? Should I instead update my values per frame instead of per millisecond?

sentences:
Appropriate database schema for heroes' skills in a Tower Defense game? In a Tower Defense game, each hero (or character) has some skills. Each skill has some "chance of appearance" (CoA for short) when attacking enemies and if appeared it has some "hit accuracy" (i.e. hit on enemies) (HA for short) and has effects on the enemies (if hit by the skill) (EoH for short).
Examples:
Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down for 4s and (2) yield 200 damage points.
Skill #2: Frost 2, CoA: 100%, HA: 50%, EoH: (1) make enemy frozen for 8s.
I first tried to breakdown skills into "atomic" effects and come up with tables as below:

All looks good?
But now we want to update Skill #1 a bit to make it more complicated:
Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down by 40% for 4s and (2) yield 200 damage points. (Please pay attention to the 40% here!)
Or even coming up with more complicated skills:
Skill #3: Frost 3, CoA: 20%, HA: 100%, EoH: (1) frozen enemy for the first 4s then slow enemy down by 50% for next 4s and (2) yield 200 more damage points.
Skill #4: Frost 4, CoA: 10%, attack enemy 3 times continuously, each time: HA: 50%, EoH: (1) frozen enemy for the first 2s then slow enemy down by 50% for next 2s and (2) yield 400 more damage points.
Each effect now has more parameters to be specified -- which makes my current schema not fit anymore. Please help deal with this!

sentences: Using Flash in CS5 for iOS So now that the restrictions are lifted from the third party developer by Apple. And the new packager for iPhone for Flash in CS5 is available for download. How much efficient it can be to develop a game in Flash for iPhone. How much worth it can be to invest time in developing games on Flash? anybody started working on game development on Flash for iPhone can help a lot.

sentences:
How can I use slerp to stop my orbit camera "shortcutting" across to its target position? I'm working on a camera that moves around the player at a fixed distance. It's the standard right-stick-to-move-cam-around kind. The camera follows the player but stays at a fixed angle to (0,0,1) until moved by input, and the player is free to move in any direction without changing the camera rotation with respect to the world. Imagine the cam as being a point on an invisible sphere with the player at the centre.

However, there's a problem with it in that when I rotate the camera around the player too fast, the lerping I added to try and smooth the movement tries to "shortcut" across instead of moving around the sphere gracefully when the desired position gets too far away. The image below is a top-down view, the camera takes the red route, but I want it to take the green route while remaining smooth.

Currently I'm:

Checking whether the look controls are inverted, and setting a modifier value.
Updating the current angle to (0,0,1) using the normalized X component of a Vector2 set by keyboard input (cam left, cam right).
Updating the current angle to the Y axis using the Y component, set by input (cam up, cam down).
Finding the desired cam position from the two angles and position of the focus point (player).
Lerping between the current cam position and the desired one and updating the lookAt vector.

Here is the update code (it's in Go which isn't especially common for game dev, but hopefully the syntax should be easy enough to understand what's going on):

// Update the gameplay camera with the focus at focusPos.
func StepGameplayCam(focusPos math32.Vector3, delta float64) {
    invertLookMod := float32(1)
    if settings.Control().InvertLook {
        invertLookMod = -1
    }

    //Get up/down and left/right components and set angles.
    currentAngleToZ = util.WrapAngleRad(currentAngleToZ + float32(movementVec.X*float32(delta)*settings.Control().CamSpeed*invertLookMod))

    if !((movementVec.Y < 0 && currentAngleToY <= math32.DegToRad(15)) || (movementVec.Y > 0 && currentAngleToY >= math32.DegToRad(165))) {
        currentAngleToY = util.WrapAngleRad(currentAngleToY + float32(movementVec.Y*float32(delta)*settings.Control().CamSpeed*invertLookMod))
    }

    distanceToFocus = maxDistanceToFocus //TODO cam collisions/not clipping through things

    //Set desired cam position.
    targetPos.X = focusPos.X + distanceToFocus*math32.Cos(currentAngleToZ)*math32.Sin(currentAngleToY)
    targetPos.Z = focusPos.Z + distanceToFocus*math32.Sin(currentAngleToZ)*math32.Sin(currentAngleToY)
    targetPos.Y = focusPos.Y + distanceToFocus*math32.Cos(currentAngleToY)
    camPos.Lerp(targetPos, float32(delta)) //TODO problem is here, we're LERPing between vectors but we need to do it spherically
    gameCam.SetPositionVec(camPos)

    gameCam.LookAt(&focusPos)

    if settings.Dev().DebugEnabled {
        updateCamDebug(focusPos.X, focusPos.Y, focusPos.Z)
    }
}

I have a strong feeling slerp is what I'm looking for here, but my understanding of 3D mathematics is starting to brickwall at this point, and I have no idea how to use it in this context.

How can I stop my camera from "shortcutting" through the imaginary sphere around the player it is bound to?

sentences:
Code vs. Configuration in Unity I know a thing or two about Unity at this point, but I've still lots of subjective, best practice questions, Such as:
How do you decide what values are obtained via Start/Awake initialization, and which values are explicitly serialized into the scene? In my current project, game objects and behaviors reference each other in a complex graph. Initially, I did this on Start(), programmatically, with lots of raycasts and GetComponent<>() and such. Now though, I just declared stuff public (violating encapsulation?), to simply serialize this information to the scene once generated by an Editor script... Which is more correct? Should my methodology be that anything that can be serialized should be serialized? Or is it better to write more initialization code which conveys some explanation why the values are what they are?

sentences:
Basic Connections Through Socket Server I'm designing a simple 2 player RTS with Stencyl, a program that uses blocks for coding. The current code updates lists whenever an actor moves (new X and Y), and I'd want the server to update the game state with each change to the list. However, to start off: I don't even know how to set up a socket server. Stencyl has taught me the basics of logic, but I've yet to learn any programming languages.

I've downloaded a Smartfox 2X socket server that I'm intending to use. Right now I'm only looking to make baby steps; I want to do something to this effect: "When someone connects to the server, open insert file here". How can I do this? My intention is to have this file be the game client. Is this "open file when connected" method the best way to go about this? When answering: assume that I know nothing, because really, though I have done research (I know that UDP>TCP for real time), implementation-wise I know nothing.

sentences:
Is it efficient to only store interface pointers for components in an entity-component system? Let us say that I have a simple architecture, and I have implemented event-based communication between the objects and the components. In this architecture, Game has GameObjects, and the GameObjects have Components.
GameObjects have reference to Game and Components have reference to the GameObject.

There is no shared interface between these objects. Is it worth making an interface to implement Update() and ReceiveMessage(), and then only store these interface pointers?

For example, should I store Component pointers in a GameObject, or I should make an EventListener interface with Update() and ReceiveMessage(), and store EventListener pointers? I think this is a good way to force modularity, but maybe I am over complicating it.

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:
Handling early/late/dropped packets for interpolation in a 3D multiplayer game I'm working on a multiplayer game that for the purposes of this question, is most similar to Team Fortress.

Each network data packet will contain the 3D position of the target moving object. (this object could be another player) The packets are sent on a fixed interval, and linear interpolation will be used to smooth the transition between packets. Under normal circumstances, interpolation will occur between the second-to-last packet, and the last packet received.

The linear interpolation algorithm is the same as this post:

Interpolating positions in a multiplayer game

I have the same issue as in that post, but the answers don't seem like they will work in my situation. Consider the following scenario:

Normal packet timing, everything is okay
The next expected packet is late. That's okay, we'll just extrapolate based on previous positions
The late packet eventually arrives with corrections to our extrapolation. Now what do we do with its information?

The answers on the above post suggest we should just interpolate to this new packet's position, but that would not work at all. If we have already extrapolated past that point in time, moving back would cause rubber-banding.

The issue is similar in the case of an early or dropped packet.

So I believe what I am looking for is some way to smoothly deal with new information in an ongoing interpolation/extrapolation process.

Since I might be moving on to quadratic or even cubic interpolation, it would be great if the same solutiuon could be applied to those as well.

sentences:
How can I load raw Bayer images using OpenGL? I want to load a raw Bayer format image and convert it to RGB using OpenGL.

So far I have played around with glTexImage2D() and loaded a Bayer image as a monochrome texture. My question is: how can I do per-pixel operations on this texture so that I can convert it to an RGB image?

sentences:
Weird texture binding bug on Mali-400 MP On Mali-400 MP, there's a weird bug with texture binding.

Sometimes, shaders use textures from wrong samplers.

On other mobile and desktop GPUs, the same code works fine, but on Mali, almost every draw call is broken:

As you see, lightmap texture (at sampler 6) is used instead of diffuse texture (0).

Anyone knows a workaround to this?

sentences:
Billboarding + aligning with velocity direction I'm working on a particle system where I'm orientating the billboard using the inverted orientation matrix of my camera. This works quite well and my quad are rotated correctly towards the camera.

But, now I want to to rotate the quads in such a way that they point towards the direction they are going to.

In 2D this can be done by normalizing the velocity vector and using that vector for a rotation around the Z-axis  (where vel.x = cos(a) and vel.y = sin(a)). But how does this work in 3D?

Thanks
roxlu

sentences: How to make installable .exe file for unity games I just completed my game but after i built the game from unity to .exe it also has filename_data folder i know it has all the resources for the game. I tried iexpress and innosetup to make the install-able file. I installed the game from the setup then i ran it but the game gives the error "There should be 'HouseFixIt_Data' folder next to the executable", but i added data folder while making install-able file but still i'm getting this error. Please anyone help me...

sentences:
Character Controller + Lag = Massive Teleportation Through Walls I'm working on a fairly robust game with another developer and we've been having a really serious issue with (I believe) the character controller. Specifically, if there's ever a large lag spike (as there are somewhat frequently - the code's not well optimized in some parts) there's a chance that the character controller will wing right through all nearby colliders and fall out of bounds.

It happens pseudo randomly, but I've noticed that it seems to be somewhat predictable, such as standing next to certain objects (nothing weird about them - just tables with colliders).

The lag often is a cause of large chunks of a level having SetActive(true) called on them in one frame or multiple objects being instantiated in one frame. These objects sometimes have colliders/rigidbodies attached but don't seem to be in any direct contact to the character controller.

I can very consistently make it happen by moving towards certain walls (again, very normal walls) and alt-tabbing while my character is still moving also seems to cause the issue predictably, which is VERY strange.

Has anyone ever experienced anything like this with the character controller? I'd give a code sample but honestly not even sure where from the codebase would be pertinent other than

if (Time.deltaTime < 0.15f)
{
    if (applyGravity && noClip == false)
        moveDirection.y -= gravity * Time.deltaTime;

    controller.Move(moveDirection * Time.deltaTime);
}

Which seems awfully straightforward to me. Obviously moveDirection gets changed elsewhere in the function too but it's all similarly bland. I'm pretty experienced with this sorta' stuff and it doesn't ring wrong to me at all.

Some other stuff.

Checked that moveDirection isn't a huge number

Tried eliminating Time.deltaTime from the equation

Fairly sure colliders aren't ending up inside of the player while a lag spike happens (again, alt-tabbing will do it too)

Geometry surrounding the player is clean (box colliders, mesh colliders on well-developed meshes)

Nothing strange like rapidly setting any components on or off is happening to my knowledge.

Anyone have any experience with this sort of issue?

sentences: Procedural dungeon generation. No corridors, color key doors I am curious how dungeons like the one in Runescape dungeoneering skill are generated. They basicaly have a 10x10 grid. So theres 100 rooms total. There's starting room and exit room. And each one are conected by open doors or doors that require key of some color. Anyone have idea how to generate something like this? I mean how to place doors and keys to make dungeon doable?

sentences:
Cannot find folder when building game to .jar LibGDX Whenever I run my game from my IntelIJ IDEA the game runs fine. It finds every folder and every asset in there. But whenever I build my game with :desktop:dist and run it it will not see the folder I try to open as a folder and it will have 0 contents.

This is the code I use to open the folder:

        FileHandle mapFolder = Gdx.files.internal("maps");

    System.out.println(mapFolder.list().length);

    for (FileHandle entry : mapFolder.list()) {
        System.out.println("something is in");
        maps.add(new Map(entry.toString()));
    }

    loadMap(maps.get(0));

The length it prints is 0. It does not print something is inso im fairly sure this is not working.

Whenever I try Gdx.files.classpath I get this error: Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Cannot list a classpath directory: maps

For clarification: It's a desktop only project. So no android.

I cannot figure it out, and I've looked at a lot of topics to try and fix this issue.

sentences:
Can J2EE be used to implement games ? Is there any connection between J2EE and games? Making an game using applets, but have to implement project using J2EE. Is there any sense in making a game with using J2EE for implementation ?

Our teacher said that we can make games for the java project, now she has put in the requirement that we have to use J2EE, and expects us to make the game. Where does J2EE comes in the picture ?

sentences:
Exporting a simple mesh from Blender for reading in Assimp I'm trying to create some simple assets for using in my rendering engine. What I'm trying to do is to generate simple low poly models and then importing them into my application using Assimp. I can successfully import models I find on the web so everything works fine application-wise. But since I'm a total noob at Blender (I managed to learn some interface basics through tutorials) I just seem able to export a model with geometry information (vertex positions) and that's it. My models don't have normals or uv-cordinates, and no textures whatsoever.
What I'm asking is a simple workflow to create and export a very simple mesh to a obj or collada format that I can read into my code.

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: How to force Landscape Mode Unity3D Android Game? I am developing a small side project on Unity that will ultimately be for Android but I cannot figure out how to force landscape on the device and when I have tried it out the game just goes all over the place! I am using Unity Canvas and have spent a long time with binding position points etc. but I cannot work it out! Could someone please tell me how to force the phone into landscape mode?

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:
Coherence between 2d tile maps In dwarf fortress, there are  3 levels of maps in the screen you pick your starting position, and they all coincide with each other perfectly. I am assuming that the top level tile accounts for lets say 36 smaller map blocks, and when the player spawns on the map, that is just a noise value at a different level or frequency of even more tiles.

The selection screen looks like this:

How is such a level of coherence achieved? It doesn't seem like simply adjusting noise frequency/octave values would work perfectly, or maybe it does, I am just not grasping the workflow properly?

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:
Pointers in C# Unity Hey I've just learned about pointers recently and am wondering how I can use them in c# (I just learned about them in c++) in unity. I do have some questions though.

Pointers use low level programming to find positions of different values on the computer so does that mean that you can just access a the value of a variable from any script?
If so how do I just call upon a location of a variable with just its location  code?
Are there any discernible differences between pointers in C# and C++ that I should know?
How can I use pointers with the variable types in Unity (Vector3s, Transforms, GameObjects, etc...)?

There are so many more questions I probably should and would like to ask so if you have any additional info or sources.

sentences:
Collision intepenetration and objects getting stuck (Unity) I am having what is probably a newbie problem with Unity, but for the life of me, I can't find a decent solution to it. In short: my rigid bodies collide, but sometimes, they interpenetrate and stay stuck.

I am looking for a solution that would either
1- stop the interpenetration from even happening
2- or at least eject the bodies to 'unstuck' the collision.

By making the physics fixed step 0.01 instead of the default 0.02, I can avoid some of the interpenetration. However, that hardly sound like the proper way to fix this problem.

Here is a screen shot of the bodies colliding. The car on the right is shown completely and you can notice that the ones behind have penetrated the others to some extent.

To give more information that could be relevant:

There is no gravity
All the objects have rigid bodies
Their sizes are 3.5 x 6.8 and they are moving at 8 to 50 m/s
Each object has a conpounded collider made up of 3 box colliders
If I change the fixed step to 0.01 there is a lot less more interpenetration (as I mentioned). Other physics settings do not seem to have any effect
The object is moved by setting its velocity in the FixedUpdate function with rigidbody.velocity = XYZ until there is a collision, then there is no more processing done in FixedUpdate at all. I detect the collision with OnCollisionEnter and set a flag.
I haven't set any collision material, but I can't see that being a factor?

Solved

Thanks to everyone who helped me with the issue.

There were a few factors in play. First, there was the scale. What I did to figure this one is create an empty scene and put 2 cubes in there. I varied the size and position of the cubes (from 68x35 to 0.65x0.35 for size and the position by factors or 10 as well) and attached a script to move them, with variation in speed by factors or 10 as well. So all else being equal (same size on the screen and time to cross it), the size of the objects elected a different response to collision: big object got interpenetration, small ones none. I am not familiar enough with Unity to explain the cause of that, but it is reproductible.

A possible second factor was the shape of my colliders and how it may be possible that they screwed up the ejecting part. The colliders I had were not overlapping, so I simplified them to 2 boxes in the shape of a cross.

Finally I was setting the position of the objects manually in FixedUpdate and that caused some problems with interpenetration at lower scale (at higher scale, it didn't appear to matter). I changed that to work with the body velocity and it helped.

sentences:
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:
Cocos2d JS - Getting vector reflection I'm working on a small Breakout clone using Cocos2D-JS, without the use of a physics engine.

One of the things that baffles me was how the ball bounces. My friend came up with this:

  inputVector - 2(normalVector * inputVector)

I have no idea how to translate that in code. So I tried with this:

g_Ball.position = this.velocityComputer(cc.p(g_Ball.x, g_Ball.y), cc.p(this.x, this.y));

velocityComputer: function(inVector, thisNVector) {
    var prodVec = cc.pDot(inVector, thisNVector);
    var retVec = inVector - (2 * (prodVec * inVector));
    cc.log(retVec);
    // cc.log(blockNVec);
    return retVec;
},

But g_Ball doesn't change directions, and retVec simply logs NaN.

Any suggestions?

Thanks.

sentences:
Unity3D: Efficiently loading chunks in an infinite voxel engine I'm developing a voxel engine in C# using Unity and I'm currently trying to implement infinite terrain, so I took a look at other Unity voxel engines that have infinite terrain. I've seen three different ways of doing it:

Using a dictionary to store the chunks and store the block data in another dictionary
Using a dictionary to store the chunks and store the block data on every chunk
Using a fixed size array and shifting it every time the player moves

The engines using approach 1 and 2 were pretty slow at chunk loading.
The engines using approach 3 were faster but produced lag every time the player entered a new chunk.

I've already tried to implement it using approach 1, but my chunk loading speed got slower by about 10 times, so it was really unplayable.

How is it done in efficient or popular voxel engines like Minecraft or VoxelFarm?
Do you have experience with voxel rendering and know a better approach?

Thanks in advance!

sentences:
Unity3D: Facebook login into the game + Verification on Server Side I don't need to know the specific code required for that, but I want to understand at high level how can I implement that and what SDKs I have to use to achieve that.

Facebook PHP SDKs: Ok If I want to perform login with Facebook into my web page.
Unity3D's Facebook SDK: Ok If I want to perform login inside my App without a server (apart Facebook's servers of course).

What I want to achieve is:

User login into facebook from the App (just once, and eventually the option to log out on request of user, or to relog if login data expires)
Login is verified by my Server (actually a user should really have a facebook account)
Do not embed stuff like Facebook App ID in my App source code.

My server will store some data for each user and to identify users I need to be able to use some unique data provided by Facebook like session token etc. Of course the session token may change so I need anyway to be able to identify the user (to avoid losing memorized data).

sentences: GameMaker child objects not inheriting layer structure Using Game Maker Studio 2. I have a parent room. When I create a child room to that parent, it inherits everything properly. But when I add a feature to the parent room, or simply rename the layer in the parent, the child does not inherit or update properly. But if I toggle 'inherit', now I get the original layer as well as the edited layer, when all I expect to see in the child object is the edited layer. This doesn't seem to be expected behavior, any idea what's up?

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:
unity android output is about 120mb even with just an empty scene there is a lot of content in my project but as a test I just chose a empty scene with one sprite to build but the apk output size is about 120mb.

I think there is an options or setting or platform support that makes it much big but I don't know what it is.

thank you for helping

sentences:
Sharing the XNA executable of my game on dropbox I'm currently making a game and I have my artist living in a different city as me.  We share a dropbox folder so that I can see her art, and I thought it should be easy to copy the debug bin folder into the dropbox so that she can see it.  This doesn't work (I can't even run it), so what could I do?

EDIT:

I run the executable in the dropbox folder, and immediately I get the "game.exe" has stopped working.  So obviously I have XNA installed, but my game can't run in this folder.

sentences:
How can one impliment multiple control schemes for a single player? I am working on a platformer and I want to have the player be able to switch control types based on items that may be carried + default controls for things such as water, in the air, on the ground etc...

I understand how to make a player move in anyway I desire but I don't understand how I can encapsulate these behaviors into their own classes and call and apply them to the player when needed.

The way I have it is this:

Input is handled by the input class.
During the update, the player looks at the input class.  It then figures out how it should move itself with a bunch of if statements to figure out what rule set should be applied. For example:  Am I in the water?  Am I on the ground? Am I in the air?  and so on.  Based on the previous questions the player object then decides how to interpret the input.  After everything is done, the results are edited by world rules which applies things such as gravity, etc...

This seems to work but it is not elegant and results in duplicated code.  Its ugly.  How should I set up some classes and how should they talk to each other?  All I manage to do is make a mess of my code trying to class it out.  I have searched around for sometime on how I need to do this but can't find anything.

Any pointers on where I can go to figure this out?  Any advice?  I just know I need the code contained so it's easy to debug later and figure out what is happening.

sentences:
Why do I have render problems happening frequently in my Unity scene? I am making vertical endless runner. My platforms are moving down, and the camera and players are remaining in the same location, resulting in the effect of player movement. The obstacles are generated and move in same direction as platforms.

The problem is obstacles rendered by the camera is not right. I mean that the obstacles are in camera's FOV but are still visible after some time when they reach the player to close.

sentences: How to create a polygon button in LibGDX? I need to make a button not a standard square shape, but a polygon shape.How to create a polygon button in LibGDX?

sentences:
Is it possible to use Windows Forms in an XNA project? Is it possible to keep a Windows Form inside a XNA project? I tried it but without success.

Below I'm showing how my main file is.

using System;

namespace JogoSuecaOnline
{
#if WINDOWS || XBOX
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            MainMenu menu = new MainMenu();
            menu.Show();
        }
    }
#endif
}

sentences:
Game Database Connectivity Java I'm developing a simple multi-player puzzle game in Java.  Both players should be able to view the same game board on his own computer. Then, when one player makes an action in the game (ex. drags an object onto a coordinate space), the game's view should update automatically on the other computer's game screen. I'd like all this to happen over the internet, not requiring both computers to be on the same LAN connection.

If I need to use SQL/PHP to accomplish this, I'm unsure how to design the database to accomplish something as simple as the following:

Player A drags element onscreen
Game sends coordinates of element to database/server

Player B's computer detects a change to an item in the database
Player B's computer grabs the coordinates of Player A's item
Player B's machine draws onscreen elements at the received coordinates

Could somebody point me in the right direction?

sentences:
Using Unity Post Processing v2, how can I apply processing effects to just the UI? I am using Unity 2018.3 with HDRP 4.9, and Post Processing 2.1.3.

I would like to apply post processing effects (i.e bloom) to the UI only.

I tried the 2 camera approach, but still can't get it working correctly.

I have a post processing volume that is global, and also one that is global but for the UI.  Not sure if this is correct.  Basically I don't want the first processing volume to apply to the UI.

I can apply post processing if I ignore all this second camera stuff and set the canvas to screen space camera.  I then get the effects like bloom applied to the UI.  However, I want to have different post processing for the UI, the global bloom is too much.

First image is the UI Camera.

Second image is the main camera.

Third image is the Canvas for the UI.

sentences:
Unity Performance: Recycling Pooled Objects OR Re-Instantiating? Re-using pre-instantiated objects in a pool.
Destroying then re-instantiating objects in a pool.

Both pools are limited.

When creating loads of objects which is better for performance?

sentences:
Scene for Computer Screen We are developing a scene that will involve heavily interacting with a "touch screen monitor" in the scene.. Because the workflow of the touch screen will need to be dynamic we are creating a REST API that Unity will fetch JSON data and use that to build out the various parts of the UI. For instance, we get a JSON file that has a list of users and attributes and build out UI elements with that data.

The question is should I build out the display and underlying logic as a 2D scene that I add in to our 3D room or just build it all in the 3D scene.

I want to abstract away as much of the logic as I can for the interactive screen; I want to make sure we can drop this screen in a different Scene down the road without too much reverse-engineering.

Sorry if this is a straightforward question, my background is software dev, not game design.

sentences:
Special relativity shader in GLSL I'm trying to implement a GLSL shader which helps understanding special relativity Lorentz Transformation.

Let's take two axis-aligned inertial observer  O and O' . The observer O' is in motion w.r.t observer O with velocity v=(v_x,0,0).

When described in terms of O' coordinates, an event P' = (x',y',z',ct') has transformed coordinates (x,y,z,ct)= L (x',y',z',ct')

where L is a 4x4 matrix called Lorentz transformation which helps us writing the coordinates of event P' in O coordinates.

(for details look http://en.wikipedia.org/wiki/Lorentz_transformation#Boost_in_the_x-direction)

I've wrote down a first preliminary vertex shader that apply the Lorentz transformation given the velocity to every vertex, but I can't get the transformation to work correctly.

vec3 beta= vec3(0.5,0.0,0.0);
float b2 = (beta.x*beta.x + beta.y*beta.y + beta.z*beta.z )+1E-12;
float g=1.0/(sqrt(abs(1.0-b2))+1E-12); // Lorentz factor (boost)
float q=(g-1.0)/b2;

//http://en.wikipedia.org/wiki/Lorentz_transformation#Matrix_forms
vec3 tmpVertex = (gl_ModelViewMatrix*gl_Vertex).xyz;
float w = gl_Vertex.w;

mat4  lorentzTransformation =
        mat4(
            1.0+beta.x*beta.x*q ,   beta.x*beta.y*q ,   beta.x*beta.z*q , beta.x*g ,
            beta.y*beta.x*q , 1.0+beta.y*beta.y*q ,   beta.y*beta.z*q , beta.y*g ,
            beta.z*beta.x*q ,   beta.z*beta.y*q , 1.0+beta.z*beta.z*q , beta.z*g ,
            beta.x*g , beta.y*g , beta.z*g , g
            );
vec4 vertex2 = (lorentzTransformation)*vec4(tmpVertex,1.0);

gl_Position = gl_ProjectionMatrix*(vec4(vertex2.xyz,1.0) );

This shader should apply to every vertex and perform the non-linear Lorentz transformation, but the transformation it performs is clearly different from what I'd expect (in this case a length-contraction on x-axis).

Has somebody already worked on special relativity shader for 3D videogame?

sentences:
How to know if two surface are in the same direction? In my code I creat a Mesh that are composed by multiple tile. those tile can have edge that are shared, and I need to know if the normal of the tile that have shared edge have the same direction, because I calculat the normal of the edge to smooth the light. before I used the Vector.Dot() , but I've sometimes two tile that have a curve that make impossible to use this function as you can see in the 4th image.
and the only information that i have in the calcul is the 2 normal of the tile.
 img 1 : diferent direction
 img 2 : diferent direction
 img 3: same  direction
 img 4: same  direction
 img 5: same  direction

sentences:
Best data types for DNA, edibles and creatures So I am making a sort of continuous evolutionary system in the Unity3D engine. Currently I have a DNA class that has values that gets applied to a Creature object on initializing e.g.:

public class DNA{
    public float maxSpeed;
    public float foodWeight;

    public DNA(float maxSpeed){
        this.maxSpeed = maxSpeed;
        this.foodWeight = foodWeight;
    }
}

Where every Creature has a public DNA variable that gets set when instantiating a population of Creatures via a GameManager class. In this "ecosystem" I want to have the creatures crave for food and try to avoid the poison.

My question isn't about the reproducing or natural selection part, but more about what the best kind of data type for each object is. Since I want the project to have expandable amount of Creatures, sorts of food etc.
Is the best way to handle all data via one GameManager, or should I seperate it in for example CreatureManager, FoodManager etc.?

Maybe a PopulationManager of some sorts?

Is the current setup for the DNA data optimal?
Also, currently I have food and poison just as two prefabs and detect collision (and add or substract health whether it's food or poison via tag), wouldn't it be smarter to create a struct for food and poison so I can later on expand on this?

Sorry if any of the given information is unclear or a bit vague, please say so if this is the case! I would be glad to clarify and add any needed information.
Thank you for reading through the entirety of my question, thanks for your time! :)

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:
Resources to help study of Quake 3 engine Are there good resources ( manuals, tutorials, etc ) to start studying the code of the Quake 3 engine beyond the code itself?

I'm very interested in know how it's structured for educational purposes and maybe to do some modifications.

sentences:
Zobrist Hashing equivalent for Simple Knights Game with only 1 unique piece I looked over the Zobrist hashing function used for getting a unique hash id of the board state in a chess game. https://en.wikipedia.org/wiki/Zobrist_hashing

Martin Fierz explains it very well in his post:

  Assume you have a board with S squares and P different types of
  pieces. You allocate an array:

int zobristnumbers[S][2*P];

  and fill it with random numbers. The hash number is now calculated as
  an XOR over the occupied squares of the entire board:

key = 0;
for(i=0; i<S; i++) {    if(board[i] != EMPTY)
  key ^= zobristnumbers[i][piece[i]];
}

Now this works very well for chess because you have 6 unique pieces and 64 squares - so the probability of getting a clash in the keys is very small.

I am trying to find a variant of this hashing function or another one, which would work smoothly in a more simple zero-sum game called Knights: 49 squares, and only one kind of piece - a knight from chess - which moves exactly like a knight in chess.

I want to use it as a transposition table key, for storing best moves and game states.

Any ideas or hints of how could this be achieved?

Thanks!

sentences:
Cocos2D SpriteBatchNode vrs. SpriteFrameCache… I do not see any performance difference I have tried using both ways...

adding the .png file on the cache with SpriteFrameCache..
adding .plist with spritebatchnode adding the correspoding .png file, I didnt see any performance difference.

In my test I keep adding and adding objects with the same image.. in this case a bullet... eventually the app crashed because it ran out of memory. Same thing happened to both situations with SpriteFrameCache and SpriteBatchNode they both dropped FPS to 30(when its supposed to be 60) and then just crashes...I understand the scenario is not real.And obviously its destiny its to crash if I just keep adding images without destroying objects that are no longer in use...but the question remains.

I saw the same performance issue, however I read that SpriteBatchNode makes only one draw call making it best performance practice. Has anyone tried and can confirm the performance difference and exactly how can you prove this performance difference in code and in the app?

sentences:
How to make an irregular shape that displays how far a unit can move through the map? I'm still new to programming, and I was wondering if there is a way to make an irregular shape that displays how far a unit can move through the map taking in account pathing around obstacles. For example, as shown in the overworld of Total War:

I do not want to brute force it by checking every pixel that is in range as that's probably too slow to do in the game maker engine.

The pathing uses the mp_grid of game maker which I heard is A* (but I don't really know what that means or how it affects what I want to accomplish).

Is there a way to get a similar thing in a 2D space, but not necessarily as precise?

sentences:
How can I set only the players X rotation to 0 in Quaternion.Slerp in Unity? I want to set the players X axis to zero while he is turning to the target Object but I dont get it to work.

Code:

public float rotationSpeed;

void OnMouseDown()
{
        //PLAYER ROTATION TO ORE OBJECT
        var rotation = Quaternion.LookRotation(transform.position - player.transform.position);
        player.transform.rotation = Quaternion.Slerp (player.transform.rotation, rotation, rotationSpeed * Time.deltaTime);
    }

sentences:
Custom shadow mapping in Unity. Works with preservative Light view but not with Orthographic So about a week ago I decided to make my own shadow mapping technique in Unity based on my understanding of the whole thing. The entire experience was somewhat successful. I learned a lot and I get to correct a lot of things such as the MVP matrix and the math behind it.  One thing though didn't work as planned and I don't know why.

First lets talk about what worked. I wrote a replacement shader that will show the depth of every object based on the Light Position/perspective. Therefore I made a custom Light GameObject that act as a camera/light with that replacement shader attached to it, and I record everything the Light sees into a render texture.

Then I made a second Camera which is basically a child of the main camera, and sees what the main camera see with the exception of the replacement Shader that I attached previously to the Light gameobject. again I recorded everything from the camera to a render texture as well.

After that, I wrote a basic Shader that does a basic light calculation and make a the shadow comparison between the two textures, and determines whether a fragment in a shadow or light. Also, I added a shadow Bias as well to eliminate any artifacts.

            struct appdata {
            float4 position : POSITION;
            float3 normal : NORMAL;
            float2 uv : TEXCOORD0;
        };

        struct v2f {
            float4 position : SV_POSITION;
            float2 uv : TEXCOORD0;
            float3 normal : TEXCOORD1;
            float3 worldPos : TEXCOORD2;

        };

        float4 _Tint;
        sampler2D _MainTex;
        sampler2D  SahdowMap_Light, SahdowMap_View;
        float4 _MainTex_ST;
        float4x4 WorldToCamera, WorldToLight;
        float3 _LightDir1;

        v2f VertexProgram(appdata v) {
            v2f i;
            i.position = UnityObjectToClipPos(v.position);
            i.worldPos = mul(unity_ObjectToWorld, v.position);
            i.normal = UnityObjectToWorldNormal(v.normal);
            i.uv = TRANSFORM_TEX(v.uv, _MainTex);
            return i;
        }

        float Shadow_Cal(v2f i, sampler2D DepthMap,float4x4 space) {

            float4 projected2 = mul(space, float4(i.worldPos, 1.0f));
            float2 uv = (-projected2.xy / projected2.w) * 0.5 + 0.5;
            float Shadow = tex2D(DepthMap, uv).r;

            if (uv.y > 1.0)
            Shadow = 0.0;

            return Shadow;
        }

        float4 FragmentProgram (v2f i) : SV_TARGET {

            float LightDepth = Shadow_Cal(i, SahdowMap_Light, WorldToLight);
            float ViewDepth = Shadow_Cal(i, SahdowMap_View, WorldToCamera);
            float bias = max(0.05 * (1.0 - dot(i.normal, _LightDir1)), 0.015);
            float Shadow = LightDepth + bias < ViewDepth ? 0 : 1;

            float4 Texture = tex2D(_MainTex, i.uv);
            float3 lightpos = _LightDir1 - i.worldPos;
            return saturate(dot(lightpos, i.normal)) *_Tint * Texture * Shadow;
        }

The problem is when the Light is on perspective, this works perfectly fine as shown above, but when I switch the light camera to Orthographic this happen:

I tried many different things to fix it but I failed.
I would love your insight in this whole thing, your thought, solution or even a suggestions.

You are free to download the whole project as a package here Download

Special thanks to DMGregory.

sentences:
How to implement GIF insertion in Unity? "XYZ App doesn't support image insertion here" I'm making an Android App with Unity, which has a chat service in it.

And I would like to handle sending images or GIFs via Gboard.

Currently when the user selects a TextField, his keyboard comes up, which is let's say GBoard.

And now when I click on a GIF or a Sticker, it says

  XYZ App doesn't support image insertion here

So how could I implement it?

Or more precisely, how can I define what method will be be called in my application when the user tries to send a GIF?

Because my first thought to implement it, is like it's done in all other apps:

every GIF would be in a separate message, and when the user clicks on a GIF it instantly sends a special GIF message, which will be rendered for example as an animated texture.

But how could I subscribe to this event in the first place?

Thanks in advance!

sentences:
Stretch the game to fit the game window, in Unity 5 (Desktop) I want to make it so that when the user re-sizes the game window, the game is stretched to fill the window.
(Similarly, for Android) I want it to be stretched to fit the screen as well.

The game's real resolution is supposed to be 720x1280 (16:9 equivalent). In the image on the left you can see the actual resolution.

I can see that unity automatically re-scales it everytime the game window is re-sized, but it kind of keeps the same aspect ratio. This results in either black bars or part of the game being off-screen. How can I scale my game based on the current window aspect ratio ? I know the graphics will get distorted.

Isn't there a way to stretch the game without keeping the same aspect ratio, within the unity interface ? If not, how could I do that within a script ?

In xna or libgdx, I would simply add a scale matrix on every spriteBatch.Begin() method call. That scale would be based on the (current window width, current window height) and the ("real" game width, "real" game height).

For example, since my game is 720x1280, if you had your window re-sized at 500x500, I would scale the graphics by 500/720 on X axis and 500/1280 on Y axis. And then I would have to scale the inputs by 1/scale matrix. I need to know how this works on unity. Perhaps, setting Camera.main.aspect to the current aspect ratio of the current window (I could calculate that everytime the window is resized), would solve the problem (?), but is there another option ?

I assumed that supported aspect ratios would do just what I needed. But when I re-size my game window to 720x1080 (4:3 equivalent) down from 720x1280 (16:9 equivalent) it just adds black bars. When I want the game to stretch, in all cases.

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:
How can I render a simple lattice in LibGDX? I have searched all over, but I can't find what I think will be a simple answer. I am using Opengl ES 2.0, and LibGDX. I simply want to use GL_LINES primitives to create a lattice structure.

I have used shapeRenderer with the following code:
in create():

shapeRenderer = new ShapeRenderer();
shapeRenderer.setProjectionMatrix(cam.combined);

in render():

shapeRenderer.setProjectionMatrix(cam.combined);
shapeRenderer.begin(ShapeType.Line);
shapeRenderer.setColor(0, 1, 0, 1);
for (float i = -10; i <=10; i++) {
    for (float j = -10; j <= 10; j++){
        shapeRenderer.line(i, j, -10, i, j, 10);
        shapeRenderer.line(-10, i, j, 10, i, j);
        shapeRenderer.line(j, -10, i, j, 10, i);
    }
}
shapeRenderer.end();

The problem is, this is not a model instance, thus doesn't seem to use the RendererContext (GL_DEPTH_TEST, etc.). When I render the lattice this way, it either shows up entirely behind my models, or entirely in front of them (depending on the order I render them in the render method).

Is there a way to build a model which is simply a set of lines to be rendered with Opengl primitive GL_LINES? Any pointers would be greatly appreciated.

sentences:
Correct Blitting 2 surface problem this is a graphics/math problem.
Consider this 2 sprite / surface

As you can see they are a tank and his gun turret.
Now, i manage the turret rotation, and it works, and, also, the rotation of the tank on the screen.

What it'snt work is the correct "blitting" of the turret on my tank.

The problem is that the turret is never blitted correctly on the tank.
This is a math problem, and i'm not so good in math !
How can i correct blit the turret centered on the "right" hole of my tank sprite ?

I'm using c# and sdl.net and actually i blit the turret with this code ( 13,13 are the X and Y position of the 'black' hole of the tank, but, i know, this is not the right method to blit it!):

            Surface tmpsurf = new Surface("graphics/tank_turret_long.png");

            Surface turretSurf = tmpsurf.CreateRotatedSurface(cannonangle);

            turretSurf.Transparent = true;

            turretSurf.TransparentColor = Color.Black;

            Point posTurret = new Point(13+this.X,13+this.Y);
            Video.Screen.Blit(torrettaSurf,posTorretta);

Thank in advance

sentences:
RawInput -- Getting the system default mouse and keyboard I'm using RawInput for device management, in a project that I have been working on for some time.  It works great, really, but...

After some hardware changes on my development system, including the addition of a second Wacom device, I'm having difficulty getting RawInput to enumerate the default mouse and keyboard input devices without going in and plugging hard values into the enumeration code.

When I call GetRawInputDeviceList  and sort through the device instances based on their RawInput DeviceType, I have 5 keyboard devices and 6 mice, along with a slew of non-specific HID devices.  Usually, the first keyboard device returned is the real default system keyboard -- but not always.  Adding or removing USB devices between application runs almost always breaks it.

Digging deeper into the enumerated device instances, I thought that examining the RawInputDeviceInformation structure would help.  For some devices, especially older input devices, there's a value that allows you to identify which device instance is a real physical device and not one of those phantom/pseudo devices.  DeviceInformation structures on keyboard device instances all report a differing number of keys, with all the other significant values -- vendor, usage page, usage, etc. being identical.  Unsurprisingly, the reported number of keys doesn't even reflect the actual number of physical keys on the keyboard.

DirectInput identifies the default system mouse and keyboard, and although it's based on RawInput, does it use RawInput to achieve this?  Switching away from RawInput is not an option for me because of the other devices I am operating with it (Wacom, Logitech G19 etc).   Any advice on how to straighten this out would be gratefully received, with thanks!

sentences:
2-components color model RGB is the natural color model for OpenGL. But a lot of other color models exist.
For example, CMY(K) for printers, YUV for JPEG, the little cousins YCbCr and YCoCg, HSL & HSV from the 70's, and so on.
All these models tend to share a common property : they are based on 3 components.

Therefore my question is :
Does it exist a 2-components color model ?
I'm surprised to not find any. I was expecting something along the line of Hue+light could exist.
I guess it cannot be as "complete" as a true 3-components color model, but a fine-enough approximation will be good for my usecase.

The end objective is to store the 2 components into a single BC5 texture (GL_COMPRESSED_RED_GREEN_RGTC2 in OpenGL). The 3rd component requires a second fetch into a second texture, which hurts performance.

sentences:
What are registers in HLSL for? I've read this document about HLSL registers, but it's more of a syntax description and not a purpose explanation.

What are registers in HLSL, actually? How and when do I use them? What happens if I don't (what's the default)?

sentences:
How to implement a configurable spring force to SpringJoint2D like SpringJoint does? I'm working in unity 5.3.4f1.

Looking at the SpringJoint2D class I can't seem to find a similar "spring force" as in spring in SpringJoint.

Is there any other way to make a spring stronger in SpringJoint2D?

If not, the only option I see is to inherit the Joint2D parent class and build my own spring joint 2D.

sentences:
How can I rotate about an arbitrary point in 3D (instead of the origin)? I have some models that I want to rotate using quaternions in the normal manner, except instead of rotation about the origin, I want it to be offset slightly. I know that you don't say, in 3d space, that you rotate about a point; you say you rotate about an axis. So I'm visualizing it as rotating about a vector whose tail is positioned not at the local origin.

All affine transformations in my rendering / physics engine are stored using SQT (scale, quaternion, translation; an idea borrowed from the book Game Engine Architecture.) So I build a matrix each frame from these components and pass it to the vertex shader. In this system, translation is applied, then scale, then rotation.

In one specific case, I need to translate an object in world space, scale it, and rotate it about a vertex not centered at the object's local origin.

Question: Given the constraints of my current system described above, how can I achieve a local rotation centered about a point other than the origin? Automatic upvote to anyone who can describe how to do this using only matrices as well :)

sentences:
How to make an object that has no rigidbody2d component smoothly fall on the ground in Unty2d? I have two character in my game: enemy and main character. Enemy can throw different objects into the main character. For this moment i am doing this action in such way:

void FixedUpdate(){
    if (CanMove){
        transform.position = Vector2.MoveTowards(transform.position, TargetPlayer.transform.position,  15 * Time.deltaTime);
    }
}

public void StartMove(bool canMove){
    CanMove = canMove;
    TargetPlayer = GameObject.FindGameObjectWithTag(Tag).transform;
    rigidbody2D.gravityScale = 0;
}

This script is attached to the prefab of the object that will be thrown into main character by the enemy. This script is working, but in this case the object that was thrown will follow  by main character all the time, because of this line of code:
transform.position = Vector2.MoveTowards(transform.position, TargetPlayer.transform.position,  15 * Time.deltaTime);

To my mind this is not good, because i want to give my player the opportunity to escape from the object that was thrown at him. For example run away. When the object reaches the player position (and the player is on the new position) - he will simply fall onto the ground. I did this, but this wasn't looking nice, because when the object was reaching his position, he was hanging in the air. Can anyone give me an advice how to make this process more good-looking?

Edit:
I need to make good-looking movement of the object, that was thrown by the enemy into main character. Every frame i am moving the instantiated object to the current player position. So the player can't escape from that object, because he always knows current player position. I think that this is not good idea, and i want to give to player an opportunity to run away from that object. In this case i am saving the position of the player into variable, and then every frame i am moving the instantiated object to that position. So when the player run away, the object, that was thrown doesn't know anything about new position of my player. But this is looking not good, because when the object is reaches its destination position he hangs in the air((

Edit # 2:
I was thinking about destroying that object anyway, but to my mind this will not look good: the object is moving and suddenly disappears from screen(. May there is some ways how to make him smoothly fall onto the ground? The problem is in that this instantiated object has no Rigidbody2d component attached to it, so it will never fall down by itself.

sentences:
How to linearly "blend" between multiple 3D points? I have a set of 3D points that I need to "blend" between. Lets say I have points [A,B,C] and I have the amount I want to blend each as [0.5, 0.2, 0.8], how can I blend between these points with the amount I need?
Obviously if I just had 2 points I could use the vector math (A + (B - A) * ratio).
Method 1:
I'm currently using a weighted average, which I suppose gives me the weighted center, but I need to try different blending styles to see visually which looks best.
Method 2 What If I did this:

Calculated a difference vector, each 3D point against the default point (I do have a default point)
A - Default

Then multiplied this difference with the blend amount
(A - Default) * Amount

And added these up, would that work? What result would I get?
(A - Default) * A_Amount + (B - Default) * B_Amount + (C - Default) * C_Amount

sentences:
.rrr subscript for float type I'm a little confused with this construction:

float sdcolor = MyColor.r; // MyColor has float4 type
float rcolor = sdcolor.rrr; // .ggg or .bbb isn't working

return float4(rcolor , rcolor , rcolor , 1);

Hence the question: how it's possible to subscript anything from a float type? What is the meaning of the .rrr subscript?

sentences:
LibGDX - why are the shapes from my ShapeRenderer resizing with my viewport? I have created a class called Node which I would like to (currently) contain a single Actor (later I will be adding additional actors, but for now I'm sticking with just one).  The actor is called "body" and is just a container for the position/size of the "Node" actor.

I have also created a Label which I am drawing with a custom font file.

What I am having issues with is that when I RESIZE my app window (on desktop, I'm not currently using Android or any other targets), the LABEL works just fine (stays the same size on my screen), but the Node gets resized with the main window.  That is, if I make the window twice as wide, the square stretches to be twice as wide as it was before.  Why is this?  The coordinates I am using work exactly as I expect UNTIL I resize the screen.  Is there something else I have to do in the resize() method?

App class:

public class App implements ApplicationListener {
    private Stage stage;
    private ShapeRenderer shapeRenderer;

    @Override public void pause() {}
    @Override public void resume() {}

    @Override
    public void create() {
        stage = new Stage(new ScreenViewport());

        shapeRenderer = new ShapeRenderer();

        //  FONT stuff  //  https://github.com/libgdx/libgdx/wiki/Gdx-freetype
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/arial.ttf"));
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.color= Color.ORANGE;
        parameter.size = 24;

        BitmapFont arialFont = generator.generateFont(parameter);
        generator.dispose();

        Skin skin = new Skin();

        Label.LabelStyle labelStyle = new Label.LabelStyle();
        labelStyle.font=arialFont;
        skin.add("default", labelStyle);

        Label label = new Label("DOOT", skin);
        label.setX(110.5f);
        label.setY(110.5f);

        stage.addActor(label);

        stage.addActor(new Node(shapeRenderer));
    }

    @Override
    public void resize(int width, int height) {
        // See below for what true means.
        stage.getViewport().update(width, height, true);
        shapeRenderer.updateMatrices();
        System.out.println(""+width+"x"+height);
    }

    @Override
    public void render(){//} {
        Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act(delta);
        stage.draw();
    }

    @Override
    public void dispose() {
        stage.dispose();
    }
}

Node class:

public class Node extends Group {
    private Actor body;
    private ShapeRenderer shapeRenderer;

    public Node(ShapeRenderer sr) {
        body = new Actor();
        body.setBounds(10.0f, 10.0f, 100.0f, 100.0f);
        shapeRenderer = sr;
    }

    @Override
    public void draw(Batch batch, float parentAlpha) {
        super.draw(batch, parentAlpha);

        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.box(body.getX(), body.getY(), 0.0f, body.getWidth(), body.getHeight(), 0.0f);
        shapeRenderer.end();
    }
}

sentences:
How can I send commands to only certain clients? I am building a multiplayer game server with Unity. In the game there are players moving around the map. Now, because this map is quite large compared to the number of players, I was thinking to have the server send each clients' position only when they are nearby, and then slow the rate down when they are far away.

At first I was using the convenient SyncVar to do sync everyone's position, until I discovered its shortcomings, that is there is no conditional way to either sync or not a certain value.

I came out with this player synchronization class so far (I removed all optimizations for simplicity):

public class PlayerSyncPositionConditional : NetworkBehaviour {

    Vector3 lastPos;

    void FixedUpdate () {
        TransmitPosition();
    }

    [ClientCallback]
    void TransmitPosition () {
        CmdProvidePositionToServer(transform.position);
    }

    [Command]
    void CmdProvidePositionToServer (Vector3 pos){
        transform.position = pos;
    }

}

Now, what this code does is nothing more than sending its position to the server: when I am looking at the dedicated server instance, each players' position is correct. Also, as expected, each client will not receive any updates.

From my research, I found that instead of SyncVar, I can use Server and ClientRpc to dispatch commands from the server to all clients, so this

 [Server]
 public void MoveTo() {
     RpcMoveTo(transform.position);
 }

 [ClientRPC]
 void RpcMoveTo(Vector3 newPosition) {
     transform.position = newPosition; //this will run in all clients
 }

would move all clients to the transform current position whenever needed.

Now, the problem is that those commands, apparently affect every client, while I only want to affect ones that are near each other.

I know how to have the server issue the MoveTo at any rate I want, setup more than one interval, etc. but I don't know how to have it send only to certain clients at a single time.

I am not asking for the code itself, but I am getting really confused with all these client/server architecture concepts, which class does what, etc. so any heads-up will be greatly appreciated.

sentences:
Creating object in front of player, with some distance I want to create objects in front of player with some distance, so that prevents hit with player immediately. So first, I get the global player position and direction vector which player towards:

var player_position = player.transform.origin
var player_forward_vector = player.global_transform.basis.z

And then give additional distance:

var spawn_position = player_position
spawn_position.z -= player_forward_vector.z + 100

And then set the position:

var asteroid_instance = asteroid_scene.instance()
asteroid_instance.transform.origin = spawn_position

When I run the game, first it seems work, however when I rotated the player, still object spawned same position, not in front of where I'm looking at.

Here's the video to demonstrate:
https://youtu.be/zvMU9ad33SA

Why object doesn't created in front of player, instead keep spawns in same location? Any advice will very appreciate it.

Here's the full code of spawning object. Note that asteroid is just Rigidbody object with collision shape as child.

# AsteroidSpawner.gd
extends Node

onready var player: Player = get_tree().get_root().find_node("Player", true, false)
var asteroid_scene: PackedScene = preload("res://Asteroid/Asteroid.tscn")

func _ready():
    spawn_asteroids()

func spawn_asteroids():
    while true:
        spawn_asteroid()
        yield(get_tree().create_timer(2), "timeout")

func spawn_asteroid():
    var spawn_position: Vector3 = get_spawn_position()

    var asteroid_instance = asteroid_scene.instance()
    asteroid_instance.global_transform.origin = spawn_position

    # Push towards player
    var direction_to_player: Vector3 = player.transform.origin - spawn_position
    var speed = min(rand_range(5, 10), 10)
    asteroid_instance.add_force(direction_to_player * speed, Vector3())

    add_child(asteroid_instance)

func get_spawn_position() -> Vector3:
    var player_position = player.global_transform.origin
    var player_forward_vector = player.global_transform.basis.z
    var spawn_position = player_position
    spawn_position.z -= player_forward_vector.z + 100

    return spawn_position

sentences:
How can I simulate shattering glass? I need to make a simulation with stone thrown through a glass window. How can I accomplish that?

I mean, I was thinking about making a 3D model of a stone and glass in 3D Studio Max 2012, shatter the glass and export both to XNA 4.0 as .x models. Then in XNA make the animation - writing my own physics engine. Is it possible that way? Is it possible to destroy the glass in XNA after impact or should I do it in 3DS Max? By 'destroying the glass' I mean disconnect some previously shattered glass bits from each others, because depending on the start-speed and weight of the stone and resistance (hardness?) of the glass (all user-defined) the bits will disconnect from each other in different ways.

sentences:
Stop animation playing automatically I've created an animation to animate a swinging mace.

To do this I select the mace object in the scene pane, open the animation pane, and key it at a certain position at 0:00.

I'm prompted to save this animation in my assets folder, which I do, as maceswing

I then rotate the mace, move the slider through time and key it in a different position. I move the slider through time again, move the object to the original position and key it.

There are now three things in my assets folder:

maceswing appears to be my animation, but I have no idea what Mace Mace 1 and Mace 2 are. (I've been mucking around trying to get this working so it's possible Mace 1 and Mace 2 are just duplicates of Mace. I still want to know what they are though)

When I play my game, the mace is constantly swinging, even though I didn't apply maceswing to it. I can't stop it. People say there's some kind of tick box to stop it constantly animating but I can't find it.

My mace object only has an Animator component:

Unticking this component doesn't stop the animation playing so I have no idea where the animation is coming from. Or what the Animator component actually does.

I don't want this animation constantly playing. I only want it to play once when someone clicks a certain button:

var Mace : Transform;
if(Input.GetButtonDown('Fire1')){
    Mace.animation.Play('maceswing');
};

Upon clicking the 'Fire1' button, I get this error:

MissingComponentException: There is no 'Animation' attached to the "Mace" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "Mace". Or your script needs to check if the component is attached before using it.

There is no 'Animation' attached to the "Mace" game object, and yet I can see it swinging away constantly. Infact I can't stop it! So what's causing the animation if the game object doesn't have an 'Animation' attached to it?

My maceswing animation object:

sentences:
How to rotate a rigidbody with a Pid controller I would like someone to describe me how to use a PID controller to rotate a rigidbody with AddTorque to a specific position. (like a spacecraft that rotates the Y axis of rotation towards Camera.forward for example). Can anyone show it to me with a script?

Actually I already use this script to rotate with AddTorque but the object almost never stops at the precise point.

Vector3 camForward = Camera.main.transform.forward;
Vector3 rbForward = rb.transform.forward;
Vector3 torqueY = Vector3.Project(torque, Vector3.up);
Vector3 torque = Vector3.Cross(camForward, rbForward);
rb.AddTorque(torque);
rb.AddTorque(-rb.angularVelocity);

sentences:
Having trouble with constructors and the deque class I've recently been trying to make a better version of my previous remake of the classic snake game by implementing data encapsulation and abstraction. I also decided to replace my horrible choice of a linked list for holding the snake's tail co-ordinates with the more sensible choice of a deque. Since I am a beginner and I have honestly no clue what is going on (I'd be worried if I did know what I was doing), I would appreciate some assistance with helping me understand what is wrong with my usage of the deque and how I can fix it.

From what I can gather I believe it has something to do with improper usage of constructors, yet I still have not fully grasped the concept of constructors to be able to properly debug it.

SnakePart.h

#ifndef SNAKEPART_H_
#define SNAKEPART_H_

#include <deque>

class SnakePart {
public:
    void advance(int x, int y, bool loose_tail = true);
};

extern std::deque<SnakePart> parts;

#endif /* SNAKEPART_H_ */

SnakePart.cpp

#include "SnakePart.h"

void SnakePart::advance(int x, int y, bool loose_tail) {
        std::deque<SnakePart> parts;
        parts.emplace_front(x, y);

        if(loose_tail)
            parts.pop_back();
}

sentences:
FBX model from Blender doesn't show it's surface in Unity3D I've create a model from Blender and exported it as .FBX file. However when I import this into Unity, the surface is missing.how can i fix?

Screenshot attached:

in Blender it look like this:

in Unity it look like this which only shows it inside:

sentences:
How should I store a Game Database on Android? I'm looking at creating a game for Android and while I have most of the ins and outs worked out, the one thing I'm struggling with is how to store data for the game.

Ultimately, the game will be based off of a lot of pre-defined data and statistics so the obvious choice to me would be something like SQLite, but as I'm pretty new to the realm of Android and Game Development, I'm not 100% certain if this is the right route to follow.

The data will be general pre-defined data as well as player data (along the lines of careers stats - what place finished, etc).

I was wondering if there was a better/best practice solution that wasn't SQLite and that would provide said functionality and if so, could you point me in the right direction?

sentences:
In an artillery game how do I mask out the part of the terrain that was hit Let's say I want to make a really simple artillery game, something like Gorillas. I don't have any experience in games, just some basic understanding of OpenGL. I want to do this for fun and to learn something.

I figured out how to simulate gravity and generate simple terrain and how to do some collision detection. But I have no idea how do they mask out the part of the terrain that is hit with a projectile that leaves a hole in form of a circle.

I tried enabling stencil buffer and put a quad which has a circle texture on it expecting to mask out only the circle part, but it masked out the whole quad -- I mean it was a rectangle shaped hole and not a circle shaped one. Next I thought maybe some blending will do the trick but I didn't figure it out how. Or should I just draw a polygon with many edges to look like a circle and use that instead (with the stencil buffer)? I'm just curious how it is done. Can someone point me in the right direction?

sentences:
Implement Fast Inverse Square Root in Javascript? The Fast Inverse Square Root from Quake III seems to use a floating-point trick. As I understand, floating-point representation can have some different implementations.

So is it possible to implement the Fast Inverse Square Root in Javascript?

Would it return the same result?

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:
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:
Graphics2D.drawImage not working I'm quite new to java.

I'm trying to come up with my own game after watching a few video tutorials. However, I encountered a problem where I cannot draw an external image file that I loaded using the BufferedImage object.

The problem seems to be on the method that I'm using to draw the image on the screen, where I'm using Graphics2D.drawImage() method to draw.

Here is part of my code (I modified and skipped parts that seemed irrelevant to the topic):

Window Class

public class Window extends JPanel{
    public Window(int width, int height) {
        JFrame frame = new JFrame("Zerro's Game");

        frame.setPreferredSize(new Dimension(width, height));

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.setResizable(false);
        frame.setVisible(true);
        frame.pack();
    }
}

Game Class

public class Game extends JFrame implements Runnable {
    // Dimension for Main Frame
    private static final int WIDTH = 640;
    private static final int HEIGHT = 480;

    // Image
    private BufferedImage image;
    private Graphics2D g;

    public void run() {
        this.requestFocus();

        // For rendering purposes
        image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
        g = (Graphics2D) image.getGraphics();

        //Game Loop
        long now;
        long updateTime;
        long wait;

        final int TARGET_FPS = 60;
        final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;

        while (isRunning) {
            now = System.nanoTime();

            update();
            render();

            updateTime = now - System.nanoTime();
            wait = (OPTIMAL_TIME - updateTime) / 1000000;

            try {
                Thread.sleep(wait);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    private void render() {
        if(gameState == STATE.GAME) {
            handler.render(g);
        } else if(gameState == STATE.MENU) {
            menu.render(g);
        }
    }

Menu Class

public class Menu extends KeyAdapter{
    private BufferedImage image;

    public void render(Graphics2D g) {
        try {
            image = ImageIO.read(getClass().getResource("/Pixel_Background.png"));
            g.drawImage(image, 0, 0, null);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

This code results in making empty frame without any content inside. I confirmed that it properly loads an image by using System.out.println(image.getHeight()) which prints out the exact height of an image that I'm using.

I've seen some comments in the internet that I need to use paintComponent() method. However, I'm just wondering if it's not a good idea to use paintComponent() in game development as the video tutorials (3 of them) that I watched didn't use such method to draw images.

Also, I'm wondering about the reason why we pass in the Graphics2D object as parameter in all the render() methods.

sentences:
(Unity) Serializing Data with Custom Object Stored by Reference I have a custom class that I serialize/deserialize to/from file(s), and is not guaranteed to be identical each time the game runs (in this example, a language pack. it's possible to fix a typo manually). As a result, I do not use UnityEngine.Object on it, and deserialize it each load. However, some classes that implement UnityEngine.Object (Monobehavior), have references to it. these references must persist (so that the language stays the same each load)
As per the Unity Scripting page, https://docs.unity3d.com/Manual/script-Serialization.html, this can cause undesired behavior: "If you store a reference to an instance of a custom class in several different fields, they become separate objects when serialized. Then, when Unity deserializes the fields, they contain different distinct objects with identical data."

Naturally, I'd prefer this not be the case. again from Unity documentation linked above: When you need to serialize a complex object graph with references, do not let Unity automatically serialize the objects. Instead, use ISerializationCallbackReceiver [interface] to serialize them manually.

I know how to implement the interface. How do I preserve the reference? (Disclaimer: not an expert in serialization, so if it's a simple fix, I'm sorry. Unity documentation doesn't provide an example for references).

sentences:
How to solve a pow equation? I have an formula that generates a number from  20 to 180 (degree).

var a = 20 * Math.pow(str/dist, 1.5));
    a = Math.max(180, w);

Using this formulae, i can generates some arcs and draw them just fine and depending on dist (which is cursor distance from target), the arc is either very wide, or narrow (pow basicly makes it so the arc expands non-linear).

This approach works in one direction: Having a location, and a distant point, to create arc.
I need a counter-equation that gives me the required DIST for a given angle.

i.e.
assuming str is 800, what is the value of dist so a would be 114 (or 68 or anything).

114 = Math.pow(900/dist, 1.5)) // ????

How can i solve this equation for dist ?

thanks,

sentences:
How can I get a list of servers hosted by my players? I'm writing a multiplayer 2D online game, where game servers are hosted by the players. I want to show players a list of the currently hosted game servers.

How would I do that? I know how to let players host servers. But how would I then get a server list? Should I use a database? Is there an easier way?

sentences:
Automatic Left/Right movement First 2d game in Unity.
Started Character controller in C#.

Tried to get the character to move constantly right then once it hits the wall move left without needing any input from the player. Looked at a couple infinite runner character controller examples, but they seem to trick the character into thinking the player is holding down the right button in order to make the character run right infinitely "character.Move( 1, false , jump );".

Question: How to make the character start moving right automatically?

sentences:
Procedural object generation and unique identification My question relates to procedural content generation and data management of the emerging objects in a database.

I assume a networked game, with a server-client model. Unspecified objects in the game world are generated while the game is running with procedural algorithms (for example perlin noise). The players (/clients) can modify the properties of these objects, but have to notify the server of these changes. How could this communication address unique objects, so that both the server and the client know of which object they are speaking?

Not only the inner properties of the objects can differ, but also visible, such as the position. When the player wants to select one of these objects the game has to find out the id - does anyone know which methods or algorithms can accomplish that?

sentences:
UDP server in unity not working I know there are a lot of UDP examples out there, but I really need to know specifically what I am doing wrong. I have Wireshark monitoring my data traffic and according to that program Unity is not sending data at all. Could some of you coding wizards look over this and help me find my mistake?

public class heatLampControl : MonoBehaviour { //Ben Stewart, june 6th, 2016
                                           //this code controls the                      "Position" of the heat lamps, ie what angle the heat should be coming from. The
// value will be added to a new UDP connection to the dSPACE machine

//Update 6-10: Added UDP functionality, as accessing the UDP class that was created for this purpose turned out to not function correctly
public float lampIntensity = 0.0f; //Multiplier for relative intensity of the sunlight
GameObject sun;
public GameObject player; // dropped in via GUI
public bool isNight = false; // is it night? if so, heat lamp should turn off
public double sunAngle; // angle about the y axis. that is the only angle that can be controlled.
public bool isOn = false;
public string keyDown;
public int port;
public string dataStr;
byte[] data;
public GameObject cycle; //following three keep track of day/night cycle
public Day_Night.TimeOfDay tod;
public Day_Night dayNight;
public int strLength;
private IPAddress ip;
private UdpClient udp;
private IPEndPoint ipep;
public float fruitIntensity;
public float hayIntensity;
OlfactoryControl olfactory;
string hostname;
IPAddress[] ipList;
void Start () {
    hostname = Dns.GetHostName ();
    ipList = Dns.GetHostEntry (hostname).AddressList;
    port = 13722;
    cycle = GameObject.Find ("DayNight");
    dayNight = cycle.GetComponent<Day_Night> ();
    sun = this.gameObject;
    olfactory = GameObject.Find ("Olfactory").GetComponent<OlfactoryControl>();
    ip = ipList [0];
    ipep = new IPEndPoint (ip, port);
    udp = new UdpClient (13722);
}

// Update is called once per frame
void Update () {
    sunAngle = player.transform.eulerAngles [1] - Math.Atan2 (sun.transform.position [2], sun.transform.position [0]);// gets the positional angle of the sun compared to the player
    keyDown = Input.inputString;
    if (isNight || Input.GetKeyUp (KeyCode.L)) { // IF L is pressed down, light will come on
        lampIntensity = 0f;
        isOn = false;
    }
    if (!isNight && Input.GetKeyDown (KeyCode.L)) {
        lampIntensity = 1f;
        isOn = true;
    }
    tod = dayNight.tod;
//      if (tod == Day_Night.TimeOfDay.Idle)
//                      lampIntensity = 1.0f;
//      if (tod == Day_Night.TimeOfDay.SunRise) {
//          lampIntensity = (dayNight.timeOfDay / (dayNight.sunSet - dayNight.StartTime));
//      }
        hayIntensity = olfactory.hayIntensity;
    fruitIntensity = olfactory.fruitIntensity;

    sendUdp ();

}

//june 30th edit
void sendUdp(){

    dataStr = hayIntensity.ToString () + fruitIntensity.ToString () + lampIntensity.ToString ();
    byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes (dataStr);
    Debug.Log (dataStr);
    udp.Send (sendBytes, sendBytes.Length, ipep);
    Debug.Log ("Data sent to IP Address " + ip.ToString() +  " on port " + port.ToString());
}
}

sentences:
OpenGL: Is it possible to use VAO's without specifying a VBO On all the tutorials I can find about VAO's (Vertex Array Objects), they show on how to use them by configuring vertex attributes and binding a VBO (Vertex Buffer Object). But I want to create a VAO that will be configured for a set of VBO's in combination with a fixed shader, where each buffer uses the same data pattern (vertex, uv, color, etc). So, I want to create one VAO for multiple VBO's that will be drawn using one shader.

I couldn't find any demo on this, so I decided to just give it a try. But it doesn't work and crashes on the glDrawArray call. It looks like the VBO isn't bound. Here is the code I'm using:

Rendering:

/* Prepare vertex attributes */
glBindVertexArrayOES(vao);

/* Upload the buffer to the GPU */
glBindBuffer(GL_ARRAY_BUFFER, pool->next());
glBufferSubData(GL_ARRAY_BUFFER, 0, parts * buffer.stride() * 6, buffer.getBuffer());

/* Draw the triangles */
glDrawArrays(GL_TRIANGLES, 0, parts * 6);

glBindVertexArrayOES(0);

VAO Creation:

glBindVertexArrayOES(vao);

glEnableVertexAttribArray(ls.position);
glVertexAttribPointer(ls.position, 2, GL_FLOAT, GL_FALSE, buffer.stride(), 0);

glEnableVertexAttribArray(ls.color);
glVertexAttribPointer(ls.color, 3, GL_FLOAT, GL_FALSE, buffer.stride(), GL_BUFFER_OFFSET(buffer.dataTypeSize * 2));

glBindVertexArrayOES(0);

Where ls is a simple struct that holds the attribute locations.

In the Rendering part, swapping the glBindBuffer and the glBindVertexArrayOES around didn't work either.

So, the question is: Is it even possible to do so, or will I have to create for each buffer a VAO? And if I have to create a VAO for each VBO, is it possible to update the VBO's data using glBufferSubData in combination with a VAO?

sentences:
What is an appropriate OpenGL(ES)-based game engine meeting these criteria? I want to try my hands on a little shooter on the Android platform, and I'm looking for a full-featured 3D game engine. I can't afford to pay more than 400 € for a license, so expensive engines are excluded from the start.

These are my requirements:

The engine has to have good level editor (able to place entities, actors and triggers); so "graphics engines" like Irrlicht and Horde 3D aren't what I'm looking for.
The engine should be based on OpenGL Core and use shaders rather than the fixed function pipeline.
It shouldn't use octrees and BSP/PVS.
It needs to have decent occlusion culling because I need good frame rates on not-very-powerful graphics cards.
It should come with source code.

I like Horde 3D very, very much and I like it's smart design, rendering capabilities and compactness. Sadly, I can't use it due to the lack of tools.

So far I've come across Torque 3D, C4 engine, Shiva 3D, and Unity 3D.

Torque 3D is really nice, decent design, has good tools, good performance, it's really cheap and comes with source code. Sadly it's only DirectX for now.
Unity has a lot of features, decent performance and tools, runs on Android but they don't give source code within my price range.
C4 is good enough, has tools, and source code but there's a catch. While you have source code the source isn't ported to Android and the engine's owner expressly forbids anyone to port source code on other platforms or to release a game on not officially supported platforms.
Shiva 3D seems nice, too, supports Android, has tools but they don't give you source code license for a decent sum.

That's all I could find. I used the list on devmaster.net, I searched this site, I've searched gamedev.net, gamasutra, polycount.com and of course Google and Bing.

Any suggestions that could help me?

sentences: Using XAudio2 to Process Microphone Input I am trying to come up with a solution to process microphone input for a game. Not entirely sure where to start. I was looking into using XAudio2, but it doesn't seem to have support for microphone processing? Is this correct? What do most companies in the industry currently use?

sentences:
Particle Effects Start Glitching out My particle effects have gone crazy look:

In my game, bombs drop on castle and then explode

For the first few second of my game the particle effects for the explosion works.  The particle effects are made using the unity particle systems:

As you can see below, the particle effects in the scene view are also in the game view:

However after a few second the particle effects start to glitch out and while they appear in the scene view, they do not appear in the game view:

Above there is a massive explosion in the scene view but nothing in the game view.

I can make the particle effects work by doing a few weird things:

If I remove the walls on my castle the particles will suddenly work.  The walls just contain a sprite renderer component, no script or anything.

If I make a looping particle effect when the effect is visible on the game screen the particle effects start working but when I drag it off the screen  even though its still working(I see it in the scene view) because its not in the game screen my explosion particle effects instantly stop working.

I am super confused about why this is happening.

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:
Blender Texture Seam I am trying to follow this tutorial to create a brushed metal "start" button. (I am very new to all of this) I want the button to look nice when rendered in a game engine.

For some reason I can not figure out how to get the texture to wrap cleanly without seams. I modeled the "pill" part of the button using mirror and subsurf modifiers. The texture is a free version from cgtextures that is supposedly ready to be tiled. I created the various textures (normal/specular/etc) using CrazyBump as mentioned in the tutorial.

But now I'm stuck! The seems are driving me insane

sentences: How do I access the pixels of an SDL 2 texture? How exactly can one get to the RGBA pixel arrays of SDL 2.0 textures? Does the texture need to be specially initialized and locked down?

sentences:
Lat, Lon and elevation Conversation into unity coordinates I have came across a very vague project problem and its feasibility report or communication procedures I have to define. And here is the current scenario:

I have two applications
One is built on Unity3d (which is under my control)
The second  is also an application (which i don't know, and not under my
control-) but it is related to a map service app.

Now the actual thing I want to do is that: If a user click in the map application than, the touch should be recognize in the unity application too.

Suppose I have able to communicate with both applications and the map application providing me the latitude, longitude and elevation information on-click. Now the question is how do I convert its lat, lon and elev into my project work-space/unity coordinates?. I found 3D coordinates on a sphere to Latitude and Longitude, and its about sphere. I don't have sphere I have an environment where different models are placed precisely according to map (there is no dummy models, all are accurate) and the map projection is based on snake-grid.

sentences:
Share a function between two passes inside CG Shader for unity3d I'm writing a shader in CG language for Unity3d.
When making transparent object you need to create two similar passes in SubShader. First to render only back faces (with Cull Front) and second to render only front faces  (with Cull Back). But the code for vertex and fragment function is the same.

Is it possible not to double a code and declare some functions, that would be shared between passes?
I want to have something like in my code example.

Shader "cool shader" {
Properties {
    ...
}
SubShader {

    CGPROGRAM
    // need to declare vertexOutput somewhow here
    float4 sharedFragFoo(vertexOutput i) : COLOR  // How to make smth like this?
    {
        ....
        return float4(...);
    }
    ENDCG

    pass {
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        vertexOutput vert(vertexInput v) {
            vertexOutput o;
            ...
            return o;
        }

        float4 frag(vertexOutput i) : COLOR
        {
            return sharedFragFoo(i); // call the shared between passes function
        }

        ENDCG
    }

    pass {
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        vertexOutput vert(vertexInput v) {
            vertexOutput o;
            ...
            return o;
        }

        float4 frag(vertexOutput i) : COLOR
        {
            return sharedFragFoo(i); // call the shared between passes function
        }

        ENDCG
    }
}
}

sentences:
How to set blur on mouse over and remove on mouse out in AS3? How can I do it? I want to active glow when the mouse is over a Sprite and remove it when the mouse is out. Is it possible?

I have the following code:

var myGlow:GlowFilter = new GlowFilter();
myGlow.color = 0xFFFFFF;
myGlow.blurX = glowMobilha.blurY = 20;
var miniatura:MovieClip = _scene.d1[link];
miniatura.addEventListener(MouseEvent.CLICK,
                           function(e:Event):void {
                               MainSoundManager._sm.stopAllSounds();
                               GameManager.loadSection(link, false);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                               miniatura.filters = [myGlow];
                               miniatura.gotoAndStop(2);
                               _control.visible = true;
                               _controle.gotoAndPlay(2);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                           function(e:Event):void {
                               miniatura.gotoAndStop(1);
                               _control.visible = false;
                               _control.gotoAndStop(1);
                           });
miniatura.buttonMode = true;

I set the blur at:

miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                               miniatura.filters = [myGlow];
                               miniatura.gotoAndStop(2);
                               _control.visible = true;
                               _controle.gotoAndPlay(2);
                           });

How can I "hide" the blur at:

miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                           function(e:Event):void {
                               miniatura.gotoAndStop(1);
                               _control.visible = false;
                               _control.gotoAndStop(1);
                           });

UPDATE
I think I found the solution in the following code:

miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                           glowMobilha.alpha = 1;
                           miniatura.filters = [glowMobilha];
                           _controle.visible = true;
                           _controle.gotoAndPlay(2);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                             function(e:Event):void {
                             glowMobilha.alpha = 0;
                             miniatura.filters = [glowMobilha];
                             _controle.visible = false;
                             _controle.gotoAndStop(1);
                           });

is it the best solution?

sentences:
Centering camera on player div I've been making a roguelike-style game in HTML5 without using canvas (only divs) with pure JS (fiddle!). I've been trying to enlarge the tile size (font size) while keeping the player centered within the camera. For some reason, when the tile size isn't equal to the map size, the camera will be slightly off.

Note that the 3D effect is on purpose. Without it, the camera is still off center, and I believe it adds some much needed depth to the scene. :D

When tileScale (line 4 in the fiddle) is 9 (very undesirable; the dots on the player's y axis should be aligned, not at a slight angle):

When tileScale is 25 (on point!):

Here's some relevant (trimmed) code:

window.onresize = function(){
    game.viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
    game.viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
    game.windowSize = Math.min(game.viewportWidth, game.viewportHeight);
    // Droid Sans Mono has a ratio of 3:4 (width:height), conveniently.
    // This may be problematic. I'm not sure.
    game.tileWidth = game.windowSize*.6 / game.tileScale;
    game.tileHeight = game.windowSize*.8 / game.tileScale;
}

// Update the camera position (needs help?)
this.updateCamera = function(){
    // Get player coordinates (-.5 because we need to get the player tile center)
    // times the tileWidth plus the game window (inner square) size divided by two.
    var left = ((-game.player.x-.5)*game.tileWidth+game.windowSize/2)+"px";
    var top = ((-game.player.y-.5)*game.tileHeight+game.windowSize/2)+"px";
    game.planeContainer.style.left = left;
    game.planeContainer.style.top = top;
}

How can I ensure that the dots in the center of the screen will be always lined up, instead of on a slight angle? My current evidence suggests that the position of the game.planeContainer object isn't being established correctly.

I know this is a super-tough problem, so any help will be greatly appreciated. Thanks in advance!

(Another fiddle link, in case you skimmed over the first one. :D)

sentences:
Sounds make Andengine Scene junky I have a GameScene which has a character (animated sprite), AutoParallaxBackground background with quite large textures and no more than 3 other items attached to the scene at a time, previous 3 items are dispose()-ed accordingly, background music and item sounds. Background music is instantiated with MusicFactory, Sounds are played on SoundPool. In between switching these scene we are loading resources asynchronously, reading the streams and instantiation is done in AsyncTask and the loading textures to the hardware is done on UpdateThread/GLThread. If I turn off the background music, this starts to happen totally random.

I'm experiencing scene junking on at first flow: MenuScene -> 1st Stage (GameScene). After a while lag does not happen, rather than occasionally or random. Junk is happening when aforementioned 3 items are attached on the Scene and a sound is played along, note that background music is playing at the same time.

Detaching previous 3 items is "optimized" to reduce GC calling almost perfectly. When the lag occurs GC_EXPLICIT is showed in the logcat.

What I have tried:

Playing the sounds and music on different thread, IntentService, dedicated Service.
Reduced calls to mScene.detachChild(child) and other scene methods to avoid iterations over children of the scene.
Detaching IEntitys with matcher to avoid iteration.
Inspected sound files' integrity with ffmpeg for possible errors

Could .dispose(), unloading the textures from hardware or detachChild() causing this junk?

Could be marked object for GC from the async tasks be causing this?

What else could be contributing to this issue?

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:
How to change material color (LWRP) I've upgraded my project to LWRP, I've changed my materials to: LWRP/lit. But in one of the gamemodes i need to change one my materials' color by script. I used to do it simply like wallMat.color = Color.red, but at LWRP that code doesn't work, how to fix it?

Edit: LWRP = Light Weight Render Pipeline

sentences:
OpenGL: missing GL_SPECULAR light on the texture I'am missing specular lighting on the texture. I have #include <GL/glext.h> in the project, so basically I used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT); for specular effect. My init code:

glEnable(GL_DEPTH_TEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_CULL_FACE);
GLfloat AmbientLight[]   = {  0.3,  0.3,  0.3,  1.0 };
GLfloat DiffuseLight[]   = {  0.7,  0.7,  0.7,  1.0 };
GLfloat SpecularLight[]  = {  1.0,  1.0,  1.0,  1.0 };
GLfloat Shininess[]      = { 90.0 };
GLfloat Emission[]       = {  0.0,  0.0,  0.0,  1.0 };
GLfloat Global_Ambient[] = {  0.1,  0.1,  0.1,  1.0 };
GLfloat LightPosition[]  = { 7.0, 7.0, 7.0,  1.0 };

glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Global_Ambient);
glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, DiffuseLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, SpecularLight);
glLightfv(GL_LIGHT0, GL_POSITION,LightPosition);

glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION,  0.05f );
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION,    0.03f );
glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.002f);

glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, AmbientLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, DiffuseLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, SpecularLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, Shininess);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Emission);

glShadeModel(GL_SMOOTH);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);

My render code:

glClearColor( 0.117f, 0.117f, 0.117f, 1.0f );
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// load texture
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_LIGHTING);
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT);
glColor4f(1.0, 1.0, 1.0, 0.2);
glDisable(GL_COLOR_MATERIAL);
// render geometry here
glFlush();

What is missing here?

sentences:
Difference between column- and row vector matrix multiplication (vector transform) Let's say we have a 4-by-4 matrix \$A\$ which represents some transformation.
We can use this matrix to transform a vector in two ways.

\$Ax\$ by assuming \$x\$ is a 4-by-1 column vector.
\$xA\$ by assuming \$x\$ is a 1-by-4 row vector.

Up until yesterday, I have not seen this \$xA\$ variant and I thought it was unnecessary. Then I came across this DirectX code from Microsoft.
This function takes just the projection matrix, computes the inverse projection matrix and then does this \$xA\$ variant (not \$Ax\$) to transform (or unproject) a bunch of coordinates.
At first, I wasn't looking and did \$Ax\$ which came out nonsensical and now I'm trying to understand why.
I've noticed that \$Ax = xA^T\$ but when I look at the way the matrix multiplication is carried out. The components that make up the result are very different depending on whether I use \$Ax\$ or \$xA\$ (as it should be, matrix multiplication is not commutative).
The analytic solution for \$Ax\$ (3-by-3 matrix and row vector)
$$
\begin{pmatrix}
x \\ y \\ z
\end{pmatrix}
\cdot
\begin{bmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{bmatrix}
=
\begin{pmatrix}
ax + dy + gz \\
bx + ey + hz \\
cx + fy + iz
\end{pmatrix}
$$
The analytic solution for \$xA\$ (3-by-3 matrix and column vector)
$$
\begin{bmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{bmatrix}
\cdot
\begin{pmatrix}
x \\ y \\ z
\end{pmatrix}
=
\begin{pmatrix}
ax+by+cz \\
dx+ey+fz \\
gx+hy+iz
\end{pmatrix}
$$
I use Mathematica to test these things. On a hunch I tried the analyitic solution for \$xA\$ with the elements of \$A\$ transposed manually and of course, I get:
$$
\begin{bmatrix}
a & d & g \\
b & e & h \\
c & f & i
\end{bmatrix}
\cdot
\begin{pmatrix}
x \\ y \\ z
\end{pmatrix}
=
\begin{pmatrix}
ax+by+cz \\
dx+ey+fz \\
gx+hy+iz
\end{pmatrix}
$$
Which is equivalent to \$Ax\$ except we now have a column vector not a row vector. I'm assuming all of this is purely conventional (and depends on whether I'm assuming row- or column-major matrix layout). It looks like I might have answered the question my self but if I'm wrong about anything here please correct me.

sentences:
Measuring distances on 2D perspective beat'em'up I'm making a 2-D beat'em up. The tech demo is here.

As you can see, the game is in perspective, pretty much like all old school brawlers. What I want to do is measure the distance between objects on the level on screen. The game is made on Construct2, so AFAIK the only distances I can work out are absolute and on a straight line, without accounting for perspective. Ideally, I would like a function that says "if this is here and this is here, this is the real distance between these two objects".

I've been reading about perspective matrixes but can't for the life of me understand what they are or how could I use it. I'm not afraid to read though, so if you could point me to something (book, website) that can explain how to do that in layman's terms I'd be most grateful.

Thank you! :D

sentences:
Bullet impact or force on cube in Blender Hoping someone here may be able to help. I'm new to Blender (and game development/3d modelling) and have been following some tutorials online to get me started. I am building a very basic FPS just to get started. I have a gun that shoots a cube object as a bullet, but when I shoot a different cube object that I added as a target, I have a number of issues. EDIT: The target cube is just set as a rigid body object. No other attributes as yet.

The cube only moves when I hit one particular face of the cube with a bullet. Otherwise, it doesn't register a hit. It's like the bullet passes right through it unless I hit the particular face.
When I hit the correct face, the cube flies way off the screen. I know this is controlled by the physics of each object but I can't find any explanations of it. It's like the box has no weight. If I increase the mass of it, walking against the cube is affected. The cube moves around slower/faster depending on the mass, but shooting it shows no change.

Could someone give a newbie some pointers?? Thanks so much guys.

btw I'm using Blender 2.6 but I reckon that's irrelevant really

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:
How to implement view bobbing? I'm developing a First-Person shooter game. Everything is just fine but I've a little problem with my camera moving.

My FPS camera is moving smoothly! But the camera should move like a human is walking and his head is doing up and down.

Now I'm stuck! So what kind of algorithm can I use for that purpose?

Any kind of help is appreciated.

sentences:
Could frame interpolation like used by SmoothVideo Project be an option to increase the framerate of games without as big a performance hit? The SmoothVideo Project uses frame interpolation to increase the fps of video from 24 to 60. The results are pretty impressive. I was wondering if this could be applied to, and whether it would look good in video games?

It uses much less resources than rendering all the frames so would allow lower end rigs to render at the quality of much better rigs at some level of compromise. I know it won't be as accurate, and would slightly increase input latency as it needs to hold on to the newest frame to be able to generate and insert the interpolated one. It's not as bad as a full frame though, by my reasoning only the lag would be the interpolation time plus half the original fps refresh time. So for 30 fps it would be 33ms/2 + interpolation time.

Maybe this lag would make it unsuitable for fast past first person games, but I doubt it would be a hindrance in slower paced games.

The lag becomes lower at higher start rates, so I would think it would be certainly worth it when going from 60fps to 100+fps which improves the experience though increasingly marginally, while being extreme taxing on the system.

sentences:
Should the render system know the entity manager? In an entity-component based game architecture, I think the entity manager is a "high-level" system, and the render system a "low-level" system.

When I edit the position component of the entity, should the render system be aware of the entity manager, and get the position over it, or should there be no low-level system communicate with a high-level system?

I think that this should not be the case. Instead, if an entity is moved, the scene manager (also "high-level") should call a "move" function of the render system, and the render system updates the position. That means that every entity interaction has to be a function in my render system.

I'm afraid that I get cyclic dependencies in the first case. Is this the right way to go?

sentences:
How can I achieve a good fire effect with alpha blending and particles? Using the following setting for the OpenGL particle effect:

SRC: GL_SRC_ALPHA
DST: GL_ONE

Creates an additive blend, which looks spectacular on a black background but terrible on brighter colours, as it begines to fade to white.

I then used alpha blending:

SRC: GL_SRC_ALPHA
DST: GL_ONE_MINUS_SRC_ALPHA

This allows other backgrounds to be used without affecting the color of the particles, but the particles themselves look dull compared to the additive blend.
How can I achieve a good fire effect with alpha blending and particles?

Additive:

Alpha:

UPDATE:

Following David's advice below, I created a separate texture and then used additive blend on the particle effect before drawing onto the texture. The problem with that is that drawing on an alpha=0 texture resulted in just the coloured parts of the particle appearing in front of my world map, since normally you have a black background instead. The trick was to use two textures. I created a black texture and then drew the particles on it. Then I removed the alpha layer of the particles from this texture, effectively removing all the surrounding solid black and fading out the partially visible particles, while leaving the underlying black as you'd expect when making additive blend particles on a black background. In short, a gruelling process, but I got there eventually:

Here's the thread where I posted my process: http://www.cocos2d-iphone.org/forum/topic/28707?replies=8#post-141528

Video: http://www.youtube.com/watch?v=JptGbEO3b5E

sentences:
What to do with d3dx9math.h when converting to DirectX11? I'm converting an old game from DirectX9 to DirectX11 and I have a question: What I should use instead of d3dx9math.h?
Do I have to convert everything for DirectXMath.h(XNAMath), or I can continue with my old d3dx9math.h or even d3dx10math.h?

sentences:
How do I create a camera? I am trying to create a generic camera class for a game engine, which works for different types of cameras (Orbital, GDoF, FPS), but I have no idea how to go about it.

I have read about quaternions and matrices, but I do not understand how to implement it. Particularly, it seems you need "Up", "Forward" and "Right" vectors, a Quaternion for rotations, and View and Projection matrices.

For example, an FPS camera only rotates around the World Y and the Right Axis of the camera; the 6DoF rotates always around its own axis, and the orbital is just translating for a set distance and making it look always at a fixed target point.

The concepts are there; implementing this is not trivial for me.

SharpDX seems to have has already Matrices and Quaternions implemented, but I don't know how to use them to create a camera.

Can anyone point me on what am I missing, what I got wrong?

I would really enjoy if you could give a tutorial, some piece of code, or just plain explanation of the concepts.

sentences:
How do you set multiple collision rules with Swift and SpriteKit? So basically I've got 2 types of balls and 2 types of enemies. Green can delete red only, red can hit delete only. Here's what I have for the first collision test:

 func didBeginContact(contact: SKPhysicsContact) {

        // 1. Create local variables for two physics bodies
        var firstBody: SKPhysicsBody
        var secondBody: SKPhysicsBody

        // 2. Assign the two physics bodies so that the one with the lower category
        // is always stored in firstBody
        if contact.bodyA.categoryBitMask < contact.bodyB.categoryBitMask {
            firstBody = contact.bodyA
            secondBody = contact.bodyB
        } else {
            firstBody = contact.bodyB
            secondBody = contact.bodyA
        }

        // 3. react to the contact between ball and bottom
        if firstBody.categoryBitMask == RedBallCategory &&
           secondBody.categoryBitMask == GreenBarCategory {

            (secondBody.node!.removeFromParent())
            score++
            scoreLabel.text = "\(score)"
        }
    }

This works as expected, red ball hits the green bar and it deletes him.

You can't just make a func didBeginContact 2 and change the bit masks as far as I'm aware..or at least it didn't work when I tried it, so how do you handle multiple rules for collision? All of the basic tutorials I've seen handle something like one bullet hitting one type of enemy. What if you have 2 "bullets" and 2 enemies?

sentences:
Revisitability of Game Elements In some games, when you miss a pickup, you can never get it again unless you restart the game, and those pickups count in your collection. (therefore, you must restart the game to finish the collection, if you made any mistakes).

In Pokémon, you have only one Master Ball, limited supply of Ethers and legendary Pokémon appear once per game. Trading fixes all of those problems.

For a more radical perfectionist, they demanded all dialogs, background music, and even items to be revisitable. Some games, like Naruto Ninja Council, satisfied all of those needs.

Is it always a good practice to make things revisitable? Even cutscenes and music? When is it not a good practice to do so?

sentences:
How to start encouraging team collaboration? I am working on converting a single player game to multiplayer, but I am concerned that if I simply do a 1-1 conversion, even in modes with "multiple players" there won't be any incentive for team work. And since I have more experience with single player mechanics than multiplayer ones, I could use some advice on this. Here is what I have implemented so far:

points that reward team based achievements higher than single player achievements eg. single kill vs team kill
a "spotting" mechanic which allows players to show their team the enemy's position on the minimap
health & ammo items which can be shared to resupply the team
team based game modes such as capture the flag, TDM etc

My main concern with the above, is that there is a heavy reliance on individual players to want to play in a team based way. If they don't want to, they can still lone wolf it in most cases which can have a negative effect on the rest of the team who is trying to play collaboratively. It only takes one person in a team to spoil the fun!

For example, the COD series has had a number of perks, achievements and streaks designed to encourage team collaboration; but I have rarely seen these used in multiplayer since a lone wolf strategy seems to be more common. Another example, the Battlefield series has had an entire class devoted to supporting team members with health packs, repairs, ammo resupplies etc and in multiplayer it is common to see this being used to fully effect. So why do such features/mechanics work in one game of the same genre but not in another? I assume the type of player is relevant here, but there must be more to it than that.

What are some tried and true ways to encourage team-based play or collaboration? This does not necessarily mean players talking to each other, but rather working together to achieve the same goal or different parts of the same goal.

sentences:
Compress 16 bit raw data in webgl I have a 3D volume where every voxel is 16 bits. Is there anyway I can use some kind of compression to store the data so I can use less video ram?
Webgl supported different compressiosn if you enable them with extension, but can I use them for a one channel data?

Like WEBGL_compressed_texture_s3tc only supports rgb and rgba data:

COMPRESSED_RGB_S3TC_DXT1_EXT
COMPRESSED_RGBA_S3TC_DXT1_EXT
COMPRESSED_RGBA_S3TC_DXT3_EXT
COMPRESSED_RGBA_S3TC_DXT5_EXT

If its not possible in webgl, is it supported in OpenGL to compress a 16 bit values with one channel?

sentences:
Sound isn't playing in Game Maker Studio when interacting with an object I'm making a small game in Game Maker Studio.
I have a piece of code that moves the player to the next room when he touches obj_star: this works.
I have another line that tries to play sound_collect when the star is touched, but the game just moves to the next room without playing the sound.
This code is in the Step event

My code is as follows:

//Get the player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x,y+1,obj_wall))
{
vsp = key_jump * -jumpspeed
}
//Horizontal Collision
if (place_meeting(x+hsp,y,obj_wall))
{
while(!place_meeting(x+sign(hsp),y,obj_wall))
{
    x += sign(hsp);
}
hsp = 0;
}
x += hsp;

//Vertical Collision
if (place_meeting(x,y+vsp,obj_wall))
{
while(!place_meeting(x,y+sign(vsp),obj_wall))
{
    y += sign(vsp);
}
vsp = 0;
}
y += vsp;

//Sounds
if (place_meeting(x+hsp,y,obj_star))
{
sound_play(sound_collect)
};
//Next Level
if (place_meeting(x+hsp,y,obj_star))
{
room_goto_next()
};

sentences:
Handling rotation interpolation at 180 degrees I currently have a scene where 3d a gents move throughout a grid, each time they move that can pick a random cardinal direction up,down,left or right. They then rotate to face that direction using Quaternion.Slerp. However I noticed there were some edge cases where the agents didn't move at all, and found out the problem was being caused during rotations at 180 degrees. Doing some reading on this I found that Slerp and Lerp dont handle rotations at this degree very well if at all and now I'm at a loss on how to proceed. I tried using transform.rotateAround() to rotate the character around the Y axis to the direction, but again at 180 degrees the agents start to just spin in circles forever.

Here's my current rotate code:

IEnumerator rotate(){
        while(Quaternion.Angle(transform.rotation,direction) > 0.3){
            var tempRotation = Quaternion.Slerp(transform.rotation, direction, Time.deltaTime * rotateSpeed);
            this.transform.rotation = tempRotation;
            yield return null;
        }
        this.transform.rotation = direction;
    }

Heres the code that handles picking where to go:

int choice = Random.Range(0,4);
        prevPos = pos;
        if((choice == 0) && pos.x < gs.maxX){
            pos.x += 1;
            direction = Quaternion.AngleAxis(-90,Vector3.up);
            }
            else if((choice == 1) && pos.x > 0){
            pos.x -= 1;
            direction = Quaternion.AngleAxis(90,Vector3.up);
            }
            else if((choice == 2)&& pos.y < gs.maxY){
            pos.y += 1;
            direction = Quaternion.AngleAxis(180,Vector3.up);
            }else if((choice == 3) && pos.y > 0){
            pos.y -= 1;
            direction = Quaternion.AngleAxis(0,Vector3.up);
        }

If someone could point me in the right direction on how to handle this gracefully I'd really appreciate it!

sentences:
How do I make this block go back to the left with another click? This is the script I've written so far which makes the block move from the left of the screen to the right on a mouse click. What I want to achieve is for the block to move back to the left when I click the mouse again. So I can have a back and forth movement with each mouse click. Thank you for any help it's much appreciated.

public class PlayerControls1 : MonoBehaviour  {

private bool hasBeenTapped = false;
private bool control = false;
public float speed = 20f;

void Update () {
    if (Input.GetMouseButtonDown (0)) {
        hasBeenTapped = true;
            }

    if (hasBeenTapped && transform.position.x < 4 && control == false){
        transform.Translate (Vector2.right * speed * Time.deltaTime);
    }

    if(transform.position.x > 4.0f) {

        control = true;

        hasBeenTapped = false;
    }

    if(hasBeenTapped && transform.position.x == 4 || transform.position.x < 4 && control == true) {
        transform.Translate (-Vector2.right * speed * Time.deltaTime);

    if(transform.position.x < -4){

            control = false;

            hasBeenTapped = false;
        }
    }
  }
}

sentences:
How can I mark a pixel in the stencil buffer? I never used the stencil buffer for anything until now, but I want to change this. I have an idea of how it should work: the gpu discards or keeps rasterized pixels before the pixel shader based on the stencil buffer value on the given position and some stencil operation.

What I don't know is how would I mark a pixel in the stencil buffer with a specific value. For example I draw my scene and want to mark everything which is drawn with a specific material (this material could be looked up from a texture so ideally I should mark the pixel in the pixel shader), so that later when I do some post processing on my scene I would only do it on the marked pixels. I didn't find anything on the internet besides how to set up a stencil buffer and explaining the different stencil operations. I was expecting to find some System-Value semantics like SV_Depth to write to in the pixel shader (because the stencil buffer shares the same resource with the depth buffer in D3D11), but there is no such thing on MSDN. So how should I do this?
If I am misunderstanding something please help me clear that up.

sentences:
Determine whether an object is 'visible' at a given distance automatically? I am creating an environment using procedural content. To optimise performance, I am batching small meshes ahead of time. For efficiency's sake, I don't want to batch objects that make only an insignificant contribution to the final frame.

My question is, how should I determine this? Is there a commonly used or provably 'correct' algorithm?

I was thinking of something like: calculate the size of the bounding box on the final frame based on the camera parameters and see if its below a certain threshold.

Is there a better one?

(PS. This is not premature optimisation - currently my batches go well over the 65k VBO limit - not batching small meshes may save a number of draw calls. Also to be clear, I am not asking about occlusion, I have a number of small highly detailed objects in a scene so large than some will simply not be noticeable if they are far enough away and can be safely culled.)

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:
What constitutes satire? For business reasons, I would like to know what constitutes satire in a game.

Also, is there a better place to ask questions like this on the business side of game development?

sentences:
How do I hide all the geometry in a scene that is contained in a box object? I have a nature scene that "stands" on z = 0 level, basically on the grey grid. I want to hide all the geometry bellow z = 0, which would be under a plane, or inside a very large box.

I don't want to use Boolean because it requires me to update group all my assets and insert them into operand B. But I have moving parts like water and stuff :|

now I KNOW its possible, I have done it like 2-3 years ago but I don't have access to the 3ds file anymore nor could I find the source website :(

sentences:
DirectX11 - CreateInputLayout() Vertex shader linkage problem I keep getting the same error every time, I really have tried everything to fix the problem but it's still not working.
Basically I'd like to draw a simple cube.

The error(s):

D3D11 ERROR: ID3D11DeviceContext::Draw: Input Assembler - Vertex 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: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (TEXCOORD,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: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (SV_Position,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]

The vertex shader, pos.hlsl:

float4 main(float3 pos : POSITION) : SV_POSITION
{
    float4 finalPos = { pos.x, pos.y, pos.z, 1.0f };

    return finalPos;
}

The vertex layout:

const D3D11_INPUT_ELEMENT_DESC d[] =
    {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }
    };

struct Vertex
    {
        XMFLOAT3 poz;
    };

The actual code:

Vertex vertex_list[] =
{
    { XMFLOAT3{-1.0f, -1.0f, -1.0f} },
    { XMFLOAT3{-1.0f, +1.0f, -1.0f} },
    { XMFLOAT3{+1.0f, +1.0f, -1.0f} },
    { XMFLOAT3{+1.0f, -1.0f, -1.0f} },
    { XMFLOAT3{-1.0f, -1.0f, +1.0f} },
    { XMFLOAT3{-1.0f, +1.0f, +1.0f} },
    { XMFLOAT3{+1.0f, +1.0f, +1.0f} },
    { XMFLOAT3{+1.0f, -1.0f, +1.0f} }
};

/* First, setup the vertex buffer */
D3D11_BUFFER_DESC o;
o.ByteWidth = sizeof(Vertex) * ARRAYSIZE(vertex_list);
o.Usage = D3D11_USAGE_IMMUTABLE;
o.BindFlags = D3D11_BIND_VERTEX_BUFFER;
o.CPUAccessFlags = 0;
o.MiscFlags = NULL;
o.StructureByteStride = 0;

D3D11_SUBRESOURCE_DATA d;
d.pSysMem = vertex_list;

if FAILED(pRenderer->GetDevice()->CreateBuffer(
    &o,
    &d,
    &m_pBuffer
))
    return R_BUFFER_ERROR;

/* Now, setup the vertex layout */
long size = pFileManager->ReadShaderFile("pos.cso", m_bytes);

if FAILED(m_pD3DDevice->CreateInputLayout(
    d,
    ARRAYSIZE(d),
    m_bytes,
    size,
    &m_pInputLayout
))
    return R_SETUP_VERTEX_LAYOUT;

m_pD3DKontekst->IASetInputLayout(m_pInputLayout);

Then I'm using m_pD3DContext->Draw() to draw the scene.
Nothing shows up, just the usual gray background color using ClearRenderTargetView()

Thanks a lot for any help.

sentences:
How to make an expanding radial search in Unity? I am currently working on a City Builder Game and I often come across the problem of having to decide wich location to use.

Examples:

The citizen has a job and needs a home. There are several buildings with open slots.
The citizen is at a positon and is hungry. There are several restaurants on the map.

How can I choose the right building to go to?
I don't really wan't to check the distance for each, because there could potentially be hundreds of buildings and that decision problem occurs quite often.

I also don't care for the optimal solution, any nearby result is fine.

Currently all buildings register them self in a LinkedList. When searching for something I'd start at the beginning and the first occurrence that was 'good enough' would be returned.
Citizen now drive across the map for something that was right next to them if the one far away was built earlier in the game.

Any suggestions?

sentences:
Need help with a field of view-like collision detector! I ran into a trouble while making a field of view for my character. I figured how to make it work with a Linecast, but what I really need is a cone-shaped field, so that the character can detect objects or enemies if they get in that field of vision. It also needs to be intersectable by other objects, so OnCollisionEnter won't work. I suspect that Raycasting might solve the problem, but I couldn't quite understand it's workings, because I'm still new. I would really appreciate any ideas that might help to solve it.
Here is what I need:

Here is what I have so far, but this detector is unsuitable, because it can only detect objects in a straight line:

public Transform sightStart, sightEnd;
    // Update is called once per frame
    public bool objectSpotted = false;
    void Update () {
        Raycasting1 ();
}
void Raycasting1()
{
    Debug.DrawLine(sightStart.position, sightEnd.position, Color.green);
    objectSpotted = Physics2D.Linecast (sightStart.position, sightEnd.position);
}

sentences:
Unity2D force of an impact I don't know how to name what I am searching for... Force, Impact?
It's easier to explain with an image for me.
We have two GameObjects with colliders, A and B. They can move in any direction (top down game with 360° movement possibilities).
First case (left): A go to the right at a speed of 2, B to the left at a speed of 1 and they collide. How to calculate that A take 1 damage (from the speed of B in its direction) and B take 2.
Second case: A go to the right at speed of 2 and B to the right at speed of 1. A take 0 damage and B take 1.

I am using Collision2D which doesn't have "impulse" property.
I have no idea how to calculate thing like this manually.

sentences:
Loading maps on HTML5 Games I was wondering if my 2D Pixel Art platformer HTML5 game(a lot of words there..) should have loading screens for maps.

My game has different maps and I don't know if a loading screen should be implemented to transition to those maps, they are already loaded when the page finished loading right?

The framework I am using is Phaserjs.

Thanks for your help :')

sentences:
The new android studio? I got the new android studio, and I noticed one thing when creating a new activity.

The layout that corresponds with the java for the activity is made twice, once as a content:

This new layout is an exact replica of the regular activity_menu.xml except this one is called content_menu.xml. I also noticed this piece of code in the layout code of activity_menu.xml:

    <include layout="@layout/content_menu" />

What is the point of this extra layout? Can I delete it? I found this on the official documentation, but I still don't understand why it is necessary. This wasn't there in the first update...

Thanks,

Ruchir

sentences:
How does transvoxel algorithm work and how can I implement It? After wasting over three days of researching on DuckDuckGo/Google, trying to understand transvoxel paper and existing implementation, I come here to clarify the subject for me and made it easier for the next person who wants to implement it.

Here is the transvoxel's homepage which explains well what the algorithm solves. So now I'm happy to find something that solves my current problem, so I would like to implement it to my code, but the website doesn't explain how to implement it or sharing code (except tables). So I was looking for existing implementation of the transvoxel algorithm:

Transvoxel (XNA): Looks great but this solution all-in-one (octree, caching, voxel, etc.) I really tried to understand the transvoxel class into this one, but no.
Transvoxel (OGRE3D): Looks great too but again, all in one. I tried too to understand, I translated the code from C++ to C#, but no again.

Finding for marching cube was so easy, one class copy&paste, one public function.

So I gave up the idea to use existing implementation. Why not implementing it myself? (Sadly I don't have the skill to fully understand what the paper said, for example the ambiguous case).

The first thing I didn't understand was if transvoxel is a modified marching cube or a seconds layer that modify the work of the marching cube. In the C++ code (second link of the list) the code uses a implementation of marching cube and transvoxelize each border, on the paper they talk about 19x19x19 voxel data on 16x16x16 chunk and about a modified version of marching cube.

So do you guys can explain me how the transvoxel algorithm works and how can I implement it on my existing project?

My existing project is an Unity3D project which uses marching cubes for an infinite world, LOD chunk are ready, the only one thing missing is fixing crack between different LOD level chunk.

sentences: Approaches to partner trick taking card game AI I am creating an android game out of a partner based trick taking card game. What are some generic approaches to AI players for these types of games and what are the advantages/disadvantages of each?

sentences:
Cannot Draw a triangle without VAO on MacOS So I was watching Cherno's Video on Vertex attributes and he was successful in drawing a triangle without a VAO, but in tutorials from learnopengl.com they specifically say they we need a VAO to draw VBO and I tested it and it works fine.
Here is my snippet :
//==============================================================================
// glGenVertexArrays(1, &VAO);
// glBindVertexArray(VAO);

glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(triangleVertices), triangleVertices, GL_STATIC_DRAW);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (GLvoid*)0);
glEnableVertexAttribArray(0);

//-----------------------------------------------------------------------------
// Game Loop
//-----------------------------------------------------------------------------
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
    /* Poll for and process events */
    glfwPollEvents();

    /* Render here */
    glClearColor(0.2f, 0.3f, 0.3f, 1.0f);   // RGBA
    glClear(GL_COLOR_BUFFER_BIT);

    glUseProgram(shaderProgram);
    // glBindVertexArray(VAO);// we did not unbind it so it's still binded to the assigned      VAO
    glDrawArrays(GL_TRIANGLES, 0, 3);

    /* Swap front and back buffers */
    glfwSwapBuffers(window);
}
//-----------------------------------------------------------------------------

This only works if I uncomment the VAO which is understandable, what I can't get my head around is how did Cherno got it working without a VAO and just using a VBO? Is it a MacOS specific thing?

sentences:
why contacts length could be 0 when collision2D happens in Unity3D? I made a ball with RigidBody2d and CircleCollider2D to collide with other balls with the same component, and I simply use the following snippet to check the contacts of the collision:

public void OnCollisionEnter2D(Collision2D collision)
{
        if(collision.contacts.Length == 0)
        {
            Debug.LogWarning(" collision contacts length is 0 ");
            return;
        }
        // futher more code to deal with situation when contacts exists
}

And I found sometimes the collision could happen without contacts I mean the contacts array could contain 0 points.

Why does that happen?

Cause it's very important for me to find the normal direction of the collision, but without a contact-point, I could find that.

sentences:
What is the best way to exploit multicores when making multithread games? Many people suggest to write a program, and then start optimizing it. But I think that when it's coming to multithreading with multicore, a little think ahead is required.
I've read about using threads, and experienced it myself during some courses at the university (still a student).

The big question is simple, but a bit abstract:

  What thread related steps in game design do I need to take, before implementation?

Now trying to be more specific. Let's say, as an example, that I'm making a small board game  (like Monopoly) that I want to be multithreaded.
My goal Is that this multithreaded game will exploit the best of the multicore system, lets say 4-6 cores (like in i7 processors).

My answer to this question at the moment is, one thread for each of these four basic components:

GUI
User Input / Output
AI (computer rival)
Other game related calculations (like shortest path from A to B, or level up status change)

I'm not an expert (yet!), and I'm sure there are better answers out there.
Any suggestion, answer, different approach will be helpful.

Some thoughts:
Maybe splitting the main database is a good way.. (or total disaster.. )

sentences:
Designing for visually impaired gamers Globally the number of people of all ages visually impaired is estimated to be 285 million, of whom 39 million are blind.
— World Health Organisation, 2010.

(That's 4.2% and 0.6% of the world population.)
Most videogames put a strong emphasis on visuals in their content delivery. Visually impaired gamers are largely left out.
How do I design a game to be accessible to visually impaired gamers?

sentences:
Separating game logic and rendering I know this has been asked before but I would like some things cleared up.

I understand that game logic and rendering should be separated but my problem is more or less how? For instance, should the renderer get ALL info from the sprite/object and use that to draw? Also should the renderer be a seperate class or member function. If it's a separate class should it be able to get the necessary info via public functions or should it be a friend of the class to draw it?

Also some clarification as to what the main object should contain, e.g, is it okay for the main class to have other sprites, shapes, fonts, and effect data? Or, should the renderer somehow contain or produce that data?

I'm asking this because I'm making a menu list class in SFML. And, although it technically works, I'm confused because it's implemented in a way that is considered by many to be bad. Thus, I would like to know as to how to implement it and fix it correctly because I have currently blended both the logic and rendering together.

class MenuList {
    private:
        bool m_visibility{ true };
        std::vector<std::pair<MenuItem, sf::Text>> m_items;
        sf::RenderWindow& m_window;
        SEL::EventManager& m_manager;
        sf::Font m_font;

        sf::RectangleShape m_highlighter;
        sf::Color m_highlightColor;

        sf::RectangleShape m_box;

        size_t m_size{ 0 };
        size_t m_rowSpacing;

        static const uint16_t indent;
    public:
        MenuList(sf::RenderWindow& window, SEL::EventManager& manager);
        ~MenuList();
        // get a certain option, no range checking
        MenuItem& operator[](size_t index);

        // get a certain option, with range checking
        // will report an error to the console if range is out of bounds
        MenuItem& getOption(size_t index);

        // update the menu
        void Update();

        // set the visibility of the menu
        void setVisibility(bool value);

        // get the visibility of the menu
        bool getVisibility() const;

        // add another option
        void addOption(const MenuItem& item);

        // add multiple options via a list { }
        void addOption(std::initializer_list<MenuItem> items);

        // remove an options index
        void removeOption(size_t index);

        // remove an option by name
        void removeOption(const sf::String& name);

        // resize the amount of submenus
        void resize(size_t size);

        // get the local position of the menubox
        sf::FloatRect getLocalBounds();

        // set the amount of spacing between each menu in pixels
        void setRowSpacing(size_t rowSpacing);

        // get the amount of spacing is in between each menu in pixels
        size_t getRowSpacing() const;

        //void addSeperator(size_t index, sf::PrimitiveType Type = sf::PrimitiveType::LinesStrip);

        // get the amount of sub menus
        size_t getMenuCount() const noexcept;

        // get the position of the menu, the top left
        const sf::Vector2f& getPosition() const noexcept;

        // move the menu to a completely new position, overides the previous position
        void setPosition(float x, float y);

        // move the menu to a completely new position, overides the previous position
        void setPosition(const sf::Vector2f& pos);

        void setOutlineThickness(size_t thickness);

        size_t getOutlineThickness() const;

        // reset the menu such as the size, menus, and box
        void reset();
    };

sentences:
Is this paint method okay? I dont know why i need to call super.paintComponent() and super.repaint() to make the player's movements update, if i just put paintComponent the game seems like to always be stopped. However I think that my mistake is the render() method, if a remove it, it doesn't make any difference, so it is useless, I've been looking for the error but I still can not see it. I would appreciate some help

Here is the paint method of the drawing class

public void paint(Graphics g) {
    super.paintComponent(g);

    setFocusable(true);
    requestFocusInWindow();
    setBackground(Color.BLACK);
    player.drawPlayer(g, getPosX(), getPosY());
    enemy.drawEnemy(g);
    //I know this should not be here
    super.repaint();
}

Pricipal GameLoop and render method

public void run() {
    long lastLoop = System.nanoTime();
    final int TARGET_FPS = 60;
    final long OPTIM_TIME = 1000000000 / TARGET_FPS;
    long lastFPSTime = 0;
    int fps = 0;
    double delta = 0;

    while (running) {
        long now = System.nanoTime();
        lastLoop = now;
        delta += (now - lastLoop) / ((double) TIEMPO_OPTIMO);

        lastFPSTime += (now - lastLoop);
        fps++;

        if (lastFPSTime >= 1000000000) {
            System.out.println("[FPS : " + fps + " ]");
            lastFPSTime = 0;
            fps = 0;
        }

        while (delta >= 1) {
            render();
            delta--;
        }

        try {
            Thread.sleep((System.nanoTime() - lastLoop + OPTIM_TIME) / 1000000);
        } catch (InterruptedException ex) {
            Logger.getLogger(mainGameLoop.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

public void render() {
    BufferStrategy bs = this.getBufferStrategy();
    if (bs == null) {
        createBufferStrategy(2);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    drawing.paint(g);
    g.dispose();
    bs.show();
}

And as last and least probable, I thought that maybe there is something that is not adding correctly to my window

A normal window class

Drawing drawing = new Drawing();

public Window(String title,int width, int hight, mainGameLoop mainGame){
    JFrame frame = new JFrame(title);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(width, hight);
    frame.setLocationRelativeTo(null);
    frame.setResizable(false);
    frame.setVisible(true);
    frame.add(mainGame);
    frame.add(drawing);

    mainGame.start();
    mainGame.run();

sentences:
How do I make a 2D race car turn smoothly? I'm making a competitive 2-player 2D racing game for a school project. I'm struggling with the movements of my car: I made it a square for testing purposes and it can move left, right, up or down, but it can't make smooth turns around corners.

How can I make my car (currently a square) make smooth movements? I've heard vectors might help, but I don't know how to use them.

I'm writing this in C# with Visual Studio.

My car control code looks like this right now:

private void Form1_KeyDown(object sender, KeyEventArgs key) {
    // player1 controls
    if (key.KeyCode == Keys.Up)     { Player1.Top -= 5; }
    if (key.KeyCode == Keys.Down)   { Player1.Top += 5; }

    if (key.KeyCode == Keys.Left)   { Player1.Left -= 5; }
    if (key.KeyCode == Keys.Right)  { Player1.Left += 5; }

    // player2 controls
    if (key.KeyCode == Keys.W) { Player2.Top -= 5; }
    if (key.KeyCode == Keys.S) { Player2.Top += 5; }

    if (key.KeyCode == Keys.A) { Player2.Left -= 5; }
    if (key.KeyCode == Keys.D) { Player2.Left += 5; }
}

sentences:
How to determine the point of intersection of two lines? I have two lines say P1( 0, -1, 0, -1 ) and P2( -1, 0, 0, -1 ). Since I'm working in 2D, there is no Z component. The x,y,z components are normals and the w component is the distance from origin. I am not given the origin or any points on the line.

What method should I use to programmatically determine the point of intersection for these two lines?

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:
How to animate a MeshRenderer color in Unity 3D? I need to animate MeshRenderer.material.color.a, but fail.

Code:

    private void Method()
{
    AnimationClip clip = new AnimationClip();
    AnimationClipPlayable playable = AnimationClipPlayable.Create(clip);

    AnimationCurve alpha = AnimationCurve.Linear(0, 1, 1, 0);
    clip.SetCurve("", typeof(MeshRenderer), "Material._Color.a", alpha);

    //gameObject.GetComponent<MeshRenderer>().material.SetColor("_Color", Color.red); // Works
    gameObject.GetComponent<Animator>().Play(playable); // Doesn't work
}

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:
LibGDX obstacle collision How can I handle collisions with obstacles in LibGDX?

Is there any automatic way to stop the character's movement when it collides with a wall or I have to constantly poll for all the possible objects it might encounter and stop the movement accordingly?
Polling this way seems pretty poor performance-wise, especially if the framework already does that for me and I make no use of it.

My game is a top view roguelike, more or less like "The Binding of Isaac".

EDIT some beginners like me might make good use of it.
Since LibGDX has no built in collision detection without Box2D, for games where physic calculation is not needed you can build your system as follows:
Create 3 lists (Static, Dynamic, Controlled) where you put all your (relatively inherited) objects in the scene.

Static objects (walls, obstacles, traps) are passive and perform no checks.

Dynamic objects (projectiles) perform checks on both Static (stop if you hit a wall, destroy self) and Controlled (deal damage)

Controlled (players, enemies) objects perform checks on self (player hit AI controlled enemy) and static objects

After a collision is reported notify the relative objects.
Controlled objects can be Dynamic aswell but if you have a lot of projectiles flying around you can avoid self-checking Dynamics and improve the performance.
This way you should reduce a lot of useless checks aswell as limit cross-checks (both player and projectile notifying eachother) and keep your game well organized.
This is just an idea that i'm testing now, I can't guarantee it's the best :P

sentences:
How do I move a 3D particle using the Mercury particle engine? I'm currently creating a 3D game with XNA, and I am in need of some particles.That's why I searched for a particle engine. I found Mercury, watched the tutorials and integrated it in the game.

But now I have a problem, I trying to have particle in 3D but I don't how to do this with Mercury. How can I do this (is it even possible)?

sentences:
What are the dangers of self-teaching game development? I am about to embark upon a journey into game development.  Following answers to my last question, I will be using C# and XNA.

However, I don't personally know any other game developers and I don't work in the industry so, as such, will be self-taught.  The exception to this is obviously the asking of questions and reading of online/printed information but I would still class this as being self-taught.

With that, I want to be prepared for issues that I may encounter through not having someone to "keep me under their wing".

As an analogy, when self-teaching myself to play guitar, I played the A major chord in such a manner that it made moving to a chord I learned later more difficult.

If you could share your lessons learned and advice on what might go wrong in my learning of game development I'd be grateful.

I am well aware that making mistakes is the biggest part of learning but, if there're mistakes I can be prepared for then I'd be happier with that.

sentences: Making a cube follow my finger in Unity2d? I would like to make a cube follow my finger when i touch an iphone screen and drag in unity 2d.

sentences:
Algorithms for rainfall + river creation in procedurally generated terrain I've recently become fascinated by the things that can be done with procedurally terrain and have started experimenting with world building a bit. I'd like to be able to make worlds something like Dwarf fortress with biomes created from meshing together various maps.

So first step has been done. Using the diamond-square algorithm I've created some nice hieghtmaps. Next step is I would like to add some water features and have them somewhat realistically generated with rainfall. I've read about a few different approaches such as starting at the high points of the map, and "stepping" down to the lowest neighboring point, pooling/eroding as it works its way down to sea level.

Are there any documented algorithms with this or are they more off the cuff?

Would love any advice/thoughts.

sentences: Does decreasing rendering resolution also decrease the amount of polygons in my 3d models? When lowering my game resolution I reduce the pixel count of the final rendered output image, does the 3d model I use to render the final image also lose polygons?

sentences:
Why is OpenGL provided with latest GeForce drivers so extremely slow? I'm writting a code in OpenGL and using two computers - an old and a new one.

On the old computer (which I use for debugging/creating implementation for the old GL) I have GeForce 5500 FX. Before windows reinstall on it, I had NVIDIA drivers with OpenGL 1.5. And everything worked perfectly. Games made quite good FPS, even with dozens or hundreds sprites.

However, after XP reinstall, I installed the drivers provided with my video card but it seems there's no OpenGL at all (mysterious 'GDI Generic' renderer). So I tried to download the newest NVidia drivers. After their installation I saw there's OpenGL 2.3 but when I runned my app it worked with extremely low FPS (about 0.25, I mean I had to wait four seconds for any app reaction) with only one sprite. And as I loaded smaller images, the FPS relatively increased, but on the new computer it's always (no matter how big and how many sprites) speed, so it must be the perfomance problem. Without any sprites, it seemed it worked normal, but game without graphics doesn't make any sense.

That's why I downloaded the oldest drivers for NVIDIA GeForce 5500 FX I found on the Nvidia site. But they're still providing OpenGL > 2.0 (2.1 exactly). The problem's the same.

I also tried to change all the properties of OpenGL to increase performance but it didn't help too.

So what can I do? I'd like to find drivers with OpenGL 1.5 but it seems they're not on the NVIDIA site and most people say it's the best to download they from there.

sentences:
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:
Unity - using WWW to download image from web. Not working from my own website, but does from other urls I have this script attached to a RawImage file in my games UI

public class DownloadImage : MonoBehaviour {
     string url = "http://megabrogames.rf.gd/pic.jpg";
     //string url = "https://i.imgur.com/xBSyvRx.jpg";

     IEnumerator Start () {
         WWW www = new WWW(url);
         yield return www;
         GetComponent<RawImage>().texture = www.texture;
     }
 }

Both jpg files are the same. One I uploaded to Imgur, this works. The other is on my own website. The url to my website works fine, I have checked in on two computers and several browsers.

All I get is the red question mark. But if I uncomment the other one instead it all works perfectly.

My problem is that I have hard-coded the url into the game, and I want to change the image each week. It has to be the same URL for that to work, but i think with Imgur it will auto assign whatever url it feels like.

thanks for any help

sentences:
How to organize the highlighting of a 3D object with which contact occurs? I want to repeat a certain "Select (); - Deselect ();", as shown in the screenshot.

Prompt with advice how to implement it or what you need to read to implement this feature.

I tried to found something similar to what I want to do.

PlayerInteraction.cs from Farm Alarm game by Brackeys

private void OnTriggerEnter2D(Collider2D col)
    {
        if (target != col.gameObject && target != null)
        {
            Deselect();
        }

        target = col.gameObject;

        SeedBarrel barrel = target.GetComponent<SeedBarrel>();
        if (barrel != null)
        {
            barrel.Select();
        }

        SpriteRenderer[] srs = target.GetComponentsInChildren<SpriteRenderer>();
        foreach (SpriteRenderer sr in srs)
        {
            sr.color = new Color(1f, 1f, 1f, 0.9f);
        }
    }

    private void OnTriggerExit2D(Collider2D col)
    {
        if (col.gameObject == target)
        {
            Deselect();
            target = null;
        }
    }

    void Deselect()
    {
        SeedBarrel barrel = target.GetComponent<SeedBarrel>();
        if (barrel != null)
        {
            barrel.DeSelect();
        }

        SpriteRenderer[] srs = target.GetComponentsInChildren<SpriteRenderer>();
        foreach (SpriteRenderer sr in srs)
        {
            sr.color = Color.white;
        }
    }

}

But if I understand right it's way for 2D.

P.S. Screenshot from the game "Overcooked"

sentences:
How to convert Texture2DContent to Texture2D in custom ContentTypeReader I'm trying to implement a custom ContentPipeline extension that writes a Surface object with a Texture2D member.

My input file is an xml with fields for all of my Surfaces and their members. In the xml, my Surface's Texture2D is represented by a path to an image file.
In my ContentProcessor, I want to load the Texture2D from the image file path, then write that texture data straight into my object's xnb with the rest of a Surface's members.

Right now, I've got the ContentTypeWriter writing a different ("CompiledSurface") object with a Texture2DContent member. The Texture2DContent is created in the ContentProcessor using BuildAndLoadAsset(string path).

My importer, processor, and writer all seem to be doing their jobs. But in my ContentTypeReader, I can't figure out how to convert the Texture2DContent back to a Texture2D in order to create my runtime object.

Any help is much appreciated.

class Surface
{
    protected Rectangle bounding_box;
    protected Texture2D texture;
    ...
}

class CompiledSurface
{
    public Texture2DContent texture;
    public int x;
    public int y;
    ...
}

sentences:
Where to install game from my game launcher I've created a game launcher that I'm pretty proud of :). I use nw.js and so the interface uses html/javascript/css. It makes ajax api calls to my web service that I've written in C# to do things like register/login/news. I'm now looking at having my game launcher do the initial install of the actual game and updates.

My question is, where should the game be installed by default. I will allow them to change the location but what should the default game location be? This will be on Windows only at this time. My concern is that I've heard (and I don't know because I'm always admin on my PC) that you can run into issues if your game is in program files because of permissions.

Does anyone who has made a game launcher have experience around the downloading/copying/unzipping of game files in a game launcher?

sentences:
Why doesn't my game start in landscape mode? I want my game to run on all Android devices in LANDSCAPE_FIXED mode, but this mode works only for some screen resolutions. PORTRAIT_FIXED works well for all devices. I'm testing this on and emulator.

How can I achieve this? Here's my camera/engine initialization code:

public EngineOptions onCreateEngineOptions() {
    cw=480;
    ch=320;
    camera = new Camera(0, 0, cw, ch);
    EngineOptions engineOptions = new EngineOptions(
        true,
        ScreenOrientation.LANDSCAPE_FIXED,
        new RatioResolutionPolicy(cw, ch),
        this.camera
    );
    engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);
    return engineOptions;
}

sentences:
How to split a screen in half using LibGDX without scaling? I am currently working on a racing game with libGDX and I need to split the screen in half for a two-players mode. (Player 1 in first half and Player 2 in second half).

I already have Camera1 that will follow Player 1's car, and Camera2 that will follow Player 2's car.

Basically, I want the first half to show Player 1's car and the second half to show Player 2's car.

I have been searching for a while online for a way to split screens with LibGDX and found how to split the screen in two with this code:

/*Left Half*/
Gdx.gl.glViewport( 0,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );

/*Right Half*/
Gdx.gl.glViewport(Gdx.graphics.getWidth()/2,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );

However, it squeezes the screen into the right half, which is not what I want.

Is there a way to split the screen without squeezing it?

sentences:
Uniform Block solve padding/alignment for vec3 in CPU struct I have a struct on the CPU which I'm sending to a uniform block in my shader. After a bit frustration I finally got it to work. The problem I had was that vec3s are actually treated as 16-bytes, or in other words they need to have padding. So to solve this I added a dummy-float after each vec3 (see below).

I know I could just use vec4, but since I want to treat alpha as a separate component I don't want to type that 4th component for each vector every time. Furthermore, I would have to use swizzling in the shader as well to separate alpha.

Now to the question, is there any nicer/better way to solve the padding problem than having to add an extra float?

// CPU
struct Material
{
public:
    vec3 Emissive; float p1;
    vec3 Ambient; float p2;
    vec3 Diffuse; float p3;
    vec3 Specular;
    float Shininess;
    float Alpha;
};

// Fragment shader
layout(std140) uniform uniMaterial
{
    vec3 Emissive;
    vec3 Ambient;
    vec3 Diffuse;
    vec3 Specular;
    float Shininess;
    float Alpha;
};

Regards, Tobias

My solution:

struct GpuVec3
{
public:
    GpuVec3() {}

    GpuVec3& GpuVec3::operator=(const vec3& other)
    {
        v.x = other.x;
        v.y = other.y;
        v.z = other.z;
        v.w = 1.0f;

        return *this;
    }

    GpuVec3& GpuVec3::operator=(const vec4& other)
    {
        v.x = other.x;
        v.y = other.y;
        v.z = other.z;
        v.w = other.w;

        return *this;
    }

private:
    vec4 v;
};

typedef GpuVec3 GpuVec4;

sentences:
How do I get the object color? I want to get the object color, when I start the game. How do I do this?

public Renderer cube;
public float r,b,g,a;

void Start() {
            r = cube.GetComponent<Renderer>().material.color =
            b = cube.GetComponent<Renderer>().material.color =
            g = cube.GetComponent<Renderer>().material.color =
            a = cube.GetComponent<Renderer>().material.color =

}

sentences:
OpenglGL Render two scenes with one draw call I need to draw a normal-vector scene and default scene.

I could achieve this my having two programs with different fragment shader to produce the following images. It will require me to draw twice.

//somethinglike
useProgram(normal_vector_rendering_program);
render_bunny();
useProgram(just_default_scene_program);
render_bunny();

However when I am rendering the default scene, I am already passing normal vector information to achieve the lighting.

So it got me curious, can I produce two different scenes with one program(a program that has two color_buffer attaches) and one draw call somehow? I think if such is possible then I am saving lots of computer resource by not having to draw multiple times for different images.

sentences: How do you save Path2D data? I am making a java game using path geometry. Is there any way to save the data stored in a Path2D to a file?

sentences:
What's the term for this illustration style common in MMOs/RPGs? Often I was asked for the "style", but I am not sure how to describe it. I just say "mix of anime and realism". But what is it actually called, a style like this example:

It's popular and you see it in most of all mmo/rpgs. I know that it's called "stylized" in 3D-Texturing. But how would you call that typical style like in the link above (not meaning the clothes or what it expresses do be, its about the illustration and character style. Like anime, Fortnite (as it has very unique style) and so on)

sentences:
Data Organization in Custom 3D Mesh File Format After careful consideration to use middleware, I have decided on creating my own 3d file format format to export meshes from 3D authoring application (Softimage) into my game.

I will need to export the following:

Vertices
Indices
Normals
UVs
Material Information
Animation information (no clue, how to import it)
Collision mesh
Game Properties defined within 3D authoring tool (object intelligence, aggressivity, etc..)
..another assets..

Can I kindly ask for a hint, how to construct my custom file format. How to organize data within my files, please? Does anoybody have a good adivce on exporting animation information, especially when the mesh changes its geometry?

I would be thankful for advices that could point me into right direction. It would be nice to save some time instead of wasting it on incorrect approaches.

I use Softimage as my 3D authoring tool. Target platform is OpenGL ES 2.0 running on mobile devices (iOS, Android). Programming language: C++.

sentences:
Create styled grid with phaserJS gaming framework I am new to Phaser and this is my first game with Phaser gaming framework. Am trying to find the right way of coding a grid what you see in below image

In some articles is being suggested to code it with html and place it over the canvas but in that case am having issues when resizing the screen.

Any ideas how i can achieve such type of grids creation. I cant have it as a full image cause there are animations per each winning case and that current winning symbol is being highlighted with the points.

Thanks.

sentences:
StartCoroutine from other MonoBehaviour is not working I am trying to replicate the model of Unity documentation about coroutines, but I want to partition it in another class:

I have these two:

public class A: MonoBehaviour {

    void Start() {
        print("Starting " + Time.time);
        B test = new B();
        StartCoroutine(test.WaitAndPrint(2.0F));
        print("Before WaitAndPrint Finishes " + Time.time);
    }
}

public class B: MonoBehaviour {

    public IEnumerator WaitAndPrint(float waitTime) {
        yield return new WaitForSeconds(waitTime);
        print("WaitAndPrint " + Time.time);
    }
}

It prints, ignoring the coroutine:

Starting 0
Before WaitAndPrint Finishes 0

The two methods work well in the same class.

sentences: How To Disable A Select Collider I have a character with 2 2D Colliders, one for the head, and one for the feet, How do I Disable only the Head Collider in C#.

sentences:
C++ How to implement a spatial hash (for a 2d Game) I feel kind of silly for asking this question, but are there examples or tutorials on how to implement a spatial hash (grid/cell-based partitioning), preferably in C++?

I'm stuck and I have no idea how to tackle this problem. I've searched all over but all I get are people saying "gosh that's easy to do", which I'm sure is true if you've seen another implementation or have done so yourself.

Instead of quadtrees I'd like to have a spatial hash to query areas of my game which has a very large world.

Thinking it probably wouldn't even have to account for sizes, merely points, as the type of game mine is that isn't that big of an issue. And if it is, I could always add that.

sentences:
How can I create a custom PropertyDrawer for my Point struct? I created a Point struct:

[System.Serializable]
public struct Point
{
    public int x;
    public int y;
}

I am trying to create a property drawer for it, so that when it shows in the inspector, it is shown in a Vector2 field.  I have the following script in the "Editor" folder:

using UnityEditor;
using UnityEngine;

[CustomPropertyDrawer(typeof(Point))]
public class PointEditor : PropertyDrawer
{
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.Vector2Field(position, label, property.vector2Value);
    }
}

It shows up in the inspector the way I want, but the values are locked at 0. Basically, I am trying to access the Point instance from inside the OnGUI method, but this could be the completely wrong approach. How can I make this so that when the values are changed in the inspector, the respective Point is also changed?

sentences:
Unity) How can i loop animation 'n' times? I usually use

currentAnimatorStateInfo.normalizedTime > n

but  is there any better way for this?

I want my animation loop n times and invoke call back.

sentences: How do I parent an object to a bone in the blender hierarchy? So, I'm trying to make a simple RPG game using Blender and Unity. I would like to have an empty object to be used as a weapon holding position parented to my right hand bone so that I can switch weapons in and out and they'll be able to animate along with my character by being the child of the empty position. The problem I am having is that I can't get the empty position to be a child of the specific right hand bone, only the armature. Is there a way to make this work? Also, if this isn't a good procedure to accomplish what I am trying to do, please enlighten me with the proper way, I'm kind of a noob, thanks.

sentences:
Designing an efficient neighbour-networking system I'm developing a game, which involves the use of nodes (buildings), and I need to implement neighbour networks that nodes can use to either directly or indirectly access other nodes. Nodes can be created, destroyed, or bridged to at any point in the game.

At the moment, I'm creating a list of all the nodes in a neighbour network, which is re-calculated whenever there is a new addition to the network. Each node in the network will hold a reference to this list. This system works, but I feel that there is a more efficient way to do this.

This is my current code for my node class

public class Node {
    public List<Node> directNeighbours;
    public List<Node> network;

    public void addNeighbour(Node n) {
        directNeighbours.add(n);
        recalculateNetwork();
    }

    public void removeNeighbour(Node n) {
        directNeighbours.remove(n);
        recalculateNetwork();
    }

    public void recalculateNetwork() {
        recalculateNetwork(new Network(), new HashSet<Node>());
    }

    void recalculateNetwork(List<Node> network, Set<Node> searched) {
        if (searched.contains(this)) return;

        network.add(this);
        this.network = network;

        for (Node neighbour : directNeighbours) {
            neighbour.recalculateNetwork(network, searched);
        }
    }
}

Is this the best way to keep track of direct and indirect neighbours? If not, could anyone please give me ideas on how to make this better?

sentences: How to read a color of a pixel from texture (cocos2d-js)? How to read a color of a pixel at [x,y] from a texture (in cocos2d-js)?

sentences:
How can I limit the y-rotation of a cinemachine POV camera based on the player's direction? I'm using Unity (2019.4.11.f1, HDRP).
My goal is to create a first-person POV camera.
To this purpose, I tied a Cinemachine (2.7.3) Virtual Camera to the head of a third person player character (one from the Basic Locomotion demo of this asset).
The Body of the camera is set to 'Hard Lock to Target', Aim to 'POV', and Recenter Target to 'Follow Target Forward'. This works fine.
The camera has a Horizontal Axis Value Range (-# to #), that limits the rotation of the camera, but I cannot figure out how to tie this to the rotation of the Follow component (the head of the avatar).
When I walk my character around, the camera can only rotate within the set Value Range angle that has it's 0-point in one absolute direction (let's say north), independent of the player's orientation.
It seems to use World Orientation, but I don't know and wasn't able to find out where to change that.
Does anyone know how I can change this behaviour?

sentences:
Calculating position to position B with speed I am trying to find out a formula that calculates the actual position of a player using his speed and a destination position.

These are the informations I have:

Vector3 (X,Y,Z) : Current position
Vector3 (X,Y,Z) : Destination position
float : Speed

I can manage to calculate the angle between these two vectors, but I can't find an efficient formula to calculate the exact position using the speed at each loop. Do you have an idea?

EDIT*

I finally found a formula, but it's not really working as I want...

private void WalkNew()
{
    float speed = 0.1f;
    float distX = this.DestinationPosition.X - this.Position.X;
    float distZ = this.DestinationPosition.Z - this.Position.Z;
    float distance = (float)Math.Sqrt((distX * distX) + (distZ * distZ)); // distance between A and B positions

    float time = distance / speed;
    float currentTime = Time.GetTickFrom(this.lastMoveTime);
    this.lastMoveTime = Time.GetTick();
    float percentage = currentTime / time;

    if (this.Position.IsInCircle(this.DestinationPosition, 0.1f))
    {
        // We arrived
    }
    else
    {
        this.Position.X += distX / percentage;
        this.Position.Z += distZ / percentage;
    }
}

Any thoughts about this formula ?

Thanks

sentences:
Bullet Physics - Collision not working when moving btBvhTriangleMeshShape I have a robot (btTriangleMeshShape for each component) and a chain of boxes used as a cable, which is anchored on two components of the robot. I want to rotate a robot component and when this happens, I want to twist/ roll the cable on that component. The problem is - when i rotate a robot component, collision does not work anymore with that component.

I cannot use btHullShape because of the lack of accuracy, neither btGimpact because of the complexity of computations (which gives a really unsatisfying performance). I couldn't improve enough any of these two shapes, so that is why I use btTriangleMeshShape and rotate it by code.

Also, I have replaced the btTriangleMeshShape of the rotating component with a simple static box and rotate the box. Using the box shape, collision is working with that box.

So the problem of collision not working is only when trying to rotate a (static) btTriangleMeshShape.

Here is the code I use to rotate the static body, although I don't think it's necessary (it works for box shape, not for triangle mesh shape):

   btTransform tr = m_dynamicsWorld->getCollisionObjectArray()[7]->getWorldTransform();
   static float angle = 0.f;
   angle += 0.1f;
   tr.setRotation(btQuaternion(btVector3(1, 0, 0), -angle));
   m_dynamicsWorld->getCollisionObjectArray()[7]->setWorldTransform(tr);

   m_dynamicsWorld->updateAabbs();
   m_dynamicsWorld->computeOverlappingPairs();

I have to mention that I've searched the web before and couldn't find any solution and also I'm a newbie on Bullet Physics and any graphic libraries.

Any help would by really apreciated,

sentences:
How to allow to slide rectangle to not colliding with corners between two rectagles? I am detecting each side of collision between two rectangles, and wen I collide them, lets say, with the left side, it also detects collision on the top side when I move to the top, and the downside when I move to the bottom. I think that is because it is detecting also the top/bottom corners.

How I can prevent this corner collision to allow to the player to slide?

Currently, my code is the next one (using xMove (-1 or 1) and yMove (-1 or 1) to know the player movement direction.

    if (collider.intersects(mapCollider)) {

            if (direction == Direction.WEST || direction == Direction.EAST) {
                // Right collision
                if (collider.x + collider.width >= mapCollider.x) {
                    isCollisionRight = true;
                }
                // Left collision
                else if (collider.x <= mapCollider.x + mapCollider.width) {
                    isCollisionLeft = true;
                }
            }

            if (direction == Direction.NORTH || direction == Direction.SOUTH) {
                // Top collision
                if (collider.y + collider.height >= mapCollider.y) {
                    isCollisionTop = true;
                }
                // Bottom collision
                else if (collider.y <= mapCollider.y + mapCollider.height) {
                    isCollisionBottom = true;
                }
            }

Best regards,
Thank you in advance.

sentences: How many Pipelines in a Typical Rendered Scene DirectX12 I'm learning DirectX12 right now and I'm missing a few pieces of the puzzle in my own head on the overall structure of how you would setup a game. Specifically, I'm trying to get an idea of how shaders are processed through the pipeline. So in DirectX12, there seems to be a lot of work to setup a pipeline state object (PSO) and then you can assign one each of the following vertex, pixel, domain, hull, and geometry shaders. Well, it seems like there are probably many different shaders being rendered at one given time, so you would have your water shaders, glass shaders, ground, etc.. and you would need a separate pixel shader for each of these correct? So if you had about 50 pixel shaders running on a particular frame, you would need to create and configure another 50 pipeline objects? This seemed like overkill to me, so I'm just trying to figure out how this would work in a real world game engine. Thanks!

sentences:
How best to structure/manage hundreds of 'in-game' characters I've been making a simple RTS game, which contains hundreds of characters like Crusader Kings 2, in Unity. For storing them the easiest option would be to use scriptable objects, but that isn't a good solution as you cannot create new ones at runtime.

So I created a C# class called "Character" which contains all data. Everything is working fine, but as the game simulates it constantly creates new characters and kill some characters (as in-game events happen). As the game continuously simulates it creates 1000s of characters. I added a simple check to make sure a character is "Alive" while processing its function. So it helps performance, but I can't remove "Character" if he/she is dead, because I need his/her information while creating the family tree.

Is a list is the best way to save data for my game? Or it will give problems once there are 10000s of a character created? One possible solution is to make another list once the list reaches a certain amount and move all dead characters in them.

sentences:
Best practices with Vertices in Open GL What is the best practice in regards to storing vertex data in Open GL?  I.e:

struct VertexColored {
    public:
        GLfloat position[];
        GLfloat normal[];

        byte colours[];
}

class Terrian  {
    private:
        GLuint vbo_vertices;
        GLuint vbo_normals;
        GLuint vbo_colors;
        GLuint ibo_elements;

        VertexColored vertices[];
}

or having them stored seperatly in the required class like:

class Terrian  {
    private:
        GLfloat vertices[];
        GLfloat normals[];
        GLfloat colors[];

        GLuint vbo_vertices;
        GLuint vbo_normals;
        GLuint vbo_colors;
        GLuint ibo_elements;
}

sentences:
How to Calculate Caridnal Direction from Unit Vector I have unit Vector of acceleration in local space of object.
Now I want to calculate Cardinal Direction from (North, East, South, West).

So Far I tried to:

FQuat QRot = LocalAcceleration.ToOrientationQuat();
    FRotator Rot = FRotator(QRot);
    float Angle = Rot.Yaw;
    float Angle2 = (FMath::RoundToInt(Angle) + 360) % 360;

(Another version was calulcating atan2).

Then:

if (FMath::IsWithin(IntAngle, 0, 46)
    && FMath::IsWithin(IntAngle, 314, 0))
{
    NewDir = EFourCardinalDirection::N;
}
if (FMath::IsWithin(IntAngle, 134, 228))
{
    NewDir = EFourCardinalDirection::S;
}
if (FMath::IsWithin(IntAngle, 46, 136))
{
    NewDir = EFourCardinalDirection::E;
}
if (FMath::IsWithin(IntAngle, 229, 313))
{
    NewDir = EFourCardinalDirection::W;
}

I also tried to calculate eighth directions and then just assign the four based on the previous eight.

Neither way provided stable results. There are some jumps between directions depending on object movement.

sentences:
Biome Transition in a Grid & Borderless World I have a universe: a list of "Systems", each with their own center, type and radius.

A small part of such a universe could look like this:

Systems:

Can be very close to a different system, e.g. overlap
Can be inside another, much bigger system
Can be very far away from any other systems
Spawn system specific entities and particles inside the system radius
Have some properties like background color

So far so good. However, the player can fly around freely, inside and outside of systems, in real time.

How do I interpolate and determine things like the background color now, depending on camera position?

E.g. if you are halfway between a green and a red system you should see a background halfway between red and green, or if you are inside a lilac system near the center and at the border of a green system you should get a mostly lilac background etc.

sentences:
Creating a click and drag system in GameMaker Studio 2 I am attempting to create a click and drag system in GameMaker 2, for example a dress-up game or maybe a puzzle. How would I go about getting the objects to click and drag?

I'm trying to get it so I can click and drag a piece of clothing, for example, and drag it onto a character and then drag another piece of clothing on as well.

sentences:
Best way to store NPCs, Monsters, Shops, etc for JavaScript game? OK, let's say I have a JavaScript game (preferably on jQuery framework) and its using HTML5 Canvas.

What would be your way of storing data to map out shops, monsters, and NPCs? I was thinking maybe JSON txt files on the website? Or maybe simple text files and simple delimiters? I am not sure. How would you store that kind of data?

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:
Why don't my keypresses work in Pygame? I don't know why my attempt to read keypresses in Pygame is not working.
import pygame

pygame.init()

white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0, 128)
black = (0, 0, 0)
red = (255, 0, 0)

w = 500
h = 500

x = 15
y = 480
vel = 5
screen = pygame.display.set_mode((w, h))

square = pygame.image.load(r'/Users/lanik2009/Downloads/square.PNG')
square = pygame.transform.scale(square, (46, 40))
triangle = pygame.image.load(r'/Users/lanik2009/Downloads/triangle.PNG')
triangle = pygame.transform.scale(triangle, (46, 40))

def player():
    screen.fill(black)
    pygame.draw.circle(screen,white, (15, 480), 10, 500)
    screen.blit(triangle, (80, 460))
    screen.blit(square, (180, 460))

running = True

while running:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    userInput = pygame.key.get_pressed()
    if userInput[pygame.K_LEFT]:
        x = -vel
    if userInput[pygame.K_RIGHT]:
        x = vel

    player()
    pygame.display.update()

sentences:
How can I combine sprites and attach them to a GameObject? I have the following sprites:

Background

Foreground

Combined they should look like this:

The first problem is Unity can only show one sprite with its Sprite Renderer, so I can't combine them with it.

The second problem is the bomb sprite should not be rotating along with the background, like so:

How can I do this?

sentences:
raylib - isometric camera, rotating to four corners of isometric map in 3d I am exploring raylib and am trying to create a 3d isometric map of cubes. Normally this is done by setting the camera to isometric with an angle x of 30 and angle y of 45 (sometimes it is angle x of -30 and angle y of 45).
I am not sure how to set the angle of the camera, I see there is an up vector, but its values seem to be limited to smaller values than 30 or 45. With this camera setup It appears to be isometric, though I'm not sure why.
Camera camera = {0};
camera.position = (Vector3){10.0f, 7.5f, 10.0f}; // Camera position
camera.target = (Vector3){0.0f, 0.0f, 0.0f};     // Camera looking at point
camera.up = (Vector3){0.0f, 1.0f, 0.0f};         // Camera up vector (rotation towards target)
camera.fovy = 10.0f;                             // Camera field-of-view Y
camera.type = CAMERA_ORTHOGRAPHIC;               // Camera mode type

This has the cube at position 0, 0, 0 at the top of the screen. This picture illustrates what I am seeing approximately:

If I change the position of the camera to:
camera.position = (Vector3){-10.0f, 7.5f, -10.0f}; // Camera position

Then I appromxiately see this:

Although it appears much higher on the screen. How do I go about rotating the camera from the first picture to the second picture? Also, how do I rotate the block at 0, 0, 0 to any other corner if the map has an even number of rows, columns?
I should add that simply tweening from 10, 7.5, 10 to -10, 7.5, -10 eventually does get to the second picture, but it inverts the map first (looks very strange), I want a circular rotation towards the second picture. The Orbital camera mode almost does what I want, but it seems move the map as well.

sentences:
Unknown error when trying to register a Minecraft ArmorItem The error in question is [Inferred type 'I' for type parameter 'I' is not within its bound; should extend 'net.minecraft.item.Item']
on the following snippet of code
// Armor Items
public static final RegistryObject<ArmorItem> RINGMAIL_HELMET = ITEMS.register("ringmail_helmet",
        new ArmorItem(DnDCraftArmorMaterial.RINGMAIL, EquipmentSlotType.HEAD, new Item.Properties().group(DnDCraft.TAB)));

I have tried many things like what I do here
public static final RegistryObject<Item> RING = ITEMS.register("ring", ItemBase::new);

by putting the ItemBase::new snippet in the last paramter.
I've also tried seeing what IntelliJ suggests is best in-context action but none of those approaches seemed to fix the issue.
I'm not super familiar with Java or Minecraft modding so this may just be something simple that I am missing but any help or recommendations would be nice. Thanks!
Also this is the ItemBase class, in case that helps.
package com.fire.dndcraft.items;

import com.fire.dndcraft.DnDCraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;

public class ItemBase extends Item {
    public ItemBase() {
        super(new Item.Properties().group(DnDCraft.TAB));
    }
}

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: How can I detect a long press then activate an animation? How can I detect a long press on a touch screen then activate an animation? And when the finger is released, play another animation smoothly? Let's take for example the main character in Crossy Road: when the user presses down, the chicken "squats" and when the user releases their finger, the chicken jumps. Same concept. C#.

sentences:
Libgdx/Box2D PolygonShape has no position... well, what now? As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body.

So for Box2D I figured I'd need multiple fixtures, like one for the legs, one for the torso and one for the head.

Each of these fixtures will get a different sprite/texture that should be swappable dynamically if the player puts on some armour or changes cloths etc.

Until now the player-character consisted of a Box2D Body with just one single fixture.
I added the sprite like this:

   body.setUserData(this.sprite);

I rendered it like this:

 // Draw-method
  if(body.getUserData() != null && body.getUserData() instanceof Sprite) {
      Sprite sprite = (Sprite) body.getUserData();
      sprite.setPosition(body.getPosition().x - sprite.getWidth() / 2, body.getPosition().y - sprite.getHeight() / 2);
      sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
      sprite.draw(spriteBatch);
  }

Now that I want to have multiple sprites for different "regions" of the body I figured it's better to add them to the fixture itself. For now I just wanted to reproduce what I already had, so just the one sprite I have to the one fixture I have right now instead of the body.

I do this like that:

Fixture fixture = body.createFixture(fixtureDef);

My problem arises when trying to render this.

for(Fixture fixture : body.getFixtureList())
{
    if(fixture.getUserData() != null && fixture.getUserData() instanceof Sprite)
    {
        Sprite sprite = (Sprite) fixture.getUserData();
        //sprite.setPosition(fixture.getShape().getPosition() ... // Not gonna work, because PolygonShape has no position! :(
        sprite.draw(spriteBatch);
    }
}

As you can read in the comment, the fixture for now has a rectangular shape which is made like:

shape = new PolygonShape();
shape.setAsBox(widthInMeters / 2, heightInMeters / 2);

The problem is, that a PolygonShape has not position :/ Now when I render this, the sprite is not being drawn at the fixtures position and currently I really have no idea how to fix that.

I'd highly appreciate any help you can give me! Thanks in advance and have a wonderful day! :)

sentences:
Time based movement Vs Frame rate based movement? I'm new to Game programmming and SDL, and I have been following Lazyfoo's SDL tutorials. My question is related to time based motion and frame rate based motion, basically which is better or appropriate depending on situations?. Could you give me an example where each of these methods are used?.

Another question I have is that, in lazyfoo's two Motion tutorials (FPS based and time based) The time based method showed a much smoother animation while the Frame rate based one was a little hiccupy, meaning you could clearly see the gap between the previous location of the dot and its current position when you compare the two programs.

As beginner which method should I stick to?(all I want is smooth animations).

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: What is the purpose for multiple windows in games? A lot of game development APIs recently got support for multiple windows (such as SDL 2, and GLFW 3). But why did they add that feature? I've never seen a game in my life use multiple windows (with the exceptions of a launcher, or a messagebox). Is there something I'm missing here? Is there an actual game development purpose to it? I'm very confused of why they did that.

sentences:
How to modify the Unity sprite renderer (or create a custom one) that can display the sprites on the X-Z plane? Prefix: I am NOT trying to rotate a sprite 90 degrees by it's transform, this changes what is up/down and forward/backwards for the object. I need the sprite displayed on the X-Z plane in comparison to the default X-Y plane in it's natural state in the game world with rotation transforms of 0.

I'm trying to use 2D sprites on the X-Z plane, how do I go about either modifying the built in sprite renderer to do this, or creating my own custom sprite renderer component?

sentences:
Get modified key with SDL2 If I poll keyboard events with SDL2 all I get is the pressed key and the modifiers. But I am using Neo and have some keys like Esc and arrow keys on a different layer which means that e.g. Mod4+i is the same as the left arrow key.

How can I get the modified key from SDL2?

The same problem occurs to me when I want to handle special chars which are located on different keys on different keyboard layouts (/ for example has a dedicated key on US layout while on German layout it is located at Shift+7).

I already found the text input mode, but this seams rather unfitting as one gets a string instead of a single key.

Edit: formatting

Edit 2: I just found another problem .. SDL doesn't recognize Mod4 so when pressing Mod4 plus another key, the mod field is still 0. Other modifiers like Shift work.

sentences:
WDDM Managing Memory in D3DPOOL_DEFAULT In this question I saw that I was running out of memory in D3DPOOL_DEFAULT in DX9EX. After changing my usage from D3DUSAGE_DYNAMIC to 0 (static usage), everything runs wonderfully with no DX9 error.

At the point in my load process where I would previously get DX9's out of memory error, I now see system memory start to grow. So I assume that the WDDM is managing my textures.

So my question is, am I really seeing memory management here? I read about the WDDM in Copying and Accessing Resource Data (Direct3D 10), but I'm not sure that pertains to DX9EX. Wikipedia says: WDDM drivers allow video memory to be virtuallized and video data to be paged out of video memory into system RAM.

sentences:
Javascript: world tile generator bug? collision not working, player falls down? Hi I have a serious problem here, When I generate my tile map from an array with numbers [0,4, ...] (0 > for air, 4 for solid) inside of generateWorld()... the collision it doesn't work, and my player falls when l walk to the left and keeps collide with that block... just keep trying until you see it, it will fall passing throught the block.

But the weird part is when l generate my world manually generateWorld2() my collision works very well.

This is located almost at the end of the code. Inside window.onload function

Please tell me why is that, lm not using jquery or others libraries... lm doing this game from 100% scratch. Thanks so much !

sentences: How can I programmatically change a sprite's pivot without it affecting a game objects current position and rotation? Because of the complexity of positions, I am using the centre pivot for my game objects sprite. Can I possibly change the pivot without it affecting the game objects current position and rotation? or in other words, can I change the pivot while the sprite remains unchanged visibly? I would preferably like to do this using c# script.

sentences:
How to modify a property after animating it in Unity3D? I animate localPosition. The animation works well, but after, I can't change a value of localPosition in editor or code. I want to change a value after the animation completes, not at the same time.

I use Animator with AnimationClipPlayable. I create Animator in editor and the rest in code (AnimationClip, AnimationClipPlayable, AnimationCurve).

The animation animates a property from one position to another. It finishes, I don't do anything to stop the animation.

Let me know, if you need a code example or video presentation.

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:
How can I write only to the stencil buffer in OpenGL ES 2.0? I'd like to write to the stencil buffer without incurring the cost of my expensive shaders. As I understand it, I write to the stencil buffer as a 'side effect' of rendering something. In this first pass where I write to the stencil buffer, I don't want to write anything to the color or depth buffer, and I definitely don't want to run through my lighting equations in my shaders.

Do I need to create no-op shaders for this (and can I just discard fragments), or is there a better way to do this?

As the title says, I'm using OpenGL ES 2.0.

I haven't used the stencil buffer before, so if I seem to be misunderstanding something, feel free to be verbose.

sentences:
Adding Grass to a Low-Poly Mesh in Unity How would I go about adding grass to a low-poly mesh in Unity?

Here is what I have looked into:

Object2Terrain: I am not using Unity's built in terrain system because I am going for a low-poly art style. I tried converting my terrain mesh object to a terrain (using Object2Terrain) however this removes the sharp edges on the terrain, because Unity uses a height map for optimization.
PolyMesh: From the get-go I knew this approach wasn't going to work. I knew it would be incredibly inefficient to render that many meshes at once. I still tried it though, and to no surprise, it was very laggy.
Particle System: From what I've read, this should work fine for randomly scattering grass over your mesh, however I do want some control when placing grass. I followed this tutorial image as suggested by a comment in this question on Reddit, however, I was never able to achieve the desired result. Nevertheless, I do want control over placing the grass, and so I moved onto another approach.
Shaders: I'm not experienced at all when it comes to creating (or even using) shaders, and it's quite a daunting topic to me. I've read that this is the most efficient approach, however haven't been able to understand how this means I could draw grass onto a mesh? On the same Reddit post linked above, "UpstairsCurrency" was kind enough to link their source code (here), however I'd like to understand what is happening? I'm reluctant to say that I'm not even sure I understand how to implement it into my project in the first place. Would appreciate any sources for reading up to help understand what is going on!

Thanks!

sentences:
2D how to add graphics for liquid physics? I was always wondering how to add the graphics to a a blob body for example, regardless of what engine or library you are using, i want to know (theoratically) how to move from this state :
http://www.youtube.com/watch?v=qHvsER4Ou0w

to something like the blob in this video :
http://www.youtube.com/watch?v=ssOaZ3Lrov0

thank you

sentences:
How BufferStrategy works I've used this piece of code a lot in my games, but I still don't know exactly how it works.

 // Main loop
while (!done) {
     // Prepare for rendering the next frame
     // ...

     // Render single frame
    do {
        // The following loop ensures that the contents of the drawing buffer
        // are consistent in case the underlying surface was recreated
        do {
            // Get a new graphics context every time through the loop
            // to make sure the strategy is validated
            Graphics graphics = strategy.getDrawGraphics();

            // Render to graphics
            // ...

            // Dispose the graphics
            graphics.dispose();

            // Repeat the rendering if the drawing buffer contents
            // were restored
        } while (strategy.contentsRestored());

        // Display the buffer
        strategy.show();

        // Repeat the rendering if the drawing buffer was lost
    } while (strategy.contentsLost());
}

Why should I use those two do-while loops? What does it achieve? Well, I know why because of the comments, but I want to know exactly what happens

BufferStrategy: http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferStrategy.html

sentences:
SDL, SFML, OpenGL, or just move to Java I recently started a new project, and I'm wondering if I should change the technology now before it's too late.

I'm using SDL with C++, I have around 6 classes, and the game is going alright, but I got to this point where I have to rotate my sprite to make it point to the coordinates of the mouse.

It's a 2D topdown game, so if I pre-cached the images, I'd have to load 360 images, which is bad for memory. If I used SDL_glx, I could do the rotation real time, but I heard it'd drop my frame rate very drastically, and I don't want my game to be slow.

I also read I could use OpenGL, which is faster at these things. The problem is, how much would I have to change my code if I moved to OpenGL with SDL.

So, I considered moving to a completely different language - Java - which is much simpler, and would allow me to focus on the game and handle networking much more easily than with C++.

I am very confused, and would like to hear your opinion - thank you!

sentences:
D3D11 Deferred Context CommandList Reset a rather quick question, I am starting on implementing rendering with deferred context into my game engine, and came across a heavy memory leak when recording command lists on my deferred contexts. Because every frame I would go like this: DeferredContext[THREAD]->FinishCommandList( 0,&commandLists[THREAD] ), it would eat up RAM, so I Release them every time, like:

if(commandLists[THREAD]){
 commandLists[THREAD]->Release();
 commandLists[THREAD] = NULL;
}

I previously only released objects when they wouldn't be used any more, so I thought there would be a more optimized way of handling this? (Like mapping dynamic *ID3D11Buffers for example?)

sentences:
Put layout over Surfaceview I have this problem: I'm trying to create new RelativeLayout over whole screen - which also contains SurfaceView in the middle - and display some things on this RelativeLayout (in my case Imageview containing animation). Almost everything is working ok - Imageview is displayed, animation is working... but SurfaceViews drawings (Bitmaps) are on the top of my RelativeLayout with Imageview, which I'm trying to appear it on top.

Calling bringtofront() doesn't work. Although I've created RelativeLayout with ImageView after SurfaceView, it's still below it.

So my question is: how to bring this RelativeLayout with ImageView to the top of SurfaceView?

In Activity:

// Layout, on which I'm adding Surfaceview programmatically
RelativeLayout layout = (RelativeLayout) findViewById(R.id.middle_layout);
layout.addView(new SurfaceView((getApplicationContext())));

// Layout which should be top over everything
RelativeLayout topLayout = new RelativeLayout(getApplicationContext());
RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(
                                 RelativeLayout.LayoutParams.MATCH_PARENT,
                                 RelativeLayout.LayoutParams.MATCH_PARENT);
topLayout.setLayoutParams(rlp);

// Although I'm adding SurfaceView first and Relative second, no hierarchy order is visible...
layout.addView(topLayout);
// OR
root_layout.addView(topLayout);
// ^ Both attempts are displayed under SurfaceView

SurfaceView class:

public class SurfaceView extends SurfaceView implements SurfaceHolder.Callback
{
    public SurfaceView (Context context)
    {
            super(context);

            getHolder().addCallback(this);

            this.setZOrderOnTop(true);

            getHolder().setFormat(PixelFormat.TRANSPARENT);

            setFocusable(true);
    }

    ...
}

PS: I need to create SurfaceView programmatically.

Thanks for any help!

sentences: Display crosshair that is diplaying where the ship is aiming at I am creating a 3D asteroids game. I got the bullets, asteroids, and ship all done. They work perfectly. Now I want a crosshair to display where the ship is pointing at. The crosshair will be a 2D sprite.

sentences:
Synchronizing actions with animations across network I'm working on a project which allows players to take actions in time-limited turns. All players are connected to a central server, which is authoritative. That means the server sends info that a turn for given player has started and the time remaining to take an action. This leads to problems when client-side animations are involved. Each action has an associated animation, which takes some time to complete. The player should be able to initiate the action within given time, and the next player show start his turn when any animations complete. Obviously, the server has no notion of animations, but still needs to take them into account and start the next turn at proper time point. I'm not sure how to solve this problem. Possible solutions I came up with:

Constant animation time and built-in delay

The server will have a built-in delay after an action has been taken, before starting the next turn. Problems:

seems an artificial construct
animation times need to be exact

Not waiting for animations

The server can simply broadcast action effects without any delay, and go to the next turn. Problems:

will look very strange for the players since the effects will become visible before the animation completes
possible overlapping animations across turns

Sending actions along with animation times

The client can send the animation time for given action, which the server will use as a delay for the next turn. Problems:

obvious cheating possibility (players can use the delay for "extra time")

So, given above, all my ideas are simply bad. Therefore the question remains: is there an existing solution for such class of problems?

sentences:
Force Reload VS soution Explorer when adding new c# Script via Unity3d? When I create C# script (Create -> C# Script) via Unity3d  or delete it from Unity3d - Visual Studio shows me the warning window.

it's annoying.

Is there any way to force "ReloadAll" in solution Explorer without the window?

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:
How to enable and disable scripts on a Game Object? This worked briefly yesterday, I believe I did something to mess this up. All my inputs that I put in are correct; therefor, it must be the code. I want to switch players. While the red cube's script is enabled and can move under the movement script I want the blue cubes movement script to be disabled and vice versus. Can you give me some insight into what I'm doing wrong? Please and thank you!!

using UnityEngine;
using System.Collections;

public class PlayerMovementScript : MonoBehaviour {

    public float speed = 2f;
    public float height = 2f;

    public Component playerMovement;
    public GameObject redCube;
    public GameObject blueCube;

    void Start()
    {
        var bc = blueCube.GetComponent<PlayerMovementScript>();

        bc.enabled = !bc.enabled;
    }

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetButton ("Right"))
        {
            transform.Translate(Vector3.right * speed * Time.deltaTime);
        }

        if (Input.GetButton ("Left"))
        {
            transform.Translate(Vector3.left * speed * Time.deltaTime);
        }

        if (Input.GetButton ("Jump"))
        {
            transform.Translate(Vector3.up * height * Time.deltaTime);
        }

        var bc = blueCube.GetComponent<PlayerMovementScript>();
        var rc = redCube.GetComponent<PlayerMovementScript>();

        if (Input.GetButton ("Switch"))
        {
            bc.enabled = !bc.isActiveAndEnabled;
            rc.enabled = !rc.enabled;
        }
    }
}

sentences: Masking away part of image with mesh I need to remove a section of an image using a 2D mesh. Since the image is destructible (artillery game style), it would be helpful to shrink the image in memory afterward. The portion in the blue section should be kept, the portion in red is within the mesh and should be removed. Note that the image is rotated as well.

sentences:
Rotation of viewplatform in Java3D I have just started with Java3D programming. I thought I had built up some basic intuition about how the scene graph works, but something that should work, does not work.

I made a simple program for rotating a pyramid around the y-axis. This was done just by adding a RotationInterpolator R to the TransformGroup above the pyramid. Then I thought hey, can I now remove the RotationInterpolator from this TransformGroup, then add it to the TransformGroup above my ViewPlatform leaf. This should work if I have understood how things work. Adding the RotationInterpolator to this TransformGroup, should make the children of this TransformGroup rotate, and the ViewingPlatform is a child of the TransformGroup. Any ideas on where my reasoning is flawed?

Here is the code for setting up the universe, and the view branchgroup.

import java.awt.*;
import java.awt.event.*;
import javax.media.j3d.*;
import javax.vecmath.*;

public class UniverseBuilder {

    // User-specified canvas

    Canvas3D canvas;

    // Scene graph elements to which the user may want access

    VirtualUniverse               universe;
    Locale                        locale;
    TransformGroup                vpTrans;
    View                          view;

    public UniverseBuilder(Canvas3D c) {
        this.canvas = c;

        // Establish a virtual universe that has a single
        // hi-res Locale

        universe = new VirtualUniverse();
        locale = new Locale(universe);

        // Create a PhysicalBody and PhysicalEnvironment object

        PhysicalBody body = new PhysicalBody();
        PhysicalEnvironment environment = new PhysicalEnvironment();

        // Create a View and attach the Canvas3D and the physical
        // body and environment to the view.

        view = new View();
        view.addCanvas3D(c);
        view.setPhysicalBody(body);
        view.setPhysicalEnvironment(environment);

        // Create a BranchGroup node for the view platform

        BranchGroup vpRoot = new BranchGroup();

        // Create a ViewPlatform object, and its associated
        // TransformGroup object, and attach it to the root of the
        // subgraph. Attach the view to the view platform.
        Transform3D t = new Transform3D();
        Transform3D s = new Transform3D();
        t.set(new Vector3f(0.0f, 0.0f, 10.0f));

        t.rotX(-Math.PI/4);
        s.set(new Vector3f(0.0f, 0.0f, 10.0f)); //forandre verdier her for å endre viewing position
        t.mul(s);

        ViewPlatform vp = new ViewPlatform();

    vpTrans = new TransformGroup(t);
        vpTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    // Rotator stuff
    Transform3D yAxis = new Transform3D();
        //yAxis.rotY(Math.PI/2);
        Alpha rotationAlpha = new Alpha(
                -1, Alpha.INCREASING_ENABLE,
                0, 0,4000, 0, 0, 0, 0, 0);

        RotationInterpolator rotator = new RotationInterpolator(
                rotationAlpha, vpTrans, yAxis,
                0.0f, (float) Math.PI*2.0f);
        RotationInterpolator rotator2 = new RotationInterpolator(
            rotationAlpha, vpTrans);
        BoundingSphere bounds =
            new BoundingSphere(new Point3d(0.0,0.0,0.0), 1000.0);
        rotator.setSchedulingBounds(bounds);

        vpTrans.addChild(rotator);
        vpTrans.addChild(vp);
        vpRoot.addChild(vpTrans);

        view.attachViewPlatform(vp);

        // Attach the branch graph to the universe, via the
        // Locale. The scene graph is now live!

        locale.addBranchGraph(vpRoot);
    }

    public void addBranchGraph(BranchGroup bg) {
        locale.addBranchGraph(bg);
    }
}

sentences:
Ways to track login/loading progress dynamic? Lets say we want to add a dynamic "loading bar" to our server-client game... the player presses on "login", a bar appears and shows the percentage of loaded assets and configurations from the server.

The only way i found... is very laborious and hardcoded :

// We received our environment
barPercentage += 10f; // Increasing the bar.
updateBar();

// We received our player settings
barPercentage += 5f; // Increasing the bar again
updateBar();

As you can see this progress tracking from received server data is very bad and needs to be adjusted everytime you change some important part of the game structure itself.

What are good ways to implement such a percentage tracker client side ? How do we actually track the loading progress (client & server related) without hardcoding it like i did in the code sample ? Are there any good patterns or data structures ?

sentences:
Stormy water like Temple Run 2 for Mobile How can I make stormy water like they did in Temple Run 2. I've tried with Unity Water Pro to achieve the same result but when I include it in the project the frame rate crashes to 3 frames per second.

Unity Water basic doesn't fulfill the requirements at all. So is there any other way?

sentences:
Cant import Sun openGL I've been working with JOGL and I've ran into a problem. The problem is when I try to import import com.sun.opengl.*; on Eclipse, Eclipse doesn't recognize it. Does anyone know where this library is? Did I miss a step during installation? I'm working with the latest build.

Here are the included libraries:

gluegen-rt-natives-windows-i586.jar - JOGL/lib
gluegen-rt - JOGL/lib
gluegen.jar - JOGL/lib
jogl-all-natives-windows-i586.jar - JOGL/lib
jogl-all.jar - JOGL/lib

This is within my JOGL project folder:

gluegen-rt.dll

sentences:
XNA C#: How can I prevent blurring when drawing from a RenderTarget2D? I'm making a game and I want the end graphics to look chunky and pixellated, so I'm drawing from the spritebatch onto a RenderTarget2D which is 1/4th the size of the actual backbuffer, and then drawing from that to the backbuffer.

At first the sprites were blurred by antialiasing and I read that using SamplerState.PointWrap in the spritebatch Begin call would ease this a bit so I made that change. Everything seemed better, however the final on-screen image is still blurry and I think this is because of how it draws from the rendertarget2D to the backbuffer.

The image here is a comparison - On the left is how the output looks now and the right is how I want it to look.

sentences:
How can I avoid type checking in the physics side of collision handling? I have a class responsible for handling the physics side of collisions. When the collision detector spots a collision, it notifies both entities in the collision to take care of gameplay. It also notifies the PhysicsGenerator to take car of the physics of the collision.

I don't know if it's possible to avoid type checking in the handleCollision() method of PhysicsGenerator. What I wanted to do is apply a force on both entities in the collision to push them backwards. But I can only do this if they are MovingEntities. What if one of them is a StaticEntity? In this case it should be treated differently. I don't know how I can do that without using instanceof quite a lot.

How is this usually handled?

sentences:
As an indie game dev, what processes are the best for soliciting feedback on my design/spec/idea? Background

I have worked in a professional environment where the process usually goes like the following:

Brain storm idea
Solidify the game mechanics / design
Iterate on design/idea to create a more solid experience
Spec out the details of the design/idea
Build it

Step 3. is generally done with the stakeholders of the game (developers, designers, investors, publishers, etc) to reach an 'agreement' which meets the goals of all involved. Due to this process involving a series of often opposing and unique view points, creative solutions can surface through discussion / iteration. This is backed up by a process for collating the changes / new ideas, as well as structured time for discussion.

As a (now) indie developer, I have to play the role of all the stakeholders (developers, designers, investors, publishers, etc), and often find myself too close to the idea / design to do more than minor changes, which I feel to be local maxima when it comes to the best result (I'm looking for the global maxima, of course).

I have read that ideas / game designs / unique mechanics are merely multipliers of execution, and that keeping them secret is just silly. In sharing the idea with others outside the realm of my own thinking, I hope to replicate the influence other stakeholders have.

I am struggling with the collation of changes / new ideas, and any kind of structured method of receiving feedback.

My question: As an indie game developer, how and where can I share my ideas/designs to receive meaningful / constructive feedback? How can I successfully collate the feedback into a new iteration of the design? Are there any specialized websites, etc?

sentences:
Build a Unity asset bundle on linux? I'm trying to generate an asset bundle on a remote linux machine and stream the bundle to a running Unity instance.

Is it possible to download the same libraries Unity uses and compile on Linux?

sentences:
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 should I apply Ambient Occlusion from greyscale AO maps? I've seen many tutorials on SSAO, but none for simple ambient occlusion maps.

I can see myself working things out alone, as AO maps are simple greyscale maps that indicate where there should be more lighting and where less, right? Something like

float ao = texture(ambientOcclusionMap, uvCoords);
vec3 lighting = ambient + (diffuse + specular) * ao;

Is there something more to it?

sentences:
How do you program the right analog stick of a controller in JInput? I have the Left Analog Stick programmed and accepting input (moving a character around). (getCompassDir() returns the values of the cardinal directions and NONE means the stick isn't touched):

// Left Analog Stick
public int getLeftAnalogStickDir() {
    // return the (x,y) analog stick compass direction
    if ((xAxisIdx == -1) || (yAxisIdx == -1)) {
        System.out.println("(x,y) axis data unavailable");
        return NONE;
    } else
        return getCompassDir(xAxisIdx, yAxisIdx);
}

This works perfectly. Now when trying to program the Right Analog Stick of the controller, I use the same code as above, but instead, I replaced xAxisIdx and yAxisIdx with zAxisIdx and rzAxisIdx (the x, y value of the right stick). The problem is that its not reading the input like the left Analog Stick.

Does anyone know why the right analog stick isnt working? I followed the tutorial from this book:

Pro Java 6 3D Game Development: Java 3D, JOGL, JInput and JOAL APIs

sentences: What is the delta value passed to the Screen's render method? The delta value given to the render method in the Screen class is a non-constant number. What is it? Where does it come from? Does it differ by screen size?

sentences:
What are pros & cons of naming in game currency a standard name vs a gimmick? We're creating a store and going to add an in game currency. We did a poll and Tokens & Sheep were the top options selected by the players.
I personally think Sheep would be more fun like a barter system as well as it is an in game resource as you may know from the Settlers of Catan (my game https://colonist.io/)
I know that https://starve.io/ has Golden Bread and https://surviv.io/ has Potato as in game currency.
Are there any other such examples? What are the pros cons of such naming?
I don't know any big games which do such a thing.

sentences:
Drawing different per-pixel data on the screen I want to draw different per-pixel data on the screen, where each pixel has a specific value according to my needs. An example may be a random noise pattern where each pixel is randomly generated.

I'm not sure what is the correct and fastest way to do this. Locking a texture/surface and manipulating the raw pixel data? How is this done in modern graphics programming?

I'm currently trying to do this in Pygame but realized I will face the same problem if I go for C/SDL or OpenGL/DirectX.

sentences:
Having trouble with EOF in Xcode I'm getting an error that says "control may reach end of function" and I have gone through my code several times now and am not spotting the error. It may be something simple too.

// loop continually until the user gives a valid guess
FText GetValidGuess()
{
    EGuessStatus Status = EGuessStatus::Invalid_Status;
    do {
        // get a guess from the player
        int32 CurrentTry = BCGame.GetCurrentTry();
        std::cout << "Try " << CurrentTry << ". Enter your guess: ";
        FText Guess = "";
        std::getline(std::cin, Guess);

        // check status and give feedback
        Status = BCGame.CheckGuessValidity(Guess);
        switch (Status) {
            case EGuessStatus::Wrong_Length:
                std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n";
                break;
            case EGuessStatus::Not_an_isogram:
                std::cout << "Please enter a word witout repeating letters.\n";
                break;
            case EGuessStatus::Not_Lowercase:
                std::cout << "Please enter all lowercase letters.\n";
                break;
            default:
                return Guess;
        }
        std::cout << std::endl;
    } while (Status != EGuessStatus::OK); // keep looping until we get no error
}

sentences:
Projecting texture from an arbitrary position I'm trying to write a surface shader (not a projector) to project a texture to a surface in a very similar way of what projectors do.

Currently I can easily obtain a shader that uses screenspace as UV:

        float2 screenUV = IN.screenPos.xy / IN.screenPos.w;

What I'm trying to achieve is to have an arbitrary plane to project the texture over the mesh that uses the shader.

I'm checking some resource online like https://en.wikibooks.org/wiki/Cg_Programming/Unity/Cookies but this is strongly related to light space.

My main doubt is how can I generate the UV coordinates from another plane? should I define somehow plane sizes or is it enough to define its position?

sentences:
How do you handle large triangles with frustum? I am rendering the Sponza scene ato test my frustum implementation.

My current approach is simply, test if the vertices of the triangle are within the frustum (angle between the camera looking direction and the position od the vertex relative to the camera).

If any of the vertices are visible then the trianlge is considered to be visible.

The issue is that the sponza scene has some really large triangles, thus with my approach it is possible to be looking directly at a triangle and see nothing if all 3 vertices are outside the camera frustum.

sentences:
How to make an Assert.IsNull test pass when the value is reported as ? I've just started using unity tests with the built in editor tests. After making my test and finding out that it constantly failed I debugged the code and found that a static object was set to a new game object when running the test while it is set to null when playing in the editor.

Is there a way to force unity to treat the test the in the same way that it treats scripts at run time?

Edit

After changing some code around i get another strange error:

does anyone know why "null" isn't "null". The null objects are stored in an array, but that shouldn't make a difference right?

Edit Edit (Edit 2?)

Here is the code that has the issue

public class StatCollector : MonoBehaviour {

    public static StatCollector running;

    //ensure that there is only one object running at the same time
    public void Awake () {
        if(running == null)
        {
            DontDestroyOnLoad(gameObject);
            running = this;
        }
        else if(running != this)
        {
            DestroyImmediate(gameObject);
        }
    }
}

and here is the test:

[Test]
public void SingleTest()
{
    //create gameobjects
    GameObject[] collect = new GameObject[2];
    collect[0] = new GameObject("one");
    collect[1] = new GameObject("two");
    collect[0].AddComponent<StatCollector>();

    //see if gameobjects were created correctly
    if (collect[0] == null || collect[1] == null) Assert.Fail("failed to create game objects");

    //test what happens when the second stat collector is added to the scene
    collect[1].AddComponent<StatCollector>();
    collect[0].GetComponent<StatCollector>().Awake();
    collect[1].GetComponent<StatCollector>().Awake();
    Assert.IsNull(collect[1]);
}

I'm assuming that there is no way to keep Awake private which is why it is public (just so that the test case has access to it)

sentences:
Visual Studio Code Unity AutoComplete still not working I am having an issue with Visual Studio Code AutoComplete for Unity.

Some of the autocomplete is working, such as: void Start(), void Update(), but most of the rest of Unity Autocomplete is not working such as: GameObject, Rigidbody, Input.GetKey, etc..)

I know VScode and Unity are not connected like how Unity and Visual Studio are, but it seems that a lot of people make it work somehow, so I thought it is possible to make it work without much trouble.

I have the extensions needed to make it work (C#, Unity Tools, Unity Snippets Code etc...)
I have set vscode as my script editor (Unity -> Edit -> Preferences -> External Tools)
I installed  .NET Core SDK and .NET Framework 4.6 Targeting Pack
I tried uninstalling Unity and vscode but that didn't work either...

How can I solve this?

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

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

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

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

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

sentences:
How can I read values from a running instance of an existing game? I play an indie flight simulation game in Windows. I want to add a specific feature by means of creating a third-party add-on.

This apps will "link" and gather current altitude and position data from the game. My program will play sounds during certain altitude and airplane configurations (it's called GPWS).

I have seen the same thing done in an online RPG game where an external program counts damage dealt in the game (which requires peeking at the game's variables), so I think this is very possible.

My question is:

What is this data-gathering called? I googled many terms like hijacking or linking but the result is not what I meant.
How do i create program like this? I don't mind if its in other languages like Java or Visual Basic, but my main experience is in C++.

sentences:
How many texture units are available per shader stage when compared to the total number available on hardware? The answer to the question How many textures can usually I bind at once?, given here, explains that:

OpenGL 3.x defines the minimum number for the per-stage limit to be 16...

and that there can be a higher limit.
This still leaves some ambiguity that I would like to clarify. If we calculate the total number of texture units to be, for e.g., 192 (see here for more details), then does this mean:

theoretically, that we have access to 192 texture units available for the pixel shader? OR
we have access to 192 texture units across all stages, however that still doesn't mean we have access to 192 texture units on any particular stage. OR
?

If #2 is correct, then how do we figure out how many maximum texture units are available on any given stage?

sentences:
Enemy shake/vibrate when following character I am using the arongranberg A* path finding project to create way points for one enemy to follow the player. However, the enemy vibrates back and forward by about 0.1 - 0.2 unit distance when moving. I have done a lot of research regarding this problem in the past few days but to no avail I could not find a solution that solves it. This is link to a gif to show what I mean.

I have tried,

changing    Application.targetFrameRate = 30;

changing fixed update to update and vice versa;

using rigidbody2d and turn interpolate on plus using velocity to move;

turning iskinematic on and off;

using translate to move.

none of the above solution works. Below is the script I have for my enemy. Any advice would be appreciated.

    using UnityEngine;
    using System.Collections;
    //Note this line, if it is left out, the script won't know that the class 'Path' exists and it will throw compiler errors
    //This line should always be present at the top of scripts which use pathfinding
    using Pathfinding;

public class AstarAI : MonoBehaviour
{
    //The point to move to
    public Transform target;

    private Seeker seeker;

    //The calculated path
    public Path path;

    //The AI's speed per second
    public float speed = 200;

    //The max distance from the AI to a waypoint for it to continue to the next waypoint
    public float nextWaypointDistance = 0.02f;

    //The waypoint we are currently moving towards
    private int currentWaypoint = 0;

    Rigidbody2D rb;

    public void Start ()
    {
        rb = this.GetComponent<Rigidbody2D> ();
        seeker = GetComponent<Seeker>();

        //Start a new path to the targetPosition, return the result to the OnPathComplete function
        seeker.StartPath( transform.position, target.position, OnPathComplete );
    }

    public void GoToNewTarget(Transform newTarget) {
        //path = null;
        currentWaypoint = 0;
        nextWaypointDistance = 0.02f;
        target = newTarget;
        seeker = GetComponent<Seeker>();
        seeker.StartPath( transform.position, target.position, OnPathComplete );
    }

    public void OnPathComplete ( Path p )
    {
        Debug.Log( "Yay, we got a path back. Did it have an error? " + p.error );
        if (!p.error)
        {
            path = p;
            //Reset the waypoint counter
            currentWaypoint = 0;
        }
    }

    public void Update ()
    {
        if (path == null)
        {
            //We have no path to move after yet
            return;
        }

        if (currentWaypoint >= path.vectorPath.Count)
        {
            Debug.Log( "End Of Path Reached" );
            return;
        }

        //this.GetComponent<Rigidbody2D> ().MovePosition (path.vectorPath[currentWaypoint]);
        //Debug.Log (path.vectorPath[currentWaypoint]);
        //Direction to the next waypoint
        Vector3 dir = ( path.vectorPath[ currentWaypoint ] - transform.position ).normalized;
        //GetComponent<Rigidbody2D> ().velocity = new Vector2 (dir.x * 3, dir.y * 3);
        //Vector3.MoveTowards(transform.position, path.vectorPath[ currentWaypoint ], 2*Time.fixedDeltaTime);
        dir *= speed* Time.deltaTime;
        rb.velocity = dir;
        //this.gameObject.transform.Translate( dir );

        //Check if we are close enough to the next waypoint
        //If we are, proceed to follow the next waypoint
        if (Vector3.Distance (transform.position, path.vectorPath [currentWaypoint]) < nextWaypointDistance) {
            currentWaypoint++;
            return;
        }
    }
}

sentences:
Unreal Engine 4 AI Character Pawn Entirely Unresponsive to Movement Commands I'm new to game development and to Unreal but I cannot for the life of me get my AI character pawn to move at all using any method I know.
I'm developing a 2d Sidescroller game using a Tilemap. I have made sure collision is set up with the map and tiles, the player character can interact with it all just fine, and I made sure to widen the collision thickness of the map so that the navmesh can properly appear (as seen with the green areas).
Nav Mesh loading. AI spawns in the air and falls down so I know he isn't overlapping with the ground

I've disabled and enabled collision for the static mesh cube component in the character pawn, but he still doesn't move.
The goal is to get him to follow the player when he sees him. The pawnsensing trigger works just fine, as I had it print whenever he sees him, and he even properly gets to the point of executing the "follow player" function (the print statement works).
However, using AIMoveTo fails every time. I've tried putting the player as the target, the player's worldLocation as a vector, and even an arbitrary point vector to the right of the AI but AIMoveTo fails every time.
I've deleted and replaced the NavMesh, and I've even tried completely skipping using AIMoveTo and just using Add Movement Input in both the AI Thinking Blueprint and Character Pawn Blueprint but neither make it move. I literally put an Add Movement Input function on the Pawn's event tick but it never moves.
Any suggestions?
Code:
AI Logic event is triggered every tick

Character Pawn Tick (for debugging). Does not cause the Pawn to move

sentences:
Rotating plane to face object while rotating around z axis. C++ I want to create a plane 2d sprite plane that looks at a 3d object and then rotates by its z axis.

So I have created a LookAt Function in my game which will make the object look automatically at the sphere, but it is executed every frame, I believe this is because it makes the rotations every frame, now if I want to rotate it again by its local axis, the LookAt() overwrites this because its matrix is being set the same each time and so cannot rotate.

I believe I will have to rotate manually, now I know this problem is easy on one axis of rotation.

My maths is rusty. So I don't think I could just do this for a 3D rotation but I'm not sure. If so do I require quaternions?

Step by step desired action

Rotation on the z axis to make the plane face on the right x angle of sphere ignoring its y position.
Rotate on its x ais to make the plane face the y angle between sphere and 2d plane.
Rotate around the z axis each second, while remaining faced at the object.

@Jay

Here is the code related to the first answer which makes my model dissapear.

selec->SetPosition(a->unit_x, a->unit_y, a->unit_z);
selec->GetMatrix(&rotmatrix[0][0]);
CMatrix4x4 crotmatrix{ &rotmatrix[0][0] };
crotmatrix.RotateLocalZ(0.025);

selec->GetMatrix(&lookatm[0][0]);
CMatrix4x4 clookat{ &lookatm[0][0] };
clookat.FaceTarget(CVector3{ 0,0,0 });

clookat.MultiplyAffine(crotmatrix);
convertmatrix(clookat);

selec->SetMatrix(&lookatm[0][0]);

This does multiply the matrices, but it keeps multiplying and creating a crazy motion, then causes a crash, maybe from gimbal lock?

sentences:
You've killed the enemy you needed to get across. Now you have to die and retry? I am designing enemies for a platformer, and want to have enemies which the player utilises to get through levels.

I like the idea of jumping on enemies to platform across gaps, but it's problematic if they die. It feels really bad to put the player in an unwinnable state, having killed their means to platform across a level. It just feels messed up to be like, 'You've killed the enemy you needed to get across. Now you have to die and retry'.

What are some ways of fixing that problematic game state?

sentences:
Unity ball hitting paddle not reflecting right away After the ball hits the paddle it continues for a frame or two in the physics, reflected direction, then my onCollisionEnter2D function runs and changes the velocity. At least, that's what it seems like. I'm a noob with Unity so I must be misunderstanding something.

https://streamable.com/ac2gg

if (other.gameObject.CompareTag("Paddle"))
    {
        float dist = ballRb.transform.position.x - paddleRb.transform.position.x;

        if (dist > 0)
        {
            print("right");
            ballRb.velocity = new Vector2(4, speedY);
        }
        else
        {
            print("left");
            ballRb.velocity = new Vector2(-4, speedY);
        }
    }

Thoughts on why there's a stutter after a redirection? I slowed it down so you can see better what's happening.

sentences:
Are the sides of a beveled rectangular prism considered "ngons", to be avoided? Many tutorials I have watched say that everything should be made in 'quads' (ie. no triangles, and no ngons).

I think this is mainly due to getting into this habit so that if I make a complex model, eg. a rigged character face, then there won't be any animation issues like model warping or bad occlusions/shadows/etc. (please do correct me if this is wrong, its just what I've gathered from many videos and some books).

So I tasked myself with making a  Glock handgun, thinking this boxy shape might be a good starter project. I noticed the corners of the top piece are curved/beveled, so I beveled it on my model.

This is where I got my first problem though, the bevel process created about 3 new vertices on each corner I applied it to, but then this leaves the side of the piece with more than 4 edges (see picture):

In the pic you can see I highlighted one of the small 'edges' the bevel created. So now I can count something like 12 edges in total surrounding that side part.

Is that an ngon? Will it matter? And if its not OK, how should I do it?

sentences:
Unity - Inaccurate rotation if object is rotated on two axis at once I have an object which i want to rotate relative to world space. I have three variables (one for every axis) which store the rotation. By pressing buttons on my controller I add or subtract 90 to these variables (rotX, rotY, rotZ). Then I rotate my Object like this:

transform.Rotate (rotX * delta, rotY * delta, rotZ * delta, Space.World);

As this is called every frame the object would spin forever so i subtract the ammount I've allready rotated afterwards:

rotX -= rotX * delta;
rotY -= rotY * delta;
rotZ -= rotZ * delta;

This works fine as long as I don't rotate two axis at once. Then the object rotates rotates only partially to the desired position (e.g. 83 if I want to rotate to 90).

I can't see what I've done wrong. It actually seems like the moment I start an rotation around an axis all other axis get canceled. But if I monitor the variables they look exactly as they should.

Thank you in advance and have a amazing day!

sentences:
How do you make a ShapeRenderer always full screen on resize? I have:

shapeRenderer.setProjectionMatrix(stage.getViewport().getCamera().combined);

And I tried to do the following in render():

shapeRenderer.rect(0, 0, stage.getViewport().getScreenWidth(), stage.getViewport.getScreenHeight());

Which full-screens the ShapeRenderer when I first run my project, but as soon as I resize the window, the rectangle starts to change size and go off-screen. I'm using a FitViewport on my Stage, is there any way to make the ShapeRenderer always be full screen?

sentences:
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:
How to change colors of texture in lwjgl? I have the following texture:

The black pixels are characters, the background is transparent.
How do I change the black pixels of the characters to another color?
I use this texture as a bitmap for text rendering in lwjgl. For example, is there a way to change the black pixels to red?
I looked to shaders, but I don't know how to use shaders and what they does.
I would appreciate an example.
I also looked at this page.

But I don't really understand how to do it.
I will really vote up your answer.

sentences:
Windows Form code not executing? Ok, I've got a weird one here.  I'm trying to make a basic tile engine using a windows form, but some of my code is just...not happening.  I'll post the chunks in question.

private void MapEditor_Load(object sender, EventArgs e)
    {
        LoadImageList();
        FixScrollBarScales();
        cboCodeValues.Items.Clear();
        cboCodeValues.Items.Add("ENEMY");
        cboCodeValues.Items.Add("CHEST");
        cboCodeValues.Items.Add("NPC");

        for (int x = 0; x < 100; x++)
            cboMapNumber.Items.Add(x.ToString().PadLeft(3, '0'));

        cboMapNumber.SelectedIndex = 0;
        TileMap.EditorMode = true;
        backgroundToolStripMenuItem.Checked = true;
    }

This should be called when the form loads, right?  The code dives into LoadImageList(), which contains:

private void LoadImageList()
    {
        string filepath = Application.StartupPath + @"\Content\Textures\IndoorTileSet.png";
        Bitmap tileSheet = new Bitmap(filepath);
        int tilecount = 0;
        for(int y = 0; y < tileSheet.Height / TileMap.TileHeight; y++)
        {
            for(int x = 0; x < tileSheet.Width / TileMap.TileWidth; x++)
            {
                Bitmap newBitmap = tileSheet.Clone(new System.Drawing.Rectangle(x * TileMap.TileWidth, y * TileMap.TileHeight,
                    TileMap.TileWidth, TileMap.TileHeight), System.Drawing.Imaging.PixelFormat.DontCare);
                imgListTiles.Images.Add(newBitmap);
                string itemName = "";
                if(tilecount == 0)
                    itemName = "Empty";
                if(tilecount == 1)
                    itemName = "Floor";
                listTiles.Items.Add(new ListViewItem(itemName, tilecount++));
            }
        }
    }

The bitmap loads correctly, but then the entire MapEditor_Load method just stops working.  tileCount seems to be a local variable in the debugger, and its value is 0, but the debugger never executes the breakpoint on the line which it is assigned.  I have absolutely no idea why it would do this, and it's driving me nuts.  Any help?
Oh, I put the bitmap load in a try/catch block just to see if it was handling an exception in a weird way, but I had no luck.  It's not throwing an exception.  I began having this problem immediately after replacing my IndoorTileSet with an updated version.

sentences:
How do I make my game connect to a server without real IP address? I'm making an XNA game. When I started, I had a broadband connection with real IP, so I could host servers of any kind without any problem, but now I don't have that connection any more and I want to be able to let players from outside my local network connect to my server again. How do I do that? How do big guys at studios do that?

UPD: I guess it isn't fair to ask two questions in one, I just wanted to know if it's still possible for me to host a server on my connection, and if it's not an option, then how to do it without it (my connection). I believe I got my answers, though.

If I had an external dynamic address, I could use dynamic DNS service, but I don't, so I'll have to host my server on another machine (probably rent a server).

sentences:
Implementing line-of-sight in 3D? I've been searching for information on implementing line-of-sight in my game. I've found some great resources for 2D implementations that produce pixel-perfect results, but there's very little info on 3D implementations.

So far, I've found these methods that could be used to achieve line-of-sight:

Shadow maps
Shadow volumes
3D grids / octrees

However, each of these seems to have limitations. Shadow maps are quite expensive to calculate, especially for omni-directional line-of-sight (just like omni-directional shadows). Shadow volumes have special requirements for geometry and are rather difficult to produce. 3D grids and octrees are not pixel-perfect and require an additional renderer on top of the grid implementation.

Have I missed something here? Which method would be the most suitable for a top-down 3D game?

sentences:
Creating mesh at run-time I've a set of voxel data and I want to create a mesh out of it at run-time.

I've looked into MeshBuilder and MeshHelper but I haven't found anything useful or a good tutorial how to use them. Can anyone tell me how to create a mesh at run-time?

sentences:
How do I implement wander behavior in GDX AI? So I follow the original gdx-ai documentation and created 2 circles to test Steering behavior.

The image shows arrival behaviour but I am still quite lost about how they work.

Screen class:

public void show() {
        pCircle = new ShapeRenderer();
        pCircle.setProjectionMatrix(mCamera.combined);
        sCircle = new SteeringCircle(pCircle, 15, 128*5, 128, Color.BLUE);

        target = new SteeringCircle(pCircle, 15, 128,128*3 , Color.CYAN);
        /*
        Wander<Vector2> wanderSB = new Wander<Vector2>(sCircle);
        wanderSB.setEnabled(true);
        wanderSB.setTarget(target);*/
        Arrive<Vector2> arriveSB = new Arrive<Vector2>(sCircle, target).setTimeToTarget(0.1f).setArrivalTolerance(10f).setDecelerationRadius(25f);

        sCircle.setBehavior(arriveSB);
}

   @Override
    public void render(float delta) {

        Gdx.gl.glClearColor(63 / 255f, 128 / 255f, 70 / 255f, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        mCamera.update();
        mTiledMapRenderer.setView(mCamera);

        mTiledMapRenderer.render();

        sCircle.update(delta);
        sCircle.render();

        target.render();

        mBatch.setProjectionMatrix(mCamera.combined);

        mBatch.begin();
        mBatch.draw(img, 128, 0);

        mBatch.end();

    }

SteeringCircle class:

   public SteeringCircle(ShapeRenderer circle ,float boundingRadius, float x, float y, Color color) {
        pCircle = circle;
        mColor = color;
        this.position = newVector();
        this.position.x = x;
        this.position.y = y;
        this.boundingRadius = boundingRadius;
        this.maxLinearSpeed = 50;
        this.maxLinearAcceleration = 5000;
        this.linearVelocity = new Vector2(15,15);
        this.maxAngularSpeed = 30;
        this.maxLinearAcceleration = 5;

        this.tagged = false;

        this.steeringOutput = new SteeringAcceleration<Vector2>(new Vector2());

    }

@Override
    public Location<Vector2> newLocation() {

        return null;
    }

public void update (float delta) {
        if (steeringBehavior != null) {
            // Calculate steering acceleration
            steeringBehavior.calculateSteering(steeringOutput);

            // Apply steering acceleration to move this agent
            applySteering(steeringOutput, delta);
        }
    }

    private void applySteering (SteeringAcceleration<Vector2> steering, float time) {
        // Update position and linear velocity. Velocity is trimmed to maximum speed
        this.position.mulAdd(linearVelocity, time);
        this.linearVelocity.mulAdd(steering.linear, time).limit(this.getMaxLinearSpeed());

        // Update orientation and angular velocity
        if (independentFacing) {
            this.orientation += angularVelocity * time;
            this.angularVelocity += steering.angular * time;
        } else {
            // For non-independent facing we have to align orientation to linear velocity
            float newOrientation = calculateOrientationFromLinearVelocity(this);
            if (newOrientation != this.orientation) {
                this.angularVelocity = (newOrientation - this.orientation) * time;
                this.orientation = newOrientation;
            }
        }
    }

For the arrival behaviour, the blue circle will move from the original position towards the Cyan circle and comes back to the circle back and forth. I thought the blue circle is supposed to stop when arriving the cyan circle which it didn't.  How can I make it stop at arrival? what's wrong with the codes?
For the wander behaviour, the blue circle just moves north-east direction and never goes back to the cyan circle. I thought it will wander around but it didn't. Any advice on what is needed to change to make the wander behaviour happens?

Also, does anyone know what should Location returns? Isn't Vector2 position already has the location?

sentences:
LibGDX controllers: how to fix crashes in JRuby? I'm using JRuby with LibGDX and it's been going quite swimmingly, save for a crash I experience every time I try to use the controllers extension.

Here's a basic rundown:

I've required all the related jars (gdx-controllers.jar, gdx-controllers-desktop.jar, and gdx-controllers-desktop-natives.jar).
I've imported the controllers package via import "com.badlogic.gdx.controllers".
I call Controllers.controllers, which goes to the getControllers method.
My game crashes with this error:

libc++abi.dylib: terminating with uncaught exception of type OIS::Exception: CocoaInputManager::_parseConfigSettings >> Unable to find a window or event target

I think the error is due to a lack of a view being passed to OIS library (here's an online view of a related source).

How do I prevent the controllers extension from crashing my game? More importantly, how do I make it work? :)

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:
Can XNA Content Pipeline split one content file into several .xnb? Let's say I have an xml file which looks like this

<Weapons>
 <Weapon>
  <Name>Pistol</Name>
  ...
 </Weapon>
 <Weapon>
  <Name>MachineGun</Name>
  ...
 </Weapon>
</Weapons>

Would it be possible to use a custom importer/writer/reader to create two files, Pistol.xnb and MachineGun.xnb which I can load individually with Content.Load()?

While writing this I realized I could just import a Weapon[] list and split them up with a helper, but I'm still wondering if this is possible?

sentences: Has piracy ever resulted in a developer getting shut down? Has piracy EVER resulted in a developer getting shut down? That is, has piracy ever been so detrimental that it brought about the downfall of a game studio? If I were to release a game, should I be extremely wary of pirates and plan accordingly, or is it safe to assume that it won't damage me or my studio whatsoever?

sentences:
Controlling Source Image From Script I am trying to make a health system where hearts display how much health you have. On each heart, I have an Image component. I am trying to control what source image the Image component uses from a script, but it is not letting me. I read the documentation for the Image component here and it has no sprite property. This is my code:

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

public class HeartScript : MonoBehaviour
{
    public GameObject heart1;
    public GameObject heart2;
    public GameObject heart3;
    public Sprite halfHeart;
    public Sprite fullHeart;
    public Sprite emptyHeart;
    private double playerHealth = 3;

    // Update is called once per frame
    void Update()
    {
        if(playerHealth == 2.5)
        {
            heart1.GetComponent<Image>().image = fullHeart;
            heart2.GetComponent<Image>().image = fullHeart;
            heart3.GetComponent<Image>().image = halfHeart;
        }
        else if(playerHealth == 2)
        {
            heart1.GetComponent<Image>().image = fullHeart;
            heart2.GetComponent<Image>().image = fullHeart;
            heart3.GetComponent<Image>().image = emptyHeart;
        }
        else if(playerHealth == 1.5)
        {
            heart3.GetComponent<Image>().image = emptyHeart;
            heart2.GetComponent<Image>().image = halfHeart;
            heart1.GetComponent<Image>().image = fullHeart;
        }
        else if(playerHealth == 1)
        {
            heart3.GetComponent<Image>().image = emptyHeart;
            heart2.GetComponent<Image>().image = emptyHeart;
            heart1.GetComponent<Image>().image = fullHeart;
        }
        else if(playerHealth == .5)
        {
            heart3.GetComponent<Image>().image = emptyHeart;
            heart2.GetComponent<Image>().image = emptyHeart;
            heart1.GetComponent<Image>().image = halfHeart;
        }
        else if(playerHealth == 0)
        {
            heart3.GetComponent<Image>().image = emptyHeart;
            heart2.GetComponent<Image>().image = emptyHeart;
            heart1.GetComponent<Image>().image = emptyHeart;
        }
    }

    public void RemoveHealth()
    {
        playerHealth = playerHealth - 0.5;
    }
}

How do I change the sprite the heart uses from a script?

sentences:
Defining tileset for Tiled Terrain Brush — incorrect tiles selected at transitions I'm using TilEd (https://mapeditor.org) to make maps, and so far have used the programs Terrain feature to create water/paths etc no problem.

I'm trying to create trees now, and I've been at it a whole day and cannot figure out what I'm doing wrong. Have tried countless variations of sizes but here's what i'm currently using:

Tileset:

Now here's the terrain setup, types TREES and GRASS

Here's what it looks like in the map editor, close, but issues:

Any tips on how to define the terrain in TilEd? Or maybe a link to a working trees terrain pattern so I can compare?

sentences:
Accessing libgdx classes within Android classes Currently what I'm able to do is to access android APIs within libgdx with an  interface in core and defining all the methods and then implementing it in every project (desktop, android, etc). What I want to do is I want to create a way so that I can call a method from some android class (say AndroidLauncher) and it calls a method of a libgdx core project class (like modifying some stage element). How do go about that?

Any help would be really appreciated.

Note: As a 'hack' right now, I'm just waiting for any update from android class in the render method using those same interface methods, but I don't think that's the best possible way.

sentences:
Gamemaker display orientation detection I am making a game that needs to detect when the device gets turned over in landscape mode to landscape-flipped to change some game mechanics when the player does so. The project is already set to work only in those two orientations.

I am using an object instantiated in the room with the following code in Step :

show_debug_message("Orientation : " + string(display_get_orientation()));

But I always get the same input - either "landscape" or "landscape-flipped" and it doesn't seems to change the output in runtime, although if I press the power button on the phone and the game goes in pause, if I flip the phone and I return to the game I get the opposite status, but it keeps repeating itself, as it could not read the real orientation of the phone.

Anyone has faced this problem before?

Cheers!

sentences:
Is creating vertex/index buffer optimized this way? I have some vertices in an array from which I create a vertex buffer. Let's say I have vertices:

v1, v2, v3, v4

I use indices:

0, 1, 2, 3

Is there any performance impact if I change the indices to

1, 3, 0, 2

(to have another geometry)? I just wonder whether the directx will iterate through vertices jumping to different addresses in a memory to get vertices (not linearly) or maybe the directx is able to recreate the vertex buffer (before it is sent to the graphics card) to suit the indices like this (it could then iterate it linearly):

v2, v4, v1, v3

(beacuse it is obvious that is is better to iterate through data put linearly in a memory)?

Is the question understandable?

sentences:
Implementing single and muliplayer without messing everything up I don't know a good way to implement single and multiplayer in a game without messing up the whole project structure.

Should I create separate classes for single and multiplayer entities or is there a clever programming pattern I can't find for this situation?

Let's make a simple example of my problem.

Let's say I want to make a pong clone with single and online multiplayer, how should I go about this?
Make separate classes for both modes?

I read somewhere that the MVC pattern might be a good choice in this case but I'm not sure how to implement it correctly.

Should I create a Player data class and then multiple controller classes for example: PlayerControllerSingleplayer,
AIController,
PlayerControllerMultiplayerSelf,
PlayerControllerMultiplayerOpponent.

And then a PlayerRenderer view class?

I've read some articles about mvc previously but still don't know really much about it or how to do it correctly in my case.

I will be using libgdx and probably kryonet for the networking if that might be important.

Thanks for every piece of advice in advance!

sentences:
How do I safely change properties on my skybox? Usually in Unity, when your scripts make changes to something at runtime, those changes are not persisted back to design-time.  This is generally considered a good thing.  But for whatever bizarre technical reason, this does not apply to shader properties on materials.  If you change something while the game is running, it stays changed!
Generally the way to get around this is with a MaterialPropertyBlock, which also helps avoid generating a lot of garbage.  But MaterialPropertyBlocks work with Renderers, which leaves out one rather important material: the skybox.
Right now, I have code that says RenderSettings.skybox.SetFloat("_PropName", value);, and it's incredibly aggravating because it always needs to be reset afterwards.  RenderSettings doesn't have a SkyboxRenderer property that I can use in conjunction with a MaterialPropertyBlock, so how can I change shader settings on my skybox and make them not persist after I exit play mode?

sentences:
What are the correct angles in the Top-down perspective? In the following picture it says that in the Top-down perspective the angles are 90°, but if it would be 90° then you shouldn't see the front of the building and the roof at the same time...

So what are the correct angles to get such an perspective?

sentences:
How to convert a premade mesh into voxels so I can use algorithms such as marching cubes I have a mesh that was created in a 3D program which is the terrain the player will walk on.  I want to allow the terrain to be deformable by the player, but for it to be smooth (not like Minecraft).

From what I have read from existing questions similar to mine, I need to use an algorithm such as Marching Cubes (which I don't understand yet).  From what I understand, those types of algorithms are suited for procedural generation.

My question is;  How do I convert my mesh into voxels so that I can use algorithms such as Marching cubes?

Is it simply a matter of cutting up my mesh in chunks?

If it helps, I will be using C# and Unity 3D.

sentences:
SFML 2.4's RectangleShape is running slow when rendered multiple times I am creating a level for my game and currently, there is a Tile class where I have a black RectangleShape rendering without any weirdness, except when I look at the FPS, its 200. Now, I have a pretty bad computer, but Normally when it just has my player texture on the screen, it was at 1200 FPS. Is this normal? I know that SFML 2.4.1 does not support batching. For that you would have to use a VertexArray. So, I replaced the RectangleShape with a VertexArray and used vertices[0].position = ... for the 4 vertices. Yet even if I set the color of the vertices to black, there are no black boxes on the screen. (This is now running at 500fps). I am sure that all the render methods are being called each frame. (window.draw(vertices);). TL;DR I need a way to optimise RectangleShape rendering within C++.

I am sincerely sorry if this is a nooby question or if the construction of this question is bad.

Thanks in advance!

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:
Collision Direction Detection I'm making an RPG game where players and enemies can collide with walls.
Right now it pushes the player off the wall when he tries to 'go through' it.
However, I detect which way he should be pushed based on his current direction.
This means that enemies can still push him through walls.
Also if the player moves diagonally, detection doesn't work properly. This is a problem...

I'm using SFML and these Collison-Detection methods: https://github.com/LaurentGomila/SFML/wiki/Source:-Simple-Collision-Detection-for-SFML-2

Specifically I'm using this method:

bool BoundingBoxTest(const sf::Sprite& Object1, const sf::Sprite& Object2)
{
    OrientedBoundingBox OBB1 (Object1);
    OrientedBoundingBox OBB2 (Object2);

    // Create the four distinct axes that are perpendicular to the edges of the two rectangles
    sf::Vector2f Axes[4] = {
        sf::Vector2f (OBB1.Points[1].x-OBB1.Points[0].x,
        OBB1.Points[1].y-OBB1.Points[0].y),
        sf::Vector2f (OBB1.Points[1].x-OBB1.Points[2].x,
        OBB1.Points[1].y-OBB1.Points[2].y),
        sf::Vector2f (OBB2.Points[0].x-OBB2.Points[3].x,
        OBB2.Points[0].y-OBB2.Points[3].y),
        sf::Vector2f (OBB2.Points[0].x-OBB2.Points[1].x,
        OBB2.Points[0].y-OBB2.Points[1].y)
    };

    for (int i = 0; i<4; i++) // For each axis...
    {
        float MinOBB1, MaxOBB1, MinOBB2, MaxOBB2;

        // ... project the points of both OBBs onto the axis ...
        OBB1.ProjectOntoAxis(Axes[i], MinOBB1, MaxOBB1);
        OBB2.ProjectOntoAxis(Axes[i], MinOBB2, MaxOBB2);

        // ... and check whether the outermost projected points of both OBBs overlap.
        // If this is not the case, the Seperating Axis Theorem states that there can be no collision between the rectangles
        if (!((MinOBB2<=MaxOBB1)&&(MaxOBB2>=MinOBB1)))
        {
            return false;
        }
    }
    return true;
}

Note that the method only checks if the sprites collide, not how or where they collide.
I don't know how exactly the collision detection works, I've tried printing out the OBB values but they're nonsensical to me.

Should I somehow modify the function, or is there another way of doing collision direction detection? I'm stuck here.

UPDATE

I managed to actually check for which direction the player was colliding with the wall.
I have a really odd problem now:
It only works properly on the last wall I place.

I have 4 booleans (canWalkUp, canWalkDown, canWalkLeft, canWalkRight) to check for if the player is holding down both left and right, or up and down - so they don't negate each other. This prevents wonky movement.
I also have 4 booleans to check if the player is currently colliding with a wall.

The code which handles player-boundary collision is as follows:

void EventHandler::collisionPlayerBoundary(std::shared_ptr<Entity> player,     std::shared_ptr<Entity> boundary)
{
std::vector<sf::Vector2f> distances = Collision::BoundingBoxDistance(player->sprite, boundary->sprite);
float pushSpeed = 75;
if(distances.at(0).y < 20) //push left!
{
    std::cout << "pushing left" << std::endl;
    player->pushX = -pushSpeed;
    player->canWalkRight = false;
    player->collidingRight = true;
}
if(distances.at(1).y < 20) //push down!
{
    std::cout << "pushing down" << std::endl;
    player->pushY = pushSpeed;
    player->canWalkUp = false;
    player->collidingUp = true;
}
if(distances.at(0).x < 20) //push right!
{
    std::cout << "pushing right" << std::endl;
    player->pushX = pushSpeed;
    player->canWalkLeft = false;
    player->collidingLeft = true;
}
if(distances.at(2).x < 20) //push up!
{
    std::cout << "pushing up" << std::endl;
    player->pushY = -pushSpeed;
    player->canWalkDown = false;
    player->collidingDown = true;
}
}

sentences:
Moving large group of units 1 by 1 takes too long, how can I improve this? I use use Unity's own NavMesh/AI system and I think it works pretty well. The only problem I have is that when I move large groups of units, they will find a path one by one, but it takes a really long time as you can see in the video:

https://gfycat.com/blankhalfdartfrog

To set destinations I use this:

    public bool SetDestination(Vector3 point)
    {
        if (SamplePosition(point))
        {
            agent.SetDestination(point);
            return true;
        }

        return false;
    }

I know I could wait until they all have pathPending == false, but that would mean the entire group moves with a huge delay. Is there some way I can improve or fix this issue?

Edit: It is quite simple to recreate (if you have some basic knowledge on Unity NavMesh): simply create a "click to move"-script that moves a List of units to where you clicked using the code above (just fill the list in Start on each unit). Put down a few obstacles and you're done.

sentences:
How to draw a sprite at a floating point xy coordinate with interlaced drawing? I have a 2D game made in MonoGame (XNA 4.0 framework). Here's what I want to do:

draw a 2d image at a floating point xy coordinate such as 125.5, 300.12 (and do NOT round them to an int).
the image is automatically "interlaced", which means the picture is shaded correctly around the borders so that it looks like it's actually a fraction of the way across pixels, and not aligned exactly on pixels.

How do I do this? Is there a standard library for this?

P.S. the game I'm working on eventually needs to work on Mac and Linux as well, so please don't give me any dead-end solutions.

sentences:
Memory leak with glfwSetWindowTitle? I am using GLFW for a game, and I have a function which allows me to set the window title.

    // PROBLEM WITH INCREASING MEMORY USAGE
    void WindowSystem::setTitle( const string & title )
    {

        glfwSetWindowTitle( window, title.c_str() );

    }

This function is called once during every iteration of the main program loop, so that I can have a basic FPS counter. Under Xcode the program memory usage increases faster and faster. If I replace title.c_str() with a literal, the problem does not happen, i.e., the following does not cause the same memory usage growth.

        // DOESN'T CAUSE PROBLEM
        void WindowSystem::setTitle( const string & title )
        {

            glfwSetWindowTitle( window, "Hello world!" );

        }

This where the function is called.

    int SystemControl::update()
    {
        double time = glfwGetTime();
        double timeStep = time - control->lastUpdate;
        control->lastUpdate = time;

        float frameRate = 1.0f / timeStep;

        string windowTitle = std::to_string( frameRate );

        control->windowSystem->setTitle( windowTitle );

        control->physicsSystem->update( timeStep );

        return OK;
    }

The string title is allocated on the stack, and should be freed at the end of update. Could there possibly be a memory leak? I understand that the pointer for c_str() is internally managed, and does not need to be freed.

sentences:
Animation position leftover I am fairly new to unity and I have encountered this same problem previously.

I have a gun with hands and I created an animation that simulates shot movements with properties transform.position and transform.rotation. Root motion is applied and motion curves are generated for the animation.The default state animation for that object has no properties assigned to it and as much as I understand from the animation controller window, the shot animation is completed before the transition to the default state is made.

The problem is that on every 3 shots 0.001 is added to the X rotation; Y and Z positions are losing some small values.

I tried to prolong the animations exit time but the result is the same. I checked the key values and the motion curves, the first and last ones are the same. Why is this happening and how can I fix it ?

sentences:
Animations only play when moving along the Y axis My problem is, I have walk animations which only play when my character is moving upward or downward, and I don't know why. This is my code:

public float speed = 5f;
private Animator anim;

void Start () {
    anim = gameObject.GetComponent <Animator>();
}

void Update () {
    anim.SetFloat ("Speed", Mathf.Abs (Input.GetAxis ("Horizontal")));
    anim.SetFloat ("Speed", Mathf.Abs (Input.GetAxis ("Vertical")));

    if (Input.GetAxis ("Horizontal") < -0.1f) {
        transform.localScale = new Vector3 (-1,1,1);
    }
    if (Input.GetAxis ("Horizontal") > 0.1f) {
        transform.localScale = new Vector3 (1,1,1);
    }
}

void FixedUpdate {
    Vector3 move = new Vector3 (Input.GetAxis("Horizontal"), Input.GetAxis ("Vertical"),0);
    transform.position += move*speed*Time.deltaTime;
}

sentences:
Getting the top layer of 3D perlin Noise I am generating 16x16x64 chunks. Afterwards I apply 3D noise to them. I want the first layer to be all grass blocks and after those I want layers of dirt.

The current problem is that I am getting some dirt blocks in my top layer.
So how do I get the entire top layer of the noise?

TArray<int32> heightMap = CalculateNoise();

    for (int32 x = 0; x < 16; ++x)
    {
        for (int32 y = 0; y<16; ++y)
        {
            for (int32 z = 0; z< 64; ++z)
            {
                int32 voxelIndex = x + (y * 16) + (z * (16*16));

                int heightmapValue = heightMap[voxelIndex];

                if (z == 30 + heightmapValue)
                    ChunkIDs[voxelIndex] = 1;
                else if (z == 29 + heightmapValue)
                    ChunkIDs[voxelIndex] = 2;
                else
                    ChunkIDs[voxelIndex] = 0;

            }
        }
    }

sentences:
Why is my Direct3D 9 floating point texture clamping values 0–1? I'm using Direct3D 9 to draw some primitives into a texture. The format used at texture creation is D3DFMT_A16B16G16R16F, and the primitives are drawn using additive blending. The additive blending works as expected provided the result is <= 1. If it is greater than 1 then it seems to be clamped to 1.

This question includes a comment stating that COLOR0 output semantics for a pixel shader automatically clamp the output values. I can't ask for elaboration there due to low SE rep. Is there anything else that I need to do on top of changing the texture format that I pass in to CreateTexture, in order to use the full range of 16-bit floats? Given that I can otherwise draw primitives with shading (aside from the clamping issue) fine, is there any other setup that needs to be done?

To illustrate my issue, I'm doing two passes of the following shader (ping-ponging between two textures in the aforementioned format):

texture tex;

sampler2D sam = sampler_state {
    texture = <tex>;
    minfilter = none;
    magfilter = none;
    mipfilter = none;
};

float4 main(float2 uv : TEXCOORD) : COLOR0 {
    float4 cin = tex2D(sam, uv);
    float4 cout = cin;

    cout.g = 10;
    if (cin.g > 1)
        cout.b = 1;

    return cout;
}

The output (starting from black) is a green screen. If I change:

cin.g > 1

To:

cin.g >= 1

Then I get a cyan screen.

I'm working from a modified version of SDL2's Direct3D 9 driver if that helps.

sentences:
Pygame proble, moving picture Thats my problem on the Picture...The stripes

How can i fix that?

My Code:

import pygame, sys
from pygame.locals import *

pygame.init()

sound = pygame.mixer.Sound('start.wav')
sound.play()

size = width, height = 1600, 848
speed = [2, 2]
black = (0, 0, 0)

pygame.mouse.set_cursor(*pygame.cursors.broken_x)

screen = pygame.display.set_mode(size)
background = pygame.image.load("background.PNG")
dragon1 = pygame.image.load("dragon1.gif")
screen.blit(background, (0,0))

x,y=0,0
clock=pygame.time.Clock()
speed=250
movex, movey=0,0

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    if event.type==KEYDOWN:
            if event.key==K_a:
                movex=-1
            elif event.key==K_d:
                movex=+1
            elif event.key==K_w:
                movey=-1
            elif event.key==K_s:
                movey=+1
    if event.type==KEYUP:
            if event.key==K_a:
                movex=0
            elif event.key==K_d:
                movex=0
            elif event.key==K_w:
                movey=0
            elif event.key==K_s:
                movey=0
    x+=movex
    y+=movey

screen.blit(dragon1, (x,y))
pygame.display.flip()

sentences:
Create a stack driven coroutine based state machine for Unity I am working on a game where I am using a coroutine based state machine which is mostly a multi class implementation of this link. I am using it because it allows me to create multi frame sequences.

I wanted to know how would I go about making a stack based machine, so that I can overlay game states such as when I want to pause the game to show a menu i can run a pause menu state pausing the running game state, while still allowing the state objects to be rendered in the background

Here is the code I am using for a state:

public abstract class State {

[Inject]
MonoBehaviour gameObject;

[Inject]
public EventSystem eventSystem;

StateMachine parent;

public State(StateMachine p)
{
    parent = p;
}

public abstract IEnumerator Enter();

public abstract IEnumerator Exit();

public abstract IEnumerator Update();

public IEnumerator Run()
{
    yield return gameObject.StartCoroutine(Enter());
    while(parent.CurrentState.GetType() == GetType())
    {
        yield return gameObject.StartCoroutine (Update ());
    }
    yield return gameObject.StartCoroutine (Exit());
}
}

State machine run function

 State Current //The current state , the one at the top of the stack
 while(Current!=null)
        {
            yield return Component.StartCoroutine(Current.run());
        }

The problem with this approach is as soon as the state machine's current state changes (That is when i push it down the stack adding a new state on top) , the while loop in the Base state class's run method will end and will call the exit coroutine causing the state to end which is undesirable as according to the stack pattern the state should be paused

Moreover as coroutines work in unity, the yield return statement(in the state-machine) wont return until the previous started coroutine exits , which is currently as of now responsible for starting the states .

My question is how do i alter this code so as to pause the previous state (that will be pushed into the stack) instead of exiting it and starting anew state

this implementation works fine if there is to be only a single state in the memory

sentences:
Split group of enemies? .
.
In my script, enemy goes to dead point and if player closet to him he attacking player. When I started making wave of enemies I notes that all of them goes to player. Now, I need to add something making enemy avoid player in case there are 4 enemy around him and goes to dead_point. What I did is, I attached every player script "enemyAround" to count any enemy around player.

    public int enemies = 0;

void OnTriggerEnter(Collider other)
{
    enemies++;
}

void OnTriggerExit(Collider other)
{
    enemies--;
}

But I couldn't figure how to make enemy read it ?. If Enemy select player to attack him, He reads or knows How many enemy around the selected player.

enemy script

private Animator enemy_anim;
private NavMeshAgent mAgent;
private GameObject[] player;
public GameObject[] dead_point;
public int farPoint, dead_point_number, player_number;
public float dist;
public bool enemt_run, enemy_atack = false;
public bool near;

private enemyAround arounds;
public int enemy_around_player;

// Use this for initialization
void Start()
{

    mAgent = GetComponent<NavMeshAgent>();
    enemy_anim = GetComponent<Animator>();
    player = GameObject.FindGameObjectsWithTag("Player");
    dead_point = GameObject.FindGameObjectsWithTag("dead_point"); // 3 points
    enemy_dirction();

}

void Update()
{

    // count enemies around player
    enemy_around_player = selected player

    for (int i = 1; i < player.Length; i++)
    {

        if (Vector3.Distance(transform.position, player[i].transform.position) <
            Vector3.Distance(transform.position, player[player_number].transform.position))
        {
            player_number = i;
        }
    }

    dead_point_number = dead_point.Length;
    dist = Vector3.Distance(transform.position, player[player_number].transform.position);

    if (dist <= 5)
    {
        near = true;
    }
    else
    {
        near = false;
    }

    if (player != null && dist <= 5.1f)
    {
        mAgent.destination = player[player_number].transform.position;
        if (dist < 1.2f)
        {
            enemy_atack = true;
        }
        else
        {
            enemy_atack = false;
        }
    }
    else
    {
        if (dead_point_number > 0)
        {
            mAgent.destination = dead_point[farPoint].transform.position;
        }
        else
        {
            mAgent.destination = player[player_number].transform.position;

        }
        if (mAgent.remainingDistance <= 1.5f)
        {
            enemy_atack = true;
        }
        else
        {
            enemy_atack = false;
            enemt_run = true;

        }
    }

    mAgent.speed = 1.0f;

    enemy_anim.SetBool("run", enemt_run);
    enemy_anim.SetBool("attack", enemy_atack);
}// end update

// choose any deat_point.
void enemy_dirction()
{
    if (dead_point_number > 0)
    {
        farPoint = Random.Range(0, dead_point.Length);
        mAgent.destination = dead_point[farPoint].transform.position;
    }
    else
    {

    }
}

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:
OpenGL Two-point perspective view Summary:
I want vertical lines to be drawn as vertical lines regardless of their position relative to the camera (distance/offset). I want the projection to be perspective so the furthest objects from camera look smaller while keeping their respective proportions.
What am I trying to achieve: A two (vanishing) point perspective like this one http://insidetheoutline.com/wp-content/uploads/2019/07/2_Point_Perspective_Cityscape.jpg
Why am I at it: I'm really bad at 3D (obviously) therefore I'm trying to replace character models with 2D sprites like in Populous 3, or "The Game" quest in Fable 3. I also want to have a top-downish view like in isometric games. Alas, perspective distortion totally kills the effect, making sprites look skewed whenever they are off-center.
What am I doing right now:
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity;
  gluPerspective(FOV, wndWidth / wndHeight, zNear, zFar);
  // Googling lead me to this MV matrix, alas it's not working for me
  // {
  //  1, 0, 0, 0,
  //  0, 1, 0, 0,
  //  0, -camY/camZ, -camZ, 0,
  //  0, 0, 0, 1
  // }
  glMatrixMode(GL_MODELVIEW);
  glLoadMatrixf(@cam);
  // camX = camY = camZ = 50
  gluLookAt(
    camX, camY, camZ,
    0, 0, 0,
    0, 0, 1
  );
  // then I draw a uniform grid -5..5 by -5..5
  // and slightly off-center wireframe box to test if they are drawn correctly

Does it work? No, it doesn't. Provided matrix produce no result at all, so I had to change it to { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, -camY/camZ, -camZ, 1}. Just like any text on a two-point perspective says: "Set one of the values in the last column to zero". I tried zero in any position, except the last one, to no avail. Generally, I get something like this:

The rightmost vertical line--the one that aligns with screen center--is vertical, just as I want all of them to be, but the others are skewed away.
What else I managed to google: Not much, really. I found an example that kinda looks like something I want to achieve, but they place the camera at ground level with zero Z delta, effectively eliminating the third vanishing point. In some other example, they just narrowed FOV to some absurdly low value, making it look like a two-point perspective to some extent.
I'm afraid I'm missing or misunderstanding something. I also not sure if the desired output will, in fact, look like I want, and I won't discard it if it's not.

sentences:
*Python* Class - self.x = self - What does it mean to set it to self? I have this class for my game that is a scene manager. I followed a tutorial and I am confused on why the self.scene.manager is equal to self

class SceneManager(object):
    def __init__(self):
        self.go_to(TitleScene())

    def go_to(self, scene):
        self.scene = scene
        self.scene.manager = self #<--

In the main game scene I also have a similar thing happening

class GameScene(Scene):
    def __init__(self, levelno):
        super(GameScene, self).__init__()
        self.player = Player(5, 40)
        self.player.scene = self

What is the purpose of setting it to self?

Another Question:
I have been using classes and for most of them I create a class and I include this within the class

Class myClass():
   super(myClass, self).__init__() #<----- This line here

Does this have something to do with my original question?
What is the purpose of doing this?

sentences:
How to add font assets to a Unity based Android app on runtime? I am working on an android app that contains a Unity scene. The unity scene has some TextMeshPro text fields where user can enter information. Users also have the option to select fonts for these text fields.

I want to support a lot of fonts. Right now I add all the font assets in Unity. But these font assets add up to increase the app size a lot.

I am trying to find out if there is a way to download these fonts at runtime as per the user's choice so that the initial app size is small? Is this possible?

I would appreciate any links, tutorials, or help. I've not been able to find any information regarding this so far. Thanks!

sentences: How can I implement dialog trees into my game? What is the best way to implement a dialog tree system in my game? I want an NPC to give the player different sets of responses, some which may only appear when the Player has an item or a previous event has occurred.

sentences:
How to optimize classes I am currently working on a game based on SFML and written in C++. For the HUD of the game I have a HUD class with a lot of different variables and methods. Basically most of the variables have a set and get method. We are talking about 14 variables currently and I am sure this will increase.

Example excerpts:

sf::Text m_AmmoText;
sf::Text m_ScoreText;

sf::Text getAmmoText();
sf::Text getScoreText();

void setAmmoText(sf::String text);
void setScore(sf::String text);

Questions

Optimize context is performance vs. code mantainability

1. Prototyp or Inheritance?

I searched the web and found the prototype pattern or the inheritance of classes as the most useful ones to apply. Since I never use both I am quite unsure which solution will have a positive impact on the code and performance. I am aware that with these few classes the performance impact is hardly measurable. It is more for practice and to get it right from the beginning. I started to re-write the code to apply inheritance but thought it might be better to ask the experts first.

Here is an example of the classes. Implementation of methods accordingly to read or write the variable (skipped here).

class HUD{
    protected:
        sf::Text m_Text;
    public:
        getText();
        setText();
}

class HudAmmo : public Hud {};
class HudScore : public Hud {};

So instead of hud.getAmmoText() I could use hudammo.getText().
I did not code the prototyping yet. But read a lot about its pros and cons on the internet. Suprisingly I could not find a clear direction since most examples I found were abstract. I tend to apply the prototyping pattern from what I understood so far mainly because of this post:

2. Alternative

Re-write the class and have only 1 set and get method which passes the context, e.g. hiscore or other solutions?

sentences:
How should I use Monte Carlo method to simulate some police cars that keep patroling in a tile based map? I have a tile map (isometric) and I have some police cars that they patrol all the time on the map, there is some building and other cars in map too so they are considered as constraints in my shortest path algorithm (below).

I use to randomly select some target for each police car and use A* algorithm to find the path to the randomly selected destination tile and this cycles over and over. because cars should move all the time! (except those that gamer should control)
The problem is police cars routes are correlated and they do not just traverse the area randomly, for instance, they do not usually cover a same area or they do not repeat their own route so my implementation based on some random destination point wasn’t a good idea and the result was not satisfying. Take a look at the following picture, it shows how randomly selecting the destinations worked for me, obviously, it is a dumb patroling for sure, even a cockroache could do better!

Suddenly, I remembered Monte Carlo Method and I thought it would solve my problem, because it exactly does what I wanted to do, However may be I should use Zobrist Hashing since it is tile base in nature. Does anyone has any idea how should I use this kind of methods?
Question in Brief :
How can I use Zobrist Hashing or Monte Carlo method to set destinations points for my patroling car (like police car)?
If anyone knows another way to implement a patrolling method, he/she is very welcome to post an answer, I am not sure if Zobrist Hashing is the best and worth to implement.
---First Edit (added following paragraph) :
I need to distribute the cars and their destination points in a homogeneous manner. Every kind of solution that get me close to a good pattern could be my answer, of course there is a lot of methods to do so, but I dont have any clue.

sentences:
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:
Do I have to re-assign localized text every time the game loads? I am trying to build a localization system for games. And I have stumbled upon a problem where in Unity you basically have to change all the text in Text components / any other references like audio - when loading a game every time.

To better explain it - if the default language is English and user decided to change language to any other. Even if you localize all the files used in the game via code, later on you will have to do it again, when user loads the game after quiting it. Because components don't persist data changed via code in run-time.

How do I make it so that user would be able to change the language once, and all of those references and text... would persist and didn't require re-set up every time the game is loaded? Is that even possible in Unity?

Or should I just localize after the game has been made. And just allow people to download different language versions. But then again, it makes it difficult for people who want to change their language.

sentences:
Boundaries in game development: How do “professionals” do it? How do professionals do boundaries in a 2D game? The way I do is say I don't want the sprite to move into a certain area:

//Example
if ((playerPosX >= 825) && (playerPosX  <= 910)&& (playerPosY >= 170) && (playerPosY <= 255)) {
    //do nothing
}else{
    //move
}

But some games out there have a lot of boundaries so I'm wondering, is there an easier way. I don't think there is any way someone would use the above method throughout a whole game, just to block of movement.

EDIT:
My question is mainly regarding a game where you can walk around, similar to Pokemon or final fantasy

sentences:
How to handle RTS Click-And-Move in 3D Space? How can I handle the click-and-move in a complete 3D space? It is easy to handle on a 2D plane by a simple raycast, but this is not the case in 3D since there is no end-plane for a raycast to get an end-point.

I have two ideas in mind:

Do raycast, then allow player to select distance on the ray by another input (mousewhell, for example).
Instead of complete 3D, have multiple "layers of height", so player can change the height layer before ordering the move.

What are your thoughts?

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:
Background blur in 2D game? In an XNA 2D game, I am thinking about blurring the background slightly to increase the feeling of depth? I am already using parallax scrolling which works pretty well in terms of enhancing depth perception. However, some newer games e.g. Super Mario Bros. 2 on the Nintento 3DS additionally use a blurred background.

Admittedly, this is a pretty extreme example:

SMB2 on 3DS example http://www.zavvi.com/blog/wp-content/uploads/2012/08/MARIO2-580x347.jpg

For me, the blurring visually is not very pleasing but nevertheless somewhat enhances the feeling of depth. I was wondering if there are any studies or personal experiences out there on the subject?

At the moment, the blurring is created by a HLSL pixel-shader (or GLSL though Mojoshader with MonoGame) which is parameterized by the velocity of movement (the faster the more blurred).

sentences:
Blender move single UV point Texturing in Blender and when I am moving UVs around in the UV/Image Editor I'm finding that I can't move a single UV point without moving all other UVs that are connected to the vertex.

This seems odd to me as the UV unwrap should be completely distinct from the mesh. Is there some odd setting that I don't realise I have turned on?

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:
Making an object hang This image is pretty self explanatory I hope:

How can I achieve this effect without animating it? I want to avoid animations as there are many objects hanging and I dont want them to move the exact same way.

sentences:
Are there technical reasons to use short variable names in shader code? I have been reading and writing both GLSL and CG for the past few years, and have noticed a trend. In programming, we are generally advised to be as meaningful and concise as possible with variable names, but I see this suggestion being ignored almost every time I look at shaders.

Here is a random example I grabbed off of Shadertoy:

vec3 tex_wmcs(vec2 p)
{
    float s=mix(0.2,1.2,sqrt(smoothNoise2(p*3.0)));
    vec3 col=mix(vec3(0.15,0.2,0.2)*0.4,vec3(0.2,0.15,0.11)*0.7*s,sqrt(max(0.0,sm...
    vec2 p2=p*vec2(4.0,10.0)+vec2(smoothNoise2(p*24.0),smoothNoise2...
    p2.x+=floor(p2.y)*0.5;
    float bh=pow(0.5+0.5*cos(floor(p2.y)*14.0)*cos(floor(p2.x)*1.0),2.0);
    float brick=brickt(p2);
    vec3 bn=normalize(vec3(brickt(p2+vec2(1e-3,0.0))-brick,b...
    ...
}

Is there a practical reason so many graphics programmers minify their code to such a point?

Is there a technical downside to spelling out brickNormal instead of leaving it as bn, or using brick_tangent or brickTexture instead of brickt?

sentences:
Is an in-app purchase required to unlock game in order to bypass pirating acceptable? I'm considering writing a mobile game and looking at distribution.  The game will have a server requirement, which means I will have to pay for bandwidth, hosting, processor time, etc.  Because of that I'll need to make at least a little money off this thing.  According to the press piracy is rampant in the android community.  To get around this, I'm thinking of implementing a simple model where the game is free, perhaps allowing play for X number of turns or something, and then requiring an in-app purchase to continue to play.  I would clearly explain this in the app description, and the in-app purchase would be managed per account so it would be linked to your google play account so you wouldn't have to re-purchase every time you get a new device.

Would gamers accept this model or see it as unreasonable?

sentences:
How do I properly light characters in a Unity scene? I made a game prototype and want to improve some of rendering the visuals through light baking (which I'm new to). While I was mostly able to do this in my environiments, I'm having issues doing this for my characters in Unity. Previously, they came out with odd-ish dark shadows in places as they were affected by light and dull colors. After I begin light baking though and adding Light probes in areas that my characters would be extremely light, especailly on the skin areas. It doesn't look good at all.

Alternatively, without using light probes, it looks like this.

I'm genuinely confused on how to properly light these characters if I can't get a middle ground of proper lighting. Can anyone help me try to understand this and solve this problem?

sentences:
How to playlay multiple Particle Systems when colliding with multiple obstacles using object pooling? I have two types of particle, one for each player:

Player 1 (Red Particle)
Player 2 (Blue Particle)

When player 1 collides with an obstacle then I want to play the red particle system, and when player 2 collides with an obstacle then I want to play the blue particle system.

Code:

TouchControll.cs

 public GameObject PlayersPartical;

  void OnTriggerEnter2D(Collider2D other)  //here my player collided with obstacle
    {
        foreach (Transform child in transform)
        {
            if (child.tag == "point")
            {

                //GameObject partical = Instantiate(twopartical[Random.Range(0,1)], transform.position, transform.rotation);
                //ParticleSystem heal = partical.GetComponent<ParticleSystem>();
                //heal.Play();
                GameObject partical = Instantiate(PlayersPartical, transform.position, transform.rotation);
                ParticleSystem heal = partical.GetComponent<ParticleSystem>();
                heal.Play();

                ObjectPooler.Instance.SpawnFromPool("redandbluepartical", transform.position, Quaternion.identity);
            }
        }
     }

ObjectPooler.cs

    public static ObjectPooler Instance;

    public void Awake()
    {
        Instance = this;
    }

    [System.Serializable]
    public class Pool
    {
        public string tag;
        public GameObject prefab1;
        public GameObject prefab2;
        public int size;
    }

    public List<Pool> pools;

    public Dictionary<string, Queue<GameObject>> pooldictionary;//which gameobject you should be pool

    void Start () {

        pooldictionary = new Dictionary<string, Queue<GameObject>>();

        foreach(Pool pool in pools) //add a pool in list
        {
            Queue<GameObject> objectpool = new Queue<GameObject>();

            for(int i=0;i<pool.size;i++)
            {
                GameObject obj =  Instantiate(pool.prefab1);
                GameObject obj1 = Instantiate(pool.prefab2);
                obj.SetActive(false);
                obj1.SetActive(false);

                //objectpool.Enqueue(obj);
            }

            pooldictionary.Add(pool.tag, objectpool);
        }
    }

   public GameObject SpawnFromPool(string tag,Vector3 position,Quaternion rotation)  //two tag red and blue partical
    {
        if(!pooldictionary.ContainsKey(tag))
        {
            Debug.Log("doesnot exist" + tag);
            return null;
        }

        GameObject objecttospawn =  pooldictionary[tag].Dequeue();

        //here how to call my trigger

        objecttospawn.SetActive(true);
        objecttospawn.transform.position = position; //pos
        objecttospawn.transform.rotation = rotation; //rotation

        pooldictionary[tag].Enqueue(objecttospawn);
        return objecttospawn;
    }

Image1:

Image2:

How do I call these particles?

sentences:
How can I generate isometric sprite sheets from 3D animations? I want to generate sprite-sheets for an isometric projection of various 3d assets purchased from the Unity3D asset store. I'd preferably also render the normal maps. I am a programmer, but new to 3D modeling software (Blender, etc.)

I found two tools for this; SpriteForge and SpriteWorks, but neither supports enough formats to be worth their cost.

There must be an efficient way of isometrically rendering various animations of a 3d assets in Blender—but I don't know how. How can I do this?

sentences:
Problem with shooting. Projectile is missing target from about 5 degrees to about 30 degrees I'm trying to make projectile shooting code. But there is a problem, in most cases projectile is missing target.

-sprite is origin of projectile
-bulletSprite is a projectile
-mouse is a target

float moveX, moveY;

void getTarget(){

float directionX = sf::Mouse::getPosition().x - sprite.getPosition().x;
float directionY = sf::Mouse::getPosition().y - sprite.getPosition().y;

float magnitude = sqrt((directionX*directionX) + (directionY*directionY));

moveX = directionX / magnitude;
moveY = directionY / magnitude;

bulletSprite.setPosition(sprite.getPosition());}

void fire(){
bulletSprite.move(sf::Vector2f(moveX, moveY));}

Looks like changing float to long double helps a bit.
Gif with this problem - https://drive.google.com/file/d/0BxPqUosXueuNY2FjcmluWlBZWW8/view?usp=sharing

sentences:
InvalidCastException in Farseer's raycasting when trying to use the built-in explosion class? I'm trying to create an explosion at the point that two entities collide, but whenever explosion.Activate() is called, it causes an InvalidCastException to be thrown in Raycast(), on the line that returns the callback.

return callback(fixture, point, output.Normal, fraction);

Is this a bug in Farseer, or am I doing something wrong? It doesn't appear to be a known issue.

sentences:
Where to put the screen dimensions to make it accessible for all on screen objects? I'm starting game development to learn a new language (SDL2, C++) and would like some opinions on the best way to handle a probably very basic problem.

I don't want my player to go off screen, so I have something like this now:

void Player::sanitizePosition() {
    if ( m_xpos < 0 ) {
        m_xpos = 0;
    }

    if ( m_ypos - m_height < 0 ) {
        m_ypos = m_height;
    }

    ...
}

For the other two sides I would need the screen dimensions. Now I'm wondering what the best way to give them to the object would be?

Global variables are bad, but a Singleton with the screen information seems like the same thing to me.

Another idea would be to have a GameObject base class, that has the screen dimensions as static members, which Player would inherit from.

Of course I could put them into the constructor of every game object, but that just screams code smell.

This is such a basic problem, I'm sure there is a consensus on how to do it.

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: Plot HDR tonemap curves I am using a tonemapper in our project and a friend of mine asked if I could provide him with a plot of the tonemapper used (different functions are implemented). I tried in MATLAB to copy the tone-mapper function and use luma values from -5 to 5.0 to feed to the function, but the resulting plot is nothing like a classic tonemap function plot as I happen to see around. The function is totally correct, but am I missing something stupid that must be taken into account when trying to plot them?

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:
How to make a cartoon like trail particle system? I'm currently working on an little Android game, it's a reaction casual game. Because the user needs to tap some balls flying around at the right moment, I want to add some new effects to them.

So I looked at some other games and found this cool looking cartoon like effect.

As you can see the ball there has an cool tail.

So my question is, does anyone know how to recreate such a trail with the Unity particle effects or some other tools?

sentences:
How do I add a third axis of movement for my character to go up and down? My movement system at the moment is based off of a tutorial I followed. The tutorial is about moving with spherical gravity. I want to add another axis of movement so my character can fly up and down with jet propulsion, but I cant get it to work, here is a couple parts of the tutorial code below:
void Update()
    {
        Vector2 playerInput;
        playerInput.x = Input.GetAxis("Horizontal");
        playerInput.y = Input.GetAxis("Vertical");
        playerInput = Vector2.ClampMagnitude(playerInput, 1f);

        if (playerInputSpace)
        {
            rightAxis = ProjectDirectionOnPlane(playerInputSpace.right, upAxis);
            forwardAxis =
                ProjectDirectionOnPlane(playerInputSpace.forward, upAxis);
        }
        else
        {
            rightAxis = ProjectDirectionOnPlane(Vector3.right, upAxis);
            forwardAxis = ProjectDirectionOnPlane(Vector3.forward, upAxis);
        }
        desiredVelocity =
            new Vector3(playerInput.x, 0f, playerInput.y) * maxSpeed;

        desiredJump |= Input.GetButtonDown("Jump");

        transform.rotation = Quaternion.LookRotation(forwardAxis, upAxis);

    }

...

void AdjustVelocity()
    {
        Vector3 xAxis = ProjectDirectionOnPlane(rightAxis, contactNormal);
        Vector3 zAxis = ProjectDirectionOnPlane(forwardAxis, contactNormal);

        float currentX = Vector3.Dot(velocity, xAxis);
        float currentZ = Vector3.Dot(velocity, zAxis);

        float acceleration = OnGround ? maxAcceleration : maxAirAcceleration;
        float maxSpeedChange = acceleration * Time.deltaTime;

        float newX =
            Mathf.MoveTowards(currentX, desiredVelocity.x, maxSpeedChange);
        float newZ =
            Mathf.MoveTowards(currentZ, desiredVelocity.z, maxSpeedChange);

        velocity += xAxis * (newX - currentX) + zAxis * (newZ - currentZ);
    }

How can I add another axis? I already have a third axis control for the trigger buttons set up in the input project settings, but I just cant find a way to fit a rising and falling axis in here. Help would be much appreciated

sentences:
Why do companies still use really old versions of Visual Studio? I understand why C++ is used. That is not what this question is about.

When I install games, commonly Steam (I pretty much only use Steam these days) will install the C++ 2005 Runtime distributable.

My question is why is this the case? What is the reason a runtime released over 8 years ago is still prevalent? Some of the games I've installed recently are slightly older, so assuming a couple of years dev time you could make the case it was the tried and tested standard at the time.

Why do game companies not use a newer version of the VC++ runtime?

sentences:
How can I get into opensource game development? The short and sweet question

I'm new to game programming in general, so how do I go about making GOOD QUALITY opensource games?

What I have come across

There are a multitude of games that I have played on Linux that are just downright shameful. The graphics are terrible, the AI is lacking, and the replayability is little to none. Don't get me wrong; I have played some good opensource games such as World of Goo, Gish, and Aquaria; but I'm really missing out on good games over here in my Linux hut.

What I have found

So, I did a little research on how the games mentioned were made. Thus, I have started learning OpenGL and SDL using my C++ programming experience (which is about a year of programming, not much). I also picked up the following books, which were recommended from programmers on stack overflow:

Focus on SDL (The only let me post one link for now...)
The OpenGL Super bible
GEB and CODE

What I have been recommended

I have also talked to someone who is a fairly experienced programmer who recommends that I take the C++ route to gaming, and that OpenGL and SDL would be a good way to go. He also recommended that I start using versioning control with my programs (Git particularly). What are your opinions on that?

Hope that was clear, guys.
Let me know,
Immanu'el

sentences:
What is the difference between Constant Vertex Attributes and Uniforms? According to the OpenGL ES 2.0 Programming Guide:

A constant vertex attribute is the same for all vertices of a primitive, and
therefore only one value needs to be specified for all the vertices of a
primitive.

For uniforms the book states:

...any parameter to a shader that is constant across either all vertices or
fragments (but that is not known at compile time) should be passed in as
a uniform.

I've always used uniforms for data that is constant for a primitive but now it appears that attributes can also be used in the same way. Is there more to constant vertex attribute than simply 'they are the same as uniforms'?

sentences:
WebGL .NETCoreApp 1.1 - UnityLoader.js - SyntaxError: expected expression, got end of script After creating a release build of my game using Unity 5.6, I could navigate to the created folder and open the 'index.html' file and my game would load and play normally.
However, when trying to integrate it into my WebApp (.NETCore 1.1), I would continually get this error in Chrome, Firefox, IE, etc..:

UnityLoader.js - SyntaxError: expected expression, got end of script

Invoking error handler due to
TypeError: UnityLoader[r] is not a function

sentences:
Can I my iOS-based editor save .plist files that my Mac game can read? I want to make an editor on iOS which will record touch positions into a file. That file (in the .plist format) will eventually be used for positions in my Mac connect-the-dots game.

Can I save one .plist file to my Mac from an iOS app?

sentences:
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:
Strange artifacts in Unity Lightmaps I experienced this weird lightmapping bug in my game that causes some models to have glowing artifacts on their surface. These artifacts "move" around, when I edit the UVs of the model in Blender, so I assume that it has something to do with them. I took a few screenshots to hopefully clarify the issue.

Engine used: Unity 2019.1.4f1
3D Software: Blender 2.79b

If you need any other screenshots or something, let me know. Thank you in advance!

Lightmap Bug (lights off):

Lightmap Bug (lights on):

Models without Lightmaps baked:

Unity Lightmapper Settings:

Tree model in Blender with UVs:

Model Configuration in Hierarchy:

Model Asset Configuration:

sentences:
differing methods of Instantiating GameObjects in Unity (what is the difference?) I have been using Unity a while and always Instantiated objects slightly differently from what many of the tutorials and posts online say (I've seen 3 very similar ways). It seems to have the same outcome much of the time, however now I am trying to instantiate the prefab using my "Resources" folder instead of dragging it from the inspector and on one method it said it was an 'object' not 'gameobject'.
I can't really find anything on Unity website or here, so what is the difference between the following:

 // These two lines to me seem identical, but most tutorials dont cast, and rather use the latter of the two instead, why?
 currentBall = (GameObject)Instantiate(Resources.Load(prefabName, typeof(GameObject)));
 currentBall = Instantiate(Resources.Load(prefabName, typeof(GameObject))) as GameObject;

  // This one I know is different somehow, because Unity said cannot convert from Object to GameObject, but honestly i do not understand why
  currentBall = GameObject.Instantiate(Resources.Load(prefabName, typeof(GameObject)));

sentences:
Does using an licensed game engine prevent you from open sourcing a defunct work? I'm curious as my previous company is asking us (people who developed the game) on what to do to the game since it's no longer financially viable.

My suggestion was to open source it so people can still enjoy the game at the same time it could at least be improved.

But we did use a licensed Torque engine which was mostly recoded/reworked. Not sure if their license allows for the move though.

(Also not sure if this is an appropriate question to ask here)

sentences:
Raycast Movement on a sphere so I'm working on a mobile game where I have touch input from a Asset from the asset store. It all works perfectly fine, except for one thing:
I want to implement a "drag and drop" feature so when I pick up an Item it should follow to the position of my finger. But because the playground is a sphere, I have to do the movement with a Raycast. So my plan is that the item should follow the Raycasts position. My current attempt looks like this:

public void DragTo(float screenX, float screenY)
{
    if (draggingObject == null)
    {
        return;
    }

    Debug.Log("Dragging");

    //Converts the screen space to world space
    Vector3 mousePosFar = new Vector3(screenX, screenY,      Camera.main.farClipPlane);
    Vector3 mousePosNear = new Vector3(screenX, screenY, Camera.main.nearClipPlane);

    Vector3 mousePosF = mainCam.ScreenToWorldPoint(mousePosFar);
    Vector3 mousePosN = mainCam.ScreenToWorldPoint(mousePosNear);

    //shoots an ray to the world space
    RaycastHit hit;

    if (Physics.Raycast(mousePosN, mousePosF - mousePosN, out hit))
    {
        float step = speed * Time.deltaTime;
        draggingObject.GetComponent<Rigidbody>().MovePosition(hit.point);
    }
}

I already have tried the following options:

draggingObject.GetComponent<Rigidbody>().MovePosition(hit.point);
draggingObject.GetComponent<Rigidbody>().MovePosition(hit.normal);
draggingObject.transform.position = hit.point;
draggingObject.transform.position = normal;

They all work, but they all have really buggy and strange behaviors.
Also when I dont freeze the z. axis on the Rigidbody the item just "flies" up on the z axis, until it reaches the camera. Then it teleportes again down and it all starts again. So its flying up on the ray.
So if you have any Ideas why this happens let me know.
Any help is appreciated.
(Also dont forget that its all happens on a sphere)

UPDATE:
It works now. When the dragging began i changed the layer from the object to "Ignore Raycast" and when it end changed it back to "Default".

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:
Libgdx clicklistener of Image Actor not recognising click So I am attempting to make a an image of a closed door for a ship. On clicking this door, it would then change to an open door. However, I am struggling to get the click listener to work for the Image. Weirdly, if i use a textbutton instead it works, with pretty much the same code. Below is the class in which a stage is created and the Image actor added to it.

    public class battleScreenActorOverlay implements Disposable {

public battleScreenActorOverlay(World world, SpriteBatch sb, battleShipScreen syst, float bottomButsH, float viewportWidth, float viewportHeight, List<Float> testDoor) {

    viewport = new ExtendViewport(viewportWidth,viewportHeight, new OrthographicCamera());
    stage = new Stage(viewport, sb);
    Gdx.input.setInputProcessor(stage);
    shipObjsAt = new TextureAtlas("batScreen/objects/shipObjects.atlas");
    Skin skin2 = new Skin(shipObjsAt);

    Image img = new Image(skin2.getDrawable("doorV"));
    img.setTouchable(Touchable.enabled);
    img.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            System.out.println("clicked");
        }
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("touch down");
            return true;
        }
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("touch up");
        }
    });

    // set Image position and dimensions, then boundaries
    img.setPosition(testDoor.get(2),testDoor.get(3));
    img.setSize(testDoor.get(1)*6, testDoor.get(0)*6);
    System.out.println("gabriel "+img.getX()+" "+img.getY()+" "+img.getWidth()+" "+img.getHeight());
    img.setBounds(img.getX(),img.getY(),img.getWidth(),img.getHeight());

    // add to stage which is then rendered in main class
    stage.addActor(img);
    stage.act();
}

Then the main class basically does some stuff like this:

public class battleShipScreen implements Screen {

// a load of variable declarations here

public battleShipScreen(MyGdxGame game){

    // create viewport etc

    genShip();

}

public void genShip(){
    // basically method for setting door positions
    batScreenActs = new battleScreenActorOverlay(world,game.batch,this,margin,gameport.getWorldWidth(),gameport.getWorldHeight(),testDoor); // calls class which creates stage and adds door

}

@Override
public void show() {

}

public void update(float dt){
    world.step(1/60f,6,2);
    handleInput(dt);
    gamecam.update();
    renderer.setView(gamecam);

}

public void handleInput(float dt) {
 // classic handle input
}

@Override
public void render(float delta) {

    update(delta);
    Gdx.gl.glClearColor((float) 60/255, (float) 181/255, (float) 0/255, (float) 0);    // clears screen
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);                       // clears screen
    // render game map
    renderer.render();
    game.batch.setProjectionMatrix(gamecam.combined);

    game.batch.setProjectionMatrix(batScreenHUD.stage.getCamera().combined);

   game.batch.setProjectionMatrix(batScreenActs.stage.getCamera().combined);
    batScreenActs.stage.act(Gdx.graphics.getDeltaTime());
    batScreenActs.stage.draw();
}

@Override
public void resize(int width, int height) {
    System.out.println("resizing "+height+" by "+width);
    gameport.update(width,height);
    gamecam.update();
}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {

}

Sorry for the long post, but I have been trying to sort this out for a few days now and have literally no idea what i am doing wrong. Any help working out how to make an Image actor click listener work would be much appreciated!

sentences:
How to toggle fullscreen with lwjgl I'm using glfw in lwjgl-3 to try to create a toggleFullscreen method. However it always gives me errors. I saw this question Toggle Fullscreen at Runtime but it didn't help because glfwOpenWindow() and glfwCloseWindow() don't exist for me. I guess lwjgl uses a differnt version of glfw? Does anyone know of a good solution for toggling fullscreen? thanks. this is my current code if it helps.

    public void toggleFullscreen(){
        long newWindow;
        fullscreen = !fullscreen;
        if(fullscreen){
            newWindow = glfwCreateWindow(windowWidth, windowHeight, "Title", glfwGetPrimaryMonitor(), window.getWindowHandle());
            glfwMakeContextCurrent( newWindow );
        }else{
            newWindow = glfwCreateWindow(windowWidth, windowHeight, "Title", NULL, windowHandle());
            glfwMakeContextCurrent( newWindow );
        }
        glfwDestroyWindow(window.getWindowHandle());
        windowHandle = newWindow;

        glfwMakeContextCurrent(windowHandle);
        glfwSwapInterval(1);
        glfwShowWindow(windowHandle);
        GLContext.createFromCurrent();

        GL11.glEnable(GL11.GL_TEXTURE_2D);
        glClearColor(0.0f, 1.0f, 0.0f, 0.0f);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glViewport(0,0,windowWidth,windowHeight);
        GL11.glOrtho(0, windowWidth, windowHeight, 0, 1, -1);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        game.initInputPolling();
    }

sentences:
Why is the depth test not done on geometry before rasterization? It seems the only time depth is used to discard data is during rasterization, i.e. at the fragment level.

In the geometry stage, I've only see culling and clipping of vertices. Is it not possible to determine whether if a triangle is behind another triangle using just vertex data (depth?) and discard if so? Wouldn't this save all the work later in scan conversion?

sentences:
Problem in if statement comparing GameObject name I am trying to get the name of the game object. for that i used

    Debug.Log (gameObject.transform.ToString());

in start. My gameObject name is "PowerupItem_0" and "PowerupItem_1". in console it displayed the gameObject name correctly. then i tried to execute the statement. so i used

    if (gameObject.transform.ToString () == "PowerupItem_0") {
        Debug.Log ("PI_0");
    } else if (gameObject.transform.ToString () == "PowerupItem_1") {
        Debug.Log ("PI_1");
    } else
        Debug.Log ("Oth");

for this coding in console it displayed a message as "oth". i am not understanding why its not printing "PI_0" and  "PI_1". anybody please help

sentences:
Why am I unable to edit the Input Field object's script? When attempting to edit an Input Field object's script like so

I get the following error:

  Unable to open C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll: Check external application preferences.

Why is Unity attempting to open a *.dll, here?

sentences:
My Raycast2D doesn't go where I want and it doesn't return a GameObject I want my Objects to teleport when they hit a wall. For that, I want to shoot a Ray backwards and teleport it to where the ray hits the wall, but whatever I try, it always teleports to the centre of the scene and the ray hit doesn't return a GameObject. This version I tried runs on OnTriggerEnter2D:
RaycastHit2D hit = Physics2D.Raycast(transform.position, -transform.up, 300);
Debug.DrawLine(transform.position, hit.point);
transform.position = hit.point;

I tried some other variations too. If you have any idea, please let me know.

sentences:
Is there a good way to get pixel-perfect collision detection in XNA? Is there a well-known way (or perhaps reusable bit of code) for pixel-perfect collision detection in XNA?

I assume this would also use polygons (boxes/triangles/circles) for a first-pass, quick-test for collisions, and if that test indicated a collision, it would then search for a per-pixel collision.

This can be complicated, because we have to account for scale, rotation, and transparency.

WARNING: If you're using the sample code from the link from the answer below, be aware that the scaling of the matrix is commented out for good reason. You don't need to uncomment it out to get scaling to work.

sentences:
How to set widget size that is independent of screen resolution/density in kivy I had coded a simple click game with Python-kivy to android.

You should click dots which are popping out randomly at screen. I set their size 20px to 60px as your level. But it seems when I try on different device screen resolution change the hardness of game. low resolution phones have higher change. I also look at some game (2048 - piano tiles etc) they are also have the same problem.

Should I keep ignore the resolution or try to solve this problem? If so how?

sentences:
Send request for Turned Based Battle I want to create a turn based battle system for Pokemon online rpg!

I will some how implement the coding of the battle..but I want to know how can a user send request for a battle to other user?

If a user wants to have a live battle with some other user, he will send a battle request!
If the opponent wants to battle he will accept it otherwise it will be rejected and no battle will take place...!

How can I implement the above??

sentences:
Typical Maximum steering angle of a real car I'm building a car sim in Unity3D. I'm trying to set the properties of the car to be as realistic as possible. I can't seem to get a straight answer on Google so I thought of asking here.

What is the typical maximum steering angle of a normal passenger car ?

sentences:
How do you find games with a similar idea? I'm thinking about making an indie game and want to know if there's maybe one with similar idea.

I'm not asking about my idea specifically, I just want to know how to find out if a game has the same idea as the one I want to implement.

sentences:
What are the steps to get sound from reality into a game? As we all know, the game is not only about gameplay, sound effects add a lot to the production value. The more unique, the better the result.

What are the steps to get a decent quality sound from reality into a game environment?

And some tips probably, as whether I should cover multiple cases of the "sound": normal, echo and other. Or this can/should be done within the engine itself, or post-processed after normal sound?

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:
2D vector to Quaternion I have a 2D vector (with only X and Y), and my engine only supports orientation through Quaternions.

How do I translate a 2D vector to a quaternion?

The X and Y represent the direction (so X = 0 and Y=1 means going forward, X=0.707 and Y=0.707 means rotate 45 degree, etc).

sentences:
Finite-state machine with more than one concurrent state I am using a FSM for the player entity and it is working fine. Currently the entity has one state and only one (e.g. paralyzed). The entity's state process() method is called every turn.

It is necessary however, that each entity can have more than one state simultaneously (e.g. paralyzed and blinded). Each state affects the entity attributes e.g. paralyzed reduces the walking range to 10% and blindness reduces it to 50%. Vision range is not affected by paralyzed state, but by blindness (set to 0).

Now it is important in which order the states are processed. I either end up with a wrong walking range or a wrong vision range. I could do checks in every state's process() whether the entity has any other states and alter the code accordingly, but this gets very messy the more states I add.

Currently I think it's a better choice to attach only one state to the entity, but to create more states, some of them a combination of two states (e.g. a blindedAndParalyzed). This way I'll and up with a lot more states than I currently calculated with, because ever state has to be combined with other states. I'm wondering if that is the best solution?

A state is a Singleton with an enter, process and exit method. Process is called each turn.
Currently process() for paralyzed looks like this:

public void process(){
   walkRange = 10% * walkRangeBase;
   visionRange = visionRangeBase;
}

and process() for blinded looks like this

public void process(){
   walkRange = 50% * walkRangeBase;
   visionRange = 0;
}

At the moment the result is always fine becvause only the process() method of only one state is executed. If I switch to multiple states both get executed and the result is either walkRange = 50% and visionRange = 0 or walkRange = 10%. THe desired result would be a walkRange of 10% and a visionRange of 0, because the walkRange should be limited to the smallest one.
I could do something like that:

public void process(){
   if(state != paralyzed)
      walkRange = 50% * walkRangeBase;
   visionRange = 0;
}

But i have around 20 different states, so I have to create a lot of if cases. Choosing the smallest value for e.g. walkRange doesn't work either because there are some states with positive effect on walkRange.
So I am wondering if it is better to avoid a state machine with more than one concurrent state and live with a bigger amount of states (about 50), or if there si another solution to this problem.

sentences:
Unity - Load Lightmaps at Runtime I'm a bit of a novice to lighting, but I think what I want to do is possible, so please bear with me.

Due to the nature of my game, I've taken an approach where a singular scene game is where all of the gameplay occurs.

For each level, I'm arranging all the GameObjects and Terrain in a secondary scene (named testbed) to my liking. Once I've got it to my liking, I save that to a prefab, which in turn is saved to an AssetBundle. I also generate the lighting at this point, which I can see appear in my project under a Assets/Scenes/testbed/ folder.

At runtime, a script in the game scene reads the appropriate AssetBundle, and then loads & positions all of my objects and characters. Everything about this works, except for updating the lighting.

My approach is to store references to the lighting textures that have been output into the aforementioned testbed folder via a ScriptableObject (after trying and failing to use the LightingData object that appearred in this same folder):

Then, when I'm loading my level up into the game scene, this block is executed:

    public void LoadLighting(LevelKey key)
    {
        var data = levelMap.metaData.Find(it => it.key == key);
        var directions = data.lightData.directions;
        var lights = data.lightData.lights;

        var lightmaps = new LightmapData[directions.Length];
        for (int i = 0; i < directions.Length && i < lights.Length; i++)
        {
            var lightmapData = new LightmapData();
            lightmapData.lightmapDir = directions[i];
            lightmapData.lightmapColor = lights[i];

            lightmaps[i] = lightmapData;
        }

        LightmapSettings.lightmaps = lightmaps;
    }

Based on a lot of searching, this should cause something to happen, but I can't detect any change in the scene.

Does what I'm trying make any sense? Should I just scrap this and make dozens of different scenes (which I'm trying to avoid) instead? Really any advice here is appreciated.

sentences:
What's an acceptable delay between a player's action and the effects of the action being visible? So, I'm creating a game where all the systems push events onto the event queue. Those events are then dispatched at the start of the next frame. This works fine, but there are some situations where the delay between a player's action and the effects of the actions can be upto 3 frames.

3 frames for a 60fps is around 50ms. Is this kind of "lag" noticeable to a player?

sentences:
Trivial and efficient sprite animation in Unity I'm looking for an efficient way to create and use simple sprite animations in Unity.

My situation is the following: I have lots of entities (thousands) which need to be animated. These entities have the same (identical) animation running, which involves just sprite swapping. The animation loops endlessly. The following gif represents an example of what I need. In this example, a single animated object is placed on each tile.

Because of the number of objects, I would prefer to not have an animator-animation combo on each, and I would prefer not to have a MonoBehaviour on each. The overhead from both of these solutions will be way more than the game could handle. The required effect requires just a looping sprite-swapping animation, which can simultaneously run on thousands of objects. The gif above was made with animator-animation combos on each object.

The features offered by Unity's Animator component are great, however way beyond what I need here and thus the overhead is not worth it.

Optimisations I am aware of:

Disabling animators when zoomed out.
Disabling animators on objects which are out of view.
Merging multiple objects into a single one which spans multiple tiles (does not apply due to nature of game)
Writing my own sprite swapping animation component (not inherited from MonoBehaviour, similar in idea to this code), placing it on each item. Then creating an AnimationController object (inherited from MonoBehaviour), which updates all instances of my sprite swapping component at regular intervals. This is the solution I will likely go for if nothing else comes up, however involves hand-crafting animations, delays between sprites and such, which will be time consuming.

I feel as though others have surely come across this problem before, so I'm wondering how you solved it. Please also let me know if using Unity's built-in animator-animation system is in fact less resource intensive in this situation than I think.

Thank you!

sentences:
Help me to understand Geometry Clipmaps Ok, so It's a mesh of frames (high to low density) around the camera that adjusts the vertices Z by height-map values. But what happens, how does it work outside those frames? Its like the coarsest grid that somehave blends with the most outside clipmap (green in pic) frame? Or anything outside it, is not culled?

Edit: also how do collisions with terrain work, if the height values are calculated in vertex Shader?

sentences:
Play animation state's clip from particular time or fram I have a controller where i have a animation state. I want to play that animation clip from specified frame to specifed end frame. is this possible?

here is the snap shot of the controller

currently i am simply switching tow application using bool. I want to transition to paritcualr state but want to play its particular frame or time duration as a clip.

public Animator talkingAvatarAnimator;
    public bool isPlayHandGesture;

    void Update () {
        talkingAvatarAnimator.SetBool("isPlayHandGesture", isPlayHandGesture);

    }

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:
How do I contiguously store and iterate over ECS components in C++? I'm writing an entity component system and want to store each type of component separately and contiguously in memory in a way that's easy to iterate over.
Component is a simple base class from which like classes like MoveComponent derive.
I store components inside the World class:
struct World {
    ...
    std::vector<Component> components;
};

This would work fine if there was only one type of component, just a Component class. The problem is I don't know how to handle component subclasses. For example every MoveComponent should be stored contiguously in memory in a way that I can easily iterate over and process them.
I want to avoid this kind of copy-paste junk code for hopefully obvious reasons:
struct World {
    ...
    std::vector<MoveComponent> move_components;
    std::vector<PhysicsComponent> physics_components;
    etc.
};

I'd like to instead structure it in a way that permits iterating over each component of a certain type in a World like, for example, this (inspired by Overwatch's entity component system video, see here):
for (MoveComponent *mc : ComponentIterator<MoveComponent>(world)) { ... }

I'm at a loss as to how to implement this.

sentences:
How to scale an object in one direction without moving the opposite edge? I am using Unity. In my game, I have an SpriteRenderer and I'd like it to increase its size

I'd like it to lengthen to the right, without moving the left edge.

I tried changing its scale to something bigger than its original scale and it changes into something like this, growing to both the left and the right:

I also tried to increase its position together with its scale but then it didn't work.

  Editor's note: this is where you tell us how it "didn't work". What exactly did you try, what results did you get, and how did those results differ from what you wanted?

My Object is configured like this in UnityEngine:

sentences: How do I manually create a .atlas file? I am trying to learn Andengine, and it seems it does not support sprites in any other way other thab a Texture Atlas. I am using the Android AIDE app and importing the older Andengine .JAR because I dont have a laptop and dont plan on forking up $250-400 for one when I can get a quad core android for $100 flat. I want to make a simple .ATLAS file but dont know how. Does anyone else here know how to solve my problem?

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: Engine Start and Stop Show Abnormal Behaviour In my game, when I pause the game using mEngine.stop() it works perfectly but when I press resume button that has code mEngine.start() it provide some movement to the physics body. So the created body does not stand at its desire position after the resuming the game. That fault I have found in other game developed by other developer also. So please provide some guidance for it. I also tried with mScene.onUpdate(0) and mScene.onUpdate(1) but I does not able to found anything new from it.

sentences:
Procedural Breakout level generation I am currently developing a Breakout game for a school project, and I've decided to use it as an opportunity to get started with procedural content generation. I took a quick look at some of the basic procedural stuff, but I wanted to know if there is a known good method to generate levels for this kind of game (block patterns, "power up" distribution, etc).
Any articles or ideas are greatly appreciated.

sentences:
Pluggable modifiers to game engine I'm currently working on a clone of an old turn-based strategy game "Stars!" and am looking for solutions to a challenge in game engine implementation.

The premise

The premise of the game is that every player takes control over the entire race of his denizens (called "colonists") and fight other players to conquer the known part of the galaxy.
Each player can design their race as they please. The first choices presented when creating a race are those of the Primary Racial Trait (PRT - must select exactly one from a list of 10) and Lesser Racial Traits (LRT - can select any number of them from a list of 14). A PRT usually modifies several aspects of the base game, e.g. sets starting technology level, gives some starting spaceships, controls the availability of certain ship parts and modifies the rules of the game for that player while LRTs provide minor advantages/disadvantages.

A few examples to show the extent of game modifications as well as interactions between them:

PRTs can modify the same part of the rules from two directions: Inner Strength PRT - 10% increased strength of defending colonists; War Monger PRT - 10% increased strength of attacking colonists.
PRT and LRT can directly modify the same "property" of a race: Jack Of All Trades PRT - +20% maximum planet population; Only Basic Remote Mining LRT - +10% maximum planet population; they cumulate multiplicatively (+32%).
LRTs can work conditionally based on other LRTs: Improved Fuel Efficiency grants access to several unique types of engine, where one of them is granted only if another LRT No Ram-Scoop Engines is not chosen.
PRT can fundamentally modify the game mechanics: Alternate Reality PRT races do not live on planets but rather in orbiting starbases. Rules of economy (resource production) are completely different for them as they do not build planetary facilities (factories and mines).

Constraints - the challenge

Make it possible to design new PRTs and LRTs and put them in the game without much pain.
(Induced from previous) They must be in some way decoupled from the main engine (so the core "rules engine" cannot be based on if/switch statements that change flow based on PRT/LRT).

The question

What design patterns would be suitable to this problem of "pluggable modifiers"?

The language is C#, if that helps with suggesting more specific solutions. So far my brain is wandering in the realm of attaching the Traits to events in the engine where it calculates certain properties (so they could modify the output of these calculations), but I don't want to suggest too much.

sentences:
Ray-Triangle Intersection: does the direction of the triangle normal matter? Found an article here about ray triangle intersection: https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/ray-triangle-intersection-geometric-solution
It states that D of plane Ax+By+Cz+D = 0 can be found as triangleNormal.Dot(triangleVertex).
But depending on the sign of the normal, D would have a different value. Doesn't that make a difference as to which side of the origin the plane lays? Doesn't the normal of the triangle always need to face the origin for this equation to be correct?

sentences:
What available multiplatform languages are there available for 2D games I was wondering what multi-platform languages are available that could be used to create and deploy 2D games, please note that im not asking which is the best as I do not want to cause arguments over which people believe to be the best.

Ideally I would like to be able to deploy to as many different platforms as I can (PC, Mac, iPhone, Android, etc..)

I do apologies if this has been bought up, but I could not find anything from the searches that I tried.

sentences: Making a Video Splash Screen for an Android Based Game I'm planning to make a video-based splash screen for the simple game app for Android under client's cigarette brand project. I was thinking if can this video file type, AVI, run on Android or not? Please suggest me.

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:
glViewport like camera I'm using glViewport as a camera of sorts, but I'm not quite sure how it works. For example when I change do:

glOrtho(0, 800, 600, 0, -1, 1);
glViewport(0, 0, 400, 200);

It makes the viewing area larger rather than just viewing a 400x200 area...

sentences:
What is a fair latency, to cut off game connection at? I'm currently coding a realtime game. I'm doing alot of technical operations with the physics world (resimulations of old world states etc.) to prevent game lag. I save the world state every physics update, so I can re simulate it later if needed.

Of course this consumes alot of memory, so I'm trying to decide after what period will I remove old world states. For example, if a world state is 250 milliseconds old, remove it from memory. Then, if any player movements are received from players, that occurred more than 250 milliseconds old, discard them.

This would theoretically discontinue any physics movements of players with a latency of 250+. This is to improve the performance/experience for other players, and to maintain low memory usage.

My question is, what is a fair latency to cut off players at (for the good of other players)?

sentences:
Pixel Animation is tearing in Unity I am working on a 2D game and I have created a simple sprite sheet. The sprite sheet represents a medkit. The size of the sprite sheet is 128x16 pixels with 8 different frames that animate the medkit bobbing up and down.

I have imported the sprite sheet into Unity as a Sprite with Sprite Mode set to multiple, Generate Mip Maps unchecked, Filter Mode set to Point, and Format set to Truecolor. I have sliced the sprite sheet using the Unity Sprite Editor and added the animation to my scene.

After doing so, I am able to see my sprite in my game. However I noticed that the animation of the sprite did not correspond to the sprite sheet. Some pixels seem to be distorted and tearing. I have searched online and couldn't find anyone with the issue I had. As you can see from the gif below, the top of the sprite is tearing.

Does anyone know what is causing this issue?

Gif of the issue:here

Sprite sheet used:

sentences:
How can my entities avoid walking on certain tiles? In my tile map, created with 'Tiled', I placed some tiles that need to be avoided by my mobiles. Tiles like water or obstacles.

The entities "wander" in the map, choosing random directions, and their position are in world coordinates (float), not grid or tile positions (int). To create a more natural effect, the random directions are similar in a period of time, so no abrupt change of direction occurs.

Is there a way to make entities avoid some tile types, or 'Tiled' tile properties, without losing the "wander" behaviour? I mean, choose random directions that do not reach these type of tiles?

sentences:
QuadTree treeNode design question I'm a programming newbie.

I have a Quadtree. I created a TreeNode class that the Quadtree will use as nodes. I have spriteNode that inherits from TreeNode.

However, I also have several sprite types inheriting from a Sprite class that I use to instantiate specific sprites.

When I am creating spriteNodes for example I have to cast each specific sprite type to it's parent Sprite class. When I put spriteNode into the quadtree I have to cast the spriteNode to be of type TreeNode so I can generalize the quadtree as much as possible to take different types of data.

I'm not sure if this is a great way of storing all your sprite / map data inside a quadtree, because setting it up requires a lot of explicit casts (even though cast up a level are safe).

Is my OO design approach to storing sprite / map data inside the quadtree the correct way to handle a large quadtree of data? Or is there a better, more standard way of doing things?

sentences:
Unity 5.3 with C# - Toggle Sound On/Off I'm working with Unity 5.3 with C# as code editor

These are what I have :

I have 2 scenes in my project : home and options. I have bg object on both scenes. Both bg objects have Audio Source component, which contains same background music that play on awake. I don't use any codes for these background musics, I only click the Add Component button from Unity and add Audio Source.

This is what I want :

Options scene can toggle the background music on/off for all scenes. Therefore, there are btnOn and btnOff in Options scene.

This is my code in Audio Manager.cs :

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

public class AudioManager : MonoBehaviour {
    public Button btnOn;
    public Button btnOff;

    // Use this for initialization
    void Start () {
        btnOn = GetComponent<Button>();
        btnOff = GetComponent<Button>();

        btnOn.onClick.AddListener(() => PlayAudio());
        btnOff.onClick.AddListener(() => StopAudio());
    }

    void PlayAudio()
    {
        AudioSource.volume = 0.5f;
    }

    void StopAudio()
    {
        AudioSource.volume = 0f;
    }
}

This is the problem :

I have this error : An object reference is required to access non-static member UnityEngine.AudioSource.volume. Maybe, this is because I don't write public AudioSource audioSource in my code. But, if I write this, I have to add another audio in Get Component box, and I will have double Audio Source in one scene. What should I do? Thanks

sentences:
How to keep track of (count) vertices processed so far in GL ES SL 2.0 vertex shader? I'm trying to learn how to use GLSL ES 2.0.

In OpenGL ES 2.0, there is no gl_VertexID keyword to obtain the number of vertices processed so far. So I was wondering if there's a way to make my own counter. I know the vertex shader is executed "per vertex," so if I can increase a counter which persists between executions then that will meet my case.

Now I know I can't use a uniform because by definition they cannot be altered.

So I thought about using an attribute, assuming the value will persist between vertex shader executions, but when I write

attribute int a_vertexCounter;

in my vertex shader, the shader compiler says that an attribute cannot have the type int.

So I thought maybe if I make a_vertexCounter a vec3 for example, and increment the first component of that vector instead... This works, except that when I try

gl_Position = u_MVPMatrix * u_canPos[int(a_vertexCounter.x)];

the compiler says

Error compiling shader: 0:23: S0027: Cannot modify an input variable

I also tried setting my attribute variable to be of type ivec3 but the shader says that's not allowed either.

Maybe there's no way to do this without ES 3.0, where I could simply use gl_VertexID ?

sentences:
Unity loop through list and match PlayerPrefs I have a list of stickers and when a player completes a level they get awarded a sticker which I save into PlayerPrefs. I want to be able to return the list of sprites saved into PlayerPrefs on the awards scene.

I have not been to loop and match the PlayerPrefs. I am not sure how to go about this.

public class StickerManager : MonoBehaviour
{
    public List<Sprite> stickers = new List<Sprite>();
    public List<Sprite> unlockedStickers = new List<Sprite>();

    public void UnlockSticker (int id)
    {
        PlayerPrefs.SetInt("sticker", id);
    }

    public List<Sprite> LoadUnlockedSticker ()
    {
        int i = 0;
        foreach (Sprite spri in stickers)
        {
            if (PlayerPrefs.GetInt("sticker", i) == stickers[i])
                unlockedStickers.Add(stickers[i]);

            i++;
        }

        return unlockedStickers;
    }
}

sentences:
Which elements make some maps in multiplayer FPS games more fun than others? I'm working on a sci-fi multiplayer FPS game, and am currently designing maps with layout influences from the 2015 Star Wars: Battlefront game and from the original Halo CE game, as those games have the maps which I find very enjoyable.  When I was building the map layouts for my game, I started to wonder why I was looking at these older games for reference instead of, say,  maps from these games's sequels.  I know that the enjoyability of certain maps is subjective, but there's a big difference in the amount of fun my friends and I have had playing the maps in these specific games instead of the newer sequels.  Something about the maps in these games provides an inherently fun, memorable experience, and some newer games (like Battlefront II or Halo V) lack that experience.  Maybe some of these maps aren't really anything special, but  I know that certain maps like Blood Gulch have been praised by fans for years.

What makes these maps so memorable and fun to play on multiplayer?  Is it a product of the developers' map-making experience and the resources of the large  companies (the Battlefront devs went to Iceland for reference), or are there specific layout styles and/or structures that are known to provide interesting close-quarters scenarios?  Is there an intangible quality to good maps?

sentences:
Point line collision reaction I am trying to program point line segment collision detection and reaction.  I am doing this for fun and to learn.

The point moves (it has a velocity, and can be controlled by the user), whilst the lines are strait and stationary.  The lines are not axis aligned.  Everything is in 2D.

It is quite straight forward to work out if a collision has occurred.  For each frame, the point moves from A to B.  AB is a line, and if it crosses the line segment, a collision has occurred (or will occur) and I am able to work out the point of intersection (poi).

The problem I am having is with the reaction.  Ideally I would like the point to be prevented from moving across the line.  In one frame, I can move the point back to the poi (or only alow it to move as far as the poi), and alter the velocity.  The problem I am having with this approach (I think) is that, next frame the user may try to cross the line again.

Although the point is on the poi, the point may not be exactly on the line.  Since it is not axis aligned, I think there is always some subtle rounding issue (A float representation of a point on a line might be rounded to a point that is slightly on one side or the other).  Because of this, next frame the path might not intersect the line (because it can start on the other side and move away from it) and the point is effectively allowed to cross the line.

Firstly, does the analysis sound correct?

Having accepted (maybe) that I cannot always exactly position the point on the line, I tried to move the point away from the line slightly (either along the normal to the line, or along the path vector).  I then get a problem at edges.  Attempting to fix one collision by moving the point away from the line (even slightly) can cause it to cross another line (one shape I am dealing with is a star, with sharp corners).  This can mean that the solution to one collision inadvertently creates another collision, which is ignored.

Again, does this sound correct?

Anyway, whatever I try, I am having difficulty with edges, and the point is occasionally able to penetrate the polygons and cross lines, which is undesirable.  Whilst I can find a lot of information about collision detection on the web (and on this site) I can find precious little information on collision reaction.

Does any one know of any good point line collision reaction tutorials?  Or is my approach too flawed/over complicated?

sentences:
Implementing a sine using a bezier curve I'm developing a 2D game using Cocos2d-x.
Is possible to use CCBezierTo to parameterize a sine function?

sentences:
Providing texture coordinates and using indexed drawing at the same time Please consider the following vertex structure

struct vertex {
    vec3 posL, normalL;
};

Using this vertex layout, we can provide the vertex data in an interleaved way, i.e. (posL,normalL),(posL',normalL'),...
This works pretty fine in combination with indexed drawing via glDrawElements().

However, if we add texture coordinates to our vertex structure, i.e. consider

struct vertex
{
    vec3 posL, normalL;
    vec2 tex;
};

things get more complicated. Since one and the same vertex (meaning it's position) may participate in a variety of different faces with varying texture coordinates, I wondered how one would provide such vertex data to the vertex buffer.

One solution would be to quit storing the data interleaved and provide it a linear way, i.e. (posL,posL',...),(normalL,normalL',...),(tex,tex',...) where each tuple has the same length. Doing so, we would hold related things together (i.e. the k-th element of each tuple forms exactly one input the vertex shader sees).

But we would push much more data to the pipeline than necessary. So, what's the "ideal" solution to this problem? If one suggests to use different buffers, how does the vertex shader know, that texture coordinate tex at position i in Buffer 2 corresponds to the tuple (posL,normalL) at position j in Buffer 1?

sentences:
How Many Threads is 'Too Many'? I writing this as I have run into a dilemma that I cannot readily answer.

  Specifically, how many threads is too many?

Background tl;dr:

Writing a game (Surprise.)
C++11, all server-side bits running on Linux server installs (headless)
Login server and chat server are on a single server
Database server/processing is its own server (eventually)
The world server is the 'master' server, in which zone 'servers' (threads) are spun up. Each zone 'server' is responsible for a specific planet and all that entails (npcs, entity lists, etc).

With that brief intro, is there a point in which there are too many threads? Assuming there are 10 planets (zone "servers"), each with their own thread, would there be any extreme problems (not performance bottlenecks) that need to be accounted for in this type of situation utilizing an 8 core server? Would the same problem persist at 16 cores?

The end goal would be to allow for up to three "instances" of each planet, with maybe 20 planets (~60 threads) in the end. I understand that this could cause CPU contention as each thread is waiting for CPU cycles, but not enough to effectively hang the system (excluding a zone server locking up). If the game progresses to that point, 32 core servers would be an (expensive) option.

Is there anything that I am missing or not understanding?

Thank you in advance!

sentences:
XNA graphics.PreferredBackBufferWidth's new value doesn't immediately change window size I set the width and height of the window in my game constructor, and then pass the graphics manager to a class to check the value. In the game's initialize function, it doesn't seem to recognize the new width and height values, so it uses the default.

Here's relevant code:

Game1.cs Constructor:

graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1600;
graphics.PreferredBackBufferHeight = 900;
Content.RootDirectory = "Content";
World = new TestWorld(Content, graphics);

Game1.cs Initialize

World.Initialize();

TestWorld Initialize

Debug.WriteLine(Graphics.GraphicsDevice.Viewport.Width);

The TestWorld Initialize outputs the default (800).

I have tried graphics.ApplyChanges(), but it does not resolve the issue.

sentences:
AC3 FlashPunk Console doesn't show anything I am making my project using flashpunk , I knew that it has a good console gui to give feed about states of the game , however when I tried making it appear with the FP.console.enable() method it shows its dark transparent GUI but no text appears .
I though it might be something wrong with my project so I downloaded some examples and they all failed .
Here is a pic from pink example :

As you see the console displays no text while it should give feed .

sentences:
Is making a sandbox feasible in Godot/Unity (w/o open world)? I want to make a 3D multiplayer game. It will inherit the basic principles of the MOBA genre: players choose from the variety of characters each having 4-8 unique abilities, then battle it out. I also want some abilities to affect terrain.
I try to keep the concept simple to be able to make this game alone. It would be good if I manage to finish the first playable prototype in no more than 6 months (keeping in mind that I'll be able to work on the game mostly on weekends). Multiplayer AND 3d in themselves make things much harder, so deciding which mechanics to implement and how is essential. Thus I want to make sure I won't have to redo much after I start programming.
To implement the destructible terrain I decided to stick with a Minecraft-ish approach, where everything consists of blocks. The sandbox is a very hard genre in terms of game development, but after doing quick research, I concluded that most difficulties arise from the fact that the game is open-world. This isn't my case. I won't need too many blocks to construct the arenas.
Now I need to come up with the engine I'm gonna use. I like Godot due to its development paradigm, but I'm not sure whether it is a good choice for a game like this. Maybe Unity is the better choice in my situation. Or something else.
Maybe I need to remove some mechanics from the concept to make the development a lot faster.
Can you comment on it? Thanks!
P. S. I have 7 years' programming experience (with Haxe and Python being my main languages) and a good mathematical background. I have been developing my multiplayer game for 3 years now (but it is a 2D game, I have no experience in 3d gamedev beyond the Godot tutorial). It is okay if I need to learn different things before starting to make a game, but I want to make the learning process as effective as possible.

sentences:
How do I construct the planes for my camera's frustum? I'm trying to get a handle on frustum culling, but I'm not quite there yet.

I have a camera in three-dimensional space

Camera
    position (cx, cy, cz)
    rotation (tx, ty, tz)
    fieldofview
    near-plane
    far-plane

and a quadtree containing my chunks of terrain

Quadtree
    Chunk
        bottomleft (x, y)
        width
        length
        heightmap

Currently, I am rendering every chunk within the quadtree. However, I would like to cull all chunks outside the six planes of the camera's frustum.

I am unsure how to:

Generate these planes given the information in the camera class.
Efficiently test for intersection using my quadtree. If one region of the quadtree fails, do all of its children (that seems reasonable, I just want to make sure)? What is the process for running through a quadtree for culling?
Perform the intersection test using the planes and my terrain chunks. How do I quickly tell if a piece of terrain (square with varying y values) lies within the 6 camera planes?

sentences:
What to watch out for when creating a autobiographical game? I plan to create a game which depicts various events from my life.

During these events, some people I know do not appear in a very positive light. I am afraid that these people might feel that it is an infraction on their personality rights. I also plan to unveil some of my own actions which they didn't know before and which could make them angry if they knew of them.

The story of the game as I currently plan it will be written in a way that if they know I made the game, they would realize that they are the ones depicted. Even if they have different names and appearance.

But despite these risks I feel that this project is important for me and might help me to cope with some events from my past.

What should I watch out for when I write and publish the game to make sure I won't ruin my relationship with these people?

sentences:
How do I get a Light's Range value in Shader? I'm trying to write a simple frag/vert shader that, depending on whether it is in the range of a light, will paint the appropriate colour from either the 'lit' texture or from the 'unlit' texture.

Therefore, I need to compare the distance between the light to the range of the light.
I've been googling all kinds of things, but I can't seem to find a way of accessing the range value of the light. Is there a way to do so? If not, is there some kind of derived data I could use as an alternative?

I was able to find this method here, which seems to be the most promising so far, however after playing around for a bit, I still can't seem to get what I need. There's some talk about _LightMatrix0 not being populated. Can anyone confirm?

I've also had it suggested to use SetFloat() and pass in the range like that...however, that provides no easy way of telling one light apart from another short of using the light's position as a key. As several key lights in the game will be moving this is just ugly and inefficient.

Update

I found the variable unity_LightAtten in the Unity Shader Variables documentation. However, this is only used for Vertex Lit shading, which isn't exactly ideal, especially considering the lack of console support.
Could there be a way to pipe this variable to Forward Rendering?

Update 2
For clarification, shading should otherwise be 'flat' (ie no need for diffuse etc):

Also, what I've currently got (albeit, not currently working as desired and currently using a workaround):

Shader "Lantern/Flat Pullup" {
Properties {
    _LitTex ("Lit (RGB)", 2D) = "white" {}
    _UnlitTex ("Unlit (RGB)", 2D) = "white" {}
    //_Falloff ("Falloff", 2D) = "white" {}
    _Pullup ("Pull up Point", Range(0,1)) = 0.7
}
SubShader {
    Pass{
        Tags { "LightMode"="ForwardBase" }
        LOD 200

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        uniform sampler2D _UnlitTex;
        uniform float4 _UnlitTex_ST;
        uniform sampler2D _LitTex;
        uniform float4 _LitTex_ST;
        uniform float _Pullup;

        uniform float4 _LightColor0;

        struct VI {
            float4 vertex : POSITION;
            float4 tex : TEXCOORD0;
        };

        struct V2F {
            float4 pos : SV_POSITION;
            float4 tex : TEXCOORD0;
            float4 posWorld : TEXCOORD1;
        };

        V2F vert(VI v){
            V2F o;
            o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
            o.tex = v.tex;
            o.posWorld = mul(_Object2World, v.vertex);
            return o;
        }

        float4 frag(V2F i) : COLOR {
            float3 flatReflection = _LightColor0.xyz *
                (1 / length(_WorldSpaceLightPos0.xyz - i.posWorld.xyz));
            float4 color;
            //Improve for light color etc
            if(length(flatReflection) > _Pullup){
                color = tex2D(_LitTex, i.tex.xy * _LitTex_ST.xy + _LitTex_ST.zw);
            }else{
                color = tex2D(_UnlitTex, i.tex.xy * _UnlitTex_ST.xy + _UnlitTex_ST.zw);
            }
            return color;
        }

        ENDCG
    }
}
FallBack "Diffuse"
}

sentences:
Use libgdx box2d for dynamically generated top down map So, I've already found some information on how to use box2d and tiledmap together.

Since I want to generate my top down map (100 by 100 tiles), I thought about only using box2d.

The tiles would be fixed and only the player (and maybe some other movable parts like chests, etc) would be dynamic. I'd also like to use box2dlights later, so using box2d seems convenient.

My only concern on this is the performance. I haven't used box2d much, so I don't know how it handles such a big amount of boxes (though not all 10000 tiles would be visible at the same time).

Does anyone know how the performance would be influenced or advice on how to achieve this easier?

Thanks in advance

sentences:
I get GL_INVALID_VALUE after calling glTexSubImage2D I am trying to figure out why my texture allocation does not work.  Here is the code:

glTexStorage2D(GL_TEXTURE_2D, 2, GL_RGBA8, 2048, 2048);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 2048, 2048, GL_RGB,
                GL_UNSIGNED_SHORT_5_6_5_REV, &BitMap[0]);

glTexSubImage2D returns GL_INVALID_VALUE but the maximum texture allowed is 16384x16384 on my card.

The source of the image is 16bit (Red 5, Green 6, Blue 5).

sentences: Your recommendation for path construction from a single background image? So I currently have my background as a single PNG and some obstacles (like blocks as part of that PNG). In order to create a path, I currently store pixels above a unique green color (my hill) and use this to move the character. My question is, is it better to create something like a collision layer mask or somehow convert my PNG to a bunch of tiles? Is this possible?

sentences:
Creating a custom collider shape in unity, and performance concerns I want to create a custom chaped collider in unity to create point-defense triggers for objects. I have a spherical collider that triggers for attacking objects that enter it already. However I want cone-shaped colliders for point defense to detect and shoot down enemy projectiles in certain areas.

I can do this by creating a custom mesh and importing that for the collider. How much of a performance hit can this cause? If you have 1,000 of these colliders active in a scene with objects flying in and out of them, will I see significant performance reduction compared to just using a spherical collider and dropping the cone idea?

sentences:
Object have the same "speed" all time JavaScript I try to create a 2D game with a big map and multiple objects. The player is always in the middle of the screen and all the other objects is moving around so it feels like a big map.

I want the player to always move after the mouse location. I have modified the mouse location to (0,0) by this:

                var mouseX = 0;
                var mouseY = 0;
                if (e.pageX < window.innerWidth/2) {
                    mouseX = -(window.innerWidth/2-e.pageX);
                }else{
                    mouseX = e.pageX-window.innerWidth/2;
                }
                if (e.pageY < window.innerHeight/2) {
                    mouseY = -(window.innerHeight/2-e.pageY);
                }else{
                    mouseY = e.pageY-window.innerHeight/2;
                }

That is working just fine. When it comes to the moving part i can't relly get it to move with the same "speed". I have made some animations to explain how it is now and how i want it to be.

How it is now:

DC is the speed that my player would go and as you can see it is moving the most when its closest to x=0 and y=0, i have done it like this so far:

            var all = mouseX + mouseY;
            clientsID[key]['x'] += mouseX / all * speed;
            clientsID[key]['y'] += mouseY / all * speed;

But as i know it is not working well. Here is a animation to show how i want it to be:

DA would be the speed and it's always 1 because it's radius of the circle. But as i don't know how far the mouse is from the center (mouse is E on the last animation) i have to scale it down somehow.

Does anyone know how to get how much i have to add x and y so the speed always will be the same?

Thank you

EDIT: See the solution under here

sentences:
Rotating player around planet causes drift in gun aiming at mouse I have a bug with the rotation of a gun object that follows the mouse position. It has issues when the parent object player rotates. Example:

The player has a gravity script to keep them aligned with the 'planet' as you walk around it. The gun is a child of the player, and it's supposed to always rotate to point at where the mouse is (sorry you can't see it in the gif). The gun normally flips itself at 90 and -90 (top and bottom), and flips the player to face the same side the mouse is on.
The problem is that the player rotates to stay aligned with the planet, but the 90 and -90 angles that the gun uses to decide whether to flip itself and the player of course don't rotate.
Here's my code for the gun:
  Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
  difference.Normalize();
  float rotationZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;

  float startRotation = rotationZ + offset;

  float shotRotation = startRotation + Random.Range(-scatter, scatter);

  transform.rotation = Quaternion.Euler(0f, 0f, startRotation);

  //Flip the gun at top and bottom
  if (rotationZ < -90 || rotationZ > 90)
  {
      if (player.transform.eulerAngles.y == 0)
      {
          transform.localRotation = Quaternion.Euler(180, 0, -rotationZ + offset);
      }
      else if (player.transform.eulerAngles.y == 180)
      {
          transform.localRotation = Quaternion.Euler(180, 180, -rotationZ + offset);
      }
  }

  //Use gun rotation to set player direction
  //left
  if (rotationZ >= -90f || rotationZ <= 90f)
  {
      animator.SetFloat("Vertical", 0);
      animator.SetFloat("Horizontal", -1);
  }
  //right
  if (rotationZ <= -90f || rotationZ >= 90f)
  {
      animator.SetFloat("Vertical", 0);
      animator.SetFloat("Horizontal", 1);
  }

sentences:
synchronizing view state between nodes in a rendering cluster I'm building a display wall demo application.

The environment:

N machines, each driving up to six displays
Wired gigabit switch
OpenTK application to draw the pretty pictures, running 1 copy on each node

Each node runs an identical copy of the demo executable. Each node also has some config data containing the resolution of the entire wall and the relative position of that node's displays within that space. When rendering, a scale/translation transform is applied after the projection matrix (effectively zooming in on the part of the view that the node is responsible for rendering).

The nodes have a "mode" switch set in a startup script that puts them in "send" or "receive" mode. All but one node is in "receive." (Switching a node to "send" causes all others to switch to "receive").

The demo app is a basic FPS-type fly through of some primitive geometry (grid, icosahedron, etc). On each update, the sender node broadcasts a UDP datagram containing some state information (camera translation/rotation, transforms for moving objects).

Listeners asynchronously receive these datagrams, deserialize the state and update their local copies.

The net effect is that I run the app on my laptop and fly around, and the wall nicely follows along. This all works pretty well.

However, I'm concerned that as the system scales (from 10 displays to, say, 500), that network latency will be an issue. I've also thought that, rather than spamming state across the network this way, it would be nice to stuff it into a database and have each node just pull from there, but I doubt any off the shelf databases are going to be up to a 60FPS * 500 nodes cycle.

Suggestions? What's the best way to share state between a lot of nodes really, really fast?

sentences:
Getting Sprites from a SpriteSheet with Rows and Columns I am having trouble reading a spritesheet with rows and columns. If it is just one row, then my code works fine. The sheet looks like this:

Source: Character animations, clothes, armor, weapons, skeleton enemy, combat dummy

Right now, it only works with the first row. I can't figure out how to move it down to the next row. I know I have to change my SourceRect for the x and y but don't know to what.

Here's my code:

class SpriteSheet
{
    public Texture2D Texture { get; set; }
    public Vector2 Origin { get; set; }
    public Rectangle SourceRect { get; set; }
    public Vector2 position;

    private float timer, interval;
    private int currentFrame;
    private int spriteWidth, spriteHeight, spriteSpeed;
    private int rows, columns;
    private KeyboardState currentKBState, previousKBState;

    public SpriteSheet(Texture2D texture, int spriteWidth, int spriteHeight, int rows = 1, int columns = 0, int currentFrame = 1)
    {
        Texture = texture;
        this.currentFrame = currentFrame;
        this.spriteWidth = spriteWidth;
        this.spriteHeight = spriteHeight;
        this.rows = rows;
        this.columns = columns;

        spriteSpeed = 100;
        interval = 200;
    }

    // Handle movement of sprite
    public void Update(GameTime gameTime)
    {
        previousKBState = currentKBState;
        currentKBState = Keyboard.GetState();

        // Get the sprite from the sheet
        // THIS LINE NEEDS TO BE CHANGED I THINK
        SourceRect = new Rectangle(currentFrame * spriteWidth, 0, spriteWidth, spriteHeight);

        if(currentKBState.GetPressedKeys().Length == 0)
        {
            if (currentFrame > 0 && currentFrame < 9)
                currentFrame = 0;

            if (currentFrame > 9 && currentFrame < 18)
                currentFrame = 9;

            if (currentFrame > 18 && currentFrame < 27)
                currentFrame = 18;

            if (currentFrame > 27 && currentFrame < 36)
                currentFrame = 27;
        }

        // Animate Up
        if (currentKBState.IsKeyDown(Keys.Up))
        {
            AnimateUp(gameTime);

            // Check boundary
            if (position.Y > 25)
                position.Y -= (float) (spriteSpeed * gameTime.ElapsedGameTime.TotalSeconds);
        }
    }

    private void AnimateUp(GameTime gameTime)
    {
        if (currentKBState != previousKBState)
            currentFrame = 1;

        timer += (float)gameTime.ElapsedGameTime.TotalMilliseconds;

        if(timer > interval)
        {
            currentFrame++;
            if (currentFrame > 8)
                currentFrame = 0;

            timer = 0f;
        }
    }
}

sentences:
Unity- how to render-to-texture with VR distortion I've also asked the question here http://answers.unity3d.com/questions/1392099/how-to-set-a-render-to-texture-camera-to-be-a-vr-c.html (but it's currently "under moderation")

So, I want to do some post processing effects in VR. I put a camera as a child of the Main Camera and set it to render-to-texture. Then, I take what is rendered, and display it (with my post-proc shader) on a quad in front of the Main Camera (The main camera and the child camera render different layers, so I don't render the same thing twice). (Also worth noting- I know that the depth will be collapsed out of the rendered-to-texture content; this is intentional.) The problem is, in this process, the positional data (that was rendered to texture) gets misaligned.

I've already fixed a problem where I have to manually set camera_project.GetComponent<Camera>().aspect = main_camera.GetComponent<Camera>().aspect; every frame. (Changing/setting the screen size auto sets the aspect ratio of the main camera- it does not automatically set the aspect ratio of the child camera.

So, with just that, everything lines up great and looks fine when it isn't in VR. But, when it is in VR, it appears that maybe some distortion is happening to the main camera that isn't happening to the render-to-texture camera, and thus, the overlay (the post-proc'd content) isn't lining up.

So what can I do to emulate the VR distortion in the child camera? Are there other properties of the Main Camera that are getting auto-set in VR that I can manually copy to the Main Camera? (I also noticed that aspect wasn't listed in the camera documentation [https://docs.unity3d.com/Manual/class-Camera.html] unless you knew to search for it explicitly, so I think it might be likely there is some other property I'm missing?)

sentences:
How to deal with texture coordinates without range? I have a set of given texture coordinates(u,v coordinates), but they are ranging from (-inf, inf), contradicting the [0,1] convention.

I tried to do a rescaling by
value = (value - min) / (mac - min).
But if I have a rectangle which composed of two triangles, four vertices. Suppose the u,v coordinates are

  -0.260944  0.490887
   3.619507  0.490887
   3.619507 -3.043434
  -0.260944 -3.043434

After scaling, the coordinates would be mapped to exact -1 and 1, resulting in wrong texture.

So how should I deal with this kind of texture coordinates?

sentences:
How to create soft tires like in `Spintires`? Here is an screenshot of a deformed tire in the game Spintires.

I would like to achieve a similar effect in my game
I'm using Bullet as the physics library, if that matters.

sentences:
HLSL sampler always returns white I'm having an issue with a simple HLSL pixel shader. As a start to writing a lighting engine, I created a point light texture that looks like this. The texture itself is a white -> transparent gradient, drawn here on a black background for visibility.

As a simple test, I wrote a shader to sample from that light texture. Here's the HLSL code.

texture2D pointLightTexture;

sampler pointLightSampler = sampler_state
{
    Texture = <pointLightTexture>;
};

struct VertexShaderOutput
{
    float4 Color : COLOR0;
    float4 Position : SV_POSITION0;
    float2 TexCoords : TEXCOORD0;
};

float4 PointLightFunction(VertexShaderOutput input) : COLOR0
{
    return tex2D(pointLightSampler, input.TexCoords);
}

technique PointLightTechnique
{
    pass Pass0
    {
        PixelShader = compile ps_4_0 PointLightFunction();
    }
};

But the resulting "light" is just a pure white rectangle.

So my basic question is, why is this texture sampling not working? I've already verified that 1) the texture is correct (I can draw the texture in isolation and it looks fine) and 2) the texture coordinates within the shader are correct (i.e. they properly span 0 to 1 within the bounds of that white square). In the past, I've run into issues when trying to use multiple samplers within one shader, but as you can see, this shader just has one.

More generally, I've been getting extremely frustrating using HLSL shaders. It seems very difficult to do even basic tasks, even when I know my logic is correct (i.e. draw a square and sample from the texture appropriately). Feels like the shader compiler optimizes the code so aggressively that most shaders just don't work. Further more, it seems silly that I should have to 1) store the point light texture and 2) create a sampler specifically using that texture, rather than just being able to call pointLightTexture.Sample(pointLightSampler, input.TexCoords);.

Is there something fundamentally I'm missing? Is there a way to disable HLSL's crazy optimizations? Is it an issue using Monogame? It seems crazy to me that I constantly have to fight against these shaders.

sentences:
How do I know if I've gone too far with processing things in a game? A common programming quote I see every day is:

  Premature optimization is the root of all evil!

I admit I'm one of those guys that like to do premature optimization in a pretty obssessive manner but that's probably because I'm not aware how powerful modern processors are. I can think of lots of sollutions for a problem, but all of them are tough on the memory side, and I keep thinking "This will hurt me more in the future when I'll have to re-do it because it's bad performance-wise."

How do you know when the code you are thinking of is going too far and is not a case of premature optimization? How much can your game handle at a time before performance becomes a problem?

sentences:
Preload in cocos2d v3 I'm trying to create a preload, but i don't know how to implement the code of this topic in cocos2d iphone v3. Since CCTextureCache has changed to CCTexture, and doesn't have sharedTextureCache property anymore.

@interface TextureHelper : NSObject
+ (void) preloadTextures;
+ (CCTexture2D *) textureForImageNamed:(NSString *) imageName;
@end

@implementation TextureHelper
+ (CCTexture2D *) textureForImageNamed:(NSString *) imageName {
    return [[CCTextureCache sharedTextureCache] textureForKey:imageName];
}

+ (void) preloadTextures {
    // or could read from a directory...
    NSArray *imageNames = @[
    @"myImage1.png",
    @"myImage2.png"
    ];

    for (NSString *imageName in imageNames)
        [[CCTextureCache sharedTextureCache] addImage:imageName];
}
@end

sentences:
Converting Frame-Dependent Movement to Frame-Independent I fine-tuned some movement physics for a 2D platformer in a frame-dependent manner and now I want to convert them to frame-independent.

I though this would be as easy as multiplying a few things by 60 (my FPS) and a few other things by a time delta.

Unfortunately, the resultant physics is not the same as the original, especially when I drop the frame rate from 60 fps to 30 fps.

Here's how the frame-dependent movement works in my Player class, simplified a bit for the purposes of illustration.

PLAYER_ACC = 1.5
PLAYER_FRICTION = -0.23
PLAYER_GRAV = 1.75
PLAYER_JUMP = 20

def get_input(self):
    if self.game.input("left"):
        self.acc.x = -PLAYER_ACC
    if self.game.input("right"):
        self.acc.x = PLAYER_ACC
    if self.game.input("up"):
        self.vel.y = -PLAYER_JUMP

def update(self):
    # reset acceleration
    self.acc = vec(0, PLAYER_GRAV)

    # process input
    self.get_input()

    # apply friction
    self.acc.x += self.vel.x * PLAYER_FRICTION     # The faster you're going, the more friction slows you down.

    # calculate velocity
    self.vel += self.acc

    # if the x-velocity approaches 0, set it equal to 0
    if abs(self.vel.x) < 1.5:
        self.vel.x = 0

    # downward velocity cap
    if self.vel.y >= 14:
        self.vel.y = 14

    # adjust position
    self.pos += self.vel + (PLAYER_GRAV * self.acc)    # Got this equation from a tutorial and I like how it feels.

Here's my attempt at making it frame-independent. My time delta is self.game.dt.

PLAYER_ACC = 1.5 * 60
PLAYER_FRICTION = -0.23
PLAYER_GRAV = 1.75 * 60
PLAYER_JUMP = 20 * 60

def get_input(self):
    if self.game.input("left"):
        self.acc.x = -PLAYER_ACC
    if self.game.input("right"):
        self.acc.x = PLAYER_ACC
    if self.game.input("up"):
        self.vel.y = -PLAYER_JUMP

def update(self):
    # reset acceleration
    self.acc = vec(0, PLAYER_GRAV)

    # process input
    self.get_input()

    # apply friction
    self.acc.x += self.vel.x * PLAYER_FRICTION    # The faster you're going, the more friction slows you down.

    # calculate velocity
    self.vel += self.acc * self.game.dt

    # if the x-velocity approaches 0, set it equal to 0
    if abs(self.vel.x) < 1.5 * 60:
        self.vel.x = 0

    # downward velocity cap
    if self.vel.y >= 14 * 60:
        self.vel.y = 14 * 60

    # adjust position
    self.pos += (self.vel + (PLAYER_GRAV * self.acc)) * self.game.dt

Unfortunately, the resultant physics did not feel the same as my original. Especially when I drop the frame rate from 60 fps to 30 fps.

I was thinking that maybe when I apply the friction to the acceleration, I need to raise it to the time delta, but this didn't help either. I am working at a small resolution (640x360) and I'm not sure if this is impacting anything.

My question is: How can I convert my current physics to frame-independent?

There are a few questions similar to this on Game Dev SE already, but none of them has led me to a solution.

sentences:
Game graphics taking too much memory of 0.5 GB I am developing a simple 2D game. I have multiple sprites. Each sprite has around 80 png/frames of 265* 256. I used LibGdx's Texture packer to package the atlas. Am enabling mimap using following code to pac

    TexturePacker.Settings settings = new TexturePacker.Settings();
    settings.combineSubdirectories = true;
    settings.filterMin = Texture.TextureFilter.MipMapNearestLinear;
    settings.filterMag = Texture.TextureFilter.Linear;

    TexturePacker.process(settings, f.getPath(), outputFolderName, atlasFileName);

Questions:

Are 80 images/frames for single sprite too much?
Is 0.5 GB memory usage too much for a simple game like Fruit ninja?
How can i reduce my memory usage?
Any other things i should try?

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:
Excluding some scene elements from bloom effect I've enabled HDR and bloom effects in my SceneKit app, but I don't want some of the elements in my scene to bloom.

For example, the lighter spots on the skybox are currently glowing.

Is there some way I can stop those elements from glowing selectively?

sentences:
How do I clear up artifacts between aligned faces when using AA in XNA 4.0? I'm working on a graphics engine that lets you walk around a world that is made up of cubes (voxel engine) and I'm having some difficulties getting the results I want.

I'm not the best at 3D graphics, but I'm willing to learn. When I have anti-aliasing turned off, the textures line up properly together on the surfaces, but when I turn it on, I see a lot of lines between each square face. I've taken a picture:

I've tried changing the mip map mag filter options on the sampler, but cannot get it to look right. I've tried increasing the quality of the textures, but that doesn't help either. When I use Linear TextureFilter but that just makes everything super blurry, and the edges are even more obvious. In fact many edges get some blurry white and dark color to them. Anisotropic doesn't help.

Nothing I do seems to get rid of those lines in between faces when I have AA turned on. Anyone have any advice on where I would start looking? I'm assuming it's because all of the faces are individual, and not mixed together when they are next to each-other. Not just the edges are being anti-aliased. Not sure if I'm even on the right track with that thought.

I'm using XNA 4.0 to do this.

sentences:
Bubble Text appears issue? I'm trying to make a dialogue between characters using bubbles witth text. But the text appears not clear to player.

The Cam is far from the canvas 13.5f. What to do fix it ?

sentences:
Unity-Sharing values between functions invoked by buttons and the rest of the script Ok so, here is the problem.

I am doing a multiplayer 2D game using UNET.

I have a script that kind of helps a player select an avatar to play with. The avatars are listed as a scrollview of buttons. These buttons invoke the function setAvatar(int id) that sets a player's avatar passing in an ID as argument. The function just sets the player's avatar using ID as index in a list of avatars.

Now the problem is this player is a prefab which is instantiated at the start of the playscene for Player A and Player B. So the setAvatar(int sprid) function assumes I am referring to the prefab whenever I use "gameObject"

So, I decided to store the local gameObject in a temporary variable.

Here's the full code,

public class Player2DController : NetworkBehaviour // Attached to player prefab
{
    public float moveForce = 2;
    Rigidbody2D myBody;
    Transform mainCamera;
    Shooting shscript;
    int i;
    public Transform joystick;
    GameObject temp;

    public Sprite[] spr;

    void Start ()
    {
        if (!isLocalPlayer)
        {
            Destroy (this);
            return;
        }

        temp = gameObject; // storing local gameobject in temp

        joystick = GameObject.Find ("MobileJoystick").transform;
        shscript = GetComponent<Shooting> ();
        mainCamera = Camera.main.transform;
        RotateCamera ();
        myBody = GetComponent<Rigidbody2D> ();

        if (isClient)
        {
            i = -1;
        }
        if (isServer)
        {
            i = 1;
        }

    }

    public void RotateCamera()
    {
        if (isClient)
        {
            mainCamera.rotation = Quaternion.Euler (new Vector3 (0f, 0f, 180f));
        }
        if (isServer)
        {
            mainCamera.rotation = Quaternion.Euler (new Vector3 (0f, 0f, 0f));
        }
    }

    void FixedUpdate ()
    {
        if (PauseMenu.isOn)
        {
            return;
        }
        Vector2 moveVec = new Vector2(CrossPlatformInputManager.GetAxis("Horizontal"),CrossPlatformInputManager.GetAxis("Vertical"))* moveForce;

        myBody.AddForce (moveVec * i);

        if (CrossPlatformInputManager.GetButton("Shoot"))
        {
            shscript.CmdFire ();
        }

    }

    public void setAvatar(int id) // called through the buttons in the avatar list
    {
        temp.GetComponent<SpriteRenderer> ().sprite = spr [id];//null pointer exception
    }
}

This code doesn't work. I get a null pointer exception on temp variable saying it is not assigned. But how can this be? I clearly assign it to active gameObject in Start() method. The only reason I can think of why this is happening is that since the button acts on the player prefab, it creates a separate instance of the script for the player prefab that doesn't get executed. So, when it invokes setAvatar(), it has a temp which is not initialized.

So that's the whole problem. Since this didn't work, I tried renaming the players as clientPlayer and serverPlayer and then accessing them using GameObject.Find(name).GetComponent<SpriteRenderer>().sprite. But this had no effect and no errors. I have no idea why.

So any ideas on how to go about this?

sentences:
How can I minimise memory thrashing when doing vector math in JavaScript or ActionScript? Please note that a similar question has been asked before in the context of C#.

Say I'm building a 3D game in Javascript or Actionscript, and doing a lot of 3D vector math. In current libraries, every operation causes a new object to be created and returned as the result value. What is a simple way to optimize this?

For example in this snippet, 2 new Vector3D objects are created, one at the divide and one at the multiply operator.

// JS
result = v.divideBy(len1).multiplyBy(len2);

A better approach would be creating a single object and reusing it.

// JS
var _temp = {x:0, y:0, z:0};  // create a single object once
....
v.divideBy(len1, _temp);       // re-use it
_temp.multiplyBy(len2, _temp); // re-use it

In C# you could just use structs, but in languages like JS and AS3 there are no such things. What does one do to minimise object creation in such  languages?

Edit: For example currently I'm doing BSP partitioning in the browser, and its very slow during the BSP operation. (I have profiled to confirm this) I have discovered that the major cause is vector math, and the GC that occurs often that also causes stutters.

Edit: Please note that my question can apply to any type of object in general, not just vector math. So when I'm creating millions of objects as a return value of any function, performance would be affected. Therefore, I am looking for better design patterns to solve the very common issue of returning multiple values.

sentences:
How do you triangulate a 3D point from a pair of stereo images? I'm working with a stereo pair of photos, and trying to obtain a set of 3D points from matching points on these 2 images. How exactly is the point triangulated? Do you throw a ray from the camera pinhole centerpoint? Or do you throw a ray perpendicular to the photos?

Edit: I'm also looking for code examples, that document the simple linear/polynomial math involved. Currently I'm simply using 3D line/line intersections to find the point. (actually line/plane intersections) I'm sure this is not accurate and the calibration data of the camera should also be used. Although I don't know how. For instance, with the points on the photos known, should I be drawing the 3D line from the camera pinhole 'origin', or is there a better way? Should I be taking the lens distort into account, or something fancier? The calibration data I have is as follows:

ix, iy -- Image sensor width and height, i.e. the dimensions of the photograph.
fx, fy -- Focal length in x- and y-dimensions measured in pixels.
cx, cy -- Principal point coordinates, i.e. coordinates of lens optical axis interception with sensor plane.
skew -- Skew transformation coefficient.
k1, k2, k3 -- Radial distortion coefficients.
p1, p2 -- Tangential distortion coefficients.

sentences:
Is OnMouseUp()'s behavior intended? Version: Unity3D 4.6.2f1

I have a grid of tiles (Cube GameObjects with a Tile script attached). They are positioned at their index location [x][y] = (x, y, z=0) World Coordinates.

Below, I try to get the coordinates of the tile upon which the mouse left click is released.

Before into code:

  OnMouseDown() -  OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider.
  OnMouseUp() - OnMouseUp is called when the user has released the mouse button.

Based on these definitions, I assumed (mistake?) OnMouseUp() would be called by the object that above it, the mouse left click was released.

On the Tile script, I have the following :

public class Tile : MonoBehaviour
{
    // variables
    private Vector2 _gridPosition = Vector2.zero;

    public Vector2 GridPosition
    {
        get { return _gridPosition; }
        set { _gridPosition = value; }
    }

    // functions
    string Vec2toText(Vector2 v)
    {
        return String.Format("(" + v.x + ", " + v.y + ")");
    }

    void OnMouseDown()
    {
        Debug.Log("TILE:: ON_MOUSE_DOWN:: " + Vec2toText(_gridPosition));
    }

    void OnMouseUp()
    {
        Debug.Log("TILE:: ON_MOUSE_UP:: " + Vec2toText(_gridPosition));
    }

    void OnMouseEnter()
    {
        Debug.Log("TILE:: MOUSE_ENTER: " + Vec2toText(_gridPosition));
    }

    void OnMouseExit()
    {
        Debug.Log("TILE:: MOUSE_EXIT: " + Vec2toText(_gridPosition));
    }
}

And here is the output:

TILE:: MOUSE_ENTER: (15, 15)
TILE:: MOUSE_DOWN: (15, 15)
TILE:: MOUSE_EXIT: (15, 15)
TILE:: MOUSE_ENTER: (14, 15)
TILE:: MOUSE_UP: (15, 15)    %% This line
TILE:: MOUSE_EXIT: (14, 15)

I would expect OnMouseDown() to be called by the object on which the mouse button was pressed (no problem here) and OnMouseUp() to be called by the object on which the mouse button was released (instead, it is called by the same object as OnMouseDown()).

Is this -- calling two functions by the same object even though I pressed left click some object and released it on some other object -- intended?

sentences:
Multi Sampling in Rendering Pipeline? I am trying to understand : How does multi-sampling rasterization effects pixel shader output?

In a nutshell (i am skipping some steps to stay on point of question):

Vertex data is fetched.
Vertex shader is executed.
Rasterizer - rasterizes the geometric region, this is where it is decided which pixels are covered by the mesh/geometry.
Pixel shader is executed.

Multi-sampling Anti aliasing rasterization which is a rasterization rule, helps to decide weather full color output by pixel shader will be drawn on screen or it will be blended based on multi-sampling result (not by Blending-operation as I am aware that Blending(srcAlpha oneMinusSrcAlpha) happens later in the pipeline before pixel is drawn on screen).

Example MFAA : which uses sampling
https://www.youtube.com/watch?v=T2UMqmne4RA

My question is where does this sampling information get stored for every pixel and at which step of rendering pipeline, color given by pixel shader is changed based on sampling result done by rasterizer?

Thanks

sentences:
back-face (back-line) culling without winding order In fooling around with my own 3D display engine I've been able to get a few modest features working, and I've come close with this latest one - line culling - but I fear in order to do it correctly I'll need to backpedal a little bit and start establishing more attributes in my basic wireframe objects. I'd like to avoid that if possible because I legitimately haven't needed it until now (maybe).

The basic '3d object' class is essentially just lists of lines, points, an RGB value for color, and a few self-transforming methods for basic movement and rotation.

class MyObject(object):
    def __init__(self, points, lines, color):
        self.points = points
        self.lines = lines
        self.color = color
    # insert methods for rotation/translation/etc

No vertex order, no collection of 'faces' or 'sides' or anything, just points and lines and a color.

I've tried to introduce a culling method into my view object that uses all the possible triangles that each line could be an edge with, and then checks the dot product of that triangle's outward-facing normal against the imaginary line from the camera to the shared point in the triangle (v0, pt_a, etc).

def line_cull(self, shape):
    """Determine which lines should be drawn by comparing them against
    the triangles they could be a part of. If the triangle faces away from the
    camera, don't draw that line.
    """
    to_draw = []
    for line in shape.lines:
        a, b = line
        # get a list of the other lines that point a exists in
        other_lines = [m for m in shape.lines if a in m and m is not one]
        # treat point a as "vertex 0" and get the line from a to the camera
        a_to_cam = minus(a, self.camera)
        for line2 in other_lines:
            # get the correct point c
            if not a == line2[0]:
                line2 = line2[::-1]
            c = line2[-1]
            # get the vector of ab and ac for a cross product
            ab = minus(b, a)
            ac = minus(c, a)
            # find the middle of the triangle
            mid = [x / 3.0 for x in plus(a, plus(b, c))]
            # outwards is the direction vector from the shape's center
            # to the middle of the triangle. for whatever reason this
            # has been working better at orienting the normal than just
            # using the dot product to the center of the object
            outwards = minus(mid, shape.center)
            norm = cross(ab, ac)
            if dot(norm, outwards) < 0:
                norm = cross(ac, ab)
            if dot(norm, a_to_cam) < 0:
                if line not in to_draw:
                    to_draw.append(line)
    return to_draw

This works for certain shapes a lot better than others. Sticking to platonic solids for now - tetrahedrons and cubes are perfectly drawn, whereas octahedrons (especially rotating ones) have flickering back-end lines.

I did try to include a line about confirming the existence of line BC -- that is, the imaginary 'third line' in the triangle -- and all of a sudden, all my cubes disappeared! Because there would never be a third line in its series of right-angles, and so there was nothing to render anymore.

My question is -- do I have to establish faces/sides/etc in order for this to "just work", or is there a way to suss out which pairings should not be considered, without just excluding certain shapes from being rendered at all?

sentences:
Unity3d Run In Background setting not working in fullscreen standalone I've ran in to an odd issue with my Unity3D game completely pausing in certain scenarios, even with the Run In Background player setting on.

For reference I'm on Windows 7 Ultimate using Unity 4.3.3

In The Editor:
If I tab out of the editor while the game is running everything keeps working fine.

*In Windowed Mode:*
If I'm running the standalone in windowed mode and tab out, everything keeps working fine.

However, if I grab the top bar on the window to move the window around, the game pauses until I release the window. Nothing updates, nothing runs while it's paused.

In Fullscreen Mode:
If I'm running the standalone in fullscreen mode and alt+tab out the game pauses. Not resuming until I tab back in to the game.

This is causing issues with the multiplayer aspects of my game, because the client stops sending messages to the server whenever they alt+tab out or move the window.

I know the graphics device is getting lost when I tab out, because I get this error in my log:

  HandleD3DDeviceLost
    HandleD3DDeviceLost: still lost
  Skipped rendering frame because GfxDevice is in invalid state (device lost)

But that should only cause the game to stop rendering, which is fine. I just need the update loop to continue.

sentences:
Change color of a texture in a specific matrix location I have following bool matrix:

bool[,] centerPiece = new bool[,] { { false, true, false }, { true, true, true }, { false, true, false } };

Using a method, I put a texture down every time the boolean hits true. Is there a way for me to select an individual texture in the matrix and change it's color independently, without changing the others in the same matrix?

I'm aware I have to use the Color method to change the color,
and that to select a specific point in my matrix the syntax is along the lines of centerPiece[1,1], but the rest baffles me.

sentences:
Trouble with LineRenderer with orthographic camera in Unity When a weapon is fired, I want to draw a line for the bullet's trajectory.

I am using a LineRenderer to draw the trajectory with the code below:

    void FixedUpdate () {
        timer += Time.deltaTime;

        if (Input.GetButton ("Fire1") && timer >= timeBetweenBullets && Time.timeScale != 0) {
            Shoot ();
        }

        if (timer >= timeBetweenBullets * effectsDisplayTime) {
            DisableEffects ();
        }
    }

    void DisableEffects () {
        gunLine.enabled = false;
    }

    void Shoot () {
        timer = 0f;

        // Set first point
        gunLine.SetPosition (0, transform.position);

        shootRay.origin = transform.position;
        shootRay.direction = -transform.forward;

        gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
    }

I am using an orthographic camera in the scene. The line will show up but at certain rotations the line will partially render or be completely hidden. Oddly, the line will always render in the scene view-- the problem only exists in the game view.

Has anyone had this issue?

sentences:
Drawing a deferred decal when the camera clips its bounding geometry I have a building grid effect that I decal onto my terrain using a cube that moves to follow the cursor.

You can see if the camera gets too close to the cube, it gets clipped by the camera's near plane:

See the clipping just starting here:

I'd like to find a solution to this as the camera may be this low to the ground or lower upwards of 50% of the time during gameplay. (the rest of the time you would use the view from above, as illustrated by the clip I provided).
Is there any way to solve this problem?
I'd like to correctly render the cube's shader despite/while clipping with the camera.
is this possible and how?
.
.
.
EDIT & UPDATE :

I'm implementing camera-to-cubemesh clipping detection and already having issues :
public class Grid : MonoBehaviour
{
    #region
    [Header("First point to Camera Controller")]
    [SerializeField]
    public CameraController CameraController;
    MeshRenderer constructionGrid;
    private Camera cam;

    private void Start()
    {
        cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<UnityEngine.Camera>();
        constructionGrid = GameObject.FindGameObjectWithTag("GridViewer").GetComponent<MeshRenderer>();
    }

    void Update()
    {
        Plane[] frustumPlanes = GeometryUtility.CalculateFrustumPlanes(cam);
        if (GeometryUtility.TestPlanesAABB(frustumPlanes, constructionGrid.bounds))
        {
            Debug.Log("Clipping");
        }
        else
        {
            Debug.Log("Not");
        }
    }

This always logs "Cliping" whether clipping or not.
If I add a meshCollider to the shadercube the same happens but the shadercube jitters all over the place.
I can't figure out clipping detection.

sentences:
How do I pass an object location into a vertex shader? I am using Blender Game Engine. I want to create a large flat plane, and deform it locally near a moving object.

So far (despite being a beginner at shaders) I've written a vertex shader for the plane which moves the vertices to their correct positions (constant positions, for now).

I cannot find a way to swap that constant location with an object's location updated every frame, while the shader is running. I am not even sure if it's possible. I only want to access a specific object's center from the shader.

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:
Android Game Idea loop So I'm a beginner in developing android gaame. I already developed a game, it's intended for kids. Basically, the game has 4 stages. In each stage, it has 15 questions. If the user chooses the correct answer, he will proceed to the next question, otherwise, will be given 3 trials to choose the correct answer/object.

Below is the structure of my game:

Home
Menu
    >>> Stage 1 | Stage 2 | Stage 3 | Stage 4

Stage 1_1.class
Stage 1_2.class
....

Stage 2_1.class
Stage 2_2.class
....

Stage 3_1.class
Stage 3_2.class
....

Stage 4_1.class
Stage 4_1.class

I know it's very noob, that's why I ask for your help to translate this to a more consistent, and efficient game or just give me an idea. I want to put each stage's main loop only in ONE ACTIVITY. Help is truly appreciated. Thanks.

sentences:
How to program rules for card game Hi I want to program a card game,
in my game each card can do multiple actions, depend on the situation in which the player is facing.
For example There is an "Attack" card which can attack another player, the attacked player can defend itself in multiple ways - it can use "Run Away" card, it also may use another card to rule a cube to avoid the attack etc,
The "Attack" may also be used to shot an attacker to avoid dying.
In short each card can be used in all sort of ways and I'm having trouble to code these rules,
How can I create the session between 2 players? (attacker and defender)
thanks

sentences:
Can't use the hardware scissor any more, should I use the stencil buffer or manually clip sprites? I wrote a simple UI system for my game. There is a clip flag on my widgets that you can use to tell a widget to clip any children that try to draw outside their parent's box (for scrollboxes for example). The clip flag uses glScissor, which is fed an axis aligned rectangle. I just added arbitrary rotation and transformations to my widgets, so I can rotate or scale them however I want. Unfortunately, this breaks the scissor that I was using as now my clip rectangle might not be axis aligned.

There are two ways I can think of to fix this: either by using the stencil buffer to define the drawable area, or by having a wrapper function around my sprite drawing function that will adjust the vertices and texture coords of the sprites being drawn based on the clipper on the top of a clipper stack. Of course, there may also be other options I can't think of (something fancy with shaders possibly?). I'm not sure which way to go at the moment.

Changing the implementation of my scissor functions to use the stencil buffer probably requires the smallest change, but I'm not sure how much overhead that has compared to the coordinate adjusting or if the performance difference is even worth considering.

sentences:
Why are textures always square powers of two? What if they aren't? Why are the resolution of textures in games always a power of two (128x128, 256x256, 512x512, 1024x1024, etc.)? Wouldn't it be smart to save on the game's file size and make the texture exactly fit the UV unwrapped model?

What would happen if there was a texture that was not a power of two?

Would it be incorrect to have a texture be something like 256x512, or 512x1024? Or would this cause the problems that non-power-of-two textures may cause?

sentences:
Get next tile by given angle I am new to game development, and I have been building some game with LibGDX engine.

The following function might make you feel bad

The function I am going to show, is accepting the current rotation index of my player (player has 4 rotations, north, south, west, east). The function will return how much to jump in X to get the next tile according to his direction (angle) and the selected move (you can only select left, right or forward per turn):

public int getIncrementXForRotation(int rotationIndex) {
    switch(this) {
        case MOVE_FORWARD:
            switch(rotationIndex) {
                case Face.EAST:
                    return 1;
                case Face.SOUTH:
                    return 0;
                case Face.WEST:
                    return -1;
                case Face.NORTH:
                    return 0;
            }
        case MOVE_BACKWARD:
            switch(rotationIndex) {
                case Face.EAST:
                    return -1;
                case Face.SOUTH:
                    return 0;
                case Face.WEST:
                    return 1;
                case Face.NORTH:
                    return 0;
            }
        case MOVE_LEFT:
            switch (rotationIndex) {
                case Face.EAST:
                    return 0;
                case Face.SOUTH:
                    return 1;
                case Face.WEST:
                    return 0;
                case Face.NORTH:
                    return -1;
            }
        case MOVE_RIGHT:
            switch (rotationIndex) {
                case Face.EAST:
                    return 0;
                case Face.SOUTH:
                    return -1;
                case Face.WEST:
                    return 0;
                case Face.NORTH:
                    return 1;
            }
        case TURN_LEFT:
            switch(rotationIndex) {
                case Face.EAST:
                case Face.SOUTH:
                    return 1;
                case Face.WEST:
                case Face.NORTH:
                    return -1;
            }

        case TURN_RIGHT:
            switch(rotationIndex) {
                case Face.NORTH:
                case Face.EAST:
                    return 1;
                case Face.WEST:
                case Face.SOUTH:
                    return -1;
            }
    }
    return 0;
}

Same function for Y.

Now I looked at this, and i thought to myself.. north can be an 0, and east can be 90, and south can be 180 and west can be 270, am I right?

So there is a way to mathematically do these coordinate increment according to the angle, isn't there?

The reason I classified my player angles by `enums` is because each direction is an image.

sentences:
Drawing Lines on android with matrix Can a matrix be used when drawing lines and paths on android?

the DrawBitmap mathod takes a matrix as argument, I cannot find anything similar
when drawing lines.

sentences: How to keep Unity data after reinstall? After the use uninstall/reinstalls my app, all of his serialized data is gone. Is there a way to store a file on a mobile device permanently - which persists through various installs? Without using a server/cloud service or requiring the user to log into Google Play Games?

sentences:
Controlling Constantly Running AIs So, I'm not really sure where to start with this question. Feel free to tell me I'm stupid and Off Topic but I'd also like you to tell me why.

So, the maps in the game I am designing will consist of lots and lots and lots of voxels. Most of the voxels will just sit there and some of them will have methods run when they are touched or something happens around them. However, some blocks will constantly being doing something. Now, I'm not sure if I should have a array in every chunk (Group of voxels) that contains all the 'active' blocks or if there is another way. I know that some voxels will run code when they are loaded that makeup for all the time that they hadn't been doing anything but I may need to constantly run some voxels. (Machine that overheats or powers something can't just be loaded in 20 minutes after it blew up; or can it?)

So, now that that basic background is over, here is my question: Will an array storing all active entities in an area suffice as a way to run all the frame by frame methods of the blocks? Or is there a "normal" way to do this that I am unaware of?

EDIT: I just realized that the client that does rendering will not do a majority of the operations for the game engine. I will have a server that does it. The answer to this question is still largely relevant and helpful though. I just thought I'd mention my change.

sentences:
RayCasting picture noise render method I'm creating a RayCasting tutorial on github (click here to access it) and I'm following a lot of tutorials, implementations and other render methods in the web. One game made with it is the "Prelude of the Chambered" by Markus Persson. He made this game in 2 days with native programming.

My question is about the noise picture effect he used for rendering. I wanted to know how to do this, and if this has some render name. Check the image bellow and you will know what I'm speaking about:

If you check some render position you will find some noise pixels. What is the method to do this? This techique has some name?

Thanks a lot for help!

sentences:
Why does the location of my vehicle spawner change when I open a matinee? I'm doing work with InterActors and vehicle spawners in Unreal Tournament 3's editor, and have it set up like so:

(The Walkway its on is the InterActor)

However if I go in Kemsit and open the matinee that handles the InterActor, this happens:

It does look to me like the editor is moving it out of the way so I can see the InterActor (which would be very clever) because only the image of the vehicle moves, not the gizmo, nor does the vehicle spawn in that location in game.

Is this the case?

sentences:
The right way to add images to Monogame/Windows I'm starting out with MonoGame. For now, I'm only targeting Windows (desktop -- not Windows 8 specifically).

I've used a couple of XNA products in the past (raw XNA, FlatRedBall, SilverSprite), so I may have a misunderstanding about how I should add images to my content.

How do I add images to my project?

Currently, I created a new Monogame project, added a folder called "Content," and added images under there; the only caveat is that I need to set the Copy to Output Directory action to one of the Copy ones.

It seems strange, because my "raw" XNA project just last week had a Content project in it (XNA Framework Content Pipeline, according to VS2010), which compiled my images to XNB (I think). It seems like Monogame doesn't use the same content pipeline, but I'm not sure.

Edit: My question is not about "how do I get the XNA content pipeline to work with Monogame." My question is "why would I want to use the XNA content pipeline in Monogame?"

Because there are (at least) two solutions (that I see today):

Add the images to the Monogame project and set the Copy to Output Directory options to copy.
Add a XNA content pipeline project and add my images to that instead; reference it from my MOnogame project.

Which solution should I use, and why? I currently have a working version with the first option.

sentences:
Integration of gravitational interaction I don't know if this question get her place in physics.stackoverflow forum. I prefer post here, with code etc.
So, I want simulate 2D movements (no rotation) of an asteroid in space affected by a planet's gravity, the problem is how integrate that ?
Any better integration for performance ?
Here is the code in C:
struct vec2
{
  float x;
  float y;
};

struct body
{
  double mass; //kg
  struct vec2 prev_pos; //for semi-implicit euler method
  struct vec2 pos; //position
  struct vec2 v; //velocity
};

void move_asteroid(float dt) {
  //semi-implicit euler integration #1 -moving the object
  asteroid.pos.x += asteroid.v.x * dt;
  asteroid.pos.y += asteroid.v.y * dt;

  //START
  float x = planet.pos.x - asteroid.pos.x;
  float y = planet.pos.y - asteroid.pos.y;
  float d = x * x + y * y; //distance^2 between asteroid and center of planet

  //acceleration
  float ah = G * ((planet.mass * asteroid.mass) / d); //gravity

  //get components of gravity
  float rad = atan2(y, x);
  float ax = ah * cos(rad);
  float ay = ah * sin(rad);

  //semi-implicit euler integration #2 -update velocity
  asteroid.v.x += ax * dt;
  asteroid.v.y += ay * dt;
}

this is for 'fun' and sadly my knowledge is quite not good, I try to find with my vocabulary (not native english), if you have directions, ideas for better implementation (like study RK4 for correctness etc), it's welcome

sentences:
Spriter model not touching ground in? I was attempting to make a game in Construct 2 by using my Spriter Models plugin. However, when I imported the model, rescaled it & changed a few things, I got this:

As seen in the picture, the Spriter model is not touching the platform ground.

Do you know of any ways I could have the model touch the ground?

Thanks in advance,

Jamie

Ps. Here is the link to the files, just in case you guys might wanna have a look at it:

https://drive.google.com/folderview?id=0B11opD9YgSqWbVhaNEVTcGhIRTA&usp=sharing

Pps. You will need the Spriter plugin for Construct 2 to open the project file. The Spriter model files will need Spriter to open it.

sentences:
Why does glGetString returns a NULL string I am trying my hands at GLFW library. I have written a basic program to get OpenGL renderer and vendor string. Here is the code

 #include <GL/glew.h>
#include <GL/glfw.h>
#include <cstdio>
#include <cstdlib>
#include <string>

using namespace std;

void shutDown(int returnCode) {
    printf("There was an error in running the code with error %d\n",returnCode);
    GLenum res = glGetError();
    const GLubyte *errString = gluErrorString(res);
    printf("Error is %s\n", errString);
    glfwTerminate();
    exit(returnCode);
}

int main() {
    // start GL context and O/S window using GLFW helper library
    if (glfwInit() != GL_TRUE)
        shutDown(1);
    if (glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW) != GL_TRUE)
        shutDown(2);
    // start GLEW extension handler
    glewInit();

    // get version info
    const GLubyte* renderer = glGetString (GL_RENDERER); // get renderer string
    const GLubyte* version = glGetString (GL_VERSION); // version as a string
    printf("Renderer: %s\n", renderer);
    printf("OpenGL version supported %s\n", version);

    // close GL context and any other GLFW resources
    glfwTerminate();
    return 0;
}

I googled this error and found out that we have to initialize the OpenGL context before calling glGetString(). Although I have initialized OpenGL context using glfwInit() but still the function returns a NULL string. Any ideas?

Edit
I have updated the code with error checking mechanisms. This code on running outputs the following

There was an error in running the code with error 2
Error is no error

sentences:
Detecting collisions with a wall before Update I'm making a script in unity to control (movement) a character in 3rd person and 3D space.

For that I'm using the CharacterController component.

All pretty standard: inside the update method a Vector3 which will be passed to CharacterController.move is crafted based on the input and collisions, movement and jumping are perfectly fine but I ran into an issue when trying to make a wall jump.

There are 3 steps involved in this:

Get the wall to jump of.
Check if the player pres the jump button.
Move the player in the desired direction.

An this is how I'm doing it:

void OnControllerColliderHit(ControllerColliderHit hit) {
   if(mController.collisionFlags==CollisionFlags.Sides) {
       //Get wall normal
       wallNormal=hit.normal;
       isOnAWall=true;
   }
}

Now inside Update

if(Input.GetButtonDown("Jump")&isOnAWall) {
    //jump...
}

And this work fine in most cases but only if player is giving input or last wall has a similar normal as current so obviously the normal isn't refreshing properly, but why?

Well, after some testing, I discovered that the OnControllerColliderHitis called after the Update method, and this is what I think is happening:

Physics engine detect the collision and stops the player
Update method not having any input just send it downwards
The OnControllerColliderHit method is not triggered(this part I am
sure)

Are my conclusions correct?

How can I fix this? (make the player jump without need to move the stick and just with the button)

sentences:
Unity : control time interval when using getAxis() in bolt visual scripting i use bolt visual scripting. I add ‘input.getAxis’ in Bolt and set the axis name to ‘Vertical’ so to get response when i press ‘w’ and ‘s’. When running the game and press the ‘w’ key, the output data (acceleration) will increase from 0 to 1. The problem is the increasing time is too fast or too short. How to make it slower/longer? Let say i want it to take 3 seconds to reach 1.
Edit :
This is what i want to achieve  (at time 6:10 to 6:25) : https://youtu.be/m8rGyoStfgQ?t=370 And the code is at the same video at time 6:00 . That codes works perfectly fine. And this is all i want to achieve but i want to do it in Bolt (visual scripting) rather than manual scripting.
So that line of code at 6:00 on that video : Velocity = time.Deltatime * acceleration
That code is controlling how fast or slow the acceleration can go from 0 to 1 when pressing ‘w’ key. But in Bolt, i use ‘getAxis’ and by using default sensitivity setting, if i press “w” it will take less than half a second for the acceleration to go from 0 to 1. I want to make it slower so i can go from 0 to 1 in 3 seconds or 5 seconds.
In fact , this the same as setting up the sensitivity in input manager to low value, but i want to keep this setting as default and want to control it inside bolt.
Pls check my video here : getAxis

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:
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:
How can a one-man team create game audio? I am basically a 14 years game programmer.
I am using Unreal Engine 4.

I can't make a game without 3D models.
So , I started to learn how to draw (for reference images) and how to make some 3D models.
I am using Corel Painter and Blender.

I can't make a game without audio.
This is a much larger problem than the models' one.
There aren't high quality (or even low quality) tutorials that can teach you "How to make music for your game" or "How to make sound effects for your game"

I made a topic on Unity forums and they suggested to me to hire someone who can create the audio for me but I really want to make everything myself as the game I'm working on will not be published, it's just a 'showcase' for my programming 'skills'.

So, I need a program and maybe a MIDI controller that is user friendly like Ableton Push, for example, that I can use to create sound effects for my game like explosions, fire, engines' sound, ... etc. The Music isn't a much of a problem as I can use something like MAGIX Music Maker as it has user friendly interface and can create some really good music.

Thanks in Advance

sentences:
How to avoid Singleton/Statics/Injection in my puzzle game I am developing a puzzle game in java with swing.
Purpose of the game to find the  all the correct pairs on the board without ur lifes reaching 0 , preety simple etc.

I have a class My_Button which extends JButton.
My game consists of 6 type of Tiles (square , circle etc)
All these type of tiles extend My_Button class and implements my_Actions interf.
my_actions interface has some methods, not crucial for the question.
I have my_board class which holds arraylist with buttons , initializes buttons, fills the array , checks for validity between pairs , delete pairs etc.
It contains all the game functions in a way.

Now my main problem is the actionListener implementation and logic.
In my ActionListener in simple words i add the button that got clicked to a temp array and when 2 buttons got added to this array i do certain actions.
for example: (pseudo)

ActionListener{
my_board.posible_pair.add(this);
my_board.click_counter++;
my_board.check_game_state();
}

!check_game_state() runs if's and updates all the info of the game like: tries,score,check_valid_pair,delete etc.!

Now my thinking and my  question laid out:

First case:
If i make every Tile class implement actionListener like the example above ill have to make my_board singleton to be able to have acess to all this variables outside of the my_board class.

Second case:
even if i implement actionListener inside the my_board class and add the actionlistener through anonymous classes to my button after i add them to the board it gives error ofc because the scope gets weird.

Third case:
full static class and variables, its really bad programming so id like to avoid.

QUESTION:

--How i can reconstruct my project to manage these problem without singletons/static ?

--How i can avoid putting the check_game_state() inside the ActionListener which also is a bad practice?

I checked infinite number of qestions on this forum , google , stackoverflow but nothing really helps on the specifics.
I have developed simmilar games before but i always follow the singleton tecqniques and id like to change that.

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: What 3D engine should I use for the browser, iPhone, and Android platforms? I have a C++ game that has a 3D engine that works only in Windows. I'm wondering which engine I should use so that it can be used in a browser or in iPad (iPhone) and Android environments? Does anyone have an idea of the size of the task to migrate from one 3D engine to another?

sentences: How to play a movie on top of a webcam texture I've been through the Unity docs, searched here, and on stackoverflow; I have not found any good information about using the WebCamTexture for my purposes. So here goes, how do I play a movie asset such as an mp4 clip so that it appears to be on top of the captured webcam image? Lets assume the movie is semi-transparent.

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:
How can I consistently identify location on a mesh from a raycast hit? I am using RaycastHit.triangleIndex to identify a location on a mesh (very low poly). However, I have discovered that a given triangle on the mesh does not have the same triangleIndex value from one execution of the game to the next (index "1" maps to location "A" on the first run, but location "B" on the second run). It is consistent within a given game, but for my mapping to work I need it to be consistent across games.

Given that I am using Raycast, how can I consistently identify the same logical location on the model?

Notes:

The game object must be instantiated from a prefab (there are a variable number of them), so it could be that this is why the vertex order changes? Is there a way to instantiate with consistent vertex order?
If I need to ask the artist to recreate the asset with submeshes for each location, will I be able to consistently identify those?

sentences:
Using custom functions in HLSL shaders generates extra insructions? We use forward rendering so our main shader is pretty big (342 instructions). Recently I tried substituting every single custom function I call in the shader with the actual code from that function and the number of instructions generated dropped down to 311.

Am I doing something wrong with my custom functions? I tried passing variables into them with various predicates (in/inout/out/[nothing]) but it did not change the number of instructions even though Microsoft claims every instruction in HLSL is inlined.

UPDATE:
Example code:

void DirectionalLight(half4 Normal,
                half3 DirectionToCamera,
                half4 Combined,
                inout half2x3 light)
{
    half3 halfVector = normalize(DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    light[0] += DirectLight1.Color*lightParams.r;
    light[1] += DirectLight1.Color*litV.b;
}

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    DirectionalLight(Normal, input.DirectionToCamera, Combined, DirLightAccum);
    ...
}

Or this code:

half2x3 DirectionalLight(half4 Normal,
                half3 DirectionToCamera,
                half4 Combined)
{
    half2x3 light = (half2x3)0;
    half3 halfVector = normalize(DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    light[0] += DirectLight1.Color*lightParams.r;
    light[1] += DirectLight1.Color*litV.b;
    return light;
}

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    DirLightAccum += DirectionalLight(Normal, input.DirectionToCamera, Combined, );
    ...
}

Both generates 342 instructions. But the following code:

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    half3 halfVector = normalize(input.DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    DirLightAccum [0] += DirectLight1.Color*lightParams.r;
    DirLightAccum [1] += DirectLight1.Color*litV.b;
    ...
}

Only generates 339 instructions. Heavier functions (with more variables passed) generate more instructions. As I mentioned, when substituting ALL the functions with their actuall bodies I was able to reduce instruction count by 10%.

I tried making CastShadow a float function so that I can get rid of the "inout half shadow" argument but does not help.

I am just trying to figure out if it's a norm or I am doing something wrong?

sentences:
2D destructable terrain with collisions in MMO Task

What I want is to create destructable terrain (like in Worms) and collisions with this terrain (with calculated normals) that will be fast enough to work on server machine.

Basically lets say that I want to make Worms Online (I don't really) using model CLIENT-SERVER, not peer2peer.

Approaches I read about

People in other threads were suggesting using bitmaps and perpixel collisions, but is it fast enough to handle i.e. 100 games simultaneously?
Another approach is using vectors to track outline of terrain, but it seems also really CPU heavy and I didn't find any good example of that.

So guys what is your proposal?

sentences:
Need help with getting a direction vector between two given points I need to find the angle of rotation from a bullet traveling from point A to point B, like in my attached diagram. I tried searching, but I got a little lost in which exact formula to use.

I want to find the direction of a bullet, expressed as a vector with X and Y coordinates.

sentences: Can I programmatically generate textures in java? Is it possible to programmatically generate textures in Java, textures that could then be used to cover in game objects?

sentences: Infinite time of rotation I want the rotation of the sprite. So that I used RotationModifier, but in that I have to specify the time interval you want the rotation. But I want to create rotation which was infinite. So please help me.

sentences:
LWJGL MouseY Coordinates are flipped So I'm very new to using OpenGL and LWJGL, although I am proficient in Java itself.
One of the first things I read in the documentation of the Display class was that it maps the origin to the bottom left as opposed to how most other programs map it to the top left.

I was ready to take this into account until I discovered that the OpenGL libraries in LWJGL still map everything to the top left. It would also appear that the two spaces (window coordinates and game/OpenGL space) do not correspond to each other. ie. if I set a quads position to 10 x 10 via a mouse click in the lower left corner of the screen, it will move to what looks more like (windowWidth - 100, windowHeight - 100) or (100,100) using a standard top left origin.

I am attempting to write a 2D game using quads to draw my sprites, and I was wondering if there was a way to get the screen and game space to correspond.

Any help would be greatly appreciated,
Thanks!
Peter

Just in case it helps, here's how I'm creating a window and initializing OpenGL
Display

Display.setResizable(true);
Display.setDisplayMode(new DisplayMode(WIDTH,HEIGHT));
Display.setVSyncEnabled(VSYNC);
Display.setFullscreen(FULLSCREEN);

Display.create();

OpenGL

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0,Display.getWidth(),Display.getHeight(),0,1,-1);

    glMatrixMode(GL_MODELVIEW);

    glClearColor(0,0,0,1);

    glDisable(GL_DEPTH_TEST);

    glEnable(GL_BLEND);
    glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

sentences:
Determine Mesh Vertex Index Given Another Mesh Index Please bare with me as I explain what I am trying to accomplish :P

Each 'X' below represents a mesh vertex:

For my Unity3d GameObject (G1); the mesh vertices are stored in a C# List object in the following order. *Note the mesh index 'A'. This is a value I know - in this case A=16 (mesh index 16).

I have another GameObject (G2) whose shape is the same (a simple rectangle) but the mesh vertices are ordered differently.*Note the mesh index 'B'. This is a value I dont know and I want to find this value (mesh index) - in this case B=17 (mesh index 17).

As you can see the mesh arrangement is pretty much the same except rotated 90 degrees. If I know the 'mesh vertex index' of A how can I find the 'mesh vertex index' of B?

Whats an algorithm that can calculate the mesh index of B? My attempt is not working at all:

uint A     = 16;
uint nCols = 6;
uint nRows = 4;

// Technically both B and A sit on Row 3, Column 5 so if I can find A's row and column maybe I am there?
uint aCol = 16 / nCols;        // nup not right
uint aRow = (16 % nCols) - 1;  // gives 3

// Once I've calculated aCol and aRow its easy
uint B    = (aRow * nRows) + aCol;  // ie, (3 * 4) + 5 = 17

sentences:
Why does Resources.Load cause a CastException in this case? I am doing this:

string fontName = "freespin_big";

TextAsset xml = Resources.Load<TextAsset>(fontName);
Texture2D image = Resources.Load<Texture2D>(fontName);

Font font = Resources.Load<Font>(fontName);
if (font == null)
{
    font = new Font();
    AssetDatabase.CreateAsset(font, "Assets/Resources/" + fontName);
}

In Resources, we have freespin_big.png and freespin_big.xml. I am planning to import the png and xml and create a font. So I check if the font object is there, if not create it.

But I get this error if the font does not exist yet:

  InvalidCastException: Cannot cast from
  source type to destination type.

If I try to do this:

Font font = Resources.Load<Font>("blorg");

Where no files are named "blorg", I get null as I expect.

Shouldn't Resources.Load return null if it finds no fonts with the right name?

sentences:
Replacement for XNA? Since Microsoft stopped developing XNA I'm wondering what will be the replacement for the XBox 720°.
I've been wondering about this. XNA was THE technologie the XBox, easy and powerfull.

So is Microsoft developing a new technologie or are they going to continue XNA, even if they've said they'd stop.

sentences:
Averaging Camera Position I'm making a camera which tracks the player. I am using a basic algorithm to calculate a position for the camera relative to the player. Then I am taking an average of this over the last x number of frames. This creates a nice chase camera which always slightly lags and evens out the players movements.

Where I am running into trouble is with delta Time. How can I weight each entry in my list of previous positions so that delta time is taken into account. Currently I'm having an issue where, when the frame rate is particularly slow, the camera lags really far behind the player.

I should also mention that currently I am adding each entry ElapsedTimeInSeconds/0.01f times to give the weight. So the average is effectively over fewer frames if the frame rate is slow. I also tried entering values as Value * DeltaTime, then keeping an average of delta time to divide the values by when I get them back out of my average tracking class but that didn't work.

What I think I really want is an average over the last n seconds rather than the last n frames.

sentences:
What to pass to scripting I am using Java and libgdx to create a game and have decided to go a data driven approaching with Jython for this refactoring (just picked up Jython, have used Java for a while). The game is a turn/tile based game where each ability will store prototype values and references to other scripts to actually execute the mechanics. I am hardcoding basic mechanics such as changing health, moving units between tiles, placing (de)buffs on units/tiles, and turn order. Everything else will be handled in softcode like deciding where to actually deal damage for aoe, how much damage to deal, what the buff behavior is, etc. I understand ideally I would script the entire game, except for things like rendering and I/O. But this is a solo project, and I don't really care.

Previously in development I hardcoded all the abilities. When an ability was casted it would call a function with the targeted tile and the entire gameboard. The function would then find the proper locations/objects on the gameboard and manipulate their state directly. However, I recognize this is terrible design. I figure some sort of API system would be better. But I am unsure how to design it.

API gives references to the objects on gameboard and gamestate variables directly. Scripts can manipulate the objects. Seems straightforward, but unsafe with possible illegal operations like moving a piece to a location that does not exist. Scripts could also be written to error check, but that seems counter productive to the idea of scripting.
APIs only give values of objects and gamestates. This may cause the script to need many variables that are normally grouped into one object, or to reconstruct the object. Also API could pass a purely data object. API calls are then also used back to the hardcode to manipulate the object. Safer as hardcode could easier contain illegal operation checking and debugging. But I guess I should learn debugging in Jython also. Also seems like a high memory overhead and extra API calls.
A mix of 1 and 2. The APIs give scripts references to the objects directly, but the scripts can only get data out of the objects. Any manipulation must be done through an API call. So scripts could use getHealth(), but not setHealth(var). I have no idea of this is even possible. I like this solution the best, but it seems a little convoluted.

sentences:
Modular weapon in UE4 editor I want to create a modular weapon system. I already got most of it working, but I wonder how to make an improvement.

Weapons in my game have different firing modes (semi and auto) and "bullet" modes (projectile and hitscan). Each weapon is it's own blueprint, and there I can select proper one in editor, so for example an Uzi would be auto / histcan, while a rocket launcher would be semi / projectile. (the firing mode actor gets created at spawn from the class selected in editor).

I want to make it easier to edit by giving the weapon some variables, like spread and projectile blueprint. But not all of the variables apply to all the types of weapon...

TLDR:
Can I create / show different variables in the editor, depending on other variables? If I choose projectile type of weapon, can I also select the projectile type, but not show the option if I chose hitscan?

sentences:
Should I use an abstract class or function pointer to implement component notifications? I want to create a component-based game engine with subsystems which do the work, entities which are simply a list of components (plus position and rotation, because every object will have that), and data.

In addition I want the subsystem to create the components for the entity (the entity has a list of component types and the subsystem creates them). The subsystem has to be notified if an entity is added to the world. I think the best way is the observer pattern: my scene manager notify every subsystem.

This is where I got stuck. When the scene manager notifies, should this be a function pointer or a abstract system class with handle message? In the first case, how can I get this work with a variable count of parameters?

This approach with an abstract class is not my favorite, I think function pointers may be better. Consider this case: my position component will be edited from the position system, so my system or my component have to notify the render system.

Given my above requirements, what should I do to deal with these notifications?

sentences:
How can I detect if a gamepad stick has been pushed to the limit? As in the question, really. I want to be able to detect if a gamepad has it's analogue input pushed as far as it can go in any direction.

Given x and y axis values in the range [-1, 1] (-1 being left and down respectively), how can I account for all of the angles between horizontal and vertical, as this means that I can't simply check if abs(axis) == 1.

As I'm unaware of how it might affect it, the engine I'm using is UE4, so any answer could take that into account.

sentences:
Getting a TileMap wrapping as a toroid on player movement [libgdx version 1.9.13 - Desktop Game]
This question seems to have been asked many times, but I have yet to find a decent solution. I want to display a map without edges, where the player moves in all directions on a 'world' which is toroidal.
I load my tiles into cells of an OrthogonalTiledMapRenderer, which I then render. This gives me a map which draws in the game window - works fine - but it has edges. The player can walk up to the edge of map.
So my questions:

How do I get a tiled map to draw without edges (I.E. no background color around edge of tile map, as per attached screen shot, which shows character about to walk off the map)

How do I then make the map toroidal - so the player moves off left map edge and is moved to right edge. Same for top/bottom. I can set the players coordinates to do this, but screen 'jumps' to the other edge.

So if the player continually presses a single up/down/left/right key, eventually they will come back to their starting position.

sentences: SpriteKit Game State Management I've created a SpriteKit Mac OS X app and I am using a simple finite state machine to manage the game states. I've seen some solutions, especially for C++ games, where a GameState class and a GameStateManager class are used to regulate states of the game through the use of a stack of GameState objects. What I don't understand is what these GameStates objects would be in SpriteKit. Would they be separate SKScene nodes? How would I implement this into a SpriteKit game?

sentences:
Screen transition effect like subway surfers I would like to know how can I achieve this kind of screen transition effect ? The effect is screen independent.

https://www.youtube.com/watch?v=Muh7QFisCfE#t=01m57s

sentences:
Should all primitives be GL_TRIANGLES in order to create large, unified batches? Optimizing modern OpenGL relies on aggressive batching, which is done by calls like glMultiDrawElementsIndirect. Although glMultiDrawElementsIndirect can render a large number of different meshes, it makes the assumption that all these meshes are made of the same primitives (eg. GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_POINTS).

In order to most efficiently batch rendering, is it wise to force everything to be GL_TRIANGLES (while ignoring possible optimizations with GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN) in order to make it possible to group more meshes together?

This though comes from reading the Approaching Zero Driver Overhead slides, which suggests to draw everything (or, presumably, as much as possible) in a single glMultiDrawElementsIndirect call.

sentences:
How can I remove a sprite from the screen using pygame? I am having trouble with removing sprites on my screen using pygame.

I am killing my sprite with sword.kill which is removing it from an all_sprites group, so it should disappear right?

Here is where i blit my images:

def draw(self):
        for sprite in self.all_sprites:
            self.screen.blit(sprite.image, self.camera.apply(sprite))
        pg.display.update()

Here is my sword class:

class Sword(pg.sprite.Sprite):
    def __init__(self, game, x, y, entity):
        self.groups = game.all_sprites
        pg.sprite.Sprite.__init__(self, self.groups)
        self.game = game
        self.image = self.game.sword
        #self.image = pg.transform.scale(self.image, (TILESIZE, TILESIZE))
        self.image.set_colorkey(WHITE)
        self.rect = self.image.get_rect()
        self.x = x
        self.y = y
        self.rect.x = x
        self.rect.y = y
        if entity.direction == 'down':
            self.image = pg.transform.rotate(self.image, -90)

        def update(self):
            self.kill()

And here is where I create my sword object:

def get_keys(self):
        self.vx, self.vy = 0, 0
        keys = pg.key.get_pressed()
        if keys[pg.K_LEFT] or keys[pg.K_a]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vx = -200
            self.direction = 'left'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkleft[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_RIGHT] or keys[pg.K_d]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vx = 200
            self.direction = 'right'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkright[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_UP] or keys[pg.K_w]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vy = -200
            self.direction = 'up'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkup[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_DOWN] or keys[pg.K_s]:

            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.direction = 'down'
            self.vy = 200
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkdown[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_SPACE]:
            self.attack = True
            if self.direction == 'down':
                print(self.rect.centery)
                self.sword = Sword(self.game, self.rect.centerx-7, self.rect.bottom, self)
        elif self.vx != 0 and self.vy != 0:
            self.vx *= 0.7071
            self.vy *= 0.7071
            self.swing = False
        elif keys[pg.K_t]:
            self.x = 1 * TILESIZE
            self.y = 1 * TILESIZE
            self.swing = False
        elif self.attack and not keys[pg.K_SPACE]:
            self.sword.update()
            self.attack = False

Any help would be appreciated. Thanks!

sentences:
Mouse Interaction in 3D space (ray) I use this code

    public static Ray CalculateRay(Vector2 mouseLocation, Matrix view, Matrix projection, Viewport viewport)
    {
        Vector3 nearPoint = viewport.Unproject(new Vector3(mouseLocation.X,
                mouseLocation.Y, 0.0f),
                projection,
                view,
                Matrix.Identity);

        Vector3 farPoint = viewport.Unproject(new Vector3(mouseLocation.X,
                mouseLocation.Y, 1.0f),
                projection,
                view,
                Matrix.Identity);

        Vector3 direction = farPoint - nearPoint;
        direction.Normalize();

        return new Ray(nearPoint, direction);
    }

to calculate a ray for mouse position x;y.
But the result is everytime again NaN..
If I try it with .99f it works but the collision detection is not exact..
How can I determine whether the cursor hits and model in 3d space?

sentences:
Is it possible to make realistic animations in 2D? I plan to make a skateboarding game and I am wondering about one thing: is it possible to make 2D realistic animations to simulate skate's and skater's rotations or should I resort to 3D for realistic visual effects?

P.S: As you guess I am new to game development.

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:
How to import Cocos2d-x in codeblocks ide? Is it possible to import cocos2d-x in codeblocks just as in xcode ?? How can I do that ?

I use ubuntu. It is not possible to use xcode in ubuntu. Cocos2dx is in c++. How can I use codeblocks for game development with cocos2dx??

Thanks

sentences:
Box2D Qt wrong collisions I am working on a simple Box2D game (with Qt), but my objects don't collide correctly:

As you can see on the picture, objects try to go through each other and slide over.

My b2World:

b2Vec2 gravity(0.0f, -9.8f);
world = new b2World(gravity);

How I add objects:

b2BodyDef bodyDef;
if (dynamic) bodyDef.type = b2_dynamicBody;
bodyDef.position.Set(centerX, centerY);
body = world->CreateBody(&bodyDef);

b2PolygonShape box;
box.SetAsBox(width/2, height/2);

b2FixtureDef fixtureDef;
fixtureDef.shape = &box;
fixtureDef.density = 1;
fixtureDef.friction = 0.5;
fixtureDef.restitution = 0.2;
body->CreateFixture(&fixtureDef);

for drawing, ppm - pixel per meter, scene - QGraphicsScene, rect - QGraphicsRectItem:

rect = scene->addRect(getRect(centerX*ppm, centerY*ppm, width*ppm, height*ppm));

Function to get QRectF (it takes left and top coordinates, not center):

QRectF GRect::getRect(float32 centerX, float32 centerY, float32 W, float32 H)
{
    return QRectF(centerX - W/2, centerY - H/2, W, H);
}

And how I draw every object:

b2Vec2 position = body->GetPosition();
rect->setRect(getRect(position.x*_ppm, position.y*_ppm, _width*_ppm, _height*_ppm));
rect->setRotation(body->GetAngle());

I tried to play with density, friction and restitution values, but it has no effect. Help.
PS. Sory for bad English, I am from Russia

sentences:
Issue with importing model to xna I am creating a model with Blender which looks like this:

and I am importing it into an XNA project.
There seems to be some kind of transparency issue.
The model looks like that:

When the camera looks on one side, the side is not shown.
Why do I have this problem and what can I do to fix it?

PS: I am using a custom Effect but I don't think that the issue has something to do with that.

sentences:
Need a little more help with rotating sword around player (Unity 2D) this question is somewhat similar to my last question (found here). This time, I have upgraded to the new Input Manager and updated the script that uses the controller, but now I'm having trouble with having the sword rotate around the player and towards the mouse. The image below might help visualize this better.

Here's my current code:
public void Update()
{
    var gamepad = Gamepad.current;
    var mouse = Mouse.current;
    if (controllerControl)
    {
        x = gamepad.rightStick.ReadValue().x;
        y = gamepad.rightStick.ReadValue().y;
    }
    else
    {
        x = mouse.position.ReadValue().x; //Here's where I think the problem is
        y = mouse.position.ReadValue().y;
    }

    //convert the input into an angle in radians, and convert that into degrees
    float rads = Mathf.Atan2(y, x);
    float degrees = rads * Mathf.Rad2Deg;

    //use trig to position sword
    sword.localPosition = new Vector3(Mathf.Cos(rads) * distance, Mathf.Sin(rads) * distance, 0);
    //rotate to face away from center. note that the angle atan gives us is
    //oriented differently than unity's rotation, so we have to reverse it
    //and add 90.
    sword.localEulerAngles = new Vector3(0, 0, degrees - 90);
}

The boolean "controllerControl" will change based on which input device the player chooses. The sword is a child of a box object. If someone could point me in the right direction, that would be much appreciated.

sentences: Sound upsample using SDL We have managed to play audio files using SDL's Mix_PlayMusic function. The problem now we need to do some upsampling for one audio to match the other so that both have same duration. Any idea how to resolve this issue.

sentences:
How to remove the old sprites in pygame and show them at a different location I am trying to show the motion of some basketballs towards walle using the pygae sprites. The idea is that I don't know how to remove the old ones so they won't show. Is there a move method so that it would know it has to draw it again at the specified location?
I created a sprite class. Then I have a Character class that uses the sprite class and threads to calculate the intermediary coordinates for them. But I don't want them to show on the screen forever, like the pictures show.
Thanks!

 import pygame

 class CharacterSprite(pygame.sprite.Sprite):

   def __init__(self, location, image, surface):
       pygame.sprite.Sprite.__init__(self)
       self.image = pygame.image.load(image).convert_alpha()
       self.rect = self.image.get_rect()
       self.rect.center = location
       self.surface = surface

    def draw(self):
       self.surface.blit(self.image, self.rect)

   def update(self, location):
      self.rect.center = location
      self.draw()

import threading
import pygame
import os
from random import randint
from Sprites.CharacterSprite import CharacterSprite

LOCK = threading.Lock()

class StudentCharacter(threading.Thread):
   NRSTEPS = 3
   YPOS = 440
   TEACHERPOS = 40
   IMAGE_PATH = os.path.join('images', 'ball.png')

def __init__(self, screen, xpos, interval):
    threading.Thread.__init__(self)
    self.screen, self.xpos, self.ypos, self.interval = screen, xpos, self.YPOS, interval
    self.draw(self.xpos, self.ypos)
    self.configure()

def draw(self, x, y):
    self.circle = CharacterSprite([x, y], self.IMAGE_PATH, self.screen)
    self.circle.draw()

def configure(self):
    (left, right) = self.interval
    self.target = randint(left, right)
    xdif = self.target - self.xpos
    ydif = self.TEACHERPOS - self.ypos
    self.normal = {'x': int(xdif / self.NRSTEPS), 'y': int(ydif / self.NRSTEPS)}
    print self.target, self.normal['x'], self.normal['y']

def update(self):
    self.circle.update([self.xpos, self.ypos])

def run(self):
    i = 0
    while i < self.NRSTEPS:
        LOCK.acquire()
        pygame.time.wait(100)
        self.xpos += self.normal['x']
        self.ypos += self.normal['y']
        self.update()
        print self.xpos, self.ypos
        pygame.display.update()
        i += 1
        LOCK.release()
    print "Done"

sentences:
Errors attempting to use Assimp in DirectX 12 I am trying to load a 3D model within a DirectX 12 project by means of Assimp, but even when I write only the importer function, I get errors I can not fix. How do I fix this?

Here is my code:
void Model::LoadModel(const std::string& FileName)
{
    Assimp::Importer importer;

    const aiScene* scene = importer.ReadFile("coso.fbx",
        aiProcess_CalcTangentSpace |
        aiProcess_Triangulate |
        aiProcess_GenSmoothNormals |
        aiProcess_SplitLargeMeshes |
        aiProcess_ConvertToLeftHanded |
        aiProcess_SortByPType |
        aiProcess_PreTransformVertices);

    if (scene == NULL)
    {

    }
}

Here are the errors I get:

Error    LNK2001 unresolved external symbol "public: struct aiScene const * __cdecl Assimp::Importer::ReadFile(char const *,unsigned int)" (?ReadFile@Importer@Assimp@@QEAAPEBUaiScene@@PEBDI@Z) Model.obj   1
Error    LNK2001 unresolved external symbol "public: __cdecl Assimp::Importer::~Importer(void)" (??1Importer@Assimp@@QEAA@XZ) Model.obj  1
Error    LNK2001 unresolved external symbol "public: __cdecl Assimp::Importer::Importer(void)" (??0Importer@Assimp@@QEAA@XZ) Model.obj   1

sentences:
Unity - Mesh Deforms terribly while mixing animations I have a simple game I'm working on to help me learn unity3d. In my Start() function, I've used the following code to set up my animations.

        walkAnimation = animation["Walk"];
        walkAnimation.layer = 1;
        walkAnimation.blendMode = AnimationBlendMode.Additive;
        walkAnimation.enabled = true;
        walkAnimation.wrapMode = WrapMode.Loop;

        walkBackwardsAnimation = animation["WalkBackwards"];
        walkBackwardsAnimation.layer = 0;
        walkBackwardsAnimation.blendMode = AnimationBlendMode.Additive;
        walkBackwardsAnimation.enabled = true;
        walkBackwardsAnimation.wrapMode = WrapMode.Loop;

        TurnLeftAnimation = animation["TurnLeft"];
        TurnLeftAnimation.layer = 1;
        TurnLeftAnimation.blendMode = AnimationBlendMode.Additive;
        TurnLeftAnimation.enabled = true;
        TurnLeftAnimation.wrapMode = WrapMode.Loop;

        TurnRightAnimation = animation["TurnRight"];
        TurnRightAnimation.layer = 1;
        TurnRightAnimation.blendMode = AnimationBlendMode.Additive;
        TurnRightAnimation.enabled = true;
        TurnRightAnimation.wrapMode = WrapMode.Loop;

Each of them are declared before start like this

public AnimationState walkAnimation;

and I call them depending on the values of the control's axis, like such;

if(Mathf.Abs(Input.GetAxis("Rotate Player")) > 0){
                if (Input.GetAxis("Rotate Player") > 0){
                    animation.CrossFade(TurnRightAnimation.name, 0.2f);
                }

The problem is, The animations don't play, and when I turn while moving my character deforms gruesomely, his arms rise above his head and into his body, other parts grow, etc

I've been battling with mixing animations for the last two weeks, but I'm determined to get it right. If you know anything about this problem please don't hesitate to tell me what it might be. I created the model myself as well, all animations are on a single mesh, and I've tried to make the different animations affect different bones.

sentences:
Is it acceptable to use Hash Maps for input, copying one hash map to an another during the game loop? I recently started developing a simple 2D game in Java using JavaFX and no proper game library (libgdx etc.) and among the things I did was to make an InputManager to handle every input from the player.

In the InputManager I'm using a Hash Map, called inputMap, using a String as the key and a Boolean as the value. When the player presses a movement key, e.g. the UP arrow key, InputManager sets the value of the "UP" key of the map to "true". The game loop which also has a Hash Map, copies the map from the InputManager (via a getInputMap() method) to it's own map every frame and then using if statements the player moves.

My questions is, is this an acceptable way of doing this? The movement and every action in general.

Is there a better way of doing it without the use of Hash Maps or if Hash Maps are the way to go is there a better, more appropriate, way to implement them?

Below is the InputManager class:

class InputManager {

    private Scene scene;
    private Map<String, Boolean> inputMap = new HashMap<String, Boolean>();

    InputManager(Scene scene) {
        this.scene = scene;
        populateInputMap();
        getInput();
    }

    private void populateInputMap() {
        inputMap.put("UP", false);
        inputMap.put("DOWN", false);
        inputMap.put("LEFT", false);
        inputMap.put("RIGHT", false);
        inputMap.put("RESTART", false);
    }

    private void getInput() {

        scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent event) {

                if (event.getCode() == KeyCode.UP) {
                    inputMap.put("UP", true);
                }
                if (event.getCode() == KeyCode.DOWN) {
                    inputMap.put("DOWN", true);
                }
                if (event.getCode() == KeyCode.LEFT) {
                    inputMap.put("LEFT", true);
                }
                if (event.getCode() == KeyCode.RIGHT) {
                    inputMap.put("RIGHT", true);
                }
                if (event.getCode() == KeyCode.R) {
                    System.out.println("RESTART");
                }
            }
        });

        scene.setOnKeyReleased(new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent event) {
                if (event.getCode() == KeyCode.UP) {
                    inputMap.put("UP", false);
                }
                if (event.getCode() == KeyCode.DOWN) {
                    inputMap.put("DOWN", false);
                }
                if (event.getCode() == KeyCode.LEFT) {
                    inputMap.put("LEFT", false);
                }
                if (event.getCode() == KeyCode.RIGHT) {
                    inputMap.put("RIGHT", false);
                }
            }
        });
    }

    public Map getInputMap() {
        return inputMap;
    }
}

And this is the part of the Game Loop that the map gets copied:

private void updateGame() {
    frameCount++;
    inputMap.putAll(inputManager.getInputMap());

    if (inputMap.get("UP").booleanValue()) {
        y -= 5;
        player.setLayoutY(y);
    }

    if (inputMap.get("DOWN").booleanValue()) {
        y += 5;
        player.setLayoutY(y);
    }

    if (inputMap.get("LEFT").booleanValue()) {
        x -= 5;
        player.setLayoutX(x);
    }

    if (inputMap.get("RIGHT").booleanValue()) {
        x += 5;
        player.setLayoutX(x);
    }
    inputMap.clear();
}

I am aware that the movement part is not right.

sentences:
Jumping on meshes in Babylon.js So I want to make it possible for players to jump on objects (meshes) that are somewhat lower than the players camera.

I have set the checkCollisions to true but i can't seem to jump on any objects

(I'm using Babylon.js)

Here is my jump function

//Object i wanna jump on
var cube = BABYLON.Mesh.CreateBox("box", 10, scene);
cube.checkCollisions = true;
cube.position.y = - 4.5 ;

//Jump function
_playerJump : function(){
        $this = this;

        if($this.isJumping == false && $this.energy - 30 >= 0){
            var
                camera = $this.camera,
                jumpAnim = new BABYLON.Animation("jumpAnim", "position.y", 20, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE),
                keys = [],
                jumpStep;

            camera.animations = [];

            for(jumpStep = 0; jumpStep < 23; jumpStep ++)
                keys.push({frame: jumpStep, value: camera.position.y + jumpStep / 5});

            for(jumpStep = 24; jumpStep < 46; jumpStep ++)
                keys.push({frame: jumpStep, value: camera.position.y + 4.8 - (jumpStep - 24) / 5});

            jumpAnim.setKeys(keys);

            var easingFunction = new BABYLON.BezierCurveEase(.13,.01,.63,1.41);
            easingFunction.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEIN);
            jumpAnim.setEasingFunction(easingFunction);

            camera.animations.push(jumpAnim);

            $this.isJumping = true;

            $this._setEnergy(-30);

            $this.scene.beginAnimation(camera, 0, 46, false, 4, function(){
                $this.isJumping = false;
                $this.isCrouching = false;
            });
        }
    }

sentences:
Libgdx Scene2d and Box2d light Currently I am using scene2d and I want to implement shadows using Box2d light.
I want shadows under characters but when I draw something after render() , it draws nothing.
 For example, in draw() method of an actor,

    public void draw(Batch batch, float delta){
        super.draw(batch,delta);
        ray_handler.render();
        batch.draw(Something......)
    }

But when draw before render, it shows no problem.

    public void draw(Batch batch, float delta){
        super.draw(batch,delta);
        batch.draw(Something......)
        ray_handler.render();
    }

How can I solve this problem?

sentences:
Cocos2d When The Loading Screen Scene is loading music When the loading screen loads objects like music cutscenes, the idea is to preload the objects, so... what should happen next? Do I transfer the objects to the next scene? or these special objects, media objects or even just images of the sprites, do they have to be part of a Singleton? According to my logic, singleton is a simple solution, that can I use whatever was preloaded in the loading screen to take to the game. The only drawback is that I have to keep management of these objects to unload them when out of the game scene.(its just an example, but its really close to what my game is doing).

The thing is, i believe there is a more elegant solution to this problem. Anyone has any suggestions? or tell me if my method is wrong?

sentences:
Android differences (Dalvik+Java vs Old School C++) Developing in Android is going to be different for me, having spent the last 10 years coding games in C++. What's the main differences / pitfalls / bottlenecks to developing for the Android? My big worry is moving to Java, what am I going to miss most?

To be clearer: what would I miss if I coded the whole thing in Java compared to the way I normally code C++ for consoles?

sentences: Integrating a leader board with FaceBook? Think like how Bejeweled 2 does its Blitz mode where it connects to Facebook, pulls your friends names and their top scores for the week.  Are there any libraries, etc. that already help facilitate this process?  I would rather not re-invent the wheel if necessary.

sentences: How can I draw an animated vector field on a map? I want to render an animated vector field map similar to this wind speed visualization. How can I do this?

sentences: How to reset a Script? Is there a way where I can make the script restore its condition to that before I hit play? Should I create a new copy of the original script every time instead?

sentences:
Separate renderng thread in Android (OpenGL ES 2.0) I'm used to mainly working with the Canvas SurfaceView API on Android and have recently been learning openGL ES 2.0

With canvas I know that surfaceView gives you the ability to start a new thread to render on, but it doesn't specifically do this for you, so I was creating a new thread and managing that thread when the app was ended / paused etc....

However, from what I've read with glSurfaceView it seems that this is actually done for you automatically? Does this mean I don't actually need to manually create / start and manage my own rendering thread? (I'm talking specifically about a rendering thread (which could also be used for logic updates) which is separate the main UI thread.

Clarification on this matter would be greatly appreciated.

sentences:
Acceptable sound quality: stereo needed for an Android game? I have various simple short sound effects (damage sound, dying sound, thunderbolt, fanfare, breaking) for a game that is developed for Android currently.

I use OGG files: 96kbps VBR, 44.1KHz, 2 channels (that means stereo, right?).

I read the other stackexchange topics about "acceptable sound quality", but they're too general, address too many things. My experience is that even with 80kbps, my effects sound OK. But I tested it on a limited number of Android devices (including a Sony Ericsson Xperia Neo and a HTC Desire HD). My questions:

For mobile phones and tablets, generally, what parameters are recommended? Won't my 80kbps sounds be bad on a newer device (such as a modern tablet)?
I don't hear any difference between stereo and mono (2 channels vs. 1 channel, right?), is there any noticeable difference at all for mobile phones / tablets? (in terms of the player experience) May it worth it at all? I assume that stereo sounds take much more in memory (when they're decoded to PCM), despite of the fact that the compressed OGG size is practically the same.

Reacting to Roy T.'s great comment:

Actually, I couldn't measure the PCM size (Android decodes OGG
internally), but I thought that stereo will take more space than
mono when uncompressed
After throwing out one of the WAV channels in Audacity, and re-exporting it:

The new WAV file size is half than before
The OGG file size is practically the same as before

The sound effects and game music was recorded by my friend who is an experienced hobby musician/composer, but he knows little about computers & software so he just gave me some high-quality WAV files generated via his hardware.These were stereo, but if I check them in Audacity, both channels appear to be exactly the same.Can I consider them the same (=> moving to mono), or might there be some unnoticeable differences to the human eye?

sentences:
Simple animation text color change I apologize in advanced if this is a trivial ask, but I am wondering if it is possible to use an animation to change the color of a Text element from teal -> white without any lerp, i.e the color instantly changes. My current animation is only the one frame at 0:00 where I do the switch, but you can still see that the color is lerping even though it is the first and only frame. Am I missing something simple or should I just script the change? Fixing the problem is easy (Trivial to script), but I am just curious if there is something in the animation I can change to not have the color lerp?

I posted the question here as well, but I never have any luck posting on the Unity forums.

sentences:
Objects with custom shaders cast grayscale shadows when lightmapped Unity 5 seems to be able to calculate colored shadows from objects mapped with standart shader and legacy shaders.

What should I do to make my custom shader to cast colored shadows as well?

sentences:
Monster's AI in an Action-RPG I'm developing an action rpg with some University colleagues. We've gotton to the monsters' AI design and we would like to implement a sort of "utility-based AI" so we have a "thinker" that assigns a numeric value on all the monster's decisions and we choose the highest (or the most appropriate, depending on monster's iq) and assign it in the monster's collection of decisions (like a goal-driven design pattern) .

One solution we found is to write a mathematical formula for each decision, with all the important parameters for evaluation (so for a spell-decision we might have mp,distance from player, player's hp etc). This formula also has coefficients representing some of monster's behaviour (in this way we can alterate formulas by changing coefficients).

I've also read how "fuzzy logic" works; I was fascinated by it and by the many ways of expansion it has. I was wondering how we could use this technique to give our AI more semplicity, as in create evaluations with fuzzy rules such as
IF player_far AND mp_high AND hp_high THEN very_Desiderable
(for a spell having an high casting-time and consume high mp) and then 'defuzz' it. In this way it's also simple to create a monster behaviour by creating ad-hoc rules for every monster's IQ category.

But is it correct using fuzzy logic in a game with many parameters like an rpg? Is there a way of merging these two techniques?
Are there better AI design techniques for evaluating monster's chooses?

sentences:
Vector Art Tool: Size, Position, Shapes, Symbols I'm looking for a vector art tool for gameart, similar to Flash, but preferably free. It just needs the following capabilities:

Create vector images (can scale up/down without losing quality)
Specify shape X/Y to the pixel (eg. set the X to 24.1, like in Flash)
Draw primitive shapes (square/circle/triangle) with border and colour (or gradient)
Specify shape width/height in precise pixels
Export to PNG

Flash can do all this, but it's expensive (and heavy to install). Is there a free alternative that I can use?

This is NOT for pixely, pixel-style art.

sentences:
Why would you use a negative value for Bounding Box? I have the following code I'm working with in XNA from the book Professional XNA Programming.

It's just pong on a 2d screen plane.  We use bounding boxes for collision detection.  I'm just having trouble understanding why we would use a negative paddle size for the RedPaddleBox.  I read bounding boxes define the minimum and maximum corners of the box, but I'm not sure what that means--minimum in terms of coordinate values?  If so, why use a negative value when the paddle isn't partly off screen?

This is the code line that gave me trouble:

            new Vector3(-paddleSize.X/2,

in context of:

        BoundingBox leftPaddleBox = new BoundingBox(
            new Vector3(-paddleSize.X/2,
                leftPaddlePosition-paddleSize.Y/2, 0),
            new Vector3(+paddleSize.X/2,
                leftPaddlePosition+paddleSize.Y/2, 0));

in the following code:

        // Check for collisions with the paddles.
        // Construct bounding boxes to use the intersection helper method.
        Vector2 ballSize = new Vector2(
            GameBallRect.Width / 1024.0f, GameBallRect.Height / 768.0f);
        BoundingBox ballBox = new BoundingBox(
            new Vector3(ballPosition.X - ballSize.X / 2,
                ballPosition.Y - ballSize.Y / 2, 0),
            new Vector3(ballPosition.X + ballSize.X / 2,
                ballPosition.Y + ballSize.Y / 2, 0));
        Vector2 paddleSize = new Vector2(
            GameRedPaddleRect.Width / 1024.0f,
            GameRedPaddleRect.Height / 768.0f);
        BoundingBox leftPaddleBox = new BoundingBox(
            new Vector3(-paddleSize.X/2,
                leftPaddlePosition-paddleSize.Y/2, 0),
            new Vector3(+paddleSize.X/2,
                leftPaddlePosition+paddleSize.Y/2, 0));
        BoundingBox rightPaddleBox = new BoundingBox(
            new Vector3(1-paddleSize.X/2,
                rightPaddlePosition+paddleSize.Y/2, 0),
            new Vector3(1+paddleSize.X/2,
                rightPaddlePosition+ paddleSize.Y/2,0));

sentences:
Progression in a Sandbox Game (to xp or not to xp) I'd like to know the strengths and weaknesses of different progression methods through a game (or a part of a game), where they're suited best, and where they should never appear. I have several subsystems a player can progress through in a project I'm working on and I'd like to be able to work out if any of them would benefit from tallying xp. [Not sure why this is on hold, I'm asking about the concrete merits of things not simply asking everyone for their favourite??]

At the moment the player's character becomes more powerful by equipping better and better gear as they progress through randgen levels however they like, but are given clear indication that going in a particular direction will increase difficulty and the quality of items. I'm not sure in what circumstances I would add in xp for fighting monsters, or which I'd have the monsters drop good gear, or parts to make good gear out of. On top of that I have a magic system and a crafting system that I'm considering progressing though with xp but I wouldn't want to implement it if the side effects don't suit the rest of the game.

As far as I know games usually progress in the following ways, often in combination:

Level by Level: Like in old school Mario, you go through a sequence of levels which become more difficult and require you to master the basic techniques of game play.
Power by Power: You gain new abilities which makes it possible to access more and more difficult content. Metroid comes to mind for this.
Xp Growth: Your stats increase every level so you can fight the harder mobs in further content. You may or may not be able to choose where your stats go.
Xp Talent Tree: You get points to put into learning new skills, often from increasingly better pools of skills.
Item by Item: Equipment determines what content can be accessed next, either because the item unlocks something (including methods of transportation), or it increases player abilities such that they can survive certain areas. The distinct thing about items is that they can be removed from a player at pretty much any time. A grappling hook that can't be removed is a Power, not an Item.
Quest by Quest: Like Level by Level, only what triggers the newer content isn't getting to the end of a stage, it's the completing the requirements of a quest (explicitly stated or not). Zelda would be an example of a game that does both LbyL and QbyQ. Each dungeon is a level and between levels you have to do a bunch of little quests to unlock the next level.
Score: You just rack up points like in pinball, it doesn't really have an effect on the game.

If you have a clear idea of the underlying purpose of these or others, I'd like to hear it! At the moment I only know that these systems exist, but only vaguely what they're for.

As an aside, I'm also interested in your thoughts on how to display progression to a player. When is it best to give them numbers, if ever? Are visual/demonstrable displays preferred for certain things? What is the function of doing it one way or another?

sentences:
Unintended stuttering when moving camera I am using opengl and GLFW to make a rendering engine.

Things work per se, but there is some weird flickering happening when I move the camera.

Due the nature of the problem I need to link a youtube video:

https://www.youtube.com/watch?v=XhFrXadnWbs&feature=youtu.be

If you pay attention you will see the stuttering happening as I move the camera.

I beleive this problem occurs due to how I have implemented my camera movement, which is:

GLFW key callback:

#define CAM_SPEED 0.2f
void static key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if(key == GLFW_KEY_W)
    {
        c.translateForward(CAM_SPEED);
    }
    if(key == GLFW_KEY_S)
    {
        c.translateForward(-CAM_SPEED);
    }
    if(key == GLFW_KEY_A)
    {
        c.translateSideways(-CAM_SPEED);
    }
    if(key == GLFW_KEY_D)
    {
        c.translateSideways(CAM_SPEED);
    }
}

Camera code:

    void inline translateForward(float speed)
    {
        glm::vec3 hForward = forward;
        hForward.y = 0;
        hForward = normalize(hForward);

        position += hForward*speed;
    }

    void inline translateSideways(float speed)
    {
        position += side*speed;
    }

sentences:
How to implement back and forth steering behavior? I am trying to implement some behavior for a flying enemy in my 2D platformer.

The desired behavior is for the enemy to fly back and forth across the player, harrowing him.

If the player was standing still, the enemy would simply fly back and forth across the player, say 128 pixels to either side of him. If the player was moving, the enemy would adjust his movement accordingly. For example, if the enemy was heading left and the player was moving right and reached a sufficient distance from the enemy, the enemy would start heading to the right of the player.

I currently implement this using a simple seek steering behavior. I have the enemy seek toward a point a fixed distance to the left of the player. When he arrives at that point, I have him then seek toward a point a fixed distance to the right of the player. If the player moves, these points also move.

Further, as my enemy approaches these target points, I slow his velocity in proportion to his distance to the target. In other words, I have a seek-with-approach behavior.

There are problems with this method. For example, if the enemy is currently to the left of the player and is seeking the left target point, if the player then starts moving left, the target point will also move left and the enemy will never reach it. It will appear as though the player is simply chasing the enemy.

So my question is: How can I implement this kind of back and forth steering behavior, accounting for the fact that the target can move? Is there a simpler way that I am not seeing?

I work in Godot, but would prefer an engine-neutral answer.

sentences:
Calculating transform of arrow model pointing at some point in 3D space I'm working on a 3D flight game and I'd like to implement a simple "navigation arrow" pointing at the next waypoint in world which the player has to fly to.

I have position of both airplane (=camera) and the target and also orientation of the airplane (in form of quaternion). But sadly I can't figure out correct way to use them to get the arrow pointing at the target regardless the airplane yaw/pitch/roll.

The arrow was already working once, but only when the airplane was in horizontal orientation. But when the airplane was tilted, the tilt was not reflected in the arrow transform.

Here's my code (it might not be accurate, as I'm desperately trying anything that could help) to get the arrow rotation

Vector3 target = ...;
target.subtract(airplane.position);
target.normalize();

Vector3 dir = new Vector3(0, 0, -1); // initial airplane direction
dir.rotateBy(airplaneQuat); // current airplane direction

double angle = Math.acos(target.dot(dir));
Vector3 axis = target.cross(dir);

I think my problem is the fact that the airplane can fly upside down and in other riddiculous orientations, and I just cannot visualize all the transforms in my head.
I'll be happy for any help.

UPDATE:
Based on Cong's answer I came up with working solution. Here's the pseudocode. It could be improved, but the arrow behaves sufficiently accurate by now, just the way I indended.

Vector3 dir = target.position;
dir.subtract(airplane.position);
dir.normalize();

Quaternion q = airplane.orientation;
q = q.conjugate();
dir.rotateBy(q);

Vector3 up = Vector3(0, 1, 0);
Matrix4 mat = Matrix4.createLookAt(dir, up);

Matrix4 transform = Matrix4(); // identity
transform.translate(0, -0.85, 0); // move to the bottom of the screen
transform.mul(mat);
transform.scale(0.2); // just scaling the model

sentences:
If a 3d surface is occluded by another 3d surface, does this have any effect on the performance and rendering speed? We have a 3D character who is wearing a gauntlet on his forearm and visibility of which can be turned on and off. Would it be better to create two versions of arm, one without extra triangles that are hidden beneath the gauntlet? Or we can just one model with gauntlet as separate object which can be turned on and off ?

Does the hidden triangles have any effect on rendering or are they completely ignored by engine?

We are using Unity 3D.

sentences:
Instantiate random different gameObjects in specific spaces? I need to instantiate different gameObjects of different shapes and sizes on top of the left third and the right third of a table, and all this objects need to be random every time the scene loads. I have a library of around 80 GO but the most I'll instantiate, for now, is 30. All the instantiated GO have to be different, that means no duplicates.
I thought that maybe I could create 30 empty gameObjects on the table, where I want to instantiate them in random, but I'm not sure if this is the most intelligent way to do it. Is there any other way?
Also, since I have a library of GO so large, would it be possible to load the folder in the script instead of defining a list and populating it in the editor?
I'm a bit new at coding for Unity, but I'm an experienced programmer.

sentences:
Collaborative Diffusion vs. A* for loose armies combat: any clear winner? Collaborative Diffusion (CD) takes a lot of the work that A* does and combines (writes) it cheaply for multiple agents to read cheaply. This is because the majority of CD's processing works via a simple CA / diffusion approach that produces a single shared map for every agent to use on a given game update. Agents then perform hill-climbing within that space, which is also very cheap.

The primary downside is that the data structure created by CD must apply for all agents; that is, each agent's subjective view of the environment is identical; A* OTOH needs a path calculation per agent, each frame. In spite of this, the relatively low cost associated with CD would seem to make it, on average, a far more suitable approach than A*, even when we must create unique views for agents (comments / experience on this are welcome).

EDIT Consider the following example using Collaborative Diffusion:

Two armies are on a battlefield, each army emitting a uniform scent. They charge (climb the scent gradient), and as the two lines clash, each agent takes on the first, closest enemy agent on the opposing line. This happens because on each approach step for each unit, it checks whether it's yet adjacent to an enemy; if so it locks on / attacks indiscriminately. This is much freer than specific targeting, which is where A* would seem to be a better choice.

Am I correct in these assumptions? Are there other downsides to CD as opposed to [insert your flavour of] A*, for selecting ANY target between large groups?

sentences:
Turn based multiplayer, Google services or Parse or.. I have a turn based game on Google play already (paid with around 2000 users and free with around 50k).i am thinking of adding multiplier option to it. I am unable to progress because I don't know which path to take (given its my first multiplier game). I need your help

Like any turn based app, you have the concept of players joining in, rooms, scores and ranking (linking it with fb is preferred)
For my backend server, which option should I go with? Google play game services, Parse, AppWrap.. Etc or simply me use my website server and do the server code?

I am leaning towards Google Game services just because the infrastructure is there and it's free. But I don't find it to provide flexibility and control (such as using nicknames, listing rooms.. Etc)

I just heard about Parse so no experience

Any help or recommendations? Plzzzz need your advice

sentences:
How do I avoid Race Conditions in UnrealScript? I'm trying to create a pseudo turn based battle system in the Unreal Engine (think Final Fantasy style).

I'm trying to avoid the Enemies and the players attacking while another animation is in progress. I thought the most simple solution is to have a flag somewhere that the player controllers check before starting an animation, and set it to a value before they start, and then reset it when they've finished.

However, I could see this leading to race conditions if two controllers (AI or player) try to access the variable at the same time, then both start their animations.

If I was writing this in Java I'd obviously use synchronized methods, but I haven't come across anything like that in UnrealScript. Is there another way to avoid this? Its probably not the end of the world, as its a pretty unlikely occurance, but I'd like to try and avoid it completely if possible.

sentences:
D3D11 - Setting multiple ID3D11SamplerStates for the pixel shader stage once and leaving them be In my Direct3D 11 application, I am using several sampler states to retrieve texture data. Some of them are used in all pixel shaders, some of them are only used in very specific ones.

The question may seem simple, but I was not able to find any decent information on the topic-

Are there any penalties (performance or otherwise) involved in creating a number of sampler states for the pixel shader stage of D3D11, setting them all at once and just never touching them again? My shaders would reference these samplers in HLSL if they need them (for instance some shaders would reference SamplerState linear_sampler : register(s0); while some others would reference SamplerState point_sampler : register(s1);, possibly without referencing s0 at all.

Also, is it correct, that if I never want to reference these samplers in my c++ code after creation and setting, I could just release my own external references after they are set and they will not get destroyed, as D3D is keeping internal references as long as they are "bound"(?) ?
And even if had to somehow get a reference, I could simply use ID3D11DeviceContext::PSGetSamplers (of course accepting the involved performance penalty of the lookup), correct?

sentences:
OpenGL global/local states OpenGL has so many APIs which can modify different states. It's not so obvious whether an API has global effect or local effect.

For example, rumour says glTexEnv has global effect while glTexParameter has local effect (it only affects the current bound texture). Is this true? How to determine whether an API has global or local effect?

sentences:
How to create a "border" effect in Unity? Okay let me start off by saying I have searched for several days on this topic, and it seems that either nobody posted anything about it, or it is on the internet, but too far buried under piles of useless information for me to find. I have created a custom terrain algorithm in Unity and have built a parser to read provinces onto the map.

The short version description of the parser is that it goes into the assets folder, finds "map/provinces.png", reads the borders of the provinces as vertices, reads "map/height.png" to determine the height of the visual terrain, and reads "map/terrain.png" to determine how much of each province is of each terrain (for example, Paris can be 95% urban, and 5% forest in my setup).

I want to make each and every one of the 500 european provinces start with a player. The idea is that the players will fight small-scale wars for 30-40 turns, by which point most or all small players will be absorbed into the most successful players country. These will then fight for 60-80 turns for dominance, with alliances being forged and broken and countries being destroyed. The problem is described below;

Each player has his own unique color. Many of the players will obviously have similar colors, and I do not want 2 dark red countries bordering eachother without some easy way to see the border. I want to basically draw a line in between any two provinces that belong to different players and border each other. I am having trouble finding a way to easily do this, as my current solution tests all provinces if they border foreign provinces, and runs a rather expensive test on each of the bordering provinces vertices to see if they border eachother, then stores those vertices as vectors and draws a line from each vertex to its others.

I have considered using a shader to accomplish this, but was unsure if that was the right approach and whether or not that would (or could?) be more efficient.

sentences:
Simple 2.5D flight movement I'm building a simple 2.5D Dogfighting game, kinda similar like this one: https://gfycat.com/PleasantDeterminedArcherfish for the moment my movement works like this:

    if (Input.GetKey("left"))
    {
        transform.Rotate(0, 0, rotation);
    }

    if (Input.GetKey("right"))
    {
        transform.Rotate(0, 0, -rotation);
    }

    if (Input.GetKey("up"))
    {
        if (speed <= maxspeed)
            speed += speedIncrease;
        if (gravity > 0)
            gravity -= speedIncrease;
    }

    if (Input.GetKey("down"))
    {
        if (speed > 0f)
            speed -= speedIncrease;

        if (speed <= 0f)
            speed = 0;

        if (gravity < 1.0f)
            gravity += speedIncrease;
    }

    transform.Translate((Vector3.down * gravity), Space.World); //This is for the fake gravity
    transform.Translate(new Vector3(0, 1 * speed, 0)); //This applies the forward speed

I tried to create the gravity by myself, so that I would be able to lower the gravity, at higher speeds, so that I can achieve an "uplift" effect, like in reality. But now I wanted to let my model face the movement direction and all solutions, I found to solve this problem use the rigidbody.velocity, which is zero in my case. Is there another case to solve this problem? Or maybe even a better solution to achieve a similar movement like in the gif than mine? Maybe adding force instead of Translate?

sentences:
How do I fix this weird lighting problem? I'm making a small game in Unity, and some models are displaying very ugly shading.  The shading usually looks funky along the edges between triangles.  I'm pretty new to working in 3D; I bet this is an artifact of vertex lighting, but I'm not sure, and I'm not sure how to fix it.

Here you can see the worst example of this problem:

Low-quality lightmapping is visible in that shot, but I'm asking about the visible bands and weird shapes visible on the surface of the orange mesh in the foreground.  The mesh was built and UV-mapped in Blender, and is using a standard bumped diffuse shader.  There is a light behind and above the camera; all other lights in the scene are pretty far away.  What am I doing wrong, and how can I do better?

EDIT: Below is the wireframe for this model in Blender.

sentences:
Emissive material not casting light on itself in Unreal I have a static mesh that has an emissive material applied to part of the mesh. The emissive material successfully cast light to surrounding objects. However, the face of the mesh with the emissive material fails to cast light on the rest of the mesh.

This is how the unlit scene look:

The parts circled blue has the emissive material, and the sphere and cube are both lit by the emissive material. However, the part of the stairs (highlighted in red) does not get lit.

The lit scene:

Is there a way for the stairs to be lit by itself?

sentences:
how to apply a texture to a 3d scene background? i don't really know the exact term for that (i thought it was hdr but no...).

i want to put a texture as a background in opengl-es , and when we rotate the view , the background rotate too (obviously) but when there is translation , the background doesn't change.

like if i was inside a sphere and the texture are stick to it.

(and i don't think the sphere idea is the best way to do it).

I have certainly not explained the problem correctly , I'm sorry for that and thanks a lot if you understand me (even more if you have the answer :p)

sentences:
How to divide hex grid evenly among n players? I'm making a simple hex grid based game, and I want the map to be divided evenly among the players. The map is created randomly, and I want the players to have about equal amount of cells, with relatively small areas. For example, if there's four players and 80 cells in the map, each of the players would have about 20 cells (it doesn't have to be spot-on accurate). Also, each player should have no more than four adjacent cells. That is to say, when the map is generated, the biggest "chunks" cannot be more than four cells each.

I know this is not always possible for two or three players (as this resembles the "coloring the map" problem), and I'm OK with doing other solutions for those (like creating maps that solve the problem instead). But, for four to eight players, how could I approach this problem?

sentences:
How to know which child collider triggered in parent? I have parent object with 3 children. Each children has one collider (BoxColliders actually) marked as triggers each one.

I want to know in a OnTriggerEnter on the parent side which collider was hit.

Similar to this question: How can I determine which Trigger is hit?
But for 3D Colliders (not 2d). As you can see in the accepted answer they used  Collider2D.IsTouching but it doesn't seem to exist any analogue method for a 3D Collider

If is not possible, what other solutions are there? What would be the recommended way? I would like to avoid the overhead from methods like CompareTag and SendMessage if possible.

http://answers.unity.com/answers/1206114/view.html

sentences:
I started my journey this way, am I on the right track? I started my journey to learn games programming from the scratch (I'm a software developer but not in gaming field), I'm targeting iOS games development.

Currently I'm ready "O'reilly iPhone Game Development", then I'm considering reading "Apress Learn iPhone and iPad Cocos2D Game Development".

Am I on the right track? Should I read and learn OpenGL ES? If yes, when to start?

What is the Math type do I need for games development? Algebra and 2D Geometry?

Books like "Challenges for Game Designers" and "Game Design Workshop, 2nd Edition" are on my list also.

I really appreciate if you know a better path to follow.

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:
GameObject in hierarchy needs to know who it belongs to I have two objects from the same prefab. They have bodies and swords. What good options do i have to check if a sword belongs to player2 or player1?

For example when body registers that it has been hit by a sword i need to see if its the sword belonging to the enemy or the same body.

sentences:
The identifier is not in the scope! I have a typical foreach loop in a coroutine like:

    foreach (DLine LineItem in DLINEs)
    {
        GameObject NL = GameObject.Instantiate(DXFLine);
        NL.layer = LayerMask.NameToLayer("2D");
        LineRenderer NLLR = NL.GetComponent();
        NLLR.positionCount = (2);
        NLLR.startWidth = (0.01f); NLLR.endWidth = (0.01f);
        Color LineColor = new Color();
        DLAYER DL = TABLES.DLAYARs.FirstOrDefault(l => l.LayerName == LineItem.Layer);
        if ((LineItem.ColorNumber == -1395 || LineItem.ColorNumber == 256) && DL != null)
            LineColor = COLORs[DL.ColorNumber];
        else if ((LineItem.ColorNumber != -1395 && LineItem.ColorNumber != 256))
            LineColor = COLORs[LineItem.ColorNumber];
        if (LineColor == Color.clear) LineColor = new Color(1.0f, 1.0f, 1.0f);
            NLLR.startColor = LineColor;
        NLLR.endColor = LineColor;
>       NLLR.SetPosition(0, LineItem.StartPoint.ToVector3());
>       NLLR.SetPosition(1, LineItem.EndPoint.ToVector3());
        NL.name = "LINE-" + LineItem.Handle;
        NL.transform.SetParent(Lines.transform);
        DXF_Input.DXFLines.Add(NLLR);
        //Debug.Log(item.Log());
        Counter++;
        if (Counter == 50)
        {
             Counter = 0;
             yield return WFS;
        }
    }

and I want to debug it using Visual studio by putting breakepoint on the lines with '>'. I'm running unity and attaching the VS to unity and it stops at the breakpoint so there is no problem there. But when I want to see the values, it says the Identifier LineItem is not in the scope.
Why is this happening?
How can I fix it?

sentences:
Reused Avatar moves mesh I have a humanoid avatar and it's animation controller.
I also have two different human meshes, they're quite similar.
When I use the generic avatar and it's controller in the animator the meshes
shot out into the sky and perform their animation correctly.
The animations run normal they just move in weird directions and don't stay in their original locations.
How to fix it so the mesh doesn't move far away and retain original position?

sentences:
Normals vs Normal maps I am using Assimp asset importer (http://assimp.sourceforge.net/lib_html/index.html) to parse 3d models.

So far, I've simply pulled out the normal vectors which are defined for each vertex in my meshes. Yet I have also found various tutorials on normal maps...

As I understand it for normal maps, the normal vectors are stored in each texel of a normal map, and you pull these out of the normal texture in the shader.

Why is there two ways to get the normals, which one is considered best-practice and why?

sentences:
How to rotate to a target position over time I know how to do rotations to vectors, but how do I rotate over time?

For instance say I made a function

RotateTo(vec2 iPosition, float iTime);

so it rotates to iPosition over iTime - how would this look? Does anyone know simple algorithm?

sentences:
Swept AABB vs Line Segment in 2D I've been trying to get a swept collision detection up and running now for almost a week and I can't for the life of me get it working.

There is a answer on this linked here below:
Swept AABB vs Line Segment 2D
I've translated this into Go which will be running the game server and needs this logic:
func SweepRectLine(rectX, rectY, rectW, rectH, rectHSpeed, rectVSpeed, lineX1, lineY1, lineX2, lineY2 float64) (bool, float64) {
    outVel := [2]float64{}
    // hitNormal := [2]float64{}
    lineNX, lineNY := lineX2-lineX1, lineY2-lineY1
    // lineMinX, lineMaxX, lineMinY, lineMaxY := math.Min(lineX1, lineX2), math.Max(lineX1, lineX2), math.Min(lineY1, lineY2), math.Max(lineY1, lineY2)
    var lineMinX, lineMaxX, lineMinY, lineMaxY float64
    if lineNX > 0 {
        lineMinX, lineMaxX = lineX1, lineX2
    } else {
        lineMinX, lineMaxX = lineX2, lineX1
    }
    if lineNY > 0 {
        lineMinY, lineMaxY = lineY1, lineY2
    } else {
        lineMinY, lineMaxY = lineY2, lineY1
    }
    r := (rectW/2)*math.Abs(lineNX) + (rectH/2)*math.Abs(lineNY) //radius to Line
    boxProj := (lineX1-rectX)*lineNX + (lineY1-rectY)*lineNY
    velProj := rectHSpeed*lineNX + rectVSpeed*lineNY

    if velProj < 0 {
        r *= -1
    }

    hitTime := math.Max((boxProj-r)/velProj, 0)
    outTime := math.Min((boxProj+r)/velProj, 1)
    // log.Println("start", hitTime, outTime)

    rectXMax, rectXMin := rectX+rectW/2, rectX-rectW/2
    if rectHSpeed < 0 { // left
        if rectXMax < lineMinX {
            return false, 0
        }
        hitTime = math.Max((lineMaxX-rectXMin)/rectHSpeed, hitTime)
        outTime = math.Min((lineMinX-rectXMax)/rectHSpeed, outTime)
    } else if rectHSpeed > 0 { // right
        if rectXMin > lineMaxX {
            return false, 0
        }
        hitTime = math.Max((lineMinX-rectXMax)/rectHSpeed, hitTime)
        outTime = math.Min((lineMaxX-rectXMin)/rectHSpeed, outTime)
        // log.Println("right", hitTime, outTime)
    } else {
        if lineMinX > rectXMax || lineMaxX < rectXMin {
            return false, 0
        }
    }

    if hitTime > outTime {
        return false, 0
    }

    rectYMax, rectYMin := rectY+rectH/2, rectY-rectH/2
    if rectVSpeed < 0 { // up
        if rectYMax < lineMinY {
            return false, 0
        }
        hitTime = math.Max((lineMaxY-rectYMin)/rectVSpeed, hitTime)
        outTime = math.Min((lineMinY-rectYMax)/rectVSpeed, outTime)
    } else if rectVSpeed > 0 { // down
        if rectYMin > lineMaxY {
            return false, 0
        }
        hitTime = math.Max((lineMinY-rectYMax)/rectVSpeed, hitTime)
        outTime = math.Min((lineMaxY-rectYMin)/rectVSpeed, outTime)
    } else {
        if lineMinY > rectYMax || lineMaxY < rectYMin {
            return false, 0
        }
    }

    if hitTime > outTime {
        return false, 0
    }

    outVel[0] = rectHSpeed * hitTime
    outVel[1] = rectVSpeed * hitTime
    return true, hitTime
}

I also put up a Gist with a executable UI here: https://gist.github.com/KidLinus/3f847c46b0e6dc1addac7252d9cb54ab
I can't for the life of me figure out what all class variables stand for. I think that some of them are native to Unity but that's just a guess. I've come so far as to figure out that the extent is half of the width/height in said direction. What the "line.n" stands for is anyones guess, I assume its the direction and have no idea if it's normalized or not.
There are also a couple of dead variables just laying there.

sentences:
Web sites with famous game information? Is there any website containing informations related with some famous game? For information I mean how to calculate damage in a rpg for example, or how they've set camera and other tips like this!
Games I'm interested in are games like the legend of zelda, league of legends,tales of series, final fantasy, super mario, online mmorpg, halo, metroid, WoW, etc. and some indie games such as games on steam (spiral knights, bastion etc)

I think it could be usefull to have a reference based on games of a certain importance both for our games and for game development culture, in general. Thanks in advance

sentences:
Why isn't my aspect ratio calculation working on Android platforms? I have this method:

public final float aspectRatioHeight(float originalW, float originalH)
{
    float newHeight = (originalH / originalW) * (Gdx.graphics.getWidth()-20);
    return newHeight;
}

To calculate my an aspect ratio for the height of a sprite, but when i try run the app on an android device, the height still stretches out the app.

This is what im doing to set the size.

splashSprite.setSize(Gdx.graphics.getWidth() - 20, aspectRatioHeight(SW, SH) - 20);

sentences:
How can I attract & repel the mouse cursor from particular UI controls? This question came from some of my students. I wanted to share it here so others can find & improve on the solutions we've found so far.

In particular, my answer below doesn't behave as well as I'd like in windowed / editor mode - UI buttons no longer respond to hovering the cursor. I welcome alternative answers that solve this more completely.

We're making a visual novel game using the Fungus asset for Unity.

We want to add a twist where some dialogue options are easier or harder to press, because they attract or repulse your mouse cursor.

Unfortunately, we haven't been able to identify a cross-platform way to manipulate the mouse's position, nor a way to create a "Fake" mouse cursor image that can still interact with Fungus's UI buttons.

How can we pull this off?

sentences:
DirectX 11 - Get the world matrix of my camera I'm relatively new to the world of 3D games programming and I am not sure if I am understanding some key concepts correctly.

Right now I have created a sphere that is 2.0f in radius which surround the camera to act as a sky box ( I disabled culling to ensure that it did not block structutes in my world, and then turned culling back on once it was drawn ), its position is currently relative to the world, which is a problem.

The problem is that when I walk over terrain my camera exits the 2.0f sphere causing me to see the default black colored sky, in order to solve this I think I need to move the sphere relative to the cameras world matrix.

I currently have this function, which takes in the master WVP matrices with an output parameter for the cameras world matrix:

void Camera::GetWorldMatrix(D3DXMATRIX w, D3DXMATRIX v, D3DXMATRIX p,
                            D3DXMATRIX& camWorld)
{
    // How can I determine the cameras world matrix here?
}

How I get the cameras world matrix relative to the master world matrix?

sentences:
How can I create a dice toss that results in a specific value? I am trying to create a 3D dice for a game. Normal dice has been created by setting cube for dice with Rigidbody and apply force to throw a dice.

Now the problem is, the user wants to give a value 1 - 6 in the text box then they will press the roll button. The dice have to rotate and need to show the dice value as the user enters in the text field once it stops rolling.

For example:

In the Input box the value entered as 5,
Now the dice want to roll on the table and show the value as 5.

Anyone, please help me to solve this

Thanks in Advance

sentences:
Fade a texture effect as it nears the end of a cylinder mesh In my game I have a laser beam that travels for about 15m, but abruptly stops due to the mesh the texture is attached to. How can I setup my shader graph so that the end of the texture fades away? I can't find anything similar to this anywhere online, and have tried multiple things (gradient/colors with lerp attached to alpha) but just can't figure it out as I'm too new to the whole shader graph thing. Anything helps, thank you.
Note: The texture is 'animated' and scrolls along the path of the beam using the shader graph

sentences:
Moving camera along generated terrain? I'm generating my terrain on the GPU, using diamond square subdivision (no height map involved). How can I anchor the camera's position to always be on top of the generated terrain?

Thanks

sentences: Finding physical gamejams I'm interested in participating in some gamejams and was hoping to be able to attend one in person. Is there a way I could search for gamejams in the general Dallas area?

sentences:
Corona SDK, display.contentWidth and height does not get the expected values I'm drawing a simple rectangle to fill the entire screen.
local bg=display.newRect(0,0,display.contentWidth,display.contentHeight)

Instead of drawing a full screen rectangle, all i get is this:

How do i rectify this?

sentences:
Why is an empty Unity Iphone Build over 700 Megs? Is this Normal? So after 2 weeks of slaving over my first game I was finally done! I was entirely ecstatic....until I saw its file size.
770 Megabytes
For a simple numbers game, that was way too much and I created an empty unity project as a test and that was also over 700 megs
Why is an empty Iphone project this large?

sentences:
How do I detect collisions between a particle-based net and a ball? I've implemented a net using Verlet integration and many points connected with constrains; like this demo, but in 3D.

I want to implement collision detection between this net and a ball (like in a soccer game), so the net catches the ball.

I've tried checking for collisions between the ball and net points (treating each like a small sphere), and this somewhat affects the net, but the ball passes through the gaps between points easily.

How should I be approaching this?

sentences:
Animation fails due to a NullPointerException which I'm certain shouldn't be thrown (LibGDX / Java) What the title says basically. I've been stuck on this error for a few hours I got it to work earlier but I honestly can't see why its failing now (ctrl + z'd back to the working stage). Here's my code:

public class Animator {
    private Animation animation;
    private TextureRegion[] walkFrames;
    private TextureRegion[] jumpFrames;
    private TextureRegion[] enemyFrames;
    private Texture jumpSheet;
    private Texture walkSheet;
    private Texture enemySheet;
    private TextureRegion currentFrame;
    private Animation enemyAnimation;
    private Animation jumpAnimation;
    private Animation walkAnimation;
    private TextureRegion[][] animationType;
    private TextureRegion[] animateJump;
    private TextureRegion[] animateWalk;
    private TextureRegion[] animateEnemy;
    private GameObject object;
    private float stateTime;

    public Animator(GameObject object) {
        this.object = object;
        jumpSheet = new Texture(Gdx.files.internal("jumpsheet.png"));
        walkSheet = new Texture(Gdx.files.internal("walksheet.png"));
        enemySheet = new Texture(Gdx.files.internal("enemySheet.png"));
        enemyAnimation = animate(1, 4, enemySheet);
        jumpAnimation = animate(1, 7, jumpSheet);
        walkAnimation = animate(1, 4, walkSheet);
        stateTime = 0f;
    }

    public Animation animate(int rows, int cols, Texture spriteSheet) {
        TextureRegion[] frames = new TextureRegion[cols * rows];
        animationType = TextureRegion.split(spriteSheet, spriteSheet.getWidth()
                / cols, spriteSheet.getHeight() / rows);
        int index = 0;
        for (int i = 0; i < frameRows; i++) {
            for (int j = 0; j < frameCols; j++) {
                frames[index++] = animationType[i][j];
            }
        }
        animation = new Animation(0.25f, frames);
        return animation;
    }

    public void render(SpriteBatch batch) {
        stateTime += Gdx.graphics.getDeltaTime();
        if (object.getType() == ObjectType.PLAYER
                && object.getState() == ObjectState.JUMPING) {
            currentFrame = jumpAnimation.getKeyFrame(stateTime, true);
        } else if (object.getType() == ObjectType.PLAYER
                && object.getState() == ObjectState.NORMAL) {
            currentFrame = walkAnimation.getKeyFrame(stateTime, true);
        } else {
            currentFrame = enemyAnimation.getKeyFrame(stateTime, true);
        }
        batch.draw(currentFrame, object.getxPos(), object.getyPos()); // Null Pointer
    }
}

I get the NullPointer on the last line, and if I run in debug mode with breakpoints it tells me that currentFrame is null (at every stage of the if statement). Can anyone see why?

Any help is highly appreciated, thanks.

sentences:
Exported shapekeys to unity don't play correctly (unity 2019 + blender 2.79) Hopefully someone can shed some light on this

I select all relevant parts of the mesh and armature etc and export to FBX 7.4 for use in Unity3d The model itself displays fine and so does the armature animations but the shapekeys come out really weird.

Any ideas or do you need more info?

sentences:
Creating 2D waveform for Cocos2d game I'd like to have a Waveform in my iPhone game that I am developing using Cocos2d v2.0.

That's the ideal wave I'd like to achieve. A simpler wave which I would still be happy with is this one.

Some people suggested me to use ParticleEffects ands ParticleDesigners like 71squared but I am not sure that this is the right approach.

Brainstorming, I think that at the end a wave is a plot of some function, and at each frame translate the wave points that where from the origin apart (-x and +x) and computes new wave points for the origin.

Something like this:

for (duration of effect)
compute wave point intensity at origin and display it
and
for each wave point before the center translate to -x and display it
and after the center translate to +x and display it

Let me know what you think and if you have any better solution. I was thinking to achieve the display point by colouring a particular pixel but I need to figure out how :)..

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:
Make platform's visibility distinct from background I have a 2d infinite runner type game which background is changing its colors constantly. Meanwhile the color of the platforms stays the same. This way the platforms at some point(when their color is the same as the background's) become "invisible" for the player.

How can I creatively, shortly and conviniently avoid this problem with unity?

P.S. I've tried adding glossy material to it but it didn't work.

sentences:
In Unity, how can I render borders of provinces from a colored province map in a grand strategy game? I am kind of a beginner of Unity and I am trying do work on a grand strategy game. I already have a province map, colored by unique rgba for each province, looks like something below:

I know that the province map is kind of a look up map for province id. But when I obverse the paradox strategy games, I notice that they have render borders differently for the provinces and nations. For example, in the CK3, the Baron collars are separated with dotted lines, and the kingdoms are separated with enhanced yellow lines.

I thought they have some other maps or files containing those information, so I went to read their dev diary, and I find that all province shape information are stored in the province map.

So, my question is:

Is there any way in Unity3D to create those different borders with some shader and some province map such those given above?

I think what I wish to accomplish is something as this link:
Render border on 3D map

Which is:

sentences:
OnMouseClick not detected I created "main script" and in Start() created simple cube:

GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.localScale = new Vector3 (1,2,1);
cube.GetComponent<Renderer>().material.color = new Color(0,0,255);
cube.AddComponent<CubeScript>();

and then in CubeScript I have empty Start() and Update() but in onMouseDown() just Debug.Log("click detected");

and I can never see log despite clicking on cube.. Any advice? did I missed something?

sentences:
How can I insert random numbers in specific place in text of UI Text? I have a Canvas with Text and a Panel.
I want that it will show random numbers between 3 and 10 between the almost and hours:

  Hello my friend, It's about time to wakeup. You were sleeping for almost...hours. My name is NAVI and i'm your navigation helper in the game.

Sometimes when running the game I was sleeping for almost 5 hours and sometimes when running the game I was sleeping for almost 3 hours.

For example:

  Hello my friend, It's about time to wakeup. You were sleeping for almost 5 hours. My name is NAVI and i'm your navigation helper in the game.

Instead the 3 dots to add a random number.

sentences:
How to place rooms proceduraly (rule based) on in a game word I am trying to design the algorithm for my level generation which is a rule driven system. I have created all the rules for the system. I have taken care to insure that all rooms make sense in a grid type setup. for example: these rooms could make this configuration

The logic flow code that I have so far

Door{
    Vector3 position;
    POD orient;     // 5 possible values (up is not an option)
    bool Open;
}

Room{
    String roomRule;
    Vector3 roomPos;
    Vector3 dimensions;
    POD roomOrient;     // 4 possible values
    List doors<Door>;
}

LevelManager{
    float scale = 18f;
    List usedRooms<Room>;
    List openDoors<Door>
    bool Grid[][][];

    Room CreateRoom(String rule, Vector3 position, POD Orient){
        place recieved values
        based on rule fill in other data
    }

    Vector3 getDimenstions(String rule){
        return dimensions of the room
    }

    RotateRoom(POD rotateAmount){
        rotate all items in the room
    }

    MoveRoom(Room toBeMoved, POD orientataion, float distance){
        move the position of the room based on inputs
    }

    GenerateMap(Vector3 size, Vector3 start, Vector3 end){
        Grid = array[size.y][size.x][size.z];
        Room floatingRoom;
        floatingRoom = Room.CreateRoom(S01, start, rand(4));
        usedRooms.Add(floatingRoom);
        for each Door in floatingRoom.doors{
            openDoors.Add(door);
        }

//      fill used grid spaces

        floatingRoom = Room.CreateRoom(S02, end, rand(4);
        usedRooms.Add(floatingRoom);
        for each Door in floatingRoom.doors{
            openDoors.Add(door);
        }

        Vector3 nRoomLocation;
        Door workingDoor;
        string workingRoom;
//      fill used grid spaces

//      pick random door on the openDoors list
        workingDoor = /*randomDoor*/
//      get a random rule
        nRoomLocation = workingDoor.position;
//      then I'm lost
    }
}

I know that I have to make sure for convergence (namely the end is reachable), and to do this until there are no more doors on the openDoors list. right now I am simply trying to get this to work in 2D (there are rules that introduce 3D), but I am working on a presumption that a rigorous algorithm can be trivially extended to 3D.

EDIT: my thought pattern so far is to

take an existing open door
and then pick a random room (restrictions can be put in later)
place that room's center at the doors location
move the room in the direction of the doors orientation half the rooms dimension w/respect to that axis
then test against the 3D array to see if all the grid points are open, or have been used, or if there is even space to put the room (caseEdge)
if caseEdge (which can also occur in between rooms) then put the door on a toBeClosed list, and remove it from the open list (placing a wall or something there).
then to do some kind of test that both the start, and the goal are connected, and reachable from each other (each room has nodes for AI, but I don't want to "have" to pull those out to accomplish this).

but this logic has the problem for say the U, or L shaped rooms in my example, and then I also have a problem conceptually if the room needs to be rotated.

sentences:
How can I draw the depth value in GLSL? I want to draw the depth buffer in the fragment shader, I do this:

Vertex shader:

varying vec4 position_;

gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
position_ = gl_ModelViewProjectionMatrix * gl_Vertex;

Fragment shader:

float depth = ((position_.z / position_.w) + 1.0) * 0.5;

gl_FragColor = vec4(depth, depth, depth, 1.0);

But all I print is white, what am I doing wrong?

sentences:
When an animation involves movement, where is the movement better to implement? For context, I am using Blender and Unity. Regarding the question, as an example, in some games, when you get hit, your character tucks a bit and gets knocked back a few distance. The tucking animation I want to implement in Blender but how about the knockback distance? Do you move your model in Blender (tuck and knockback), or do you do the tuck animation only (tuck in place) and then handle the knockback in Unity (basically triggering the tuck animation and then moving the model backwards a bit).

My question basically is, what's commonly done and if there's any specific reason, why?

sentences:
Character bounces/stutters down hills I'm using Unity3D (not 4) and I'm experiencing a bit of a problem with character movement. I'm using a capsule as a First Person player with a camera attached to it. In this capsule is the stock ThirdPersonController script (with the animation parts removed). I know it's not conventional, but it's not the problem in this case.

The problem is when my character goes down hills, running or walking, it bounces down. It's as if it's going horizontally, then realising it's not grounded and then falling. It works fine going uphill but the downhill is driving me crazy.

One solution that may be possible is raycasting, I know what it is but I have no clue on how to use it.

sentences:
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:
How do I hide the camera object in Unity Editor I have 2019 Unity Editor
I have a huge camera object that is blocking all the other objects that I need to move in the scene,
I want to hide this object, but I cannot find a hide/show menu item anywhere or when I right click on the hierarchy

sentences:
Actor not taking touch libGDX I am trying to handle the touch of one of the Actors in the stage. The following is the code I have written:

public class MyGame extends ApplicationAdapter
{
    private GameStage gameStage; //Game stage is custom stage class.
    @Override
    public void create ()
    {
        gameStage = new GameStage();
        Gdx.input.setInputProcessor(gameStage); //Set the input processor
    }

    @Override
    public void dispose()
    {
        super.dispose();
        gameStage.dispose();
    }

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

        gameStage.act(Gdx.graphics.getDeltaTime());
        gameStage.draw();
    }
}

Now in the GameStage class:

public class GameStage extends Stage implements ContactListener
{
    MyActor myActor; //Custom actor object.
    public GameStage()
    {
        super(new ScalingViewport(Scaling.fill, Constants.APP_WIDTH, Constants.APP_HEIGHT, new OrthographicCamera(Constants.APP_WIDTH, Constants.APP_HEIGHT)));
        setUpWorld(); //Code to setup the world. added background and other actors. none of them are touchable.
        addActor();
    }

    private void addActor()
    {
        myActor = new MyActor(100, 100, 100, 100, 1000, 0);
        myActor.setTouchable(Touchable.enabled);
        myActor.addListener(new InputListener()
        {
            @Override
            public boolean touchDown(InputEvent event, float x, float y,
                                     int pointer, int button)
            {
                actorTouched(); //This method is not getting triggered becaused the call never comes in this function.
                return true;
            }
        });
        addActor(myActor);
    }
}

The custom actor class initializes the actor with a sprite image.

public class MyActor extends Actor
{
    public MyActor(int startX, int startY, int startWidth, int startHeight, int endX, int speed)
    {
        TextureAtlas textureAtlas = new TextureAtlas(Gdx.files.internal(Constants.ATLAS_PATH));
        TextureRegion[] runningFrames = new TextureRegion[Constants.MOVING_REGION_NAMES.length];

        for (int i = 0; i < Constants.MOVING_REGION_NAMES.length; i++)
        {

            String path = Constants.MOVING_REGION_NAMES[i];
            runningFrames[i] = textureAtlas.findRegion(path);
            if (horizontalMovingDirection == MovementDirection.Right)
            {
                runningFrames[i].flip(true, false);
            }
        }
    }
//code to draw and animate in a straight line by overriding the draw and act methods.
}

Am I doing something wrong here? Why am I not getting the touch in the actor?

sentences:
Libgdx Get Font Height with a Wrap is possible to get the 'Height' of a font drawed with the drawWrapped methods (with a wrapWidth) ?

getMultiLineBounds only works when \n is used, but when drawing with drawWrapped it doesn't give the right Height.

Text

String text = "hello this is very lonnnnng text without new line";
float wrapWidth = 100;

Display code :

 font.drawWrapped(batch, text, x, y, wrapWidth, alignment);

My 'get the displayed height code' :

 font.getMultiLineBounds(text).height;

Output :

 hello this is very
 lonnnnng text without
 new line

Problem :

How to have the total height of the displayed text by the methods : DrawWrapped

Can you help me please ? thanks you

sentences:
Is it a good idea to make a game for one aspect ratio and arbitrary screen resolution? After several very small games I have decided to make something more standalone (2D) and playable. However, I have met the problem of every game that is going to be played in more screen resolutions.

Basically, after some research I see that there are several solutions.

This seems to be the simplest one: Let's say I define a constant aspect ratio for the game (16:9) and the whole game will be created for a resolution 1680 x 1050.

The game will be rendered in this resolution and then I will be able to scale the render to match the player's display resolution. Therefore the game might be playable on almost any resolution, while it would keep the aspect ratio. So, if the game was run on 4:3 display, the top and the bottom of the display would be filled with black color.

It seems easy, but my question is - Is this a good approach for a simple game? The game will be simple, but I want to maintain high quality.

sentences:
What are some good MMO middleware server packages? If you have any experience with any MMO middleware packages and have any positive or negative experiences with them, your feedback will be appreciated.

Specifically I'm looking for server packages.  Price, functionality, speed, and ease of use would all be useful metrics to know about.

For example, doing some preliminary research has led me to some packages like Exit Game's Photon,  RedDwarf Server, and SmartFoxServer.

sentences:
Scrolling background in PyGame with Entity Component System I know this type of question has been asked to death for 'normal' games, however I am struggling with relating a scrolling background to an entity component system (ECS) approach.
Generic samples here and here and here.
What I struggle with is how to take a fairly procedural view of this problem and abstract it out to an ECS.  I'm trying to get a roguelike game up and running in PyGame using Esper.  I do have a proof of concept up and running where I generate a large map, however I'm having issues relating how to add a camera here as an entity that other objects would relate to.  I'm guessing that I need to refactor my movement code to be based around a camera, and have each separate entity update their relative position as a result.
At present, the background is being directly drawn and needs to be abstracted to an Entity in this system, but I was somewhat holding off on that until I figured out the camera.  Here is a snippet of the Renderable class that each drawn entity has:
class Renderable:
    def __init__(self, image, posx, posy, depth=0):
        self.image = image
        self.depth = depth
        self.x = posx
        self.y = posy

        self.curr_row, self.curr_col = convert_to_cells(posx, posy)

        self.w = image.get_width()
        self.h = image.get_height()
        self.rect = pygame.Rect(self.x,self.y,self.w,self.h)

And here are the Movement processor and Render processors:
class MovementProcessor(esper.Processor):
    def __init__(self, minx, maxx, miny, maxy, game_map):
        super().__init__()
        self.minx = minx
        self.maxx = maxx
        self.miny = miny
        self.maxy = maxy
        self.game_map = game_map

    def process(self):
        # This will iterate over every Entity that has BOTH of these components:
        for ent, (vel, rend) in self.world.get_components(Velocity, Renderable):
            # Check if movement is valid:
            newx = rend.x + int(vel.x * TILE_SIZE)
            newy = rend.y + int(vel.y * TILE_SIZE)
            new_row, new_col = convert_to_cells(newx, newy)

            if self.game_map.data[new_row][new_col] > 1:
              # Update the Renderable Component's position by it's Velocity:
              rend.x = newx
              rend.y = newy
              rend.curr_row = new_row
              rend.curr_col = new_col

class RenderProcessor(esper.Processor):
    def __init__(self, window, clear_color=(0, 0, 0)):
        super().__init__()
        self.window = window
        self.clear_color = clear_color

    def process(self):
        # Clear the window:
        self.window.fill(self.clear_color)

        # This will iterate over every Entity that has this Component, and blit it:
        for ent, rend in self.world.get_component(Renderable):
            self.window.blit(rend.image, (rend.x, rend.y))

        # Flip the framebuffers
        pygame.display.flip()

Later on in my main loop I iterate over my tilemap (Map class) and simply draw it to a surface, add some debugging overlays, and then assign that surface to the entity associated with the background (bg_entity):
        # Blit background directly -- this needs to be abstracted out
        for row in range(len(game_map.data)):
          for col in range(len(game_map.data[0])):
            rect = pygame.Rect(col*TILE_SIZE,row*TILE_SIZE,TILE_SIZE,TILE_SIZE)

            # Blit a wall sprite
            if game_map.data[row][col] in [0,1]:
              bg_surface.blit(walls[game_map.data[row][col]],rect)

            # Blit a floor/grass sprite
            elif game_map.data[row][col] in [2,3,4,5]:
              bg_surface.blit(floors[game_map.data[row][col]-2],rect)

Here is the full listing:
https://pastebin.com/N7c4TXXB

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 make TEXT RENDER stand facing the camera of my character and also for the camera of simulation? I have an actor (Minion) with a Text Render just above it mesh:

As you have seen, I defined your rotation as absolute, so the text does not rotate along with the actor.

In the game the rotation setting is good and acceptable at various times:

At other times it is very bad:

An example of what I want is something like the life of the champions in the League of Legends:

I would also like to know how to do this when I am simulating:

I've made some attempts at the camera of my main character. And I got some of what I tried.

Character Blueprint:

I know I could put on the Event Begin Play because the camera does not rotate.

Minion Blueprint:

I did (partially):

Ignoring the fact that the text is inverted. I tried Split Struct and added 180 to each of the 3 axes (ROLL, PITCH, YAW) and I could not solve it anyway.

Simulating nothing works:

EDIT 1 (Attempt made based on a_rrat's answer)

Blueprint:

I think I tried all the combinations and none worked the way I would. The combination defined in the image made the Text Render spin.

EDIT 2 (Correction of the attempt I made wrongly)

Correction that I did:

With the answer I was given I noticed a marked improvement.

Result 1:

Besides the value is no longer inverted.

Result 2:

But I still have not got what I like.

Result I am looking for:

I wish life would be displayed the same way anywhere on the map the character is on.

EDIT 3 (Removing roll)

Blueprint:

In game there was no difference.

EDIT 4 (Trying to explain what I want to happen)

I think that because I can not speak English and have to use programs to translate things for myself, I do not know the best way to explain my doubts, the best words, among other things.

I think the best way then to try to explain what I want is with images.

I want regardless of the location or angle life is seen in the same way.

Image:

Image:

Image:

In the LEAGUE OF LEGENDS anywhere on the screen that the champion is, the life bar appears the same way. I would like to achieve this result.

sentences: If two objects interact, what holds the interaction code? Think of a bullet and an enemy, or the player and the floor. If these objects interact, what holds the interaction code?

sentences: Unreal Engine 4 DefaultInput.ini mappings not showing in editor The mappings from DefaultInput.ini are not showing up in the editor. I had originally added them in the editor project settings, but it lost the mappings except for 2 of them Jump and Reset VR. They still show up in the DefaultInput.ini file. How do I get the editor to recover them (or read them from the .ini file?

sentences:
Free scripting in Construct 2? In Construct 2 example about creating an animated player, they used more than 8 events:

4 events to store movement direction into Direction variable from Player.8Direction.MovingAngle

4 events to select animation based on Direction value

1 event to stop animation

Apparently if would be much easier to do the same with simple if-else code with 4 or 5 cases. Is it possible in Construct 2?

UPDATE

I didn't find scripting, but was able to express the same example in more condensed way:

All names are from example.

sentences:
Straighter SLERP/LERP I am debugging my Lerping to see how it works. It is rotating a card and it looks good. However the lerping contains way beyind the card is visually done rotating. I understand it has to do with the mathematics. Is thera a way i can fix it? Is it unavoidable with Lerp/Slerp? Basically what i want is the function to be done when the card has rotated enough so that steps are no longer visible.

public IEnumerator LerpRotationY (float durationSeconds, FlipsSide flipSide)
    {
            int targetAngle = FlipSideEnumToDegrees (flipSide);

            //float flipSpeed = 3F;
            var flipRotation = Quaternion.Euler (0, targetAngle, 0);
            float t = Time.deltaTime;
            var cardRotation = cardSides.rotation;
            var timePassed = Time.time;
            print ("SLERPING! ");
            while (t < durationSeconds) {

                    cardSides.rotation = Quaternion.Slerp (cardSides.rotation, flipRotation, t);

                    yield return null;
                    t += Time.deltaTime;
            }
            print ("SLERPING FINISHED: " + (Time.time - timePassed).ToString ());}

sentences:
Rotate GameObject on click I'm trying to get a card to flip when clicked but the flipping only works the first flip. While debugging, I can see that OnMouse is called every time I click.

public class CardController : MonoBehaviour
{
   bool isShowingFront = true;
   bool isFlipping = false;
   float speed = 0.005F;
   Quaternion flipRotation = new Quaternion (0, 0, 0, 0);
   // Use this for initialization
   void Start ()
   {

   }

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

      if (transform.rotation.y != flipRotation.y) {
             transform.rotation = Quaternion.Lerp (transform.rotation, flipRotation, Time.deltaTime * speed);
             isFlipping = true;
      } else {
             isFlipping = false;
      }

   }

   void OnMouseUp ()
   {
      if (isShowingFront) {

             flipRotation.y = 180;

      } else {
             flipRotation.y = 0;
      }

      isShowingFront = !isShowingFront;
      Debug.Log ("I was clicked");
   }
}

sentences:
Unity wheel collider extra camber angle I want to give the value of a camber to the wheel collider my game. When the car stops, there is no problem visually, but as the wheel rotates, the wheel makes odd rotational movements together with the value of camber.
foreach (var axle in axles){
    Vector3 pos;
    Quaternion rot;
    axle.wheel.GetWorldPose(out pos, out rot);
    axle.tire.position = pos;
    axle.tire.Rotate(axle.wheel.rpm / 60 * 360 * Time.deltaTime, 0, (camperValue * camperFactor));
    axle.tire.localEulerAngles = new Vector3(
         axle.tire.localEulerAngles.x,
         axle.wheel.steerAngle - axle.tire.localEulerAngles.z,
         axle.tire.localEulerAngles.z);

    axle.wheel.motorTorque = 300 * Input.GetAxis("Vertical");
    if (axle.index < 2)
        axle.wheel.steerAngle = 30 * Input.GetAxis("Horizontal");

    axle.wheel.brakeTorque = 1000 * (Input.GetKey(KeyCode.Space) ? 1 : 0);
}

sentences:
OpenGL ES 2.0 Point Sprites Size I am trying to draw point sprites in OpenGL ES 2.0, but all my points end up with a size of 1 pixel...even when I set gl_PointSize to a high value in my vertex shader.

How can I make my point sprites bigger?

sentences:
Movement within a circle, but the circle bends around obstacles? I wish I knew a better way to phrase this, but I want to make an object move from point to point inside a circle. But I also want that "circle" to bend around obstacles, so that no matter what path the object takes inside the circle, the maximum distance traveled remains constant.
To try and simulate what this shape might look like, I wrote a simple program that creates random lines from a center point to the edge of a circle that represents the maximum distance. If the line collides with an obstacle (represented by a smaller circle), it randomly changes direction until it no longer collides. Some of these lines get all the way around the obstacle, but leave a "shadow" behind the obstacle. So far, it looks like the size of the shadow is about equal to the size of the obstacle, but I'm not a good enough mathematician to prove it, or even to know how to describe this problem better.
Here is an image from my program so you can get some idea of what I'm talking about.

This problem might be similar to that of calculating what's visible from a point, but I want the unit to be able to move behind the obstacle, so I think it's a little different.
EDIT: The shape reminds me of a cardioid.

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: Is OpenGl still supported in C? I'm reading the OpenGl superbible 3th edition (well I plan to) and it's all in C. Since this book was written in 2004 and all the other later versions are written in C++, i was wondering whether or not OpenGl is still supported in C, and whether the relevant downloads required will still be available. I want to do it this way, because I'm more comfortable with C, and I'm still learning C++.

sentences:
Calculating the angular direction from velocity I'm trying to calculate the angular direction of a projectile, knowing it's X and Y velocity I can find the magnitude of its movement, but I'm having a hard time wrapping my mind around getting the angular direction (in radians) that it is moving...

I assume there is a tan or a sin involved, but I'm a bit clueless otherwise...

sentences:
Sound effects system design I'm creating a RPG/RTS game in Unity. There are a lot of characters and potentially a lot of different environments. I'm fairly confident with the coding part (so this question isn't really tied to the game engine). I also create music myself (solo work, pad-based live drums in a band, mixing for friends, etc), so I think I have a pretty good grasp of all the neccessary tools. However, I've never created sound design for a game, and I don't really understand how to do that.

How would you organize and use sound effects? For example, you have 5 different character types and 3 different grounds — grass, mud and wood, for example — would you create 5*3 footstep sounds? Is adding random pitch for variety to a sample a good idea? What about environment sounds — do you create a main loop you just launch on the background, or do you place real sounds (water, wind, tree barks moving, birds) all over the game level?

Overall, I just have too many of this stupid random questions because I don't quite understand how this system should be designed; I would be very thankful if someone gave me a link to some sort of a guide or an article on the matter.

sentences:
Using fully cropped sprites with TexturePacker and Cocos2d When using texturepacker, you can set your trim-mode to crop. This is nice, because when a sprite loads in cocos2d your bounding box will only be the visible area of your sprite - which is useful for things like collision detection etc.

However, if you have a complex animation - say a warrior with a sword, there is a good chance that the visible rect of your sprite is changing with each frame. For example, when the sword swings backwards or forwards your sprite width would adjust.

Cocos2d seems to handle this in a less then ideal way - when the dimensions change the sprite seems to dance around, rather then anchoring to centered point. In an engine I wrote, I handled this by using a set anchor point and direction for an animation. So if an animation got wider you could make sure it extended in a given direction (for example, a punch would extend in one direction, rather then appear to push the sprite backward from the fist)

Does cocos2d have any mechanism for handling this? I looked at anchorpoint, but it doesn't seem to handle this scenario.

sentences:
How to solve the ground check problem? I noticed a problem in Unity's third person controller's ground check.

The ground check should detect whether or not the player is standing on the ground. It does so by sending out a ray beneath the player.

However, if the player stands on top and in middle of two boxes and there is a space between these boxes, then the ray shoots into the gap and the player thinks he is not in contact with the ground, which looks like this:

I am unable to move.
You can clearly see that the ray is in the gap and thus the player animator airborne blend tree is active.

What is the best way to solve this problem?

I was thinking of shooting multiple rays, from the same origin but with different angles. And OnGround should only be true, if X% of these rays hit the "ground". Or is there a better way?

sentences:
Effective AI for 3D Motion I am developing a game in XNA and am trying to create an effective AI for the enemy and friendly spaceships but am having a hard time keeping the game effective without disadvantaging one side or the other (deliberately). My current setup is as follows:

Ship targets enemy based on proximity.
Ship changes direction and moves toward target, firing when in range. Ship fires single repeater weapon in the forward direction.
Ship will not change direction when closer than certain distance from enemy.
If you are directly following and shooting at a ship, the ship does not attempt to evade fire. (consequence of #3)
All ships have similar firepower.

I am trying to improve this system and am willing to rewrite if necessary. Most of the ships end up flying around each other, shooting but never hitting. I have thought of several ideas to improve it:

Once health drops significantly, ship will boost away from firing ship.
Some ships are randomly chosen to be equipped with torpedoes (maybe add aft firing?).
Make ships more wary of attacking cruisers (they tend to die quickly when attacking).

Does anyone have any other suggestions as to improve the AI of the ships? Does anyone have a completely different system of doing this?

sentences:
Java game in a day or two We are three people who are going to make a simple game in Java as a school project (University, first year). The game has to be object oriented. We don't have much time, 10-20 hours tops. None of us has any experience in game development, but we all have fair skills in Java.

We can choose exactly what kind of game, and that is where the problem lies. How high should we aim? There is a competition involved, so we do want to make the best game in the time we have. Is a 3d game unrealistic? Should we use any game-engines/libraries? What kind of functionality should we avoid?

sentences:
How to create array with unique sprites? in cocos2d iphone I write the code like this. This displays only one sprite (red colour bubble) with number of times and moving down, but actually I want to display different sprites (different colour bubble) every time and moving down. I also add no of .png images in resource folder of my project. Here I used only 3.png, but I need to display all *.png images (different colour bubbles) in my project but I don't know how to get this.
Please help me
Thank you.
Here is the code:

-(void)addTarget {
CCSprite *target = [CCSprite spriteWithFile:@"3.png" rect:CGRectMake(0, 0, 256, 256)];

CGSize winSize = [[CCDirector sharedDirector] winSize];
int minY = target.contentSize.height/2;
int maxY = winSize.height - target.contentSize.height/2;
int rangeY = maxY - minY;
int actualY = (arc4random() % rangeY) + minY;

// Create the target slightly off-screen along the right edge,
// and along a random position along the Y axis as calculated above
target.position = ccp(winSize.width + (target.contentSize.width/2), actualY);

[self addChild:target];

// Determine speed of the target
int minDuration = 4.0;
int maxDuration = 12.0;
int rangeDuration = maxDuration - minDuration;
int actualDuration = (arc4random() % rangeDuration) + minDuration;

// Create the actions
id actionMove = [CCMoveTo actionWithDuration:actualDuration position:ccp(-target.contentSize.width/2,actualY)];
id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];
[target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];

// Add to targets array
target.tag = 2;
[_targets addObject:target];
}

-(void)gameLogic:(ccTime)dt {

[self addTarget];

}

-(id) init
{

if( (self=[super initWithColor:ccc4(255,255,255,255)] )) {

// Enable touch events
self.isTouchEnabled = YES;

// Initialize arrays
_targets = [[NSMutableArray alloc] init];
_projectiles = [[NSMutableArray alloc] init];
// Get the dimensions of the window for calculation purposes

CGSize winSize = [[CCDirector sharedDirector] winSize];

[self schedule:@selector(gameLogic:)
interval:1.0];
[self schedule:@selector(update:)];

}
return self;
}

- (void)update:(ccTime)dt {

NSMutableArray *projectilesToDelete = [[NSMutableArray alloc] init];
for (CCSprite *projectile in _projectiles) {
CGRect projectileRect = CGRectMake(projectile.position.x - (projectile.contentSize.width/2),
projectile.position.y - (projectile.contentSize.height/2),
projectile.contentSize.width,
projectile.contentSize.height);

NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init];
for (CCSprite *target in _targets) {
CGRect targetRect = CGRectMake(target.position.x - (target.contentSize.width/2),
target.position.y - (target.contentSize.height/2),
target.contentSize.width,
target.contentSize.height);

if (CGRectIntersectsRect(projectileRect, targetRect)) {
[targetsToDelete addObject:target];
}
}

for (CCSprite *target in targetsToDelete) {
[_targets removeObject:target];
[self removeChild:target cleanup:YES];
_projectilesDestroyed++;
if (_projectilesDestroyed > 30) {
//GameOverScene *gameOverScene = [GameOverScene node];
//  [gameOverScene.layer.label setString:@"You Win!"];
//  [[CCDirector sharedDirector] replaceScene:gameOverScene];
}
}

if (targetsToDelete.count > 0) {
[projectilesToDelete addObject:projectile];
}
[targetsToDelete release];
}

for (CCSprite *projectile in projectilesToDelete) {
[_projectiles removeObject:projectile];
[self removeChild:projectile cleanup:YES];
}
[projectilesToDelete release];

}

sentences:
How to instantiate a prefab only when something is hit, and for some seconds? How do I instantiate a prefab only when something is hit for a few seconds? I mean, I just need to activate the particle system when something is hit. Now it always runs, even before I hit something. I need it to activate the particle system when something is hit and for 2-3 seconds.

This is what I do now:

public void Shot()
{
    Destroy(gameObject);
    Instantiate(effect, transform.position, transform.rotation);
}

sentences:
How to make smooth animations Say I want to write a card game. I have a hand of cards and I want to be able to draw a smooth animation of a card moving from the hand to the table. I am looking for suggestions on how to elegantly represent the situation in data structures. Of course, I am not solely interested in cards, it seems to be a problem with more complex user interfaces in general.

The obvious representation of the hand is an array/list of cards. Given a rectangle in 2d space this hand is trivial to draw. When playing a card I can remove that card from the array and create a new structure that draws that card moving along any curve I like. The problem is then how the hand is drawn. In trivial implementation the hand in one instant shrinks in width by one card (as the array was replaced). Also, the selected card is now either above or bellow the hand (as it is drawn before or after drawing the hand), while a moment ago it was between the two cards next to it. These problems I'm not sure how to solve. They get even worse if trying to move several cards at once.

It would most likely work to make every card a separate body aware of it's position and movement in the plane (and possibly, the z axis to make overlaps work, as OpenGL allows this). It does seem like poor design to allow a system that almost always stays in a fixed shape too much flexibility. It also looks like a recipe for unexplainable bugs.

I would like to hear from someone who has done this, what is the best approach. To put it briefly, "specific and restrictive representation in data structures" versus "entirely free environment with some external limits".

Thanks a lot

sentences: Why flip sprites instead of creating extra assets? Why is the preferred method for changing the direction a character is looking in a 2D game a sprite flip? Why not just create the extra asset and show that one on screen?

sentences:
Field of view determination with partially opaque cells I'm currently implementing the field of view of a player in a 2D-grid based game. I've chosen a standard ray tracing algorithm because he really fits the features needed in my game.
However, the cells aren't just opaques or transparents. They can be "partially opaques", which means that they decrease the length of the line of the sight more than the others (we don't see as far in water than in the air!). Concretely, the player has a given "vision potential", and each cell has a "vision cost". For each cell crosses by the ray during the ray tracing, I decrease the vision. When it hits zero, I stop the ray.
Things are OK here. But this algorithm leads to some artefacts, as described in the last part of this document:

Ok, we have thrown rays all aroung our @, flagging each cell as visible. When we move aroung the dungeon, we notice some artifacts appearing on some walls, especially when the @ is near the wall.
Since we stop the ray as soon as it reaches a wall, when the ray is almost parallel to the wall, there may be some missing wall cells in the resulting potential visible set. [...] The issue is due to the fact that the ray should keep going until it reaches the other side of the wall and not stop on the first cell. But this is not possible since we have only a boolean 'lightThrough' information  and not the wall orientation.
Fortunately, there is a trivial trick which will allow us to remove those artifacts without adding more information on the cell. It is based on a simple observation : if the player sees a ground cell, he sees the wall behind it. [...]
Thus, our post-processing algorithm consist of :

loop through all cells of the visible map.

if the current cell is a hidden wall and is directly behind a visible ground cell (depending on the region the current cell is in), we can flag it as visible.

The result : on the left, the PVS [potential visible set] without the post-processing step. The yellow arrows show the missing cells. On the right, the PVS with the post-processing step.

The document suggests a post-process treatment, but it obviously doesn't work in my situation. What can I do instead?

sentences: Recreate UI or move it out of view? Which method would be best? What are the pros and cons? For example, if I have a main menu screen, I can easily start my game loop right as the user presses 'Start'. Which would be better, moving the 'Start' button as well as, 'settings, leaderboard, etc' buttons out of view? or to erase them and then recreate them when needed?

sentences:
How to use images/text/etc. in XNA without Content Pipeline? I'm currently writing a program in C# with the XNA framework. It is absolutely necessary for the game's images and text assets to be visible by the end user in the form of PNG files, so I can't use the content pipeline.

How would I go about using graphics and text in my XNA game without it?

sentences:
Detecting a ledge in Box2D Possible Duplicate:
  Detect Open Space in Farseer
  How do I detect ledges?

I'm making a 2D platformer with Box2D. The player needs to be able to grab onto a ledge and pull him/herself up.

Right now I have a sensor that extends in every direction from the upper half of the player's body.

The logic seems simple enough: if there are tiles inside the sensor and empty space above them, then it's a ledge and the game should act accordingly. The problem is that I can't figure out how to implement that logic with Box2D.

Anyone have any ideas?

sentences:
Add vertices to "middle" of VBO I've been playing around with VBOs as of late (mostly because my game necessitates it), and I've found the need to add new vertices to a VBO, but not necessarily at the end. The game in question is a Terraria port, and when a player updates the world, the VBO needs to be updated. Up until now, I've been using glBufferData() to update the array, but it's time I switch to glBufferSubdata() or glMapBuffer() I'd like to be able to update a certain "chunk" of the world when a block in it is modified, but this could potentially result in adding more or less vertices than are already in the appropriate memory section. If a player places a "block," more memory would need to be allocated, resulting in any proceeding vertices being shifted over x indices. My only thought would be to allocate enough memory for each chunk to be completely filled with blocks, but I haven't yet found a way to do that. Would anyone be able to point me in the right direction?

EDIT: To clarify, pushing new VBO data to the graphics card (which is what causes the lag spike) takes 11-12ms the first couple of times, and 1-4 every time after. This also raises the question: why does the graphics card seemingly need to be "broken in?" In other words, why is there such a huge delay at first?

sentences:
Phaserjs, filters, save to image cache I've tried to apply a Pixi filter to a image and save it to cache but the image doesn't get saved with the filter.

colorMatrix = new PIXI.ColorMatrixFilter();
colorMatrix.matrix = [0,0.0,0.5,-0.2, 0,0,1.0,-0.2, 0.0,0.0,0.5,-0.2, 0.0,0.0,0.0,1]
image = game.make.bitmapData()
image.load("testImage")
image.filters = [colorMatrix]
game.cache.addBitmapData("testImageWIthFilter", image);

Is it not possible to save it to cache? The only thing I see is the original image when using the code down below:

messageImage = game.add.sprite(0, 0, game.cache.getBitmapData('testImageWIthFilter'))

sentences:
Snake game steering with Java FX I am currently trying to make a snake game with Java FX, I read several posts about it and I understand on theory how to move the snake body (for each part of the snake reference the previous one and move it to its former location) but I am facing some issues, my snake is not able to turn around properly:

I would just like it to react as a normal snake, when the head steers into a direction then the other body parts follow one by one.

In my case I created a vector class to store positions and velocity (I use velocity to be able to move all the part at the same speed and therefore be able to keep the 3 pixel gap between them).

I usually trying my best to resolve issues but this time I've spent almost 3 hours knowing the theory and groping for a proper way to do it but without any improvements.

I tested different approaches but this one seems to be the clearest and the nearest to the solution to me:

I got 2 simple classes that are Vector (only holding reference to X and Y) and Block that holds references such as Position, Velocity for the current motion, nextVelocity to anticipate steering, Previous for the previous block in the snake body.

I initialize my snake like that :

    public Snake(){
    this.head = new Block(250,250);
    for(int i = 0; i < 5; i++){
        if(i == 0){
            body.add(i, new Block(new Vector(head.getPosition().getX() - 18 , head.getPosition().getY())));
            body.get(i).setPrevious(this.head);
        }else{
            body.add(i, new Block(new Vector(body.get(i-1).getPosition().getX() - 18, body.get(i-1).getPosition().getY())));
            body.get(i).setPrevious(body.get(i-1));
        }
    }
    this.head.setPrevious(body.get(0));
}

Then there are my steer() method for the head as well as my follow() method for the other body parts.

I used the variable nextVelocity that stores the velocity of the previous part if this one is different from the current one, in this case nextVelocity is passed to velocity at the next frame to avoid that the whole body moves at the same time in the direction taken by the head (which apparently doesn't work):

public void steer(Vector velocity){
    this.velocity = velocity;
    this.position.add(velocity);
    this.shape.relocate(this.getPosition().getX(), this.getPosition().getY());
}

public void follow(Block previous){
    if(this.velocity == null) {
        this.velocity = new Vector(previous.velocity);
    }else if(this.nextVelocity != null) {
        this.velocity = new Vector(this.nextVelocity);
        this.nextVelocity = null;
    }else if(this.previous.velocity != this.velocity){
        this.nextVelocity = new Vector(this.previous.velocity);
    }
    this.position.add(this.velocity);
    this.shape.relocate(this.getPosition().getX(), this.getPosition().getY());
}

And finally my move() method handling the whole snake moves:

public void move(Vector direction){
    this.head.steer(direction);
    for(int i = 0; i < body.size(); i++){
        if(i == 0){
            body.get(i).follow(this.getHead());
        }else{
            body.get(i).follow(body.get(i-1));
        }
    }
}

If anyone could point me into the right direction or just let me know where I am mistaking it would be amazing.

sentences:
Aircraft trajectory prediction I have an aircraft that is controlled by player and i need to predict it's position at needed time. It's not a problem if the plane is just moving straight but most of the time aircraft is maneuring. So i came up with an aproximation that aircraft movement can be described as a helix.

So i have a point A and linear velocity V_1 that aircraft had at a time of t_1. Point B and linear velocity V_2 that aircraft had at a time of t_2. In that approximation we may assume that |V_1| equals |V_2| so it will be a perfect helix. And i need to find a point C in that aircraft will be at a time of t_3.

sentences:
How to display three dimensional Objects in a 2D Game using OpenGL and orthographic Projection? I am creating a 2D (2.5D) game using OpenGL and orthographic projection.

It is simple to have relatively flat objects, e.g. characters.
I simply use a quad with a texture of the character and move that about.

However, what is the best way to draw big objects that have depth, e.g. a big house?
Do I use one quad with a three dimensional looking represantation of the house on it, or do I use multiple quads (e.g. front, side, top)?

I prefer using one quad with a three dimensional looking texture on it. What are the drawbacks to this approach?

sentences:
How to temporarily increase the speed of a character in a Unity game As the title would suggest, I want to give a character a speed boost for x amount of seconds, while increasing their Gameobject's mass. During this little speed boost, I also want to add a script to another player that disappears when the speed boost dies out I am new to C#, and Unity in general, any help would be appreciated.

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

public class PlayerAddMass : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Q))
        {
            rb = GetComponent<Rigidbody>();
            rb.mass = 10;
            rb = GetComponent<Rigidbody>();
            rb.speed = 5;
        }
    }
}

The code above was found on a unity website of some sorts, and I modified it to set the speed and mass numbers (I changed the 0s into a 10 and a 5) The errors I get are "rb does not exist in the current context" x 4

sentences: How to use X,Y, and Z instead of Pitch, Roll and Yaw I'm learning Unreal engine, and I'm rather disappointed because it uses pitch roll and yaw instead of the standard x, y, and z that I'm used to.  Is there any way to convert this easily, or is there a preference, or do  I have to get used to using y,z,x, instead of x,y,z.

sentences:
Calculating displacement in physics simulation Something's been bugging me and I haven't been able to figure this out.

In a simply physics simulation, where you'd calculate a net force acting on a body every frame, calculate the acceleration that frame and from that the velocity and then distance travelled. (like this):

a = F(given)/m v = a*dt s = v*dt

Why is it not s=0.5*vfinal*dt (for constant acceleration), in other words, why is not customary to assume that the speed changes linearly during the timeframe dt instead of assuming that the velocity is constant during the frame.

sentences:
3D terrain generation with overhangs/caves 3D terrain with 2D noise function as heightmap is kind of 'easy'. Make a plane and adjust height based on the noise.

How would one start working on 3D terrain with overhangs/caves?

There are some older topics (for example related to Minecraft) on the thema, but non of them cover overhangs and in general techniques that can be applied to heightmap generated terrain.

sentences: How do i put apps on sleep while my game is running in an Android Device How do i put apps on sleep while my game is running in an Android Device. I m a Game Developer (intermediate Level). And i Wanna know the Can i put apps of phone running in background to sleep to free some ram and make my game run on 1 gb of phone smoothly (Android 9).

sentences:
How to get struct layouts from vertex shader input using ID3D12Reflection I am attempting to write a code generator that builds C++ structs/classes from D3D12 reflection data built using DXC. Given a simple vertex shader signature:
struct Light
{
    float3 Color;
    float3 Dir;
};

struct cbPerPass : register(b0)
{
    float4x4 gWorldProjTransform;
    Light gGlobaLight;
};

struct VertexIn
{
    float3 Pos      : POSITION;
    float4 Color    : COLOR;
};

struct VertexOut;  // unimportant for the question

VertexOut VS(VertexIn vin) { // do calculations here }

I can retrieve the input parameters via ID3D12ShaderReflection::GetInputParameterDesc(), but this only reports the mapping of VertexIn members to shader registers and any attached semantics. I can get the layout of cbPerPass through ID3D12ShaderReflection::GetConstantBufferByIndex() and the layout of Light through the ID3D12ShaderReflectionType interface.
However, what I would like to retrieve is the layout of the VertexIn struct. Is there a way to do this?

sentences:
How is game difficulty tested/balanced? How is game difficulty typically tested or balanced so that there's a steady progression of difficulty; how do I ensure that no level is too difficult or too easy for its point in the game?

Are play testers of various skills brought in, or a random sampling of people? What considerations are/should be taken into account during the actual level design process?

sentences:
3D Dice using Maya - for integration with iOS game app My designer is building a 3D design of a dice using Maya.

I want to integrate this in my iOS app so that the user can spin the dice and get a number. Then they play the game using that number.

So, I have two questions:
1) How can I make the dice spin and stop at a random position so that a number is presented to the user?

and

2) Once it stops spinning how can I detect the number that is displayed to the user (programmatically)?

Many thanks.
-Anil

sentences:
Determine arc-length of a Catmull-Rom spline to move at a constant speed I have a path that is defined by a concatenation of Catmull-Rom splines. I use the static method Vector2.CatmullRom in XNA that allows for interpolation between points with a value going from 0 to 1.

Not every spline in this path has the same length. This causes speed differences if I let the weight go at a constant speed for every spline while proceeding along the path. I can remedy this by letting the speed of the weight be dependent on the length of the spline. How can I determine the length of such a spline? Should I just approximate by cutting the spline into 10 straight lines and sum their lengths?

I'm using this for dynamic texture mapping on a generated mesh defined by splines.

sentences:
Loading Textures in Background Cocos2d Objective C loading CCScene I am allocating a few CCScene subclasses, but when I do this, it takes more than 10 seconds. What I am trying to achieve is to perform a small CCAmimation, such as a loading logo glowing. My question is: how do I load those CCScene subclasses in the background and perform this animation.

I am able to perform these things separately, but I want to do them together.

sentences: Multiple Colliders in Collision I have an object that has a front collider, left collider and right collider.  When a collision occurs, I notice that there are situations where the front collider and left collider/right collider has collided with the object. I need to somehow figure out which collider made contact "first".  Is there anyway to do this?  The reason I need this is because I have different code that needs to run depending on which collider made contact first.

sentences:
How do I ignore 1 axis on vector 3 reset to 0,0,0? coding noob 3D artist here. I'm trying to create a scrolling parallax background with 3D objects, I have it set so that when it scrolls off screen, it resets it's position off screen on the opposite side so it repeats. However, If I want to have multiple depths to these background objects, it needs to not reset that objects position in the Z axis, or when it loops once it'll just overlap the other objects. How can I tell it to ignore the Z axis on resets? Here's what I have so far.

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

public class BGSLIDE : MonoBehaviour
{
    public float speed = 2.0f;
    public Transform cube;
    public CC player;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        cube.position += new Vector3(speed*player.velocity.x, 0, 0);
       if (cube.position.x > 10)
        {
            cube.position = new Vector3(-10,0,0);
        }
       if (cube.position.x < -10)
        {
            cube.position = new Vector3(10,0,0);
        }

    }

}

sentences:
Basic plane kinematics I never did physics in my life and this is really hard for me. I am currently trying to implement movement in the X and Y axis of a plane, in a video game I am making.

What I want to do is, given a starting angle and a velocity, and the value of gravity, calculate in different points of time the current angle and the displacement in X and Y.

So, lets say, my current velocity is 4 units / second and my current angle is 30 degrees and my gravity is 9.8 u/s, I want to pass an argument in seconds and calculate the final angle, velocity, and the amount of X and Y the body moved.

sentences:
Is there something similar to XMFLOAT2 that has its operators overloaded? Since XMFLOAT2 is just a structure, I'm sure it does not have operator overloading which is what I need to make things a lot simpler. Is there something like XMFLOAT2 where I can add two (a) + (b). I also need to use the =.

Thanks

sentences:
Troubleshooting Unity & Unity Hub Problems Behind Firewall I'm teaching game design at a high school in the US. This means that we're behind a firewall that does packet inspection. Our lab machines are running Windows 10 and have the school's certificate installed as a "Trusted Root Certification Authority" (as seen in certlm).

The problem I'm seeing are:

Unity Hub (2.0.0) silently fails when trying to download Unity installs
Unity (2019.1.3f1) complains about a "self-signed certificate in the trust chain" (roughly)

This post from the Unity Forums suggests that Unity might know how to read the local computer's list of trusted certificates, but there are also responses indicating that it may not always work.

My questions:

Where do Unity and Unity Hub log certificate errors (do they)?
Suggestions for troubleshooting?

sentences:
Vector vs Scalar velocity? I am revamping an engine I have been working on and off on for the last few weeks to use a directional vector to dictate direction; this way I can dictate the displacement based on a direction. However, the issue I am trying to overcome is the following problem; the speed towards X and speed towards Y are unrelated to one another. If gravity pulls the object down by an increasing velocity my velocity towards the X should not change. This is very easy to implement if my speed is broken into a Vector datatype, Vector.X dictates one direction Vector.Y dictates the other (assuming we are not concerned about the Z axis). However, this defeats the purpose of the directional vector because:

  SpeedX = 10
  SpeedY = 15

  [1, 1] normalized = ~[0.7, 0.7]

  [0.7, 0.7] * [10, 15] = [7, 10.5]

As you can see my direction is now "scaled" to my speed which is no  longer the direction that I want to be moving in.

I am very new to vector math and this is a learning project for me. I looked around a little bit on the internet but I still want to figure out things on my own (not just look at an example and copy off it). Is there way around this? Using a directional vector is extremely useful but I am a little bit stumped at this problem. I am sorry if my mathematical understanding maybe completely wrong.

sentences:
Prevent counterclockwise rotation So I have an object that has a handle attached to it, the player is supposed to rotate this handle. For that, I'm taking in the horizontal and vertical axis of a controllers analogue stick and transform these values into degrees, which I then use to rotate the object.
The problem is that I can't seem to completely block out the possibility of rotating the handle counterclockwise, as the player is only supposed to rotate it clockwise. What happens is that every couple of frames while I try rotating counterclockwise it detects a clockwise rotation, executing my according code, even though I was rotating counterclockwise consistently.
The principles I use to determine which direction the rotation is going is done by comparing the input angle of the last frame to the current input angle, like:
// Variant 1:
var inputAngle = Mathf.Atan2(x, y) * Mathf.Rad2Deg;

float angleDifference = inputAngle - previousAngle;
if (angleDifference > 180f) angleDifference -= 360f;
if (angleDifference < -180f) angleDifference += 360f;

if (Mathf.Sign(angleDifference).Equals(-1))
{
// Counterclockwise rotation
}
else
{
// Clockwise rotation
}

// ...

previousAngle = inputAngle;

In another attempt, I tried to do this comparison by simply checking if my current angle is larger than my previous one while having the input transformed in a 0° to 360° range and also handling the overflow from going back to 0° from 360°, which did not work consistently either.
So I tried to see what the values are giving in this faulty case, but what this told me was simply that the values are not as I expected them to be, as the current angle should be smaller than the previous one while rotating counterclockwise, in those cases and I can't figure out why or how to prevent it?

So I guess in the end my question would be how can I consistently prevent a player from rotating counterclockwise by reading a controller's analogue stick input.

sentences:
In A star, how does the heuristic help determine your path? Say you're using a 4 by 5 grid. The G cost for horizontal and vertical movement is 10, and the G cost for diagonal movement is 14. On this page: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html
it says  "At one extreme, if h(n) is 0, then only g(n) plays a role, and A* turns into Dijkstra’s algorithm, which is guaranteed to find a shortest path."

Why would it find the shortest path? Wouldn't it find the longest path instead? If the heuristic no longer plays a role then it will never consider going diagonal because the cost of diagonal movement is 14. Previously, even if the G cost was higher than another adjacent node, it could still be chosen if the H cost was a bit lower.

Now, even if the shortest path was by going diagonal, it would never go diagonal because the G cost of diagonal movement will always be higher than the G cost for horizontal/vertical movement. So why exactly would it be guaranteed to find the shortest path if the heuristic was 0?

Another thing, what would be the difference if, let's say we're using the Manhatten method, and after calculating the total number of squares moved horizontally and vertically to reach the target square from the current square the heuristic was multiplied by 1 or if it was multiplied by 100? Wouldn't the path be the same either way?

sentences: Does anyone have a sample for drawing a subdivided icosahedron in javascript, that they would be able to share? Does anyone have a sample for drawing a subdivided icosahedron in javascript, that they would be able to share?

sentences:
Can't understand these UV texture coordinates (range is NOT 0.0 to 1.0) I am trying to draw a simple 3D object generated by Google SketchUp 8 Pro onto my WebGL app, the model is a simple cylinder.

I opened the exported file and copied the vertices positions, indices, normals and texture coordinates into a .json file in order to be able to use it on javascript. Everything seems to work fine, except for the texture coordinates which have some pretty big values, like 46.331676 and also negative values. Now I don't know if I am wrong, but isn't 2D texture coordinates supposed to be in a range from 0.0 to 1.0 only?

Well, drawing the model using these texture coordinates gives me a totally weird look, and I can only get to see the texture properly when I am very close (not really me, the cam) to the model, as if the texture has been insanely reduced in it's size and repeated infinitely across the model's faces. (yeah, I am using GL_REPEAT on that texture wrap thing)

What I noticed is that if I get all these coordinates and divide them by 10 or 100 I get a much "normal" look, but still not in the 0.0 to 1.0 range.

Here's my json file: http://pastebin.com/Aa4wvGvv

Here are my GLSL Shaders: http://pastebin.com/DR4K37T9

And here is the .X file exported by SketchUp: http://pastebin.com/hmYAJZWE

I've also tried to draw this model using XNA, but still not working. Using this HLSL shaders: http://pastebin.com/RBgVFq08

I tried exporting the same model to different formats, collada, fbx, and x. All those yields the same thing.

sentences:
How can I change the Value in HSV color via scripting? I have a glowing object (point light attached to a ball with a default shader with the emission property) in my scene and I've added a script to make the point light flicker.
The script randomly changes the intensity of the point light to make it flicker.
Since I'm using an emission shader, the ball can also be seen without light.
I'm using HDR values in my emission shader and by changing the Value in the HSV Color picker I can change the color of the ball to black.
I need help in linking the value of the HSV color on the emission shader of the ball to the intensity of the point light.
Any help would be useful! Thanks!

sentences:
Unity 2D Input.gyro eulerAngles X value strange behaviour I am working on a project where I want to create an 'scrolling' effect using gyroscope on mobile devices. The basic idea is that I have an Image object in my Scene and I want to be able to show different part of it using gyroscope like for example you see the wall of a room and rotation your phone you see different parts of the room, but in 2D.

For now I managed to move my Image using Input.gyro.attitude.eulerAngles.x; from gyroscope like this:

    protected void Update()
    {
        var x = transform.localPosition.x;
        var gyroX = Input.gyro.attitude.eulerAngles.x;
        x += -gyroX * Speed;

        BackgroundImage.transform.localPosition =
            new Vector3(x, transform.localPosition.y, transform.localPosition.z);

    }

The problem which I am seeing is that when Input.gyro.attitude.eulerAngles.x reaches 86.0 it starts decreasing and even if you are rotating your phone to right it changes it's direction.

Checked the documentation, examples over internet, but didn't find anything about that.

If you have any idea what can cause that issue and how can I fix it, or any other suggestions how can I achieve the thing which I want to create, pleae share your knowledge.

Thanks in advance!

Edit:
The only rotation axis which I am interested in is X, because the app will be in portrait mode and I want to be able to move the image only horizontal (by X).

So the phone's rotation has to be similar to while taking an panoramic photo on your mobile as shown on the first picture:

sentences: In XNA 3.1, is it possible to disable texture filtering? I want to disable texture filtering (since I'm making a retro-style game where it looks bad if a texture gets filtered like that), but since I'm on XNA 3.1 there seems to be no option to set a SamplerState with SpriteBatch.Begin or anything. Is it possible to do this?

sentences:
How to implement line of sight restriction in actionscript? I have a problem with a game i am programming. I am making some sort of security game and i would like to have some visual line of sight. The problem is that i can't restrict my line of sight so my cops can't see through the walls. Below you find the design, in which they can look through windows, but not walls. Further below you find an illustration of what my problem is exactly.

this is what it looks like now. As you can see, the cops can see through walls.

This is the map i would want to use to restrict the line of sight.

So the way i am programming the line of sight now is just by calculating some points and drawing the sight accordingly, as shown below. Note that i also check for a hittest using bitmapdata to check whether or not my player has been spotted by any of the cops.

private function setSight(e:Event=null):Boolean
{
    g = copCanvas.graphics;
    g.clear();

    for each(var cop:Cop in copCanvas.getChildren())
    {
        var _angle:Number = cop.angle;
        var _radians:Number = (_angle * Math.PI) / 180;
        var _radius:Number = 50;

        var _x1:Number = cop.x + (cop.width/2);
        var _y1:Number = cop.y + (cop.height/2);
        var _baseX:Number = _x1 + (Math.cos(_radians) * _radius);
        var _baseY:Number = _y1 - (Math.sin(_radians) * _radius);

        var _x2:Number = _baseX + (25 * Math.sin(_radians));
        var _y2:Number = _baseY + (25 * Math.cos(_radians));
        var _x3:Number = _baseX - (25 * Math.sin(_radians));
        var _y3:Number = _baseY - (25 * Math.cos(_radians));

        g.beginFill(0xff0000, 0.3);
        g.moveTo(_x1, _y1);
        g.lineTo(_x2, _y2);
        g.lineTo(_x3, _y3);
        g.endFill();
    }

    var _cops:BitmapData = new BitmapData(width, height, true, 0);
    _cops.draw(copCanvas);

    var _bmpd:BitmapData = new BitmapData(10, 10, true, 0);
    _bmpd.draw(me);

    if(_cops.hitTest(new Point(0, 0), 10, _bmpd, new Point(me.x, me.y), 255))
    {
        gameover.alpha = 1;
        setTimeout(function():void{ gameover.alpha = 0; }, 5000);
        stop();

        return true;
    }

    return false;
}

So now my question is: Is there someone who knows how to restrict the view so that the cops can't look through the walls? Thanks a lot in advance.

ps: i have already looked at this tutorial by emanuele feronato, but i can't use the code to restric the visual line of sight.

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:
Unable Compile Unreal Project into .Exe File I'm new to Unreal Engine and I've been looking for an answer online but I don't understand why the project I just started on is unable to compile. I only used the default blueprints. The error logs are below.
UATHelper: Packaging (Windows (64-bit)): Running AutomationTool...
UATHelper: Packaging (Windows (64-bit)): Parsing command line: -ScriptsForProject=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide/EscapeFromDarkSide.uproject BuildCookRun -nocompileeditor -installed -nop4 -project=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide/EscapeFromDa
rkSide.uproject -cook -stage -archive -archivedirectory=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide -package -ue4exe="C:\Program Files\Epic Games\UE_4.26\Engine\Binaries\Win64\UE4Editor-Cmd.exe" -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -clientconfig=Development -utf8
output
UATHelper: Packaging (Windows (64-bit)): Setting up ProjectParams for C:\Users\belmo\OneDrive\Documents\GitHub\EscapeFromDarksidePenitentiary\EscapeFromDarkSide\EscapeFromDarkSide.uproject
UATHelper: Packaging (Windows (64-bit)): ********** COOK COMMAND STARTED **********
UATHelper: Packaging (Windows (64-bit)): Running UE4Editor Cook for project C:\Users\belmo\OneDrive\Documents\GitHub\EscapeFromDarksidePenitentiary\EscapeFromDarkSide\EscapeFromDarkSide.uproject
UATHelper: Packaging (Windows (64-bit)): ERROR: Cook failed.
UATHelper: Packaging (Windows (64-bit)):        (see C:\Users\belmo\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.26\Log.txt for full exception trace)
PackagingResults: Error: Cook failed.
UATHelper: Packaging (Windows (64-bit)): AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
UATHelper: Packaging (Windows (64-bit)): BUILD FAILED
PackagingResults: Error: Unknown Cook Failure
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogEditorViewport: Clicking on Actor (LMB): StaticMeshActor (Cube11)
LogSlate: Window 'Output Log' being destroyed
LogSlate: Window 'Output Log' being destroyed
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogEditorViewport: Clicking on Actor (LMB): StaticMeshActor (Cube11)

sentences: How to make a GameObject ignore a camera effect? I have a 2D game and I wanted to apply bloom to the main GameObjects so I attached the effect onto the main camera, however the background also gets affected by the bloom and it gets all shiny. How can I make it ignore the bloom effect?

sentences:
Unable to create suitable graphics device? I've been following the Eye of the Dragon tutorial, which is basicly a guide to making a 2D RPG game, obviously.

I recently finished the tutorial about making pop up screens in the menu and changed the screen to load as a full screen.

Whenever I try and load the game it just goes black and my mouse sits there. I cannot change out of it other then with CtrlAltDel. Once i do that it says No suitable graphics card found, unable to create graphics device.

I read somewhere about XNA not allowing more then one screen when any one of them is full screen. but it wasnt very informative. Anyone have any ideas whats going on and/or how to fix this?

Just incase if this helps this is the code for the graphics device:

public Game1()
{
    graphics = new GraphicsDeviceManager(this);
    graphics.PreferredBackBufferWidth = 900;
    graphics.PreferredBackBufferHeight = 768;
    graphics.IsFullScreen = true;
    this.Window.Title = "Eyes of the Dragon";
    Content.RootDirectory = "Content";
}

sentences:
How can I child one sprite to another? I am a newb at GameMaker.  I have a 2D map which you can move around.  I want to add pins to the map, such that when the map moves, the pins stay in the same position relative to the map.  By default, the map will move, while the pins remain stationary.

I have tried creating a sub-layer of instances on my map instance layer, but the depth of the sub-layer is always greater than the parent layer.  I have tried overriding the depth, but it gives me a warning suggesting unpredictable results.

I have searched the internet, but all I could find was overkill code which I am hoping is not necessary.  (And none of those suggestions directly addressed my question.)

How can I make it so that my pins move around with the map?  I would like to avoid using code for something so simple.

sentences:
Where to find passive advertisements? Imagine a soccer game. While the player is playing a match, he is seeing the billboards all the time.

I want to include that kind of advertisements in my game (obviouly, making profit). Just a brand logo, not a banner the user has to click.

Does this even exist? Is there any AdMob like which allows this kind of advertisement?

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:
Graphical mesh lags behind collision shape in BulletPhysics debug drawing In Bullet Physics when I debug draw physics world the graphical mesh lags behind the collsion shape.

m_DynamicsWorld->stepSimulation(1 / 60.0f, 10);

btTransform trans, trans2;
trans2 = m_RigidBodies.at("CubeMesh")->m_Body->getWorldTransform();

m_RigidBodies.at("CubeMesh")->m_Body->getMotionState()->getWorldTransform(trans);
/*
 * using
 * m_RigidBodies.at("CubeMesh")->m_Body->getMotionState()->getWorldTransform(trans);
 *
 * causes the graphical mesh to lag behind the collision shape in DebugDraw call
 * Checking with debugger shows that the lag error keeps on increasing
 * */
//
//
glm::mat4 M;
trans.getOpenGLMatrix(glm::value_ptr(M));
m_RigidBodies.at("CubeMesh")->GetGraphicalObject()->Model = M;

if (m_DebugDraw) {
    m_DynamicsWorld->debugDrawWorld();
}

If I use the OpenGL matrix from trans2 then debug drawing is perferct.
But with trans the graphical mesh lags behind the collision shape in debug draw.

I am using btDefaultMotionState when setting the CubeMesh rigid body.

btTransform tr;
    tr.setIdentity();
    tr.setOrigin(btVector3(0.0f, 90.0f, 0.0f));
    cubeMesh->m_PhysicsBody->m_MotionState = new btDefaultMotionState(tr);

Can anyone explain reason for this lag?

sentences:
Having trouble swapping elements I'm trying to visualize a simple Hanoi solver that uses an algorithm, and I'm swapping elements on array to visualize it.
Here's my code:
        let A = [];
        let B = [];
        let C = [];
        let moveCount = 0;
        let once = true;
        hanoi(3, A, C, B);
// 3, how many disk
// A C B are rods
        alert(A + '.\n' + B + '.\n' + C + '.')

        function hanoi(n, start, target, other)
        {
            if (once)
            {
                once = false;
                for (var i = 1; i <= n; i--)
                {
                    start.push(i);
                }
            }

            if (n <= 1)
            {
                let temp = start[n-1];
                start[n-1] = target[target.length];
                start = start.filter(Boolean)
                target[target.length] = temp;
                target = target.filter(Boolean);
                //console.log('Moving disk '+n+' from rod '+start+' to '+target+' rod');
                moveCount++;
            }
            else
            {
                hanoi(n-1, start, other, target);

                let temp = start[n-1];
                start[n-1] = target[target.length];
                start = start.filter(Boolean)
                target[target.length] = temp;
                target = target.filter(Boolean);
                //console.log('Moving disk '+n+' from rod '+start+' to rod '+target);
                moveCount++;

                hanoi(n-1, other, target, start);
            }
        }

The C value should be expected [3, 2, 1] but only shows 2. I also checked A and B and 1 is nowhere to be found
How do I make this properly so the output would be [3, 2, 1]
Imagine 3 is the largest disk and so on...

sentences:
How to implement OpenGL triple buffering of buffer objects to avoid stalls? I'm trying to implement the triple buffering described here. The intent is to gain higher frame rate by avoiding waiting for glBufferSubData() to finish.

My understanding is that this is how to implement triple buffer:

- make 3 buffers with glGenBuffers()
Current frame:
  - bind to buffer3
  - draw last frame
  - bind to buffer1
  - glBufferSubData for all the vertices,
  keep track of their texture/vertex count,blend function, etc
Next frame:
  - bind to buffer 1
  - draw last frame (bind texture, blend func, glDrawArrays)
  - and so on

There doesn't seem to be any performance gain between this and doing glBufferSubData() and then immediately calling glDrawArrays().

Am I missing something or misunderstand how triple buffer should work?

Also is there a way to know when glDrawArrays() stalls due to glBufferSubData() still not being finished?

sentences: save player achievements in local device As  an indie developer with zero dollar budget for servers and backend i wonder if there are ways to store the player achievements on his mobile device ?

sentences:
Manipulating sprite shape rendered I wish to create a game object where you can start dragging it by touching somewhere on the line of its collision and to create these "dynamic shapes" by stretching the sprites and readjusting the sprite look and collision according to the drag point.

Adding an illustration for clearance:

Started playing with Sprite Shape Renderer to create these curved sprite tiles but I need to be able to create dynamic ones using the mouse cursor and adjust all collisions.

I've tried to add an AnchorDragger script to the Sprite Shape Renderer object:

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

public class AnchorDragger : MonoBehaviour
{
    const int INVALLID_INSERTED_POINT_INDEX = -1;

    public SpriteShapeController spriteShapeController;
    private Spline spline;
    private int inseretedPointIndex = INVALLID_INSERTED_POINT_INDEX;

    void Start()
    {
        spline = spriteShapeController.spline;
        int pointCount = spline.GetPointCount();
        for (var i = 0; i < pointCount; i++)
        {
            Vector3 currentPointPos = spline.GetPosition(i);
            Debug.Log("Point " + i + " position: " + currentPointPos);
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (inseretedPointIndex != INVALLID_INSERTED_POINT_INDEX)
        {
            spline = spriteShapeController.spline;
            spline.SetPosition(inseretedPointIndex, Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 1.0f)));
            // Debug.Log("Setting position to: " + Camera.main.ScreenToWorldPoint(Input.mousePosition));
        }
    }

    void OnMouseDown()
    {
        Debug.Log("Mouse Down Position:" + Input.mousePosition);
        Vector3 mouseDownPos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 1.0f));
        Debug.Log("World Position: " + mouseDownPos);
        spline = spriteShapeController.spline;
        int pointCount = spline.GetPointCount();
        int closestPointIndex = int.MaxValue;
        float minDistance = int.MaxValue;
        for (var i = 0; i < pointCount; i++)
        {
            Vector3 currentPointPos = spline.GetPosition(i);
            float distance = Vector3.Distance(currentPointPos, mouseDownPos);
            if (distance < minDistance)
            {
                minDistance = distance;
                closestPointIndex = i;
            }
        }
        spline.InsertPointAt(closestPointIndex, mouseDownPos);
        spline.SetTangentMode(closestPointIndex, ShapeTangentMode.Continuous);
        inseretedPointIndex = closestPointIndex;
        Debug.Log("Inserted point index: " + inseretedPointIndex);
    }

    void OnMouseUp()
    {
        Debug.Log("Mouse Up");
        spline = spriteShapeController.spline;
        spline.RemovePointAt(inseretedPointIndex);
        inseretedPointIndex = INVALLID_INSERTED_POINT_INDEX;
    }
}

Basically tried to figure the closest point on the spline where I've clicked and then inserting a new point and setting its position on Update to where the mouse is and delete the point on mouse up.Right now I'm having a problem where the drag position is not correct for some reason.Where I clicked, where the new point position is set:

Even when I tried to play with where I click and where I take my mouse to while dragging, not sure why, could use help!

Also I'm not sure how I would update the EdgeCollider2D? I know I can get it in the Update method using:

EdgeCollider2D edgeCollider = gameObject.GetComponent<EdgeCollider2D>();

But how would I actually update it correctly to fit the new sprite?

sentences:
Need efficient way to keep enemy from getting hit multiple times by same source My game's a simple 2D one, but this probably applies to many types of scenarios.

Suppose my player has a sword, or a gun that shoots a projectile that can pass through and hit multiple enemies.

While the sword is swinging, there is a duration where I am checking for the sword making contact with any enemy on every frame.  But once an enemy is hit by that sword, I don't want him to continue getting hit over and over as the sword follows through. (I do want the sword to continue checking whether it is hitting other enemies.)

I've thought of a couple different approaches (below), but they don't seem like good ones to me. I'm looking for a way that doesn't force cross-referencing (I don't want the enemy to have to send a message back to the sword/projectile). And I'd like to avoid generating/resetting multiple array lists with every attack.

Each time the sword swings it generates a unique id (maybe by just incrementing a global static long). Every enemy keeps a list of id's of swipes or projectiles that have already hit them, so the enemy knows not to get hurt by something multiple times. Downside is that every enemy may have a big list to compare to. So projectiles and sword swipes would have to broadcast their end-of-life to all enemies and cause a search and remove on every enemy's array list. Seems kind of slow.
Each sword swipe or projectile keeps its own list of enemies that it has already hit so it knows not to apply damage. Downsides: Have to generate a new list (probably pull from a pool and clear one) every time a sword is swung or a projectile shot. Also, this breaks down modularity, because now the sword has to send a message to the enemy, and the enemy has to send a message back to the sword. Seems to me that two-way streets like this are a great way to create very difficult-to-find bugs.

sentences:
Applying Transformation Matrices to VBOs in OpenGL So I've recently tried to add Vertex Buffer Object Matrix transformation to an OpenGL engine I'm working on. I could go about this by applying the matrix to a copy of each vertex individually, but this would take a lot of CPU resources, so I am trying to implement transformation natively using OpenGL. This code works:

    /// <summary>
    /// Sets up the required OpenGL settings so as to create the necessary environment for the models to work (must be called on a thread on which an OpenGL context is set up, preferably on the thread on which the model was loaded).
    /// </summary>
    public static void Setup(Size viewPort, ref Matrix4 camera) {
        GL.MatrixMode(MatrixMode.Projection);
        GL.PushMatrix();
        if (!(viewPort.Width == 0 || viewPort.Height == 0)) {
            Matrix4 matrix;
            Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver3F, (float) viewPort.Width / viewPort.Height, 0.01F, long.MaxValue, out matrix);
            GL.LoadMatrix(ref matrix);
        }
        GL.MatrixMode(MatrixMode.Modelview);
        GL.PushMatrix();
        Camera = camera;
        GL.LoadMatrix(ref Camera);
        GL.Enable(EnableCap.DepthTest);
        GL.Enable(EnableCap.Lighting);
    }

    /// <summary>
    /// Renders the model (must be called on a thread on which an OpenGL context is set up, preferably on the thread on which the model was loaded).
    /// </summary>
    public override void Render() {
        if (IsVisible) {
            /*Matrix4 matrix = Matrix4.CreateTranslation(location);
            GL.MultMatrix(ref matrix);*/
            if (Cull)
                GL.Enable(EnableCap.CullFace);
            else
                GL.Disable(EnableCap.CullFace);
            texture.Bind();
            if (DataBuffer == 0) {
                GL.GenBuffers(1, out DataBuffer);
                GL.BindBuffer(BufferTarget.ArrayBuffer, DataBuffer);
                GL.BufferData<Vertex>(BufferTarget.ArrayBuffer, BufferSize, BufferData, Optimization);
            } else {
                GL.BindBuffer(BufferTarget.ArrayBuffer, DataBuffer);
                if (UpdateFrame) {
                    GL.BufferData<Vertex>(BufferTarget.ArrayBuffer, BufferSize, BufferData, Optimization);
                    UpdateFrame = false;
                }
            }
            IndexBuffer.Bind();
            GL.VertexPointer(3, VertexPointerType.Float, Vertex.SizeOfVertex, IntPtr.Zero);
            GL.TexCoordPointer(2, TexCoordPointerType.Float, Vertex.SizeOfVertex, TexturePointer);
            GL.NormalPointer(NormalPointerType.Float, Vertex.SizeOfVertex, NormalPointer);
            GL.DrawElements(BeginMode.Triangles, IndexBuffer.Count, IndexBuffer.Format, IntPtr.Zero);
            GL.Disable(EnableCap.CullFace);
            //GL.LoadMatrix(ref Camera);
        }
    }

    /// <summary>
    /// Resets the OpenGL settings set by calling Setup().
    /// </summary>
    public static void Reset() {
        GL.PopMatrix();
        GL.MatrixMode(MatrixMode.Projection);
        GL.PopMatrix();
    }

First Setup() is called to set up the projection matrix, then several meshes are rendered using the Render() method, then Reset() is called at the end to restore the matrices before I swap the buffers to the window.

However, when I comment out the commented lines in order to apply a simple translation matrix, I only get flickers all over the window. I tried using GL.Push() and GL.Pop() at the beginning and end of the Render() method, but to no avail. I also tried using GL.LoadIdentity() first and GL.MatrixMode(MatrixMode.Projection), but still no success.

Can anyone be kind enough to point out the mistake in my code please?

sentences:
libGDX best way to do Game States I'm making a JRPG in libGDX, and I'm working with Screens. I have a main Screen called GameScreen, a screen for battles called BattleScreen and I want to make a screen for managing party members and items, as well as for shops. My question is, how can I draw one of those 3 screens without having to reload the whole game when going back to GameScreen.

GameScreen loads everything when Show() is called, so I'll have to save all information everytime I call another screen, so I can continue when I go back to GameScreen. This of course isn't good, and I'm looking for another way to draw a Screen over another one so that all vars wont be lost, or another solution.

sentences:
New Unity version copies the settings of previous version I use Ubuntu 20.04.
When I download a new version of Unity 3D through Unity Hub, this new version automatically takes the settings of the previous version. I have installed Unity 2020.1, and I am facing the same problem. I created a new project, but it written in 2020.1 that I used preview package. I didn't even installed any package in Unity 2020.1. I did install preview package in 2019.4. But I didn't even open the project with 2020.1. I only have one project with 2020.1. The new project I just created. I asking help because I faced this issue when I first installed 2019.1, 2019.2, etc.
How can I flx it? Thanks

sentences:
Using SDL instead of Allegro? While looking for a cross platform library for game development, I came across both SDL and Allegro. After extensive research on fora, it seems SDL it way more widely used than Allegro is. I got the impression SDL is like 'the standard library' for developing graphical applications.

Now, I was wondering why this is the case. From a purely technical perspective, Allegro supports (almost) the same platforms as SDL. Moreover some functions in Allegro seems more intuitive than the SDL counterparts. On the other hand, the support of SDL for iOS and Android is better.

My question therefore is:

What is the cause of the widespread use of SDL over Allegro? Is it only due to personal preference or are there technical reasons for this?

To put my search into context, I'm looking for a low level library preferably written in C++. My goal is to develop a game engine from the lowest level possible just for the learning experience.

sentences:
How can I convert OBJ data into CSS3D transformations? I want to convert the data in a 3D .obj file (vertices, normals, faces) to CSS3D (width, height, rotateX,Y,Z and/or similar transforms).  I found a bunch of formulae and what-not, but 3D isn't my forte, so I don't know which I should use.

Essentially: How can I get the X/Y/Z-rotation of a 4-point plane from it's matrix of x,y,z coordinates?

For example, here are  2 simple planes in .obj format:

g plane1
# simple along along Z axis
v  0.0  0.0  0.0
v  0.0  0.0  1.0
v  0.0  1.0  1.0
v  0.0  1.0  0.0

g plane2
# plane rotated 90 degrees along Y-axis
v  0.0  0.0  0.0
v  0.0  1.0  0.0
v  1.0  1.0  0.0
v  1.0  0.0  0.0

f  1 2 3 4
f  5 6 7 8

I'd like to convert it into CSS:

#plane1 {
    width: X;
    height: Y;
    transform: rotateX(Xdeg) rotateY(Ydeg) rotateZ(Zdeg) translateZ(Zpx)
}

#plane2 {
    width: X;
    height: Y;
    transform: rotateX(Xdeg) rotateY(Ydeg) rotateZ(Zdeg) translateZ(Zpx)
}

/* Or equivalent, like using transform: matrix3d() */

sentences:
Skill system in turn-based board-like RPG I'm working on the implementation of a turn-based board RPG (like Descent: Journeys in the Dark) to improve my C++ skills and learn something about game-dev.

I have already done with general stuff, like Heroes and Monsters, their common action (move, attack) which they can do every turn. Now I want to add some skill system, and I'm not quite sure how to do it. I'm thinking about some skills that can be used after particular action is done (e.g. 'after attack dices are rolled, add +X to damage' or 'after another hero is revived, recover X HP'), some of those skill hero can gain by leveling up or with some item, but I don't know, how to implement this kind of skills.
Maybe adding a checking for a game state could be a good idea, but that leads to tens of different options and doesn't look like efficient way to implement.

Could anyone please help me?

sentences:
Change screen dimensions in libgdx in HTML Can i change the screen dimensions in libGDX in HTML?

If I inspect the element (the game) in Chrome and I change canvas width or height it changes the screen dimensions, but I don't know how to do it in the HTML file. I have the default file generated by libGDX.

The CSS path to the canvas containing the screen size is: #embed-html > table > tbody > tr > td > canvas

The HTML is:

          &#8635;

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:
Word in different color in middle of string XNA Is it possible to use different font colors for the same string, for example, when buying a weapon in CoD AW Exo Zombies:

How do I do this?

Thanks.

sentences:
How can I generate a lightning bolt effect? Is there an algorithm to generate a lightning bolt?
I would like an algorithm that generates a list of segment or point objects specifying where the bolt will land. The method would need a start point parameter, along with an endpoint. The bolt should have random branches coming off it, and zig-zag at random intervals. The result will be a random lightning effect that would look somewhat like this

(source: wikimedia.org)
If anyone knows of an algorithm that this may work for, help would be greatly appreciated!

sentences:
Can't change materials of model from FBX I was used 5.x before, and that version when I loaded FBX, Unity generated each material automatically, so I can change them like assigning textures or change shader.

And now I switched to 2017.3, and when I imported FBX, now Unity didn't generate materials anymore. I can see the properties of each material but every parameter is locked. It seems materials are inside of model and can't change like animation clips.

Some of model has multiple materials, so I can't generate manually and assign them. I'm creating mobile game so I really need to change the shader to mobile shader, not standard(PBR).

How to change materials of model from FBX in Unity 2017.3? Note that model created from Blender 2.7c and exported as FBX.

sentences:
Separating logic and data in browser game I've been thinking this over for days and I'm still not sure what to do. I'm trying to refactor a combat system in PHP (...sorry.) Here's what exists so far:

There are two (so far) types of entities that can participate in combat. Let's just call them players and NPCs. Their data is already written pretty well.
When involved in combat, these entities are wrapped with another object in the DB called a Combatant, which gives them information about the particular fight. They can be involved in multiple combats at once.
I'm trying to write the logic engine for combat by having combatants injected into it.
I want to be able to mock everything for testing.

In order to separate logic and data, I want to have two interfaces / base classes, one being ICombatantData and the other ICombatantLogic. The two implementers of data will be one for the real objects stored in the database, and the other for my mock objects.

I'm now running into uncertainties with designing the logic side of things. I can have one implementer for each of players and NPCs, but then I have an issue. A combatant needs to be able to return the entity that it wraps. Should this getter method be part of logic or data? I feel strongly that it should be in data, because the logic part is used for executing combat, and won't be available if someone is just looking up information about an upcoming fight. But the data classes only separate mock from DB, not player from NPC. If I try having two child classes of the DB data implementer, one for each entity type, then how do I architect that while keeping my mocks in the loop? Do I need some third interface like IEntityProvider that I inject into the data classes?

Also with some of the ideas I've been considering, I feel like I'll have to put checks in place to make sure you don't mismatch things, like making the logic for an NPC accidentally wrap the data for a player. Does that make any sense? Is that a situation that would even be possible if the architecture is correct, or would the right design prohibit that completely so I don't need to check for it?

If someone could help me just layout a class diagram or something for this it would help me a lot. Thanks.

edit

Also useful to note, the mock data class doesn't really need the Entity, since I'll just be specifying all the parameters like combat stats directly instead. So maybe that will affect the correct design.

sentences: How do I find a point on a line? I have two points (A, B) and the length of d. How can I find point C?

sentences:
Unity Animation (2D) - Cannot drag sprite into animation I am trying to create animations for my sprite which are configured to the "Multiple" option. When I try to drag the sprite into the timeline for the animation it won't do anything. It will just go back into the folder like nothing happened. I don't know if this is normal or there is a problem.
Thank You.
EDIT - First I created a 2D animation, I gave it a name, docked and locked the animation then tried to drag the sprite into the timeline and didn't let add components nor drag the sprite i spliced.

sentences:
How to fix infinite jump in Unity 3D? I have the following code:
public float jumpHeight = 3f;

bool isGrounded;

void Update()
{
    if(Input.GetButtonDown("Jump")) && isGrounded)
    {
        velocity.y = Mathf.Sprt(jumpHeight * -2f * gravity;
    }
}

sentences:
Geometry shader wireframe not rendering correctly GLSL/OpenGL/C++ Im trying to make a tool for skinning 3D models, and as part of that, I need to show faces wireframed, making use of the geometry shader stage.

Im following the approach suggested here and here. My problem however, is that it ends up looking like this:

Where some of the lines get thicker when the faces are oriented in a specific way. This is my geometry shader: (The vertex shader just passes vertices, so theres no need to show it)

#version 400

layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;

noperspective out vec3 gDist;

void main()
{
//800,600=window size(make uniform later)
vec2 p0 = vec2(800,600) * gl_in[0].gl_Position.xy/gl_in[0].gl_Position.w;
vec2 p1 = vec2(800,600) * gl_in[1].gl_Position.xy/gl_in[0].gl_Position.w;
vec2 p2 = vec2(800,600) * gl_in[2].gl_Position.xy/gl_in[0].gl_Position.w;

vec2 v0=p2-p1;
vec2 v1=p2-p0;
vec2 v2=p1-p2;
float area = abs(v1.x*v2.y - v1.y * v2.x);

gDist = vec3(area/length(v0),0,0);
gl_Position = gl_in[0].gl_Position;
EmitVertex();

gDist = vec3(0,area/length(v1),0);
gl_Position = gl_in[1].gl_Position;
EmitVertex();

gDist = vec3(0,0,area/length(v2));
gl_Position = gl_in[2].gl_Position;
EmitVertex();

EndPrimitive();
}

and frag shader:

#version 400

noperspective in vec3 gDist;

const vec4 wire_color = vec4(0.0,0.5,0.0,1);
const vec4 fill_color = vec4(1,1,1,0);

void main()
{
float d = min(gDist[0],min(gDist[1],gDist[2]));
float i = exp2(-2*d*d);

gl_FragColor = i * wire_color + (1.0 - i) * fill_color;
}

So what am I doing wrong here? I feel like im missing something. Is anyone familiar with this?

sentences:
How to calculate Camera "correct" position and distance to Frame all my Scene? Consider I have N dynamic points on my Scene, I would like to "frame" all them, with my Camera.

How can i calculate (at runtime) Vector3 Position to correctly frame all my scene ?

This is my idea:

Calculate Avarage for all my points
Move my Camera "up" to correctly "frame" all my points  (i don't know how)
Use Unity LookAt(myAvaragePoint)

Thanks

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:
Required Security Precautions for Flash / AS3 Multiplayer Game I have created a couple of games in Flash/AS3 and am playing with programming a flash-based multiplayer (possibly mmo?) game where the application will communicate with a server over a socket connection.

Obviously I need some form of authentication (username and password) but what other security precautions do I  need to explore to prevent cheating?

sentences:
Stop current animation and re-play immediately? When the player hit something, I'm playing hit animation from animation_player. However when player hit something while hit animation is playing, it just ignored and play previous hit animation.

I need to stop the animation, but couldn't find any related information. How do I stop the animation and play again immediately?

sentences:
How do I hide the bug image once it's hit by a bullet? I have almost solved my problem. I am able to shoot a bullet and hit a bug and it then draws a collision bitmap. but then it redraws a bug, I want to clear the bug bitmap after the collision happens.

public Form1()
{
    InitializeComponent();
}
public void Form1_Load(object sender, EventArgs e)
{
    timer1.Interval = 20;
    timer1.Start();
    timer2.Interval = 100;
    timer2.Start();
    this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);
}
int x = 0, y = 0;
Bitmap bug_one = new Bitmap("bug_one.bmp", true);
Bitmap ship = new Bitmap("ship.bmp", true);
Bitmap bullet = new Bitmap("bullet.bmp", true);
Bitmap coll = new Bitmap("coll.bmp", true);
Bitmap black = new Bitmap("black.bmp", true);
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Left)
    {
        x-=5;
        if(x<=-350)
        {
            x = -350;
        }
    }
    if(e.KeyCode == Keys.Right)
    {
        x+=5;
        if(x>=375)
        {
            x = 375;
        }
    }
    if (e.KeyCode == Keys.Space)
    {
        if (y <= -530)
        {
            y = 0;
        }
    }
}
int count = 102;
public void Form1_Paint(object sender, PaintEventArgs e)
{
    e.Graphics.Clear(Color.Black);
    e.Graphics.DrawImage(ship, 350 + x, 530);
    e.Graphics.DrawImage(bullet, 375 + x, 520 + y);
    e.Graphics.DrawImage(bug_one, 350, 0);
    if (y <= -510 && x >= -15 && x <= 15 && count > 0)
    {
        e.Graphics.DrawImage(coll, 350, 0);
        count = 0;
    }
}
public void timer1_Tick(object sender, EventArgs e)
{
    y -= 5;
    Invalidate();
}
public void timer2_Tick(object sender, EventArgs e)
{
    count--;
    Invalidate();
}

This attempt almost works: when a bullet hits a bug it draws a collision image, but then all the bugs are cleared. I only want one bug to be cleared at a time.

    public void Form1_Paint(object sender, PaintEventArgs e)
    {
        e.Graphics.DrawImage(ship, x-25, 530);
        e.Graphics.DrawImage(bullet, x, y);
        if (collision)
        {
            return;
        }
        foreach (Bug bug in bugs)
        {
            e.Graphics.DrawImage(bug_one, bug.px, bug.py);
        }
        foreach (Bug bug in bugs)
        {
            if (x >= bug.px && y >= bug.py && x <= bug.px + bug.width && y <= bug.py + bug.height)
            {
                e.Graphics.DrawImage(coll, bug.px, bug.py);
                collision = true;
            }
        }
    }

sentences:
I need some help with stopping individual sound effects in OALSimpleAudio I'm trying to find out how to stop a specific sound effect rather than having to stop all of them.

I'm using OALSimpleAudio.

I can't seem to find how to do it. simple google searches result in nothing, which means my searches are crap, it's REALLY easy to do and i'm ... stupid :p, or it isn't possible.

I hope you guys can help me.

In the background i have a humming engine sound, but when the object takes damage, the humming sound is stopped, that's not what i want.

case kStateTakingDamage:
        CCLOG(@"Ship taking damage");
        [self playTakingDamageSound];
        self.characterHealth = self.characterHealth - 1.0f;
        action = [CCActionAnimate actionWithAnimation:damageAnimation];
        [[GameManager sharedGameManager] stopSoundEffect];
        break;

- (void) playSoundEffect: (NSString *) soundEffect {
    [self playSoundEffect: soundEffect andLoop: NO];
}

- (void) playSoundEffect: (NSString *) soundEffect andLoop: (BOOL) loop {
    [[OALSimpleAudio sharedInstance] playEffect:soundEffect loop: loop];
}

- (void) stopSoundEffect {
    [[OALSimpleAudio sharedInstance] stopAllEffects];
}

- (id) isSoundPlaying {
    //TODO: find out how this works ;
}

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:
Can't delete face Maya So here is my model (bed sheets). I have an extra face right below it and I cannot delete it. I made it bigger for you guys but at first it was really small. I have no idea how that geometry got there. I used nCloth for the bed sheets and it was my first time using it, maybe that's where I screwed up.

I tried to separate the faces for the sheets and create a new object but I received that message: // Error: line 0: sheets has only one piece. Ignored.

sentences:
How to implement armor? I am a newbie in Python, I am very bad at math too and I need some help. Also close/move this post if you feel this isn't the right place for it.

Hero1 = 5000   # His HP is 5k.
Hero1dmg = 200 # damage output

How can I subtract some value (let's say 20%) from Hero1's damage output?

sentences: 3d Maya object mesh problems when used in Unity Asking for help to solve a problem 3d Maya objects imported in Unity to make an ios app. Maya object change when imported on Unity mesh attributes disappears and mesh structure comes evident. Has anyone some suggestion to fix this problem?

sentences:
How to decompose a rectangular shape in a Voronoi diagram, only generating convex shapes? I think this is a very straighforward question, lets say i have a building in 2D, a rectangle shape. Now i want to decompose that area in a lot of convex shapes, as seen in a voronoi diagram, or closely like it, just so I can add those shapes to the physics engine, and have a realistic destruction.

Bonus: Possible suggestions on how to make the effect more dynamic and interesting.

Please keep in mind we re talking about realtime calculations..

sentences: Hiding pixels inside a Shape I have a player wich is a png image and I want a part of him to be able to go behind things, so I need to know how to hide pixels that are inside of a shape

sentences: Should be GameKit used together with GameCenter? As far as I understand, GameKit provides Bluetooth-maches, while GameCenter allows to play matches through internet. So it looks like the best scenario is to use both of them? Is this reasonable?

sentences:
How do you restrict sideway movement in 3D endless runner in Unity? I have been making a endless runner 3d game and implemented 3 lane side way movement. It's working perfectly, although I want to restrict my movement for the 3 lanes only. If my character for example say on left lane, If I press left again it should not move to the side anymore since there's not lane beyond the left one. I did implemented a logic for this, though when I press either left or right in the borders of the lanes it freezes the side way movement. Any idea on how to stop this. This is my code.

PlayerMortor.cs

     private bool isChangingLane = false;
     private Vector3 locationAfterChanginLane = Vector3.zero;
     private Vector3 sideWayMovementDistance = Vector3.right * 2f;
     private float sideWaySpeed = 6f;

     void Update()
        {
            currentBaseState = anim.GetCurrentAnimatorStateInfo(0);

            if (controller.isGrounded)
            {
                verticalVelocity = -0.5f;
                if (currentBaseState.fullPathHash == locoState)
                {
                    if (Input.GetButtonDown("Jump"))
                    {
                        verticalVelocity = 18f;

                        anim.SetBool("Jump", true);
                    }
                }

                MoveLeftRight(); //Call sideway movement on update()

                if (isChangingLane)
                {
                    if (Math.Abs(transform.position.x - locationAfterChanginLane.x) < 0.1f)
                    {
                        isChangingLane = false;
                        moveVector.x = 0;
                    }
                }
            }
       }

    private void MoveLeftRight() //Sideway Movement function
    {
        if (controller.isGrounded && !isChangingLane)
        {
            isChangingLane = true;

            if (Input.GetKeyDown(KeyCode.A))
            {
                locationAfterChanginLane = transform.position - sideWayMovementDistance;
                moveVector.x = -sideWaySpeed;
            }
            else if (Input.GetKeyDown(KeyCode.D))
            {
                locationAfterChanginLane = transform.position + sideWayMovementDistance;
                moveVector.x = +sideWaySpeed;
            }
        }
    }

    private void OnControllerColliderHit(ControllerColliderHit hit) //Restriction when we move sideways beyond border
    {
        if (hit.collider.gameObject.tag == "Border")
        {
            Debug.Log("Border Hit");
            isChangingLane = false;
            moveVector.x = 0;
        }
    }

Any help would be appreciated. :)

sentences: Wanting to make a quick java game Hey guys I have experimented in making games in java.  So far I have created A text game in JOptionPane that is kind of like Zork but with yes and no buttons (that were changed to "left" and "right").  I have also made a small game  where a ball bounces around a screen but with was with heavy help from a website tutorial.  Do you guys have any advice or stories about your first game programming? I really want to get into it but it seems like such a steep learning curve.  Any help on where I should start or advice? Thanks guys!

sentences: Tiled tmx format into 3d Texture I am thinking of making 3d games with 2d pixels feel. So far, i have been playing around in tiled and monogames. I learned some xml and managed to import and render tmx into my game. This is maybe a dumb question. How do you convert tmx into 3d texture? What kind of software do you need?

sentences:
How could I implement my library/game to run in a browser plugin? I usually code cross-platform, to build as native code for Mac Linux and Windows,
but I clearly see the value in being able to display my game in a browser.

Could you guide me in doing such a task? How could i have something like Unity Web Player?
Cross-browser is preferable, but Chrome would already be great  :)

I use technologies such as SFML, libRocket, Box2D and more.. If that is pertinent to the question!

Thanks

sentences: How are photorealistic models' textures created? I've been learning Blender and have made some decent progress. I've made some neat models, but so far, they haven't been textured. I understand how to unwrap a model so as to get the UV coordinates, but how do I actually create a texture to fit this coordinates? I've looked around and so far, it seems like a lot of people spend time hand-painting their models. Then I look at games like Counterstrike: Source, Call of Duty, etc., and I'm wondering how their models look photorealistic. It's all a bit of a mystery to me, but I'm hoping somebody could clarify. So, how exactly are photorealistic models created?

sentences:
Drag 3D camera with mouse cursor I have a camera that is moved by changing its X and Z coordinates. However, the camera is rotated, so when an object moves by 1 unit in the world, the number of pixels it moves by isn't trivial to determine.

How could I move the camera so that if the pointer is at a set point, that point will be under the cursor after the cursor moves?

I have a PerspectiveCamera and the number of pixels that the pointer was dragged in each direction (X and Y) on the screen.

sentences:
What to do after detecting OBB-OBB intersection I'm using this code to detect intersections between two OBBs. The problem is that i don't know what to do after detecting it. I tried using a simple algorithm:

    if (collision detected) {
        move character back to its position on previous frame
    }

But this is not what i need, because the character is rotating and moving to certain points (usually to mouse click position). When it's close to an object with OBB and it rotates to a point, its OBB updates (the position of all OBBs corners is recalculated) and most of the time the updated OBB intersects with an object that is near, so the charecter gets stuck at its position.

How can i deal with the rotation problem or what other methods can you offer for stoping character when its OBB itersects with another?

sentences:
How do I save and restore an int value with PlayerPrefs? I am stuck on how to save the player's amount of money. When I build the game in the exe as soon as I shutdown the game my money value gets lost. I want this money to be saved. I am using the following code in UnityEngine:

using UnityEngine.UI; using System.Collections;

namespace CompleteProject
{
    public class MoneyManager : MonoBehaviour {
        public static int money; // The player's money.
        Text moneytext;          // Reference to the Text component.

        void Awake ()
        {
            // Set up the reference.
            moneytext = GetComponent <Text> ();
            money=print(PlayerPrefs.GetInt("Money"));
        }

        void Update ()
        {
            moneytext.text = "" + money;
            PlayerPrefs.SetInt ("Money", money);
        }
    }
}

sentences:
Triangulating a point mesh at runtime I'm familiar with various methods of triangulation (eg Delaunay), but since I have hundreds of thousands of regularly spaced points that may need to be revisited like this on each physics frame, I'm hoping that there's a more efficient way to do this.

What I need to do is, given a series of points like this:

locate the triangles and perimeter. While I haven't show it in this image, it should be possible to form holes in the mesh where there are points missing inside the blue perimeter shown below. Still, I do need to find all the interior perimeters.

or, if it would be faster

My current plan is to use Delaunay triangulation to build the mesh, not merging the triangles at all, and then starting from an arbitrary point, select points which meet criteria for being an edge (being a member of less than 5 triangles?). Is there a more efficient way to do this?

sentences:
Getting data from the backbuffer D3D11 using Map I'm having some trouble using ID3D11DeviceContext::Map() correctly.
Here's the whole function so far:
 Color Graphics::GetPixel(int x, int y) const
{
    //Temp frame buffer descriptor;
    CD3D11_TEXTURE2D_DESC pFrameDesc;
    pFrameDesc.Width = WindowWidth;
    pFrameDesc.Height = WindowHeight;
    pFrameDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
    pFrameDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
    pFrameDesc.MipLevels = 1u;
    pFrameDesc.ArraySize = 1u;
    pFrameDesc.SampleDesc.Count = 1u;
    pFrameDesc.SampleDesc.Quality = 0u;
    pFrameDesc.Usage = D3D11_USAGE_DEFAULT;
    pFrameDesc.BindFlags = D3D11_BIND_UNORDERED_ACCESS;
    pFrameDesc.MiscFlags = 0u;

    // Create temp frame buffer(2d texture)
    wrl::ComPtr<ID3D11Texture2D>pFrame = nullptr;
    HRESULT hr = pDevice->CreateTexture2D(&pFrameDesc, nullptr, &pFrame);
    GFX_THROW_INFO(hr);

    hr = pSwapChain->GetBuffer(0, __uuidof(pFrame), &pFrame);
    GFX_THROW_INFO(hr);

    D3D11_MAPPED_SUBRESOURCE map;
    map.RowPitch = WindowWidth * 4;
    map.DepthPitch = WindowHeight * 4;

    //Throwing here, CPU access flags problem.
    hr = pContext->Map(pFrame.Get(), 0u, D3D11_MAP_READ, 0u, &map);
    GFX_THROW_INFO(hr);

    pContext->Unmap(pFrame.Get(), 0u);

    return { 0.0f, 0.4f, 0.0f, 0.0f };
}

I'm getting an exception thrown at pContext->Map()
"Map cannot be called with MAP_READ access, because the Resource was not created with the D3D11_CPU_ACCESS_READ flag. "
Which is confusing as the newly created resource has the D3D11_CPU_ACCESS_READ flag enabled. This is also true If I try MAP_WRITE and change the access flags to match. I've also tried ORing the flags together with no luck.
The ultimate use of this function is to be able to create a CPU side array of Color objects (Colors are currently a struct of four floats) Which I can then send onto the NewTek NDI sdk. But I feel it would also be useful for saving screen shots, creating colour pickers etc.
Any ideas welcome!

sentences:
EditorApplication.SaveScene followed by EditorWindow.Close throws InvalidOperationException I'm making a really basic custom editorwindow that has a textbox for a scene name, creates a scene with that name and closes itself. Trimmed down to the essence it looks like this:

public void OnGUI()
{
    if (!GUILayout.Button("Create")) return;

    if (CreateScene())
    {
        Close();
    }
}

private bool CreateScene()
{
    var path = string.Format("{0}/{1}.unity", Application.dataPath, "bug");
    EditorApplication.NewScene();
    return EditorApplication.SaveScene(path);
}

This throws an InvalidOperationException

InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Stack.Peek () (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections/Stack.cs:321)
UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/GUILayoutUtility.cs:223)
UnityEngine.GUILayout.EndVertical () (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/GUILayout.cs:266)
UnityEditor.HostView.OnGUI () (at C:/BuildAgent/work/d63dfc6385190b60/Editor/Mono/GUI/DockArea.cs:135)

When I remove either the save or the close, the exception doesn't rise.
My guess is the project window needs to finish refreshing somehow.

UPDATE

Tried a frame of delay
Tried AssetDatabase.Refresh()
Tried GUILayout.EndVertical()
Filed a bug
Bugtrack: http://fogbugz.unity3d.com/default.asp?668833_nmit48pnb2fivo27

Any advise?

sentences:
Are interleaved vertex data formats better than non-interleaved formats? I have been reading up on data formatting for 3D objects so that I can render my meshes as fast as possible in OpenGL. I am quite new to OpenGL so bear with me.

The format for interleaving your meshes goes something like:

 position, normal, texture1, texture2  //this I understand

Most formats for 3D meshes, however, don't use this structure. From my understanding the interleaved format is fast for execution but isn't necessarily the best in terms of size, since you never really have as many unique normals as you do vertices, since (if you are using hard shading) all normals for a face would be the same.

A hard shaded basic cube for example has 8 unique vertices and 6 unique normals.

So my question is, is it worth it to set up an interleaved format like this despite the fact that if you had 3 separate buffers you would use MUCH less data?

Also (remember I'm new) is it somehow possible to do pack your vertex information like:

 all positions, all normals, all tex1, all tex2 //so all of one type in a sequence

and have different sets of indices for each type? Or is that just dumb?

sentences:
Is there a sound library for C to generate sound samples from code? I'm working on an engine for a retro-style game in C.  I'm looking for a sound library that would produce chip sounds from code...I want to make my own simple chiptune tracker for the engine to create music.  Does such a thing exist?

I'd also be interested in a library to use .nsf files in my project.

I'm using Linux for development.

sentences:
General pointers and advice in creating inventory structure? I am working on text-based Diablo-like RPG, where each weapon and armor has unique stats and names and there is a lot of overlap. Ie I can generate Silver Sword with 40 damage, but I can also generate Silver sword with 20 damage. So those items can't obviously be stored as one value. I am thinking of storing the items in multidimensional array where one column would store weapon name and the other column would be used for storing the damage. Same for armor etc. But I feel this may get cumbersome and spiral out of control very quickly.

Is there any other data structure I could use and have more flexible and efficient solution?

sentences:
Do open world games need less backstory? I've played a few open-world games and really enjoyed them, though the ones I've really enjoyed have generally received complaints about how little story there is to them.

The Saboteur is one example of this. Fully open-world, good enough story (for me, anyway), engaging gameplay, and still has received complaints in reviews about not having enough story.

Do open-world games actually need a full, all-encompassing story? Or can fun and engaging gameplay fill in the gap and let the designer get away with a slightly less complete story?

sentences:
Component based design, but components rely on each other I've begun stabbing at a "Component Based" game system.

Basically, each entity holds a list of components to update (and render)
I inherit the "Component" class and break each game system into it.

Examples:
RenderComponent   - Draws the entity
MovementComponent - Moves the entity, deals with velocity and speed checks
DamageComponent   - Deals with how/if the entity gets damaged...

So, my system has this:
MovementComponent
InputComponent

Now maybe my design is off, but the InputComponent should say things like

if (w key is down)
    add y speed to movement

if (x key is down)
    Trigger primary attack

This means that the InputComponent sort of relies on these other components. I have to do something alone the lines of:

if (w key is down)
{
    MovementComponent* entityMovement = mEntity->GetMovement();
    if (entityMovement != NULL)
        add y speed to movement
}

which seems kinda crappy every update.

Other options? Better design? Is this the best way?

Thanks!

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:
How to offset particles from point of origin Hi I'm having troubles off setting particles from a point of origin. I want my particles to spread out after a certain radius from a the point of origin. For example, this is what I have right now:

All particles emitted from a point of origin. What I want is this:

Particles are offset from the point of origin by some amount, i.e after the circle. What is the best way to achieve this? At the moment, I have the point of origin, the position of each particle and its rotation angle. Sorry for the poor illustrations.

Edit: I was mistaken, when a particle is created, I have only the point of origin. When the particle is created I am able to calculate the rotation of the particle in the update method after it has moved to a new location using atan2() method.

This is how I create/manage particles:
Created new particle at enemy ship death location, for every new particle which is added to the list, call Update and Draw to update its position, calculate new angle and draw it.

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:
Portal 2 Authoring Tools: func_instance_io_proxy not working? I have a func_instance (which I made myself) of a door in my map. It is supposed to open when a cube is fizzled. I also put a checkmark indicator to make sure I had the cube's logic correct. When the cube is fizzled, the checkmark indicator lights up, but the door does not open. To make sure the door was working, I put a logic_auto into the prefab which opened the door when the map loaded. This worked correctly. I therefore think that there is something wrong with the func_instance_io_proxy, but I do not know what. Here are some screenshots:

The cube targets the openDoor relay's trigger input via the func_instance_io_proxy. It also targets the checkmark indicator, which properly lights up when the cube is fizzled.

My door func_instance. The relay on the left opens the door, and the one on the right closes it.

The logic_auto targets the closeDoor relay on startup, which does execute properly, as the door is closed when I go to test the map.

Finally, the func_instance_io_proxy targets the openDoor's trigger input. However, when I try and access it via the cube, it does not work, and the door does not open.

*By the way, I am running this on linux via wine, which is why it looks like windows 98

**Off-topic question, is this the right place to post this, since it is technically map making, not game development?

sentences: Blender modelling for a C++ game? I want to know if it were possible to integrate models created with Blender into a game written in solely C++.

sentences:
How do I gain access to objects in order to change their properties in Unity? I have created a GUI text object named "GUIText" in the Unity editor, and I want to change what the text says via code (I'm using C#). How do I access GUIText1 to change its string properties?

I want to be able to write code like this:

GUIText1.Text = "";

In general, I'm not sure how to get access to any sort of object created in the editor (a mesh or a light for example). How do you access them in code?

I already know how to write the scripts and trigger them.

sentences:
Efficiently separating Read/Compute/Write steps for concurrent processing of entities in Entity/Component systems Setup

I have an entity-component architecture where Entities can have a set of attributes (which are pure data with no behavior) and there exist systems that run the entity logic which act on that data. Essentially, in somewhat pseudo-code:

Entity
{
    id;
    map<id_type, Attribute> attributes;
}

System
{
    update();
    vector<Entity> entities;
}

A system that just moves along all entities at a constant rate might be

MovementSystem extends System
{
   update()
   {
      for each entity in entities
        position = entity.attributes["position"];
        position += vec3(1,1,1);
   }
}

Essentially, I'm trying to parallelise update() as efficiently as possible. This can be done by running entire systems in parallel, or by giving each update() of one system a couple of components so different threads can execute the update of the same system, but for a different subset of entities registered with that system.

Problem

In the case of the shown MovementSystem, parallelization is trivial. Since entities don't depend on each other, and don't modify shared data, we could just move all entities in parallel.

However, these systems sometimes require that entities interact with (read/write data from/to) each other, sometimes within the same system, but often between different systems that depend on each other.

For example, in a physics system sometimes entities may interact with each other. Two objects collide, their positions, velocities and other attributes are read from them, are updated, and then the updated attributes are written back to both entities.

And before the rendering system in the engine can start rendering entities, it has to wait for other systems to complete execution to ensure that all relevant attributes are what they need to be.

If we try to blindly parallelize this, it will lead to classical race conditions where different systems may read and modify data at the same time.

Ideally, there would exist a solution where all systems may read data from any entities it wishes to, without having to worry about other systems modifying that same data at the same time, and without having the programmer care about properly ordering the execution and parallelization of these systems manually (which may sometimes not even be possible).

In a basic implementation, this could be achieved by just putting all data reads and writes in critical sections (guarding them with mutexes). But this induces a large amount of runtime overhead and is probably not suitable for performance sensitive applications.

Solution?

In my thinking, a possible solution would be a system where reading/updating and writing of data is separated, so that in one expensive phase, systems only read data and compute what they need to compute, somehow cache the results, and then write all the changed data back to the target entities in a separate writing pass. All systems would act on the data in the state that it was in at the beginning of the frame, and then before the end of the frame, when all systems have finished updating, a serialized writing pass happens where the cached results from all the different systems are iterated through and written back to the target entities.

This is based on the (maybe wrong?) idea that the easy parallelization win could be big enough to outdo the cost (both in terms of runtime performance as well a code overhead) of the result caching and the writing pass.

The Question

How might such a system be implemented to achieve optimal performance? What are the implementation details of such a system and what are the prerequisites for an Entity-Component system that wants to use this solution?

sentences:
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:
Architectural approaches to creating a game menu/shell overlay on PC/Linux? I'm am working on a collection of games for a custom digital tabletop installation (similar to Microsoft Surface tables). Each game will be an individual executable that runs full-screen. In addition, there needs to be a menu/shell overlay program running simultaneously. The menu/shell will allow users to pause games, switch to other games, check their game history, etc.

Some key requirements of the shell:

it intercepts all user input (mainly multitouch) first before passing it on to the currently running game (so that it can, for instance, know to pop-up at a "pause" command);
can reveal on arbitrary portions of the screen, with the currently running (but presumably paused) game still showing underneath, ideally with its shape/size being dynamic, to allow for creation of an animated in/out drawer effect over the game.

I'm currently looking into different architectural approaches to this problem, including Fraps and DirectX overlays, but I'm sure I'm missing some ways to think about this. What are the main approaches I should be considering?

(Note the table is currently being run by Windows PC, but it could potentially be a Linux box instead. By this I don't mean I need an OS-agnostic solution. I'd be happy with a Windows-specific solution. But I would be willing to consider switching to Linux and using a Linux-specific solution if it's much easier to achieve this in Linux.)

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:
Accessing archived assets - what are the options in C#? We are looking to add an archiving system to our game, where the assets (textures, scripts, sounds, etc.) will be located and directly accessed from memory. The main requirements are:

Files must not be compressed
Archive must have an internal folder structure
Individual files must be accessed directly from the archive without the need to extract them to the hard disk
If an external API is used, it must be able to run on Windows, Mac and Linux ; optimally, it should be redistributable free of charge

Our game engine is in C#, and we are looking for a managed solution (i.e. no PhysicsFS). What could be our options in this case?

Could it make sense to implement the whole thing by ourselves, using FileStream?

sentences: How do you create a fractal cube-map? I want to create a map similar to how Mincraft and other related games do. I just haven't the faintest clue on how to do so. Can anyone point me to a decent tutorial or give me a decent run through? I program in java and use openGL.

sentences:
Creating sideways friction in a 2D top down racer I've been playing around with trying to create some kind of top down racer but I'm having trouble getting the car to turn properly. At the moment this is the code I have to update the position of the car:

var power;
    if (keyboard.upKeyDown) {
        power = 1;
    } else {
        power = 0;
    }

if (keyboard.leftKeyDown) {
    this.rotate -= 0.05;
} else if (this.keyboard.rightKeyDown) {
    this.rotate+= 0.05;
}

this.velocityX += Math.cos(this.rotate) * power;
this.velocityY += Math.sin(this.rotate) * power;

var cDrag = 0.98;
this.velocityX *= cDrag;
this.velocityY *= cDrag;

this.positionX += this.velocityX;
this.positionY += this.velocityY;

At the moment the code is very simple, you hold down UP and force is applied in the direction you're pointing which makes it feel like the ship in asteroids.

It seems to me the next thing I need to do is compare the direction the car is pointing with the direction it's actually travelling and apply some sideways force to make it slow down in the sideways direction but also transfer some of that force to the forward direction so it keeps going in the direction it's now pointing.

I'm a bit confused as to how I go about doing this so any advice would be most welcome.

sentences: How to smooth scene2d ui default skin? I am usng uiskin.png, default.fnt, uiskin.atlas to create my game UI, but the images is blurred, How do I make it smooth?

sentences:
Design question: How to handle input more efficiently? I'm designing a system to handle the keyboard input for my game. To get it more simple, I have a class that has two methods, KeyUp and KeyDown which tell me which key has been pressed, this is already implemented by the library I'm using, now I want to have a way to send that information to the classes that are handling input (I'm using an MCV pattern, those would be the controllers). I've thought of two ways of doing that, both seem valid to me, and I don't know which is better, so I'm asking which would be the best way, in terms of object-oriented design, and if it has any significant impact, also efficiency.

The first way I thought of is having the class which receives the input hold references to all the controllers, and then call some methods of those controller classes in an event-like fashion when a key event is triggered in this class.

The other method is the other way round, the controllers hold a refference to the input handler class, which in this design has some kind of data structure (I was thinking of an EnumMap) that holds the status of all the relevant game keys, and then the controller classes might query the input handler for a key with some getters (just to encapsulate the data structure).

So, that's it, I'd like some help on how to do this. Any comments on which of both is better, or a new design that might be better than this are more than welcome.

Thanks in advance.

sentences:
Calculate when round object is inside an ellipse I want to calculate in java when a circle is inside an ellipse. I drew an example below:

For this particular problem, the top left corner of the field has the position 0.0f, 0.0f. The bottom right corner has the position 1.0f, 1.0f. The position of the bat is: 0.48f, 0.94f. The goal is located at: 0.5f, 1.0f, height is 0.1f and the radius 0.4f.

How can I calculate if the bat is inside the ellipse?  What is the general algorithm?

sentences:
Flash Game not working on Android I am not sure if I will be able to provide enough information for someone to answer this question, but any ideas might help.

I am creating a tower defense game in Flash and I eventually want to make it run on Android. Just for testing purposes, I have been running it on Android's browser and different Android .swf player apps.

Recently, the game stopped working correctly. When it gets to the second wave of enemies, they get about four tiles in and stop moving. I can get them to start moving again by constantly clicking on parts of the screen. It's almost like the game loop has quit updating.

Trying to solve the problem, I have updated the gameloop from Flash's standard events to a NativeSignal event (didn't solve the problem but the game runs much faster overall).

The game works fine on my PC, I can't figure out the Android problem though. Any ideas or help would be appreciated. I didn't want to supply code since I wouldn't know where to start that would be helpful.

sentences:
How can I calculate a terrain's normals? Im trying to implement basic lighting in Opengl 3+ (a sun) with this tutorial :

http://www.mbsoftworks.sk/index.php?page=tutorials&series=1&tutorial=11

Im building a basic terrain and its working well. Now im trying to add normals, and I think its not working well :

Terrain in wireframe

As you can see I dont think my normals are good.

This is how I get them :

for(x = 0; x < this.m_size.width - 1 ; x++)
    {
        for(y = 0; y < this.m_size.height - 1 ; y++)
        {
            immutable uint indice1 = y * this.m_size.width + x;
            immutable uint indice2 = y * this.m_size.width + (x + 1);
            immutable uint indice3 = (y + 1) * this.m_size.width + x;
            immutable uint indice4 = (y + 1) * this.m_size.width + x;
            immutable uint indice5 = y * this.m_size.width + (x + 1);
            immutable uint indice6 = (y + 1) * this.m_size.width + (x + 1);

            Vector3 v1 = vertexes[indice3] - vertexes[indice1];
            Vector3 v2 = vertexes[indice2] - vertexes[indice1];
            Vector3 normal = v1.cross(v2);
            normal.normalize();

            normals[indice1] = normal;

            indices ~= [indice1,
                        indice2,
                        indice3,
                        indice4,
                        indice5,
                        indice6];
        }
    }

I use this basic shader : http://ogldev.atspace.co.uk/www/tutorial18/tutorial18.html   or in the link I posted at the top.

Thanks.

sentences:
How should I go about randomizing levels in a "runner" game? I'm working on a runner type of game (basically it's a never ending run through hordes of enemies and platforms and whatnot). 2d platformer view.

Should I random a bit of map every now and then? Few screens or 30 screens? And what about platforms and ground to make the whole thing "doable". Can I find any resources on that subject?

sentences:
Develop Isometric Games could someone explain me about isometric games ? i'm unity beginner and want to know about game development.

i read that its 2.5 d , that all the objects is actually 2d sprites,
is that true ?
can we combine it (i use isometric camera, pan only, no rotation) ? ,i mean can we use 2d (for buildings) and 3d (characters) ?
i recently play android games (Fun Hospital Tycoon), anyone know the
game ? are they using full 2d or combined ?

thank you.

sentences:
Can I use DirectX with C#? I thought that if you wanted to make games using DirectX, you had to know C++. But I recently found out that that is not actually true. It looks like some parts of Direct3D can be used from C#. This MSDN document, for example, which has C# examples.

Am I understanding this incorrectly? Have I waited all these years for nothing?

sentences:
Calculating Delta time , what is wrong? For 2 days now i am trying to calculate the correct delta time for my game , I am starting to getting crazy since i tried all the solutions that i found on the 5 first google pages...
What is wrong? I cant get the correct delta time ,whatever i tried is just not working , the delta goes from 1 to 4 and then back 1 and then to 3 even if i take the averange delta between many frames.Plus  the game runs way much faster(i mean the movement) on slow devices than in fast.
The game runs on android so the spikes between frames are expected.

My code is this:

    void Game::render()
    {

        timesincestart=getTimeMil();

        _director->Render();
        _director->Update();

        float dif=(getTimeMil()-timesincestart);//usally its about 5 milliseconds

        lastcheck++;
        sumdelta+=dif;
        if(lastcheck>20)
        {
            sumdelta=sumdelta/20;
            delta=sumdelta;
            sumdelta=0;
            lastcheck=0;
        }

        LOGI("delta:%f",delta);
    }

SOLVED:

void Game::render()
{
    oldtime=newtime;
    newtime=getTimeMil();

    delta=(newtime-oldtime)/16;//divide by 16 is just making the dt closer to 1

    _director->Render();
    _director->Update();

}

sentences:
Difference between multiple AudioUnits and one AudioGraph with a MultiChannelMixer I'm porting my game to iOS using MonoTouch, and I'm having some trouble getting sound output to work. SystemSound/AVAudioPlayer is way too simple for my needs (I need looping and multiple simultaneous sounds), and OpenTK is not trivial to get working, in addition for it not supporting audio decoding by itself.

So I've settled with CoreAudio, which seems to do the trick. I've downloaded some samples, and gotten it to play and loop some sounds. Now I want it to play multiple sounds at the same time.

I noticed that it was trivial to get multiple sounds by creating multiple AudioUnits, each one separately connected to RemoteIO, but this doesn't seem to be very efficient. You can also mix multiple sounds by creating a graph and mixing everything on a MultiChannelMixer connected to RemoteIO which seems to be the right way to do it.

But I'm basing my decisions on pure assumptions (and in my short iOS experience, I've seen my assumptions are usually wrong when it comes to iOS, like some kind of inverse Principle of Least Astonishment), so I would like to ask the CoreAudio gurus over here if there is a real difference between these two approaches, or if there is a "more correct" approach to do what I want.

sentences:
How many datapoints are there generally in terrain height maps? I've created my own heightmap with data from USGS. The heightmap is pretty large, but the point density is low, resulting in a low-poly terrain.

While performance is excellent, the physics engine I'm using doesn't particularly like how much distance is between each point, resulting in clipping.

Regardless, what is the point density like for games like H1Z1 or any other game that uses a height map on a large world?

sentences:
Admob for Unity: clarification on use needed I'm following this documentation by Google on how to integrate Admob ads into my game and I'm confused because of the following:

This documentation says I build by game and then I mess around with ads. (Section Unity plugin API tells me how to add ads and that's after the build instruction). Shouldn't it be vice versa? That I place those ads and build last?

Or, if I really do build first, where do I add those ads?

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:
Best practice for 4x game management in Unity? I'm trying my hand at creating a turn-based 4x game in Unity, with a galaxy map and 2D hexagon grid maps for each individual planet. The planet grid hexes would be gameobjects, with the overall grid being around 30x40 in size. The number of planets would be under 50.

What would be the best way to set this up? I'm looking for a solid approach regarding performance here, but one that also caters to easier design/programming would be a plus.

Some approaches I've come up with:

Load all of the grids for the individual planets at the start into a single scene, with each being under a "planet gameobject", and then set those gameobjects to inactive. The galaxy map would be its own scene that is loaded additively when needed; clicking on a planet to view it would set its associated gameobject to active and then unload the galaxy map scene.
Instantiate the gameobjects for planets as they're called up; the grid data for the planet is dynamically loaded as part of this. The planet gameobject is destroyed when no longer needed. Galaxy map would function the same as approach 1.
Individual scenes for each planet, loaded/unloaded additively when needed. A separate, single scene would be used for loading procedurally generated planets.

Seems to have serious challenges for managing units/resources across planets/scenes.

Approach 1 seems to be the most straightforward, as the core of the game would be managed in a single scene, but I am concerned about performance. I'm setting up some test projects to stress test the approaches, but it'd be great to get feedback from someone with more experience.

Any help is appreciated!

sentences: Unity 2019.3 HDRI SkyBox I am trying to create an HDRI SkyBox out of 6 textures but after I create the cubemap with Assets → Legacy → Cubemap and drag it in the HDRI Sky I get an all white environment. Is this a problem with the textures or maybe I am missing some setting?

sentences:
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 to save one color channel, taking only 1 byte per pixel? How can I save only one color channel, such that it would only take 1 byte per pixel?

I only want to save the alpha channel and apply colors later using a custom shader. But all the formats I tried so far take more memory than necessary. For instance, 8x8 image should only take 64 bytes. Is there any image format that allows this?

sentences:
XNA/C# Convert polygons into tilemap I'm currently working on my 2D survival game, where the world is infinite and generated by perlin noise. I wanted to also include biomes and this article interested me - http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ .

I downloaded the source ported to C# and edited it to 2D, but there's the problem. I generated simple map 100x100 but then, I dont know how to convert those polygons into the tiles. I tried a simple technique:

for (int x = 0; x < map.GetLength(0); x++)
        {
            for (int y = 0; y < map.GetLength(1); y++)
            {
                float rozdilP = 100000f; Biome b = BiomeTypes.Snow;

                foreach (Center center in EnvironmentService.MapGenService.Centers.Values)
                {
                   float rozdil = Vector2.Distance(new Vector2(x, y), new Vector2(center.Point.X, center.Point.Z));
                    if (rozdil < rozdilP)
                    {
                        rozdilP = rozdil;
                        b = center.Biome;
                    }

                }
                map[x, y] = b;
            }
        }

it works, but it's really, really slow. Isn't there any better solution or algorhytm for this or is the polygon method of generation supposed to be used only in 3D?

Ty for your time and answer :)

sentences:
I'm having resolution issues; does my math suck? There are a lot of scripts involved so I'm just going to give a generalized description of the process.

First, a 1x1 square tile is created. Second, that tile is placed out of the way, and 16 x 10 (160) new tiles are created starting at the (0,0) position and building outward in positive numbers. Now, the camera is a 16:10 display.  At this point, I wanted to scale up the tiles. If I want to scale the map up I start by scaling the camera by 100, and then I scale the tiles, and align their position (edge to edge).  At this point, scaling the tiles by 100 seems logical, but that didn't work correctly, for some reason. Scaling by 50 almost works, but the resolution is no longer a 16:10 grid like it was before the scaling.

What am I doing wrong?  I am using Unity.

sentences:
I want to show total time spent by all players around the world in my game I am developing a Unity3D game. I want to show in my game:

Total time spent playing all time by all players around the world
Total time spent playing in last 24 hours by all players around the world

I heard that it can be achieved by analytics services like Flurry / Google Analytics. I did some research but I am not getting anywhere by myself. Can anybody guide me to the right path?

sentences:
What is cutoff when calculating speed in this equation? I saw a twitter post mention the following as way to make movement frame-rate independent:
changeRate = 1 - exp(-2.0 * PI * cutoff / fps)
speed -= speed * changeRate

What is cutoff?  And is fps a constant or the actual fps?
As someone unfamiliar with game development, I'm probably doing all these wrong, but the equation above is the green ball:
https://codesandbox.io/s/gallant-davinci-f7o19?file=/src/index.ts

sentences:
Map is rendering too slow I have a basic 20x20 array that stores the map for my game. It either has a 1 or 0 to say a path and a non path. When I draw it on the screen, It seems to take to long to draw one at a time and looks like a snake is being loaded on the screen. I need them drawing faster.

Set up the screen array

for(int i=0; i<sizeOfArray; i++)
    {
        for(int j=0; j<sizeOfArray; j++)
        {
            if (LevelOne[i][j]==0)//Path
            {
                screenChunks[i][j].Set(i*40,j*40,"Path.bmp", screen);
            }
            if (LevelOne[i][j]==1)//Wall
            {
                screenChunks[i][j].Set(i*40,j*40,"Wall.bmp", screen);
            }
            if (LevelOne[i][j]==2) //Hero
            {
                screenChunks[i][j].Set(i*40,j*40,"Hero.bmp", screen);
            }
        }
    }

Draw the sprites

for(int i=0; i<sizeOfArray; i++)
    {
        for(int j=0; j<sizeOfArray; j++)
        {
            screenChunks[i][j].Draw();
        }
    }

    //Dynamically drawn each time
    SDL_FillRect(screen,0,0);

    //Hero Start Position
    hero.Draw();

    SDL_Delay(60);

Sprite.cpp Draw Method

void Sprite::Draw()
{
SDL_Rect offset;

//Give the offsets to the rectangle
offset.x = PosX;
offset.y = PosY;

//Blit the surface
SDL_BlitSurface( sprite, NULL, Screen, &offset );

Height = offset.h;
Width = offset.w;

SDL_UpdateRect(Screen, 0,0,0,0);

}

Sprite Setter

void Sprite::Set(int posX, int posY, string imagePath, SDL_Surface *screen)
{
PosX = posX;
PosY = posY;
ImagePath = imagePath;
Screen = screen;

if(ImagePath == "")
    return;

char * writable = new char [ImagePath.size()+1];
strcpy (writable, ImagePath.c_str());

temp = SDL_LoadBMP(writable);
sprite = SDL_DisplayFormat(temp);
SDL_FreeSurface(temp);
// free the string after using it
delete[] writable;
}

sentences:
Why do I have to divide the origin of a quad by 4 instead of 2? I'm currently transitioning from C#/XNA to C#/OpenTK but I'm getting stuck at the basics.

So I have this Sprite-Class:

public static bool EnableDebugDraw = true;
public float X;
public float Y;

public float OriginX = 0;
public float OriginY = 0;

public float Width = 0.1f;
public float Height = 0.1f;

public Color TintColor = Color.Red;
float _layerDepth = 0f;

public void Render()
    {
        Vector2[] corners =
        {
            new Vector2(X-OriginX,Y-OriginY), //top left
            new Vector2(X +Width -OriginX,Y-OriginY),//top right
            new Vector2(X +Width-OriginX,Y+Height-OriginY),//bottom rigth
            new Vector2(X-OriginX,Y+Height-OriginY)//bottom left
        };
        GL.Color3(TintColor);
        GL.Begin(BeginMode.Quads);
        {
            for (int i = 0; i < 4; i++) GL.Vertex3(corners[i].X,corners[i].Y,_layerDepth);
        }
        GL.End();

        if (EnableDebugDraw)
        {
            GL.Color3(Color.Violet);
            GL.PointSize(3);
            GL.Begin(BeginMode.Points);
            {
                for (int i = 0; i < 4; i++) GL.Vertex2(corners[i]);
            }
            GL.End();

            GL.Color3(Color.Green);
            GL.Begin(BeginMode.Points);
            GL.Vertex2(X + OriginX, Y + OriginY);
            GL.End();
        }

With the following setup I try to set the origin of the quad to the middle of the quad.

_sprite.OriginX = _sprite.Width / 2;
_sprite.OriginY = _sprite.Height / 2;

but this sets the origin to the upper right corner of the quad, so i have to

_sprite.OriginX = _sprite.Width / 4;
_sprite.OriginY = _sprite.Height / 4;

However this is not the intended behaviour, could you advise me how I fix this?

sentences: Any tips for creating cross-platform games? Do you have any tips/recommendations when creating a cross-platform game in C/C++?

sentences: How to best apply colliders on a rough 3D shape I have a 3D model for a level in unity. I want to add colliders to it. What is the best type of collider for this model? And,it is 3D

sentences:
OpenGL Core 3.2 framebuffer rendering black on Mac OSX I'm trying to get a 2 pass post-processing system going in OpenGL in a cross-platform manor using FBOs. I'm starting the dev on mac OSX (since in the past I've found it the most finicky to get working of windows/linux/osx), I have a toggle to toggle between using the FBO(post-processing) and not. The shaders are working, but it seems the FBO didn't load the texture unit bound to it. The following is the init code for the FBO and it's texture:

glGenTextures(1,&fboimg);
glBindTexture(GL_TEXTURE_2D,fboimg);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0,
             GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);

glGenFramebuffers(1,&fboHandle);
glBindFramebuffer(GL_FRAMEBUFFER,fboHandle);

glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,fboimg,0);

GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

switch(status)
    {

        case GL_FRAMEBUFFER_COMPLETE:    cout<<"The fbo is complete\n"<<endl; break;
        case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:    cout<<"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\n"<<endl; break;
        case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:    cout<<"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\n"<<endl; break;
        case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:    cout<<"GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"<<endl; break;
        case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:    cout<<"GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"<<endl; break;
    }

if(status != GL_FRAMEBUFFER_COMPLETE)
{
    cout<<"status !=  GL_FRAMEBUFFER_COMPLETE"<<endl;
    GLUtils::checkForOpenGLError(__FILE__,__LINE__);
}
else
{
    //shader and VAO setup for post
    fboSetup = true;
}

Here is the render code:

//start rendering to FBO
if(postFlag&&fboSetup)
{
    glBindFramebuffer(GL_FRAMEBUFFER, fboHandle);

}
glUseProgram(programHandle);

//start rendering scene one way or another
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glUniformMatrix4fv(mats.projHandle,1,GL_FALSE, glm::value_ptr(mats.projMatrix));
glUniformMatrix4fv(mats.mvHandle,1,GL_FALSE,glm::value_ptr(mats.modelViewMatrix));

//bind to vertex array object
glBindVertexArray(vaoHandle);
//render scene
glDrawArrays(GL_TRIANGLES, 0, 240*3 );

//do post-processing if we have it enabled
if(postFlag&&fboSetup)
{
    glFlush();
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    glUseProgram(fboProgram);

    glClear(GL_COLOR_BUFFER_BIT);

    glBindTexture(GL_TEXTURE_2D,fboimg);

    glUniform1i(glGetUniformLocation(fboProgram,"sampler0"),fboimg);
    glUniform2f(glGetUniformLocation(fboProgram,"resolution"),512,512);
    glBindVertexArray(vaoFBO);
    glDrawArrays(GL_TRIANGLES, 0, 6);
    glBindTexture(GL_TEXTURE_2D, 0);
}

Tried everything I can think of or find in a FBO tutorial or have read about. I don't get any errors and it returns as complete. (Also I can't seem to get it glTexImage2d a image of size width and height. says invalid values, and if I try to use GL_TEXTURE_RECTANGLE it says invalid enum :-/ but that's for a different question after I just get it working to begin with^^)

sentences:
How to render Viva Pinata fur In the game Viva Pinata, cute virtual animals have color changing paper cut like furs.

It didn't seem like using shell rendering because there are LOTS of animals in a scene and shell rendering each every one of them to render these furs sounded like a daunting process for a game.

I tried to build 3d model with each triangle but that didn't seem like right solution either.

I am out of my tricks in my pocket.

sentences:
Should I make the Cells in a Tiledmap as null when my player hits it I am making a Tile Based game using Libgdx. I took the idea from SuperKoalio platformer demo by Mario Zencher. When I wanted to implement Collectables in my game , I simply draw the coins using Tiled Map Editor. When my player hits that, I use to set that cell as null.

Someday on this site suggested me not to do so... never use null. I agreed. What can be any other way. If I am using layer.setCell(x,y) to set the cell to any other cell... even if an transparent one .. my player seems to be stopped by an invisible object/hurdle.

This is my code:

for (Rectangle tile : tiles)
                {
                    if (koalaRect.overlaps(tile))
                    {
                        TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(1);
                        try{
                            type = layer.getCell((int) tile.x, (int) tile.y).getTile().getProperties().get("tileType").toString();
                            }
                            catch(Exception e){
                                System.out.print("Exception in Tiles Property"+e);
                                type="nonbreakable";
                            }

                        //Let us destroy this cell
                        if(("award".equals(type))){
                        layer.setCell((int) tile.x, (int) tile.y, null);
                        listener.coin();
                        score+=100;
                        test = ""+layer.getCell(0, 0).getTile().getProperties().get("tileType");
                        }

                        //DOING THIS GIVES A BAD EFFECT
                        if(("killer".equals(type))){
                            //player.health--;
                            //layer.setCell((int) tile.x, (int) tile.y, layer.getCell(20,0));
                        }

                        // we actually reset the player y-position here
                        // so it is just below/above the tile we collided with
                        // this removes bouncing :)
                        if (player.velocity.y > 0)
                        {
                            player.position.y = (tile.y - Player.height);

                        }

Is this a right approach? OR
I should create separate Sprite Class called Coin.

sentences:
Does gluLookAt add or set the view matrix variables? I'm trying to rotate the camera view in PyOpenGL, but it's not working well. The weirdest behavior I've noticed is that putting gluLookAt in a loop seems to change the camera view, even when I'm not changing the inputs as the loop continues.

So while I'd expect something like:

gluLookAt(0,0,0, 0,0,-5, 0,0,1)

to keep the camera constantly pointing downwards, it seems to rotate the view in some strange way, with the objects being rendered leaving the maximum clipping radius after a while.

My question is, does gluLookAt take into account the previous camera settings, or do I need to look for something else wrong in my code?

sentences:
DX11 StreamOut to Vertex Buffer from GeometryShader, can't clear Buffer? I'm trying to use a geometry shader to continuously modify the positions of vertices, and save the modfied verts in a buffer.

I have two vertex buffers, one is bound to the IA stage / the vertex shader input, the other to the SO stage / the geometry shader output.
After I draw a frame, I swap those two buffers so that (ideally) the saved vertices get modified and saved by the GS again.

What actually happens though is this:
I have two buffers, outVB and inVB, both are empty, and an initial, vertex generating vertex shader is set

(Frame 1) Draw(..), the initial vertices are processed, saved to outVB, and drawn
I set inVB as the SO target, and outVB as the input vertex buffer
(Frame 2) Draw(..), vertices are read from outVB, processed, saved to inVB, and drawn
I swap the buffers
(Frame 3) Draw(..), vertices are read from inVB, processed, (apparently not)saved, and drawn
I swap the buffers
(Frame 4) the same output appears as in Frame 2
I swap the buffers
(Frame 5) the same output appars as in Frame 3

and it continues alternating between those two frames, which lead me to believe the buffers still contain the data they held the first time they were written to.

Which makes sense, as the GS can only append new data to the provided buffer.

So I tried releasing and recreating the buffer that is to become the new stream out target before swapping them (I couldn't find any way to clear it), which makes it produce 5 unique frames (including the initial one), and it loops over the last 4 frames, which makes no sense to me at all.

Destroying the buffer holding the old data and recreating it seems to work, since it progresses beyond the states of Frame 2 and 3, but if it worked how can it revert back to the states of Frames 2 and 3 after drawing two more?

my shaders are really simple so far:

struct GS_OUT {
    float4 Pos : SV_POSITION;
    float4 Col : COLOR;
};

GS_OUT VS(GS_OUT input)
{
    return input;
}

[maxvertexcount(10)]
void GS(point GS_OUT input[1], inout PointStream<GS_OUT> PStream )
{
    float4 position = input[0].Pos + float4(0.1f, 0.1f, 0, 1);

    GS_OUT output;
    output.Pos = position;
    output.Col = float4(1,1,1,1);

    PStream.Append(output);
}

float4 PS(GS_OUT input) : SV_TARGET
{
    return inut.Col;
}

My code for flipping the buffers (not neat, I know I could just flip the pointers then assign, but I wanted to make sure everything happened in exactly the order I want):

void swapVBs()
{
    static bool flip = true;

    UINT bufferstride = 2*sizeof(XMFLOAT4);
    ID3D11Buffer *nobuffer = NULL;
    UINT offset = 0;

    D3D11_BUFFER_DESC vbdesc;
    vbdesc.BindFlags = D3D11_BIND_STREAM_OUTPUT | D3D11_BIND_VERTEX_BUFFER;
    vbdesc.ByteWidth = 640*360*2*sizeof(XMFLOAT4);
    vbdesc.CPUAccessFlags = 0;
    vbdesc.MiscFlags = 0;
    vbdesc.StructureByteStride = 0;
    vbdesc.Usage = D3D11_USAGE_DEFAULT;

    if (flip) // SO Target == inVB, Vertex Buffer == outVB
    {

        //clear SO target
        devcon->SOSetTargets(1, &nobuffer, 0);
        //make inVB Vertex Buffer
        devcon->IASetVertexBuffers(0, 1, &inVB, &bufferstride, &offset);

        outVB->Release();
        device->CreateBuffer(&vbdesc, NULL, &outVB);

        //make outVB SO target
        devcon->SOSetTargets(1, &outVB, 0);

    }

    if (! flip) // SO Target == outVB, Vertex Buffer == inVB
    {

        //clear SO target
        devcon->SOSetTargets(1, &nobuffer, 0);
        //make outVB Vertex Buffer
        devcon->IASetVertexBuffers(0, 1, &outVB, &bufferstride,  &offset);

        inVB->Release();
        device->CreateBuffer(&vbdesc, NULL, &inVB);

        //make inVB SO target
        devcon->SOSetTargets(1, &inVB, 0);

    }

    flip = !flip;
}

and the draw code is nothing more than

devcon->DrawAuto();
swapVBs();

So I guess I'm asking...how do I properly clear a ID3D11Buffer?
Why in the world does releasing and creating a new buffer not give me an empty buffer?

sentences:
Palette reduction to pre-defined palette I'm writing a bunch of GLSL effects for fun, but I can't wrap my head around this. Basically, I want to reduce a texture's palette into a pre-defined set of colors. For example, a post-processing shader would take the FBO result texture and a 1D / 2D texture that would contain the reduced palette (say, 64 colors), and the output would then be sampled based on these.

Something like this in its core:

sampler2D source;
sampler2D palette;

vec4 source = texture2D(...); // Source texture to sample
vec4 palette = texture2D(...); // Palette

vec3 result = /* color from the source converted to the closest value available in palette */;

Any ideas how to do this? And to be more precise, I don't mean palette swapping - the source texture is full-colored result, and this shader would ultimately be a post-processing shader, reducing the amount of colors to the ones that are predefined in the palette texture.

sentences:
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: Is it possible to store diffuse and normal maps in the same texture area and preserve SRGB/linear space? Usually, one would want to upload texture data to OpenGL with GL_SRGB* for the internalformat of a texture, and GL_RGB* (or some other linear format) for normal data or specular highlight maps. We can minimize context switches by using a texture array, but that forces all textures to have the same internalformat. Is there a way to store all needed textures in a single texture array, but preserve colour spaces? Or should I convert from SRGB to linear space when uploading texture data?

sentences:
Moving a sprite over a tile map I am working on a tile based game in Java. I have a 2D array of tiles (JComponents) in a GridLayout, this is fine for creating the world (I think), but I am stumped at how to move the sprite smoothly between tiles. Currently, each JComponent tile draws the world and the sprite in accordance with booleans representing state (i.e. to show the sprite or not to show the sprite), however, this is not smooth. The sprite simply disappears from one tile and appears in another.

Any ideas on how I could go about moving the sprite in a smooth manner?

I am new to the whole game dev thing, so please be patient.

Regards,
Jack Hunt

sentences:
How should I handle tiny objects in a physics engine? I am making a 3D physics engine for throwing dice. Up until now a dice has been 1x1x1m and gravity has been 9.82 m/s^2. This of course does not look realistic as the dice will respond to everything in a way that looks a little bit slow.

To fix this I tried to just change all sizes to make a dice be about 0.02m along a side. This in turn made my inverse masses and inverse inertia matrices get very large values which lead to numerical instability.

What is the best route to handle this? Can I keep the scale up so that a dice is 1x1x1 and just change mass or size of acting forces? Or should I tweak something else?

I guess the same problem could turn up if you made a game with very large physical bodies like spaceships or something so I hope that someone has run into something similar before.

sentences:
What is the best way of storing transformations for an object and then applying them with OpenGL? First some background info...

I have been working on a platformer game, which I draw with OpenGL. The platforms are cubes and the player is a cube.

The platforms and the player (both cubes) are given a position, from which the vertices should be drawn. However, the first cube is at position [0, 0, 0] and I would like the player to be on top of this cube. The size of the cubes and player is [0.5, 0.5, 0.5] initially.

However, I didn't manage to get the player on [0, 1, 0] (cubes are drawn from their center point I remembered), because the scaling didn't seem to work, which led me to believe the method I'm using to store the translations and scaling is inherently bad.

I am currently storing the translations and scaling in a matrix, which is part of the object. The object also holds the vertices and the VBO. Let's call it class Cube, which thus holds glm::mat4 m_transform.

I expose m_transform and pass it with glUniformMatrix4fv(shader.GetUniformLocation("model"), 1, GL_FALSE, glm::value_ptr(m_transform));

And at some point I call glDrawArrays(GL_TRIANGLES, 0, 36); to draw the platform/player cube.

So to alter the position of such a cube, I would alter m_transform. Such as: m_transform = glm::translate(m_transform, vec); where glm::vec3 vec is the desired translation to apply.

However, the issues arise when u wish to scale a cube as well, so if we scale with vec3(0, 2, 0), the translations will be twice as large. And I'm unsure where to go from here.

I've read that having different matrices for translation, rotation and scaling is the way to go, which I will try, however, I would like to know what the best practices are surrounding this subject.

Any suggestions are much appreciated!

sentences:
OpenGL ES Shader help (Blending) Earlier I required assistance getting to grips with how to retain the alpha channel of a transparent texture in my colourised texture shader program.

Whilst playing with that first version of my program (before obtaining the solution to my first requirement), I managed to enable transparency for the whole texture (effectively blending via GLSL), and I quite liked this, and I would now like to know if and how it is possible to retain this blending effect, on top of the existing output without affecting the original alpha channel - as I don't know how to input this transparency via the parameter that is already being provided with the textures alpha channel.

A basic example of the blending program I am referring to (minus any other functionality) is as follows...

varying vec2 texCoord;
uniform sampler2D texSampler;

void main() {
    gl_FragColor = vec4(texture2D(texSampler,texCoord).xyz,0.5);
}

Where 0.5 is the transparency (blending effect) of the whole texture.

This is the current version of my program, which provides the ability to colour a texture according the colour parameter passed to the program, and retains the alpha channel of the original texture.

varying vec2 texCoord;
uniform sampler2D texSampler;
uniform vec3 colour;

void main() {
    gl_FragColor = vec4(colour,1)
    * vec4(texture2D(texSampler,texCoord).xyz,texture2D(texSampler,texCoord).w);
}

I need to know if it is possible to apply transparency on top this program, without affecting the original alpha channel which I have already preserved.

I hope this makes enough sense, I am sure it is possible, and if so I should imagine it is rather simple, but this has me stumped. Any help much appreachiated.

Cheers, Chris

sentences: On Android, why would you handle expansion files yourself instead of using Google Play? Why aren't all Android games using Google Play's ability to serve their expansion files? Why some are handling it themselves inside their apps?

sentences:
How do I write a wave-spawning system for a shoot-em-up? I recently played Knightmare Tower and was amazed by the way how different monsters are beign spawned.

I'm aware of time-based and count-based spawing systems in shoot-em-ups. Count-based systems allow a certain number of enemies on screen and spawn more as they die. Time-based ones spawn more at given intervals.

How are these spawning mechanism built? Is there some pattern or theory to it?

Additionally, such games typically have increasingly resilient enemies of increasing numbers of types. How are these balanced?

I'm looking for a general answer, independent of any particular game or technology.

sentences:
How To Add Animation Graphics To An Android Game How to make something like this animation drawings that coming out from the car ?

(I'm using android studio)

The Game's Link : Finger Driver

sentences:
Implementing a Deferred Renderer (Basic Understanding) I am trying to implement a Deferred Renderer in Direct3D11. I am fairly new to this.
I already bought a book: Practical Rendering & Computation with Direct3D 11.
However, this book doesnt answer many of my questions.

The Book just says "Call one of the Draw Commands to execute the Pipeline"

In the context of a deferred Renderer I would like to know How I can actually render the different GBuffers, merge them and put actual Lighting to my scene.
Let's say my GBuffers should represent Diffuse, Specular and Normals.
I understand that Vertex Shaders have Constant Buffers that represent my Camera through Matrices. Vertices get Transformed in shaders into ViewSpace.
How Do I get my Diffuse/Specular/Normal information out of that?

Do I have to execute the Rendering Pipeline for every GBuffer?
Technically do I just need to transform my vertices once in a VS and just execute my different GBuffer PS?
The Context Object offers functions like "OMSetRenderTarget". The OutputMerger however is the last stage of the Pipeline, not the first...

The Book itself just calls "Present(0,0)" exactly once and doesnt explain how you actually put things together.

Sorry, quite a lot of different questions :(

sentences:
2D Physics Engine to Handle Shapes Composed of Multiple Densities XNA The game I'm working on involves shapes that might be composed of multiple materials in a variety of ways. Let's just take for example a wooden rod with and sizable tip of iron or say a block composed of a couple triangles of stone and aluminum and small nugget of gold. The shapes and compositions will change from time to time, so I was wondering what engine I should use and how I might implement this feature?

I've looked at Farseer 3, but I'm still trying to decipher the library by reading the source and the samples and wasn't sure if I was barking up the wrong tree.

Thanks!

sentences: Visual studio alternatives for unity as intellisense not working I am new to unity and unity tools for game dev are unavailable in vs community,i also tried vs code.So what are some alternatives for vs for unity scripts for a beginner?

sentences:
Using USB sound input for an android game - is it possible? We are brainstorming ideas for an app, for a major project using Android Studio, and writing in java. My major is game development, so I intend on trying to build a video game based off the use of an electric guitar, as input.

While I can set up a means to provide input via the audio-in, through the 3.5mm, having USB input would be far more effective.

My main question is: Is it feasible?

To give background, I believe it must be entirely possible, however, I am unsure how difficult the process would be.

I am basing my question off three things.

If I plug my Xbox controller directly into my phone, it automatically works. So the requirement for local support does not work as strictly as I understood it too.
If I plug the Rocksmith cable into a computer, and tell my sound card to "listen" to it, the guitar automatically comes through the speakers as if I was using the computer as an amplifier. This implies that no software is required on the computer side to interpret the input.
If you set up the electric guitar to connect to the computer via the microphone, it is not only compatible with Rocksmith, but it works just as well. This tells me the USB cable does not do anything fancy, in order to interpret the guitar - it must all be software side.

To start me off, all I really need to do is be able to interpret the frequencies. If I run into brick walls, further on, I will simply build around it, or change my games scope.

In terms of accessibility, I do understand the repercussions of requiring the Rocksmith cable to run the game. However, at the moment, simple being able to use the Rocksmith cable allows me to work on the part I am being marked on. If it goes to plan, I can access a more accessible means to use USB, later.

For those that are not familiar with Rocksmith, for the purpose of this question, it is simply a game that includes an electric guitar to USB cable, and is able to assess the player as they play the guitar, by reading its frequencies to determine what notes are being hit.

sentences:
Marketing games for the android - what are the best sites to contact for reviews/advertising? WE are in final dev stages of our latest game and want to release it for the android market.
What are the best sites to contact for reviews/advertising that specifically target the android users???

sentences:
Why does changing the diffuse color of my model's effect change it for all models? I want to change color of individual model in my game. But when I use

  effect.DiffuseColor = newColor

then all of models which were loaded from same model file change color too.

How can I do ?

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:
Should I use an arraylist to store client connections I am running a server, and I have an arraylist of clients.

When a client connects, I create a new object in the arraylist(all running on their own threads)

When a client disconnects, the server closes the Socket. And the thread terminates

My problem is when a client disconnects, it closes the Socket, but it doesn't delete its spot in the arraylist, and shift everything down one. So the arraylist is constantly growing bigger.

What can I do/use to fix this problem?

I will update with more detailed information/code if need be.

sentences:
1D Simplex Noise Returns Same Generation I've been using 1D Simplex Noise to create a random world surface, and it keeps generating with the same looking surface terrain, with some minor variations.  Here is my sample code-

Tile[][] tiles = new Tile[rows][];
for (int i = 0; i < rows; i++)
{
    tiles[i] = new Tile[cols];
    for (int x = 0; x < cols; x++)
    {
        tiles[i][x] = new Tile(0, new Vector2(x, i), scale);
    }
}

int left = Main.rand.Next(rows / 4, rows / 2);

double seed = Main.rand.NextDouble();
for (int i = 0; i < cols; i++)
{
    int height = left + (int)(Noise.Generate((float)seed) * 10);
    height = (int)MathHelper.Clamp(height, 0, rows - 1);
    tiles[height][i] = new Tile(2, new Vector2(i, height), scale);
    //FillLower just fills everything under the top tile
    FillLower(tiles, height, i, scale);
    seed += .05f;
}

My question is am I doing something wrong with the Simplex Noise method?  How should I generate it so it'll look different?

Images for reference- http://imgur.com/I0g98z8,M61UBfb,tYPflb7

sentences:
Is using Box2D for simulating gravity "in space" a good idea? I'm attempting to write a simulation of a solar system of planets in 2D space that are attracted to each other through Newton's law of universal gravitation.

I know that it is possible to simulate this in Box2D by applying forces between each body in the system each frame, however I've read that Box2D is tuned for objects between 0.1m and 10m - In my simulation I want to be able to simulate the motion of large and small bodies (e.g. planets and artificial satelites).

When such large scales are involved is using Box2D (or an alternative 2D physics engine) to simulate the gravity between bodies in this way a good idea (I know I can scale the system, e.g. so that the sun has a diameter of 10m), or am I better off doing this myself?

sentences:
Selecting Dictionary item based on custom classes instead of keys I am attempting to write my own path finding code for a game I'm working on that will implement a form of the A* algorithm.  I store my nodes of the path finding system as a class called nodes and add these to a dictionary with their position in world space as the key for the dictionary.  Here's the problem.  At one point I need to test the dictionary and return from it the node with the lowest "f" value.  I came across the morelinq MinBy function with seemed promising, but so far have not had any luck getting it to work. Here is a stripped down version of the code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using MoreLinq;

public class GMove : MonoBehaviour
{

    public Dictionary<Vector3, Node> vectorNodesOpen = new Dictionary<Vector3,Node>();
    public Dictionary<Vector3, Node> vectorNodesClosed = new Dictionary<Vector3,Node>();

    private KeyValuePair<Vector3, Node> currentNode = new KeyValuePair<Vector3,Node>();

    private bool goal;
    private bool findingPath;

    void Start()
    {
        goal = false;
        findingPath = false;
    }

    public void addNodes()
    {
        //several nodes get added to the dictionary based on the A* algorithm
        //ending way point and beginning waypoint are stored as Vector3
    }

    public class Node
    {
        public int h { get; set; }
        public int g { get; set; }
        public int f { get; set; }
        public Vector3 pos { get; set; }
        public Vector3 parentNodeVector { get; set; }
    }

    void Update()
    {
        if(findingPath)
         while (!goal)
            {
                currentNode = new KeyValuePair<Vector3, Node>(vectorNodesOpen.MinBy(x => x.Value.f).Key, vectorNodesOpen[vectorNodesOpen.MinBy(x => x.Value.f).Key]);  //This is the line in which I'm attempting to get the node in the open list with the smallest f value.
                vectorNodesClosed.Add(vectorNodesOpen.MinBy(x => x.Value.f).Key, vectorNodesOpen[vectorNodesOpen.MinBy(x => x.Value.f).Key]);
                vectorNodesOpen.Remove(vectorNodesOpen.MinBy(x => x.Value.f).Key);  // remove current from open.

                if (currentNode.Value.pos == waypointEnd)   // if current node = end position we are done.
                {
                    goal = true;
                }

                addNodes(currentNode.Value.pos, waypointEnd);  //Add and update nodes
    }

}

The line that is giving me trouble is the first line inside the while loop.

I need a way to return the Dictionary item with the smallest "F" value, this would be pretty easy if it were an integer but the F value resides in the Node class.  I don't have to use MoreLinq,  I would be happy to do it any other way that someone can come up with.  Cheers!

*One more note:  the code above is incomplete in an effort to minimize it down to only what is necessary to understand the problem more complete code can be provided if necessary.

sentences:
How does a minecraft biome finder generates map How does chunkbase biome finder generates map base on seed?
I was curious if chunkbase knows the secret formula for generating the map? Or it uses other math formulas such as scaling, mapping etc...

Here's my main point:
If I generate a map in minecraft and grab that minecraft seed. If I place that minecraft seed in biome finder, It also generates the same world that minecraft generated. If I place the coords in that biome finder, it also shows me the correct position in minecraft world.

How can you possibly generate a world similarly to minecraft without knowing the secret formula? Is this possible?

Here is the site https://chunkbase.com/apps/biome-finder

This is my first question and I'm not a real game dev(I just want you to know). If you want me to remove this question, just tell me.

sentences: What fluid simulation system is used in iPhone games? Does anybody know what kind of system developers are using for fluid simulation in iPhone games? It doesn't seem like they're using a Navier-Strokes simulation to me.

sentences:
android zoomable and scrollable board game I'm developing a Android board game and have a question regarding creating a board that is zoomable and scrollable. The board contains a static background, characters (players) and  the actual "level" which is drawn using tiles.

My solutions is to have a collection of elements (tiles, figures, all game elements - all have x,y coordinates and width + height), a camera and a renderer that draws the collection according to cameraX,cameraY, cameraWidth and cameraHeight. So if a user would scroll to the right, the camera would just set the cameraX appropriately - and the surface is scrollable. And if a user would zoom in/out the renderer would just scale every element image appropriately.

Example code for the renderer with scrollable surface and zoom in/out

    protected function draw(Canvas c){
      Collection elements = collection.getElements(cameraX,cameraY,cameraWidth,cameraHeight);
      if(elements.size() > 0) {
         for(int i = 0; i < elements.size(); i++) {
              elements.get(i).drawElement(c);
         }
      }
    }
    .
    .
    .
    // element class drawElement function
    protected drawElement function(Canvas c) {
        if(this.image != null) {
          int w = this.width;
          int h = this.height;
          if(this.zoomFactor < 1) {
             w*=this.zoomFactor;
             h*=this.zoomFactor;
          }
          c.drawBitmap(this.image,this.x,this.y,w,h);
        }
    }

Is this the best solutions?
Could it be achived somehow else?
Could scrolling be achived using a ScrollView?

I dont wanna use any engine, because this is for a school project.

sentences:
How can I turn off the sound from another scene? I attached music file to my first scene and thanks to following javascipt code, sound continues without stopping in other scenes.

public static var object : SingletonMusic = null;

function Awake()
{

    if( object == null )
    {
        object = this;
        DontDestroyOnLoad(this);
    }
    else if( this != object )
    {
        Destroy( gameObject );
    }
}

My problem is that I want to turn off the sound from the button in the another scene (setting scene) so that I added a new button to my setting scene and attached the following javascript code to the button that I have created.

Javascript code:

var objects: AudioSource = SingletonMusic.object.GetComponent(AudioSource);
if( objects.isPlaying )
objects.Pause();
else
objects.Play();

However, it gives following errors:

If I start the game from Setting scene; I get this error:

If I start the game from first scene and then, go to Setting scene; I get this error:

sentences:
GL_INVALID_OPERATION in glGenerateMipmap(incomplete cube map) I'm trying to learn OpenGL and i'm using SOIL to load images.

I have the following piece of code:

GLuint texID = 0;

bool loadCubeMap(const char * baseFileName) {

    glActiveTexture(GL_TEXTURE0);

    glGenTextures(1, &texID);
    glBindTexture(GL_TEXTURE_CUBE_MAP, texID);

    const char * suffixes[] = { "posx", "negx", "posy", "negy", "posz", "negz" };
    GLuint targets[] = {
        GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
        GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
        GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
    };

    for (int i = 0; i < 6; i++) {
        int width, height;
        std::string fileName = std::string(baseFileName) + "_" + suffixes[i] + ".png";
        std::cout << "Loading: " << fileName << std::endl;
        unsigned char * image = SOIL_load_image(fileName.c_str(), &width, &height, 0, SOIL_LOAD_RGB);
        if (!image) {
            std::cerr << __FUNCTION__ << " cannot load image " << fileName << " (" << SOIL_last_result() << ")" << std::endl;
            return false;
        }
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
        SOIL_free_image_data(image);
    }

    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_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);
    glGenerateMipmap(GL_TEXTURE_CUBE_MAP);

    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
    return true;

}

When i call this, the images load successfully, but then i get an error in console:

---- OGL DEBUG ----
message <1>: 'API' reported 'Error' with 'High' severity:
GL_INVALID_OPERATION in glGenerateMipmap(incomplete cube map)
---- BACKTRACE ----

and no cubemap is displaying at all.
Do you see any mistake in this code?

sentences:
How to get a good picture of the health of a level-based game from analytics? I am designing a level-based game where the user completes the level 1, then 2, 3 and so on. There are 200 levels and each is rather short: 60-ish seconds.

I am tracking

Each played, completed (cleared for the first time), failed and cleared level
Milestones: number of players to reach level 1, 5, 10, etc. Also for number of failed and played levels.
Separate new players from returning ones.

However, I still find it difficult to get a clear picture of what is going on from the stats. So what are the best practices for determining where I am losing players?

sentences:
How can I parse different types of objects from JSON? I'm trying to save the player's inventory as a JSON data but I'm having a problem. I have a class Sword which extends an abstract class Weapon which extends another abstract class called Item. This is what JSON file looks like with the Sword and Armor objects in it:

[
    {
        "category": {
            "type": "Weapon",
            "subtype": "Sword"
        },
        "id": 0,
        "value": 1,
        "name": "Wooden Sword",
        "description": "Sword made out of wood",
        "slug": "wooden_sword",
        "stats": {
            "wear": 100,
            "damage": 5
        }
    },
    {
        "category": {
            "type": "Armor",
            "subtype": "Helmet"
        },
        "id": 1337,
        "value": 1,
        "name": "Steel Helmet",
        "description": "Whatever...",
        "slug": "steel_helmet",
        "stats": {
            "wear": 100,
            "defence": 5,
            "vitality": 3,
            "dexterity": -1
        }
    }
]

How can I parse these objects into their respective C# objects, putting the first entry into a Sword object and the second one into a Helmet object. There will be other types of objects in there too, so it's not limited on these two.

sentences:
moving object on game background after scaling it based on screen size I am creating a game using Corona SDK, I have a map with a ball and another other object that moves on the map.

I use the the ultimate config.lua file for scaling background based on device screen resolution.

My problem is that I want to arrange some objects on this map.  I have created specific assets for a specific device resolution, but on devices with aspect ratio lower than 1.72 the map is stretched horizontally so that appears wider than other assets.

Also when I want to arrange an object to a specific location on top of the map the result is that things don't line up right because of the scaling issue.  For example, when i set myobject.y=100 on a device with aspect ration more than 1.72 it set on the right place but when I do the same thing on device with aspect ratio less than 1.72 my object is off the map.

I tried to convert my pixels to inches using device DPI but it's still the same.

sentences: My game is dull; how would you make it more exciting? The game is Darts for the iPhone. It's OK but it's more like a simulation than anything I'd ever claim to be overtly "fun". I am looking for some ideas to spice up the gameplay. What are your thoughts?

sentences:
Automating the process of creating a steam lobby (for dota) and inviting users to it I'm working on a Ruby on Rails web-application and I want to create lobbies and send invitations to users to join these lobbies. Simply, I want to achieve ISteamMatchmaking Interface functionality of Steam SDK but the problem is that sdk in written in C/C++ and I would have to write wrapper to integrate sdk in my application.

My question is that is there some easy and less time consuming approach to achieve ISteamMatchmaking Interface functionality in web-application?

I'm using RoR but I'm open to use other technologies too.

sentences: Minecraft Forge Look for Entities in a Certain Location The title mostly explains it. I have a tile entity that is called Energizer. I want this energizer to check to see if there is an EntityItem on top of it and if so, consume it and create energy. The only problem is, I can't figure out how to check for (and receive) an EntityItem in a certain location (on top of it). I considered using a method that searches for nearby entities and then seeing if they were instanceof EntityItem, but I can't even find a method to do that.

sentences:
Any hints about the average renderstate changes per frame? While answers will vary depending on the case, I'd love to hear about what people have seen in their past experiences.
The question mainly relates to DirectX though if you have some numbers for any other API (OpenGL, consoles etc) I'd be glad to hear them too.

Thanks in advance.

sentences:
What is a convincing Berserker enemy AI finite state machine for a Roguelike I'm looking for a way to create a convincing Berserker enemy in a Roguelike I've been creating for some time. You may assume a game like NetHack for this when considering what kinds of actions can be taken and text messages that can be alerted.

I ask this for two reasons:

I've been trying to solve this problem for over a year and have failed. Examples to follow.
I see a general lack of examples on this SE that show what a mapping of an entity's states, in total, looks like. It would be helpful to the community to have such an example.

What I need:

When I say Berserker I mean an enemy that can swing into a blind rage and attack other entities that it is in conflict with with violence and bloodlust. Not simply switching to attacking targets randomly, as is done in many RPGs. To this end, feel free to assume the addition of any status effects or buffs you wish. Just make sure you detail the pertinent information for those states.

A berserk entity needs to express his rage in a way that isn't simply a status change with some strength increases. This is a very shallow solution to the problem. The entity doesn't end up feeling like a Berserker at all.

What I've Tried:

I've tried 3 different ideas over the last year. And none of them satisfy. A solution to the problem could be all new, or a 'fix' for one of these. I am mainly including them to get the juices flowing.

The first thing I tried was a simple Berserk state that increased the strength of the entity, randomized its target (from list of enemies), had him shout obscenities, so on. Once in this state, the enemy would remain in it until death.
The next thing I attempted was really a modification of the above. The enemy felt very flat, and there was no way to calm him or knock him out of his rage which seemed unrealistic. I added the ability to calm (with a spell and other effects) and also added a condition that would return the enemy to a normal state, from which he could transition to others such as fleeing. This created more depth, but made the Berserker state seem even more shallow and less destructive.
From here I scrapped it all and aimed for something more emergent. Essentially a buff that the enemy could cast on itself based on a transition state. Once cast, this would change the enemies behavior (for targeting) and increase their damage while randomly issuing insults from the enemy. Then, he could enter any other states and stay enraged. So he might flee, but still taunt. He might heal, but still be enraged and deal lots of damage. This is better, but the underlying issue still remains. He doesn't really seem berserked, just pissed. Mainly because you typically encounter the enemy alone, and not with other enemies the berserker doesn't like, so the randomization aspect is down played.

How else can I make the guy seem Berserked, and not just pissed/foul-mouthed?

I realize this is a borderline list question. So I impose these requirements: It must be a very detailed complete answer that shows all the states and conditions for transitioning. And it must be more than a guess. You should test this in your own roguelike, or it should otherwise be obvious why this is a probable 'best' solution at getting the idea of Berserk status across.

I also won't take offense if this is closed. I realized it dances the edge.

sentences:
How can I ensure my game complies with all asset/source licenses when preparing it for distribution? I put together a 3D space scene demo, but I bought some models from turbosquid and using the jmonkey engine I must comply with BSD licence (jmonkeyengine) and also package the models, but I don't think that the 3D artist who created the 3D models agrees, could you tell me if there is a solution to "lock" or "encrypt" the assets that I bought from turbosquid or other ways to handle content and assets with a different licence than the source code / libraries?

In practice I've purchased a 3D model from turbosquid and I don't think that I can just include it with a BSD-licenced open source 3D scene.

sentences:
Java and Steam JVM deployment I am currently considering my options for game development and deploying to Steam Greenlight. I really like Java with libGDX, especially for its cross platform Android potential, and I understand that it is possible to deploy Java games on Steam. I am also very comfortable with having to create some sort of wrapper so that my Java game could call into the C++ Steamworks API.

My question is about what deployment problems I might run into. Specifically, with the client machine's installation of the JRE. I have seen many Steam installers check for the .NET runtime. Should I do a similar check and install for the JRE?

Are there any glaring reasons why Java deployment on Steam would be a nightmare to deploy and maintain vs something like C# using Monogame?

sentences:
How to inspect child nodes in IDE debugger? Consider an enemy with this node hierarchy:
* KinematicBody2D (Enemey)
|- Sprite
|- CollisionShape
|- Area2D (StompDetector)
   |- CollisionShape2D

With signal from StompDetector to Enemy:
func _on_StompDetector_body_entered(body: Node) -> void:
    if body.global_position.y < $StompDetector.global_position.y:
        die() ## >> BREAKPOINT <<

That does not work as exepcted. How to inspect $StompDetector from the debugger at BREAKPOINT?

sentences:
How can I locate GameObjects near the player in Unity? I'm trying to figure out how I can find GameObjects that are close to the player so that I can delete them with Destroy().  I know how to use Destroy() but I can't figure out how to get a reference to the objects I want to remove.

public class hand : MonoBehaviour {
public Transform player;
public Transform mushrums;
private Animator anim;

void Start () {
    anim = GetComponent<Animator> ();
}
public void HandUp () {

    float dist = Vector3.Distance(player.position, mushrums.position);
    Debug.Log(dist);
    if (dist <= 59)
    {
        anim.Play("pick_up");

            Collider[] hitColliders = Physics.OverlapSphere(this.transform.position, 20);

        while (i < hitColliders.Length) {
                 thisDist = (transform.position - hitColliders[i].transform.position).sqrMagnitude;

            if(thisDist < nearDist) {
                    nearDist = thisDist;
                    nearest = hitColliders[i].transform;

                }
            }
            if(nearest != null) {
            Destroy(nearest.gameObject);
            }

    }

}
}

if the radius of the 10, subject is not and
hitColliders.Length = 0
if the radius of the 20 its freezing
if remove WhileLoop while (i < hitColliders.Length) {thisDist ... but keep if(thisDist < nearDist) {... everything works and get another object, not the one that is near

sentences:
How to check the device type using Adobe AIR for iOS How do I check what kind of device the user is running my Adobe AIR app on?

Example: if(device == ipad3) { stagestuff.width = 300; }

sentences: Is a voxel engine appropriate for a Minecraft-like game? Why does Minecraft use polygons to draw the world terrain instead of voxels?  Would a voxel based rendering engine be appropriate for a fully destructible game world built out of cubes like Minecraft?  Would it be more efficient than using polygons?

sentences:
Main characteristics of a game I was doing some reading for college and I searched for

"Main characteristics of games"
"Main characteristics of video games"

and other similar ones, the result were a bunch of psychological studies and some non totally related links. The bottom line there was no real definition.
I can see why, however I m suprised there are no attempts

I m going to think I m looking for the wrong thing, so can you help?

My purpose is to try to understand what is a video game and what isnt. ie: bad games are still games, so fun and immersion are not characteristics of a game ( before I started thinking about this I thought that was the case)

Cheers

sentences:
Calculating a circle or sphere along a vector Updated this post and the one at Math SE (http://math.stackexchange.com/questions/127866/calculating-a-circle-or-sphere-along-a-vector), hope this makes more sense.

I previously posted a question (about half an hour ago) involving computations along line segments, but the question and discussion were really off track and not what I was trying to get at. I am trying to work with an FPS engine I am attempting to build in Java.

The problem I am encountering is with hitboxing. I am trying to calculate whether or not a "shot" is valid.

I am working with several approaches and any insight would be helpful. I am not a native speaker of English nor skilled in Math so please bear with me.

Player position is at P0 = (x0,y0,z0), Enemy is at P1 = (x1,y1,z1). I can of course compute the distance between them easily. The target needs a "hitbox" object, which is basically a square/rectangle/mesh either in front of, in, or behind them.

Here are the solutions I am considering:

I have ruled this out...doesn't seem practical. [Place a "hitbox" a small distance in front of the target. Then I would be able to find the distance between the player and the hitbox, and the hitbox and the target. It is my understanding that you can compute a circle with this information, and I could simply consider any shot within that circle a "hit". However this seems not to be an optimal solution, because it requires you to perform a lot of calculations and is not fully accurate.]
Input, please! Place the hitbox "in" the player. This seems like the better solution. In this case what I need is a way to calculate a circle along the vector, at whatever position I wish (in this case, the distance between the two objects). Then I can pick some radius that encompasses the whole player, and count anything within this area a "hit".
I am open to your suggestions. I'm trying to do this on paper and have no familiarity with game engines. If any software folk out there think I'm doing this the hard way, I'm open to help!

Also - Anyone with JOGL/LWJGL experience, please chime in.

Is this making sense?

sentences:
Strauss model : no specular component I implemented the Strauss model with the metalness, transparency and smoothness parameters, taking the formulas from the book "Programming vertex geometry and pixel shaders", this is how I implemented it:

float fresnel(float x) {
    float Kf= 1.12;
    float result= 1.0/pow(x-Kf,2.0) - 1.0/(Kf*Kf);
    result/= 1.0/pow(1.0-Kf,2.0) - 1.0/(Kf*Kf);
    return result;
}

float shadow(float x) {
    float Ks= 1.01;
    float result= 1.0/pow(1.0-Ks,2.0) - 1.0/pow(x-Ks,2.0);
    result/= 1.0/pow(1.0-Ks,2.0) - 1.0/(Ks*Ks);
    return result;
}

vec4 Strauss(vec3 L, vec3 N, vec3 V, float smoothness, float metalness, float transparency)
{
    vec3 H= reflect(L,N);
    float HdotV= max(dot(H,V),0.0);
    float NdotL= max(dot(N,L),0.0);
    float NdotV= max(dot(N,V),0.0);
    float k=0.1;

    // Diffuse component
    vec3 diffuse= NdotL * (1.0 - metalness * smoothness) * (1.0 - pow(smoothness,3.0)) * (1.0 - transparency) * vec3(materialDiffuse);

    // Specular component
    float r= (1.0-transparency) - (1.0 - pow(smoothness,3.0)) * (1.0 - transparency);
    float j= fresnel(NdotL) * shadow(NdotL) * shadow(NdotV);
    float reflect= min(1.0,r+j * (r+k));
    vec3 C1= vec3(1.0,1.0,1.0);
    vec3 Cs= C1 + metalness * (1.0 - fresnel(NdotL)) * (vec3(materialSpecular) - C1);
    vec3 specular= pow(-HdotV, 3.0/(1.0-smoothness)) * reflect * Cs;

    return max(lightDiffuse * vec4(diffuse,1.0) ,0.0) + max(lightSpecular * vec4(specular,1.0), 0.0);
}

The parameters metalness, smoothness and transparency are uniforms. I try to vary them, but I cannot get something similar to this result:

This is what I get with roughness 0.9, transparency 0.1 and metalness 0.1 :

It is practically equal to a lambert shader! I tried a lot of parameters combination, but I never get a shiny teapot like it should be.
I also debugged the shader, and it seems like the specular component is zero in many parts of the teapot. I tried to add an if that makes look red all the areas where the specular component is zero, that's the result:

I checked many times the formulas and the implementation, and it seems like I've done all correctly. What's the problem?

sentences:
How to render gameplay over UI? I'm working in 2D.

I have set up 2 cameras. One for UI and another one for gameplay.

I need the UI to be rendered after before game objects (over gameplay). I wanted to achieve this without using world space canvas, because It requires being scaled for every other device along with a camera.

UI can be drawn over gameplay using greater depth than gameplay camera. And because it's depth only there is no solid color, so it all works well.

But you cannot set gameplay camera to depth only because it doesn't render things right, it doesn't clear the render texture I guess.

So this is what happens if gameplay camera is set to depth only.

This is what happens when gameplay camera is set to Solid Color and UI Camera has bigger depth. You can see that the ring is covered by UI arrow.

If the UI Camera depth would be lower than gameplay camera (Solid Color). It would all be covered by gameplay camera without even displaying UI.

These are mine settings.

Is there a way to achieve this in Unity without using World Space Canvas Mode?

sentences:
How to make expanding ring with constant thickness? I need to generate this burst or (donut-shaped) pulse.
I'm having a difficult time how to generate such shape.
At first, I was thinking of scaling the image but that didnt work out because the line or "diameter" of the donut shape gets bigger accordingly..

https://www.youtube.com/watch?v=ewnEE5mt1ZM

sentences:
How can I find an agent that would help me get my foot into the door of a publisher? I have submitted my game for review at couple of game publishers with zero response.

My game is very specific and unusual, so maybe I need to find very specific publisher, or maybe it hasn't been noticed in the sea of submissions, maybe the game is not worth publishing. In any case, I need to know for sure which reasons it is and I need to try all the options available before giving up.

Therefore I've been looking for a professional who knows how and where to try these options, but I'm at a loss on what would be the process to find such a person.

What would be the process to find such an agent?

sentences:
Choosing a heuristic function for RPG character's AI I am designing an AI for mouse and cat. So they have HP, and cat will chase and eat mouse, mouse will eat cheese. This eating action will help them to gain HP. If they can't eat food, they will die if they use up all the HP.

So I searched through books and I have a basic algorithm for this.

def chooseAction(actions, goals):
  # Go through each action, and calculate the
  # discontentment.
  bestAction =  actions[0]
  bestValue = calculateDiscontentment(actions[0], goals)
  for action in actions:
    thisValue = calculateDiscontentment(action, goals)
    if thisValue < bestValue:
      bestValue = thisValue
      bestAction = action
  # return the best action
  return bestAction

def calculateDiscontentment(action, goals):
  # Keep a running total
  discontentment = 0
  # Loop through each goal
  for goal in action:
    # Calculate the new value after the action
    newValue = goal.value + action.getGoalChange(goal)
    # Get the discontentment of this value
    discontentment += goal.getDiscontentment(value)

struct Goal:
  value
  def getDiscontentment(newValue):
    return newValue * newValue

This algorithm is quite easy to understand, and quite easy to implement.

So I have to determine Goal and goal value for each action they take.

Let say a mouse, He may want to move, eat.

So I have to come up with a value(wiliness) for these values.

What is a good way to determine these values?

My approach is here.

Ley say my mouse have a view range of 3 cells and it can only walk in four directions up down left and right.

The goal eat value may determine by its MAX_ENERGY and NOW_ENERGY and I come out a formula
eatValue = MAX_ENERGY - NOW_ENERGY. This make sense because, it NOW_ENERGY is equal to MAX_ENERGY, my mouse has a wiliness 0 to eat.

What is a good way of come out this simple formulations?
What will be the good heriustic for my mouse to move?

sentences:
Problems with gravity and box colliders in Unity 3D I have a game character that can jump or roll in order to avoid obstacles. He is able to roll while on the ground and he can also roll while he is in the air after jumping. Everything was working fine when I made him roll. I want to make it so that when he rolls while he's in the air after jumping, he would fall at a faster pace than if he was just falling normally. So I did this in my c# script:
IEnumerator IncGravAcc()
{
    Physics.gravity = new Vector3(0, -50f, 0);
    yield return new WaitForSeconds(2f);
    Physics.gravity = new Vector3(0, -9.8f, 0);
}

I call this coroutine in the function that runs when the down arrow is clicked. Everything is working fine. When he rolls while in the air, he falls at a faster than normal rate. However he doesn't land properly and he just falls right through the platform like it's not even there. Here's a video to show what I mean:
https://youtu.be/sirc4L3MnqM
I have a box collider, not set to isTrigger, on the player (you can see it, the green box, right underneath him in the video) and the player's also a rigidbody. The platforms don't have rigidbodies on them but they do have box colliders set to trigger. You can see the platform's box collider in the relation to player's box collider in the picture provided (the platform's box collider is the larger one of course)
How do I get it so that the character doesn't fall through? Please let me know if there's anything else you need to know about the project. Thank you for helping me!

sentences:
How to smooth hand drawn lines? So I am using Kinect with Unity.

With the Kinect, we detect a hand gesture and when it is active we draw a line on the screen that follows where ever the hand is going. Every update the location is stored as the newest (and last) point in a line. However the lines can often look very choppy.

Here is a general picture that shows what I want to achieve:

With the red being the original line, and the purple being the new smoothed line. If the user suddenly stops and turns direction, we think we want it to not exactly do that but instead have a rapid turn or a loop.

My current solution is using Cubic Bezier, and only using points that are X distance away from each other (with Y points being placed between the two points using Cubic Bezier). However there are two problems with this, amongst others:

1) It often doesn't preserve the curves to the distance outwards the user drew them, for example if the user suddenly stop a line and reverse the direction there is a pretty good chance the line won't extend to point where the user reversed the direction.

2) There is also a chance that the selected "good" point is actually a "bad" random jump point.

So I've thought about other solutions. One including limiting the max angle between points (with 0 degrees being a straight line). However if the point has an angle beyond the limit the math behind lowering the angle while still following the drawn line as best possible seems complicated. But maybe it's not. Either way I'm not sure what to do and looking for help.

Keep in mind this needs to be done in real time as the user is drawing the line.

sentences:
Client projectile ignores camera Y-axis in multiplayer shooter I'm able to spawn the bullet and make it move. But the problem is, only the host can shoot the bullet in the way the camera is facing(takes both X-axis and Y-axis correctly). The client takes only the X-axis of the camera and keeps the Y-axis at zero.

Here's the code for spawning and applying velocity:

[Command]
void CmdFire()
{
    GameObject fb = Instantiate(fireBall, spawnPoint.position, spawnPoint.rotation);
    fb.GetComponent<Rigidbody>().velocity = gameObject.GetComponentInChildren<Camera>().transform.forward * fireSpeed;
    NetworkServer.Spawn(fb);
}

And the code for the camera attached to the player:

void Update()
{

    mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

    //Horizontal Looking
    playerBody.Rotate(Vector3.up * mouseX);

    //Vertical Looking
    xRotation = xRotation - mouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);
    transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);

}

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:
OpenGL : sluggish performance in extracting texture from GPU I'm currently working on an algorithm which creates a texture within a render buffer. The operations are pretty complex, but for the GPU this is a simple task, done very quickly.

The problem is that, after creating the texture, i would like to save it.
This requires to extract it from GPU memory.

For this operation, i'm using glGetTexImage(). It works, but the performance is sluggish. No, i mean even slower than that. For example, an 8MB texture (uncompressed) requires 3 seconds (yes, seconds) to be extracted. That's mind puzzling. I'm almost wondering if my graphic card is connected by a serial link...

Anyway, i've looked around, and found some people complaining about the same,
but no working solution so far. The most promising advise was to "extract data in the native format of the GPU". Which i've tried and tried, but failed so far.

Edit : by moving the call to glGetTexImage() in a different place, the speed has been a bit improved for the most dramatic samples : looking again at the 8MB texture, it knows requires 500ms, instead of 3sec. It's better, but still much too slow. Smaller texture sizes were not affected by the change (typical timing remained into the 60-80ms range).

Using glFinish() didn't help either. Note that, if i call glFinish() (without glGetTexImage), i'm getting a fixed 16ms result, whatever the texture size or complexity. It really looks like the timing for a frame at 60fps.

The timing is measured for the full rendering + saving sequence. The call to glGetTexImage() alone does not really matter. That being said, it is this call which changes the performance.

And yes, of course, as stated at the beginning, the texture is "created into the GPU", hence the need to save it.

Edit 2 : I've also tried to use glReadPixels(), instead of glGetTexImage(). But it's worse unfortunately. Approximately twice slower.

Edit 3 : Here is the code. Note that it uses a "framework" that i've not developed. So some of the function calls here are not OpenGL standard. But they are nonetheless quite self-expressive.

glDisable(GL_BLEND);

// Simple construction, for test : the resulting texture is output into render buffer
renderbufx1.bind();
    clear(0,0,0,0);
    simpleDiffShader.bind();
    simpleDiffShader.setTexture("TextureRef",img.tex,0);
    simpleDiffShader.setTexture("TextureDown",renderbufx2.getTexture(),1);
    img.tex->drawPart(-1,-1,2,2,0,0,1,1);
    simpleDiffShader.unbind();
renderbufx1.unbind();

// Not really useful, but just in case, the result is copied into another render buffer.
// renderbufx1 is going to be displayed, and i want to avoid any access conflict
savebufx1.bind();
    clear(0,0,0,0);
    renderbufx1.getTexture()->bind();
    renderbufx1.getTexture()->drawPart(-1,-1,2,2,0,0,1,1);
    renderbufx1.getTexture()->unbind();
savebufx1.unbind();

savebufx1.getTexture()->bind();
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_BYTE, t.data);  // <-- This is the line
savebufx1.getTexture()->unbind();

glEnable (GL_BLEND);

renderbufx1.getTexture()->bind();
renderbufx1.getTexture()->drawPart(tex2x,-1,w,h,texSpan,texSpan,fact,fact);
renderbufx1.getTexture()->unbind();

Timing measured encompasses all this (and a few other things, which do not really contribute to the total).

Edit 4 : (on course for the most edited question of the week)

The native texture format of the GPU is supposed to be retrieved through the function glGetTexLevelParameter. More precisely, i've used this line of code :

glGetTexLevelParameteriv ( GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &iTexFormat);

The result of the function (within iTexFormat) is 32856.
32856, decimal, is 0x8058, and within gl.h there is :

#define GL_RGBA8 0x8058

sentences:
cant add script component So I'm just starting to try to learn unity development with C# using this tutorial but I cant add the script to any game object and I get the following error:

Code of the script:

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

public class NewBehaviourScript : MonoBehaviour
{
    // Start is called before the first frame update
    public Light myLight;

    void Update()
    {
        if (Input.GetKey("space"))
        {
            myLight.enabled = true;
        }
        else
        {
            myLight.enabled = false;
        }
    }
}

I know it's been answered before but I've done everything I read, I did my homework and I still cant get around this issue. I allready checked the name of the class and its the same as the file's name.
I think it may be something regarding installation (?) I installed unity hub and it installed Unity and Microsoft Visual Studio by itself.

Unity version: 2019.3.3f1
MS Visual Studio version: 16.4.5
MS Net Framework version: 4.7.03062

I honestly dont know what else to do people! Please help!

sentences:
Build Unity3D project from source without Unity Editor I am trying to create an installer which will download the source of the latest release of a Unity project from a repository hosted on Github and then build it into an executable file. I have tried looking online for a solution, but, they all require the Unity Editor to be installed.

Is it possible to build a Unity project from the source code into a .exe file or a .dmg file without the Unity Editor?

EDIT: From @DMGregory's answer, it seems that using an external tool to build Unity Projects will violate Unity's Terms of Service. Therefore, I am updating the question.

Does Unity provide a lightweight (installer) tool that can allow clients to build and install Unity projects from source rather than requiring the client to install the entire Unity Editor?

sentences: Making a 2d sprite based game in Unity? I'm looking at developing a 2D sprite based platformer. Usually I make games in Gamemaker, because I find it very easy to use. I have never used Unity before but have heard a lot of good things. So, just wondering whether you can easily make this type of game in Unity?

sentences:
Update DirectX 11 Texture Created in Unity Asynchronously in the Native (c++) Plugin tl;dr version :) Is it possible to update DirectX 11 textures created in Unity asynchronously in a native plugin (C++)?
I've written a plugin that retrieves data from Kinect.
Currently, color stream data is written to a texture created by Unity in a separate thread in the plugin using DirectX 9 as shown in the example below.
D3DLOCKED_RECT lockedRectangle;
colorFrameTextureDX9->LockRect(0, &lockedRectangle, NULL, 0);
memcpy(lockedRectangle.pBits, colorFrameMat.data, colorFrameMat.total() * colorFrameMat.channels());
colorFrameTextureDX9->UnlockRect(0);

With DX9 this works beautifully. As far as I know calling LockRect on a DX9 texture locks the texture data and memcpy after that is thread safe.

Using this code sample from Unity I've added support for DX11 textures.
ID3D11DeviceContext *ctx = NULL;
device->GetImmediateContext(&ctx); // Device is sent from Unity

D3D11_TEXTURE2D_DESC desc;
colorFrameTextureDX11->GetDesc(&desc);
ctx->UpdateSubresource(colorFrameTextureDX11, 0, NULL, colorFrameMat.data, colorFrameMat.cols * colorFrameMat.channels(), 0);
ctx->Release();

When Unity is run in DX11 mode, this runs perfectly for a few second after which it crashes without error report. I believe the problem is in using UpdateSubresource method which doesn't lock the texture causing simultaneous access from Unity's rendering pipeline and plugin thread.
In DX11 documentation I came across the Map/Unmap methods for updating textures which work similarly to LockRect/UnlockRect methods from DX9. However these methods can only be used with DX11 textures created as D3D11_USAGE_DYNAMIC and the texture from Unity is created as D3D11_USAGE_DEFAULT.
Is it possible to change or recreate the texture created in Unity with different usage flags?
Thanks in advance to anyone who even read it all :D

sentences:
Automatic audio segmentation and find the most energetic segments What algorithm can be used for audio segmentation? I want to divide song to segments and find the most energetic segments (begin and end in seconds). It is needed for the rhythm-game.

Examples:

https://soundcloud.com/dieantwoord-yolandi/die-antwoord-cookie-thumper
(most energetic segments: first 3:09-3:38; second 5:02-5:27)

https://www.youtube.com/watch?v=StZcUAPRRac (rammstein - sonne)
(most energetic segments: first 0:55-1:20; second 1:52-2:44)

sentences:
UDK and Protocol Buffers Actually two questions:

Can I use TCP sockets in UDK to implement my own networking protocol? (I guess TCPLink is an answer)
Is there any way I can user Protocol Buffers inside UDK? Or anything like that? (i.e. thrift, bson)

sentences:
How can I publish my game (*.aab file) on google play? I select arm64 (64 bit) and x86 and amrv7 and select build app bundle in player setting so but when I want publish so I have an error like :
Error
This release is not compliant with the Google Play 64-bit requirement
The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 2. Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code it needs. This avoids increasing the overall size of your app.

I tried following the steps listed in this Stack Overflow post, but the problem remains.
PLease answer me, why no people answer in this web site?

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:
Handling input in a custom ECS engine I've been implementing an Entity Component System into my custom toy engine so I can learn more about it. Currently I have the following problem:

I can't think of a way of implementing input as a system. Currently I just check for key presses in the main loop, like this:

if (glfwGetKey(Window, GLFW_KEY_A) == GLFW_PRESS)
    Camera.Translate(glm::vec2(-5.0f, 0.0f) * static_cast<float>(DeltaTime));

Here I check if key A is pressed, and if it is I move the camera, which isn't a component associated with an entity.

So what I thought is creating an Entity with a Input component associated (this component would have mouse coordinates, keys pressed, etc):

ECS::Entity * InputManager = EntityWorld->create();
InputManager->assign<Input>();

Then, each frame, after polling events, I would update the Entity directly like this:

InputManager->get<Input>()->MousePosition = MousePosition;
InputManager->get<Input>()->MouseWheelDelta = MouseWheelDelta;
....

Then, I'd have an InputSystem, where I can check mouse position, if some key is pressed, etc. But what I don't understand is, if the camera is not a component, how could I make it move now that I handle input through the InputSystem?  If I make the camera a component, how would I implement all the functionality to move it around, and zoom in and out?

Let me know if something it's not clear.

sentences:
How can I recreate the movement of arrow in air? Given two Particles A and B which forms the arrow itself, A.P an edge of it and the opposite one B.P. Like so A.P---------B.P.

const float DistArrow = 60;

Where I have structure Particle:

struct Particle
{
    struct Complex P; //Position
    struct Complex F; //Gravitational Force
    struct Complex V; //Velocity
    float m; //Mass
}

At the start each particle, A and B has a starting Velocity of like (40, 70). And I am adding a value of force to A.F(0, -9.21) and B.F(0, -9.81). So that the B.F has much more weight on it, so it drags the A to down kind of.

I want the arrow to move like this:

And I am tried to figure out how to make till I was stuck with this(I am trying to calibrate in a way the arrow to the initial DistArrow:

A = erA->B*(D(AB)-DistArrow)/2+A; where erA->B(unit vector) = (B-A)D(AB);
B = erB->A*(D(AB)-DistArrow)/2+A; where erB->A(unit vector) = (A-B)D(AB);

The problem is that it just rotates 180 degree, dunno why it does, if it will infinitely fall it should be A at the top of B, a line perpendicular with oX.

I am seeking a good solution not involving to much physics, any advice will be highly appreciated.

sentences:
What tools do you use for 2D art/sprite creation? What cheap/free tools do you use for 2D art and/or animation?

I don't really like Gimp's interface, Paint.NET is limited and GraphicsGale is sort of archaic. Cosmigo ProMotion looks like it could be good, anyone use it? Seems a bit pricey at $78/92 but of course cheaper than Photoshop.

I used to like Jasc Paint Shop Pro 7, but the newer versions Corel makes are more for photos.

2D Bones support would be handy also.

sentences:
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:
How to PRECISELY measure execution time of a code? In order to compare algorithms speed, I measure execution time of a code part with a method similar to the one described in this question.

I am not operating on Windows, but on Linux, so I use gettimeofday function in order to measure time with microsecond precision.

My test program has a simple architecture:

int main()
{
    test_algorithm1(); // Measure execution time of algorithm1 and
    test_algorithm2(); // Measure execution time of algorithm1 and

    return 0;
}

My functions test_algorithm1 and test_algorithm2 have exactly the same structure:

void test_algorithmX()
{
    struct timeval before, after;
    time_t         elapsedUs;
    int            i;

    gettimeofday(&before, nullptr);
    for (i = 0; i < 1000000; i++) // Repeated 1 000 000 times for more precision.
    {
        // Code to measure here
    }
    gettimeofday(&after, nullptr);

    elapsedUs = after.tv_usec - before.tv_usec; // Elapsed microseconds
    elapsedUs += (after.tv_sec - before.tv_sec) * 1000000; // Elapsed seconds
    std::cout << "Elapsed time for algorithm X: " << elapsedUs << std::endl;
}

However, I face two problems:

Measured time seems very random, especially with short algorithms. If I run many times the program, I can obtain results between 25 000 and 35 000 us.
If I invert algorithms order in the main function (running test_algorithm2 before test_algorithm1), values change. It appears that the first one to be executed is slower. Values like 50 000/15 000 us may change to 40 000/20 000 if I invert them.

This is very problematic, because I sometimes measure algorithms of very close speed, and I cannot make a conclusion with this random.

Is there a better way to measure execution time? Or did I do something bad, like using the gettimeofday function?

sentences:
How to make a cell shader like BOTW in Unity? It seems most cell shader tutorials focus on individual shaders for materials, but the effect used in BOTW seems to be more like a filter, that is applied to everything.
I've researched multiple examples that have been done in UE4 like here and here but nothing in Unity.
How would I apply something like this in Unity?

sentences: Should I use scenes in Unity for menus? I assume scenes are for different levels, but should I use them for menu screens or is there a specific tool for menu screens?

sentences:
Convert linear velocity to angular velocity for a ball / sphere (Rolling Ball Maths) I have a ball moving on a flat plane. I cannot use RigidBody physics, so my object in Kinematic and I am manually handling speed/acceleration. The linear movement of the ball is fine, however as the ball does not rotate, it looks odd.

Given a speed Vector3, where I am moving on the X & Z, I need to figure out how to make the ball "roll".

I think I a running into Euler / Gimbal lock issues by trying this:

transform.Rotate(
  180.0f *  speed.z / (Mathf.PI * radius) * dt,
  0,
  -180.0f * speed.x / (Mathf.PI * radius) * dt
);

This formula is loosely based on the angular velocity formula and converting to degree's per second, with dt (deltaTime).

My gut instinct says that the solution may lie in Quaternions somewehere...?!

sentences:
FPS drop after moved from Textures to TextureAtlas in LibGDX I've started using LibGDX some time ago and I was making a test project to get used to this library. I've created some images and added them to the assets folder and loaded each image as a Texture using the AssetManager. Everything was working fine and I had 60 FPS.

I wanted to work in a more efficient way so I packed all my images into an atlas using the TexturePacker tool. I loaded the atlas using the AssetManager again and started using TextureRegions instead of Textures.

After this change I've started to notice sudden drops in FPS from 60 to 50 and even 30 once. I've tried to change the pixel format to RGBA4444, I've made sure that the min and mag filter were both seth to Nearest, but still I see those annoying frame drops.

I'm not doing anything heavy in the game itself, it's currently some actors in a stage. I got some MoveActions and Animation, but nothing special yet.

Does anyone have a clue what can cause the FPS drop?

Thanks

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:
How to apply game progression changes on screen loading in a Zelda like game I'm trying to develop a 2D game like Zelda. The game is divided in screens with exits linking each other. I store each screen data (including objects and NPC positions) on a separate file, and when the main character steps on the exit, the next screen data is parsed and the screen is loaded. Everything works just fine so far.

I'm now trying to implement the game progression system, along with the save system. I've read a lot about some ideas on how to do that, finite state machine design, what to store on save files, serialization and everything, but I'm kind stuck here.

Let's say that action X triggers event Y, moving some NPC from point A to point B. The player then saves and quits the game. When the game is loaded, it must position that NPC on point B.
To achieve that, should I rewrite the files that contains screen data so when the screen is parsed it draws the NPC on its new place? Or should I store its new position on a separate file, and apply the changes on the screen after its loaded? Or maybe there's a better and less ugly way.

Any suggestions are welcome.

sentences:
Non-physics character movement in a Box2d Environment I am in the process of creating a physics platformer. However, I want the player movement to feel very old-school(as in: non-physics like), which means that the character:

Should always move equally fast horizontally, even on slopes.
Has a reasonably fast jumping movement. The 'normal'(earthlike) gravity that is the default of Box2d tends to feel floaty.

Now, I have been trying lots of things to create a Box2d player that works this way. Multiple questions over the past few weeks are related to problems I've encountered with that:

I increased the gravity and the density of the player to ensure they would jump/fall faster. (see this question)
I worked with the 'unicycle' model(a square connected to a circle) to prevent getting stuck behind small corners. The bad part was that the player was now unable to stay on any slope, because they kept sliding down.
To prevent that, I learned that I had to keep the density of both objects low.(see this question) This again created the gravity problem. Also, while the player now was able to keep standing on slopes, moving up on them was still extremely slow (and moving down incredibly fast).

I am getting a bit frustrated now over all this crazy behaviour that doesn't work the way I want it to. Now I am wondering:

Is there something wrong with the approach to handle the player's movement outside of Box2d, and after that let Box2d resolve the new collisions with ground and objects?

Or is this going to be extremely unstable and glitchy because I would 'teleport' the player instead of moving them with forces and is there still another, better way to get the movement I'd like?

sentences:
Detecting a 3 x 3 grid and extracting its coordinates using Kinect I'm interested in creating a DDR (dance dance revolution) game using unity3D and Kinect. However I need to do this without actually using a pressure sensor pad, just a mat with grids and numbers on it.

Here is what the Grid is supposed to look like:

I need to be able to track where the Mat is placed on the floor and a way to check which number is the user stepping on. The user feet coordinates can be tracked via skeletal tracking, however the grid coordinates and boundaries need to be extracted.

Is there a way to do this without using openCv and can opencv be used with Kinect and unity3d?

sentences:
Server networking - Thread per player As my game is purely multiplayer, online performance is important.

Should I run two threads for each player/connection? (One for input and one for output) or should I run one thread for all player input and one thread for all player output?

What is the pros and cons, and how do I deal with high ping players in the second method?

sentences:
How would I handle collision to all instances of one object? (C# and monogame) What I'm saying is, let's say I have a list. That list contains all the tiles in the game. I use this to update them all, draw them all, etc.

for (var i = 0; i < Tiles.Count; i++)
{
     Tiles[i].Update(gameTime);
}

But how can I handle collision from each side of the tile, each side of the player for all tiles, but instead have each tile have its own individual set of collision codes? Because if I have the player box intersect the tile box, it counts as ALL of the tiles..

sentences: Game Design Lexicon: terminology for gems etc When a Hero picks up gems or coins or other "collectibles" that add to his wealth in a game, what are those things (gems and coins etc) commonly called and how are they generally referred to in game design terminology?

sentences:
How can I speed up Unity3D Substance texture generation? I'm working on an iOS/Android project in Unity3D. We're seeing some incredibly long times for generating substances between testing runs. We can run the game, but once we shut down the playback, Unity begins to re-import all off the substances built using Substance Designer. As we've got a lot of these in our game, it's starting to lead to 5 minute delays between testing runs just to test a small change.

Any suggestions or parameters we should check that could possibly prevent Unity from needing to regenerate these substances every time? Shouldn't it be caching these things somewhere?

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: Using XBOX controllers on PC for an XNA game Does anybody know how to do this? I have been trying to figure this out with no luck.

sentences:
Using PS3 controller for input on Mac OSX I've managed to find a USB driver to connect to the PS3 controller in OSX, and as reported here, can connect to the controller via Bluetooth.

I've verified that the input is working properly via Snes9x.

Anyway, that's just background for my actual question. Is there any way to access the PS3 HID, via C++, on the Mac? I'm relatively new to C++ development on Mac using XCode, and the internet has been disappointing in my search for a possibly library to use.

Does anybody have any ideas on how I could access the controller button/axis states in code, so I can transfer them to my input maps?

sentences:
Background replacement with 3D moving objects using Intel RealSense SDK I have done background replacement with static image and video using RealSense and c#, but now the requirement is to replace the background with the 3D moving object in still background.

Is it possible with RealSense?

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:
Canting of track in a racing game I am trying to create a small racing game in which the track would be modeled using a BSpline curve for the path's center line and directional vectors to define the canting of the track at each point.

My problem is that I don't know how to calculate the correct canting / slope of the curve, in such a way that it would be optimal or at least visually nice for a car to 'slant in the corner'.

My idea was to use the direction of the 2nd derivatives of the curve, however while this approach looks fine for most of the track, there are points in which the 2nd derivative makes sharp 'twists' / very quick 180 degree flips. I also read about 'knots' of bsplines, but I don't know if such 'twist' in 2nd derivatives is a knot or knots are something else.

Can you tell me that using a BSpline:
1. How could I calculate a visually nice canting of a track for a racing game?
2. Is it possible to do this by using some simple calculations of centripetal force / gravity?
3. Is it possible to do this by using 1st, 2nd and 3rd derivatives of the BSpline curve?

I am not looking for the 'physically correct' canting angle for the track, I would just like to create something which is visually pleasing in a simple game.

I am using a framework which has a built-in class for BSpline, including support for 1st, 2nd and 3rd derivatives of the curve.

sentences:
Approach on how to split game assets into split archives With a custom binary file format for archives that is structured similiar to Valve's VPK files I have a Game.index.gcf which holds information about all files and where exactly they are stored. I can split up and say, that the /Assets/Maps and /Assets/Scripts folders should be stored in Game.000.gcf while the bigger /Assets/Music folder could be split up into Game.001.gcf and Game.002.gcf. This should boost performance but only if done right. Moreover with updates I could say, just update this particular split archive and not the entire archive (when storing everything in one really huge a file).

As of yet, I don't know how to write such an adaptive algorithm which automatically decides the best way to split all archives and files. What aspects should I keep in mind and what should I be aware of when creating these? Do you have any suggestions?

sentences:
How to Make Saving System Serializable Hello I’ve been working on a save/load system for my RPG inventory, and I was wondering whether there was a way to make the script use Serialization instead of PlayerPrefs, because I want the player to be able to access their save file. The main issue I run into with this code is how it mixes up the same variable in different itemHolders, causing duplication. Also, I heard that PlayerPrefs is better used for settings or preferences. Here’s my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

public class ItemInformation : MonoBehaviour
{
    // These are the assets for the item to change
    public Text nameText;
    public Text descriptionText;
    public Text regenText;
    public Text amountText;

    // This is the identifier for each item
    public string identifier;

    // These are the variables that change with the different items
    public string itemName;
    public string itemDescription;
    public float itemRegeneration;
    public int itemAmount;

    // Starts on awake
    void Awake()
    {
        // Function to change the object's information and such
        nameText.text = itemName;
        descriptionText.text = itemDescription;
        regenText.text = "HEALS " + itemRegeneration + "HP";

        // Loads game data
        LoadDataIfNeeded();
    }

    void Update()
    {
        amountText.text = "HAVE:" + itemAmount;
    }

    private void SaveData()
    {
        string jsonString = JsonUtility.ToJson(this);
        PlayerPrefs.SetString(identifier, jsonString);

        // Creates file to store variables
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/InvData.dat");
        SaveData data = new SaveData();

        // Gets the player data
        data.itemSave = myItemAmount.itemAmount;

        // Writes player data to file and encrypts it
        bf.Serialize(file, data);
        file.Close();
    }

    public void LoadDataIfNeeded()
    {
        if (PlayerPrefs.HasKey(identifier))
        {
            string jsonInstance = PlayerPrefs.GetString(identifier);
            JsonUtility.FromJsonOverwrite(jsonInstance, this);

            // Extracts the data from the binary file and reads it
            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(Application.persistentDataPath + "/InvData.dat", FileMode.Open);
            SaveData data = (SaveData)bf.Deserialize(file);
            file.Close();
            myItemAmount.itemAmount = data.itemSave;
        }
        else
        {
            SaveData();
        }
    }
}

// Holds data that is to be saved
[Serializable]
class SaveData
{
    // Variables for save file
    public int itemSave;
}

sentences:
How can I select and scale an edge loop within Blender? I'm a web developer looking into game development as a hobby for fun and the challenge. I have just started learning blender 2.6. I am currently doing a tutorial at http://cgcookie.com/blender/2010/12/22/modeling-a-building/
at around 9:30 after making loop cuts he scales a column. I cant get the same selection as he did. he has vertices selected but selected the whole loop cut? can someone tell me how to make that selection he did.
Also what setting does he use to display the dimension numbers of his selections?

sentences:
Efficient solution for multiplayer space partioning? This question is a little tricky, but I will try to make it clear.

Lets say I am building an online game (not MMO-scale), but that supports as many players as possible, in a authoritative server approach. I want really big worlds with lots of AI simulated enemies.

I am aware of a few strategies to save server CPU by subdividing the space and not processing what doesn't need processing. I have already split the world by regions, that will require loading times and small transitions, which I think is important to maintain the quality of gameplay when playing locally (alone or even with a couple of friends). I don't expect the players to be in more than one or two regions.

The problem is that a region can become pretty big, and have a lot of NPCs simulating at once. How do I handle this without affecting the players' experience? Approaches like one server per region and alike are not in the table.

I am mainly looking for data structures to hold hordes of enemies, and even peaceful NPCs. To finalize the question, please note that vehicles exist, therefore its considerably fast to travel within a region, influencing the "when" to cull areas.

sentences:
Generate next chunk with perlin noise I'm actually trying to generate a level with procedural generation using perlin noise.
So one chunk has a size of 30x30, it's a float 2d array and at first I'm filling it with values between 0 and 1. Next step is to calculate 7 octaves and merge them. In the end I normalize the values.
All this works quiet well if I only want to create one chunk but how can I create one more chunk beside my first so that they fit together smoothly?

sentences:
How do I add leaderboard feature of OpenFeint in android? I am developing a game in android, by extending a class with view. I have integrated OpenFeint in it by studying the tutorial provided on the OpenFeint site, but I am not able to add the leaderboard feature in my app. How can I achieve it?

My game class is like this

public class GameActivity extends Activity {

Intent i;

Grapic g;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(new Grapic(this));

and Grapic is a class which extends view and where scoring is done with touch events.

sentences:
What's wrong with reversing an action like this? I'm working on an undo and redo system map editor and have come across a major issue. If I place a tile down, move right a tile, and then move back to that tile I previously placed everything works fine. Until I try and Undo, Redo, and then Undo again.

This is the state when they're placed:

Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:

The undo redo stack looks something like:

Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
41
Unexecuting:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
41

I don't want this to be a code dump or "debug my code for me". I understand the problem is located at the bottom most segment where it assigns the tile an ID of 41 once again - since that's what it's previous value was. This works the first time - but not the second as seen. I'm confused to why the algorithm fails. If anyone has written something similar, feedback would be appreciated. I don't need code-fixed - just hints as to where I can find a working algorithim or a rational explanationa s to why this happens. It's just a simple pencil tool that should write tiles the grid.

  public new void Execute(GameMap gameMap)
{
    Console.WriteLine("Executing: ");
    PrintState();

    _previousTiles.Clear();

    // Get vertical portion
    var curTexture = MapEditorGlobals.CurrentActiveTexture;

    // We need to loop over the width of the editor
    for (int w = 0; w < SelectedTiles.Width / 32; w++)
    {
        for (int h = 0; h < SelectedTiles.Height / 32; h++)
        {

            var gX = SelectedTiles.X / 32 + w;
            var gY = SelectedTiles.Y / 32 + h;

            var tY = (gY) * curTexture.Width / 32;
            var tX = gX;
            var tileID = tY + tX;

            _previousTiles.Add(gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId);
            gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId = tileID;
        }
    }

}

  public new void UnExecute(GameMap gameMap)
        {

            Console.WriteLine("Unexecuting: ");
            PrintState();

            List<int> newTiles = new List<int>();

            // Get vertical portion
            var curTexture = MapEditorGlobals.CurrentActiveTexture;

            // We need to loop over the width of the editor
            for (int w = 0; w < SelectedTiles.Width / 32; w++)
            {
                for (int h = 0; h < SelectedTiles.Height / 32; h++)
                {

                    var gX = SelectedTiles.X / 32 + w;
                    var gY = SelectedTiles.Y / 32 + h;

                    var tY = (gY) * curTexture.Width / 32;
                    var tX = gX;
                    var tileID = tY + tX;

                    newTiles.Add(gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId);
                    gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId = _previousTiles.Last();
                    _previousTiles.Remove(_previousTiles.Last());
                }
            }

        }

sentences:
Online Tower Defense : Problem in protecting user's data Sorry about the question heading

I am creating an online tower defense game with SQL Server 2008 as my database.

SQL user used to send data to server is restricted to only execute existing storeprocedures which means to do anything like building or destroying a tower a storeprocedure has to be used. Now in the case of destroying of towers a storeprocedure named "sp_remove_tower" is fired with just 1 parameter "UserId" which will tell the database from which account the tower has to be removed.

Problem

is that if a person has SQL Server 2008 management studio installed and gets the SQL Server Name, SQL User ID, SQL User Password from lets say through inspect element in google chrome or by hacking the game itself. Then he can randomly pass any UserId in the storeprocedure which will cause to delete towers from other innocent players account.

How do i stop such a thing from happening?

Thanks in advance

sentences: Why don't objects far away from the camera experience floating point issues? In Kerbal Space Program, a space exploration game made with Unity, Floating origin technique is used to overcome the floating point precision issues. While in map view, the world (a scaled space with miniature celestial bodies) is recentered around the camera every frame so glitches don't occur when viewing unsafely distant planets. But when such planets are observed from an 'unsafe distance' (more than 10 000 units in scaled space), they're still rendered normally. Why don't floating point issues occur?

sentences:
Unity character customization parts I'm relatively new to unity, started a couple weeks ago and so far I managed to setup a character with multiple parts, like hair, head, and body. Here's how it looks like:

I also managed to import some animation thanks to https://www.mixamo.com/ and everything works perfectly well; for now...
Now, I'm struggling with the "change" part mecanism. I'd like to swap the "nude" body mesh part, to an "armor" mesh or any other body mesh. Problem is, when I change the model in the SkinnedMeshRenderer it tells me the following:

with this result:

I did some reseach about this error message, and it actually makes sense, the given mesh doesn't have any bone setup, bone weights or such.
I would like to know if it's possible to use "common" skeleton for every models and assign it throught code?

sentences:
Approaches for a clickable map of nations (such as a Risk game) with Spritekit I would like to create a political map where each country is clickable by tapping but I'm not sure the best way to determine which nation was selected.  Imagine Risk where each country can be individually clicked to bring up additional information.

My current approach is to make a sprite for each nation where every image is the size of the screen   The images are mostly transparent except for the country, that way when all of the images are displayed the countries are in the correct place relative to one another.  To determine if a click occurs on an individual country I look to see if the tapped location is a non transparent pixel and check that the sprite's name is one of the countries.  Additionally the nation needs to glow or something when tapped as an indicator, however my current solution is yet another sprite that is displayed.

This seems like a terrible approach and I was wondering what other solutions might achieve the same results.  I'm pretty new to SpriteKit so I'm not entirely sure.

The other idea I had was creating a single texture where each country is a different shade of gray, then when I get the tap location I do a lookup on the color at that location and get the corresponding country.  However, I'm not sure how to create a hilight or glowing country effect with that method.

sentences:
Design patterns for rules systems? As a quick fun project, I tried writing a solitaire game. But when getting to writing up the rules systems, I felt dirty, because my code felt completely unstructured and inextensible, mainly because my game logic was complete spaghetti code.

I've run into this problem before, and always feel awkward when writing this part of my program, so I was wondering, are there any tried and tested best practices when it comes to defining rules in a game?

sentences:
How do you set event after a pawn takes damage? How can I set event after bot/pawn takes damage in UDK? (possibly in Kismet?)

I need to do something similar to this: http://www.youtube.com/watch?v=gjRf5lTcWLY

sentences:
Can't get reliable collision detection/response in Monogame So, I currently have a Rectangle that updates with player position, and is the size of the sprite. I'm using Tiled as my tile editor, and have an Object layer called "collision" which I loop over when loading the map, and store each object as a Rectangle in a list. Then in my Update I check if the player is colliding with any of those rectangles (via looping over the list) with Rectangle.Intersects(Rectangle). And if a collision is detected, I handle it with this function:

private static void HandleCollision()
{
    if (_currentLevel.IsCollisionTile())
    {
        float deltaLeft = Math.Abs((Player.Instance.Position.X + Player.Instance.PlayerCollider.Width) - (_currentLevel.collidingRectangle.X));
        float deltaRight = Math.Abs((Player.Instance.Position.X) + (_currentLevel.collidingRectangle.X + _currentLevel.collidingRectangle.Width));
        float deltaUp = Math.Abs((Player.Instance.Position.Y + Player.Instance.PlayerCollider.Height) - (_currentLevel.collidingRectangle.Y));
        float deltaDown = Math.Abs((Player.Instance.Position.Y) - (_currentLevel.collidingRectangle.Y + _currentLevel.collidingRectangle.Height));

        if (deltaLeft < deltaRight && deltaLeft < deltaUp && deltaLeft < deltaDown)
        {
            Player.Instance.Position.X -= deltaLeft;
        }
        else if (deltaRight < deltaLeft && deltaRight < deltaUp && deltaRight < deltaDown)
        {
            Player.Instance.Position.X += deltaRight;
        }
        else if (deltaUp < deltaLeft && deltaUp < deltaRight && deltaUp < deltaDown)
        {
            Player.Instance.Position.Y -= deltaUp;
        }
        else if (deltaDown < deltaLeft && deltaDown < deltaRight && deltaDown < deltaUp)
        {
            Player.Instance.Position.Y += deltaDown;
        }
    }
}

I know this is ugly, but that's not the problem, the problem is that when it detects a collision, the player "spazzes out" and just bounces in and out of the rectangle it's colliding with. I've tried a couple other ways too, like just setting the player position without using absolute values, with similar calculations. The same problem happens though. Also it allows the player to just phase through platforms from one side, and the player will get teleported to other sides sometimes, so this is very bad.

I'm not sure how else to handle it, I've done research and googled a lot, as well as searched here, but everything I find is about the actual collision detection, which I'm doing via the Rectangle.Intersects() method. I've been at this for 3-4 days, before deciding to post here.

sentences:
Having trouble creating multiple sprites from one class So I am trying to make more than one sprite using a single class but I cannot seem to get the sprites to be drawn at all or drawn in different places (they are all just on top of one another).

In my Game1 I have:

    Flag flag;
    List<Flag> GameFlags = new List<Flag>();

then in LoadContent:

flag = new Flag();
tempTexture = Content.Load<Texture2D>("FlagTexture");
tempRectangle = new Rectangle(50, 500,tempTexture.Width / 3, tempTexture.Height / 3);
flag.SetSprite(tempTexture);
flag.SetRectangle(tempRectangle);

for (int i = 0; i < 2; i++)
        {
            GameFlags.Add(flag);
            flag.spriteRectangle.X += 100;
        }

Then in Draw:

 foreach (Flag flag in GameFlags)
        {
            spriteBatch.Begin();
            flag.Draw(spriteBatch);
            spriteBatch.End();
        }

The effect I am after is having 2 sprites spaced out by a specified amount of space. Image if the underscores were spacing and the zeros were sprites in the following:

0____________________________0

Any help and advice is appreciated.

Thanks in advance,

TeaBelliedTitch.

sentences:
Text Adventure - Engine actions based on dialogues Building forward my text adventure i stumbled upon how to actually drive the actions that can be caused by dialogs. I wrote the dialogues and the logic around handling them already, but i'm missing a key about how to turn a dialogue into an 'engine' specific action (like spawn item, drop, buy, sell).

My game is absolutely based on JSON therefore even dialogues are stored there:

An Option is what a player can choose by typing one of the defined Keywords for currently displayed dialogue.

Response is what a player sees when option is chosen

Goto is where the dialogue goes next after an option is chosen

Script is nothing more fancy than a list of strings with integers that get mapped into a std::map<std::string,int> and later passed for the execution. Think of it as of flags.

Let's look at the example below - where you could buy something from inn keeper.

In above situation, you can talk to the keeper and choose:

"1" to buy item "1"
"2" to buy item "2"
"back" to get back to previous dialogue (with a goto)

Let's say i want to choose option "1" and it boils down to the design now.

How would you turn that "1" into a real engine action of buying an item?

What i did.

As you might have seen i have defined a Script within the option of the dialogue, this would be just a map (string to int) of attributes passed to an interpreter.

Then the interpreter executes that based on 'action_type' - which is defined in json, mandatory and describes type of action like here:

Some questions then:

1) Is it the valid approach to write my own interpreter - maybe i can use it somewhere else? or i should start thinking about external scripts - which actually require me to focus on adding library and learning it, instead of doing the game itself.

2) Which class should be really responsible for actually executing the script with the data passed from dialogue.

Dialog class itself ?

std::string CDialogue::Process(const std::vector<std::string>& rvArguments)

Npc class handling talk action ?

void CEntityNPC::HandleTalk(CEntity *pFromWho, const std::vector<std::string>& rvArguments)

Command class that handles talk command?

void CCommandTalk::Execute(CEntity *pPlayer,const std::vector<std::string>& rvArguments)

3) Maybe you can think of a different way to handle this situation? Basically a translation of a text(json) data into a game logic.

sentences:
Unity - Quaternion - Rotate / Unrotate Error I'm trying to un-rotate a quaternion, aligning it with the axis, and then rotate it back to where it was originally.
But with every iteration it seems to lose precision and just after 20 iterations the rotation disappears.
Here is an example, which is a simplification of my code:

Quaternion rotation = Quaternion.Euler (0f, 90f, 0f);
Debug.Log ("Before: " + rotation.ToString ("F7") + " / Euler: " +
  rotation.eulerAngles.ToString());

int iterations = 1;
for (int i = 0; i < iterations; i++) {
    var currentRotation = rotation;
    rotation = Quaternion.Inverse (currentRotation) * rotation;
    rotation = currentRotation * rotation;
}

Debug.Log ("After:  " + rotation.ToString ("F7") + " / Euler: " +
  rotation.eulerAngles.ToString());

With 1 iteration the output is:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7071067, 0.0000000, 0.7071067) / Euler: (0.0, 90.0, 0.0)

With 5 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7071019, 0.0000000, 0.7071019) / Euler: (0.0, 90.0, 0.0)

With 10 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7059279, 0.0000000, 0.7059279) / Euler: (0.0, 90.0, 0.0)

With 15 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.4714038, 0.0000000, 0.4714038) / Euler: (0.0, 90.0, 0.0)

And finally with 19 iterations

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.0000000, 0.0000000, 0.0000000) / Euler: (0.0, 0.0, 0.0)

At the 19th iteration the euler angles becomes zero, and at previous iterations altough the euler angles are still correct, if I rotate a vector with the quaternion its magnitude is changed.

I hope you can help me and sorry for my bad english!

sentences:
Client-side physics simulation I am trying to create a very simple client-server based physics game, using box2d library. A simple football game.
Obviously, the server runs only the box2d world.
My question is:
is it correct to state that the client should run not only the needed rendered simulation but another box2d world as well?

I ask this because I know that the client should receive state information of the elements that have a changing state. And this information is received in packets every few ticks. And between every packet received, there's a time gap where I need to run the world like "nobody did nothing", and then correct the world state if somebody did something after I received the next packet.
That is why I need to run the box2d world in the client as well, but I feel it's kinda awkward and assymetrical.

Is this right? Is box2d prepared for this?

sentences:
Changing distance after some time on OnGUI Unity Though I am using IEnumerator to calculate the distance travelled value, the distance is updated very frequently, how can I change that? and why exactly increasing the time in WaitForSeconds function not changing the behaviour?

    void OnGUI ()
    {
        GUI.contentColor = Color.black;
        GUI.Label (new Rect (40, 40, 140, 40), "Speed : " + _speed, "color");
        StartCoroutine (distancetravelled ());
        GUI.Label (new Rect (40, 100, 100, 140), "Dist : " + Mathf.RoundToInt (distance * 1000) + " Kms", "color");

    }

    IEnumerator distancetravelled ()
    {
        timeInHours = (Time.smoothDeltaTime / 60) / 60;
        if(PlayerControl.collision != true)
        distance += _speed * timeInHours;
        yield return new WaitForSeconds (60);
    }

sentences: How can i add mobile camera feed to unity? I want to take my mobile camera's feed to unity , where if the target image is found , some action should happen ( may be like a cuboid appears on the target image). I thought of using ip webcam app which generates ip address , through browser i was able to see the camera feed. I want the feed from camera but the action must be in my laptop.

sentences:
Clipping a windows draw area - Direct x 9 and c++ - 2D using D3D DirectX 9, C++... Let me set the scene:

I have a 16:9 image.
I have a 16:10 screen.
I want the 16:9 image to be drawn so that it is vertically centred within my 16:10 screen.
My 16:9 image is 1920 x 1080.
My screen is 1920 x 1200.

Easy:

float topOffset = ( 1200 - 1080 / 2 )

But what if my screen was 1400 x 900

I have to resize the image and get its new height, then do the above again:

float newHeightForScaledImage = ( 1080 * 1400 ) / 1920

Okay so now I have a topOffset for both widescreen cases. I draw all of my images and interactive objects at their ( y position + the topOffset ).

New problem is that the menu is also needed to take into consideration, so I use that systemmetricssomething call which returns 20 which I then subtract from the topOffset... Okay my drawing is vertically centred... perfect!

Question is, regardless of my entire game now being vertically centred (in the most crazy long hauled way possibly known to man), I can still draw outside of the game area into the black zone that now exists.

I know I am approaching this wrong, but I am too new to this to know any better.

How do you guys vertically centre your games if they are a different ratio to the artwork you have created for the backgrounds etc?

sentences:
Is built-in checking Android/iOS permissions on runtime possible? I have a game with some levels, coded to both Android and iOS.

One of the levels late in the game uses a Microphone, so the app asks the user at the start (at the start of the application) to accept the Microphone permission.

If he does accept, everything is fine.

If he doesn't, Microphone.Start() method doesn't really work and I can't do anything about it.

What I should do is that in level's start() I should check if he has the permission and handle it, but...

I can't find a built-in way to check that on both Android and iOS.

Is there any, or I should download two different libs (for both platforms) and check it natively?

This is what I've tried:

    audio.clip = Microphone.Start ("Built-in Microphone", true, 999, FREQUENCY);

    Debug.Log("CLIP: " + audio.clip); // not null

    if(audio.clip == null)
    {
        GameManager.Instance().ForceComplete();
        return;
    }

    try
    {
        audio.Play ();

    }catch(Exception ex) // no exception here
    {
        GameManager.Instance().ForceComplete();
        return;
    }

    //...

sentences:
What is the highest quality way to render warped text on Windows? I need to render highly readable text, on par with DirectWrite+Cleartype+Truetype. The Cleartype system uses sub-pixel anti-aliasing. DirectWrite takes things a step further and moves letters around slightly (sub-pixel positioning, pixel snapping, etc.) to maximize readability and minimize distortions. This was important enough that every major web browser uses DirectWrite on Windows.

The obvious plan (with major shortcomings) is to render DirectWrite to a texture with cleartype disabled (because sub-pixel AA doesn't lend itself to transforms) and pixel snapping disabled (because that pixel "grid" is meaningless after transformation.) Unfortunately the text will look worse than it could if glyphs are enlarged or shrunk, and of course the lack of pixel snapping will hurt readability.

Ignoring performance, is there a higher quality way to draw warped text in Windows?

Edit: removed comment about disabling AA (DWRITE_RENDERING_MODE_ALIASED).

sentences:
How should I implement multi-pass rendering in a game engine? I have done multi-pass rendering, before, and understand how it works. I made a simple example, which rendered a basic scene with shadows. This was all part of one file. Now, I am trying to figure out is how to put it into my game engine.

Currently, my game engine uses a single pass. It is in a hierarchical structure, and uses Direct3D 9. I have a graphics component, which will load and draw a 3D model. In my game loop, I update all of the entities in the world, then I call the draw function for each one. This draw function gets the vertex buffer, index buffer and texture or material, and draws the 3D model using a shader. This works fine.

To do multi-pass rendering, to allow for shadows, I will need to draw each model multiple times. It doesn't seem right, to me, that in each models draw function I should put the second pass code; this will then be completed before the next models first pass.

How should I implement multi-pass rendering in a game engine?

sentences:
Cylindrical billboarding around an arbitrary axis in geometry shader I found an answer on this site relating to this question already, but it doesn't seem applicable in the context of my project.
Basically I'd like to create a method which fits this signature:
float3x3 AxisBillboard(float3 source, float3 target, float3 axis)

That is to say, when given a source point (i.e an object's position in world space), a target (camera position in world space), and an axis (the object's up vector, which is not necessarily the global y axis), it produces a 3x3 rotation matrix by which I can multiply the vertices of my point so that it's properly rotated.
I've found many solutions and tutorials online which work nicely assuming I only want to rotate around the y axis.
For example, here's a solution which billboards around the global y axis:
float3 dir = normalize(target - source);

float angleY = atan2(dir.x, dir.z);
c = cos(angleY);
s = sin(angleY);

float3x3 rotYMatrix;
rotYMatrix[0].xyz = float3(c, 0, s);
rotYMatrix[1].xyz = float3(0, 1, 0);
rotYMatrix[2].xyz = float3(-s, 0, c);

For context, I'm working on a grass shader, and each individual blade of grass should be billboarded to face the camera while remaining aligned with the normal of the terrain.
edit:
Thanks to @DMGregory I'm using his matrix method in the following way:
float3 viewDir = normalize(vertexPosition); // camera is at (0, 0, 0)
float3x3 billboardMatrix = transpose(AxisBillboard(worldUp, viewDir));
float3 worldPosition = vertexPosition + mul(billboardMatrix, localPosition);

This works correctly when grass is rotated to align with world space. In other rotations, grass is still billboarding 'correctly' around its local y axis but also has another rotation applied. Any ideas?

sentences:
How can I make a shader that renders only the scene's skybox? I am trying to replicate the following image:

There are a few ways about doing this that involve camera stacking, layers, etc. Is it possible to create a shader that will only render the skybox?

sentences:
Unity2D 5 - Flickering sprites on Android So the game had been working fine for a few days on Android phone without any issues. Today, after adding some scripts and tweaking the game a little bit (tweaks which have nothing to do with the sprites and the issue itself), the game assets/sprites started on flicker. On PC, they looked fine, but once ported to Android as a developer build, they started to flicker constantly, even after restart.

I decided to go in Player Settings and played with some check marks but nothing seemed to help.

Following are my current Player Settings :

Any help would be appreciated.

Oh also, I have GUI in my game, can it be the problem?

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:
OBJ file, face materials and drawing them with OpenGL I'm implementing a model class which loads OBJ and MTL files, and ran into an issue or question with face materials.

Consider the following example: It's a cube with 5 sides Gray and 1 side Green.

mtllib Materials.mtl

o Cube
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
v 1.000000 1.000000 -1.000000
v 1.000000 1.000000 1.000000

usemtl Green
f 7 8 4 3

usemtl Gray
f 5 8 2 1
f 6 7 3 2
f 8 5 1 4
f 1 2 3 4
f 8 7 6 5

The OBJ file obviously shares same vertices for adjacent faces even if the faces get different materials.

When drawing such a cube with OpenGL however, I would need to duplicate the vertices of the adjacent faces with different materials, since every vertex specifies the color it has - and I have two different colors for the same vertices here, depending on the face and the different material it has.
If I wouldn't do that, the adjacent faces would smooth over to the different materials.

First: Did I get this correctly or am I missing an OpenGL "feature" here which lets me "specify" the color of a whole triangle / face rather than a single vertex?

Second: If not, is there an easier way to keep track of the faces materials and duplicating the adjacent vertices if they get different materials? What would be the easiest way to implement different materials on one object?

sentences:
(Unity) Shortest way to instantiate an object and obtain it script Normally I use

ScriptName script = ((GameObject)Instantiate(
        Resources.Load("Prefab"),
        new Vector3(x, y, z),
        Quaternion.identity
    )).GetComponent<ScriptName>();

It is a little too long and too much of brackets, so I wondering if there is any other way to get instantiated object's script without break it in two statements.

sentences:
Export Blender materials to Unity3D I have a low poly model that I made in Blender 2.8. Because it's low poly, it only has a material that's a mix between a diffuse and a glossy shader - it has no textures. The only thing I want to do is import the model into Unity3D with the diffuse and glossy shaders, just like it is in Blender.
Does anyone know how can I do this?

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:
Sprites not being rendered on screen change - Android Libgdx In my game over screen for my Libgdx Android game I've the following code which starts a new game upon a screen touch.

       if(Gdx.input.isTouched()) {
        ScreenManager.setScreen(new GameScreen());
    }

A new game starts but none of the sprites are displayed on screen.

I've confirmed that a new game has started through logging and through use of the debugger. Also the game over screen eventually reappears after some time due to the player dying.

What's interesting is that if I hit the home button or bring up the running apps menu in Android and re-enter the app, the sprites display fine.

Both my GameOver screen and Game screen are classes which implement a Screen interface

Anyone have an idea of what could be causing the sprites not to display?

Here is my ScreenManager class which can either set or get the screen.

public class ScreenManager {

private static Screen currentScreen;

public static void setScreen(Screen screen) {
    if (currentScreen != null) {
        currentScreen.dispose();
    }
        currentScreen = screen;
        currentScreen.create();

}

public static Screen getCurrentScreen() {
    return currentScreen;
}

}

sentences:
Is chess-like AI really inapplicable in turn-based strategy games? Obviously, trying to apply the min-max algorithm on the complete tree of moves works only for small games (I apologize to all chess enthusiasts, by "small" I do not mean "simplistic").
For typical turn-based strategy games where the board is often wider than 100 tiles and all pieces in a side can move simultaneously, the min-max algorithm is inapplicable.

I was wondering if a partial min-max algorithm which limits itself to N board configurations at each depth couldn't be good enough? Using a genetic algorithm, it might be possible to find a number of board configurations that are good wrt to the evaluation function. Hopefully, these configurations might also be good wrt to long-term goals.

I would be surprised if this hasn't been thought of before and tried. Has it? How does it work?

sentences:
Where does the game code fit into the engine? I was wondering if somebody could tell me how the game and the game engine fit into game development. What I specifically mean is, the game engine does not actually contain a game. Do game developers build an engine, then create a new class that inherits from the engine, which becomes the game?

For example,

class ShooterGame : public Engine
{
};

I'm not sure about where the game code fits into the engine.

sentences:
How do I change the window position in Unrealscript? So when I start my game it starts out in the middle of my screen at 1024x768 resolution, but then when I change the resolution via consolecommand("SETRES ..."); it resets the window position to the top left of my desktop.

Is there a way for me to set the windows position after I make this change?

sentences:
Need some help with A* Pathfinding I am trying to read in from 2 text files (one contains the start and end coordinates, the other is a map of costs for use with the Manhatten Distance) and I'm really struggling with the implementation of the code from various algorithms I've found.

I've been able to read in the text files and put them into 2 separate arrays fine, the real issue I'm having is with adding to the open list and compares their costs so that the smallest goes onto the priority queue and then compare its neighbors, I just cannot work this out after hours upon hours of reading and watching YouTube videos on the subject, any help?

Here is my code so far:

#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include <deque>
#include <math.h>
#include <vector>
#include <deque>
using namespace std;

struct pNode
{
    int xPos;
    int yPos;
    pNode* Parent;
    pNode* child;

    float g; //Cost of this Node plus predecessors
    float h;//Heuristic estimate to Goal state
    float f; // f= g+h

    pNode() :
        Parent(0),
        child(0),
        g(0.0f),
        h(0.0f),
        f(0.0f)
    {
        bool wall = false;
        bool water = false;
        bool grass = false;
        bool startNode = false;
        bool endNode = false;
    }
};

class compare
{
public:

    bool compareNodes()
    {
        pNode *x;
        pNode *y;
        return x->f > y->f;
    }
};

class dMap
{
public:
    static const int ARRAY_SIZE = 100;

    void LoadFile();
    void Display() const;
    void priorityQueue();
    void aStar();

private:
    pNode   mArray[ARRAY_SIZE];
    pNode   mArrayCoords[ARRAY_SIZE];
};

void dMap::LoadFile()
{
    ifstream infile("dMap.txt");
    if (!infile)
    {
        cout << "Cannot open File";
        exit(1);
    }
    for (int i = 0; i < ARRAY_SIZE; i++)
    {
        infile >> mArray[i].xPos >> mArray[i].yPos;
    }
}

void dMap::priorityQueue()
{
    int disX = mArray[ARRAY_SIZE].xPos;
    int disY = mArray[ARRAY_SIZE].yPos;
    int heuristic(int xPos, int yPos);

    struct pQueue
    {

        int fx;
        int fy;
        int x;
        int y;

        int cost;
        int h;
        int totalCost;

        pQueue(int _x, int _y, int _cost)
        {
            x = _x;
            y = _y;
            cost = _cost;
            h = heuristic(x, y);

            totalCost = cost + h;
        }

        int manhattenDistance(int xPos, int yPos)
        {
            return abs(xPos - fx) + abs(yPos - fy);
        }//Manhatten Distance

        bool operator<(const pQueue &b)const
        {
            return totalCost>b.totalCost;
        }

    };
}

void dMap::aStar()
{
    LoadFile();

    pNode mArrayCoords[ARRAY_SIZE];
    ifstream infile("dCoords.txt");
    if (!infile)
    {
        cout << "Cannot open File";
        exit(1);
    }
    for (int i = 0; i <9; i++)
    {
        infile >> mArrayCoords[i].xPos >> mArrayCoords[i].yPos;
    }

    deque <pNode*> openList;
    pNode* startNode = new (pNode);
    deque <pNode*> closedList;
    pNode* endNode = new (pNode);
    pNode* currentNode = new (pNode);
    deque <pNode*> finalList;

    //startNode ->

}

sentences:
Xna Import two files at once i need to import model from two separate files.

I have

dog.mesh
pet.material

dog.mesh contains vertices (converted to GeometryContent) and string "pet.material" (reference to .material file)

My MeshImporter that handles .mesh files returns NodeContent (one of children should be MaterialEffectContent)

Problem is, that in ContentImporter there is nothing to handle loading of additional assets.

Should pet.material be build by content pipeline in some way? To EffectMaterialContent for example. (Now i build it into MaterialDescription by MaterialImporter - contains string reference to .fx file)

The question is, can you even do things like this in xna? Split something that xna expects to be in one file (MeshContent) into two?

sentences:
Draw GUI.Button on certain position on a scrollable background Problem is in a 2D game I have a large background around 2 screens wide. And on there I got 4 buttons placed on top of background all over complete width. Now when I swipe of move my mouse around I scripted that the camera will move with it. So for the GUI.Buttons (Unity4.5) to stick on their place I used a variable drawX

 drawX = Camera.main.transform.position.x * 100;

The 100 is for calculating it to pixels. I then add this to my buttons when drawing.

scaleX = Screen.width / 1920f;
 scaleY = Screen.height / 1200f;
 if (GUI.Button(new Rect((500 - drawX) * scaleX, 700 * scaleY, 325 * scaleX, 425 * scaleY), ""))

Now the problem is that under 1920x1200 my target resolution everything works exactly pixel perfect. But when changing the resolution or aspect ratio to something else the drawX increases to much or not enough so the buttons don't move on the same pace as they did in the 1920x1200 version. Somebody got the solution for me?

sentences:
Loading sound in XNA without the Content Pipeline I'm working on a "Game Maker"-type of application for Windows where the user imports his own assets to be used in the game. I need to be able to load this content at runtime on the engine side.

However I don't want the user to have to install anything more than the XNA runtime, so calling the content pipeline at runtime is out.

For images I'm doing fine using Texture2D.FromStream.

I've also noticed that XNA 4.0 added a FromStream method to the SoundEffect class but it only accepts PCM wave files.

I'd like to support more than wave files though, at least MP3.

Any recommendations? Perhaps some C# library that would do the decoding to PCM wave format.

sentences:
An invisible object that deletes anything behind it? I am using augmented reality to put a 3D object on top of a "camera detected" object.

The 3D object can be though of as leaves that go above the real world object but also fall in front / behind / on the sides of it.

The leaves are not uniform so they appear as arcs which let more of the "camera detected" object be seen in some parts and less in others.

Because of this I want to only show the leaves that would normally be seen if there was a real 3D object (instead of the camera detected one) in that place. But since the camera detected one is just a background image part of the leaves on the side or behind are seen when the object is rotated.

I was thinking it might be possible to use an "invisible" object that moves and rotates the same way as the "camera detected" one so it behaves as a placeholder for depth testing but is not actually rendered.

Is this possible? May I have some pointers on how to achieve this?

Thank you

sentences:
Should I dedicate a single thread to each player in a split-screen game? I was thinking about making multiplayer version of a game I am making with SDL and OpenGL. It would be a split-screen game.

Do you think it would be a good idea to have each part of the screen (game session) handled by different thread? Those threads would have no data to share except for pause and game over/victory events. Since the single player version is already written, I thought I could save a lot of development time by implementing it this way.

sentences:
How is shot synchronization implemented in multiplayer FPS? I'm building a 2D multiplayer shooter game. I have singleplayer working and started working on multiplayer part (server code,...) and there is one thing I just can't get my head around.

When player shoots someone, who is moving, and he has high latency (>200ms or something like that) how to synchronize it with the other client? I thought that the shot vector could be sent relatively to targeted player (so when he would recieve the info about the shot, he could animate the shot hitting him).

Problem is, shots can destroy enviroment or hit other players. So when I shoot a target and there aren't any obstacles, he gets hit and the packet about shot hitting him gets sent. 200ms (+ other player latency) later, other player recieves the packet, but in that time, he moved behind an obstacle.

Problem rises:

a) If the obstacle is destroyable by the shot, clients will have different map (shooting player will have map with obstacle, while the other player will have the obstacle destroyed)

b) If the obstacle can't be destroyed, other player will either complain, because he got shot through impenetrable obstacle or the shot will be shot, so shooter will think that target got hit and target won't see any hit.

I just can't find a better way to solve this. Any ideas or examples how other games did it?

sentences:
Am I experiencing a gimbal lock problem when rotating my cube? So I'm trying to build a simple mechanic where the player see's 3 sides of a cube at a time: top, left and front(I called the front-side "Right" in my code, due to the orthographic view). The player can click on the front side or left side of the cube to rotate the cube so that the side that was pressed moves and becomes the top face. I want to smooth/animate the rotation.

The red faces are the faces that the user can click on.

My Logic seems to work quite well when I click on the left face (Rotating along the x axis), but doesn't seem to work well for the front/right face(It usually works once and then does weird stuff on the next click, this is on the z-axis)

public class CubeRotator : MonoBehaviour
{
    private const float STOP_THRESHHOLD = 0.1f;
    private const float ROTATE_AMOUNT = 90f;

    [SerializeField, Header("Touch Quads Colliders")]
    private Collider touchQuadLeft;
    [SerializeField]
    private Collider touchQuadRight;

    [SerializeField, Space(10)]
    private float timeToRotate;

    private bool mustRotateLeft = false;
    private bool mustRotateRight = false;

    private float targetX = 0.0f;
    private float targetZ = 0.0f;

    private float xVelocity = 0.0F;
    private float zVelocity = 0.0F;

    int layerMask;

    private void Start()
    {
        layerMask = LayerMask.GetMask("Touch Quad");
    }

    void Update()
    {
        ListenForTouch();
        RotateCube();
    }

    private void ListenForTouch()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector2 touchPoint = Input.mousePosition;
            RaycastHit rayCastHit;
            Ray ray = Camera.main.ScreenPointToRay(touchPoint);

            if (Physics.Raycast(ray, out rayCastHit, 150f, layerMask))
            {
                if (rayCastHit.collider == touchQuadLeft)
                {
                    mustRotateLeft = true;
                    targetZ = targetZ - ROTATE_AMOUNT;
                    zVelocity = 0f;
                }

                else if (rayCastHit.collider == touchQuadRight)
                {
                    mustRotateRight = true;
                    targetX = targetX + 90f;
                    xVelocity = 0f;
                }
            }
        }
    }

    private void RotateCube()
    {
        float zAngle = transform.rotation.eulerAngles.z;
        float xAngle = transform.rotation.eulerAngles.x;

        if (mustRotateLeft)
        {
            zAngle = Mathf.SmoothDampAngle(zAngle, targetZ, ref zVelocity, timeToRotate);

            if (Mathf.Abs(zVelocity) <= STOP_THRESHHOLD)
            {
                mustRotateLeft = false;
            }
        }

        if (mustRotateRight)
        {
            xAngle = Mathf.SmoothDampAngle(xAngle, targetX, ref xVelocity, timeToRotate);

            if (Mathf.Abs(xVelocity) <= STOP_THRESHHOLD)
            {
                mustRotateRight = false;
            }
        }

        transform.rotation = Quaternion.Euler(xAngle, 0f, zAngle);
    }
}

Inspector Values:

I've tried several things, the only problem I can think of is, gimbal lock. Thanks in advance.

sentences:
Determine required camera pitch/yaw change based on mouse movement and roll? I'm sure this is going to be a pretty simple answer but I can't quite figure it out on my own. Each frame, I'm getting the mouse's distance from the center of the screen (left/up is positive) and using it to change the camera's pitch and yaw.

Then, I added camera roll. Now, if the camera is rolled 45° left, moving the mouse left needs to change both the pitch AND yaw. I know I need to use math.sin and math.cos but I can't get it to work quite right.

Pitch and yaw are relative to the world, not the camera's view.

AddYaw and AddPitch are hypothetical functions that apply world yaw/pitch to the camera. So if the camera is rolled 90 degrees left (so right is world-up), applying yaw will appear to make the camera pitch "up", which is still left according to the world.

Due to the functions available to me through the game's API, I can't just apply camera-relative pitch/yaw, I'm restricted to world-relative pitch/yaw only. Basically, it boils down to applying some trigonometry to the mouse x/y input to "rotate" the pitch and yaw values added to the camera.

-- change.x = distance mouse moved left/right in this frame
-- change.y = distance mouse moved up/down in this frame

-- Fix me!
local yawChange = math.sin(rollInRads) * change.x + math.cos(rollInRads) * change.y
local pitchChange = math.cos(rollInRads) * change.y + math.sin(rollInRads) * change.x

-- Apply pitch/yaw changes to the camera
Camera:AddYaw(yawChange)
Camera:AddPitch(pitchChange)

A few examples of what it needs to return. For clarity, yaw = left positive, right negative, pitch = up positive, down negative.

Situation 1: No roll. Moving the mouse left applies positive yaw to the camera, moving the mouse up applies positive pitch. No conversion needed since camera yaw = world yaw, camera pitch = world pitch.

Situation 2: Camera is rolled 90 degrees left. Now, positive camera yaw (left) is actually negative world pitch (down). Therefore, moving the mouse left needs to apply PITCH, not yaw. And moving the mouse up needs to apply YAW, not pitch.

Situation 3: Camera is rolled 45 degrees left. Now, the camera/world axes are a bit mixed. Moving the mouse left should apply equal amounts of negative pitch AND positive yaw so the camera's view moves left relative to its own view.

sentences:
Minecraft Forge 1.8 referencing mod problem I'm trying to make a Minecraft Forge mod. I've done this before, but I've never worked with entities. So I was trying to add an entity to the EntityRegistry, but I can't seem to reference the mod file as an object using this. It tells me that it expect Object mod, not TestMobs. What am i doing wrong?

Here is my code:

package com.scriptcoded.testmobs;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.EntityRegistry;

@Mod(modid = Tutorial.MODID, version = Tutorial.VERSION)
public class TestMobs
{
    public static final String MODID = "testmobs";
    public static final String VERSION = "1.0";

    @EventHandler
    public void init(FMLInitializationEvent event)
    {
        EntityRegistry.registerModEntity(EntityTutorial.class, "Test mob", 1, this, 80, 3, true);
    }
}

The problem is in the line EntityRegistry.registerModEntity(EntityTutorial.class, "Test mob", 1, this, 80, 3, true);.

Any ideas?
Thanks for any help!

sentences:
How do I make a character capable of walking on walls? I am trying to get a character to move like a spider: Given a rising slope which a ball would normally not be able to roll up, the spider would slowly crawl up.

Similarly, given a mid-air rectangular platform, instead of falling down when reaching the edge, the spider would continue, wrapping over the edge and continue down the side and then underside of the platform (eventually walking around the perimeter of the platform).

I've looked into various Unity 2D components, with little success. :(

Most of my world's collision boundaries are marked by Collider 2D components (which work great with a simple ball affected by gravity, but less so with this spider character).

sentences:
Making a radial gradient visual range I am currently working on a project in p5JS.
So lets say i've got a texture and top of it, i've got a radial gradient that is overlapping on the texture. I want to make this like a cool vision range effect in 2D. I believe you can imagine this stitation.
So how am i able to start this thing?
Should i use another framework to do this?

sentences:
Calculating real time moment of inertia around arbitrary axis in 3d I have a 3d rigid body consisting of multiple triangles forming a closed mesh. I know how to calculate the moment of inertia around an arbitrary axis by splitting up the mesh into simpler shapes and using the parallel axis theorem and summarization to calculate the angular mass for the whole thing.

The problem is that in a real time simulation I would have to re-calculate the rotation mass for every impulse applied to the body. In my 2d simulation this is not a problem as there is just one orientation to any rotation axis, so I can calculate the angular mass just once.

Is there a way to pre-calculate the rotation mass for a 3d object, or is there a simplified way of doing this?

sentences:
LUA - Keeping track of game state for a digital card trading game I am building a card game.  Let's say it's similar to Magic the Gathering, Hearthstone, etc.

The problem I am trying to figure out is how to architect "auras" and how much damage each card takes.

Right now I have a deck and I store card data as follows.  I've made up names for the types of cards that will exist.

M.card = {}
-- Minion cards have health and damage
M.card[1].name = "Minion"
M.card[1].hp = 1
M.deck[1].dmg = 1

-- Super Minions have more health and damage
M.card[2].name = "Super Minion"
M.card[2].hp = 4
M.card[2].dmg = 4

-- Spell cards have no health and damage. Instead they affect the health and damage of other cards.
M.card[3].name = "Heal"
M.card[3].details = "This card heals any character for +2 health"
M.card[3].healthboost = 2

M.card[4].name = "Damage Boost"
M.card[4].details = "This card gives + 1 damage to any other card for 1 turn"
M.card[4].dmgboost = 1

-- Super damage boost gives more damage boost to other cards
M.card[5].name = "Super Damage Boost"
M.card[5].details = "This card gives +3 damage to any other card permanently"
M.card[5].dmgboost = 3

So when one card attacks another card, I need to keep track of the damage taken by both cards. I don't want to change the base stats of each card so I need to keep track of adjustments.

I could do something like this

-- Super Minion takes 3 damage
M.card[2].newHp = 1
-- or
M.card[2].adjHp = -3
-- Not sure which is better.

During the battle I need to keep track of which auras are played.   So for example if the Damage boost card is played.  I need to give another card +1 damage for just one turn.

Let's say that I am keep track of each turn number starting from 1.

Should I do something like this
    M.aura[1] = 4   -- ( aura 1 is card # 4)
    M.aura[1].target = 2   -- (this aura is applied to card 2)
    M.aura[1].expires = 5  -- (this aura expires on turn 5)

M.aura[2] = 3    ( second active aura is heal, card #3 )
M.aura[2].target = 2
M.aura[2].expires = 0   -- this is a one time aura.  So I need to apply it to card #2 and then immediately expire it so it never activates again.

Then on every new turn I loop through all the auras and make sure they are still active before a fight begins?

Just wondering architecturally what is the best way to keep track of Damage that characters have taken and spells that are active that are giving characters special abilities.

sentences:
FPS issue between computers results in slow down of animations and moving I have been developing my game on two computers. I recently got a new computer and have noticed an issue that seems to be happening in my game.

When computer 1 runs the game at 60 FPS everything seems to run fine, all the timings are correct and everything runs smoothly.

When computer 2 runs the game at 60 FPS everything seems to slow down, everything happens properly (all the timings are correct) but it's as if the update is not being called at 60 FPS. If I "unlock" the frame rate and let it go to >3000 fps then it runs fine, but not when it's at the expected 60 FPS. A frame counter in code seems to tell me the FPS is 59.

I'm not sure if this is relevant but I usually use something like this to perform updates between moving or animations, etc:

 public bool ShouldUpdate(GameTime gameTime)
 {
     if (this.Disable)
         return false;

     float dpf = this.DelayPerFrame; // example value: 60f
     float tpf = 1.0f / dpf;

     this.totalElapsedTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

     if (this.totalElapsedTime >= tpf)
     {
         this.totalElapsedTime = 0f;

         return true;
     }

     return false;
 }

What kind of things can be causing this? I'm more than happy to add any additional information.

I guess my question really comes down to, how do I ensure that all updates and timings happen the same across computers?

sentences:
I made a game in XNA - how can I share it with my friends? I've just finished programming a charming (albeit bare-bones) XNA version of arcade classic Tempest.
Hooray!
Given that this was a homework assignment, I'd like to be able to share it with my professor and my friends/classmates to solicit feedback.
(And let's be honest - if I have a question about how to add in an additional feature, it might be nice to be able to share it with folks on this site as well.)
Is there a better way of sharing an XNA game than by shuttling the visual studio - produced  executable around? Some way to host it on a website would be ideal.

sentences: Does XNA 4.0 for Windows Phone 7 require Visual Studio 2010? I have a copy of Visual Studio 2008 Pro. The Windows Phone Developments tools which include XNA 4 continuously fail to install on my machine. I am wondering if it was due to having 2008 vs 2010. Any ideas?

sentences:
Unity target position never stops with Vector3.SmoothDamp I've integrated Vector3.SmoothDamp method to have a more fluid and native movement between the character and his camera in Unity. The camera movement is perfectly in sync with the character because both uses SmoothDamp to move, but the character sometimes still looking for the final position in the x axes.

How can I fix the problem introduced by SmoothDamp without remove it?
The problem seems to be correlated to targetPosition.x which still changes but I'm not sure why because hrxMovement and velocity.x reaches 0:

float movementDuration = 0.3f;
float movementSpeed = 2.5f;

void Run () {
    float hrzMovement = Input.GetAxis("Horizontal");
    Vector2 velocity = new Vector2(Vector2.right.x * movementSpeed * hrzMovement, body.velocity.y);
    Vector3 targetPosition = new Vector3(body.transform.position.x + hrzMovement, body.transform.position.y, body.transform.position.z);

    body.transform.position = Vector3.SmoothDamp(body.transform.position, targetPosition, ref transformVelocity, movementDuration);

    print("hrzMovement: " + hrzMovement + ", velocity.x: " + velocity.x + ", targetPosition.x: " + targetPosition.x);

    if (velocity.x != 0) {
        animation.SetBool("isMoving", true);
        orientationMovement = velocity.x;
    } else {
        animation.SetBool("isMoving", false);
    }

    if (orientationMovement < 0) {
        body.transform.localScale = new Vector3(-1, 1, 1);
    } else {
        body.transform.localScale = new Vector3(1, 1, 1);
    }

}

Additional packages used:

I'm using Pixel Perfect Camera package, I hope this doesn't affect the code.

sentences:
How can I perform 2D side-scroller collision checks in a tile-based map? I am trying to create a game where you have a player that can move horizontally and jump. It's kind of like Mario but it isn't a side scroller. I'm using a 2D array to implement a tile map.

My problem is that I don't understand how to check for collisions using this implementation. After spending about two weeks thinking about it, I've got two possible solutions, but both of them have some problems.

Let's say that my map is defined by the following tiles:

0 = sky
1 = player
2 = ground

The data for the map itself might look like:

00000
10002
22022

For solution 1, I'd move the player (the 1) a complete tile and update the map directly. This make the collision easy because you can check if the player is touching the ground simply by looking at the tile directly below the player:

// x and y are the tile coordinates of the player. The tile origin is the upper-left.
if (grid[x][y+1] == 2){
   // The player is standing on top of a ground tile.
}

The problem with this approach is that the player moves in discrete tile steps, so the animation isn't smooth.

For solution 2, I thought about moving the player via pixel coordinates and not updating the tile map. This will make the animation much smoother because I have a smaller movement unit per frame. However, this means I can't really accurately store the player in the tile map because sometimes he would logically be between two tiles. But the bigger problem here is that I think the only way to check for collision is to use Java's intersection method, which means the player would need to be at least a single pixel "into" the ground to register collision, and that won't look good.

How can I solve this problem?

sentences:
How to create post-processing effects in Slick2D? As I get closer and closer to the end of the feature development for my game and the beginning of the graphical overhaul, I keep thinking of ideas for graphical effects that would make my game even better, but Slick2D is so limited in terms of graphical capabilities. The LWJGL layer is exposed, and thus, basic OpenGL functions, but I don't know anything about the various blending functions and other functions available to me.

A couple of the most basic things I need to be able to do are to be able to properly blend images and primitive shapes together, and to be able to create a proper lighting system. As of right now, I simply have a black and white "stencil" for my flashlight that I blend with a flat black layer that's drawn over everything and set its opacity so it sort of looks like a flashlight. However, I'd like it to look better and to be able to have other light sources in the scene.

Also, I'd really like to be able to have "glow" effects, such as electricity or fire that brighten up the scene and don't just look like flat pixels. Is it as simple as additively drawing these images/shapes to the scene? Or is there more to it?

I know Slick2D is horribly outdated and no longer supported and I never should have used it, but it's definitely the last time I'll be using it. I only went to it because Java has limited game libraries available and LibGDX was giving me a lot of trouble getting started.

I'd appreciate any articles and examples.

EDIT: As an example of the "glow" effect, here's a neat explosion effect created in Unity that I found on /r/gamedev. It would be great if I could get something like this in my game.

https://www.reddit.com/r/gamedev/comments/8wurqc/stylized_explosion_shader_breakdown/

sentences:
How to scale UV coordinates from a specific offset? I'm currently attempting to copy a small texture onto a larger texture, but I want to have control over how large and at what UV position the smaller texture is copied over.

I've made some progress on this and can scale and offset the texture, but the issue is that the scaling is not from the center of the offset.

Does anyone have any ideas on how to do this?

---EDIT---

As you can see above, the capsule is at the center of the outlined box. When I scale the coordinates, you can see the red splotches representing where I'm standing scale towards the center/capsule. Now, to do this, the offset is set to (0.5, 0.5).

If I move the outlined box to the upper left corner, the offset no longer scales from the circle. It scales from the upper left corner with an offset of (0, 0). To get it to scale from the center, I need an offset of (0.125, 0.125) which is counter intuitive. I'm handling the offset and scaling manually, but I'd ideally like to automate the process and calculate it all based on position.

Here's the code I'm working with:

float2 newUV = i.uv - float2(_XMod, _YMod);
newUV = newUV.xy * float2(_ScaleX, _ScaleY) + float2(0.5f, 0.5f);

sentences:
How do I use a JBox2D ContactListener to check if my character is standing on the ground? I want to know when my character is touching a wall or floor. I've had no luck searching for information on this. I saw a few things about ContactListeners and getContactList(), but I don't understand how to use them.

How can I do this?

sentences:
Handling lost graphics device XNA 4.0 in winforms I'm trying to put in a new feature into my level editor. Part of the feature is to bring up a form when a user places a new tile onto the map, but once the form is brought up the XNA embedded screen throws up a big red X.  I think this is due to the embedded screen losing focus to the form and then crashing.

This is where the form is initialized

 public Form1()
   {
    InitializeComponent();

    //Node Editor

    tileDisplay1.OnInitialize += new EventHandler(tileDisplay1_OnInitialize);
    tileDisplay1.OnDraw += new EventHandler(tileDisplay1_OnDraw);

    Microsoft.Xna.Framework.Input.Keys[] allKeys = (Microsoft.Xna.Framework.Input.Keys[])
     Enum.GetValues(typeof(Microsoft.Xna.Framework.Input.Keys));

    foreach (var key in allKeys)
    KeyboardInput.AddKey(key);

     KeyboardInput.KeyRelease += new KeyHandler(KeyboardInput_KeyRelease);
     MouseInput.MouseMove += new MouseMoveHandler(MouseInput_MouseMove);
     MouseInput.MouseDown += new MouseClickHandler(MouseInput_MouseDown);
     MouseInput.MouseUp += new MouseClickHandler(MouseInput_MouseUp);

     Application.Idle += delegate { tileDisplay1.Invalidate(); };

     saveFileDialog1.Filter = "Map File|*.map";

     Mouse.WindowHandle = tileDisplay1.Handle;

   }

This is where the draw event is fired off

void tileDisplay1_OnDraw(object sender, EventArgs e)
        {
            Logic();
            Render();

            KeyboardInput.Update();
            MouseInput.Update();

            foreach (var actor in Actor.Actors)
                actor.Update();
        }

This is where the form is being called

     private void Logic()
    {
               if (colIndex == 8 && AssociateBox.SelectedIndex == 0)
                {
                    currentCollisionLayer.SetCellIndex(collideCellX, collideCellY,form.spawnNumber.ToString());

                    if(form.spawnNumber == "12")
                    {
                       camdetails.ShowDialog();
                    }
                }
    }

sentences:
How to fix a crowbar mesh deformation problem I am having a problem exporting my model to Garry's Mod.
Every time i compile the model in crowbar it comes out deformed like this

when the model is really suppose to look like this

how do I fix this is there something wrong with the collision?
I am also ready to provide whatever files/information are needed to solve this problem.
I should also mention that the mesh has multiple objects from each sphere that are joined but not connected.
I went to the arqade for this at first but they said it was offtopic and that I should come here instead.

sentences:
How to move a cube withour rolling it? I am trying to move a cube with my keyboard on a plane surface. However, the cube always rolling instead of moving. How could I slide the cube on the plane?

What I have done:

I added a plane game object with a mesh colider
I added a 3D cube object with a box colider and rigidbody
I appended a ControllerScript to the cube

  ControllerScript

private const float Speed = 10;

private Rigidbody rb;

void Start()
{
    this.rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
    var x = Input.GetAxis("Horizontal");
    var z = Input.GetAxis("Vertical");

    this.rb.AddForce(Speed * x, 0, Speed * z);
}

It looks like the AddForce method upset the cube. I already tried to reduce the friction of the plane and the cube, but this only delays the problem.

How could I move the cube without rolling it? Whats the common way to do it?

sentences:
Random Direction Vector Relative To Current Direction I have a 2D vector where the x and y values are randomly generated using a range between -1 and 1 respectively. I use this as the direction to move an object in which works great.

var direction = Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f));

What I would like to do is after some period of time, randomly generate a new direction vector, but this time keep the same "relative" direction that it currently has. Probably within 45 degrees or so on either side of the current direction.

So I'd like to randomly generate a new direction vector within a range of 45 degrees on either side of it's current direction vector, and start moving in that new direction. Does that make sense?

I'm not quite sure how to go about this, but I'm sure this isn't too difficult if someone could help get me started. Thanks!

sentences:
What is deferred lighting? There is plenty of information on what deferred rendering is but there is a lack when it comes to deferred lighting and the information that there is there is not clear.

My question is simple, what is deferred lighting and what is its advantage and disadvantage.

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 can non-indie devs stop reinventing the wheel? It seems like the status quo in the games industry is to write most software in-house, maybe excluding the engine if you use one of the dozen or so big ones. Before working here I was mostly an open-source developer, so this mindset seems downright crazy to me. Is there any good way we can all stop building things like log viewers, network diagnostics, and patching systems?

sentences:
Determining If a Point is Within Bounds I've got two points which I need to create a bounding box with, and then check to see if points are within this bounding box. The end result is a marquee selection tool.

So, here is the code I started with:

    var v1 = Camera.main.ScreenToViewportPoint( screenPosition1 );
    var v2 = Camera.main.ScreenToViewportPoint( screenPosition2 );
    var min = Vector3.Min( v1, v2 );
    var max = Vector3.Max( v1, v2 );
    //min.z = camera.nearClipPlane;
    //max.z = camera.farClipPlane;

    var bounds = new Bounds();
    bounds.SetMinMax( min, max );
    return bounds;

So then when I run it, it seems to create the correct bounds:
Center (0.4,0.4,22.3), Extends (0.2,0.2,0.0)

And the point seems like it should be within:
(0.4,0.3,22.4)

Now, my initial thoughts were that the z-index was off. However, i've tried setting that a bunch of different ways, including setting the z index of the center to 22, and the extent to 25. Nothing works.

I'm checking to see if it's contained, with:

bool unitInsideSelection = viewportBounds.Contains(camera.WorldToViewportPoint( gameObject.transform.position ) );

Where viewportBounds is the return object of the function above.

Any Thoughts?

sentences:
What is the purpose of glEdgeFlagv? I know that what both glEdgeFlagv and glEdgeFlag do is toggle boundary edge status, but my question is why does the v version exist when the documentation specifies that the only difference is that glEdgeFlagv takes (quoting from documentation):

  a pointer to an array that contains a single Boolean element, which
  replaces the current edge flag value.

What's the point of having a special version that takes a pointer to an array of length one? I can't imagine its to let you toggle the pointed-to bool to change the value later because the documentation would have to mention that to avoid inadvertent frees. I don't know of any platform where a pointer is smaller than a bool. When would one use glEdgeFlagv instead of glEdgeFlag?

sentences:
Hardware Fragment Sorting? I'm writing a rendering engine in OpenGL.

I Want to do order independent transparency.

I had heard somewhere that some GPUs have support for actually sorting the fragments of all the objects in the scene based on depth and then drawing them.

I then realized that this feature is likely very important to many people.

Does OpenGL have a built-in fragment sorting algorithm, or access to this hardware?

sentences: UV Mapping in Autodesk Maya 2011 goes wrong I'm always struggling with UV mapping, I'm still a student though. When I am creating a UV map the texture on the object always seems to be very low resolution... does anybody know  a very good tutorial, or can somebody tell me what I am doing wrong? Thank you.

sentences:
How can I keep straight alpha during rendering particles? Rencently,I was trying to save textures of 3D particles so that I can reuse the in 2D rendering.Now I had some problem with alpha channel.Some artist told me I that my textures should have unpremultiplied alpha channel.When I try to get the rgb value back,I got strange result.Some area went lighter and even totally white.I mainly focus on additive and blend mode,that is:

ADDITIVE: srcAlpha  VS  1
BLEND:    srcAlpha  VS  1-srcAlpha

I tried a technique called premultiplied alpha.This technique just got you the right rgb value,its all you need on screen.As for alpha value,it worked well with BLEND mode,but not ADDITIVE mode.As you can see in parameters,BLEND mode always controlled its value within 1.While ADDITIVE mode cannot guarantee.
I want proper alpha,but it just got too big or too small consider to rgb.Now what can I do?Any help will be great thankful.
PS:If you don't understand what I am trying to do,there is a commercial software called "Particle Illusion".You can create various particles and then save the scene to texture,where you can choose to remove background of particles.
Now,I changed the title.For some software like maya or AE,what I want is called [straight alpha].

sentences:
Connecting varying tilemap layouts at possible connection points? I'm building an isometric 3D ARPG in Unity3D, and

I have a tilemap, for example a dungeon.
I have tiles marked where a door could be placed.
I select a random "could-be-a-door" tile from the tilemap.
I "receive" an any shaped room, which could be a prefab, or a generated one as well. This room got tiles marked for door placement as well.

Without editing anything:

how could I easily determine whether this room could be connected to the existing dungeon via the selected connection point? (and of course find the solution if it could be)

by (valid) connecting I mean: only their doors and walls can overlap, but nothing else. (and removing the duplicates, creating the door itself, etc)

(Of course rooms can differ from rectangles)

sentences:
When creating quick prototypes, is it better to use the language you are going to use in the end? I have been working with SFML(C++) and Flash(AS3) and usually creating prototypes for some ideas I have.

Is it better to use the language you are going to use in the end (C++ usually) or use something simple and quick (AS3, Python, etc) to get it working and then start from scratch when you start on the main product?

sentences:
How to draw only visible models of the game? Suppose I have an array of models, each having it’s own “position” in the world space (scale*translation matrix). And I have an orthogonal camera. How can I test if model is “visible”, i.e. is in the range of the camera? Like this:

        +--------------+
        |              |
xxxxxxxx|xxxxxxxxxxxxxx|xxxxxxxxx
        |              |
        +--------------+

I want to know whether x is in a frame or not. Thank you very much in advance, I know it should be a fairly simple (if not trivial) task :)

sentences:
Create ROI tools for analysis I want to create some ROI tools on my game for personal analysis.

Let's say that I have 3 different level of special powers with a recursive cost and certain bonus. So, I want to see when certain level will start have income.

1st example: 1000 coins for 10 uses. Bonus: +10% on farming speed. 2000 coins for 10 uses. Bonus: +20% on farming speed. Etc

In this example, I know exactly what the bonus will do. I have the price of the farming per unit and I can calculate the income per use for each power level. So, I can tweak the numbers using the ROI tool to make the effect better.

2nd example: 1000 coins for 3 power ups on a weapon. Bonus: +1 attack power, +5% chance to destroy the weapon. 2000 coins for 3 power ups on a weapon. Bonus: +2 attacking power, 10% chance to destroy the weapon.

3rd example: 1000 coins per use. Bonus: 30% heal, 5% chance to get injured. 2000 coins per use. Bonus: 50% heal, 10% chance to get injured.

As you can see, the first example is simple to calculate the income vs cost. However, the second and third example don't have an exact effect and both of them have a probability to either good or bad effect. How do you work on this type of ROI? How do you calculate the pros of each level?

sentences:
UE4 Repeat fail: how to feed text widget unique message on instances I am a noob who has spent many hours looking at similar questions and responses but still failing to get desired result. I am going to be thorough and specific - I'm very keen on walk-throughs with any helpful experts! Thanks in advance.
Backdrop
My level consists (ideally) of the following:

Trigger boxes
Spheres that have 2x-sided texture with media player texture (let's call these "movie globes")
Transparent actors with blinking borders and are clickable ("highlight_inspect")
(I made these with a tutorial on adding post-process stencil depth something or other in order to get a blinking appearance)
Text widget that appears to inform viewer of what they clicked. Variable across unique instances

In simple terms let's say I have 5 trigger boxes with 5 unique (360º video-captured) movies. You step into trigger, sphere appears around the actor and the media texture/movie begins playing on inside of that sphere (I successfully did this), at which point you can pan around and look. I initiate a delay function before the visibility for "highlight inspect" appears, so that the user may spontaneously first look at movie around them before seeing blinking highlights over certain people, things, etc captured/displayed in movie imagery.
Let's say the movie globes are depicting different forest types or different habitats, and the user is meant to learn about "xx oak tree" "yy pine species" "zz herb that provides x benefit" etc. The idea is to have a kind of interactive museum per se.
Some globes might only have one highlight, some might have 4 - the idea is that I can use the "highlight_inspectable" actor object as a click event across these instances but each one returns unique text upon a widget template (saves font/color/style etc)
As if to demonstrate my thick-headedness around this issue of actor objects and instances, I also currently have separate but locationally equivalent triggers for the globe and for the highlight object, mainly because I need different spheres to call different movies in their blueprint... in other words

I have an actor that has a component 'trigger capsule' that toggles visibility of a sphere
i have an actor that has a component 'trigger capsule' that toggles visibility of highlight_inspect mesh object..

I just need a simple way to do all this *sigh/shakes fist/bangs head on wall.
what I'm failing to learn
I've come across "casting" and "blueprint interfaces" and "event dispatchers" and more, and I'm still not grasping those and whether any apply here and how.
I kinda understand that I should be able to make the Text Element in the Widget "variable" and/or bind it to a variable.. but I can't smoothly achieve this.
Thank you for your help, I am posting some images below (in the screenshots the pink cylinder+light is the trigger, and the next screenshot is user's POV standing there after globe materializes and highlight is showing. the sketch up is for more illustration)
ps the second screenshot is actually in next comment
-SS

sentences:
How can I detect the player being crushed in a 2D platformer? I'm checking collision for a platformer character as shown in #1. The red dots are the pixels that are checked and the grey lines indicate the axes they pertain to. I like the results I get from checking collision this way (versus, say, bounding box). Everything works exactly as I'd like it except for one problem: crush detection.

In the following images, the light blue box represents the ground, the orange box is an object, and the arrows indicate direction of movement.

The simple solution to detecting when the player is crushed is to see if the collision points on opposite sides are both triggering. If they are, the player is being crushed. In #2, you can see a normal crush scenario. The player is grounded and the top collision points are intersecting with the falling object. This triggers a crush.

#3, 4, and 5 present problematic scenarios. In #3, the player is moving toward the object, which is moving up. A right-side collision point is hitting the object, causing a collision and stopping the player.

Now, if the object continues to move up and the player continues to move right (as shown in #4), the object clears the players right-side collision point and the player moves to the right. But now, having done so, the object is intersecting a top collision point causing an unwanted vertical crush.

A similar scenario is shown in #5. Two objects are far enough apart for the bottom collision points to clear, allowing the player to fall, but no to so far as to allow the side collision points to clear, causing an unwanted horizontal crush.

I've been racking my brain on a solution, but nothing I've come up with has worked particularly well, so I'm wondering if anyone out there has an idea or insight into how to solve these problems.

To clear up some confusion, the red collision points would be within the sprite and the grey lines were only used to denote the relevant axis for each collision point. For example, if the character's sprite was a simple green square, the collion points would look something like this:

sentences:
How can I control a game 2d car mechanic from acceleration & speed to just 1 value? So I have a car in a 2d game that runs on acceleration and speed, two values that have a max.
The acceleration is small, under the value of 1 and it rises by an incrementation.
The speed is large number like 100 and it rises by incrementing the current acceleration.
They are both incremented relative to the fps but that's not important.

What I am trying is to have a formula with having only one value (with a max) instead of two as I am trying to simplify the UI for the player.

Alternatively, I was thining of having a value (lets call it speed) that gets incremented by something, without a max, but is limited by, lets say road friction (like multipling it with 0.99). Such a thing would be felt lower when the car is slow but eventually the friction would act as a max/limit, the car oscilating to near max values.

I know too little of physics and car stuff to figure this out on my own so I am reaching out for help. Thanks!

sentences:
OpenGL tile map rendering with 1 quad for all tiles and 1 texture atlas I'm using lwjgl to experiment with 2D games.

I made some maps with Tiled (small 30x30 maps) and currently I draw them by loading the tileset image as one texture and extracting from it the texture coordinates for each tile (so a texture atlas).

Every tile is one quad model (vao + 3 vbos: indices, vertices, texCoords) and to render the map I bind the texture atlas, then for each tile I bind the vao and call glDrawElements to draw the model of the tile.

To improve this, I thought I could have one single little quad that represents one tile and move it around changing its texture. This way I'd only have 1 vao+vbos in memory. The problem is that I'm not sure how to handle changing the tex coords.

I could put in the texCoords vbo of this model, all the "regions" of the texture atlas, but then how do I tell the draw call to use some specific 4 coordinates in the long list of coords of the vbo? Maybe I could use the fragment shader in some way?

sentences:
Making A Sprite Rotate To A Specific Angle XNA 4.0 I have a game that the character spins when you press either of the triggers on the xbox remote. Here's the code.

if (gamepadState.IsButtonDown(Buttons.RightTrigger))
        RotationAngle += spinSpeed;

if (gamepadState.IsButtonDown(Buttons.LeftTrigger))
        RotationAngle -= spinSpeed;

what i want to happen is when neither of the triggers are being pressed he rotates back to a rotation angle of 0. I know How to make him go back to 0 when neither triggers are pulled but its too abrupt. How can i make the sprite actually rotate back to an angle of 0?

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:
How to avoid character to move when selected I've got a player Class which can walk to a certain point on the screen when left mouse is pressed:

if (mState.LeftButton == ButtonState.Released && oldMouseState.LeftButton == ButtonState.Pressed)
            {

                    if (mState.X > CurrentPosition.X)
                    {
                        CurrentDirection = Direction.Right;
                    }
                    else if (mState.X < CurrentPosition.X)
                    {
                        CurrentDirection = Direction.Left;
                    }

                    CurrentDestination = new Vector2(mState.X, mState.Y);
                    CurrentState = PlayerState.Moving;
                    reachedDestination = false;
            }

Now I have several Characters on screen. If I want to select one of them I also do a left click, which sets the character to selected.

    if (mState.LeftButton == ButtonState.Released && oldMSstate.LeftButton == ButtonState.Pressed)
            {
                if (player1.BoundingBox.Contains(new Point(mState.X, mState.Y)))
                {
                    if (!player1.Selected)
                    {
                        player1.Selected = true;
                        player2.Selected = false;
                    }
                }
if (player2.BoundingBox.Contains(new Point(mState.X, mState.Y)))
                {
                    if (!player2.Selected)
                    {
                        player2.Selected = true;
                        player1.Selected = false;
                    }
                }
}

The problem is that as soon as one of the characters is selected it also performs the moving animation. This is beacuse for the trigger is the same for both moving to destination and selecting.

Do you know any way to avoid this behaviour and still keep using the left click for both?

Thanks in advance!

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:
Billboard rendering without distortion? I use the standard approach to billboarding within Unity that is OK, but not ideal:

transform.LookAt(camera)

The problem is that this introduces distortion toward the edges of the viewport, especially as the field of view angle grows larger. This is unlike the perfect billboarding you'd see in eg. Doom when seeing an enemy from any angle and irrespective of where they are located in screen space.

Obviously, there are ways to blit an image directly to the viewport, centred around a single vertex, but I'm not hot on shaders.

Does anyone have any samples of this approach (GLSL if possible), or any suggestions as to why it isn't typically done this way (vs. the aforementioned quad transformation method)?

EDIT: I was confused, thanks Nathan for the heads up. Of course, Causing the quads to look at the camera does not cause them to be parallel to the view plane -- which is what I need.

sentences:
Update method from script doesn't called After experiments with Unity versions, I have reproduced Mandelbrot example from scratch and got C# script doesn't called. If I set breakpoint, it says it is not reacheable

I think I set up all links. As it seem from IDE hint, inheritance is correct.

Simultaneously, shader is working, i.e. image is displayed, but not updated by controller.

sentences:
What exactly does an installer do and why might I need one? this is probably the noob-question of the day:

So I've written this game.

Now there's the .exe file that does the work, a folder with my beautiful, beautiful assets and a bunch of .dll files and other stuff that I probably shouldn't touch. To run the game, I copy the whole lot to the desired computer, double-click the .exe file and start shooting some dudes. Yay!

But what exactly is the difference between that and using an installer? What else does an installer do besides copying files and looking more professional than a .zip-file? Is there generally a lot of patching/configuring involved when trying to make a game run on a different computer? I tested my game on all windows computers I could get my greedy fingers on and it works great.

sentences:
Rotating multiple points at once in 2D I currently have an editor that creates shapes out of (X, Y) coordinates and then triangulate that to make up a shape of those points.

What will I have to do to rotate all of those points simultaneously? Say I click the screen in my editor, it locates the point where I've clicked and if I move the mouse up or down from that point it calculates rotation on X and Y axis depending on new position relevant to first position, say I move up 10 on the Y axis it rotates that way and the same way for X. Or simply, somehow to enter rotation degree: 90, 180, 270, 360, for example.

I use VertexPositionColor at the moment.

What are the best algorithms or methods that I can look at to rotate multiple points in 2D at once?

Also:

Since this is an editor I do now want to rotate it on the Matrix, so if I want to rotate the whole shape 180 degree that's the new "position" of all the points, so that's the new rotation = 0 for example. Later on I probably will use World Matrix rotation for this, but not now.

sentences:
Are polygon normals really shadeable? Garry's Mod has a copy-protection trap that shows this error:

  Unable to shade polygon normals

It made me wonder if such a problem could ever actually exist.  Can polygon normals be shaded? Is a failure to do so detectable and reportable?

sentences:
Is there a way to earn money from non-mobile HTML5 game? I'm just a hobbyist, who has some ideas, that would not fit on a mobile screen. I have searched for some method, to make a bit of money from them, but I've found just for mobile-optimized games.

So the question is: is there any way to earn some money from these games, too?

sentences:
Game State / Screen Management What's the best way to handle game states / screens?  My problem is this:

PlayGameScreen adds a new InventoryGameScreen to the game during it's update.  This immediately adds InventoryGameScreen to the array of GameScreens.  That's throwing an exception when iterating over the array that the contents of the array have changed.

Should I have two more arrays, like screensToBeAdded and screensToBeRemoved and do all the processing for them at the end of the game loop after drawing all the other screens?

sentences:
Why is my collision resolution failing on the corners? I'm tearing my hair out trying to work out how to handle my collision resolution at the corners of the rectangles that I'm colliding with.

The code that I'm working with is:

class Player(object):
    def move(self):
        # Calculate velocity based on gravity, etc
        # ...

        # Check collisions
        for obj in self.controller.collidable():
            sides = self.get_intersect(obj)

            if sides & TOP:
                self.mover.vy = 0
                self.mover.y = obj.coord.y + obj.size.y
            elif sides & BOTTOM:
                self.mover.vy = 0
                self.mover.y = obj.coord.y - self.size.y
            elif sides & LEFT:
                self.mover.vx = 0
                self.mover.x = obj.coord.x - self.size.x
            elif sides & RIGHT:
                self.mover.vx = 0
                self.mover.x = obj.coord.x + obj.size.x

        self.coord.x = self.mover.x
        self.coord.y = self.mover.y
        self.velocity.x = self.mover.vx
        self.velocity.y = self.mover.vy

    def is_intersecting(self, other):
        return (
            (
                self.coord.x + self.size.x > other.coord.x
                and
                self.coord.x < other.coord.x + other.size.x
            )
            and
            (
                self.coord.y + self.size.y > other.coord.y
                and
                self.coord.y < other.coord.y + other.size.y
            )
        )

    def get_intersect(self, other):
        if not self.is_intersecting(other):
            return 0

        pos = 0

        # Are we overlapping the bottom edge?
        if self.coord.y < other.coord.y < (self.coord.y + self.size.y) > other.coord.y:
            pos |= BOTTOM
        # Are we overlapping the top edge?
        if self.coord.y < (other.coord.y + other.size.y) < (self.coord.y + self.size.y):
            pos |= TOP

        # Are we overlapping the left edge?
        if self.coord.x < other.coord.x < (self.coord.x + self.size.x):
            pos |= LEFT
        # Are we overlapping the right edge?
        if self.coord.x < (other.coord.x + other.size.x) < (self.coord.x + self.size.x):
            pos |= RIGHT

        if pos == 0:
            pos = INSIDE

        return pos

The problem I'm experiencing is during vertical movement. If you push into a wall and jump, as you reach the top corner, it will push you vertically. This is due to the sides & TOP being the first check. Moving the horizontal checks first fixes this when jumping up, but then falling onto a corner moves the player horizontally.

I've tried doing checking based on what the horizontal/vertical velocities are, but this falls apart, since the vertical velocity is always non-zero due to gravity (and is corrected by this check if standing on a platform). Any other answers I've found fail to take this into account.

sentences:
How can I scale a subset of my game view during rendering? I am developing a 2d game which has a lateral panel and a main panel with the scenario. I want to scale the main scenario to apply a zoom (only the main panel portion of the screen).

I think if I use SDL_SetRenderTarget I will be able to change textures and then zoom it, in runtime. I have to use only SDL2 library or some extension. I can't use openGL.

How can I accomplish this?

sentences:
How to move an object along a vector Let's say I got an object A and object B in a 2D game.
I create a vector leading from A to B. It's name is AB.

How can I make A move along the vector AB and reach B?

One way I was thinking of doing this, is calculate the angle between AB and the x axis, and then move the object every game-loop cycle in that angle, using trigonometry.

I would calculate that angle by making a new normalized vector (1,0) (the x axis), normalize AB, and then get the angle between them by getting their dot product and using arccos on it.

But is there an easier way to make an object follow the path of a vector?

EDIT:

In this question: Make objects follow a strict path (Xna), the way someone suggested to move an object along a vector, is like so:

position += direction * speed * elapsed;

Where:

position = current position of the object.
direction = a normalized vector pointing in the direction of the
destination.
speed = a scalar to decide how much to advance the object every
cycle of the game-loop. (Is this a 'scalar'? Am I using this word correctly?)
elapsed = what is this?

I get everything but elapsed. What is this? Is this necessary?

Anyhow, is this method a good method? Would you recommend it?

Thanks

sentences:
Rotate around moving object I'm using the function Transform.RotateAround in order to make my player rotate around objects in my game, it's the main feature.
The thing is, when I'm making my levels harder and make the objects (that the player rotates around) dynamic and add some movement on the X & Y axis, the rotation movement is inconsistent, obviously, since the function recalculates each frame a different pivot to rotate around, the player distance from the object changes and not staying static throughout the rotation cycles.
The question is, is there a way to get around this and make the player rotate around the object in a static, permanent distance from the object even though it's moving?
Maybe by predicting the movement of the object or somehow "diffusing" the effect of the object movement..?
Any comment would be helpful.
Thanks in advance!

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:
Collision detection for sloping tiles I've been looking into adding 'sloping' tiles into my platform game and my first attempt at collision detection with these tiles has produced some promising results (considering it's a first attempt), however, there is something that I just can't work out.

First, some background.

My tiles (on my dev device which is a Google Nexus 10 tablet) are 102 pixels wide by 100 pixels tall (this was done on purpose so they fit better to the screen).

So, my 'slope tile' looks something like this:

Not being a perfect square, the slope isn't quite 45 degrees but that shouldn't really matter I don't think.

Now, in order to find out the vertical 'centre' for collision purposes, I'm doing the following:

Find out where the sprite is in relation to the X Coordinate of the tile. (So, if the tile is at 100 and the sprite is at 110, then I am 10 in from the X of the tile.
I then multiply that by my slope (slope being height/width or 100/102 in my case)
I then divide by 2 to get the centre
Finally, I subtract that result from the height of the tile (to invert it)

This gives me the vertical center which I can compare with the centre of my sprite to check for collision.

So, my code looks like this:

VertTileCentre=Math.round(tileYCoord]+tile.quadHeight-((slope*(spriteX-tileX))/2));

Results

When I run this, although my sprite can slide up and down the slope it doesn't follow the (visible) path of my tile so I get something like this:

So when moving down the slope it moves in a jagged line and when trying to move up, it moves up the slope until it hits the next tile along, then gets stuck

Would appreciate if someone could point out why my sprite path is not following the slope correctly or anything else I may be doing incorrectly.

Edit 1 - results from further experimenting

I've noticed that the sprite when at the top-left of a slope tile sinks into the tile slightly, this is why the sprite was 'getting stuck' when moving up - because it was hitting solid blocks behind (which have their own collision detection)

Strangely, I've also noticed that if I remove the 'divide by 2' from my above calculations the path of the sprite is pretty much OK although the sprite itself still sinks into the tile slightly (But now throughout the whole slope) - therefore if I remove the solid blocks, it works OK.

So I have no idea why not dividing by 2 makes sense and also why my sprite is not correctly sitting on the slope!!

sentences:
In GM Studio, how do I prompt the player for a password? I could make strings in earlier Game maker versions, but it doesn't work in the Studio version when I try.  The code I used:

When Left Mouse Clicked on Password Bar:

var str;
str=get_string("Crack the code!","");
if str!="pswrd" && str!="PSWRD"
{
    check_answer=false;
    room_restart()
}
else
{
    check_answer=true;
    room_goto_next()
}

I want a box to pop up saying "Enter Password".  Then to enter the password, and if correct, go to a room, for example.  I am using physics in Gamemaker Studio 1.4.

sentences:
Most efficient way to remove a Rectangle ? Monogame/XNA I have a project in which I'm trying to remove the "collision box" (Rectangle class) of one of my enemy.
My game logic basically is:

foreach (Enemy e in Enemy.enemiesOnScreen) {
            if (e._isDead) {
                e._collisionBox = new Rectangle(0, 0, 0, 0);
            }
            else {
                e.Update(gameTime);
            }
        }

What I wrote works perfectly, but wouldn't that be subject to memory overflow (for a much higher number of instances) or bad optimization in a real game project ?

sentences:
How to render sprite array efficiently in j2me game? I am working on a landscape java game.

I have a sprite array like this;

Sprite stickArray[] = new Sprite[10];

and initializing it like this with visibility as false.

for (int j = 0; j < stickArray.length; j++) {

        if (stickArray[j] != null) {

            stickArray[j].setPosition(stickX, stickY);
            stickArray[j].setVisible(false);
        }
    }

Later I want to position it like one after another vertically on repeating a key.pressBool is false initially.

public void keyRepeatInGame(int keyCode) {
    int gameKey = getGameAction(keyCode);
    Graphics g = getGraphics();
    if (gameKey == FIRE || keyCode == KEY_NUM5) {
        pressBool = true;
    }
}

Later I have written code like this;
Initially one Sticksprite is there.above this sprite, I want to place each sticks on clalling keyrepeat()in space key.

for (int i = 0; i < stickArray.length; i++) {
            if (pressBool) {
                if (i == 0) {
                    stickArray[i].setPosition(stickSprite.getX(),
                            stickSprite.getY() - stickSprite.getHeight());
                    stickArray[i].setVisible(true);
                } else {
                    stickArray[i].setPosition(stickArray[i-1].getX(),
                            stickArray[i-1].getY() - stickArray[i].getHeight());
                    stickArray[i].setVisible(true);
                }
            }
        }

This code is working partially.Stick is getting added on the sprite,all at once.

How can I change the code to make the sticks repeatedly getting added on calling keyrepeat() only, and make it visible one by one properly?

sentences:
Issues with 2D raycasting lighting under limitations of HLSL 3.0 pixel shader I've been writing my own HLSL pixel shader for dynamic lighting using raycasting. Unfortunately, since I'm using this out of XNA, I can only use up to ps_3_0. As you can see, the limitations difference between 3 and 4 are drastic, especially in instruction slots and temp registers:

Specifically, I'm running out of instruction slots. This limitation is preventing me from having accurate rays. (As in the amount of pixels the ray's position increases by from the light source has to be a lot less than I want)

Here's what it looks like.
And here's the relevant part of the code:

//Cast rays (Point Light)
float4 CastRays(float2 texCoord: TEXCOORD0) : COLOR0
{
    float dir;
    float2 move;
    float2 rayPos;

    float2 pixelPos = float2(texCoord.x * width, texCoord.y * height);

    float dist = distance(pixelPos, lightPos);

    if (sqrt(dist) <= lightSize)
    {
        rayPos = lightPos;
        dir = atan2(lightPos.y - pixelPos.y, lightPos.x - pixelPos.x);
        move = float2(cos(dir), sin(dir)) * rayLength;
        for (int ii = 0; ii < clamp(dist / rayLength, 0, 7); ii++)
        {
            if (tex2D(s0, float2(rayPos.x / width, rayPos.y / height)).a > 0)
            {
                return black;
            }
            rayPos -= move;
        }
    }
    else
    return black;

    float light = 1 - clamp((float)abs(sqrt(dist)) / lightSize, 0.0, 1.0);
    return lightColor * light;
}

The limitation variable I've put in place is rayLength. The larger this number, the less accurate the rays are. I can give more specific examples of what this looks like if anybody wants.

I'm very new to the concept of raycasting, and fairly new to HLSL. Is there any way I can make this work under the limitations and/or increase the limits?

Thank you.

sentences:
Handling mouse input depending on selected unit and clicked tile I am making a turn-based tactical game (think something like X-Com) and I am currently trying to figure out how to handle mouse input in a clean way without a mess of if-statements.

I have a lot of variables that come into play and that changes what happens when you click a tile in the game.

For example: if the currently selected unit is a player controlled unit and the tile you click is within that units movement range, I want to queue up a move action. If the clicked tile contains another player character I want to select that one instead, but if it contains an enemy I want to select the enemy or attack it if the player is adjacent.

So basically what happens when you click depend on selectedUnit, clickedTile, clickedTile.getUnit().getType(), and if the selected units tile is a neighbour to the clicked tile.

Is there a cleaner way to handle this than a mess of if-statments? I am using Java and Libgdx if that matters, but I am guessing this is mostly a design question.

sentences:
Implementing ClearPath (crowd pathfinding) This is the academic article:

http://gamma.cs.unc.edu/CA/ClearPath.pdf

Here is the confusing part (marked in red):

The first part is the path in which the object will move.

The first part of the formula in the red frame defines the sets of all possible velocities for agent A that will result in collision with obstacle B in the future (a cone).

I don't understand why they XOR the subtraction of A from that formula? I don't understand what it means to do exclusive or a substructed set?I want to understand it better.

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: How to play a sound for a Game Jam Menu Template button in Unity I'm using the "Game Jam Menu Template" plugin from the asset store in a project of mine and I'm having a bit of a problem with it. See, I'd like it so that a particular button in the menu plays a sound before transitioning to the next scene. I've tried a number of ways to accomplish this so far, but none seem to be working. I initially tried attaching the AudioSource.Play method to the On Click () events for my button, but that didn't work. It seems that the StartOptions.StartButtonClicked method is interfering with the AudioSource's ability to play for some reason (that method is used to transition to the next scene in this plugin). So, I tried patching that function itself, by both running this.gameObject.GetComponent<AudioSource>.Play() at the beginning of it, as well as finding the object I wanted by tag and then attempting to play its AudioSource. However, both of these attempts at forcing the sound to play were unsuccessful as well and I'm kind of at a loss as to what to do now. Is there a way for a button that transitions to the next scene via StartOptions.StartButtonClicked to play an AudioSource before doing so in this "Game Jam Menu Template" plugin?

sentences:
Cocos2d+pybox2d vs Cocos2d-Iphone Myself and two colleagues are working on making our first indie game for PC and, we decided to use Cocos2D + PyBox2D.  We decided this based on what we've seen of Cocos2D-iPhone games, but I'm not sure if Cocos2D-iPhone is just a port of the Python version with a few more features, or if it's far more advanced than the Python version.

I just want to be sure that I'm on the right track. (We also want to port our game to Android and iPhone if it is successful on the PC.)

Note: For the maps we will use Tiled , which is compatible with Cocos2D (both iPhone and Python versions, I think.)

sentences:
How can I make my program get a username? I am making a program that I want to load music from library/music on any computer.
To do this I use Music.FromUri().
However, I need the username from the current computer in order for the filepath to work.

Is there any way to get the username and use it in the filepath?

sentences:
High-resolution VR with tethered smartphone display I have an Android SmartPhone with a fairly high resolution + USB-C port, a USB-C-to-USB-A cable, and a Google Cardboard headset.

Is it possible to develop a VR app running on a PC game engine (such as Unreal) but stream the output to the Cardboard headset by using the phone as a display? (rather than running the app entirely on the phone). For instance, if I wanted to render using a beefy NVIDIA GPU and stream the graphics over USB.

What are the options here? I'm aware of this guide, which seems reasonable: https://uploadvr.com/budget-vr-101-get-pc-vr-streaming-phone/

Is this a use case supported by any Game Engines like Unreal/Unity?

sentences: Creating a 2D skeleton animation system for use with Panda3D Hey. I want to be able to create a system for 2D skeletal animation in my game. I'm using panda3d as my game engine. I'd like to be able to make simple bone structures and skin them with my sprites. I would prefer to do this with straight code and algorithms, but if I have to use a 3D modeler or something, then I can try to (I didn't do a great job last time I tried using Blender... >.<)

sentences:
How would I successfully split a vector to increase game performance? Okay so I have a vector for all of the monsters that are spawned in my game. All of these monsters are in a single vector and are "active" according to what zone they are in relative to the player's zone.

If the player is in the same zone as the monster, then have the monster move around and commit actions such as attacking other monsters or the player.

This is all done on a very powerful computer: my main computer.

-BUT-

If I were to attempt using this game on my medium-end computers, the game runs on a steady 2 FPS(where on the main does 50+)

What I attempted is splitting the vector into an array of vectors
vector SpawnList to vector SpawnList[100] as a quick example

Now with this code the monsters are in separate vectors according to their zones(zone is the area that the monster is spawned in)

Note: I use Ogre3D for rendering and bulletPhysics for the physics, and I haven't figured out a way to split the monsters' rendering accordingly.

And with this new idea, my main computer even faces severe slowdowns.

I am wondering if maybe the vectors have been created wrong or it is not a good idea to have an array of vectors.

Is there a better way of having the monsters grouped together where the performance is almost maximum on any computer?

EDIT: I have Profiled my code and here are the updated results. I hope they are of help to this situation: http://pastebin.com/v0PFQf0X

sentences:
How to detect collision on specific part of the sprite node I have a spike and a ball is falling down, when the ball touches the top point of the spike, I want to make the ball invisible, and when it touches on the other part i.e on the sides I don't want to make it invisible.

I have two sprite nodes - Ball and spike.

How can I make the collision detect only on specific part i.e only on top of the spike in spritekit?

sentences: Deriving from base class but not calling base method I am very new to C#, XNA, and OOP. This is my question: I have an abstract class called Sprite. Sprite handles position and drawing from the sprite sheets, from its update and draw methods, for my other automated and user controlled classes. I have another class that I need to create that also uses a sprite sheet but not in the same way. The sprite sheet in this case shows the texture in 5 states, from whole to destroyed, and I am going to write the update method for it so that when a missile collides with the texture, then and only then does the next frame of the sprite sheet get drawn. Is there a way that I can have this class, called bunker, be a child of the sprite class but never call the update method from the parent? Or should I just make it a seperate class altogether? Thank you for bearing with my noobish question.

sentences:
Tile Map World Background I am making a 2D top-down game in Java using the Slick2D library. However, this question applies to all ways of making games of this nature.

My question is: How would I do a background for the world. Currently it looks like this:

Obviously, this isn't the best example, as the right side has an area that allows the player to walk into the 'background'. However, I am asking how this is done in other games, such as Pokemon.

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:
Frenet frame and application I have just been reviewing Frenet Frame math. It is an interesting geometrical issue.

I know that common applications are:

camera movement along a curve
tube and ribbons surface

Can someone suggest other interesting applications?

sentences:
Removing FMOD from a Unity WebGL project causes an error about not being able to copy fmod_register_static_plugins.cpp When I imported the FMOD plugin into a Unity WebGL project, then removed it afterwards, I wasn't able to build it due to errors about trying to copy an FMOD file: fmod_register_static_plugins.cpp
Restarting the editor, reimporting everything, deleting Library/Temp folders did not help. Neither did deleting the FMod folder.

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:
Implement Candy Crush like level graph I want to implement road-map like level graph where in you can see what level are you and your friends are on. Just like we see in Candy Crush Saga.For people who have not seen Candy Crush Saga, please see the image below for your reference.

I want to understand the technology I should be using here. libgdx is one option i keep hearing is best for Android gaming engine. But somehow I feel Unity for Android would provide more bang performance wise.

This is my first try at gaming, please help me understand my options.

sentences:
Howdo I load a GIF animation in pygame? How can I load a GIF animation in pygame? With a web search, I found a severely outdated library called GIFImage. I tried it to do it with 2 pictures but I'm getting stuck because I'm a beginner. I also found something about making animations with Sprites, but no tutorial...

How do I do this?

sentences:
Alternative for using game object/prefabs for level generator I just finished the Unity Tutorial for creating a simple 2D roguelike Mobile Game. Now I wanted to make my level bigger; finding or creating my own algorithm isn't the problem. My problem is that creating a game object or using a prefab for every single floor or wall tile is a bad idea. (Map 200x200 = 40000 objects). A comment under the tutorial said that and I'm incline to believe it. That much I can understand, but I can't find a alternative. What can I use besides object/prefabs?

Sidenote: I have decent programming skills, but am beginner with Unity.

The tutorial I followed: https://www.youtube.com/playlist?list=PLX2vGYjWbI0SKsNH5Rkpxvxr1dPE0Lw8F
I want to make the maps there bigger, but then everything goes slow motion.

sentences:
SceneKit flickering with Ambient and Omnidirectional lights I have a project where I have a sphere with a png texture that represents a planet (or a moon in the videos I'm attaching).

Wrapped around that sphere I have a hexasphere (implemented using the results of my question from last year: How to orient a hexagonal tile on a geodesic sphere (Goldberg polyhedron)?).

Almost everything works just fine however I've noticed that in some situations, the hexasphere flickers at some points.

From my experiments, it seems that the problem is the lighting I am using.

The hierarchy of nodes I have is as follows:

bodyContainer    OMNI
    planet         OMNI (sphere, radius:0.987 with image texture as it's only (diffuse) material)
    hexasphere   AMBIENT (hexasphere, radius: 1.0 as described in the linked question)

There are two light sources, both placed at the centre of the "sun" in my larger model.  OMNI is an Omnidirectional light source with default settings.  AMBIENT is an Ambient light source.

The reason that "body" uses OMNI is that I want the planet or moon to have a light and dark side which changes as the body orbits the sun.

The hexasphere that is co-located with the body by being a sibling of the body in the same container.  It needs to use the AMBIENT light source so that it is equally visible on the dark side of the planet or moon.

What I'm noticing, it that when I move the camera further away from the planet, the parts of the hexasphere closest to the camera seem to flicker, and I seem to be able to see through to some of the hexasphere's cells on the opposite of the sphere.

Here are some videos to show what I'm seeing.

This first shows the scene in it's full 'glory' with all nodes in play as described above:

https://youtu.be/o3hdpuLoSbQ

This next one shows the same hierarchy, however I've changed the planet body to use the AMBIENT light instead.  Note that there is no flicker, but also, I've lost the dark/light side of the planet.

https://youtu.be/O0Ca-MrYgJc

In this 3rd video, I've replaced the body texture with a simple translucent blue color, and reverted to using the OMNI light.  It looks great, but the flickering is back.

https://youtu.be/ftGWnaqoN5I

Finally, I've changed back to the AMBIENT light again, but kept the blue body texture.  Note that the flickering is gone again.

https://youtu.be/c6i5vjOEauw

I'm quite positive that this is something I can fix, but I don't understand yet how.  Is this simply a weakness in the lighting mechanisms in SceneKit?

Is there something special I should be doing to allow the outer hexasphere to render cleanly (i.e. without the flickering), with the ambient light, whilst having the inner sphere that is using an omni light?

UPDATE

I've found one solution that appears to work, however I'm not sure if this will result in a lower quality visual overall.  If I set the material property litPerPixel to NO, then the problem I've outlined goes away.  I'm just not sure that the presumed "lower quality" rendering might cause other problems elsewhere.

sentences:
How do I disable function when triggerExit2D? I want to add a system when the player moves to the door, the scene changed but if the player walks away from the door the function that I call disables it. so I put OnTriggerEnter2D and OnTriggerExit2D to make that. The issue is once the triggerExit the bool return false but not the function.
so this my script:
     private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            finish = true;

            if (finish)
                StartCoroutine(WaitForChangeScene());
        }
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            finish = false;
        }
    }

    public IEnumerator WaitForChangeScene()
    {
        yield return new WaitForSeconds(1);
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);

    }

sentences:
Draw trajectory arc predictor in game I found this tutorial on youtube and it works pretty well, but I want to add more to it.

How can I draw a smooth arc path in the game view (right now the path is only visible in the editor)?

Here is the code:

public class BallLauncher : MonoBehaviour
{

    public Rigidbody ball;
    public Transform target;

    public float h = 25;
    public float gravity = -18;

    public bool debugPath;

    void Start() {
        ball.useGravity = false;
    }

    void Update() {
        if (Input.GetKeyDown (KeyCode.Space)) {
            Launch ();
        }

        if (debugPath) {
            DrawPath ();
        }
    }

    void Launch() {
        Physics.gravity = Vector3.up * gravity;
        ball.useGravity = true;
        ball.velocity = CalculateLaunchData ().initialVelocity;
    }

    LaunchData CalculateLaunchData() {
        float displacementY = target.position.y - ball.position.y;
        Vector3 displacementXZ = new Vector3 (target.position.x - ball.position.x, 0, target.position.z - ball.position.z);
        float time = Mathf.Sqrt(-2*h/gravity) + Mathf.Sqrt(2*(displacementY - h)/gravity);
        Vector3 velocityY = Vector3.up * Mathf.Sqrt (-2 * gravity * h);
        Vector3 velocityXZ = displacementXZ / time;

        return new LaunchData(velocityXZ + velocityY * -Mathf.Sign(gravity), time);
    }

    void DrawPath() {
        LaunchData launchData = CalculateLaunchData ();
        Vector3 previousDrawPoint = ball.position;

        int resolution = 30;
        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 = ball.position + displacement;
            Debug.DrawLine (previousDrawPoint, drawPoint, Color.green);
            previousDrawPoint = drawPoint;
        }
    }

    struct LaunchData {
        public readonly Vector3 initialVelocity;
        public readonly float timeToTarget;

        public LaunchData (Vector3 initialVelocity, float timeToTarget)
        {
            this.initialVelocity = initialVelocity;
            this.timeToTarget = timeToTarget;
        }

    }
}

I found a way to Instantiate projectile along the path. Now I just need to know how to convert that line in debug mode to make it visible in game mode

sentences:
How to detect RayHit on part of model and not entire model I'm building a low poly role playing Hack and Slash game. When I click it renders a sprite & character moves to that location(with RayCast).

But in this case. I don't want the click to occur on side of the bridge. Clicks should only occur in green coloured part & not in the red part. How should I fix this problem?

sentences:
What does it mean to "strafe" the camera? I'm looking at a tutorial in which both the terms camera moving and "strafing" are used. I looked onto dictionary.com and found:

  strafe
  verb (used with object)
  1. to attack (ground troops or installations) by airplanes with
  machine-gun fire.
  2. Slang . to reprimand viciously. –noun
  3. a strafing attack.

WTF???

I'm not a native english speaker.

sentences: Lerp UI Color outside update method? I'm able to Lerp the color of a UI panel within the Update method. However I'd like to trigger behavior a single time when needed. If I put it in a method and call it it only changes for a brief time and doesn't fully complete. I could probably set a bool flag within the update method but that seems sloppy.

sentences:
Is there any option other than Component Based for game architecture? Having read a lot recently on Component Based systems (for games), i find it hard to go back to my earlier state of mind.

If static object hierarchies fail to model "objects with a dynamic set of properties" then:

Why are they even used for in the first place? (in game dev and software engineering in general).
Is there any other option other than going Component Based to realize a more dynamic and flexible object model ?

sentences:
How should the actual game interface with the menu system I'm using the Game State Management (GSM) concept in my prototype and I like it very much. One of the screen has a "Game" embeded in it, where all the "good stuff" happens. The menu launching the game works fine, but I'm not sure how I should allow the game to request a screen from the ScreenManager. I'm not talking about a menu screen, but about something contextual to the game.

For clarity's sake, let's say that when I click on a game element (a rendered model for example) I want a screen that asks me what color I want that model to be drawn next. Right now, my game knows that model is "targeted" with the mouse (I use a Ray picking approach).

I looked at the Role-Playing sample to see how they did this, but when their GameScreen handles the keys, to open the inventory for example, it's never contextual to what's actually happening in the GameScreen.

Ideas welcomed!

Edit: The game must also be able to get a feedback or something from the "contextual screen" to get the new model color, for example.

sentences:
What scaling system to use in Box2d? I'm worried about this Caution box from the Box2d manual:

  Box2D is tuned for MKS units. Keep the size of moving objects roughly between 0.1 and 10 meters. You'll need to use some scaling system when you render your environment and actors. The Box2D testbed does this by using an OpenGL viewport transform. DO NOT USE PIXELS.

I don't want to use OpenGL since I know nothing about it. I'm using SFML to render my game.

sentences: Maya LT extrude tool won't work properly, is it buggy? First several hours with Maya LT and already stuck and frustrated. Trying to extrude faces (let's say future legs) but the position of faces from which I am extruding won't stay on its place, it changes and the extrusion happens from a new place, even from there I try to adjust this position, but the edge loop around the selected faces won't move, I try to delete that edge loop, it won't delete it, (tried 'delete', 'ctrl + Delete', delete Edges/Vertex menu option, deleting by vertices, there are no doubles it just removes the selection when I press delete) I managed only when I deleted the faces around that edge loop, which is quite annoying. Maybe someone had a similar issue and knows the solution or I am doing something wrong here? Any advice is appreciated!

sentences:
Unity - OnTriggerEnter & OnTriggerExit strange behavior I am having a trouble with OnTriggerEnter with a lot of objects.

I have a NavMeshAgent moving randomly throught the scene, then I have a sphere collider inside a children to detect nearby objects. If the object has an allowed tag it adds to the objects_near List.

It starts working right, but when it is working a few secs it starts dropping the objects_near variable to a wrong value, sometimes to 0, then, a few minutes later it drops to 0 permanently.

Is it a Unity bug? Is it my fault because I am using a lot of resources?

https://imgur.com/toLIMew

    void OnTriggerEnter(Collider col)
    {
        string tagname = col.gameObject.tag;

        for (int i = 0; i < tags_allowed.Length; i++)
        {
            if (tags_allowed[i] == tagname)
            {
                objects_near.Add(col.gameObject);
            }
        }
    }

    void OnTriggerExit(Collider col)
    {
        string tagname = col.gameObject.tag;

        for (int i = 0; i < tags_allowed.Length; i++)
        {
            if (tags_allowed[i] == tagname)
            {
                objects_near.Remove(col.gameObject);
            }
        }
    }

sentences:
Changing coordinate system from Z-up to Y-up Blender's coordinate system is different from what I'm used to, in that Z points upwards instead of Y. What would be the simplest way of converting all the world data (so that all animations, texture coordinates, etc still work) so that Y points upwards?

Clarification:

Object positions are defined as matrices, so just switching translation/rotation/scale information in matrices is not a trivial task. (at least it does not seem like a trivial task to me)

sentences:
How do I correctly import an animation from blender into UE4? I have animated a conveyor belt in blender. When I import the animation to UE4, the conveyor belt does not move correctly. What am I doing wrong?
Here is a link to my blender file: Blender File

sentences:
How to produce assets effectively on large Flash game projects? I have been working on Flash games professionally for two years now and somehow, having our artists producing assets the right way is one of our biggest challenge.

More precisely, it is very hard to have them following any kind of structure and/or standards, nor taking into consideration performance. I would say also the most of our issues concerns UI and related animations.

Our current workflow is (on a Facebook hidden object game) :

Artists produce PSD and animate prototypes in Flash
Artists re-organize their FLA files to be a bit more "programmer friendly"
Programmers retouches assets until they have the right structure and export classes inside a SWC, from Flash
Programmers try to improve performances, sometimes degrading the quality of game graphics

Our main idea is to hire somebody dedicated to prepare assets for programmers but I am really looking forward to improving the pipeline.

I was wondering if you guys have tips of any kind to improve this workflow, whether it be team organization, training, tools or tips with Flash. Any explanation on your asset pipeline is well appreciated too.

EDIT :

Thanks for your replies. I do agree with you that tools and processes will never replace collaborative people. However, I feel like we got stuck into this "I am doing my own thing" mentality as the integration process caused a lot of friction. As part of our Scrum process, the team clearly acknowledge its own quirks and was looking at immediate solutions for the next project : better rules, better attitude, better understanding of each other.

My team have specialized artists (UI, character drawing, character animation), but no leading art director (we use existing licenses/brands), and programmers (both front and back end). That's why having a very versatile person in between (designer, integrator, technical artist or however you want to call it) is invaluable in my opinion - so, I am looking for innovative solutions.

Usually, the main specs/requirements for assets are :

Naming (of classes, textfields or various visual objects that will be used by the code, taking in account that visual needs can cause deep nesting of objects)
States (that we implemented with frame labels)
Alignement (always build from 0,0 - use round values)

So, while adopting "good practices" can sure help, there always is this little part of feature-specific requirements that has to be decided. Basically I was looking for a an efficient way to communicate these specs (even to non-technical people) and avoid the back and forth to verify assets are as expected (this is where my idea of intermediate validation format comes from).

I understand there is no clear answer and I created this post to get people feedback and good ideas (it's working so far :)

sentences:
understanding spatial hash function behaviour and Knuth for int64 I implemented open-indexing sparse 2D spatial HashMap, and I'm quite satisified with performance ( ~30-70 CPU cycles to get object at particular location for size ~16 Milion objects ).

However, I don't understand behaviour of hashFunction. Just by trial and error I found out that best performing for my case is slightly modified  Knuth's hash function:

return i * 2654435761 >> 8;
( original Knuth's hash function is return i * 2654435761 >> 16; )

with this hash function I get no more than 1-2 buckets maped to the same hash (when capacity is sufficient) ... the histogram looks like:

689780 without collision (buckets mapped to same hash)
358791 with 1 colision
5 with 3 collisions

but I have no idea why, and why it is performing better with >>8 than >>16), and if this behaviour is general or somehow specific for my settings

I also tried other hash functions which are used as pseudo random generators .. some are here:

inline ULONG hashFunc( ULONG i ) {
// see http://stackoverflow.com/questions/664014/what-integer-hash-function-are-good-that-accepts-an-integer-hash-key
//return  ( ( 2166136261UL ^ i ) * 16777619 );              // VERY BAD
//return  ( 2166136261UL ^ (i * 16777619) );                // VERY BAD
//return ((i >> 16)^i);                                     // NOT WORKING
//return ( i * 2654435761 >> 16 );                          // Knuth's multiplicative method // GOOD
return ( i * 2654435761 >> 8 );                             // GOOD, even better than Knuth for map size 2^16 ( 65536 fields )
//return ( i * 2654435761 >> 16 ) ^ i;                      // REASONABLY GOOD but worse than pure Knuth
//i = ((i >> 16) ^ i) * 0x45d9f3b; i = ((i >> 16) ^ i) * 0x45d9f3b; return  ((i >> 16) ^ i);                                        // REASONABLY GOOD but worse than pure Knuth
//i = ((i >> 16) ^ i) * 0x45d9f3b; return  ((i >> 16) ^ i); // LESS GOOD
//i = ((i >> 16) ^ i) * 0x3335b369; i = ((i >> 16) ^ i) * 0x3335b369; return  ((i >> 16) ^ i);                                        // LESS GOOD
};

all are performing worse than Knuth or modified Knuth. ( Just empirical observation, no idea why )

The questions:

Do you have experience that some other hash function performs better for such job ?
Do you understand the behaviour?
Do you know how to properly make analogy to Knuth 32bit for 64bit integer ( because if I understand it correctly, the 32bit golden ratio multiplicator is prime number, I'm not sure If it is easy to get multiplicator with such property for 64bit )

some details for explanation:

I have to say that I use the hash function somewhat differently than is common:

First I discretize double x,y to uint16 ix,iy
Then I compute bucket index as uint32 bucket = (iy<<16)+ix;
Then I compute the uint hash = hashFunc()&mask where mask = capacity -1 and capacity is power of 2 ( &mask is basically modulo capacity  ). I know that many people recommend use prime-number capacity for hashmap, but I find it tricky to find proper prime number during resize-ing, and also & is faster than modulo.

My hashmap is open-indexing, and it is able to realize if the object is in particular particular grid tile (ix,iy = bucket ) without actually dereferencing the object pointer, which I think gives it speed advantage.

each memory field of the hashmap stores not only pointer to the object TYPE* object but also the bucket index uint32 bucket to which the object belong and number of objects uint n with the same hash. The bucket index is used to check if object belong to particular (ix,iy) position or if it was mapped to that hash by chance (when there are collisions). I do not store hash since I think it is faster compute it on the fly than use more memory.

( you can see code here ( HashMap | HashMap2D | test_HashMap2D) If you are interested

sentences:
Debugging-Setting Consoles in Games Right now I have the graphical and input portions of a console for my game (command parsing hasn't been implemented yet). I was wondering how you would go about making changes to properties in game objects. For example, if I typed in the console:

skeletonMonster maxHP 20

That would change all of the existing in-game skeletons' max hit points to 20. After you parse this information what are some ways to change the value? How can I change the that member variable without directly accessing it (by making it public/global)?

I'd like to implement this so I don't have to change variables in the code and recompile every time while playtesting.

sentences:
Asymetric Perspectiv View I am building a addon component that will show synthesized 3D view of the world (kind of FLIR camera simulation). The problem I am facing is that currently I am using Symmetric Perspective View with an eye pointed always on the center of the screen. I can manipulate field of view in both vertical and horizontal dimension however what I cannot do is to move the eye point view from the center, so that I can see 15 degrees up and 30 down while my eyes are pointing at at the screen at point that is located at 1/3 from the top of the viewport. Below is the picture of what I want to achieve, assuming the eye point is on sea level looking straight ahead to the horizon.

I tried several techniques, I tried to enlarge my viewport proportionally and then increase FOVY and clip the viewport to have again 45 degree view, then I tried to manipulate the camera to look 15 degrees down, but none of the results are satisfactory, because the horizon of my 3d world view was never in range of 15 degrees up and 30 down and this is my requirement

I guess the correct way is to define the correct frustum. Please confirm this is the case and how to set it assuming that:
FOV=64
FOVY=45
ratio 1:5
near plane = 1
far = 500000000.0

sentences:
C# 2D Enemy Follow Y Axis Only While Rotating to Look At Player (Unity) I have a 2D game where the player can move up and down on the y axis, I need the enemy to rotate to look at my player (which I have working, but probably isn't the best method) while also moving up and down with the player.

I have both of those things working, but not fully, right now whenever I move up and down, the rotation happening seems to cause the enemy to move backwards more and more with each up and down movement.

I need it to remain stationary on the x and z axis's.

Also, if anyone knows how I could make it so the enemy always wants to be slightly above the player on the y axis, that'd be awesome. Meaning, instead of locking onto the player dead straight, maybe the enemy can be up slightly by perhaps 20%.

This is the code I'm working with:

public float moveSpeed = 3.0f;
public Transform target;

private Transform myTransform;

// Use this for initialization
void Start () {
  myTransform = transform;
}

// Update is called once per frame
void Update () {
  Quaternion rotation = Quaternion.LookRotation(
    target.transform.position - transform.position,
    transform.TransformDirection(Vector3.up));
  transform.rotation = new Quaternion(0, 0, rotation.z, rotation.w);

  if (target.transform.position.y < myTransform.position.y)  {

    myTransform.position -= myTransform.up * moveSpeed * Time.deltaTime;
  }
  else if (target.transform.position.y > myTransform.position.y) {

    myTransform.position += myTransform.up * moveSpeed * Time.deltaTime;
  }
}

sentences:
Texture artifacts depending on texture size I get some strange artifacting with textures depending on their size. I run OpenGL 3.3 with an GTX 580 so it should definitely support non power of two textures. I've narrowed down the problem specifically to the texture's size, I've tried checking if transparency had anything to do with it, color channels etc.

As you can see, the 512x512 and 300x300 textures look just fine but the 437x437 is all distorted. What could be the cause of this and how can it be fixed? I could of course just stick to power of two textures which seem to work fine but since this is an personal educational project I really want to understand what's going on.

sentences:
How to structure my projectile code I have a submarine model that I would like to shoot torpedoes.

I want these torpedoes' initial velocity to vary with the forward velocity of its shooting submarine (so they go faster if launched off a moving sub, slower if show from a stationary sub).

I have a few requirements I'm trying to achieve:

Torpedos despawn when they swim too far away. No need to keep them in memory if they're too far too see.
When a torpedo is updated, and collision detection is done, there should be a way to determine who shot the torpedo, so it can be determined who to award the kill.
Torpedos should outlive the lifecycle of its parent sub, in the case the sub is destroyed between the torpedo was shot, and the time the torpedo hits or veers too far away. (Who doesn't love double kill mechanics :D?)
I'm working in C++, so manual memory management is a concern.

I'm debating between two approaches:

Have subs be the owners of their torpedoes. This makes requirements 1 and 2 easy, but complicated 3.
Have the scene be the owners of torpedoes. This makes 3 easy, but complicates 1 and 2.

This seems like it would be a common problem. What's the preferred way to do this?

sentences:
Player fly's off of canvas when key pressed I am fairly new to game development. I am programming a basic JavaScript canvas game. Whenever I press a key my player goes flying off of the canvas. Here is the controller code

document.onkeydown = function(event){
    if(event.keyCode === 87){
        player.up = true;
    }
    else if(event.keyCode === 83){
        player.down = true;
    }
    else if(event.keyCode === 65){
        player.left = true;
    }
    else if(event.keyCode === 68){
        player.right = true;
    }
}

document.onkeyup = function(e){
    if(e.keyCode === 87){
        player.up = false;
    }
    else if(e.keyCode === 83){
        player.down = false;
    }
    else if(e.keyCode === 65){
        player.left = false;
    }
    else if(e.keyCode === 68){
        player.right = false;
    }
}

if(game.keys && game.keys[87]){
        player.speedY += -0.4;
        if(player.speedY > player.maxSpeed){
            player.speedY = player.maxSpeed;
        }
    }
    if(game.keys && game.keys[83]){
        player.speedY += 0.4;
        if(player.speedY > player.maxSpeed){
            player.speedY = player.maxSpeed;
        }
    }
    if(game.keys && game.keys[65]){
        player.speedX += -0.4;
        if(player.speedX > player.maxSpeed){
            player.speedX = player.maxSpeed;
        }
    }
    if(game.keys && game.keys[68]){
        player.speedX += 0.4;
        if(player.speedX > player.maxSpeed){
            player.speedX = player.maxSpeed;
        }
    }

The above is the controller code... What improvements should be made on the above code.

edit
I realize you may need to see the entity creation code

function square(width, height, color, x, y) {
  this.width = width;
  this.height = height;
  this.x = x;
  this.y = y;
  this.speedX = 0;
  this.speedY = 0;
  this.right = false;
  this.left = false;
  this.up = false;
  this.down = false;
  this.rend = function(){
    ctx = game.context;
    ctx.fillStyle = color;
    ctx.fillRect(this.x, this.y, this.width, this.height);
  }
  this.movement = function() {
    this.x += this.speedX;
    this.y += this.speedY;
  }
}

edit max speed integration.

  var now = Date.now();
  var delta = now - lastUpdate;
  lastUpdate = now;
  this.width = width;
  this.height = height;
  this.x = x;
  this.y = y;
  this.angle = 0;
  this.maxSpeed = 3;
  this.speedX = 0;
  this.speedY = 0;
  this.rend = function(){
    ctx = game.context;
    ctx.fillStyle = color;
    ctx.globalAlpha = 1;
    ctx.fillRect(this.x, this.y, this.width, this.height);
  }
  this.movement = function() {
    this.x += this.speedX;
    this.y += this.speedY;
}
}

editadded player making function.

sentences: Is using Sprites the most recommended way for doing 2d animations with Directx? I am working on a game engine of my own and I was using Vertex buffers to create triangles and then draw textures on them. Now I want to extend it so I can do simple 2d animations using "sprite sheets". I'm not sure how to accomplish this by using vertex buffers, since those are "hard coded" and I can't figure out an easy way to draw "portions" of the sprite sheet using them. I've been searching online and most tutorials use DirectX Sprite functions to do it so my question is, is it possible to achieve this by using vertex buffers or should I go and use sprites? The only thing that is stopping me from using sprites is the fact that some graphics stuff I have already relies on vertex buffers.

sentences:
LibGdx: How do I combine 2 GestureListener objects from 2 seperate classes into 1 GestureDetector I'm trying to make 2 separate classes, 1 a VirtualJoystick class and 1 a VirtualButton class. I want to implement a GestureListener class in each, it just seems like good code to do so, but when I go to my main program, how do I add both GestureListener classes?

Here's some pseudocode that I'm thinking of:

VirtualJoystick vjs = new VirtualJoystick(x, y, width, height, bgImage, fgImage);
VirtualButton vb    = new VirtualButton(x,  y,  width, height, upImage, dnImage);

GestureDetector joyGestureDetector = new GestureDetector( vjs.getDetector() );
GestureDetector btnGestureDetector = new GestureDetector(  vb.getDetector() );

// Here's what I don't know how to do
GestureDetector combinedGestureDetector = ?

Gdx.input.setInputProcessor(combinedGestureDetector);

but as you can see, I'm stuck on how to combine the two, if there's a better way let me know, I'm just trying to get my code to "think through well" and be atomically contained in classes.

sentences:
Why does my model render differently with different BasicEffect instances? I'd like to understand why I get a completely different result when I replace the effects of a model (as suggested by How To: Draw a Model with a Custom Effect) with a BasicEffect that I instantiate myself:

var basicEffect = new BasicEffect( game.GraphicsDevice );
basicEffect.EnableDefaultLighting();
foreach (var mesh in _modelHead.Meshes)
    foreach (var part in mesh.MeshParts)
        part.Effect = basicEffect;

My goal is of course to use an effect of my own later, but for the moment I'd really like to understand what's going on!? What is different with the predefined BasicEffect from the one I instantiate myself? When I inspect the properties of the two instances they seem to be all the same.

How it looks with the "default" BasicEffect
How it looks when I instantiate a new BasicEffect

sentences:
Generating mipmaps for volume texture Does texconv from DirectxTex support generating mipmaps for volume textures? If not what are the other alternatives?

I am asking because I have tried to create the mipmaps by using textconv.exe -m 3 my.dds, but it looks like this (I am viewing it in the DDS plugin for photoshop):

And now I wonder whether the DDS plugin is bugged that it displays only mipmap for first texture or the texconv doesn't support it?

EDIT: Acutally by taking a deeper look on this image, the mipmap is somehow blended from these 2 main textures. Why? (high resolution texture here)

sentences:
How to determine polygon, texture size, and frame time budgets for a game on a custom engine? I'm currently working on a mid-size group of students developing a classic dungeon crawler game using own engine. I have the task to create a document where it tells:

What polycount and texture size limits artists should have
How much time each module of the engine should take

I know that this data is not to be exact by any meanings, because priorities would change depending of the needs of the game. I could try to drop some art in a scene, and seeing how much the framerate is impacted. I can take the 16 miliseconds of a 60fps game and distribute them among all modules, trusting my gut.

The problem is that I do not feel as this method is the correct, and I do not found any references of how I could distribute miliseconds (even for a blurry guide to follow), or how I could do some estimation of what limits the art (and the design) should have, based on our tech.

How can I make these estimates?

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:
In Cocos2D, how do I check for collisions against an arbitrary user-drawn shape? I want to detect a collision between a sprite and a user-generated shape of some sort.

For example. There are 3 objects on the screen. The user takes their finger and draws an abnormal shape around 2 of the objects. I need to detect those 2 objects.

How do I approach this efficiently using Cocos2D?

sentences:
WP 8.1 XNA custom game loop (render when dirty?) I need to know whether it's possible to create a XNA game for Windows Phone 8.1 (which I've already) using monogame with a custom game loop.

OpenGL ES has this possibility (GL_RENDERMODE_WHENDIRTY or sth. like that).

Is there anything like that RenderMode for XNA/MonoGame on WP 8.1

Note: I'm new to Windows phone game programming.

sentences:
Pre-calculating skeletal animation data I'm working on skeletal animation and so far I've got the skeleton drawn with interpolated animation working (just on the cpu still). I was thinking about changing my file format for my skeleton and animations to have fully calculated matrices stored.

Right now I calculate my matrices recursively by multiplying the parent's world matrix(absolute matrix) by the childs joint matrix, same thing with each frame of animation. I think it would be a good idea to just export all of this pre-calculated to my model format so I could just send these matrices to the shader for skinning.

Is there any reason I should not do this?

Edit: Calculating the matrices is negligible by itself on a rather small skeleton anyway but is there any reason I should calculate them at run time or just pre-calculate in my file format?  I think this sums up my question better.

sentences:
Connecting tiles to make a large image based on text file If I am building my level from a text file

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

and I want to draw a large image, how do I go about doing that? do I take the image, separate it in tiles (the same size as the other ones) and then add a value to each image

0,1,2,3,4,5,6
0,7,8,9,10,11,12

or is there another way to do this?
Lets say I want to add a house, or a something like this ship?

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 I start a over a new game using a ui button logic code? My Hierarchy have 3 main GameObjects :

Game Data where all the gameplay objects are stored as childs of the Game Data GameObject.
Main Menu and all objects of the main menu stored as childs under the Main Menu GameObject.
Game Manager GameObject that have a script that control the game like pausing the game or go to the main menu.

By default the Game Data is disabled and all the gameplay objects childs disabled too. Then when starting the game with the main menu when clicking the button to start a new game I'm just activating the Game Data object :

This script is attached to the Main Menu :

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

public class MainMenu : MonoBehaviour
{
    public GameObject gameData;

    public void StartNewGame()
    {
        gameData.SetActive(true);
    }

    public void ResumeGame()
    {

    }

    public void QuitGame()
    {
        Application.Quit();
    }
}

This is working for first time starting a new game.

And this script is attached to the Game Manager GameObject :

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

public class GameController : MonoBehaviour
{
    public static bool gamepaused = false;

    public GameObject gameData;
    public GameObject mainMenu;

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.P))
        {
            gamepaused = !gamepaused;

            if (gamepaused)
            {
                Time.timeScale = 0f;
            }
            else
            {
                Time.timeScale = 1f;
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            gameData.SetActive(false);
            mainMenu.SetActive(true);

            Time.timeScale = 0f;
        }
    }
}

This script is working. When pressing the P button the game pause/continue.
When pressing the ESCAPE key the game also pause but also back to the main menu by switching the gameobjects disable/enable.

Now let's say I pressed the escape key while playing the game and I'm back to the main menu now I want to start a new complete game but clicking the StartNewGame ui button.

The problem is that this time I don't want to just active the Game Data like I did before :

gameData.SetActive(true);

This time at least in my logic I want to destroy the existing Game Data and instantiate a new Game Data using a prefab I already have of the Game Data.
This is my logic but I'm not sure how to do it. Or something like that.

The main goal is to be able to start over a new game each time clicking the StartNewGame ui button.

sentences:
Situational awareness in path finding Assume you had to find the shortest path through a dungeon, where certain passages are only opened to you after certain items were collected, like locked doors and keys, for instance.

The normal gut reaction to the words "shortest path" would obviously be A*. But A* would fail in such an environment, since I see many problems defining a reliable heuristic and, additionally, it is very likely, that a node has to be visited multiple times, which is also not possible in conventional A* and would also make the heuristic harder.

What I thought about is simply looking for a path from the start of the dungeon to the end, ignoring any blocked doors. After this path is found, for each of the doors blocking our way, an additional path looking for the appropriate key and back to the door would be sought and traversed before the door is even reached. The very same system would be used to handle a situation, where the path to a key needed to open a door is again blocked by another door, which needs to be opened first.

A big problem I see with my solution is that after all the paths including the ones for item acquisition are found, the total distance travelled by the agent might not be the smallest possible, since there might be other blocked doors that are farther from the goal but have their appropriate key much more easily available. A* would have neglected these doors on the first pass where blocked doors are simply ignored.

I'm sure I'm not the first one to try to solve this and I would appreciate some input on the problem.

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: Hammer BSP file size inefficiency I haven't posted here before but I came across a problem, when I save a map in Hammer as .bsp it ends up being over 10x bigger than all of the source files put together. I found the source for one map rp_downtown_v2.bsp, which the map is 2mb but when I used the source and compiled it in hammer its 40MB? Why would this be? Any further help will aid thanks!

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:
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:
Spaceship Shield Flare I'm trying to implement a system whereby a "shield flare" will be shown whenever a projectile impacts the shield. The shield itself is one like in Star Wars, where it's more like a skin around the spaceship, rather than a simple bubble.

The problem I'm having is determining how to draw a simple flare effect where the projectile impacted the shield. I can determine the Vector2 point where the shield was hit. Right now, I'm able to show the whole shield whenever it's hit just fine.

The problem as I see it, is that I somehow need to mask out the shield, except for a few pixels around the point of impact. Either that, or I'm going about this the completely wrong way.

What I can do so far is draw the whole shield:

What I need is to be able to draw a piece of the shield on the point of impact:

Any help would be appreciated.

sentences:
Why are clicks not corresponding correctly to XY positions? I'm trying to make custom buttons in LibGDX (I really only wanted to use it for the Android/Desktop portability, not for any of its features, like Scene2D)

The issue I'm having is that the clickable area and the texture don't have a 100% overlap. I can click some places in the texture that don't respond to my isClicked method, and there are places outside the texture that do. I just don't understand what's happening.

Here's my button  class.

public class btn
{
private Texture btnTexture;

private int x;
private int y;

private int width;
private int height;

public btn(String btnTexturePathSet, int xSet , int ySet)
{
    btnTexture = new Texture(btnTexturePathSet);
    x = xSet;
    y = ySet;
    width = btnTexture.getWidth();
    height = btnTexture.getHeight();

}

public void render(SpriteBatch sb)
{
    sb.begin();
    sb.draw(btnTexture, x, y);
    sb.end();
}

public boolean isClicked()
{
    if (Gdx.input.justTouched())
    {
        if (Gdx.input.getY() >= y && Gdx.input.getY() <= y + height && Gdx.input.getX() >= x && Gdx.input.getX() <= x + width)
        {
            return true;
        }

    }
    return false;
}
}

sentences:
Cannot use imported image with Unity's UI controls I know this question sounds banal but its a problem.

I received a project and opened it.

Now I try to edit it by adding my own images.

I do the import but the image does not show up when selecting images, for example, for a button:

What is the correct folder in this case?

sentences:
Choosing a correct collisionshape for a voxel engine I am building a voxel engine on Ogre with bullet as a physics engine.

I separated my blocks into chunks to help batch together render calls.

At the moment, each chunk's physics is handled by a btBvhTriangleMeshShape that is constructed through the vertices and indices.

Each time the user breaks a voxel, I modify the vertex and index array and construct a new btBvhTriangleMeshShape.

Unfortunately, because btBvhTriangleMeshShape has to recreate an optimizedBVH each time it is created, this becomes quite slow, taking several seconds each time the user breaks a block.

I've alternatively tried using a btConvexTriangleMeshShape, but the broadphase collision detection now becomes very low performance dropping the fps to single digits if the player is near the blocks.

What is the proper collisionshape to choose?

sentences:
libgdx - #iterator() cannot be used nested I'm getting this error when I try to check if any of the targets overlap each other:

iterTargets = targets.iterator();
while (iterTargets.hasNext()) {
    Target target = iterTargets.next();

    for (Target otherTarget:targets) {
        if (target.rectangle.overlaps(otherTarget.rectangle)) {
            // do something
        }
    }
}

So I can't do that? How am I supposed to check each member of an array to see if it overlaps any other member?

sentences:
Add and remove tiles? Or better to have them all loaded off screen? Which method do you expect would have better performance when stressed?  It's a 2D tile map where the camera has view of a small portion of the map.  As I pan up/down/left/right, should I be adding and removing tiles from the stage as needed? or have them loaded, offstage, and just change their x/y coords as needed?

I'm using AS3 to code this and I have it working fine.  And I know it's not wise to try to optimize early, but since I'm very new at this, I thought maybe someone already knows if one is usually better.

sentences:
Are there methods faster than Strings for sending a sprite's state over UDP? I'm programming a 2.5D networked game in Java. The networking works like this right now:

Create new networked sprite object at the client. Send it to the server. Server distributes and saves it. (TCP-ObjectStreams are used)
The Sprite's state is represented by a String that contains its id (Player's name+Index) and values. You can request the state with the method getState():

return getID()+"|x"+getX()+"y"+getY()+"#";
//Example: "Grimey2|x402y123#"

These states are collected multiple times a second by adding them to a single big String:

zState += spriteArray[x].getState();
//Example: "Grimey1|x752y133#Grimey2|x410y31#Grimey3|x202y13#"

All sprites' states are then saved in a HashMap at the client, sent to the server (Java DatagramSocket) and saved there too.

Is there a more performant way to handle sprite-updating than with Strings?

sentences:
Change AI steering behavior's direction to 8 directions I am making a 2d soccer game, all players move in 8 directions, so I need to convert AI steering behavior(like arrive and pursuit) into 8 directions.
Here are three example situations:

Player(now is at point A) set target To point B, we could not directly move in direction(B - A), player need to first move to point C in horizontal or vertical, then move in 45 degree to reach target point.
 Consider in my game there is no steering behavior accumulation, which means, at any time , only have one function to affect player movement(arrive or pursuit), so I first make convert code in arrive function, because pursuit actually call arrive either.
Here is pseudo-code:

void RSAIController::Init()
{
   ...
    m_vDirectionArray[0] = CCPoint(1.f, 0.f);
    m_vDirectionArray[1] = CCPoint(0.7071f, 0.7071f);
    m_vDirectionArray[2] = CCPoint(0.f, 1.f);
    m_vDirectionArray[3] = CCPoint(-0.7071f, 0.7071f);
    m_vDirectionArray[4] = CCPoint(-1.f, 0.f);
    m_vDirectionArray[5] = CCPoint(-0.7071f, -0.7071f);
    m_vDirectionArray[6] = CCPoint(0.f, -1.f);
    m_vDirectionArray[7] = CCPoint(0.7071f, -0.7071f);
}
//called in arrive method, then use m_vMoveDirection as speed direction
void RSAIController::ConvertTo8Directional()
{
    int idx = -1;
    float maxValue = -MaxFloat;
    CCPoint direction = m_vTarget - m_pPlayer->Pos();
    //do this because in cocos2d normalize zero vector will return (1, 0)
    //which is not the expected result,so I avoid it manually
    if(!VIsZero(direction))
        direction = direction.normalize();

    for(int i = 0; i < 8; ++i)
    {
        float dotValue = m_vDirectionArray[i].dot(direction);
        if(dotValue > maxValue)
        {
            maxValue = dotValue;
            idx = i;
        }
    }
    m_vMoveDirection = m_vDirectionArray[idx];
}

Then I am thinking 8-directional AI movement is pretty common in old nes game, like "Nintendo World Cup". Does anyone used to meet this problem or have any articles related to this?

UPDATE: I have update the code in @Json advice, but still got the errors I met before.
1.Actually player will change direction in 22.5 degree not 45 degree. I need player move on the diagonals when the degree is just reach 45.
2.When player move on the diagonals, the player will keep shaking. For example, in situation 1, when player start to move from C to B in first frame, player decide to move in perfect 45 degree, but player can not reach precise point C because "distance from A to C" has small error to "player speed(constant) * move time from A to C" , this will cause next frame player probably run in horizontal direction, again and again..
  Do I need to check when the last frame that arrive at C, then just make player at the precise point C manually to avoid this error, or there has any other trick to fix this?

sentences:
How do I move the camera sideways in Libgdx? I want to move the camera sideways (strafe). I had the following in mind, but it doesn't look like there are standard methods to achieve this in Libgdx.

If I want to move the camera sideways by x, I think I need to do the following:

Create a Matrix4 mat
Determine the orthogonal vector v between camera.direction and camera.up
Translate mat by v*x
Multiply camera.position by mat

Will this approach do what I think it does, and is it a good way to do it?
And how can I do this in libgdx? I get "stuck" at step 2, as I have not found any standard method in Libgdx to calculate an orthogonal vector.

EDIT: I think I can use camera.direction.crs(camera.up) to find v. I'll try this approach tonight and see if it works.

EDIT2: I got it working and didn't need the matrix after all:

Vector3 right = camera.direction.cpy().crs(camera.up).nor();
camera.position.add(right.mul(x));

sentences:
Problems exporting animations to Unity 5 I've finished a model in SpeedTree Cinema v7.1.1 and the model exports correctly, but I can't figure out how to export the wind animation to Unity 5. The only problem is that the wind animation itself doesn't export.

I think that the problems are one of the following:

The way I export the mesh (.FBX ascii).
The settings in the export process.

I'll add some images so you understand better.

(Image 1.) In here you can see the export settings, the important aspects, regarding the animation, are in the 'Extra Data' tab, in there I included Wind, there are other options which I will describe in the next paragraph.

(Image 2.) In the 'Include' section, in the 'Extra Data' tab I can choose from a variety of things, but I don't know which one will work for exporting the wind animation to Unity 5.

In the 'Extra Data' tab there is also a sections where it says 'Format', under Include, in the 'Format' section the options are FBX/MC, FBX/PC2 and MDD. In the 'Files' sector the options are One or Per Frame.

If you know or think you know how to do this, please tell me, any help will be appreciated.

Thank you.

sentences:
How to orbit an object at certain speed in Unity? I want to move an object around a circle. So I have this code below:

    static public int theta = 0;

void Update(){

    Vector3 position = this.transform.position;

    position.x = 0 + 50 * Mathf.Cos (theta) * Time.deltaTime;
    position.y = 0 + 50 * Mathf.Sin (theta) * Time.deltaTime;
    this.transform.position = position;
    theta += 1;
}

The object orbits, but it orbits so fast!!! I want the object to rotate like 1 orbit per second only.  How to do that?

ANSWER TO THIS PROBLEM, THANKS!

static public int theta = 0;

void Update(){

    Vector3 position = this.transform.position;

    position.x = 0 + 50 * Mathf.Cos (theta) * Time.deltaTime;
    position.y = 0 + 50 * Mathf.Sin (theta) * Time.deltaTime;
    this.transform.position = position;
    theta += 1 * Time.deltaTime;
}

sentences: How can I get rid of "missing DLL" problems? I made some games with Visual C++ 2015 and OpenGL. When I ran it on my machine there was no problem, but when I ran it on other machines it shows that some DLLs are missing. I want to know how to make sure that it won't happen next time and what things should I consider so that I can avoid file missing problems?

sentences:
Unity - Where are Asset Store assets downloaded on Mac? I'm on a Mac, running Unity 2021.1.5f1 Personal, and am trying to remove an asset I downloaded using Package Manager.
So for the asset in question, I want Unity to have to download the package again, from the Asset Store, to my local mac. That option is currently unavailable, because I have downloaded it in the past.
I've tried deleting the contents of these folders, to remove the downloaded file, but still no "download" option shows up next to the asset.

~/Library/Unity/Asset Store/Cache
~/Library/Unity/cache
MY_PROJECT/Library/PackageCache
I also tried clearing the cache in Preferences | Gi Cache
I looked in the docs for Asset Store cache, and the closest I found was this link

sentences:
Saving and retrieving high-score data in XNA 4.0 I made a game in XNA 4.0 and now I need to save the points in a database or in a file (or in something else). My goal is to store and retrieve the highest score if I choose that option in the main menu. What I found on the internet is not complete, or whatever, useless for me.

What techniques can I use with XNA to save and load data?

sentences:
How do I get a HingeJoint2D to be rigid instead of elastic? I made a chain of 40 segment using a HingeJoint2D. I followed the instructions directly off this Unity tutorial video

But when I start the game the chain bounces and stretches and then slowly over about 20 seconds it slowly pulls it self back up

How do I get the chain to actually be rigid instead of elastic?

If that's impossible, how do I get them to start in a rest state instead of starting with a bounce?

I uploaded the scene here if you want to play with it in Unity yourself.

sentences:
How can I kill a libGDX AsyncTask immediately? Is there any way of killing a running AsyncTask immediately in libGDX?

The AsyncExecutor that submits it seems to just have one method (dispose()) that kills all the AsyncTasks that it handles after they've all managed to complete their runs.

Currently, to achieve what I want, I use a volatile boolean in the task class, loop on its value in the call() method of the same class, and then set it to false whenever I want to interrupt that specific task immediately.

I wonder though whether there's another, more direct, way of achieving this. Is there any other class or method responsible for this?

sentences:
Unity calculate the size of a text box before text gets drawn so it can lerp to the next size Im trying to make a dialog box image that lerps to the next size.

In order to do that I need to calculate the size of the image before the text gets drawn.

My idea is to use the legacy GUI stuff like guiStyle.CalcSize to get the width and guiStyle.CalcHeight to get the height. then im setting the image's layout elements min values = to the GUI sizes.

the width is set to the longest string in the array of "lines"

the problem is that while the image does scale it doesn't do so correctly. perhaps my approach is wrong and there's an easier way?

private void Update()
{
    lineText = dialogueRunner.dialogText;
    drawnText = dialogueUI.lineText.text;

    //Debug.Log(prefferedValues);

    numberOfCharactersInLine = dialogueRunner.dialogText.Length;

    lineTextWithNewLine = NewLineAfterNChar(lineText, 18);

    string[] lines = lineTextWithNewLine.Split(new[] { "\n" }, StringSplitOptions.None);
    for (int i = 0; i < lines.Length; i++)
    {
        longest = lines.OrderByDescending(s => s.Length).First();

        prefferedValues = textMesh.GetPreferredValues(longest);

        Debug.Log(longest.Length);
    }

    //scale isnt correct
    layoutElement.minWidth = size.x;
    layoutElement.minHeight = size.y;

}

void OnGUI()
{
    guiContent = new GUIContent(longest);

    guiStyle = GUI.skin.box;
    guiStyle.alignment = TextAnchor.UpperLeft;
    guiStyle.wordWrap = true;

    //------
    boxSize = new Rect(Screen.width / 2, Screen.height / 1, txtBGRect.sizeDelta.x, txtBGRect.sizeDelta.y);
    boxSize.center = new Vector2(Screen.width / 2, Screen.height / 2);

    // // Compute how large the button needs to be.
    size.x = guiStyle.CalcSize(guiContent).x;
    width = size.x / 1;
    size.y = guiStyle.CalcHeight(guiContent, width);
    height = size.y;

    GUI.Box(boxSize, longest); //this draws the box

}

//Pass it a string and it will insert a line break after every n characters at end of words.

public static string NewLineAfterNChar(string inputText, int lineLength)
{
    string[] stringSplit = inputText.Split(' ');//Split string into array seperatly "word1" "word2" "word3" etc...
    int charCounter = 0;
    string finalString = "";

    for (int i = 0; i < stringSplit.Length; i++)// iterates per word count
    {
        finalString += stringSplit[i] + " ";// "word1 "  "word2 " "word3 "
        charCounter += stringSplit[i].Length;

        if (charCounter > lineLength)//after n characters
        {
            finalString += "\n";
            charCounter = 0;
        }

    }
    return finalString;
}

sentences:
How can i create sprite sheet from 3d model (3D studio max) I built simple 3D model of a car, with simple animation in which it's wheels are turning.

Now i want to create a sprite sheet, the only way i know how to do it, is to render manually 20 frames from the from, then combine them to a strip manually, then rotate it by 10 degrees, render 20 frames of animation again and combine them to a strip...

Is there a way to do it automatically ?
With out rotating the scene manually and render it and combining .. it's a lot of work, takes more time then the modelling itself...

Thanks

sentences:
Why does the player fall down when in between platforms? Tile based platformer I've been working on a 2D platformer and have gotten the collision working, except for one tiny problem. My games a tile based platformer and whenever the player is in between two tiles, he falls down.
Here is my code, it's fire off using an ENTER_FRAME event. It's only for collision from the bottom for now.

        var i:int;
        var j:int;
        var platform:Platform;
        var playerX:int = player.x/20;
        var playerY:int = player.y/20;
        var xLoopStart:int = (player.x - player.width)/20;
        var yLoopStart:int = (player.y  - player.height)/20;
        var xLoopEnd:int = (player.x + player.width)/20;
        var yLoopEnd:int = (player.y + player.height)/20;
        var vy:Number = player.vy/20;
        var hitDirection:String;
        for(i = yLoopStart; i <= yLoopEnd; i++)
        {
            for(j = xLoopStart; j <= xLoopStart; j++)
            {
                if(platforms[i*36 + j] != null && platforms[i*36 + j] != 0)
                {
                    platform = platforms[i*36 + j];
                    if(player.hitTestObject(platform) && i >= playerY)
                    {
                        hitDirection = "bottom";
                    }
                }
            }
        }

This isn't the final version, going to replace hitTest with something more reliable , but this is an interesting problem and I'd like to know whats happening. Is my code just slow? Would firing off the code with a TIMER event fix it? Any information would be great.

sentences:
Slick2D Tile Based 'Fog of War' Blurring Problem I'm working on my first Java Game and I have run into a little problem I'm hoping to get some help with.  I'm using Slick2D displaying a tile based map, and I'd like to know how I can created a "blurred" fog of war.

Here you can see the fog of war covering most of the map, I am rendering the fog by filling a rectangle over each tile who has the property isFog = true.

When the climber goes to a tile isFog sets false, and the map is re-rendered.

I'm looking for a way to create a smoother fog like in this poor paint.net image.

Please let me know what ideas you might have. Thanks!

Apparently I can not post images yet... I will update when I've earned enough reputation.

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:
Unity 5 Distributed Physics in Client Server Model I have a server which controls a physics object via buttons, adding force whenever I click them. I want to be able to have a client connect and whenever the physics object has a reaction on the server, the same reaction occurs on the client. But I don't want the client to do any physics calculations. I tried this out as seen below. When a button on the server is hit and the object moves, an RPC is sent to the client with the position, rotation and velocity of the server physics object and then applied to the object on the client.

[ClientRpc]
void RpcSendPhysicsInfo(Vector2 Pos, float Rot, Vector2 Velo)
{
    Debug.Log ("Received");
    moveableBarrel.GetComponent<Rigidbody2D> ().position = Pos;
    moveableBarrel.GetComponent<Rigidbody2D> ().rotation = Rot;
    moveableBarrel.GetComponent<Rigidbody2D> ().velocity = Velo;
}

void OnGUI()
{

    if (isServer)
    {

        if (GUI.Button (new Rect(0,Screen.height/3, 150, 30),"Move Barrel Right"))
        {
            moveableBarrel.GetComponent<Rigidbody2D>().AddForce(new Vector2(50, 0));
            //RpcSendPhysicsInfo(physics info)
            RpcSendPhysicsInfo(moveableBarrel.GetComponent<Rigidbody2D>().position, moveableBarrel.GetComponent<Rigidbody2D>().rotation,
                               moveableBarrel.GetComponent<Rigidbody2D>().velocity);
        }

With this code, whenever the server side button is hit nothing happens on the client side. But when it is hit again the client object moves to the position of the server object, but the speed the object is moving isn't the same as the server object. Obviously this didn't give the reaction that I wanted which was to have the client object copy the server object and in the long run make it seem as though the client carried out the physics when actually it was the server. Is there more data to send? Have I sent the wrong data? Have I went about it all wrong?

sentences:
How much assembly is really used in modern game code? On average, how often is assembly used in modern game code?

Specifically on platforms that already have good C++ compilers, like x86, PPC, or ARM--because I assume games on embedded systems make extensive use of assembly.

sentences: How to store the co-ordinates traced by a character in unity C# script? I have a navmesh agent with a trail-renderer component attached to it, who travels to a pre-determined destination based upon user input using unity's built in Navigation system. I want to store the (x,y,z) cordinated of the path traced by the character in some kind of data structure and then I want the camera to trace that exact path, but at some height above so the path(trail-renderer) is visible.

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:
How to reproduce this (parallax?) effect? I'm wondering how to imitate the camera movement like in the gif below. It´s from a Android game.

This game for example (via GIPHY)

Actually, I am not sure if this can be called a parallax effect, but it is the only word I can think of.

My code until now:

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

public class RotateAroundTarget : MonoBehaviour {

public Transform target;    // The object to follow
public Transform background;
public Transform foreground;
public float speedMod = 20.0f;  // Camera speed
public float topMargin = 0.2f;  // Top rotation margin

// The position of the target
private Vector3 point;
// Point if the camera is rotating to the left
private bool toLeft = false;

// Use this for initialization
void Start () {
    point = target.transform.position;
    transform.LookAt (point);
}

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

    // The camera is moving to the right until it reaches the top margin, then it changes it movement direction
    if (!toLeft) {
        transform.RotateAround (point, new Vector3 (0f, 1f, 0f), Time.deltaTime * speedMod);
        rotateBackground (1);
        rotateForeground (-1);
        Debug.Log ("Izquierda");
        if (transform.rotation.y >= topMargin) {
            toLeft = true;
        }
    } else {
        transform.RotateAround (point, new Vector3 (0f, -1f, 0f), Time.deltaTime * speedMod);
        rotateBackground (-1);
        rotateForeground (1);
            Debug.Log ("Derecha");
        if (transform.rotation.y <= -topMargin) {
            toLeft = false;
        }
    }
}

// Direction = 1 (left) | -1 (right)
public void rotateBackground(float direction){
    background.transform.Rotate (new Vector3(0, Time.deltaTime * (speedMod * 2) * direction, 0));
}

public void rotateForeground(float direction){
    foreground.transform.Rotate (new Vector3(0, Time.deltaTime * (speedMod / 2) * direction, 0));
}
}

But what I obtain in Unity Editor is this:
Result in Unity Editor (via GIPHY)

Any suggestion on how to get this?
Any help would be appreciated.

sentences:
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: WebGL stereo on Linux Is there any way for us to use frame-sequential stereo with WebGL without having to boot into Windows and use the DirectX hack?

sentences:
How to integrate the game editor with the engine? What I am trying to figure out is what is the best way to integrate the editor(level, effects, model, etc...) in the most effective way?

Now the first thing I thought would be to create the game engine(*) extremely modular. For example I took the example of game states. You could have multiple game states that all have their own update() and draw() methods among others. Each game state class would inherit from a base GameState class. This allows for a more modular approach and a useful one at that.

Now would the most efficient approach be to implement the editor along with the modular engine, or create two different designs for both the game, and editor? I thought to take the game state example and extend it to window states, and well could be used for a lot more systems. Is there a better implementation of this design(game state) for use in other systems used in the engine?

*: Now I know the term game engine is sorta irrelevant, and misused in many situations. What I am referring to as the "game engine" is the combination of the systems that the game must interact with for short.

Also this is more of a theory / design question than an implementation. Even though both mix, I'd rather like to have a more general idea on how the editor is built in an efficient way and still using the same engine code as what the game uses.

P.S If you need more clarification or extra bits just leave a comment.

sentences:
XNA VertexBuffer.SetData performance suggestions I have a 3d world in a grid layout where each grid cell contains its separate vertex and index buffer for the mesh/terrain of that cell.

When the player moves outside the boundaries of his cell, i dynamically load more cells in his walking direction based on his viewing distance. This triggers x number of vertex and indexbuffer initializations depending on how many cells that needs to be generated and causes the framerate to drop annoyingly during this time.

The generation of terrain data is handled in a separate thread and runs smoothly.
The vertex and index buffers are added during the update cycle of the game loop.

I´ve tried batching the number of cells to be processed to avoid sending too much data at once into the buffers, which worked ok at a shorter viewing distance (about 9 cells to process), but not as well at greater distances with around 30 cells to process.

Any idea how i can optimize this?

sentences: How to detect a sign-out from Google Play achievements or leader-boards UI? I am making an android game in Unity (C#), in which I've used the Google's official plugin for Google Play Services. My question is how to detect that a player has clicked on sign out button on Google's UI

sentences:
Libgdx: If Rectangle overlaps anything? I've written a code that allows me to talk with an NPC. This works as long as there is only 1 NPC on the map. I'll explain why.

public void getNPCCollision(){
    for (int i = players.size() - 1; i >= 0; i--) {
        Player player = players.get(i);
        for (int j = beings.size() - 1; j >= 0; j--) {
            Being being = beings.get(j);
            if(player.getBounds().overlaps(being.getBounds())) {
                setX(oldX);
                velocity.x = 0;
                setY(oldY);
                velocity.y = 0;
            }
            else if(player.getBounds().overlaps(being.getTalkingBounds())) {
                canTalk = true;
                talkAbleBeing = being;
            }
            else{
                talkAbleBeing = null;
                canTalk = false;
            }
        }
    }
}

I check every update if my Player walks into an NPC's Talking Rectangle. It goes by every NPC on the map. The thing is If I'm not on NPC 1's rectangle but on NPC 2's rectangle, It'll still set canTalk to False because I'm indeed not in his rectangle.

Is there any way I can fix this issue? Please, any help appreciated.

sentences:
Tiled game: how to correct load background image? i'm a newbie. I'm trying to develop a 2d game (top-down view).
I would like to load a standard background, a textured ground... My "world" is big, for example 3000px X 3000px.
I think it is not a good idea to load a 3000px x 3000px image and move it...
So, how is the best practice ?
To load a single small image (64x64) and repeat it for N times ?
If yes, ok, but how i can manage the "background" movement ?
Thanks
Bye!

sentences:
Calculating trajectory I'm just starting with game development and some physics related to that. Basically I want to calculate a trajectory given an initial velocity and as well as an elevation / angle. So I wrote this code in Java (I left out some class related code and such):

int v0 = 30; // m/s
int angle = 60;
double dt = 0.5; // s

double vx = v0 * Math.cos(Math.PI / 180 * angle);
double vy = v0 * Math.sin(Math.PI / 180 * angle);

double posx = 1; // m
double posy = 1;  // m
double time = 0; // s

while(posy > 0)
{
   posx +=  vx * dt;
   posy += vy * dt;
   time += dt;

   // change speed in y
   vy -= 9.82 * dt; // gravity
}

This seems to work fine. However, is there a better way to do this? Also, is it possible to scale so that 5 meter (in calculation) corresponds to 1 m for the posx and posy variables?

Thanks in advance!

sentences:
GML and C/C++ language question Is GML (Game Maker Language) script is clipped in C/C++ language, and GML wrote the code to Visual Studio C++, it will always be correct, because it is just under C++ language features?

I think that a bit wrong to have written that question could be to ask yet another generation of weeks. But if correct, is not need to ask again.

sentences:
What is the depth that a pixel shader may output? Is it necessary to write Depth? In DirectX11, what does the depth that a Pixel Shader can output mean? Does a pixel shader need to output a depth so that we "write" the depth? If not, why would we output it?

For any doubts, I'm talking about the depth described in the last paragraph of this page of the MSDN documentation:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb205146(v=vs.85).aspx#Pixel_Shader_Stage

sentences:
What is the correct approach to implement multiplayer in a game? I'm developing a game and it is intended to be a multiplayer game. I have experience in writing servers and clients in Java, but the game is written in C++.
The server will be written in Java for sure.

I have 3 questions:

Am I forced to write the client in C++ ?
If not, is there a way to write the client in Java as well, and somehow communicate with the game program?
The game includes characters moving. Is the correct approach to calculate the positions of every dynamic object on the server and for the clients to only receive the current positions of everything from the server? The only thing the clients would send is their input(click, spell casts etc.).

sentences:
How to identify a Tile without using its name attribute In the newly added Tilemap system, the TileBase and Tile have no tag attribute and it is then not possible to identify them by anything else than their name attribute which is not very practical. It is however said in the documentation of TileBase :

  Inherit from this to implement your custom tile to be placed in a Tilemap component.

I guess it can be used to create our own tile system but then I can't find a way to use this new class in the tilemap instead of the basic Tile class. How can I use this inheritance to create my own Tiles ?

sentences:
Gaussian blur not working correctly So pretty much I tried to add a gaussian blur to something I am making and it is acting oddly. The setup is like:

[All framebuffers are cleared to rgba(0,0,0,0), normal blend enabled]
Draw some solid black objects to Framebuffer 0
Apply horizontal gaussian pass from Framebuffer 0 to Framebuffer 1 (this works fine)
Apply vertical gaussian pass from Framebuffer 1 to backbuffer
[original black objects removed here, does not affect the process at all]

It seems like a standard gaussian layout, but the problem happens with the final view (presumably the vertical pass). It appears that the vertical gaussian pass dampened the previous horizontal one, making it a lot thinner (and making the box shadow effect I was going for look weird):

(note on the right image on one of the center rectangles for example, the top and bottom are blurred like they should but the sides aren't)

I just cant figure out why the vertical blur factor is at least 2x the horizontal one. I feel like this is because of something to due with alpha because the horizontal pass displays like it should until the second step happens. One final note, this still happens if I flip the horiz/vert order, it just happens on the other axis. I honestly can't figure this out so any help would be nice. Also for more info, heres the fragment shader I use (all the data passed to it is correct):

in vec2 ftexpos;

uniform sampler2D inputtex;
uniform vec2 vector;

float[15] gaussianraito = float[15](
    0.023089,
    0.034587,
    0.048689,
    0.064408,
    0.080066,
    0.093531,
    0.102673,
    0.105915,
    0.102673,
    0.093531,
    0.080066,
    0.064408,
    0.048689,
    0.034587,
    0.023089
);

void main() {
    vec4 sum = vec4(0.0);

    for (int i = -7; i < 7; i++) {
        sum += texture(inputtex, vec2(ftexpos.x + i * vector.x, ftexpos.y + i * vector.y)) * gaussianraito[i + 7];
    }

    gl_FragColor = sum;
}

sentences:
Movement nudge instead of constant I am making a small game where the player is constantly moving upwards, and I am having slight problems with the movement to the sides.
The script located under works quite perfectly in itself, but my problem is that I want the balloon-player to nudge in a direction, rather than go at a constant speed. Kinda like a small punch to the side of the balloon.

How could I easily implement this? GetMouseButton or GetMouseButtonDown?
Thanks in advance. :)

    void Update () {

    transform.Translate(Vector3.up * Time.deltaTime, Space.World);

    if(Input.GetMouseButton(0))
        transform.Translate(Vector3.left * Time.deltaTime, Space.World);

    if(Input.GetMouseButton(1))
        transform.Translate(Vector3.right * Time.deltaTime, Space.World);

}

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

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

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

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

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

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

sentences:
Monogame - SpriteFont Exception: Text contains characters that cannot be resolved by this SpriteFont I'm trying to put text on the screen and if I put anything but an empty string I get "Text contains characters that cannot be resolved by this SpriteFont.\nParameter name: text"

_spriteBatch.DrawString(screenText, "A", new Vector2(0, 200), Color.Black);

screenText is the name of my SpriteFont variable.

<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
  <Asset Type="Graphics:LocalizedFontDescription">

    <!--
    Modify this string to change the font that will be imported.
    -->
    <FontName>Arial</FontName>

    <!--
    Size is a float value, measured in points. Modify this value to change
    the size of the font.
    -->
    <Size>6</Size>

    <!--
    Spacing is a float value, measured in pixels. Modify this value to change
    the amount of spacing in between characters.
    -->
    <Spacing>0</Spacing>

    <!--
    UseKerning controls the layout of the font. If this value is true, kerning information
    will be used when placing characters.
    -->
    <UseKerning>true</UseKerning>

    <!--
    Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
    and "Bold, Italic", and are case sensitive.
    -->
    <Style>Regular</Style>

    <!--
    If you uncomment this line, the default character will be substituted if you draw
    or measure text that contains characters which were not included in the font.
    -->
    <!-- <DefaultCharacter>*</DefaultCharacter> -->

    <!--
    CharacterRegions control what letters are available in the font. Every
    character from Start to End will be built and made available for drawing. The
    default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
    character set. The characters are ordered according to the Unicode standard.
    See the documentation for more information.
    For localized fonts you can leave this empty as the character range will be picked up
    from the Resource Files.
    -->
    <CharacterRegions>
      <CharacterRegion>
        <Start>&#32;</Start>
        <End>&#32;</End>
      </CharacterRegion>
    </CharacterRegions>
    <!--
    ResourceFiles control the charaters which will be in the font. It does this
    by scanning the text in each of the resource files and adding those specific
    characters to the font.
    -->
    <ResourceFiles>
        <!-- <Resx>Strings.resx</Resx> -->
    </ResourceFiles>
  </Asset>
</XnaContent>

I did build and rebuild the spritefont file using the Content Builder.

sentences:
Toggle Button click doesn't count when the Mouse Up happens outside of the button area I have a problem with my toggle buttons. When a user performs the Mouse Up of the toggle button outside the button area, the click is not counted.

Mouse Down and Mouse Up on the button area works. Mouse Down on the button and Mouse Up outside, does not work..

Just to avoid confusion, the Mouse Down is when you click, the Mouse Up is when you lift the finger from the mouse button.

Do you have any idea how to solve this?

I'm using Unity.
Thanks for your help!

sentences:
Slow dictionary access with coordinates as keys I am making a game server and currently I am experiencing a huge performance hit.

I have a class Map which holds a Dictionary of the class Tile with each tile having X, Y, and Z coords, some lists, etc. nothing fancy as it's a MMORPG.

Currently in the Map class I have this:

public Tile GetTile(Coordinate_t coordinate)
{
    if (Tiles.ContainsKey(coordinate))
    {
        return Tiles[coordinate];
    }
    return null;
}

Coordinate_t is a struct containing X, Y and Z as UInt32. the Dictionary is represented like this:

 Dictionary<Coordinate_t, Tile> Tiles;

Basically I need to hold over 7 million tiles in this list, but it's being really slow! Every time I try to get around 12 tiles in a function it increases the program CPU use to 1~3% which is a lot! Since the game server is supposed to hold over 100 players online at a time.

Any ideas why is it being so slow? Are there better ways to hold a huge amount of tiles of a game in a list to be accessed continuously without having such a huge performance hit?

sentences:
How to mix effects together? Lets say I have got terrain effect, contains multitexturing, light. Now water effect. It must be different, but must be also affected by light. Other one, player effect, must also be affected by light, but doesn't share much stuff with others.

How all of these should be mixed together to create proper effect? Should I write multiple techniques in single effect file, or should I split it to as many as possibile and choose which are needed when rendering?

sentences: Combining Animations for Colllada export I need to export an animated character to the Collada file format in Blender. My .blend file has the individual animations (idle, walk cycle, attack, etc) each as separate actions. I discovered after creating it that the Blender Collada exporter cannot export multiple actions, so I need to merge them into one action which can be exported. I have tried the NLA editor, but the resulting NLA track which I create isn't exported at all. Is there any way to convert the track back to an action? Is there another, better way to achieve the result I want?

sentences:
Continous repeatable object/image moving horizontally unity3d I want to move objects on the screen horizontally. And the user has to pop the object by touching it. When user touch it, it gets destroyed and new object comes randomly.

For experimenting, I used Unity's Scroll Rect to move them. What can be the best solution for this.

sentences:
sfml/opengl, two objects of same class are sharing variables whenever I use the none-default constructor, it only adds to the coordinates of the previous class(in an array)

wall_1x1 wall[2] = {
    wall_1x1(0, -2, 0), //first argument is x, second z, and third ry
    wall_1x1(1, -2, 0)
};

the second object in the array will be behind the first object(by -2 z) and if I give the first object an ry of 90, all the other objects will have the same rotation.

#pragma once
#ifndef WALL_1X1_H

#include <GL\glew.h>
#include <SFML\Graphics.hpp>

class wall_1x1 {

public:
  wall_1x1();
  wall_1x1(float x, float z, float ry);
  ~wall_1x1();
  void up();

private:
  float m_x;
  float m_z;
  float m_ry;
  GLuint tex;
  sf::Image data;
};

#endif

and the .cpp class:

#include "wall_1x1.h"

GLfloat verts[] = {
  0, 0, 0,
  1, 0, 0,
  1, 1, 0,
  0, 1, 0
};

GLfloat coords[] = {
  0, 0,
  2, 0,
  2, 2,
  0, 2
};

wall_1x1::wall_1x1() {
  m_ry = 0;
  m_x = 0;
  m_z = 0;
}

wall_1x1::wall_1x1(float x, float z, float ry) {
  m_ry = 0;
  m_x = 0;
  m_z = 0;

  m_x = x;
  m_z = z;
  m_ry = ry;

  data.loadFromFile("wall1.png");

  glGenTextures(1, &tex);
  glBindTexture(GL_TEXTURE_2D, tex);
  glTexImage2D(
    GL_TEXTURE_2D,
    0,
    GL_RGBA,
    data.getSize().x,
    data.getSize().y,
    0,
    GL_RGBA,
    GL_UNSIGNED_BYTE,
    data.getPixelsPtr());
}

wall_1x1::~wall_1x1() {
}

void wall_1x1::up() {
  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  glVertexPointer(3, GL_FLOAT, 0, verts);
  glTexCoordPointer(2, GL_FLOAT, 0, coords);
  glBindTexture(GL_TEXTURE_2D, tex);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  glTranslatef(m_x, 0, m_z);
  glRotatef(m_ry, 0, 1, 0);
  glDrawArrays(GL_QUADS, 0, 4);
  glDisableClientState(GL_VERTEX_ARRAY);
  glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}

and the important parts in main:

wall_1x1 wall[2] = {
    wall_1x1(0, -2, 0),
    wall_1x1(1, -2, 0)
};
....

wall[0].up();
wall[1].up();

sentences:
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:
Does TCP slow down server and other clients for MMO game hi guys i made a server and client for mmorpg game of course very amateurish. i am using UDP to send coordinates if the packet is lost doesnt matter i am already sending 10 times in a second. UDP doesn't slow down server and server doesn't slow down other clients. But i also want to use TCP for ID PW and attack skill because when i use attack skill he needs to go absolutely to server. If i use TCP for them, Will client1 slow down Server ? or Will Server slow down other clients ?

i am using c++,opengl,SDL 1.2 and SDL_net 1.2

I will be grateful for your help :)

EDIT I ADD VIDEO :D : youtu.be/J7Ulh4vUBu0 when only udp server loop 658982 in a second like at the end of the video if i add tcp this valuse slow down ?

sentences:
Efficient Tile-based collision detection for a lot of squares? currently I am working on my own take of a tile-based game (think Terraria, but less fantastical (I think that's a word? Sorry if it isn't)).

Anyway, I currently have collision detection working (for corner cases even!) which was a big step for me. There is something extremely gratifying about seeing a sprite not run through a block. But then I had the idea to benchmark. Bad idea.

1,000 squares, no problem.
10,000 squares, for 3 characters was kind of laggy.
100,000 squares (really huge map), for 3 characters was unplayable.

I'm having the issue where I don't want to even consider the blocks that are too far from the player, characters, items, etc., but I don't want to load those in-out of memory constantly.

Here's my algorithm so far, feel free to criticize.

foreach (Block in level)
{
    if (distance from block to player > a specified amount)
        ignore this block;
    else
    {
        get the intersection depth between the two bounding boxes
        if (depth of intersection != Zero-vector)
        {
            check y size vs x size
            resolve on smallest axis
        }
    }
}

As you will note, when the level size get's bigger, the Order of this algorithm grows by N blocks. I would like to not even consider blocks that aren't even near the player.

I'm thinking maybe use a (0,0) to (mapWidth,mapHeight) double-array of blocks instead of a list, calculating a danger-zone depending on the person's position e.g., if player's position is at (10, 20) it will look from (0, 10) to (20, 30), or so on.

Any thoughts and considerations are awesome, thank you.

sentences:
How to unify vertices in 3ds max? I want two vertices of editable spline become one. Neither fuse, nor weld helps: vertices remain separate.

Here is a video: http://youtu.be/bp3OJPeKapc

sentences:
How important is a character's sexuality when it come to audience appeal I ask because I came across this comment about putting gay characters in games:

The necessity of exposing the larger playerbase to the homosexual tendencies of two of its cast mates is never really expounded upon by ScreenRant. That’s not to mention that only a tiny percentage of people even identify as on the LGBTQ spectrum, even according to Gallup, which puts the national average at 4.5%. So why exactly would Blizzard force the majority of their straight players to have to engage with the homosexual tendencies of two of its non-straight characters?
(Source)

And here:

So what better way to get back at the core gamers who dropped one-liners and zingers that have become memes of legend, than to strip away from gamers the last remaining normal character in Overwatch?
Most people figured Soldier 76 would be safe. He’s a patriotic military man, a hard-fighting soldier with undying loyalty, and a code of honor. He’s the perfect representation for what the majority of gamers like to see out of a hero. And besides, you need at least one normal sized, healthy, properly muscled straight, white male with all of his limbs intact to cater to the majority of your playerbase. Right? … RIGHT?!
The average male gamer typically gravitates toward a game where there’s a character who looks like he can kick butt and take names, and Soldier 76 was that guy.

....

The last bastion for masculinity in a game that’s constantly bleeding testosterone faster than the Overwatch League bleeds viewership,
(Source)

It's obvious that this guy thought that 76 was straight before this. So his outrage that his face character was revealed to be gay when there was no evidence to say otherwise beforehand is pretty sad.
Beyond this there is a point he makes that is interesting. Is a characters sexuality really that important? Yes most gamers are straight, but does that automatically mean that every game character needs to be straight? Or is this an appeal to the majority fallacy?

sentences:
OpenGL ES 2.0 basic camera issues I am having issues with the camera, I cant find how to invert the AXIS

Now

A point is 0,0,0
B point is 1,0,0
C point is 0,0,1

What I want is

A point    0,0,0
B point    0,0,1
C point    1,0,0

I cant find the way to do this, so if you can explain also why is this happening it will be great! (if you need more code ask for it)

Code:

final float eyeX = 2.0f;
    final float eyeY = 10f;
    final float eyeZ = 6.0f;

    final float lookX = 1.0f;
    final float lookY = 0.0f;
    final float lookZ = 6.0f;

    final float upX = 1.0f;
    final float upY = 0.0f;
    final float upZ = 0.0f;

    Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);

ViewPort

    GLES20.glViewport(0, 0, width, height);

    final float ratio = (float) width / height;
    final float left = -ratio;
    final float right = ratio;
    final float bottom = -1.0f;
    final float top = 1.0f;
    final float near = 1.0f;
    final float far = 25.0f;
    Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);

sentences:
Will the same Flash game business model work for HTML5 games? One of the best ways to earn money with Flash games is by making sponsorship deals. The developer puts the sponsor's logo and a link to their site in the game and lets the game spread around the web. The sponsor gains money from the ads and the extra traffic to their website. Alternatively, they site-lock their game to their website (usually for a short period of time) so that people who want to play the game go to their website. It's true that one can remove the site-lock with some effort by decompiling the swf, but it's usually not done as it's not worth the effort and not legitimate. Another significant part of the Flash business model is to put advertisements in-game. There are other ways of earning money with Flash games, but from what I know, these two are the most prevalent ones.

Since HTML5 is necessarily open source, it makes me wonder if this model would still work for HTML5. Even if you obfuscate your js, it's much easier than Flash to copy the game, so maybe it's worth the effort for someone to copy the game to their (illegitimate) site. If you add your sponsor's logo and link or advertisements, it might be worth the effort to remove them for their site, something that I think is much harder to do with Flash games. Perhaps even the illegitimate site could claim that their site is better because there are no in-game ads. There's still the legitimacy barrier, but I wonder if it's strong enough.

Let's put aside all game development technical restrictions regarding HTML5 for this question (suppose for a moment that HTML5 works just as well as Flash for games). I have two very similar (pair of) questions. The first is, would the Flash business model work with HTML5? What changes to it would be helpful for HTML5 games? The second question is, what about the big picture for HTML5 games? Is adapting the Flash model really the best solution, or is there a better model for the HTML5 games world to "turn"?

sentences:
pathFinding performance in Unity3d I am making Sniper game in unity 3d. In this game zombies will come randomly towards the sniper and sniper have to kill them. I am using RAIN(indie) for path finding. It works best when zombies are few . As I increase the Zombies( that is 10) the performance decrease a lot. The fbs drops to 25.

I want to know is there any technique or steps so I can improve fps
Any other technique/algorithm that I can use for pathfinding weith good fps.

PS

I already remove Sensor component from AI.
FPS of game without AI is 61

sentences:
Is there anyway to disable the script "gameplay" from running once you start the simulation? Was following the tutorial in this video https://oxmond.com/how-to-make-multiple-copies-of-a-gameobject/ on how to duplicate object.
I want to modify my code I learned from this tutorial https://www.youtube.com/watch?v=OR0e-1UBEOU&t=4178s so that the bird will increase its size proportion to the distance travel and when scale>certain value, it break into 2 identical bird object that possess the same properties as the first one. I already did the part size increase in proportion to the distance travel. Now I create an empty game object and attach the script "explode" together with prefab of the bird object to it but how to write the proper code to carry out the function if the main bird object is destroyed then it run the code "explode" to duplicate bird?
   using UnityEngine;
   using UnityEngine.Assertions.Must;
   using UnityEngine.SceneManagement;

   public class Bird : MonoBehaviour

{Vector3 OldPosition;
Vector3 DistanceDifference;
float TotalDistance = 0;
Vector3 _initialPosition;
private bool _birdWasLaunched;
[SerializeField] private float _launchPower = 500;

void start()
{
    OldPosition = transform.position;

}

private void Awake()
{
    _initialPosition = transform.position;

}

    void Update()
    {

    if (_birdWasLaunched &&
             GetComponent<Rigidbody2D>().velocity.magnitude > 0.1)
    {
        DistanceDifference = transform.position - OldPosition;
        TotalDistance += DistanceDifference.magnitude;
        OldPosition = transform.position;
        transform.localScale = new Vector3(0.2f * Mathf.Abs((TotalDistance * 0.2f)), 0.2f *Mathf.Abs(TotalDistance * 0.2f) , TotalDistance*0.5f);

    }

    if (transform.position.y > 20.00 ||
        transform.position.y < -20.00 || transform.position.x > 23 || transform.position.x < -23)
    {
        string currentSceneName = SceneManager.GetActiveScene().name;
        SceneManager.LoadScene(currentSceneName);

    }
    }

void OnMouseDown()
{
    GetComponent<SpriteRenderer>().color = Color.red;

}

private void OnMouseUp()
{
    GetComponent<SpriteRenderer>().color = Color.white;
    Vector2 directionToInitialPosition = _initialPosition - transform.position;
    GetComponent<Rigidbody2D>().AddForce(directionToInitialPosition * _launchPower);
    GetComponent<Rigidbody2D>().gravityScale = 1;
    _birdWasLaunched = true;

}

private void OnMouseDrag()
{
    Vector3 newPosition =    Camera.main.ScreenToWorldPoint(Input.mousePosition);
    transform.position = new Vector3(newPosition.x, newPosition.y);

This the 2nd script to duplicate the bird but i'm not sure what the correct codes I have to put in if the 1st game object destroy, then it duplicate 2 bird?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Explode : MonoBehaviour
{
 public GameObject Bird;

// Update is called once per frame
void Update()
{
    (if Destroy(Bird))
    GameObject BirdClone = Instantiate(Bird);
}
}

sentences:
AABB Collision Problems in SFML I have a problem with AABB collision.

I am making a top down rougelike in SFML and my collision algorithm does't quite work properly.

HERE IS A GIF OF THE PROBLEM.

It mostly works, except for when you're against the corner of the block and hold the direction towards the block for a second. For some reason, after about a second, the player is clipped through the block to the adjacent side.

I think the problem is caused when, for example, the x axis needs to be resolved as the player is approaching the object from the left, but the y penetration ends up being more than the x and thus the collision is resolved incorrectly.

This is my collision code:

sf::FloatRect collisionRect;
std::vector<Entity*> activeEntities;
for each (Entity* e in entities)
    if (e->otype == Dynamic)
        activeEntities.push_back(e);
for each (Entity* dynamicEntity in activeEntities)
{
    for each (Entity* target in entities)
    {
        if (dynamicEntity->sprite.getGlobalBounds().intersects(target->sprite.getGlobalBounds(), collisionRect) && dynamicEntity != target)
        {
            dynamicEntity->velocity = sf::Vector2f(0, 0);
            if (collisionRect.width > collisionRect.height)
            {
                if (collisionRect.contains(collisionRect.left, dynamicEntity->sprite.getPosition().y))
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x, dynamicEntity->sprite.getPosition().y + collisionRect.height);
                else
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x, dynamicEntity->sprite.getPosition().y - collisionRect.height);
            }
            else if (collisionRect.height > collisionRect.width)
            {
                if (collisionRect.contains(dynamicEntity->sprite.getPosition().x + dynamicEntity->sprite.getGlobalBounds().width - 1.f, collisionRect.top + 1.f ))
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x - collisionRect.width, dynamicEntity->sprite.getPosition().y);
                else
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x + collisionRect.width, dynamicEntity->sprite.getPosition().y);
            }
        }
    }
}

EDIT: I have tried making only one call to getPosition() getSprite() etc., and that only makes it glitchier.

EDIT2: I made a gfy of the problem. Sorry for the low res.

sentences:
How to get the tangent and normal of a collision? In my game, one of my objects casts a ray into a 2d space. If that ray were to hit another object, I'd like to draw a line that is perpendicular to the tangent of the ray's hit point. So when the ray hits the other object, a tangent is formed at the point of contact, and then I'd like to use the linerenderer component to draw a line that is perpendicular to that tangent. I already know how to use the linerenderer to draw lines, but I don't know how to get the tangent and normal from a collision.

  if (Input.GetMouseButton(0))
    {
        Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        var direction = (mousePos - (Vector2)cueBall.position).normalized;

        var hit = Physics2D.Raycast(cueBall.position, direction, Mathf.Infinity, 1 << LayerMask.NameToLayer("Ball"));

        if (hit)
        {
            _line1.SetPositions(cueBall.position, hit.point); //This is the line from the cueball to the red ball.
            _line2.SetPositions(hit.point, hit.normal); //This is supposed to be the predicted trajectory of the red ball.
        }
    }

sentences:
Calculating aim point to pass through other point We know for an object:

Initial point O(x,y)
Initial speed (s_x,s_y)
Constant vector module aceleration (A)
A point P(i,j) where we have to pass through in the future.

We need:

A point W(x, y) so the angle alpha (or only the angle alpha), formed between O and W, can be used to calculate acceleration in both axis:

Ax = A * cos(alpha)

Ay = A * sin(alpha)

so that the object passes through W.

How do I define an elliptic motion system knowing two points of the orbit (and Vo)?

I'll appreciate alternatives to design a guided rocket too.

My attempt for solving this:

Calculate module of initial point O, initial speed So, destination point D. (Aceleration module A is given)
Use these terms to calculate the time we need to arrive to D with the equation:

D = O + So*t + 1/2 A * t^2
Find out the value of alpha from this equation, knowing time:

Dx = Ox + Sox * t + 1/2 A * cos(alpha) * t^2

I tried to implement this, but for some reason it doesn't work. Should this theorically work?

sentences:
Procedural Islands Voronoi Pattern I'm trying to keep this as simple as possible, as I've found out the last few days this is a very difficult topic. I'd like to generate multiple flat islands, formed by a voronoi diagram. I've followed a long and (for me) difficult tutorial of building a procedural hexagonal grid just to find out it looks to artificial.

I'd like to create a plane with faces divided in a voronoi diagram, and extrude multiple groups upwards to create islands. With that I'd like to achieve something similar as this: http://applemagazine.com/wp-content/uploads/2015/10/image2.jpg

Please help to get me started in the right direction, since my approach might be wrong in itself.

EDIT:

I've found this: https://github.com/jceipek/Unity-delaunay. Which draws lines in a voronoi diagram. Now I'm guessing the next step is to convert this to a mesh. Then I'd have to highlight random faces to be extruded to create the islands. Maybe this could be done with perlin noise, which I've just learned about. Extruding might not be the best way. Maybe deleting the faces that won't be land, and creating fall of edges (Like Wardy said).  I'm doing my best to figure this out on my own, but any help is greatly appreciated.

sentences:
Getting UV maps from UDK? I have created a map using UDK and I am exporting it as a .fbx for use within an XNA project.

My question is, can I generate a UV map for texturing the map or is there an easier way to texture a map made within UDK to be used in an XNA project?

Thanks.

sentences:
Unable to access jar. Why? I was making a game in java and exported it as jar file. Then after that, I opeed jar splice. I added the libaries and exported jar. I added the natives then i made a main class. I created a fat jar and put it on my desktop. I'm using Mac OS X 10.8 Mountain Lion. When I put in the terminal, java -jar System Front.jar it says unable to access System Front.jar Even if i double click on the file, it doesen't show up! Help! I'm using slick.

I added slick and lwjgl as libraries for the jar splice at the jars.

sentences:
Where do I write code in my minecraft modding environment? So this is probably a stupid question but I'm just beginning so I hope someone can help. I set up my whole modding environment in eclipse but the problem is that I don't know where to start writing code that will be run while playing the game. I'm used to there being a run method that will constantly loop and run the code within that method but there doesn't seem to be such a thing. I tried putting stuff in my main class under the init event handler but that just crashed my game. I was just testing stuff out and tried putting this code in the init area which caused the game to crash when I tried running the client:

Entity player = Minecraft.getMinecraft().player;
if(player.posX>100.0)
{
 player.posX = 12.0;
}

sentences:
Unity 3d auto-move player forward script Trying to write a basic script to attach to the player on Unity 3D, I want them to move forward automatically. I'm guessing that will be part of the Update function and using transform, but that's about as far as I get.

I'm assuming it's a Transform.translate function too, but not sure what parameters to use to move forward 1 m/s automatically (for example). Also, how do I block W and S keys moving forwards and backwards, and instead use the for up and down? (My character is 'floating' and I'm looking to incorporate space harrier style controls)

Thank you!

sentences:
Half-shaded pixel artifacts on 2d dynamic lighting shader I'm working on a shader for dynamic lighting in a 2 unity game. I'm new to shaders but I've managed to get something close to the effect I was looking for, although not 100%.

As you can see in the image below, my texture maps respond to a point light and are shaded using a cel-shaded technique:

However, if you look closely, you can see that a few of the pixels are somewhere between fully lit and half lit, creating diagonal lines across pixels:

What I would like to achieve instead, are pixels that have a single color at all times, depending on the intensity of the light reaching it.

Do I need to move away from the surface shader and implement the lighting in a vertex+fragment shader?

Below is the relevant code for the shader:

Shader "Custom/PixelCellShading"
{
    ...

    SubShader
    {
        Tags { "RenderType" = "Cutout" }

        CGPROGRAM
        #pragma surface surfaceFunction PixelCell alpha
        #pragma target 3.0

        sampler2D _MainTex;
        sampler2D _NormalTex;
        float _Cels; // number of shading levels, set to 3

        struct Input
        {
            float2 uv_MainTex;
        };

        void surfaceFunction(Input IN, inout SurfaceOutput o)
        {
            float3 normalMap = UnpackNormal(tex2D(_NormalTex, IN.uv_MainTex));
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex);

            o.Normal = normalMap.rgb;
            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }

        half4 LightingPixelCell(SurfaceOutput s, half3 lightDir, half attenuation)
        {
            half NdotL = dot(s.Normal, lightDir);
            half cel = floor(NdotL * _Cels) / (_Cels);

            half4 c;
            c.rgb = s.Albedo * _LightColor0.rgb * cel * attenuation;
            c.a = s.Alpha;
            return c;
        }
        ENDCG
    }
}

sentences:
Traditional Chunk Loading vs. Chunk Swapping I'm designing a voxel-based game (aren't we all?), and just yesterday implemented infinite terrain generation. I'd already had the terrain generation working off of simplex noise, so this wasn't a problem, and I've worked a lot with terrain generation before.. Anyway, I found myself hitting performance issues with the huge increase in "stuff to draw", so I started optimizing and disposing of vertex buffers for chunks that were out of frustum, then created a "SurroundingChunks(Vec3 position, int range)" function that as you may assume returns the chunks surrounding a position within a range. I used this to cull the chunks being even considered for drawing before the frustum check.

Performance is pretty good when it isn't generating new chunks (haven't multithreaded yet), but after I had already worked out the performance issue I came across an alternate solution, and I was wondering how it would compare.

In a normal chunk-based terrain, the player moves around in the chunks and chunks are loaded and unloaded depending on some algorithm/methodology. In this alternate method, there are a fixed number of chunks in existance. For the sake of simplicity, let's pretend we have a chunk-view-distance of 1, i.e., 8 chunks around the player and the one he's standing on for a total of 9. Instead of allowing the player to roam around infinite chunks, the chunks are replaced with others as the player proceeds in a direction. This could mean the player never moves, and some movement buffer dictates chunk changing, or it triggers when the player moves over a chunk boundary and then resets the player to the center (like many FPS mouse schemes, but with a player in 3D).

I drew a crappy little diagram in mspaint (don't have better tools on hand) to help illustrate this concept:

I'm curious whether this would perform better than doing all of the detection work for chunks in range and frustum culling followed by unloading any unneeded chunks, since it wouldn't require as much detection work. However, I am concerned that it would complicate things in the future, for example when there are enemy entities - they would have to constantly be position shifted with the land, etc..

I was hoping perhaps you guys would chime in with thoughts, pros, cons, opinions, etc.. :3

sentences:
Server Side : How to manage "delay" action/event like attacking? at the moment I'm writing a game server, so I made an event "handler". I mean, if a player send to the server "I move" it fire a function, so I think I'm doing well at the moment.

But there's a problem and I don't know how to handle it. Lets take an example.

When a player want to attack he need to press a key one time, and it will attack automaticly every second, that means the server receive one packet with "I attack" and the server handle it, But I don't know how to make the player attacking every second correctly. It's kinda hard to explain I'm sorry ! So what I'm doing at the moment is, if the server receive from the player "I attack" I start a timer for the player which call a function every second. And I do that for every player but, I think that is not a nice idea. Should it be better to make one big timer ? If yes, which interval should I use ? 100ms or more ?

Well I hope you understood me, I know I didn't explain it well and sorry for that ! Thanks in advance for your help.

sentences:
How do I stop stretching during window re-size in XNA? In my windowed mode XNA game when the user resizes the window the game stops updating the window and the last frame drawn is stretched and distorted until the user releases the mouse and the resize completes.

Is there any way to have the game continue to run "normally", updating frames and redrawing the screen, during the resize event?

I realize that keeping the render loop going while resizing may not be possible or recommended due do hardware managed resources getting continually created and destroyed, but is there any way to stop the ugly stretching?  Ideally by leaving the existing frame unscaled in the top left, or with a black screen if that isn't possible.

sentences:
Change shadervalues for different Meshes in Three.js Hey I am writing a Shader for Three.js.

My goal is to have multiple objects with the same shader and each object should have a color set on the object that is then given to the shader. The goal is to have multiple "units" (think of an RTS game) each with the team color.

I red through a couple of documentation pages and am not really sure how to handle that. I looked into https://threejs.org/docs/#api/materials/ShaderMaterial.

I have tried:

changing a uniform but from my limited knowledge and trial and
error I came to the conclusion that I can not change a uniform value
during a drawcycle.
change the uniform in onBeforeRender which gave me an error that v
was not defined

I am not sure how to go on now. In the ShaderMaterial Documentation is written:

  You're recommended to update custom Uniform values depending on object and camera in Object3D.onBeforeRender because Material can be shared among meshes, matrixWorld of Scene and Camera are updated in WebGLRenderer.render, and some effects(ex:VREffect) render a scene with private their own cameras.

So did I just change the values wrong and it actually works with a uniform that changes? In this Github issue someone wanted to draw meshes in different colors and got suggested to create different materials for each mesh (https://github.com/mrdoob/three.js/issues/1532). But that would kill the idea of having one shader per unit regardless of the team.

sentences:
Making a 2d puzzle game like Unblock Me for iOS and need advice. I have a simple game on the Apple App Store written entirely in Objective-C and Cocoa Touch.

I would like my next game to be like the Unblock Me game or Auqeduct where you have to drag pieces around the game board arranging them to create something or free something to exit the board.

My question is how are games like this started. Do they work on a grid? How does collision work? When one piece hits the other piece they stop. Is this all done using Core Animation for moving the pieces and using functions like "CARectIntersectsRect()" to test for collision?

I love puzzle games that involve falling blocks and color matching and puzzles like mentioned above. Is there a resource I could read more about on the principles of these games that is language independent or explains how to make them?

sentences:
Wait till all CCActions have completed I am developing a simple cocos2d game in which I want to animate two CCSprites simultaneously, and for this purpose I simply set CCActions on respective `CCSprite's as follows.

[first runAction:[CCMoveTo actionWithDuration:1 position:secondPosition]];
[second runAction:[CCMoveTo actionWithDuration:1 position:firstPosition]];

Now I want to wait till the animations are complete, so I can perform the next step. How should I wait for these animations to finish?

There are actually two method calls, the first one animates the objects via the code above and second call does the other animation.

I need to delay the second method call until the animations in first are complete. (I would not like to use CCCallFunc blocks as I want to call the second method from the same caller as the first one.

sentences:
How to animate alpha channel of sprite color using Animator in code in Unity3D? I tried Animator + AnimationClipPlayable, but failed. Sprite disappears completely after 1 second, without animation happening. If I set "1" instead of "0" for final point, then nothing happens.

Code:

    AnimationClip clip = new AnimationClip();
    AnimationClipPlayable playable = AnimationClipPlayable.Create(clip);

    gameObject.AddComponent<Animator>();

    AnimationCurve alpha = AnimationCurve.Linear(0, 255, 1, 0);
    clip.SetCurve("", typeof(SpriteRenderer), "m_Color.a", alpha);

    gameObject.GetComponent<Animator>().Play(playable);

sentences: Is there an MMO-related research body? I'm trying to find a research resource for MMOs -- preferrably where people send papers to be published, have conferences, etc. If nothing else, just a repository of articles would be nice. Is there a site like that? I'm assuming it would be a subconference of a bigger group.

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:
Where does Unity save Inspector properties for objects in a scene? If I add a collection of objects to my scene and configure Inspector properties on those objects (like name, layer, tag, transform parameters, attached Components and their parameters), where does the information about those Inspector properties get saved within my project?

Is it all saved within the scene's .unity file or are there other files I should look at?

sentences:
Dodge different type of obstacles I'm writing a 2D game where the player has to kill a Ninja. This Ninja is coming closer with a constant speed chasing the player.
The Map has some static obstacles like stones no one can pass.
The player can move too and has different types of weapons to damage the Ninja in different ways:

Laser: instantly on whole range
Gun: projectile (circular) following a fixed path
Trap: circular floor ability which detonates after time

I want the Ninja to dodge those Weapons the best he can, he is allowed to take some damage, the least is preferred.

I now have different ideas how to achieve that:

A* with 3rd dimension (time): This is working but the paths are ugly and post processing is not my favorite. Also the Graph's size is about 1000x1000, making it inefficient (on creating neighbors), i try to reduce node count by scaling the nodes to unit.hitbox (40px), which drastically improves the calcs, but the paths look even more ugly..
Theta*: won't work even tho I love it, but line-of-sight on moving obstacles is...
Visibility Graph: same as Theta*, moving obstacles...
Steering: haven't tried this one yet how it performs with constant speed and moving (, delayed) obstacles
Local Avoidance: won't work as the weapon speed is bigger than Ninja movement speed
Geometry: tangents, vector projection etc....  could work well if there aren't much obstacles to dodge

Do you have any other ideas how to achieve some good doing for the poor Ninja?

(NINJAS USUALLY DODGE EVERYTHING... That's why I also plan to give the Ninja a Ninja-Roll feature he can use every 10s to dash on some position if he can't dodge something)

Representation of the raw map (little dots are 40px)

A* Pathfinding with time dimension and a 5px-Grid

Edit: I'll check out D*-Lite and RRT*-Smart

Edit #2: Both are not what im looking for, i will try to optimize A*

sentences: AndEngine sprite movement I want to ask that I have a player in my game. I may walk. I have a image which has five different frames for walk and two frames for standing position. I want to ask that how can I change the images on runtime depending on the player state? I have loaded the image in tiledtextureregion. Also player can walk in forward and backward direction as well. How to use the same image strip for walking back and forth? I am new to andengine.

sentences: How to modify Game1.cs out of an object it contains? Assuming I Have a List<SomeClass> myList; in my Game1-class. It also contains an object of SomeOtherClass otherClass;. How would I modify myList (Add/Remove) out of the otherClass's logic? Or in other words how to get access to the Game1-instance in this situation?

sentences:
How do I make a 2D character aim their gun toward the mouse? Heli Attack is a perfect example of the shooting mechanic I'd like. The character aims perpetually toward the mouse. What's going on here?

From what I've read so far, you could separate the arm and rotate that. I've also noticed some people use a different sprite for each weapon.

How can I achieve this?

sentences:
How to flatten out terrain and make better caves with Perlin noise I'm currently using Perlin noise to generate a terrain. This is my actual attempt to create caves. I do get some sort of cave structures but they are small and are always close to the edges of the terrain. Also my terrain looks very irregular I'd like to have a more flat terrain. I've been playing with the values I pass to the Perlin noise function but I can't seem to get something good.

Do you have any pointers or suggestions to my actual approach in order to get something more regular within the Minecraft standards?

sentences:
Is there an easier way to get sprites from a spritesheet One issue I have when working with API's such as Monogame and SFML unlike with Game Engines like Unity and Unreal is trying to extract sprites from a spritesheet. I know the method of doing it but it becomes really annoying when you use spritesheets for example that have lots of different sized sprites that are scattered all around the spritesheet. Everything seems to need to be perfectly sized and aligned to be able to extract the sprites correctly, unless you're using a game engine like Unity where you can do something like draw boxes around the sprites you want, no matter the size or position, or have this done for you.

What workflow can I use to quickly select the portions of the image corresponding to each sprite and use those extracted sprites right away in code instead of splitting the sprites into seperate .png's and using them?

sentences:
Application.OpenURL in Unity works in inspector (PC) but not in Android I'm using unity and I've got some simple code that should work but doesn't for some reason and I'm stuck. Basically I am just trying to open up a website through a button click "On Click ()" in an application meant for android but it does not work. The code goes as follows.

public string url;

public void Website()
{
    Application.OpenURL(url);
}

public void Website2(string diffURL)
{
    Application.OpenURL(diffURL);
}

public void Website3()
{
    Application.OpenURL("http://www.google.com/");
}

As you can see I have three different variations of the same "Application.OpenURL" testing on three different buttons and all three do not work. Some more information:

I have paid close attention to format the websites properly with
quotation marks and "http://"
I have already set the "Internet Access" to "require" in the player
settings,
and interestingly enough, they work in the game window when testing,
it is only when I upload the apk to my android device that it does
not work anymore
.

The buttons register I am pressing them as evident by the slight darkening of the button press when I press on my android device but nothing happens. I have seen this question asked around but no solution to my issue has been found. Are any other build settings wrong? Any other thing I should change in Unity? API level or what?(currently 19 on min and highest installed on target)

Is there some settings I should change on my android device to allow this to happen? Because as stated earlier it works when testing through the game window on unity but not on android.

(The function "Website3()" begun to work when I rebuilt the app. No changes were made. "Website1()" and "Website2()" however still do not work on android and they work perfectly fine on unity game window.)

sentences:
How front-to-back blending works? I would like to implement dual depth peeling in my engine. I read the original paper and examined the corresponding source code. I understand the algorithm, except how the blending works, especially in the front-to-back part. I'm so confused now, I'm not sure anything about alpha blending.
So let's start with the basics. I think there are two options: either we compute the pixel's color and it's transparency and store them separately (straight), or we multiply them and then we don't use the alpha channel's value (premultiplied alpha). The second option is what we usually do when we set glBlendFunc's parameters to GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. When we blend two pixels, the GPU multiplies the source color with the source alpha and it multiplies the destination color with (1 - source alpha). We don't multiply the destination color with the destination alpha because basically it's already multiplied with it. So we assume the destination alpha is 1 (and also the destination alpha is not correct, because of the GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA parameters, so we can't use it anyways). Am I right so far?
At this point the back-to-front part of the dual depth peeling makes sense to me. In  dual_peeling_peel_fragment.glsl we just store the color with the alpha (we can't blend it yet because we have to use max blending in this shader).
void main(void)
{
    ...
    gl_FragData[2] = vec4(0.0);
    ...
    if (fragDepth == nearestDepth) {
        ...
    } else {
        gl_FragData[2] += color;
    }
}

Then in the dual_peeling_blend_fragment.glsl shader we just blend it with the background.
void main(void)
{
    gl_FragColor = textureRect(TempTex, gl_FragCoord.xy);
    ...
}

Here we use additive blending with the already mentioned parameters which makes sense to me.
But when we compute the front-to-back part in dual_peeling_peel_fragment.glsl, I don't understand the code.
void main(void)
{
    ...
    vec4 forwardTemp = textureRect(FrontBlenderTex, gl_FragCoord.xy);
    ...
    gl_FragData[1] = forwardTemp;
    ...
    float alphaMultiplier = 1.0 - forwardTemp.w;
    ...
    vec4 color = ShadeFragment();
    ...
    if (fragDepth == nearestDepth) {
        gl_FragData[1].xyz += color.rgb * color.a * alphaMultiplier;
        gl_FragData[1].w = 1.0 - alphaMultiplier * (1.0 - color.a);
    } else {
        ...
    }
}

Here we compute the color value and multiply it with some alpha values and we also compute the alpha. I don't see where these equations come from. We don't modify the destination color (which is the nearer), but we multiply the source color with the source alpha and with (1 - destination alpha). And then we also compute the alpha value. So this not straight neither premultiplied. Also in the paper they use slightly different equations in page 6.

Where the paper multiplies with destination alpha the source code multiplies with (1 - destination alpha). I found a blog post where the author is also confused about that.
And then, at the end in dual_peeling_final_fragment.glsl we blend together the back-to-front part with the front-to-back part.
void main(void)
{
    vec4 frontColor = textureRect(FrontBlenderTex, gl_FragCoord.xy);
    vec3 backColor = textureRect(BackBlenderTex, gl_FragCoord.xy).rgb;
    float alphaMultiplier = 1.0 - frontColor.w;
    gl_FragColor.rgb = frontColor + backColor * alphaMultiplier;
}

But I don't understand why we only multiply the back part with (1 - front part alpha). In this part we use additive blending.

sentences:
How should I structure my Android platform board game? I'm new to developing Android games, but not new to developing mobile games (J2ME). I'm currently developing a board game, for a school project, with 2 things - a board and a spinning wheel (both are displayed at the same time). The user is able to zoom in/out and scroll around the board and spin the wheel. The wheel is also animated - resized during game. The board is build using tiles (2-4 different tiles on one image per board ) and the wheel is a image with numbers draw on it, using graphics.

My questions is what is the best practice to achive the best performance of the game (game has to run on every possible Android version)?

Should i use Android canvas or open GL?
Is there a mechanism for drawing tiles, animations or should i just implement it my self using drawImage()?
Should i separate the wheel and the board into two different threads? Should i separate the wheel and the board in to 2 activities or put it in 1 activity and draw each part separatly?
What would be the best way to resize the wheel during gameplay? Scale the wheel image (but the animation has to be smooth - opengl vs canvas)?
What would be the best way to make the board zoomable - should i scale every image on the board when the zoom is detected or does android have some better way to do this?
What would be the best way to make the board scrollable - should i implement a Camera that displays just a piece of the board or does android have some better way to do this?

sentences: Cocos2d -- Check if place is free before moving (all objects) Is there a method in Cocos2d like CGRectIntersectsRect, except instead of limiting it to one sprite, it checks for ALL objects?

sentences:
What underlying character stats would you put into your "character" object in an RPG engine basically I'm making my own RPG/TBS engine named Uruk (making an rpg themed about the epic of gilgamesh) and I am thinking of a combat system similar to the Disgaea franchise or the Super Robot Wars franchise

I'm currently in the process of writing the "character" class (cant name it character since it causes confusion with the primitive data type "character") and right now i've decided to go with the regular RPG route of including the following base stats:

strength
Agility
Willpower
Endurance
Luck

and the base stats would then dictate the following stats

Attack (probably a combination of the strength stat and weapon stats)
Physical Defense (determined by endurance and armor)
Magic Resistance (maybe something to do with willpower and armor)
Crit Rate (luck and agility)
Max Health (endurance)
Max Mana (willpower)
Max Stamina (combination of strength and endurance)
Move per turn (determined by character class or agility)

of course there would also be a leveling system with level and experience stats

the biggest problem I am facing right now is whether I should put additional underlying stats (hidden from the play) for leveling purposes (for example stats such as strength per level and max health per level) and how would i go for implementing said underlying stats with a class system, currently I am using an enum within the character object (calling them objects to avoid confusion with programming classes and character classes) to implement the class system and I have been considering on whether I should just write multiple objects extending on the character object for each character class or should I keep on using enums to represent different classes

sentences:
Set texture of a LHSprite that is loaded from LevelHelper How do i set the image/texture of an LHSprite that is loaded into xCode using levelHelper & spriteHelper?

I am using sprite sheets. So i tried to load the image the old fashioned way using CCSpriteFrameCache, but unfortunately it isnt recognizing the .pshs file :( Any Help would be great!

sentences:
What is the logic behind these design decisions regarding difficulty levels? In some games you are unable to play on the harder difficulties before complete it on a lower difficulty. Why?
Achievements are popular. In some games you do not get an achievement for completing the game on the hardest difficulty (e.g. Bethesda RPG's) but for just about everything else, Why?

sentences:
What should I do about legal considerations for an indie game? Apologies if there's a bit too much background information here, not sure what's relevant but figured I needed to outline the financial situation to differentiate this from other questions whose answers aren't applicable here.

I'm making an indie game, to be sold online (ie, to any country that can use PayPal). My current situation is underemployed - unable to find enough work to make ends meet over the last couple of years, I'm now looking to use some of that free time to top up my income by making a little extra money from my hobby. Primarily, I look at is as art rather than a business, but with cash flow and employment prospects limited, I need to make a little money.

My question is what should I do about the legal problems that can arise out of selling a game? I've read up general advice on small businesses, so I should be fine with the usual issues like copyright, limited liability and tax - it's game development specific ones that worry me. I've also checked the licenses of any libraries used thoroughly (it's all open stuff anyhow).

Software patents are currently scaring the hell out of me - they might not be legal in my country, but if I'm going to get any sales at all with my small scale project I'm going to have to cast a broad net. As far as I understand, there are so many and so broad or poorly defined, that I can't in practical terms make a game without violating them in at least some countries. The other thing that bothers me is if there's legal issues I've never heard of and wont hear of until I get a nasty letter threatening to take everything.

I've obviously searched for related questions here and elsewhere, but had no luck - the answers always seem to say either consult a lawyer, or buy expensive legal reference materials - whilst well intentioned, given the financial situation outlined above, well this advice isn't really applicable. I have no money, and the total amount I hope to make from this game is less than one hour of legal consultation. Given the amount of researched involved in patents, and the numerous jurisdictions that my sales might come from - well, I can't think of a way that sufficient help from a lawyer will ever be within my means.

So, given those considerations, can anyone suggest a sensible course of action for such a small scale business that'll prevent me from being shut down, and from losing my creative rights to the game the moment some large company with software patents decides to sue? And further, any other steps I need to take to protect myself against legal problems specific to this industry that general advice sites wouldn't cover?

sentences:
I imported both the rig and baked animation seperatly from Maya, but it's not working correctly I am using the animation controller to bind the "jump" animation I did onto the rig itself. I don't get any errors. The animation plays. Except it seems to only affect the root joint only. Basically the model moves but not the arms or legs. They stay static. So If i have a character jumping few feet away, the entire model rig will move in jump motion(X and Y axis), but nothing happens with legs and arms.

What's going on?

sentences:
A script isn't showing in the Content Browser Just to set the tone, I'm very new to game development.

I'm currently taking an online video course for Unreal Engine 4 that required me to create a C++ script. After I created the script and it compiled it did not appear in the Content Browser where it should be. I received the following text boxes:

and

sentences:
Keyboard input system handling Note: I have to poll, rather than do callbacks because of API limitations (SFML). I also apologize for the lack of a 'decent' title.

I think I have two questions here; how to register the input I'm receiving, and what to do with it.

Handling Input

I'm talking about after the fact you've registered that the 'A' key has been pressed, for example, and how to do it from there.

I've seen an array of the whole keyboard, something like:

 bool keyboard[256];  //And each input loop check the state of every key on the keyboard

But this seems inefficient. Not only are you coupling the key 'A' to 'player moving left', for example, but it checks every key, 30-60 times a second.

I then tried another system which just looked for keys it wanted.

std::map< unsigned char, Key> keyMap; //Key stores the keycode, and whether it's been pressed. Then, I declare a load of const unsigned char called 'Quit' or 'PlayerLeft'.
input->BindKey(Keys::PlayerLeft, KeyCode::A);  //so now you can check if PlayerLeft, rather than if A.

However, the problem with this is I cannot now type a name, for example, without having to bind every single key.

Then, I have the second problem, which I cannot really think of a good solution for:

Sending Input

I now know that the A key has been pressed or that playerLeft is true. But how do I go from here?

I thought about just checking
 if(input->IsKeyDown(Key::PlayerLeft) { player.MoveLeft(); }
This couples the input greatly to the entities, and I find it rather messy. I'd prefer the player to handle its own movement when it gets updated. I thought some kind of event system could work, but I do not know how to go with it. (I heard signals and slots was good for this kind of work, but it's apparently very slow and I cannot see how it'd fit).

Thanks.

sentences:
Modular spaceship control I am developing a physics based game with spaceships.

A spaceship is constructed from circles connected by joints. Some of the circles have engines attached.

Engines can rotate around the center of circle and create thrust.
I want to be able to move the ship in a direction or rotate around a point by setting the rotation and thrust for each of the ship's engines.

How can I find the rotation and thrust needed for each engine to achieve this?

sentences:
Fragment shader working so strange the fragment shader is working so strange, can someone explain me whats going on.

this one compiles fine but crashes when i use it-

#version 330 core
const float PI = 3.14159265359;
out vec4 coloroutfinal;

in vec3 fragpos;
uniform vec3 lightpos;
uniform vec3 camerapos;

vec3 wi;
vec3 normal;
float cosT;
uniform vec3 lightcolor;
vec3 incidentlight;

uniform float metallic;
uniform float roughness;
uniform vec3 albedo;
uniform float ao;

vec3 fresnel(float cosT,vec3 Fo);
float ND(vec3 H,vec3 N,float roughness);
float G(vec3 L,vec3 N,vec3 V,float roughness);

void main()
{
  coloroutfinal=vec4(1.0);

}

vec3 fresnel(float cosT,vec3 Fo)
{
  return Fo+(1.0-Fo)*pow((1-cosT),5);
}

float ND(vec3 H,vec3 N,float roughness)
{
   float roughness4=pow(roughness,4);
   float cosT=max(dot(N,H),0.0);
   float cosT2=cosT*cosT;
   float num=roughness4;
   float denom=cosT2*(1.0-roughness4)+1.0;
   return num/denom;
}

float GP(float cosT,float roughness)
{
roughness-=1.0;
   float r2=roughness*roughness;
   float k=r2/8;

float num=cosT;
float denom=cosT*(1.0-k)+k;
 return num/denom;

}

float G(vec3 L,vec3 N,vec3 V,float roughness)
{
  float cosTL=max(dot(N,L),0.0);
  float cosTV=max(dot(N,V),0.0);

  float GL=GP(cosTL,roughness);
  float GV=GP(cosTV,roughness);
  return GL*GV;
}

but this one is just the same as above but no function definitions but works fine(renders my object in white)-

#version 330 core
const float PI = 3.14159265359;
out vec4 coloroutfinal;

in vec3 fragpos;
uniform vec3 lightpos;
uniform vec3 camerapos;

vec3 wi;
vec3 normal;
float cosT;
uniform vec3 lightcolor;
vec3 incidentlight;

uniform float metallic;
uniform float roughness;
uniform vec3 albedo;
uniform float ao;

vec3 fresnel(float cosT,vec3 Fo);
float ND(vec3 H,vec3 N,float roughness);
float G(vec3 L,vec3 N,vec3 V,float roughness);

void main()
{
  coloroutfinal=vec4(1.0);

}

I never call the function so how are they interfearing.
also both the shaders compile and link fine.

can someone point me to the mistake?

sentences:
3D Procedural Planet Generation I was looking for some inspration for my Voxel based game I am writting and came across this: http://www.youtube.com/watch?v=rL8zDgTlXso. I would like to know how to go about (or preferably source examples) of how I would do that, in real time, and infinitley. In addition to that I was wondering how I would do this with a voxel based terrain?

A procedural planet generator in 3D which constructs voxel data, my voxels are of the same size of thoose in minecraft.

Any ideas?

Edit:

I ported the simplex noise function i_grok suggested written in C++/Python to C#, I sure hope it works :)

http://pastebin.com/TZSQwnye

Edit 2:

float noise(float x, float y, float z, float persistance, float amplitude, float frequency, float octaves)  {
    float total = 0;

    for (int i = 0; i < octaves; i++)  {
        frequency = frequency ^ i;            // or frequency *= 2; ?
        amplitude = amplitude ^ i;

        total = total + SimplexNoise.raw_noise_3d(x * frequency, y * frequency, z * frequency) * amplitude;
    }

    return total;
}

sentences:
x axis detection issues platformer starter kit I've come across a problem with the collision detection code in the platformer starter kit for xna.It will send up the impassible flag on the x axis despite being nowhere near a wall in either direction on the x axis, could someone could tell me why this happens ?

Here is the collision method.

  /// <summary>
    /// Detects and resolves all collisions between the player and his neighboring
    /// tiles. When a collision is detected, the player is pushed away along one
    /// axis to prevent overlapping. There is some special logic for the Y axis to
    /// handle platforms which behave differently depending on direction of movement.
    /// </summary>
    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;
                            }
                        }
                       //This is the section which deals with collision on the x-axis
                        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:
In iOS, where/how to do a back button? Edit: To sum up my question, what is the established back gesture for iOS games (when no pause button exists)?

I have a block puzzle game, square grid, and some levels fill up the whole screen with them. In Android this is no problem because there's a hardware back button. iOS devices, however, have no such thing.

I need some kind of back button to get to the menu, where you can restart, undo, select other levels, go to options page, etc.

I looked at iOS game demos on youtube. All I found was many of them have a pause button in some corner, but this is not a great solution in my case. I could not find a demo illustrating some kind of back gesture, like swiping from the left edge towards the right? Most demos are direct screen captures instead of showing a user and their hands, so I could not confirm this.

I figure most iOS games have adopted some kind of standard practice for this. What is it?

EDIT: I found this article about iOS 7 doing a left-right swipe to go back one page, apparently for safari. This was kinda my first though, because surely there is a back gesture for the back button of web pages? I don't know if this same gesture is standard practice in iOS games, but I put it here because it's my first guess.

sentences:
Get color array with alpha for an image in java I can get the pixel array like this:

int[] pixels = image.getRGB(0, 0, width, height, null, 0, width);

But it ignores the alpha channel, I only get the rgb (I'm reading a PNG image). How can I get the alpha channel too?

sentences:
Road Intersection mesh generation For the last month I was learning about meshes and how procedurally generate them. For what I need it looks very straightforward.
For my little app I planning to have a road tool (very simple), user draws lines and curves and road is generated with specific width (flat).
So I can now create a drawing tool and generate simple mesh along the curve or line.
Next step is to be able to construct intersections...
I looked at lots of example but couldn't find any descriptions how it is done.

Could you please advice what approach to take, how to identify intersection of two or multiple curves and generate mesh junction?

Also could you please advice on bigger picture, should I have sort of underline system for city building app, like graph, to know where to place road intersections, buildings and so on?

Thank you
This is a quick prototype I did (not in code)
https://youtu.be/1TxxB-ofLAo

sentences:
Endless 2d runner with increasing speed, how to adjust jump behavior? I am making an endless 2d runner with unity. my player object is not moving at all, i move all the other game objects. I have a SpeedManager script which increases the "speed" at every update by a short amount. The movement speed of every gameObject which is streaming towards the player is now multiplied with the SpeedManager "speed".

One controll of my player is a jump. Currently i am using

  public Vector2 jumpForce = new Vector2(0, 350);
  rigidbody2D.AddForce(jumpForce);

The problem now is, as the game goes on, the game objects pass faster and faster but the player jump remains the same. What i want is a jump that goes as far as before, which means, the player should jump faster into the air, reach the same height and drop faster to the ground, so the jump distance is the same.

I tried some stuff like multiplying both the jumpForce.y and the gravity of my player object with my SpeedManager.speed, but i did not achieve anything yet. :)

Greetings.

sentences:
How do you design a replay system for a frequently patched game Possible Duplicate:
  How do you design a record/replay system for a frequently changing game?

I understand that in order for a game to have a replay system it must:

Have a deterministic engine
Record initial state
Record player inputs

The problem is, what if the game is being patched every few weeks, and these patches change significant parts of the game that can not really be abstracted into an attribute/state? Like, what if something (minor) is completely redesigned? Then you can no longer just play back older player inputs which took place when there were different mechanics on the current engine because it will lead to entirely different results.

Example: Let's say there is a bug in StarCraft that makes marines not take any damage if the damage they receive is greater than their maximum health. Later this is patched, but any replay from the time of the bug would be junk on the patched system. People would be trying to move marines that are dead in the eyes of the game, etc.

Is this reasonably solvable, given there will always be frequency patches that will make structural gameplay changes/fixes?

sentences:
2D Simplex Smooth Cave Generation So I'm creating a system of caves below my random terrain generation, and I'm using 2D Simplex Noise to do so and I have a pretty good grasp on generating the random caves.  However, the cutoff from the terrain to where the cave layer starts is a bit abrupt, and I was wondering how I could prevent this.

Random Level Generation:

public static Level GetRandomLevel(int rows, int cols, float scale = 1f)
{
    Tile[][] tiles = new Tile[rows][];
    for (int i = 0; i < rows; i++)
    {
        tiles[i] = new Tile[cols];
        for (int x = 0; x < cols; x++)
        {
            tiles[i][x] = new Tile(0, new Vector2(x, i), scale);
        }
    }
    int left = Main.rand.Next(rows / 4, rows / 2);

    double seed = Main.rand.NextDouble() * 255;
    for (int i = 0; i < cols; i++)
    {
        float noise = Noise.Generate((float)seed);
        noise *= 7;
        int height = left + (int)noise;
        height = (int)MathHelper.Clamp(height, 0, rows - 1);
        tiles[height][i] = new Tile(2, new Vector2(i, height), scale);
        FillLower(tiles, height, i, scale);
        seed += .05f;
    }

    int[] heightmap = new int[cols];
    for (int i = 0; i < cols; i ++)
    {
        for (int j = 0; j < rows; j++)
        {
            if (tiles[j][i].TileID == 2)
            {
                heightmap[i] = j;
                break;
            }
        }
    }

    //Smoothing out terrain
    for (int i = 0; i < cols - 1; i++)
    {
        if (heightmap[i] > heightmap[i + 1])
        {
            tiles[heightmap[i] - 1][i] = new Tile(6, new Vector2(i, heightmap[i] - 1), scale);
            tiles[heightmap[i]][i] = new Tile(3, new Vector2(i, heightmap[i]), scale);
        }
    }
    for (int i = cols - 1; i > 0; i--)
    {
        if (heightmap[i] > heightmap[i - 1])
        {
            tiles[heightmap[i] - 1][i] = new Tile(5, new Vector2(i, heightmap[i] - 1), scale);
            tiles[heightmap[i]][i] = new Tile(4, new Vector2(i, heightmap[i]), scale);
        }
    }

    //Caves
    for (int y = 0; y < rows && left + 10 + y < rows; y++)
    {
        for (int x = 0; x < cols; x++)
        {
            double noise = Noise.Generate(x / (70 * scale), (y + 1) / (70 * scale));
            //Not air
            if (tiles[left + 10 + y][x].TileID != 0 && noise > 0)
            {
                tiles[left + 10 + y][x] = new Tile(0, new Vector2(x, left + 10 + y), scale);
            }

        }
    }

    return new Level(tiles);
}

Here is a picture demonstrating what I mean about the 'cave layer cutoff' being to abrupt.

sentences:
How do you turn a cube into a sphere? I'm trying to make a quad sphere based on an article, which shows results like this:

I can generate a cube correctly:

But when I convert all the points according to this formula (from the page linked above):

    x = x * sqrtf(1.0 - (y*y/2.0) - (z*z/2.0) + (y*y*z*z/3.0));
    y = y * sqrtf(1.0 - (z*z/2.0) - (x*x/2.0) + (z*z*x*x/3.0));
    z = z * sqrtf(1.0 - (x*x/2.0) - (y*y/2.0) + (x*x*y*y/3.0));

My sphere looks like this:

As you can see, the edges of the cube still poke out too far. The cube ranges from -1 to +1 on all axes, like the article says.

Any ideas what is wrong?

sentences:
LibGDX: Google Play Game Service (Dec 2016) - Cannot call Games class I'm trying to include Google Play Game Services in my Android game and I tried adding BaseGameUtils library. But it is not really working.

I can call the GameHelper class from AndroidLauncher but not the Games class for getting leaderboards.

I also have this warning in my console: (which does not interfere with the actual problem - see the answer)

project ':android': Unable to resolve additional project configuration.
Details: groovy.lang.MissingPropertyException: Could not find property 'main' on SourceSet container.

Can somebody give any insight to this problem?

This is my android gradle: http://pastebin.com/ya85gGs4

And this my BaseGameUtils gradle: http://pastebin.com/0iyz2j12

Also the root gradle: http://pastebin.com/in2MmYMM

When I check Project Structure -> Problems, I have these messages:

EDIT: I have tried changing android support library, appcompat and google play services to different versions including the latest ones but this error keeps pissing me off.

PS: Please feel free to edit the title. I put the date because I wanted to imply that this is a recent issue.

sentences: How do you add a scripting language to a game? Let's say I have a game written in C++. But I want to add some modding or scripting functionality to it. How would one go about adding a scripting functionality to your game?

sentences:
Move enemies over the network without sending their positions I am trying to move enemies on two clients without sharing their positions. I use this:
startingPosition + GetRandomDir() * Random.Range(1f, 10f)

To have the same movement on clients and server, I set the same seed to get the same directions with Unity Random.
I set it with the system datetime now ticks on server and clients:
Random.InitState(newTicks);

I am getting the same movements on the server and on the clients until a enemy starts looking for a player and chasing that player.
When this happens, the enemy on one client is not at the same position on the other client. One enemy is targeting a player on one client, but on the other client he hasn't targeted that player yet. The enemy keeps wandering creating a different position on one client than on the server or other clients for example.
Is there a better way to synchronize the enemy movement ?
My idea was not to send the positions of the enemies from the server to the clients but rather have the clients move their enemies themselves.
I would also like to know what to search for on Google to get help with this problem: networking ai movement doesn't help, synchronize movement over the network without sending position does not return the results I would like either.
What I think is strange and I don't understand is that the same code is executed on both the client and the server. The players and the enemies are at the same positions. Yet the enemy will choose to chase a player on the server and not to chase a player on the client. Resulting on the client to view the enemy at a different position than the position of the enemy on the server.

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:
Java Slick2d - Mouse picking how to take into account camera When I move it it obviously changes the viewport so my mouse picking is off.

My camera is just a float x and y and I use g.translate(-cam.cameraX+400, -cam.cameraY+300); to translate the graphics. I have the numbers hard coded just for testing purposes.

How would I take into account the camera so my mouse picking works correctly.

double mousetileX = Math.floor((double)mouseX/tiles.tileWidth);
    double mousetileY = Math.floor((double)mouseY/tiles.tileHeight);

    double playertileX = Math.floor(playerX/tiles.tileWidth);
    double playertileY = Math.floor(playerY/tiles.tileHeight);

    double lengthX = Math.abs((float)playertileX - mousetileX);
    double lengthY = Math.abs((float)playertileY - mousetileY);
    double distance = Math.sqrt((lengthX*lengthX)+(lengthY*lengthY));

    if(input.isMousePressed(Input.MOUSE_LEFT_BUTTON) && distance < 4) {
        if(tiles.map[(int)mousetileX][(int)mousetileY] == 1) {
            tiles.map[(int)mousetileX][(int)mousetileY] = 0;
        }
    }

That is my mouse picking code

sentences:
Parse and iterate over SVG path I need to parse a SVG path expression like

m8,295c-4,-292 441,-291 446,-26c5,265 440,263 442,-9

and have a way of iterating over it in [0 ... 1]. I looked into Apache Batik but it doesn't seem to have this specified function. I also looked at Salamander SVG but in the end the path is a wrapper around java.awt.geometry, which is not ported to android so I can't really use it.

sentences:
SFX Played Once per Collision or Hit I have a question about using Box2D (engine for LibGDX used to make realistic physics). I observed on the code that I've made for the physics here below:

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button)
{
      // TODO Touch Up Event

     if(is_Next_Fruit_Touched)
     {
             BodyEditorLoader Fruit_Loader = new BodyEditorLoader(Gdx.files.internal("Shape_Physics/Fruity Physics.json"));

             Fruit_BD.type = BodyType.DynamicBody;
             Fruit_BD.position.set(x, y);

             FixtureDef Fruit_FD = new FixtureDef(); // --> Allows you to make the object's physics.
             Fruit_FD.density = 1.0f;
             Fruit_FD.friction = 0.7f;
             Fruit_FD.restitution = 0.2f;

             MassData mass = new MassData();
             mass.mass = 5f;

             Fruit_Body[n] = world.createBody(Fruit_BD);
             Fruit_Body[n].setActive(true); // --> Let your dragon fall.
             Fruit_Body[n].setMassData(mass);
             Fruit_Body[n].setGravityScale(1.0f);

             System.out.println("Eggs... " + n);

             Fruit_Loader.attachFixture(Fruit_Body[n], Body, Fruit_FD, Fruit_IMG.getWidth());
             Fruit_Origin = Fruit_Loader.getOrigin(Body, Fruit_IMG.getWidth()).cpy();

             is_Next_Fruit_Touched = false;
             up = y;
             Gdx.app.log("Initial Y-coordinate", "Y at " + up);

             //Once it's touched, the next fruit will set to drag.
             if(n < 50)
             {
                 n++;

             }else{

                 System.exit(0);

             }
     }

         return true;

}

Now, I'm thinking which part o line should I implement for the sound effects. My objectives to make SFX played once for every collision (Or should I say "SFX played once per collision"?) on the following:

SFX played once if they hit on the objects of its kind. (e.g. apple vs. apple)
SFX played once on a different sound when it hit on the ground. (e.g. apple land on the mud)

Take note that I'm using Box2D for the Java programming version thanks to LibGDX via Box2D engine and I edited the physics body using Physics Body Editor before I implement it to code.

I tried to check every available methods for body, fixture definition, or body definition to code for the SFX when hit but it seems only for the gravity and weight. Is there possibly available on the document for SFX played when collision happens if possible?

sentences:
How to make minecraft like world round? I'm interested is there a game or at least example which shows how minecraft-like world turn to sphere?

Idea is that there is sphere which consists from cubes like in minecraft but they are on the surface of it. This have to make that player can go around the world.

Math? Code? Examples?

sentences:
How can I iterate over all entities with a particular component? I'm currently designing a game engine and want to implement my own ECS implementation, so I decided to look around for ideas.

Unity has recently updated their engine and seems to be pushing towards using ECS, instead of their original components-are-systems design.

I noticed that Unity has a method called "GetEntities", a generic method which can do something like this:

public struct SomeComponent : IEntityComponent
{
    public string Message = "Hello, World!";
}

public struct Filter
{
    SomeComponent someComponent;
}

public MovementSystem : EntitySystem
{
    public override Process()
    {
        // How can I accomplish something like this?
        foreach(var entity in GetEntities<Filter>())
        {
            Console.WriteLine(entity.someComponent.Message);
        }
    }
}

I like this style of iterating over entities, given a filter for a specific component they need to include. But I'm not sure how to accomplish something like this.

If someone could shed some light on how something like this is even possible in C# that would be great!

sentences:
Android, how important is deltaTime? Im making a game that is getting pretty big and sometimes my thread has to skip a frame, so far I'm not using deltaTime for setting the speed of my different objects in the game because it's still not a big enough game for it to matter imo. But its getting bigger then I planned, so my question is, how important is delta Time?

If I should use delta time there is a problem, since speedX and speedY are integers(they have to be for eclipse to let you make a rectangle of them), I cant add delta time very functionally as far as I understand, but might be wrong?
Ive tried adding deltaTime to the code below, and sometimes my enemies just not move after spawn, they just stand there and run in the same place

Will add an some code for how I set / use speed:

     public void update(int dx, int dy) {
        double theta = 180.0 / Math.PI * Math.atan2(-(y - controls.pointerPosition.y), controls.pointerPosition.x - x);

        x +=dx * Math.cos(Math.toRadians(theta));
        y +=dy * Math.sin(Math.toRadians(theta));
    currentFrame = ++currentFrame % BMP_COLUMNS;
}

     public void draw(Canvas canvas) {
    int srcX = currentFrame * width;
    int srcY = 1 * height;
    Rect src = new Rect(srcX, srcY, srcX + width, srcY + height);
    Rect dst = new Rect(x, y, x + width, y + height);
    canvas.drawBitmap(bitmap, src, dst, null);
}

So if someone with some experience with this has any thoughts, please share. Thank you!

Changed code:

    public void update(int dx, int dy, float delta) {
        double theta = 180.0 / Math.PI * Math.atan2(-(y - controls.pointerPosition.y), controls.pointerPosition.x - x);
        double speedX = delta * dx * Math.cos(Math.toRadians(theta));
        double speedY = delta * dy * Math.sin(Math.toRadians(theta));
        x += speedX;
        y += speedY;
    currentFrame = ++currentFrame % BMP_COLUMNS;
}

     public void draw(Canvas canvas) {
    int srcX = currentFrame * width;
    int srcY = 1 * height;
    Rect src = new Rect(srcX, srcY, srcX + width, srcY + height);
    Rect dst = new Rect(x, y, x + width, y + height);
    canvas.drawBitmap(bitmap, src, dst, null);
}

with this code my enemies move like before, except they wont move to the right (wont increment x), all other directions work.

sentences: Collision and response between sprites? What is an easy way to have sprites collide and react to the collision? E.g. if I'm writing a game in XNA or with Canvas 2D and need to write the code myself very simply.

sentences:
How to put triangle information into a glsl shader for dynamic shadows? I am experimenting with how much I can push the GPU with clever optimizations and correct use of hardware, so I know this may lag my computer a lot, that's not the issue.

Currently my goal is as follows:

Define a variable size structure (i.e an array) that contains floats, every 3 floats define a position vector, every 9 define a triangle.

I need to create an array of these structures (the array of all shadow casting objects currently loaded) and pass the array to the GPU (the glsl shader).

If I follow a couple of conventions when putting my data into this format I can use hashing to get an amortized constant search time for the shadow casting triangles,

The issue is to get the data into the format that I need. If this was C++ the format would be an array of vectors and we're done, but GLSL is not as good at managing memory, does somebody know a way to pass the information in the fashion I described, or am I trying to do something that can't be done?

sentences:
Need to boost the number of simultaneous players in single (existing) game with Unity3d I have created a turn based multiplayer game (with Unity3d) in which three teams battle to finish constructing a cake before one another. The game mostly targets on entertaining kids at certain venues. It is free and is only running from time to time (it isn't online and does not run 24/7 like what we normally see).

The game consists of a few round that have two phases. Phase one asks for the joystick apps to enter their strategies (units to invest in construction and/or defense and/or attack) and send them to the server. This phase lasts for 30 seconds after which the second phase kicks in. Phase two is the MainGame talking to the server, getting all compiled strategies and rendering them on to the screen. The rounds follow one another until one of the teams finishes its cake. Kids love it!

The setup is rather easy. Players use a joystick App that they install on their iOS device enabling them to send strategies to the server. The MainGame is responsible of rendering the compiled strategies on to the screen. In between the Joystick Apps and the MainGame App is the server that glues everything up and manages the states of the game. The server currently runs on a free PlayerIO account that supports 45 players to be connected at the same time (actually 44 since one of the instance is the MainGame who does the rendering). When the game reaches its full capacity, all 44 joystick apps and my 1 MainGame app are connected to one single room. Everything works fine!

I now have this new client who wants me to boost the game so it can handle something between 1000 and 3000 players simultaneously. With you knowing this, here are my questions:

Should I stay with PlayerIO for my new and boosted version?
Is it just a matter of getting a bigger server? Can I still have one
single room with 3000 players joining it? If not, how should I handle
the weight?
How many players can normally connect to a single room (keeping in
mind I am looking for a way to connect as many people in a single
game at once… Not many games at once)? What’s the rules of thumb?
Being that the game will only be running a third of the time every
month (when my client’s starts it), how much can I expect to pay in
backend fees? (I really have a hard time knowing how much PlayerIO is
going to charge me with its new pricing).

Thanks in advance for your help!

sentences:
Stop animation from playing while waiting to destroy object I'm working on functionality in Unity where if a game object's health is zero, it does and the object is destroyed.  This works fine as is, I reduce the health to zero, the die animation plays and the game object is destroyed.  I want to have the script wait a certain amount of time and then run the destroy method.  I thought using WaitForSeconds() would do the trick, and technically, it does, but the death animation continues to play until the object is destroyed.  My question is, how do I get the animation to stop playing as the script waits to destroy the object?

C#

void Die(){
    GetComponent<Animation>().CrossFade(die.name);
    //If the current animation time is greater than 90% of the entire animation length, destroy the object.
    if(GetComponent<Animation>()[die.name].time > GetComponent<Animation>()[die.name].length * 0.9){
        StartCoroutine(RemoveBody());
    }
}

IEnumerator RemoveBody(){
    yield return new WaitForSeconds(5);
    Destroy(gameObject);
}

sentences:
Directional and orientation problem I have drawn 5 tentacles which are shown in red. I have drew those tentacles on a 2D Circle, and positioned them on 5 vertices of the that circle. BTW, The circle is never be drawn, I have used it to simplify the problem. Now I wanted to attached that circle with tentacles underneath the jellyfish. There is a problem with the current code but I don't know what is it.

You can see that the circle is parallel to the base of the jelly fish. I want it to be shifted so that it be inside the jelly fish. but I don't know how. I tried to multiply the direction vector to extend it but that didn't work.

// One tentacle is constructed from nodes
// Get the direction of the first tentacle's node 0 to node 39 of that tentacle;
   Vec3f dir = m_tentacle[0]->geNodesPos()[0] -  m_tentacle[0]->geNodesPos()[39];

    // Draw the circle with tentacles on it

    Vec3f pos = m_SpherePos;

    drawCircle(pos,dir,30,m_tentacle.size());

    for (int i=0; i<m_tentacle.size(); i++)
    {
        m_tentacle[i]->Draw();

    }

 // Draw the jelly fish, and orient it on the 2D Circle
    gl::pushMatrices();
    Quatf q;
    // assign quaternion to rotate the jelly fish around the tentacles
    q.set(Vec3f(0,-1,0),Vec3f(dir.x,dir.y,dir.z));
    // tanslate it to the position of the whole creature per every frame
    gl::translate(m_SpherePos.x,m_SpherePos.y,m_SpherePos.z);
    gl::rotate(q);

    // draw the jelly fish at center 0,0,0
    drawHemiSphere(Vec3f(0,0,0),m_iRadius,90);

    gl::popMatrices();

sentences:
Huge procedurally generated subway transit map How could I generate a single transit map image
, which is not based on any real map, on a massive scale? Are there algorithms or tools which could do something like this already?

  Unlike conventional maps, transit maps are usually not geographically accurate—instead they use straight lines and fixed angles, and often illustrate a fixed distance between stations, compressing those in the outer area of the system and expanding those close to the center.

The scale I'm looking for is earth-like. If a line ran horizontally across it could have 40,075 stations kind of map. Ideally, It should also wrap around, like on a sphere.

I want it to look just like any local transit map (I'm basing myself on the Montreal metro map) which means I don't care about what a metro system of this scale should look like or how useless this would be.

So far, the research

Nathan Hellinga's Processing.py subway map generator resembles what I'm looking for and looks great but the algorithm wouldn't scale well to a very large grid.
Jannis Redmann's generating transit map theory is really interesting but bases itself on real world data. Maybe it could be used with generated data but how do you generate that data then?
Fractal generators! But how do I make it look like a transit map?
With Graphviz, I would still need an algorithm to generate data.
Slime is a really interesting idea! But how do you procedurally generate that?
Wave function collapse algorithm!!
Generating a random heightmap, making a graph out of it, and then making it pretty
My idea, a random walker.
You all know what this is, I just don't think that's the best option there is.

sentences:
Input.GetAxis("Horizontal") not updating I'm having trouble with Unity's basic character controlling. After i implemented the crouching in the code below the Input.GetAxis("Horizontal") does not update (while the left control is pressed (crouching), Input.GetAxis("Horizontal") is always set to zero even if left or right arrows are pressed.

The reason why this happens is not because of keyboard buffer etc. because horizontal input is working while jumping, which is implemented pretty much the same way the crouching is implemented in the code below. Btw. no root motion is used. Here's the code:

void HandleInput()
{
    currentBaseState = animator.GetCurrentAnimatorStateInfo(0);

    var deadZone = 0.1f;

    verticalVelocity = moveVector.y;
    moveVector = Vector3.zero;

    // print for testing
    print(Input.GetAxis("Horizontal"));

    if (Input.GetAxis("Horizontal") > deadZone || Input.GetAxis("Horizontal") < -deadZone)
    {
        yRotation += Input.GetAxis("Horizontal");
        animator.SetFloat("Direction", Input.GetAxis("Horizontal"));
    }

    if (Input.GetAxis ("Vertical") > deadZone)
    {
        speed += 0.1f;
        moveVector += new Vector3 (0, 0, Input.GetAxis ("Vertical") + speed);
    }
    else if(Input.GetAxis ("Vertical") < -deadZone)
    {
        if(speed >= 0)
            speed -= 0.1f;
        else
            speed += 0.1f;
        moveVector += new Vector3 (0, 0, Input.GetAxis ("Vertical") + speed);
    }
    else
    {
        moveVector += new Vector3(0, 0, Input.GetAxis ("Vertical") + previousSpeed);
        if(speed > 0)
            speed -= 0.1f;
    }

    animator.SetFloat ("Speed", Input.GetAxis ("Vertical"));

    totalRotation = yRotation * rotationMultiplier;

    transform.eulerAngles = new Vector3(0, totalRotation, 0);

    moveVector = transform.TransformDirection(moveVector);

    if (moveVector.magnitude > 1)
        moveVector = Vector3.Normalize(moveVector);

    Physics.Raycast (gameObject.transform.position, Vector3.down, out hitInfo, 0.5f);
    if(hitInfo.distance < 0.5f)
    {
        if (enableJump)
        {
            if (Input.GetButtonDown("Jump"))
            {
                animator.SetBool("Jump", true);
                verticalVelocity = jumpSpeed;
                skillSlider.value -= 1f;
                if(skillSlider.value == 0f){
                    enableJump = false;
                    bunnyImage.gameObject.SetActive(false);
                    skillSlider.gameObject.SetActive(false);
                }
            }
        }
    }

    if (Input.GetButtonDown ("Crouch")) {
        animator.SetBool ("Crouch", true);
        crouching = true;
    }

    if (Input.GetButtonUp("Crouch")) {
        crouching = false;
    }

    if (currentBaseState.fullPathHash == crouchState) {
        if(!animator.IsInTransition(0)){
            if(!crouching)
                animator.SetBool("Crouch", false);
        }
    }

    if (currentBaseState.fullPathHash == jumpState) {
        if (!animator.IsInTransition(0)) {
            animator.SetBool("Jump", false);
        }
    }

    previousSpeed = speed;

    moveVector = new Vector3(moveVector.x, verticalVelocity, moveVector.z);

    if (moveVector.y > -terminalVelocity)
        moveVector = new Vector3(moveVector.x, moveVector.y - gravity * Time.deltaTime, moveVector.z);

    if (characterController.isGrounded && moveVector.y < -1)
        moveVector = new Vector3(moveVector.x, -1, moveVector.z);

    characterController.Move(moveVector * Time.deltaTime);

}

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 can I add a batch of sprites to a list in Unity's inspector? I have a C# script with a public property:

List<Sprite> someSprites;

I would like to add 20 sprites to it, from the inspector window. However, it seems like the only way to do so is to drag one by one. Is there a simpler way to batch fill lists in Unity?

sentences:
Does destroying object at List element make it null? I'm using a list in Unity and I'm adding objects to it as they are collected through the game. But they will then be used and destroyed. My first question is do I use Destroy(), or should I just use List.Remove()? I'm not sure what happens to an object once it is removed from a list and not used anymore. Does garbage collection get it? My other question is, when I check the list (I will always be checking the first index), if that object was just destroyed or removed, will that element now be null? I've tried reading about this but it's hard to find an exact answer. Thanks for the help.

For reference, here is the code that I came up with based on my current assumptions about lists:

public List<BasePickUp> pickUpQueue = new List<BasePickUp>();
public bool pickUpActive = false;

void Update ()
{
    if (pickUpQueue[0] != null && !pickUpActive)
    {
        pickUpActive = true;
        pickUpQueue[0].ActivatePickUp();
    }
}

Edit: I have been playing with the if statement conditions, and even if I change pickUpActive to true, it somehow still manages to get inside the if statement to the breakpoint there. How is that possible? The condition says pickUpActive must be false, and yet it blows right by it. When I set the first condition to pickUpQueue != null, I get an error for index out of range once, when it is set to check the first element, as it is in the above code, I get an index out of range every frame. I finally changed it to pickUpQueue.Count != 0, and that finally kept it from getting into the if statement. If anyone can help me understand what is going on with my bool, and to understand exactly how to handle this list, I would greatly appreciate it! Thanks!

sentences: if a desktop machine supports OpenGL 3.0+ I can assume that it supports OpenGL ES 2.0 too? This isn't clear for me, if i use the drivers from the GPU manufacturer and they support OpenGL 3.0 and/or above, i can always make an OpenGL ES 2.0 application work?

sentences:
Procedural Turn Based Puzzle Generation? Alright, we have a large set of possible moves (what the player is allowed to do). We also have a well defined state of success that defines the desired goal.
We want to generate a configuration where for the purpose of this question, only 1 set of moves leads to a victory within k steps. We also have a solver that can find all possible solutions for a given configuration problem.

For example let's take Chess, how would you place a set of chess pieces on a board such that only a specific set of moves by White will result in Check Mate?

sentences:
Update function - design patterns I started reading about game development design patterns and from my experience there are 2 options for update methods. The first one receive from the game loop and delta time of this update and multiple everything by it, for example position += speed * delta_time. And this will happen in the game loop without delay.

The second option is too set constant frame delay and use it. In the end of the loop function you use sleep(last_frame_time + frame_length - current_time).

Does it matter what do I use? What's more common? I know unity use the delta time technique but it's the only one I saw that use it. I would like to hear your opinions on what to use for both options.

Should I always use the first option? always the second?

Thank you for your time.

sentences:
Camera.unproject(Vector3) method is not working in libGdx I know the touch postioning in libGdx uses OpenGL, making 0,0 the bottom left corner while the camera uses the top left corner as 0,0. I did some searching and found this SO question that specifies that I need to use the Camera.unoroject(Vector3) method. This is the relevant code:

package com.mycompany.mygame;

import com.badlogic.gdx.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.math.*;

public class MyGdxGame implements ApplicationListener
{
    public float x;
    public float y;
    public float w = 50;
    public float h = 50;

    Texture texture;
    SpriteBatch batch;
    OrthographicCamera cam;

    @Override
    public void create()
    {
        texture = new Texture(Gdx.files.internal("android.jpg"));
        batch = new SpriteBatch();
        cam = new OrthographicCamera();

        //x = 50;
        //y = 50;
    }

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

        if(Gdx.input.isTouched()){
            Vector3 touchPos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
            cam.unproject(touchPos);
            batch.draw(texture, touchPos.x, touchPos.y, w, h);
        }
        batch.end();
    }

    @Override
    public void dispose()
    {
    }

    @Override
    public void resize(int width, int height)
    {
    }

    @Override
    public void pause()
    {
    }

    @Override
    public void resume()
    {
    }
}

The problem is the game is not drawing correctly. It should draw the character at the touchPos.x and touchPos.y coordinates, but it is not. It is drawing in the bottom left corner. See the pictures below:

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:
Random Sobol 3D Cell in Unity There is a blueprint in UE4 for making Sobol random 3D cell. It places random objects inside cell structure.
How to make this in Unity?

For example, if I make a sphere prefab I would need to generate Sobol distribution in some volume.

EDIT:

@Seyed Morteza Kamali have made a script:

sentences:
What defines a minigame? A "minigame" (sometimes mini-game) is a rather common term used in game design and the general game industry. Therefore it has a definable scope, that is not opinion based, but rather established and tangible. However, I'm at a loss to define its scope. The wikipedia page says:

  "A minigame (also spelled mini-game or mini game and sometimes called
  a subgame) is a short video game often contained within another video
  game and sometimes in application software or on a display of any form
  of hardware. A minigame is always smaller or more simplistic than the
  game in which it is contained. Minigames are sometimes also offered
  separately for free to promote the main game. For instance, the
  Pokémon Stadium minigames involve merely pressing a few buttons at
  specific intervals, with little complexity."

When asked to define it, I guess loosely I'd consider a minigame any game that:

could easily be a self-contained game within another one
that usually shows all the information on the screen
could have been produced in the "dawning of gaming" (At least its mechanics)
that the average (perhaps even non-gamer) can sit down and instantly
understand nearly all the game rules without having to "learn" them via
play.

Some things to think about:

Is Game_B that has been included in another game, Game_A, still
a minigame if it is later played or released independently from
Game_A?
What if Game_B was originally independent, but Game_B (or
clones) are now almost exclusively found as minigames within other
games? Will Game_B always be a minigame after that?
Is pong a minigame - it most certainly has been a minigame?
Likewise, is chess a minigame (it matches my personal definition
despite being incredibly complex logically)?

(I don't know if I can link pictures here, otherwise I would add some examples.)

Answers should please be constructive and professional. Good answers should also give reasoning and cite sources when possible.

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: FindWithTag returning a game object from "Preview Scene". What is that and why is it not detecting from the active scene? I have a script that fetches a transform using GameObject.FindWithTag("Tag").GetComponent<Transform>();. This has worked fine for a long time, but now it retrieves a transform from a preview scene(whatever that is). How do I prevent it from looking at preview scene?

sentences:
How can I measure the weight in Farseer? I have two different objects(star and rectangle) and I want to measure the entire weight that lies on the balance. How can I do that? Is it possible to know the entire weight that presses on the balance?

The rectangle is lying on the star, it is not possible to lie the rectangle on the balance.
You can see the balance in this picture:

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:
Compressing game save data I'm writing a game that needs to save a lot of detailed data (exact trajectories of some entities) to an external file. I want to save drive space and bandwidth by compressing it, but I've never done this, so I don't know if there is a preferred way to do it.

Of course the compression-decompression should not affect the speed of the game too much.

sentences:
Why is my Unity camera chasing player script running slow? I have a camera class, that is suppose to chase my player, which works, but its really really slow. It only has this line of code, which makes sense to me, player moves, camera moves.  Any idea of why my game runs slower.

void Update()
{
    transform.position= new Vector3(player.transform.position.x, player.transform.position.y, -10);
}

sentences:
Why Godot over Cryengine, UE4, Armory3d or Unity3d? Godot have a low performance in linux systems and lack of functionalities? This appear not been in account when peoples vote for him over other engines and i wonther whi.
I know it is under MIT lisence, but the others engines have a very permisive licences and in some cases they help you with funding for your games.
I ask this because i have maded survey on google plus about a selection of engines, and people still bote for godot over other engines. I want to select an engine for my future games, and when i compared, godot's not get a good place.

sentences:
How can I simplify this code to compute the shortest rotation between two angles? The following code will find the shortest rotation (in radians) (from pi to -pi) that I need to apply to from to leave me with to.

Scalar rotationBetween(Scalar from, Scalar to)
{
    Scalar fromMod = std::signbit(from) ?
        pi * 2 + std::fmod(from, pi * 2) : std::fmod(from, pi * 2);
    Scalar toMod = std::signbit(to) ?
        pi * 2 + std::fmod(to, pi * 2) : std::fmod(to, pi * 2);

    Scalar rotation = toMod - fromMod;

    if(rotation > pi)
        return rotation - 2 * pi;
    else if(rotation < -pi)
        return 2 * pi + rotation;
    else
        return rotation;
}

Scalar is a c++ float.

Can I simplify this? I feel like this is far too much logic to do something so simple.

sentences:
SFML drawing Tiles low fps int main()
{
sf::RenderWindow window(sf::VideoMode(800, 800), "SFML works!");
sf::VertexArray Tquad(sf::Quads, 40*40*4);
int size{ 20 };
int width{ 40 };
for (int x = 0; x < width; x++)
{
    for (int y = 0; y < width; y++)
    {
        sf::Vertex* quad = &Tquad[(x + y * width) * 4];
        quad[0].position = sf::Vector2f(x, y);
        quad[1].position = sf::Vector2f((x+1)*size, y);
        quad[2].position = sf::Vector2f((x+1)*size, (y+1)*size);
        quad[3].position = sf::Vector2f(x, (y+1)*size);
    }
}

while (window.isOpen())
{
    sf::Event event;

    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();
    }

    window.clear();
    window.draw(Tquad);
    window.display();
}

return 0;

}

Hello , im getting very low fps with only 40x40 tiles, in release mode i get 21 fps. If i disable the window.draw i get 2000+- fps.

sentences: What revenue models exist for online games? What revenue models exist for online games?

sentences:
How can I refer to Android assets in other directories? My project was initially not meant for Android, and its assets are organised along the following directory structure (I hope the ASCII art renders reasonably well):

/
+- engine/
 |    +- src/
 |     |      enginefile1.cpp
 |     |      ...
 |     `- textures/
 |            texture1.tex
 |            ...
+- game/
 |    +- src/
 |     |      gamefile1.cpp
 |     |      ...
 |    +- textures/
 |     |      gametexture1.tex
 |     |      ...
 |    +- ios/
 |     |      [various iOS-specific files]
 |     `- android/
 |           | build.xml
 |           | AndroidManifest.xml
 |           +- jni/
 |           |     Android.mk
 |           +- assets/
 |             [other Android-specific files]
 `- othergame/

My game/android/jni directory is almost empty because Android.mk points to the relative paths of the source files in engine/src and game/src. Actually, it even includes the proper Makefiles so that I never have to modify Android.mk when I add or remove a source file to the project.

Both engine and game provide assets that need to be shipped with the Android build. I would like build.xml to refer to these assets without having to manually copy them. A rule that copies the assets at build time then deletes them would be acceptable, but of course I would prefer a zero copy solution. Does this make sense? How did others solve this cross-platform build problem?

sentences:
tiled map - changing textures? (XNA HLSL) I have successfully created a tiled map of various textures. Right now, i had a Vector4 in my own custom Vertex declaration deciding what texture each of the tiles should be. This is working perfectly. I can have any of my four tiles on the map, and any combination of them.

However, i would like to start having the tiles change, yet i do not know how to change this Vector4 of the vertices. They have been added to a vertex buffer if that helps you answer the questions.

sentences:
Laser Beam End Points Problems I am building a game in XNA that features colored laser beams in 3D space.

The beams are defined as:

Segment start position
Segment end position
Line width

For rendering, I am using 3 quads:

Start point billboard
End point billboard
Middle section quad whose forward vector is the slope of the line and whose normal points to the camera

The problem is that using additive blending, the end points and middle section overlap, which looks quite jarring. However, I need the endpoints in case the laser is pointing towards the camera!

See the blue laser in particular:

sentences:
How should I store trading cards? I'm working on a Magic-esque TCG in Unity. Currently, the cards themselves are all prefabs: I have a Satyr Archer prefab, a Candle Wisp prefab, etc. This works fine for now, since I only have a few cards, but by the time I get to several hundred, I feel that this may become unwieldy.

Are prefabs a good way to store a large list of cards? Should I be making those prefabs using an XML document and a script?

sentences:
How to implement 'Fog of War' in SpriteKit or Cocos2D? Take a look at the image below from the game Warcraft 2. There's a darkened area (like a fog) that represents the limits of the 'field of view' -- to the effect that you would not see any enemy characters in the fog.

How would you implement this 'fog' in iOS (SpriteKit, Cocos2d, etc)? Mostly interested in hearing high-level strategies on implementing the fog itself -- within the node-based hierarchy of something like SpriteKit or Cocos2d.

And bonus: what do people call this 'fog' in the game industry?

[Update] 'Fog of War' (thanks @Jon)

sentences:
Calculating vertex normals in OpenGL C++ Does anyone knows a simple solution for calculating vertex normals? I've been looking for this on the internet but i cant find a simple solution, for example, if I have some vertices like this:

GLfloat vertices[] =
{
 0.5f,  0.5f, 0.0f,  // Top Right
 0.5f, -0.5f, 0.0f,  // Bottom Right
-0.5f, -0.5f, 0.0f,  // Bottom Left
-0.5f,  0.5f, 0.0f   // Top Left
};

sentences:
HTML Canvas drawing - Firefox error I am getting the following error ONLY when running my game in Firefox (3.6)

  Component returned failure code:
  0x80040111 (NS_ERROR_NOT_AVAILABLE)
  [nsIDOMCanvasRenderingContext2D.drawImage]

The issue does not occur in the other major browsers, and my game runs completely fine after I click 'OK.'

Here are a few snippets of code where I have localized the issue to.  Has anybody seen this issue before?  According to Google it has something to do with drawing the image before it is loaded, but from my understanding I am loading it properly before using it!.

player class

var player = new (function(){
  var that = this;
  that.image = new Image();
  that.image.src = "res/enemy1_sprites.png";
  that.width = 16;
  that.height = 16;
  that.frames = 2;
  that.actualFrame = 0;
  that.spriteXoffset = 0;
  that.spriteYoffset = 0;
  that.moved = false;
  that.boundary = false;
  that.num_balls = 5;
  that.rootX = 350;
  that.rootY = 250;
  that.ballX = [that.rootX,0,0,0,0];
  that.ballY = [that.rootY,that.rootY,that.rootY,that.rootY,that.rootY];

  that.directions = {"up":0, "right":1, "down":2, "left":3};
  that.dirs  = [that.directions.right,that.directions.right,that.directions.right,that.directions.right,that.directions.right];

  for (i = 1; i < that.num_balls; i++)
    that.ballX[i] = that.rootX - (i * that.width);

...
...

that.draw = function(){
    try {
      for (var i = that.num_balls-1; i >= 0; i--)
      {
        // update animation
        switch (that.dirs[i])
        {
          case that.directions.left:
            that.moveLeft();
          break;
          case that.directions.right:
            that.moveRight();
          break;
          case that.directions.up:
            that.moveUp();
          break;
          case that.directions.down:
            that.moveDown();
          break;
        }
        ctx.drawImage(that.image, that.spriteXoffset, that.spriteYoffset, that.width, that.height, that.ballX[i], that.ballY[i], that.width, that.height);
      }
    }
    catch (e) {
      alert(e.message);
    };

    if (that.moved)
    {
      if (that.spriteYoffset > 0)
        that.spriteYoffset = 0;
      else
        that.spriteYoffset += 16;
      that.moved = false;
    }
  }
})();

game loop

 var GameLoop = function(){
    ..
    ..
     player.move();
     player.draw();
    ..
    ..
      if (state)
        gLoop = setTimeout(GameLoop, GAME_SPEED);
    }

sentences:
Unity OnControllerColliderHit triggered multiple times in one frame private void Update()
{
     Debug.Log("### " + CollisionFlags);
     CollisionFlags = CharacterController.Move(moveAmount);
}

private void OnControllerColliderHit(ControllerColliderHit hit)
{
    Debug.Log("### OnControllerColliderHit " + hit.gameObject.name);
}

the characterController is heading down to plane and
I called characterController move function in update() and i expect the result is like
"None"
"OnControllerColliderHit Cube (2)"
"Below"
"OnControllerColliderHit Cube (2)"
but result is
"None"
"OnControllerColliderHit Cube (2)"
"OnControllerColliderHit Cube (2)"
"OnControllerColliderHit Cube (2)"
"OnControllerColliderHit Cube (2)"
... 12 times.
"Below"
Why OnControllerColliderHit triggered 12 times in one frame?

sentences:
Change the min width/height of a LayoutElement to scale with the screen size I want to change the Min Width and Min Height configured in my LayoutElement so that they scale proportionate to the screen size.
For example, at a screen resolution of 1920x1080, the min width is 300. Then if I reduce my screen size to 1280x720 (one-third smaller), then the min width should become 200.

How can I do this?

sentences:
How to use GLM Simd using GLM version 0.9.8.2? I am new user for GLM, can somebody guide me how to use GLM SIMD using its version 0.9.8.2.

According to its Manual using #define GLM_FORCE_SSE2

For example, if I write:

#define GLM_FORCE_SSE2

#ifdef GLM_FORCE_SSE2

glm::vec3 v(1.0f);

#endif

I am unable to notice any difference if I write this now:

glm::vec3 v(1.0f);

unlike older version of GLM where I can use different function like

#include <GLM\GTX\simd_mat4.hpp>
glm::detail::fvec4SIMD v(1.0f); //for simd
glm::vec3 v(1.0f); //for non simd

but with version 0.9.8.2 I am confused.

sentences:
How to force a sub-optimal path I'm currently trying to develop a "Taxi-Driver" AI that intentionally makes sub-optimal pathing decisions. I need to have my driver go from point A to point B using a sub-optimal but still logical path. "Logical" in this case isn't a well-defined condition per-se but it is instead defined as a path that would make sense to a passenger (player).

Here's an example where

Green = Optimal
Red = Suboptimal but "logical"
Blue = Suboptimal but "illogical"

I'm currently using A* so I tried modifying node weights but I couldn't find a way to come up with a logical value for the weight. I've also tried to sometimes pick a random open node (in the right direction) instead of calculating the closest node. However this (understandably) made the pathing look even more illogical.

If it can be done I'd like an A* solution but I'm open to other solutions as well (even non-pathfinding solutions!). It is fine if a solution doesn't always give a sub-optimal path for certain conditions (e.g. only one path possible; all paths are the same length etc).

sentences:
transform.Rotate with z clamped to 0 I have a virtual joystick to rotate the player and this piece of code works nice and smooth for the rotation of the players view.

public void rotatePlayer(Vector3 newPosition){
  transform.Rotate(new Vector3(-newPosition.y,newPosition.x,0)*Time.deltaTime);
}

I pass a Vector3 with the position of the joystick in relation of his parrent's(the joystick border) anchor.That gives me the rotation direction.Which means that if I set the rotation of the camera direclty it will just flip to that point and not move progresively to that point.

Even though z is set to 0 in the vector3, it changes the z axis angle of the camera. How can I clamp it to 0 without using many resources?

I tried other methods but they just switch the camera's rotation directly when the joystick is touched like I already said.Flip and stop.

I guess I could just set the z axis rotation to 0 every time but that just seems like double work.

sentences:
Using movie names in a game I am working out a concept of a game where I want to refer to movies. However, I am unsure if I can just refer to the real movie titles in the game or if I should change them slightly so that it becomes a parody of the movie for liablility / copyright reasons.

I know it is a bit on the risky side when you are using brands etc, but can I be held acountable for indirect damage to the sales of their movie?

Does this change when I use an API from a website (f.e. imdb / TheMovieDatabase)?

sentences:
How can I keep the drawn lines instead deleting them? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DrawLines : MonoBehaviour
{
    private Transform startMarker, endMarker;
    public GameObject[] waypoints;
    private float speed = 2f;
    private float startTime = 0f;
    private float journeyLength = 1f;
    private int currentStartPoint = 0;
    private LineRenderer lineRenderer;

    public void StartInit()
    {
        currentStartPoint = 0;
        SetPoints();
        lineRenderer = GetComponent<LineRenderer>();
        lineRenderer.startWidth = 0.2f;
        lineRenderer.endWidth = 0.2f;
    }
    void SetPoints()
    {
        startMarker = waypoints[currentStartPoint].transform;
        endMarker = waypoints[currentStartPoint + 1].transform;
        startTime = Time.time;
        journeyLength = Vector3.Distance(startMarker.position, endMarker.position);
    }
    void Update()
    {
        if (waypoints.Length > 0)
        {
            float distCovered = (Time.time - startTime) * speed;
            float fracJourney = distCovered / journeyLength;
            Vector3 startPosition = startMarker.position;
            Vector3 endPosition = Vector3.Lerp(startMarker.position, endMarker.position, fracJourney);
            lineRenderer.SetPosition(0, startPosition);
            lineRenderer.SetPosition(1, endPosition);
            if (fracJourney >= 1f)
            {
                if (currentStartPoint + 2 < waypoints.Length)
                {
                    currentStartPoint++;
                    SetPoints();
                }
                else
                {
                    //if finished, disable lineRenderer and this script
                    lineRenderer.enabled = false;
                    this.enabled = false;
                }
            }
        }
    }
}

Each time it's drawing a line between two waypoints but then the line is deleted and then it's drawing a new line between the next two waypoints.

Instead I want it to draw one line between all the waypoints. And to keep the line in the end not to delete it.

sentences:
Attribute ownership in Entity Component systems How do you typically handle data ownership in these systems?

Right now I just have a map that maps type(std::string or hashed int)->void* where outside sources can add attributes via a simple AddAttribute method.

Right now I'm having the problem of where and how to delete some of that data, since some of it is added via outside sources (e.g. reference to another entity) and some of it is legitimate data of the entity that contains it (e.g. health attribute).

The most obvious solution would be to simply use shared pointers, but somehow I'm worried that their overhead will become noticeable when I have a lot of entities (see https://stackoverflow.com/questions/3628081/shared-ptr-horrible-speed).

Another solution that I could come up with was to first use two distinct methods: "AddAttributeExternal" and "AddAttributeInternal" (or something similar, naming is irrelevant) where the attribute would only delete data that was added via the second. But I would like to avoid this since it introduces duplicate code and can probably be error prone when you introduce a lot of changing data.

Are there better/more optimized solutions or do I need to change the way I think about entity data altogether?

sentences:
3d Wall sliding collision I'm working on collision for walls in my game and the way I currently have it I get stuck walking into a wall. I'm trying to make my character slide on the walls but still collide.

My character moves off of a vector I create using the angle he is facing.

this is my collision function:

    private static bool CheckForCollisions(ref Crate c1, ref Player c2,bool direction)
    {
        for (int i = 0; i < c1.model.Meshes.Count; i++)
        {
            // Check whether the bounding boxes of the two cubes intersect.
            BoundingSphere c1BoundingSphere = c1.model.Meshes[i].BoundingSphere;
            c1BoundingSphere.Center += c1.position + new Vector3(2, 0, 2);
            c1BoundingSphere.Radius = c1BoundingSphere.Radius / 1.5f;

            for (int j = 0; j < c2.model.Meshes.Count; j++)
            {
                BoundingSphere c2BoundingSphere = c2.model.Meshes[j].BoundingSphere;
                if (direction)
                    c2BoundingSphere.Center += c2.position + new Vector3(c2.getPlannedDirection().X, 0, 0);
                else if (!direction)
                    c2BoundingSphere.Center += c2.position + new Vector3(0, 0, c2.getPlannedDirection().Y);
                //c2BoundingSphere.Center += c2.position;

                if (c1BoundingSphere.Intersects(c2BoundingSphere))
                {
                    return true;
                }
            }
        }
        return false;
    }

This is my update:

for (int x = 0; x <= 29; x++)
        {
            for (int y = 0; y <= 29; y++)
            {
                if (crate[x, y].getType() == 11 && collisionEnabled)
                {
                    if (CheckForCollisions(ref crate[x, y], ref player,true))
                    {
                        player.clearPlannedDirectionX();
                        //Console.Write(player.getPosition().X + "," + player.getPosition().Y + "," + player.getPosition().Z);
                        //movePlayer = false;
                    }
                    if (CheckForCollisions(ref crate[x, y], ref player,false))
                    {
                        player.clearPlannedDirectionZ();
                        //Console.Write(player.getPosition().X + "," + player.getPosition().Y + "," + player.getPosition().Z);
                        //movePlayer = false;
                    }
                }
            }
        }

sentences:
How to send data from compute shader to vertex shader I have some shaders, every shader has the same constant buffer,

//-----------------------
//constant buffer
//---------------------
cbuffer cbPerFrame : register(b0)
{
    float3 gEyePosW;
    float4x4 gView;
    float4x4 gProj;
    float gDim;
    float3 gVoxelOffset;
    float gVoxelSize;
};

I think it's a waste to send these same constant buffer several times, so I want to pack them in one Constant Buffer, and share them to other vertex shaders.

I have tried send constant buffer to compute shader, but they don't work in vertex shader.

Do I need to pack these data in one structured buffer? Is it faster than send constant buffer several times?

Is deferred shading relevant to this problem? Which solution do we usually use to solve this problem?

sentences:
Unity Collaborate Error: "It looks like you don't have any data yet" On the Unity Developer page, my partner has added me to his team. I can see his project. I clicked Go to Collaborate:

That brings me to the "Assets" tab, saying "It looks like you don't have any data yet."

Clicking on the provided link just brings me back to the main page, where no detailed instructions can be found.

Has anyone successfully used the new "Unity Collaborate" feature yet?

sentences:
The number of shaders a large game or game engine has Wondering the scale basically. The number of shaders a large game or game engine has. I've seen some metal repos but they typically just have 1 or 2 shaders for small demos. I think I've seen a few with 5 or 10, 1 with maybe 20. But I haven't seen anything where there is like 100 or 1,000 shaders or anything like that.

Wondering what the scale is like for typical large games or game engines, if they are on the order of 1-10, or 100, or 1000, sorta thing. And if it's a large number, maybe a quick idea of what the various tasks they are used for would be interesting but not required :). Thank you!

sentences:
Process for Creating Imposters (For Unity) I'm still working on making a sports stadium with crowd etc. I've been reading a lot about 'Imposters' and 'Billboarding'. I want to explore and learn the imposters technique.
But I am stuck at step 1 :|
I have a stadium model made which is empty (no seats or people).
All I want at the moment is seats. I have the model made in Maya for a seat.

Do I need to make (and import to Unity) both a low-poly and high-poly version of the model.
How exactly is an 'imposter' asset stored in data (specifically if used in Unity)?
Do I need to make 2d images/textures of many angles of the seat?

I do have more questions, but these may be enough to get me started.
Thanks as always for any help.

sentences:
Game Engine Design – Ubershader - Shader management design I want to implement a flexible Ubershader system, with deferred shading. My current idea is to create shaders out of modules, which deal with certain features, such as FlatTexture, BumpTexture, Displacement Mapping, etc. There are also little modules which decode color, do tone mapping, etc. This has the advantage that I can replace certain types of modules if the GPU doesn't support them, so I can adapt to the current GPU capabilities. I am not sure if this design is good. I fear I could make a bad design choice, now, and later pay for it.

My question is where do I find resources, examples, articles about how to implement a shader management system effectively? Does anyone know how the big game engines do this?

sentences: Is there an SDK to write console apps to simulate an Xbox 360 controller? Is there any SDK I can use to write a console app that can connect to an Xbox 360 as a controller and simulate controller interaction?

sentences:
In Unity, can I load a local (/Resources folder) website to safari on an ipad In Unity, can I load a local (/Resources folder) website to safari on an ipad?
This works fine on a Mac, opening up a wepage from my Resources folder.

string path = "file://"+(Application.dataPath)+"/Resources/testsite.html";
    void OnGUI(){
        if(GUI.Button(new Rect(20, 20, 100, 100), "site")){
           Application.OpenURL(path);
        }
    }

but when I try to load this on an iPhone or iPad, it doesn't seem to work.
Am I accessing the address incorrectly for iOS using "file://"?
If this is not possible, is there an alternative way I can load a locally stored website on an iOS device?

sentences:
How to sync game tick in peer to peer game? I am making a 2-player iphone action game using a synchronization service (in this case Firebase). The service allows state syncing through the internet, but I have to execute all game logic on the phones.

I've read a bunch of game networking articles, and since I have no server, it seems like if I can get both phones to start the game at "exactly" the same time in realtime, I can adjust everything from there. (Planning on using a "tick" count on each phone, and sending the tick along with actions, then rewinding the simulation if necessary. The phones divide the game into halves to determine authority).

But how do you get remote clients to start a game tick at the same time?? It seems like this would be necessarily in lock step peer-to-peer, and something like it in FPS games.

The strategy I'm using now tries to have one client "guess" the other client's clock time, including ping time. If correct, they both start the game based on the guess (since for that message it was on).

a: sends a.localTime
b: receives message. Returns b.localTime, and dTime(a-b)
a: receives message. Returns a.localTime, and dTime(b-a)
b: receives message. If a.localTime + dTime(b-a) is very close to new b.localTime, send accept message.
b: starts game at: new b.localTime + 1 second
a: receives accept. Starts game at accepted a.localTime + dTime(b-a) + 1s

I made a little number counter thing to go with the tick, and they're just barely off. I can't see how this is possible though, since A "guessed" B's time, they should start at exactly the same time...

See anything wrong with my method? What's an easier way? I'm trying to avoid using a server if possible.

sentences: Get the current time of animation using script Unity3d I want to know the current time of the played animation using script in Unity3d. I tried using currentState.normalizedTime but this time is not the time of the animation, like it's the time of the runtime I think. Any advice please?

sentences:
unity & c# - File.ReadAllLines() vs TextAsset Split('\n') I switched from one approach to the other in my code and I noticed that File.ReadAllLines() has a string length of equal to the alpha-numeric chars in the string, with exception of the last line of the file. I assume that is eol. String.Split('\n') however will result in that extra char for every string in the array, and so only matches ReadAllLines() on the final string. Am I write in assuming its an end of line character that's introduced on every string in the split version? How can I trim these? I don't know of any eol in the special chars. I tried to trim \n and \r but it didn't change the line lengths

--- further clarification as to why I put it here instead of stackoverflow

I am not familiar enough with the workings to be sure. I thought perhaps the results might be due to unity. The File.ReadAllLines() version works on the path to the txt file, the string.Split() version works on the TextAsset.text and the TextAsset is passed through the inspector as reference.

Sorry if I made the wrong decision in posting here!

sentences: How do I render .dae models? I'm building a game for iOS. I'm quite new to OpenGL but what I want is to take a 3D model I have made in Google SketchUp and use it in my 3d game. The problem is I don't know how to proceed. I have built 3d graphics in OpenGL before by specifying the vertices, but the 3D shape I have made is too complex. Is there a way .dae files can be broken down and re-formed as an OpenGL 3D model?

sentences: Sprite sheet or multiple resources When animating for the Android platform is it a better practice to create a sprite sheet with multiple states for each sprite on a single picture or should I instead export individual images for each character/state/etc.? Which option gives me a smaller file size for resources and which is easier for the programmer to animate?

sentences:
OpenGL datatypes conversion overhead In my project, certain data is stored in floating point datatypes (C's native float, double). Before sending the data in a VBO to OpenGL I have to convert this data to GLfloat with some pretty silly code.

float data[DATA_SIZE];
GLfloat *new_data;

new_data = malloc(sizeof(data));
for (i = 0; i < DATA_SIZE; i++)
    new_data[i] = (GLfloat) data[i];

upload_to_gpu(new_data);

free(new_data);

Of course, since I know float is equal to GLfloat on my platform, I can just ignore this but then my code won't be properly platform-independent. I could also store the data in my program in OpenGL native datatypes but this is unacceptable as I don't want to fixate my code only on OpenGL (DirectX or a software renderer are possibilities I don't want to exclude).

How can I solve this? Is the conversion step unavoidable? Or am I obligated to store my geometry in GLfloat's?

sentences:
Custom Content Package for Files I am about to purchase quite a few model packs from a website for prototyping my game. In the contract it states that I must protect them as to prevent the public from gaining access to them.

I remember working with the Valve games, they used .gcf (game content file) that basically was an archive of all the content for each game. They packed in sound/materials/models/maps/etc. I figured it might not be a bad idea to develop something similar to this, and just write a small tool to let me add/remove files from it.

Problem is I really have no idea how to go about starting on something like this. I tried Google but I didn't even know what to search for. If anyone has any ideas, links that might be of use, or anything else I would greatly appreciate it.

sentences:
Developing AI for Zatacka I am trying to develop a stronger AI for the popular game, Zatacka.
The basic aim of the game is to survive the longest. It's like the TRON game, but the characters can only turn smoothly, instead of 90 degree turns.

I am new to game AI. I have the following ideas in mind, but I don't know how they can be implemented.

Collision prediction. If another player is about to come into the same area, then the player should turn around and try to evade.
Hole taking capability. How to detect holes. How to distinguish holes from a normal empty area.
Early detection of a dead end and being able to turn around before its too late. The problem with this how do we determine a dead end, it could be a bit far than our current position. Doing a path finding algorithm and searching for the wall or a player's body might not be efficient enough as this has to be done for each steps.

Are there any standard algorithms for these problems? Can somebody throw some light on how I can approach these problems?

sentences:
What Type of Options should be on the Game Settings Menu? I have seen a post about the main menu options here:
UI: Main Menu options for mobile games. What options should be listed? What do users want to see?

But I want to know what kind of options should/need to be available on the settings screen.

I am making a rather simple 2D game for Android, but really I haven't found many aspects that warrant an options button or a check box besides turning the sound and music on/off.  I was thinking graphics settings but then again, how many apps really need graphics settings besides immersive 3D ones?

sentences:
Saving an interface instance into a Bundle All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle.  When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu (Another custom class) which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen

sentences:
Increasing resolution of a texture? I'm doing some experiments on my own to improve my general skills with HLSL and so forth. In other words, I'm not doing any serious game development, but only looking to expand my knowledge within the field.
I'm trying to figure out how I can increase the resolution of a texture, and multiply it X amount of times.
Consider the following low-resolution picture:

A typical scenario for me would be to scale up this picture 3 times in the shader without interpolation, and draw the new result:

I've been experimenting with a shader that transfers the small picture on to a texture as a variable on the shader. I got that far. Now I just need it to take that texture using tex2D or something else, and scale it up.
How would I do that?

sentences:
Enable IME in a non-windows control I'm writing my own game in DirectX using C#. I'm at the point where I'm implementing my own textbox, written from scratch. It has the very basic functions for now, but works well. I want, however, to be able to input non-English text using Microsoft's IME (such as Japanese or Korean).

I've spent quite a lot of time looking for tutorials and documentations. I found a lot of functions (mainly contained in imm32.dll), but I can't really figure out how to make them work in order to make the input work:

my problem is that I can't use the IME inside my own textbox (contained in the DirectX Window form) as it is disabled. How do I tell the IME that my textbox can get input from keyboard and therefore get the IME enabled? Is there any method I should call?

I already tried stuff like ImmGetContext() and ImmAssociateContext(), using my window form as handle, but with no real results.

sentences:
Where to save enemy positions in C++? I'm wondering how and where to save the positions my enemies should spawn.

My idea was to use a struct such as:

struct enemy{
    int x,y,type;
}

And save an array of it in a .dat with fwrite() but I'm not sure if it's a good idea.

I want to know how it's commonly done. Also I recently asked a question about events and was answered something about scripting languages like Lua, is this related to the enemy positions too? Could I create a file in a scripting language with them?

sentences:
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:
What am I doing wrong, in regards to multi-texture? I am writing a bump mapping demo, so I need an image texture, and a normal texture which should be loaded into the fragment shader.

This is the texture part of my OpenGL code:

glActiveTexture(GL_TEXTURE0);
GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, brick);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLint textureLocation = glGetUniformLocation(shader, "texture");
glUniform1i(textureLocation, 0);

glActiveTexture(GL_TEXTURE1);
GLuint normal_textureID;
glGenTextures(1, &normal_textureID);
glBindTexture(GL_TEXTURE_2D, normal_textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE,
    brick_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLint normalTextureLocation = glGetUniformLocation(shader, "normal_texture");
glUniform1i(normalTextureLocation, 1);

Here is the fragment shader:

uniform vec3 light;
uniform sampler2D texture;
uniform sampler2D normal_texture;

void main() {
    vec3 tex = texture2D(normal_texture, gl_TexCoord[0].st).rgb;
    gl_FragColor = vec4(tex, 1.0);
}

I am sure that the brick array contains the image texture, and the brick_texture array contains the normal texture; but it seems normal_texture and texture are both the image texture, not the normal texture. What am I doing wrong, in regards to multi-texture?

sentences:
Load all content from folder I want to ask, is there way to load in xna all content from folder ?
For example in my content I have:
Images/hero
Images/car
Images/tree

I want to make something like this

Dictionary<string,Model> models = new ...

foreach(string name in content.getNames("Images"))
{
    models[name] = content.load<Model>("Images\\" + name);
}

sentences:
Clearing just the object, not the whole canvas, leaving an uwanted trail I'm working on a platform game via poo.

I heard is more efficient to clear just the object you're drawing instead of clearing the whole canvas. So I'm working on this, and all goes well when the player's velocity player.Xvel has an integer value.

But when I use a floating point value for the velocity, then my object leaves a banded trail behind it, like a barcode of stripes and gaps.

Can you help me identify what's causing this artifact?

var canvas = {};
canvas.obj = document.getElementById('canvas');
canvas.ctx = canvas.obj.getContext('2d');
canvas.width = canvas.obj.width;
canvas.height = canvas.obj.height;

var Object = function() {
  this.draw = function() {
    switch (this.fill) {
      case true:
        canvas.ctx.fillStyle = this.color;
        canvas.ctx.fillRect(this.x, this.y, this.width, this.height);
        break;
      case false:
        canvas.ctx.strokeStyle = this.color;
        canvas.ctx.strokeRect(this.x, this.y, this.width, this.height);
        break;
      default:
        console.log('draw err');
    }
  };
  this.clear = function() {

    var prevCoords = {};
    prevCoords.x = this.x - this.xVel;
    prevCoords.y = this.y - this.yVel;
    // lineWidth:fix
    canvas.ctx.clearRect(prevCoords.x, prevCoords.y, this.width, this.height);
  };
};

var player = new Object();
var game = {};

player.width = 10;
player.height = 50;
player.x = 200;
player.y = 150;
player.xVel = 0.9; // try to change this to integer/float value then run
player.yVel = 0;
player.color = 'white';
player.fill = true;
player.movement = function() {
  this.x += this.xVel;
  this.y += this.yVel;
};

game.key = [];
game.fps = 15;
game.obj = setInterval(function() {
  player.clear();
  player.draw();
  player.movement();

}, 1000 / game.fps);
body {
  background: rgb(110, 110, 110);
  color: rgb(230, 230, 230);
}

canvas {
  background: rgb(60, 60, 60);
}
<canvas id="canvas" width="460" height="360"></canvas>
<form action="">
  <label>Game:</label>
  <input type="button" value="run" onclick="" />
  <input type="button" value="stop" onclick="clearInterval(game.obj);console.log('end');" />
</form>

sentences:
Whats the physics behind the doodle jump game? I'd like to know how we can achieve the doodle jump type physics using andengine.

I mean the character is not colliding with the ground blocks when he moves upwards but will collide when he came downwards and will make a jump from their.

Can it be achieved using the collision filter? If yes how? Is it possible to enable and disable collision filter for particular bodies dynamically?

sentences:
Libgdx: converting between two camera coordinates I had a similar issue to the question here: Why is my text is too large even when scaled to .05f in libGDX?

So I created a second camera for my text elements. I'm rendering the text above some other elements, and under others, so I was trying to map between the two camera's coordinates when rendering.

That seems to be working OK, but I need to invert the y coordinate during the transformation. I'm wondering why that's the case?

Here's the code:

    // Setup camera
    OrthographicCamera camera = new OrthographicCamera(VIEWPORT_UNITS, VIEWPORT_UNITS * (height / width));
    camera.position.set(camera.viewportWidth / 2f, camera.viewportHeight / 2f, 0);

    // Setup text camera
    FitViewport fitViewport = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    fitViewport.apply(true);
    gameContext.setHudViewport(fitViewport);
    OrthographicCamera textCamera = fitViewport.getCamera();

    // ... later, during render(), convert between coordinates
    Vector3 textPosition = new Vector3(fontX, fontY, 0);
    camera.project(textPosition);
    textPosition.y = Gdx.graphics.getHeight() - textPosition.y; // why?
    textCamera.unproject(textPosition);

    font.draw(spriteBatch, text, textPosition.x, textPosition.y);

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:
How can I create a heightmap for ocean surface simulation? I am working on a game that is based on boats fighiting each other. The game is finished but due to some license incopatibilities, I have to change how I simulate the surface of the sea.
What I used until now was a mesh with all the vertices of the sea, and I was setting each vertex's height using FFT (with a library that is the one I can't use). Now I don't have time to port it to another FFT library, so do you know any sine / cosine based formula or any other "easy" method that I can use to compute the height of each vertex which also keeps consistency between frames?
Having the game finished I need to keep some features of the previous implementation like it has to be CPU computed because the sea surface is affecting the boat's rotation.

sentences: 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: Make a decal a physical object? Is there a way in the UE4 to make a decal such as a blood decal and give it a physical object? I want to do it so that I can add a sound affect when the player walks on the physical object, a box trigger wont work as when the player stands on it the sound will keep playing and repeating even if the player isn't moving.

sentences:
Getting user id from one scene then to the next scene I'm new to multiplayer and photon so pardon me if this question is somewhat frequent.

I have successfully set up my project to start from a main menu - waiting room - actual gameplay scene.
However I couldn't search my way through getting a sort of user id from waiting room(ie; order of user joined to waiting room) then use it in the gameplay scene to manipulate sort by score / by hp / etc.

Perhaps I got the while concept of having to identify unique players via such variable? I'm not quite sure. I just got my foot in the multiplayer development realm, so please go easy on me.

// Edit

Sorry for my initial question being quite vague.
Basically, I'm trying to replicate this with Photon.
I've got various things set up but was stuck at where designating individual players to individual player info panels as if captured(Get WHAT to connect to those UI elements I've got set up).

It'd be simple enough even for me if this was a singleplayer, but since it's not I'm also refactoring a lot on the way as well.
Thanks to both of the answers given so far I'm looking into Photon UtilityScripts(To a novice to anything simply directing where to look helps a ton, so thanks again), but since I'm not quite there yet I'll update my progress.

sentences:
Handling game states for Android Currently developing a game for Android. I went through a tutorial to get sprites, loop, etc. up and running, and it all works fine. The way it is currently set up is that Main creates a canvas, the canvas then runs a thread which has the while loop calling update() and display() functions in the canvas class. All of the game code and classes are essentially called from the canvas.

My question is, how do I expand this to include multiple screens/states, like menus, level selection, options, etc?

sentences:
How to Properly Type My Curve's Formula I'm creating an RPG game (using C# in Unity API) that uses a leveling system. I went to the Desomos Online Graphing Calculator and created the following curve representing the levels based on experience: https://www.desmos.com/calculator/bsvkba4qg1. Note that the Y-intercept is at approximately (0, 1).

My Character class has the following fields representing the experience curve from above:

public float experience { get; set; }

public int level {
    get
    {
        float level = experience / 120;
        level += 1.123f;
        level = Mathf.Log(level);
        level *= 20;
        return Mathf.FloorToInt(level);
    }
}

However, when the game begins and experience defaults to 0 as floats do, level returns 2. When experience is 100, level returns 13. Clearly there is some error on my part. Have I entered my formula wrong? If so, how can I fix it, and if not, what else might be the problem?

sentences: Output from vertex shader in D3D9 I've been looking at creating some 2D rendering systems in D3D9, basically because I don't like ID3DXSprite. For the output of the vertex shader, what co-ordinate system does the run-time expect vertex co-ordinates in, like homogenous device co-ordinates? And secondly, does the depth of the resulting vertices have any effect except on the culling/depth buffering? I wanted to "reserve" a section of depth for use in 2D drawing, and then have a section for 3D geometry, to ensure that 3D geometry is always behind 2D.

sentences:
how to implement A Star path finding on 2D map with large tiles The map tiles I have im my game are 64x64 pixels, and the characters are 16x16 pixels. I was reading about A Star path finding and I was wondering if I need my tiles closer to the size of my characters so that the movement given by the path finding seems more natural, or should I set up a different node map of where the characters can move, and use that in the A Star algorithm.

Or if you have a better solution let me know

Thanks!

EDIT: this is the Map class I am using

public class Map extends JComponent{
MapTile[][] map;
Random random;

public Map(char[][] mapKey){
    map = createMap(mapKey);
}

public void update(){

}

@Override
public void paintComponent(Graphics g){
    for(int i = 0; i < map.length; i++){
        for(int j = 0; j < map[0].length; j++){
            drawTile(g, map[i][j].getType(), i * 64, j * 64);
        }
    }
}

private MapTile[][] createMap(char[][] mapKey){
    MapTile[][] temp = new MapTile[mapKey.length][mapKey[0].length];

    for(int i = 0; i < mapKey.length; i++){
        for(int j = 0; j < mapKey[i].length; j++){
            temp[i][j] = new MapTile(mapKey[i][j]);
        }
    }
    return temp;
}
}

really the only thing that the MapTiles hold at this point is a key to the Image they paint on the screen

sentences:
Send push notifications when realtime database change How to send push notifications (status notifications) from one user to another? I mean a user of a unity MOBILE game to another mobile game? Both uses the SAME  game on their mobiles.
Thanks!

sentences: How do I get to ModPE to perform a function the first time a mod is opened? I am making a Minecraft PE mod and I want to set a variable only on the first launch of the mod. So, how do I make it it set the variable and then not set it again until I import the mod again?

sentences:
How can I make a progress bar for EXP in JavaScript? So I am making an incremental game with JavaScript, HTML5, and CSS, I need to have this bar that is essentially a div with a p element in it "fill up" as the player earns more points through sacrifice. All the ways I saw to do this on Google required other CSS code that messed up the spacing and such of my whole page.

Here is a non-functioning idea of how it should look. I basically need the Div to fill with any color behind the p element:

function expCalc(){
 var expC = exp;
 var expN = expC + clickCount + modif;
  exp = exp + expN;
 getElementById("exp").innerHTML = exp;
}
div#ovvw-c{
float: center;
border: 3px solid green;
width: 3.3%;
height: 50%;
text-align: center;
margin-top:1%;
margin-left:49.25%;
margin-bottom: 1%;
background-color: rgba(255, 255, 255, .5);
}
.pbar{
 transform: rotate(270deg);
 margin-right:4px;
 margin-top:250px;
 text-align:center;
 font-size:20px;
 font-weight:900;
}

Hatchling:0/100

I understand that my coding is probably sub-par so any constructive criticisms would be appreciated but my main question is how to turn the div into a progress bar with minimal changes to size/spacing/CSS in general. Thanks!

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:
Algorithm for querying linearly through a non-linear list of questions For a multiplayers trivia game, I need to supply my users with a new quizz in a desired subject (Science, Maths, Litt. and such) at the start of every game.

I've generated about 5K quizzes for each subject and filled my database with them. So my 'Quizzes' database looks like this:

|ID   |Subject     |Question
+-----+------------+----------------------------------
|  23 |Science     | What's water?
|  42 |Maths       | What's 2+2?
|  99 |Litt.       | Who wrote "Pride and Prejudice"?
| 123 |Litt.       | Who wrote "On The Road"?
| 146 |Maths       | What's 2*2?
| 599 |Science     | You know what's cool?
|1042 |Maths       | What's the Fibonacci Sequence?
|1056 |Maths       | What's 42?
And so on... (Much more detailed/complex but I'll keep the exemple simple)

As you can see, due to technical constraints (MongoDB), my IDs are not linear but I can use them as an increasing suite.

So far, my algorithm to ensure two users get a new quizz when they play together is the following:

// Take the last played quizzes by P1 and P2
var q_one = player_one.getLastPlayedQuizz('Maths');
var q_two = player_two.getLastPlayedQuizz('Maths');

// If both of them never played in the subject, return first quizz in the list
if ((q_one == NULL) && (q_two == NULL))
  return QuizzDB.findOne({subject: 'Maths'});

// If one of them never played, play the next quizz for the other player
// This quizz is found by asking for the first quizz in the desired subject where
// the ID is greater than the last played quizz's ID (if the last played quizz ID
// is 42, this will return 146 following the above example database)
if (q_one == NULL)
   return QuizzDB.findOne({subject: 'Maths', ID > q_two});
if (q_two == NULL)
   return QuizzDB.findOne({subject: 'Maths', ID > q_one});

// And if both of them have a lastPlayedQuizz, we return the next quizz for the
// player whose lastPlayedQuizz got the higher ID
if (q_one > q_two)
   return QuizzDB.findOne({subject: 'Maths', ID > q_one});
else
   return QuizzDB.findOne({subject: 'Maths', ID > q_two});

Now here comes the real problem:

Once I get to the end of my database (let's say, P1's last played quizz in 'Maths' is 1056, P2's is 146 and P3 is 1042), following my algorithm, P1's ID is the highest so I ask for the next question in 'Maths' where ID is superior to 1056. There is nothing, so I roll back to the beginning of my quizz list (with a random skipper to avoid having the first question always show up). P1 and P2's last played will then be 42 and they will start fresh from the beginning of the list. However, if P1 (42) plays against P3 (1042), the resulting ID will be 1056...which P1 already played two games ago.

Basically, players who just "rolled back" to the beginning of the list will be brought back to the end of the list by players who still haven't rolled back. The rollback WILL happen in the end, but it'll take time and there'll be a "bottleneck" at the beginning and at the end.

Thus my question: What would be the best algorith to avoid this bottleneck and ensure players don't get stuck endlessly on the same quizzes?

Also bear in mind that I've got some technical constraints:

I can't get a random question in a subject (ie: no "QuizzDB.findOne({subject: 'Maths'}).skip(random());"). It's cool to skip on one to twenty records, but the MongoDB documentation warns against skipping too many documents.
I would like to avoid building an array of every quizz played by each player and find the next non-played in the database with a $nin.

Thanks for your help

sentences:
Shadows moving with camera. I'm using MJP's Cascade Shadow Map code and I'm having major issues with the shadows moving with the camera. Here a video to demonstrate what's going on. Also, is there a way to fix the dueling frustum issue? It's annoying seeing them pop in and out of corners of the screen.

Video of the shadows

c# and shader code

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:
Designing 1 on 1 battle: improving on Pokemon's model Possible Duplicate:
  Designing AI in a 1 on 1 battle similar to Pokemon

I am developing an android game that uses a similar battle style to Pokemon.  Essentially you are going 1 on 1 against an opponent and you select from 4 moves to bring their health to 0.  I also will be implement items such as healing potions, antidotes etc.

My problem/question deals with how I can improve upon the simple battle system that Pokemon has.  What suggestions or ideas do you have that would improve gameplay and avoid everything becoming repetitive?

I've already come up with a couple ideas that I would like some feedback on.

Speed system - In pokemon, the speed stat for the most part only determines which pokemon attacks first.  I would like to implement as system where each monster has a speed stat that determines how often it can go and the monster with the lowest speedVariable goes next..  THe speed stat would be an arbitrary unit 1-100 that is added to the monsters speedVariable every time it makes an attack.  Also attacks have their own speed stat that gets added so high damage attacks add more time between attacks to provide balance.

FOr example: Monster A - 50 base speed, Monster B - 30 base speed
"Turn" one - B has lower speed so subtract difference and B gets to choose a move
           A(20) B(0)   - uses an attack that has a speed of 70. (0 + 70 + 30) = 100;
"Turn" two - A(20) B(100) figure out which goes next and adjust speedVariable
           A(0)B(80) - A uses a weaker attack with a speed of 25. (0+25+50) = 80
           A(75)B(80) - A would get to go again.

I also thought using statuses/debuffs to augment moves would be a nice addition.  If you use a fire attack on a monster it becomes burned for a certain number of turns.  Certain moves do extra damage (25-50%) when a monster has the burned status.  I also thought freezing/slowing with ice spells would increase a monsters speedVariable.

sentences:
Best 2D graphics API when the only functionality needed is writing individual pixels to the framebuffer I have been dreaming for years about programming a relatively simple, but from the standpoint of the game engine, a very unusual 2D game engine for the PC platform. I am planning to use either C or C++ for the core engine, and maybe later expose the engine to a scripting language such as ruby, python or lua (for higher level programming of the content of the game). Not having ever programmed any noteworthy GUI applications let alone games, i am not really sure about which API:s to select for the task.

The requirements for the API:s are unlike other 2D games, since instead of drawing sprites, glows etc. using OpenGL, Allegro or SDL, i only need to be able to open a window instance, clear the framebuffer, write individual pixels to it, and then draw everything to the screen. Thus the API needs to be really really fast, and no additional functionality is needed from the API.

Additionally i need user input and sound output, through an additional API if necessary.
Do you have any suggestions for the best course of action?

sentences:
Unity3D URP - How do I approach creating Fog of War for 3D top-down stealth game? What I try to achieve is a fog of war system for 3d top-down stealth game. I have searched the Internet and it seems that behavior I want to achieve can be done by using secondary camera that is rendering its output to a render texture. Then render texture is applied to a plane which sits above a map with a masking shader. I was following this video: https://www.youtube.com/watch?v=PNAvNeOTnSE however my project is using URP in Unity and the Clear Flags on camera settings is missing. So basically after each rendering loop render texture gets cleared and drawn again which makes impossible to "save" areas that already have been revealed by the player.
Maybe this can be done using another technique? I would like to have fog of war that covers entire rooms with black opaque plane and reveals them upon entering them but remains cleared once visited. However visited areas should be gray once left and enemies should be hidden from the player when not in line of sight. Something like in this video: https://youtu.be/jrK_Uvwwk9I?t=1247
I would really appreciate if someone pointed my in right direction.

sentences:
Checking distant 2D objects from the player in pure javascript I'm checking if the objects are too far from the player to be able to disable some things, I'm doing so:

const obj1 = {
     x: 0,
     y: 0
};

const player = {
   x: 0,
   y: 0
};

const sqrMagnitude = (x, y) => {
    return (x * x + y * y);
};

const isAwayFromPlayer = (entity, targetEntity, distanceMax) => {
    if(sqrMagnitude((targetEntity.x - entity.x), (targetEntity.y -
entity.y)) > distanceMax * distanceMax){
        console.log("yes!");
    }else{
        console.log("no!");
    }
};

awayFromPlayer(obj1, player, 250);

but when walking with the player, sometimes I approach the objects and I get the console.log("yes!"), sometimes I move away and also I get, but it was only to work if I were away from them, I'm forgetting to do some conversion to absolute value with Math.abs for example? I remember that this is how it was when I needed some time ago, but something is not working properly.

sentences: Portal view direction I'm trying to add portals to a game (as in the entities from the Portal video game), and I've gotten them to a render the other portal's pos/dir to a texture which I can then display on a surface. However, I'm not really sure which direction to render the portal view from so that it'll actually look like a portal. Simply rotating the camera dir by the difference between the portal dirs isn't correct.

sentences:
Designing an end-less running game with levels-using LibGdx JSON I am working on an end-less running game where obstacles are placed along the way on moving background.
I have a lot of levels in the game,and I am implementing it using JSON.

My JSON file for first level look like this:

 "obstacles": [
 {"name":"rock","position":"middle","distance":"1000","speed":"350"},
 {"name":"crow","position":"up","distance":"1600","speed":"350"},
 {"name":"gap","position":"down","distance":"1600","speed":"350"},
 {"name":"monkey","position":"middle","distance":"2200","speed":"350"},
 {"name":"fish2","position":"down","distance":"2400","speed":"350"},
 {"name":"crow","position":"up","distance":"2600","speed":"350"},
 {"name":"snake","position":"up","distance":"3400","speed":"350"},
 {"name":"fish","position":"down","distance":"3400","speed":"350"},
 {"name":"fish2","position":"down","distance":"4400","speed":"350"},
 {"name":"monkey","position":"middle","distance":"5500","speed":"350"},
 {"name":"rock","position":"middle","distance":"6500","speed":"350"},
 {"name":"fish","position":"down","distance":"6500","speed":"350"},
 {"name":"cloud","position":"up","distance":"7200","speed":"350"},
  {"name":"rock","position":"middle","distance":"8000","speed":"350"},
 {"name":"gap","position":"down","distance":"8000","speed":"350"},
 {"name":"snake","position":"up","distance":"8700","speed":"350"}
 ]

Here I am placing obstacles up to an x position of 8700 on a moving parallax back ground.

Level1 is working fine,but my issue is that how I should place the next level obstacles.I have only one way that some position after 8700 I have to choose for placing next level obstacles.

Here I want to clarify one thing.Will it become a problem when I use larger values like this?

There is more than 20 level planned in my project,and each level get loaded automatically when one is completed.

I expect suggestions from experienced persons ,for designing the levels with these aspects.

Thanks in advance.

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:
Generate a 2d mesh terain out of triangles (low details) I'd like to learn a good algorithm to generate a 2d mesh made out only of triangles to be used as a terrain.

Its not important to get a high detail terrain. It should just have a triangle looking style.

Also the mesh should be extendable endlessly in all directions because the map will be endless. I thought about to having chunks of meshes saved in a file so they can be loaded during the execution.

Something like this (from Chasing Aurora):

sentences:
How to mitigate this strange pattern shown in Phong lighting? I am creating an entire lighting scene in OpenGL. The entire scene consist of only one point light. I noticed some strange z-fighting like pattern. This flickers when I move the camera.

Can anyone tell me what is the potential cause of the problem? How should I mitigate this problem? Thank you.

===

EDIT: The problem is solved. It was primarily caused by normal transform computation error and my ill made model might have been aggravated this speckle flickering effect.

sentences:
Unity3d : Make prefab follow raycast hit I've been trying to make a weapon script which fires a projectile (prefab) straight forward.I added to the bullet the first script shown here.And the second one to the main camera.The problem is that the gun doesn't shoot straight forward.I mean it shoots straight but in small distances it looks...crap.How can I make it so it follows the hit point of the raycast.I placed my attempt below.

Script 1:

var bulletSpeed : float = 20;

function Update ()
{
    transform.Translate(Vector3.forward * bulletSpeed * Time.deltaTime);
}

Script 2 :

var hit : RaycastHit;
    var forward = transform.TransformDirection(Vector3.forward);

    if(Physics.Raycast(transform.position, forward, hit, rayLength))
    {

    if(Input.GetButtonDown("Fire1") && canShoot==true && clip > 0)
    {
        var rocketInstance : Transform;
        rocketInstance = Instantiate(rocketPrefab, barrelEnd.position, transform.rotation);
        rocketPrefab.LookAt(hit.point);
        w();
        gun.animation.Play("Shoot");
        audio.PlayOneShot(soundEffect);
        clip -= 1;
    }
}

Thank you for your time,please help me!

sentences:
I want to display the total computed score in sfml sf::RenderWindow window(sf::VideoMode(LAYOUT_WINDOW_WIDTH, LAYOUT_WINDOW_HEIGHT),
        "Tetris 2019 - A New Beginning");

    window.setFramerateLimit(30);

    int currentScore = 0;
    int numCleared = 0;

    currentScore = 5 * 100;

    sf::Font myFont;
    if (!myFont.loadFromFile("cartoon relief.ttf")) {

    }

    // Score
    sf::Text score;
    score.setFont(myFont);
    score.setFillColor(sf::Color::Green);
    score.setStyle(sf::Text::Regular);
    score.setString("Score");
    score.setCharacterSize(25);
    score.setPosition(25, 130);

    sf::Text scoreCurrent;
    scoreCurrent.setFont(myFont);
    scoreCurrent.setFillColor(sf::Color::Green);
    scoreCurrent.setStyle(sf::Text::Regular);
    scoreCurrent.setString("currentScore");
    scoreCurrent.setCharacterSize(25);
    scoreCurrent.setPosition(45, 175);

    sf::RectangleShape scoreRectangle;
    scoreRectangle.setSize(sf::Vector2f(100, 50));
    scoreRectangle.setOutlineThickness(1);
    scoreRectangle.setOutlineColor(sf::Color::White);
    scoreRectangle.setFillColor(sf::Color::Black);
    scoreRectangle.setPosition(25, 165);

    while (window.isOpen()) {

        sf::Event event;

        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.draw(score);
        window.draw(scoreRectangle);
        window.draw(scoreCurrent);
        window.display();
    }

    return 0;
}

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:
Lighting effects with 2D sprites I would like to know how to best achieve lighting effects with 2D.

I guess the only way is to make sprites of the area to be lit in specific colors?
Say I have a streetlamp, and around this place sprites to make it appear lit?

Is there a better way?

Edit: Found a good screenshot of what I'm looking for:
http://www.saltgames.com/wp-content/uploads/2009/11/multipleLights.png

sentences:
Prevent Wall Clipping with Bouncing Shape I'm currently working on a demo-type program involving bouncing objects. Currently, I have a rectangle that can bounce around the screen.
When the rectangle bounces against one of the walls imperfectly, part of it will clip into the side of the window (or other objects, in the future).
I'd like to have the rectangle bounce from an accurate position (as in when/where it begins to collide with the object). Is there a better or more efficient way to do this other than by going back a step and checking over again with smaller steps?

The relevant code is here, and for reference the rectangle's velocity is stored as an angle and speed.

    //Update position
    rect.setX(rect.getX() + (rect.getVelocity() * Math.cos(rect.getDirection())));
    rect.setY(rect.getY() + (rect.getVelocity() * Math.sin(rect.getDirection())));

    //Check for collisions
    for(Collider c : colliders) {
        if(c.isColliding(rect)) {
            bounce(rect, c);
            System.out.printf("Rect is colliding with %s%n", c);
        }
    }

Any help would be appreciated.

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: One draw call with one big mesh VS many draw calls with many little meshes I have read that in order to optimize WebGL application, one should reduce an amount of draw calls. But does it mean that computing a one big mesh from all single meshes on CPU by modifying vertices position (which I heard is much slower than GPU while talking about matrix multiplications) and calling the draw call once would be faster than drawing every single mesh using model matrix inside GPU, calling the draw call for each one of them?

sentences: Does opengl performs Visibilty algorithms based on z-index? Does OpenGL performs Visibilty algorithms based on z-index? Or we have to write our own algorithms. Mainly I'm referring to z-buffer algorithm. Is it in-built?

sentences:
Partial recalculation of visibility on a 2D uniform grid Problem
Imagine that we have a 2D uniform grid of dimensions N x N. For this grid we have also pre-computed a visibility look-up table, e.g. with DDA, which answers the boolean query is cell X visible from cell Y?

The look-up table is a complete graph KN of the cells V in the grid, with each edge E being a binary value denoting the visibility between its vertices.

Question
If any given cell has its visibility modified, is it possible to extract the subset Edelta of edges which must have their visibility recomputed due to the change, so as to avoid a full-on recomputation for the entire grid? (Which is N(N-1) / 2 or N2 depending on the implementation)

sentences: Is it copyright infringement if I make a clone of a game for educational purposes, and upload it on github? Pacman and Snake Xenzia are common examples, and many universities have programming assignments where you recreate parts of a game (or even the entire game) without copying any of the artwork and design, etc. Is it okay to upload something like this (which was NOT written as a part of a course) under a personal profile on Github? Or will you necessarily have nothing to show for embarking on a project such as this one?

sentences:
How can I determine which tiles in a tilemap an oriented bounding box (OBB) overlaps? I need to detect collisions between an oriented bounding box and a static tile map. My tile map class looks something like this:

function Tilemap(width, height, tiles) {
    this.width = width;        // Width of the map in tiles
    this.height = height;      // Height of the map in tiles
    this.tiles = tiles;        // 1D array containing tiles, grouped by row
}

Tilemap.prototype.getTile = function (x, y) {
    return this.tiles[y * this.width + x];
};

Tilemap.prototype.setTile = function (x, y, value) {
    this.tiles[y * this.width + x] = value;
};

My question is this: How can I determine which tiles an OBB, represented as an array of vertices, overlaps?

(I am writing in JavaScript but answers for any language would be appreciated.)

sentences:
When should iOS gamecenter authentication be called? I'm integrating GameCenter leaderboards into my iOS game. The game has a home screen with a play and "High Scores" button, the game screen itself, and a finished screen with you score, another "High Scores" button, and some other stuff.

When installing the GameCenter package it recommended that you call the authentication function as soon as the device is ready. In this case, if a user that is logged into GameCenter opens the app it immediately says "Welcome back XX" and the player can continue like normal. However, if a user is not logged in, as soon as they open the app they are greeted with the GameCenter login page, which to me is a bad user experience.

The alternative is to only do the initial authorization when the user clicks to see the high scores, if they are logged in it takes them to the leaderboard, if not it prompts them to log in. The problem with this is if they don't try to view high scores until the game is over it would not have saved their score to the leaderboard (as I have it automatically submit if logged in on Game Over).

Which of these two choices is the best? I don't see the first option occur too often as I'm rarely/never greeted with a GameCenter login as I enter a game. Although number 1 is recommended by the plugin I installed. Should I have a dedicated "Sign in" button?

sentences:
How to render grid properly, especially over distance? I'm drawing a grid, pretty much like one can see in the Unity editor itself or any 3D-editor, many 3D-related applications and some games. But it doesn't look pretty in my case.

I put a few random objects to make perspective more readable.

Please also see it full-size for clearer view on the artifacts at a distance.

How grid is rendered

Whole grid is one big plane.
There is texture representing one cell.
The cell is multiplicated by tiling.

How there are different line thicknesses on the picture?

It's just 3 planes (each with one grid) with different settings on top of each other. I could leave only one, but 3 grids demonstrate my problem better.

Additional details:

Mipmap is disabled (grid cells disappear very soon over distance when it's enabled).
Trilinear filtration and maximum aniso are set (looks worse otherwise).

My guess

I think over distance lines get to be thinner than a pixel, especially under shallow angle (hence “verticals” lines look better than “horizontal”.

Conclusion

Grid rendering is obviously done many times before me, so I presume it should be pretty much wide knowledge how to draw them prettily. I tried to google it, but any query formulation I tried led only to completely unrelated stuff. I have a bit of ideas what I can try, but I believe it would be reinventing the wheel.

P.S.: I'm using Unity engine, but I believe the engine is irrelevant.

Plane simple blurring suggested by user29244 and Thebluefish really makes huge difference:

Biggest lines are too blurry now, but it's irrelevant, because easy to fix.
Note that I had to enable mipmaping if you're trying to reproduce it.

sentences:
Slick2D ComponentListener added to MouseOverArea not responding to right mouse clicks I am developing a UI using Slick2D and experimenting with MouseOverArea.  I have noticed that if I add a ComponentListener to my Button (which extends MouseOverArea) it only responds to left-clicks on my mouse, but not right-clicks.  The MouseOverArea itself responds to both.  If I call notifylisteners() in my Button subclass then ComponentListener does respond to right-clicks, but it gets called twice for left-clicks.

Does anyone have any idea why this is happening and how to fix it?  Code included below:

package slick2dbutton;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.gui.AbstractComponent;
import org.newdawn.slick.gui.ComponentListener;
import org.newdawn.slick.gui.GUIContext;
import org.newdawn.slick.gui.MouseOverArea;

public class Slick2DButton extends BasicGame {

    Button button;

    public Slick2DButton(String title) {
        super(title);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        AppGameContainer game;
        try {
            game = new AppGameContainer(new Slick2DButton("Slick2DButton Test"));
            game.setMaximumLogicUpdateInterval(60);
            game.setDisplayMode(640, 480, false);
            game.setTargetFrameRate(60);
            game.setAlwaysRender(true);
            game.setVSync(true);
            game.setShowFPS(false);
            game.start();
        } catch (SlickException ex) {
            Logger.getLogger(Slick2DButton.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void init(GameContainer container) throws SlickException {
        button = new Button(container, new Image("res/bunsen burner #1.png"), 50, 50, new Slick2DButton.Listener());
        button.setMouseOverImage(new Image("res/bunsen burner #2.png"));
        button.inputStarted();
    }

    @Override
    public void update(GameContainer container, int delta) throws SlickException {
    }

    @Override
    public void render(GameContainer container, Graphics g) throws SlickException {
        button.render(container, g);
    }

    public class Listener implements ComponentListener {

        @Override
        public void componentActivated(AbstractComponent source) {
            System.out.println("Source: " + source);
        }
    }

    public class Button extends MouseOverArea {

        public Button(GUIContext container, Image im, int x, int y, ComponentListener listener) {
            super(container, im, x, y, listener);
        }

        @Override
        public void mousePressed(int button, int mx, int my) {
            super.mousePressed(button, mx, my);
//            this.notifyListeners();
            System.out.println("Button: " + button);
            System.out.println("");
        }
    }
}

sentences:
Why is Unity 2D Alpha-Blurring my pixel sprite? So I have just brought in a place holder block for the ground in unity 2D, and it's 16 by 16 pixel image, and for some reason unity is automatically blurring the image. So I was wondering if there was any way to stop unity from automatically blurring the image. I would really appreciate if someone could tell me how to stop the image form being blurred. Also sorry if this is, just something that is incredibly simple to fix, I just started using unity 2D instead of 3D so it's different for me.

Thanks, Nova

sentences:
How can I fill the interior of a closed loop on a tile map? In my game the player can dynamically modify terrain.  The map is stored within a 2D array of prefabricated 3D objects.  This is working well for now.  The player modifies terrain by selecting what sort of tile they'd like to create (like cliff going up or down), and then clicking individual tiles, or "painting" over multiple by holding down mouse button and scrolling.

I don't want the player to have to manually click every tile they want to rise or fall in elevation.  The most elegant solution I can conceive, is for the player to "paint" a loop of cliff tiles, which is then filled in automatically when the loop closes.  Imagine, perhaps, someone drawing a line using MS Paint or Photoshop, until that line closes into a shape which then autofills.

Let's say the player wants a plateau, and so they select cliff going up, and then click and drag the desired shape.  Upon closing the loop, when the last cliff tile is created beside the first cliff tile, witchcraft is invoked which fills the inside.

I have no idea how this can be done, never mind elegantly or optimally.  There are obvious possible solutions (find the average vector of all tiles in the loop, and then dijkstra algorithm from the average until the space is filled with the correct elevation), but these assume the shape generated is blobby or boxy.  An irregular shape where the mid point falls outside of the shape is possible and would probably ruin that solution!

How can I fill the inside of a closed loop? I'd like a theoretical solution I can go away and implement in C#.  At this point it seems like there is probably conceptual overlap between raster graphics and procedural maps!

sentences:
What calls trigger a new batch? I am finding my project is starting to show performance degradation and I need to optimize it. The answer to my previous question and this presentation from NVidia have helped greatly in understanding the performance characteristics of code using the GPU but there are a couple of things that aren't clear that I need to know to optimize my drawing.

Specifically, what calls make the distinction between batches.

I know that any state changes cause a new batch, so that includes:

Render State Changes
Buffer Changes
Shader Changes
Render Target Changes

Correct? What else counts as a 'state change'?

Does each DrawPrimitive() call constitute a new batch?** Even if I were to issue the same call twice, with no state changes, or call it once on on part of the buffer, then again on another?

If I were to update a buffer, but not change the bindings, would that be a new batch?

That presentation and a DX9 page suggest using all of the texture slots available, which I take to mean loading multiple objects in 'parallel' by mapping their buffers/shaders/textures to slots 1-16. But I am not sure how this works - surely to do this you would need to change the buffer binding and that would count as a state change? (or is it a case of you do but it saves 16 calls so its OK?)

sentences:
Why is enabling GL_FRAMEBUFFER_SRGB making the colours brighter? My understanding of gamma correction is as follows: We want to do colour math in linear space so we can lerp etc. between colour values and get the results we expect. But human eyes don't have a linear response to light, so we need to modify the colours just before displaying them. sRGB is then commonly used colour space for this. Furthermore, since paint programs and colour pickers talk about colour in sRGB, the colours typically need to be linearized before math is performed on them.

EDIT 2: Turns out I had the following conversions backwards. The rest of the question is left unchanged for context, but I don't want to lead someone else down the same incorrect path.

The actual curve mapping sRGB to linear space is an exponential curve over the range 0 to 1. Linear to sRGB is raising the colour to the power of 2.2. sRGB to linear is taking the 2.2th root of the colour. So since we are in the range 0 to 1 Linear to sRGB make the colours less bright, and sRGB to linear does the opposite.

In my program I'm pulling values out of an GL_R8 texture, interpreting them as alpha values and taking a vec4 as a vertex attribute we'll call colour and multiplying it by vec4(1.0, 1.0, 1.0, alpha) to produce the final colour in the fragment shader. If I set the colour attribute to a known colour and enable the GL_FRAMEBUFFER_SRGB flag, then the colour I get is too bright, and it is exactly as bright as it would be if the sRGB to linear conversion was not applied.

For example if I pass in the colour #222222 I get #666666 actually rendered to the screen according to an external colour picking tool. If I convert the colour #222222 to three floats by dividing by 255.0 I get three copies of 0.13333333. 0x22 = 34 in base 10, 34.0 / 255.0 = 0.13333333. The 2.2th root of 0.13333333 is 0.40017032. 0.40017032 * 255.0 gives us 102. 102 in hex is the 0x66 we were expecting.

At first I thought that the problem was that it wasn't applying the linear to sRGB conversion to the output of the shader for some reason, since things were too bright. So I did some searching and found this answer but that states that the only way that the linear to sRGB conversion will only be applied if GL_FRAMEBUFFER_SRGB is enabled. I'm getting the opposite behavior: the colours are too bright only if GL_FRAMEBUFFER_SRGB is enabled!

I then realized that openGL can't magically know what the semantics of my colour vertex attribute are. So it can't be automatically converting my colour to linear space, unless it's doing something weird and error prone like checking the name of the attribute or just converting every vec3 or vec4. If that was a desired feature, a shader keyword or something would have been a better way to do that.

So I'm confused as to how I'm getting this result. I'm not currently doing any colour math in the shader besides what I've already mentioned, besides alpha blending. But I might want to do more of that later, including loading more textures in the fragment shader so I would like to sort out this weirdness, rather than just disabling GL_FRAMEBUFFER_SRGB and leaving the same mess for myself if I do end up doing more complicated stuff later.

EDIT 1: My windowing library says that my pixel format is sRGB so I don't think that is the issue. If I run glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &result), result gets set to GL_SRGB. If I check GL_FRONT_RIGHT, GL_BACK_LEFT, and GL_BACK_RIGHT I get GL_LINEAR, GL_SRGB, and GL_LINEAR respectively. But according to this page since I didn't set any stereo rendering settings, then the RIGHT buffers shouldn't matter.

sentences:
Setting density for Android game I am developing an Android game, in which a ball (bitmap) translates( is in motion). So I have provided motion equations for the ball. I have checked my app on Samsung galaxy S2 whose actual density is roundly 252 dpi, and It works fine on that. So my question is that Does these motions of bitmaps in surfaceView, depends on actual density of phone( i.e 252 dpi for S2) or generalized density(i.e 240 dpi).

I am confused whether if I run this app on 235 dpi smartphone, So will it have the same performance of motion as it is on Galaxy S2( with 252 dpi) or it would be little slow ?

Any help will be appreciated.

Let me elaborate it with coding. For example a linear motion of a ball is defined as with this equation x=x+4;
Now If I run this app, on Samsung galaxy S2(252dpi, and hdpi), So It will give me a particular speed motion, let say P is the speed of the ball.
Now If I run this application on Samsung Galaxy S3(300+ dpi, xhdpi), So the ball speed gonna be slow on this density, meaning less than the speed P.

So I will need the same speed on xhdpi density phone.
So will use these conversion formulas ;
dx= (x*160)/240;
px= (dx*320)/160;
 Hence the speed will be either exact or little different from P.(This is my confusion). That Whether the speed will be as same as it was on S2.

So my Question at this point is that my app worked on Samsung Galaxy S2 with the speed p, that I desired. As S2 is of 252 dpi, So Should I Include 240(Generalized density or 252 (Actual density) in my this line of coding ?
    dx= (x*160)/240;

Thanks !

sentences:
How to handle the different frame rate on different devices? I am not quite sure how frame per second works on a web page. I have a Canvas game that involves in moving an image from point A to B, and measuring the time elapsed.
The code can be as simple as:

var timeStamp = Date.now();
function update(){
  obj.y += obj.speed;
  text = "Time: "+ (Date.now() - timeStamp) + "ms";
}

The function update() is called every frame.
The problem is that the time elapsed is different from device to device. It is pretty short on my PC, but get longer on my iPad, and is much longer on my cell phone. I thought it is because the FPS is smaller on mobile devices, so instead of calling update() every frame, I call it every 1ms by using a setInterval. But this does not solve the problem.

In my understanding, the function for setInterval is invoked based on the increment in system time, other than frame rate, so it should fix the problem. Am I missing anything here? If the setInterval function is called based on FPS, is there any way to get around with the FPS difference across devices?

On a side note, I have sort of a "water simulator" on the same canvas. It involves in redrawing about 60 objects which can be 600x600 pixels for every frame, so it could be a frame rate killer. I am using Phaser.js but not really using much of its functionalities, if that helps.

sentences: box2D vs manual collision handling in libGDX I am developing a fairly simple game with Zelda-style physics where the only moving objects will be characters and other entities, however I am using a randomly generated (all in code, no .tmx) tile map which means I cannot immediately implement box2D as I would need to convert the tiled map into a box2D world, like in this question. My question is should I do collision checks manually, do the work to convert from a tile map to box2d, or just throw out the tile map (I'm not too far in that this is infeasible) and switch to a box2d world? And can I even use box2D for a top-down game?

sentences:
Proper Text-RPG Monster Generator I'm making a text-based RPG in C++ just for fun, and in a way that I can keep adding to it and hopefully give it graphics one day, and I've got a lot of code for everything. My only problem is that I can't come up with a decent way to create enemies that will be fair across the levels and classes. Tweaking the formulas doesn't seem to help. I will give some examples, there are only 10 enemies now, and I'm just wondering if anyone has a better way of going about this that keeps the variety between classes and fairness across levels. Here are a few of the monsters:

    Monster.Name = "Minotaur";
    Monster.monsterOption = random1;
    Monster.level = Player.level;
    Monster.health = 30+(5*Monster.level)+(rand()%7);
    Monster.workinghealth = Monster.health;
    Monster.attack = 15+(7*Monster.level+(rand()%4));
    Monster.defense = 26+(11*Monster.level)+(rand()%4);
    Monster.speed = 10+(2*Monster.level)+(rand()%3);
    Monster.luck = 2+(1*Monster.level)+(rand()%1);
    Monster.accuracy = 90+(rand()%5)-(rand()%10);
    Monster.gold = (rand()%120)+(30*Monster.level);

    Monster.Name = "Bandit Leader";
    Monster.monsterOption = random1;
    Monster.level = Player.level;
    Monster.health = 20+(2*Monster.level)+(rand()%15);
    Monster.workinghealth = Monster.health;
    Monster.attack = 20+(7*Monster.level+(rand()%3));
    Monster.defense = 20+(10.5*Monster.level)+(rand()%3);
    Monster.speed = 20+(4*Monster.level)+(rand()%8);
    Monster.luck = 2+(1*Monster.level)+(rand()%1);
    Monster.accuracy = 90+(rand()%5)-(rand()%10);
    Monster.gold = (rand()%150)+(32*Monster.level);

    Monster.Name = "Dragon";
    Monster.monsterOption = random1;
    Monster.level = Player.level;
    Monster.health = 35+(4*Monster.level)+(rand()%10);
    Monster.workinghealth = Monster.health;
    Monster.attack = 20+(7*Monster.level+(rand()%10));
    Monster.defense = 25+(11*Monster.level)+(rand()%10);
    Monster.speed = 20+(1*Monster.level)+(rand()%10);
    Monster.luck = 2+(1*Monster.level)+(rand()%6);
    Monster.accuracy = 90+(rand()%5)-(rand()%10);
    Monster.gold = (rand()%100)+(30*Monster.level);

So you can see the formulas aim to keep some degree of randomness between each of the same type of monster, and they should be changed based on your level but not your class, weapons, armor, etc. That is all the information about each kind of monster while there is more information about the player (Armor and weapons added to base defense and attack). Here is an example player from a file I have saved right now:

           SAVED CHARACTER INFORMATION
================================================
| Name:     WarriorRawrry                      |
| Class:    Warrior                            |
| Level:    32                                 |
| Health:   207/241                            |
| Attack:   231                                |
| Defense:  159                                |
| Speed:    159                                |
| Luck:     45                                 |
| Accuracy: 90%                                |
| Exp Pnts: 1228/16000                         |
| Gold:     7183                               |
| Weapon:   Sword of 1000 Truths  +125 attack  |
| Chest:    Blinding Breastplate  +90  defense |
| Legs:     Oblivion Greaves      +88  defense |
| Helmet:   Crown of Death        +64  defense |
| Hands:    Gauntlets of Fate     +54  defense |
| Feet:     Hell's Sabatons       +60  defense |
================================================

Note: That is output from the command line, I just put it in code format to make it easy to read.

So you guys can see what I'm trying to accomplish here, I'm not asking you guys to create math formulas for me, but any ideas on what would be a better way to go about this would be much appreciated.

sentences: Tilemap graphic rendering Say i have 10 towns in my world map. the world map right now is just a very large Tilemap. I'm curious as to what the standard is. I think it would be much more efficent to have a Tilemap for each town. If i want to walk from one town to another in the large tilemap I dont have an issue, but how can i do this if i had a Tilemap for each town? when is it best to load the upcoming Towns Tilemap?

sentences: Editor Window - How to create this? I am trying to create this in my editor window but not sure how. Basically a drop down arrow, next to a C# icon, next to a toggle, next to a Label with a cog at the end

sentences:
Generating a map in runtime for a simple top-scrolling racing game I'm creating a simple top-scrolling racing game. The concept is quite simple - the player controls the car, which goes on a dynamically generated field with square blocks. Once the car hits a car, the game ends.

My first implementation was simply to put a few random blocks in each row being generated on the top of the screen, but this does lead to maps where going through is impossible.

What is the best algorithm for generating such type maps? My platform of choice is XNA and C#, if that's important.

EDIT: Here's an illustration: (pic)

In this case, there's no possible way for the player to pass.

sentences:
What's the use and difference between Forward, Deferred and Physically Based Rendering? Maybe I'm still confused about my own understanding,

Forward Render: render the lighting of an object according to the light source in the scene. (e.g Phong)
Deferred Render : render the scene to get geometric information, store it in a buffer, and then apply lighting. (e.g ?)
PBR : treats lights in the scene the way it behaves in the real world. (e.g Ray tracing, Photon Mapping)

I don't see how Forward and Deferred render are going to give much difference to the scene. Why do we need to store the geometrical value in Deferred Render before applying lighting ? Why don't we just compute lighting right away like Forward Render ?

Also for Physically Based Rendering, computing each light takes a lot of time, and almost impossible to be done in real time. But why this technique is always considered the best ?

sentences:
2D deferred lighting calculations not working I have the following code for my HLSL pixel shader. Modified from another post here on GameDev (Link), but I have a few problems with it:

// calculate UV and get texture and normal.
float2 UV = Input.position.xy / Input.ScreenSize.xy;
float4 DiffuseColor = ColorTexture.Sample( SampleType, UV );
float4 NormalColor = NormalTexture.Sample( SampleType, UV );
float4 normal = 2.0f * NormalColor - 1.0f;

// calculate distance.
float3 LightDir = LightPos - Input.position.xyz;
float distance = 1 - length( LightDir ) / LightRadius;

// calculate dot of normal and light direction.
float NdL = max( 0, dot( normal.xyz, LightDir ) );

// get final color.
float4 finalColor = ( DiffuseColor * ambientIntensity ) + DiffuseColor * distance * LightIntensity * LightColor * NdL;

return float4( finalColor.rgb, DiffuseColor.a );

ambientIntensity and LightIntensity are currently 1.0f to simplify things. LightRadius depends on the size of the geometry, but is in pixels. ~80 for testing. DiffuseColor is a texture resulting from applying self-illumination and darkening the base image. NormalColor is the normal map for the image.

This shader needs to run for every light on the screen, which isn't that many.

For my tests I use the images from the blog post here. It's a little old, but it is pretty much what I need to do, which I can't.

Now; I did enough testing to know that all input and cbuffer parameters are valid but the results I get are not what I hoped for.

Here are my problems:

Problem 1: My knowledge of math is limited and I don't understand exactly what the dot product does, why it is needed in the light calculation or why the distance is calculated as it is. Is there a resource online that would explain lighting in term of HLSL or at least in a way meant for a programmer and not using big equations meant for a mathematician? If I don't understand the basics, I'm afraid I wont be able to improve and I'll be stuck every time I need to add new features (ie: shadows), but I need to get this things running asap.
Problem 2: The results I have are not good. When I move the light around, I can actually see where the geometry cuts off, and it is as if the light does not trail off properly near the edges of the geometry. Are the calculations wrong?
Problem 3: I built a 2D shape editor that I use to design the shape of the lighting geometry, but I don't know how to edit the shaders or the geometry's UV to have the custom shapes (fans, circles, etc) shaded properly. The light I render is always shaded as if it was a circle.

I spent the last two weeks working on this and whenever I search on Google, I keep getting pages I have already visited, so I'm quite lost right now. Any suggestions would be highly appreciated.

My game is a tile-based 2D game, thought I would mention that.

sentences:
What is the simplest way to rotate a 3D point arohnd another point given a quaternion? I am weak in understanding quaternions however I am learning. Right now, I know how to rotate a point around another point given an angle represented by a Vector3 using a rotation matrix.
However because of order of rotations this causes undesirable behaviour for me. I need to understand how I can rotate a point around another point with a quaternion.
For context, I am getting the rotated vertices of an oriented bounding box.

sentences:
Where can I learn 2D game architecture Possible Duplicate:
  Good resources for learning about game architecture?

I know that game architecture can vary greatly, especially with the type of game being built, but I know that there are a lot of similarities too.

I feel like I am on the cusp of really having a good grasp on game architecture, but I feel like something is missing. Maybe it's something obvious. So, I want to know, is there a resource out there that is the be-all-end-all guide to 2D game programming concepts, patters and architecture?

Edit:  I'm mostly interested in building platformers and shmups and the like. So, if the resources are related to those types of games, even better.

sentences:
How to keep the camera view to within room dimensions me = self;
    view_yview[0] += ( me.y-(view_hview[0]/2) - view_yview[0]) * 0.1;
    view_xview[0] += ( me.x-(view_wview[0]/2) - view_xview[0]) * 0.3;

This is the code I use to smooth camera movement in game maker. But it's going beyond the room dimensions; showing stuff that shouldn't be shown, as the camera should stop following the player at a point.

How do I achieve this?

sentences:
Explanation of matrix transformations I've been looking for something that can help me understand matrix transformations.  I've been to multiple different sites, including Wikipedia and quite a lot of related questions on SE and other forums.  I also posted a similar question in another forum and was unable to get results. Oh, and I visited a number of learning sites like Khan Academy to no avail.

The linked websites all provide methods to calculate transformed pixel-perfect collisions, but they require matrices for input.  Some of the sites tell you to ignore how matrices work and focus on the collision methods, but how can you do that if you need to use matrices for input?

In trying to figure out how to convert my data into matrices and use XNA's mysterious matrix transformation tools, I ran into one of math's famous jargon-barriers with such head-scratchers as vector space and linearity, among plenty others.

So the question is, can you explain how to create position, rotation, and scaling matrices, as well as how to combine them and why they work?

As I've explained, I wouldn't be asking this question if I hadn't exhausted all of my searching queries.  I am no more advanced in my mathematical understanding than Pre-Calculus.

sentences: Material colours in unity not displaying correctly? Even though I've picked blue the color is displayed as something pinkish. All colors are like this

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:
Unity's Quaternion.Lerp slows down when target is directly behind turret Software: Unity v5.2.1f1 Personal

I am trying to achieve the effect of a turret in Unity. For this I have a turret consisting of 3 parts as well as a target. The problem is that whenever the target my turret is targeting has a z of < 0, the lerp speed is extremely slow. However, the further away the target is from x=0 (both positive and negative), the faster it will move. This effect only occurs when my target has a transform.position.z of < 0. When z > 0 the transform.position.x has no effect on the lerp speed. My setup is as follows:

The 3 turret parts are the base, turret and barrel.

The base is nothing more than a block for the turret to rest on.
The turret is a block holding the barrel in place with base as his parent. The turret rotates around its y-axis to always face the target. The barrel has turret as his parent. The barrel rotates around its x-axis to always face the target. See the picture below for the end result.

Base: Blue; Turret: Red; Barrel: Green;

The turret has the following code:

public class turretRotation : MonoBehaviour {

    public Transform target;

    void Update()
    {
        Vector3 relativePosition = target.position - transform.position;
        relativePosition.y = 0;
        Quaternion rotation = Quaternion.LookRotation(relativePosition, new Vector3(0, 1, 0));
        transform.localRotation = Quaternion.Lerp(transform.localRotation, rotation, Time.deltaTime);
    }
}

The barrel has the following code:

public class barrelRotation : MonoBehaviour {

    public Transform target;
    public float speed = 1;
    Vector3 relPos;
    Quaternion rot;

    void Update () {
        // Position of target relative to my position
        relPos = (target.position - transform.position).normalized;

        rot = Quaternion.LookRotation(relPos, new Vector3(0,1,0));

        // Lerping localRotatiot > rot with speed: Time.deltaTime * speed (set to 1 by default)
        transform.localRotation = Quaternion.Lerp(transform.localRotation, rot, Time.deltaTime *  speed);

        // Resetting y- and z-EulerAngles to 0; This way only the x-EulerAngle will be affected.
        // The y rotation is inherited from the parent (turret_turret)
        transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, 0, 0);
    }
}

In this picture the Lerp is working as intended; Note target.transform.z > 0

In this picture the target has a z = -5 and x = 0; pay particular attention to the Lerp speed

It eventually gets there, but it takes a very long time. For some reason, the further away the target is from x=0, the faster the Lerp speed. Note: Still slower than intended

In this picture the target has a z = -5 and x = -10

So for some reason when target.transform.z has a negative value, the higher the distance from target.transform.x to x=0 the higher the Lerp speed.

I've done a fair bit of searching and came across a post on answers.unity.com describing a similair problem; Unfortunately, no reply.
http://answers.unity3d.com/questions/1084067/lerp-problem-when-target-is-behind.html

So my question is: "Why is this happening and more importantly, how can I fix this?"

Any help would be much appreciated!

sentences:
Difference between Vorbis OGG and M4A/MP4/AAC? From what i know m4a and aac are the same thing with mp4 allowing video while the former only allows audio.

Whats the difference between vorbis ogg and m4a? I looked it up and it seems that m4a/aac are patent free. What are reasons i may want to choose one from the other?

Assume source will always be lossless (wav/aiff/flac) and i am choosing the encoding to distribute with my game/demo

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:
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:
OpenGL textures loaded with SDL_Image display with no alpha I am making a game using OpenGL, with SDL_Image employed to load the textures. When drawn on screen, there's no alpha -- in an exact square around the opaque contents of the texture, black is drawn; outside that space, white is drawn. Here is my OpenGL init code...

SDL_SetVideoMode(windowWidth, windowHeight, 16, SDL_HWSURFACE|SDL_GL_DOUBLEBUFFER|SDL_OPENGL);
glClearColor(0, 0, 0, 0);
glClearDepth(1.0f);
glViewport(0, 0, windowWidth, windowHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, windowWidth, windowHeight, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLoadIdentity();

...here is my image loading function...

SDL_Surface *loadImage (const char *filename, bool alpha = true) {
    SDL_Surface* loadedImage = NULL;
    SDL_Surface* zoomedImage = NULL;
    SDL_Surface* optimizedImage = NULL;

    loadedImage = IMG_Load(filename);

    if (loadedImage != NULL) {
        zoomedImage = zoomSurface(loadedImage,windowScaleH/4,windowScaleH/4,SMOOTHING_ON);
        SDL_FreeSurface(loadedImage);

        if (alpha) optimizedImage = SDL_DisplayFormatAlpha(zoomedImage);
        else optimizedImage = SDL_DisplayFormat(zoomedImage);
        SDL_FreeSurface(zoomedImage);
    }

    return optimizedImage;
}

...here is the code I actually use to create the GL texture...

GLuint thisIsMyTexture;
glGenTextures(1, &thisIsMyTexture);
temporarySurface = loadImage("theimagetomytexture.png");
glBindTexture(GL_TEXTURE_2D,thisIsMyTexture);
glTexImage2D(GL_TEXTURE_2D, 0, 4, temporarySurface->w, temporarySurface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, temporarySurface->pixels);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

...and the drawing code itself.

glBindTexture(GL_TEXTURE_2D,thisIsMyTexture);
glBegin( GL_QUADS );
    glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 1.0f);
    glTexCoord2f(1.0f, 0.0f); glVertex3f(32.0f, 0.0f, 1.0f);
    glTexCoord2f(1.0f, 1.0f); glVertex3f(32.0f, 32.0f, 1.0f);
    glTexCoord2f(0.0f, 1.0f); glVertex3f(0.0f, 32.0f, 1.0f);
glEnd();

That's all the relevant information I can think of. Help would be appreciated! :D

sentences:
Should I update VAO when I update a VBO? My VAO/VBO/IBO work fine on iPad and other devices on Android excepted two (A Samsung galaxy S4 and a Sony Xperia S).

A problem is present when I start my application on this devices, every elements move everywhere and start to blink on each frame, the problem is present on every element updated during the simulation.

I have a SpriteRenderer who share a VBO, so I need to update this VBO on each frame for each sprite (change color, uvs, …).

The visual glitch is not present on static element (like text).

So my question his:

Did I have to do something with my VAO on each frame?

Here is what I've got:

Init part:

 - bind vao
     -> Bind vbo
     -> Bind ibo
 - unbind vao

Rendering part:

for( sprites )
{
     // Update (Need to bind VAO here?)
     bind vbo (lock)
     update vbo data
     unbind vbo (unlock + bind)

     // Draw.
     bind vao
     drawElement
     unbind vao
}

Thanks!

sentences:
Confusion over GLViewport I'm hoping someone can help me understand the GLViewport and what happens when we resize it

This will illustrate my confusion....

So, here I have a quad stuck in the middle of the screen.  If I have my GLViewport match the device's width and height, I get what is on the first (left hand) picture.  Exactly what I would expect.

Device resolution, 2560 x 1600
Viewport resolution 2560 x 1600
Quad size 200 x 200 (Note, the image above is not to scale!!! :-))
Quad shape, appears as square

Now, for the 2nd (right hand) picture...

Device resolution, 2560 x 1600
Viewport resolution 2560 x 1200 (and centered vertically)
Quad size (200, 200)
Quad shape, appears as rectangle

My question is, why is the quad displaying as a rectangle now and not a square?  I've confirmed by logging that my quad is 200 x 200 pixes - surely the size of the physical pixels stays the same?  They can't change.  So what is going on here?

I thought (clearly incorrectly) that when I scaled the viewport, it literraly just chopped off pixels.

Would appreciate if someone could explain how this works.

Edit

Currently, I'm setting my viewport like this:

width = (int) Math.min(deviceWidth, deviceHeight * 1.702127659574468);
height = (int) Math.min(deviceHeight, deviceWidth / 1.702127659574468);

ratio = width / height;
GLES20.glViewport(offsetX, offsetY, width, height);

Matrix.orthoM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);

offsetX and offsetY are just so that when there are letterboxes, the viewport is centered.

sentences:
How do I use images with copyright in my game? Our game requires to show images from movies, cartoon characters, etc. but we don't know how we can include them.

We have seen that games like QuizUp and other guess the pic like games have images from Disney characters, Pokemon or company logos, etc.

How does it work? Is this usage considered fair use?

sentences:
Unity 5 - how to toggle realtime global illumination I am using Unity 5.5. Is there a way to enable and disable precomputed realtime GI at runtime? and if so, how can I do it?

The idea is that I want to set dynamic lights as a graphics quality option that the player can choose to toggle.

sentences:
How could I implement something like Minecraft's crafting grid? The crafting system in Minecraft uses a 2x2 or 3x3 grid. You place ingredients on the grid, and if you put the right ingredients in the right pattern, it will activate the recipe.

Some interesting points about the design:

Some recipes can exchange certain ingredients for others. For example, a pick uses sticks for the haft, and may use wooden planks, cobblestone, iron ingots, gold ingots, or diamond gems for the head.
Relative position within the pattern is what matters, not absolute position on the grid. That is, you can craft a torch by placing the stick and coal (or charcoal) in the correct pattern in any of six positions on the 3x3 grid.
Patterns may be flipped horizontally.

I may be overthinking it, but this seems like an interesting search/set-reduction problem. So, how does (or could) this work, algorithmically speaking?

sentences:
What Situations is Saving a Game to Main Memory for? I've been reading through Unreal's 'Saving and Loading' guide: Link

Within, they present a capability to save a game to main memory rather than secondary storage:

I haven't found any information on where this would ever be used.

The only situation I can fathom for this being useful is to keep data about other load zones in memory so that travelling through load screens into these zones is quicker.

Why, When and Where is this technique of saving to Main Memory used instead of saving to Secondary Storage?

sentences:
Is there anything like XNA for c++? I love the features of XNA but I want to get into c++ game dev. The problem is that I now have to worry about everything from loading a png file to opening a window. This is a little bit annoying.

I would really like a c++ version of XNA to solve these issues for me.

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: How flat-file and databases compare in games development? Typically games built with a goal of being easily modded often store data in plain text documents, such as Rimworld. I can't see why an entire database system would be implemented just to read a few saved variables in other games? Sure if it's more efficient or built into the engine there's likely no reason not to use it.

sentences:
Unity Game with Voice Chat Have been working on a Poker game, it is network based and instead of launching game instance on server. I have managed everything via www class and on server created PHP API.

Now PHP is taking care of tables and rounds and then updating MySQL DB, and clients (mobile devices) just communicate to PHP over http. There are multiple tables and maximum of 5 players can sit on the table.

I need to implement voice chat between the players of the room, there can be visitors in the room as well. so 5 people are playing but may be 10, 20 people are watching them play.

What are my options on implementing voice messages? I am not using any Photon or UNET or any other server game instance.

Thank you

sentences:
XNA: How to capture precise time of button press? I'm guessing the default XNA model encourages checking for button presses in Update(). However, I am developing a game-like application for research and need to measure reaction times as quickly as possible. If I only check button presses in Update(), this constrains me to the refresh rate of the application. For example, if Update() runs 60 times per second, button capture times could be off by up to 16.6ms (1/60) if they happen soon after the thread goes to sleep. Is there another way to design my application to catch button presses as soon as possible?

Should I run a separate thread that polls the game controller and runs faster than the regular application's 60 Hz, say 120 Hz?

Or should I run a thread that gets a hardware interrupt when a button is pressed and store the time?

Other ideas?

(I know this sounds excessive when we are talking about button pressing and 20ms or less, but there are a number of scientific applications out there that advertise millisecond level timing precision. I am just wondering if I might be able to get something reasonably close with XNA.)

sentences:
How to calculate a movement Vector3 to kill unnecessary momentum and start moving in the right direction? Imagine a rocket is accelerating in a straight line toward PointA, picking up momentum every frame, then suddenly decides it wants to go toward PointB instead.

It can't just turn straight toward PointB and start accelerating, because the new acceleration plus the pre-existing momentum will carry it wildly off-course, and not straight toward PointB.

It could turn exactly 180° around to aim directly away from PointA and thrust until it comes to a stop, then turn toward PointB and start accelerating from scratch. But that's very inefficient, especially if the two points are in generally similar directions.
It would be more efficient to turn and start accelerating in some specific direction that will bleed off the unnecessary momentum but keep any useful momentum, course-correcting so that it is now moving toward PointB.

I'm trying to figure out how to calculate that "specific direction" that the rocket needs to start accelerating toward, in order to efficiently reach PointB. I have the rocket's position, the Vector3 of its inertia, and the Vector3 locations of PointA and PointB, but I'm not experienced enough in Vector Math to totally understand what's needed.
Especially since we're talking about acceleration (not just speed), so the angle will no doubt need to be recalculated each frame as the changing momentum leads to a changing angle toward PointB, etc.
Can anyone help me out?

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:
Getcomponent(), GameObject, and Component issues I have been trying for over 2 hours now to get over these problems :

I have 2 GameObjects in my hierarchy, but I do not have them anywhere in any script. I would very much like to add those 2 objects into a script of mine. I used

GameObject thing1 = new GameObject("name of object");

but unfortunately this didn't work, gave me errors about how I can only create objects from main script? I pasted my code into game.cs, and added the game.cs script to the 2 objects I want, but I get the exact same errors.

So the reason for this problem is that I need to actually add those 2 objects in my lines of code, so I can use GetComponent(); to be able to modify the enabled status of my script. So the other problem here, is that when I use GetComponent on the 2 objects, I get a nullreference exception. I am very sure that I added the script to both the objects, and I'm pretty sure I didn't mistype them, so can anyone give me a hand please?

sentences: How can I represent a tile-based map and related properties on disk? I'm trying to load a tile-based map in my game. I've been watching SDL tutorials for a while now but they never covered how to represent the map in a file? How can I represent a tile map on-disk in a way that also lets me store information about collision and other properties?

sentences:
Constraining camera bounds within bounds based on Unity UI object dimensions I have a perspective camera which has bounds which I wish to constrain within larger bounds.  All the bounds are calculated in world space.

The code for containing the camera within the constraining bounds is straightforward:

        var camRect = this.cameraComponent.GetCameraWorldRect();
        var correction = Vector3.zero;

        if (camRect.xMin < constrainingRect.xMin)
        {
            correction.x += Mathf.Abs(constrainingRect.xMin - camRect.xMin);
        }

        if (camRect.xMax > constrainingRect.xMax)
        {
            correction.x -= Mathf.Abs(constrainingRect.xMax - camRect.xMax);
        }

        if (camRect.yMin < constrainingRect.yMin)
        {
            correction.y += Mathf.Abs(constrainingRect.yMin - camRect.yMin);
        }

        if (camRect.yMax > constrainingRect.yMax)
        {
            correction.y -= Mathf.Abs(constrainingRect.yMax - camRect.yMax);
        }

        this.cameraComponent.transform.position += correction;

This can be visualized as:

The problem I am facing is that I have a UI object that is covering the right hand side of the screen and I am uncertain how to correctly calculate the width of the UI object so that the constrained camera bounds can take it into account.

The camera that is drawing the UI object is configured as follows:

The camera that is being constrained is configured as follows:

Apart from the layer, the parameters which affect the rendering of the objects for each camera configuration are the same.

The UI object has the following configuration with a Canvas Renderer:

This is how I am currently attempting to calculate to width of the UI object but given that the UI is being rendered using a perspective camera I wasn't too certain that ScreenToWorldPosition was correct.

    private float CalculateMenuWidth()
    {
        // Generate padding to account for the side menu
        var canvas = LevelEditor.Instance.Menu.GetComponentInParent<Canvas>();
        var menuRect = LevelEditor.Instance.Menu.GetComponent<RectTransform>();
        var menuRectMax = menuRect.rect.max * canvas.scaleFactor;
        var menuRectMin = menuRect.rect.min * canvas.scaleFactor;

        if (this.cameraComponent.orthographic)
        {
            return Mathf.Abs(this.cameraComponent.ScreenToWorldPoint(menuRectMax).x - this.cameraComponent.ScreenToWorldPoint(menuRectMin).x);
        }

        // Perspective camera requires distance for ScreenToWorldPoint
        var distance = Mathf.Abs(this.cameraComponent.transform.position.z);

        return Mathf.Abs(this.cameraComponent.ScreenToWorldPoint(new Vector3(menuRectMax.x, 0f, distance)).x - this.cameraComponent.ScreenToWorldPoint(new Vector3(menuRectMin.x, 0f, distance)).x);
    }

However, the size of menu returned by the method above appears to be too large.

How can I correctly calculate the width of the UI object so it appears that the camera constraints do not allow the camera to travel past the UI object?

EDIT: I've added a link to a Unity project which is the minimal working example for reproducing the issue.

https://www.dropbox.com/s/mq36mfqz5wvvsch/CameraConstraintGUIIssue.zip

The camera can be controlled with WASD to translate and the Shift key will speed up the movement.

The camera is constrained inside the checkerboard.  An offset is created so that the camera should stop moving to the right once the right edge of the checkerboard is adjacent to the left edge of the menu.  Unfortunately, I can't seem to calculate the size of the menu correctly so this occurs.

The code for constraining the camera and calculating the menu size is in EditorCamera.cs.

Edit2:

The constraint from KingDolphin

The constraint I am attempting to calculate (quoted from above, An offset is created so that the camera should stop moving to the right once the right edge of the checkerboard is adjacent to the left edge of the menu.):

sentences:
Why do my game objects jitter when moving the camera? I'm moving from Qt Widgets' QGraphicsScene to Qt Quick's QQuickItem for rendering my game objects. One of the things this involves is setting up a scene and the view onto that scene, as this was previously managed by QGraphicsScene and QGraphicsView.

My naive attempt was to do the following:

void SceneView::centerOn(const QPointF &pos)
{
    if (mScene) {
        mScene->setX(-(pos.x() - width() / 2));
        mScene->setY(-(pos.y() - height() / 2));
    }
}

This works, but it produces this odd effect where some game objects "jump around" between neighbouring pixels while the camera comes to a halt while following the player:

The player's movement is fine. The crate also does not seem to exhibit this problem (though its Box2D debug drawing marker does).

This is what it looks like when the player moves without the camera following it:

This is what I'd expect from the other game objects when the camera is moving; no movement whatsoever relative to the scene.

The old, correct movement looked like this:

The old code:

void MapView::centerOverFollowedItem()
{
    QRectF geometry(mFollowing->pos(), mFollowing->boundingRect().size());
    centerOn(geometry.center());
}

(QGraphicsView::centerOn implementation)

What could be causing this?

sentences:
Deal with mini states in game Hi :)
I want to ask what is the best way to deal with "mini-states" in game? For example I making game like Simcity, i can build buildings, roads, rails, or I can change something in economy.
I am making something like:

enum
{
  ROAD_CONSTRUCT,
  BUILDING_CONSTRUCT
  VIEW_MAP
  etc..
}

and in the game loop big switch. But the code is getting big. Is there some solution for all popular languages? I am asking because I am writing in C++, AS3 and sometimes in C.

sentences: How to move the camera in XNA only after few moments? I made the camera position 10 units from an object, but not behind it. I dont want the camera position behind the object right away when it rotates, I want that when I will rotate the object, the camera position will move slowly until it will be behind the object.

sentences:
How can I get accurate collision resolution on the corners of rectangles? I have a working collision system implemented, and it's based on minimum translation vectors. This works fine in most cases except when the minimum translation vector is not actually in the direction of the collision.

For example:

When a rectangle is on the far edge on any side of another rectangle, a force can be applied, in this example down, the pushes one rectangle into the other, particularly a static object like a wall or a floor. As in the picture, the collision is coming from above, but because it's on the very edge, it translates to the left instead of back up. I've searched for a while to find an approach but everything I can find deals with general corner collisions where my problem is only in this one limited case.

Any suggestions?

sentences:
How to make overlap detection more accurate? I have a project where there are two types of warrior, red and blue.

When they overlap, both are destroyed, or at least that is what should happen.

Red Warrior Blueprint (code of destruction):

This overlap is not detected. I put an impression right after the Cast To and it does not appear, so the event is not detected.

Which makes me think of another question I asked, maybe I have found the answer for it (Error detecting collision with another instance of the same actor?).

Capsule Collision of Warriors:

I had a similar problem in the collision of the red warrior with a tower, in order to have the detection of the overlap I had to greatly increase the capsule collision of tower:

It's practically a sphere.

The correct title of the question should be => How to make overlap detection more accurate without having to increase the collision box?

But I do not rule out that increasing the collision box is not the best way to detect overlap, I just want you to explain why (if it is).

EDIT 1 (attempt based on Stephen's comment)

I put an impression when the cast fails.

Red Warrior Blueprint and Blue Warrior Blueprint (respectively):

Result in game:

Test made with capsule in size (sclae) => x = 1.5, y = 1.5, z = 1.5.

EDIT 2 (Event image)

Image to show how the overlay is called:

sentences:
What could cause a sudden stop in Box2D? I'm using Box2d for a game, and I have a bug that's driving me nuts. I've simplified the situation down to a square player sliding back and forth frictionlessly on top of a floor composed of a series of square tiles, driven by the left and right keys (which apply a horizontal force). Works great, sliding back and forth across the whole floor.

Except... Every once in a while, the player will suddenly stick at the edge of one of the tiles as if it is hitting a (nonexistent) wall. Further pushes in the same direction it was traveling will fail, but as soon as I push backwards once in the opposite direction, I can push forwards past the sticking point again. The sticking point seems to be random, except for being on the edge of a tile. Happens while going left or right.

For debugging purposes, I keep the Positions/velocity values for the previous two update ticks and print them out when this stop occurs. As an example, here you see the player moving right, decelerating slightly; pos2 should be about 8.7, but it stops dead instead.

tick0:  pos= 8.4636 vel= 7.1875
tick1:  pos= 8.5816 vel= 7.0833
tick2:  pos= 8.5816 vel= 0.0000

So, as the player is 0.8 and the tiles 1.0 wide, the player is stopping just as it is about to cross onto the next tile (8.5816 + 0.8/2 = 8.9816). In fact, I get a collision message (which I ignore except noting that it happened). It only seems to happen at x.5816 (or -x.4184) while moving right, and x.4167 (or -x.5833) while moving left

I said that it's like hitting a wall, but in fact, when it hits a wall, the numbers look more like:

 tick0:  pos0= 12.4131 vel2= 8.4375
 tick1:  pos1= 12.5555 vel1= 8.5417
 tick2:  pos2= 12.5850 vel0= 0.0000

so it moves further right on the last tick, which puts it in contact with the wall.

Anyone seen anything like this. Any suggestion on how I could be causing this behavior.

sentences:
Examples of 2D side-scrollers that achieve open non-linear feel? I'm working on a 2.5D platformer prototype that aims for an open feel while maintaining familiar core mechanics.

Now, there's some obvious challenges with creating a non constricted feel in a spatially constricted environment. What I'm interested in, is examples of how game designers deal with the "here's a level, beat the bad guys/puzzles to get to the next level" design that seems so natural to most platformers (eg. Mario/Braid/Pid/Meat Boy to name a few).

Some ideas for achieving openness I've come across include:

One obvious successful example is Terraria, which achieves openness simply through complexity and flexibility of the game-system
Another example that comes to mind is Cave Story. Game is non-linear, offers multiple choices and side-stories
Mario, Rayman and some other 'classics' with a top-down level selection. I actually really dislike this as it never did anything for me emotionally and just seems like a bit of a lazy way to do things.

Note: I've not actually had much experience with most of the 'classical' console platformers, apart from the obvious Marios/Zeldas/Metroids, since I've grown up on adventure games. By that I mean, it's entirely possible that I simply missed some games that solve the problem really well and are by some considered obvious 'classics'.

sentences:
Improve appearance of neon LineRenderer at sharp corners I followed the answer given in how to make 2d neon using linerender and get neon effect nicely, but when I draw a line with a tight circle or overlap nearby lines, I get unsightly triangle artifacts and discolouration:

I'm using this alpha image:
And I apply this shader on the LineRender:
Shader "Trail/Neon"
{
    Properties
    {
        [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
    _Color("Tint", Color) = (1,1,1,1)
        _MainTexture("Sprite", 2D) = "white" {}
    [MaterialToggle] PixelSnap("Pixel snap", Float) = 0
    }

        SubShader
    {
        Tags
    {
        "Queue" = "Transparent"
        "IgnoreProjector" = "True"
        "RenderType" = "Transparent"
        "PreviewType" = "Plane"
        "CanUseSpriteAtlas" = "True"
    }

        Cull Off
        Lighting Off
        ZWrite Off
        Blend One OneMinusSrcAlpha

        Pass
    {
        CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile _ PIXELSNAP_ON
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
#include "UnityCG.cginc"

        struct appdata_t
    {
        float4 vertex   : POSITION;
        float4 color    : COLOR;
        float2 texcoord : TEXCOORD0;
        UNITY_VERTEX_INPUT_INSTANCE_ID
    };

    struct v2f
    {
        float4 vertex   : SV_POSITION;
        fixed4 color : COLOR;
        float2 texcoord  : TEXCOORD0;
        UNITY_VERTEX_OUTPUT_STEREO
    };

    fixed4 _Color;

    v2f vert(appdata_t IN)
    {
        v2f OUT;
        UNITY_SETUP_INSTANCE_ID(IN);
        UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
        OUT.vertex = UnityObjectToClipPos(IN.vertex);
        OUT.texcoord = IN.texcoord;
        OUT.color = IN.color * _Color;
#ifdef PIXELSNAP_ON
        OUT.vertex = UnityPixelSnap(OUT.vertex);
#endif

        return OUT;
    }

    sampler2D _MainTexture;
    sampler2D _AlphaTex;

    fixed4 SampleSpriteTexture(float2 uv)
    {
        fixed4 color = tex2D(_MainTexture, uv);

#if ETC1_EXTERNAL_ALPHA
        // get the color from an external texture (usecase: Alpha support for ETC1 on android)
        color.a = tex2D(_AlphaTex, uv).r;
#endif //ETC1_EXTERNAL_ALPHA

        return color;
    }

    fixed4 frag(v2f IN) : SV_Target
    {
        //standard sprite shader, only this part is different.
        //takes the sprite in
        fixed4 s = SampleSpriteTexture(IN.texcoord);

        //makes a colored version of the sprite
        fixed4 c = s * IN.color;

        //makes the grayscale version
        fixed n = (s.g + s.r + s.b) / 3;

        //So, I've scrapped the previous calculation in favor of this I'll leave the previous one in too, just for reference
        c = (c*3 + n*c.a)*c.a;
        //Adds the grayscale version on top of the colored version
        //The alpha multiplications give the neon effect feeling
        //c.g = (c.g + n * c.a) * c.a;
        //c.r = (c.r + n * c.a) * c.a;
        //c.b = (c.b + n * c.a) * c.a;
        // You can add c.a multiplications of colors
        //(i.e. turn  c.g to c.g*c.a) for less color in your effect
        //this saturates the insides a bit too much for my liking

        return c;
    }
        ENDCG
    }
    }
}

How can I improve the appearance of these corners, so they look smooth?

sentences:
How to fold a view from 2 3D cameras in Unity? I need to combine view from 2 or more 3D static cameras. Let's say I have 3 humans standing in line side by side.

The first camera is viewing the left person and the left half of the middle person.
The second camera is viewing the person on the right and the right half of the middle person.

Now I need to see the whole middle person.

Any ideas how I can do this?

I don't need to see code or some finished implementation, I just need some ideas, because I can not find anything on this.

sentences:
Why am I seeing streak artifacts on the cube map I'm rendering? I'm getting strange streaks on my cube map when rendering to it. He is my code that is being called each frame:

void drawCubeMap(void)
{

int face;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBindFramebuffer(GL_FRAMEBUFFER, fbo);
//glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMapTexture);
//glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glViewport(0,0,sizeT, sizeT);

for (face = 0; face < 6; face++) {

   glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, cubeMapTexture, 0);
   drawSpheres();
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glViewport(0,0,900, 900);
}

Any idea what it might be? The streaking occurs when I'm rotating the spheres around the main sphere.

sentences:
Rendering an object more than once Right now I'm facing the issue of rendering the same objects more than once in Directx 11, as the object has:

A diffuse shader
A directional lighting shader
A texture shader

Now the final color should be all of them somehow put together, maybe something like this:

Render Diffuse
Render Texture
Render Directional
Final Color = (Diffuse + Texture) * Lighting // Not sure about this though

But how can this be archieved? Without the EFFECTS FRAMEWORK!

sentences:
How to implement rotating Earth effect in 2D? I've modeled a photorealistic scene of the Earth rotating in 3DS Max and would like to use it as a backdrop of a menu screen in a 2D game. What would be the appropriate way to implement this effect in-game, a sprite sheet? That seems like it would require a whole mess of frames to appear convincing. Does that matter?

What if I then wanted to add the moon orbiting the Earth? A second sprite sheet for the moon's positions, with blank frames where it should be hidden behind the Earth?

Is there a better method?

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:
Correct Rotation and Translation with a 4x4 matrix I am using a 4x4 matrix to transform verts in a shader. I multiply an identity matrix by a rotation matrix by a translation matrix. I am trying to first rotate the verts and then translate them, however in my result, it appears that the verts are being transformed and then rotated.

My matrix looks something like this:

m00 m01 m02 tx
m10 m11 m12 ty
m20 m21 m22 tz
--- --- --- 1

I am not using OpenGL's fixed function pipeline, I am multiplying matrices on the client side, and uploading the matrix to a GLSL shader.

If it helps, I am using my own matrix multiplication code, but I have recreated this problem using matrices on my graphing calculator, so I don't believe my matrix code has errors..

I'll include a visual aid if needed.

sentences:
How does an iOS developer get his app/game on the AppStores main page? I was looking at the front page of the AppStore, and they display a new game and a new app every day. I was just curious, how does an iPhone developer get their game or app onto that front page? Does Apple choose what goes on there? Or do you pay money?

I was just curious, I don't develop games for iOS.

sentences:
Unity3D in WebGL the Player doesn't have animations I using Unity 2019.2.14f1 to create a simple 3D game.

I want to build the project for WebGL, but, even though the player has animations on Unity, in the web the Player doesn't have animations even though it jumps and moves around [as you can see here].

For the Player, I am using the ThridPersonController from on Standard Assets  - but I have hidden Ethan and added my own character/avatar.

And this is the inspector of the avatar:

What am I missing here?

sentences: How can I switch between texture atlases based on the iOS version? How can I switch between atlases (with different resolutions) in Unity based on the runtime iOS version?

sentences:
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:
Collision response callback First at all, I'm not asking how to handle or detect collision. I already have that.

My actual situation is, I have a system collision and I detect the collisions. Every collision detected is store as a message containing the two entities colliding with some information like type of collision or something. Later, all messages is processed.

I'm trying to figure out how to implement the reaction of the entities in every collision with that message. In the game a collision can trigger an action like talking with another, change the level, kill the character, store an object, not letting go...

I don't want to hard-code the calls and methods if possible (in my ideal world,I can define even the behaviour in an xml an read from that!). My first approach is a class where I store a list of possible actions/callback functions and attach it to the entity as a component. When a collision succed, I go to the entity and depending of the collision, execute the correspond callback.

Still I don't know how to determine the callback to execute or where I must code the behaviour. Any ideas? What you think about this approach?

By the way, I'm building everything from scratch, with c++ and SFML and following the entity system approach, for educational purpose.

sentences:
ScollRect Jumps while Filling I have a UI panel with a scollrect inside, which I fill dynamically. It can only be moved vertically.
When filling this scollrect, the content jumps up and down for one frame, creating a weird look. When I check for the VerticalNormalizedPosition of the scrollrect after each added GameObject, it always tells me, the position is 1. When I check for the position in an Update method, it sometimes gives me a small rounding error. Instead of 1 it's somewhere between 0.9999995 and 0.9999998. The height of the content holder is less trhan 2000 units, whereas the jumps seems to be more than 2000*0.9999998.

I tried to set the VerticalNormalizedPosition of the scrollrect to 1 every frame which didn't help. It also didn't help setting it after every newly added GameObject. Locking vertical scrolling also didn' help.
Is this soley a rounding error and I can't do anything about it, or is there a way to stop this jump from happening?
Here you can see the jump happening in 0.05 speed

sentences:
How to get collision area within a circle in libgdx I have a ball inside of a multi-colored circle, the ball will hit the inner area of the circle like this bellow circle image

And the Circle will be rotated clockwise or anti-clockwise based on user input.
How would I know, where the ball hit the Big Colored circle.

I just need to identify in which color of my circle sprite has made a collision with the ball.

I have tried a lot, googled a lot but still, the solution has not been found yet.

Experts, please help me.

sentences:
Rotating a gameworld using quaternion I'm a hobbyist programmer at best and I had an idea I wanted to test in Unity, I wanted to rotate the game world around 90 degrees, to this end I've been learning a tiny bit about quaternions, in this  simple test I have a empty game object at position 0,0,0 and 2 cubes placed so only one will be in the foreground at once (both children of the empty game object). I simply want to rotate the parent object on a mouse up  like so.

if (Input.GetMouseButtonUp(0)) {

        Quaternion newrot = Quaternion.Euler (0,90,0);
        transform.rotation = Quaternion.Slerp (transform.rotation,newrot,0.05f);

    }
}

The problem I am having is that this does not do the rotation in a single click and never reaches 90 degrees, it only ever tends towards 90 (for fun I decided to click for 2 minutes and only got up to 89.99999 ... well you get the picture).

Can someone tell me what I am doing wrong and if there is a better way of doing this?

sentences:
(Unity) Physics based movement vs Straight position change Unity provides a cool physics engine for game development and I want to utilize it in my game.

Shorter version

I want to use physics engine for everything else other than character movement because trying to use physics engine for player movement doesn't yield the perfectmovement speed that I want; move x units per second.

If I use physics engine for character movement, it gets complicated. I would rather just add "moved distance" to the position to have things done simple. Is doing something like this wrong? All the learning sources I read recommend to use physics engine for movement if the game incorporates physics engine. I am nervous; am I wrong?

Longer version

The following description is where I use "physics", why I need physics engine.

In my game a player fires a bullet. When enemies collide with bullet, they get pushed back slightly. A strong blast can push enemies far back so that they even bounce back from hitting wall.

A recommend, a proper way, I was told, to utilize this physics engine for character movement is to add force to the direction I want to move.

But doing so(adding force to the direction I want to move) will result in truck-like; slowly warming up by adding velocity. To avoid "truck like movement" I was told to apply greater force at the beginning. Doing so result in change in velocity like the below picture.

However problem is not over yet, you must consider a situation where you change direction of movement while the character is running.

If you started to move backward, all of the sudden while running forward, you will need to slow down forward movement burn velocity by adding backward force. Thus rotation burns velocity.

So a solution is to find out perpendicular velocity to your desired direction, then find out needed amount of force to "burn off" the undesired velocity.

This seems way too complicated for a character to simply move around. I would rather just move character to desired direction by simply adding "constant X distance" to the character's position.

But I can't find a source of example where it utilizes both "simple movement by directly adding moved distance to the position" and "using physics engine for the game". All the sources of learning(using Unity physics) I find say use this complicated way of having character to move around. I wonder is there a reason why people don't just add moved distance to the position?

sentences:
Why aren't my Unity rotations working properly? I'm experiencing a rather annoying bug and I was hoping someone could offer some help because this just isn't making sense to me. I have a Ballistic script that tells the bullet to move in its local forward direction, which should be whichever way the gun is pointing. I have a PlayerAttack script that calls for a bullet to spawn with OnShootEnter(). It sets the bullets position to that of a bulletSpawn transform, which is a child of the gun.

OnShootEnter() is being properly called and bulletSpawn is properly assigned; and yet, when the bullet spawns, its facing Vector3.forward, instead of it facing bulletSpawn.forward. These are the only two scripts affecting the bullets spawn, rotation, and direction. Everything looks in order to me; what am I missing?

public class PlayerAttack : MonoBehaviour
{
    public GameObject bulletPrefab;

    public Transform gun;
    public Transform bulletSpawn;
    public float damage;

    void OnShootEnter()
    {
        GameObject bullet
            = Instantiate(bulletPrefab, bulletSpawn.position, bulletSpawn.rotation);
     }
}

public class Ballistic : MonoBehaviour
{
    public GameObject model;
    public float range;
    public float accuracy;
    public float speed;

    Vector3 dir = Vector3.zero;

    void Start ()
    {
        model.transform.SetParent (this.transform);
        dir = transform.forward;
    }

    void Update ()
    {
        transform.GetComponent<Rigidbody> ().velocity = dir.normalized * speed;
        range -= Time.deltaTime;

        if (range <= 0)
            Destroy (this.gameObject);
    }
}

sentences:
Slick2D - Entities and rendering I have been trying to create my very first game for quite a while, followed some tutorials and stuff, but I am stuck at creating my entity system. I have made a class that extends the Entity class and here it is:

  public class Lazer extends Entity{//Just say that it is some sort of bullet

private Play p;//Play class(State)
private float x;
private float y;
private int direction;

public Lazer(Play p, float x , float y, int direction){
    this.p = p;
    this.x = x;
    this.y = y;
    this.direction = direction;
    p.ent.add(this);
}

public int getDirection(){
    return direction; //this one specifies what value will be increased (x/y) at update
}
public float getX(){
    return x;
}
public float getY(){
    return y;
}
public void setY(float y){
    this.y = y;
}
public void setX(float x){
    this.x = x;
}
     }

The class seems pretty good , after speding some hours googling what would be the right thing.
Now, on my Play class. I cant figure out how to draw them. (I have added them to an arraylist) On the update method , I update the lazers based on their direction:

public void moveLazers(int delta){
       for(int i=0;i<ent.size();i++){
           Lazer l = ent.get(i);
           if(l.getDirection() == 1){
               l.setX(l.getX() + delta * .1f);
           }else if(l.getDirection() == 2){
               l.setX(l.getX() - delta * .1f);
           }else if(l.getDirection() == 3){
               l.setY(l.getY() + delta * .1f);
           }else if(l.getDirection() == 4){
               l.setY(l.getY() - delta * .1f);
           }

       }
   }

Now , I am stuck at the render method. Anyway , is this the correct way of doing this or do I need to change stuff? Also I need to know if collision detection needs to be in the update method. Thanks in advance ~ Teo Ntakouris

sentences:
How to move Vector2 along angle? These are my Vector2's that I am using for this function.

public Vector2 position = new Vector2();
public Vector2 velocity = new Vector2();
public Vector2 movement = new Vector2();
public Vector2 direction = new Vector2();

Here is the function that I use to move the position vector along an angle. setLocation() just sets the new location of the image.

public void move(float delta, float degrees) {
    position.set(image.getX() + image.getWidth() / 2, image.getY() + image.getHeight() / 2);
    direction.set((float) Math.cos(degrees), (float) Math.sin(degrees)).nor();
    velocity.set(direction).scl(speed);
    movement.set(velocity).scl(delta);
    position.add(movement);
    setLocation(position.x, position.y); // Sets location of image
}

I get a lot of different angles with this, just not the correct angles. How should I change this function to move a Vector2 along an angle using the Vector2 class from com.badlogic.gdx.math.Vector2 within the LibGDX library?

I found this answer, but not sure how to implement it.

Update: I figured out part of the issue. Should convert degrees to radians. However, the angle of 0 degrees is towards the right. Is there any way to fix this? As I shouldn't have to add 90 to degrees in order to have correct heading. New code is below

public void move(float delta, float degrees) {
    degrees += 90; // Set degrees to correct heading, shouldn't have to do this
    position.set(image.getX() + image.getWidth() / 2, image.getY() + image.getHeight() / 2);
    direction.set(MathUtils.cos(degrees * MathUtils.degreesToRadians), MathUtils.sin(degrees * MathUtils.degreesToRadians)).nor();
    velocity.set(direction).scl(speed);
    movement.set(velocity).scl(delta);
    position.add(movement);
    setLocation(position.x, position.y);
}

sentences: Simple message box in gdscript / godot I want a single line of code which shows a popup dialog with the words "Hello World!" and an "Ok" button.  (I want something simple for now, I know how to make something more complicated but that would be stupid at this point in development).

sentences:
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: Find the closest point on a ray I've got a ray defined by P1 and P2, and then a target P3, and I want to find P4. How do I go about this? I've come to understand that I should use vector projection, but I can't get it to work. Any help? I'm using C# and XNA.

sentences:
Is Google App Engine a good platform for an online MMO? I'm looking at some ideas of creating a smale scale MMORPG game, based in Java, this is a side/hobby project to help my learning process

I've already had a play with GAE and have put up a simple web app, I'm thinking of using this as my platform for a game

Is this a good idea? Are there any games out there that use such a platform? I can't see any limitations so far, other than Google might be able to "own" it rather than myself

sentences: How can I draw textures with JOGL? I have begun to learn OpenGl and using JOGL. There's something I haven't found any actual or easy guide to though: how can I draw textures? For example, what kind of code would I need to draw a texture at (X, Y, Z) position? I want to use glDrawArrays() or glDrawElements().

sentences:
Cube doesn't render as expected when rotated (representing 3D in 2D) Cube.

When I rotate the object around OZ moves to the left.

Rotation around OX - the cube rises up.

Rotation around the OY-the cube is compressed.

The function I use for rotation:

void rotation(double angleX, double angleY, double angleZ, int x, int y, int z)
{
    angleX = angleX * M_PI / 180;
    angleY = angleY * M_PI / 180;
    angleZ = angleZ * M_PI / 180;

    double cX = cos(angleX);
    double sX = sin(angleX);
    double cY = cos(angleY);
    double sY = sin(angleY);
    double cZ = cos(angleZ);
    double sZ = sin(angleZ);

    double x0 = x;
    double y0 = y * cX + z * sX;
    double z0 = z * cX - y * sX;

    double x1 = x0 * cY - z0 * sY;
    double y1 = y0;
    double z1 = z0 * cY + x0 * sY;

    double x2 = x1 * cZ + y1 * sZ;
    double y2 = y1 * cZ - x1 * sZ;

    SDL_RenderDrawPoint(ren, x2, y2);
}

Used matrices. However, the result was the same.

sentences:
How do you handle uneven tiles while rendering a tile map? Here is what I want to do with my tile map that I am unsure of. As you can see the top walls are way larger then the bottom and side ones (this is also an issue with my corners which are odd shapes [more like an L then a square] as well as larger then the 40x40px that my current tiles are).

I have also attached the tile sheet I am using for the tiles to show you what the corners and tops look like compared to the rest of the tiles.

What I’m thinking is I might be able to just draw them using the same array I have if I use the tiles width and height instead of a set WxH? I dont know how well this will work, but were the blocks that will have different values will be blocks the player/NPCs can’t step on then it may not be an issue, again I’m not even sure if that is a viable solution.

My code in case you want to see how I'm currently handling it: Map.java (pastebin)
(edit:im not handling it, meant how I'm currently doing the map)

tl;dr - how can I take take my 2d looking tile map and change it to have different size tiles? or is there a better way to do what I am trying to do? Is there a name of a method that I should be looking for while googling?

sentences:
Ray Sphere Interesection Distances WRONG The discriminant is not working. This code produces incorrect distances from ray to sphere, but it can tell whether or not the ray does strike the sphere.

HOW HARD IS THIS I'VE BEEN TRYING TO DO THIS FOR 2 DAYS

float raySphereIntersect2(glm::vec3 ray, glm::vec3 origin, glm::vec3 sphere_origin, float sphere_radius, float drawdistance){
    //A sphere is given by its center
    float cx = sphere_origin.x;
    float cy = sphere_origin.y;
    float cz = sphere_origin.z;
    //its radius R
    float R = sphere_radius;
    //and its color
        //Ignored
    //A line segment (ray) is given by its endpoints:
    //P0
    float x0 = origin.x;
    float y0 = origin.y;
    float z0 = origin.z;
    //and P1
    float x1 = origin.x+(ray * drawdistance).x;
    float y1 = origin.y+(ray * drawdistance).y;
    float z1 = origin.z+(ray * drawdistance).z;
    //set
        float dx = x1 - x0;
        float dy = y1 - y0;
        float dz = z1 - z0;

        float a = dx*dx + dy*dy + dz*dz;
        float b = 2*dx*(x0-cx) + 2*dy*(y0-cy) + 2*dz*(z0-cz);
        float c = cx*cx + cy*cy + cz*cz + x0*x0 + y0*y0 + z0*z0 + -2*(cx*x0 + cy*y0 + cz*z0) - R*R;

        float discriminant = (b * b) - (4 * a * c);
        if (discriminant < 0)
            return -1;
        // OK so there is a solution, compute the distance
        float t = (-b - sqrtf(discriminant))/(2*a);
        return t;
}

sentences:
3D camera implementation I've been bashing my head against the concept of a 'camera' for my 3D world for some time now, and I'm not sure I'm doing this right anymore.  Maybe I've been working on this for too long and have confused myself, or I have a fundamental mis-understanding of the topic.  Therefor, I could use a refresher/help on the concept of a 3D camera object and how that is supposed to operate.  I have a camera class with a position, an orientation (quaternion), and a derived transformation matrix.  Currently, my draw loop looks something like this:

Start Frame
Mult current matrix with matrix: Camera.Transform.Inverse
Save current matrix
Render all objects
Restore matrix
End Frame

However, this makes the camera's position reflected about the origin (ie, the camera's position vector has negative values but DRAWS as if it had positive values) and modification of position and rotation are consequently negated from their expected values (to get closer to the origin from z=3, I must add...).

So here is my issue: am I using this correctly?  How is a camera supposed to work?  Say I want to billboard something, how would I use the camera's information to do this?

Additionally, the clipping plane suddenly cuts out my scene if I rotate too far in any direction and I'm not sure why.  How can I fix/avoid this using camera information?  Any help is much appreciated!

sentences:
Unable to rotate box2d body with torque if revolute joint introduced I created a simple body (PLAYER) which, as speed increased the angle of the body increases slightly.  I set the torque property based on velocity, to change the body's angle, and it looks like the player is leaning forward as he runs.  Great.
I wanted to prevent my PLAYER from flipping over (when hitting other bodies), so I created a second body and placed a revolute joint between them.  The second body has rotation disabled, and is dynamic.  I discovered that I did not need to apply any angle limits to prevent flipping, since the joint seemed to resist rotation.  The player actually rights himself if flipped on his side.  (The joint seems to want to return to 0 angle). The motor is disabled, no motor speed, no motor torque.  Still, the joint returns to 0'.
The PLAYER still rotates a bit when hitting other bodies, but I can no longer rotate the body with any torque value (to make him lean forward).  Why?  I need to restore the leaning effect.
I don't understand why the second body + revolute joint prevent rotation due to any torque applied.  Can someone explain, and offer solution?

sentences:
Is there a quick way to determine if a vector is in a quadrant? I am wondering if there is a quick easy way to determine if a given vector is in a specified quadrant.

In the below image, I've define the ranges of the blue quadrants.

For example, if I am given a sample vector of -9.4,13.3 is there an easy way to figure out which of the four quadrants it is in (Q2)?

I'm looking to know if there is some vector math that can determine this relatively simply instead of doing a bunch of less than / greater than operators on a fixed range.

Considering that I could have more or less than 4 quadrants and they might not be at this nice 45 degree angle.

sentences:
Java game loops with high tick times? Take for example the first game loop from this question. A similar code is used in Minecraft (at least in older versions). I understand the concept and how this loop works in principle. But there is something I'm wondering about for a long time now. There are 20 tps (ticks per second) in Minecraft for example. There can be more fps (frames per second) than tps because the game loop renders as many frames as possible in the time which is left between the ticks. It's also clear to me, that one can do "partial ticks" or interpolations for each frame between the ticks to make the game smoother. This is actually the reason why there should be more fps than tps. Without the interpolations each frame between the ticks would be exactly the same.
Now suppose I write a game with 20 tps (50 ms (milliseconds) period) and an expected tick time of 40 ms as an extreme example. The expected tick time is the time, which the tick() function takes on average. Then there are 10 ms left each tick for rendering on average. Suppose rendering is very fast and the game still reaches 60 fps. However, the game wouldn't be smooth in this case because there are always long time intervals of about 40 ms, where no frame is rendered.
Of course I know that this is an extreme example and one would try to avoid such high tick times if possible. However, I want to know if there is a commonly used solution for this problem? Unfortunately I can't find any resources about this topic or this specific question.
I've come up with these ideas to solve this problem: One could try to ...

... render frames based on the current number of fps and buffer the frames for a while, to show them more frequently and smooth.
... tick and render on different threads. However, this has the disadvantage that one has to care about thread safety. The render thread must get or copy the data to show in a valid state somehow. This seems very inefficient and complicated.

Is there (another) common way to do this in game development?

sentences:
Why is the size of glm's vec3 struct 12 bytes? When trying to determine the size of glm::vec3 (from GLM math library) by using the size of operator like so:

sizeof(glm::vec3)

I get 12 returned. When I look at the definition of a vec3 struct I see this:

    template <typename T, precision P = defaultp>
    struct tvec3
    {
        // -- Implementation detail --

        typedef tvec3<T, P> type;
        typedef tvec3<bool, P> bool_type;
        typedef T value_type;

#       ifdef GLM_META_PROG_HELPERS
            static GLM_RELAXED_CONSTEXPR length_t components = 3;
            static GLM_RELAXED_CONSTEXPR precision prec = P;
#       endif//GLM_META_PROG_HELPERS

        // -- Data --

#       if GLM_HAS_ANONYMOUS_UNION
            union
            {
                struct{ T x, y, z; };
                struct{ T r, g, b; };
                struct{ T s, t, p; };

#               ifdef GLM_SWIZZLE
                    _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
                    _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
                    _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
                    _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
                    _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
                    _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
                    _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
                    _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
                    _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
#               endif//GLM_SWIZZLE
            };

         //other code......
       }

For which I see three structs, each with three member variables of templated type T, which in GLM defaults to float type. My question is why is the sizeof() operator returning 12 bytes as the size of glm::vec3 when it looks like it should be 36 bytes:

3 structs, with 3 float members each = 3*3*4(number of bytes in a float) = 36.

sentences:
In Unity (2017) is there a way to set the buttons used by Input.GetAxis() programatically? The buttons used for keyboard axis inputs can be set manually via Negative and Positive Button fields for the axis at Edit > Project Settings > Input Manager. However I'd like to make this a user configurable option which I think means needing to set the button values from a script.

I've been looking for a method along the lines of:

Input.SetAxis("Vertical").positveButton

But so far I'm striking out. Is there a way to do this?

sentences:
How to make a changeable color constant for editor materials? Due to the nature of a project I'm working on, the models I got have a bunch of redundant materials on them. I have to fiddle around with some of the colors, but every time I want to change the colors, I have to change each material to the exact same color.

Is there any way to declare some kind of swatch that I can change and have those changes just apply to the materials or anywhere else? For instance, in code, you'd just make a readonly Color mainColor, that you'd use wherever you need and could change at will. I'm looking for this kind of behavior in the editor itself.

sentences:
User input text in pygame I want a text box to appear on the screen. I am doing this by:

TextButton= pygame.draw.rect(Screen,Red, (100, 100, 150,50),2)

How can I allow the user to enter a text into this text box in Pygame? The text box should say 'Enter your name here'. When the user clicks on it, they should be able to enter their name, and submit it if the textbox is not empty. How can I do this in pygame?

sentences:
Trademarks - a couple of questions I got a couple of questions about game trademarks.

When should I submit a trademark for my game if I see that this is a serious project?
Where do I submit a trademark request? Does it have to be local (In my country)?
What do I need to be ready to submit a trademark request?

Thanks!

sentences: How to draw an arc between two angles? I'd like to draw an arc between two specific angles. For example, "draw an angle between 0 and 90 degrees" and it will draw only that part of the circle and ignore the rest.

sentences:
How do I render everything in software using XNA/C#? I'm trying to find how to render everything with software in XNA, but I can't find what option I need to set.

I'd like to know which method/properties I have to call/set to make my app run in software mode as opposed to hardware accelerated mode.

sentences:
Unity: Opacity over Distance with Surface Shaders I want to tweak the alpha value based on the distance to the camera. But I see no way of passing the vertex position on to the surface function using surface shaders. Not a problem with frag shader.
It's for fading out vegetation and creating LOD systems.
Shader "asdf" {
SubShader {
    CGPROGRAM
    #pragma surface surf StandardSpecular alphatest:_Cutoff addshadow vertex:vert

    struct v2f {
        float4 pos : TEXCOORD1;
    };

    struct Input {
        float2 uv_Maintex;
    };

    v2f vert (inout appdata_base v) {
        v2f o;
        o.pos = mul(unity_ObjectToWorld, v.vertex);
        return o;
    }

    void surf (Input IN, inout SurfaceOutputStandardSpecular o) {
        //Need vertex or pixel distance here:
        //float dist = length(v2f.pos.xyz - _WorldSpaceCameraPos.xyz);
        //o.Alpha = saturate(50/dist);
    }
    ENDCG
}
}

sentences:
Camera rotation (OpenGL) I am having trouble with a camera class I am trying to use in my program. When I change the camera_target of the gluLookAt call, my whole terrain is rotating instead of just the camera rotating like it should.

Here is some code from my render method:

camera->Place();

    ofSetColor(255, 255, 255, 255);

 //draw axis lines
 //x-axis
 glBegin(GL_LINES);
 glColor3f(1.0f,0.0f,0.0f);
 glVertex3f(0.0f,0.0f,0.0f);
 glVertex3f(100.0f, 0.0f,0.0f);
 glEnd();

 //y-axis
 glBegin(GL_LINES);
 glColor3f(0.0f,1.0f,0.0f);
 glVertex3f(0.0f,0.0f,0.0f);
 glVertex3f(0.0f, 100.0f,0.0f);
 glEnd();

 //z-axis
 glBegin(GL_LINES);
 glColor3f(0.0f,0.0f,1.0f);
 glVertex3f(0.0f,0.0f,0.0f);
 glVertex3f(0.0f, 0.0f,100.0f);
 glEnd();

 glColor3f(1,1,1);

 terrain->Draw();

And the rotate and place methods from my camera class:

void Camera::RotateCamera(float h, float v){
hRadians += h;
vRadians += v;

cam_target.y = cam_position.y+(float)(radius*sin(vRadians));
cam_target.x = cam_position.x+(float)(radius*cos(vRadians)*cos(hRadians));
cam_target.z = cam_position.z+(float)(radius*cos(vRadians)*sin(hRadians));

cam_up.x = cam_position.x-cam_target.x;
cam_up.y = ABS(cam_position.y+(float)(radius*sin(vRadians+PI/2))) ;
cam_up.z = cam_position.z-cam_target.z;
}

void Camera::Place() {
//position, camera target, up vector
gluLookAt(cam_position.x, cam_position.y, cam_position.z, cam_target.x, cam_target.y, cam_target.z, cam_up.x, cam_up.y, cam_up.z);
}

The problem is that the whole terrain is moving around the camera, whereas the camera should just be rotating.

Thanks for any help!

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:
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:
Top-Down mapping with GLEED2D: Collision and Faux 3D This is just a theoretical question. I was thinking of using GLEED2D to map a top-down game (I haven't decided on what type, but that shouldn't matter for this question.). I chose GLEED2D because I was getting tired of tile-based maps, and wanted to try something new.

However, two questions come to mind: How would you implement collision, and how would you display faux 3d? (I can't come up with a better name. It's where in RPGs and other topdown games you can have a bottom wall that obscures your character if you walk up to it. Say there's a pillar on the map. On a tiled map, it takes up one tile of space that you can't move on to, but the sprite itself is taller than one tile, so it covers character when you are behind it.)

An idea I had was to use the primitive shapes such as the Path to define areas where the character should collide. But then there's the faux 3d issue, which I can't figure out. Maybe GLEED2D isn't meant for it?

sentences:
C# 2D game collision detection huge problem I'm making my first game using C# and Monogame and I have a huge problem with collision detection.

The entire code is in a link below:

My game code

So, I use Vector2 to keep position and dimensions of objects such as characters and blocks which are elements of the map.

The problem is here(I guess):

    protected virtual void CollisionDetection()
    {
        if (!CanGoRight()) pos.X -= velocity;
    }

    protected bool IsTouchingLeft(Basic2d asset)
    {
        return pos.X + dims.X / 2 > asset.pos.X &&
               pos.X - dims.X / 2 < asset.pos.X &&
               pos.Y + dims.Y / 2 < asset.pos.Y - asset.dims.Y;
               //pos.Y - dims.Y / 2 > asset.pos.Y;
    }

    protected bool CanGoRight()
    {
        foreach (Basic2d asset in Globals.GameAssets)
            if (IsTouchingLeft(asset)) return false;
        return true;
    }

The Hero object stops while walking on the floor when the Basic2d objects ends. But I have in my code that he's supposed to stop if his bottom side(bottom of the feet)(in pixels) is lower than floor's object upper side. And he seems not to see the brick(Basic2d object) that is a real obstacle on his way, he just goes through it.

I have no idea what is wrong.

sentences:
How do I undo changing the color of an image in Slick2d? This code colors the enemy red:

enemies.get(i).image.setColor(0,1,0,0,1);
enemies.get(i).image.setColor(1,1,0,0,1);
enemies.get(i).image.setColor(2,1,0,0,1);
enemies.get(i).image.setColor(3,1,0,0,1);

if I set it to:
enemies.get(i).image.setColor(0,0,0,0,1);
it turns it pure black, and if I set it to
enemies.get(i).image.setColor(0,0,0,0,0);
it turns the enemy invisiable

How do I un-color enemy red? as in return to state as it was before it was colored.

Documentation link.

sentences:
OpenGL cube map is always black When creating and rendering a skybox with a cube map texture, the skybox is black.

Here is how I create the cube map texture:

GLuint loadCubemap(std::vector<std::string> faces)
{
    GLuint textureID;
    glGenTextures(1, &textureID);
    glActiveTexture(GL_TEXTURE0);

    int width,height;
    unsigned char* image;

    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
    for(GLuint i = 0; i < faces.size(); i++)
    {
        image = SOIL_load_image(faces[i].c_str(), &width, &height, 0, SOIL_LOAD_RGBA);
        glTexImage2D(
                    GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
                    GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image
                    );
    }
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_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);
    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

    return textureID;
}

Here is how I draw the cube map:

void Skybox::update()
{
    //the sky box should be in the background
    glDepthMask(GL_FALSE);

    //set the position of the skybox around the camera
    pos = Camera::getCurrentlyBound()->getPos();

    //faces of the cube map
    std::vector<std::string> faces = {
        "/home/a/Programming/GameEngine/Game/Assets/skybox_px.png", //+x
        "/home/a/Programming/GameEngine/Game/Assets/skybox_nx.png", //-x
        "/home/a/Programming/GameEngine/Game/Assets/skybox_py.png", //+y
        "/home/a/Programming/GameEngine/Game/Assets/skybox_ny.png", //-y
        "/home/a/Programming/GameEngine/Game/Assets/skybox_pz.png", //+z
        "/home/a/Programming/GameEngine/Game/Assets/skybox_nz.png", //-z
    };

    //create the texture object
    GLuint cubeMap = loadCubemap(faces);

    //set up some matrices
    glm::mat4 modelMatrix = glm::translate(glm::mat4(), pos)*glm::mat4_cast(orien);
    glm::mat4 mvpMatrix = Camera::getCurrentlyBound()->getVP()*modelMatrix;

    //you can ignore this part
    Program* prog = ProgramManager::getProgram(msh.getProgramPath());

    //bind the program
    prog->bind();

    //set uniform data
    prog->setUniformData(mvpMatrix, "MVP");

    //bind the VAO
    msh.bind();

    //bind the cube map texture
    glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMap);

    glDrawElements(GL_TRIANGLES, msh.getNumVerts(), GL_UNSIGNED_INT, 0); //draw

    msh.unbind(); //unbind the VAO

    prog->unbind();

    glDepthMask(GL_TRUE);

}

And here are the shaders:

Vertex Shader:

#version 330 core

in vec3 pos;

uniform mat4 MVP;

out vec3 fragTexVector;

void main()
{
    gl_Position = MVP*vec4(pos, 1);
    fragTexVector = pos;
}

Fragment Shader:

#version 330 core

out vec4 finalColor;

in vec3 fragTexVector;

uniform samplerCube skybox;

void main()
{
    //finalColor = vec4(1,1,1,1);
    finalColor = texture(skybox, fragTexVector);
}

I have scanned over this piece of code and over my entire project many times to find what was wrong and could not find anything. The samplerCube seems to always get black pixels.

Extra Information (might be helpful, I'm not sure):

I have tried debugging the program with VOGL (Valve's opengl debugger) but when I try to capture a snapshot of a frame it crashes with an error:

Internal error: KTX texture failed internal consistency check, texture 7 target GL_TEXTURE_CUBE_MAP. This should not happen!

I'm very new to OpenGL and if anybody with OpenGL experience could help me with issue it would be greatly appreciated.

Thanks.

sentences:
XNA Monogame - Move .dll and .xml root folder I was just wondering if it's possible to move the dll and xml files into a subfolder, like in this picture:

Thanks !

sentences:
How do I make dialogue text appear with a beeping effect? I'm interested in old-school RPG dialogue boxes, where text appearing in dialogue boxes is accompanied by a subtle beeping sound. This is demonstrated in a video here.

Is this morse code translated to audio?

How can I achieve such an effect?

sentences:
how to handle server tick update for multiple rooms? (Nodejs) I'm making a multiplayer game using socketio + nodejs. Currently I use setInterval on my server and requestAnimation on my client render. Now I want to create multiple game instances for each room and so I ask how to do so efficiently:

Do I initialize a new setInterval for every game created and call clearInterval when that game ends? or...
Should I create only one instance of setInterval and loop through each active game and update them?
Should I be using setInterval at all?

EDIT: For clarification, my current single setInterval simply does this at about 15hz:

-update each player position based on input

-notify all clients of new positions

input is received as soon as the client sends them, handled by socketio. Sending this many emits is intentional because my server is authoritative and my game is slow (imagine a snakes clone). I intend to allow as many games as there are rooms, which is indefinite (or as many as one server can handle)

sentences:
Quaternion.Lerp does not actually rotate object when called inside an "if" clause Let's say I have a RotatableObject class, which inherits from MonoBehaviour. Here is its Start() method:

private void Start() {
    this.startingLocalRotation = this.transform.localRotation;
    this.finalLocalRotation = Quaternion.Euler(this.startingLocalRotation.eulerAngles.x, -150f, this.startingLocalRotation.eulerAngles.z);

    // Initialize other private fields
}

It has a method called Rotate(), defined as follows:

private void Rotate() {
    this.transform.localRotation = Quaternion.Lerp(this.startingLocalRotation, this.finalLocalRotation, 0.2f);
}

Given the following Update() method, the object rotates as expected:

private void Update() {
    this.Rotate();
}

However, if I make the following changes to Update(), then the object does not actually rotate, even though the Rotate() method is hit:

private void Update() {
    if (this.SomeCondition) {
        this.Rotate();
    }
}

this.SomeCondition always has the value true over multiple frames.

What is my mistake, and how can I fix it?

EDIT:

In response to this comment:

  When you say "the object rotates as expected" do you mean that the
  object rotates from starting angles until final angles and then stops
  rotating (without the if) ?

Yes.

  could you provide some more details about what SomeCondition is?

this.SomeCondition is determined by the state of another object, say, Puppy. E.g. if puppyInstance.Mood == Mood.Happy, then this.SomeCondition is true.

  Did you try replacing the condition with the word true

No, I have not tried that. However, when stepping through the call stack in debug mode, I can see that this.SomeCondition is true and Rotate() is called -- I managed to step into the Rotate() method itself.

EDIT:

I tried the first approach described in this answer. However, it did not produce the effects that I was aiming for.

I set a breakpoint here:

transform.localRotation = Quaternion.Lerp(
   startingLocalRotation,
   finalLocalRotation,
   _rotationProgress
);

Every single time the breakpoint was hit in the Update() call, I could see that the value of _rotationProgress was steadily increasing. However, the value of transform.localRotation never actually changed -- it was always (-0.7, 0.7, 0.0, 0.0).

If I updated transform.localRotation outside of an if clause, however, that game object rotates as expected -- transform.localRotation gets updated as _rotationProgress gets updated.

EDIT:

Never mind, I am an idiot. The problem lies elsewhere in the code. The suggested approach works and I have accepted it as the answer.

sentences:
JWJGL Multi-threading to separate update and render Introduction:

I am currently designing a game in Java using the LWJGL 3.0, with Gradle. I have quite an advanced knowledge on multi-threading, and I am aware how GLFW does/doesn't implement multi-threading from this guide. Currently, I have one class Updater with a loop for updating, and another class Renderer for rendering, each extending Runnable with their own loops and time calculations. Below is a diagram showing the structure of the classes and update and render methods. I have also set up a lock system, using the Java Lock class (again below).

My Problem:

Despite setting each thread as the current context before each loop executes its window call, and setting the current context to null at the end, I still get the error Exception in thread "RENDERER" java.lang.IllegalStateException: GLFW error [0x10008]: WGL: Failed to make context current: The requested resource is in use. Any idea as to why? Been at this for a few hours now.

Loop class:

private void threadLoop() {
    try {
        lock.lock();
        locked = true;
        loop();
        TPS++;
    } catch (InterruptedException e) {
        e.printStackTrace();
    } finally {
        lock.unlock();
        locked = false;
    }
}

@Override
public void run() {
    init();
    long lastTime = System.nanoTime();
    double ns = SECOND / (MAX_TPS/2);
    double delta = 0;
    long timer = System.currentTimeMillis();
    while (running) {
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while(delta >= 1) {
            threadLoop();
            TPS++;
            delta--;
        }
        if(System.currentTimeMillis() - timer > 1000) {
            finalTPS = TPS;
            timer += 1000;
            TPS = 0;
        }
    }
    stop();
}

Thread Manager:

public void update() {
    if (window == null) return;
    window.setThread();
    window.update();
    window.nullThread();
}

public void render() {
    if (window == null) return;
    window.setThread();
    window.render();
    window.nullThread();
}

Renderer:

@Override
protected void loop() {
    if (state != null) state.render();
    threadManager.intermediateCode();
    threadManager.render();
}

Updater:

@Override
protected void loop() {
    if (state != null) state.update();
    threadManager.intermediateCode();
    threadManager.update();
}

Window:

public void setThread() {
    glfwMakeContextCurrent(getID());
}

public void nullThread() {
    glfwMakeContextCurrent(NULL);
}

public void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glClearColor(0.0f, 0.3f, 0.8f, 0.0f);
    glfwSwapBuffers(ID);
    System.out.println("Rendered window");
}

public void update() {
    glfwPollEvents();
    System.out.println("Updated window");
}

sentences:
How to emulate Mode 13h in a modern 3D renderer? I was indulging in nostalgia and remembered the first game I created, which used Mode 13h.

This mode was really simple to work with, since it was essentially just an array of bytes with an element for each pixel on the screen (using an indexed color scheme).

So I thought it might be fun to create something nowadays under these restrictions, but on modern hardware. The API could be as simple as:

public class Mode13h
{
    public byte[] VideoMemory = new byte[320 * 200];
    public Color[] Palette = new Color[256];
}

Now I'm wondering what would be the best way to get this data on the screen, using something like XNA / DirectX / OpenGL.

The only solution I could think of was to create a texture with the same size as the VideoMemory array, write the contents of VideoMemory to it every frame, then render that texture in a full screen quad with the correct aspect ratio and using point texture filtering for that retro look.

Is there a better way?

sentences:
Is glxinfo saying that the 980 GTX doesn't support a 32 bit depth buffer? I've been using the glxinfo command (glxinfo -v) to explore the supported framebuffer configurations. There are two values relating to depth, "depth" and "depthsize." According the source, it appears that the "depth" value relates to the X config and the "depthsize" value relates to the OpenGL config.

Assuming that is correct, would the lack of a "depthsize=32" entry suggest that 32 bit depth buffers aren't supported? Or is my understanding of the glxinfo output flawed?

sentences:
How to custom file formats work, encryption, packing etc So say I take an example from Telltale games, they pack all their file assets into ttarch files, now I guess this is a custom file format that allows many file assets such as dds, jpg, bik, wav, 3ds etc to be packed into one file.

So someone has worked out how to explore these ttarch files and inside as you would imagine there are hundreds of files each with non standard file extensions(apart from the  lua files) such as d3dtx, d3dmesh, vers, spline, style, scene, there are also lua files which we all know.

The d3dtx files will be dds, jpg, bmp etc, so do you actually encrypt a dds file in this way, can someone enlighten me on the process of file encryption/packing files together?

sentences:
How to add a UI Text for keeping Score in Unity 5 My Problem is simple I want to show scores on my game. The examples on internet are good but in Unity 5 there are no GUI elements but instead these are now UI elements. I was following this example: https://unity3d.com/learn/tutorials/projects/space-shooter/counting-points but it didn't work.
I followed the code and added a new UI text to the scene as in the picture.

After adding the script to a .cs file and declaring public GUIText scoreText; and making this text as prefab when I drag it to the inspector panel it didn't get attached.

and it gave this error:

The variable scoreText of Fruits has not been assigned.
You probably need to assign the scoreText variable of the Fruits script in the inspector.

Fruit is a projectile and every time this projectile hits the container it should add the score. So how to do this in Unity 5. I've seen in one example online that on previous versions of unity there was this option of adding GUI Text in GameObject.

sentences:
Balance advantage of having the first turn I'm developing a game in which two players compete for area domination. Each player can play four moves per turn, ideally conquering four tiles.
Edit: Here a little more detail on the mechanics: Each player is given the same amount of cards (about 20). Each card has a value. The board consists of 4x5 tiles which you conquer by placing a card on it. If there already is a card on the tile, your can still conquer the tile but your card must have a higher value than the card on the tile.

The problem is that player two could technically (almost) always just undo player ones moves by conquering the same areas immediately. Of course this isn't fun at all and no human player would play this way, but I'm working on implementing an AI opponent, and I've seen the above happen a few times:

Player one conquers four tiles with pretty low value cards
player two immediately takes them
player one takes them back again because not doing so would be a disadvantage
player two takes them back again etc...

So as you can see, this is definitely not the best strategy as it becomes ridiculously expensive to possess the tiles of interest, but there are strategies or situations in which you might play like this.

How should I balance this? Are there any common design solutions for this problem?

(Having player one play more moves in the first turn would give player one a huge advantage as it would allow him/her to conquer highly strategic areas in the first turn. (Unfortunately, the "immediately undo player ones moves" strategy is actually not mathematically bad for player two, but that's another issue))

sentences:
How to handle game states for a single-player / multiplayer game? I'm developing a little simon-like game and I'd like to know what the best approach is when it comes down to game states.

What would be the best approach?

Creating different states/screens for 1-player and 2-player game sessions.
Creating just one state/screen with validation from a variable that holds the selection made by the player on the title screen.

sentences:
Libgdx can't read .ttf file when running Android configuration Firstly, I am aware that a similar question was asked some time ago that went unanswered. Currently, it has multiple upvotes but no answer.

The error

com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/font/font1.ttf (Internal)
...
Caused by: java.io.FileNotFoundException: font/font1.ttf

occurs when I use the class FreeTypeFontGenerator provided by Libgdx as a extension to use freetype fonts(link). This is the line in my project that caused error:

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/font1.ttf"));

I can be fairly certain that my path to the .ttf is correct, as the desktop configuration runs perfectly, showing the font as desired.

My guess: I didn't include the freetype extension when creating this libgdx project. When following the tutorial to include it (that is, adding the freetype dependencies in build.gradle), something somehow went wrong. But even this is not convincing enough.

build.gradle:

project(":desktop") {
    apply plugin: "java"

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"

    }
}

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"

    }
}

sentences:
Run XNA game without graphics Wondering if there is anyway to run an XNA game with out displaying anything.

I have a working game that runs in a client server setup where one player is the host and other people can connect to his game.

I now want to be able to run the game as a host on a decicated server with no graphics card, basically I dont want to run any Draw() logic at all.

Do i really need to go through the entire game and remove all references to XNA?

How have people done this?

EDIT: The reason I want to do this is because I have a working client server setup in the game and I dont want to make a separate "headless" server program.

sentences:
How to securely store xml/json information about actors in a game? I'm developing a 2D "small" offline rpg game, and to this point I have many actors (mobs, heroes, NPCs) and what I did, is created a class named "Actor" and each time I have a new actor I create a whole new class extending it.

I was thinking if I could limit it and go with a single class (prototype pattern?) were each instance of it gets its info and properties from stored files (name, weight, HP, attack, playable, ...)

I thought first to use xml to store every actor I have in the game, so it would be a lot easier to modify or add new actors, and this goes for also weapons, gear, potions, etc.

I'm afraid to use XML or JSON, because this would make the game content open and then anyone can modify it.

So, any thoughts on how to implement that, because i'm totally new to game dev?

sentences:
Both Trigger and Collision BoxCollider2D My Player sprite needs to collide with some objects and be unable to pass through them and in other cases detect when it passes through some object (e.g. some non-fatal enemies and some one-way barriers).

How do I test what an object is and make enforce one collision type or the other?

sentences: The Physics behind 2D Platformer Games? Is there any good book or tutorial that explains the physics behind creating a 2D Platformer game? Such as tile rendering, tile map reading, collision detection, camera movement etc.?

sentences:
Java looking in wrong directory for XML I found this suggestion on a Stack Exchange site to print out what the current directory is:

File file = new File(".");
for(String fileNames : file.list())
    System.out.println(fileNames);

Basically, when I run a game in Eclipse, I get this:

But when I compile the game and run it, it prints out this (it prints out the stuff that is in the same directory as the JAR file is). Images, and sound are working fine. It's just the XML file that is causing this.

How do I make Java read XML files from res folder like it does for images and sound in Eclipse?

My particular code that loads the XML is at http://pastebin.com/59Nt7Dtd.

Slick2D documentation is at http://www.slick2d.org/javadoc/.

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:
Libgdx Recoil Effect I set -velocityX to my sprite gun.

float velocityX = -20 * dt;
if(trigger) {
   gun.setX(gun.getX() + velocityX);
}

I basically set a velocity of -20m/s to my gun vertex X. The problem is when I rotate the gun in a vertical position or example: 30degree angle.

How can I add recoil effect even if the sprite is not in a horizontal position, or should I just add it in the animation?

sentences:
WWWForm - .AddField vs .headers I am using WWWForm to do the equivalent of GET and POST from python. To add headers to my unity requests, according to the documentation I could two options:

WWWForm form = new WWWForm ();

form.AddField("user", username); //OPTION 1:
https://docs.unity3d.com/ScriptReference/WWWForm.AddField.html

form.headers["user"] = username; //OPTION 2:
https://docs.unity3d.com/ScriptReference/WWWForm-headers.html

With the risk of asking a very naive question: Can someone explain the difference between the two? Thank you

sentences:
How should I model an economy-based game in code? I'd like to create an economy game based on an ancient civilization. I'm not sure how to design it. If I were working on a smaller game, like a copy of "Space Invaders," I'd have no problem structuring it like this:

Main Control Class
Graphics Class
Player Class
Enemy class

I don't understand how I'd do this for larger projects like my economy game. Do I create a country class that contains a bunch of towns? Do the towns contain a lot building class, most contain classes of people? Do I make a path finding class that the player can access to get around?

sentences: Drawing graphics in GAE I have seen a lot of questions about making a game using Google app engine. I have run into a problem that I cant seem to find any answers to. What can I actually use to draw my game? Are there any libraries that GAE supports? Any feedback is appreciated.

sentences:
Advice for programming a lobby for a network multiplayer game? I'm working on learning network programming. I'm working on a simple card game. The basic idea is:

Players enter the lobby
Players see tables
Players sit at an empty seat

Once they sit, they do not need any information from the lobby, they see the card table and the data about the other players and so forth.

I've programmed the server portion for the game itself. The clients connect to my server object and the server then receives and sends messages; quite simple.

The tricky concepts for me are:

What's a good way to run many tables at the same time?
What's a good way to keep the lobby consistently updated for each person in the lobby (eg: MSG_TABLE_FILLED, 22)

Ideally I'd like to have 1 server exe for all of this and to have to deal with multithreading as little as possible.

I'm going to use the enet library.

I was thinking that each time a game session starts, I push a new Game and I map the client IPs to that table, then I just route messages from those clients to that Game.

Since enet supports channels I was thinking of using 2 channels per table, one for the game messages and one for in game chat.

Would something like this work?

Does anyone have any advice / design ideas for a game with a lobby and many tables?
Is there a usual way this is done that I'm overlooking?

Any conceptual ideas or even c/c++ code examples would be very helpful.

Thanks

sentences:
Unity too many batches There are 64k cubes, 64k-1 's materials are assigned to sharedMaterial of first cube. But unity is not batching them together. Only cubes themselves are batched.

Static color(but different per cube)
Dynamic position and rotation per cube

How can I force unity to batch them all so it sends all cube data with only an array then draw once instead of drawing 64k times?

Each cube has a constructor as:

public class Test : MonoBehaviour {
    public static System.Random r { get; set; }
    // Use this for initialization
    public static Material m=null;
    void Start () {
        if (r == null)
            r = new System.Random();
        sayac++;
        if (m == null)
            m = GetComponent<Renderer>().sharedMaterial;
        else
            GetComponent<Renderer>().material = m;
        GetComponent<Renderer>().material.color = new Color((float)r.NextDouble(), (float)r.NextDouble(), 1);
        var mesh= GetComponent<MeshFilter>().mesh;
        var vertices  = mesh.vertices;
        var colors  = new Color[vertices.Length];
        var i  = 0;
        while (i < vertices.Length)
        {
            colors[i] = new Color((float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble());
            i++;
        }
        mesh.colors = colors;
        mesh.UploadMeshData(false);
        mesh.Optimize();
    }

}

and they are instantiated from a cube as:

    for(int i=0;i<1024*64;i++){
        var pos = new Vector3(i % 64, (i /64) % 64, (i / 4096) % 64);
        pos*=2.5f;
        var cu = Instantiate(ref_cu, pos, Quaternion.identity);
        cu .name = "cube_" + i;
    }

After deleting 'material.color' lines, batching has started. But now cubes are not easily seen as with different colors. I need them different colored but not changing. Static color but different per cube. How it looks now:

its not easy to see individual cubes.

public class Test : MonoBehaviour {
    public static System.Random r { get; set; }
    // Use this for initialization
    public static Material m=null;
    void Start () {
        if (r == null)
            r = new System.Random();
        sayac++;
        if (m == null)
            m = GetComponent<Renderer>().sharedMaterial;
        else
            GetComponent<Renderer>().material = m;

    }

}

sentences:
Unreal Engine and Simple Animation I am creating a card based game and I am stuck on an animation detail.
My question is I need an animation to shuffle the deck, a animation for dealing and  an animation for drawing.
My question is should I create the animations in Unreal Engine or would I create them in blender. I know traditionally with characters and other animations you would create them within blender. However I am unsure in this instance as we are talking about simply shuffling, dealing, and drawing cards.

sentences:
Implementing black map in a 3d game I am struggling with designing black map and fog of war in a 3d game. Black map is the area that player hasn't explored (completely unknown), while fog of war is the area that player has explored and knows geospatial topology, but no friendly units or buildings are nearby to provide player with up-to-date info about enemy movements over the area.

The problem is that my terrain is 3D, varies in height greatly and camera can be placed at any position on the map at virtually any angle.

So far I've designed very heavy fog/clouds for area under fog of war, but not so heavy that the terrain underneath would not be visible, and am not rendering non-environment objects on those locations, but black map is another story.

Simply not rendering terrain over those locations looks and feels bad, and rendering terrain in pure black is not good as, when the camera is angled to view forward, player can still see elevation - very important information in the game and should not be given away without having to explore the map.

Are there any generally accepted ways of implementing such feature?

sentences: Farseer engine built for MonoTouch? Does anyone know where I can find a version of the farseer physics engine compiled for MonoTouch, or do most people just download a windows version from codeplex and attempt to build their own solution?

sentences:
BSPs, Octrees and modern graphics hardware I have read a lot of literature on BSPs, Octrees and like. Problem is that it is all old literature from software rendering time. Nobody describes how it is implemented today. So here is my idea how to do it and my question.

Let's say that I use some partitioning algorithm, it does not matter which one. I subdivide my level mesh into multiple partitions and store it in RAM. Should I simply create vertex buffers for each node so I can render my scene faster or what?

How do you do it, is there any better way today?

Thank you

sentences:
Intuitive way to handle dragging outside the Arc Ball? So I'm writing a game (or toy, rather), which involves manipulating a 3d object with the mouse. I'm trying to get the most intuitive control that I can.

I've implemented the "Arc Ball" mouse control. I'm happy with how it "feels", except for when I drag the mouse outside the range of the virtual ball.

Currently when the ray from camera to mouse-pointer in world-space does not intersect the virtual sphere, I simply find the closest point to it.

This results in something that acts like this example (not my code, just an example I found with the same implementation as me).

Notice the behaviour change when you click and drag away from the cube.

I'm not sure if it makes sense, but I am hoping for some way of allowing the cube to continue to rotate no matter how far away the mouse pointer gets, while still maintaining the useful property of standard Arc Ball that returning the pointer to the starting point will undo all rotation.

Any suggestions?

sentences:
What are some strategies for handling a zoomed out grid of sprites? I'm writing a grid-based 2D game in Unity3D that would ideally use grid sizes of around 200x200 or so, with multiple zoom levels, including all the way out. When I tried render a 200x200 grid at the most zoomed-out level where everything is visible, Unity crapped out saying that there were too many vertices to attempt to draw. This makes sense, as it's trying to render 40,000 sprites.

I was wondering, how do games like Dwarf Fortress and OpenTTD manage so many sprites at once on the screen when the map is zoomed out all the way? Are there any general strategies for handling the rendering of a large number of sprites such as this?

sentences:
How can I make an infinite cave using stage3d? I want to make an infinite cave in my 3d game using flash stage3d. But I got no idea about how to build that cave. Can anyone can give me some solution or hint?
update:
I've tried agal fragment shader like squeae tunnel in shadertoy

code:

var fragmentProgramCode:String =
                AGALUtils.build()
                .mov("ft0","v0")
                .div("ft1","ft0.xy","fc3.xy")
                .mul("ft2","fc6.x","ft1")
                .sub("ft3","ft2","fc5.x")//vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy;
                .mul("ft1","ft3.x","ft3.x")
                .mul("ft2","ft3.y","ft3.y")
                .pow("ft4","ft1","fc6.z")//float r = pow( pow(p.x*p.x,16.0) + pow(p.y*p.y,16.0), 1.0/32.0 );
                .pow("ft5","ft2","fc6.z")
                .add("ft1","ft4","ft5")
                .pow("ft4","ft1","fc6.w")
                .mov("ft5","fc5")//uv
                .sub("ft1","fc7.x","ft4")
                .add("ft5.x","fc7.x","ft1")//uv.x = .5*time + 0.5/r;
                .mov("ft6","fc0")//for atan
                .atan2("ft5.y","ft3.y","ft3.x",new <String>["fc7.y","fc5.x","fc7.z","fc7.w","fc8.x","fc8.y","fc8.z","fc8.w","fc9.x","fc9.y"],"ft6")
                .tex("ft0","ft5","fs0","repeat","linear","nomip")//tex
                .mul("ft1","ft4","ft4")
                .mul("ft2","ft1","ft4")//r*r*r
                .mul("ft1","ft0.xyz","ft2")
                .mov("ft0.w","fc5.x")
                .mov("oc","ft1").toString()

it can only apply one material,but my project requires different types of material (like floor,ceilling).
so ,I create a 3d model
Is there anyway to make that 3d model render like "infinity cave"? use agal to make each side of cave's texture move?
thanks for your help

update again:

I tried glsl to make a cube,when using color It looks good,but when I don't know how to apply texture's transform. It's really hard for me to accomplish this,haven't 3d experience before,thanks for your time !

#ifdef GL_ES
precision highp float;
#endif

uniform vec2 resolution;
uniform float time;
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform sampler2D tex3;

vec4 p1 = vec4(0.0, 1.0, 0.0, 1.3);//down
vec4 p2 = vec4(0.0, - 1.0, 0.0, 1.3);//up
vec4 p3 = vec4(1.0, 0.0, 0.0, 1.3);//left
vec4 p4 = vec4(-1.0, 0.0, 0.0, 1.3);//right
vec4 p5 = vec4(0.0, 0.0, 1.0, 1.3);//center

void main(){
 vec2 uv = -1.0 + 2.0*gl_FragCoord.xy/resolution.xy;
 uv.x *= resolution.x/resolution.y;
 vec3 o = vec3(0.0, 0.0, 2.3);
 vec3 rd = normalize(vec3(uv, -1.0));
 vec3 lp = vec3(sin(time), sin(time), cos(time));
 float li = 2.0;
 vec3 co;

 float tm = 10000.0;
 float t=- (dot(p1.xyz, o)+p1.w)/dot(p1.xyz,rd);
 if(t>0.0&&t<tm){
   co =vec3(.2);//down
   tm=t;
 }
 t=- (dot(p2.xyz, o)+p2.w)/dot(p2.xyz,rd);
 if (t>0.0&&t<tm){
   co =vec3(.3);//top
   tm = t;
 }
 t=- (dot(p3.xyz, o)+p3.w)/dot(p3.xyz,rd);
 if (t>0.0&&t<tm){
    co =vec3(.4);//left
    tm = t;
 }
 t=- (dot(p4.xyz, o)+p4.w)/dot(p4.xyz,rd);
 if (t>0.0&&t<tm){
    co =vec3(.5);//right

    tm = t;
 }
 t=- (dot(p5.xyz, o)+p5.w)/dot(p5.xyz,rd);
 if (t>0.0&&t<tm){
     co =vec3(.6); //center
     tm=t;
 }
 gl_FragColor = vec4(co, 1.0);
}

sentences:
Spot Light color fade in Unity 3d I have a scene where many spot lights are focused on the screen. All have red color and same intensity. What I want is that the red Color(0,0,0,1) value should increase and decrease in a fading effect over a period of time. I thought of using Color.Lerp() but can not achieve it. What currently I am doing is attaching this script to all the instances of the SpotLight.

void Update()
{
 if(Time.time()%120==0)
   transform.light.color=new Color(Random.Range(0,255),0,0,1);
}

I know I am missing something big here. Help is appreciated. Thanks in advance.

sentences: How can you implement Lua into your game? I am trying to implement Lua into my game, but am having trouble. Say I have a weapon class, which is just a hollow shell, lacking real functions. I was thinking of creating an onFire function, which will simply call a pointer to a Lua function that was created for that weapon. Is this the way most people do it? Are there any other ways?

sentences:
MinGW Windows Cross-Compile Error While I was developing my game on Linux (I'm using an ARM system), I decided that I want to cross-compile it to Windows. Yet, I get an error while I try to link Allegro (version 4.2) to the compiler.

I have installed MinGW32 (x86_64-w64-mingw32-c++ in the terminal) and have moved the bin / include / lib folders from the Windows Allegro version to the /usr/x86_64-w64-mingw32-c++/ folder.

When I enter into the command line:

x86_64-w64-mingw32-c++ *.cpp -o W_Survival `allegro-config --libs`

It returned to me a linking error:

/usr/bin/x86_64-w64-mingw32-ld: unrecognized option '-z'
/usr/bin/x86_64-w64-mingw32-ld: use the --help option for usage  information
collect2: ld returned 1 exit status

The compiling is all the same as I would do it using g++. the only thing different is that I have it set to compile for windows.

Is there anything that I did wrong?
All help is appreciated :)

sentences:
Configurable Joint, linear limit range I am working on a physics driven pressable button, but I cannot seem to tackle the minimum and maximum limits.

This is the rig I have set up for the button (as it looks when pressed down).
2D view:

3D view:

The idea is that the box collider is a trigger and the button (cylinder, mesh collider) is a rigidbody with configurable joint, locked and limited on a single axis. I am using configurable joint, as that's the only one that supports basic, linear restrictions.

I have set up the configurable joint to restrict motion on a single axis, but the joint only allows single dimensional limit, that is applied to both directions. Screen capture of relevant configuration:

Basically, the opened Linear Limit section is the last property that has been changed for the joint - anything else are defaults and irrelevant (at least I haven't found my solution in the properties below, mostly angular stuff).

The limit of 0.2 units work, and the button can be pressed - it only gets pressed until those 0.2 units and thats the expected behaviour.
The unexpected is that sometimes the angle at which I hit the button, adds force to the button outwards from the box, and it moves 0.2 away from it, ending up like this:

Obviously, the specified limit of 0.2 units constrain the movement in both directions from the anchor, actually resulting in the range of -0.2 to 0.2 (relative to anchor).

How, and is it even possible, to restrict the movement only in a single direction relative to anchor?

sentences:
How to achieve realistic fake physics? In my opinion, games that are most entertaining to watch and play implement fake physics, the difficult issue is how to implement the fake physics and still allow it to appear realistic. Most popular car driving games implement this really well.

Question
Anyone has any tips or know of anywhere I can learn more about how these are implemented?

Long Story
For example, Need For Speed is entertaining when the player car crashes into the computer car, but it would not be fun if we land off the track each time the player collide. In the game, it is obvious that some game logic is in place to steer or land the player car upright, face correct direction and on track most of the time even after a massive collisions. The game instead causes the computer car to suffer heavier damages like flying of the screen after many spins etc to enhance effects.

As another example, suppose at a time instance, a speeding player car is driving at the close rear left of a computer car and real physics dictates in the next time instance the player will definitely bump into the computer and lose speed and control. Then at this point, the player could steer right to avoid the car, or steer left to bump into its rear. In an entertaining game, we may still want the player to avoid the front car completely if he steers away and experience an exciting near miss.

In NFS, this experience appears to be implmented in a few ways such as player auto-steer avoidance, scraping pass and rebound to right of computer, computer car steer away to avoid, computer gets hit but lose control and spin off track to give way to player.

On the other hand, it the player steers to engage in a collision, we want to add excitement to spin the computer very badly but still keep the player on track with a good speed.

In NFS, these fake collisions and steering are not easily noticeable as they feel very realistic even though if we study them closely, it looks almost like the are scripted. One method I have tried is to determine the final state of collision and then compute the path backwards. But this only ensures the car is in a desired final state, does not address the realism.

sentences:
UVW Unwrap multiple quads on same texture space automatically I've been looking around the web for the answer to this question, but to no avail. So here I go.

I'm looking for a way to automatically map several quads on the same texture space (for example (0,0) ~ (0.4,0.4)) using the UVW unwrapper modifier of Max (or something else).

Here is a quick (and dirty) graphical explanation (click for larger):

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 do I implement side scrolling in a javascript platformer? I'm building a side scrolling platformer with Javascript and the canvas element for a school project. I have the character all sorted out. He runs left and right, and has a different sprite set for standing still. The game has gravity, and I can jump. Now what I can't get my head around is how to implement side scrolling.

The game world will be tile based. Each tile will be 20x20 pixels. When the character gets to the edge of the screen, it should scroll with the character to explore the level further.

Can anyone point me in the right direction to a resource that explains how to programmatically do this? Language specific to Javascript would be good, but anything would be a help.

sentences:
How should bots be recognised in a game? I'm interested in how bots are usually written.

Here's my situation:

I plan to make an online 2D mecha game in HTML5, and the server-side will be done with node. It is intended to be multiplayer, but I also want to make bots in case there aren't enough players.

How does my game logic see them, as players or as bots? Is there a standard by which I should make them? Also, any general tips and hints will be OK.

sentences:
Does abstraction influence performance? Say I have a GameObject class that is being extended by all of the objects in the game that are moving around. (This class provides basic stuff like a sprite, draw method, update method with application of move vector and so on...) I also have a class Asteroid that like I said extends GameObject

Then there are two versions of the game:

Version 1: Somewhere in the game there is a Collection that holds all of the Asteroid-objects. The update Method is something like this:

for(Asteroid a : asteroids)
    a.update(...)

Draw method goes equivalent.

Version 2: I decided to put all of my GameObjects in a single collection, so that all moving stuff is being handled in one single loop like this:

for(GameObject o : gameObjects)
    o.update(...)

Again, draw method goes equivalent.

The problem I am facing with version 2 is that the game loop basically takes twice as long. (The update method as well as the draw method.) I am astonished at the draw method, since in either version there is the exact same amount of object being drawn. So my question is: Does this abstraction in version 2 affect the game's performance in any way? (I can imagine that version 2 requires the JVM to alway cast the GameObject implicitly to it's specific type which it does not have to do when the type is already given like in version one, but I am not sure about that.) (I am using Java with LibGDX if it matters)

sentences:
Looking for the reference tutorials for the joints in the Box2D for iphone I can't find the tutorials of joints class in the Box2D for iPhone. I am unable to run a Testbed for iPhone Box2D.

(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
       if (_mouseJoint!=NULL)return;
       UITouch *mytouch=[touches anyObject];
       CGPoint location=[mytouch locationInView:[mytouch view]];
       location=[[CCDirector sharedDirector]convertToGL:location];
        b2Vec2 locationWorld=b2Vec2(location.x/PTM_RATIO,location.y/PTM_RATIO);
 //ristrict the player within the ground limit  keep stucking the player with grounditself.....
if (_playerFixture->TestPoint(locationWorld))
{
    b2MouseJointDef md;
    md.bodyA=groundBody;
    md.bodyB=_playerBody;
    md.target=locationWorld;
    md.collideConnected=true;
    md.maxForce=100.0f*_playerBody->GetMass();
    _mouseJoint=(b2MouseJoint *)_world->CreateJoint(&md);
    _playerBody->SetAwake(true);
}
}

-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (_mouseJoint == NULL) return;
UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView:[myTouch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
if (location.y<240.00&&location.y>=20.0f)
{
    b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO);
    _mouseJoint->SetTarget(locationWorld);
}
}

- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (_mouseJoint)
{

 _world->DestroyJoint(_mouseJoint);
    _mouseJoint = NULL;

  }

}

sentences:
Direct3D & Assimp Texture is inverted weirdly! I'm working on a rendering engine but even on the first mesh is something wrong.
I use assimp for mesh importing!
In the Assimp Viewer it looks correct:

And in my software it looks like this:

Look at the text and you will see it is weirdly mirrored.
I'm using front counter clockwise vertex winding and the texture is flipped on y coordinate - if I don't then it is completely wrong. I already tried disabling front counter clockwise winding but the texture is still inverted!

Does anybody know what else I can try?

sentences:
Smooth Rotate Object While Orbiting I am working on a 3D game where you can control an object that orbits a sphere with an on-screen virtual joystick. So far I have that part working, but the object follows the joystick angle perfectly and "snaps" into the angle, rather than smoothly interpolating to the new angle of the joystick.

I would like to redo this and have it interpolate the values. I have it very close using the following code:

angle = Mathf.Atan2(joystickY, joystickX) * Mathf.Rad2Deg;
Quaternion targetRotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, currentAngle);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, TURNING_SPEED * Time.deltaTime);

This works great on one side of the sphere, but as soon as I move the object halfway around the sphere, the rotation is now mirrored and the object rotates 180 degrees until it reaches the other side again. What am I missing here?

I am basically trying to calculate the joystick angle, then apply that to the object as it orbits, but do this smoothly using slerp.

Let me know if you need any further information. Thanks!

sentences:
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:
Cant write/read to/from external storage with LibGDX My create method looks like this:

@Override
public void create () {
    batch = new SpriteBatch();

    FileHandle file = Gdx.files.external("file.txt");
    file.writeString("My god, it's full of stars", false);
}

I allso included:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

The Exception i get is this:

02-13 14:45:51.858 12439-12466/com.snowdevs.tweetiebirds E/AndroidRuntime: FATAL EXCEPTION: GLThread 1120
Process: com.snowdevs.tweetiebirds, PID: 12439
com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: file.txt (External)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:353)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: file.txt (External)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:330)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: java.io.FileNotFoundException: /storage/emulated/0/file.txt: open failed: EACCES (Permission denied)
   at libcore.io.IoBridge.open(IoBridge.java:452)
   at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:322)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
   at libcore.io.Posix.open(Native Method)
   at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
   at libcore.io.IoBridge.open(IoBridge.java:438)
   at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:322)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

I use a Nexus 5 with Android 6 Marshmallow for testing.
I searched and found that Android 6 uses runtime permissions but the LibGDX guys says that it works even on Android 6... Is there a fix With or Without runtime permissions?

sentences:
"Video system not initialized" error I always get the error message "video system not initialized"

I don't get where I went wrong with the code below:

import pygame
pygame.init()

display_width = 800
display_height = 600

gameDisplay = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('4 pics 1 word: ASTRONOMY VERSION')

black = (0,0,0)
white = (255,255,255)
red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)

answered = False
satImg1 = pygame.image.load(r'C:\Users\andrea\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.7\img\satellite.png')

def satImg(x,y):
    gameDisplay.blit(satImg1,(x,y))

x = (display_width * 1.0)
y = (display_height * 1.5)

while not answered:
    if pygame.mixer.get_busy() != None:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                answered = True
    gameDisplay.fill(white)
    satImg1 = (x, y)
    pygame.quit()
    quit()

sentences:
Implementing an AI controller for Pacman I'm currently implementing an AI controller class that is being used to determine the moves that ms.pacman should make to collect pills and avoid ghosts. In order to determine which is the best move to make in each state (configuration) of the game, I'm using Breadth-First Search to search the decision tree at each state. I've gotten the controller to work (at least somewhat) for Depth-First Search so I was trying to apply the same logic here.

The idea for DFS was to start with a "root" or driver function which would iterate through the possible moves ms. pacman could make at each state in the decision tree and then make a call to a recursive function that searches the tree to find the terminal state (point at which all pills have been eaten) with the highest value (e.g. highest score). This value is returned from the recursive function and stored in a variable in the root function. The root function the returns the move (out of possible moves) that had the highest value in the tree.

Since BFS is not recursive, I was thinking that it wouldn't be necessary to have a driver function like this, so I decided to put it all in one function. Based on DFS, I'm implementing BFS using a queue which stores all of the neighboring states of the current state and visits each state in FIFO order. Once a state is reached in which all pills have been eaten, the current Move should be returned. I'm not sure if this is the best approach, but its what I could come up with. The problem is that the code for the function takes too long to run and ms.Pacman immediately just goes left and runs into a wall. I'm assuming this is because the terminal state is never being found. Here is the function (in Java):

  public MOVE bfs(Game state){
        EnumMap<GHOST,MOVE> ghostMove = new EnumMap<>(GHOST.class);
        MOVE bestMove = MOVE.NEUTRAL;
        Queue<Game> q = new LinkedList<>();
        q.add(state.copy());
        while(!q.isEmpty()){
            Game current = q.peek();
            q.remove();
            for (MOVE move : current.getPossibleMoves (current.getPacmanCurrentNodeIndex())) {
                Game neighbor = state.copy();
                neighbor.advanceGame(move, ghostMove);
                q.add(neighbor);
                if ((current.getNumberOfActivePills() == 0) && (current.getNumberOfActivePowerPills() == 0)) {
                    return move;
                }

            }
        }
        return bestMove;
    }

Is there anything wrong with the design of the algorithm that could be causing this problem?

sentences:
How can I identify feature regions in a procedurally generated world? I'm building an Island. I use the classical heightmap solution : with a hill-building function, avoiding the corners of the map, I make altitude. Then, perlin noise give me some climatic variables to handle the biomes.
Now, I'm facing two challenges who are, in some way, connected :

In Dwarf Fortress, one of the neat aspects of world generation is how the game seems to "know" areas, and give them names, though they are not rectangular shapes. I would like to be able to "recognize" my forests, my rivers, my hills... any idea what kind of algorithm I could use to scan my map and interpret its areas ? And how would you store that ? I'm using a basic C++ graph made out of a vector of vector of "tiles object".
This Island should be divided in political areas, not only purely natural regions. I could use mountains and rivers to make "natural borders", but my procedurally generated map doesn't garantee I will have nice "enclaves" that would form a kingdom ; I could find myself having a gigantic "ribbon-formed" political areas surounded by micro-kingdoms.
Another possibility would be to look for appropriate areas for a city or a castle. Then, "grow" a political area around it. But there again, I'd like to have some well-known algorithms before trying to devise my own.

This question could be interpreted as a bit too vague, so one way of rephrasing it would be : how to partition (without modifying !) a procedurally generated world into areas suitable for gameplay ? Thanks in advance for your help.

sentences: Unity3D - Cancel a build process (Windows, Unity 5) I accidently pressed build for iOS and just realized that it might take a few hours to build the project. I tried to kill the unity process in the task manager, but on next start up unity instantly starts to build it again. Is there any option to cancel the build?

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:
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:
wavefront .obj file loader problem I'm pretty new to direct x and c++, I have a problem with loading .obj files.
This is a cube

I think the problem is with creating vertices and indecies.
list<vertex> FinalVertices;

list<unsigned long> Indecies;
for (int i = 0; i < Faces.size(); i++)
{
    for (int j = 0; j < Faces.size(); j++)
    {
        if (Faces[i] == Faces[j])
        {
            cout << 'b' << endl;
            if (i == j)
            {
                FinalVertices.push_back(Faces[i]);
                Indecies.push_back(j);
            }
            goto a;
        }
    }
a:
    cout << ' ';
}

sentences:
Need to use trig to make a ship point in the right direction I'm making a 2D spaceship-shooter game that moves in all directions, (i.e. ( -x, +x ),( -y, +y ) ).

I'm trying to make the spaceship face the direction of the movement according to a virtual joystick. The virtual joystick has it's x and y coordinates working correctly and they are normalized (ie. between -1 and +1) in both x and y.

I'm able to set the angle of the image I'm using by a call to

SetSpriteAngle(spriteNum, angle)

where the angle is in degrees. The problem I'm having is with the trigonometry involved.

I know from trig that calculating the angle is radius*cos(x), and I could be wrong on that, so I tried this:

x = GetVirtualJoystickX(1)
y = GetVirtualJoystickY(1)
r = sqrt(x*x + y*y)

angle = r * cos(x)

SetSpriteAngle(1,angle)

Problem one is, there's no account for the Y direction, so I tried:

angle = r*cos(x) + r*sin(y)

Still a problem, just not working correctly, so I tried arcsine and arccosine:

angle = r*aCos(x) + r*aSin(y)

Now the image is just flipping in what seems like a random direction, and just in case it was calculating, instead of the total angle, perhaps it was the angle from the x intercept, so I tried:

if GetVirtualJoystickX(1) > 0 and GetVirtualJoystickY(1) > 0
    //angle = angle
elseif  GetVirtualJoystickX(1) < 0 and GetVirtualJoystickY(1) > 0
    angle = angle - 180
elseif  GetVirtualJoystickX(1) < 0 and GetVirtualJoystickY(1) > 0
    angle = angle - 270
elseif  GetVirtualJoystickX(1) > 0 and GetVirtualJoystickY(1) < 0
    angle = angle - 360
else
    angle = 0
endif

Now it's only flipping as if angle is close to 0 and moving occasionally in a certain 270 degree position  I believe,

So I guess I'm going to have to admit that my trigonometry skills aren't what they used to be and ask you guys for some help, by the way sin(x) is where x is in degrees and sinr(x) is where x is in radians, so I might be missing it there too, frankly I'm just too confused to get any farther right now.

Thanks guys!

sentences:
Circled plus math symbol - Direct sum of triangles? I'm reading a paper on terrain rendering LOD and there's some math notation there I'm not clear on.

When talking about how triangles are split into pairs of smaller triangles where more detail is needed on the mesh they have an equation along the lines of

large triangle = left triangle ⊕ right triangle

From the context of the rest of the paragraph, I get that they're saying that the bigger triangle contains/is made up of the two smaller triangle.  But what specifically does that symbol mean in terms of triangles & trigonometry?

Should that be interpreted as the direct sum of two triangles?  If so, what does that operation actually entail?  Performing a direct sum of the matrices of the triangle vertices?

Paper in question is here btw, page 4, section 4.1 has the notation I'm talking about.

sentences: Libgdx. Converting Screen Click Coordinates into World Coordinates for 2D Game I'm using the InputHandler's touchdown method. It gives me my screenX and screenY. Is there a simple way to convert screenX and screenY to world coordinates? By my understanding, InputHandler returns the coordinates in relation to your screen.

sentences:
Achieve anisotropic filtering I want to set anisotropic filtering to my scene. I use SharpDX (DirectX 11) and C#.

How do i set up anisotropic filtering in my shader?

Currently i try that in the shader:

Texture2D tex;
sampler textureSampler = sampler_state
{
  Texture = (tex);
  MipFilter = Anisotropic;
  MagFilter = Anisotropic;
  MinFilter = Anisotropic;
  MaxAnisotropy = 16;
};

float4 PShader(float4 position : SV_POSITION, float4 color:COLOR, float2 tex0 : TEXCOORD0) : SV_TARGET
{
  float4 textureColor;
  textureColor = tex.Sample(textureSampler, tex0) * color;

  return textureColor;
}

I get my object, textured, but it is not filtered anisotropic. I can write everything in the Parameters, even invalid things and i don't get any errors. The result is the same, objects without applied anisotropic filtering.

Do i have to set that in the shader? Can i do that also with SamplerState? I tested that but i didn't get a result too.

Some steps what i have to set would be helpful.

Edit:

Here the current result. You can see the blurred planes of the cube in the middle:

As comparison the same scene in OpenGL with 16x anisotropic filtering. The planes of the cube are not blurred:

Second Edit:

Based on the idea, that in OpenGL the anisotropic filtering is a texture environment variable, maybe i have set some settings in the texture wrong?

Texture2D texture = (Texture2D)Texture2D.FromFile("Test.png");
ShaderResourceView tSRV = new ShaderResourceView(device, texture);
device.ImmediateContext.PixelShader.SetShaderResource(0, tSRV);

sentences:
C# Pathing algorithm for moving a object from point(X, Y) to point(X, Y) Given a object which may move forward, backward, left and right at a given X,Y point. How to efficiently direct the object to a X,Y point using the given movement mechanics in the most efficient and human natural way.

The object is available for movement in real time, you may tell them to "startMoving|Direction|()" and "stopMoving|Direction|()" to any heading of 360 degrees. Though as a additional twist and the part I am having trouble with, is the facing of the object is never known, only its current location is known, so the algorithm must "detect" direction. The location of the object is updated in a separate thread in 500-1second intervals. A "Request" to update the location within the algorithm made be made at any point, but it is not immediately available and the algorithm must keep that in consideration. Doing something like requestAndWaitForCoordUpdate() is perfectly acceptable, however likely not needed.

In addition, no obstacles appear, it can be assumed you are on a MOSTLY open plane, stray to far from the direct straight line between the paths and you may run into obstacles. It is safe to assume that 1/4th the distance between a target and source, should be available in width on a given direct path.

I would also mention I am not sure A* applys in this scenario, if it does I am unsure how to implement it given the constraints. The only real variable here is the facing of the object.

Here is some example code:

public int[] currentCoords;
public void movement() {
  currentCoords[0] = 1005; // starting y coord
  currentCoords[1] = 1007; // starting x coord
  moveTo(1050, 1025);
}

public void moveTo(int x, int y) {
  ... how?
}

public void threadUpdatingCoords() {
   ... periodically check for source coord updates
   ... between 200ms and 1000ms apart.
}

sentences: Run OpenGL shader on part of a texture How do I run an OpenGL shader on just a portion of an off screen texture and leave the rest of the texture unmodified? Are there any calls that restrict the sampled pixels to just a rectangle or do I have to filter out the rectangle in the shader code?

sentences:
Using server timestamp to synchronize actions across clients tl;dr
The question is rather simple: how unsynchronized can internal clocks be between different machines?

Context
We have a "hybrid" approach where the Clients are authoritative on certain things, and the Server on some others. That is to make our life easier because the gameplay doesn't need to be too tight about certain things.
In this case, the Server will pre-determine a sequence of Enemy Types to be spawned at different locations with pre-determined delay between the spawns. We would then let the Clients handle the rest during the gameplay.
However, if we want the Clients to be mostly synched on the display of the enemies, they would need to initiate this sequence at the very same time, and thus we cannot rely on the network to have transmitted the data at the very same time for all Clients.
The idea we had was to send a timestamp of the format returned by System.currentTimeMillis() which would indicate when to begin the sequence.
But then one question remains in the way: how unsynchronized can internal clocks be between different machines?

sentences:
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:
How can I generate random levels like in "Square it!" game? In this game, you have a 2d field with some free squares and two colored squares which you can move but only together (they'll move only if the spot is still "free"). And you have to fill whole free space.

Here is a video that demos how the game is played.

How can I generate random game levels like in that game?

sentences:
What is the design rationale behind melee retaliations in turn-based games? I've seen quite a lot of turn-based games in which melee attacks on another unit cause the attacked units to also damage the attacking unit, while ranged attacks do not suffer from this "retaliation" mechanic.

Examples include the Heroes of Might and Magic series, the Civilization series, the new King's Bounty series, and more.

Is there a specific design reason for this? What's the rationale behind giving the attacked unit an extra attack, which doesn't cost it its turn? And why are ranged attacks excluded from retaliation?

sentences:
Spriting engine on mobile platforms, OpenGLES I'm writing a basic spriting engine for a blackberry app, and I want to know the best way to draw tons of sprites using the glDrawArrays() command.

We have several sprites that move around the screen, and a bunch of sprites for background tiles.  Zelda-1 like tiling.

My first idea was to create a quad at the origin for every sprite that exists and glTranslatef it to wherever it needs to be.  But several hundred sprites to draw per frame, you only get to call this once for every call to glDrawArrays() so its not a good idea to call glTranslatef() on each sprite as you draw it.  That's the reason glVertex3f() was left out..

So I'm left with the option of maintaining a master vertex array and every time a sprite moves in the game, pushing the update to move the 4 vertices that represent its quad in the MASTERVERTEXARRAY.  I don't like this but it seems my only option.

What I'd really like is to be able to somehow create an array of "translation values" to use for every quad that gets drawn..

glTranslateArray( ... ) ;

But alas, no such thing exists.

sentences:
Marching cubes over an octree dual - how? In Dual Marching Cubes the dual of an octree is tessellated via the standard marching cubes method. But the classical marching cubes algorithm operates only on cubes with eight vertices (it uses signs at eight corners of the cube to construct a bitmask and select the proper configuration of triangles), while cells of octree duals can actually have more than eight edges.

For example, in the following picture a quadtree dual is shown, where the lower left cell has 8 links to neighboring dual vertices:

although the marching squares algorithm needs only 4 corner vertices (4-bit masks - 16 cases) for contouring the grid.

And how to build the surface in this case? Which edges to select to form a bitmask used in the marching cubes/squares algorithm as the algorithm needs only 8/4 points as input?

sentences:
How does the Maya ASCII FBX format store positions within animation? I want to understand Maya's ASCII FBX format so I can convert animations in it to OSG (OpenSceneGraph) format.

I have a simple sphere, with a translation in one direction for 30 frames baked into an animation. I was expecting to see a list of values like this:

Frame #, X-position, Y-position, Z-position

However, I find nothing like it in the output file. For example, at frame 1, X/Y/Z = -7.189/0/10.136, but I cannot find any of these, or any other X/Y/Z position anywhere in the file.

What am I missing?

Could someone point out the frame/xyz position in the file?

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:
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:
How do I change the game object on a button click? I have a five game objects (ornament1, ornament2, ornament3, ornament4 and ornament5) and  two buttons ("Next" and "Previous"). When I click "Next", the object should change from ornament1 to ornament2. When I click "Next", again, it should change from ornament2to ornament3; when I then click "Previous" it should change from ornament3to ornament2.

I have the "Next" button working, but the "Previous" button is not working. How do I change the game object on a button click?

Here is my code:

if(GUI.Button(new Rect(10, 20, 80, 50), "Ornament1"))
{
    Debug.Log("hhhhhhhhhhhhhhhhhhhhhhh" + countbool);

    if(count==0)
    {
        Debug.Log("hhhhhhhhhhhhhhhhhhhhhhh");
        ornament1.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament1.SetActive(true);
        ornament2.SetActive(false);
        ornament3.SetActive(false);
        ornament4.SetActive(false);
        ornament5.SetActive(false);
        count++;
    }
    else if(count == 1)
    {
        ornament2.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament2.SetActive(true);
        ornament1.SetActive(false);
        ornament3.SetActive(false);
        ornament4.SetActive(false);
        ornament5.SetActive(false);
        count++;
    }
    else if(count == 2)
    {
        ornament3.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament3.SetActive(true);
        ornament1.SetActive(false);
        ornament2.SetActive(false);
        ornament4.SetActive(false);
        ornament5.SetActive(false);
        count++;
    }
    else if(count == 3)
    {
        ornament4.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament4.SetActive(true);
        ornament3.SetActive(false);
        ornament1.SetActive(false);
        ornament2.SetActive(false);
        ornament5.SetActive(false);
        count++;
    }
    else if(count == 4)
    {
        //ornament1.SetActive(true);
        ornament5.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament5.SetActive(true);
        ornament3.SetActive(false);
        ornament1.SetActive(false);
        ornament2.SetActive(false);
        ornament4.SetActive(false);
        count++;
    }
}

sentences:
From Position/Target to Orientation/Elevation I have an orbit camera class that calculates the camera position from Orientation/Elevation and distance from target. I decided to replace these initial values for the camera instantiation with simply Vector3's position and target. How do I calculate Orientation/Elevation and distance from target from these two vectors?

I only got as far as creating a Matrix (Matrix.LookAt) and decomposing it. The translation that can be used for the distance from target partition is trivial, but what do I do with the Quaternion portion to get the elevation/orientation?

sentences:
SIGSEGV error when returning a new object I am attempting a minecraft clone, and I have spent the past 3 hours debugging a SIGSEGV error. I've traced it to returning a new object. return Block(BlockID::Air) for example. When I run my debugging tool, it leads to move.h:

...
 // concept requirements
  __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)

  _Tp __tmp = _GLIBCXX_MOVE(__a);
  __a = _GLIBCXX_MOVE(__b);
  __b = _GLIBCXX_MOVE(__tmp);
}
...

I also get the error whenever I create a new glm::vec3

sentences:
Interactive texture modification (such as fluid mixing) in Unity I am working on a game where I want to allow users to mix multiple colors (similar to shown in this video): https://youtu.be/11UFYyv8hjs?t=316.
I have the following questions:

I am expecting that this is done using shaders. What kind of shader I have to use for such implementation? What will be the logic to create this type of shader?

Are there any other ways using which this feature can be implemented?

Are there any open source tutorials or examples?

I would appreciate any suggestions and thoughts on this topic. Thank you.

sentences:
Can I use two Collision Boxes on the same GameObject? I have two Collision Boxes on the same GameObject. I don't want the Collision Boxes to be triggers. I want the Collision Boxes on the actual GameObject, not its children.

For example, if I want to check for a headshot. My reason for not wanting triggers is that a trigger is already being used. My reason for not wanting children is for cleanliness. I understand there are work arounds. I was wondering if there was a more direct approach.

When there is a collision, how can I check which Collision Box is hit?

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:
Unpacking UE4 .pak's? Is there any way to properly unpack/repack resources of UDK-based games (.pak files)? .
From what I've tried already, gildor.org's viewer seems to skip/ignore these .pak's (also, UDK, which is UE3 though, wont read renamed .pak->.uassets).

sentences:
How to implement a starwar energy shield in game I am using Ogre3D.

How can I implement an energy shield like this image?

In the picture, the shield is a semi-sphere, where I want to make it a sphere surround my object. The shield should be transparent (this should be adjustable). Can the community advise how to do this?  Thanks.

sentences:
NullReferenceException Error For Respawning I am making an infinite runner game, and I am having issues with killing and respawning the player. I have a coroutine setup on the GameMaster objec which is the respawn and on the player I have a method that calls that coroutine. But when ever the player hits an enemy I get a Null Reference Exception and I am not sure why this is happining.

Here is the entire error

NullReferenceException: Object reference not set to an instance of an object
Player.OnCollisionEnter2D (UnityEngine.Collision2D col) (at Assets/Script/Player.cs:32)

Here is the line that when I double click on the error it goes to. This line is on the player.

StartCoroutine(GetComponent<GameMaster>().RespawnPlayer());

This is the method that the above line is in. This method is on the player.

void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "Enemy")
    {
        Debug.Log("HIT");
        Destroy(col.gameObject);
        StartCoroutine(GetComponent<GameMaster>().RespawnPlayer());
    }
}

Here is the coroutine that the above method is trying to call. This method is on the GameMaster GameObject and this object never gets destoryed or setActive false.

public IEnumerator RespawnPlayer()
{
    player.GetComponent<SpriteRenderer>().enabled = false;
    player.GetComponent<BoxCollider2D>().enabled = false;
    player.GetComponent<movemnt>().enabled = false;
    yield return new WaitForSeconds(respawnDelay);
    adMenu.SetActive(true);
}

If anybody can give any suggestions that would be great!

sentences:
Why would OpenGL ignore GL_DEPTH_TEST setting? I cannot figure out why some of my objects are being rendered on top of each other. I have Depth testing on.

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);

Do I need to draw by order of what is closest to the camera? (I thought OpenGL did that for you.)

Setup code:

 private  void setUpStates() {
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glLightModel(GL_LIGHT_MODEL_AMBIENT, BufferTools.asFlippedFloatBuffer(new float[]{0, 0f, 0f, 1f}));
    glLight(GL_LIGHT0, GL_CONSTANT_ATTENUATION,BufferTools.asFlippedFloatBuffer(new float[]{1, 1, 1, 1}) );

    glEnable(GL_COLOR_MATERIAL);
    glColorMaterial(GL_FRONT, GL_DIFFUSE);
    glMaterialf(GL_FRONT, GL_SHININESS, 50f);
    camera.applyOptimalStates();

    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

    glEnable(GL_TEXTURE_2D);

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);

    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}

Render Code:

private void render() {

    // Clear the pixels on the screen and clear the contents of the depth buffer (3D contents of the scene)
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    // Reset any translations the camera made last frame update
    glLoadIdentity();
    // Apply the camera position and orientation to the scene
    camera.applyTranslations();
    glLight(GL_LIGHT0, GL_POSITION, BufferTools.asFlippedFloatBuffer(500f, 100f, 500f, 1));
    //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

    for(ChunkBatch cb : InterthreadHolder.getInstance().getBatches()){
        cb.draw(camera.x(), camera.y(), camera.z());
    }

}

The draw method in ChunkBatch:

    public void draw(float x, float y, float z) {
    shader.bind();
    shader.setUniform("cameraPosition", x,y,z);
   for(ChunkVBO c : VBOs){
        glBindBuffer(GL_ARRAY_BUFFER, c.vertexid);
        glVertexPointer(3, GL_FLOAT, 0, 0L);
        glBindBuffer(GL_ARRAY_BUFFER, c.colorid);
        glColorPointer(3, GL_FLOAT, 0, 0L);
        glBindBuffer(GL_ARRAY_BUFFER, c.normalid);
        glNormalPointer(GL_FLOAT, 0, 0L);
        glDrawArrays(GL_QUADS, 0, c.visibleFaces * 6);
    }
    ShaderProgram.unbind();
}

sentences:
Google Play Services and COPPA Compliance I hesitated to ask this question here, since i'm not sure there is a definitive answer (but there can be, maybe i missed it).

I'm implementing Google Play Services for a game on Android target at all audiances, including children under 13.

So, I was wondering, does the use of achievements comply with COPPA rules?
On one hand the app is not using personal informations (only reporting progress of achievements, which can be score, or number of games... nothing personal), BUT on the other hand, the authentication itself to google play games seems to be personal information sent to the internet (the auth process itself).
I'm already using admob with the tagForChildDirectedTreatment.

So i was wondering, if achievements (and maybe leaderboards) need specific steps to comply with COPPA, is there something like this tagForChildDirectedTreatment but for achievements, ... or do I have to show a panel to get parental authorization? Or maybe set the google play connection as optional, not default as written somehow here?

The reason why i'm so concerned by this is this little $16000 fine i read several times, in case you don't respect whatever has to be respected.

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:
How does Unity's Collider.Bounds work? From waht I understand, Collider.Bounds are the sides or bounds of the collider of the GameObject (at least for a cube with a BoxCollider). But I got a result that I wasn't expecting when I tried moving a cube continuously downwards and drawing the bounds with lines. While moving frame by frame, the collider bounds seemed to be not bounding the cube (or at least that's what my test is showing, if my test is correct).

Here's 3 frames of screenshot:

What I did for this is create a new 3D project, add a Cube, then added a single script and then added this script to the Cube. The whole script is:

using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    Vector3 velocity;

    // Start is called before the first frame update
    void Start()
    {
        velocity = Vector3.zero;
    }

    // Update is called once per frame
    void Update()
    {
        velocity.y += -0.5f;
        transform.Translate(velocity);

        Bounds bounds = GetComponent<Collider>().bounds;
        Debug.DrawLine(new Vector3(bounds.min.x, bounds.min.y, bounds.min.z), new Vector3(bounds.max.x, bounds.min.y, bounds.min.z), Color.red);
        Debug.DrawLine(new Vector3(bounds.max.x, bounds.min.y, bounds.min.z), new Vector3(bounds.max.x, bounds.max.y, bounds.min.z), Color.red);
        Debug.DrawLine(new Vector3(bounds.max.x, bounds.max.y, bounds.min.z), new Vector3(bounds.min.x, bounds.max.y, bounds.min.z), Color.red);
        Debug.DrawLine(new Vector3(bounds.min.x, bounds.max.y, bounds.min.z), new Vector3(bounds.min.x, bounds.min.y, bounds.min.z), Color.red);
        Debug.DrawLine(bounds.min, bounds.max, Color.red);
    }
}

Am I not understanding something or am I doing something wrong?

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:
Instantiate creates a clone in wrong position I have this prefab with this transform:

And then using this code to create a clone (the prefab is assigned to a public property of a script, which I assign using the editor, which is the e.Weapon):

Instantiate(e.Weapon, new Vector3(0f, 0f, 0f), Quaternion.identity, rightHand.transform);

I am parenting it to my character's right hand. But whenever the clone gets created, it has different position than the one I have in my code. It appears like this:

Any idea why this is happening?

sentences: How to add text box in slick2d? I wanted to let the player rename the character of my game. So I thought that making a text box and when he clicks the ok button, the text inside the text box will make it to a string and render it on the screen. How do I let the user type their own text?

sentences:
Android SurfaceView framerate issue I am using SurfaceView to draw a lot of Bitmaps onto canvas. This causes really variable frame rates depending on how many objects are present. My code below:

public class OriginalView extends SurfaceView implements SurfaceHolder.Callback {
  private final static int THREAD_SLEEP_TIME = 32;
  private DrawThread drawthread;

  private onDraw(Canvas canvas);
  public void onSizeChanged(int w, int h, int oldW, int oldH);
  public void surfaceChanged(SurfaceHolder holder, int format, int width,
        int height);
  public void surfaceCreated(SurfaceHolder holder);
  public void surfaceDestroyed(SurfaceHolder holder);

  private DrawThread extends Thread {
    private SurfaceHolder surfaceHolder;
    public boolean threadIsRunning;
    public DrawThread (SurfaceHolder holder) {
      threadIsRunning = true;
      surfaceHolder = holder;
    }
    public void run() {
      Canvas canvas = null;
      while(threadIsRunning) {
        try {
          canvas = surfaceHolder.lockCanvas(null);
          synchronized (surfaceHolder) {
            if (canvas!=null) onDraw(canvas);
          }

          sleep(THREAD_SLEEP_TIME);

        } catch (InterruptedException e) {
          e.printStackTrace();
        } finally {
          if (canvas != null) surfaceHolder.unlockCanvasAndPost(canvas);
        }
      }
    }
  }
}

As you can see here in DrawThread's run function that the Thread is supposed to sleep for a constant value of time, predefined here as 32 milliseconds, but since sometimes onDraw(canvas) takes more time, varied due to number of components on screen, the frame rate per second that this code achieve is 17 - 51 fps in my game. This is highly unacceptable. How can I draw lots of Bitmaps onto a canvas, while maintaining high frame rates?

sentences:
Is there a way to limit the size of the D3DPOOL_MANAGED pool? I have over 2GB of textures that I need to put in D3D9's D3DPOOL_MANAGED pool.

D3D9 charges the system copy of anything in the D3DPOOL_MANAGED to my process space. I'm working on a 32-bit system so I have less than 1.7GB of available process space.

Is there a way to limit the size of the pool D3D9 stores in my process, that is to tell it to keep anything else it needs to cache on disk?

sentences:
How would I move an object using its velocity on a closed curve? I want that an object follows a path, in Peggle game there are some pegs that have
movement in a closed path. How can i get the same result? I guess that I can use parametric curve but I need use the velocity and not the position (x, y).

I use NAPE and I have this in my gameloop:

//circunference
angle = angle + 1*(Math.PI / 180);
movableBall.position.x = radius * Math.cos(angle)+ h;
movableBall.position.y = radius * Math.sin(angle)+ k;

It works but I can not control the velocity, each movableBall must have its own velocity.
Besides, from docs of NAPE:

  "Setting the position of a body is equivalent to simply teleporting
  the body; for instance moving a kinematic body by position is not the
  way to go about things.."

I want to use:

movableBall.velocity.x =??
movableBall.velocity.y = ??

The final idea is to follow others paths like the Lemniscate of Bernoulli.

sentences:
Video recording and editing for game promo video I would like to screen record a beta of an RPG I've created. The format will be narration over video with the ability to edit. It's an indie game I'm marketing, so the video quality and narration need to be semi-professional.

I'm curious as to which video production packages are of good enough quality to accomplish this without breaking the bank (free is the best!). If there are no good packages, then separate software recommendations for screen recording, editing, and narration would be helpful!

Notes:

I have a Mac
I would rather do video recording first, then narration later with an overlay
I've used Quicktime in the past, not sure if there was something better
This video is for my Kickstarter campaign

sentences:
How does Against The Wall create an infinite wall? There is a game called Against The Wall, developed by Michael P. Consoli. It's a fantastic game, as I've always been stumped at how the game creates an infinitely spanning wall.

In the game, you can fall forever, and the wall will keep spanning. I can fall as long as I like, and still be able to climb back to where I was before. The game is developed in Unity.

How can a game do this without crashing, or creating some kind of memory overload?

sentences:
The name 'txt' does not exist in the current context I am getting the error The name 'txt' does not exist in the current context and I am unsure why this is happening. I am very new to programming in C# so sorry if the answer is obvious. I am trying to make my ammo count change on screen and have been told to use txt.GetComponent<UnityEngine.UI.Text>().text = ammo.ToString(); but that gives me the error and I am unsure why. This code is supposed to spawn in bullets for my gun but that part of the script is not important. The problem is that error. If you could tell me what the problem is that would be greatly appreciated.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;

public class PL : MonoBehaviour
{
    public GameObject bulletPrefab;

    public Camera playerCamera;

    private Coroutine hasCourutineRunYet = null;

    public int ammo = 165; // 65 enemies in total, needs tons of ammo
    public GameObject axe;

    public Text Ammmo;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (hasCourutineRunYet == null)
            {
                hasCourutineRunYet = StartCoroutine(BulletShot());
            }
        }

        if (ammo == 0)
        {
            GameObject.Find("wp_shotgun").SetActive(false);
            axe.SetActive(true);
        }

        txt.GetComponent<UnityEngine.UI.Text>().text = ammo.ToString();
    }

    IEnumerator BulletShot()
    {
        GameObject bulletObject = Instantiate(bulletPrefab);
        bulletObject.transform.position = playerCamera.transform.position + playerCamera.transform.forward;
        bulletObject.transform.forward = playerCamera.transform.forward;
        yield return new WaitForSeconds(1.0f);
        hasCourutineRunYet = null;
        ammo--;
    }
}

sentences:
Bullet prefab gets stuck to target after hitting As the title says, I am having an issue with prefabs: I am trying to make a bullet follow a curve and then hit a target using this method:

private IEnumerator BezierShooting()
{
    GameObject shotInstance = new GameObject();
    shotInstance = Instantiate(shotPrefab, transform.position, Quaternion.identity);
    Vector3 currentPosition = new Vector3();
    if (shotInstance != null)
    {
        while (t < 1 && shotInstance != null)
        {
            currentPosition = Mathf.Pow(1 - t, 3) * controlPoint0.position +
                            3 * Mathf.Pow(1 - t, 2) * t * controlPoint1.position +
                            3 * (1 - t) * Mathf.Pow(t, 2) * controlPoint2.position +
                            Mathf.Pow(t, 3) * controlPoint3.position;
            Debug.Log(currentPosition);
            shotInstance.transform.position = currentPosition;
            t += 0.02f;
            yield return new WaitForEndOfFrame();
        }
    }
    else
    {
        currentPosition = transform.position;
        t = 0;
        yield break;
    }

}

Where t is a float variable that I initialised before as well as the transforms controlPoint0, controlPoint1, controlPoint2 and controlPoint3.

The bullet is succesfully following the path that I created, however the problem is that once the bullet hits an object in position (x, y, z) and gets destroyed, if I call the method again the prefab will spawn in the last position it was on. I thought that final else statement would do the trick, but appearantly I am missing something. Can somebody help me please?

sentences: OpenGL vs DirectX difference from Graphics card perspective? I want to know the difference in purely hardware level if there is any. For example the most simple question: Is there a chip for DirectX and another chip for OpenGL? What do hardware producers do to make their cards DirectX or OpenGL compliant?

sentences:
Why does my Window take a few clicks to actually close even though the event fires? I am pretty new to game dev (and libgdx + scene2d specifically), I am creating a dialog system for an rpg game and obviously a dialog window has a close button to close a dialog but for some reason it takes few clicks to close it (see video).

I have added System.out.println(Actor.class) to where the listener executes:

As you can see the events fired as planned!

Here is my listener code:

closeButton.addListener(new ChangeListener() {

  @Override
  public void changed(ChangeEvent event, Actor actor) {
    System.out.println(Actor.class);
    event.getListenerActor().getParent().addAction(Actions.hide());
  }
});

Please send help,  thank you

sentences:
watching for changes in object state I'd like to know what others do to watch for changes in object states while the game is running.

Say you have an object and that object has a timer. The timer completes. What is the best way to know that the timer has completed?

something like?
- add all timers to a vector.
- set a bool when the timer completes
- loop over the vector continuously or at a short interval and watch for the bools?

Seems simple, but is it really that simple? What is the best way to loop over the vector continuously? C++11 thread and detach it from the main?

sentences:
How should I draw the GUI if I use a 2D camera? I have a camera in my 2D side scrolling game and I want to implement the GUI. How can I do that?

For the moment, I draw everything like this:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.None, RasterizerState.CullNone, null, scaleMatrix * camera.GetMatrix());
  player.Render(spriteBatch);
  GUI.Render(spriteBatch);
  ...
spriteBatch.End();

Should I separate the GUI drawing code from the camera's transformation matrix? How can I do that? What is the best way to implement the GUI in a Windows Phone 8 project?

sentences:
Movement in grid in Unity I am a beginner at Unity. I want to make a game like Lightbot, but in 2d (without the z axis movement) with some obstacles. Before making the function system of the Lightbot, I want to make the in-game character move on a grid by the set of key inputs (e.g. WASD) by the player. But I'm stuck here. I searched on Tilemap which makes a grid, but I have no idea how to save the set of input keydowns and move my character on this grid at once. Suppose my character is on the (0, 0) square for example. After the player taps WWDD, then my character should move to the following squares, in the following order:

(0, 1)
(0, 2)
(1, 2)
(2, 2)

How can I achieve my goal?

sentences:
Best way to read expandable voxel world (hashmap) such as in Minecraft I'm building a 3D multiplayer Roguelike-style engine (tile and turn-based) and I'd like to make the worlds virtually "infinite", similar to what you would see in Minecraft.

I'm storing data in a manner I'm assuming to be pretty similar to Minecraft based on what I've read so far. Chunks of 16x16x16, stored in arrays that are X amount high based on world height. These arrays are stored in a hashmap indexed as integers based on a z-order / morton curve implementation (to flatten them from 2d for easier storage.)

Everything is working well so far, but I've been coding everything assuming the active world will all fit into one square (based on view distance or something along those lines) instead of multiple areas (difference illustrated here).

But once I start assuming different areas will be loaded and active in the world, it brings a huge performance issue: in order to check individual cubes I'd have to see if it's parent chunk is active and loaded in order to avoid some kind of null pointer exception.

Aside from trying to somehow do pathfinding / world interaction in batches within individual chunks (which would be really hard to think around and I'm trying to just grab individual cubes from the "world" object that handles navigating the hash map) I can't think of any way around the issue except doing a hashMap.containsKey(int) for every single world read operation. So, in other words, if 8 players are on the server in entirely different active areas in the world, every block read would require checking if the Morton Code of the chunk the requested block is in falls into the currently loaded area of Players * Active Area, so 8*(8*8) individual chunks in this example.

So I'm curious if my Hashmap-based setup is incorrect for solving this problem, or if there is any other way around this issue.

sentences:
Navigation using Marmalade How do I achieve navigation to different views in Marmalade? Like what using startActivity(intent) in Android does.
I know that there's only a single view in Marmalade, but still couldn't figure out how to make a similar example.

sentences:
Animation inside a .obj file? Ok, so yesterday I understood that "rigging (bone and joints)" are things that are use inside a 3D animation software like maya. By that I mean that those bones and joints are not inside the .obj file but only inside the software to help you animate the model.

My plan was to create my own voxel model using my own editor, then load it up into maya to animate it and then put it inside Unity to use the animation but from what I understand, its impossible to put multiple frame inside a file to use the pre-made animation inside a software like Unity.

Does that mean that I will have to load my voxel model inside unity and animate it using the Unity Animation Engine ?

sentences:
How to write a PBR Unlit Shader in Unity? I have a REALLY specific case here:

I have an Texture (a webcam), that is used by a shader to pickup a few x,y colors at the cordinates, and renders to a Custom Render Texture, that is later fetched (download pixel color information from GPU to CPU), and I can handle the algorithm from there.

The thing is, once I upgraded the project to PBR (Physically Based Rendering), all my Unlit scripts become PINK, and they stopped working.

This is a special case because:

It doesn't need to appear on the screen
It acts as a "Compute Shader", but with backward compatibility to old phones
It works well without PBR, but once PBR is enabled it becomes pink and stops working
It doesn't need to reflect, refract, output pixels or anything to the "Screen", only to my Custom Render Texture so that I can fetch it later.
The algorithm doesn't fits on a Graph based programming (it has iterations and etc)

Well, I didn't find documentation on how to write custom PBR shaders and here I am.

sentences:
Filling in gaps in a grid I have a set of terrain sprites available to represent terrain:

Flat
North-South Straight Cliff (x 2 allowing for slope direction either way)
West-East Straight Cliff (x 2 allowing for slope direction either way)
Convex North West Cliff
Convex North East Cliff
Convex South East Cliff
Convex South West Cliff
Concave North West Cliff
Concave North East Cliff
Concave South East Cliff
Concave South West Cliff

There source for my terrain is a height map that I am looking to represent with contours made up from above sprites. The cliff tiles would be placed on the below-threshold tiles that border the above-threshold ones. However when I split the height map by threshold I get terrain features that are impossible to represent with the tile set, for example:

    .....
... 1 1 1 ...
... 0 0 0 ...
... 1 1 1 ...
    .....

Where 1's represent tiles that are above the threshold and 0-tiles are below. My sprite set lacks the tile to represent either immediate neighbors (in this case North and South neighbors) being above threshold.

I am looking for a good approach to get rid of these cases. I have already tried just looping through all columns/rows looking for 1 0 1 combinations and changing the height map value to be above the threshold. In the end, I don't really mind the way the "gaps" are filled in, as long as the end result can be represented with my tile set.

Remember cases with diagonal gaps must be considered. For example:

    .....
... 0 0 1 ...
... 0 0 0 ...
... 1 0 0 ...
    .....

Also cannot be represented with my tiles set.

Finally, I'm also looking for a scalable solution to this problem. If I require to use and even more restrictive tile set that requires 1 (0 x n) 1 gaps to be filled in, as in the two above-threshold tiles can be n below-threshold tiles away from each other.

P.S. Apologies for my previous poorly worded question.

sentences:
Unity Particle System collision detection problem I'm using Unity 3.5.5f3 wich has the Shuriken particle system.

I've made a blood particle system based on Unity's demos. (Exploding paint [Blood])
The blood is flowing and when it collides with a Plane Transform wich I've created a small pool of blood spawns as a Collision Sub Emitter.

My main problem is that when I want to add another object to collide it just doesn't want to work. When I create a cube, and set it as a collision plane the collision will only occur at the half of the cube.

I want this to happen: When it reaches the cube's surface the sub emmiter activates, and when the surface is horizontal it appears horizontally, and if it's vertical then vertically. Now it just appears horizontally everytime like in the picture.

How could I solve it?

sentences:
Why does rb.velocity blurrs background? My player controller code is bellow. So is my player inspector. This makes my character move yet it blurs the background, but when I use  transform.position.x = transform.right * speed * Time.DeltaTime it moves without blurring the background. However I'd prefer moving the character using the physics system, to avoid complications with collisions, etc.. What is going on?

[SerializeField] public float speed;
[SerializeField] public float jumpForce;

private Rigidbody2D rb;
private CharacterAnimationsAn animationScript;
void Start()
{
    rb = GetComponent<Rigidbody2D>();
    animationScript = GetComponent<CharacterAnimationsAn>();
    gameObject.transform.eulerAngles = new Vector3(0, 180, 0);

}

// Update is called once per frame
void FixedUpdate()
{
    rb.velocity = new Vector2(speed, rb.velocity.y);
    animationScript.SetRunning(true);
}

Maybe it might be related to the Script that make the Camera follow the Player?

myDistanceToFllowerDifference = gameObject.transform.position - objectTofollow.transform.position;

gameObject.transform.position = new Vector3(objectTofollow.transform.position.x + myDistanceToFllowerDifference.x, gameObject.transform.position.y, gameObject.transform.position.z);

I have no processing stack, my camera inspector is bellow:

I also have a parralax script working on the background which has an inner working almost identical to this: Parallax Video

I should correct that it might not be a blur but actually an effect similar to a low frame rate on the background, while the player and everything show no such effect. Unfortunately I can't actually provide you with an image of the effect, as I'm not authorized to do so.

sentences:
How to synchronize actions like jump in multiplayer? I am a newbie game developer and I have been researching about multiplayer games. I observed that there's always some latency, the players always get updates from past actions. But there are techniques like dead reckoning to handle the latency. I can predict the movement and make movements smooth. But how would I make actions synchronize like jumping, stopped walking, etc.

Suppose, client A was moving, he was at 100m at 10.2 time with 100m/sec velocity and sended this information. Client B would receive this information somewhat later, let it be 10.4. So at client B, I can use prediction and place client A at 120m. But what if, client made a jump at 110m at 10.3. I can't predict that and since I have been using prediction I can't show client A jump in past.

I may deal with this problem by not sending jump action at all. But what if my game has some voids where players can fall and die. So, If I don't sync jump actions, other players will observe that one player was running then he falls in void and then again appear on the screen destroying the visual engagement.

Jump is just an example, there might many scenarios where prediction can't work. So, How do deal with them. One such example can be Multiplayer Online battle arena games like Awesomenauts.

sentences:
In glsl, how do indices work? I have made a vertex shader and fragment shader and kind of know how they work, and I know that you specify what index you want your vertices to be in inside the shader program. So if the vertex was at index 0, does each vertex take up 1 index? If each one took up an index, than how many indices would a matrix 4x4 take up? Sorry if thats confusing but I'm just starting and I don't really know how the indices within the shader works. So:

#version 140
in vec3 position; //This could be located at index 0
in mat4 randomMatrix; //If this came right after position, what index is it located at??
void main() {
    gl_Position = vec4(position.x * 0.5, position.y * 0.5, position.z * 1, 1);
}

Tell me if I have this all wrong.

sentences:
Shortest path to a road I have a road network and a vehicle that is current off the roads. I want to find the shortest path to any road. An obvious solution is to run a pathfinding algorithm between the current vehicle location and all the points on the road, but that's hardly scalable.

I am curious to know if there is an algorithm out there that I could use to maximize the performance of this operation.

sentences:
How it the level of detail texture loading called Borderlands 2 uses this technique:
https://www.youtube.com/watch?v=NDKOndosFAg

Some games use techniques to load textures progressively in some level of detail way.
I can not find any material on this topic or any terms.
How is it called and how is it done?

sentences: how to attach a body to a rope and making it swing to another rope I've set some ropes (using cocos2d and box2d) and would like to attach a body to one rope in such a way that it can swing to another rope. I am not sure how to go about this. I read  making and object swing from one rope to another but it didn't seem to be of any help.

sentences:
How to Align Gun with Bullets I have a top-down 2D shooter. I have an image of a player holding a gun, that rotates to face the mouse. Please note that the gun isn't a separate image tethered to the player, but rather part of the player. Right now, bullets are created at the player's x and y. This works when the player is facing the right way, but not when they rotate. The bullets move in the right direction, but don't come from the gun. How can I fix this?

TL;DR: When the player rotates, bullets don't come from gun.

public void fire() {
    angle = sprite.getRotation();
    System.out.println(angle);
    x = sprite.getX();
    y = sprite.getY();

    Bullet b = new Bullet(x, y, angle);
    Utils.world.addBullet(b);
}

sentences:
How did EA DICE create destructible environments in Battlefield Bad Company 2 and Battlefield 3? How did the folks at EA DICE create destructible environments in Battlefield Bad Company 2 and Battlefield 3?

Did they just assemble the buildings out of predefined sub-regions, that break apart when there is an explosion or something similar? I can't think of anything else.

sentences:
How do I get current emission intensity of a material in code? I'm unable to find how can I get current intensity level of emission in Unity.
Is there some kind of method that can return its value?
I need it to complete my algorithm's formula:
current_color = (intensity * 10)/20;

sentences:
Is using two languages in a game engine a good idea? I'm thinking about making a game engine, as a learning project.

I know Java the best, and I figure most of the code is not going to be running that much of the time, given the 20/80 rule. Why not write most of it in a language I know? For the part that has to be really fast, like the renderer, I was thinking of writing that in native code.

Is this approach of using two languages a good idea, or a terrible one?

sentences:
How do I convert a humanoid retargetted animation to a generic animation? In my game, I use a Generic Rig model called "hero_generic".
I have a pistol-shooting animation.
This animation was created for another rig, so I need to use Humanoid retargetting to use it on my model.
To try out how it looks, I copy my "hero_generic" character, name it "hero_humanoid" and create a Humanoid avatar for it. Then I set the animation to "Humanoid", put it on an animation controller and put the animation controller onto the "hero_humanoid".
It works, the animation is now playing on my Humanoid character, but I don't want my character to be Humanoid.
I want to bake the animation out for my hero_generic character.
Unity doesn't provide any built-in option to do that.
How can I turn this retargetted animation to a generic .anim file?

sentences:
Infinite Seamless Background HLSL Shader in Monogame doesn't work with non square textures I'm trying to write a shader that draws a seamless background infinitely in Monogame.

sampler TextureSampler : register(s0);
float2 ViewportSize;
float4x4 ScrollMatrix;
struct VertexToPixel {
    float4 Position : SV_Position0;
    float4 TexCoord : TEXCOORD0;
    float4 Color : COLOR0;
};
VertexToPixel SpriteVertexShader(float4 color : COLOR0, float4 texCoord : TEXCOORD0, float4 position : POSITION0) {
    VertexToPixel Output = (VertexToPixel)0;

    // Half pixel offset for correct texel centering.
    position.xy -= 0.5;

    // Viewport adjustment.
    position.xy = position.xy / ViewportSize;
    position.xy *= float2(2, -2);
    position.xy -= float2(1, -1);

    // Transform our texture coordinates to account for camera
    texCoord = mul(texCoord, ScrollMatrix);

    //pass position and color to PS
    Output.Color = color;
    Output.Position = position;
    Output.TexCoord = texCoord;

    return Output;
}

technique SpriteBatch {
    pass {
        VertexShader = compile vs_2_0 SpriteVertexShader();
    }
}

I'm using Monogame.Extended so I can use their Camera2D class. I have this function to draw my texture:

public static void drawSeamlessBackground(SpriteBatch s, Texture2D t, GraphicsDevice gd, float parallax, Camera2D cam) {
    //TODO: Make this work with non square textures.
    Vector2 textureSize = new Vector2(t.Width, t.Height);
    Rectangle view = gd.Viewport.Bounds;
    Matrix m = Matrix.CreateTranslation(new Vector3(-cam.Origin / textureSize, 0.0f)) *
                Matrix.CreateScale(1f / cam.Zoom) *
                Matrix.CreateRotationZ(-cam.Rotation) *
                Matrix.CreateTranslation(new Vector3(cam.Origin / textureSize, 0.0f)) *
                Matrix.CreateTranslation(new Vector3((cam.Position * parallax) / textureSize, 0.0f));

    infiniteShader.Parameters["ScrollMatrix"].SetValue(m);
    //Normally this next line would not be here since the viewport doesn't usually change.
    infiniteShader.Parameters["ViewportSize"].SetValue(new Vector2(view.Width, view.Height));

    s.Begin(samplerState: SamplerState.LinearWrap, effect: infiniteShader);
    s.Draw(t, new Vector2(0, 0), view, Color.White);
    s.End();
}

This whole thing works fine for square textures, but when the width and the height are different, there's distortion that happens when I rotate my camera.

In the next image, there are two textures, one that is square and one that is a rectangle.

Here is what it looks like with no rotation:

Here is what it looks like with some rotation:

The red texture has square dimensions (500x500). The white texture has rectangular dimensions (1280x720).

I'm sure this is a simple fix, but I can't figure it out.

sentences:
LibGDX collision detection on moving and rotating object (rectangle enemy) i am trying to get collision dectection working properly but when i do it, the collision area keeps moving. no matter what i tried.
there are 2 objects and the objects are moving and i cannot get the area of the collision to follow the enemy/object.

i am using the method below to see if the collision will work and it does not follow the enemy properly.

enemy class extends sprite {

the above is an example of how i am using the sprite extension.

the object/enemy is a sprite from libgdx the class is extended by sprite.

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);

shapeRenderer.rect(rect1.getX() + (rect1.getWidth() / 2), rect1.getY()  + (rect1.getHeight() / 2) - 2, rect1.getOriginX() - 1, rect1.getOriginY() - 4, 1.0f, 1.0f, rect1.getRotation());

shapeRenderer.rect(rect2.getX() - 10, rect2.getY() - 10, rect2.getWidth() - 10, rect2.getHeight() - 10, rect2.getOriginX(), rect2.getOriginY(), rect2.getRotation());

shapeRenderer.end();

this is in the enemy class collision check

rect.set(getX() + (getWidth() / 2), getY()  + (getHeight() / 2) - 2, getOriginX() - 1, getOriginY() - 4);

this is to see if the enemy is colliding

public boolean collides(Ball ball) {
 if (getX() < ball.getX()) {
 return (Intersector.overlaps(ball.getRect1(), rect));
  }
 return false;

 }

Any help will be really nice.
thank you

sentences:
How can I instantiate enemies in a 2D game at a set Viewport Position before my camera enters the room? (Or alternative solution!) I'm currently working on a 2D game where I'm trying to pre-populate my level with encounters, I want the enemies already in the room when the player enters. Right now the encounter is triggered upon entering the room when the camera bumps into the collider and the enemies are instantiated at the Viewport position, however because it does it while the camera is moving into the room the position is incorrect. Using hard values isn't an option because the maps could of course change and also I may want them randomly generated at some point. So I guess ultimately the problem is the camera not being in the right position when they instantiate and not wanting enemies to "pop" in once it is.
Is there a way I can I instantiate an enemy at the same point on the screen regardless of resolution in each specific room at the start of the level?
Encounters will have up to 3 enemies and they will always hold the same formation (with spots randomized to add diversity)
Here is my instantiating code:
[SerializeField] public List<GameObject> levelEnemies = new List<GameObject>();
GameObject levelEnemy;
Vector3 enemyPosition;
Vector3 viewportPosition = new Vector3(0.8f, 0.5f, 10f); // Place on the screen I decided I want single enemies to appear
Camera cam;

void Start()
{

    Debug.Log("Enemy Triggered");
    cam = Camera.main;
    enemyPosition = cam.ViewportToWorldPoint(viewportPosition);
    levelEnemy = Instantiate(levelEnemies[0], enemyPosition, Quaternion.identity); //instantiate test enemy at the converted position

    //navigation.DisableNavigation();
}

Here is what my camera collider looks like (Room 1) and my enemy encounter collider looks like (Room 3)

Here's what should be happening when the enemy is instantiated (triggered manually through the editor once camera has been moved fully)

Here is what happens when the camera collider bumps into the encounter collider

Any help in the right direction would be much appreciated or a workaround!
Here is what my camera collider looks like (Room 1) and my enemy encounter collider looks like (Room 3)

sentences:
How to share image in persistentDataPath to facebook feed? I'm trying to share an image taking from CaptureScreenshot() using FB.ShareLink(...) to Facebook.

My code is the following: (After calling FB.Init(), etc..)

 string tmpScreenshotPathname = "file:///" + currentScreenshotPathname;
 System.Uri contentUri = new System.UriBuilder(tmpScreenshotPathname).Uri;
 System.Uri imageUri = new System.UriBuilder(tmpScreenshotPathname).Uri;
 FB.ShareLink(contentUri, "Test", "Test desc", imageUri);

However,  when open the FB share, the page opens for a split second before returning me back to the game. I tried using a normal Uri such as http://........jpg and it works fine, but when I try to use a local Uri, it fails.

Is there any way to share the image to the feed without uploading it to the user's Facebook gallery using FB.API? Because there's the case where the user might decide not to share the image to the feed.. but it would have already been uploaded to his gallery from FB.API.

sentences:
Raycast Masks not working Unity3D I'm having a problem with filters/masks when raycasting.

I've created a LayerMask and then in the inspector selected the layer I want to ignore when Raycasting. however then I print out the name of the object hit by the raycast I am still getting hits on objects on the layer masked out, as well as on other layers.

public LayerMask rayMask;

RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (ray, out hit,rayMask)){
    Debug.Log (hit.collider.name);
}

I have paused the Game and checked that the object I'm getting a hit on is indeed on the layer in the mask.

sentences:
How do you deal with transparent fonts that you want to be white? I'm a bit of a total amateur, but I thought I would learn how to make a simple game during quarantine.
However, I stumbled into a problem with fonts. I'm thinking about using the free font "Pixelmania" to show a score at the top of the screen. But the font is transparent! How do I make the inner part of the font white? Do I have to manually edit the font file myself? Or is there an easier way?

sentences:
OnClick events - using Scaleform UI with Cryengine 3.5.4 I've created a UI in Flash, set up an xml file for it and designed a flowgraph to ensure it displays when I launch. However, clicking on the buttons doesn't appear to do anything, despite me writing a click event in AS, linking to it in the xml, and connecting the function to a level change in the flowgraph.

XML:

<UIElements name="zlogicGUI2">

<UIElement name="GuiV2" render_lockless="1">

<Gfx file="GuiV2.gfx" layer="0">
<Constraints>
<Align mode="dynamic" valign="center" halign="center" scale="0" max="0" />
</Constraints>
</Gfx>

<events>
<event name="OnClick" ExternalInterface="ButtonClickPressed" desc="" />
</events>

</UIElement>

</UIElements>

ActionScript 3 (created in Flash CC)

button_1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void
{
    ExternalInterface("ButtonClickPressed");
}

sentences:
Stopping on a slope in Box2d I am creating a simple platformer using Box2d. I've implemented a variant of the technique described here.

To make the player character move more 'platformer-like' I want him to stop on (shallow) slopes.

However, the engine I am using does not support angle-joints, so I have trouble restricting the movement of the wheel. I've tried some different alternatives that not worked: Setting the horizontal velocity to 0 every game loop doesn't seem to work, because between calls the wheel catches up speed once again.

Is there another way to fix this?

sentences: Confusion on HLSL Samplers. Can I Set Samplers Inside Functions? I'm trying to create a system where I can instance a quad to the screen, however I've run into a problem. Like I said, I'm trying to instance the quad, so I'm trying to use the same geometry several times, and I'm trying to do it in one draw call. The issue is, I want some quads to use different textures, but I  can't figure out how to get the data into a sampler so I can use it in the pixel shader. I figured that since we can simply pass in the 4 bytes of our IDirect3DTexture9* to set the global texture, I can do so when passing in my dynamic buffer. (Which also stores each objects world matrix and UV data) Now that I'm sending the data, I can't figure how to get it into the sampler, and I really want to assume that it's simply not possible. Is there any way I could achieve this?

sentences:
Performance drawing in Pygame Relevant background information

I'm developing a game for a high school computer science performance task in python & pygame. I'm using objects and all the code is working well for me.

The game consists of a top down (bird's eye view) 2D shooter of a player that rotates and shoots at zombies that spawn and make their way to him. Kind of like dead ops arcade from the original black ops.

Though I'm developing the levels using a list string type designer (there's probably a name for the common technique I'm unaware of), than I load it and I have an array of rects. Here is some background code.

            x = 0 # Start X at 0
                    y = 0 # Start Y at 0
                    for row in levelData: # run a for loop for all the rows in level data
        for col in row: # run a for loop for all the colums in the row
            if col == "1": # check if the column section is labeled 1
                self.Rects.append(pygame.Rect((x, y),(self.tileWidth, self.tileHeight))) # append a rectangle
            if col == "2": # check if the column section is labeled 2
                self.Rects.append(pygame.Rect((x, y),(self.tileWidth, self.tileHeight))) # append a rectangle
            if col == "3": # check if the column section is labeled 3
                self.zombieSpawners.append(ZombieSpawner(x, y, self.zombieManager, int(self.maxZombies / self.levelDesigns.getSpawnerAmount(self.level)), self.zombieSpawnTimeMin, self.zombieSpawnTimeMax, self.zombieVelMin, self.zombieVelMax, self.zombieHealth)) # Initalize a zombie spawner with given data
            x += 64 # adjust x
        y += 64 # adjust y
        x = 0 # reset row
    self.levelLoaded = True

            def draw(self, canvas, playerRect):
    canvas.blit(self.backgroundImage, (0, 0)) # draw background image
    for rect in range(len(self.Rects)): # for loop to run all rects
        canvas.blit(self.blockImage, (self.Rects[rect].x, self.Rects[rect].y)) # draw a block
    for spawner in range(len(self.zombieSpawners)):
        canvas.blit(self.spawnerImage, (self.zombieSpawners[spawner].getX(), self.zombieSpawners[spawner].getY()))

The indenting is all screwed up but you should understand what I'm doing.

The problem

The code above works perfectly. The game ran really smooth with just the player and zombies. Though when I run the background image above, it becomes a huge performance decrease, the fps becomes a solid 3-5. Drawing the blocks and the spawners cause some performance issue's as well, not as bad as the background image but still unplayable.

I think the background image does so much performance damage because it's an actual picture and not a little cartoon like the blocks and spawer's.

What I'm trying to do

Is there anything I'm doing wrong or something I should do that can get my performance back? Like some sort of spritebatch for pygame or something. I can't figure out anything online other than pygame doesn't have that good of a performance.

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:
Why are all my brushes black when I test the level I built with Hammer? In Valve's map-making tool Hammer, I have created several brushes which I use as walls, ceilings, and floors. I've added textures to them, and I have a light entity on the ceiling. all the props and entities in the game are textured and visible.

Unfortunately, when I try to play the map, all the brushes are black. There are no textures or colors besides black on the brushes.

What could be causing this issue? I have tried compiling the map with HDR off, and HDR on, but receive the same effect.

sentences:
Compile shader and root signature of a ray tracing shader into a single binary using DXC I'm new to DXR, so please
If I got it right, when we want to compile a ray tracing shader using the DirectX Shader Compiler, we need to specify lib_6_* as the target profile.
Now assume I've got a HLSL file containing a single ray generation shader RayGen whose root signature is specified by a RootSignature attribute of the form
#define MyRS "RootFlags(LOCAL_ROOT_SIGNATURE),"  \
        "DescriptorTable("                  \
            "UAV(u0, numDescriptors = 1),"  \
            "SRV(t0, numDescriptors = 1))"
[rootsignature(MyRS)]
[shader("raygeneration")]
void RayGen() {}

Using IDxcCompiler::Compile, I'm able to compile both the shader itself using the target profile lib_6_3 and the root signature using the target profile rootsig_1_1, but if I got it right it's not possible to invoke IDxcCompiler::Compile such that the created IDxcBlob contains both the shader and the root signature. (I've tried to add the argument -rootsig-define MyRS to the call for the compilation of the shader, but it seems to me that the compiler expects the root signature specified in this way to be a global root signature.)
So, I end up with two IDxcBlob's. Is there any possibility to "merge" them into a single one which can later be used to specify the shader as well in a call of ID3D12Device5::CreateRootSignature?

sentences:
Glow effect shader for mesh generated at runtime I'm using the leap motion-paint module and i would like the ribbons that are generated at runtime to have a glow effect, I tried editing the existing shader by adding a glow property but the colors did not change. I'm not experienced with shaders so any help would be much appreciated.

EDIT: I tried adding post-processing effects for bloom & glows, all the objects have a glow effect except the ones i'm generating at runtime..

 Shader "LeapMotion/TubeShader" {

Properties{
    _Color("Tint", Color) = (1,1,1,1)
    _Glossiness("Smoothness", Range(0,1)) = 0.5
    _Metallic("Metallic", Range(0,1)) = 0.0
     _Glow("Intensity", Range(0, 3)) = 1
  }
  SubShader{
    Tags { "RenderType" = "Opaque" "Glowable"="True"}
    LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0

struct Input {
  float4 color : COLOR;
};

half _Glossiness;
half _Metallic;
fixed4 _Color;
half _Glow;

void surf(Input IN, inout SurfaceOutputStandard o) {
  o.Albedo = (_Color* _Glow * IN.color).rgb * ;
  o.Metallic = _Metallic;
  o.Smoothness = _Glossiness;
}
ENDCG

}
  FallBack "Diffuse"
}

sentences: An evaluation of game UI, based on certain usability criteria? Is there a resource online which has made the effort to evaluate game user interfaces and estimate their usability (by genre)? (something like what Nielsen does). In-game reviews in magazines unfortunately do not always present an objective and quantifiable point, based on established heuristics or criteria

sentences:
onClickListeners not working correctly (conflicting) In my pause dialog, the exit is working correctly, but the resume isn't, if I press resume 3 times, the third time it's going to exit.

ImageButton btnPlayOn = UIFactory.createButton(txtrPlayOn);
btnPlayOn.setSize(40, 40);
btnPlayOn.setPosition(75, 75, Align.center);
dialogP.addActor(btnPlayOn);

ImageButton btnEndGame = UIFactory.createButton(txtrEndGame);
btnEndGame.setSize(40, 40);
btnEndGame.setPosition(75, 55, Align.center);
dialogP.addActor(btnEndGame);

btnPlayOn.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                System.out.println("resuumeeeeeeee");

            }
        });

        btnEndGame.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                System.out.println("exiiiiiiiiit");

            }
        });

I think I know why, it's because both buttons have the same x so the listener is getting confused. Anyhow I don't know how to fix it.

sentences:
Slowdown in sliding background with Libgdx I´m new with libgx and i have a basic question. I want an background like an image that repeats indefinetely, and moves down. I did with 2 images and it worked, but the problem is that is very slow. I stored the images with 512x512px. My code is very simple but i dont know what im doing wrong.

public void render() {
   Gdx.gl.glClearColor(0, 0, 0.2f, 1);
   Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   offset -= 600 * Gdx.graphics.getDeltaTime();
   offset = offset % 512;
   camera.update();
   batch.setProjectionMatrix(camera.combined);
   batch.begin();
   batch.draw(backgroundImage, 0, offset);
   batch.draw(backgroundImage, 0, offset + 512);
   batch.draw(bucketImage, 0, offset + 1024);
   batch.end();
}

Any suggestions will be appreciated Thanks a lot!

sentences:
Why can't cross-platform multiplayer games exist? At least, why are they so difficult to make? - assuming that's the reason why not even AAA studios accomplish this feat for their games. Especially with modern cross-platform game engines like Unreal and Unity that can build on Xbox, PS4, and PC, why hasn't this been done yet on a large scale?

For example, Diablo III is a game released on a variety of platforms. Despite it being a product of Blizzard, one of the wealthiest video game companies in the world, it does not allow an Xbox player to play with someone using a PC.

sentences:
Scene building for procedurally generated tile based world in Unity i'm making a procedurally generated side-scrolling and destructible tile based world. So far I've got :
 - the values generator (for deciding which tile to place where)
 - a testing scene generating one object per tile (a mesh with 2d box collider, inactive at start)
 - map chunking (separating the map into chunks to show only what is visible)
 - visibility based on orthographic camera size (it's not much but the camera can zoom in or out)
 - the chunks are 32x32 tiles in size
 - the maximum chunks I've seen is around 25

This works fine for testing the world generation, however there is massive stuttering when moving around with camera zoomed out to the maximum. It's less when zoomed in, but it is still noticeable.

From testing, I've found out that its obviously the building in the scene that causes the major part of the stuttering.

I've been searching for better ways of building the scene but there are a few constraints that make most of the non viable :
 - The world is destroyable, so I need to be able to interact with each tile
 - There are textures coming on top of the tile texture depending on context (selection rectangle, decoration, glow...)
 - The tile texture itself is not a single sprite but a repeatable texture, so it needs to be places based on coordinates so it properly repeats itself.

So far I've looked at :
 - TileMaps
 - Mesh melding
 - Texture bombing

None of these seem to be able to fulfill the constraints fully.

Is there a way to fulfill the constraints while improving scene building or am I missing something? Please help.

sentences: Unity or OpenGL for a real time strategy game? I'm trying to recreate an old game I use to play back in the day called Evony but I'm not sure what would be the best way to accomplish this graphically. It was originally written in Flash and I'm contemplating whether to do it using Unity or openGL. I'm not really sure how these types of games are made graphically, I looked at Clash of Clans but all it said is that they use "C++" so I'm lost. How would I go about making these types of games graphically using "C++" as most of these types of games are made for the android platform. I was thinking of using Unity but I'm afraid it would probably be too "bulky" and might make the game run slow, I want to be able to make it in C++ if possible so it can be more efficient. So again, how should I go about this?

sentences:
How can I implement caching into my Rectangular Symmetry Reduction pathfinding algorithm? I have a working implementation of Rectangular Symmetry Reduction (see here and here for more information on RSR).

I'm interested in further improving performance over raw A* by implementing caching of paths. My assumptions are as follows:

We're working on a 4-connect square grid
The Destination position is more important than the start position.
Because RSR is made possible via contiguous rectangular regions, the fastest path between two points in the same region is likely to be the same (but not always)

It's at this point that I get stuck -- I'm unsure how best to use those assumptions and the information generated by a path calculation to better future path calculations.

I've considered storing the path cost from the final waypoint (that is, where the resultant path leaves the first rectangle), but as far as I've been able to consider, that is only useful if I have the path cost from every other potential waypoint on the rectangle's edge -- so good if you've got a lot of rectangular rooms separated by doors (few open edges), less so if you're pathing around wide open fields with a few scattered rocks (many open edges).

Essentially, my intuition is that going that route would potentially necessitate a lot of pathfinding before caching could provide any returns, so I'm looking for someone else's opinion on whether I'm on the right track, or if I'm missing a simpler way of implementing a performance-boosting caching algorithm.

Thoughts? I'm more than happy to discuss more of what I understand of the algorithm or share specific code if requested.

sentences:
How to display full website in Unity WebGL? I want to display the complete website within the WebGL in Unity. I have tried Awesomium plugin but it doesn't work in WebGL. Please tell me is there any way to display the webpage.

Thank you.

sentences: How do I show a camera's field of view area through another camera? I have a side camera that can be set on run-time with changeable field of view with GUI. I am searching for a way to show the field of view of the side camera using my main camera. I am thinking about custom mesh creation through code so that it can be generated alongside the camera rectangle, but it seems too complex. Should I proceed with this method or are there any other solutions?[!

sentences:
Mathf.Clamp not Working Properly I want to clamp the vertical rotation of the first person controller I was making. I want to restrict the vertical rotation of the main camera between -90 and 90 degrees. The code is as follows:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseY : MonoBehaviour
{
    [SerializeField]
    private float _sensitivity = 5.0f;
    private float _verticalInput;

    // Update is called once per frame
    void Update()
    {
        _verticalInput = Input.GetAxis("Mouse Y") * _sensitivity;
        Vector3 lookDirectionY = transform.localEulerAngles;
        lookDirectionY.x -= _verticalInput;
        lookDirectionY.x = Mathf.Clamp(lookDirectionY.x, -90f, 90f);
        transform.localEulerAngles = lookDirectionY;
    }
}

In the above code, Mathf.Clamp does not work for -90. On reaching 0 degrees, it reels back to the +90 degrees. What could be the reason for this and how to resolve it?

sentences:
How do i eject bullet shells from a gun? Java/slick2d So, here is my problem: I am working on a top down 2d shooter in Java and have a character, which can move and rotate/fire to the mouse direction.
Shooting guns etc. works fine but now i am trying to implement a shell ejection system, which "ejects" the shells next to the player. The problem is, that i can't just draw the shells next to the player since the player has an x and y position which are rotating. I want the shells to have a random radius in which they will be ejected. But i don't know how to implement something like this.
Any suggestions?

EDIT:
That's my shell-ejection method, which doesn't work(the angle represents the player angle):

    public void shellEjection(){
    x=(float) x*((float) (Math.cos(angle)));
    y=(float) y*((float) (Math.sin(angle)));

    double length = Math.sqrt((mouseX - x)*(mouseX - x) + (mouseY - y)*(mouseY - y));

    double xVel = (5 - x) /length * 5*bulletVelocity;
    double yVel = (5 - y) /length * 5*bulletVelocity;

    x+=xVel;
    y+=yVel;
}

sentences:
how to remove game objects after on overlap in LIBGDX game I have gold stars in my game that give score to game hero if the hero overlap with the star. What I want is to remove star once it overlap with hero object.
I give score by checking overlap with this code

public void scorecount(Hero myhero){

            if (!star.isScored() && Intersector.overlaps(myhero.getBoundingBalloon(), star.getStarCircle()))
    {

                addScore(1); // give one plus always
  star.setScored(true);

AssetLoader.coin.play();

}

Now once I give score and setScore true , i want to remove star.
How can I do that?
I tried for setvisible method but I dont know how to use it. Because just Calling star.setVisible() ask to create this method in star class. then in star class I dont know what should be given inside this method body.

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:
Board game: Move entity direction based on position and angle I have a board game where you have entities on a tiled map and you can only move forward, left, and right. Each tile represents a position of the entity, and based on the entity's angle and position, I need to make a method that processes the move. For example if the entity has decided to move left, my function needs to perform a left movement.

An example:

My ship is currently on the tile where the arrow starts and the entity selected to move left, the arrow represents how the entity should move, with a motion.

So it slowly goes up and then slowly starts to go left and changing its rotation.

My question is, how can I make such a function which will know the entity's position, current angle (rotation), and where it should move to, and then with these parameters, it will process the movement animation motion to the target tile?

I am trying to solve this for a long time now, but no luck.
Thank you a lot!

sentences:
How can I reduce this code? Could you help me to reduce this code as much as possible?
public GameObject[] TextPage;

public void Skin0()
{
    foreach (GameObject go in TextPage)
    {
        go.SetActive(false);
    }
    TextPage[0].SetActive(true);
}
public void Skin1()
{
    foreach (GameObject go in TextPage)
    {
        go.SetActive(false);
    }
    TextPage[1].SetActive(true);
}
public void Skin2()
{
    foreach (GameObject go in TextPage)
    {
        go.SetActive(false);
    }
    TextPage[2].SetActive(true);
}

sentences:
How to make a game without OOP? I am currenty studying game development and practicing making games.

I use a lot of OOP in my games. For example, each missile that is shot is an instance of a Missile object, and added to a list of Missile objects. Each tank in the game is a Tank object. Etc.

The entire design of the program is based on this. For instance, having a list of Missile objects allows me every frame to move the missiles, draw them, etc. And having an instance of a Tank object for every tank allows me to check for each tank if it collides with something, etc.

It's hard for me to imagine how a game (which is more complex than Pac-Man) could be programmed in a non-OO language. (With no disrespect to non-OO programmers of course). Not only in terms of how long it will take, but mostly in terms of how a game could be designed this way.

I can't imagine designing a game without using object oriented programming, because my entire understanding of how to design a game-program is based on OOP.

I would like ask: Today, are there any games that aren't programmed using OOP, in a similiar fashion to what I described above? Are there any 'professionl' games that don't use OOP as a major factor in the development process?

If so, could you give me an idea of how, for example, collision detection between a tank and N number of missiles could be implemented, without OOP?

sentences:
When creating a game, what are some architectural desgin concepts I can use to be able to port my game from single to multiplayer? I am a software developer but, I mostly develop games in Unity. I have experience creating single player games as well as multiplayer games. I am at a crossroads where I am in the middle of development of a proof of concept or small demo and all of a sudden I am asked to turn it into a multiplayer game without prior knowledge of this I turn around and say it would add 50% to development time because I basically have to start over from scratch because I didn't necessarily take into account that later down the road they might want to change the experience from single to multiplayer.

So with all of that out of the way, are there any different methodologies out there that would make it easier on the developer to port a game from single player to multiplayer?

I have thought of a possible way of doing this by just setting the game up as single player, however, making my functions where they are easily able to wrap them using Commands and RPCs. But I find this may or may not help me and is only dependent on what the requirements are.

My biggest time killer when it comes to porting these PoC's is typically the UI. Most of the time my requirements are so that the UI will be the same shared UI for all clients and having to update it for each action performed on it and dealing with handling ClientAuthority. (Any tips for dealing with this would be greatly appreciated too) Think of this as something like, making something with Legos in multiplayer and having shared instructions based on the step the user is on.

Summary

What are different ways that I can design a small demo/concept where I can easily port it to multiplayer later on, or make my game where it is "multiplayer friendly" ? Or should I try to stay away from this type of thinking altogether and just develop a single player aspect and just develop a multiplayer aspect, arguments for and against this concept are sought after.

sentences:
Spotlight turns off on and based on distance and angle, even in editor I have cloned a spotlight 3 times.  The original and one clone are near eachother and both work as expected.  However, the other two are a few meters away, and behave oddly.  I initially noticed in the player, but it also happens in the editor. If you get a few meters away they go out. I eventually noticed it also happens based on angle, as demonstrated below.

I am relatively new to Unity, but I've asked the other devs and they are stumped.  What could cause this?

sentences:
Triangle area selection using BVH raycasting Let's assume I'm already storing a BVH acceleration structure per mesh on my engine and I'd like start
making area selection like on many DCC tools out there, for instance, blender.
With blender you can do {rectangular, circle, lasso} selection to select faces and I'd like to understand the maths behind these algorithms. If I was using color picking techniques these sort of algorithms would be obvious but when using BVH+raycasting I'm still failing to understand the algo/maths behind it.
So, could you please explain the logic behind those? For instance, I assume rectangular selection should be easier to implement than circle/lasso, so how would you gather all screen projected triangles living inside the rectangular selection created by the mouse?

sentences:
Should frame update and network packet sending synchronous or asynchronous? I am making a game server that has 60 Update-Per-Second (assume I can most of the time achieve it). In the current model, my main loop does the following tasks in sequence:

Update game logic (position, etc...)
Serialize the data to JSON string
Broadcast the data (through WebSocket) to the clients. Currently the broadcast method is async, that means my server does not stop and wait for the broadcast to finish.

I have 3 questions:

Is it good to send the packages at this frequency?
Should I cap the UPS to 30 instead?
Should I separate the broadcast into another thread, so no matter the UPS of my server, the broadcast will do asynchronous time and depend on the update?

Here is my current code:

public MusicGame(GameRoom room)
{
    this.Room = room;
    this.ConnectedSessions = new List<GameBehavior>();

    this.timer = new Stopwatch();
    this.timer.Start();

    new Thread(() =>
    {
        while (!this.Disposed)
        {
            float delta = (float)this.timer.Elapsed.TotalSeconds;
            if (this.timer.Elapsed.TotalSeconds < MusicGame.FpsLimit)
            {
                Thread.Sleep((int)((MusicGame.FpsLimit - delta) * 1000));
                continue;
            }
            this.timer.Restart();

            delta = Math.Min(DeltaTimeLimit, delta);
            this.Act(delta);
        }
    }).Start();

    this.CurrentScreen = new WaitingScreen(this);
}

public void Act(float delta)
{
    if (this.CurrentScreen != null)
    {
        this.CurrentScreen.Act(delta);
        this.CurrentScreen.SerializeData();

        var data = this.CurrentScreen.SerializedData;
        this.BroadcastGameAsync(data);
    }
}

I am using C# Console Application and WebSocketSharp if it matters.

sentences: How to assign a button in the main storyboard to launch the GameViewController.swift file I am quite new to swift and I have constructed a main menu in the main.storyboard file, how do I assign the 'Play Now' button to launch the GameViewController.swift file where I actually plan to program the game.

sentences:
How many Fringe/Base layers in a 2D map editor? I'm creating a highly flexible 2D tile-based map editor in XNA to make some of my future projects easier (will work for side-scrollers and top-down games). This editor can work with any sized tile.

This editor is based on a standard system. It has pre-determined layers such as Base, Fringe, and Collision. However, I've run into a bit of a problem. I don't know how many Fringe layers to use.

I'll be working with fairly detailed tilesets and will want enough Fringe layers to be able to render a wide variety of fairly complex scenes (e.g., forests with lots of trees overlapping).

I'm also considering having multiple Base layers to enable things like a player walking both over and under a bridge.

So my question is this: Is there a "right way" to approach this situation, and if so, what is it? Just lots of Fringe and Base layers? If you were a map editor, how would you expect/want this situation to be approached?

Also, while I have this question here, is storing layered maps in 3D arrays a good way to go about things? Meaning the first level is an array of layers, the second is an array of tile columns within the layer, and the third is the array of tile rows within the column.

sentences: Move gameobject from fixed position to pointposition following curve Unity2d I want to move the object from the fixed position to the mouse position according to the curve as shown in the illustration. The altitude is the same and the horizontal distance is equal.

sentences:
Why was 24-bit color support introduced twice in GPUs? I was doing research, trying to answer the question "Which was the first GPU to support 24-bit color". I know all color since 1992 is 24-bit, even in games like Doom. I mean 16 million simultaneous colors on the screen, not just 256 unique colors from a 24-bit palette.
I started digging, and naturally I came across the ATI Mach 32. Later I find out that RIVA TNT also "added" support for truecolor. So I'm left wondering, is 24-bit color support some ancient technology that was forgotten after 1992 and rediscovered in the year 1998? Or are they talking about something different?
I have two guesses, but I'd love to know the real explanation:

Truecolor support in RIVA TNT meant it's hardware accelerated, as in the sprites are stored in the VRAM, as opposed to the Mach 32, where the VRAM is just a frame buffer so acceleration would be considered software.
Nvidia meant 32-bit color texture, not even talking about frame buffer pixel depth.

Anyone know what both Nvidia and ATI really meant?

sentences:
Using MCTS in Unreal Engine I have been making a turn-based board game in UE4 and have come to the point of making a first pass on the AI. I planned to use Monte Carlo Tree Search but this requires you to make (at least) one copy of the game state for each simulation. I am guessing that I will have to do  hundreds of simulations per move.

I am fairly new to UE4 but the problem is that there isn't really a separation between view and logic (at least the way that I have programmed it!). For example I have actors which contain their static meshes, current material etc as well as their logical state. I think in UE4 to create a real deep copy I would have to spawn new actors etc. Obviously in hindsight I have  made a big mistake and should have realised this earlier so that I could have switched to a different engine, but too late for that now.

Neither of the ideas that I have come up with are good:

1) Implement a special copy function which sets the static mesh etc to nullptr. I am not sure how Unreal will react to creating all of these actors but not spawning them in the level, my experience up to now suggests not well.

2) Make AI versions of all classes e.g. an AIUnit class which can be constructed from a normal Unit class but only initialises the minimum required data. I think this would work but it would be painfully inelegant with the obvious downside that I will essentially have to maintain two almost identical games and keep the rules in sync.

MCTS with UE4 doesn't seem to have many hits on google so any advice would be appreciated, I am willing to sacrifice some dead time e.g. wait 1 second every turn for AI "thinking" time.

sentences:
Multi Threading - How to split the tasks if I have a game engine with the basic 'game engine' components, what is the best way to 'split' the tasks with a multi-threaded approach?

Assuming I have the standard components of:

Rendering
Physics
Scripts
Networking

And a quad-core, I see two ways of multi-threading:

Option A ('Vertical'):

Using this approach I can allow one core for each component of the engine; e.g. one core for the Rendering task, one for the Physics, etc.

Advantages:

I do not need to worry about thread-safety within each component
I can take advantage of special optimizations provided for single-threaded access (e.g. DirectX offers a flag that can be set to tell it that you will only use single-threading)

Option B ('Horizontal'):

Using this approach, each task may be split up into 1 <= n <= numCores threads, and executed simultaneously, one after the other.

Advantages:

Allows for work-sharing, i.e. each thread can take over work still remaining as the others are still processing
I can take advantage of libraries that are designed for multi-threading (i.e. ... DirectX)

I think, in retrospect, I would pick Option B, but I wanted to hear you guys' thoughts on the matter.

sentences:
How do I determine a device's default orientation? I am developing a game with accelerometer controls. This works well on all the mobile phones I've tested it on. However, when testing on a tablet, the y and x axes are reversed, presumably because the device's default orientation is landscape.

How can I identify the default orientation of the device, to set my axes accordingly?

(I'm using Android SDK 1.5 - 1.7.)

sentences:
How do I protect my rights to my game on the web? My small games all have different gameplay. I want to showcase them through the internet. However, I'm worried about them and their concepts getting copied. How can I protect them?

Also, if I have to openly display the code to the open source community, how can I make sure I get credit for my work.

sentences:
How can I name and organize resources at design time? I'm having a very hard time trying to figure out a good way to add new resources to my game project in a way that's convenient for designers.

To try and better understand the problem, I'm trying to create a very simple game.  It's in the style of an old text adventure.  The user begins in a room, and at the start of each turn an image of the room is displayed and some text describing the room is printed.  Then several options are shown (in a multiple choice format).  The user picks one and option and the result of the action is printed to the screen.  Then the turn ends and the next turn begins (the new image and description are shown, more options are printed, etc).

This game will require several resources:
    - String tables (to hold the text)
    - Images (Shown in each room)
    - Places (links to the image and description, as well as the list of options)
    - New Game Scenerio (used to initialize game.  Just tells the user where the starting room is)

I would like to create an editor where designers can just start it up and then start adding and editing rooms.

The straight forward approach would be to create a simple, stand alone editor that can load and save independent Place files.  It would use relative file paths to locate the linked images and string tables.  These Place file format would be XML which would later be compiled to a binary form when the final resource archive containing all resources is compiled.

The trouble with using paths, though, is that if you rename and move files (as you likely will as the project get larger), the paths that point to it will break (at well as any relative paths it points to itself).

Relative paths can also be a problem if you need to refer to resources that are in a completely different branch off the root.  For example, let's say I have the following resources in my project:

/item/MagicWand.xml
/place/grassyPlain/castle/DarkTower.xml

If I want to place a MagicWand in my DarkTower, I'd have to use a relative path that looks something like "../../../item/MagicWand.xml".  That's pretty cumbersome.  It would be nicer to use something like "item.MagicWand".

Also, since these resources are going to be compiled, if I need to refer to them from my scripts I will need something to call them.  If my user is in the DarkTower and selects the option "go to the griffon pen", I'm like to be able to do this with code similar to

getUser().setLocation("place.grassyPlain.castle.GriffonPen");

All this suggests importing my resources into some sort of super editor project that knows how to handle all resources and provides names for them (and even provide interactive editors for some of them).  While this would simplify the naming problem, but would be a lot of work - especially if more than one person need to design resources at the same time.  (for multiple users, I'd need a database-like locking mechanism to make sure multiple people weren't renaming things or working on the same file at the same time).  The whole thing would have a look and feel that calls to mind the Flash editor.

My thinking keeps leaning toward this super-duper editor solution, since I've been exposed to tools like this before.  However, this seems like a lot of work, especially for so simple a project.  I can't help but think that I'm over thinking this.  I would like to have a system for managing my game's resource that is simple yet, flexible and which integrates well with my code/scripts.

Does anyone have any thought on what makes a good resource managment/naming system?

sentences:
Schlick Fresnel Shader I hope you are all doing ok.  I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around.  I'm not sure what i'm doing wrong.  I'm using glsl with the Schlick Fresnel algorithm along with a Diffuse BRDF.  A picture says a thousand words, so let me show you the issue I am having.  For debugging purposes, I am only rendering the Fresnel, nothing else.

The following image shows the Fresnel working perfectly from this particular angle (i'm looking along the direction the light is facing)

However, the following image shows the Fresnel not working when I pan the camera around the object to arrive at it's back (facing more or less against the light direction.)

As you can see, the Fresnel didn't change at all when i moved the camera,  It's as if it's "Baked" into the object.

The code for the Schlick algorithm used in this application is:

vec3 Specular_Fresnel_Schlick( in vec3 SpecularColor, in vec3 PixelNormal, in vec3 LightDir )
{
    float NdotL = max( 0, dot( PixelNormal, LightDir ) );
    return SpecularColor + ( 1 - SpecularColor ) * pow( ( 1 - NdotL ), 5 );
}

All calculations are done in world space.

Any help you can provide would be a huge deal.  Thank you for your time.

sentences:
What is the best mechanism for controlling a character in a 2D Android game? Im developing a 2D RPG for Android where the character can move up, down, left, and right like in top-down RPGs like Pokemon.

What is the best input mechanism to use to control the character? A virtual joystick seems a bit to complicated for just straight movement.

sentences:
Can one build a game based on something that already exists and make money off of it? Possible Duplicate:
  Is it legally possible to make a clone of the game?

I was planning on producing a game but then I had to stall. I have an idea to make a game, but its very similar to a game already out there. If I made my own graphics, audio and use my own code, would I be allowed to sell it?

sentences:
Unity - Set quad to angle of floor mesh I have a cursor object (simple quad) that I'm moving around above a floor mesh. The floor mesh has varying heights (hills and such).
How can I set my quad to sit at the same angle as the mesh floor?
I'm using a raycast to cast down on the position of the cursor and get the angle of the floor mesh using hit.normal, then reflect.
RaycastHit hit;
var rayStart = new Vector3(transform.position.x, transform.position.y + 5f, transform.position.z);
if (Physics.Raycast(rayStart, Vector3.down, out hit, 10f)) {
    if (hit.collider.tag == "Floor") {
        Vector3 incomingVec = hit.point - rayStart;
        Vector3 reflectVec = Vector3.Reflect(incomingVec, hit.normal);
        cursorSprite.transform.eulerAngles = reflectVec;
        }
    }

(I've left out the position code, that works, its just the angle code that doesnt)
I've tried a bunch of variations, altering the reflectVec angle x, y and z but I can't figure out how to get it correct :/

sentences:
Is this specific server architecture okay for a multiplayer game? So I am making a game in Node.js / HTML5.

And I am really struggling to determine what an effective server architecture looks like?

Right now I have a server for a multiplayer game ( I plan on making servers instanced, so up to 80 people per instance).

So everybody in the instances location and health are shared.

And when an attack happens, i.e. a meteor is dropped from the sky, the x-value is the only data passed to the rest in the instance ( they all do the computations on their own computer locally).

When you are hit, you tell the server you were hit. (can't tell the server to hit other people, only yourself, becuase otherwise it's exploitable).

That's the kind of architecture I was going for, you can only tell the server about events that damage yourself.  ( I don't believe these events are overridable but I will try to determine that).

--

Do I have the right idea about how to go ahead with this server?

Do you have any tips or resources?

NOTE: It's under MMO but servers will hopefully top off at about 80. MMO in the same sense as Realm of the Mad God. = )

sentences:
Unity3D - post-process unwanted on UI I have scene rendered with a single camera using target texture (a).
Second camera is used to render UI and using same target texture (a) as the first one.
Third camera takes target texture (a), depth texture and apply post proces. Result is rendered to the screen.

How can I apply postprocess only to the output elements that are not UI?

sentences:
OpenGL textures look poor I'm having some issues loading in textures in OpenGL, as my textures keep rendering incorrectly or coming out looking muddy. For instance, here I tried to load a 256x256 color spectrum image. On the left is how it looks in OpenGL and on the right is how it looks in an image viewing program:

As you can see, while the left image resembles the right image, the left image appears to squish the blues, and greens, and extend the pinks.

I also tried loading in this 512x512 image of a dog and the result came out like this (again, left is OpenGL, right is image viewer):

For this image, the image looks like it has lost a lot of its color, resulting in something that looks white washed and like it came out of a 1970s camera. (the fact that is flipped is fine however since the cube that I am drawing this on has some texture coordinates flipped to accommodate for a different image).

I load in these .BMP textures using SOIL, as such:
    glEnable(GL_TEXTURE_2D);

GLuint texID = 0;
glGenTextures(1, &texID);

int height = 0, width = 0;
unsigned char* imgData = SOIL_load_image(filePath.c_str(), &width, &height, 0, SOIL_LOAD_AUTO);

glBindTexture(GL_TEXTURE_2D, texID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, imgData);
// set texture filtering, gen mip map

Then in my fragment shader I do the following to apply the texture:

#version 330 core
in vec2 TexCoord;

uniform sampler2D textureSampler;

void main() {
    gl_FragColor = texture2D(textureSampler, TexCoord);
}

sentences:
Space invaders 2d array to represent scene For code optimization purposes, I want to create a 2d array that contains 40 equal squares (10x10px). Each square represents 1\40 of the displayed window (400x400px).

I populate the 2d array with the standard double for-loop methodology.

    int col = 40;
    int row = 40;
    int boxSize = 0;
    Integer[][] boxes = new Integer[40][40];

    for (int i = 0; i < col; i++) {
        for (int j = 0; j < row; j++) {
            boxes[i][j] = boxSize;
            boxSize += 10; //Creates a 10px box.
        }
        boxSize = 0; //Resets box size for next column
    }

There are several circles in this program. We have a ship(circle) that fires missiles(circles) toward enemies(circles).

I want to run collision detection ONLY when there is a bullet + an enemy in one of the squares. This will greatly optimize the code.

The question is... how do I create these squares off of a 2d array? How do I select each square? How do I test if the missiles and the enemies are inside the same square?

Thanks.

sentences:
LibGDX. How to fill background with shader? I want to make background of my game like lava via perlin noise.
I've read some tutorials but they were too old and some api calls aren't exist already.
If I understand right in libgdx I need to create a runtime-generated texture (FrameBuffer) on x=0 and y=0 with width=Screen width and height=Screen height and apply shader to it.

I tried to do:

class A extends ApplicationAdapter {
    FrameBuffer   background;
    ShaderProgram shaderProgram;

    public void create() {
       background = new FrameBuffer(
           Pixmap.Format.RGBA8888,
           Gdx.graphics.getWidth(),
           Gdx.graphics.getHeight(),
           false
       );
       shaderProgram = /* stuff to pickup .vert and .frag */
    }

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

        background.begin();
        batch.setProjectionMatrix(
          new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight())
        );
        batch.begin();
        batch.setShader(shaderProgram);
        batch.end();
        background.end();
    }
}

My shaders are simple red fill programs:

//Vertex
attribute vec4 a_position;

uniform mat4 u_projTrans;

varying vec2 v_Pos;

void main() {
    gl_Position = u_projTrans * a_position;

    v_Pos = gl_Position;
}

//Fragment
#ifdef GL_ES
    precision mediump float;
#endif

uniform mat4 u_projTrans;

varying vec2 v_Pos;

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

Nothing has been drawn. I expect that all my viewport become red

Function that picks up shaders is working, i tested at sprites

sentences:
numeric identifiers associative array edit: clarified my question. I also realized that I didn't pick a very conclusive question title, which unfortunately I cannot change anymore, sorry.

Hey everyone,

to improve my programming skills a little and getting familiar with good design patterns, I'm trying to program a litte turn based strategy game, and I am at the point to choose a good data structure for the configuration of different terraintypes and unittypes etc. which do exist.

What I have implemented so far is a big "Game Object" with knowledge about everything in the game, and many of its properties are big associative arrays (I'm using PHP, but my question doesn't really have to do much with the language), for example an arrays of units, a map array.... What my array structure is comparable to is the type object pattern mentioned here.

Example: A single unit is of a certain type, say 'Infantry', and shares many data with all the other infantry untis on the field. Instead of copying all these values, I give every unit a "type" so it can look up the details there. Similar with terraintypes. Example:

terraintypes = array()
terraintypes[0] = array()
terraintypes[0]['name'] = 'Forest'
terraintypes[0]['capturable'] = false

unittypes = array()
unittypes[0] = array()
unittypes[0]['name'] = 'Infantry'
unittypes[0]['movecost'] = array()
unittypes[0]['movecost'][0] = 5 //Movementpoints needed for forest
unittypes[0]['movecost'][1] = 7 //Movementpoints needed for terraintype 1

A specific unit or tile on the map wouldn't know its movement costs or name, but would be able to look that up in the unittypes array. Example:

sometile = array();
sometile['owner'] = whatever
sometile['type'] = 0; //this tile is a forest

someunit = array()
someunit['type'] = 0 //This is an "Infantry".

The problem is that getting any kind of information will produce very verbose code, for example finding out how much it costs for a unit to move onto a tile will be

unittypes[unit['type']]['movecost'][tile['type']]

I am trying right now to move to using more objects and classes, so if I give a unit a reference to its unittype, it can lookup information itself, for example

terraintypes[0] = new Terraintype('Forest')
unittypes[0] = new Unittype('Infantry')
someunit = new Unit(unittypes[0])

Now, if I ask a unit something only its unittype would now, the unit can look it up itself, e.g. someunit.getName() will be implemented in the unit like this.unittype.getName().

So far so good. However, how could a unittype store its movecost on the different terrains? Basically I would need an array indexed with terraintypes, but as that is not possible, I will have to swhich back to translate everything to numeric keys, and have a movecost value for every pair (terraintype, unittype).

Who assigns these numeric keys and where? Will every single unittype need to store some kind of identifier which is unique among all the unittypes?
Should I use some constants like const FOREST = 0; const ROAD = 1; const INFANTRY = 0; const VEHICLES = 1 etc?

Another of my problems for finding a good data structure is that if I don't give the game all the data directly, but break everything down to smaller parts, then many parts will need to know about the same objects.

For example, if the Map object knows about all tiles of the map and the units on it, then the game doesn't really know anything about the units, it only knows about the map, and every command in the game which affects a unit needs to be passed to the map, even though its not actually a "map task", like healing units.

This seems like breaking the single responsibility pattern. However, storing references to all the units in several places (so both the Map and something else store references to units) seems to be troublesome with bookkeeping.

To sum it up a little, can you hint me to data structure which are suitable to represent what I am describing? Thanks in advance!

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:
How do I get GLEW to use my Nvidia GPU instead of an integrated Intel card? I'm new to graphics programming, though not to coding generally. I've been learning opengl from the OpenGL Superbible, 6th Edition. I was trying out the shader examples from the book but couldn't get them to work. The logged error says approximately "incorrect #version". The book uses GLSL 4.3 core.

I ran glewinfo.exe and the generated text file said that the core OpenGL version on my system was OpenGL 4.0, but it was the stats of my integrated Intel GPU, not my Nvidia GT720m GPU. I'm pretty sure the nvidia gpu supports a higher opengl version.

How do I get GLEW to detect the high-performance GPU and make calls to the Nvidia drivers instead of the integrated Intel HD GPU?

A similar question has been asked there, but it concerned only running the program on the gpu. How do I tell which version of OpenGL the Nvidia GPU supports?

sentences:
[Unity]Avoid boucing when ground move down I have a sphere & a quad, when the quad move down, the sphere fall after and bounce back continuously. I dont want to change my project setting like bounciness, gravity,mass and I need the sphere to move freely to jump between quad.
How can I do this, thanks

sentences:
Select display adapter in D3D9 I have a notebook that has 2 graphics card one Intel and one nvidia graphics cards.
When I want to start my game I right click on the exe file and select run with graphics processor->Nvidia but my engine stills run with my Intel graphics card on d3d9.
Is there any way to choose the graphics card with code?

sentences:
My first animation - Using SDL.NET C# I'm trying to animate a player object in my 2D grid when the user clicks somewhere in the screen.

I got the following 4 variables:

oX (Current player position X)
oY (Current player position Y)
dX (Destination X)
dY (Destination Y)

How can I make sure the player moves in a straight line to the new XY coordinates. The way I'm doing it now is really awfull and causes the player to first move along x axis, and finally in y axis.

Can someone give me some guidance with the involved math cause I'm really not sure on how to accomplish this.

Thank you for your time.
Kind regards,
Mark

Update: It's working now but whats the right way to check if the current positions are equal to the target position?

    private static void MovePlayer(double x2, double y2, int duration)
{
    double hX = x2 - m_PlayerPosition.X;
    double hY = y2 - m_PlayerPosition.Y;

    double Length = Math.Sqrt(Math.Pow(hX, 2) + Math.Pow(hY, 2));
    hX = hX / Length;
    hY = hY / Length;

    while (m_PlayerPosition.X != Convert.ToInt32(x2) || m_PlayerPosition.Y != Convert.ToInt32(y2))
    {
        m_PlayerPosition.X += Convert.ToInt32(hX * 1);
        m_PlayerPosition.Y += Convert.ToInt32(hY * 1);

        UpdatePlayerLocation();
    }
}

sentences:
How to make sure that at least one element in a collection has a certain value? In my game, I assign each agent a random direction. However, at least one of these agents has to have a direction of Vector2.up. How can I ensure that?

private void AssignRandomDirection()
{
    var directions = new List<Vector2>
    {
        Vector2.up,
        Vector2.down,
        Vector2.left,
        Vector2.right
    };

    foreach (var agent in FindObjectsOfType<Agent>())
    {
        var random = Random.Range(0, directions.Count);
        agent.direction = directions[random];
    }
}

sentences:
UI clicks hitting game objects below I have a canvas with a panel with set width / height inside. The canvas rendermode is set to ScreenSpace Overlay.

My clicks on the panel are falling through and hitting the game objects below triggering their mouse events.

The little green circle is a Sprite with the following event

  public void OnMouseDown() {
        Debug.Log("click");
        Vector3 newPos = Camera.main.WorldToScreenPoint (this.transform.position);
        newPos.x -= panel.GetComponent<RectTransform>().rect.width / 2.0f;
        newPos.y -= panel.GetComponent<RectTransform>().rect.height / 2.0f;

        panel.transform.position = newPos;
  }

I've been reading through the docs but I'm missing something... How do I stop my clicks hitting the game objects below the panel?

sentences:
Problem with folder structure and building project in UE4 I created a new C++ project on Unreal Engine 4. After that I close visual studio and ue4 editor. I manually added public and private folders in the source folder. Then I made folders for the player, items, AI and gamemodes.

The problem appears when I create a new class, the files appear in the respective folders but not in the editor. To fix this I open the visual studio project and I press the build solution. I restart the editor and the classes appear in the folder structure.

The real problem starts here. When i double click any class. A new visual studio appears, ue4 shows the progress bar on the bottom right corner with the text "Loading visual studio". After a couple of seconds a new visual studio pops up. A new screen appears saying that the project is opened on another visual studio and now will migrate all info to a temp folder.

Now I can't code because any attempt at using a C++ class by dragging it into the editor viewport instantly crashes UE4.

What am I doing wrong? What is the correct workflow for creating folder structures in UE4? There is no documentation on how to do this properly.

sentences:
Is there a way to convert a shader code to shader graph? I would like to ask if there is a way to convert a Coded shader into the new Shader graph, beacause i want to edit my shaders in more efficient way.

Any help is appreciated.

sentences:
Simple game engines / development tools made with artists in mind? I've been working in the 2d art side of games for a while now, and my full time job keeps me very busy on the art side of things, but I'm becoming more and more interested in learning to prototype my own games.

I know very very little programming, though I did take some in college (in TorqueScript, of all things), and while I could probably take the time to learn it, the learning curve is a bit too steep for me as it's completely separated from my current job.

I'm wondering if there are any game engines out there with an interface designed with artists in mind, where the learning curve might be easier for me, and where my current skill set will be more easily applied. I bought an indy license for Torque Game Builder but it still requires a lot of scripting and finding good, basic, entry-level tutorials is proving difficult.

Basically I'm looking for a tool where I can focus on the art and game design, and where the programming is minimal, or is easy to learn and has really excellent documentation. No idea if anything like that exists, but it's worth a shot. :]

Any ideas?

sentences:
How do open world games handle efficiently enemy respawn? I'm currently working on a 2D open world game loaded in chunks, initially I thought It would be sufficient to spawn entities randomly in a specific "radius" close to the player, and periodically remove distant enemies.

Though appealing, this system is inefficient unless you keep in memory the chunks surrounding the chunk the player is in (if an enemy needs to spawn on a chunk which is currently not in memory, you have no way of knowing wether you can actually place it in a specific tile or not, since it may be occluded by a wall) which is why I'm currently spawning enemies as soon as chunks are loaded, but there's a problem..

A massive complication arises when enemies are spawned with specific criteria. Assume a little dungeon spawns inside a chunk, it needs 2 enemies and a chest with loot in-between them. When you're done with it, it shouldn't respawn unless an hour passed. You can't just spawn those enemies inside the structure as soon as it's close enough to the player, otherwise you could go back 'n fort, kill the enemies and keep looting the chest's content.

Time to make a cache right? Let's forget for a moment any complication related to how you could make it memory efficient, and analyze this particular scenario:

The player enters a chunk with said structure
Enemies and chests are then spawned
A cache marks this particular dungeon as "already spawned, check back in an hour"
Instead of getting closer to the dungeon, the player moves in the opposite direction, until the dungeon gets out of view and enemies are removed since they're now too distant
..few minutes later, the player goes back where the dungeon is, only to find an empty dungeon because the structure was marked as "already spawned" and wont spawn again unless an hour is passed.

I thought about caching all enemies that where present inside a chunk when it gets out of view and restoring them as soon as the chunk is visible again, yet again this requires caching every entity inside a chunk and keep the entry available for an hour, and periodically check if in that particular chunk an hour is passed and we can spawn again enemies

Doesn't look too bad, but if a player moves in a straight line in my game for an hour I would need to cache about 200 chunks before cache entries start expiring!

Is there a better solution? How do modern games handle enemies spawn? How do they get around these difficulties? I'm particularly interested in knowing how online games do it considering the crazy amount of memory (which should be shared between servers) such systems may require

sentences:
What algorithm can I use to distribute energy between connected nodes? I'm creating a game where every user has a network of connected nodes that each have a specific amount of energy. The nodes will try to distribute energy evenly amongst themselves. If a node has more energy than the average, it should deliver to the network. If a node has less than the average, it should receive from the network. An example network would be this, where + means more than average and - means less than average:

Now the one question I've been trying to solve for a while now: how can I calculate the cumulative amount of energy that flows through every edge until all nodes have the same amount of energy? For example we know that the node in the top left will in the end distribute 7 energy to the network, but will it give 5 down and 2 to the right? Or something else?

Is there any algorithm we could use to solve that problem? Could we potentially represent this problem as an electric circuit and solve it like that?

sentences:
AI: Learning vs. Strategizing I have a theory on AI that I would like to write a "whitepaper" about. The distinction I want to explore in AI is learning vs. strategizing. My question is, where can I read other material about this subject?

Let me give a chess example. Let's look at a chess AI as a max-tree, where capturing an enemy unit adds that unit's value to the "move score" for that decision (and likewise losing a piece subtracts that value to the score). Capturing a pawn might net 1 point, a knight 4 points, a rook 5 points, etc.

Strategizing would be AI to apply these points and determine the next move; eg. given ten possible moves, pick the best (max score) at the end of three moves.

Learning would be applying statistical observation to determine those values. If you play 100 games, the AI might decide that capturing a pawn is 2 points, and a knight is worth 7 points, while a rook is only worth 3 points (based on 100 gameplays).

Does this distinction already exist in literature, and if so, where can I read about it?

Edit: Does anyone know a Chess game (with source-code preferably) that utilizes this approach? Maybe Chess960@Home?

sentences:
How to trigger onclick for Unity Selectable by script? As title, I know Button can be triggered onclick by button.onClick.Invoke();
But how to simulate onclick event of Selectable?
Thanks for the help.

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:
Tool to create a bitmap font from a true type font What tool do you use to convert ttf fonts to bitmap fonts?

Following is a list of features I'm looking for.  I'd be happy with any tool really, but one that had these features would be better.

outputs power-of-2 texture atlas
parsible config file (so I don't have to use their rendering library)
output kerning information
cross platform
a rendering library would be great if it lets me make the actual OpenGL calls.

So what tool have you used?  Were you happy with it?

sentences:
How accurate is Gdx.input.justTouch()? We're developing a game, we want to perform actions the moment the user touches the screen, delays make the game impossible to play.

We're testing on samsung S3 mini and samsung a5, we know they are low end devices and lags are to be expected.  But How accurate is Gdx.input.justTouch()? Is it so accurate on high end phones?

If not then how to improve the accuracy?
Is the same problem expected from keyboard or mouse input if we publish a webapp version?

sentences:
Quaternions and rotation around world axis Disclaimer: I am a professional games programmer, and use quaternions most days but they are close to black magic to me. I am relatively at home with math but imaginary numbers always confused me. I tend to treat quats as useful and end up reversing multiplications more than once. I try to reason about them like I would with matrices with limited success.

Anyhow....

What baffles me, is the following.
When I want to rotate an object around it's local axis I multiply its rotation with the quaternion that represents the rotation I want to apply. It is therefore a rotation in local space.

Now if I want to rotate it around an axis in world space, my reasoning would be:
Take the rotation in world space as a quaternion.
Multiply the inverse of my object rotation with this quaternion. This will bring my world rotation in local space.
Multiply my rotation with this new quaternion.
ie: newRot = oldRot * (inverse oldRot * worldRot)

However, what I need to do is
newRot = oldRot * (inverse oldRot * worldRot) * oldRot.

Why do I, after multiplying with the inverse quat still need to multiply with my own quat before applying it? I know there must be a perfect valid reason, but I can't reason my way out of it and it's frustrating as heck to me. I tried the various faqs and whatnot, but most go to deep in the math, making it less clear to me.

Anyone who can explain this to me like I'm a 5 year old?

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:
Animation file format I'm trying to make a simple 2D animation file format. It'll be very rudimentary: only an XML file containing some parameters (such as frame duration) and metadata, and some images, each representing a frame.

I'd like to have the whole animation (frames and XML document) packed in a single file. How do you suggest I do that? What libraries are there that would allow easy access to the files inside the animation file itself?

The language I'm using is C++ and the platform is Windows, but I'd rather not use a platform dependent library, if possible.

sentences:
How can I make player move on array of GameObjects in Unity? I am making a board game where the players hit a dice and move on an array of GameObjects according to the number they got.

So I declared a Gameobject array and added to it all the objects I need.

The problem is that when the player moves, he is going immediately to the target.

What I want is to make the player move through the Gameobject array, object by object, till it reaches the target(which is defined according to the dice number).

Here is what I am trying (using C#):

for(int i=0;i<spaces.Length;i++)
{
    transform.position = Vector3.MoveTowards(transform.position,
    spaces[currentPosition+diceResult].transform.position,Time.deltaTime / smooth );
}

spaces is the name of GameObject[] array.

currentPosition is the position of player before hitting the dice.

diceResult is the number he got in the dice.

EDIT :

I solved it!

Here is how it worked:

 if (index < spaces.Length)
 {
       transform.position = Vector3.MoveTowards(transform.position,
       spaces[index].transform.position, Time.deltaTime *smooth);

       //If we've reached the destination, move to the next one
       if (transform.position == spaces[index].transform.position)
            index++;
 }

sentences:
Is it Possible to create one equipment piece, and handle the manipulation programatically I have a 2D game made in XNA-4.0.  I am brainstorming on how to implement a system of equipment where I can draw one Texture, and rotate/scale it to my character's current animation without haveing to create a seperate Atlas for each Weapon/Gear Piece.

Right Now I have a Default Character Sprite Sheet that I use, and For each Item I wish to incorporate into the game, I draw it onto the Sprite Sheet, remove the character from the sprite sheet, then draw the new Sprite Sheet with just the visible parts of the given piece of equipment.  It works very well, and looks great... The only problem is that It requires a lot of work for each piece of gear I implement into the game.

Originally my hope was to Create one image, and have a system in place that can alter the texture as required to rotate and move with my hero's animations.  Since I am in 2D, I am restricted to Scaling and rotation images.

Is this goal of creating one image even a possibility?  If so I would love any direction to as how this might be achieved.

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

sentences:
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:
Draw lines from the center of the screen at specific angles I want to draw multiple primitive lines which start at the center of the screen and end at the edges of the screen, traveling at specific angles:

How can I set the angle for each line?

Here is my code where I draw only one line from the middle of the screen to the top of the screen.

LineVertices = new VertexPositionColor[2];
LineVertices[0].Position = new Vector3(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2, 0);
LineVertices[0].Color = Color.Red;
LineVertices[1].Position = new Vector3(graphics.GraphicsDevice.Viewport.Width / 2, 0, 0);
LineVertices[1].Color = Color.Red;
.
.
.
//Draw call
graphics.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, Line2Vertices, 0, 1);

sentences:
Controlling a balance wheel using a Unity script I am working on a small demonstration project with Unity like this (screenshot from footage below).

I don't want to use Unity physics, which is too heavy. I plan to create a rotation function with ratio params for gears.  But I am not sure how to control the balance wheel rotation like that video, I tried animation tools which is hard to make the acceleration like real physics.

sentences:
How do I debug within an animation loop? I'm trying to see some values within an animation loop, and am naively just console.log'ing when I need to, however, this usually results in the browser crashing from all the logs.

I'm working in JavaScript, but I don't think this issue is specific to JavaScript. How do people usually debug within an animation loop to see what values are?

sentences:
Style: When to call GL Enable/Disable I'm working on an OpenGL application and some routines render textured objects, some are just colored primitives. I was wondering if there was a standard convention for how to deal with setting the OpenGL 'state'.

For example, consider this routine (using OpenGL ES / OpenTK):

/// <summary>
/// Renders the given tile at the corresponding screen-tile location.
/// </summary>
public static void RenderTile(float[] vertices, float xOffset, float yOffset, uint textureId)
{
    GL.EnableClientState(All.VertexArray);
    GL.EnableClientState(All.ColorArray);
    GL.EnableClientState(All.TextureCoordArray);

    GL.PushMatrix();

    GL.Translate(xOffset, yOffset, 0.0f);

    GL.BindTexture(All.Texture2D, textureId);
    GL.VertexPointer(2, All.Float, 0, vertices);
    GL.ColorPointer(4, All.Float, 0, SQUARE_COLORS);
    GL.TexCoordPointer(2, All.Float, 0, SQUARE_TEXTURE_COORDS);

    GL.DrawArrays(All.TriangleStrip, 0, 4);

    GL.PopMatrix();
}

I'm curious about that GL.EnableClientState(All.TextureCoordArray); bit. Should I just get into the habit of calling GL.Enable(...) / Gl.EnableClientState(...) for everything the current function needs? Even if it is largely redundant? Or is it better to just assume that the application has a certain set of things enabled (blending, back-face culling, 2D textures, etc.).

I know this question is pretty subjective, so I'm looking for advice from someone who has worked with a large OpenGL codebase. (As all my experience is for solo projects.)

sentences:
Simulate race winner based on character attributes I'm new to game development and I was thinking of starting off with something easy like a top down simulated race game. It will be similar to a horse race, such that there will be betting, and character should win based on their attributes and simulated conditions.

One problem I'm currently facing is how to simulate who wins. Characters will probably have the attributes top speed, acceleration, endurance etc. I don't want the top ranked character winning all the races.

I was looking into probability distributions but I couldn't quite understand how that would help calculate who will win.

I know the winner will be who crosses the finish line first. However how do I calculate characters slowing down, speeding up?

sentences:
Rotating an object about a point (2D) using box2d i just started developing using box2d on flixel and i realise the pivot point of the rotation of an object in box2d is set to the center of an object.

i had read on forums and i found out that SetAsBox can change the pivot point of the object, however, i cannot seem to get it work to rotate about a point.

what i would like to achieve is to rotate an object about a point like earth revolving around the sun. any one can help me with it? really thanks a lot and sorry for the bad english

sentences:
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:
How can I use the NDK to make games? I want to use NDK to use my existing C++ code for a game. I know there are two ways to use NDK:

I can use Java to create GLSurface and opengl context;
I can use NativeActivity class to entirely write code in C++.

Given that the documentation available about these two approaches is not great, I have trouble making up my mind.

What's the difference between these two approaches?

sentences:
Enemy fire every few seconds Hi I'm trying to get my enemy to fire once every few seconds, I tried using a Coroutine but due to me essentially calling the Coroutine through the update method, the Coroutine is repeating every frame update and spamming the shoot key. What is a solution for this?

void Update () {
        Shoot ();
}

public void Shoot(){

        StartCoroutine ("ShootContinuous");

}

public IEnumerator ShootContinuous() {
    yield return new WaitForSeconds (1);
    anim.SetTrigger("Shoot");
    Instantiate (Bullet, firePoint.position, firePoint.rotation);
    isShooting = true;
    yield return new WaitForSeconds (1);
    anim.SetTrigger("NoShoot");
    isShooting = false;

}

sentences:
How to loop through functions dependent on previous function? In Unity, I need to generate a series of platforms in a specific order for a sidescroller I am working on. The issue is that the generation of the next platform is dependent of the previous platform meaning I can not generate the next platform before the previous platform is made. In this case I cannot predict where the next platform will be at since its length is based off randomized parameters. Also I the generation function is based off of multiple scripts so it has to go through multiple scripts before the generation is complete.

I am currently using a Bool function to wait for the completion of the generation but I do not think this is the appropriate way to go about this. What would be an appropriator structure for calling multiple functions dependent on the previous call?

This function is used to call the functions to generate the platform

    public void GeneratePlatformSequence ()
{
//For loop to
    for (int i = 0; i < TerrainSequence.Count; i++) {
        bool isComplete = TerrainSequence [i].Transition (TerrainSequence [i+1], new Vector3(50*1,0,0));
    }
}

Abstract class for Platform Generation

public abstract class TerrainMesh : MonoBehaviour {

    public abstract bool Transition(TerrainMesh CurrPlatform, Vector3 LastPosition);

}

One of the mesh generation classes I use to create the platform

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

public class GroundTerrain : TerrainMesh {

    public override bool Transition(TerrainMesh CurrPlatform, Vector3 LastPosition) {
        bool isStepComplete =   GroundTransition(CurrPlatform, LastPosition);
        return isStepComplete;
    }

    public bool GroundTransition (TerrainMesh CurrPlatform, Vector3 LastPosition){
        if (CurrPlatform is WaterTerrain) {
            print ("Generating WaterTerrain");
//Here is where I generate the Actual mesh for the platform.
            bool GeneratedMesh = MeshGenerate ();
            return GeneratedMesh ;
        }

        return false;
    }

}

sentences:
Progressively loading the racing arena in a 3D driving sim I need advice and resources on a 3D car simulator.
I want to progressively load the track for the player as I'm thinking of porting the game to mobile devices.
This seems too difficult to me as I'm trying to separate the racing arena model design and the code as much as possible. Is there a structured method for achieving that for any model (arena/map). I think this is something that comes up a lot in games in general not just this instance.

sentences:
Should cooldown be time or tick based? In the past I've done cooldowns as a specific time in ms, but I was thinking isn't having tick based cooldowns better. This would be more accurate and efficent(not sure).

The bad side I can think about is that if the tick rate is increased, it would affect the game logic. While having a base update rate and a multiplier(that can be applied to everything that is tied to tick rate) would probably fix this, I am not sure if this is a good approach.

sentences:
How to change mobile device screen size in Unity for testing? For an experiment I need to be able to dynamically adjust the screen size of my device. I'm using a Nexus 5 (5") and want to fake the screensize to 2", 3", 4",.. See images:

Is this possible using Unity? I'm aware that I can easily place some planes right in front of my camera, but I'm looking for a proper solution.

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:
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:
Trigger for Melee-attack not working I'm currently trying to add a melee-slash attack to my Sidescroller.

For that I decided to to have an invisible box-colliders infront of my character. My idea is to activate it when the attack-key is pressed and leave it active for the duration of the attack before turning it inactive again.

I know from a previous attempt with a dash instead (didn't work out on the movement for it) that my code for the attack-triggering in the player-script works just fine, so now in my box-collider infront of the player I have:

    public GameObject Player;
//public GameObject Box;
bool attack = false;
//Collider c;

void Awake ()
{
    Player = GameObject.FindGameObjectWithTag ("Player");
    //Box = GameObject.FindGameObjectWithTag ("AttackBox");
    gameObject.collider.enabled = false;
}

void Update ()
{
    Player pstats = Player.GetComponent<Player>();
    attack = pstats.attacking;

    if (!attack)
    {
        gameObject.collider.enabled = false;
    }

    if (attack)
    {
        gameObject.collider.enabled = true;
    }

}

And in my Enemy script I have

    void OnTriggerEnter(Collider collision)
{
    Player pstats = Player.GetComponent<Player>();
    if (collision.gameObject.tag == "Player") {
        collision.gameObject.GetComponent<Player>().PlayerHit();
    }

    if (collision.gameObject.tag == "AttackBox")
    {
        pstats.CurrentEXP += 25;
        EnemyDeath ();
    }

}

Though the hit isn't recognized.

The issue I see is that probably the OnTriggerEnter is the issue since the Enemy tends to be allready inside the attack-box collider when the attack is triggered. I tested a bit with the Debug-Log and the box is activated at least, so it should really be just the issue of calling the Trigger at the right time.

Are there any alternatives to OnTriggerEnter that would be working better?

edit:
I tried adding this right below my collision-part in the enemy-script:

    void OnTriggerStay(Collider collision)
{

    Player pstats = Player.GetComponent<Player> ();
    if (collision.gameObject.tag == "AttackBox")
    {
        pstats.CurrentEXP += 25;
        EnemyDeath ();
    }

}

void OnTriggerExit(Collider collision)
{
    Player pstats = Player.GetComponent<Player> ();
    if (collision.gameObject.tag == "AttackBox")
    {
        pstats.CurrentEXP += 25;
        EnemyDeath ();
    }
}

Though the hit is still not recognized.

sentences: Is there a site where people discuss game concepts and questions in general? I like making game concepts for fun, as a hobby. I don't think that all my game concepts are amazingly awesome and have to be created and would revolutionize the industry. I just want some people to talk to that have the same hobbies as I do. To be able to discuss ideas and point out the pros and cons.

sentences:
How do I calculate specular contribution in physically-based rendering? I'm trying to implement physically-based rendering, in a small game engine built for academic and learning purposes. I cannot understand the right way to calculate specular and diffuse contribution, based on the materials metallic and roughness values.

We don't use any third party libraries or engines for rendering; everything is hand written in OpenGL 3.3.

Right now, I ues this:

// Calculate contribution based on metallicity
vec3 diffuseColor  = baseColor - baseColor * metallic;
vec3 specularColor = mix(vec3(0.00), baseColor, metallic);

I'm under the impression that the specular has to be dependant on the roughness, somehow. I was thinking to change it to this:

vec3 specularColor = mix(vec3(0.00), baseColor, roughness);

Again, I'm not sure. What is the right way to do it? Is there even a right way, or should I just use the 'trial and error' method until I get a satisfying result?

Here is the full glsl code:

// Calculates specular intensity according to the Cook - Torrance model
float CalcCookTorSpec(vec3 normal, vec3 lightDir, vec3 viewDir,
    float roughness, float F0)
{
    // Calculate intermediary values
    vec3 halfVector = normalize(lightDir + viewDir);
    float NdotL = max(dot(normal, lightDir), 0.0);
    float NdotH = max(dot(normal, halfVector), 0.0);
    // Note: the following line could also be NdotL, which is the same value
    float NdotV = max(dot(normal, viewDir), 0.0);
    float VdotH = max(dot(viewDir, halfVector), 0.0);

    float specular = 0.0;
    if(NdotL > 0.0)
    {
        float G = GeometricalAttenuation(NdotH, NdotV, VdotH, NdotL);
        float D = BeckmannDistribution(roughness, NdotH);
        float F = Fresnel(F0, VdotH);

        specular = (D * F * G) / (NdotV * NdotL * 4);
    }
    return specular;
}

vec3 CalcLight(vec3 lightColor, vec3 normal, vec3 lightDir, vec3 viewDir,
    Material material, float shadowFactor)
{
    // Helper variables
    vec3  baseColor = material.diffuse;
    vec3  specColor = material.specular;
    vec3  emissive  = material.emissive;
    float roughness = material.roughness;
    float fresnel   = material.fresnel;
    float metallic  = material.metallic;

    // Calculate contribution based on metallicity
    vec3 diffuseColor  = baseColor - baseColor * metallic;
    vec3 specularColor = mix(vec3(0.00), baseColor, metallic);

    // Lambertian reflectance
    float Kd = DiffuseLambert(normal, lightDir);

    // Specular shading (Cook-Torrance model)
    float Ks = CalcCookTorSpec(normal, lightDir, viewDir, roughness, fresnel);

    // Combine results
    vec3 diffuse  = diffuseColor * Kd;
    vec3 specular = specularColor * Ks;
    vec3 result   = lightColor * (emissive + diffuse + specular);
    return result * (1.0 - shadowFactor);
}

sentences:
What are Glow Textures? So i'm not quite sure exactly what "glow textures" are. For my implementation of a "lightning" effect, according to the comments on the article;
http://drilian.com/2009/02/25/lightning-bolts/

They guy uses "glow textures". To achieve the really cool effects on his beams. I'm trying to-do the same thing, except that i'm not 100% sure what a glow texture is, currently the texture i'm using produces this output *I'm also using a simple shader to adjust the color value the lightning is rendered at;
http://www.youtube.com/watch?v=dQNRYD8bJJo

Which isn't very good, it has the shape of the lightning but it doesn't have the sorta "flare" of it. This is a screenshot of my current texture that i'm using:
http://dl.dropbox.com/u/13874083/screenshots/screen120417-105326.png

So essentially what i'd like to ask is mainly what is a glow texture? And perhaps to see  an example of one would be really appreicated.

Edit:
Taking the advice of kaoD, i'm now rendering the using Additive Blending, I've also got the Max Blending working, yet, still the bolt's do not produce the required effect that i'd like. Here's another video of them in action with the current code;
http://www.youtube.com/watch?v=T0OEBobHqks

And here's specifically how i'm rendering them;

        spriteBatch.Begin(SpriteSortMode.Immediate, new BlendState
            {
                ColorSourceBlend = Blend.One,
                ColorDestinationBlend = Blend.One,
                ColorBlendFunction = BlendFunction.Max
            }, null, null, null, effect);

        //Set Brightness of The First Bolt
        effect.Parameters["brightness"].SetValue(firstBoltBrightness);

        spriteBatch.Draw(firstBoltTarget, Vector2.Zero, Color.White);

        //Set Brightness of the Seconded Bolt
        effect.Parameters["brightness"].SetValue(secondBoltBrightness);

        spriteBatch.Draw(secondBoltTarget, Vector2.Zero, Color.White);

sentences:
How to handle "weapon slots"? I'm working on implementing an RPG engine, and I'm trying to figure out the best way to implement equipment.  The really tricky part is the hand slots.

It would be easy to give a character one hand slot for a weapon, and one off-hand slot for a shield.  But defining it that way would make it impossible to dual-wield, or to wield two-handed weapons.  Giving the character two generic "hand slots" would allow for dual wielding, two-handed weapons is where things get tricky.

The obvious way to equip a two-handed weapon is by filling both slots with the same object. But then I need special-case code for calculating stat bonuses (you can't simply sum all bonuses from all slots, because the weapon's values will get added twice) and for removal (you can't just clear the item from one slot).  If I only put the object in one slot, then calculating bonuses becomes easy again, but there needs to be special-case code to check whether the "empty" offhand slot is really empty or not.

Obviously I'm not the first person to face something like this. Two-handed weapons have been around in RPGs for decades.  Is there any elegant way to handle the logic involved?

sentences:
How do I create game rooms using Kryonet? I'm currently about to create my first networking game, and it's supposed to be two player and turn-based. I wrote the client using the LibGDX library, and the server with Kryonet.

It should be possible for multiple users to play the games, at once, I feel the need to create something like a "game room". I thought about creating a class with two connections (the two players), adding a listener to each, and to handle the messages within the game room.

However, I am not sure how to permanently update the game rooms. At the moment, my server only listens for new connections, and registers them in a list of connected clients. Maybe, I should create a new thread for each match?

How do I create such game rooms within the game server, itself?

Edit:

So after doing some more research, this is how I currently do it:
- I store the players, that are currently searching for a game in a LinkedList (more precise, their Connections) and once there are more than two, I do this in my Server class:

if (connectedPlayers.size() >= 2) {
            GameRoom newGame = new GameRoom(connectedPlayers.removeFirst(), connectedPlayers.removeFirst());
            gameRooms.add(newGame); //some list, storing all the current games
            newGame.start();
}

and my GameRoom looks like this:

public class GameRoom implements Runnable {
Thread t;
Connection playerOne;
Connection playerTwo;
//more variables your GameRoom might need

public GameRoom(Connection playerOne, Connection playerTwo) {
    this.playerOne = playerOne;
    this.playerTwo = playerTwo;
    //whatever more variables you need to use can be declared here, e.g.
}

@Override
public void run() {
    while (true) {
        //Game logic goes here
    }
}

public void start() {
    t = new Thread(this);
    t.start();
}

}
I am not really into threading and this is what I set up after a little more reading into that topic, but I assume this is not really scaleable - because 1000 games would mean 1000 more threads, which I think is not so good.
Please let me know, whether this is the correct approach and if not, just stick to my question and help me with it, if you can and feel like it.

sentences:
Slow tile map rendering I'm having an issue with my tilemap renderer, with small maps (like 40*40 tiles) it works fine but with maps that have 400*400 tiles the framerate becomes really slow when I try to move the camera.

Here are my rendering methods

/// Renders the map
void Map::Map::render(sf::RenderWindow& window)
{
    for (auto c : m_tiles)
    {
        for (Tile& tile : c)
        {
            m_renderer.render(tile);
        }
    }
}

And for the TileRenderer

void Renderer::TileRenderer::render(const Map::Tile& tile) const
{
    try
    {
        if (m_previousType != tile.getType())
            m_sprite.setTextureRect(getTypeTextureRect(tile.getType()));

        m_sprite.setPosition(tile.getAbsolutePosition());

        m_renderWindow.draw(m_sprite);
        m_previousType = tile.getType();
    }
    catch (ETileTypeUndefined e)
    {
        Logger::getInstance().log(e.what());
    }
}

Any idea to solve that poor framerate ?
It doesn't seems to be a memory issue.
Visual Studio debugger tells me that external code spend a lot of time in the renderer's render function (calls to sf::RenderWindow::draw(sf::Drawable) I guess).

sentences:
(How exactly to use EventSystem?) Assigning string Name to UI Button in Unity without CrossPlatformInput? I'm trying to make a new game for Android. There is a Jump button i've added as UI button , this works fine as I have a method for Jump() which I can just add to the OnClick() method in the Button's Inspector tab.

However, for my 'Pick Up' button I don't really want a method for pick up. I already have my item pickup handling code inside a OnTriggerEnter() method and what I was hoping to do was have an additional if condition into my code like:

if (Input.GetButtonDown("Pickup")){ //then it ok to pickup! }

This is how i did it in my other projects. But I had been importing the CrossPlatformInput namespace and then just copied and adapted the buttons from the Jump button that came as standard with that.

So now, I can't see how to name my button as 'Pickup'. I tried looking at the code from CrossPlatformInput, it seems it takes the name you provide it, and passes it to VirtualInput (also in the CrossPlatformInput namespace), I couldnt see a copy of this class anywhere, it think its closed source maybe :/

Of course, I could probably manually make a method to add to the OnClick() which just makes a bool true only when it's being clicked. But I feel like there must be a way to just add this UI button as 'Pickup' to the Input system (like you do with "Horizontal", "Vertical" or "Jump" for example).

Again, I tried to read the docs, and also lots of forums and sites like this. I found that the EventSystem will (or should) have the part I need, but i am now stuck.

I tried this:

EventSystem.current.currentSelectedGameObject.name == ??????????

I read that will return the name of the most recent button pressed, but how would that method know that my new Button is called "Pickup", I dont see how I added it to that yet?

Another reason why i'd like to do it this way is for Cross Platform compatibility. If I make it this way, I already now that there is a certain button on the keyboard mapped in Project>Input to the same name (ie. "Pickup" ; Left-Ctrl). And it seems cleaner to use the existing way of doing this if possible, im sure its just that I dont know how yet.

Most options ive seen online involve the OnClick inspector function, or CrossPlatFormInput imported package.

I hope this makes sense to someone, and that there is a way to do it. Thanks for any help as usual very much appreciated.

sentences:
Examples of 3D space strategy with good XYZ controls? I've been tinkering with an idea for a space sym, kind of like MOO2, writing it for mobile or browser as a way to learn Java.  Command ships and control planets, etc.  I'd love to make the game in 3d, with x, y, and z coordinates to make things more realistic, but I'm afraid that it'd be too much to implement. The engine wouldn't be any harder to code, just add another vector to the calculations, but a user interface for navigating a 3d galaxy is more difficult.  I'd prefer to keep the graphics simple, without a lot of hardcore rendering for different angles.

Does anyone have any experience designing a UI for directing units in 3D?  If I decide to go the 3D route, how should I have the player control the 3rd coordinate (the one that would come out of the screen)?  Is there a method that would allow a player to easily tell the ship how far "back" or "forward" to travel in addition to the usual up/down, right/left?

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:
TextureRegions and TextureAtlases in AndEngine This is my first android game, sorry if my code is bad, any advice will help. I am trying to find ways to improve performance on a game of mine, I'm using AndEngine GLES2. I have a basic question about how to actually load sprites.

I have 6 player sprites that actually use the same jpg as it's image, the way I've been loading them is like this:

private void loadLinebackers(String imageResource, int i) {
    this.playersTextureAtlas[i] = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
    this.playersTextureRegion[i] = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.playersTextureAtlas[i], this, imageResource, 0, 0);
    this.playersTextureAtlas[i].load();
}

private void loadWideReceivers(String imageResource, int i) {
    this.wrsTextureAtlas[i] = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
    this.wrsTextureRegion[i] = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.wrsTextureAtlas[i], this, imageResource, 0, 0);
    this.wrsTextureAtlas[i].load();
}

Do I have to create an atlas and a region for every player that I have? Or can I somehow use the same resource?

All the players are viewable simultaneously within the camera. I run these load* functions via a for loop, passing in i each time.

Each set of players is performing different actions (SequenceModifiers) and I make the Sprite arrays like this:

private void makeLinebackers(Scene scene, float posX, float posY, int i, int spaceBetween) {
    this.olineman[i] = new Sprite(posX + (spaceBetween * i), posY, this.playersTextureRegion[i], this.getVertexBufferObjectManager());
    this.olinemenPhysicsHandler[i] = new PhysicsHandler(this.olineman[i]);
    this.olineman[i].registerUpdateHandler(this.olinemenPhysicsHandler[i]);
    scene.attachChild(this.olineman[i]);
}

private void makeWideReceivers(Scene scene, float posX, float posY, int i, int spaceBetween) {
    this.wideReceivers[i] = new Sprite(posX + (spaceBetween * i), posY, this.wrsTextureRegion[i], this.getVertexBufferObjectManager());
    this.wrsPhysicsHandler[i] = new PhysicsHandler(this.wideReceivers[i]);
    this.wideReceivers[i].registerUpdateHandler(this.wrsPhysicsHandler[i]);
    scene.attachChild(this.wideReceivers[i]);
}

I made each of these 2 different arrays, because generally each player from each array are doing similar animations and actions. For example, I make all the wide-receivers "run" at once.

sentences:
How can I get started making textures for 3D games? Just wondering where to find good tutorials on making textures for 3D games?

Also, is it common practice to take photographs and convert them into game textures or do designers draw the textures themselves?

UPDATE:

To make the situation more specific, I am trying to make a simple game where the game character is in a small building so I would be making textures for computers, tables, chairs, doors, windows, walls, etc... What is outside the building is mostly irrelevant. I don't have any experience in 3D modeling though I'm thinking of using Blender.

sentences:
Same dimension feel no matter what FOV Does anyone know a formula, way, ... to make a FPS player feel like an object has the same size on different FOVs (given that it's at the same distance of the player, of course)? I know that this can't be done perfectly, because of the distortion various FOVs cause and the position of the object (near the edges of the FOV = more distortion).
Let's ignore these distortions, and aim for a same size feel for objects that are directly in front of the player (so in the exact center of the FOV).

To clarify things a bit further: I want 1 object in my game to have the same scale feel on different FOVs, not my entire game world.

I've tried giving it a percentage of the frustrum height, but that doesn't seem to give me consistent results.

Note: I'm using vertical field of view in my game.

sentences:
How does Unity's Entity-Component System Work In Practice? On the surface Entity-Component seems like a good way to program games. Everything is a game object and those game objects are made up of components. The attraction is components are very flexible, just requiring you to "add" them to a game object to inherit it's functionality.

So, obviously a good example might be a platform the character has to jump on. Maybe this thing has a collider, a moving component, maybe a rotating component, or maybe even a rigid "RotatingAndMovingPlatformComponent". Okay, that sounds great, just add all these components to the game object and that's it, you have this extra functionality. However, I find that this level of complexity is where it's usefulness ends.

Try this with menus, complex character movement with multiple states, abstract ideas like game modes or game state, and your flexibility and modularity are destroyed. Menus involve a lot of specifics, complex character movement often involves many states meaning either communication between these components is needed or there must be a controlling component made just for this type of character. On top of this, some components will need to rely on game state in some way.

I see very little benefit to programming this way over ordinary inheritance. The lack of object structures at compile time makes doing a lot of things very difficult and unreliable.

I feel the best and easiest way of going about things would be using larger components with more dependencies. I don't see this as a problem ( more like unreal 4's architecture ), but then I wonder what's the point in the Entity-Component architecture.

sentences:
Are there any methods for generating rivers on-demand with Perlin/Simplex noise? I'm aware of many methods for procedurally generating rivers, but they require an entire heightmap beforehand in order to work. For instance, they may require to find a high position on the map and find a path to the ocean.

But when working with on-demand / on-the-fly procedural generation (generating the map around the player as he moves), those requirements are unfeasible. For instance, Minecraft doesn't have "true rivers":

  the river does not in fact have a start and end point, it is actually just dividing the two biomes, this means that it uses the distance between the point and the edge of the biome to determine how deep the water should be, with some variance of course.

This mod seems to solve the issue, but how? Probably it takes advantage of the fact that entire chunks are generated and thus is not entirely on-demand per position.

So, the question is: how can I generate rivers procedurally on-demand? More preciselly, I want a function f(x, y) which tells me whether there is a river at (x,y) or not (and its flow direction). It seems pretty unsolvable for me, but maybe people have come with some solution.

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:
How to set rotations to 0,0,0 in 3ds max for exporting in unity? I'm a modeler in 3ds max and the unity programmer ask me that the object must have:

pivot with Y up
rotations at 0,0,0

but every object that I export in fbx he says don't have rotations at 0,0,0.
I tryed different solutions as:
- reset xform
- freeze rotation
- rotation to zero
- $.rotation = eulerangles 0 0 0

but in unity he have values like this
[4.577637e-05, -1.525879e-05, 0] or [-90, 1.525879e-05, 0] and so on

It's a problem that can I fix in max or the programmer has to fix it in unity?

Thanks

sentences: Can networking be platform independent in a libgdx game? LibGDX supports Desktop (Windows, Linux and Mac), Android and web applications. Can i code the network part of an online game without taking care of what kind a of application i'm running? i.e coding the network engine interdependently of the application type.

sentences:
How do splines work? I've been beginning to work with different kinds of splines (e.g. Bezier, Hermite, B-splines) in some of my work with computer graphics and I am trying to get a grasp of how they work (mathematically and programmatically). I know that generally (at least for cubic splines), you will have 4 control points that influence the position of points along an interpolated line. For example, with Bezier curves (as far as I understand), there can be two end points where the line will begin and terminate and two control points that influence the direction of the line.

I've been programming Bezier, Hermite, and B-Splines (in javascript on an html5 canvas) and what I don't understand is how to choose these 4 points in order to see a specific curve rendered on the screen. So far, I have only been able to render at least part of a curve by randomly playing around with different numbers for each point.

This is one of the many questions I have about the inner workings of splines so could someone provide an overview on how they work and how they can be programmed (most of the examples online are more theoretical and rather unspecific)?

sentences:
Low resolution RenderTexture with gradients I have a small RenderTexture that stretched on large object, so texels is near 0.3 of unit. Source for this texture has much more resolution and with gradients.

If source little bit changes its brightness, camera renders it much different.
On this video, first is source, second is texture. Also the rendered gradient is not constant.

How can I fix it?

Archive with minimal scene - If you hide source object in inspector and move it, you will see artifacts on result object.

sentences:
Create a 2D trail in Unity? I would like to make a trail for a pixelated snake such as this one :

As you can see, the cross simply repeats itself to create the snake. In Unity I have messed around with Trail Renderer, tried everything to import the cross as a texture / sprite, then created all sorts of materials for it, but it just won't work the same way.

How can I achieve this effect please? Thanks!

sentences:
Declaring Keycodes as strings How do I declare the keycodes as strings instead of selecting the keys from a list? Such that the user can input a key in inspector window and it will be read?
public string StringKey = "a";

void Update () {

   if (Input.GetKeyDown (KeyCode.StringKey)) {

   }

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:
Why can't my A* implementation find a path out of an open room? I tried to follow this article with the following example, but in my attempts it always ends up with a dead end.

If we take G being 10 in a straight line or 14 in a diagonal, and H the distance in horizontal or vertical to the target point, then we restart this search for every tile that is the nearest one to the target point.

I have this result: if we take one or the other direction with 54, it ends up with a dead end. For example, if we go up from 40 to 54, then to 60, when we restart the search with G and H, it ends up with "4" (second shema) and comes back in a dead end:

Why does this happen and how can I solve it?

I also looked at the wiki, but I did not understand the system with the colors and the code shown.

sentences:
Change hero direction in place before movement on a grid based game in Unity I've already implemented a grid based movement with all the necessary animations.

Now I would like the make the hero face the direction of the input without moving first and move only if the input direction is the same one he's facing.

E.g.: if the Hero is standing still facing up, and you press left, he will face left without moving. If you then press left again, he will move on that direction cause he's already facing it.

Here's the code:

void Update() {

    movementDirection.x = Input.GetAxisRaw("Horizontal");
    movementDirection.y = Input.GetAxisRaw("Vertical");

    isMoving = Vector2.Distance(transform.position, movePoint.position) > 0.1f;

    SetAnimator();

}

void FixedUpdate() {

    transform.position = Vector2.MoveTowards(transform.position, movePoint.position, movementSpeed * Time.fixedDeltaTime);

    if (!isMoving) {
        if (movementDirection.x != 0) { movePoint.Translate(new Vector2(movementDirection.x, 0f)); }
        else if (movementDirection.y != 0) { movePoint.Translate(new Vector2(0f, movementDirection.y)); }
    }

}

private void SetAnimator() {

    animator.SetBool("Moving", isMoving);

    if (!isMoving && movementDirection != Vector2.zero) {

        animator.SetFloat("Horizontal", movementDirection.x);
        animator.SetFloat("Vertical", movementDirection.y);

    }

}

I tried using global variables to compare Hero's direction with the input, and let the Hero move only if they're the same but due to the Update function called every frame as soon as I update the current direction with the input one the hero will start to move:

void FixedUpdate() {

    Directions latestGivenDirection = GetLatestGivenDirection(movementDirection);

    //this wont work, as the next frame will pass the condition and the hero will move
    if (latestGivenDirection == currentDirection) {

        transform.position = Vector2.MoveTowards(transform.position, movePoint.position, movementSpeed * Time.fixedDeltaTime);

        if (!isMoving) {
            if (movementDirection.x != 0) { movePoint.Translate(new Vector2(movementDirection.x, 0f)); }
            else if (movementDirection.y != 0) { movePoint.Translate(new Vector2(0f, movementDirection.y)); }
        }

    }

    currentDirection = latestGivenDirection;

}

How can I achieve such a behaviour?

sentences:
Defining collision rules in Farseer XNA I'm trying to integrate Farseer into my XNA game.
Since I'm using an EntityComponentSystem approach, I've added the Body inside a component and added it to the players' components.

One thing I'm struggling with is that I don't know how to control "collision rules".

For example,

I want Players to colide with other Players/Walls, but not move them on contact, which is what happens when I set BodyType = BodyType.Dynamic.

I want players to be able to block other players, but I what happens now is that if a player remains still, if another player runs into them, they move, physically, which is not the kind of behavior I want.

I move them by giving them a LinearVelocity, and then when I Step the World, I set the players' position to their Body's position. I tried changing BodyType = BodyType.Static, but that removed the collision between the players.

I know that if it was Unity, I'd give the object a BoxCollision2D and a RigidBody2D and it'd behave like I want. I guess that what I'm missing is the RigidBody part of the collision, but how can I implement it in Farseer?

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:
CompileFromFile syntax error upon compilation I am using visual studio c++ 2003 edition and I am trying to use the function CompileFromFIle function from DirectX SDK February 2010 SDK to add bloom to my source code for a mod I am working on and I get this error upon building the release build what is the issue. How do I fix this error?

Output build errors:

c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(839) : error C2061: syntax error : identifier '__out'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(843) : error C2061: syntax error : identifier '__in'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(847) : error C2059: syntax error : ')'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(847) : fatal error C1903: unable to recover from previous error(s); stopping compilation

Here is my code cpp file to look at also:

#define _WIN32_WINNT 0x600
#include "stdafx.h"
#include <stdio.h>

#include "C:\Users\john\Desktop\fear public tools 108\Source \Game\ClientFxDLL\D3Dcompiler.h"

#pragma comment(lib,"d3dcompiler.lib")

HRESULT CompileShader( _In_ LPCWSTR srcFile, _In_ LPCSTR entryPoint, _In_   LPCSTR profile, _Outptr_ ID3DBlob** blob )
{
if ( !srcFile || !entryPoint || !profile || !blob )
   return E_INVALIDARG;

*blob = nullptr;

UINT flags = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
flags |= D3DCOMPILE_DEBUG;
#endif

const D3D_SHADER_MACRO defines[] =
{
    "EXAMPLE_DEFINE", "1",
    NULL, NULL
};

ID3DBlob* shaderBlob = nullptr;
ID3DBlob* errorBlob = nullptr;
HRESULT hr = D3DCompileFromFile( srcFile, defines,    D3D_COMPILE_STANDARD_FILE_INCLUDE,
                                 entryPoint, profile,
                                 flags, 0, &shaderBlob, &errorBlob );
if ( FAILED(hr) )
{
    if ( errorBlob )
    {
        OutputDebugStringA( (char*)errorBlob->GetBufferPointer() );
        errorBlob->Release();
    }

    if ( shaderBlob )
       shaderBlob->Release();

    return hr;
}

*blob = shaderBlob;

return hr;
}

int main()
{
// Compile vertex shader shader
ID3DBlob *vsBlob = nullptr;
 HRESULT hr = CompileShader( L"BloomCombine.hlsl", "VSMain",   "vs_4_0_level_9_1", &vsBlob );
if ( FAILED(hr) )
{
    printf("Failed compiling vertex shader %08X\n", hr );
    return -1;
}

// Compile pixel shader shader
ID3DBlob *psBlob = nullptr;
hr = CompileShader( L"BloomExtract.hlsl", "PSMain", "ps_4_0_level_9_1",    &psBlob );
if ( FAILED(hr) )
{
    vsBlob->Release();
    printf("Failed compiling pixel shader %08X\n", hr );
    return -1;
}

printf("Success\n");

// Clean up
vsBlob->Release();
psBlob->Release();

return 0;
}

sentences:
Is there any way in open-gl to "bit crush" everything on the screen? I am making an educational game and am looking for options for a visual effect to show when something is "incorrect".  So, I am looking to see if there's an easy way in openGL to temporarily distort everything on the screen (all sprites, everything), like pixelate it or something...

Does anyone know if this is possible?

I'm using cocos2d by the way...

Edit: here is an example of what I am looking for:

On the left, the original, on the right the pixelated / bitcrushed version:

The thing is, I don't want to just do this to a single texture / sprite, I want to take the entire display output, and perform this pixelated effect on it and then revert back to normal after a second or something.

sentences:
Calculate direction of coordinates I wanted conditions that could determine which direction (north, south, east, west, northwest, northeast, southeast, southwest) the player is following, what I got was just north, south, east and west, as shown in the code below:

var playerX = player.x, playerY = player.y;

var destX = 8, destY = -15;

    if (playerX < destX) {
      playerX += 0.5; // east
    } else if (playerX > destX) {
      playerX -= 0.5; // west
    } else {
      playerX = destX; // maintains direction
    }
    if (playerY < destY) {
      playerY += 0.5; // north
    } else if (playerY > destY) {
      playerY -= 0.5; // south
    } else {
      playerY = destY; //maintains direction
    }

image example:

sentences:
camera movement along with model I am making a game in which a cube travels along a maze with the motive of crossing the maze safely. I have two problems in this.

The cube needs to have a smooth movement like it is traveling on a frictionless surface. So could someone help me achieve this. I need to have this done in a event callback function
I need to move the camera along with the cube. So could someone advice me a good tutorial about camera positions along with an object?

sentences:
Using a permutation table for simplex noise without storing it Generating Simplex noise requires a permutation table for randomisation (e.g. see this question or this example).

In some applications, we need to persist the state of the permutation table. This can be done by creating the table, e.g. using

def permutation_table(seed):
    table_size = 2**10  # arbitrary for this question
    l = range(1, table_size + 1)

    random.seed(seed) # ensures the same shuffle for a given seed
    random.shuffle(l)
    return l + l  # see shared link why l + l; is a detail

and storing it.

Can we avoid storing the full table by generating the required elements every time they are required?

Specifically, currently I store the table and call it using table[i] (table is a list). Can I avoid storing it by having a function that computes the element i, e.g. get_table_element(seed, i).

I'm aware that cryptography already solved this problem using block cyphers, however, I found it too complex to go deep and implement a block cypher.

Does anyone knows a simple implementation of a block cypher to this problem?

sentences:
Rotate a plane defined by its normal and its distance First apologies for the amount of pictures, it's a bit hard trying to explain my problem without pictures. Hope I've provided all the relevant code. If you feel you want to know about how I am doing something else, please tell me and I will include it.

I've been trying to work around rotating a plane in 3D space, but I keep hitting dead ends. The following is the situation:

I have a physics engine where I simulate a moving sphere inside a cube. To make things simpler, I have only drawn the top and bottom plane and moved the sphere vertically. I have defined my two planes as follows:

CollisionPlane* p = new CollisionPlane(glm::vec3(0.0, 1.0, 0.0), -5.0);
CollisionPlane* p2 = new CollisionPlane(glm::vec3(0.0, -1.0, 0.0), -5.0);

Where the vec3 defines the normal of the plane, and the second parameter defines the distance of the plane from the normal. The reason I defined their distance as -5 is because I have scaled the the model that represents my two planes by 10 on all axis, so now the distance from the origin is 5 to top and bottom, if that makes any sense.

To give you some reference, I am creating my two planes as two line loops, and I have a model which models those two line loop, like the following:

top plane:
std::shared_ptr<Mesh> f1 = std::make_shared<Mesh>(GL_LINE_LOOP);
std::vector<Vertex> verts = { Vertex(glm::vec3(0.5, 0.5, 0.5)), Vertex(glm::vec3(0.5, 0.5, -0.5)), Vertex(glm::vec3(-0.5, 0.5, -0.5)), Vertex(glm::vec3(-0.5, 0.5, 0.5)) };
f1->BufferVertices(verts);

bottom plane:
std::shared_ptr<Mesh> f2 = std::make_shared<Mesh>(GL_LINE_LOOP);
std::vector<Vertex> verts2 = { Vertex(glm::vec3(0.5, -0.5, 0.5)), Vertex(glm::vec3(0.5, -0.5, -0.5)), Vertex(glm::vec3(-0.5, -0.5, -0.5)), Vertex(glm::vec3(-0.5, -0.5, 0.5)) };
f2->BufferVertices(verts2);

std::shared_ptr<Model> faceModel = std::make_shared<Model>(std::vector<std::shared_ptr<Mesh>> {f1, f2 });

And like I said I scale the model by 10.

Now I have a sphere that moves up and down, and collides with each face, and the collision response is implemented as well.

The problem I am facing is when I try to rotate my planes. It seems to work fine when I rotate around the Z-axis, but when I rotate around the X axis it doesn't seem to work. The following shows the result of rotating around Z:

However If I try to rotate around X, the ball penetrates the bottom plane, as if the collisionplane has moved down:

The following is the code I've tried to rotate the normals and the planes:

for (int i = 0; i < m_entities.size(); ++i)
    {
        glm::mat3 normalMatrix = glm::mat3_cast(glm::angleAxis(glm::radians(6.0f), glm::vec3(0.0, 0.0, 1.0)));

        CollisionPlane* p = (CollisionPlane*)m_entities[i]->GetCollisionVolume();
        glm::vec3 normalDivLength = p->GetNormal() / glm::length(p->GetNormal());
        glm::vec3 pointOnPlane = normalDivLength * p->GetDistance();
        glm::vec3 newNormal = normalMatrix * normalDivLength;

        glm::vec3 newPointOnPlane = newNormal * (normalMatrix * (pointOnPlane - glm::vec3(0.0)) + glm::vec3(0.0));

        p->SetNormal(newNormal);
        float newDistance = newPointOnPlane.x + newPointOnPlane.y + newPointOnPlane.z;
        p->SetDistance(newDistance);
    }

I've done the same thing for rotating around X, except changed the glm::vec3(0.0, 0.0, 1.0) to glm::vec3(1.0, 0.0, 0.0)

m_entites are basically my physics entities that hold the different collision shapes (spheres planes etc). I based my code on the answer here Rotating plane with normal and distance

I can't seem to figure at all why it works when I rotate around Z, but not when I rotate around X. Am I missing something crucial?

sentences:
Voxel terrain generation performance problems I am trying to create a minecraft clone to practice some stuff in Unity including Raycasting, terrain generation and player controlls.
Terrain is generating without any problem with a perlinNoise.
My problem is the then following performance problems.
The terrain is only 1 block high with no underlying blocks. Each block constist out of 6 quads with a 64x64 texture. I generate terrain at 200 x 200 size.
I can't imagine why 4000 voxels with such simple textures can lag out whilst my pc runs objects with 50k tris and complex textures without any problem.
My code:
[...]

public int xVoxels = 200;
public int zVoxels = 200;

[...]

for (int x = 0; x < xVoxels; x++){
    for (int z = 0; z < zVoxels; z++){

        // voxel = script parameter
        GameObject newVoxel = GameObject.Instantiate(voxel);
        Vector3 position = new Vector3();

        position.x = xVoxels/2 + x;
        position.z = zVoxels/2 + z;
        // PerlinNoise stripped out for testing
        position.y = 0f;

        newVoxel.transform.position = position;
    }
}

Solutions I tried:
Combining meshes
Combining all meshes to a single one per material worked wonderfully... until I wanted to interact with each voxel determined by Raycasting from the Camera, I had a raycast hit to the combined mesh and not to my determined voxel
Generating the planes myself
Instead of using the unity plane object I generated all vertecies myself, same performance problems

sentences:
It is worth adding 'futuristic' features to our game, or should we put our focus elsewhere? I'm lead programmer in a medium-sized indie game studio. This is our first game as a team. We're working on a futuristic FPS game, with a profit-sharing buisness plan.

Anyway, we have some very good programmers, who have the ability to create never-seen-before features (true realistic fluids, procedural mesh destruction, procedural skyboxes, etc.) And I'm wondering is there any point to implementing these things? They take a long time, but look brilliant. We're aiming for a 12 month development cycle. So should we do this, or just make a standard game.

sentences:
How to draw a Minecraft-like world with Open GL I recently completed the this Open GL tutorial. The tutorial shows how to set up a window and shaders, and teaches you how to draw a single cube in the middle of the screen, which all makes sense to me (I think).

I'd like to make just a simple flat world made of cubes like Minecraft, but I have no idea how to turn my single giant cube into a bunch of smaller cubes, or how to get the smaller cubes to be arranged in the proper way.

Mostly what doesn't make sense to me is the coordinate system being from 1 to -1 and trying to draw a bunch of cubes in that space. Is there a way to adjust that coordinate space to be more world-like, where each unit of coordinate space is roughly equivalent to a meter or something?

sentences:
Good map file structure? I need a map file structure for my game but does anyone know a good way to map it out? I was thinking something like this:

name=MyMap
add[floor[stone]][solid][20, 640]
add[playerspawn][20, 620]

sentences:
OpenGL can an Element Array Buffer points to only one VBO I'm making a Minecraft style game and currently storing 36 vertices and texture coordinates per cube. Could I make an EBO for only the position and leave the texture coordinates as they are?

OK i think thsi is how i will do it.

I would have an array of 24 vertices(3*GLfloat) and 24 texture coordinates(2*GLfloat) for the corners

then i would have an EBO pointing to the corners with 36 indices

So memory total = 24*3*4 + 24*2*4 + 36*4 = 624 bytes

instead of

36*3*4 + 36*2*4 = 720 bytes

sentences:
XNA - Non perspective projection? For a section of my game, instead of having a perspective projection, i would like to display an isometric view of an object.

So i don't want things to appear smaller if in a distance, etc.

Basically a proper isometric image.

Is there any way to do this in XNA?

sentences:
Temporary objects in opengl I want to write a game in which the player shoots projectiles (bullets, etc).
Since I don't know how many and when these projectiles will be shot, I wonder how to buffer and render them (and when!).

Normal opengl pipeline (as I understand it):

Create and bind buffers (once)
Buffer data to these buffers (once)
In loop - Draw every frame/period.

What about temporary objects ? I buffer them only when used ? I suppose I get the player input as trigger, and then buffer them and draw them. Is this approach fast enough ?

Thank you

sentences:
Zooming into generated map I have generated a 1024 X 1024 heightmap using Open simplex noise. Now i want to zoom into a 64X64 area. Every pixel in the 64X64 is not 16X16 on the larger scale.

I tried just generating the area, but problem is, that I want to also calculate normals from it, and the normals are different for the zoomed in area from the big map. The difference comes from the fact that on the big map the height difference between 2 pixels can be quite large, but when zoomed in, new pixels are place between the original 2 so if now normals are calculated, they are totally different.

How can I zoom into an area of a generated heightmap but retain the normals?
On the left is the large scale map and on the right is the zoomed in area. Zoomed in area is the upper left corner of the large scale map. As you can see the normals are completely different. Both of these images are textures. There are no meshes or anything only textures, and there will not be any meshes in future either.

This is how I calculate normals from heightMap.

            u = noiseValues[x + (y - 1) * width];
            r = noiseValues[x + 1 + y * width];
        }
        Vector3 up = new Vector3(0, 1, (noiseValues[index] - u)*100);
        Vector3 across = new Vector3(1, 0, (r - noiseValues[index])*100);

        normal = across.Cross(up).Normalized();
        normal = (normal + new Vector3(1, 1, 1)) / 2.0f;

After updating these lines in normal calculation:

 Vector3 up = new Vector3(0, 1/zoomFactor, (noiseValues[index] - u)*100);
        Vector3 across = new Vector3(1/zoomFactor, 0, (r - noiseValues[index])*100);

This is the result after adjusting normal calculation:

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

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

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

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

sentences:
How do I find voxels along a ray? I am making a voxel engine, and I want to make it possible to create and destroy voxels with the mouse. I use C++ and OpenGL, so C++ examples would be best.

So far, I have the camera position and appropriate angle as Vector3 values. I need to find voxels along a ray extending from the camera position along the angle. I tried to solve it myself, and essentially came up with a slow, 3D version of Bresenham's line. This would be okay, but it skips diagonals, meaning if I point toward the edge of a voxel, it usually misses.

The "bad" line skips over where the line crosses diagonals, while the good line hits them. I currently have the bad, but I want the good:

I have tried reading around this, but most of what I find relates to sparse octree rendering.

sentences:
Wall jumping collision detection anomaly I'm creating a game where the player ascends a tower by wall jumping his way to the top. When the player has collided with the right wall they can only jump left and vice versa. Here is my current implementation:

    if(wallCollision() == "left"){
        player.setPosX(0);
        player.setVelX(0);
        ignoreCollisions = true;
        player.setCanJump(true);
        player.setFacingLeft(false);
    } else if (wallCollision() == "right"){
        player.setPosX(screenWidth-playerWidth*2);
        player.setVelX(0);
        ignoreCollisions = true;
        player.setCanJump(true);
        player.setFacingLeft(true);
    } else{
        player.setVelY(player.getVelY() + gravity);
    }

and

private String wallCollision(){
    if(player.getPosX() < playerWidth && !ignoreCollisions)
        return "left";
    else if(player.getPosX() > screenWidth - playerWidth*2 && !ignoreCollisions)
        return "right";
    else{
        timeToJump += Gdx.graphics.getDeltaTime();
        if(timeToJump > 0.50f){
            timeToJump = 0;
            ignoreCollisions = false;
        }
        return "jumping";
    }
}

If the player is colliding with the left wall it will switch between the states left and jumping repeatedly due to the varible ignoreCollisions being switched repeatedly in collision checks. This will give a chance to either jump as intended or simply ascend vertically instead of diagonally.

I can't figure out an implementation that will reliably make sure the player jumps as intended. Does anyone have any pointers?

sentences:
Optimization of A* in Python I am working on an IA (in Python) for small board game, and I need to do a lot of pathfinding per round in order to find the best move I can do (minmax implementation).

My problem is that even if the board is small (9*9), I am able to run it (only) approx. 10000 per second, and I don't know how to speed it. Do you have some advise?

def shortest_path(self, start, goal):
    elements = []
    heapq.heappush(elements, (0, start))

    came_from = {}
    cost_so_far = {}
    came_from[start] = None
    cost_so_far[start] = 0
    current = None
    while len(elements) > 0:
        current = heapq.heappop(elements)[1]
        if goal.is_on_goal(current):
            break
        for next in self.edges[current].neighbors:
            new_cost = cost_so_far[current] + 1
            if next not in cost_so_far or new_cost < cost_so_far[next]:
                cost_so_far[next] = new_cost
                lowest_priority = new_cost + goal.heuristic(next)
                heapq.heappush(elements, (lowest_priority, next))
                came_from[next] = current
    way = []
    if goal.is_on_goal(current):
        reverse_edge = current
        while reverse_edge in came_from:
            way.insert(0, reverse_edge)
            reverse_edge = came_from.get(reverse_edge, None)
    return way

sentences:
How to port animation from one skeleton to another? While I need to do this in a Blender3D modeler script, the math should be similar for other modelers or realtime engines.

Blender3D specific terminology:
Armature = skeleton
EditBone = rest pose bone (stores the rest pose matrix)
PoseBone = can store a different pose (animation matrix) for each frame of your animation

I need to share animations (Blender Actions) between Armatures which have EditBones with same names and which have the same positions, but can have different (rest pose) angles and scales. Plus the Armatures might have different bone hierarchy (bone parenting/ no bone parenting).

Why I need this:
I've made an importer/exporter for a 3d format for a game. The format doesn't store enough info to connect/parent the bones, which makes posing/animating character models in a 3d modeller nearly impossible (original model files for the 3d modeler don't exist, this is for modding).
As there are only 2 character skeleton types in the game, I decided to optionally allow to generate the bone from a hardcoded data in the model importer and undo that in the exporter. This allows to easily pose the model for checking weights, easily create weights, makes it easier for Blender to generate automatic weights and of course makes animating possible.

This worked perfectly: the importer optionally generated the Armature itself and the exporter removed those changes, so the exported model works with existing animations in the game.
But now I'm writing an importer and exporter for the game's animation format and here come the problems of:

Trying to make original animations work in Blender with my "custom" (modified) Armature
Trying to make animations created by using the "custom" (modified) Armature work with the original models in the game (and Blender).

Constraints or bone snapping inside Blender won't work as they don't care that the bones have different angles in the rest pose, they will still face the same direction.

It seems I just need to get the "difference" between the EditBone matrices of all EditBones for the two Armatures somehow and apply that difference to PoseBone matrices of all PoseBones, for all frames of my animation. I need to know how to get that difference and how to apply it.

BTW, PoseBone matrices are relative to rest pose, they are by default

[1.000000, 0.000000, 0.000000, 0.000000](matrix [row 0])
[0.000000, 1.000000, 0.000000, 0.000000](matrix [row 1])
[0.000000, 0.000000, 1.000000, 0.000000](matrix [row 2])
[0.000000, 0.000000, 0.000000, 1.000000](matrix [row 3])

So the question is: How to get the difference between two bone (EditBone) matrices to apply that difference to the animation matrices (PoseBone matrices)?

Please be easy on the matrix math.

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:
What technology does Starcraft 2 use render its maps? I've got a map that is being procedurally generated at run-time and I'm currently investigating methods of rendering this map.
I've taken an interest in the look of Starcraft 2 and I'd like some advise on what methods it employs to achieve it. Secondarily, I'd like to see any tutorials, articles, or even source code examples if possible.

There are a couple of main things I'd like to get some advise on, but please also feel free to suggest anything else that could help me.

Snappable Tilesets - A typical starcraft map seems to consist of a tileset of models that one can snap together to create the cliffs, ramps and other elevated terrain. What methods do they employ to make them look so natural? What I mean is, its very hard to spot repetition.
Terrain Textures - The terrain textures are so varied and even dynamic (Zerg creep). What methods are used to do this?

Thanks.

sentences:
What does "formalism" mean in the context of video game theory? I've come across the term "formalism" in a number of articles and discussions on the topic of video games. What does it mean?

PS: if I'm posting in the wrong place, could someone please link me a forum/site where I can ask academic game theories questions?

sentences:
How can I repeat a portion of a texture on a quad? I want to repeat a selected part of the texture into a quad.

I was looking at this thread, however the solution involved changing my HLSL.

Is there any way to do it without changing my shader settings?

SamplerState SampleType
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Wrap;
    AddressV = Wrap;
};

float4 TexturePixelShader(PixelInputType input) : SV_Target
{
    float4 textureColor;

    // Sample the pixel color from the texture using the sampler at this texture coordinate location.
    textureColor = shaderTexture.Sample(SampleType, input.tex);

    return textureColor;
}

And here's my current texture calculations:

// Get desired texture coordinates.
tLeft = (float)relTextureX / aTextureWidth ;
tRight = (float)(relTextureX + relTextureWidth) / aTextureWidth;
tTop = (float)relTextureY / aTextureHeight;
tBottom = (float)(relTextureY + relTextureHeight) / aTextureHeight;

// Create the vertex array.
vertices = new VertexType[m_vertexCount];
if (!vertices)
{
    return false;
}

// Load the vertex array with data.
vertices[0].position = D3DXVECTOR3(left, top, 0.0f);  // Top left.
vertices[0].texture = D3DXVECTOR2(tLeft, tTop);

vertices[1].position = D3DXVECTOR3(right, bottom, 0.0f);  // Bottom right.
vertices[1].texture = D3DXVECTOR2(tRight, tBottom);

vertices[2].position = D3DXVECTOR3(left, bottom, 0.0f);  // Bottom left.
vertices[2].texture = D3DXVECTOR2(tLeft, tBottom);

// Second triangle.
vertices[3].position = D3DXVECTOR3(left, top, 0.0f);  // Top left.
vertices[3].texture = D3DXVECTOR2(tLeft, tTop);

vertices[4].position = D3DXVECTOR3(right, top, 0.0f);  // Top right.
vertices[4].texture = D3DXVECTOR2(tRight, tTop);

vertices[5].position = D3DXVECTOR3(right, bottom, 0.0f);  // Bottom right.
vertices[5].texture = D3DXVECTOR2(tRight, tBottom);

sentences:
Which features belong to the engine and which ones to a game? Right now, I find myself implementing and testing new features for my 2D game engine, by directly coding them into the engine. Simultaneously, I have a showcase game with scripting support, which should call the engines functions. I attach e.g. a fixed tile movement to the Entity class in the engine, rather than scripting this specifically for the game. This is definitely breaking the idea of a general engine used for more than one game.

Are there any best practices to keep focusing on the correct implementation in the right parts (that is engine vs. game)?

sentences:
game multiplayer service development I'm currently working on a multiplayer game. I've looked at a number of multiplayer services(player.io, playphone, gamespy, and others) but nothing really hits the mark. They are missing features, lack platform support or cost too much. What I'm looking for is a simple poor man's version of steam or xbox live. Not the game marketplace side of those two but the multiplayer services.

User accounts, profiles, presence info, friends, game stats, invites, on/offline messaging. Basically I'm looking for a unified multiplayer platform for all my games across devices.

Since I can't find what I'm planning to roll my own piece by piece. I plan to save on server resources by making most of the communication p2p. Things like game data and voice chat can be handled between peers and the server keeps track of user presence and only send updates when needed or requested. I know this runs the risk of cheating but that isn't a concern right now. I plan to run this on a Amazon ec2 micro server for development then move to a small to large instance when finished.

I figure user accounts would be the simplest to start with. Users can create accounts online or using in game dialog, login/out, change profile info. The user can access this info online or in game. I will need user authentication and secure communication between server and client. I figure all info will be stored in a database but I dont know how it can be stored securely and accessed from webserver and game services.

I would appreciate and links to tutorials, info or advice anyone could provide to get me started. Any programming language is fine but I plan to use c# on the server and c/c++ on devices. I would like to get started right away but I'm in no hurry to get it finished just yet. If you know of a service that already fits my requirements please let me know.

sentences: Unity Rigidbody2D to act on certain gameobject only I am creating a 2D game and the player object has a rigidbody2D attached to it. The game works fine until the player collides with a power up. The rigidbody physics get all messed up. So I was wondering is there a way so that rigidbody will only act on enemies and be disabled for power ups?

sentences:
Fbx mesh animation opacity export 3d Max does export Opacity value of an material to Fbx, which in Xna (when importet/processed) can be easily found in BasicEffect of a mesh instance Alpha property (and used in draw method).

My question is:

Can opacity values on animated mesh be exported (specific opacity states/values over time/keyframes) ??

From what I gathered it seems that only Opacity value of the First frame of animated mesh is exported (and found in BasicEffect of mesh). So if in Max there are keyframes with different opacity values and Max animation preview clearly show these transparency transitions when moving scroll, then do not get exported to Fbx.

Are there knows techniques/hacks to inject opacity from animated meshed (values over time/keyframes) to Fbx?

sentences: Eliminate unwanted "hills" in navmesh over a flat floor So in the image below you can see that my navmesh has these weird hills being formed in it. Any way to remove these? My AI gets stuck on them.

sentences: (Fat) ray cast with MPR OR GJK? I know that it's possible to see if a line segment or a swept shape (to make a "fat" line segment) intersects objects using MPR and GJK.  Is it possible in those situations to find out the distance down the ray cast that the collision occurred?  Thanks!!

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:
Should I use float, double, or decimal for stats, position, etc? The problem with float and double is that they are not exact. If you are to do something like store replays, the values would have to be exact.

The problems with decimal is that they are approximately 16x slower (confirmed by searching and personal testing) than floats and doubles.

Couldn't Vector2s be another problem because they use floats internally for all the components?

How do other games solve this problem? I'm sure they must use floats and doubles but aren't they not deterministic across platforms and different architecture?

The replay files for games like SC2 run in a linear fashion so you cannot skip ahead so how do they solve the determinism issue with floating point numbers?

sentences:
How can I remove branches from a fragment shader function? I have a fragment shader, when I've carefully managed to remove most branching decisions, as I have found out through research here that they are bad.

But I have one function that I just can't work out how to do it without them.

The function takes in a HSV vector, and 'expands' it. By that I mean any Value (V of HSV) from 0.0 to 0.5 gets expanded to 0.0 to 1.0. Any Value from 0.5 to 1.0 gets de-saturated, so that it becomes more white. At V=1.0 any input colour is white.

Here is my working function. Can anyone help me de-'if' it?

//expand doubles the level up to 0.5=> 1.0
//for over 0.5 then the saturation is reduced from where it is now (V=0.5) to 0.0 (v=1.0)
vec3 expand() {
    vec3 expanded;
    float newSaturation;
float newValue;

//HSV = rgb2hsv(inputColor);
if (HSV.z < 0.5) { //x = Hue,y = Sat,z = Val ,w= bugger all
    newValue = HSV.z * 2.0; //double value 0.0 to 0.5 => 0.0 to 1.0
    //no need to touch saturation
    newSaturation = HSV.y;
} else {
    newValue = 1.0; //value is max
    //need to de-saturate proportional to level over 0.5 : (1.0 - ((v - 0.5) * 2)) * s
    newSaturation = (1.0 - ((HSV.z - 0.5) * 2.0)) * HSV.y;
}

expanded = hsv2rgb(vec3(HSV.x, newSaturation, newValue));
return expanded;
}

sentences:
Rotate a Vector by Quaternions I'm trying how to work out how to Rotate a Vertex using Quaternions, using a scientific calculator, or on paper. Exam preparation.

My lecturer has given us this;
Quaternion = (-0.5, 0, -0.7071067, 0.5)
Vertex = (23, 10, 18)

The way it's been explained to us is like this;

We have a vertex called p
We have a quaternion called q
We store p within a quaternions vector component, we'll call this K
K = (0, p)
Finally we do the normal quaternion multiplication
p' = qKq-1

I'm just trying to work out how I break this down so it's easier to understand so I am able to find out the result. I know how to do quaternion multiplication, but it seems confusing as I only have one w component in the quaternion, and only the x, y,z in the vector.

sentences:
How to generate smoother Perlin Noise? So, recently I've been learning procedural generation stuff (Perlin noise specifically) and I've kind of hit a wall.

This is the result that I've seen everyone get, but this is what I'm getting,

This is my code, (I'm using python):

import random
import math
import PIL.Image

class Noise:

    def __init__(self, x, y):
        self.x = x
        self.y = y

    def lerp(self, start, stop, t):
        return start*(1-t) + (stop*t)

    def smoothstep(self, t):
        return 3*(t**2) - 2*(t**3)

    def gradients(self):
        grads = []
        for _ in range(4):
            x = random.randrange(0, 361)
            y = random.randrange(0, 361)
            grads.append((math.cos(x), math.sin(y)))
        return grads

    def cvectors(self):
        botleft = (self.x, self.y)
        botright = (self.x-1, self.y)
        topleft = (self.x, self.y-1)
        topright = (self.x-1, self.y-1)
        cvecs = [botleft, botright, topleft, topright]
        return cvecs

    def makenoise(self):
        dot = []
        grads = self.gradients()
        cvecs = self.cvectors()
        for i in range(4):
            (x, y) = cvecs[i]
            (a, b) = grads[i]
            dot.append((x*a)+(y*b))
        st = self.lerp(dot[0], dot[1], self.smoothstep(x))
        uv = self.lerp(dot[2], dot[3], self.smoothstep(x))
        stuv = self.lerp(st, uv, self.smoothstep(self.y))
        return stuv

    size = 128
    img = PIL.Image.new('L', (size, size))
    for x in range(size):
        for y in range(size):
            perlin = Noise(random.uniform(0, 1), random.uniform(0, 1))
            img.putpixel(tuple([x, y]), perlin.makenoise())
    img.save("nois.png")

This is just a guess, but I feel like it's a scaling issue. Thanks in advance, and apologies, as well, for the horrible code.

sentences:
How to position spawned objects in diamond and grid (row x column) arrangements I am creating clones of my objects using the code below:

public List<Vector3> clonePositions;
public List<GameObject> cloneObjects;

for (int i = 0; i < clonePositions.Count; i++)
    {

        cloneObjects.Add(Instantiate(clonedObject,
        clonePositions[i], quaternion.identity));

    }

How can I create and position the cloned game objects in a grid/matrix (row x column) arrangement  (with equal spacing between and at equal spacing at the sides)? as seen below:

and also in a diamond shape arrangement as below:

I would like to keep the clones centered around the original game object.

sentences:
In 3D camera math, calculate what Z depth is pixel unity for a given FOV I am working in iOS and OpenGL ES 2.0.  Through trial and error I've figured out a frustum to where at a specific z depth pixels drawn are 1 to 1 with my source textures.  So 1 pixel in my texture is 1 pixel on the screen.  For 2d games this is good.  Of course it means that I also factor in things like the size of the quad and the size of the texture.

For example if my sprite is a quad 32x32 pixels.  The quad size is 3.2 units wide and tall.  And the texcoords are 32 / the size of the texture wide and tall.

Then the frustum is:

    matrixFrustum(-(float)backingWidth/frustumScale,(float)backingWidth/frustumScale,
                   -(float)backingHeight/frustumScale, (float)backingHeight/frustumScale, 40, 1000, mProjection);

Where frustumScale is 800 for a retina screen.  Then at a distance of 800 from camera the sprite is pixel for pixel the same as photoshop.

For 3d games sometimes I still want to be able to do this.  But depending on the scene I sometimes need the FOV to be different things.

I'm looking for a way to figure out what Z depth will achieve this same pixel unity for a given FOV.

For this my mProjection is set using:

    matrixPerspective(cameraFOV, near, far,  (float)backingWidth / (float)backingHeight, mProjection);

With testing I found that at an FOV of 45.0 a Z of 38.5 is very close to pixel unity.  And at an FOV of 30.0 a Z of 59.5 is about right.  But how can I calculate a value that is spot on?

Here's my matrixPerspecitve code:

void matrixPerspective(float angle, float near, float far, float aspect, mat4 m)
{
    //float size = near * tanf(angle / 360.0 * M_PI);
    float size = near * tanf(degreesToRadians(angle) / 2.0);
    float left = -size, right = size, bottom = -size / aspect, top = size / aspect;

    // Unused values in perspective formula.
    m[1] = m[2] = m[3] = m[4] = 0;
    m[6] = m[7] = m[12] = m[13] = m[15] = 0;

    // Perspective formula.
    m[0] = 2 * near / (right - left);
    m[5] = 2 * near / (top - bottom);
    m[8] = (right + left) / (right - left);
    m[9] = (top + bottom) / (top - bottom);
    m[10] = -(far + near) / (far - near);
    m[11] = -1;
    m[14] = -(2 * far * near) / (far - near);
}

And my mView is set using:

lookAtMatrix(cameraPos, camLookAt, camUpVector, mView);

* UPDATE *

I'm going to leave this here in case anyone has a different solution, can explain how they do it, or why this works.

This is what I figured out.  In my system I use a 10th scale unit to pixels on non-retina displays and a 20th scale on retina displays.  The iPhone is 640 pixels wide on retina and 320 pixels wide on non-retina (obsolete).  So if I want something to be the full screen width I divide by 20 to get the OpenGL unit width. Then divide that by 2 to get the left and right unit position.  Something 32 units wide centered on the screen goes from -16 to +16.  Believe it or not I have an excel spreadsheet do all this math for me and output all the vertex data for my sprite sheet.

It's an arbitrary thing I made up to do .1 units = 1 non-retina pixel or 2 retina pixels.  I could have made it .01 units = 2 pixels and someday I might switch to that.  But for now it's the other.  So the width of the screen in units is 32.0, and that means the left most pixel is at -16.0 and the right most is at 16.0.

After messing a bit I figured out that if I take the [0] value of an identity modelViewProjection matrix and multiply it by 16 I get the depth required to get 1:1 pixels.  I don't know why.  I don't know if the 16 is related to the screen size or just a lucky guess.  But I did a test where I placed a sprite at that calculated depth and varied the FOV through all the valid values and the object stays steady on screen with 1:1 pixels.  So now I'm just calculating the unityDepth that way.

If someone gives me a better answer I'll checkmark it.

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:
UNITY IEnumerator Function I am currently using the IEnumerator function to pause a for loop, in which a ball  should move towards another game object. From my print statements it seems like the ball moves a little, but it's actually never reaching the object and I'm not sure why. I have never used IEnumerator so I'm not sure if this is a part of the issue.

    public IEnumerator CoUpdate(){
    float waitTime = 8;

    yield return new WaitForSeconds (waitTime);

    for (int i = 0; i <= 19; i++) {
        //Finding Game Objects
        numbers = GameObject.FindGameObjectsWithTag ("num");
        ball = GameObject.FindGameObjectWithTag ("ball");
        float step = speed * Time.deltaTime * 2;

        //Picking the random cube
        index = Random.Range (0, numbers.Length);
        pickedNumber = numbers [index];

        print ("number picked");
        print (pickedNumber.name);

        print ("numer postion");
        print (pickedNumber.transform.position);

        //Moving ball to cube
        target = pickedNumber.transform;
        ball.transform.position = Vector3.MoveTowards(transform.position, target.position, step);

        //Checking balls position
        print ("ball Position");
        print (ball.transform.position);

        //Pause here
        print ("PAUSE!");
        yield return new WaitForSeconds (waitTime);

        //Ball Returns to position
        ball.transform.position = new Vector3 (0, 0, 0);
        print ("ball reset");
        print (ball.transform.position);
    }
}

sentences:
remove sudden upward & downward jerk from camera I have a scene with low poly assets & NavMesh enabled for character navigation. When player climbs the bridge there's a sudden upward jerk in camera. Also, when the player comes down, there's a downward jerk in Camera.

I want the camera movement to be smooth so it appears as if the y-axis of the camera is floating like a drone. Below is my script that I'm using

public class FollowCamera : MonoBehaviour {

float MIN_X = -26.72f;
float MAX_X = 34f;
float MIN_Z = -6.22f;
float MAX_Z = 47.6f;
float MAX_Y = 15f;
float MIN_Y = 0.6f;

public float startYPositionOfCamera;

// The target we are following
public Transform target;
// The distance in the x-z plane to the target
public float distance = 10.0f;
// the height we want the camera to be above the target
public float height = 5.0f;
// How much we
public float heightDamping = 2f;
public float rotationDamping = 3.0f;

[AddComponentMenu("Camera-Control/Smooth Follow")]

void Start()
{
    startYPositionOfCamera = transform.position.y;
}

void LateUpdate()
{
    // Early out if we don't have a target
    if (!target) return;

    // Calculate the current rotation angles
    float wantedRotationAngle = target.eulerAngles.y;
    float wantedHeight = target.position.y + height;

    float currentRotationAngle = transform.eulerAngles.y;
    float currentHeight = transform.position.y;

    // Damp the rotation around the y-axis
    currentRotationAngle = Mathf.LerpAngle(currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime);

    // Damp the height
    currentHeight = Mathf.Lerp(currentHeight, wantedHeight, heightDamping * Time.deltaTime);

    // Convert the angle into a rotation
    var currentRotation = Quaternion.Euler(0, currentRotationAngle, 0);

    // Set the position of the camera on the x-z plane to:
    // distance meters behind the target
    transform.position = target.position;
    transform.position -= currentRotation * Vector3.forward * distance;

    // Set the height of the camera
    transform.position = new Vector3(transform.position.x, currentHeight, transform.position.z);

    // Always look at the target
    transform.LookAt(target);

    // Clamp the position of camera so it doesn't go back of mountains
    transform.position = new Vector3(
            Mathf.Clamp(transform.position.x, MIN_X, MAX_X),
            Mathf.Clamp(transform.position.y, MIN_Y, MAX_Y),
            Mathf.Clamp(transform.position.z, MIN_Z, MAX_Z)
        );
}

}

sentences:
How to implement Lua thread for Sleep function I am running into a problem in my game engine right now.
I want to be able to call Sleep(number_of_seconds) from .lua file (1 only) and halt the execution of the lua file, WHILE the game is running and rendering / updating.
When the sleep is done, the .lua file will return execution.
Is this possible?
All the best,
Aldo

p.s.
I guess this can be implemented with C++ <thread>but I couldn't find a solution for now:/

sentences:
How would I move something around inside of a sphere without it going outside of the sphere? I want to be able to do this, but not go outside of the 4.4 meter limit, the radius is 4.4 meters, and it has zero gravity and no friction. I have a hard time explaining this, but imagine holding a hollow sphere with a little ball inside, when you shake it around the ball goes around the inside, I need something like that, but with zero gravity and no friction. I wasn't really sure how to do this, but I tried:

void Slide() {
if (slide) {
    for (uint32_t deviceIndex = 0; deviceIndex < vr::k_unMaxTrackedDeviceCount; deviceIndex++) {
        glm::vec3 position = devicePos[deviceIndex].xyz();
        if (sqrt(pow(position.x - 0.35, 2) + pow(position.y + 1.75, 2) + pow(position.z + 0.85, 2)) >= 4.4) {
            if (abs(position.x) > abs(position.y) && abs(position.x) > abs(position.z)) {
                if (position.x > 0) {
                    velocity.x = ((abs(velocity.y)) + (abs(velocity.z))) / 2;
                }
                else {
                    velocity.x = ((abs(velocity.y) * -1) + (abs(velocity.z) * -1)) / 2;
                }

            }
            if (abs(position.y) > abs(position.x) && abs(position.y) > abs(position.z)) {
                if (position.y > 0) {
                    velocity.y = ((abs(velocity.x)) + (abs(velocity.z))) / 2;
                }
                else {
                    velocity.y = ((abs(velocity.x) * -1) + (abs(velocity.z) * -1)) / 2;
                }

            }
            if (abs(position.z) > abs(position.x) && abs(position.z) > abs(position.y)) {
                if (position.z > 0) {
                    velocity.z = ((abs(velocity.x)) + (abs(velocity.y))) / 2;
                }
                else {
                    velocity.z = ((abs(velocity.x) * -1) + (abs(velocity.y) * -1)) / 2;
                }
            }
        }
    }
}

}

sentences:
How do I render a mirror or other reflective surfaces? I just wondered how to create a mirror within a 3D game?
My suggestion is/was to trace rays, hitting the "mirror" object then drawing a picture of a second cam onto the "mirror" object which is located at the original camera's mirror "point" by using the hit side of the mirror object as mirroring plane.

We would have to use the one ray coming from the center of the original camera to determine the point where the center of the vision is located on the mirror plane.

sentences:
how to detect if a line is crossing another shape in javascript? given the situation here

http://jsfiddle.net/h902cLpy/

is it possible to detect that a line going from A to B does cross another shape while A to C doesn't?

sentences:
NavMeshAgent in Unity giving jerky performance I am using NavMeshAgent in my Unity project to calculate and move my object to a particular location.

When I do:

navMeshAgent.destination = destinationPt

the object starts moving, but the motion of the object is very jerky.

Is there a way to override the function which is responsible for the jerkiness of the object motion? Or is there a way I can remove the jerkiness of the motion some other way?

I also tried setting

navMeshAgent.updatePosition = false

after which I use

navMeshAgent.CalculatePath(destinationPt, path)

to get the path, but then after this I am not able to figure out how to write my own logic to make the object move. I want a smooth motion with a given acceleration and a max velocity.

labels: godot c++ iphone algorithm 2d physics unity c# xna java unity java unity unity rendering xna-4.0 gui unity unity unity javascript unity python textures unity havok java collision-detection xna architecture c# c++ game-mechanics xna unity unity unity textures unity opengl unity opengl xna unity physics directx11 architecture 2d c# spritekit collision-detection 3dsmax spritekit 2d unity opengl unity animation timer unity mathematics monogame c++ unity networking architecture opengl-es2 ai opengl glsl blender unity javascript 2d unity unity opengl opengl opengl mmo opengl unity opengl networking xna c# unity c# xna minecraft-modding opengl unity graphics tilemap user-experience mission-design 3d storyboard 2d unity graphics-programming opengl game-design javascript c# graphics-programming unity levels unity opengl c++ libgdx console unity xna unity libgdx puzzle glsl animation collision-detection unity animation unity unity xna java opengl android unity unity unreal-4 ai unity opengl animation unity physics android iphone unity javascript 2d collision-detection unity 3d opengl xna ios data-structure c# mathematics unreal-4 collision-detection xna-4.0 legal unity collision-detection c# java unity physics xna algorithm networking opengl unreal-4 libgdx sdl2 collision-detection unity unity rotation physics opengl textures mathematics 2d unity opengl unity libgdx xna opengl game-design xna-4.0 lua opengl opengl shaders xna procedural-generation 3d mathematics unity unity unity 3d java c++ ios opengl 3d unity opengl opengl unity unity c++ java unity unity performance c++ opengl c++ c# android turn-based libgdx unity 3d game-design c# 3d unity 2d sprites opengl 2d java unity 3d java data-driven loading c++ movement rotation xna animation sdl2 javascript 3d c# unity c# javascript vertex collision-detection xna c# shaders architecture scripting networking unity xna unity animation mmo unity xna camera unity unity 2d collision-detection java html5 rpg c# 2d legal unity c# unity c++ unity ai android unity android unity 2d unity ai xna opengl collision-detection multiplayer unity xna collision-resolution unity software-engineering unity unity unity game-loop xna-4.0 scripting unity c# 3d unity mathematics android c# c# c++ opengl c++ unity mmo architecture android vertex android sprites algorithm c# steam directx shaders xna java c++ collision-detection unity collision-detection architecture software-engineering collision-detection level-design xna 2d tiles opengl unity unity 2d c++ c# unity c# xna unity android blender algorithm html5 javascript animation unity game-maker 2d crusader-kings-2-modding unreal-4 c++ unity unity c# c# unity unity python graphics python xna c# 3d hlsl algorithm unity libgdx rendering 2d physics unity android unity c# c# opengl game-maker opengl unity unity unity java unity collision-detection c++ game-design xna android android 2d 2d javascript unity xna networking gui 2d collision-detection mathematics graphics physics collision-detection game-maker opengl iphone unity mathematics unity voxels xna textures ios game-loop java unity game-design textures unity c# c++ animation game-design copyright architecture unreal-4 rendering 2d c++ c++ java opengl image shaders unity xna xna opengl javascript xna unity unity unity java xna-4.0 unity unity box2d lua unity java unity unity xna cocos2d game-mechanics physics unity algorithm blender free-to-play java directx unity c# 3d input 2d unity unity shaders unity opengl 2d architecture unity browser-based-games javascript animation collision-detection unity opengl trademark opengl game-design unity game-design javascript java c++ cryengine opengl opengl directx11 ai c# c# particles c++ iphone mathematics game-maker c++ tools unity unity java collision-detection javascript javascript game-maker opengl c++ architecture game-maker unity unity javascript 2d opengl path-finding unity unity opengl physics java textures animation xna unity c++ unity opengl c# movement unity udk networking udk transformation multiplayer mathematics models 2d unity xna-4.0 javascript unity unity xna algorithm minecraft-modding collision-detection c++ unity unity libgdx opengl xna unity libgdx godot 3d mathematics unity c++ unity unity unity java unity mathematics unity c++ xna flash mathematics xna architecture windows unity udk art c# unity c++ actionscript-3 android ios c# xna unity mathematics java motivation java opengl opengl collision-detection collision-detection mobile godot opengl unity android collision-detection c++ directx unity c++ c# iphone java c++ xna java opengl game-industry algorithm hlsl unity javascript unity opengl unity xna unity 3dsmax c# unity unity game-design android architecture ai unity opengl unity 2d legal unity online collision-detection shaders unity animation unity java c++ java android xna cocos2d-x tools hlsl directx unity c++ 2d xna opengl libgdx c++ unity javascript javascript playstation4 unity java java 2d unity unity entity-system c# xna game-design javascript unity flash design-patterns animation c++ cocos2d opengl c# java unity unreal-4 unity animation algorithm c++ java unity unity 3d frame-rate unity mathematics books c++ c++ javascript collision-detection porting mathematics unity game-loop java mouse sdl opengl unity resolution facebook server software-engineering unity unity physics opengl-es unity game-design graphic-effects data-structure camera ios xna android unity platform c++ game-design procedural-generation opengl unity unity sfml 3d c# unity opengl physics unreal-4 box2d game-design nintendo android unity java terminology unity c++ 2d python c++ architecture unity unity actionscript-3 minecraft-modding flash 2d flash unity unity mathematics c++ unity c++ events unity unity python unity graphics-programming unity architecture xna unity c# 2d unity xna game-design opengl 2d unity unity textures windows-phone-7 spritesheet unity opengl networking algorithm opengl server unity java unity c++ c# unity actionscript-3 design-patterns xna c# xna directx javascript c++ unity multiplayer box2d c++ game-design mathematics unity c# lua unity javascript opengl 3d unity unity xna shaders entity-system opengl component-based marketing unity xna c++ unity unity java 3d c++ unity unity unity c++ javascript graphics unity xna android business 3d 2d 3d java c++ unity unity xna unity opengl-es mathematics business textures xna xna-4.0 c++ box2d opengl unreal-4 unity unity unity unity monogame space-partitioning c# flash unity gui html-canvas c++ unity node.js input ios opengl movement mathematics c# c# opengl objective-c opengl physics monogame c# unity movement c++ java java graphic-effects transformation unity actionscript-3 nintendo opengl java game-design xna-4.0 c++ glsl c++ lwjgl unity unity unity 2d opengl random unity maps c++ game-design unity lua xna unreal xna iphone mathematics collision-detection sprites interactive-fiction android mathematics unity cocos2d-iphone opengl unity gpu xna physics unity graphics networking unity 2d unity xna opengl java game-design algorithm android unity game-design 2d unity unity unity camera networking unity matrix procedural-generation unity cocos2d-x-js algorithm rendering opengl opengl c# models c++ udk opengl xna collision-detection c++ unity xna scoring assets 2d unity camera collision-detection flash libgdx android opengl physics unity unity unity c++ c# opengl c++ xna unity unity opengl revenue xna sdl opengl openal architecture unity unity xna unity 2d vsync assets opengl c++ c++ unity unity unity game-design c# c++ c# unity box2d camera opengl minecraft-modding android gui unity shaders 3d blender unity unity java physics architecture unity shaders unity unity python shaders opengl unity game-design unity godot tower-defense terrain maps iphone mathematics ai xna xna unity 2d unity ai geometry ai navmesh opengl unity unity 2d c# c++ unity rotation performance c++ android raytracing architecture unity unity c++ c++ game-design javascript graphics xna architecture unity unity unity shaders rendering unity c++ gdevelop java unity android ai unity xna unity opengl unity 3d 2d c++ unity xna career box2d xna xna unity c++ xna opengl unity xna 2d libgdx unity algorithm opengl unity unity java rpg unity rendering unity unity unreal-4 blender unity java xna unity path-finding opengl unity java java libgdx android unity java opengl legal glsl architecture collision-detection graphics c++ collision-detection textures 3d java game-maker unity opengl unity opengl animation python flash c++ unity 3d-meshes collision-detection unity xna xna side-scroller game-design 3d camera xna unity unity opengl data-structure xna mmo mathematics graphics rendering unity unity unity unity procedural-generation unity sprites entity-system opengl c++ 2d c# opengl windows udk c++ platform 2d unity xna unity unreal-4 art c++ xna unity godot xna optimization c++ c# unity physx unity c++ shaders unreal-4 xna libgdx unity game-design xna unity unity unity java graphics source-engine c# unity unity python c++ unity perlin-noise unity unity c++ unity physics isometric 3d javascript unity html5 unity android phaser procedural-generation 3dsmax java unity libgdx unity c++ c++ game-design c# unity unity shaders unity terminology xna c++ unity 3d c# libgdx unity unity terrain java legal sprites xna unity java unity unity libgdx networking opengl xna shadows unity opengl opengl directx unity unity xna unity unity graphic-effects opengl 2d animation unreal-4 3d models transformation unity java xna-4.0 scripting unity game-design unity libgdx xna c++ game-design 2d game-design textures c++ c++ opengl unity java mathematics networking unity c++ c# algorithm udk unity java opengl unity algorithm unity opengl unity c# sprites 3d-meshes java unity unity unity c# unity path-finding 2d c++ opengl unity opengl xna physics c++ collision-detection camera cocos2d isometric unity performance java unity architecture c# c# 3d xna architecture c# assets algorithm algorithm flash path-finding love2d 2d flash c++ path-finding shaders unity game-design puzzle unity c++ cross-platform 2d javascript c# pygame game-design multiplayer 2d javascript unity tools art udk unity art game-design cocos2d-x shaders unity c++ matrix unity android c++ 3d java android unity unity javascript java opengl opengl procedural-generation libgdx camera unity 3dsmax directx11 models unity collision-detection game-design algorithm c# unreal-4 android unity unity ios unity 3d unity 2d flash unity xna modding java directx iphone unity libgdx animation phaser ai collision-detection html5 game-design 2d legal terrain opengl xna legal opengl normals c++ c++ java java unity opengl java c++ graphics javascript c# unity networking unity game-design steam networking modding opengl ai unity path-finding javascript 2d maps multithreading c# unity unity 3d hardware c++ xna xna tiles shaders android libgdx algorithm mathematics shaders minecraft-modding godot hlsl c++ xna unity unity xna unity operating-system java actionscript-3 xna window-management html5 libgdx cocos2d-iphone unity algorithm pygame java art java xna 3d collision-detection unreal-4 unity entity-system 2d 2d xna xna c++ c# flash teamwork graphics unity collision-resolution python unity unity java box2d unity 2d c# unreal-4 c# game-maker unity xna android xna 2d unity procedural-generation libgdx xna 3d game-design unity unity libgdx unity c++ 3d unity opengl-es physics unity unity unity unity opengl movement unity shaders opengl-es2 xna xna game-design architecture unity music procedural-generation networking mathematics c++ unity collision-detection 2d unity collision-detection udk testing unity android mathematics multiplayer physics 2d collision-detection xna unity java architecture c++ ai opengl shaders java audio unity opengl unity c++ c# android iphone game-design shaders directx unity mmo unity magicavoxel c# materials minecraft-modding unity unity game-design unity unity unity unity unity java rendering legal unity opengl opengl-es2 unity php c# modding directx game-maker 2d unity xna unreal unity racing animation javascript unity camera unity opengl architecture android minecraft-modding libgdx game-design game-loop path-finding flash unity java unity path-finding networking architecture c++ xna xna mesh animation path-finding libgdx twine c++ android javascript unity culling game-design unity java 2d unity unity unity unity unity unity unity textures unity xna mysql javascript directx11 java c++ java game-mechanics c++ mathematics android rendering unity slick 2d 2d glsl opengl unity game-design unity unity software-engineering animation unity c++ unity unity javascript unity unity game-design c++ javascript xna rendering camera ai unity 3d c# unity input opengl procedural-generation vector unity c++ assets libgdx mathematics android unity libgdx c# projection java unity c# opengl libgdx xna unity c++ unity unity unity projectile-physics animation unity shaders c++ xna performance udk c# unity graphics unity unity mathematics unity xna libgdx unity unreal-4 opengl android libgdx opengl opengl java unity java entity-system rpg unity unity unity opengl javascript game-maker python directx sfml libgdx javascript opengl unity android unity xna unity c++ 2d unity unity legal javascript algorithm python software-engineering unity opengl unity 2d unity java java python performance 2d java unity unity 3d 3d unity shaders unity software-engineering opengl java unity unity architecture ai opengl physics physics java 3d opengl java unity unity game-loop c# unity javascript networking c# opengl 2d unity 3d movement libgdx opengl unity html5 game-design collision-detection unity legal entity-system unity game-design browser-based-games animation sdl2 uv-mapping physics unity game-design physics java mathematics ios unity android shaders java c++ python unity ios android simulations unity c++ android unity unity unity libgdx xna architecture c++ xna textures rotation unity unity unity javascript java c++ java unity c# textures c# xna libgdx unity c++ xna 3d c++ java unity architecture opengl opengl lighting software-engineering android unity networking unity unity movement 3d rigging xna allegro opengl unity video textures unity unity c# unity c# lighting animation unity php unity javascript unity legal camera java unity textures c# bullet-physics unity textures unity opengl opengl 2d unity rotation unity unity unity textures c# unity android vector unity character 2d c++ game-loop leaderboards xna software-engineering 3d directx opengl unity unity xna shaders unity opengl opengl cocos2d-iphone java 2d textures lighting opengl architecture unity unity unity java client-server unity opengl xna unity 2d udk unity opengl glsl collision-detection video unity game-design opengl flash unity c++ unity networking unity rendering c++ game-maker c++ javascript c++ camera xna unity shaders xna android isometric project-management xna xna 3d mathematics c++ libgdx c# javascript xna unity havok mathematics unity opengl libgdx opengl java opengl javascript opengl unity java c++ c++ opengl graphics java unity mathematics c++ unity physics hlsl opengl java libgdx c++ c# physics vector unity collision-resolution opengl ios pipeline lighting c# unity animation c++ terminology javascript collision-detection unity textures 2d unity unity unity xna javascript c# frame-rate unity collision-detection interpolation c++ algorithm glsl entity-system java game-design unity unity shaders 2d 2d animation scripting unity xna networking uv-mapping unity opengl physics directx tools textures unity unity camera opengl networking ogre multiplayer opengl python c++ game-design unity patching lighting physics mathematics software-rendering unity unity java 2d unity cocos2d-iphone software-engineering shaders libgdx unity c++ opengl unity c++ social unity unity game-design textures unity mathematics hlsl tilemap java unity directx9 voxels unity unity c++ c# game-maker simulations 3d unity unity shaders sdl2 opengl shaders testing libgdx opengl 2d android c++ architecture unity opengl opengl xna unity collision-detection c# game-design java android libgdx savegame unity animation movement input collision-detection unity lighting unity c# 3d unity unity opengl c# opengl android libgdx c# simulations c# unity java linear-algebra 3d steam unity unity java geometry sprites opengl-es networking opengl opengl java c# animation unity unity unity physics python c++ unity java unity unity actionscript-3 architecture xna textures unity matrix rotation shaders ogre javascript client-server libgdx opengl unity c++ java skeletal-animation unity 3d unity java c# unity unity opengl c++ unity unity 2d c++ 2d mathematics unity mathematics monogame mathematics opengl xna directx performance c# unity opengl unity godot directx unity java unity unity google-play-services unity collision-detection iphone xna c++ unity mathematics xna libgdx linux simulations collision-detection 2d 2d architecture opengl-es marketing xna game-design component-based networking textures directx unity java shaders rendering android opengl java unity java unity c++ java unity unity unity xna c# xna c++ graphics xna unity unity unity android directx opengl libgdx cocos2d c++ c++ unity android opengl opengl libgdx collision-detection c++ unity unity opengl vector opengl 3d java libgdx leaderboards unity xna movement unity game-industry opengl opengl rotation xna c# mmo unity vector xna opengl libgdx unity unity textures java c++ game-maker libgdx flash 2d puzzle unity c++ unity c++ unity ai collision-detection opengl unity unity c++ opengl-es2 2d skeletal-animation normal-mapping xna java models vertex textures c++ unity unity unity unity unity unity unity unity 2d unity design-patterns legal 2d c++ ai c# java libgdx 2d java unity architecture game-design sdl2 3d-meshes xna unity unity android controllers android unity graphics godot unity shaders unity textures unity c++ textures c# xna 3d assets web architecture projectile-physics unity directx11 opengl 2d camera opengl android mathematics architecture interpolation graphics game-design textures opengl unity opengl game-design opengl 2d android unity 3d java starcraft-2 unity c++ unity education python unity unreal-4 multithreading 2d opengl algorithm physics graphics xna unity shaders python unity physics game-maker java c# movement unity unity testing physics design-patterns c# algorithm entity-system unity mathematics directx shaders css lwjgl data-structure c++ android networking c# c++ xna directx maya animation 3d modding opengl xna javascript c++ unity unity java models c++ unity unity libgdx unity html5 2d game-design c# shaders algorithm unity unity c# android textures javascript c# performance unity 2d unity unity xna unity 3dsmax software-engineering xna xna rpg animation game-design algorithm java maps game-design tiles unity game-mechanics html5 directx unity unity shaders lwjgl 3d entity-system xna unity unity c# c++ mathematics opengl collision-detection opengl java xna c++ unity unity unity animation unity opengl planning 2d education collision-detection lighting unity c++ sound udk physics unity unity unity rpg opengl iphone unity java c# c# unity 3d android algorithm unity opengl unity unity game-maker physics movement android libgdx blender ai animation python 3d c++ browser-based-games c++ opengl unity opengl opengl unity unity 2d 3d-meshes c++ game-design collision-detection materials unity game-design multiplayer algorithm xna unity sprites architecture unity algorithm unity c++ opengl ai unity monogame box2d unreal-4 game-design networking xna java textures collision-detection character unity unity c++ unity unity unity game-design directx python java xna game-loop mathematics unity ai xna unity unity unity rotation c++ rendering unity ai opengl-es c# physics-engine graphics java scripting game-design terminology shaders unity design-patterns physx xna vector xna flash unity unity unity game-center iphone unity unity c++ xna opengl 2d unity java unity mmo unity opengl c++ unity unity unity unity c++ java unity xna 2d unity flash unity android unreal-4 unity unity shaders unity unity animation rendering unity game-mechanics unity c++ unity unity unity 2d java performance legal c# game-design animation java cocos2d-x c# unity opengl c++ c# unity random opengl 2d xna unity architecture opengl game-industry opengl unity unity unity game-industry xna keyboard 3d networking mathematics unity unity c# xna opengl physics unity 2d unity music unity opengl opengl xna c# unity physics javascript c# 2d first-person-shooter c# iphone tools game-design c# unity path-finding 2d c# savegame collision-detection c# 2d 2d game-maker glsl c# ogre c++ java directx11 unity c++ unity unity javascript opengl c++ legal unity xna unity java opengl java 2d 2d xna cocos2d-iphone shaders directx11 unity actionscript-3 unity c# 2d game-industry physics flash graphics collision-detection xna unity unity android opengl xna java unity unity andengine opengl unity collision-detection c# directx c++ unity xna mathematics game-design c# ai ios mathematics open-source platformer unity unity unity unity sprites unity android unity game-design unity mobile unity unity directx c# xna android unity java html5 opengl collision-detection c++ unity unity mathematics unity c++ flash mmo c# camera 3d c++ unity c# unity 2d opengl android animation 3d facebook c++ android mathematics unity shaders windows c# textures c# game-design c++ unity game-state unity c# networking unity unity xna rendering mathematics game-maker camera android 3d networking unity c# 2d algorithm java c++ mmo libgdx unity opengl multiplayer unity mathematics c++ opengl unity java character collision-detection collision-detection android animation javascript algorithm opengl unity sdl opengl 3d unity c# graphics c# game-design game-design mathematics game-design multiplayer c++ opengl maps c++ directx unity xna libgdx unity c++ phaser c# text-based c++ tiles torque-x opengl unity unreal java textures c++ c++ algorithm unity legal mobile game-mechanics android unity opengl unity 2d android depth-buffer unity unity ios architecture unity physics c++ java 3d unity xna unity c++ textures unity c# opengl corona-sdk scripting opengl unity unity c++ opengl c++ architecture algorithm rendering c++ opengl algorithm rendering opengl directx11 libgdx collision-detection c++ xna graphics-design directx unity maya godot libgdx opengl opengl html5 unity 2d c++ opengl c# unity 2d 2d opengl unity browser-based-games collision-detection c++ maps physics c# opengl unity sprites c++ opengl unity game-design 2d models physics java 3d unity physics c++ java c++ unity c++ unity xna unity opengl libgdx unity shaders linux unity unity models terrain libgdx unity software-engineering graphics godot movement mobile libgdx libgdx collision-detection mathematics unity android opengl c++ xna unity unity software-engineering game-maker textures textures random unity 2d unity procedural-generation 2d unity unity opengl animation c++ movement 2d c++ 2d unity c++ unity java algorithm 2d java unity unreal-4 algorithm textures networking mathematics flash unity android java 2d java c++ c++ unity c# art ai javascript c++ procedural-generation c# architecture xna algorithm shaders unity 2d java unity c++ unity xna unity javascript rpg 2d lua unity windows unity c# ios java algorithm unity entity-system unity java c++ unity collision-detection c++ signed-distance-field unity unity android c# xna c# iphone gui c# 3d c++ directx11 unity c# unity directx unity c++ opengl three.js physics opengl unity animation tessellation android sdl2 c++ opengl unity unity fsm java directx unity game-design sprites unity unity unity 2d opengl android java matrix c++ algorithm rendering opengl android unity unity c game-design unity localization unity rendering opengl java unreal unity c++ torque unity mathematics unity unity android shaders java directx11 xna client-server pico-8 unity xna c++ geometry directx java unity unity android unity 2d spritebatch unity video unity xna xna cocos2d-iphone iphone c# collision-detection mmo unity c++ vector java unity unity python c# c++ c++ normals movement 2d game-mechanics xna c++ rotation xna graphics-programming unity unity mathematics java xna algorithm unity iphone c++ unity data-driven java c++ libgdx tiles unity unity shaders 2d xna c# networking xna ai path-finding 2d c++ scoring lighting collision-detection unity unity opengl unity xna unityscript lighting opengl unity opengl project-management xna unity mathematics unity unity cocos2d-iphone performance c++ c++ unity directx opengl love2d game-design unity unity unity opengl advertisements unreal-4 unity c++ graphics scripting unity libgdx libgdx architecture unity c++ unity java unity 3d game-design opengl c++ xna unity java textures c++ opengl rendering unity unity unity rendering architecture javascript unity ios unity ios xna java c# c++ game-mechanics occlusion libgdx c++ input unity particles c++ xna mobile c# path-finding xna unity monetization opengl adventure-games box2d unity algorithm libgdx c++ 3dsmax graphics unity java unity directx textures 2d unity javascript libgdx lua opengl unity unity c# c# ai 2d software-engineering android vector opengl collision-detection graphics unity c# unity unity unity software-engineering unity c# opengl animation unity sprites animation mathematics opengl unity unity shaders xna algorithm javascript unreal-4 c++ xna unity unity directx c++ mathematics opengl opengl shaders ios unity path-finding c++ xna networking unity c++ unity c++ java unity c++ unity terminology c++ networking hlsl java mathematics textures unity libgdx business-model sharpdx unity matrix javascript game-design unity physics collision-detection unity rotation browser-based-games unity opengl xna opengl c# xna path-finding multithreading unity java spritesheet unity cocos2d-iphone game-design 2d animation android mathematics xna unity xna c++ godot video c++ xna directx music animation collision-detection c# 2d unreal-4 java process opentk c++ game-design mathematics opengl unity opengl libgdx movement unity minecraft-modding mobile directx unity ios architecture android android 3d physics unity unity tiles c++ javascript opengl unity physx assets shaders unity algorithm opengl collision-detection physics unity udk c++ c++ java xna c++ java tools input sprites blender opengl-es2 game-loop unity mathematics opengl opengl opengl java 3d music multiplayer c++ opengl c++ opengl unity c# java unity unity education unity unity unity software-engineering java unity 2d xna opengl c# assets java unity gui unity c++ c++ unity unity c++ textures unity c# unity c# graphics c++ opengl opengl xna unity textures unity mathematics algorithm libgdx unity c# java android textures 2d unity mathematics multiplayer unity opengl 2d opengl-es game-design architecture xna unity c++ mathematics opengl unity opengl unity movement shaders unity unity xna c++ assimp xna java unity unity java unity textures sprites c# game-design directx rendering xna 2d opengl unity xna opengl collision-detection opengl directx11 unity 3d javascript c++ opengl opengl unity xna libgdx mathematics unity unity javascript python rotation java c++ game-design java mathematics mathematics unity unity xna c# javascript android c++ hlsl unity opengl unity python unity unity unity bullet-physics xna 3d opengl unreal-4 graphics game-industry javascript unity opengl 3d unity xna unity shaders unity collision-detection libgdx unity unity unity unity c# javascript platform 3d collision-detection java unity html5 3d-meshes unity c# trailer unity java physics unity unity unity modding unity game-design opengl textures networking ai unity ios unity spritekit shaders unity textures unity assets game-design java first-person-shooter legal xna physics physics installer c# unity unity community-management c++ 2d unity opengl unity java opengl javascript interpolation editors 3dsmax android unity android unity texture-atlas shaders software-engineering c# opengl unity unity java collision-detection mathematics opengl unity xna unity collision-detection multiplayer sprites xna opengl java algorithm unity box2d opengl c++ xna maya xna directx9 c# c++ ios game-design game-mechanics multithreading javascript glsl c++ mathematics c++ unity mmo unity glsl graphic-effects scale unity text-based directx11 unity java opengl unity box2d c++ unity unity collision-detection 2d game-design animation unity networking android unity opengl unity ruby 3d xna unity libgdx architecture unity java particles lua legal ai google-play terrain-rendering path-finding c# graphics xna architecture unity unity shaders 2d character racing c++ c++ unity cocos2d-iphone unity unity c# game-design iphone xna mathematics isometric unity blender game-design c++ ai javascript licensing 2d unity java 2d c++ unity unity image 2d unity storage 2d game-design c# unity java unity server c# c++ corona-sdk architecture javascript physics unity 3d unity unity ai unity c++ rendering opengl algorithm projection unity unity path-finding xna physics unity unity algorithm animation savegame unity mathematics c++ game-design 2d c# minecraft-modding unity opengl unity unity matrix networking unity unity c++ unity rendering unity opengl 2d shaders unity algorithm opengl unity component-based java unity mathematics game-design game-design python c++ procedural-generation lighting unity opengl algorithm libgdx vulkan unity unity 2d android java unity geometry unity unity java unity unity c# graphics c# c++ iphone unity unity unity java xna physics unity opengl java game-maker xna unity ios projectile-physics unity unity opengl libgdx javascript image networking architecture python directx android entity-component xna 2d game-design game-maker multiplayer unity 2d javascript xna unity terrain c++ game-design unity unity camera c++ ranking xna unity animation pygame unity unity graphics 2d game-maker javascript unity unity unity java graphics optimization unity javascript directx11 opengl unity game-design c libgdx c++ c++ unity path-finding xna unity opengl c++ unity c# 3dsmax android unity unity c++ unity security 2d java xna graphics opengl xna unity sprites lighting ai c++ unity unity c# xna unity java python c++ c# unity unity 2d java camera game-design opengl c++ textures unity java opengl java unity directx algorithm legal opengl unity unity unity unity networking unity unity algorithm java javascript libgdx unity unity game-design mathematics architecture opengl c++ sprites unity xna java unity cloud-computing 3d opengl unity opengl opengl unity unity unity unity opengl xna mmo procedural-generation tilemap game-mechanics unity android opengl unity xna unity c++ unreal-4 c++ opengl grid software-engineering flash xna animation unity file opengl c++ textures java game-mechanics game-design libgdx collision-detection opengl java unity unity game-design unity unity xna unity vertex unreal-4 java unity architecture 3d xna unity c++ version-control unity graphics-programming unity c++ graphic-effects algorithm legal shaders tilemap c++ unity shaders c# physics blender unity unity unity 2d 2d architecture collision-resolution sprites mathematics unity xna opengl 2d c++ xna methodology collision-detection unity c# c# parallax-scrolling xna opengl opengl xna shaders 2d rotation multithreading textures mmo android android architecture android unity blender entity-system geometry c++ graphics java unity xna physics lua opengl architecture java unity textures opengl unity ios iphone 3d unity-webgl unity ios opengl opengl directx opengl-es 3d xna lighting c++ unity unity facebook xna libgdx javascript 2d materials android terrain-rendering c++ unity libgdx c++ actionscript-3 shaders entity-system unity xna hlsl unity procedural-generation opengl collision-detection unreal spritekit procedural-generation java java opengl unity unity unity cross-platform publishing javascript opengl terrain unity unity game-mechanics java unity animation unity unity unity xna unity opengl-es opengl sprites unity 2d java c++ jobs c# xna culling game-design shaders android software-engineering java blender ai audio unity box2d libgdx mathematics unity xna architecture javascript ai shaders shaders java xna levels c++ quaternion open-source unity c# 2d camera graphics opengl javascript android unity c# flash architecture art opengl opengl xna unity 2d html5 unity unity c# optimization algorithm unity xna xna component-based c++ pixel-art unity cocos2d-iphone c# browser-based-games xna ai shaders textures opengl c# javascript unity xna 3d xna javascript xna game-design 2d libgdx physics javascript c++ unity unity unity mathematics c++ unity cross-platform unity unity text-based android unity unreal-4 android c++ multiplayer entity-system unity collision-detection procedural-generation opengl unity unity multiplayer google-play unity godot c++ matrix xna c++ android 3d models java unity mathematics unity xna 2d scripting unity xna collision-detection opengl sprites libgdx unity unreal-4 ios graphics box2d libgdx raycasting c++ copyright game-design blender unity opengl algorithm unity unity unity collision-detection java unity unity opengl java javascript opengl software-engineering lighting unity unity unity unity unity java opengl java 2d collision-detection opengl c++ unity ai graphics c++ game-design unity libgdx javascript java linear-algebra 3d unity xna opengl unreal-4 unity opengl rendering mathematics unity collision-detection statistics unity unity software-engineering unity directx9 unity data-structure marketing libgdx libgdx javascript unity assets unity algorithm unity unity sdl2 mathematics 2d unity opengl-es collision-resolution unity hardware mathematics unity mathematics unity color xna unity xna c++ c# sprites ios loading unity xna quaternion collision-detection c# java opengl procedural-generation unity mathematics c++ unity algorithm c++ opengl loading opengl xna software-engineering andengine textures education flash unity unity javascript opengl xna java opengl opengl c++ unity 2d java game-mechanics c# opengl java algorithm javascript opengl java unity collision-detection mathematics java xna unity xna open-source unity unity unity camera unity xna unity architecture opengl opengl xna lighting c++ unity optimization android unity c++ graphics ios android opengl c++ mathematics java xna android vector c# path unity opengl unity java 3d architecture game-industry unity opengl collision-detection algorithm unity xna go unity unity java java opengl game-maker rotation html5 unity opengl unity unity shaders animation unity c++ opengl android unity opengl-es java game-design c# lua c# unity xna c++ unity xna c# c# unity opengl c++ game-design unity cocos2d-iphone unity xna javascript unity collision-detection c++ unity architecture unity opengl java c# android game-loop xna unity unity c# physics interface directx11 android unity procedural-generation game-design unity procedural-generation unity xna client-server unity networking 2d unity unity unity unity ios opengl c# c iphone opengl unreal-4 libgdx tiled javascript xna 2d mathematics unity 3d xna glm xna algorithm unity lighting unity java 3d opengl unity jmonkeyengine c# game-design c# c# unity unity matrix game-design physics unity c++ unity game-design unity copyright physics raycasting unity graphics monogame android textures xna unity physics opengl javascript unity unity opengl java game-design android unity monogame java xna c# c# shaders collision-detection shaders audio unity collision-detection android unity legal c# flash unity java xna xna collision-detection unity xna ios unity 2d camera unity unity unity jquery unity sharpdx minecraft-modding algorithm textures c# unity splines c# lighting maps opengl separating-axis-theorem unity mathematics flash c# unreal-4 c++ unity javascript unity 3d c++ unity xna multiplayer xna c++ keyboard interface component-based javascript xna game-design xna-4.0 c# unreal c++ opengl libgdx unity unity unity game-design opengl unity c# assets unity cocos2d-iphone opengl c# javascript game-mechanics unity multiplayer xna unity java javascript c++ android path-finding android opengl 2d business java opengl-es 2d mobile directx9 path-finding xna c# unity opengl unity game-design maps xna java pygame xna monogame libgdx unity screen algorithm xna-4.0 graphics 3d collision-detection opengl javascript c++ mathematics java collision-detection c++ vulkan opengl unity c++ animation unity animation opengl mathematics mathematics unity xna unity opengl game-design legal 2d lua c++ 2d unity xna collision-detection unity maps unity python javascript opengl unity directx11 shaders unity unity animation java unity rotation 3d unity opengl trademark c++ game-design game-maker unity unity xna unity 2d game-design animation hardware unity c# blender directx11 3d ai graphics xna-4.0 jmonkeyengine xna opengl java server server opengl-es libgdx unity 2d unity unity java shaders unity unity shadows legal collision-detection 3d 2d xna browser-based-games xna c# procedural-generation opengl java unity monogame unity c# libgdx depth-buffer c++ c++ collision-detection c++ javascript unity c++ physics unity android unity unity unity tools graphics projectile-physics unit-testing architecture opengl c# collision-detection 2d game-design unity android controllers 2d c++ ios xna unity 3d flash xna 2d c# networking rpg unity java game-design blender unity android directx 2d opengl shaders unity camera collision-detection xna directx c# collision-detection sdl cocos2d-x unity c# 3d xna quaternion unity unity opengl tiles unity unity opengl java c# 2d opengl gui opengl 3d android unity unreal graphics opengl libgdx unity game-mechanics c++ opengl html5 android ios android opengl deferred-rendering unity game-design c++ unity opengl opengl iphone unity unity unity java tools assets c++ 2d directx11 unity web vector udk architecture opengl 2d opengl xna google-play ai directx11 unity input music shaders 2d java unity c++ javascript opengl directx directx9 mmo animation unity java procedural-generation python collision-detection animation xna unity c# c++ unity unity awesomium shaders rts unity algorithm directx11 unity unity physics directx directx unity unity unity box2d unity rendering textures software-engineering libgdx opengl unity 2d windows java unity algorithm unity unity javascript unity unity unity opengl game-mechanics cocos2d-x vector unity unity unity java unity xna unity java special-effects animation javascript unity unity javascript objective-c java opengl unity libgdx c# unity xna 3d xna minecraft-modding unity optimization c++ camera unity unity compatibility physics unity opengl events unity c++ c ai graphics unity camera unity multiplayer libgdx unity level-design windows java java unity unity game-design unity unity architecture opengl procedural-generation java modding ai transformation java physics unity procedural-generation c++ 2d cocos2d-x opengl xna unity mathematics mathematics unity unity unity box2d c++ libgdx unity unity unity minecraft-modding game-design c# opengl libgdx monogame c# unity iphone unity animation path-finding c# java animation opengl python networking xna xna opengl libgdx unity multiplayer unity libgdx game-design unity directx libgdx libgdx unity unity 2d opengl unity architecture geometry unity lighting tiles marketing hlsl c++ c# c++ strategy collision-detection 2d 2d java unity unity android 3d tiles game-design ai xna opengl mathematics graphics objective-c libgdx music unity game-design libgdx xna xna 2d c# xna-4.0 c++ animation html5 architecture algorithm libgdx unity java unity legal unity server xna animation opengl iphone java rendering game-maker unity unity unity algorithm unity unity unity unity algorithm unity shaders multiplayer resource-management mmo c++ unity collision-detection unity xna unity directx architecture c++ shaders unity opengl xna c++ unity c# mmo c++ java opengl unity animation unity gui path-finding copyright color c++ unity 3d collision-detection python 3d platformer unity performance sprites game-design unity unity java xna algorithm networking bullet-physics unity c++ multiplayer unity models unity textures opengl algorithm xna unity directx design-patterns 2d unity rendering rpg godot game-design 3d c++ java javascript libgdx c# physics unity unity unity graphics unity unity opengl collision-detection collision-detection iphone unity monogame opengl c# unreal-4 android 2d opengl collision-detection mesh c++ server opentk unity unity c# software-engineering android physics 3d unity collision-resolution gui javascript 3d libgdx unreal-4 ai c++ android 2d android matchmaking multiplayer 2d architecture box2d java ios textures unity xna mathematics android game-design windows unity xna opengl c++ c++ unity unity unity unity unity animation libgdx game-maker animation game-design directx html5 mathematics 3d mathematics opengl camera tilemap sprites c++ java javascript c++ 3d multiplayer libgdx c# unity camera opengl textures c++ game-design android unity unity rigidbody c++ opengl android box2d c# libgdx algorithm unreal-4 unity image c# unity unity animation c++ ai 3d opengl c++ game-design javascript tiles 2d rotation 2d android 2d java xna c++ game-design opengl opengl unity geometry unity unity unity unity unity opengl unity game-design c++ software-engineering shadows tiles opengl opengl 2d opengl-es physics game-design javascript 2d java software-engineering unity unity path-finding sound c++ c# 3d unity opengl java unity game-design game-design unity collision-detection unity unity unity c++ physics xna c++ c# libgdx opengl unity physics touch unity 2d java xna unity unity c# android monogame directx11 iphone unity javascript shaders unity opengl unity game-design analytics 3d terrain-rendering collision-detection unity shaders udk javascript xna opengl java raycasting 3d-meshes xna unity c++ iphone unity graphics software-engineering unity unity java java javascript unity libgdx graphics 3d opengl opengl andengine mathematics rendering hlsl 3d monogame project-management unity opengl libgdx unity opengl game-mechanics unity java c++ opengl unity xna opengl networking unity java c++ xna xna unity unity c# c# 2d unity opengl xna javascript movement unity data-structure c# c++ unity game-design xna 2d game-design rotation animation cross-platform c# sdl2 textures java game-design unity sprites unity c++ unity c# opengl xna collision-detection c++ unity java java xna opengl 2d glsl unity architecture android c# flash c++ unity mathematics c++ networking android rendering unity unity opengl graphics unity unity legal c# xna 3d java unity sound game-design directx data-structure camera c++ c# animation c++ java unity physics c# c++ rendering roguelikes opengl shaders opengl 2d javascript unity networking c++ unity rpg-maker godot graphics trigonometry c# unity ai 3d unity libgdx c++ game-design camera html5 unity graphics xna java unity 2d unity mathematics 3d unity c++ unity unity java physics shaders c# java 2d unity textures java c++ opengl unity collision-detection unity unity unity unity opengl rpg-maker-vx unity 3d unity physics game-design xna python cocos2d-iphone opengl unity architecture physics unity unity unity rendering java algorithm xna-4.0 opengl java unity unity irrlicht unity xna unity c++ unity c# java networking c++ architecture c++ c# java multiplayer textures 2d unity directx ai unity xna unity mathematics opengl client-server directx11 unity opengl game-design java c# procedural-generation collision-detection opengl animation directx11 android raytracing opengl unity physics java opengl unity opengl python mmo networking opengl-es opengl unity client-server ogre opengl javascript opengl game-design legal ai unity 3d android marketing networking unity unity 2d unity architecture unity java c++ c# marketing raycasting graphics rotation c++ opengl-es 2d 3d xna c++ algorithm state opengl architecture java 2d xna unreal-4 3d unity unity opengl c++ c# unity algorithm anti-cheat unity opengl unity unity java ios sdl2 unity xna unity architecture online game-design unity java java unity android ios game-maker world-of-warcraft-modding 2d ios unity opengl-es unity shaders unity game-design unity unity xna c# opengl unity algorithm path-finding game-maker shaders mathematics unity geometry panda3d tilemap opengl unity unity android c# unity architecture unity procedural-generation scripting directx9 collision-detection unity c++ opengl rendering unity unity flash unity procedural-generation unity unity xna unity ai unity libgdx c++ game-mechanics unity steering-behaviors libgdx user-experience c# education modding c++ animation unity opengl unity opengl procedural-generation xna ios unity grid opengl-es vsync configuration game-maker xna javascript c# unity android libgdx ai books c# xna mmo geometry unity design-patterns performance clipping unity unity collision-detection scripting c++ unity networking level-design c++ 2d opengl rendering c++ unity unity unity unity 2d legal iphone game-design directx first-person-shooter directx box2d unity tilemap unity 2d java java ai c++ xna c++ c# unity unity unity android unity cocos2d-iphone java c++ xna unity unreal-4 unity unity flash opengl ogre unity android unity source-code opengl directx java shaders rendering c++ xna c# design-patterns xna-4.0 unity opengl c++ 2d unity unity opengl architecture xna mathematics c# unreal-4 java networking movement xna xna 3d c++ game-design unity component-based animation unity xna-4.0 physics game-design libgdx javascript sdl javascript networking unity 2d collision-detection tools c++ unreal-4 unity filesystem game-design physics unity 2d unity xna c++ box2d unity animation c++ c++ mathematics c++ opengl mathematics unity opengl 2d mathematics directx algorithm java mathematics design-patterns opengl android opengl opengl unity unity networking opengl ios unity c++ c++ unity maps java animation actionscript-3 terminology mathematics xna physics 2d fixed-timestep hexagonal-grid unity unity unity opengl directx opengl c++ opengl game-design unity c++ libgdx libgdx c++ opengl jmonkeyengine unity c++ unity ai unity unity blender c# opengl unity libgdx collision-detection collision-detection unity unity opengl unity unity unity java legal opengl opengl unity unity unity shaders projection shaders unity iphone physics arma3 c# java unity unity unity sprites unity physics rendering javascript unity camera 2d 2d unity directx c# android camera opengl xna xna pygame input unity physics c++ java c# unity opengl collision-detection game-loop cocos2d-iphone 2d java c++ unity unityscript 2d unity unity server c# c++ architecture c++ c# architecture directx unity ui-design rendering unity client-server unity java game-design cocos2d-x unity unity browser-based-games opengl libgdx rendering xna unity data-structure web 3d c++ unity unity 2d xbox360 animation unity mmo javascript physics sprites android unity unity algorithm libgdx c# opengl unity xna unity unity glut collision-detection opengl 2d game-design python xna sprites game-design architecture animation piracy c++ opengl architecture graphic-effects xna unity 3d-meshes appstore xna-4.0 c# java opengl unity unity c++ unity unity unity c++ 2d c++ xna java game-design 2d opengl opengl architecture unity xna game-industry unity c++ xna 2d java unity physics unity android unity unity c++ c++ unity shaders unity unity unity architecture xna textures state opengl unity unity textures unity opengl architecture game-design entity-system 2d unity ios roblox python path-finding networking unity file mathematics unity unity assets terrain-rendering android sound gpu opengl 2d android java directx godot libgdx android cocos2d mathematics unity c# 2d java java iphone c++ collision-detection unity c++ unity unity 3d opengl unity unity unity game-maker unity physics c++ java unity lighting glsl unity box2d unity unity c# lua collision-detection unity box2d animation c# unity java android models game-design tilemap vector ios libgdx java software-engineering mathematics c# java unity rendering opengl unity unity unity opengl unity unity libgdx animation unity path-finding android unity procedural-generation unity multiplayer javascript unity game-design unity 3d opengl career opengl game-mechanics difficulty lighting legal unity cocos2d ai unity ai textures shaders directx11 water java unity java rope-physics algorithm level-design ios javascript xna unity unreal-4 xna glsl architecture java box2d xna unity c# java graphics unity java xna nintendo sdl2 node.js opengl unity textures unity javascript unity algorithm collision-detection unity unity java unity textures unity opengl xna unreal xna java architecture unity physics unity opengl architecture animation unity unity entity-system frame-rate unity opengl unity libgdx art c# opengl java unity c# opengl javascript xna ios java unity unity unity unity c++ optimization 3d game-maker opengl unity software-engineering javascript ai shaders android unity 2d unity c++ obj javascript unity c++ c++ unity java unity unity c++ c++ unity c++ game-design lighting java 2d unity unity c# flash xna xna libgdx camera unity education blender unity physics unity c# algorithm java c++ sponza steam unity game-maker graphics directx algorithm c++ xna mmo c++ unity c# collision-detection collision-detection architecture path-finding c# unity unity opengl-es game-design unity javascript unity random flash modding game-design android unity level-of-detail unity xna android c++ 2d unity sfml c# unity unity c++ c++ unity flash animation graphics unity libgdx unity libgdx opengl animation libgdx unity java unity 2d unity java 3d networking android opengl unity 2d 3d unity xna terminology networking opengl java game-design networking c# c++ xna algorithm java movement libgdx models graphics c++ cocos2d-iphone javascript java 2d collision-detection unity path-finding collision-detection unity unity directx11 android game-design terminology python opengl steam maps architecture mobile unity voxels c# collision-detection graphics opengl software-engineering c++ c# xna optimization unity windows opengl xna opengl 2d c++ haxe godot unity unity unity c++ unity c++ unity unity unity html5 unity unity unity networking c# vector path-finding 2d android directx java directx game-design xna xna box2d unity game-design 2d collision-detection unity unity movement unity video unity c# directx 2d c++ libgdx unity unity cocos2d-x c++ unreal-4 collision-detection camera unreal-4 unreal-4 xna ai mathematics client-server 3d unity directx11 unity unity html5 xna networking animation unity unity xna android unity rotation movement events game-design opengl 2d physics c++ glsl xna android java c# 2d xna unity xna-4.0 android physics unity collision-detection unity xna c++ unity shaders game-mechanics unity android unity mmo opengl c++ java c# unity opengl-es python 2d c++ opengl unity iphone software-engineering ai java unity xna android physics unreal-4 unity models unity collision-detection 2d unity mathematics networking libgdx xna unity libgdx javascript collision-detection mathematics unity game-design tilemap android sql mathematics c# c# unity 2d sprites unity algorithm phaser c++ opengl physics unity procedural-generation collision-detection 3d java unity unity unity quaternion c++ unity opengl java c# 2d unity unity unity c# libgdx rendering quaternion java libgdx unity algorithm physics unity glsl architecture steam unity unity voxels unity rpg scripting mathematics game-maker c# opengl opengl unity audio unity unity kinect multiplayer xna c# skeletal-animation unity unity software-engineering unity android unity c++ unity rendering art c++ unity unity unity lua minecraft-modding multiplayer animation directx11 iphone unity graphics xna c++ android ios publishing unity mathematics c++ 2d xna unity unity c++ iphone c++ networking android flash opengl game-loop unity xna sdl 2d gpu collision-detection unity unity unity xna java java libgdx unity libgdx xna animation performance 3d opengl mathematics unity php 2d unity android scene unity unity physics unity opengl animation c++ 2d android libgdx textures unity unity unity android c# sprites textures unity javascript unity unity hardware unity game-design c# unity software-rendering unity unity sdl unity raycasting unity graphics mathematics 3d c++ path-finding textures game-maker models rts libgdx unity textures xna unity c# c++ ios intersection client-server physics javascript models java shaders skeletal-animation opengl android java component-based unity publishing rendering javascript java collision-detection unity mathematics c# unity unity c++ performance xna accessibility unity opengl tilemap game-maker xna directx11 unity libgdx xna c++ collision-detection opengl 3d algorithm xna java direct3d12 javascript c# c++ java c++ javascript java android unity architecture file-format objects c# libgdx software-engineering unity java xna game-maker unity architecture mmo c# shaders directx11 unity javascript libgdx c++ rotation unity mathematics unity animation opengl networking c# javascript databases game-design xna 3d shaders libgdx unity c++ career opengl image unity iphone opengl animation unity mathematics c# xna c# collision-detection unity unity game-maker isometric javascript box2d unity networking unity unity textures unity game-mechanics c++ multiplayer java c++ c# rendering unity unity 3d unity ios steam xna unity unity unity opengl unity xna unity java textures javascript godot xna xna color unity mathematics c++ c++ architecture c++ collision-detection android game-design cocos2d textures level-design unity models unity unity career c++ unity iphone unity steam 2d unity unity opengl animation directx11 unity unity glsl unity tilemap android path-finding libgdx unity c++ xna unity unity unity coordinates libgdx c++ c++ xna unity iphone java ruby c shaders cocos2d-iphone unity unity 2d tiles path-finding rendering android unity unity c# c++ directx10 unity rendering camera xna 2d ios unity sound-effects libgdx mmo animation collision-detection c++ teaching opengl unity opengl libgdx c# iphone unity java unity unity 3d unity c++ java publishing unity architecture unity directx9 c++ unity ai c++ unity directx11 3d-meshes google-play android image c# android unity unity mathematics c++ shaders android opengl architecture opengl c# unity mobile xna unity modding memory-efficiency unity networking testing unity textures unity physics collision-detection directx camera unity unity unreal-4 unity c# unreal unity spritekit level-design algorithm iphone python sprites steering-behaviors networking unity unity xna xna textures path-finding networking android c++ directx11 xna game-design mathematics c++ c# java minecraft-modding leaderboards 2d xna c# 2d libgdx c++ unity unity 3d javascript 3d physics xna hardware opengl xna flash c# 2d c# collision-detection 2d c++ collision-detection 2d unreal unity entity-system javascript c++ unity 2d 2d xna unity collision-detection physics c++ android c# unity shaders movement unity unity 2d xna directx11 c# java game-design xna level-design physics xna unity unity c# architecture glsl android map-editor gui unity textures directx mmo unreal-4 unity unity opengl collision-detection adventure-games 2d networking game-design playn networking xna mathematics python performance xna c# opengl unity unity mathematics maya opengl unity physics c++ c++ webgl c++ opengl xna xna opengl-es2 c++ xna shaders mathematics unity xna rpg opengl box2d 2d xna opengl unity 3d physics online game-design unity camera unity xna game-loop sprites gpu physics collision-detection unity c++ javascript game-maker c++ unity libgdx opengl networking c# 2d opengl 3d libgdx unity flash steam unity path-finding rendering javascript ai multiplayer unity unity unity actionscript-3 2d collision-detection java unity unity savegame java unity lua javascript libgdx java rendering networking game-design 3d 2d java c++ mathematics unity unity shaders java libgdx xna unity c++ mathematics architecture physics xna tilemap xna path-finding unity 3d performance terminology modelling-techniques ios 2d unity java assembly c# sdl flash libgdx 3d algorithm unity 2d xna monogame c# c++ java javascript deployment unity 2d collision-detection unity copyright unity game-design mathematics opengl unity java unity geometry open-source unity opengl java roblox opengl c++ android glsl game-maker java java unity vector c++ xna business game-design mathematics jobs c++ xna unity 3d xna android java modding unity unity unity andengine unity opengl unity unity statistics opengl collision-detection unity unity unity unity c# xna opengl c# unity box2d xna c++ java unity textures 2d c# legal ios physics godot libgdx unity opengl opengl ai godot 3d unity opengl game-design unity shaders unity c++ physics unity ios cocos2d-x unity game-design unity javascript directinput unity physics c++ opengl c# opengl interactive-fiction c++ unity waypoints unity unity architecture unity unity 3d unity 3d unity c# unity c++ opengl java collision-detection unity xna unity tools opengl java java c# 3d algorithm java audio animation 3d html5 game-design 2d algorithm path-finding c++ algorithm unity unity xna c# rotation unreal-4 c# flash matrix opengl unity unity unity unity unity path-finding unity directx opengl c++ libgdx graphics game-design architecture c# 2d unity level-design unity c++ opengl unity mathematics unity unity c++ box2d c# legal transformation xna xna opengl c# opengl software-engineering c++ architecture c++ blender path-finding c# unreal-4 game-design c# c# android unity html5 unity c++ 3d-meshes game-design xna unity xna c++ input unity collision-detection flash opengl android andengine unreal-4 ai iphone path-finding architecture unity c++ unity hlsl lwjgl particles mathematics javascript game-design xna unity c# libgdx unity c# unreal-4 pc c# 3d textures 3d unity xna unity networking xna mathematics sprites networking opengl rotation java unity unity unity unity rigidbody unity networking xna 3d unity 2d c++ data-driven unity opengl difficulty unity textures mathematics c++ android mathematics unity javascript unity xna textures c++ unity c# 2d xna unity android 3d unity c# android 3d-meshes movement opengl unity unity html5 sketchup collision-detection architecture java unity android effect unity textures terrain c# flash unity libgdx opengl vulkan rendering collision-detection unreal-4 normal-mapping physics c++ architecture xna libgdx c# java unity xna-4.0 java xna unity libgdx software-engineering xna-4.0 entity-system animation movement unity android rendering game-mechanics models c++ game-maker unity optimization python ai textures xna path-finding 2d opengl android opengl opengl shaders textures collision-detection android game-design unity unity unity unity collision-detection unity networking graphics physics unity architecture ios collision-detection unity opengl 3d unity mathematics unity path-finding c# opengl java unity unity unity textures opengl opengl hlsl c++ opengl graphics unity unity unity java game-design xna c++ unity opengl java box2d xna unity software-engineering libgdx multiplayer methodology xna multiplayer geometry c++ debugging legal unity puzzle android unity opengl unity legal marketing directx11 xna unity ai libgdx unity algorithm textures c++ game-design unity unity unity collision-detection camera unity android opengl c++ ai architecture opengl opengl opengl xna unity ipad unity textures 2d godot 2d algorithm unity opengl-es 3dsmax tiles 2d unity procedural-generation unity unity physics xna unity directx opengl opengl unity opengl c++ game-design directx legal camera skybox rendering movement c# android 2d libgdx mathematics minecraft-modding c++ glsl c++ unity tiles xna ios c++ marching-cubes ios mathematics directx unity unity unity 3d iphone opengl-es2 portals opengl c# xna-4.0 skeletal-animation java c# 3d c++ c# xna javascript xna java game-maker networking java gpu c# java python c++ algorithm physics c# rts macos javascript java c# java c++ unity c# 3d xna unity opengl unity scene-graph java gui opengl c# rendering gui opengl xna game-design textures mmo unity unity c# xna transformation unity mathematics unity c++ unreal-4 cocos2d-iphone unity mmo libgdx c++ mathematics unity unity ai software-engineering python unity 2d game-design animation 2d c# unity unity opengl entity-system unity unity opengl c# unity android networking c++ java behavior-tree graphics unity game-design java camera android physics opengl sdl android debugging xna opengl graphics opengl directx11 c# android unity 2d pygame architecture opengl unity unity unity unity c++ rendering graphics unity 3d c++ xna javascript ios c# unity 3dsmax opengl unity unity unity directx java assets unity opengl 3d-meshes c++ unity unity game-design graphics graphics animation c++ udk game-maker unity unity opengl godot unity unity python career directx11 physics javascript game-design iphone camera unity multiplayer c++ unity multiplayer opengl opengl-es c++ unity unity mathematics java java models cocos2d-iphone unity opengl procedural-generation unity unity collision-detection algorithm javascript unity unity game-maker-studio-2 opengl unity xna xna unity libgdx xna java unity unity unity shaders geometry unity architecture quake3 mathematics ios game-maker unity unity unity c# models opengl c# input opengl hlsl physics mathematics unity 3d shaders libgdx unity transformation xna unity unity data-structure unity android opengl javascript unity java unity mathematics java c# game-design unity opengl opengl voice unity xna textures sdl unity unity actionscript-3 javascript android 2d unity opengl mathematics 2d collision-detection unity algorithm rendering architecture opengl c++ camera collision-detection game-design game-design opengl android unity c# hlsl optimization unity legal 3dsmax c++ unity unity unity 2d java unity ai opengl unity multithreading game-design game-design java 2d c++ resource-management unity unity collision-detection 3d c# unity maps 3d opengl directx9 unity unity xna deployment camera libgdx opengl unity opengl java terminology opengl grid unity unity c++ unity unity unity java textures unity c# c++ java shaders unity c++ mathematics procedural-generation game-design javascript unity input unity 3d java unity unity java game-design unity graphics unity sdl2 directx9 2d unity unity unity opengl unity 2d java opengl directx11 java xna animation unity collision-detection unity xna java unity unity opengl xna physics game-design unity android shading java libgdx monetization performance c++ unity graphics unity unity unity c++ opengl unity movement c++ game-design unity 3d unity libgdx c# 3d windows-forms networking 3d xna libgdx java unity xna project-management unity tiles android game-maker directx multiplayer unity 2d unity c++ unity c++ unity 2d opengl unity c# c++ directx python unity unity 2d opengl python unity fsm c++ path-finding entity-component-system unity 2d game-design c++ xna textures legal unity shaders android unity unity animation c++ xna collision-detection opengl hdr culling unity unity c++ c++ opengl unity ios c++ unity unity legal unity libgdx libgdx opengl geometry c# unity unity xna python php physics 2d sound unity mathematics fsm unity game-design unity level-of-detail unity opengl c++ unity java unity andengine procedural-generation c# mathematics 2d java unity lwjgl physics unity libgdx xna unity glsl unity game-design 2d cocos2d-x opengl c++ xna flash unity terrain-rendering game-design unity libgdx opengl 2d c# javascript unity c# c# unity textures physics hlsl performance cocos2d-iphone 2d libgdx collision-detection graphic-effects xna unity unity mathematics 3d c# shaders python unity c# unity shaders shaders unity java game-design opengl textures libgdx java unity performance 3d unreal sprites physics sprites opengl unity unity rendering voxels sound java android browser-based-games unity unity unity hlsl collision-detection libgdx java andengine opengl unity unity xna game-design java unreal-4 c++ input 2d spritekit unity opengl sprites xna 2d java c++ box2d xna unity sdl sprites directx c# java mathematics libgdx cocos2d-iphone java facebook animation c# android android unity unity ai 2d xna game-design opengl 2d opengl unity unity ai android udk hlsl opengl unity c# 3d lighting opengl-es algorithm unity opengl-es unity c# unity unity c++ c++ algorithm mathematics java unity directx unity unity camera game-industry corona-sdk unity collision-detection java unity iphone java unity unity unity unity algorithm opengl unity unity java unity android java resolution mmo tilemap c# camera architecture unreal-4 scripting mathematics unity unity opengl mathematics mathematics opengl 2d architecture animation unity xna software-engineering cocos2d-iphone unity architecture unity 2d architecture xna 2d java javascript java physics opengl unity unreal-4 physics procedural-generation unity c++ game-design ios xna ios unity unity 2d directx11 unity xna unity path-finding webgl opengl c# unity xna flash 3d-meshes unreal-4 unity xna game-maker marketing unity opengl javascript opengl server unity collision-resolution c# java unity c++ 3d c++ libgdx game-design xna algorithm unity architecture mathematics unity unity opengl unity microsoft flash animation c# cocos2d-iphone unity maya mathematics unity procedural-generation java ios unity java c# sfml 3d camera physics c# optimization c++ unity opengl c java game-design c++ unity xna vector logic blender unity entity-system entity-system architecture c# c# opengl 2d libgdx java java flash opengl game-design isometric c# c++ c# terrain unity c# unity unity unity sprites c# unity unity movement c++ c# c++ unity opengl rendering tiles opengl c++ opengl game-design opengl sprites physics-engine opengl shaders android architecture android directx11 xna unity java android xna xna java xna 2d unity procedural-generation iphone 2d unity opengl analytics unity corona-sdk game-design steam minecraft-modding directx ai c# assets java godot unity flash voxels game-design graphics shaders unity c++ publishing ai unity mathematics unity libgdx opengl unity unity unity c++ unity c++ unity ios c++ physics 2d libgdx c++ unity unity unity textures console savegame box2d unity java c# game-design unity unity xna c++ c# unity 3d c++ unity 3d-meshes multiplayer procedural-generation android c# tower-defense unity unity ios design-patterns udk c# c# c++ unity box2d unity unity c++ unity windows shaders mathematics unity unity game-design opengl unity unity networking java ai software-engineering udk c++ xna unity xna unity multithreading multiplayer unity lua java 2d textures mathematics game-loop xna xna xna unity collision-detection java unity java xna 3d-meshes unity unity 3d xna open-source unity opengl opengl textures rendering unity development-speed xna game-design unreal-4 2d physics opengl xna-4.0 2d xna geometry unity unity installer xna 3d html5 architecture 2d textures 2d unity xna collision-detection input xna java xna java mathematics lua unity cocos2d-iphone xna unreal-4 2d c++ collision-detection c# java lighting mathematics unity java unity python unity lighting unity unity unity camera unity architecture xna box2d maya c# mathematics blender flash mathematics architecture camera c# opengl c++ 2d directx java xna textures performance-budgeting c++ objective-c xna animation tiles unity unity ai windows steam unity unity xna java unity ogre libgdx 2d java 2d camera unity unity c++ unity xna physics java unity sprites collision-detection java unity c# c++ unity android unity javascript webgl c++ xna-4.0 unity collision-detection game-design java c++ directx opengl unity opengl unity algorithm xna unity c# shaders blender unity opengl unity mmo xna 3dsmax marketing android flash unity unity c++ unity movement unity xna 2d minecraft-modding unity unity performance architecture xna shaders ios animation unity mmo libgdx unity collision-detection animation xna 2d voxels animation unity opengl opengl cocos2d-iphone game-design iphone game-design legal unity c++ architecture mathematics opengl xna xna ios java unity unity game-recording xna 3d android c++ unity java java java java 3d unity 2d sprites opengl unity unity opengl procedural-generation input 3d unity unity opengl procedural-generation game-design java libgdx unity terminology unity unity c# shaders compression unity unity c++ c++ online android xna xna unity 2d opengl javascript unity unity c++ ai c# copyright unity architecture xna shaders unity shaders unity opengl c# unity iphone unity c# opengl android opengl game-design ai android android xna c# c++ unity opengl xna javascript collision-detection libgdx fragment-shader c++ unity unreal-4 unity java unity c++ java unity java javascript networking algorithm xna unity game-mechanics 2d unity 2d mathematics libgdx unity 2d opengl unity sfml unity javascript java unity shaders opengl 2d copyright collision-detection ios 3d java unity algorithm performance opengl android html5 java c++ java unity maps rendering 2d 3d 2d camera c# unity unity unity audio unity camera c++ opengl opengl image unity minecraft-modding c++ xna libgdx databases unity xna unity java c# c++ unity 2d architecture xna collision-resolution unreal-4 c++ game-design unity unity opengl c++ 2d c# opengl game-design unity unity marketing collision-detection unity java unity unity unity java libgdx input physics c# platform opengl c++ 2d c++ 3d box2d mathematics java opengl unity unity gui trademark unity xna unity c++ unity architecture sprites c# java opengl xna text node.js unity opengl graphics opengl c++ c# game-design architecture java xna savegame unity 2d java opengl-es2 java unity java java c++ unity animation 3d farseer-physics-engine 3d xna unity actionscript unity c++ windows unity physics 3d c++ javascript software-engineering java iphone c# unity java android pygame java 2d unity graphics-programming opengl c++ trigonometry mathematics android c# c# opengl java unity algorithm game-design java octree animation efficiency unity unity sharpdx c++ shaders unity tiles modding ogre unity opengl android unity unity models unity java 2d directx9 curves marketing unity unity unity opengl java c++ xna unity java c++ unity unity algorithm collision-detection unity networking opengl path-finding terminology box2d java physics unity java unity c# java unity unity unity unity flash box2d textures 2d c++ hammer directx unity game-design java android multiplayer unity unity path-finding unity unity unity java java c++ java unity architecture unity unity mathematics c# ios xna unity gpu ai multithreading android legal assets shaders 2d game-design unity multiplayer unity opengl java libgdx data-structure input opengl unity c++ c# unity unity c++ unity software-engineering architecture algorithm ai unity software-engineering tools java quaternion unity c++ c# xna 3d c# xna unity javascript opengl simulations box2d c# c++ c# unity physics game-design unity game-design hlsl c# game-design opengl xna rpg networking tilemap unity strategy legal java 3d unity unity procedural-generation unity unity networking mathematics unity unity unity opengl algorithm unity xna c# c++ opengl c# opengl maps opengl unity game-design opengl maps opengl xna opengl procedural-generation opengl c++ java path-finding animation level-design textures terminology c++ 2d networking unity xna unreal-4 physics sprites c# shaders mathematics procedural-generation unity 3d android c# unity c++ collision-detection graphics-programming javascript unity